@friggframework/devtools 2.0.0-next.29 → 2.0.0-next.30

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 B1(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 Gx(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Yx={exports:{}},vl={},Xx={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"),W1=Symbol.for("react.portal"),H1=Symbol.for("react.fragment"),q1=Symbol.for("react.strict_mode"),K1=Symbol.for("react.profiler"),G1=Symbol.for("react.provider"),Y1=Symbol.for("react.context"),X1=Symbol.for("react.forward_ref"),Q1=Symbol.for("react.suspense"),J1=Symbol.for("react.memo"),Z1=Symbol.for("react.lazy"),hh=Symbol.iterator;function eN(e){return e===null||typeof e!="object"?null:(e=hh&&e[hh]||e["@@iterator"],typeof e=="function"?e:null)}var Qx={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Jx=Object.assign,Zx={};function Tr(e,t,n){this.props=e,this.context=t,this.refs=Zx,this.updater=n||Qx}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 e0(){}e0.prototype=Tr.prototype;function tf(e,t,n){this.props=e,this.context=t,this.refs=Zx,this.updater=n||Qx}var nf=tf.prototype=new e0;nf.constructor=tf;Jx(nf,Tr.prototype);nf.isPureReactComponent=!0;var ph=Array.isArray,t0=Object.prototype.hasOwnProperty,sf={current:null},n0={key:!0,ref:!0,__self:!0,__source:!0};function s0(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)t0.call(t,s)&&!n0.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:sf.current}}function tN(e,t){return{$$typeof:io,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function rf(e){return typeof e=="object"&&e!==null&&e.$$typeof===io}function nN(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?nN(""+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 W1: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&&(rf(i)&&(i=tN(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=eN(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 ko(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 sN(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},rN={ReactCurrentDispatcher:Ge,ReactCurrentBatchConfig:ra,ReactCurrentOwner:sf};function r0(){throw Error("act(...) is not supported in production builds of React.")}te.Children={map:ko,forEach:function(e,t,n){ko(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return ko(e,function(){t++}),t},toArray:function(e){return ko(e,function(t){return t})||[]},only:function(e){if(!rf(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};te.Component=Tr;te.Fragment=H1;te.Profiler=K1;te.PureComponent=tf;te.StrictMode=q1;te.Suspense=Q1;te.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=rN;te.act=r0;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=Jx({},e.props),i=e.key,o=e.ref,a=e._owner;if(t!=null){if(t.ref!==void 0&&(o=t.ref,a=sf.current),t.key!==void 0&&(i=""+t.key),e.type&&e.type.defaultProps)var l=e.type.defaultProps;for(c in t)t0.call(t,c)&&!n0.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:Y1,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:G1,_context:e},e.Consumer=e};te.createElement=s0;te.createFactory=function(e){var t=s0.bind(null,e);return t.type=e,t};te.createRef=function(){return{current:null}};te.forwardRef=function(e){return{$$typeof:X1,render:e}};te.isValidElement=rf;te.lazy=function(e){return{$$typeof:Z1,_payload:{_status:-1,_result:e},_init:sN}};te.memo=function(e,t){return{$$typeof:J1,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=r0;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";Xx.exports=te;var g=Xx.exports;const We=Gx(g),of=B1({__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 iN=g,oN=Symbol.for("react.element"),aN=Symbol.for("react.fragment"),lN=Object.prototype.hasOwnProperty,cN=iN.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,uN={key:!0,ref:!0,__self:!0,__source:!0};function i0(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)lN.call(t,s)&&!uN.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:oN,type:e,key:o,ref:a,props:i,_owner:cN.current}}vl.Fragment=aN;vl.jsx=i0;vl.jsxs=i0;Yx.exports=vl;var r=Yx.exports,fu={},o0={exports:{}},gt={},a0={exports:{}},l0={};/**
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 V=D-1>>>1,K=R[V];if(0<i(K,I))R[V]=I,R[D]=K,D=V;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 V=0,K=R.length,se=K>>>1;V<se;){var ve=2*(V+1)-1,yt=R[ve],Pe=ve+1,Le=R[Pe];if(0>i(yt,D))Pe<K&&0>i(Le,yt)?(R[V]=Le,R[Pe]=D,V=Pe):(R[V]=yt,R[ve]=D,V=ve);else if(Pe<K&&0>i(Le,D))R[V]=Le,R[Pe]=D,V=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,m=3,b=!1,j=!1,v=!1,p=typeof setTimeout=="function"?setTimeout:null,h=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,h(T),T=-1),b=!0;var D=m;try{for(y(I),f=n(c);f!==null&&(!(f.expirationTime>I)||R&&!A());){var V=f.callback;if(typeof V=="function"){f.callback=null,m=f.priorityLevel;var K=V(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,m=D,b=!1}}var C=!1,E=null,T=-1,N=5,k=-1;function A(){return!(e.unstable_now()-k<N)}function P(){if(E!==null){var R=e.unstable_now();k=R;var I=!0;try{I=E(!0,R)}finally{I?_():(C=!1,E=null)}}else C=!1}var _;if(typeof x=="function")_=function(){x(P)};else if(typeof MessageChannel<"u"){var M=new MessageChannel,O=M.port2;M.port1.onmessage=P,_=function(){O.postMessage(null)}}else _=function(){p(P,0)};function F(R){E=R,C||(C=!0,_())}function $(R,I){T=p(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 m},e.unstable_getFirstCallbackNode=function(){return n(c)},e.unstable_next=function(R){switch(m){case 1:case 2:case 3:var I=3;break;default:I=m}var D=m;m=I;try{return R()}finally{m=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=m;m=R;try{return I()}finally{m=D}},e.unstable_scheduleCallback=function(R,I,D){var V=e.unstable_now();switch(typeof D=="object"&&D!==null?(D=D.delay,D=typeof D=="number"&&0<D?V+D:V):D=V,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>V?(R.sortIndex=D,t(u,R),n(c)===null&&R===n(u)&&(v?(h(T),T=-1):v=!0,$(w,D-V))):(R.sortIndex=K,t(c,R),j||b||(j=!0,F(S))),R},e.unstable_shouldYield=A,e.unstable_wrapCallback=function(R){var I=m;return function(){var D=m;m=I;try{return R.apply(this,arguments)}finally{m=D}}}})(l0);a0.exports=l0;var dN=a0.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 fN=g,pt=dN;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 c0=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++)c0.add(t[e])}var xn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),mu=Object.prototype.hasOwnProperty,mN=/^[: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 hN(e){return mu.call(yh,e)?!0:mu.call(xh,e)?!1:mN.test(e)?yh[e]=!0:(xh[e]=!0,!1)}function pN(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 gN(e,t,n,s){if(t===null||typeof t>"u"||pN(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 af=/[\-:]([a-z])/g;function lf(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(af,lf);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(af,lf);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(af,lf);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 cf(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")&&(gN(t,n,i,s)&&(n=null),s||i===null?hN(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 kn=fN.__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"),uf=Symbol.for("react.strict_mode"),hu=Symbol.for("react.profiler"),u0=Symbol.for("react.provider"),d0=Symbol.for("react.context"),df=Symbol.for("react.forward_ref"),pu=Symbol.for("react.suspense"),gu=Symbol.for("react.suspense_list"),ff=Symbol.for("react.memo"),On=Symbol.for("react.lazy"),f0=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 xN(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 xu(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 hu:return"Profiler";case uf:return"StrictMode";case pu:return"Suspense";case gu:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case d0:return(e.displayName||"Context")+".Consumer";case u0:return(e._context.displayName||"Context")+".Provider";case df:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ff:return t=e.displayName||null,t!==null?t:xu(e.type)||"Memo";case On:t=e._payload,e=e._init;try{return xu(e(t))}catch{}}return null}function yN(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 xu(t);case 8:return t===uf?"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 m0(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function vN(e){var t=m0(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=vN(e))}function h0(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),s="";return e&&(s=m0(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 yu(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 p0(e,t){t=t.checked,t!=null&&cf(e,"checked",t,!1)}function vu(e,t){p0(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")?bu(e,t.type,n):t.hasOwnProperty("defaultValue")&&bu(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 bu(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 wu(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 g0(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 x0(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 ju(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?x0(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var Ro,y0=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},bN=["Webkit","ms","Moz","O"];Object.keys(ui).forEach(function(e){bN.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),ui[t]=ui[e]})});function v0(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 b0(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var s=n.indexOf("--")===0,i=v0(n,t[n],s);n==="float"&&(n="cssFloat"),s?e.setProperty(n,i):e[n]=i}}var wN=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 Nu(e,t){if(t){if(wN[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 Su(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 Cu=null;function mf(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Eu=null,cr=null,ur=null;function Sh(e){if(e=lo(e)){if(typeof Eu!="function")throw Error(U(280));var t=e.stateNode;t&&(t=Sl(t),Eu(e.stateNode,e.type,t))}}function w0(e){cr?ur?ur.push(e):ur=[e]:cr=e}function j0(){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 N0(e,t){return e(t)}function S0(){}var cc=!1;function C0(e,t,n){if(cc)return e(t,n);cc=!0;try{return N0(e,t,n)}finally{cc=!1,(cr!==null||ur!==null)&&(S0(),j0())}}function Ei(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 jN(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,_a=null,Ma=!1,Tu=null,NN={onError:function(e){di=!0,_a=e}};function SN(e,t,n,s,i,o,a,l,c){di=!1,_a=null,jN.apply(NN,arguments)}function CN(e,t,n,s,i,o,a,l,c){if(SN.apply(this,arguments),di){if(di){var u=_a;di=!1,_a=null}else throw Error(U(198));Ma||(Ma=!0,Tu=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 E0(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 EN(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 k0(e){return e=EN(e),e!==null?T0(e):null}function T0(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=T0(e);if(t!==null)return t;e=e.sibling}return null}var A0=pt.unstable_scheduleCallback,Eh=pt.unstable_cancelCallback,kN=pt.unstable_shouldYield,TN=pt.unstable_requestPaint,we=pt.unstable_now,AN=pt.unstable_getCurrentPriorityLevel,hf=pt.unstable_ImmediatePriority,R0=pt.unstable_UserBlockingPriority,Ia=pt.unstable_NormalPriority,RN=pt.unstable_LowPriority,P0=pt.unstable_IdlePriority,bl=null,Qt=null;function PN(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:IN,_N=Math.log,MN=Math.LN2;function IN(e){return e>>>=0,e===0?32:31-(_N(e)/MN|0)|0}var Po=64,_o=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 ON(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 LN(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]=ON(l,t)):c<=t&&(e.expiredLanes|=l),o&=~l}}function Au(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function _0(){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 DN(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 pf(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 M0(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var I0,gf,O0,L0,D0,Ru=!1,Mo=[],zn=null,Bn=null,Wn=null,ki=new Map,Ti=new Map,Dn=[],FN="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 kh(e,t){switch(e){case"focusin":case"focusout":zn=null;break;case"dragenter":case"dragleave":Bn=null;break;case"mouseover":case"mouseout":Wn=null;break;case"pointerover":case"pointerout":ki.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&&gf(t)),e):(e.eventSystemFlags|=s,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function $N(e,t,n,s,i){switch(t){case"focusin":return zn=Hr(zn,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 ki.set(o,Hr(ki.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 F0(e){var t=xs(e.target);if(t!==null){var n=Ls(t);if(n!==null){if(t=n.tag,t===13){if(t=E0(n),t!==null){e.blockedOn=t,D0(e.priority,function(){O0(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=Pu(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var s=new n.constructor(n.type,n);Cu=s,n.target.dispatchEvent(s),Cu=null}else return t=lo(n),t!==null&&gf(t),e.blockedOn=n,!1;t.shift()}return!0}function Th(e,t,n){ia(e)&&n.delete(t)}function UN(){Ru=!1,zn!==null&&ia(zn)&&(zn=null),Bn!==null&&ia(Bn)&&(Bn=null),Wn!==null&&ia(Wn)&&(Wn=null),ki.forEach(Th),Ti.forEach(Th)}function qr(e,t){e.blockedOn===t&&(e.blockedOn=null,Ru||(Ru=!0,pt.unstable_scheduleCallback(pt.unstable_NormalPriority,UN)))}function Ai(e){function t(i){return qr(i,e)}if(0<Mo.length){qr(Mo[0],e);for(var n=1;n<Mo.length;n++){var s=Mo[n];s.blockedOn===e&&(s.blockedOn=null)}}for(zn!==null&&qr(zn,e),Bn!==null&&qr(Bn,e),Wn!==null&&qr(Wn,e),ki.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);)F0(n),n.blockedOn===null&&Dn.shift()}var dr=kn.ReactCurrentBatchConfig,La=!0;function VN(e,t,n,s){var i=oe,o=dr.transition;dr.transition=null;try{oe=1,xf(e,t,n,s)}finally{oe=i,dr.transition=o}}function zN(e,t,n,s){var i=oe,o=dr.transition;dr.transition=null;try{oe=4,xf(e,t,n,s)}finally{oe=i,dr.transition=o}}function xf(e,t,n,s){if(La){var i=Pu(e,t,n,s);if(i===null)bc(e,t,s,Da,n),kh(e,s);else if($N(i,e,t,n,s))s.stopPropagation();else if(kh(e,s),t&4&&-1<FN.indexOf(e)){for(;i!==null;){var o=lo(i);if(o!==null&&I0(o),o=Pu(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 Pu(e,t,n,s){if(Da=null,e=mf(s),e=xs(e),e!==null)if(t=Ls(e),t===null)e=null;else if(n=t.tag,n===13){if(e=E0(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 $0(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(AN()){case hf:return 1;case R0:return 4;case Ia:case RN:return 16;case P0:return 536870912;default:return 16}default:return 16}}var $n=null,yf=null,oa=null;function U0(){if(oa)return oa;var e,t=yf,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},vf=xt(Ar),ao=ge({},Ar,{view:0,detail:0}),BN=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:bf,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),WN=ge({},wl,{dataTransfer:0}),HN=xt(WN),qN=ge({},ao,{relatedTarget:0}),mc=xt(qN),KN=ge({},Ar,{animationName:0,elapsedTime:0,pseudoElement:0}),GN=xt(KN),YN=ge({},Ar,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),XN=xt(YN),QN=ge({},Ar,{data:0}),Ph=xt(QN),JN={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},ZN={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"},e2={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function t2(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=e2[e])?!!t[e]:!1}function bf(){return t2}var n2=ge({},ao,{key:function(e){if(e.key){var t=JN[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"?ZN[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:bf,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}}),s2=xt(n2),r2=ge({},wl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),_h=xt(r2),i2=ge({},ao,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:bf}),o2=xt(i2),a2=ge({},Ar,{propertyName:0,elapsedTime:0,pseudoElement:0}),l2=xt(a2),c2=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}),u2=xt(c2),d2=[9,13,27,32],wf=xn&&"CompositionEvent"in window,fi=null;xn&&"documentMode"in document&&(fi=document.documentMode);var f2=xn&&"TextEvent"in window&&!fi,V0=xn&&(!wf||fi&&8<fi&&11>=fi),Mh=" ",Ih=!1;function z0(e,t){switch(e){case"keyup":return d2.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function B0(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Ks=!1;function m2(e,t){switch(e){case"compositionend":return B0(t);case"keypress":return t.which!==32?null:(Ih=!0,Mh);case"textInput":return e=t.data,e===Mh&&Ih?null:e;default:return null}}function h2(e,t){if(Ks)return e==="compositionend"||!wf&&z0(e,t)?(e=U0(),oa=yf=$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 V0&&t.locale!=="ko"?null:t.data;default:return null}}var p2={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"?!!p2[e.type]:t==="textarea"}function W0(e,t,n,s){w0(s),t=Fa(t,"onChange"),0<t.length&&(n=new vf("onChange","change",null,n,s),e.push({event:n,listeners:t}))}var mi=null,Ri=null;function g2(e){ty(e,0)}function jl(e){var t=Xs(e);if(h0(t))return e}function x2(e,t){if(e==="change")return t}var H0=!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;H0=hc&&(!document.documentMode||9<document.documentMode)}function Dh(){mi&&(mi.detachEvent("onpropertychange",q0),Ri=mi=null)}function q0(e){if(e.propertyName==="value"&&jl(Ri)){var t=[];W0(t,Ri,e,mf(e)),C0(g2,t)}}function y2(e,t,n){e==="focusin"?(Dh(),mi=t,Ri=n,mi.attachEvent("onpropertychange",q0)):e==="focusout"&&Dh()}function v2(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return jl(Ri)}function b2(e,t){if(e==="click")return jl(t)}function w2(e,t){if(e==="input"||e==="change")return jl(t)}function j2(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Vt=typeof Object.is=="function"?Object.is:j2;function Pi(e,t){if(Vt(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(!mu.call(t,i)||!Vt(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 K0(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?K0(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function G0(){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 jf(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 N2(e){var t=G0(),n=e.focusedElem,s=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&K0(n.ownerDocument.documentElement,n)){if(s!==null&&jf(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 S2=xn&&"documentMode"in document&&11>=document.documentMode,Gs=null,_u=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&&jf(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(_u,"onSelect"),0<s.length&&(t=new vf("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={},Y0={};xn&&(Y0=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 Y0)return gc[e]=t[n];return e}var X0=Nl("animationend"),Q0=Nl("animationiteration"),J0=Nl("animationstart"),Z0=Nl("transitionend"),ey=new Map,Vh="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){ey.set(e,t),Os(t,[e])}for(var xc=0;xc<Vh.length;xc++){var yc=Vh[xc],C2=yc.toLowerCase(),E2=yc[0].toUpperCase()+yc.slice(1);is(C2,"on"+E2)}is(X0,"onAnimationEnd");is(Q0,"onAnimationIteration");is(J0,"onAnimationStart");is("dblclick","onDoubleClick");is("focusin","onFocus");is("focusout","onBlur");is(Z0,"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(" "),k2=new Set("cancel close invalid load scroll toggle".split(" ").concat(ii));function zh(e,t,n){var s=e.type||"unknown-event";e.currentTarget=n,CN(s,t,void 0,e),e.currentTarget=null}function ty(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;zh(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;zh(i,l,u),o=c}}}if(Ma)throw e=Tu,Ma=!1,Tu=null,e}function ce(e,t){var n=t[Fu];n===void 0&&(n=t[Fu]=new Set);var s=e+"__bubble";n.has(s)||(ny(t,e,2,!1),n.add(s))}function vc(e,t,n){var s=0;t&&(s|=4),ny(n,e,s,t)}var Lo="_reactListening"+Math.random().toString(36).slice(2);function _i(e){if(!e[Lo]){e[Lo]=!0,c0.forEach(function(n){n!=="selectionchange"&&(k2.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 ny(e,t,n,s){switch($0(t)){case 1:var i=VN;break;case 4:i=zN;break;default:i=xf}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}C0(function(){var u=o,d=mf(n),f=[];e:{var m=ey.get(e);if(m!==void 0){var b=vf,j=e;switch(e){case"keypress":if(aa(n)===0)break e;case"keydown":case"keyup":b=s2;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=HN;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":b=o2;break;case X0:case Q0:case J0:b=GN;break;case Z0:b=l2;break;case"scroll":b=BN;break;case"wheel":b=u2;break;case"copy":case"cut":case"paste":b=XN;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":b=_h}var v=(t&4)!==0,p=!v&&e==="scroll",h=v?m!==null?m+"Capture":null:m;v=[];for(var x=u,y;x!==null;){y=x;var w=y.stateNode;if(y.tag===5&&w!==null&&(y=w,h!==null&&(w=Ei(x,h),w!=null&&v.push(Mi(x,w,y)))),p)break;x=x.return}0<v.length&&(m=new b(m,j,null,n,d),f.push({event:m,listeners:v}))}}if(!(t&7)){e:{if(m=e==="mouseover"||e==="pointerover",b=e==="mouseout"||e==="pointerout",m&&n!==Cu&&(j=n.relatedTarget||n.fromElement)&&(xs(j)||j[yn]))break e;if((b||m)&&(m=d.window===d?d:(m=d.ownerDocument)?m.defaultView||m.parentWindow:window,b?(j=n.relatedTarget||n.toElement,b=u,j=j?xs(j):null,j!==null&&(p=Ls(j),j!==p||j.tag!==5&&j.tag!==6)&&(j=null)):(b=null,j=u),b!==j)){if(v=Rh,w="onMouseLeave",h="onMouseEnter",x="mouse",(e==="pointerout"||e==="pointerover")&&(v=_h,w="onPointerLeave",h="onPointerEnter",x="pointer"),p=b==null?m:Xs(b),y=j==null?m:Xs(j),m=new v(w,x+"leave",b,n,d),m.target=p,m.relatedTarget=y,w=null,xs(d)===u&&(v=new v(h,x+"enter",j,n,d),v.target=y,v.relatedTarget=p,w=v),p=w,b&&j)t:{for(v=b,h=j,x=0,y=v;y;y=Us(y))x++;for(y=0,w=h;w;w=Us(w))y++;for(;0<x-y;)v=Us(v),x--;for(;0<y-x;)h=Us(h),y--;for(;x--;){if(v===h||h!==null&&v===h.alternate)break t;v=Us(v),h=Us(h)}v=null}else v=null;b!==null&&Bh(f,m,b,v,!1),j!==null&&p!==null&&Bh(f,p,j,v,!0)}}e:{if(m=u?Xs(u):window,b=m.nodeName&&m.nodeName.toLowerCase(),b==="select"||b==="input"&&m.type==="file")var S=x2;else if(Oh(m))if(H0)S=w2;else{S=v2;var C=y2}else(b=m.nodeName)&&b.toLowerCase()==="input"&&(m.type==="checkbox"||m.type==="radio")&&(S=b2);if(S&&(S=S(e,u))){W0(f,S,n,d);break e}C&&C(e,m,u),e==="focusout"&&(C=m._wrapperState)&&C.controlled&&m.type==="number"&&bu(m,"number",m.value)}switch(C=u?Xs(u):window,e){case"focusin":(Oh(C)||C.contentEditable==="true")&&(Gs=C,_u=u,hi=null);break;case"focusout":hi=_u=Gs=null;break;case"mousedown":Mu=!0;break;case"contextmenu":case"mouseup":case"dragend":Mu=!1,Uh(f,n,d);break;case"selectionchange":if(S2)break;case"keydown":case"keyup":Uh(f,n,d)}var E;if(wf)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?z0(e,n)&&(T="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(T="onCompositionStart");T&&(V0&&n.locale!=="ko"&&(Ks||T!=="onCompositionStart"?T==="onCompositionEnd"&&Ks&&(E=U0()):($n=d,yf="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}),E?T.data=E:(E=B0(n),E!==null&&(T.data=E)))),(E=f2?m2(e,n):h2(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=E))}ty(f,t)})}function Mi(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=Ei(e,n),o!=null&&s.unshift(Mi(e,o,i)),o=Ei(e,t),o!=null&&s.push(Mi(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=Ei(n,o),c!=null&&a.unshift(Mi(n,c,l))):i||(c=Ei(n,o),c!=null&&a.push(Mi(n,c,l)))),n=n.return}a.length!==0&&e.push({event:t,listeners:a})}var T2=/\r\n?/g,A2=/\u0000|\uFFFD/g;function Wh(e){return(typeof e=="string"?e:""+e).replace(T2,`
38
- `).replace(A2,"")}function Do(e,t,n){if(t=Wh(t),Wh(e)!==t&&n)throw Error(U(425))}function $a(){}var Iu=null,Ou=null;function Lu(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 Du=typeof setTimeout=="function"?setTimeout:void 0,R2=typeof clearTimeout=="function"?clearTimeout:void 0,Hh=typeof Promise=="function"?Promise:void 0,P2=typeof queueMicrotask=="function"?queueMicrotask:typeof Hh<"u"?function(e){return Hh.resolve(null).then(e).catch(_2)}:Du;function _2(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,Fu="__reactEvents$"+Rr,M2="__reactListeners$"+Rr,I2="__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 $u=[],Qs=-1;function os(e){return{current:e}}function ue(e){0>Qs||(e.current=$u[Qs],$u[Qs]=null,Qs--)}function ae(e,t){Qs++,$u[Qs]=e.current,e.current=t}var Zn={},ze=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(ze)}function Kh(e,t,n){if(ze.current!==Zn)throw Error(U(168));ae(ze,t),ae(rt,n)}function sy(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,yN(e)||"Unknown",i));return ge({},n,s)}function Va(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Zn,Ts=ze.current,ae(ze,e),ae(rt,rt.current),!0}function Gh(e,t,n){var s=e.stateNode;if(!s)throw Error(U(169));n?(e=sy(e,t,Ts),s.__reactInternalMemoizedMergedChildContext=e,ue(rt),ue(ze),ae(ze,e)):ue(rt),ae(rt,n)}var dn=null,Cl=!1,jc=!1;function ry(e){dn===null?dn=[e]:dn.push(e)}function O2(e){Cl=!0,ry(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)),A0(hf,as),i}finally{oe=t,jc=!1}}return null}var Js=[],Zs=0,za=null,Ba=0,jt=[],Nt=0,As=null,hn=1,pn="";function hs(e,t){Js[Zs++]=Ba,Js[Zs++]=za,za=e,Ba=t}function iy(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 Nf(e){e.return!==null&&(hs(e,1),iy(e,1,0))}function Sf(e){for(;e===za;)za=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 oy(e,t){var n=Et(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=Et(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,mt=e,ft=null,!0):!1;default:return!1}}function Uu(e){return(e.mode&1)!==0&&(e.flags&128)===0}function Vu(e){if(de){var t=ft;if(t){var n=t;if(!Yh(e,t)){if(Uu(e))throw Error(U(418));t=Hn(n.nextSibling);var s=mt;t&&Yh(e,t)?oy(s,n):(e.flags=e.flags&-4097|2,de=!1,mt=e)}}else{if(Uu(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"&&!Lu(e.type,e.memoizedProps)),t&&(t=ft)){if(Uu(e))throw ay(),Error(U(418));for(;t;)oy(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 ay(){for(var e=ft;e;)e=Hn(e.nextSibling)}function br(){ft=mt=null,de=!1}function Cf(e){Ft===null?Ft=[e]:Ft.push(e)}var L2=kn.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 ly(e){function t(h,x){if(e){var y=h.deletions;y===null?(h.deletions=[x],h.flags|=16):y.push(x)}}function n(h,x){if(!e)return null;for(;x!==null;)t(h,x),x=x.sibling;return null}function s(h,x){for(h=new Map;x!==null;)x.key!==null?h.set(x.key,x):h.set(x.index,x),x=x.sibling;return h}function i(h,x){return h=Yn(h,x),h.index=0,h.sibling=null,h}function o(h,x,y){return h.index=y,e?(y=h.alternate,y!==null?(y=y.index,y<x?(h.flags|=2,x):y):(h.flags|=2,x)):(h.flags|=1048576,x)}function a(h){return e&&h.alternate===null&&(h.flags|=2),h}function l(h,x,y,w){return x===null||x.tag!==6?(x=Ac(y,h.mode,w),x.return=h,x):(x=i(x,y),x.return=h,x)}function c(h,x,y,w){var S=y.type;return S===qs?d(h,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(h,x,y),w.return=h,w):(w=ha(y.type,y.key,y.props,null,h.mode,w),w.ref=Gr(h,x,y),w.return=h,w)}function u(h,x,y,w){return x===null||x.tag!==4||x.stateNode.containerInfo!==y.containerInfo||x.stateNode.implementation!==y.implementation?(x=Rc(y,h.mode,w),x.return=h,x):(x=i(x,y.children||[]),x.return=h,x)}function d(h,x,y,w,S){return x===null||x.tag!==7?(x=Ss(y,h.mode,w,S),x.return=h,x):(x=i(x,y),x.return=h,x)}function f(h,x,y){if(typeof x=="string"&&x!==""||typeof x=="number")return x=Ac(""+x,h.mode,y),x.return=h,x;if(typeof x=="object"&&x!==null){switch(x.$$typeof){case To:return y=ha(x.type,x.key,x.props,null,h.mode,y),y.ref=Gr(h,null,x),y.return=h,y;case Hs:return x=Rc(x,h.mode,y),x.return=h,x;case On:var w=x._init;return f(h,w(x._payload),y)}if(si(x)||Br(x))return x=Ss(x,h.mode,y,null),x.return=h,x;$o(h,x)}return null}function m(h,x,y,w){var S=x!==null?x.key:null;if(typeof y=="string"&&y!==""||typeof y=="number")return S!==null?null:l(h,x,""+y,w);if(typeof y=="object"&&y!==null){switch(y.$$typeof){case To:return y.key===S?c(h,x,y,w):null;case Hs:return y.key===S?u(h,x,y,w):null;case On:return S=y._init,m(h,x,S(y._payload),w)}if(si(y)||Br(y))return S!==null?null:d(h,x,y,w,null);$o(h,y)}return null}function b(h,x,y,w,S){if(typeof w=="string"&&w!==""||typeof w=="number")return h=h.get(y)||null,l(x,h,""+w,S);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case To:return h=h.get(w.key===null?y:w.key)||null,c(x,h,w,S);case Hs:return h=h.get(w.key===null?y:w.key)||null,u(x,h,w,S);case On:var C=w._init;return b(h,x,y,C(w._payload),S)}if(si(w)||Br(w))return h=h.get(y)||null,d(x,h,w,S,null);$o(x,w)}return null}function j(h,x,y,w){for(var S=null,C=null,E=x,T=x=0,N=null;E!==null&&T<y.length;T++){E.index>T?(N=E,E=null):N=E.sibling;var k=m(h,E,y[T],w);if(k===null){E===null&&(E=N);break}e&&E&&k.alternate===null&&t(h,E),x=o(k,x,T),C===null?S=k:C.sibling=k,C=k,E=N}if(T===y.length)return n(h,E),de&&hs(h,T),S;if(E===null){for(;T<y.length;T++)E=f(h,y[T],w),E!==null&&(x=o(E,x,T),C===null?S=E:C.sibling=E,C=E);return de&&hs(h,T),S}for(E=s(h,E);T<y.length;T++)N=b(E,h,T,y[T],w),N!==null&&(e&&N.alternate!==null&&E.delete(N.key===null?T:N.key),x=o(N,x,T),C===null?S=N:C.sibling=N,C=N);return e&&E.forEach(function(A){return t(h,A)}),de&&hs(h,T),S}function v(h,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,E=x,T=x=0,N=null,k=y.next();E!==null&&!k.done;T++,k=y.next()){E.index>T?(N=E,E=null):N=E.sibling;var A=m(h,E,k.value,w);if(A===null){E===null&&(E=N);break}e&&E&&A.alternate===null&&t(h,E),x=o(A,x,T),C===null?S=A:C.sibling=A,C=A,E=N}if(k.done)return n(h,E),de&&hs(h,T),S;if(E===null){for(;!k.done;T++,k=y.next())k=f(h,k.value,w),k!==null&&(x=o(k,x,T),C===null?S=k:C.sibling=k,C=k);return de&&hs(h,T),S}for(E=s(h,E);!k.done;T++,k=y.next())k=b(E,h,T,k.value,w),k!==null&&(e&&k.alternate!==null&&E.delete(k.key===null?T:k.key),x=o(k,x,T),C===null?S=k:C.sibling=k,C=k);return e&&E.forEach(function(P){return t(h,P)}),de&&hs(h,T),S}function p(h,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(h,C.sibling),x=i(C,y.props.children),x.return=h,h=x;break e}}else if(C.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===On&&Qh(S)===C.type){n(h,C.sibling),x=i(C,y.props),x.ref=Gr(h,C,y),x.return=h,h=x;break e}n(h,C);break}else t(h,C);C=C.sibling}y.type===qs?(x=Ss(y.props.children,h.mode,w,y.key),x.return=h,h=x):(w=ha(y.type,y.key,y.props,null,h.mode,w),w.ref=Gr(h,x,y),w.return=h,h=w)}return a(h);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(h,x.sibling),x=i(x,y.children||[]),x.return=h,h=x;break e}else{n(h,x);break}else t(h,x);x=x.sibling}x=Rc(y,h.mode,w),x.return=h,h=x}return a(h);case On:return C=y._init,p(h,x,C(y._payload),w)}if(si(y))return j(h,x,y,w);if(Br(y))return v(h,x,y,w);$o(h,y)}return typeof y=="string"&&y!==""||typeof y=="number"?(y=""+y,x!==null&&x.tag===6?(n(h,x.sibling),x=i(x,y),x.return=h,h=x):(n(h,x),x=Ac(y,h.mode,w),x.return=h,h=x),a(h)):n(h,x)}return p}var wr=ly(!0),cy=ly(!1),Wa=os(null),Ha=null,er=null,Ef=null;function kf(){Ef=er=Ha=null}function Tf(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,Ef=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(Ef!==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 Af(e){ys===null?ys=[e]:ys.push(e)}function uy(e,t,n,s){var i=t.interleaved;return i===null?(n.next=n,Af(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 Rf(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function dy(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,Af(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,pf(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 m=l.lane,b=l.eventTime;if((s&m)===m){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(m=t,b=n,v.tag){case 1:if(j=v.payload,typeof j=="function"){f=j.call(b,f,m);break e}f=j;break e;case 3:j.flags=j.flags&-65537|128;case 0:if(j=v.payload,m=typeof j=="function"?j.call(b,f,m):j,m==null)break e;f=ge({},f,m);break e;case 2:Ln=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,m=i.effects,m===null?i.effects=[l]:m.push(l))}else b={eventTime:b,lane:m,tag:l.tag,payload:l.payload,callback:l.callback,next:null},d===null?(u=d=b,c=f):d=d.next=b,a|=m;if(l=l.next,l===null){if(l=i.shared.pending,l===null)break;m=l,l=m.next,m.next=null,i.lastBaseUpdate=m,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 Pf(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:ju(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=ju(t,e)}ue(Jt),ae(Jt,t)}function jr(){ue(Jt),ue(Oi),ue(Li)}function fy(e){vs(Li.current);var t=vs(Jt.current),n=ju(t,e.type);t!==n&&(ae(Oi,e),ae(Jt,n))}function _f(e){Oi.current===e&&(ue(Jt),ue(Oi))}var me=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=kn.ReactCurrentDispatcher,Sc=kn.ReactCurrentBatchConfig,Rs=0,pe=null,ke=null,Ae=null,Ga=!1,pi=!1,Di=0,D2=0;function De(){throw Error(U(321))}function If(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Vt(e[n],t[n]))return!1;return!0}function Of(e,t,n,s,i,o){if(Rs=o,pe=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,ca.current=e===null||e.memoizedState===null?V2:z2,e=n(s,i),pi){o=0;do{if(pi=!1,Di=0,25<=o)throw Error(U(301));o+=1,Ae=ke=null,t.updateQueue=null,ca.current=B2,e=n(s,i)}while(pi)}if(ca.current=Ya,t=ke!==null&&ke.next!==null,Rs=0,Ae=ke=pe=null,Ga=!1,t)throw Error(U(300));return e}function Lf(){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?pe.memoizedState=Ae=e:Ae=Ae.next=e,Ae}function Pt(){if(ke===null){var e=pe.alternate;e=e!==null?e.memoizedState:null}else e=ke.next;var t=Ae===null?pe.memoizedState:Ae.next;if(t!==null)Ae=t,ke=e;else{if(e===null)throw Error(U(310));ke=e,e={memoizedState:ke.memoizedState,baseState:ke.baseState,baseQueue:ke.baseQueue,queue:ke.queue,next:null},Ae===null?pe.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=ke,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,pe.lanes|=d,Ps|=d}u=u.next}while(u!==null&&u!==o);c===null?a=s:c.next=l,Vt(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,pe.lanes|=o,Ps|=o,i=i.next;while(i!==e)}else i===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function Ec(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);Vt(o,t.memoizedState)||(nt=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,s]}function my(){}function hy(e,t){var n=pe,s=Pt(),i=t(),o=!Vt(s.memoizedState,i);if(o&&(s.memoizedState=i,nt=!0),s=s.queue,Df(xy.bind(null,n,s,e),[e]),s.getSnapshot!==t||o||Ae!==null&&Ae.memoizedState.tag&1){if(n.flags|=2048,$i(9,gy.bind(null,n,s,i,t),void 0,null),Re===null)throw Error(U(349));Rs&30||py(n,t,i)}return i}function py(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=pe.updateQueue,t===null?(t={lastEffect:null,stores:null},pe.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function gy(e,t,n,s){t.value=n,t.getSnapshot=s,yy(t)&&vy(e)}function xy(e,t,n){return n(function(){yy(t)&&vy(e)})}function yy(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Vt(e,n)}catch{return!0}}function vy(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=U2.bind(null,pe,e),[t.memoizedState,e]}function $i(e,t,n,s){return e={tag:e,create:t,destroy:n,deps:s,next:null},t=pe.updateQueue,t===null?(t={lastEffect:null,stores:null},pe.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 by(){return Pt().memoizedState}function ua(e,t,n,s){var i=Kt();pe.flags|=e,i.memoizedState=$i(1|t,n,void 0,s===void 0?null:s)}function El(e,t,n,s){var i=Pt();s=s===void 0?null:s;var o=void 0;if(ke!==null){var a=ke.memoizedState;if(o=a.destroy,s!==null&&If(s,a.deps)){i.memoizedState=$i(t,n,o,s);return}}pe.flags|=e,i.memoizedState=$i(1|t,n,o,s)}function tp(e,t){return ua(8390656,8,e,t)}function Df(e,t){return El(2048,8,e,t)}function wy(e,t){return El(4,2,e,t)}function jy(e,t){return El(4,4,e,t)}function Ny(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 Sy(e,t,n){return n=n!=null?n.concat([e]):null,El(4,4,Ny.bind(null,t,e),n)}function Ff(){}function Cy(e,t){var n=Pt();t=t===void 0?null:t;var s=n.memoizedState;return s!==null&&t!==null&&If(t,s[1])?s[0]:(n.memoizedState=[e,t],e)}function Ey(e,t){var n=Pt();t=t===void 0?null:t;var s=n.memoizedState;return s!==null&&t!==null&&If(t,s[1])?s[0]:(e=e(),n.memoizedState=[e,t],e)}function ky(e,t,n){return Rs&21?(Vt(n,t)||(n=_0(),pe.lanes|=n,Ps|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,nt=!0),e.memoizedState=n)}function F2(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 Ty(){return Pt().memoizedState}function $2(e,t,n){var s=Gn(e);if(n={lane:s,action:n,hasEagerState:!1,eagerState:null,next:null},Ay(e))Ry(t,n);else if(n=uy(e,t,n,s),n!==null){var i=qe();Ut(n,e,s,i),Py(n,t,s)}}function U2(e,t,n){var s=Gn(e),i={lane:s,action:n,hasEagerState:!1,eagerState:null,next:null};if(Ay(e))Ry(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,Vt(l,a)){var c=t.interleaved;c===null?(i.next=i,Af(t)):(i.next=c.next,c.next=i),t.interleaved=i;return}}catch{}finally{}n=uy(e,t,i,s),n!==null&&(i=qe(),Ut(n,e,s,i),Py(n,t,s))}}function Ay(e){var t=e.alternate;return e===pe||t!==null&&t===pe}function Ry(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 Py(e,t,n){if(n&4194240){var s=t.lanes;s&=e.pendingLanes,n|=s,t.lanes=n,pf(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},V2={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,Ny.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=$2.bind(null,pe,e),[s.memoizedState,e]},useRef:function(e){var t=Kt();return e={current:e},t.memoizedState=e},useState:ep,useDebugValue:Ff,useDeferredValue:function(e){return Kt().memoizedState=e},useTransition:function(){var e=ep(!1),t=e[0];return e=F2.bind(null,e[1]),Kt().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var s=pe,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||py(s,t,n)}i.memoizedState=n;var o={value:n,getSnapshot:t};return i.queue=o,tp(xy.bind(null,s,o,e),[e]),s.flags|=2048,$i(9,gy.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=D2++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},z2={readContext:Rt,useCallback:Cy,useContext:Rt,useEffect:Df,useImperativeHandle:Sy,useInsertionEffect:wy,useLayoutEffect:jy,useMemo:Ey,useReducer:Cc,useRef:by,useState:function(){return Cc(Fi)},useDebugValue:Ff,useDeferredValue:function(e){var t=Pt();return ky(t,ke.memoizedState,e)},useTransition:function(){var e=Cc(Fi)[0],t=Pt().memoizedState;return[e,t]},useMutableSource:my,useSyncExternalStore:hy,useId:Ty,unstable_isNewReconciler:!1},B2={readContext:Rt,useCallback:Cy,useContext:Rt,useEffect:Df,useImperativeHandle:Sy,useInsertionEffect:wy,useLayoutEffect:jy,useMemo:Ey,useReducer:Ec,useRef:by,useState:function(){return Ec(Fi)},useDebugValue:Ff,useDeferredValue:function(e){var t=Pt();return ke===null?t.memoizedState=e:ky(t,ke.memoizedState,e)},useTransition:function(){var e=Ec(Fi)[0],t=Pt().memoizedState;return[e,t]},useMutableSource:my,useSyncExternalStore:hy,useId:Ty,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 Bu(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 kl={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 _y(e,t,n){var s=!1,i=Zn,o=t.contextType;return typeof o=="object"&&o!==null?o=Rt(o):(i=it(t)?Ts:ze.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=kl,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&&kl.enqueueReplaceState(t,t.state,null)}function Wu(e,t,n,s){var i=e.stateNode;i.props=n,i.state=e.memoizedState,i.refs={},Rf(e);var o=t.contextType;typeof o=="object"&&o!==null?i.context=Rt(o):(o=it(t)?Ts:ze.current,i.context=vr(e,o)),i.state=e.memoizedState,o=t.getDerivedStateFromProps,typeof o=="function"&&(Bu(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&&kl.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+=xN(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 kc(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Hu(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var W2=typeof WeakMap=="function"?WeakMap:Map;function My(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,td=s),Hu(e,t)},n}function Iy(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(){Hu(e,t)}}var o=e.stateNode;return o!==null&&typeof o.componentDidCatch=="function"&&(n.callback=function(){Hu(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 W2;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=rS.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 H2=kn.ReactCurrentOwner,nt=!1;function Be(e,t,n,s){t.child=e===null?cy(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=Of(e,t,n,s,o,i),n=Lf(),e!==null&&!nt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,bn(e,t,i)):(de&&n&&Nf(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"&&!qf(o)&&o.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=o,Oy(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 Oy(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 qu(e,t,n,s,i)}function Ly(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 Dy(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function qu(e,t,n,s,i){var o=it(n)?Ts:ze.current;return o=vr(t,o),fr(t,i),n=Of(e,t,n,s,o,i),s=Lf(),e!==null&&!nt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,bn(e,t,i)):(de&&s&&Nf(t),t.flags|=1,Be(e,t,n,i),t.child)}function cp(e,t,n,s,i){if(it(n)){var o=!0;Va(t)}else o=!1;if(fr(t,i),t.stateNode===null)da(e,t),_y(t,n,s),Wu(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:ze.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 m=t.memoizedState;a.state=m,qa(t,s,a,i),c=t.memoizedState,l!==s||m!==c||rt.current||Ln?(typeof d=="function"&&(Bu(t,n,d,s),c=t.memoizedState),(l=Ln||np(t,n,l,s,m,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,dy(e,t),l=t.memoizedProps,u=t.type===t.elementType?l:Ot(t.type,l),a.props=u,f=t.pendingProps,m=a.context,c=n.contextType,typeof c=="object"&&c!==null?c=Rt(c):(c=it(n)?Ts:ze.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||m!==c)&&sp(t,a,s,c),Ln=!1,m=t.memoizedState,a.state=m,qa(t,s,a,i);var j=t.memoizedState;l!==f||m!==j||rt.current||Ln?(typeof b=="function"&&(Bu(t,n,b,s),j=t.memoizedState),(u=Ln||np(t,n,u,s,m,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&&m===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&m===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&&m===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&m===e.memoizedState||(t.flags|=1024),s=!1)}return Ku(e,t,n,s,o,i)}function Ku(e,t,n,s,i,o){Dy(e,t);var a=(t.flags&128)!==0;if(!s&&!a)return i&&Gh(t,n,!1),bn(e,t,o);s=t.stateNode,H2.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 Fy(e){var t=e.stateNode;t.pendingContext?Kh(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Kh(e,t.context,!1),Pf(e,t.containerInfo)}function up(e,t,n,s,i){return br(),Cf(i),t.flags|=256,Be(e,t,n,s),t.child}var Gu={dehydrated:null,treeContext:null,retryLane:0};function Yu(e){return{baseLanes:e,cachePool:null,transitions:null}}function $y(e,t,n){var s=t.pendingProps,i=me.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(me,i&1),e===null)return Vu(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=Yu(n),t.memoizedState=Gu,e):$f(t,a));if(i=e.memoizedState,i!==null&&(l=i.dehydrated,l!==null))return q2(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?Yu(n):{baseLanes:a.baseLanes|n,cachePool:null,transitions:a.transitions},o.memoizedState=a,o.childLanes=e.childLanes&~n,t.memoizedState=Gu,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 $f(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&&Cf(s),wr(t,e.child,null,n),e=$f(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function q2(e,t,n,s,i,o,a){if(n)return t.flags&256?(t.flags&=-257,s=kc(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=Yu(a),t.memoizedState=Gu,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=kc(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 Hf(),s=kc(Error(U(421))),Uo(e,t,a,s)}return i.data==="$?"?(t.flags|=128,t.child=e.child,t=iS.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=$f(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 Uy(e,t,n){var s=t.pendingProps,i=s.revealOrder,o=s.tail;if(Be(e,t,s.children,n),s=me.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(me,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 K2(e,t,n){switch(t.tag){case 3:Fy(t),br();break;case 5:fy(t);break;case 1:it(t.type)&&Va(t);break;case 4:Pf(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(me,me.current&1),t.flags|=128,null):n&t.child.childLanes?$y(e,t,n):(ae(me,me.current&1),e=bn(e,t,n),e!==null?e.sibling:null);ae(me,me.current&1);break;case 19:if(s=(n&t.childLanes)!==0,e.flags&128){if(s)return Uy(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),ae(me,me.current),s)break;return null;case 22:case 23:return t.lanes=0,Ly(e,t,n)}return bn(e,t,n)}var Vy,Xu,zy,By;Vy=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}};Xu=function(){};zy=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=yu(e,i),s=yu(e,s),o=[];break;case"select":i=ge({},i,{value:void 0}),s=ge({},s,{value:void 0}),o=[];break;case"textarea":i=wu(e,i),s=wu(e,s),o=[];break;default:typeof i.onClick!="function"&&typeof s.onClick=="function"&&(e.onclick=$a)}Nu(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)}};By=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 G2(e,t,n){var s=t.pendingProps;switch(Sf(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(ze),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&&(rd(Ft),Ft=null))),Xu(e,t),Fe(t),null;case 5:_f(t);var i=vs(Li.current);if(n=t.type,e!==null&&t.stateNode!=null)zy(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)}Nu(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=x0(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,Vy(e,t,!1,!1),t.stateNode=e;e:{switch(a=Su(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=yu(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=wu(e,s),ce("invalid",e);break;default:i=s}Nu(n,i),l=i;for(o in l)if(l.hasOwnProperty(o)){var c=l[o];o==="style"?b0(e,c):o==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&y0(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&&cf(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)By(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(me),s=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(de&&ft!==null&&t.mode&1&&!(t.flags&128))ay(),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&&(rd(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||me.current&1?Te===0&&(Te=3):Hf())),t.updateQueue!==null&&(t.flags|=4),Fe(t),null);case 4:return jr(),Xu(e,t),e===null&&_i(t.stateNode.containerInfo),Fe(t),null;case 10:return Tf(t.type._context),Fe(t),null;case 17:return it(t.type)&&Ua(),Fe(t),null;case 19:if(ue(me),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(me,me.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=me.current,ae(me,s?n&1|2:n&1),t):(Fe(t),null);case 22:case 23:return Wf(),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 Y2(e,t){switch(Sf(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(ze),Mf(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return _f(t),null;case 13:if(ue(me),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(me),null;case 4:return jr(),null;case 10:return Tf(t.type._context),null;case 22:case 23:return Wf(),null;case 24:return null;default:return null}}var Vo=!1,$e=!1,X2=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 Qu(e,t,n){try{n()}catch(s){ye(e,t,s)}}var fp=!1;function Q2(e,t){if(Iu=La,e=G0(),jf(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,m=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;)m=f,f=b;for(;;){if(f===e)break t;if(m===n&&++u===i&&(l=a),m===o&&++d===s&&(c=a),(b=f.nextSibling)!==null)break;f=m,m=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(Ou={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,p=j.memoizedState,h=t.stateNode,x=h.getSnapshotBeforeUpdate(t.elementType===t.type?v:Ot(t.type,v),p);h.__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&&Qu(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 Ju(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 Wy(e){var t=e.alternate;t!==null&&(e.alternate=null,Wy(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[Fu],delete t[M2],delete t[I2])),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 Hy(e){return e.tag===5||e.tag===3||e.tag===4}function mp(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Hy(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 Zu(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(Zu(e,t,n),e=e.sibling;e!==null;)Zu(e,t,n),e=e.sibling}function ed(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(ed(e,t,n),e=e.sibling;e!==null;)ed(e,t,n),e=e.sibling}var _e=null,Lt=!1;function An(e,t,n){for(n=n.child;n!==null;)qy(e,t,n),n=n.sibling}function qy(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=_e,i=Lt;_e=null,An(e,t,n),_e=s,Lt=i,_e!==null&&(Lt?(e=_e,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):_e.removeChild(n.stateNode));break;case 18:_e!==null&&(Lt?(e=_e,n=n.stateNode,e.nodeType===8?wc(e.parentNode,n):e.nodeType===1&&wc(e,n),Ai(e)):wc(_e,n.stateNode));break;case 4:s=_e,i=Lt,_e=n.stateNode.containerInfo,Lt=!0,An(e,t,n),_e=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)&&Qu(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 X2),t.forEach(function(s){var i=oS.bind(null,e,s);n.has(s)||(n.add(s),s.then(i,i))})}}function Mt(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:_e=l.stateNode,Lt=!1;break e;case 3:_e=l.stateNode.containerInfo,Lt=!0;break e;case 4:_e=l.stateNode.containerInfo,Lt=!0;break e}l=l.return}if(_e===null)throw Error(U(160));qy(o,a,i),_e=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;)Ky(t,e),t=t.sibling}function Ky(e,t){var n=e.alternate,s=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Mt(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:Mt(t,e),Ht(e),s&512&&n!==null&&tr(n,n.return);break;case 5:if(Mt(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&&p0(i,o),Su(l,a);var u=Su(l,o);for(a=0;a<c.length;a+=2){var d=c[a],f=c[a+1];d==="style"?b0(i,f):d==="dangerouslySetInnerHTML"?y0(i,f):d==="children"?Ci(i,f):cf(i,d,f,u)}switch(l){case"input":vu(i,o);break;case"textarea":g0(i,o);break;case"select":var m=i._wrapperState.wasMultiple;i._wrapperState.wasMultiple=!!o.multiple;var b=o.value;b!=null?lr(i,!!o.multiple,b,!1):m!==!!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(Mt(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(Mt(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:Mt(t,e),Ht(e);break;case 13:Mt(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,Mt(t,e),$e=u):Mt(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(m=G,b=m.child,m.tag){case 0:case 11:case 14:case 15:gi(4,m,m.return);break;case 1:tr(m,m.return);var j=m.stateNode;if(typeof j.componentWillUnmount=="function"){s=m,n=m.return;try{t=s,j.props=t.memoizedProps,j.state=t.memoizedState,j.componentWillUnmount()}catch(v){ye(s,n,v)}}break;case 5:tr(m,m.return);break;case 22:if(m.memoizedState!==null){gp(f);continue}}b!==null?(b.return=m,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=v0("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:Mt(t,e),Ht(e),s&4&&hp(e);break;case 21:break;default:Mt(t,e),Ht(e)}}function Ht(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(Hy(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);ed(e,o,i);break;case 3:case 4:var a=s.stateNode.containerInfo,l=mp(e);Zu(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 J2(e,t,n){G=e,Gy(e)}function Gy(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||Vo;if(!a){var l=i.alternate,c=l!==null&&l.memoizedState!==null||$e;l=Vo;var u=$e;if(Vo=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,Gy(o),o=o.sibling;G=i,Vo=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&&Ju(t)}catch(m){ye(t,t.return,m)}}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{Ju(t)}catch(c){ye(t,o,c)}break;case 5:var a=t.return;try{Ju(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 Z2=Math.ceil,Xa=kn.ReactCurrentDispatcher,Uf=kn.ReactCurrentOwner,kt=kn.ReactCurrentBatchConfig,ie=0,Re=null,Ce=null,Ie=0,ut=0,nr=os(0),Te=0,Ui=null,Ps=0,Al=0,Vf=0,xi=null,tt=null,zf=0,Sr=1/0,un=null,Qa=!1,td=null,Kn=null,zo=!1,Un=null,Ja=0,yi=0,nd=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:L2.transition!==null?(ma===0&&(ma=_0()),ma):(e=oe,e!==0||(e=window.event,e=e===void 0?16:$0(e.type)),e):1}function Ut(e,t,n,s){if(50<yi)throw yi=0,nd=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;LN(e,t);var s=Oa(e,e===Re?Ie:0);if(s===0)n!==null&&Eh(n),e.callbackNode=null,e.callbackPriority=0;else if(t=s&-s,e.callbackPriority!==t){if(n!=null&&Eh(n),t===1)e.tag===0?O2(yp.bind(null,e)):ry(yp.bind(null,e)),P2(function(){!(ie&6)&&as()}),n=null;else{switch(M0(s)){case 1:n=hf;break;case 4:n=R0;break;case 16:n=Ia;break;case 536870912:n=P0;break;default:n=Ia}n=nv(n,Yy.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function Yy(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=Qy();(Re!==e||Ie!==t)&&(un=null,Sr=we()+500,Ns(e,t));do try{nS();break}catch(l){Xy(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=Au(e),i!==0&&(s=i,t=sd(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)&&!eS(i)&&(t=Za(e,s),t===2&&(o=Au(e),o!==0&&(s=o,t=sd(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=Du(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*Z2(s/1960))-s,10<s){e.timeoutHandle=Du(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?Yy.bind(null,e):null}function sd(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&&rd(t)),e}function rd(e){tt===null?tt=e:tt.push.apply(tt,e)}function eS(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(!Vt(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&=~Vf,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=Au(e);s!==0&&(t=s,n=sd(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 Bf(e,t){var n=ie;ie|=1;try{return e(t)}finally{ie=n,ie===0&&(Sr=we()+500,Cl&&as())}}function _s(e){Un!==null&&Un.tag===0&&!(ie&6)&&mr();var t=ie;ie|=1;var n=kt.transition,s=oe;try{if(kt.transition=null,oe=1,e)return e()}finally{oe=s,kt.transition=n,ie=t,!(ie&6)&&as()}}function Wf(){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,R2(n)),Ce!==null)for(n=Ce.return;n!==null;){var s=n;switch(Sf(s),s.tag){case 1:s=s.type.childContextTypes,s!=null&&Ua();break;case 3:jr(),ue(rt),ue(ze),Mf();break;case 5:_f(s);break;case 4:jr();break;case 13:ue(me);break;case 19:ue(me);break;case 10:Tf(s.type._context);break;case 22:case 23:Wf()}n=n.return}if(Re=e,Ce=e=Yn(e.current,null),Ie=ut=t,Te=0,Ui=null,Vf=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 Xy(e,t){do{var n=Ce;try{if(kf(),ca.current=Ya,Ga){for(var s=pe.memoizedState;s!==null;){var i=s.queue;i!==null&&(i.pending=null),s=s.next}Ga=!1}if(Rs=0,Ae=ke=pe=null,pi=!1,Di=0,Uf.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 m=d.alternate;m?(d.updateQueue=m.updateQueue,d.memoizedState=m.memoizedState,d.lanes=m.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),Hf();break e}c=Error(U(426))}}else if(de&&l.mode&1){var p=ip(a);if(p!==null){!(p.flags&65536)&&(p.flags|=256),op(p,a,l,o,t),Cf(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 h=My(o,c,t);Jh(o,h);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=Iy(o,l,t);Jh(o,w);break e}}o=o.return}while(o!==null)}Zy(n)}catch(S){t=S,Ce===n&&n!==null&&(Ce=n=n.return);continue}break}while(!0)}function Qy(){var e=Xa.current;return Xa.current=Ya,e===null?Ya:e}function Hf(){(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=Qy();(Re!==e||Ie!==t)&&(un=null,Ns(e,t));do try{tS();break}catch(i){Xy(e,i)}while(!0);if(kf(),ie=n,Xa.current=s,Ce!==null)throw Error(U(261));return Re=null,Ie=0,Te}function tS(){for(;Ce!==null;)Jy(Ce)}function nS(){for(;Ce!==null&&!kN();)Jy(Ce)}function Jy(e){var t=tv(e.alternate,e,ut);e.memoizedProps=e.pendingProps,t===null?Zy(e):Ce=t,Uf.current=null}function Zy(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=Y2(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=G2(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=kt.transition;try{kt.transition=null,oe=1,sS(e,t,n,s)}finally{kt.transition=i,oe=s}return null}function sS(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(DN(e,o),e===Re&&(Ce=Re=null,Ie=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||zo||(zo=!0,nv(Ia,function(){return mr(),null})),o=(n.flags&15990)!==0,n.subtreeFlags&15990||o){o=kt.transition,kt.transition=null;var a=oe;oe=1;var l=ie;ie|=4,Uf.current=null,Q2(e,n),Ky(n,e),N2(Ou),La=!!Iu,Ou=Iu=null,e.current=n,J2(n),TN(),ie=l,oe=a,kt.transition=o}else e.current=n;if(zo&&(zo=!1,Un=e,Ja=i),o=e.pendingLanes,o===0&&(Kn=null),PN(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=td,td=null,e;return Ja&1&&e.tag!==0&&mr(),o=e.pendingLanes,o&1?e===nd?yi++:(yi=0,nd=e):yi=0,as(),null}function mr(){if(Un!==null){var e=M0(Ja),t=kt.transition,n=oe;try{if(kt.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 m=d.sibling,b=d.return;if(Wy(d),d===u){G=null;break}if(m!==null){m.return=b,G=m;break}G=b}}}var j=o.alternate;if(j!==null){var v=j.child;if(v!==null){j.child=null;do{var p=v.sibling;v.sibling=null,v=p}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 h=o.sibling;if(h!==null){h.return=o.return,G=h;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,kt.transition=t}}return!1}function vp(e,t,n){t=Nr(n,t),t=My(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=Iy(t,e,1),t=qn(t,e,1),e=qe(),t!==null&&(oo(t,1,e),ot(t,e));break}}t=t.return}}function rS(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):Vf|=n),ot(e,t)}function ev(e,t){t===0&&(e.mode&1?(t=_o,_o<<=1,!(_o&130023424)&&(_o=4194304)):t=1);var n=qe();e=vn(e,t),e!==null&&(oo(e,t,n),ot(e,n))}function iS(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),ev(e,n)}function oS(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),ev(e,n)}var tv;tv=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,K2(e,t,n);nt=!!(e.flags&131072)}else nt=!1,de&&t.flags&1048576&&iy(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,ze.current);fr(t,n),i=Of(null,t,s,e,i,n);var o=Lf();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,Va(t)):o=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,Rf(t),i.updater=kl,t.stateNode=i,i._reactInternals=t,Wu(t,s,e,n),t=Ku(null,t,s,!0,o,n)):(t.tag=0,de&&o&&Nf(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=lS(s),e=Ot(s,e),i){case 0:t=qu(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),qu(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(Fy(t),e===null)throw Error(U(387));s=t.pendingProps,o=t.memoizedState,i=o.element,dy(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=cy(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 fy(t),e===null&&Vu(t),s=t.type,i=t.pendingProps,o=e!==null?e.memoizedProps:null,a=i.children,Lu(s,i)?a=null:o!==null&&Lu(s,o)&&(t.flags|=32),Dy(e,t),Be(e,t,a,n),t.child;case 6:return e===null&&Vu(t),null;case 13:return $y(e,t,n);case 4:return Pf(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(Vt(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 Oy(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,Va(t)):e=!1,fr(t,n),_y(t,s,i),Wu(t,s,i,n),Ku(null,t,s,!0,e,n);case 19:return Uy(e,t,n);case 22:return Ly(e,t,n)}throw Error(U(156,t.tag))};function nv(e,t){return A0(e,t)}function aS(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 Et(e,t,n,s){return new aS(e,t,n,s)}function qf(e){return e=e.prototype,!(!e||!e.isReactComponent)}function lS(e){if(typeof e=="function")return qf(e)?1:0;if(e!=null){if(e=e.$$typeof,e===df)return 11;if(e===ff)return 14}return 2}function Yn(e,t){var n=e.alternate;return n===null?(n=Et(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")qf(e)&&(a=1);else if(typeof e=="string")a=5;else e:switch(e){case qs:return Ss(n.children,i,o,t);case uf:a=8,i|=8;break;case hu:return e=Et(12,n,t,i|2),e.elementType=hu,e.lanes=o,e;case pu:return e=Et(13,n,t,i),e.elementType=pu,e.lanes=o,e;case gu:return e=Et(19,n,t,i),e.elementType=gu,e.lanes=o,e;case f0:return Rl(n,i,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case u0:a=10;break e;case d0:a=9;break e;case df:a=11;break e;case ff:a=14;break e;case On:a=16,s=null;break e}throw Error(U(130,e==null?e:typeof e,""))}return t=Et(a,n,t,i),t.elementType=e,t.type=s,t.lanes=o,t}function Ss(e,t,n,s){return e=Et(7,e,s,t),e.lanes=n,e}function Rl(e,t,n,s){return e=Et(22,e,s,t),e.elementType=f0,e.lanes=n,e.stateNode={isHidden:!1},e}function Ac(e,t,n){return e=Et(6,e,null,t),e.lanes=n,e}function Rc(e,t,n){return t=Et(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function cS(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 Kf(e,t,n,s,i,o,a,l,c){return e=new cS(e,t,n,l,c),t===1?(t=1,o===!0&&(t|=8)):t=0,o=Et(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:s,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Rf(o),e}function uS(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 sv(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 sy(e,n,t)}return t}function rv(e,t,n,s,i,o,a,l,c){return e=Kf(n,s,!0,e,i,o,a,l,c),e.context=sv(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=sv(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 Gf(e,t){bp(e,t),(e=e.alternate)&&bp(e,t)}function dS(){return null}var iv=typeof reportError=="function"?reportError:function(e){console.error(e)};function Yf(e){this._internalRoot=e}_l.prototype.render=Yf.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(U(409));Pl(e,t,null,null)};_l.prototype.unmount=Yf.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;_s(function(){Pl(null,e,null,null)}),t[yn]=null}};function _l(e){this._internalRoot=e}_l.prototype.unstable_scheduleHydration=function(e){if(e){var t=L0();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&&F0(e)}};function Xf(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Ml(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function wp(){}function fS(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=rv(t,s,e,0,null,!1,!1,"",wp);return e._reactRootContainer=a,e[yn]=a.current,_i(e.nodeType===8?e.parentNode:e),_s(),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=Kf(e,0,!1,null,null,!1,!1,"",wp);return e._reactRootContainer=c,e[yn]=c.current,_i(e.nodeType===8?e.parentNode:e),_s(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=fS(n,t,e,i,s);return el(a)}I0=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=ri(t.pendingLanes);n!==0&&(pf(t,n|1),ot(t,we()),!(ie&6)&&(Sr=we()+500,as()))}break;case 13:_s(function(){var s=vn(e,1);if(s!==null){var i=qe();Ut(s,e,1,i)}}),Gf(e,1)}};gf=function(e){if(e.tag===13){var t=vn(e,134217728);if(t!==null){var n=qe();Ut(t,e,134217728,n)}Gf(e,134217728)}};O0=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)}Gf(e,t)}};L0=function(){return oe};D0=function(e,t){var n=oe;try{return oe=e,t()}finally{oe=n}};Eu=function(e,t,n){switch(t){case"input":if(vu(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));h0(s),vu(s,i)}}}break;case"textarea":g0(e,n);break;case"select":t=n.value,t!=null&&lr(e,!!n.multiple,t,!1)}};N0=Bf;S0=_s;var mS={usingClientEntryPoint:!1,Events:[lo,Xs,Sl,w0,j0,Bf]},Xr={findFiberByHostInstance:xs,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},hS={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:kn.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=k0(e),e===null?null:e.stateNode},findFiberByHostInstance:Xr.findFiberByHostInstance||dS,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(hS),Qt=Bo}catch{}}gt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=mS;gt.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Xf(t))throw Error(U(200));return uS(e,t,null,n)};gt.createRoot=function(e,t){if(!Xf(e))throw Error(U(299));var n=!1,s="",i=iv;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(s=t.identifierPrefix),t.onRecoverableError!==void 0&&(i=t.onRecoverableError)),t=Kf(e,1,!1,null,null,n,!1,s,i),e[yn]=t.current,_i(e.nodeType===8?e.parentNode:e),new Yf(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=k0(t),e=e===null?null:e.stateNode,e};gt.flushSync=function(e){return _s(e)};gt.hydrate=function(e,t,n){if(!Ml(t))throw Error(U(200));return Il(null,e,t,!0,n)};gt.hydrateRoot=function(e,t,n){if(!Xf(e))throw Error(U(405));var s=n!=null&&n.hydratedSources||null,i=!1,o="",a=iv;if(n!=null&&(n.unstable_strictMode===!0&&(i=!0),n.identifierPrefix!==void 0&&(o=n.identifierPrefix),n.onRecoverableError!==void 0&&(a=n.onRecoverableError)),t=rv(t,null,e,1,n??null,i,!1,o,a),e[yn]=t.current,_i(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 _l(t)};gt.render=function(e,t,n){if(!Ml(t))throw Error(U(200));return Il(null,e,t,!1,n)};gt.unmountComponentAtNode=function(e){if(!Ml(e))throw Error(U(40));return e._reactRootContainer?(_s(function(){Il(null,null,e,!1,function(){e._reactRootContainer=null,e[yn]=null})}),!0):!1};gt.unstable_batchedUpdates=Bf;gt.unstable_renderSubtreeIntoContainer=function(e,t,n,s){if(!Ml(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 ov(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(ov)}catch(e){console.error(e)}}ov(),o0.exports=gt;var Ol=o0.exports;const pS=Gx(Ol);var jp=Ol;fu.createRoot=jp.createRoot,fu.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 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)}var Vn;(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"})(Vn||(Vn={}));const Np="popstate";function gS(e){e===void 0&&(e={});function t(s,i){let{pathname:o,search:a,hash:l}=s.location;return id("",{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 yS(t,n,null,e)}function je(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function av(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function xS(){return Math.random().toString(36).substr(2,8)}function Sp(e,t){return{usr:e.state,key:e.key,idx:t}}function id(e,t,n,s){return n===void 0&&(n=null),Vi({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?Pr(t):t,{state:n,key:t&&t.key||s||xS()})}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 yS(e,t,n,s){s===void 0&&(s={});let{window:i=document.defaultView,v5Compat:o=!1}=s,a=i.history,l=Vn.Pop,c=null,u=d();u==null&&(u=0,a.replaceState(Vi({},a.state,{idx:u}),""));function d(){return(a.state||{idx:null}).idx}function f(){l=Vn.Pop;let p=d(),h=p==null?null:p-u;u=p,c&&c({action:l,location:v.location,delta:h})}function m(p,h){l=Vn.Push;let x=id(v.location,p,h);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(p,h){l=Vn.Replace;let x=id(v.location,p,h);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(p){let h=i.location.origin!=="null"?i.location.origin:i.location.href,x=typeof p=="string"?p:tl(p);return x=x.replace(/ $/,"%20"),je(h,"No window.location.(origin|href) available to create URL for href: "+x),new URL(x,h)}let v={get action(){return l},get location(){return e(i,a)},listen(p){if(c)throw new Error("A history only accepts one active listener");return i.addEventListener(Np,f),c=p,()=>{i.removeEventListener(Np,f),c=null}},createHref(p){return t(i,p)},createURL:j,encodeLocation(p){let h=j(p);return{pathname:h.pathname,search:h.search,hash:h.hash}},push:m,replace:b,go(p){return a.go(p)}};return v}var Cp;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(Cp||(Cp={}));function vS(e,t,n){return n===void 0&&(n="/"),bS(e,t,n)}function bS(e,t,n,s){let i=typeof t=="string"?Pr(t):t,o=Qf(i.pathname||"/",n);if(o==null)return null;let a=lv(e);wS(a);let l=null;for(let c=0;l==null&&c<a.length;++c){let u=MS(o);l=RS(a[c],u)}return l}function lv(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+'".')),lv(o.children,t,d,u)),!(o.path==null&&!o.index)&&t.push({path:u,score:TS(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 cv(o.path))i(o,a,c)}),t}function cv(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=cv(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 wS(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:AS(t.routesMeta.map(s=>s.childrenIndex),n.routesMeta.map(s=>s.childrenIndex)))}const jS=/^:[\w-]+$/,NS=3,SS=2,CS=1,ES=10,kS=-2,Ep=e=>e==="*";function TS(e,t){let n=e.split("/"),s=n.length;return n.some(Ep)&&(s+=kS),t&&(s+=SS),n.filter(i=>!Ep(i)).reduce((i,o)=>i+(jS.test(o)?NS:o===""?CS:ES),s)}function AS(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 RS(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=PS({path:c.relativePath,caseSensitive:c.caseSensitive,end:u},d),m=c.route;if(!f)return null;Object.assign(i,f.params),a.push({params:i,pathname:Xn([o,f.pathname]),pathnameBase:DS(Xn([o,f.pathnameBase])),route:m}),f.pathnameBase!=="/"&&(o=Xn([o,f.pathnameBase]))}return a}function PS(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,s]=_S(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:m,isOptional:b}=d;if(m==="*"){let v=l[f]||"";a=o.slice(0,o.length-v.length).replace(/(.)\/+$/,"$1")}const j=l[f];return b&&!j?u[m]=void 0:u[m]=(j||"").replace(/%2F/g,"/"),u},{}),pathname:o,pathnameBase:a,pattern:e}}function _S(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),av(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 MS(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return av(!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 Qf(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 IS(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:OS(n,t):t,search:FS(s),hash:$S(i)}}function OS(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 LS(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function Jf(e,t){let n=LS(e);return t?n.map((s,i)=>i===n.length-1?s.pathname:s.pathnameBase):n.map(s=>s.pathnameBase)}function Zf(e,t,n,s){s===void 0&&(s=!1);let i;typeof e=="string"?i=Pr(e):(i=Vi({},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 m=a.split("/");for(;m[0]==="..";)m.shift(),f-=1;i.pathname=m.join("/")}l=f>=0?t[f]:"/"}let c=IS(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,"/"),DS=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),FS=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,$S=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function US(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const uv=["post","put","patch","delete"];new Set(uv);const VS=["get",...uv];new Set(VS);/**
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 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)}const em=g.createContext(null),zS=g.createContext(null),ls=g.createContext(null),Ll=g.createContext(null),Tn=g.createContext({outlet:null,matches:[],isDataRoute:!1}),dv=g.createContext(null);function BS(e,t){let{relative:n}=t===void 0?{}:t;_r()||je(!1);let{basename:s,navigator:i}=g.useContext(ls),{hash:o,pathname:a,search:l}=hv(e,{relative:n}),c=a;return s!=="/"&&(c=a==="/"?s:Xn([s,a])),i.createHref({pathname:c,search:l,hash:o})}function _r(){return g.useContext(Ll)!=null}function Ds(){return _r()||je(!1),g.useContext(Ll).location}function fv(e){g.useContext(ls).static||g.useLayoutEffect(e)}function uo(){let{isDataRoute:e}=g.useContext(Tn);return e?nC():WS()}function WS(){_r()||je(!1);let e=g.useContext(em),{basename:t,future:n,navigator:s}=g.useContext(ls),{matches:i}=g.useContext(Tn),{pathname:o}=Ds(),a=JSON.stringify(Jf(i,n.v7_relativeSplatPath)),l=g.useRef(!1);return fv(()=>{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=Zf(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 mv(){let{matches:e}=g.useContext(Tn),t=e[e.length-1];return t?t.params:{}}function hv(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(Jf(i,s.v7_relativeSplatPath));return g.useMemo(()=>Zf(e,JSON.parse(a),o,n==="path"),[e,a,o,n])}function HS(e,t){return qS(e,t)}function qS(e,t,n,s){_r()||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 p=typeof t=="string"?Pr(t):t;c==="/"||(f=p.pathname)!=null&&f.startsWith(c)||je(!1),d=p}else d=u;let m=d.pathname||"/",b=m;if(c!=="/"){let p=c.replace(/^\//,"").split("/");b="/"+m.replace(/^\//,"").split("/").slice(p.length).join("/")}let j=vS(e,{pathname:b}),v=QS(j&&j.map(p=>Object.assign({},p,{params:Object.assign({},l,p.params),pathname:Xn([c,i.encodeLocation?i.encodeLocation(p.pathname).pathname:p.pathname]),pathnameBase:p.pathnameBase==="/"?c:Xn([c,i.encodeLocation?i.encodeLocation(p.pathnameBase).pathname:p.pathnameBase])})),o,n,s);return t&&v?g.createElement(Ll.Provider,{value:{location:zi({pathname:"/",search:"",hash:"",state:null,key:"default"},d),navigationType:Vn.Pop}},v):v}function KS(){let e=tC(),t=US(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 GS=g.createElement(KS,null);class YS 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(dv.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function XS(e){let{routeContext:t,match:n,children:s}=e,i=g.useContext(em);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 QS(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:m,errors:b}=n,j=f.route.loader&&m[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,m)=>{let b,j=!1,v=null,p=null;n&&(b=l&&f.route.id?l[f.route.id]:void 0,v=f.route.errorElement||GS,c&&(u<0&&m===0?(sC("route-fallback"),j=!0,p=null):u===m&&(j=!0,p=f.route.hydrateFallbackElement||null)));let h=t.concat(a.slice(0,m+1)),x=()=>{let y;return b?y=v:j?y=p:f.route.Component?y=g.createElement(f.route.Component,null):f.route.element?y=f.route.element:y=d,g.createElement(XS,{match:f,routeContext:{outlet:d,matches:h,isDataRoute:n!=null},children:y})};return n&&(f.route.ErrorBoundary||f.route.errorElement||m===0)?g.createElement(YS,{location:n.location,revalidation:n.revalidation,component:v,error:b,children:x(),routeContext:{outlet:null,matches:h,isDataRoute:!0}}):x()},null)}var pv=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(pv||{}),gv=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}(gv||{});function JS(e){let t=g.useContext(em);return t||je(!1),t}function ZS(e){let t=g.useContext(zS);return t||je(!1),t}function eC(e){let t=g.useContext(Tn);return t||je(!1),t}function xv(e){let t=eC(),n=t.matches[t.matches.length-1];return n.route.id||je(!1),n.route.id}function tC(){var e;let t=g.useContext(dv),n=ZS(),s=xv();return t!==void 0?t:(e=n.errors)==null?void 0:e[s]}function nC(){let{router:e}=JS(pv.UseNavigateStable),t=xv(gv.UseNavigateStable),n=g.useRef(!1);return fv(()=>{n.current=!0}),g.useCallback(function(i,o){o===void 0&&(o={}),n.current&&(typeof i=="number"?e.navigate(i):e.navigate(i,zi({fromRouteId:t},o)))},[e,t])}const kp={};function sC(e,t,n){kp[e]||(kp[e]=!0)}function rC(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;_r()||je(!1);let{future:o,static:a}=g.useContext(ls),{matches:l}=g.useContext(Tn),{pathname:c}=Ds(),u=uo(),d=Zf(t,Jf(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 iC(e){let{basename:t="/",children:n=null,location:s,navigationType:i=Vn.Pop,navigator:o,static:a=!1,future:l}=e;_r()&&je(!1);let c=t.replace(/^\/*/,"/"),u=g.useMemo(()=>({basename:c,navigator:o,static:a,future:zi({v7_relativeSplatPath:!1},l)}),[c,l,o,a]);typeof s=="string"&&(s=Pr(s));let{pathname:d="/",search:f="",hash:m="",state:b=null,key:j="default"}=s,v=g.useMemo(()=>{let p=Qf(d,c);return p==null?null:{location:{pathname:p,search:f,hash:m,state:b,key:j},navigationType:i}},[c,d,f,m,b,j,i]);return v==null?null:g.createElement(ls.Provider,{value:u},g.createElement(Ll.Provider,{children:n,value:v}))}function oC(e){let{children:t,location:n}=e;return HS(od(t),n)}new Promise(()=>{});function od(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,od(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=od(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 ad(){return ad=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},ad.apply(this,arguments)}function aC(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 lC(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function cC(e,t){return e.button===0&&(!t||t==="_self")&&!lC(e)}const uC=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],dC="6";try{window.__reactRouterVersion=dC}catch{}const fC="startTransition",Ap=of[fC];function mC(e){let{basename:t,children:n,future:s,window:i}=e,o=g.useRef();o.current==null&&(o.current=gS({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(()=>rC(s),[s]),g.createElement(iC,{basename:t,children:n,location:l.location,navigationType:l.action,navigator:a,future:s})}const hC=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",pC=/^(?:[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,m=aC(t,uC),{basename:b}=g.useContext(ls),j,v=!1;if(typeof u=="string"&&pC.test(u)&&(j=u,hC))try{let y=new URL(window.location.href),w=u.startsWith("//")?new URL(y.protocol+u):new URL(u),S=Qf(w.pathname,b);w.origin===y.origin&&S!=null?u=S+w.search+w.hash:v=!0}catch{}let p=BS(u,{relative:i}),h=gC(u,{replace:a,state:l,target:c,preventScrollReset:d,relative:i,viewTransition:f});function x(y){s&&s(y),y.defaultPrevented||h(y)}return g.createElement("a",ad({},m,{href:j||p,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 _p;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(_p||(_p={}));function gC(e,t){let{target:n,replace:s,state:i,preventScrollReset:o,relative:a,viewTransition:l}=t===void 0?{}:t,c=uo(),u=Ds(),d=hv(e,{relative:a});return g.useCallback(f=>{if(cC(f,n)){f.preventDefault();let m=s!==void 0?s:tl(u)===tl(d);c(e,{replace:m,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 ld={type:"error",data:"parser error"},yv=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",vv=typeof ArrayBuffer=="function",bv=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,tm=({type:e,data:t},n,s)=>yv&&t instanceof Blob?n?s(t):Mp(t,s):vv&&(t instanceof ArrayBuffer||bv(t))?n?s(t):Mp(new Blob([t]),s):s(rn[e]+(t||"")),Mp=(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 _c;function xC(e,t){if(yv&&e.data instanceof Blob)return e.data.arrayBuffer().then(Ip).then(t);if(vv&&(e.data instanceof ArrayBuffer||bv(e.data)))return t(Ip(e.data));tm(e,!1,n=>{_c||(_c=new TextEncoder),t(_c.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 yC=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},vC=typeof ArrayBuffer=="function",nm=(e,t)=>{if(typeof e!="string")return{type:"message",data:wv(e,t)};const n=e.charAt(0);return n==="b"?{type:"message",data:bC(e.substring(1),t)}:pa[n]?e.length>1?{type:pa[n],data:e.substring(1)}:{type:pa[n]}:ld},bC=(e,t)=>{if(vC){const n=yC(e);return wv(n,t)}else return{base64:!0,data:e}},wv=(e,t)=>{switch(t){case"blob":return e instanceof Blob?e:new Blob([e]);case"arraybuffer":default:return e instanceof ArrayBuffer?e:e.buffer}},jv="",wC=(e,t)=>{const n=e.length,s=new Array(n);let i=0;e.forEach((o,a)=>{tm(o,!1,l=>{s[a]=l,++i===n&&t(s.join(jv))})})},jC=(e,t)=>{const n=e.split(jv),s=[];for(let i=0;i<n.length;i++){const o=nm(n[i],t);if(s.push(o),o.type==="error")break}return s};function NC(){return new TransformStream({transform(e,t){xC(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 Mc;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 SC(e,t){Mc||(Mc=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(ld);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(nm(o?c:Mc.decode(c),t)),s=0}if(i===0||i>e){l.enqueue(ld);break}}}})}const Nv=4;function Ee(e){if(e)return CC(e)}function CC(e){for(var t in Ee.prototype)e[t]=Ee.prototype[t];return e}Ee.prototype.on=Ee.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this};Ee.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this};Ee.prototype.off=Ee.prototype.removeListener=Ee.prototype.removeAllListeners=Ee.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};Ee.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};Ee.prototype.emitReserved=Ee.prototype.emit;Ee.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]};Ee.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")(),EC="arraybuffer";function Sv(e,...t){return t.reduce((n,s)=>(e.hasOwnProperty(s)&&(n[s]=e[s]),n),{})}const kC=St.setTimeout,TC=St.clearTimeout;function Fl(e,t){t.useNativeTimers?(e.setTimeoutFn=kC.bind(St),e.clearTimeoutFn=TC.bind(St)):(e.setTimeoutFn=St.setTimeout.bind(St),e.clearTimeoutFn=St.clearTimeout.bind(St))}const AC=1.33;function RC(e){return typeof e=="string"?PC(e):Math.ceil((e.byteLength||e.size)*AC)}function PC(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 Cv(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function _C(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}function MC(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 IC extends Error{constructor(t,n,s){super(t),this.description=n,this.context=s,this.type="TransportError"}}class sm extends Ee{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 IC(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=nm(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=_C(t);return n.length?"?"+n:""}}class OC extends sm{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)};jC(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,wC(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]=Cv()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(t,n)}}let Ev=!1;try{Ev=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const LC=Ev;function DC(){}class FC extends OC{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 Ee{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=Sv(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=DC,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 $C=function(){const e=kv({xdomain:!1});return e&&e.responseType!==null}();class UC extends FC{constructor(t){super(t);const n=t&&t.forceBase64;this.supportsBinary=$C&&!n}request(t={}){return Object.assign(t,{xd:this.xd},this.opts),new hr(kv,this.uri(),t)}}function kv(e){const t=e.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!t||LC))return new XMLHttpRequest}catch{}if(!t)try{return new St[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const Tv=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class VC extends sm{get name(){return"websocket"}doOpen(){const t=this.uri(),n=this.opts.protocols,s=Tv?{}:Sv(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;tm(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]=Cv()),this.supportsBinary||(n.b64=1),this.createUri(t,n)}}const Ic=St.WebSocket||St.MozWebSocket;class zC extends VC{createSocket(t,n,s){return Tv?new Ic(t,n,s):n?new Ic(t,n):new Ic(t)}doWrite(t,n){this.ws.send(n)}}class BC extends sm{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=SC(Number.MAX_SAFE_INTEGER,this.socket.binaryType),s=t.readable.pipeThrough(n).getReader(),i=NC();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 WC={websocket:zC,webtransport:BC,polling:UC},HC=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,qC=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function cd(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=HC.exec(e||""),o={},a=14;for(;a--;)o[qC[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=KC(o,o.path),o.queryKey=GC(o,o.query),o}function KC(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 GC(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(s,i,o){i&&(n[i]=o)}),n}const ud=typeof addEventListener=="function"&&typeof removeEventListener=="function",xa=[];ud&&addEventListener("offline",()=>{xa.forEach(e=>e())},!1);class Qn extends Ee{constructor(t,n){if(super(),this.binaryType=EC,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=cd(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=cd(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=MC(this.opts.query)),ud&&(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=Nv,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+=RC(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(),ud&&(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=Nv;class YC 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 m=new Error("probe error");m.transport=n.name,this.emitReserved("upgradeError",m)}}))};function o(){s||(s=!0,d(),n.close(),n=null)}const a=f=>{const m=new Error("probe error: "+f);m.transport=n.name,o(),this.emitReserved("upgradeError",m)};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 XC=class extends YC{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=>WC[i]).filter(i=>!!i)),super(t,s)}};function QC(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=cd(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 JC=typeof ArrayBuffer=="function",ZC=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,Av=Object.prototype.toString,eE=typeof Blob=="function"||typeof Blob<"u"&&Av.call(Blob)==="[object BlobConstructor]",tE=typeof File=="function"||typeof File<"u"&&Av.call(File)==="[object FileConstructor]";function rm(e){return JC&&(e instanceof ArrayBuffer||ZC(e))||eE&&e instanceof Blob||tE&&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(rm(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 nE(e){const t=[],n=e.data,s=e;return s.data=dd(n,t),s.attachments=t.length,{packet:s,buffers:t}}function dd(e,t){if(!e)return e;if(rm(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]=dd(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]=dd(e[s],t));return n}return e}function sE(e,t){return e.data=fd(e.data,t),delete e.attachments,e}function fd(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]=fd(e[n],t);else if(typeof e=="object")for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=fd(e[n],t));return e}const rE=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],iE=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 oE{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=nE(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 im extends Ee{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 aE(n),n.attachments===0&&super.emitReserved("decoded",n)):super.emitReserved("decoded",n)}else if(rm(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(im.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"&&rE.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 aE{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=sE(this.reconPack,this.buffers);return this.finishedReconstruction(),n}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const lE=Object.freeze(Object.defineProperty({__proto__:null,Decoder:im,Encoder:oE,get PacketType(){return ne},protocol:iE},Symbol.toStringTag,{value:"Module"}));function Dt(e,t,n){return e.on(t,n),function(){e.off(t,n)}}const cE=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Rv extends Ee{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(cE.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 Mr(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}Mr.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};Mr.prototype.reset=function(){this.attempts=0};Mr.prototype.setMin=function(e){this.ms=e};Mr.prototype.setMax=function(e){this.max=e};Mr.prototype.setJitter=function(e){this.jitter=e};class md extends Ee{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 Mr({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||lE;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 XC(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 Rv(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=QC(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 md(s,t):(Qr[i]||(Qr[i]=new md(s,t)),c=Qr[i]),n.query&&!t.query&&(t.query=n.queryKey),c.socket(n.path,t)}Object.assign(va,{Manager:md,Socket:Rv,io:va,connect:va});const Pv=g.createContext(),an=()=>{const e=g.useContext(Pv);if(!e)throw new Error("useSocket must be used within SocketProvider");return e},uE=({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(Pv.Provider,{value:{socket:t,connected:s,emit:o,on:a},children:e})};function _v(e,t){return function(){return e.apply(t,arguments)}}const{toString:dE}=Object.prototype,{getPrototypeOf:om}=Object,{iterator:$l,toStringTag:Mv}=Symbol,Ul=(e=>t=>{const n=dE.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),Wt=e=>(e=e.toLowerCase(),t=>Ul(t)===e),Vl=e=>t=>typeof t===e,{isArray:Ir}=Array,Bi=Vl("undefined");function fE(e){return e!==null&&!Bi(e)&&e.constructor!==null&&!Bi(e.constructor)&&at(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Iv=Wt("ArrayBuffer");function mE(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Iv(e.buffer),t}const hE=Vl("string"),at=Vl("function"),Ov=Vl("number"),zl=e=>e!==null&&typeof e=="object",pE=e=>e===!0||e===!1,ba=e=>{if(Ul(e)!=="object")return!1;const t=om(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Mv in e)&&!($l in e)},gE=Wt("Date"),xE=Wt("File"),yE=Wt("Blob"),vE=Wt("FileList"),bE=e=>zl(e)&&at(e.pipe),wE=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]"))},jE=Wt("URLSearchParams"),[NE,SE,CE,EE]=["ReadableStream","Request","Response","Headers"].map(Wt),kE=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 Lv(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,Dv=e=>!Bi(e)&&e!==bs;function hd(){const{caseless:e}=Dv(this)&&this||{},t={},n=(s,i)=>{const o=e&&Lv(t,i)||i;ba(t[o])&&ba(s)?t[o]=hd(t[o],s):ba(s)?t[o]=hd({},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 TE=(e,t,n,{allOwnKeys:s}={})=>(fo(t,(i,o)=>{n&&at(i)?e[o]=_v(i,n):e[o]=i},{allOwnKeys:s}),e),AE=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),RE=(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)},PE=(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&&om(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},_E=(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},ME=e=>{if(!e)return null;if(Ir(e))return e;let t=e.length;if(!Ov(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},IE=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&om(Uint8Array)),OE=(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])}},LE=(e,t)=>{let n;const s=[];for(;(n=e.exec(t))!==null;)s.push(n);return s},DE=Wt("HTMLFormElement"),FE=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),$E=Wt("RegExp"),Fv=(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)},UE=e=>{Fv(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+"'")})}})},VE=(e,t)=>{const n={},s=i=>{i.forEach(o=>{n[o]=!0})};return Ir(e)?s(e):s(String(e).split(t)),n},zE=()=>{},BE=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function WE(e){return!!(e&&at(e.append)&&e[Mv]==="FormData"&&e[$l])}const HE=e=>{const t=new Array(10),n=(s,i)=>{if(zl(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)},qE=Wt("AsyncFunction"),KE=e=>e&&(zl(e)||at(e))&&at(e.then)&&at(e.catch),$v=((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)),GE=typeof queueMicrotask<"u"?queueMicrotask.bind(bs):typeof process<"u"&&process.nextTick||$v,YE=e=>e!=null&&at(e[$l]),L={isArray:Ir,isArrayBuffer:Iv,isBuffer:fE,isFormData:wE,isArrayBufferView:mE,isString:hE,isNumber:Ov,isBoolean:pE,isObject:zl,isPlainObject:ba,isReadableStream:NE,isRequest:SE,isResponse:CE,isHeaders:EE,isUndefined:Bi,isDate:gE,isFile:xE,isBlob:yE,isRegExp:$E,isFunction:at,isStream:bE,isURLSearchParams:jE,isTypedArray:IE,isFileList:vE,forEach:fo,merge:hd,extend:TE,trim:kE,stripBOM:AE,inherits:RE,toFlatObject:PE,kindOf:Ul,kindOfTest:Wt,endsWith:_E,toArray:ME,forEachEntry:OE,matchAll:LE,isHTMLForm:DE,hasOwnProperty:Fp,hasOwnProp:Fp,reduceDescriptors:Fv,freezeMethods:UE,toObjectSet:VE,toCamelCase:FE,noop:zE,toFiniteNumber:BE,findKey:Lv,global:bs,isContextDefined:Dv,isSpecCompliantForm:WE,toJSONObject:HE,isAsyncFn:qE,isThenable:KE,setImmediate:$v,asap:GE,isIterable:YE};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 Uv=J.prototype,Vv={};["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=>{Vv[e]={value:e}});Object.defineProperties(J,Vv);Object.defineProperty(Uv,"isAxiosError",{value:!0});J.from=(e,t,n,s,i,o)=>{const a=Object.create(Uv);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 XE=null;function pd(e){return L.isPlainObject(e)||L.isArray(e)}function zv(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=zv(i),!n&&o?"["+i+"]":i}).join(n?".":""):t}function QE(e){return L.isArray(e)&&!e.some(pd)}const JE=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,p){return!L.isUndefined(p[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,p){let h=j;if(j&&!p&&typeof j=="object"){if(L.endsWith(v,"{}"))v=s?v:v.slice(0,-2),j=JSON.stringify(j);else if(L.isArray(j)&&QE(j)||(L.isFileList(j)||L.endsWith(v,"[]"))&&(h=L.toArray(j)))return v=zv(v),h.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 pd(j)?!0:(t.append($p(p,v,o),u(j)),!1)}const f=[],m=Object.assign(JE,{defaultVisitor:d,convertValue:u,isVisitable:pd});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(h,x){(!(L.isUndefined(h)||h===null)&&i.call(t,h,L.isString(x)?x.trim():x,v,m))===!0&&b(h,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 am(e,t){this._pairs=[],e&&Bl(e,this,t)}const Bv=am.prototype;Bv.append=function(t,n){this._pairs.push([t,n])};Bv.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 ZE(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Wv(e,t,n){if(!t)return e;const s=n&&n.encode||ZE;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 am(t,n).toString(s),o){const a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}class Vp{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 Hv={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},ek=typeof URLSearchParams<"u"?URLSearchParams:am,tk=typeof FormData<"u"?FormData:null,nk=typeof Blob<"u"?Blob:null,sk={isBrowser:!0,classes:{URLSearchParams:ek,FormData:tk,Blob:nk},protocols:["http","https","file","blob","url","data"]},lm=typeof window<"u"&&typeof document<"u",gd=typeof navigator=="object"&&navigator||void 0,rk=lm&&(!gd||["ReactNative","NativeScript","NS"].indexOf(gd.product)<0),ik=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",ok=lm&&window.location.href||"http://localhost",ak=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:lm,hasStandardBrowserEnv:rk,hasStandardBrowserWebWorkerEnv:ik,navigator:gd,origin:ok},Symbol.toStringTag,{value:"Module"})),Ue={...ak,...sk};function lk(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 ck(e){return L.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function uk(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 qv(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]=uk(i[a])),!l)}if(L.isFormData(e)&&L.isFunction(e.entries)){const n={};return L.forEachEntry(e,(s,i)=>{t(ck(s),i,n,0)}),n}return null}function dk(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:Hv,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(qv(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 lk(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),dk(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 fk=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"]),mk=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]&&fk[n])&&(n==="set-cookie"?t[n]?t[n].push(s):t[n]=[s]:t[n]=t[n]?t[n]+", "+s:s)}),t},zp=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 hk(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 pk=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 gk(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,s)=>n.toUpperCase()+s)}function xk(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())&&!pk(t))a(mk(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 hk(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?gk(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[zp]=this[zp]={accessors:{}}).accessors,i=this.prototype;function o(a){const l=Jr(a);s[l]||(xk(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 Kv(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 Gv(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 yk(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function vk(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,m=0;for(;f!==i;)m+=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(m*1e3/b):void 0}}function bk(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=vk(50,250);return bk(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)),wk=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,jk=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 Nk(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function Sk(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function Yv(e,t,n){let s=!Nk(t);return e&&(s||n==!1)?Sk(e,t):t}const Hp=e=>e instanceof lt?{...e}:e;function Ms(e,t){t=t||{};const n={};function s(u,d,f,m){return L.isPlainObject(u)&&L.isPlainObject(d)?L.merge.call({caseless:m},u,d):L.isPlainObject(d)?L.merge({},d):L.isArray(d)?d.slice():d}function i(u,d,f,m){if(L.isUndefined(d)){if(!L.isUndefined(u))return s(void 0,u,f,m)}else return s(u,d,f,m)}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,m=f(e[d],t[d],d);L.isUndefined(m)&&f!==l||(n[d]=m)}),n}const Xv=e=>{const t=Ms({},e);let{data:n,withXSRFToken:s,xsrfHeaderName:i,xsrfCookieName:o,headers:a,auth:l}=t;t.headers=a=lt.from(a),t.url=Wv(Yv(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&&wk(t.url))){const u=i&&o&&jk.read(o);u&&a.set(i,u)}return t},Ck=typeof XMLHttpRequest<"u",Ek=Ck&&function(e){return new Promise(function(n,s){const i=Xv(e);let o=i.data;const a=lt.from(i.headers).normalize();let{responseType:l,onUploadProgress:c,onDownloadProgress:u}=i,d,f,m,b,j;function v(){b&&b(),j&&j(),i.cancelToken&&i.cancelToken.unsubscribe(d),i.signal&&i.signal.removeEventListener("abort",d)}let p=new XMLHttpRequest;p.open(i.method.toUpperCase(),i.url,!0),p.timeout=i.timeout;function h(){if(!p)return;const y=lt.from("getAllResponseHeaders"in p&&p.getAllResponseHeaders()),S={data:!l||l==="text"||l==="json"?p.responseText:p.response,status:p.status,statusText:p.statusText,headers:y,config:e,request:p};Gv(function(E){n(E),v()},function(E){s(E),v()},S),p=null}"onloadend"in p?p.onloadend=h:p.onreadystatechange=function(){!p||p.readyState!==4||p.status===0&&!(p.responseURL&&p.responseURL.indexOf("file:")===0)||setTimeout(h)},p.onabort=function(){p&&(s(new J("Request aborted",J.ECONNABORTED,e,p)),p=null)},p.onerror=function(){s(new J("Network Error",J.ERR_NETWORK,e,p)),p=null},p.ontimeout=function(){let w=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const S=i.transitional||Hv;i.timeoutErrorMessage&&(w=i.timeoutErrorMessage),s(new J(w,S.clarifyTimeoutError?J.ETIMEDOUT:J.ECONNABORTED,e,p)),p=null},o===void 0&&a.setContentType(null),"setRequestHeader"in p&&L.forEach(a.toJSON(),function(w,S){p.setRequestHeader(S,w)}),L.isUndefined(i.withCredentials)||(p.withCredentials=!!i.withCredentials),l&&l!=="json"&&(p.responseType=i.responseType),u&&([m,j]=nl(u,!0),p.addEventListener("progress",m)),c&&p.upload&&([f,b]=nl(c),p.upload.addEventListener("progress",f),p.upload.addEventListener("loadend",b)),(i.cancelToken||i.signal)&&(d=y=>{p&&(s(!y||y.type?new Or(null,e,p):y),p.abort(),p=null)},i.cancelToken&&i.cancelToken.subscribe(d),i.signal&&(i.signal.aborted?d():i.signal.addEventListener("abort",d)));const x=yk(i.url);if(x&&Ue.protocols.indexOf(x)===-1){s(new J("Unsupported protocol "+x+":",J.ERR_BAD_REQUEST,e));return}p.send(o||null)})},kk=(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}},Tk=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},Ak=async function*(e,t){for await(const n of Rk(e))yield*Tk(n,t)},Rk=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=Ak(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 m=o+=f;n(m)}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",Qv=Wl&&typeof ReadableStream=="function",Pk=Wl&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),Jv=(e,...t)=>{try{return!!e(...t)}catch{return!1}},_k=Qv&&Jv(()=>{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,xd=Qv&&Jv(()=>L.isReadableStream(new Response("").body)),sl={stream:xd&&(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 Mk=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 Pk(e)).byteLength},Ik=async(e,t)=>{const n=L.toFiniteNumber(e.getContentLength());return n??Mk(t)},Ok=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:m}=Xv(e);u=u?(u+"").toLowerCase():"text";let b=kk([i,o&&o.toAbortSignal()],a),j;const v=b&&b.unsubscribe&&(()=>{b.unsubscribe()});let p;try{if(c&&_k&&n!=="get"&&n!=="head"&&(p=await Ik(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[E,T]=Bp(p,nl(Wp(c)));s=qp(S.body,Kp,E,T)}}L.isString(f)||(f=f?"include":"omit");const h="credentials"in Request.prototype;j=new Request(t,{...m,signal:b,method:n.toUpperCase(),headers:d.normalize().toJSON(),body:s,duplex:"half",credentials:h?f:void 0});let x=await fetch(j,m);const y=xd&&(u==="stream"||u==="response");if(xd&&(l||y&&v)){const S={};["status","statusText","headers"].forEach(N=>{S[N]=x[N]});const C=L.toFiniteNumber(x.headers.get("content-length")),[E,T]=l&&Bp(C,nl(Wp(l),!0))||[];x=new Response(qp(x.body,Kp,E,()=>{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)=>{Gv(S,C,{data:w,headers:lt.from(x.headers),status:x.status,statusText:x.statusText,config:e,request:j})})}catch(h){throw v&&v(),h&&h.name==="TypeError"&&/Load failed|fetch/i.test(h.message)?Object.assign(new J("Network Error",J.ERR_NETWORK,e,j),{cause:h.cause||h}):J.from(h,h&&h.code,e,j)}}),yd={http:XE,xhr:Ek,fetch:Ok};L.forEach(yd,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const Gp=e=>`- ${e}`,Lk=e=>L.isFunction(e)||e===null||e===!1,Zv={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,!Lk(n)&&(s=yd[(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:yd};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),Zv.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 Kv(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 eb="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"+eb+"] 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 Dk(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:Dk,validators:Hl},qt=ja.validators;let Cs=class{constructor(t){this.defaults=t||{},this.interceptors={request:new Vp,response:new Vp}}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=Ms(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,m;if(!c){const j=[Yp.bind(this),void 0];for(j.unshift.apply(j,l),j.push.apply(j,u),m=j.length,d=Promise.resolve(n);f<m;)d=d.then(j[f++],j[f++]);return d}m=l.length;let b=n;for(f=0;f<m;){const j=l[f++],v=l[f++];try{b=j(b)}catch(p){v.call(this,p);break}}try{d=Yp.call(this,b)}catch(j){return Promise.reject(j)}for(f=0,m=u.length;f<m;)d=d.then(u[f++],u[f++]);return d}getUri(t){t=Ms(this.defaults,t);const n=Yv(t.baseURL,t.url,t.allowAbsoluteUrls);return Wv(n,t.params,t.paramsSerializer)}};L.forEach(["delete","get","head","options"],function(t){Cs.prototype[t]=function(n,s){return this.request(Ms(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(Ms(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 Fk=class tb{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 tb(function(i){t=i}),cancel:t}}};function $k(e){return function(n){return e.apply(null,n)}}function Uk(e){return L.isObject(e)&&e.isAxiosError===!0}const vd={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(vd).forEach(([e,t])=>{vd[t]=e});function nb(e){const t=new Cs(e),n=_v(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 nb(Ms(e,i))},n}const Ne=nb(mo);Ne.Axios=Cs;Ne.CanceledError=Or;Ne.CancelToken=Fk;Ne.isCancel=Kv;Ne.VERSION=eb;Ne.toFormData=Bl;Ne.AxiosError=J;Ne.Cancel=Ne.CanceledError;Ne.all=function(t){return Promise.all(t)};Ne.spread=$k;Ne.isAxiosError=Uk;Ne.mergeConfig=Ms;Ne.AxiosHeaders=lt;Ne.formToJSON=e=>qv(L.isHTMLForm(e)?new FormData(e):e);Ne.getAdapter=Zv.getAdapter;Ne.HttpStatusCode=vd;Ne.default=Ne;const{Axios:DL,AxiosError:FL,CanceledError:$L,isCancel:UL,CancelToken:VL,VERSION:zL,all:BL,Cancel:WL,isAxiosError:HL,spread:qL,toFormData:KL,AxiosHeaders:GL,HttpStatusCode:YL,formToJSON:XL,getAdapter:QL,mergeConfig:JL}=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 sb=g.createContext(),_t=()=>{const e=g.useContext(sb);if(!e)throw new Error("useFrigg must be used within FriggProvider");return e},Vk=({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,m]=g.useState([]),[b,j]=g.useState([]),[v,p]=g.useState(null),[h,x]=g.useState([]),[y,w]=g.useState(null),[S,C]=g.useState(!0),[E,T]=g.useState(!1),[N,k]=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),k(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([]),[]}},_=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 M(),Ze}catch(ee){throw console.error("Error switching repository:",ee),ee}},M=async()=>{var H,q,ee,Ze,ch;try{T(!0),k(null);const[zr,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=zr.data.data)==null?void 0:H.status)||zr.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||{}),m(((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(zr){console.error("Error fetching initial data:",zr),k(zr.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 M(),q.data}catch(q){throw console.error("Error installing integration:",q),q}},V=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 M(),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 M(),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 M(),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 M(),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 M(),H.data}catch(H){throw console.error("Error deleting all users:",H),H}},Le=H=>{p(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}},Eo=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{p(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:h,currentRepository:y,isLoading:S,loading:E,error:N,startFrigg:O,stopFrigg:F,restartFrigg:$,getLogs:R,getMetrics:I,installIntegration:D,updateEnvVariable:V,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:Eo,fetchRepositories:P,switchRepository:_,refreshData:M};return r.jsx(sb.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 zk=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),rb=(...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 Bk={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 Wk=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,...Bk,width:t,height:t,stroke:e,strokeWidth:s?Number(n)*24/Number(t):n,className:rb("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(Wk,{ref:o,iconNode:t,className:rb(`lucide-${zk(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 Hk=[["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"}]],qk=X("Activity",Hk);/**
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 Kk=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],ib=X("ArrowLeft",Kk);/**
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 Gk=[["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"}]],Yk=X("ChartColumn",Gk);/**
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 Xk=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],cm=X("Check",Xk);/**
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 Qk=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],um=X("ChevronDown",Qk);/**
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 Jk=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],bd=X("ChevronRight",Jk);/**
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 Zk=[["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",Zk);/**
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 eT=[["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",eT);/**
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 tT=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],wd=X("CircleCheck",tT);/**
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 nT=[["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"}]],sT=X("CircleUser",nT);/**
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 rT=[["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"}]],ob=X("CircleX",rT);/**
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 iT=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],ab=X("Circle",iT);/**
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 oT=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]],Wi=X("Clock",oT);/**
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 aT=[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]],Hi=X("Code",aT);/**
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 lT=[["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",lT);/**
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 cT=[["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"}]],uT=X("Database",cT);/**
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 dT=[["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"}]],fT=X("Download",dT);/**
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 mT=[["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"}]],lb=X("ExternalLink",mT);/**
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 hT=[["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",hT);/**
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 pT=[["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"}]],gT=X("Folder",pT);/**
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 xT=[["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"}]],jd=X("GitBranch",xT);/**
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 yT=[["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"}]],cb=X("Grid3x3",yT);/**
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 vT=[["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"}]],bT=X("House",vT);/**
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 wT=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],jT=X("Info",wT);/**
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 NT=[["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"}]],ST=X("Key",NT);/**
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 CT=[["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"}]],Nd=X("Layers",CT);/**
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 ET=[["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"}]],kT=X("Link2",ET);/**
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 TT=[["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"}]],AT=X("Link",TT);/**
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 RT=[["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"}]],ub=X("List",RT);/**
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 PT=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],db=X("LoaderCircle",PT);/**
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 _T=[["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"}]],MT=X("Menu",_T);/**
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 IT=[["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"}]],OT=X("Monitor",IT);/**
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 LT=[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]],Jp=X("Moon",LT);/**
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 DT=[["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",DT);/**
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 FT=[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]],fb=X("Play",FT);/**
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 $T=[["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"}]],UT=X("Plug",$T);/**
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 VT=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Zp=X("Plus",VT);/**
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 zT=[["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",zT);/**
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 BT=[["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"}]],WT=X("Rocket",BT);/**
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 HT=[["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"}]],qT=X("Save",HT);/**
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 KT=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]],qi=X("Search",KT);/**
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 GT=[["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"}]],dm=X("Settings",GT);/**
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 YT=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],XT=X("Square",YT);/**
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 QT=[["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",QT);/**
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 JT=[["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"}]],ZT=X("TestTube",JT);/**
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 eA=[["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"}]],Sd=X("User",eA);/**
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 tA=[["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"}]],nA=X("Users",tA);/**
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 sA=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],rA=X("X",sA);/**
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 iA=[["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"}]],mb=X("Zap",iA);function hb(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=hb(e[t]))&&(s&&(s+=" "),s+=n)}else for(n in e)e[n]&&(s&&(s+=" "),s+=n);return s}function pb(){for(var e,t,n=0,s="",i=arguments.length;n<i;n++)(e=arguments[n])&&(t=hb(e))&&(s&&(s+=" "),s+=t);return s}const tg=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,ng=pb,gb=(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 m=tg(d)||tg(f);return i[u][m]}),l=n&&Object.entries(n).reduce((u,d)=>{let[f,m]=d;return m===void 0||(u[f]=m),u},{}),c=t==null||(s=t.compoundVariants)===null||s===void 0?void 0:s.reduce((u,d)=>{let{class:f,className:m,...b}=d;return Object.entries(b).every(j=>{let[v,p]=j;return Array.isArray(p)?p.includes({...o,...l}[v]):{...o,...l}[v]===p})?[...u,f,m]:u},[]);return ng(e,a,c,n==null?void 0:n.class,n==null?void 0:n.className)},fm="-",oA=e=>{const t=lA(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:s}=e;return{getClassGroupId:a=>{const l=a.split(fm);return l[0]===""&&l.length!==1&&l.shift(),xb(l,t)||aA(a)},getConflictingClassGroupIds:(a,l)=>{const c=n[a]||[];return l&&s[a]?[...c,...s[a]]:c}}},xb=(e,t)=>{var a;if(e.length===0)return t.classGroupId;const n=e[0],s=t.nextPart.get(n),i=s?xb(e.slice(1),s):void 0;if(i)return i;if(t.validators.length===0)return;const o=e.join(fm);return(a=t.validators.find(({validator:l})=>l(o)))==null?void 0:a.classGroupId},sg=/^\[(.+)\]$/,aA=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}},lA=e=>{const{theme:t,prefix:n}=e,s={nextPart:new Map,validators:[]};return uA(Object.entries(e.classGroups),n).forEach(([o,a])=>{Cd(a,s,o,t)}),s},Cd=(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(cA(i)){Cd(i(s),t,n,s);return}t.validators.push({validator:i,classGroupId:n});return}Object.entries(i).forEach(([o,a])=>{Cd(a,rg(t,o),n,s)})})},rg=(e,t)=>{let n=e;return t.split(fm).forEach(s=>{n.nextPart.has(s)||n.nextPart.set(s,{nextPart:new Map,validators:[]}),n=n.nextPart.get(s)}),n},cA=e=>e.isThemeGetter,uA=(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,dA=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)}}},yb="!",fA=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 p=0;p<l.length;p++){let h=l[p];if(u===0){if(h===i&&(s||l.slice(p,p+o)===t)){c.push(l.slice(d,p)),d=p+o;continue}if(h==="/"){f=p;continue}}h==="["?u++:h==="]"&&u--}const m=c.length===0?l:l.substring(d),b=m.startsWith(yb),j=b?m.substring(1):m,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},mA=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},hA=e=>({cache:dA(e.cacheSize),parseClassName:fA(e),...oA(e)}),pA=/\s+/,gA=(e,t)=>{const{parseClassName:n,getClassGroupId:s,getConflictingClassGroupIds:i}=t,o=[],a=e.trim().split(pA);let l="";for(let c=a.length-1;c>=0;c-=1){const u=a[c],{modifiers:d,hasImportantModifier:f,baseClassName:m,maybePostfixModifierPosition:b}=n(u);let j=!!b,v=s(j?m.substring(0,b):m);if(!v){if(!j){l=u+(l.length>0?" "+l:l);continue}if(v=s(m),!v){l=u+(l.length>0?" "+l:l);continue}j=!1}const p=mA(d).join(":"),h=f?p+yb:p,x=h+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(h+S)}l=u+(l.length>0?" "+l:l)}return l};function xA(){let e=0,t,n,s="";for(;e<arguments.length;)(t=arguments[e++])&&(n=vb(t))&&(s&&(s+=" "),s+=n);return s}const vb=e=>{if(typeof e=="string")return e;let t,n="";for(let s=0;s<e.length;s++)e[s]&&(t=vb(e[s]))&&(n&&(n+=" "),n+=t);return n};function yA(e,...t){let n,s,i,o=a;function a(c){const u=t.reduce((d,f)=>f(d),e());return n=hA(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=gA(c,n);return i(c,d),d}return function(){return o(xA.apply(null,arguments))}}const le=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},bb=/^\[(?:([a-z-]+):)?(.+)\]$/i,vA=/^\d+\/\d+$/,bA=new Set(["px","full","screen"]),wA=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,jA=/\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$/,NA=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,SA=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,CA=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,cn=e=>pr(e)||bA.has(e)||vA.test(e),Rn=e=>Lr(e,"length",MA),pr=e=>!!e&&!Number.isNaN(Number(e)),$c=e=>Lr(e,"number",pr),Zr=e=>!!e&&Number.isInteger(Number(e)),EA=e=>e.endsWith("%")&&pr(e.slice(0,-1)),Z=e=>bb.test(e),Pn=e=>wA.test(e),kA=new Set(["length","size","percentage"]),TA=e=>Lr(e,kA,wb),AA=e=>Lr(e,"position",wb),RA=new Set(["image","url"]),PA=e=>Lr(e,RA,OA),_A=e=>Lr(e,"",IA),ei=()=>!0,Lr=(e,t,n)=>{const s=bb.exec(e);return s?s[1]?typeof t=="string"?s[1]===t:t.has(s[1]):n(s[2]):!1},MA=e=>jA.test(e)&&!NA.test(e),wb=()=>!1,IA=e=>SA.test(e),OA=e=>CA.test(e),LA=()=>{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"),m=le("gap"),b=le("gradientColorStops"),j=le("gradientColorStopPositions"),v=le("inset"),p=le("margin"),h=le("opacity"),x=le("padding"),y=le("saturate"),w=le("scale"),S=le("sepia"),C=le("skew"),E=le("space"),T=le("translate"),N=()=>["auto","contain","none"],k=()=>["auto","hidden","clip","visible","scroll"],A=()=>["auto",Z,t],P=()=>[Z,t],_=()=>["",cn,Rn],M=()=>["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"],V=()=>[pr,Z];return{cacheSize:500,separator:":",theme:{colors:[ei],spacing:[cn,Rn],blur:["none","",Pn,Z],brightness:V(),borderColor:[e],borderRadius:["none","","full",Pn,Z],borderSpacing:P(),borderWidth:_(),contrast:V(),grayscale:I(),hueRotate:V(),invert:I(),gap:P(),gradientColorStops:[e],gradientColorStopPositions:[EA,Rn],inset:A(),margin:A(),opacity:V(),padding:P(),saturate:V(),scale:V(),sepia:I(),skew:V(),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:k()}],"overflow-x":[{"overflow-x":k()}],"overflow-y":[{"overflow-y":k()}],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":M()}],"col-end":[{"col-end":M()}],"grid-rows":[{"grid-rows":[ei]}],"row-start-end":[{row:["auto",{span:[Zr,Z]},Z]}],"row-start":[{"row-start":M()}],"row-end":[{"row-end":M()}],"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:[m]}],"gap-x":[{"gap-x":[m]}],"gap-y":[{"gap-y":[m]}],"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:[p]}],mx:[{mx:[p]}],my:[{my:[p]}],ms:[{ms:[p]}],me:[{me:[p]}],mt:[{mt:[p]}],mr:[{mr:[p]}],mb:[{mb:[p]}],ml:[{ml:[p]}],"space-x":[{"space-x":[E]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[E]}],"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":[h]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[h]}],"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":[h]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...O(),AA]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",TA]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},PA]}],"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":[h]}],"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":[h]}],"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:_()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[h]}],"ring-offset-w":[{"ring-offset":[cn,Rn]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",Pn,_A]}],"shadow-color":[{shadow:[ei]}],opacity:[{opacity:[h]}],"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":[h]}],"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:V()}],ease:[{ease:["linear","in","out","in-out",Z]}],delay:[{delay:V()}],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"]}}},DA=yA(LA);function Y(...e){return DA(pb(e))}const FA=gb("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 $A({className:e,variant:t,...n}){return r.jsx("div",{className:Y(FA({variant:t}),e),...n})}const wn=({status:e,className:t,showIcon:n=!0,...s})=>{const o=(l=>{switch(l){case"running":return{icon:wd,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:ob,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:db,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:ab,text:"Unknown",variant:"outline",className:""}}})(e),a=o.icon;return r.jsxs($A,{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]})},UA=({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(sT,{size:20}),r.jsx("span",{children:"No User Context"})]}),r.jsx(um,{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(Sd,{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,m;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],(m=d.lastName)==null?void 0:m[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]})})]})]})},VA=({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 p=h=>{d.current&&!d.current.contains(h.target)&&s(!1)};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[]);const f=async()=>{var p;u(!0);try{const h=await W.get("/api/project/repositories");console.log("Repository API response:",h.data);const x=((p=h.data.data)==null?void 0:p.repositories)||h.data.repositories||[];console.log(`Setting ${x.length} repositories`),o(x)}catch(h){console.error("Failed to fetch repositories:",h)}finally{u(!1)}},m=async p=>{try{await W.post("/api/project/switch-repository",{repositoryPath:p.path}),t(p),s(!1),window.location.reload()}catch(h){console.error("Failed to switch repository:",h)}},b=async(p,h)=>{h.stopPropagation();try{if(!(await fetch("/api/open-in-ide",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:p})})).ok)throw new Error("Failed to open in IDE")}catch(x){console.error("Failed to open in IDE:",x)}},j=i.filter(p=>p.name.toLowerCase().includes(a.toLowerCase())||p.path.toLowerCase().includes(a.toLowerCase())),v=p=>({React:"text-blue-500",Vue:"text-green-500",Angular:"text-red-500",Svelte:"text-orange-500"})[p]||"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(gT,{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(um,{className:Y("h-4 w-4 text-muted-foreground transition-transform duration-200",n&&"transform rotate-180")})]}),e&&r.jsx("button",{onClick:p=>b(e.path,p),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:p=>l(p.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(p=>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)===p.path&&"bg-accent"),children:[r.jsxs("button",{onClick:()=>m(p),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)===p.path?r.jsx(cm,{className:"h-4 w-4 text-primary"}):r.jsx(jd,{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:p.name}),p.framework&&r.jsx("span",{className:Y("text-xs font-medium",v(p.framework)),children:p.framework}),p.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:p.path}),p.version&&r.jsxs("p",{className:"text-xs text-muted-foreground/80 mt-0.5",children:["v",p.version]})]})]}),r.jsx("button",{onClick:h=>b(p.path,h),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"})})]},p.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:p=>b(e.path,p),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(lb,{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 h;const{scope:m,children:b,...j}=f,v=((h=m==null?void 0:m[e])==null?void 0:h[c])||l,p=g.useMemo(()=>j,Object.values(j));return r.jsx(v.Provider,{value:p,children:b})};u.displayName=o+"Provider";function d(f,m){var v;const b=((v=m==null?void 0:m[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,zA(i,...t)]}function zA(...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:()=>{},BA=of[" useInsertionEffect ".trim().toString()]||es;function jb({prop:e,defaultProp:t,onChange:n=()=>{},caller:s}){const[i,o,a]=WA({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 m=HA(d)?d(e):d;m!==e&&((f=a.current)==null||f.call(a,m))}else o(d)},[l,e,o,a]);return[c,u]}function WA({defaultProp:e,onChange:t}){const[n,s]=g.useState(e),i=g.useRef(n),o=g.useRef(t);return BA(()=>{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 HA(e){return typeof e=="function"}function Ki(e){const t=KA(e),n=g.forwardRef((s,i)=>{const{children:o,...a}=s,l=g.Children.toArray(o),c=l.find(YA);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 qA=Ki("Slot");function KA(e){const t=g.forwardRef((n,s)=>{const{children:i,...o}=n;if(g.isValidElement(i)){const a=QA(i),l=XA(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 GA=Symbol("radix.slottable");function YA(e){return g.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===GA}function XA(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 QA(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 JA=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Xe=JA.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 Nb(e,t){e&&Ol.flushSync(()=>e.dispatchEvent(t))}function Sb(e){const t=e+"CollectionProvider",[n,s]=ho(t),[i,o]=n(t,{collectionRef:{current:null},itemMap:new Map}),a=v=>{const{scope:p,children:h}=v,x=We.useRef(null),y=We.useRef(new Map).current;return r.jsx(i,{scope:p,itemMap:y,collectionRef:x,children:h})};a.displayName=t;const l=e+"CollectionSlot",c=Ki(l),u=We.forwardRef((v,p)=>{const{scope:h,children:x}=v,y=o(l,h),w=ct(p,y.collectionRef);return r.jsx(c,{ref:w,children:x})});u.displayName=l;const d=e+"CollectionItemSlot",f="data-radix-collection-item",m=Ki(d),b=We.forwardRef((v,p)=>{const{scope:h,children:x,...y}=v,w=We.useRef(null),S=ct(p,w),C=o(d,h);return We.useEffect(()=>(C.itemMap.set(w,{ref:w,...y}),()=>void C.itemMap.delete(w))),r.jsx(m,{[f]:"",ref:S,children:x})});b.displayName=d;function j(v){const p=o(e+"CollectionConsumer",v);return We.useCallback(()=>{const x=p.collectionRef.current;if(!x)return[];const y=Array.from(x.querySelectorAll(`[${f}]`));return Array.from(p.itemMap.values()).sort((C,E)=>y.indexOf(C.ref.current)-y.indexOf(E.ref.current))},[p.collectionRef,p.itemMap])}return[{Provider:a,Slot:u,ItemSlot:b},j,s]}var ZA=g.createContext(void 0);function Cb(e){const t=g.useContext(ZA);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 eR(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 tR="DismissableLayer",Ed="dismissableLayer.update",nR="dismissableLayer.pointerDownOutside",sR="dismissableLayer.focusOutside",og,Eb=g.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),kb=g.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:o,onInteractOutside:a,onDismiss:l,...c}=e,u=g.useContext(Eb),[d,f]=g.useState(null),m=(d==null?void 0:d.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,b]=g.useState({}),j=ct(t,E=>f(E)),v=Array.from(u.layers),[p]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),h=v.indexOf(p),x=d?v.indexOf(d):-1,y=u.layersWithOutsidePointerEventsDisabled.size>0,w=x>=h,S=oR(E=>{const T=E.target,N=[...u.branches].some(k=>k.contains(T));!w||N||(i==null||i(E),a==null||a(E),E.defaultPrevented||l==null||l())},m),C=aR(E=>{const T=E.target;[...u.branches].some(k=>k.contains(T))||(o==null||o(E),a==null||a(E),E.defaultPrevented||l==null||l())},m);return eR(E=>{x===u.layers.size-1&&(s==null||s(E),!E.defaultPrevented&&l&&(E.preventDefault(),l()))},m),g.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(og=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),ag(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(m.body.style.pointerEvents=og)}},[d,m,n,u]),g.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),ag())},[d,u]),g.useEffect(()=>{const E=()=>b({});return document.addEventListener(Ed,E),()=>document.removeEventListener(Ed,E)},[]),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)})});kb.displayName=tR;var rR="DismissableLayerBranch",iR=g.forwardRef((e,t)=>{const n=g.useContext(Eb),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})});iR.displayName=rR;function oR(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(){Tb(nR,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 aR(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&&Tb(sR,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(Ed);document.dispatchEvent(e)}function Tb(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?Nb(i,o):i.dispatchEvent(o)}var Uc=0;function lR(){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 Vc="focusScope.autoFocusOnMount",zc="focusScope.autoFocusOnUnmount",cg={bubbles:!1,cancelable:!0},cR="FocusScope",Ab=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),m=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:Mn(f.current,{select:!0})},p=function(y){if(b.paused||!l)return;const w=y.relatedTarget;w!==null&&(l.contains(w)||Mn(f.current,{select:!0}))},h=function(y){if(document.activeElement===document.body)for(const S of y)S.removedNodes.length>0&&Mn(l)};document.addEventListener("focusin",v),document.addEventListener("focusout",p);const x=new MutationObserver(h);return l&&x.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",v),document.removeEventListener("focusout",p),x.disconnect()}}},[s,l,b.paused]),g.useEffect(()=>{if(l){dg.add(b);const v=document.activeElement;if(!l.contains(v)){const h=new CustomEvent(Vc,cg);l.addEventListener(Vc,u),l.dispatchEvent(h),h.defaultPrevented||(uR(pR(Rb(l)),{select:!0}),document.activeElement===v&&Mn(l))}return()=>{l.removeEventListener(Vc,u),setTimeout(()=>{const h=new CustomEvent(zc,cg);l.addEventListener(zc,d),l.dispatchEvent(h),h.defaultPrevented||Mn(v??document.body,{select:!0}),l.removeEventListener(zc,d),dg.remove(b)},0)}}},[l,u,d,b]);const j=g.useCallback(v=>{if(!n&&!s||b.paused)return;const p=v.key==="Tab"&&!v.altKey&&!v.ctrlKey&&!v.metaKey,h=document.activeElement;if(p&&h){const x=v.currentTarget,[y,w]=dR(x);y&&w?!v.shiftKey&&h===w?(v.preventDefault(),n&&Mn(y,{select:!0})):v.shiftKey&&h===y&&(v.preventDefault(),n&&Mn(w,{select:!0})):h===x&&v.preventDefault()}},[n,s,b.paused]);return r.jsx(Xe.div,{tabIndex:-1,...a,ref:m,onKeyDown:j})});Ab.displayName=cR;function uR(e,{select:t=!1}={}){const n=document.activeElement;for(const s of e)if(Mn(s,{select:t}),document.activeElement!==n)return}function dR(e){const t=Rb(e),n=ug(t,e),s=ug(t.reverse(),e);return[n,s]}function Rb(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(!fR(n,{upTo:t}))return n}function fR(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 mR(e){return e instanceof HTMLInputElement&&"select"in e}function Mn(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&mR(e)&&t&&e.select()}}var dg=hR();function hR(){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 pR(e){return e.filter(t=>t.tagName!=="A")}var gR=of[" useId ".trim().toString()]||(()=>{}),xR=0;function kd(e){const[t,n]=g.useState(gR());return es(()=>{n(s=>s??String(xR++))},[e]),t?`radix-${t}`:""}const yR=["top","right","bottom","left"],ts=Math.min,dt=Math.max,al=Math.round,qo=Math.floor,en=e=>({x:e,y:e}),vR={left:"right",right:"left",bottom:"top",top:"bottom"},bR={start:"end",end:"start"};function Td(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 mm(e){return e==="x"?"y":"x"}function hm(e){return e==="y"?"height":"width"}const wR=new Set(["top","bottom"]);function Xt(e){return wR.has(Sn(e))?"y":"x"}function pm(e){return mm(Xt(e))}function jR(e,t,n){n===void 0&&(n=!1);const s=Dr(e),i=pm(e),o=hm(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 NR(e){const t=ll(e);return[Ad(e),t,Ad(t)]}function Ad(e){return e.replace(/start|end/g,t=>bR[t])}const mg=["left","right"],hg=["right","left"],SR=["top","bottom"],CR=["bottom","top"];function ER(e,t,n){switch(e){case"top":case"bottom":return n?t?hg:mg:t?mg:hg;case"left":case"right":return t?SR:CR;default:return[]}}function kR(e,t,n,s){const i=Dr(e);let o=ER(Sn(e),n==="start",s);return i&&(o=o.map(a=>a+"-"+i),t&&(o=o.concat(o.map(Ad)))),o}function ll(e){return e.replace(/left|right|bottom|top/g,t=>vR[t])}function TR(e){return{top:0,right:0,bottom:0,left:0,...e}}function Pb(e){return typeof e!="number"?TR(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 pg(e,t,n){let{reference:s,floating:i}=e;const o=Xt(t),a=pm(t),l=hm(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,m=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]-=m*(n&&u?-1:1);break;case"end":b[a]+=m*(n&&u?-1:1);break}return b}const AR=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}=pg(u,s,c),m=s,b={},j=0;for(let v=0;v<l.length;v++){const{name:p,fn:h}=l[v],{x,y,data:w,reset:S}=await h({x:d,y:f,initialPlacement:s,placement:m,strategy:i,middlewareData:b,rects:u,platform:a,elements:{reference:e,floating:t}});d=x??d,f=y??f,b={...b,[p]:{...b[p],...w}},S&&j<=50&&(j++,typeof S=="object"&&(S.placement&&(m=S.placement),S.rects&&(u=S.rects===!0?await a.getElementRects({reference:e,floating:t,strategy:i}):S.rects),{x:d,y:f}=pg(u,m,c)),v=-1)}return{x:d,y:f,placement:m,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:m=!1,padding:b=0}=Nn(t,e),j=Pb(b),p=l[m?f==="floating"?"reference":"floating":f],h=cl(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(p)))==null||n?p:p.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:(h.top-S.top+j.top)/w.y,bottom:(S.bottom-h.bottom+j.bottom)/w.y,left:(h.left-S.left+j.left)/w.x,right:(S.right-h.right+j.right)/w.x}}const RR=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=Pb(d),m={x:n,y:s},b=pm(i),j=hm(b),v=await a.getDimensions(u),p=b==="y",h=p?"top":"left",x=p?"bottom":"right",y=p?"clientHeight":"clientWidth",w=o.reference[j]+o.reference[b]-m[b]-o.floating[j],S=m[b]-o.reference[b],C=await(a.getOffsetParent==null?void 0:a.getOffsetParent(u));let E=C?C[y]:0;(!E||!await(a.isElement==null?void 0:a.isElement(C)))&&(E=l.floating[y]||o.floating[j]);const T=w/2-S/2,N=E/2-v[j]/2-1,k=ts(f[h],N),A=ts(f[x],N),P=k,_=E-v[j]-A,M=E/2-v[j]/2+T,O=Td(P,M,_),F=!c.arrow&&Dr(i)!=null&&M!==O&&o.reference[j]/2-(M<P?k:A)-v[j]/2<0,$=F?M<P?M-P:M-_:0;return{[b]:m[b]+$,data:{[b]:O,centerOffset:M-O-$,...F&&{alignmentOffset:$}},reset:F}}}),PR=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:m,fallbackStrategy:b="bestFit",fallbackAxisSideDirection:j="none",flipAlignment:v=!0,...p}=Nn(e,t);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const h=Sn(i),x=Xt(l),y=Sn(l)===l,w=await(c.isRTL==null?void 0:c.isRTL(u.floating)),S=m||(y||!v?[ll(l)]:NR(l)),C=j!=="none";!m&&C&&S.push(...kR(l,v,j,w));const E=[l,...S],T=await Gi(t,p),N=[];let k=((s=o.flip)==null?void 0:s.overflows)||[];if(d&&N.push(T[h]),f){const M=jR(i,a,w);N.push(T[M[0]],T[M[1]])}if(k=[...k,{placement:i,overflows:N}],!N.every(M=>M<=0)){var A,P;const M=(((A=o.flip)==null?void 0:A.index)||0)+1,O=E[M];if(O&&(!(f==="alignment"?x!==Xt(O):!1)||k.every(R=>R.overflows[0]>0&&Xt(R.placement)===x)))return{data:{index:M,overflows:k},reset:{placement:O}};let F=(P=k.filter($=>$.overflows[0]<=0).sort(($,R)=>$.overflows[1]-R.overflows[1])[0])==null?void 0:P.placement;if(!F)switch(b){case"bestFit":{var _;const $=(_=k.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:_[0];$&&(F=$);break}case"initialPlacement":F=l;break}if(i!==F)return{reset:{placement:F}}}return{}}}};function gg(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function xg(e){return yR.some(t=>e[t]>=0)}const _R=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=gg(o,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:xg(a)}}}case"escaped":{const o=await Gi(t,{...i,altBoundary:!0}),a=gg(o,n.floating);return{data:{escapedOffsets:a,escaped:xg(a)}}}default:return{}}}}},_b=new Set(["left","top"]);async function MR(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=_b.has(a)?-1:1,d=o&&c?-1:1,f=Nn(t,e);let{mainAxis:m,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:m*u}:{x:m*u,y:b*d}}const IR=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 MR(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}}}}},OR=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:p=>{let{x:h,y:x}=p;return{x:h,y:x}}},...c}=Nn(e,t),u={x:n,y:s},d=await Gi(t,c),f=Xt(Sn(i)),m=mm(f);let b=u[m],j=u[f];if(o){const p=m==="y"?"top":"left",h=m==="y"?"bottom":"right",x=b+d[p],y=b-d[h];b=Td(x,b,y)}if(a){const p=f==="y"?"top":"left",h=f==="y"?"bottom":"right",x=j+d[p],y=j-d[h];j=Td(x,j,y)}const v=l.fn({...t,[m]:b,[f]:j});return{...v,data:{x:v.x-n,y:v.y-s,enabled:{[m]:o,[f]:a}}}}}},LR=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),m=mm(f);let b=d[m],j=d[f];const v=Nn(l,t),p=typeof v=="number"?{mainAxis:v,crossAxis:0}:{mainAxis:0,crossAxis:0,...v};if(c){const y=m==="y"?"height":"width",w=o.reference[m]-o.floating[y]+p.mainAxis,S=o.reference[m]+o.reference[y]-p.mainAxis;b<w?b=w:b>S&&(b=S)}if(u){var h,x;const y=m==="y"?"width":"height",w=_b.has(Sn(i)),S=o.reference[f]-o.floating[y]+(w&&((h=a.offset)==null?void 0:h[f])||0)+(w?0:p.crossAxis),C=o.reference[f]+o.reference[y]+(w?0:((x=a.offset)==null?void 0:x[f])||0)-(w?p.crossAxis:0);j<S?j=S:j>C&&(j=C)}return{[m]:b,[f]:j}}}},DR=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),m=Dr(i),b=Xt(i)==="y",{width:j,height:v}=o.floating;let p,h;f==="top"||f==="bottom"?(p=f,h=m===(await(a.isRTL==null?void 0:a.isRTL(l.floating))?"start":"end")?"left":"right"):(h=f,p=m==="end"?"top":"bottom");const x=v-d.top-d.bottom,y=j-d.left-d.right,w=ts(v-d[p],x),S=ts(j-d[h],y),C=!t.middlewareData.shift;let E=w,T=S;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(T=y),(s=t.middlewareData.shift)!=null&&s.enabled.y&&(E=x),C&&!m){const k=dt(d.left,0),A=dt(d.right,0),P=dt(d.top,0),_=dt(d.bottom,0);b?T=j-2*(k!==0||A!==0?k+A:dt(d.left,d.right)):E=v-2*(P!==0||_!==0?P+_:dt(d.top,d.bottom))}await c({...t,availableWidth:T,availableHeight:E});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 Mb(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=(Mb(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Mb(e){return Kl()?e instanceof Node||e instanceof ht(e).Node:!1}function zt(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 yg(e){return!Kl()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof ht(e).ShadowRoot}const FR=new Set(["inline","contents"]);function po(e){const{overflow:t,overflowX:n,overflowY:s,display:i}=Bt(e);return/auto|scroll|overlay|hidden|clip/.test(t+s+n)&&!FR.has(i)}const $R=new Set(["table","td","th"]);function UR(e){return $R.has(Fr(e))}const VR=[":popover-open",":modal"];function Gl(e){return VR.some(t=>{try{return e.matches(t)}catch{return!1}})}const zR=["transform","translate","scale","rotate","perspective"],BR=["transform","translate","scale","rotate","perspective","filter"],WR=["paint","layout","strict","content"];function gm(e){const t=xm(),n=zt(e)?Bt(e):e;return zR.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)||BR.some(s=>(n.willChange||"").includes(s))||WR.some(s=>(n.contain||"").includes(s))}function HR(e){let t=ns(e);for(;on(t)&&!Cr(t);){if(gm(t))return t;if(Gl(t))return null;t=ns(t)}return null}function xm(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const qR=new Set(["html","body","#document"]);function Cr(e){return qR.has(Fr(e))}function Bt(e){return ht(e).getComputedStyle(e)}function Yl(e){return zt(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||yg(e)&&e.host||ln(e);return yg(t)?t.host:t}function Ib(e){const t=ns(e);return Cr(t)?e.ownerDocument?e.ownerDocument.body:e.body:on(t)&&po(t)?t:Ib(t)}function Yi(e,t,n){var s;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=Ib(e),o=i===((s=e.ownerDocument)==null?void 0:s.body),a=ht(i);if(o){const l=Rd(a);return t.concat(a,a.visualViewport||[],po(i)?i:[],l&&n?Yi(l):[])}return t.concat(i,Yi(i,[],n))}function Rd(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Ob(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 ym(e){return zt(e)?e:e.contextElement}function gr(e){const t=ym(e);if(!on(t))return en(1);const n=t.getBoundingClientRect(),{width:s,height:i,$:o}=Ob(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 KR=en(0);function Lb(e){const t=ht(e);return!xm()||!t.visualViewport?KR:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function GR(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=ym(e);let a=en(1);t&&(s?zt(s)&&(a=gr(s)):a=gr(e));const l=GR(o,n,s)?Lb(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 m=ht(o),b=s&&zt(s)?ht(s):s;let j=m,v=Rd(j);for(;v&&s&&b!==j;){const p=gr(v),h=v.getBoundingClientRect(),x=Bt(v),y=h.left+(v.clientLeft+parseFloat(x.paddingLeft))*p.x,w=h.top+(v.clientTop+parseFloat(x.paddingTop))*p.y;c*=p.x,u*=p.y,d*=p.x,f*=p.y,c+=y,u+=w,j=ht(v),v=Rd(j)}}return cl({width:d,height:f,x:c,y:u})}function vm(e,t){const n=Yl(e).scrollLeft;return t?t.left+n:Is(ln(e)).left+n}function Db(e,t,n){n===void 0&&(n=!1);const s=e.getBoundingClientRect(),i=s.left+t.scrollLeft-(n?0:vm(e,s)),o=s.top+t.scrollTop;return{x:i,y:o}}function YR(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 m=a&&!f&&!o?Db(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+m.x,y:n.y*u.y-c.scrollTop*u.y+d.y+m.y}}function XR(e){return Array.from(e.getClientRects())}function QR(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+vm(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 JR(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=xm();(!u||u&&t==="fixed")&&(l=i.offsetLeft,c=i.offsetTop)}return{width:o,height:a,x:l,y:c}}const ZR=new Set(["absolute","fixed"]);function eP(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 vg(e,t,n){let s;if(t==="viewport")s=JR(e,n);else if(t==="document")s=QR(ln(e));else if(zt(t))s=eP(t,n);else{const i=Lb(e);s={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return cl(s)}function Fb(e,t){const n=ns(e);return n===t||!zt(n)||Cr(n)?!1:Bt(n).position==="fixed"||Fb(n,t)}function tP(e,t){const n=t.get(e);if(n)return n;let s=Yi(e,[],!1).filter(l=>zt(l)&&Fr(l)!=="body"),i=null;const o=Bt(e).position==="fixed";let a=o?ns(e):e;for(;zt(a)&&!Cr(a);){const l=Bt(a),c=gm(a);!c&&l.position==="fixed"&&(i=null),(o?!c&&!i:!c&&l.position==="static"&&!!i&&ZR.has(i.position)||po(a)&&!c&&Fb(e,a))?s=s.filter(d=>d!==a):i=l,a=ns(a)}return t.set(e,s),s}function nP(e){let{element:t,boundary:n,rootBoundary:s,strategy:i}=e;const a=[...n==="clippingAncestors"?Gl(t)?[]:tP(t,this._c):[].concat(n),s],l=a[0],c=a.reduce((u,d)=>{const f=vg(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},vg(t,l,i));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function sP(e){const{width:t,height:n}=Ob(e);return{width:t,height:n}}function rP(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=vm(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?Db(i,l):en(0),f=a.left+l.scrollLeft-c.x-d.x,m=a.top+l.scrollTop-c.y-d.y;return{x:f,y:m,width:a.width,height:a.height}}function Bc(e){return Bt(e).position==="static"}function bg(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 $b(e,t){const n=ht(e);if(Gl(e))return n;if(!on(e)){let i=ns(e);for(;i&&!Cr(i);){if(zt(i)&&!Bc(i))return i;i=ns(i)}return n}let s=bg(e,t);for(;s&&UR(s)&&Bc(s);)s=bg(s,t);return s&&Cr(s)&&Bc(s)&&!gm(s)?n:s||HR(e)||n}const iP=async function(e){const t=this.getOffsetParent||$b,n=this.getDimensions,s=await n(e.floating);return{reference:rP(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function oP(e){return Bt(e).direction==="rtl"}const aP={convertOffsetParentRelativeRectToViewportRelativeRect:YR,getDocumentElement:ln,getClippingRect:nP,getOffsetParent:$b,getElementRects:iP,getClientRects:XR,getDimensions:sP,getScale:gr,isElement:zt,isRTL:oP};function Ub(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function lP(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:m,height:b}=u;if(l||t(),!m||!b)return;const j=qo(f),v=qo(i.clientWidth-(d+m)),p=qo(i.clientHeight-(f+b)),h=qo(d),y={rootMargin:-j+"px "+-v+"px "+-p+"px "+-h+"px",threshold:dt(0,ts(1,c))||1};let w=!0;function S(C){const E=C[0].intersectionRatio;if(E!==c){if(!w)return a();E?a(!1,E):s=setTimeout(()=>{a(!1,1e-7)},1e3)}E===1&&!Ub(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 cP(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=ym(e),d=i||o?[...u?Yi(u):[],...Yi(t)]:[];d.forEach(h=>{i&&h.addEventListener("scroll",n,{passive:!0}),o&&h.addEventListener("resize",n)});const f=u&&l?lP(u,n):null;let m=-1,b=null;a&&(b=new ResizeObserver(h=>{let[x]=h;x&&x.target===u&&b&&(b.unobserve(t),cancelAnimationFrame(m),m=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&&p();function p(){const h=Is(e);v&&!Ub(v,h)&&n(),v=h,j=requestAnimationFrame(p)}return n(),()=>{var h;d.forEach(x=>{i&&x.removeEventListener("scroll",n),o&&x.removeEventListener("resize",n)}),f==null||f(),(h=b)==null||h.disconnect(),b=null,c&&cancelAnimationFrame(j)}}const uP=IR,dP=OR,fP=PR,mP=DR,hP=_R,wg=RR,pP=LR,gP=(e,t,n)=>{const s=new Map,i={platform:aP,...n},o={...i.platform,_c:s};return AR(e,t,{...i,platform:o})};var xP=typeof document<"u",yP=function(){},Na=xP?g.useLayoutEffect:yP;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 Vb(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function jg(e,t){const n=Vb(e);return Math.round(t*n)/n}function Wc(e){const t=g.useRef(e);return Na(()=>{t.current=e}),t}function vP(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}),[m,b]=g.useState(s);ul(m,s)||b(s);const[j,v]=g.useState(null),[p,h]=g.useState(null),x=g.useCallback(R=>{R!==C.current&&(C.current=R,v(R))},[]),y=g.useCallback(R=>{R!==E.current&&(E.current=R,h(R))},[]),w=o||j,S=a||p,C=g.useRef(null),E=g.useRef(null),T=g.useRef(d),N=c!=null,k=Wc(c),A=Wc(i),P=Wc(u),_=g.useCallback(()=>{if(!C.current||!E.current)return;const R={placement:t,strategy:n,middleware:m};A.current&&(R.platform=A.current),gP(C.current,E.current,R).then(I=>{const D={...I,isPositioned:P.current!==!1};M.current&&!ul(T.current,D)&&(T.current=D,Ol.flushSync(()=>{f(D)}))})},[m,t,n,A,P]);Na(()=>{u===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,f(R=>({...R,isPositioned:!1})))},[u]);const M=g.useRef(!1);Na(()=>(M.current=!0,()=>{M.current=!1}),[]),Na(()=>{if(w&&(C.current=w),S&&(E.current=S),w&&S){if(k.current)return k.current(w,S,_);_()}},[w,S,_,k,N]);const O=g.useMemo(()=>({reference:C,floating:E,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=jg(F.floating,d.x),D=jg(F.floating,d.y);return l?{...R,transform:"translate("+I+"px, "+D+"px)",...Vb(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:_,refs:O,elements:F,floatingStyles:$}),[d,_,O,F,$])}const bP=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?wg({element:s.current,padding:i}).fn(n):{}:s?wg({element:s,padding:i}).fn(n):{}}}},wP=(e,t)=>({...uP(e),options:[e,t]}),jP=(e,t)=>({...dP(e),options:[e,t]}),NP=(e,t)=>({...pP(e),options:[e,t]}),SP=(e,t)=>({...fP(e),options:[e,t]}),CP=(e,t)=>({...mP(e),options:[e,t]}),EP=(e,t)=>({...hP(e),options:[e,t]}),kP=(e,t)=>({...bP(e),options:[e,t]});var TP="Arrow",zb=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"})})});zb.displayName=TP;var AP=zb;function RP(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 bm="Popper",[Bb,Wb]=ho(bm),[PP,Hb]=Bb(bm),qb=e=>{const{__scopePopper:t,children:n}=e,[s,i]=g.useState(null);return r.jsx(PP,{scope:t,anchor:s,onAnchorChange:i,children:n})};qb.displayName=bm;var Kb="PopperAnchor",Gb=g.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:s,...i}=e,o=Hb(Kb,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})});Gb.displayName=Kb;var wm="PopperContent",[_P,MP]=Bb(wm),Yb=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:m=!1,updatePositionStrategy:b="optimized",onPlaced:j,...v}=e,p=Hb(wm,n),[h,x]=g.useState(null),y=ct(t,fs=>x(fs)),[w,S]=g.useState(null),C=RP(w),E=(C==null?void 0:C.width)??0,T=(C==null?void 0:C.height)??0,N=s+(o!=="center"?"-"+o:""),k=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},A=Array.isArray(u)?u:[u],P=A.length>0,_={padding:k,boundary:A.filter(OP),altBoundary:P},{refs:M,floatingStyles:O,placement:F,isPositioned:$,middlewareData:R}=vP({strategy:"fixed",placement:N,whileElementsMounted:(...fs)=>cP(...fs,{animationFrame:b==="always"}),elements:{reference:p.anchor},middleware:[wP({mainAxis:i+T,alignmentAxis:a}),c&&jP({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?NP():void 0,..._}),c&&SP({..._}),CP({..._,apply:({elements:fs,rects:Eo,availableWidth:rc,availableHeight:H})=>{const{width:q,height:ee}=Eo.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&&kP({element:w,padding:l}),LP({arrowWidth:E,arrowHeight:T}),m&&EP({strategy:"referenceHidden",..._})]}),[I,D]=Jb(F),V=jn(j);es(()=>{$&&(V==null||V())},[$,V]);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(()=>{h&&Pe(window.getComputedStyle(h).zIndex)},[h]),r.jsx("div",{ref:M.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(_P,{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"}})})})});Yb.displayName=wm;var Xb="PopperArrow",IP={top:"bottom",right:"left",bottom:"top",left:"right"},Qb=g.forwardRef(function(t,n){const{__scopePopper:s,...i}=t,o=MP(Xb,s),a=IP[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(AP,{...i,ref:n,style:{...i.style,display:"block"}})})});Qb.displayName=Xb;function OP(e){return e!==null}var LP=e=>({name:"transformOrigin",options:e,fn(t){var p,h,x;const{placement:n,rects:s,middlewareData:i}=t,a=((p=i.arrow)==null?void 0:p.centerOffset)!==0,l=a?0:e.arrowWidth,c=a?0:e.arrowHeight,[u,d]=Jb(n),f={start:"0%",center:"50%",end:"100%"}[d],m=(((h=i.arrow)==null?void 0:h.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:`${m}px`,v=`${-c}px`):u==="top"?(j=a?f:`${m}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 Jb(e){const[t,n="center"]=e.split("-");return[t,n]}var DP=qb,FP=Gb,$P=Yb,UP=Qb,VP="Portal",Zb=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?pS.createPortal(r.jsx(Xe.div,{...s,ref:t}),a):null});Zb.displayName=VP;function zP(e,t){return g.useReducer((n,s)=>t[n][s]??n,e)}var go=e=>{const{present:t,children:n}=e,s=BP(t),i=typeof n=="function"?n({present:s.isPresent}):g.Children.only(n),o=ct(s.ref,WP(i));return typeof n=="function"||s.isPresent?g.cloneElement(i,{ref:o}):null};go.displayName="Presence";function BP(e){const[t,n]=g.useState(),s=g.useRef(null),i=g.useRef(e),o=g.useRef("none"),a=e?"mounted":"unmounted",[l,c]=zP(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 m=o.current,b=Ko(u);e?c("MOUNT"):b==="none"||(u==null?void 0:u.display)==="none"?c("UNMOUNT"):c(d&&m!==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 p=t.style.animationFillMode;t.style.animationFillMode="forwards",u=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=p)})}},m=b=>{b.target===t&&(o.current=Ko(s.current))};return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",f),t.addEventListener("animationend",f),()=>{d.clearTimeout(u),t.removeEventListener("animationstart",m),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 WP(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",HP={bubbles:!1,cancelable:!0},xo="RovingFocusGroup",[Pd,ew,qP]=Sb(xo),[KP,tw]=ho(xo,[qP]),[GP,YP]=KP(xo),nw=g.forwardRef((e,t)=>r.jsx(Pd.Provider,{scope:e.__scopeRovingFocusGroup,children:r.jsx(Pd.Slot,{scope:e.__scopeRovingFocusGroup,children:r.jsx(XP,{...e,ref:t})})}));nw.displayName=xo;var XP=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,m=g.useRef(null),b=ct(t,m),j=Cb(o),[v,p]=jb({prop:a,defaultProp:l??null,onChange:c,caller:xo}),[h,x]=g.useState(!1),y=jn(u),w=ew(n),S=g.useRef(!1),[C,E]=g.useState(0);return g.useEffect(()=>{const T=m.current;if(T)return T.addEventListener(Hc,y),()=>T.removeEventListener(Hc,y)},[y]),r.jsx(GP,{scope:n,orientation:s,dir:j,loop:i,currentTabStopId:v,onItemFocus:g.useCallback(T=>p(T),[p]),onItemShiftTab:g.useCallback(()=>x(!0),[]),onFocusableItemAdd:g.useCallback(()=>E(T=>T+1),[]),onFocusableItemRemove:g.useCallback(()=>E(T=>T-1),[]),children:r.jsx(Xe.div,{tabIndex:h||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&&!h){const k=new CustomEvent(Hc,HP);if(T.currentTarget.dispatchEvent(k),!k.defaultPrevented){const A=w().filter(F=>F.focusable),P=A.find(F=>F.active),_=A.find(F=>F.id===v),O=[P,_,...A].filter(Boolean).map(F=>F.ref.current);iw(O,d)}}S.current=!1}),onBlur:re(e.onBlur,()=>x(!1))})})}),sw="RovingFocusGroupItem",rw=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=YP(sw,n),f=d.currentTabStopId===u,m=ew(n),{onFocusableItemAdd:b,onFocusableItemRemove:j,currentTabStopId:v}=d;return g.useEffect(()=>{if(s)return b(),()=>j()},[s,b,j]),r.jsx(Pd.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,p=>{s?d.onItemFocus(u):p.preventDefault()}),onFocus:re(e.onFocus,()=>d.onItemFocus(u)),onKeyDown:re(e.onKeyDown,p=>{if(p.key==="Tab"&&p.shiftKey){d.onItemShiftTab();return}if(p.target!==p.currentTarget)return;const h=ZP(p,d.orientation,d.dir);if(h!==void 0){if(p.metaKey||p.ctrlKey||p.altKey||p.shiftKey)return;p.preventDefault();let y=m().filter(w=>w.focusable).map(w=>w.ref.current);if(h==="last")y.reverse();else if(h==="prev"||h==="next"){h==="prev"&&y.reverse();const w=y.indexOf(p.currentTarget);y=d.loop?e4(y,w+1):y.slice(w+1)}setTimeout(()=>iw(y))}}),children:typeof a=="function"?a({isCurrentTabStop:f,hasTabStop:v!=null}):a})})});rw.displayName=sw;var QP={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function JP(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function ZP(e,t,n){const s=JP(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(s))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(s)))return QP[s]}function iw(e,t=!1){const n=document.activeElement;for(const s of e)if(s===n||(s.focus({preventScroll:t}),document.activeElement!==n))return}function e4(e,t){return e.map((n,s)=>e[(t+s)%e.length])}var t4=nw,n4=rw,s4=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Vs=new WeakMap,Go=new WeakMap,Yo={},qc=0,ow=function(e){return e&&(e.host||ow(e.parentNode))},r4=function(e,t){return t.map(function(n){if(e.contains(n))return n;var s=ow(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})},i4=function(e,t,n,s){var i=r4(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(m){if(l.has(m))d(m);else try{var b=m.getAttribute(s),j=b!==null&&b!=="false",v=(Vs.get(m)||0)+1,p=(o.get(m)||0)+1;Vs.set(m,v),o.set(m,p),a.push(m),v===1&&j&&Go.set(m,!0),p===1&&m.setAttribute(n,"true"),j||m.setAttribute(s,"true")}catch(h){console.error("aria-hidden: cannot operate on ",m,h)}})};return d(t),l.clear(),qc++,function(){a.forEach(function(f){var m=Vs.get(f)-1,b=o.get(f)-1;Vs.set(f,m),o.set(f,b),m||(Go.has(f)||f.removeAttribute(s),Go.delete(f)),b||f.removeAttribute(n)}),qc--,qc||(Vs=new WeakMap,Vs=new WeakMap,Go=new WeakMap,Yo={})}},o4=function(e,t,n){n===void 0&&(n="data-aria-hidden");var s=Array.from(Array.isArray(e)?e:[e]),i=s4(e);return i?(s.push.apply(s,Array.from(i.querySelectorAll("[aria-live], script"))),i4(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 aw(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 a4(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",l4="with-scroll-bars-hidden",c4="--removed-body-scroll-bar-size";function Kc(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function u4(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 d4=typeof window<"u"?g.useLayoutEffect:g.useEffect,Ng=new WeakMap;function f4(e,t){var n=u4(null,function(s){return e.forEach(function(i){return Kc(i,s)})});return d4(function(){var s=Ng.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)})}Ng.set(n,e)},[e]),n}function m4(e){return e}function h4(e,t){t===void 0&&(t=m4);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 p4(e){e===void 0&&(e={});var t=h4(null);return t.options=Yt({async:!0,ssr:!1},e),t}var lw=function(e){var t=e.sideCar,n=aw(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))};lw.isSideCarExport=!0;function g4(e,t){return e.useMedium(t),lw}var cw=p4(),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,m=e.sideCar,b=e.noRelative,j=e.noIsolation,v=e.inert,p=e.allowPinchZoom,h=e.as,x=h===void 0?"div":h,y=e.gapMode,w=aw(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),S=m,C=f4([n,t]),E=Yt(Yt({},w),i);return g.createElement(g.Fragment,null,d&&g.createElement(S,{sideCar:cw,removeScrollBar:u,shards:f,noRelative:b,noIsolation:j,inert:v,setCallbacks:o,allowPinchZoom:!!p,lockRef:n,gapMode:y}),a?g.cloneElement(g.Children.only(l),Yt(Yt({},E),{ref:C})):g.createElement(x,Yt({},E,{className:c,ref:C}),l))});Xl.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Xl.classNames={fullWidth:Ca,zeroRight:Sa};var x4=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function y4(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=x4();return t&&e.setAttribute("nonce",t),e}function v4(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function b4(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var w4=function(){var e=0,t=null;return{add:function(n){e==0&&(t=y4())&&(v4(t,n),b4(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},j4=function(){var e=w4();return function(t,n){g.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},uw=function(){var e=j4(),t=function(n){var s=n.styles,i=n.dynamic;return e(s,i),null};return t},N4={left:0,top:0,right:0,gap:0},Yc=function(e){return parseInt(e||"",10)||0},S4=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)]},C4=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return N4;var t=S4(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])}},E4=uw(),xr="data-scroll-locked",k4=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(l4,` {
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(c4,": ").concat(l,`px;
373
- }
374
- `)},Sg=function(){var e=parseInt(document.body.getAttribute(xr)||"0",10);return isFinite(e)?e:0},T4=function(){g.useEffect(function(){return document.body.setAttribute(xr,(Sg()+1).toString()),function(){var e=Sg()-1;e<=0?document.body.removeAttribute(xr):document.body.setAttribute(xr,e.toString())}},[])},A4=function(e){var t=e.noRelative,n=e.noImportant,s=e.gapMode,i=s===void 0?"margin":s;T4();var o=g.useMemo(function(){return C4(i)},[i]);return g.createElement(E4,{styles:k4(o,!t,i,n?"":"!important")})},_d=!1;if(typeof window<"u")try{var Xo=Object.defineProperty({},"passive",{get:function(){return _d=!0,!0}});window.addEventListener("test",Xo,Xo),window.removeEventListener("test",Xo,Xo)}catch{_d=!1}var zs=_d?{passive:!1}:!1,R4=function(e){return e.tagName==="TEXTAREA"},dw=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!R4(e)&&n[t]==="visible")},P4=function(e){return dw(e,"overflowY")},_4=function(e){return dw(e,"overflowX")},Cg=function(e,t){var n=t.ownerDocument,s=t;do{typeof ShadowRoot<"u"&&s instanceof ShadowRoot&&(s=s.host);var i=fw(e,s);if(i){var o=mw(e,s),a=o[1],l=o[2];if(a>l)return!0}s=s.parentNode}while(s&&s!==n.body);return!1},M4=function(e){var t=e.scrollTop,n=e.scrollHeight,s=e.clientHeight;return[t,n,s]},I4=function(e){var t=e.scrollLeft,n=e.scrollWidth,s=e.clientWidth;return[t,n,s]},fw=function(e,t){return e==="v"?P4(t):_4(t)},mw=function(e,t){return e==="v"?M4(t):I4(t)},O4=function(e,t){return e==="h"&&t==="rtl"?-1:1},L4=function(e,t,n,s,i){var o=O4(e,window.getComputedStyle(t).direction),a=o*s,l=n.target,c=t.contains(l),u=!1,d=a>0,f=0,m=0;do{if(!l)break;var b=mw(e,l),j=b[0],v=b[1],p=b[2],h=v-p-o*j;(j||h)&&fw(e,l)&&(f+=h,m+=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(m)<1)&&(u=!0),u},Qo=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Eg=function(e){return[e.deltaX,e.deltaY]},kg=function(e){return e&&"current"in e?e.current:e},D4=function(e,t){return e[0]===t[0]&&e[1]===t[1]},F4=function(e){return`
375
- .block-interactivity-`.concat(e,` {pointer-events: none;}
376
- .allow-interactivity-`).concat(e,` {pointer-events: all;}
377
- `)},$4=0,Bs=[];function U4(e){var t=g.useRef([]),n=g.useRef([0,0]),s=g.useRef(),i=g.useState($4++)[0],o=g.useState(uw)[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=a4([e.lockRef.current],(e.shards||[]).map(kg),!0).filter(Boolean);return v.forEach(function(p){return p.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),v.forEach(function(p){return p.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var l=g.useCallback(function(v,p){if("touches"in v&&v.touches.length===2||v.type==="wheel"&&v.ctrlKey)return!a.current.allowPinchZoom;var h=Qo(v),x=n.current,y="deltaX"in v?v.deltaX:x[0]-h[0],w="deltaY"in v?v.deltaY:x[1]-h[1],S,C=v.target,E=Math.abs(y)>Math.abs(w)?"h":"v";if("touches"in v&&E==="h"&&C.type==="range")return!1;var T=Cg(E,C);if(!T)return!0;if(T?S=E:(S=E==="v"?"h":"v",T=Cg(E,C)),!T)return!1;if(!s.current&&"changedTouches"in v&&(y||w)&&(s.current=S),!S)return!0;var N=s.current||S;return L4(N,p,v,N==="h"?y:w)},[]),c=g.useCallback(function(v){var p=v;if(!(!Bs.length||Bs[Bs.length-1]!==o)){var h="deltaY"in p?Eg(p):Qo(p),x=t.current.filter(function(S){return S.name===p.type&&(S.target===p.target||p.target===S.shadowParent)&&D4(S.delta,h)})[0];if(x&&x.should){p.cancelable&&p.preventDefault();return}if(!x){var y=(a.current.shards||[]).map(kg).filter(Boolean).filter(function(S){return S.contains(p.target)}),w=y.length>0?l(p,y[0]):!a.current.noIsolation;w&&p.cancelable&&p.preventDefault()}}},[]),u=g.useCallback(function(v,p,h,x){var y={name:v,delta:p,target:h,should:x,shadowParent:V4(h)};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,Eg(v),v.target,l(v,e.lockRef.current))},[]),m=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:m}),document.addEventListener("wheel",c,zs),document.addEventListener("touchmove",c,zs),document.addEventListener("touchstart",d,zs),function(){Bs=Bs.filter(function(v){return v!==o}),document.removeEventListener("wheel",c,zs),document.removeEventListener("touchmove",c,zs),document.removeEventListener("touchstart",d,zs)}},[]);var b=e.removeScrollBar,j=e.inert;return g.createElement(g.Fragment,null,j?g.createElement(o,{styles:F4(i)}):null,b?g.createElement(A4,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function V4(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const z4=g4(cw,U4);var hw=g.forwardRef(function(e,t){return g.createElement(Xl,Yt({},e,{ref:t,sideCar:z4}))});hw.classNames=Xl.classNames;var Md=["Enter"," "],B4=["ArrowDown","PageUp","Home"],pw=["ArrowUp","PageDown","End"],W4=[...B4,...pw],H4={ltr:[...Md,"ArrowRight"],rtl:[...Md,"ArrowLeft"]},q4={ltr:["ArrowLeft"],rtl:["ArrowRight"]},yo="Menu",[Xi,K4,G4]=Sb(yo),[Fs,gw]=ho(yo,[G4,Wb,tw]),Ql=Wb(),xw=tw(),[Y4,$s]=Fs(yo),[X4,vo]=Fs(yo),yw=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),m=Cb(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(DP,{...l,children:r.jsx(Y4,{scope:t,open:n,onOpenChange:f,content:c,onContentChange:u,children:r.jsx(X4,{scope:t,onClose:g.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:d,dir:m,modal:a,children:s})})})};yw.displayName=yo;var Q4="MenuAnchor",jm=g.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e,i=Ql(n);return r.jsx(FP,{...i,...s,ref:t})});jm.displayName=Q4;var Nm="MenuPortal",[J4,vw]=Fs(Nm,{forceMount:void 0}),bw=e=>{const{__scopeMenu:t,forceMount:n,children:s,container:i}=e,o=$s(Nm,t);return r.jsx(J4,{scope:t,forceMount:n,children:r.jsx(go,{present:n||o.open,children:r.jsx(Zb,{asChild:!0,container:i,children:s})})})};bw.displayName=Nm;var Tt="MenuContent",[Z4,Sm]=Fs(Tt),ww=g.forwardRef((e,t)=>{const n=vw(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(e3,{...i,ref:t}):r.jsx(t3,{...i,ref:t})})})})}),e3=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 o4(o)},[]),r.jsx(Cm,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:re(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),t3=g.forwardRef((e,t)=>{const n=$s(Tt,e.__scopeMenu);return r.jsx(Cm,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),n3=Ki("MenuContent.ScrollLock"),Cm=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:m,onDismiss:b,disableOutsideScroll:j,...v}=e,p=$s(Tt,n),h=vo(Tt,n),x=Ql(n),y=xw(n),w=K4(n),[S,C]=g.useState(null),E=g.useRef(null),T=ct(t,E,p.onContentChange),N=g.useRef(0),k=g.useRef(""),A=g.useRef(0),P=g.useRef(null),_=g.useRef("right"),M=g.useRef(0),O=j?hw:g.Fragment,F=j?{as:n3,allowPinchZoom:!0}:void 0,$=I=>{var Le,us;const D=k.current+I,V=w().filter(Je=>!Je.disabled),K=document.activeElement,se=(Le=V.find(Je=>Je.ref.current===K))==null?void 0:Le.textValue,ve=V.map(Je=>Je.textValue),yt=h3(ve,D,se),Pe=(us=V.find(Je=>Je.textValue===yt))==null?void 0:us.ref.current;(function Je(ds){k.current=ds,window.clearTimeout(N.current),ds!==""&&(N.current=window.setTimeout(()=>Je(""),1e3))})(D),Pe&&setTimeout(()=>Pe.focus())};g.useEffect(()=>()=>window.clearTimeout(N.current),[]),lR();const R=g.useCallback(I=>{var V,K;return _.current===((V=P.current)==null?void 0:V.side)&&g3(I,(K=P.current)==null?void 0:K.area)},[]);return r.jsx(Z4,{scope:n,searchRef:k,onItemEnter:g.useCallback(I=>{R(I)&&I.preventDefault()},[R]),onItemLeave:g.useCallback(I=>{var D;R(I)||((D=E.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(Ab,{asChild:!0,trapped:i,onMountAutoFocus:re(o,I=>{var D;I.preventDefault(),(D=E.current)==null||D.focus({preventScroll:!0})}),onUnmountAutoFocus:a,children:r.jsx(kb,{asChild:!0,disableOutsidePointerEvents:l,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:m,onDismiss:b,children:r.jsx(t4,{asChild:!0,...y,dir:h.dir,orientation:"vertical",loop:s,currentTabStopId:S,onCurrentTabStopIdChange:C,onEntryFocus:re(c,I=>{h.isUsingKeyboardRef.current||I.preventDefault()}),preventScrollOnEntryFocus:!0,children:r.jsx($P,{role:"menu","aria-orientation":"vertical","data-state":Dw(p.open),"data-radix-menu-content":"",dir:h.dir,...x,...v,ref:T,style:{outline:"none",...v.style},onKeyDown:re(v.onKeyDown,I=>{const V=I.target.closest("[data-radix-menu-content]")===I.currentTarget,K=I.ctrlKey||I.altKey||I.metaKey,se=I.key.length===1;V&&(I.key==="Tab"&&I.preventDefault(),!K&&se&&$(I.key));const ve=E.current;if(I.target!==ve||!W4.includes(I.key))return;I.preventDefault();const Pe=w().filter(Le=>!Le.disabled).map(Le=>Le.ref.current);pw.includes(I.key)&&Pe.reverse(),f3(Pe)}),onBlur:re(e.onBlur,I=>{I.currentTarget.contains(I.target)||(window.clearTimeout(N.current),k.current="")}),onPointerMove:re(e.onPointerMove,Qi(I=>{const D=I.target,V=M.current!==I.clientX;if(I.currentTarget.contains(D)&&V){const K=I.clientX>M.current?"right":"left";_.current=K,M.current=I.clientX}}))})})})})})})});ww.displayName=Tt;var s3="MenuGroup",Em=g.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e;return r.jsx(Xe.div,{role:"group",...s,ref:t})});Em.displayName=s3;var r3="MenuLabel",jw=g.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e;return r.jsx(Xe.div,{...s,ref:t})});jw.displayName=r3;var dl="MenuItem",Tg="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=Sm(dl,e.__scopeMenu),c=ct(t,o),u=g.useRef(!1),d=()=>{const f=o.current;if(!n&&f){const m=new CustomEvent(Tg,{bubbles:!0,cancelable:!0});f.addEventListener(Tg,b=>s==null?void 0:s(b),{once:!0}),Nb(f,m),m.defaultPrevented?u.current=!1:a.onClose()}};return r.jsx(Nw,{...i,ref:c,disabled:n,onClick:re(e.onClick,d),onPointerDown:f=>{var m;(m=e.onPointerDown)==null||m.call(e,f),u.current=!0},onPointerUp:re(e.onPointerUp,f=>{var m;u.current||(m=f.currentTarget)==null||m.click()}),onKeyDown:re(e.onKeyDown,f=>{const m=l.searchRef.current!=="";n||m&&f.key===" "||Md.includes(f.key)&&(f.currentTarget.click(),f.preventDefault())})})});Jl.displayName=dl;var Nw=g.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:s=!1,textValue:i,...o}=e,a=Sm(dl,n),l=xw(n),c=g.useRef(null),u=ct(t,c),[d,f]=g.useState(!1),[m,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??m,children:r.jsx(n4,{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))})})})}),i3="MenuCheckboxItem",Sw=g.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:s,...i}=e;return r.jsx(Aw,{scope:e.__scopeMenu,checked:n,children:r.jsx(Jl,{role:"menuitemcheckbox","aria-checked":fl(n)?"mixed":n,...i,ref:t,"data-state":Tm(n),onSelect:re(i.onSelect,()=>s==null?void 0:s(fl(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Sw.displayName=i3;var Cw="MenuRadioGroup",[o3,a3]=Fs(Cw,{value:void 0,onValueChange:()=>{}}),Ew=g.forwardRef((e,t)=>{const{value:n,onValueChange:s,...i}=e,o=jn(s);return r.jsx(o3,{scope:e.__scopeMenu,value:n,onValueChange:o,children:r.jsx(Em,{...i,ref:t})})});Ew.displayName=Cw;var kw="MenuRadioItem",Tw=g.forwardRef((e,t)=>{const{value:n,...s}=e,i=a3(kw,e.__scopeMenu),o=n===i.value;return r.jsx(Aw,{scope:e.__scopeMenu,checked:o,children:r.jsx(Jl,{role:"menuitemradio","aria-checked":o,...s,ref:t,"data-state":Tm(o),onSelect:re(s.onSelect,()=>{var a;return(a=i.onValueChange)==null?void 0:a.call(i,n)},{checkForDefaultPrevented:!1})})})});Tw.displayName=kw;var km="MenuItemIndicator",[Aw,l3]=Fs(km,{checked:!1}),Rw=g.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:s,...i}=e,o=l3(km,n);return r.jsx(go,{present:s||fl(o.checked)||o.checked===!0,children:r.jsx(Xe.span,{...i,ref:t,"data-state":Tm(o.checked)})})});Rw.displayName=km;var c3="MenuSeparator",Pw=g.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e;return r.jsx(Xe.div,{role:"separator","aria-orientation":"horizontal",...s,ref:t})});Pw.displayName=c3;var u3="MenuArrow",_w=g.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e,i=Ql(n);return r.jsx(UP,{...i,...s,ref:t})});_w.displayName=u3;var d3="MenuSub",[ZL,Mw]=Fs(d3),ai="MenuSubTrigger",Iw=g.forwardRef((e,t)=>{const n=$s(ai,e.__scopeMenu),s=vo(ai,e.__scopeMenu),i=Mw(ai,e.__scopeMenu),o=Sm(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(jm,{asChild:!0,...u,children:r.jsx(Nw,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":i.contentId,"data-state":Dw(n.open),...e,ref:ql(t,i.onTriggerChange),onClick:f=>{var m;(m=e.onClick)==null||m.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 m=(b=n.content)==null?void 0:b.getBoundingClientRect();if(m){const v=(j=n.content)==null?void 0:j.dataset.side,p=v==="right",h=p?-5:5,x=m[p?"left":"right"],y=m[p?"right":"left"];o.onPointerGraceIntentChange({area:[{x:f.clientX+h,y:f.clientY},{x,y:m.top},{x:y,y:m.top},{x:y,y:m.bottom},{x,y:m.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 m=o.searchRef.current!=="";e.disabled||m&&f.key===" "||H4[s.dir].includes(f.key)&&(n.onOpenChange(!0),(b=n.content)==null||b.focus(),f.preventDefault())})})})});Iw.displayName=ai;var Ow="MenuSubContent",Lw=g.forwardRef((e,t)=>{const n=vw(Tt,e.__scopeMenu),{forceMount:s=n.forceMount,...i}=e,o=$s(Tt,e.__scopeMenu),a=vo(Tt,e.__scopeMenu),l=Mw(Ow,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(Cm,{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),m=q4[a.dir].includes(d.key);f&&m&&(o.onOpenChange(!1),(b=l.trigger)==null||b.focus(),d.preventDefault())})})})})})});Lw.displayName=Ow;function Dw(e){return e?"open":"closed"}function fl(e){return e==="indeterminate"}function Tm(e){return fl(e)?"indeterminate":e?"checked":"unchecked"}function f3(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function m3(e,t){return e.map((n,s)=>e[(t+s)%e.length])}function h3(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=m3(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 p3(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,m=c.y;d>s!=m>s&&n<(f-u)*(s-d)/(m-d)+u&&(i=!i)}return i}function g3(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return p3(n,t)}function Qi(e){return t=>t.pointerType==="mouse"?e(t):void 0}var x3=yw,y3=jm,v3=bw,b3=ww,w3=Em,j3=jw,N3=Jl,S3=Sw,C3=Ew,E3=Tw,k3=Rw,T3=Pw,A3=_w,R3=Iw,P3=Lw,Zl="DropdownMenu",[_3,eD]=ho(Zl,[gw]),Qe=gw(),[M3,Fw]=_3(Zl),$w=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]=jb({prop:i,defaultProp:o??!1,onChange:a,caller:Zl});return r.jsx(M3,{scope:t,triggerId:kd(),triggerRef:u,contentId:kd(),open:d,onOpenChange:f,onOpenToggle:g.useCallback(()=>f(m=>!m),[f]),modal:l,children:r.jsx(x3,{...c,open:d,onOpenChange:f,dir:s,modal:l,children:n})})};$w.displayName=Zl;var Uw="DropdownMenuTrigger",Vw=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:s=!1,...i}=e,o=Fw(Uw,n),a=Qe(n);return r.jsx(y3,{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())})})})});Vw.displayName=Uw;var I3="DropdownMenuPortal",zw=e=>{const{__scopeDropdownMenu:t,...n}=e,s=Qe(t);return r.jsx(v3,{...s,...n})};zw.displayName=I3;var Bw="DropdownMenuContent",Ww=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,i=Fw(Bw,n),o=Qe(n),a=g.useRef(!1);return r.jsx(b3,{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)"}})});Ww.displayName=Bw;var O3="DropdownMenuGroup",L3=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,i=Qe(n);return r.jsx(w3,{...i,...s,ref:t})});L3.displayName=O3;var D3="DropdownMenuLabel",Hw=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,i=Qe(n);return r.jsx(j3,{...i,...s,ref:t})});Hw.displayName=D3;var F3="DropdownMenuItem",qw=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,i=Qe(n);return r.jsx(N3,{...i,...s,ref:t})});qw.displayName=F3;var $3="DropdownMenuCheckboxItem",Kw=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,i=Qe(n);return r.jsx(S3,{...i,...s,ref:t})});Kw.displayName=$3;var U3="DropdownMenuRadioGroup",V3=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,i=Qe(n);return r.jsx(C3,{...i,...s,ref:t})});V3.displayName=U3;var z3="DropdownMenuRadioItem",Gw=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,i=Qe(n);return r.jsx(E3,{...i,...s,ref:t})});Gw.displayName=z3;var B3="DropdownMenuItemIndicator",Yw=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,i=Qe(n);return r.jsx(k3,{...i,...s,ref:t})});Yw.displayName=B3;var W3="DropdownMenuSeparator",Xw=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,i=Qe(n);return r.jsx(T3,{...i,...s,ref:t})});Xw.displayName=W3;var H3="DropdownMenuArrow",q3=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,i=Qe(n);return r.jsx(A3,{...i,...s,ref:t})});q3.displayName=H3;var K3="DropdownMenuSubTrigger",Qw=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,i=Qe(n);return r.jsx(R3,{...i,...s,ref:t})});Qw.displayName=K3;var G3="DropdownMenuSubContent",Jw=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,i=Qe(n);return r.jsx(P3,{...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)"}})});Jw.displayName=G3;var Y3=$w,X3=Vw,Q3=zw,Zw=Ww,ej=Hw,tj=qw,nj=Kw,sj=Gw,rj=Yw,ij=Xw,oj=Qw,aj=Jw;const J3=Y3,Z3=X3,e_=g.forwardRef(({className:e,inset:t,children:n,...s},i)=>r.jsxs(oj,{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(bd,{className:"ml-auto"})]}));e_.displayName=oj.displayName;const t_=g.forwardRef(({className:e,...t},n)=>r.jsx(aj,{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}));t_.displayName=aj.displayName;const lj=g.forwardRef(({className:e,sideOffset:t=4,...n},s)=>r.jsx(Q3,{children:r.jsx(Zw,{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})}));lj.displayName=Zw.displayName;const Ea=g.forwardRef(({className:e,inset:t,...n},s)=>r.jsx(tj,{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}));Ea.displayName=tj.displayName;const n_=g.forwardRef(({className:e,children:t,checked:n,...s},i)=>r.jsxs(nj,{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(rj,{children:r.jsx(cm,{className:"h-4 w-4"})})}),t]}));n_.displayName=nj.displayName;const s_=g.forwardRef(({className:e,children:t,...n},s)=>r.jsxs(sj,{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(rj,{children:r.jsx(ab,{className:"h-2 w-2 fill-current"})})}),t]}));s_.displayName=sj.displayName;const r_=g.forwardRef(({className:e,inset:t,...n},s)=>r.jsx(ej,{ref:s,className:Y("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...n}));r_.displayName=ej.displayName;const i_=g.forwardRef(({className:e,...t},n)=>r.jsx(ij,{ref:n,className:Y("-mx-1 my-1 h-px bg-muted",e),...t}));i_.displayName=ij.displayName;const cj=g.createContext({theme:"system",setTheme:()=>null});function o_({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(cj.Provider,{...s,value:a,children:e})}const a_=()=>{const e=g.useContext(cj);if(e===void 0)throw new Error("useTheme must be used within a ThemeProvider");return e};function l_(){const{theme:e,setTheme:t}=a_();return r.jsxs(J3,{children:[r.jsx(Z3,{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(lj,{align:"end",children:[r.jsxs(Ea,{onClick:()=>t("light"),children:[r.jsx(eg,{className:"mr-2 h-4 w-4"}),r.jsx("span",{children:"Light"})]}),r.jsxs(Ea,{onClick:()=>t("dark"),children:[r.jsx(Jp,{className:"mr-2 h-4 w-4"}),r.jsx("span",{children:"Dark"})]}),r.jsxs(Ea,{onClick:()=>t("system"),children:[r.jsx(OT,{className:"mr-2 h-4 w-4"}),r.jsx("span",{children:"System"})]})]})]})}const c_="/assets/FriggLogo-B7Xx8ZW1.svg",uj=({children:e})=>{const t=Ds(),{status:n,environment:s,users:i,currentUser:o,switchUserContext:a}=_t(),[l,c]=We.useState(!1),[u,d]=We.useState(null);We.useEffect(()=>{(async()=>{var j;try{const p=await(await fetch("/api/repository/current")).json();(j=p.data)!=null&&j.repository&&d(p.data.repository)}catch(v){console.error("Failed to fetch repository info:",v)}})()},[]);const f=[{name:"Dashboard",href:"/dashboard",icon:bT},{name:"Integrations",href:"/integrations",icon:UT},{name:"Code Generation",href:"/code-generation",icon:Hi},{name:"Environment",href:"/environment",icon:dm},{name:"Users",href:"/users",icon:nA},{name:"Connections",href:"/connections",icon:AT},{name:"Simulation",href:"/simulation",icon:mb},{name:"Monitoring",href:"/monitoring",icon:Yk}],m=()=>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:m}),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(MT,{size:24})}),r.jsxs("div",{className:"flex items-center gap-3 ml-2 lg:ml-0",children:[r.jsx("img",{src:c_,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(VA,{currentRepo:u,onRepoChange:d}),r.jsx(UA,{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(l_,{})]})]})})}),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(bd,{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(Nd,{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:m,className:"absolute top-4 right-4 p-2 text-muted-foreground hover:text-foreground hover:bg-accent industrial-transition sharp-button",children:r.jsx(rA,{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:m,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(bd,{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})]})})]})]})},Am=g.createContext({});function Rm(e){const t=g.useRef(null);return t.current===null&&(t.current=e()),t.current}const Pm=typeof window<"u",dj=Pm?g.useLayoutEffect:g.useEffect,ec=g.createContext(null);function _m(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 Im=()=>{};const En={},fj=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function mj(e){return typeof e=="object"&&e!==null}const hj=e=>/^0[^.\s]+$/u.test(e);function Om(e){let t;return()=>(t===void 0&&(t=e()),t)}const At=e=>e,u_=(e,t)=>n=>t(e(n)),bo=(...e)=>e.reduce(u_),Ji=(e,t,n)=>{const s=t-e;return s===0?1:(n-e)/s};class Lm{constructor(){this.subscriptions=[]}add(t){return _m(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 pj(e,t){return t?e*(1e3/t):0}const gj=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,d_=1e-7,f_=12;function m_(e,t,n,s,i){let o,a,l=0;do a=t+(n-t)/2,o=gj(a,s,i)-e,o>0?n=a:t=a;while(Math.abs(o)>d_&&++l<f_);return a}function wo(e,t,n,s){if(e===t&&n===s)return At;const i=o=>m_(o,0,1,e,n);return o=>o===0||o===1?o:gj(i(o),t,s)}const xj=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,yj=e=>t=>1-e(1-t),vj=wo(.33,1.53,.69,.99),Dm=yj(vj),bj=xj(Dm),wj=e=>(e*=2)<1?.5*Dm(e):.5*(2-Math.pow(2,-10*(e-1))),Fm=e=>1-Math.sin(Math.acos(e)),jj=yj(Fm),Nj=xj(Fm),h_=wo(.42,0,1,1),p_=wo(0,0,.58,1),Sj=wo(.42,0,.58,1),g_=e=>Array.isArray(e)&&typeof e[0]!="number",Cj=e=>Array.isArray(e)&&typeof e[0]=="number",x_={linear:At,easeIn:h_,easeInOut:Sj,easeOut:p_,circIn:Fm,circInOut:Nj,circOut:jj,backIn:Dm,backInOut:bj,backOut:vj,anticipate:wj},y_=e=>typeof e=="string",Ag=e=>{if(Cj(e)){Im(e.length===4);const[t,n,s,i]=e;return wo(t,n,s,i)}else if(y_(e))return x_[e];return e},Jo=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function v_(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};function c(d){a.has(d)&&(u.schedule(d),e()),d(l)}const u={schedule:(d,f=!1,m=!1)=>{const j=m&&i?n:s;return f&&a.add(d),j.has(d)||j.add(d),d},cancel:d=>{s.delete(d),a.delete(d)},process:d=>{if(l=d,i){o=!0;return}i=!0,[n,s]=[s,n],n.forEach(c),n.clear(),i=!1,o&&(o=!1,u.process(d))}};return u}const b_=40;function Ej(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]=v_(o),y),{}),{setup:l,read:c,resolveKeyframes:u,preUpdate:d,update:f,preRender:m,render:b,postRender:j}=a,v=()=>{const y=En.useManualTiming?i.timestamp:performance.now();n=!1,En.useManualTiming||(i.delta=s?1e3/60:Math.max(Math.min(y-i.timestamp,b_),1)),i.timestamp=y,i.isProcessing=!0,l.process(i),c.process(i),u.process(i),d.process(i),f.process(i),m.process(i),b.process(i),j.process(i),i.isProcessing=!1,n&&t&&(s=!1,e(v))},p=()=>{n=!0,s=!0,i.isProcessing||e(v)};return{schedule:Jo.reduce((y,w)=>{const S=a[w];return y[w]=(C,E=!1,T=!1)=>(n||p(),S.schedule(C,E,T)),y},{}),cancel:y=>{for(let w=0;w<Jo.length;w++)a[Jo[w]].cancel(y)},state:i,steps:a}}const{schedule:fe,cancel:ss,state:Me,steps:Xc}=Ej(typeof requestAnimationFrame<"u"?requestAnimationFrame:At,!0);let ka;function w_(){ka=void 0}const st={now:()=>(ka===void 0&&st.set(Me.isProcessing||En.useManualTiming?Me.timestamp:performance.now()),ka),set:e=>{ka=e,queueMicrotask(w_)}},kj=e=>t=>typeof t=="string"&&t.startsWith(e),$m=kj("--"),j_=kj("var(--"),Um=e=>j_(e)?N_.test(e.split("/*")[0].trim()):!1,N_=/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,Vm=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function S_(e){return e==null}const C_=/^(?:#[\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"&&C_.test(n)&&n.startsWith(e)||t&&!S_(n)&&Object.prototype.hasOwnProperty.call(n,t)),Tj=(e,t,n)=>s=>{if(typeof s!="string")return s;const[i,o,a,l]=s.match(Vm);return{[e]:parseFloat(i),[t]:parseFloat(o),[n]:parseFloat(a),alpha:l!==void 0?parseFloat(l):1}},E_=e=>Cn(0,255,e),Qc={...$r,transform:e=>Math.round(E_(e))},ws={test:zm("rgb","red"),parse:Tj("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 k_(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 Id={test:zm("#"),parse:k_,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"),T_=jo("vh"),A_=jo("vw"),Rg={...sn,parse:e=>sn.parse(e)/100,transform:e=>sn.transform(e*100)},sr={test:zm("hsl","hue"),parse:Tj("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)||Id.test(e)||sr.test(e),parse:e=>ws.test(e)?ws.parse(e):sr.test(e)?sr.parse(e):Id.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)}},R_=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function P_(e){var t,n;return isNaN(e)&&typeof e=="string"&&(((t=e.match(Vm))==null?void 0:t.length)||0)+(((n=e.match(R_))==null?void 0:n.length)||0)>0}const Aj="number",Rj="color",__="var",M_="var(",Pg="${}",I_=/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(I_,c=>(Se.test(c)?(s.color.push(o),i.push(Rj),n.push(Se.parse(c))):c.startsWith(M_)?(s.var.push(o),i.push(__),n.push(c)):(s.number.push(o),i.push(Aj),n.push(parseFloat(c))),++o,Pg)).split(Pg);return{values:n,split:l,indexes:s,types:i}}function Pj(e){return eo(e).values}function _j(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===Aj?o+=vi(i[a]):l===Rj?o+=Se.transform(i[a]):o+=i[a]}return o}}const O_=e=>typeof e=="number"?0:Se.test(e)?Se.getAnimatableNone(e):e;function L_(e){const t=Pj(e);return _j(e)(t.map(O_))}const rs={test:P_,parse:Pj,createTransformer:_j,getAnimatableNone:L_};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 D_({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 he=(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)},F_=[Id,ws,sr],$_=e=>F_.find(t=>t.test(e));function _g(e){const t=$_(e);if(!t)return!1;let n=t.parse(e);return t===sr&&(n=D_(n)),n}const Mg=(e,t)=>{const n=_g(e),s=_g(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=he(n.alpha,s.alpha,o),ws.transform(i))},Od=new Set(["none","hidden"]);function U_(e,t){return Od.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function V_(e,t){return n=>he(e,t,n)}function Bm(e){return typeof e=="number"?V_:typeof e=="string"?Um(e)?ml:Se.test(e)?Mg:W_:Array.isArray(e)?Mj:typeof e=="object"?Se.test(e)?Mg:z_:ml}function Mj(e,t){const n=[...e],s=n.length,i=e.map((o,a)=>Bm(o)(o,t[a]));return o=>{for(let a=0;a<s;a++)n[a]=i[a](o);return n}}function z_(e,t){const n={...e,...t},s={};for(const i in n)e[i]!==void 0&&t[i]!==void 0&&(s[i]=Bm(e[i])(e[i],t[i]));return i=>{for(const o in s)n[o]=s[o](i);return n}}function B_(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 W_=(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?Od.has(e)&&!i.values.length||Od.has(t)&&!s.values.length?U_(e,t):bo(Mj(B_(s,i),i.values),n):ml(e,t)};function Ij(e,t,n){return typeof e=="number"&&typeof t=="number"&&typeof n=="number"?he(e,t,n):Bm(e)(e,t)}const H_=e=>{const t=({timestamp:n})=>e(n);return{start:(n=!0)=>fe.update(t,n),stop:()=>ss(t),now:()=>Me.isProcessing?Me.timestamp:st.now()}},Oj=(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 Wm(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 q_(e,t=100,n){const s=n({...e,keyframes:[0,t]}),i=Math.min(Wm(s),hl);return{type:"keyframes",ease:o=>s.next(i*o).value/t,duration:nn(i)}}const K_=5;function Lj(e,t,n){const s=Math.max(t-K_,0);return pj(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 G_({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,m=d-n,b=Ld(u,a),j=Math.exp(-f);return eu-m/b*j},o=u=>{const f=u*a*e,m=f*n+n,b=Math.pow(a,2)*Math.pow(u,2)*e,j=Math.exp(-f),v=Ld(Math.pow(u,2),a);return(-i(u)+eu>0?-1:1)*((m-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=X_(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 Y_=12;function X_(e,t,n){let s=n;for(let i=1;i<Y_;i++)s=s-e(s)/t(s);return s}function Ld(e,t){return e*Math.sqrt(1-t*t)}const Q_=["duration","bounce"],J_=["stiffness","damping","mass"];function Ig(e,t){return t.some(n=>e[n]!==void 0)}function Z_(e){let t={velocity:xe.velocity,stiffness:xe.stiffness,damping:xe.damping,mass:xe.mass,isResolvedFromDuration:!1,...e};if(!Ig(e,J_)&&Ig(e,Q_))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=G_(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:m,isResolvedFromDuration:b}=Z_({...n,velocity:-nn(n.velocity||0)}),j=m||0,v=u/(2*Math.sqrt(c*d)),p=a-o,h=nn(Math.sqrt(c/d)),x=Math.abs(p)<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=Ld(h,v);y=C=>{const E=Math.exp(-v*h*C);return a-E*((j+v*h*p)/S*Math.sin(S*C)+p*Math.cos(S*C))}}else if(v===1)y=S=>a-Math.exp(-h*S)*(p+(j+h*p)*S);else{const S=h*Math.sqrt(v*v-1);y=C=>{const E=Math.exp(-v*h*C),T=Math.min(S*C,300);return a-E*((j+v*h*p)*Math.sinh(T)+S*p*Math.cosh(T))/S}}const w={calculatedDuration:b&&f||null,next:S=>{const C=y(S);if(b)l.done=S>=f;else{let E=S===0?j:0;v<1&&(E=S===0?tn(j):Lj(y,S,C));const T=Math.abs(E)<=s,N=Math.abs(a-C)<=i;l.done=T&&N}return l.value=l.done?a:C,l},toString:()=>{const S=Math.min(Wm(w),hl),C=Oj(E=>w.next(S*E).value,S,30);return S+"ms "+C},toTransition:()=>{}};return w}pl.applyToOptions=e=>{const t=q_(e,100,pl);return e.ease=t.ease,e.duration=tn(t.duration),e.type="keyframes",e};function Dd({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],m={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 p=f+v,h=a===void 0?p:a(p);h!==p&&(v=h-f);const x=T=>-v*Math.exp(-T/s),y=T=>h+x(T),w=T=>{const N=x(T),k=y(T);m.done=Math.abs(N)<=u,m.value=m.done?h:k};let S,C;const E=T=>{b(m.value)&&(S=T,C=pl({keyframes:[m.value,j(m.value)],velocity:Lj(y,T,m.value),damping:i,stiffness:o,restDelta:u,restSpeed:d}))};return E(0),{calculatedDuration:null,next:T=>{let N=!1;return!C&&S===void 0&&(N=!0,w(T),E(T)),S!==void 0&&T>=S?C.next(T-S):(!N&&w(T),m)}}}function eM(e,t,n){const s=[],i=n||En.mix||Ij,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 tM(e,t,{clamp:n=!0,ease:s,mixer:i}={}){const o=e.length;if(Im(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=eM(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 m=Ji(e[f],e[f+1],d);return l[f](m)};return n?d=>u(Cn(e[0],e[o-1],d)):u}function nM(e,t){const n=e[e.length-1];for(let s=1;s<=t;s++){const i=Ji(0,t,s);e.push(he(n,1,i))}}function sM(e){const t=[0];return nM(t,e.length-1),t}function rM(e,t){return e.map(n=>n*t)}function iM(e,t){return e.map(()=>t||Sj).splice(0,e.length-1)}function bi({duration:e=300,keyframes:t,times:n,ease:s="easeInOut"}){const i=g_(s)?s.map(Ag):Ag(s),o={done:!1,value:t[0]},a=rM(n&&n.length===t.length?n:sM(t),e),l=tM(a,t,{ease:Array.isArray(i)?i:iM(t,i)});return{calculatedDuration:e,next:c=>(o.value=l(c),o.done=c>=e,o)}}const oM=e=>e!==null;function Hm(e,{repeat:t,repeatType:n="loop"},s,i=1){const o=e.filter(oM),l=i<0||t&&n!=="loop"&&t%2===1?0:o.length-1;return!l||s===void 0?o[l]:s}const aM={decay:Dd,inertia:Dd,tween:bi,keyframes:bi,spring:pl};function Dj(e){typeof e.type=="string"&&(e.type=aM[e.type])}class qm{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 lM=e=>e/100;class Km extends qm{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;Dj(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(lM,Ij(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=Wm(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:m,repeatDelay:b,type:j,onUpdate:v,finalKeyframe:p}=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 h=this.currentTime-u*(this.playbackSpeed>=0?1:-1),x=this.playbackSpeed>=0?h<0:h>i;this.currentTime=Math.max(h,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),k=T%1;!k&&T>=1&&(k=1),k===1&&N--,N=Math.min(N,f+1),!!(N%2)&&(m==="reverse"?(k=1-k,b&&(k-=b/l)):m==="mirror"&&(w=a)),y=Cn(0,1,k)*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 E=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&C);return E&&j!==Dd&&(S.value=Hm(d,this.options,p,this.speed)),v&&v(S.value),E&&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=H_,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 cM(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}const js=e=>e*180/Math.PI,Fd=e=>{const t=js(Math.atan2(e[1],e[0]));return $d(t)},uM={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:Fd,rotateZ:Fd,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},$d=e=>(e=e%360,e<0&&(e+=360),e),Og=Fd,Lg=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),Dg=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),dM={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:Lg,scaleY:Dg,scale:e=>(Lg(e)+Dg(e))/2,rotateX:e=>$d(js(Math.atan2(e[6],e[5]))),rotateY:e=>$d(js(Math.atan2(-e[2],e[0]))),rotateZ:Og,rotate:Og,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 Ud(e){return e.includes("scale")?1:0}function Vd(e,t){if(!e||e==="none")return Ud(t);const n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let s,i;if(n)s=dM,i=n;else{const l=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);s=uM,i=l}if(!i)return Ud(t);const o=s[t],a=i[1].split(",").map(mM);return typeof o=="function"?o(a):a[o]}const fM=(e,t)=>{const{transform:n="none"}=getComputedStyle(e);return Vd(n,t)};function mM(e){return parseFloat(e.trim())}const Ur=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Vr=new Set(Ur),Fg=e=>e===$r||e===Q,hM=new Set(["x","y","z"]),pM=Ur.filter(e=>!hM.has(e));function gM(e){const t=[];return pM.forEach(n=>{const s=e.getValue(n);s!==void 0&&(t.push([n,s.get()]),s.set(n.startsWith("scale")?1:0))}),t}const Es={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})=>Vd(t,"x"),y:(e,{transform:t})=>Vd(t,"y")};Es.translateX=Es.x;Es.translateY=Es.y;const ks=new Set;let zd=!1,Bd=!1,Wd=!1;function Fj(){if(Bd){const e=Array.from(ks).filter(s=>s.needsMeasurement),t=new Set(e.map(s=>s.element)),n=new Map;t.forEach(s=>{const i=gM(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)})}Bd=!1,zd=!1,ks.forEach(e=>e.complete(Wd)),ks.clear()}function $j(){ks.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(Bd=!0)})}function xM(){Wd=!0,$j(),Fj(),Wd=!1}class Gm{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?(ks.add(this),zd||(zd=!0,fe.read($j),fe.resolveKeyframes(Fj))):(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])}cM(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),ks.delete(this)}cancel(){this.state==="scheduled"&&(ks.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const yM=e=>e.startsWith("--");function vM(e,t,n){yM(t)?e.style.setProperty(t,n):e.style[t]=n}const bM=Om(()=>window.ScrollTimeline!==void 0),wM={};function jM(e,t){const n=Om(e);return()=>wM[t]??n()}const Uj=jM(()=>{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})`,$g={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 Vj(e,t){if(e)return typeof e=="function"?Uj()?Oj(e,t):"ease-out":Cj(e)?li(e):Array.isArray(e)?e.map(n=>Vj(n,t)||$g.easeOut):$g[e]}function NM(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=Vj(l,i);Array.isArray(f)&&(d.easing=f);const m={delay:s,duration:i,easing:Array.isArray(f)?"linear":f,fill:"both",iterations:o+1,direction:a==="reverse"?"alternate":"normal"};return u&&(m.pseudoElement=u),e.animate(d,m)}function zj(e){return typeof e=="function"&&"applyToOptions"in e}function SM({type:e,...t}){return zj(e)&&Uj()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}class CM extends qm{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,Im(typeof t.type!="string");const u=SM(t);this.animation=NM(n,s,i,u,o),u.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!o){const d=Hm(i,this.options,l,this.speed);this.updateMotionValue?this.updateMotionValue(d):vM(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&&bM()?(this.animation.timeline=t,At):n(this)}}const Bj={anticipate:wj,backInOut:bj,circInOut:Nj};function EM(e){return e in Bj}function kM(e){typeof e.ease=="string"&&EM(e.ease)&&(e.ease=Bj[e.ease])}const Ug=10;class TM extends CM{constructor(t){kM(t),Dj(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 Km({...a,autoplay:!1}),c=tn(this.finishedTime??this.time);n.setWithVelocity(l.sample(c-Ug).value,l.sample(c).value,Ug),l.stop()}}const Vg=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(rs.test(e)||e==="0")&&!e.startsWith("url("));function AM(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 RM(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=Vg(i,t),l=Vg(o,t);return!a||!l?!1:AM(e)||(n==="spring"||zj(n))&&s}const PM=new Set(["opacity","clipPath","filter","transform"]),_M=Om(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function MM(e){var d;const{motionValue:t,name:n,repeatDelay:s,repeatType:i,damping:o,type:a}=e;if(!(((d=t==null?void 0:t.owner)==null?void 0:d.current)instanceof HTMLElement))return!1;const{onUpdate:c,transformTemplate:u}=t.owner.getProps();return _M()&&n&&PM.has(n)&&(n!=="transform"||!u)&&!c&&!s&&i!=="mirror"&&o!==0&&a!=="inertia"}const IM=40;class OM extends qm{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,p;this._animation&&(this._animation.stop(),(v=this.stopTimeline)==null||v.call(this)),(p=this.keyframeResolver)==null||p.cancel()},this.createdAt=st.now();const m={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)||Gm;this.keyframeResolver=new b(l,(v,p,h)=>this.onKeyframesResolved(v,p,m,!h),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(),RM(t,o,a,l)||((En.instantAnimations||!c)&&(d==null||d(Hm(t,s,n))),t[0]=t[t.length-1],s.duration=0,s.repeat=0);const m={startTime:i?this.resolvedAt?this.resolvedAt-this.createdAt>IM?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:n,...s,keyframes:t},b=!u&&MM(m)?new TM({...m,element:m.motionValue.owner.current}):new Km(m);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(),xM()),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 LM=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function DM(e){const t=LM.exec(e);if(!t)return[,];const[,n,s,i]=t;return[`--${n??s}`,i]}function Wj(e,t,n=1){const[s,i]=DM(e);if(!s)return;const o=window.getComputedStyle(t).getPropertyValue(s);if(o){const a=o.trim();return fj(a)?parseFloat(a):a}return Um(i)?Wj(i,t,n+1):i}function Ym(e,t){return(e==null?void 0:e[t])??(e==null?void 0:e.default)??e}const Hj=new Set(["width","height","top","left","right","bottom",...Ur]),FM={test:e=>e==="auto",parse:e=>e},qj=e=>t=>t.test(e),Kj=[$r,Q,sn,In,A_,T_,FM],zg=e=>Kj.find(qj(e));function $M(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||hj(e):!0}const UM=new Set(["brightness","contrast","saturate","opacity"]);function VM(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[s]=n.match(Vm)||[];if(!s)return e;const i=n.replace(s,"");let o=UM.has(t)?1:0;return s!==n&&(o*=100),t+"("+o+i+")"}const zM=/\b([a-z-]*)\(.*?\)/gu,Hd={...rs,getAnimatableNone:e=>{const t=e.match(zM);return t?t.map(VM).join(" "):e}},Bg={...$r,transform:Math.round},BM={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:Rg,originY:Rg,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,...BM,zIndex:Bg,fillOpacity:Zi,strokeOpacity:Zi,numOctaves:Bg},WM={...Xm,color:Se,backgroundColor:Se,outlineColor:Se,fill:Se,stroke:Se,borderColor:Se,borderTopColor:Se,borderRightColor:Se,borderBottomColor:Se,borderLeftColor:Se,filter:Hd,WebkitFilter:Hd},Gj=e=>WM[e];function Yj(e,t){let n=Gj(e);return n!==Hd&&(n=rs),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const HM=new Set(["auto","none","0"]);function qM(e,t,n){let s=0,i;for(;s<e.length&&!i;){const o=e[s];typeof o=="string"&&!HM.has(o)&&eo(o).values.length&&(i=e[s]),s++}if(i&&n)for(const o of t)e[o]=Yj(n,i)}class KM extends Gm{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(),Um(u))){const d=Wj(u,n.current);d!==void 0&&(t[c]=d),c===t.length-1&&(this.finalKeyframe=u)}}if(this.resolveNoneKeyframes(),!Hj.has(s)||t.length!==2)return;const[i,o]=t,a=zg(i),l=zg(o);if(a!==l)if(Fg(a)&&Fg(l))for(let c=0;c<t.length;c++){const u=t[c];typeof u=="string"&&(t[c]=parseFloat(u))}else Es[s]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:n}=this,s=[];for(let i=0;i<t.length;i++)(t[i]===null||$M(t[i]))&&s.push(i);s.length&&qM(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=Es[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]=Es[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 GM(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 Xj=(e,t)=>t&&typeof e=="number"?t.transform(e):e;function Qj(e){return mj(e)&&"offsetHeight"in e}const Wg=30,YM=e=>!isNaN(parseFloat(e));class XM{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=YM(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 Lm);const s=this.events[t].add(n);return t==="change"?()=>{s(),fe.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>Wg)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,Wg);return pj(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 Er(e,t){return new XM(e,t)}const{schedule:Qm}=Ej(queueMicrotask,!1),It={x:!1,y:!1};function Jj(){return It.x||It.y}function QM(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 Zj(e,t){const n=GM(e),s=new AbortController,i={passive:!0,...t,signal:s.signal};return[n,i,()=>s.abort()]}function Hg(e){return!(e.pointerType==="touch"||Jj())}function JM(e,t,n={}){const[s,i,o]=Zj(e,n),a=l=>{if(!Hg(l))return;const{target:c}=l,u=t(c,l);if(typeof u!="function"||!c)return;const d=f=>{Hg(f)&&(u(f),c.removeEventListener("pointerleave",d))};c.addEventListener("pointerleave",d,i)};return s.forEach(l=>{l.addEventListener("pointerenter",a,i)}),o}const e1=(e,t)=>t?e===t?!0:e1(e,t.parentElement):!1,Jm=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,ZM=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function eI(e){return ZM.has(e.tagName)||e.tabIndex!==-1}const Ta=new WeakSet;function qg(e){return t=>{t.key==="Enter"&&e(t)}}function tu(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const tI=(e,t)=>{const n=e.currentTarget;if(!n)return;const s=qg(()=>{if(Ta.has(n))return;tu(n,"down");const i=qg(()=>{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 Kg(e){return Jm(e)&&!Jj()}function nI(e,t,n={}){const[s,i,o]=Zj(e,n),a=l=>{const c=l.currentTarget;if(!Kg(l))return;Ta.add(c);const u=t(c,l),d=(b,j)=>{window.removeEventListener("pointerup",f),window.removeEventListener("pointercancel",m),Ta.has(c)&&Ta.delete(c),Kg(b)&&typeof u=="function"&&u(b,{success:j})},f=b=>{d(b,c===window||c===document||n.useGlobalTarget||e1(c,b.target))},m=b=>{d(b,!1)};window.addEventListener("pointerup",f,i),window.addEventListener("pointercancel",m,i)};return s.forEach(l=>{(n.useGlobalTarget?window:l).addEventListener("pointerdown",a,i),Qj(l)&&(l.addEventListener("focus",u=>tI(u,i)),!eI(l)&&!l.hasAttribute("tabindex")&&(l.tabIndex=0))}),o}function t1(e){return mj(e)&&"ownerSVGElement"in e}function sI(e){return t1(e)&&e.tagName==="svg"}const Ve=e=>!!(e&&e.getVelocity),rI=[...Kj,Se,rs],iI=e=>rI.find(qj(e)),Zm=g.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});class oI extends g.Component{getSnapshotBeforeUpdate(t){const n=this.props.childRef.current;if(n&&t.isPresent&&!this.props.isPresent){const s=n.offsetParent,i=Qj(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 aI({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:m}=a.current;if(t||!o.current||!c||!u)return;const b=n==="left"?`left: ${f}`:`right: ${m}`;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(oI,{isPresent:t,childRef:o,sizeRef:a,children:g.cloneElement(e,{ref:o})})}const lI=({children:e,initial:t,isPresent:n,onExitComplete:s,custom:i,presenceAffectsLayout:o,mode:a,anchorX:l,root:c})=>{const u=Rm(cI),d=g.useId();let f=!0,m=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&&(m={...m}),g.useMemo(()=>{u.forEach((b,j)=>u.set(j,!1))},[n]),g.useEffect(()=>{!n&&!u.size&&s&&s()},[n]),a==="popLayout"&&(e=r.jsx(aI,{isPresent:n,anchorX:l,root:c,children:e})),r.jsx(ec.Provider,{value:m,children:e})};function cI(){return new Map}function n1(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 Gg(e){const t=[];return g.Children.forEach(e,n=>{g.isValidElement(n)&&t.push(n)}),t}const Yg=({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]=n1(a),f=g.useMemo(()=>Gg(e),[e]),m=a&&!u?[]:f.map(ea),b=g.useRef(!0),j=g.useRef(f),v=Rm(()=>new Map),[p,h]=g.useState(f),[x,y]=g.useState(f);dj(()=>{b.current=!1,j.current=f;for(let C=0;C<x.length;C++){const E=ea(x[C]);m.includes(E)?v.delete(E):v.get(E)!==!0&&v.set(E,!1)}},[x,m.length,m.join("-")]);const w=[];if(f!==p){let C=[...f];for(let E=0;E<x.length;E++){const T=x[E],N=ea(T);m.includes(N)||(C.splice(E,0,T),w.push(T))}return o==="wait"&&w.length&&(C=w),y(Gg(C)),h(f),null}const{forceRender:S}=g.useContext(Am);return r.jsx(r.Fragment,{children:x.map(C=>{const E=ea(C),T=a&&!u?!1:f===x||m.includes(E),N=()=>{if(v.has(E))v.set(E,!0);else return;let k=!0;v.forEach(A=>{A||(k=!1)}),k&&(S==null||S(),y(j.current),a&&(d==null||d()),s&&s())};return r.jsx(lI,{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},E)})})},s1=g.createContext({strict:!1}),Xg={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"]},kr={};for(const e in Xg)kr[e]={isEnabled:t=>Xg[e].some(n=>!!t[n])};function uI(e){for(const t in e)kr[t]={...kr[t],...e[t]}}const dI=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")||dI.has(e)}let r1=e=>!gl(e);function fI(e){typeof e=="function"&&(r1=t=>t.startsWith("on")?!gl(t):e(t))}try{fI(require("@emotion/is-prop-valid").default)}catch{}function mI(e,t,n){const s={};for(const i in e)i==="values"&&typeof e.values=="object"||(r1(i)||n===!0&&gl(i)||!t&&!gl(i)||e.draggable&&i.startsWith("onDrag"))&&(s[i]=e[i]);return s}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 i1(e){return!!(sc(e)||e.variants)}function hI(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 pI(e){const{initial:t,animate:n}=hI(e,g.useContext(tc));return g.useMemo(()=>({initial:t,animate:n}),[Qg(t),Qg(n)])}function Qg(e){return Array.isArray(e)?e.join(" "):e}const no={};function gI(e){for(const t in e)no[t]=e[t],$m(t)&&(no[t].isCSSVariable=!0)}function o1(e,{layout:t,layoutId:n}){return Vr.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!no[e]||e==="opacity")}const xI={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},yI=Ur.length;function vI(e,t,n){let s="",i=!0;for(let o=0;o<yI;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=Xj(l,Xm[a]);if(!c){i=!1;const d=xI[a]||a;s+=`${d}(${u}) `}n&&(t[a]=u)}}return s=s.trim(),n?s=n(t,i?"":s):i&&(s="none"),s}function nh(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(Vr.has(c)){a=!0;continue}else if($m(c)){i[c]=u;continue}else{const d=Xj(u,Xm[c]);c.startsWith("origin")?(l=!0,o[c]=d):s[c]=d}}if(t.transform||(a||n?s.transform=vI(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 sh=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function a1(e,t,n){for(const s in t)!Ve(t[s])&&!o1(s,n)&&(e[s]=t[s])}function bI({transformTemplate:e},t){return g.useMemo(()=>{const n=sh();return nh(n,t,e),Object.assign({},n.vars,n.style)},[t])}function wI(e,t){const n=e.style||{},s={};return a1(s,n,e),Object.assign(s,bI(e,t)),s}function jI(e,t){const n={},s=wI(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 NI={offset:"stroke-dashoffset",array:"stroke-dasharray"},SI={offset:"strokeDashoffset",array:"strokeDasharray"};function CI(e,t,n=1,s=0,i=!0){e.pathLength=1;const o=i?NI:SI;e[o.offset]=Q.transform(-s);const a=Q.transform(t),l=Q.transform(n);e[o.array]=`${a} ${l}`}function l1(e,{attrX:t,attrY:n,attrScale:s,pathLength:i,pathSpacing:o=1,pathOffset:a=0,...l},c,u,d){if(nh(e,l,u),c){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:f,style:m}=e;f.transform&&(m.transform=f.transform,delete f.transform),(m.transform||f.transformOrigin)&&(m.transformOrigin=f.transformOrigin??"50% 50%",delete f.transformOrigin),m.transform&&(m.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&&CI(f,i,o,a,!1)}const c1=()=>({...sh(),attrs:{}}),u1=e=>typeof e=="string"&&e.toLowerCase()==="svg";function EI(e,t,n,s){const i=g.useMemo(()=>{const o=c1();return l1(o,t,u1(s),e.transformTemplate,e.style),{...o.attrs,style:{...o.style}}},[t]);if(e.style){const o={};a1(o,e.style,e),i.style={...o,...i.style}}return i}const kI=["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 rh(e){return typeof e!="string"||e.includes("-")?!1:!!(kI.indexOf(e)>-1||/[A-Z]/u.test(e))}function TI(e,t,n,{latestValues:s},i,o=!1){const l=(rh(e)?EI:jI)(t,s,i,e),c=mI(t,typeof e=="string",o),u=e!==g.Fragment?{...c,...l,ref:n}:{},{children:d}=t,f=g.useMemo(()=>Ve(d)?d.get():d,[d]);return g.createElement(e,{...u,children:f})}function Jg(e){const t=[{},{}];return e==null||e.values.forEach((n,s)=>{t[0][s]=n.get(),t[1][s]=n.getVelocity()}),t}function ih(e,t,n,s){if(typeof t=="function"){const[i,o]=Jg(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]=Jg(s);t=t(n!==void 0?n:e.custom,i,o)}return t}function Aa(e){return Ve(e)?e.get():e}function AI({scrapeMotionValuesFromProps:e,createRenderState:t},n,s,i){return{latestValues:RI(n,s,i,e),renderState:t()}}function RI(e,t,n,s){const i={},o=s(e,{});for(const m in o)i[m]=Aa(o[m]);let{initial:a,animate:l}=e;const c=sc(e),u=i1(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 m=Array.isArray(f)?f:[f];for(let b=0;b<m.length;b++){const j=ih(e,m[b]);if(j){const{transitionEnd:v,transition:p,...h}=j;for(const x in h){let y=h[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}const d1=e=>(t,n)=>{const s=g.useContext(tc),i=g.useContext(ec),o=()=>AI(e,t,s,i);return n?o():Rm(o)};function oh(e,t,n){var o;const{style:s}=e,i={};for(const a in s)(Ve(s[a])||t.style&&Ve(t.style[a])||o1(a,e)||((o=n==null?void 0:n.getValue(a))==null?void 0:o.liveStyle)!==void 0)&&(i[a]=s[a]);return i}const PI=d1({scrapeMotionValuesFromProps:oh,createRenderState:sh});function f1(e,t,n){const s=oh(e,t,n);for(const i in e)if(Ve(e[i])||Ve(t[i])){const o=Ur.indexOf(i)!==-1?"attr"+i.charAt(0).toUpperCase()+i.substring(1):i;s[o]=e[i]}return s}const _I=d1({scrapeMotionValuesFromProps:f1,createRenderState:c1}),MI=Symbol.for("motionComponentSymbol");function rr(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function II(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 ah=e=>e.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),OI="framerAppearId",m1="data-"+ah(OI),h1=g.createContext({});function LI(e,t,n,s,i){var v,p;const{visualElement:o}=g.useContext(tc),a=g.useContext(s1),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(h1);d&&!d.projection&&i&&(d.type==="html"||d.type==="svg")&&DI(u.current,n,i,f);const m=g.useRef(!1);g.useInsertionEffect(()=>{d&&m.current&&d.update(n,l)});const b=n[m1],j=g.useRef(!!b&&!((v=window.MotionHandoffIsComplete)!=null&&v.call(window,b))&&((p=window.MotionHasOptimisedAnimation)==null?void 0:p.call(window,b)));return dj(()=>{d&&(m.current=!0,window.MotionIsMounted=!0,d.updateFeatures(),d.scheduleRenderMicrotask(),j.current&&d.animationState&&d.animationState.animateChanges())}),g.useEffect(()=>{d&&(!j.current&&d.animationState&&d.animationState.animateChanges(),j.current&&(queueMicrotask(()=>{var h;(h=window.MotionHandoffMarkAsComplete)==null||h.call(window,b)}),j.current=!1))}),d}function DI(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:p1(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 p1(e){if(e)return e.options.allowProjection!==!1?e.projection:p1(e.parent)}function nu(e,{forwardMotionProps:t=!1}={},n,s){n&&uI(n);const i=rh(e)?_I:PI;function o(l,c){let u;const d={...g.useContext(Zm),...l,layoutId:FI(l)},{isStatic:f}=d,m=pI(l),b=i(l,f);if(!f&&Pm){$I();const j=UI(d);u=j.MeasureLayout,m.visualElement=LI(e,b,d,s,j.ProjectionNode)}return r.jsxs(tc.Provider,{value:m,children:[u&&m.visualElement?r.jsx(u,{visualElement:m.visualElement,...d}):null,TI(e,l,II(b,m.visualElement,c),b,f,t)]})}o.displayName=`motion.${typeof e=="string"?e:`create(${e.displayName??e.name??""})`}`;const a=g.forwardRef(o);return a[MI]=e,a}function FI({layoutId:e}){const t=g.useContext(Am).id;return t&&e!==void 0?t+"-"+e:e}function $I(e,t){g.useContext(s1).strict}function UI(e){const{drag:t,layout:n}=kr;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}}function VI(e,t){if(typeof Proxy>"u")return nu;const n=new Map,s=(o,a)=>nu(o,a,e,t),i=(o,a)=>s(o,a);return new Proxy(i,{get:(o,a)=>a==="create"?s:(n.has(a)||n.set(a,nu(a,void 0,e,t)),n.get(a))})}function g1({top:e,left:t,right:n,bottom:s}){return{x:{min:t,max:n},y:{min:e,max:s}}}function zI({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function BI(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}}function su(e){return e===void 0||e===1}function qd({scale:e,scaleX:t,scaleY:n}){return!su(e)||!su(t)||!su(n)}function gs(e){return qd(e)||x1(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function x1(e){return Zg(e.x)||Zg(e.y)}function Zg(e){return e&&e!=="0%"}function xl(e,t,n){const s=e-n,i=t*s;return n+i}function ex(e,t,n,s,i){return i!==void 0&&(e=xl(e,i,s)),xl(e,n,s)+t}function Kd(e,t=0,n=1,s,i){e.min=ex(e.min,t,n,s,i),e.max=ex(e.max,t,n,s,i)}function y1(e,{x:t,y:n}){Kd(e.x,t.translate,t.scale,t.originPoint),Kd(e.y,n.translate,n.scale,n.originPoint)}const tx=.999999999999,nx=1.0000000000001;function WI(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&&or(e,{x:-o.scroll.offset.x,y:-o.scroll.offset.y}),a&&(t.x*=a.x.scale,t.y*=a.y.scale,y1(e,a)),s&&gs(o.latestValues)&&or(e,o.latestValues))}t.x<nx&&t.x>tx&&(t.x=1),t.y<nx&&t.y>tx&&(t.y=1)}function ir(e,t){e.min=e.min+t,e.max=e.max+t}function sx(e,t,n,s,i=.5){const o=he(e.min,e.max,i);Kd(e,t,n,o,s)}function or(e,t){sx(e.x,t.x,t.scaleX,t.scale,t.originX),sx(e.y,t.y,t.scaleY,t.scale,t.originY)}function v1(e,t){return g1(BI(e.getBoundingClientRect(),t))}function HI(e,t,n){const s=v1(e,n),{scroll:i}=t;return i&&(ir(s.x,i.offset.x),ir(s.y,i.offset.y)),s}const rx=()=>({translate:0,scale:1,origin:0,originPoint:0}),ar=()=>({x:rx(),y:rx()}),ix=()=>({min:0,max:0}),be=()=>({x:ix(),y:ix()}),Gd={current:null},b1={current:!1};function qI(){if(b1.current=!0,!!Pm)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>Gd.current=e.matches;e.addEventListener("change",t),t()}else Gd.current=!1}const KI=new WeakMap;function GI(e,t,n){for(const s in t){const i=t[s],o=n[s];if(Ve(i))e.addValue(s,i);else if(Ve(o))e.addValue(s,Er(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,Er(a!==void 0?a:i,{owner:e}))}}for(const s in n)t[s]===void 0&&e.removeValue(s);return t}const ox=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class YI{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=Gm,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 m=st.now();this.renderScheduledAt<m&&(this.renderScheduledAt=m,fe.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=i1(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:d,...f}=this.scrapeMotionValuesFromProps(n,{},this);for(const m in f){const b=f[m];c[m]!==void 0&&Ve(b)&&b.set(c[m],!1)}}mount(t){this.current=t,KI.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)),b1.current||qI(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:Gd.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=Vr.has(t);s&&this.onBindTransform&&this.onBindTransform();const i=n.on("change",l=>{this.latestValues[t]=l,this.props.onUpdate&&fe.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 kr){const n=kr[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<ox.length;s++){const i=ox[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=GI(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=Er(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"&&(fj(s)||hj(s))?s=parseFloat(s):!iI(s)&&rs.test(n)&&(s=Yj(t,n)),this.setBaseTarget(t,Ve(s)?s.get():s)),Ve(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=ih(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&&!Ve(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 Lm),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}scheduleRenderMicrotask(){Qm.render(this.render)}}class w1 extends YI{constructor(){super(...arguments),this.KeyframeResolver=KM}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;Ve(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}function j1(e,{style:t,vars:n},s,i){const o=e.style;let a;for(a in t)o[a]=t[a];i==null||i.applyProjectionStyles(o,s);for(a in n)o.setProperty(a,n[a])}function XI(e){return window.getComputedStyle(e)}class QI extends w1{constructor(){super(...arguments),this.type="html",this.renderInstance=j1}readValueFromInstance(t,n){var s;if(Vr.has(n))return(s=this.projection)!=null&&s.isProjecting?Ud(n):fM(t,n);{const i=XI(t),o=($m(n)?i.getPropertyValue(n):i[n])||0;return typeof o=="string"?o.trim():o}}measureInstanceViewportBox(t,{transformPagePoint:n}){return v1(t,n)}build(t,n,s){nh(t,n,s.transformTemplate)}scrapeMotionValuesFromProps(t,n,s){return oh(t,n,s)}}const N1=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 JI(e,t,n,s){j1(e,t,void 0,s);for(const i in t.attrs)e.setAttribute(N1.has(i)?i:ah(i),t.attrs[i])}class ZI extends w1{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=be}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(Vr.has(n)){const s=Gj(n);return s&&s.default||0}return n=N1.has(n)?n:ah(n),t.getAttribute(n)}scrapeMotionValuesFromProps(t,n,s){return f1(t,n,s)}build(t,n,s){l1(t,n,this.isSVGTag,s.transformTemplate,s.style)}renderInstance(t,n,s,i){JI(t,n,s,i)}mount(t){this.isSVGTag=u1(t.tagName),super.mount(t)}}const e5=(e,t)=>rh(e)?new ZI(t):new QI(t,{allowProjection:e!==g.Fragment});function so(e,t,n){const s=e.getProps();return ih(s,t,n!==void 0?n:s.custom,e)}const Yd=e=>Array.isArray(e);function t5(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,Er(n))}function n5(e){return Yd(e)?e[e.length-1]||0:e}function s5(e,t){const n=so(e,t);let{transitionEnd:s={},transition:i={},...o}=n||{};o={...o,...s};for(const a in o){const l=n5(o[a]);t5(e,a,l)}}function r5(e){return!!(Ve(e)&&e.add)}function Xd(e,t){const n=e.getValue("willChange");if(r5(n))return n.add(t);if(!n&&En.WillChange){const s=new En.WillChange("auto");e.addValue("willChange",s),s.add(t)}}function S1(e){return e.props[m1]}const i5=e=>e!==null;function o5(e,{repeat:t,repeatType:n="loop"},s){const i=e.filter(i5),o=t&&n!=="loop"&&t%2===1?0:i.length-1;return i[o]}const a5={type:"spring",stiffness:500,damping:25,restSpeed:10},l5=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),c5={type:"keyframes",duration:.8},u5={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},d5=(e,{keyframes:t})=>t.length>2?c5:Vr.has(e)?e.startsWith("scale")?l5(t[1]):a5:u5;function f5({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:m=>{t.set(m),l.onUpdate&&l.onUpdate(m)},onComplete:()=>{a(),l.onComplete&&l.onComplete()},name:e,motionValue:t,element:o?void 0:i};f5(l)||Object.assign(d,d5(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)),(En.instantAnimations||En.skipAnimations)&&(f=!0,d.duration=0,d.delay=0),d.allowFlatten=!l.type&&!l.ease,f&&!o&&t.get()!==void 0){const m=o5(d.keyframes,l);if(m!==void 0){fe.update(()=>{d.onUpdate(m),d.onComplete()});return}}return l.isSync?new Km(d):new OM(d)};function m5({protectedKeys:e,needsAnimating:t},n){const s=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,s}function C1(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),m=l[d];if(m===void 0||u&&m5(u,d))continue;const b={delay:n,...Ym(o||{},d)},j=f.get();if(j!==void 0&&!f.isAnimating&&!Array.isArray(m)&&m===j&&!b.velocity)continue;let v=!1;if(window.MotionHandoffAnimation){const h=S1(e);if(h){const x=window.MotionHandoffAnimation(h,d,fe);x!==null&&(b.startTime=x,v=!0)}}Xd(e,d),f.start(lh(d,f,m,e.shouldReduceMotion&&Hj.has(d)?{type:!1}:b,e,v));const p=f.animation;p&&c.push(p)}return a&&Promise.all(c).then(()=>{fe.update(()=>{a&&s5(e,a)})}),c}function Qd(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(C1(e,s,n)):()=>Promise.resolve(),a=e.variantChildren&&e.variantChildren.size?(u=0)=>{const{delayChildren:d=0,staggerChildren:f,staggerDirection:m}=i;return h5(e,t,u,d,f,m,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 h5(e,t,n=0,s=0,i=0,o=1,a){const l=[],c=e.variantChildren.size,u=(c-1)*i,d=typeof s=="function",f=d?m=>s(m,c):o===1?(m=0)=>m*i:(m=0)=>u-m*i;return Array.from(e.variantChildren).sort(p5).forEach((m,b)=>{m.notify("AnimationStart",t),l.push(Qd(m,t,{...a,delay:n+(d?0:s)+f(b)}).then(()=>m.notify("AnimationComplete",t)))}),Promise.all(l)}function p5(e,t){return e.sortNodePosition(t)}function g5(e,t,n={}){e.notify("AnimationStart",t);let s;if(Array.isArray(t)){const i=t.map(o=>Qd(e,o,n));s=Promise.all(i)}else if(typeof t=="string")s=Qd(e,t,n);else{const i=typeof t=="function"?so(e,t,n.custom):t;s=Promise.all(C1(e,i,n))}return s.then(()=>{e.notify("AnimationComplete",t)})}function E1(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 x5=th.length;function k1(e){if(!e)return;if(!e.isControllingVariants){const n=e.parent?k1(e.parent)||{}:{};return e.props.initial!==void 0&&(n.initial=e.props.initial),n}const t={};for(let n=0;n<x5;n++){const s=th[n],i=e.props[s];(to(i)||i===!1)&&(t[s]=i)}return t}const y5=[...eh].reverse(),v5=eh.length;function b5(e){return t=>Promise.all(t.map(({animation:n,options:s})=>g5(e,n,s)))}function w5(e){let t=b5(e),n=ax(),s=!0;const i=c=>(u,d)=>{var m;const f=so(e,d,c==="exit"?(m=e.presenceContext)==null?void 0:m.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=k1(e.parent)||{},f=[],m=new Set;let b={},j=1/0;for(let p=0;p<v5;p++){const h=y5[p],x=n[h],y=u[h]!==void 0?u[h]:d[h],w=to(y),S=h===c?x.isActive:null;S===!1&&(j=p);let C=y===d[h]&&y!==u[h]&&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 E=j5(x.prevProp,y);let T=E||h===c&&x.isActive&&!C&&w||p>j&&w,N=!1;const k=Array.isArray(y)?y:[y];let A=k.reduce(i(h),{});S===!1&&(A={});const{prevResolvedValues:P={}}=x,_={...P,...A},M=$=>{T=!0,m.has($)&&(N=!0,m.delete($)),x.needsAnimating[$]=!0;const R=e.getValue($);R&&(R.liveStyle=!1)};for(const $ in _){const R=A[$],I=P[$];if(b.hasOwnProperty($))continue;let D=!1;Yd(R)&&Yd(I)?D=!E1(R,I):D=R!==I,D?R!=null?M($):m.add($):R!==void 0&&m.has($)?M($):x.protectedKeys[$]=!0}x.prevProp=y,x.prevResolvedValues=A,x.isActive&&(b={...b,...A}),s&&e.blockInitialAnimation&&(T=!1),T&&(!(C&&E)||N)&&f.push(...k.map($=>({animation:$,options:{type:h}})))}if(m.size){const p={};if(typeof u.initial!="boolean"){const h=so(e,Array.isArray(u.initial)?u.initial[0]:u.initial);h&&h.transition&&(p.transition=h.transition)}m.forEach(h=>{const x=e.getBaseTarget(h),y=e.getValue(h);y&&(y.liveStyle=!0),p[h]=x??null}),f.push({animation:p})}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(m=>{var b;return(b=m.animationState)==null?void 0:b.setActive(c,u)}),n[c].isActive=u;const d=a(c);for(const m in n)n[m].protectedKeys={};return d}return{animateChanges:a,setActive:l,setAnimateFunction:o,getState:()=>n,reset:()=>{n=ax(),s=!0}}}function j5(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!E1(t,e):!1}function ms(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function ax(){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 N5 extends cs{constructor(t){super(t),t.animationState||(t.animationState=w5(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 S5=0;class C5 extends cs{constructor(){super(...arguments),this.id=S5++}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:N5},exit:{Feature:C5}};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 k5=e=>t=>Jm(t)&&e(t,No(t));function wi(e,t,n,s){return ro(e,t,k5(n),s)}const T1=1e-4,T5=1-T1,A5=1+T1,A1=.01,R5=0-A1,P5=0+A1;function He(e){return e.max-e.min}function _5(e,t,n){return Math.abs(e-t)<=n}function lx(e,t,n,s=.5){e.origin=s,e.originPoint=he(t.min,t.max,e.origin),e.scale=He(n)/He(t),e.translate=he(n.min,n.max,e.origin)-e.originPoint,(e.scale>=T5&&e.scale<=A5||isNaN(e.scale))&&(e.scale=1),(e.translate>=R5&&e.translate<=P5||isNaN(e.translate))&&(e.translate=0)}function ji(e,t,n,s){lx(e.x,t.x,n.x,s?s.originX:void 0),lx(e.y,t.y,n.y,s?s.originY:void 0)}function cx(e,t,n){e.min=n.min+t.min,e.max=e.min+He(t)}function M5(e,t,n){cx(e.x,t.x,n.x),cx(e.y,t.y,n.y)}function ux(e,t,n){e.min=t.min-n.min,e.max=e.min+He(t)}function Ni(e,t,n){ux(e.x,t.x,n.x),ux(e.y,t.y,n.y)}function wt(e){return[e("x"),e("y")]}const R1=({current:e})=>e?e.ownerDocument.defaultView:null,dx=(e,t)=>Math.abs(e-t);function I5(e,t){const n=dx(e.x,t.x),s=dx(e.y,t.y);return Math.sqrt(n**2+s**2)}class P1{constructor(t,n,{transformPagePoint:s,contextWindow:i=window,dragSnapToOrigin:o=!1,distanceThreshold:a=3}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const m=iu(this.lastMoveEventInfo,this.history),b=this.startEvent!==null,j=I5(m.offset,{x:0,y:0})>=this.distanceThreshold;if(!b&&!j)return;const{point:v}=m,{timestamp:p}=Me;this.history.push({...v,timestamp:p});const{onStart:h,onMove:x}=this.handlers;b||(h&&h(this.lastMoveEvent,m),this.startEvent=this.lastMoveEvent),x&&x(this.lastMoveEvent,m)},this.handlePointerMove=(m,b)=>{this.lastMoveEvent=m,this.lastMoveEventInfo=ru(b,this.transformPagePoint),fe.update(this.updatePoint,!0)},this.handlePointerUp=(m,b)=>{this.end();const{onEnd:j,onSessionEnd:v,resumeAnimation:p}=this.handlers;if(this.dragSnapToOrigin&&p&&p(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const h=iu(m.type==="pointercancel"?this.lastMoveEventInfo:ru(b,this.transformPagePoint),this.history);this.startEvent&&j&&j(m,h),v&&v(m,h)},!Jm(t))return;this.dragSnapToOrigin=o,this.handlers=n,this.transformPagePoint=s,this.distanceThreshold=a,this.contextWindow=i||window;const l=No(t),c=ru(l,this.transformPagePoint),{point:u}=c,{timestamp:d}=Me;this.history=[{...u,timestamp:d}];const{onSessionStart:f}=n;f&&f(t,iu(c,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 ru(e,t){return t?{point:t(e.point)}:e}function fx(e,t){return{x:e.x-t.x,y:e.y-t.y}}function iu({point:e},t){return{point:e,delta:fx(e,_1(t)),offset:fx(e,O5(t)),velocity:L5(t,.1)}}function O5(e){return e[0]}function _1(e){return e[e.length-1]}function L5(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,s=null;const i=_1(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 D5(e,{min:t,max:n},s){return t!==void 0&&e<t?e=s?he(t,e,s.min):Math.max(e,t):n!==void 0&&e>n&&(e=s?he(n,e,s.max):Math.min(e,n)),e}function mx(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 F5(e,{top:t,left:n,bottom:s,right:i}){return{x:mx(e.x,n,i),y:mx(e.y,t,s)}}function hx(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 $5(e,t){return{x:hx(e.x,t.x),y:hx(e.y,t.y)}}function U5(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 Jd=.35;function z5(e=Jd){return e===!1?e=0:e===!0&&(e=Jd),{x:px(e,"left","right"),y:px(e,"top","bottom")}}function px(e,t,n){return{min:gx(e,t),max:gx(e,n)}}function gx(e,t){return typeof e=="number"?e:e[t]||0}const B5=new WeakMap;class W5{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.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=t}start(t,{snapToCursor:n=!1,distanceThreshold:s}={}){const{presenceContext:i}=this.visualElement;if(i&&i.isPresent===!1)return;const o=f=>{const{dragSnapToOrigin:m}=this.getProps();m?this.pauseAnimation():this.stopAnimation(),n&&this.snapToCursor(No(f).point)},a=(f,m)=>{const{drag:b,dragPropagation:j,onDragStart:v}=this.getProps();if(b&&!j&&(this.openDragLock&&this.openDragLock(),this.openDragLock=QM(b),!this.openDragLock))return;this.latestPointerEvent=f,this.latestPanInfo=m,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 x=this.getAxisMotionValue(h).get()||0;if(sn.test(x)){const{projection:y}=this.visualElement;if(y&&y.layout){const w=y.layout.layoutBox[h];w&&(x=He(w)*(parseFloat(x)/100))}}this.originPoint[h]=x}),v&&fe.postRender(()=>v(f,m)),Xd(this.visualElement,"transform");const{animationState:p}=this.visualElement;p&&p.setActive("whileDrag",!0)},l=(f,m)=>{this.latestPointerEvent=f,this.latestPanInfo=m;const{dragPropagation:b,dragDirectionLock:j,onDirectionLock:v,onDrag:p}=this.getProps();if(!b&&!this.openDragLock)return;const{offset:h}=m;if(j&&this.currentDirection===null){this.currentDirection=H5(h),this.currentDirection!==null&&v&&v(this.currentDirection);return}this.updateAxis("x",m.point,h),this.updateAxis("y",m.point,h),this.visualElement.render(),p&&p(f,m)},c=(f,m)=>{this.latestPointerEvent=f,this.latestPanInfo=m,this.stop(f,m),this.latestPointerEvent=null,this.latestPanInfo=null},u=()=>wt(f=>{var m;return this.getAnimationState(f)==="paused"&&((m=this.getAxisMotionValue(f).animation)==null?void 0:m.play())}),{dragSnapToOrigin:d}=this.getProps();this.panSession=new P1(t,{onSessionStart:o,onStart:a,onMove:l,onSessionEnd:c,resumeAnimation:u},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:d,distanceThreshold:s,contextWindow:R1(this.visualElement)})}stop(t,n){const s=t||this.latestPointerEvent,i=n||this.latestPanInfo,o=this.isDragging;if(this.cancel(),!o||!i||!s)return;const{velocity:a}=i;this.startAnimation(a);const{onDragEnd:l}=this.getProps();l&&fe.postRender(()=>l(s,i))}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=D5(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=F5(s.layoutBox,t):this.constraints=!1,this.elastic=z5(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=HI(s,i.root,this.visualElement.getTransformPagePoint());let a=$5(i.layout.layoutBox,o);if(n){const l=n(zI(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 m=i?200:1e6,b=i?40:1e7,j={type:"inertia",velocity:s?t[d]:0,bounceStiffness:m,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 Xd(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]-he(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]=U5({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(he(c,u,i[a]))})}addListeners(){if(!this.visualElement.current)return;B5.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()),fe.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=Jd,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 H5(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class q5 extends cs{constructor(t){super(t),this.removeGroupControls=At,this.removeListeners=At,this.controls=new W5(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 xx=e=>(t,n)=>{e&&fe.postRender(()=>e(t,n))};class K5 extends cs{constructor(){super(...arguments),this.removePointerDownListener=At}onPointerDown(t){this.session=new P1(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:R1(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:s,onPanEnd:i}=this.node.getProps();return{onSessionStart:xx(t),onStart:xx(n),onMove:s,onEnd:(o,a)=>{delete this.session,i&&fe.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 yx(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=yx(e,t.target.x),s=yx(e,t.target.y);return`${n}% ${s}%`}},G5={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=he(l,c,.5);return typeof i[2+a]=="number"&&(i[2+a]/=u),typeof i[3+a]=="number"&&(i[3+a]/=u),o(i)}};let vx=!1;class Y5 extends g.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:s,layoutId:i}=this.props,{projection:o}=t;gI(X5),o&&(n.group&&n.group.add(o),s&&s.register&&i&&s.register(o),vx&&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,vx=!0,i||t.layoutDependency!==n||n===void 0||t.isPresent!==o?a.willUpdate():this.safeToRemove(),t.isPresent!==o&&(o?a.promote():a.relegate()||fe.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 M1(e){const[t,n]=n1(),s=g.useContext(Am);return r.jsx(Y5,{...e,layoutGroup:s,switchLayoutGroup:g.useContext(h1),isPresent:t,safeToRemove:n})}const X5={borderRadius:{...ti,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:ti,borderTopRightRadius:ti,borderBottomLeftRadius:ti,borderBottomRightRadius:ti,boxShadow:G5};function Q5(e,t,n){const s=Ve(e)?e:Er(e);return s.start(lh("",s,t,n)),s.animation}const J5=(e,t)=>e.depth-t.depth;class Z5{constructor(){this.children=[],this.isDirty=!1}add(t){_m(this.children,t),this.isDirty=!0}remove(t){Mm(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(J5),this.isDirty=!1,this.children.forEach(t)}}function eO(e,t){const n=st.now(),s=({timestamp:i})=>{const o=i-n;o>=t&&(ss(s),e(o-t))};return fe.setup(s,!0),()=>ss(s)}const I1=["TopLeft","TopRight","BottomLeft","BottomRight"],tO=I1.length,bx=e=>typeof e=="string"?parseFloat(e):e,wx=e=>typeof e=="number"||Q.test(e);function nO(e,t,n,s,i,o){i?(e.opacity=he(0,n.opacity??1,sO(s)),e.opacityExit=he(t.opacity??1,0,rO(s))):o&&(e.opacity=he(t.opacity??1,n.opacity??1,s));for(let a=0;a<tO;a++){const l=`border${I1[a]}Radius`;let c=jx(t,l),u=jx(n,l);if(c===void 0&&u===void 0)continue;c||(c=0),u||(u=0),c===0||u===0||wx(c)===wx(u)?(e[l]=Math.max(he(bx(c),bx(u),s),0),(sn.test(u)||sn.test(c))&&(e[l]+="%")):e[l]=u}(t.rotate||n.rotate)&&(e.rotate=he(t.rotate||0,n.rotate||0,s))}function jx(e,t){return e[t]!==void 0?e[t]:e.borderRadius}const sO=O1(0,.5,jj),rO=O1(.5,.95,At);function O1(e,t,n){return s=>s<e?0:s>t?1:n(Ji(e,t,s))}function Nx(e,t){e.min=t.min,e.max=t.max}function vt(e,t){Nx(e.x,t.x),Nx(e.y,t.y)}function Sx(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function Cx(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 iO(e,t=0,n=1,s=.5,i,o=e,a=e){if(sn.test(t)&&(t=parseFloat(t),t=he(a.min,a.max,t/100)-a.min),typeof t!="number")return;let l=he(o.min,o.max,s);e===o&&(l-=t),e.min=Cx(e.min,t,n,l,i),e.max=Cx(e.max,t,n,l,i)}function Ex(e,t,[n,s,i],o,a){iO(e,t[n],t[s],t[i],t.scale,o,a)}const oO=["x","scaleX","originX"],aO=["y","scaleY","originY"];function kx(e,t,n,s){Ex(e.x,t,oO,n?n.x:void 0,s?s.x:void 0),Ex(e.y,t,aO,n?n.y:void 0,s?s.y:void 0)}function Tx(e){return e.translate===0&&e.scale===1}function L1(e){return Tx(e.x)&&Tx(e.y)}function Ax(e,t){return e.min===t.min&&e.max===t.max}function lO(e,t){return Ax(e.x,t.x)&&Ax(e.y,t.y)}function Rx(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function D1(e,t){return Rx(e.x,t.x)&&Rx(e.y,t.y)}function Px(e){return He(e.x)/He(e.y)}function _x(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}class cO{constructor(){this.members=[]}add(t){_m(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 uO(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:m,skewX:b,skewY:j}=n;u&&(s=`perspective(${u}px) ${s}`),d&&(s+=`rotate(${d}deg) `),f&&(s+=`rotateX(${f}deg) `),m&&(s+=`rotateY(${m}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 ou=["","X","Y","Z"],dO=1e3;let fO=0;function au(e,t,n,s){const{latestValues:i}=t;i[e]&&(n[e]=i[e],t.setStaticValue(e,0),s&&(s[e]=0))}function F1(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=S1(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:i,layoutId:o}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",fe,!(i||o))}const{parent:s}=e;s&&!s.hasCheckedOptimisedAppear&&F1(s)}function $1({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:s,resetTransform:i}){return class{constructor(a={},l=t==null?void 0:t()){this.id=fO++,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(pO),this.nodes.forEach(vO),this.nodes.forEach(bO),this.nodes.forEach(gO)},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 Z5)}addEventListener(a,l){return this.eventHandlers.has(a)||this.eventHandlers.set(a,new Lm),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=t1(a)&&!sI(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,f=0;const m=()=>this.root.updateBlockedByResize=!1;fe.read(()=>{f=window.innerWidth}),e(a,()=>{const b=window.innerWidth;b!==f&&(f=b,this.root.updateBlockedByResize=!0,d&&d(),d=eO(m,250),Ra.hasAnimatedSinceResize&&(Ra.hasAnimatedSinceResize=!1,this.nodes.forEach(Ox)))})}l&&this.root.registerSharedNode(l,this),this.options.animate!==!1&&u&&(l||c)&&this.addEventListener("didUpdate",({delta:d,hasLayoutChanged:f,hasRelativeLayoutChanged:m,layout:b})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const j=this.options.transition||u.getDefaultTransition()||CO,{onLayoutAnimationStart:v,onLayoutAnimationComplete:p}=u.getProps(),h=!this.targetLayout||!D1(this.targetLayout,b),x=!f&&m;if(this.options.layoutRoot||this.resumeFrom||x||f&&(h||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const y={...Ym(j,"layout"),onPlay:v,onComplete:p};(u.shouldReduceMotion||this.options.layoutRoot)&&(y.delay=0,y.type=!1),this.startAnimation(y),this.setAnimationOrigin(d,x)}else f||Ox(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(wO),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&&F1(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(Mx);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(Ix);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(yO),this.nodes.forEach(mO),this.nodes.forEach(hO)):this.nodes.forEach(Ix),this.clearAllSnapshots();const l=st.now();Me.delta=Cn(0,1e3/60,l-Me.timestamp),Me.timestamp=l,Me.isProcessing=!0,Xc.update.process(Me),Xc.preRender.process(Me),Xc.render.process(Me),Me.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,Qm.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(xO),this.sharedNodes.forEach(jO)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,fe.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){fe.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&&!L1(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)),EO(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(kO))){const{scroll:d}=this.root;d&&(ir(l.x,d.offset.x),ir(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:m}=d;d!==this.root&&f&&m.layoutScroll&&(f.wasRoot&&vt(l,a),ir(l.x,f.offset.x),ir(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&&or(c,{x:-d.scroll.offset.x,y:-d.scroll.offset.y}),gs(d.latestValues)&&or(c,d.latestValues)}return gs(this.latestValues)&&or(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;qd(u.latestValues)&&u.updateSnapshot();const d=be(),f=u.measurePageBox();vt(d,f),kx(l,u.latestValues,u.snapshot?u.snapshot.layoutBox:void 0,d)}return gs(this.latestValues)&&kx(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!==Me.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(a=!1){var m;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||(m=this.parent)!=null&&m.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:d,layoutId:f}=this.options;if(!(!this.layout||!(d||f))){if(this.resolvedRelativeTargetAt=Me.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(),M5(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):vt(this.target,this.layout.layoutBox),y1(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||qd(this.parent.latestValues)||x1(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===Me.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,m=this.treeScale.y;WI(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():(Sx(this.prevProjectionDelta.x,this.projectionDelta.x),Sx(this.prevProjectionDelta.y,this.projectionDelta.y)),ji(this.projectionDelta,this.layoutCorrected,b,this.latestValues),(this.treeScale.x!==f||this.treeScale.y!==m||!_x(this.projectionDelta.x,this.prevProjectionDelta.x)||!_x(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=ar(),this.projectionDelta=ar(),this.projectionDeltaWithTransform=ar()}setAnimationOrigin(a,l=!1){const c=this.snapshot,u=c?c.latestValues:{},d={...this.latestValues},f=ar();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!l;const m=be(),b=c?c.source:void 0,j=this.layout?this.layout.source:void 0,v=b!==j,p=this.getStack(),h=!p||p.members.length<=1,x=!!(v&&!h&&this.options.crossfade===!0&&!this.path.some(SO));this.animationProgress=0;let y;this.mixTargetDelta=w=>{const S=w/1e3;Lx(f.x,a.x,S),Lx(f.y,a.y,S),this.setTargetDelta(f),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Ni(m,this.layout.layoutBox,this.relativeParent.layout.layoutBox),NO(this.relativeTarget,this.relativeTargetOrigin,m,S),y&&lO(this.relativeTarget,y)&&(this.isProjectionDirty=!1),y||(y=be()),vt(y,this.relativeTarget)),v&&(this.animationValues=d,nO(d,u,this.latestValues,S,x,h)),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=fe.update(()=>{Ra.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=Er(0)),this.currentAnimation=Q5(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(dO),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&&U1(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 m=He(this.layout.layoutBox.y);c.y.min=a.target.y.min,c.y.max=c.y.min+m}vt(l,c),or(l,d),ji(this.projectionDeltaWithTransform,this.layoutCorrected,l,d)}}registerSharedNode(a,l){this.sharedNodes.has(a)||this.sharedNodes.set(a,new cO),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&&au("z",a,u,this.animationValues);for(let d=0;d<ou.length;d++)au(`rotate${ou[d]}`,a,u,this.animationValues),au(`skew${ou[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()}applyProjectionStyles(a,l){if(!this.instance||this.isSVG)return;if(!this.isVisible){a.visibility="hidden";return}const c=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,a.visibility="",a.opacity="",a.pointerEvents=Aa(l==null?void 0:l.pointerEvents)||"",a.transform=c?c(this.latestValues,""):"none";return}const u=this.getLead();if(!this.projectionDelta||!this.layout||!u.target){this.options.layoutId&&(a.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,a.pointerEvents=Aa(l==null?void 0:l.pointerEvents)||""),this.hasProjected&&!gs(this.latestValues)&&(a.transform=c?c({},""):"none",this.hasProjected=!1);return}a.visibility="";const d=u.animationValues||u.latestValues;this.applyTransformsToTarget();let f=uO(this.projectionDeltaWithTransform,this.treeScale,d);c&&(f=c(d,f)),a.transform=f;const{x:m,y:b}=this.projectionDelta;a.transformOrigin=`${m.origin*100}% ${b.origin*100}% 0`,u.animationValues?a.opacity=u===this?d.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:d.opacityExit:a.opacity=u===this?d.opacity!==void 0?d.opacity:"":d.opacityExit!==void 0?d.opacityExit:0;for(const j in no){if(d[j]===void 0)continue;const{correct:v,applyTo:p,isCSSVariable:h}=no[j],x=f==="none"?d[j]:v(d[j],u);if(p){const y=p.length;for(let w=0;w<y;w++)a[p[w]]=x}else h?this.options.visualElement.renderState.vars[j]=x:a[j]=x}this.options.layoutId&&(a.pointerEvents=u===this?Aa(l==null?void 0:l.pointerEvents)||"":"none")}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(Mx),this.root.sharedNodes.clear()}}}function mO(e){e.updateLayout()}function hO(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 m=a?t.measuredBox[f]:t.layoutBox[f],b=He(m);m.min=s[f].min,m.max=m.min+b}):U1(o,t.layoutBox,s)&&wt(f=>{const m=a?t.measuredBox[f]:t.layoutBox[f],b=He(s[f]);m.max=m.min+b,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[f].max=e.relativeTarget[f].min+b)});const l=ar();ji(l,s,t.layoutBox);const c=ar();a?ji(c,e.applyTransform(i,!0),t.measuredBox):ji(c,s,t.layoutBox);const u=!L1(l);let d=!1;if(!e.resumeFrom){const f=e.getClosestProjectingParent();if(f&&!f.resumeFrom){const{snapshot:m,layout:b}=f;if(m&&b){const j=be();Ni(j,t.layoutBox,m.layoutBox);const v=be();Ni(v,s,b.layoutBox),D1(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 pO(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 gO(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function xO(e){e.clearSnapshot()}function Mx(e){e.clearMeasurements()}function Ix(e){e.isLayoutDirty=!1}function yO(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function Ox(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function vO(e){e.resolveTargetDelta()}function bO(e){e.calcProjection()}function wO(e){e.resetSkewAndRotation()}function jO(e){e.removeLeadSnapshot()}function Lx(e,t,n){e.translate=he(t.translate,0,n),e.scale=he(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function Dx(e,t,n,s){e.min=he(t.min,n.min,s),e.max=he(t.max,n.max,s)}function NO(e,t,n,s){Dx(e.x,t.x,n.x,s),Dx(e.y,t.y,n.y,s)}function SO(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const CO={duration:.45,ease:[.4,0,.1,1]},Fx=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),$x=Fx("applewebkit/")&&!Fx("chrome/")?Math.round:At;function Ux(e){e.min=$x(e.min),e.max=$x(e.max)}function EO(e){Ux(e.x),Ux(e.y)}function U1(e,t,n){return e==="position"||e==="preserve-aspect"&&!_5(Px(t),Px(n),.2)}function kO(e){var t;return e!==e.root&&((t=e.scroll)==null?void 0:t.wasRoot)}const TO=$1({attachResizeListener:(e,t)=>ro(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),lu={current:void 0},V1=$1({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!lu.current){const e=new TO({});e.mount(window),e.setOptions({layoutScroll:!0}),lu.current=e}return lu.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),AO={pan:{Feature:K5},drag:{Feature:q5,ProjectionNode:V1,MeasureLayout:M1}};function Vx(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&&fe.postRender(()=>o(t,No(t)))}class RO extends cs{mount(){const{current:t}=this.node;t&&(this.unmount=JM(t,(n,s)=>(Vx(this.node,s,"Start"),i=>Vx(this.node,i,"End"))))}unmount(){}}class PO 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 zx(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&&fe.postRender(()=>o(t,No(t)))}class _O extends cs{mount(){const{current:t}=this.node;t&&(this.unmount=nI(t,(n,s)=>(zx(this.node,s,"Start"),(i,{success:o})=>zx(this.node,i,o?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const Zd=new WeakMap,cu=new WeakMap,MO=e=>{const t=Zd.get(e.target);t&&t(e)},IO=e=>{e.forEach(MO)};function OO({root:e,...t}){const n=e||document;cu.has(n)||cu.set(n,{});const s=cu.get(n),i=JSON.stringify(t);return s[i]||(s[i]=new IntersectionObserver(IO,{root:e,...t})),s[i]}function LO(e,t,n){const s=OO(t);return Zd.set(e,n),s.observe(e),()=>{Zd.delete(e),s.unobserve(e)}}const DO={some:0,all:1};class FO 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:DO[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(),m=u?d:f;m&&m(c)};return LO(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($O(t,n))&&this.startObserver()}unmount(){}}function $O({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const UO={inView:{Feature:FO},tap:{Feature:_O},focus:{Feature:PO},hover:{Feature:RO}},VO={layout:{ProjectionNode:V1,MeasureLayout:M1}},zO={...E5,...UO,...AO,...VO},bt=VI(zO,e5),BO=gb("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"}}),z=g.forwardRef(({className:e,variant:t,size:n,asChild:s=!1,...i},o)=>{const a=s?qA:"button";return r.jsx(a,{className:Y(BO({variant:t,size:n,className:e})),ref:o,...i})});z.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 WO=g.forwardRef(({className:e,...t},n)=>r.jsx("div",{ref:n,className:Y("text-sm text-muted-foreground",e),...t}));WO.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 HO=g.forwardRef(({className:e,...t},n)=>r.jsx("div",{ref:n,className:Y("flex items-center p-6 pt-0",e),...t}));HO.displayName="CardFooter";const qO=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)}},Bx=({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"})]})]}),Wx=["Scanning for local Frigg repositories...","Checking installed integrations...","Pinging npm for up-to-date API modules...","Loading Frigg core plugins...","Initializing management interface..."];function Hx(){const e=uo(),{repositories:t,isLoading:n,switchRepository:s,currentRepository:i}=_t(),[o,a]=g.useState(null),[l,c]=g.useState(0),[u,d]=g.useState(!1),[f,m]=g.useState(!1),[b,j]=g.useState(!1),[v,p]=g.useState("project");g.useEffect(()=>{const w=setInterval(()=>{c(S=>S>=Wx.length-1?(setTimeout(()=>d(!0),800),S):S+1)},600);return()=>clearInterval(w)},[]);const h=async w=>{a(w),j(!1),m(!0);try{await s(w.path),setTimeout(()=>e("/dashboard"),800)}catch(S){console.error("Failed to switch repository:",S),m(!1),a(null)}},x=()=>{window.open("/api/cli/init-wizard","_blank")},y=()=>{o&&h(o)};return r.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center p-4",children:r.jsx(Yg,{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(Bx,{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:()=>p("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:()=>p("analyze"),children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(Nd,{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:()=>p("project"),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:"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(um,{className:`w-5 h-5 text-muted-foreground transition-transform ${b?"rotate-180":""}`})]})}),r.jsx(Yg,{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(z,{variant:"ghost",size:"sm",onClick:C=>{C.stopPropagation(),qO(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(z,{onClick:y,disabled:!o,size:"lg",className:"gap-2 px-8",children:[r.jsx(WT,{className:"w-5 h-5"}),"Launch Project"]}),r.jsxs(z,{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(z,{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(Nd,{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(z,{onClick:()=>p("project"),variant:"outline",children:[r.jsx(jd,{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(Bx,{className:"w-24 h-24 mx-auto text-primary"})}),r.jsx("div",{className:"space-y-2",children:Wx.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 KO=()=>{const{status:e,startFrigg:t,stopFrigg:n,restartFrigg:s,integrations:i,users:o,connections:a,getMetrics:l,getLogs:c}=_t(),{on:u}=an(),[d,f]=g.useState([]),[m,b]=g.useState(null),[j,v]=g.useState(!1),[p,h]=g.useState({stage:"dev",verbose:!1});g.useEffect(()=>{const E=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 k=setInterval(()=>{e==="running"&&typeof l=="function"&&l().then(b).catch(console.error)},5e3);return()=>{E&&E(),T&&T(),clearInterval(k)}},[u,c,l,e]);const x=async()=>{try{await t(p)}catch(E){console.error("Failed to start Frigg:",E)}},y=async(E=!1)=>{try{await n(E)}catch(T){console.error("Failed to stop Frigg:",T)}},w=async()=>{try{await s(p)}catch(E){console.error("Failed to restart Frigg:",E)}},S=[{name:"Integrations",value:i.length,icon:"🔌"},{name:"Test Users",value:o.length,icon:"👤"},{name:"Active Connections",value:a.filter(E=>E.active).length,icon:"🔗"},{name:"Total Entities",value:a.reduce((E,T)=>{var N;return E+(((N=T.entities)==null?void 0:N.length)||0)},0),icon:"📊"}],C=E=>{if(!E)return"N/A";const T=Math.floor(E/1e3),N=Math.floor(T/60),k=Math.floor(N/60);return k>0?`${k}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:p.stage,onChange:E=>h(T=>({...T,stage:E.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:p.verbose,onChange:E=>h(T=>({...T,verbose:E.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)})]}),m&&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:m.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(m.uptime)})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"Stage:"}),r.jsx("span",{className:"ml-2 font-medium",children:p.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(E=>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:E.icon}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:E.name}),r.jsx("p",{className:"text-2xl font-bold text-card-foreground",children:E.value})]})]})},E.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((E,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(E.timestamp).toLocaleTimeString()}),r.jsxs("span",{className:`mr-2 w-12 flex-shrink-0 ${E.type==="stderr"?"text-red-400":E.type==="system"?"text-blue-400":"text-green-400"}`,children:["[",E.type.toUpperCase(),"]"]}),r.jsx("span",{className:"flex-1 break-all",children:E.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(db,{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",m=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:p,uninstalling:h,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(z,{size:"sm",onClick:m,disabled:d,className:"inline-flex items-center",children:[r.jsx(fT,{size:16,className:"mr-1"}),"Install"]}),u&&!f&&r.jsxs(z,{size:"sm",variant:"outline",onClick:b,className:"inline-flex items-center",children:[r.jsx(dm,{size:16,className:"mr-1"}),"Configure"]}),d&&r.jsxs(z,{size:"sm",disabled:!0,className:"inline-flex items-center",children:[r.jsx(Ke,{size:"sm",className:"mr-1"}),"Installing..."]}),f&&r.jsxs(z,{size:"sm",variant:"destructive",onClick:m,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(z,{size:"sm",variant:"ghost",onClick:()=>window.open(e.docsUrl,"_blank"),className:"inline-flex items-center text-xs",children:[r.jsx(lb,{size:14,className:"mr-1"}),"Docs"]}),u&&r.jsx(z,{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(z,{size:"sm",variant:"destructive",onClick:j,className:"inline-flex items-center text-xs",children:"Uninstall"})})]})]})})},GO=()=>{const{integrations:e,installIntegration:t,uninstallIntegration:n}=_t(),[s,i]=g.useState(""),[o,a]=g.useState("all"),[l,c]=g.useState("grid"),[u,d]=g.useState(!1),[f,m]=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())),E=o==="all"||S.category===o;return C&&E}),[b,s,o]),p=g.useMemo(()=>b.filter(S=>S.installed),[b]),h=g.useMemo(()=>v.filter(S=>!S.installed),[v]),x=async S=>{d(!0),m(S);try{await t(S)}catch(C){console.error("Installation failed:",C)}finally{d(!1),m(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(z,{variant:l==="grid"?"default":"ghost",size:"sm",onClick:()=>c("grid"),className:"rounded-r-none",children:r.jsx(cb,{size:16})}),r.jsx(z,{variant:l==="list"?"default":"ghost",size:"sm",onClick:()=>c("list"),className:"rounded-l-none border-l",children:r.jsx(ub,{size:16})})]})]})]}),p.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 (",p.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:p.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 (",h.length,")"]}),h.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(z,{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:h.map(S=>r.jsx(yl,{integration:S,onInstall:x,installing:u&&f===S.name,className:l==="list"?"max-w-none":""},S.name))})]})]})},YO=()=>{const{refreshData:e}=_t(),{on:t,emit:n}=an(),[s,i]=g.useState(!0),[o,a]=g.useState([]),[l,c]=g.useState([]),[u,d]=g.useState([]),[f,m]=g.useState(""),[b,j]=g.useState("all"),[v,p]=g.useState("grid"),[h,x]=g.useState({}),[y,w]=g.useState(null),[S,C]=g.useState(!1);g.useEffect(()=>{E()},[]),g.useEffect(()=>{T()},[f,b]),g.useEffect(()=>{const R=t("integration:install:progress",V=>{x(K=>({...K,[V.packageName]:{status:V.status,progress:V.progress,message:V.message}}))}),I=t("integration:install:complete",V=>{x(K=>{const se={...K};return delete se[V.packageName],se}),T(),e()}),D=t("integration:install:error",V=>{x(K=>({...K,[V.packageName]:{status:"error",message:V.error}}))});return()=>{R&&R(),I&&I(),D&&D()}},[t,e]);const E=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 V=I.data.data.map(K=>K.name);D=D.map(K=>{var se;return{...K,installed:V.includes(K.name),status:((se=h[K.name])==null?void 0:se.status)||(V.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 V,K;return{...D,[R]:{status:"error",message:((K=(V=I.response)==null?void 0:V.data)==null?void 0:K.message)||"Installation failed"}}})}},k=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 V={...D};return delete V[R],V}),await T(),e()}catch(I){console.error("Uninstall failed:",I),x(D=>{var V,K;return{...D,[R]:{status:"error",message:((K=(V=I.response)==null?void 0:V.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 V,K;return{...D,[R]:{status:"error",message:((K=(V=I.response)==null?void 0:V.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)}},_=R=>{window.location.href=`/integrations/${R}/configure`},M=R=>{window.location.href=`/integrations/${R}/test`},O=g.useMemo(()=>o.map(R=>{var I,D,V,K,se,ve;return{...R,installing:((I=h[R.name])==null?void 0:I.status)==="installing",uninstalling:((D=h[R.name])==null?void 0:D.status)==="uninstalling",updating:((V=h[R.name])==null?void 0:V.status)==="updating",installError:((K=h[R.name])==null?void 0:K.status)==="error",installMessage:(se=h[R.name])==null?void 0:se.message,installProgress:(ve=h[R.name])==null?void 0:ve.progress}}),[o,h]),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(z,{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=>m(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(z,{variant:v==="grid"?"default":"ghost",size:"sm",onClick:()=>p("grid"),className:"rounded-r-none",children:r.jsx(cb,{size:16})}),r.jsx(z,{variant:v==="list"?"default":"ghost",size:"sm",onClick:()=>p("list"),className:"rounded-l-none border-l",children:r.jsx(ub,{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(wd,{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(wd,{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:()=>k(R.name),onUpdate:()=>A(R.name),onConfigure:()=>_(R.name),onTest:()=>M(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(z,{variant:"outline",onClick:()=>{m(""),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))})]})]})},XO=()=>{const{integrationName:e}=mv(),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({}),[m,b]=g.useState({}),[j,v]=g.useState(null),[p,h]=g.useState("");g.useEffect(()=>{x()},[e]);const x=async()=>{try{s(!0);const[N,k]=await Promise.all([W.get(`/api/discovery/integrations/${e}`),W.get(`/api/integrations/${e}/config`)]);u(N.data.data),f(k.data.config||{})}catch(N){console.error("Failed to fetch integration details:",N),b({general:"Failed to load integration configuration"})}finally{s(!1)}},y=(N,k)=>{f(A=>({...A,[N]:k})),b(A=>({...A,[N]:""})),h("")},w=()=>{var P,_;const N={},k=(P=c==null?void 0:c.integrationMetadata)==null?void 0:P.authType;return k==="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")):k==="api-key"?d.apiKey||(N.apiKey="API Key is required"):k==="basic"&&(d.username||(N.username="Username is required"),d.password||(N.password="Password is required")),(((_=c==null?void 0:c.integrationMetadata)==null?void 0:_.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,k;if(w())try{o(!0),h(""),await W.post(`/api/integrations/${e}/config`,{config:d}),h("Configuration saved successfully!"),setTimeout(()=>{t("/integrations")},2e3)}catch(A){console.error("Failed to save configuration:",A),b({general:((k=(N=A.response)==null?void 0:N.data)==null?void 0:k.message)||"Failed to save configuration"})}finally{o(!1)}},C=async()=>{var N,k,A,P;if(w())try{l(!0),v(null);const _=await W.post(`/api/integrations/${e}/test`,{config:d});v({success:_.data.success,message:_.data.message,details:_.data.details})}catch(_){console.error("Test failed:",_),v({success:!1,message:((k=(N=_.response)==null?void 0:N.data)==null?void 0:k.message)||"Connection test failed",details:(P=(A=_.response)==null?void 0:A.data)==null?void 0:P.details})}finally{l(!1)}},E=()=>{var k;switch((k=c==null?void 0:c.integrationMetadata)==null?void 0:k.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",m.clientId?"border-red-300":"border-gray-300"),placeholder:"Enter your OAuth2 Client ID"}),m.clientId&&r.jsx("p",{className:"mt-1 text-sm text-red-600",children:m.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",m.clientSecret?"border-red-300":"border-gray-300"),placeholder:"Enter your OAuth2 Client Secret"}),m.clientSecret&&r.jsx("p",{className:"mt-1 text-sm text-red-600",children:m.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",m.redirectUri?"border-red-300":"border-gray-300"),placeholder:"https://your-app.com/auth/callback"}),m.redirectUri&&r.jsx("p",{className:"mt-1 text-sm text-red-600",children:m.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",m.apiKey?"border-red-300":"border-gray-300"),placeholder:"Enter your API key"}),m.apiKey&&r.jsx("p",{className:"mt-1 text-sm text-red-600",children:m.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",m.username?"border-red-300":"border-gray-300"),placeholder:"Enter username"}),m.username&&r.jsx("p",{className:"mt-1 text-sm text-red-600",children:m.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",m.password?"border-red-300":"border-gray-300"),placeholder:"Enter password"}),m.password&&r.jsx("p",{className:"mt-1 text-sm text-red-600",children:m.password})]})]});default:return r.jsxs("div",{className:"text-gray-500",children:[r.jsx(jT,{size:20,className:"inline mr-2"}),"No authentication configuration required for this integration."]})}},T=()=>{var k;const N=((k=c==null?void 0:c.integrationMetadata)==null?void 0:k.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:_=>{const M=_.target.checked?[...d.scopes||[],A]:(d.scopes||[]).filter(O=>O!==A);y("scopes",M)},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)})}),m.scopes&&r.jsx("p",{className:"mt-1 text-sm text-red-600",children:m.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(z,{variant:"ghost",onClick:()=>t("/integrations"),className:"mr-4",children:[r.jsx(ib,{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"})]})]})}),m.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:m.general})]})]}),p&&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:p})]})]}),r.jsxs(B,{children:[r.jsx(fn,{children:r.jsxs(mn,{className:"flex items-center",children:[r.jsx(ST,{size:20,className:"mr-2"}),"Authentication"]})}),r.jsx(Ct,{className:"space-y-4",children:E()})]}),T()&&r.jsxs(B,{children:[r.jsx(fn,{children:r.jsxs(mn,{className:"flex items-center",children:[r.jsx(dm,{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(kT,{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(z,{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(ZT,{size:16,className:"mr-2"}),"Test Connection"]})}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(z,{variant:"outline",onClick:()=>t("/integrations"),disabled:i,children:"Cancel"}),r.jsx(z,{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(qT,{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(z,{onClick:()=>t("/integrations"),children:"Back to Integrations"})]})},QO=()=>{var M;const{integrationName:e}=mv(),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({}),[m,b]=g.useState(null),[j,v]=g.useState(!1),[p,h]=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]),E($.data.endpoints[0]))}catch(F){console.error("Failed to fetch integration data:",F)}finally{s(!1)}},E=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),E(F),b(null))},N=(O,F)=>{f($=>({...$,[O]:F}))},k=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 V,K;return[{endpoint:c.name,timestamp:new Date().toISOString(),success:!1,error:(K=(V=I.response)==null?void 0:V.data)==null?void 0:K.message},...D.slice(0,9)]})}finally{v(!1)}},A=O=>{navigator.clipboard.writeText(O),h(!0),setTimeout(()=>h(!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);`},_=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(z,{variant:"ghost",onClick:()=>t("/integrations"),className:"mr-4",children:[r.jsx(ib,{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(uT,{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&&((M=c.parameters)==null?void 0:M.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:"*"})]}),_(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(z,{size:"sm",variant:"ghost",onClick:()=>A(P()),className:"text-xs",children:p?r.jsxs(r.Fragment,{children:[r.jsx(cm,{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(z,{onClick:k,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(fb,{size:16,className:"mr-2"}),"Run Test"]})})})}),m&&r.jsxs(B,{className:m.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:m.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"]})}),m.timing&&r.jsxs("span",{className:"text-sm text-gray-500",children:[m.timing,"ms"]})]})}),r.jsxs(Ct,{children:[m.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:m.error}),m.details&&r.jsx("pre",{className:"mt-2 text-xs text-red-600 overflow-x-auto",children:JSON.stringify(m.details,null,2)})]}),m.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(z,{size:"sm",variant:"ghost",onClick:()=>A(JSON.stringify(m.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(m.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))})})]})]})]})]})},JO=({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([]),[m,b]=g.useState(!1),[j,v]=g.useState(""),[p,h]=g.useState(new Set),x=g.useRef(null),{on:y}=an(),w=g.useCallback(_=>{let M=`# Environment: ${t}
394
- `;return M+=`# Generated at: ${new Date().toISOString()}
395
-
396
- `,[..._].sort((F,$)=>F.key.localeCompare($.key)).forEach(F=>{F.description&&(M+=`# ${F.description}
397
- `);let $=F.value;F.isSecret&&!m&&($="***MASKED***"),M+=`${F.key}=${$}
398
-
399
- `}),M.trim()},[t,m]),S=g.useCallback(_=>{const M=_.split(`
400
- `),O=[];let F="";const $=[];return M.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 V=D.indexOf("=");if(V>0){const K=D.substring(0,V).trim();let se=D.substring(V+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=_=>["PASSWORD","SECRET","KEY","TOKEN","PRIVATE","CREDENTIAL"].some(O=>_.toUpperCase().includes(O));g.useEffect(()=>{l(w(e)),u(!1)},[e,w]),g.useEffect(()=>y("env-update",M=>{M.environment===t&&(c||l(w(e)))}),[y,t,c,e,w]);const E=_=>{const M=_.target.value;l(M),u(!0);const{errors:O}=S(M);f(O)},T=async()=>{const{variables:_,errors:M}=S(a);if(M.length>0){f(M);return}try{await n(_),u(!1),f([])}catch(O){f([{message:O.message}])}},N=(_,M)=>{if(M.ctrlKey||M.metaKey){const O=new Set(p);O.has(_)?O.delete(_):O.add(_),h(O)}},k=()=>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 M=a.split(`
403
- `).filter((O,F)=>p.has(F+1));navigator.clipboard.writeText(M.join(`
404
- `))},P=_=>{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`}[_];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(!m),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:m?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"})}),m?"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"})]})]}),p.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 ",p.size," Selected"]})]}),r.jsx("div",{className:"flex items-center",children:r.jsx("input",{type:"text",placeholder:"Search variables...",value:j,onChange:_=>v(_.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(M+1,O),className:`px-2 text-right text-xs text-muted-foreground leading-6 cursor-pointer hover:bg-accent hover:text-accent-foreground ${p.has(M+1)?"bg-primary/20 text-primary":""}`,children:M+1},M))}),r.jsx("textarea",{ref:x,value:j?k():a,onChange:E,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:[_.line&&`Line ${_.line}: `,_.message]},M))})]})]}),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:p=>!isNaN(p)},boolean:{name:"Boolean",validator:p=>/^(true|false|1|0)$/i.test(p)},url:{name:"URL",validator:p=>/^https?:\/\/.+/.test(p)},email:{name:"Email",validator:p=>/^.+@.+\..+$/.test(p)},port:{name:"Port",validator:p=>!isNaN(p)&&p>=1&&p<=65535},json:{name:"JSON",validator:p=>{try{return JSON.parse(p),!0}catch{return!1}}},base64:{name:"Base64",validator:p=>/^[A-Za-z0-9+/]+=*$/.test(p)}};g.useEffect(()=>{const p=localStorage.getItem(`env-schema-${n}`);p&&i(JSON.parse(p))},[n]);const f=p=>{i(p),localStorage.setItem(`env-schema-${n}`,JSON.stringify(p)),t&&t(p)},m=()=>{if(!l.key)return;const p={...s};l.required&&(p.required=[...new Set([...p.required,l.key])]),l.type&&l.type!=="string"&&(p.types[l.key]=l.type),l.pattern&&(p.patterns[l.key]=l.pattern),l.default&&(p.defaults[l.key]=l.default),l.description&&(p.descriptions[l.key]=l.description),f(p),a(!1),c({key:"",type:"string",required:!1,pattern:"",default:"",description:""})},b=p=>{const h={required:s.required.filter(x=>x!==p),types:{...s.types},patterns:{...s.patterns},defaults:{...s.defaults},descriptions:{...s.descriptions}};delete h.types[p],delete h.patterns[p],delete h.defaults[p],delete h.descriptions[p],f(h)},v=(()=>{const p={valid:!0,errors:[],warnings:[]};return s.required.forEach(h=>{const x=e.find(y=>y.key===h);(!x||!x.value)&&(p.valid=!1,p.errors.push({key:h,type:"missing",message:`Required variable ${h} is missing or empty`}))}),e.forEach(h=>{const{key:x,value:y}=h,w=s.types[x];w&&d[w]&&(d[w].validator(y)||(p.valid=!1,p.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)||(p.valid=!1,p.errors.push({key:x,type:"pattern",message:`${x} does not match required pattern`}))}catch{p.warnings.push({key:x,type:"pattern",message:`Invalid pattern for ${x}`})}!s.required.includes(x)&&!s.types[x]&&!s.patterns[x]&&!s.descriptions[x]&&p.warnings.push({key:x,type:"untracked",message:`${x} has no validation rules defined`})}),p})();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:p=>c({...l,key:p.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:p=>c({...l,type:p.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(([p,{name:h}])=>r.jsx("option",{value:p,children:h},p))})]}),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:p=>c({...l,pattern:p.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:p=>c({...l,pattern:p.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(([p,h])=>r.jsx("option",{value:h,children:p},p))]})]})]}),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:p=>c({...l,default:p.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:p=>c({...l,description:p.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:p=>c({...l,required:p.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:m,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((p,h,x)=>x.indexOf(p)===h).map(p=>{var h;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:p}),s.required.includes(p)&&r.jsx("span",{className:"ml-2 px-2 py-0.5 text-xs bg-red-100 text-red-800 rounded",children:"Required"}),s.types[p]&&r.jsx("span",{className:"ml-2 px-2 py-0.5 text-xs bg-blue-100 text-blue-800 rounded",children:((h=d[s.types[p]])==null?void 0:h.name)||s.types[p]})]}),s.descriptions[p]&&r.jsx("p",{className:"mt-1 text-sm text-gray-500",children:s.descriptions[p]}),r.jsxs("div",{className:"mt-2 space-y-1",children:[s.patterns[p]&&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[p]})]}),s.defaults[p]&&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[p]})]})]}),(()=>{const x=v.errors.find(S=>S.key===p),y=v.warnings.find(S=>S.key===p),w=e.find(S=>S.key===p);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(p),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"})})})]})},p)})}),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 p=new Blob([JSON.stringify(s,null,2)],{type:"application/json"}),h=URL.createObjectURL(p),x=document.createElement("a");x.href=h,x.download=`${n}-schema.json`,x.click(),URL.revokeObjectURL(h)},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:p=>{const h=p.target.files[0];if(h){const x=new FileReader;x.onload=y=>{try{const w=JSON.parse(y.target.result);f(w)}catch{alert("Invalid schema file")}},x.readAsText(h)}},className:"hidden"})]})]})]})},eL=({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,m]=g.useState(new Set),[b,j]=g.useState(!1);g.useEffect(()=>{v()},[]);const v=async()=>{i(!0);try{const[N,k,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:k.data.variables||[],production:A.data.variables||[]})}catch(N){console.error("Error loading environments:",N)}finally{i(!1)}},p=()=>{const N=new Set;return l.forEach(k=>{t[k].forEach(A=>{N.add(A.key)})}),Array.from(N).sort()},h=N=>{const k=l.map(A=>{const P=t[A].find(_=>_.key===N);return P?P.value:void 0});return new Set(k).size>1},x=(N,k)=>{const A=t[N].find(P=>P.key===k);return A?A.value:null},y=N=>{const k=new Set(f);k.has(N)?k.delete(N):k.add(N),m(k)},w=async()=>{if(!u||f.size===0)return;const[N,k]=u.split("->"),A=[];f.forEach(P=>{const _=t[N].find(M=>M.key===P);_&&A.push({key:_.key,value:_.value,description:_.description||""})});try{await W.put(`/api/environment/variables/${k}`,{variables:A}),e&&e({source:N,target:k,count:A.length}),await v(),m(new Set),d(null)}catch(P){console.error("Error syncing variables:",P)}},S=async(N,k)=>{try{if(!window.confirm(`Are you sure you want to copy all variables from ${N} to ${k}? This will overwrite existing values.`))return;await W.post("/api/environment/copy",{source:N,target:k,excludeSecrets:!1}),await v()}catch(A){console.error("Error copying environment:",A)}},C=()=>{const N=p(),k={timestamp:new Date().toISOString(),environments:l,variables:{}};N.forEach(M=>{k.variables[M]={},l.forEach(O=>{const F=t[O].find($=>$.key===M);k.variables[M][O]=F?{value:F.value,exists:!0}:{value:null,exists:!1}})});const A=new Blob([JSON.stringify(k,null,2)],{type:"application/json"}),P=URL.createObjectURL(A),_=document.createElement("a");_.href=P,_.download=`environment-comparison-${Date.now()}.json`,_.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 E=p(),T=b?E.filter(N=>h(N)):E;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:k=>{k.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?m(new Set(T)):m(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 k=h(N),A=l.map(_=>x(_,N)),P=A.filter(_=>_===null).length;return o==="diff"&&!k||o==="missing"&&P===0?null:r.jsxs("tr",{className:k?"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[M],F=t[_].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})},_)}),r.jsxs("td",{className:"px-6 py-4 whitespace-nowrap",children:[k&&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]}),!k&&P===0&&r.jsx("span",{className:"px-2 py-1 text-xs bg-green-100 text-green-800 rounded",children:"Synchronized"})]})]},N)})})]})})]})},tL=({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,m]=g.useState({format:"env",excludeSecrets:!1,includeDescriptions:!0}),[b,j]=g.useState(!1),[v,p]=g.useState(!1),h=g.useRef(null),x=(N,k)=>{const A=[],P=[];try{if(k==="json"){const _=typeof N=="string"?JSON.parse(N):N;if(typeof _!="object")return A.push({message:"Invalid JSON format"}),{variables:P,errors:A};Object.entries(_).forEach(([M,O])=>{if(typeof M!="string"){A.push({message:`Invalid key: ${M}`});return}P.push({key:M.toUpperCase(),value:String(O),isSecret:y(M)})})}else{const _=N.split(`
422
- `);let M="";_.forEach((O,F)=>{const $=O.trim();if(!$)return;if($.startsWith("#")){M=$.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:M,isSecret:y(I),line:F+1}),M=""}else A.push({line:F+1,message:`Invalid line format: ${$}`})})}}catch(_){A.push({message:_.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(),p(!1);const k=N.dataTransfer.files[0];k&&S(k)},S=N=>{const k=new FileReader;k.onload=A=>{const P=A.target.result;i(P);const _=N.name.endsWith(".json")?"json":"env";a(_);const{variables:M,errors:O}=x(P,_);c(M),d(O)},k.readAsText(N)},C=N=>{const k=N.target.value;if(i(k),k){const{variables:A,errors:P}=x(k,o);c(A),d(P)}else c(null),d([])},E=async()=>{var N,k;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:((k=(N=A.response)==null?void 0:N.data)==null?void 0:k.message)||A.message}])}finally{j(!1)}}},T=async()=>{try{const N=new URLSearchParams({format:f.format,excludeSecrets:f.excludeSecrets}),k=await W.get(`/api/environment/export/${e}?${N}`,{responseType:"blob"}),A=window.URL.createObjectURL(new Blob([k.data])),P=document.createElement("a");P.href=A;const _=f.format==="json"?`${e}-env.json`:e==="local"?".env":`.env.${e}`;P.setAttribute("download",_),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(),p(!0)},onDragLeave:()=>p(!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=h.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:h,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,k)=>r.jsxs("li",{children:[N.line&&`Line ${N.line}: `,N.message]},k))})]}),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,k)=>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})]},k))})]})})]}),r.jsx("button",{onClick:E,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=>m({...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=>m({...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=>m({...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=>m({...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"})]})]})]})},nL=({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,m]=g.useState([]),[b,j]=g.useState({user:"",pattern:"",permission:"read"});g.useEffect(()=>{v(),h()},[e]);const v=()=>{const N=localStorage.getItem(`security-settings-${e}`);if(N){const k=JSON.parse(N);n(k.settings||t),i(k.patterns||s),m(k.rules||[])}},p=()=>{const N={settings:t,patterns:s,rules:f};localStorage.setItem(`security-settings-${e}`,JSON.stringify(N))},h=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 k={...t,[N]:!t[N]};n(k),p()},y=N=>{const k=[...s];k[N].enabled=!k[N].enabled,i(k),p()},w=()=>{if(o&&!s.find(N=>N.pattern===o)){const N=[...s,{pattern:o.toUpperCase(),enabled:!0}];i(N),a(""),p()}},S=N=>{const k=s.filter((A,P)=>P!==N);i(k),p()},C=()=>{if(b.user&&b.pattern){const N=[...f,{...b,id:Date.now()}];m(N),j({user:"",pattern:"",permission:"read"}),p()}},E=N=>{const k=f.filter(A=>A.id!==N);m(k),p()},T=()=>{const N=[["Timestamp","User","Action","Variable","Environment","Details"].join(","),...l.map(_=>[_.timestamp,_.user,_.action,_.variable,_.environment,_.details].join(","))].join(`
430
- `),k=new Blob([N],{type:"text/csv"}),A=URL.createObjectURL(k),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),p()},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,k)=>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(k),className:"mr-3"}),r.jsx("code",{className:"text-sm font-mono text-gray-700",children:N.pattern})]}),k>=8&&r.jsx("button",{onClick:()=>S(k),className:"text-red-600 hover:text-red-800",children:"Remove"})]},k))}),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 k={...t};k.accessControl.defaultPermission=N.target.value,n(k),p()},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:()=>E(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))})]})})]})]})},sL=()=>{const{envVariables:e,updateEnvVariable:t,refreshData:n}=_t(),{on:s}=an(),[i,o]=g.useState("editor"),[a,l]=g.useState("local"),[c,u]=g.useState([]),[d,f]=g.useState(!1),[m,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}},p=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")}},h=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"})]})]})]})}),m&&r.jsx("div",{className:`mb-4 p-4 rounded-md ${m.type==="success"?"bg-green-50 text-green-800":m.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:[m.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"})}),m.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:m.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(JO,{variables:c,environment:a,onSave:v,onVariableUpdate:p,onVariableDelete:h,readOnly:a==="production"}),i==="schema"&&r.jsx(ZO,{variables:c,environment:a,onSchemaUpdate:y=>{x("Schema updated","success")}}),i==="compare"&&r.jsx(eL,{onSync:y=>{x(`Synced ${y.count} variables from ${y.source} to ${y.target}`,"success"),y.target===a&&j()}}),i==="import-export"&&r.jsx(tL,{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(nL,{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"})]})})]})},rL=({userId:e=null})=>{const{users:t,getAllSessions:n,getUserSessions:s,refreshSession:i,endSession:o}=_t(),{on:a}=an(),[l,c]=g.useState([]),[u,d]=g.useState(!0),[f,m]=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",E=>{c(T=>T.map(N=>N.id===E.sessionId?{...N,lastActivity:E.timestamp}:N))}),C=setInterval(b,3e4);return()=>{y&&y(),w&&w(),S&&S(),clearInterval(C)}},[a,e]);const j=async y=>{try{m(!0),await i(y),await b()}catch(w){console.error("Error refreshing session:",w),alert("Failed to refresh session")}finally{m(!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")}},p=y=>t.find(w=>w.id===y),h=y=>{const w=new Date,C=new Date(y)-w;if(C<0)return"Expired";const E=Math.floor(C/6e4),T=Math.floor(E/60);return T>0?`${T}h ${E%60}m`:`${E}m`},x=y=>{const w=new Date,S=new Date(y),C=w-S,E=Math.floor(C/6e4),T=Math.floor(E/60);return T>0?`${T}h ago`:E>0?`${E}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(Sd,{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=p(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(Sd,{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(qk,{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 ",h(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(ob,{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"})]})},iL=()=>{const{users:e,createUser:t,updateUser:n,deleteUser:s,bulkCreateUsers:i,deleteAllUsers:o}=_t(),[a,l]=g.useState(!1),[c,u]=g.useState(null),[d,f]=g.useState(null),[m,b]=g.useState(""),[j,v]=g.useState(""),[p,h]=g.useState(""),[x,y]=g.useState("users"),[w,S]=g.useState({email:"",firstName:"",lastName:"",role:"user",appUserId:"",appOrgId:""}),C=M=>{const{name:O,value:F}=M.target;S($=>({...$,[O]:F}))},E=async M=>{M.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=M=>{u(M),S({email:M.email,firstName:M.firstName,lastName:M.lastName,role:M.role,appUserId:M.appUserId||"",appOrgId:M.appOrgId||""}),l(!0)},N=async M=>{try{await s(M),f(null)}catch(O){console.error("Error deleting user:",O)}},k=async()=>{try{await i(10)}catch(M){console.error("Error creating bulk users:",M)}},A=async()=>{if(window.confirm("Are you sure you want to delete all users? This action cannot be undone."))try{await o()}catch(M){console.error("Error deleting all users:",M)}},P=M=>`test_user_${M.email.split("@")[0].replace(/\./g,"_")}`,_=e.filter(M=>{const O=m===""||M.email.toLowerCase().includes(m.toLowerCase())||M.firstName.toLowerCase().includes(m.toLowerCase())||M.lastName.toLowerCase().includes(m.toLowerCase())||M.appUserId&&M.appUserId.toLowerCase().includes(m.toLowerCase())||M.appOrgId&&M.appOrgId.toLowerCase().includes(m.toLowerCase()),F=j===""||M.role===j,$=p===""||M.status===p;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:E,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:k,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:m,onChange:M=>b(M.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:M=>v(M.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:p,onChange:M=>h(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"})]})]})]}),(m||j||p)&&r.jsxs("div",{className:"mt-3 flex items-center text-sm text-gray-600",children:[r.jsxs("span",{children:["Showing ",_.length," of ",e.length," users"]}),r.jsx("button",{onClick:()=>{b(""),v(""),h("")},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:_.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"})}):_.map(M=>{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=M.firstName)==null?void 0:O[0],(F=M.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:[M.firstName," ",M.lastName]}),r.jsx("div",{className:"text-sm text-gray-500",children:M.email})]})]})}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:r.jsx("code",{className:"text-sm font-mono text-gray-600",children:M.appUserId||P(M)})}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:r.jsx("code",{className:"text-sm font-mono text-gray-600",children:M.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:M.role})}),r.jsxs("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-500",children:[(($=M.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(M),className:"text-frigg-blue hover:text-blue-700 mr-3",children:"Edit"}),r.jsx("button",{onClick:()=>f(M.id),className:"text-red-600 hover:text-red-900",children:"Delete"})]})]},M.id||M.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(rL,{}),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."})})]})})]})]})},oL=({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 p=await W.post("/api/connections/oauth/init",{integration:e.name,provider:e.provider||e.name.toLowerCase()}),{authUrl:h,state:x,codeVerifier:y}=p.data;sessionStorage.setItem("oauth_state",x),y&&sessionStorage.setItem("oauth_verifier",y);const w=window.open(h,"OAuth Authorization","width=600,height=700,left=200,top=100");d(!0),m(x,w)}catch(p){a(((v=(j=p.response)==null?void 0:j.data)==null?void 0:v.error)||"Failed to initialize OAuth flow"),i(!1)}},m=async(j,v)=>{const p=setInterval(async()=>{if(v&&v.closed){clearInterval(p),d(!1),i(!1),a("Authorization window was closed");return}try{const h=await W.get(`/api/connections/oauth/status/${j}`);h.data.status==="completed"?(clearInterval(p),d(!1),i(!1),v&&!v.closed&&v.close(),sessionStorage.removeItem("oauth_state"),sessionStorage.removeItem("oauth_verifier"),t(h.data.connection)):h.data.status==="error"&&(clearInterval(p),d(!1),i(!1),a(h.data.error||"OAuth authorization failed"),v&&!v.closed&&v.close())}catch(h){console.error("Polling error:",h)}},1500);setTimeout(()=>{clearInterval(p),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(z,{onClick:f,className:"w-full",variant:"primary",children:["Authorize with ",e.displayName||e.name]}),r.jsx(z,{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."})})]})},aL=({connection:e,onTestComplete:t})=>{const[n,s]=g.useState(!1),[i,o]=g.useState(null),[a,l]=g.useState([]),c=async()=>{var m,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:p}=j.data,h=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(h),o(p),t&&t(p)}catch(j){o({success:!1,error:((b=(m=j.response)==null?void 0:m.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(z,{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(z,{onClick:c,variant:"secondary",size:"sm",children:"Run Again"}),i.success&&i.canRefreshToken&&r.jsx(z,{variant:"secondary",size:"sm",children:"Refresh Token"})]})]})]})},qx=({connectionId:e,compact:t=!1})=>{var m;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),p=Math.floor(b%3600/60);return j>0?`${j}d ${v}h`:v>0?`${v}h ${p}m`:`${p}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:((m=s.recentEvents)==null?void 0:m.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"})})]})]})},lL=({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(()=>{m()},[e]),g.useEffect(()=>{u==="graph"&&t.length>0&&b()},[t,s,u,l]);const m=async()=>{a(!0);try{const[p,h]=await Promise.all([W.get(`/api/connections/${e}/entities`),W.get(`/api/connections/${e}/relationships`)]);n(p.data.entities||[]),i(h.data.relationships||[])}catch(p){console.error("Failed to fetch entity data:",p)}finally{a(!1)}},b=()=>{const p=f.current;if(!p)return;const h=p.getContext("2d"),x=p.width=p.offsetWidth,y=p.height=p.offsetHeight;h.clearRect(0,0,x,y);const w=x/2,S=y/2,C=Math.min(x,y)*.35,E={};t.forEach((T,N)=>{const k=N/t.length*2*Math.PI;E[T.id]={x:w+C*Math.cos(k),y:S+C*Math.sin(k),entity:T}}),h.strokeStyle="#e5e7eb",h.lineWidth=1,s.forEach(T=>{const N=E[T.fromId],k=E[T.toId];if(N&&k){h.beginPath(),h.moveTo(N.x,N.y),h.lineTo(k.x,k.y),h.stroke();const A=(N.x+k.x)/2,P=(N.y+k.y)/2;h.fillStyle="#6b7280",h.font="10px sans-serif",h.textAlign="center",h.fillText(T.type,A,P)}}),Object.values(E).forEach(({x:T,y:N,entity:k})=>{const A=(l==null?void 0:l.id)===k.id;h.beginPath(),h.arc(T,N,30,0,2*Math.PI),h.fillStyle=A?"#2563eb":"#ffffff",h.fill(),h.strokeStyle=A?"#2563eb":"#d1d5db",h.lineWidth=2,h.stroke(),h.fillStyle=A?"#ffffff":"#111827",h.font="12px sans-serif",h.textAlign="center",h.textBaseline="middle",h.fillText(k.name||k.type,T,N),h.fillStyle=A?"#dbeafe":"#6b7280",h.font="10px sans-serif",h.fillText(k.type,T,N+40)})},j=p=>{const h=f.current,x=h.getBoundingClientRect(),y=p.clientX-x.left,w=p.clientY-x.top,S=h.width/2,C=h.height/2,E=Math.min(h.width,h.height)*.35;t.forEach((T,N)=>{const k=N/t.length*2*Math.PI,A=S+E*Math.cos(k),P=C+E*Math.sin(k);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 m()}catch(p){console.error("Failed to sync entities:",p)}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(z,{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(z,{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(p=>r.jsxs("div",{className:"border border-gray-200 rounded-lg p-4 hover:bg-gray-50 cursor-pointer",onClick:()=>c(p),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:p.name||p.id}),r.jsxs("p",{className:"text-sm text-gray-500",children:["Type: ",p.type," | External ID: ",p.externalId]})]}),r.jsxs("div",{className:"text-sm text-gray-500",children:[s.filter(h=>h.fromId===p.id||h.toId===p.id).length," relationships"]})]}),(l==null?void 0:l.id)===p.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(h=>h.fromId===p.id||h.toId===p.id).map((h,x)=>{var y,w;return r.jsxs("p",{className:"text-sm text-gray-600",children:[h.fromId===p.id?"Has":"Is"," ",h.type," ",h.fromId===p.id?((y=t.find(S=>S.id===h.toId))==null?void 0:y.name)||h.toId:((w=t.find(S=>S.id===h.fromId))==null?void 0:w.name)||h.fromId]},x)})})]})]},p.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"]})})]})]})},cL=({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 p=>{var h,x;p.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=(h=y.response)==null?void 0:h.data)==null?void 0:x.error)||"Failed to save configuration")}finally{l(!1)}},f=()=>{const p=prompt("Header name:");if(p){const h=prompt("Header value:");h&&o(x=>({...x,customHeaders:{...x.customHeaders,[p]:h}}))}},m=p=>{o(h=>{const{[p]:x,...y}=h.customHeaders;return{...h,customHeaders:y}})},b=()=>{o(p=>({...p,entityMappings:[...p.entityMappings,{id:Date.now(),sourceType:"",targetType:"",fieldMappings:{}}]}))},j=(p,h)=>{o(x=>({...x,entityMappings:x.entityMappings.map(y=>y.id===p?{...y,...h}:y)}))},v=p=>{o(h=>({...h,entityMappings:h.entityMappings.filter(x=>x.id!==p)}))};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:p=>o(h=>({...h,name:p.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:p=>o(h=>({...h,description:p.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:p=>o(h=>({...h,autoSync:p.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:p=>o(h=>({...h,syncInterval:p.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:p=>o(h=>({...h,webhookEnabled:p.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:p=>o(h=>({...h,webhookUrl:p.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:p=>o(h=>({...h,rateLimitOverride:p.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(z,{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(([p,h])=>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:[p,": ",h]}),r.jsx("button",{type:"button",onClick:()=>m(p),className:"text-destructive hover:text-destructive/80",children:"Remove"})]},p))}):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(z,{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(p=>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:p.sourceType,onChange:h=>j(p.id,{sourceType: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:"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:p.targetType,onChange:h=>j(p.id,{targetType: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:"e.g., User"})]})]}),r.jsx("button",{type:"button",onClick:()=>v(p.id),className:"mt-2 text-sm text-red-600 hover:text-red-800",children:"Remove Mapping"})]},p.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(z,{type:"button",onClick:s,variant:"secondary",children:"Cancel"}),r.jsx(z,{type:"submit",variant:"primary",disabled:a,children:a?"Saving...":"Save Configuration"})]})]})},uL=()=>{const{connections:e,users:t,integrations:n,refreshConnections:s}=_t(),{socket:i,emit:o,on:a}=an(),[l,c]=g.useState(null),[u,d]=g.useState("overview"),[f,m]=g.useState(!1),[b,j]=g.useState(!1),[v,p]=g.useState(null),[h,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=>{m(!1),p(null),await s(),c(A),d("config"),j(!0)},E=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},k=A=>{const P=t.find(_=>_.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(z,{onClick:()=>m(!0),variant:"primary",children:"New Connection"})]}),h&&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:h.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:h.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:h.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:h.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:k(A.userId)})]}),r.jsx(qx,{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 ",k(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(z,{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(aL,{connection:l,onTestComplete:A=>{console.log("Test completed:",A)}}),u==="health"&&r.jsx(qx,{connectionId:l.id,compact:!1}),u==="entities"&&r.jsx(lL,{connectionId:l.id}),u==="config"&&r.jsx(B,{children:r.jsx("div",{className:"p-6",children:b?r.jsx(cL,{connection:l,integration:N(l.integration),onSave:E,onCancel:()=>j(!1)}):r.jsxs("div",{children:[r.jsx("h4",{className:"text-lg font-semibold text-gray-900 mb-4",children:"Configuration"}),r.jsx(z,{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(oL,{integration:v,onSuccess:C,onCancel:()=>{m(!1),p(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:()=>p(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(z,{onClick:()=>m(!1),variant:"secondary",className:"mt-4 w-full",children:"Cancel"})]})})})]})},dL=({user:e,integration:t})=>{const{currentUser:n}=_t(),{on:s}=an(),[i,o]=g.useState(!1),[a,l]=g.useState(null),[c,u]=g.useState([]),[d,f]=g.useState("list"),[m,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)}),E=s("simulation:webhook",T=>{v("Webhook Event",T.webhookEvent)});return()=>{S&&S(),C&&C(),E&&E()}},[s]);const v=(S,C)=>{u(E=>[{id:Date.now(),type:S,data:C,timestamp:new Date().toISOString()},...E].slice(0,50))},p=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)}},h=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(m)try{S=JSON.parse(m)}catch{S={data:m}}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:h,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(XT,{size:16}),r.jsx("span",{children:"Stop Simulation"})]}):r.jsxs("button",{onClick:p,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(fb,{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:m,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(mb,{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))})]})]})},fL=()=>{const{users:e,integrations:t,currentUser:n}=_t(),[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(dL,{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 mL({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 hL({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 pL({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 gL({metrics:e}){var a,l,c,u,d,f,m,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=(p,h,x="blue")=>{if(!p||p.length===0)return null;const y=Math.max(...p.map(w=>w.value));return r.jsxs("div",{className:"mb-6",children:[r.jsx("h4",{className:"font-medium mb-3",children:h}),r.jsx("div",{className:"space-y-2",children:p.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(p=>{var h;return{label:p.functionName.split("-").pop()||p.functionName,value:((h=p.metrics)==null?void 0:h.invocations)||0}}))||[],s=((u=(c=e.lambda)==null?void 0:c.functions)==null?void 0:u.map(p=>{var h;return{label:p.functionName.split("-").pop()||p.functionName,value:((h=p.metrics)==null?void 0:h.errors)||0}}))||[],i=((f=(d=e.apiGateway)==null?void 0:d.apis)==null?void 0:f.map(p=>{var h;return{label:p.apiName.split("-").pop()||p.apiName,value:((h=p.metrics)==null?void 0:h.count)||0}}))||[],o=((b=(m=e.sqs)==null?void 0:m.queues)==null?void 0:b.map(p=>({label:p.queueName.split("-").pop()||p.queueName,value:(p.messagesAvailable||0)+(p.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(p=>p.value>0),"Lambda Function Invocations (Last Hour)","blue"),s.some(p=>p.value>0)&&t(s.filter(p=>p.value>0),"Lambda Function Errors (Last Hour)","red"),i.length>0&&t(i.filter(p=>p.value>0),"API Gateway Requests (Last Hour)","green"),o.length>0&&t(o.filter(p=>p.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(p=>{var h;return((h=p.metrics)==null?void 0:h.duration)>0}).sort((p,h)=>{var x,y;return(((x=h.metrics)==null?void 0:x.duration)||0)-(((y=p.metrics)==null?void 0:y.duration)||0)}).map((p,h)=>r.jsxs("div",{className:"border rounded p-3",children:[r.jsx("div",{className:"text-sm font-medium truncate",children:p.functionName.split("-").pop()||p.functionName}),r.jsx("div",{className:"text-2xl font-mono",children:p.metrics.duration<1e3?`${Math.round(p.metrics.duration)}ms`:`${(p.metrics.duration/1e3).toFixed(2)}s`}),r.jsxs("div",{className:"text-xs text-gray-500",children:[p.metrics.invocations," invocations"]})]},h))})]}),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,E,T;const p=((C=(S=e.lambda)==null?void 0:S.functions)==null?void 0:C.reduce((N,k)=>{var A;return N+(((A=k.metrics)==null?void 0:A.invocations)||0)},0))||0,h=((T=(E=e.lambda)==null?void 0:E.functions)==null?void 0:T.reduce((N,k)=>{var A;return N+(((A=k.metrics)==null?void 0:A.errors)||0)},0))||0,x=p>0?h/p*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 xL(){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(()=>{m()},[]),g.useEffect(()=>{if(!d||!f)return;const h=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"?h(y.data):y.topic==="monitoring:error"&&x(y.data)}),()=>{d.emit("unsubscribe",{topics:["monitoring:metrics","monitoring:error"]}),d.off("broadcast")}},[d,f]);const m=async()=>{try{const x=await(await fetch("/api/monitoring/status")).json();t(x)}catch(h){console.error("Failed to check monitoring status:",h)}},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 m(),await v()}catch(h){l(h.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 m(),s(null)}catch(h){l(h.message)}finally{o(!1)}},v=async()=>{o(!0);try{const h=await fetch("/api/monitoring/metrics/collect",{method:"POST"});if(!h.ok)throw new Error("Failed to collect metrics");const x=await h.json();x.success&&s(x.data)}catch(h){l(h.message)}finally{o(!1)}},p=()=>{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:h,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:h.totalFunctions||0})]}),h.functions&&h.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:h.functions.reduce((E,T)=>{var N;return E+(((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:h.functions.reduce((E,T)=>{var N;return E+(((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((E,T)=>{var N;return E+(((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((E,T)=>E+(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((E,T)=>E+(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(z,{variant:"secondary",onClick:v,disabled:i,children:"Refresh Now"}),r.jsx(z,{variant:"secondary",onClick:j,disabled:i,children:"Stop Monitoring"})]}):r.jsx(z,{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(z,{variant:c==="overview"?"primary":"secondary",onClick:()=>u("overview"),children:"Overview"}),r.jsx(z,{variant:c==="lambda"?"primary":"secondary",onClick:()=>u("lambda"),children:"Lambda Functions"}),r.jsx(z,{variant:c==="apigateway"?"primary":"secondary",onClick:()=>u("apigateway"),children:"API Gateway"}),r.jsx(z,{variant:c==="sqs"?"primary":"secondary",onClick:()=>u("sqs"),children:"SQS Queues"}),r.jsx(z,{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"&&p(),c==="lambda"&&r.jsx(mL,{metrics:n==null?void 0:n.lambda}),c==="apigateway"&&r.jsx(hL,{metrics:n==null?void 0:n.apiGateway}),c==="sqs"&&r.jsx(pL,{metrics:n==null?void 0:n.sqs}),c==="charts"&&r.jsx(gL,{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 yL(){return r.jsx(uj,{children:r.jsx(xL,{})})}const vL={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}};`}},bL=({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 E=Ws[C];if(E){const T={};E.variables.forEach(N=>{T[N]=""}),i(T)}},[]),m=g.useCallback((C,E)=>{i(T=>({...T,[C]:E}))},[]),b=g.useCallback(()=>{c(C=>[...C,{name:"",description:"",defaultValue:""}])},[]),j=g.useCallback((C,E,T)=>{c(N=>N.map((k,A)=>A===C?{...k,[E]:T}:k))},[]),v=g.useCallback(C=>{c(E=>E.filter((T,N)=>N!==C))},[]),p=g.useCallback((C,E)=>{let T=C;return Object.entries(E).forEach(([N,k])=>{const A=new RegExp(`{{${N}}}`,"g");T=T.replace(A,k);const P=new RegExp(`{{${N}\\.toUpperCase\\(\\)}}`,"g");T=T.replace(P,k.toUpperCase());const _=new RegExp(`{{#if ${N}}}([\\s\\S]*?){{/if}}`,"g");T=T.replace(_,k?"$1":"")}),T=T.replace(/{{[^}]+}}/g,""),T},[]),h=g.useCallback(()=>{let C,E,T;if(u)C=o,E=l.reduce((N,k)=>(N[k.name]=k.defaultValue,N),{}),T={name:"custom-template",type:"custom",files:[{name:"index.js",content:p(C,E)},{name:"README.md",content:w()}]};else{const N=Ws[t];if(!N)return;const k=p(N.template,s);T={name:t,type:"template",files:[{name:"index.js",content:k},{name:"package.json",content:x(N)},{name:"README.md",content:y(N)}]}}e(u?{customTemplate:o,customVariables:l}:s,u?C:p(Ws[t].template,s),T)},[u,o,l,t,s,p,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(E=>`- **${E}**: ${s[E]||"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(E=>{var T;return(T=s[E])==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(z,{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,E)=>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(E,"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(E,"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(E,"defaultValue",T.target.value),placeholder:"Default value",className:"px-2 py-1 border border-gray-300 rounded text-sm"}),r.jsx(z,{size:"sm",variant:"outline",onClick:()=>v(E),className:"text-red-600 hover:text-red-700",children:"Remove"})]},E))})]})]})}):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(vL).map(([C,E])=>{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:E}),r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:T.map(([N,k])=>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:k.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:k.description}),r.jsxs("div",{className:"text-xs text-gray-500",children:["Variables: ",k.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:E=>m(C,E.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(z,{onClick:h,disabled:!S(),className:"bg-purple-600 hover:bg-purple-700",children:"Generate from Template"})})]})},wL=[{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"}],z1=({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(m=>m.id===u?{...m,...d}:m);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,m,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(z,{size:"sm",variant:"outline",onClick:()=>s(u.id),children:"Edit"}),r.jsx(z,{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:wL.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:((m=u.validation)==null?void 0:m.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(z,{variant:"outline",onClick:()=>s(null),children:"Cancel"}),r.jsx(z,{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(z,{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 jL{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 ef=new jL,NL=({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),[m,b]=g.useState(!1);g.useEffect(()=>{j()},[]),g.useEffect(()=>{t&&v(t)},[t]);const j=async()=>{try{o(!0),l(null);const x=await ef.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 ef.getModuleDetails(x);f(y)}catch(y){console.error("Error loading module details:",y)}finally{b(!1)}},p=g.useCallback(x=>{e(x)},[e]),h=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(z,{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:h.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:()=>p(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))}),h.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"}),m?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"},uu={[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}]},SL=({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 ef.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(E=>E.id===w?{...E,...S}:E)}))},[]),f=g.useCallback(w=>{n(S=>({...S,apiEndpoints:S.apiEndpoints.filter(C=>C.id!==w)}))},[]),m=g.useCallback(()=>{const w=t.name.replace(/-/g,"_").replace(/(?:^|_)(\w)/g,(_,M)=>M.toUpperCase());if(t.useExistingModule&&t.selectedModule)return b();const S=uu[t.type]||[],C=[...S,...t.entitySchema,{name:"user_id",label:"User ID",type:"string",required:!0}],E=`class ${w}Entity extends Entity {
655
- static tableName = '${t.name}';
656
-
657
- static getSchema() {
658
- return {
659
- ${C.map(_=>` ${_.name}: { type: '${_.type}', required: ${_.required}${_.encrypted?", encrypted: true":""}${_.default?`, default: '${_.default}'`:""} }`).join(`,
660
- `)}
661
- };
662
- }
663
- }`,T=t.apiEndpoints.map(_=>{const M=_.name||`${_.method.toLowerCase()}${_.path.replace(/[^a-zA-Z0-9]/g,"")}`,O=_.parameters&&_.parameters.length>0;return` async ${M}(${O?"params = {}":""}) {
664
- const response = await this.${_.method.toLowerCase()}('${_.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
- }`,k=`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(_=>` ${_.name}: params.${_.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
- ${E}
744
-
745
- ${N}
746
-
747
- ${k}
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:p()}]};e(t,A,P)},[t,e]),b=()=>{var A,P;const w=t.name.replace(/-/g,"_").replace(/(?:^|_)(\w)/g,(_,M)=>M.toUpperCase()),S=t.selectedModule,C=t.moduleDetails||{},E=`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(_=>` async ${_.name||`${_.method.toLowerCase()}${_.path.replace(/[^a-zA-Z0-9]/g,"")}`}(params = {}) {
781
- const api = new ${w}Module.Api(this.entity);
782
- return api.${_.method.toLowerCase()}('${_.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(_=>`- **${_.label}**: ${_.type}${_.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(_=>` ${_.name}: 'your-${_.name}'`).join(`,
815
- `))||" // Add required parameters"}
816
- });
817
- \`\`\`
818
-
819
- ## API Methods
820
-
821
- ${t.apiEndpoints.map(_=>`- \`${_.name||"endpoint"}\`: ${_.description||"No description"}`).join(`
822
- `)||"See module documentation for available methods."}
823
- `,k={name:t.name,className:w,type:"module-wrapper",baseModule:S,files:[{name:"index.js",content:E},{name:"package.json",content:JSON.stringify(T,null,2)},{name:"README.md",content:N}]};e(t,E,k)},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,E)=>E.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=uu[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`},p=()=>{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
- });`},h=[{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:h.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(NL,{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=uu[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(z,{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(z,{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(z1,{schema:t.entitySchema,onChange:w=>l("entitySchema",w)})]})]}),r.jsx("div",{className:"flex justify-end",children:r.jsx(z,{onClick:m,disabled:!t.name||!t.baseURL&&!t.useExistingModule||t.useExistingModule&&!t.selectedModule,className:"bg-blue-600 hover:bg-blue-700",children:"Generate Integration Code"})})]})},CL=["GET","POST","PUT","DELETE","PATCH"],EL=({onGenerate:e})=>{var S,C,E,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(k=>[...k,N]),i(N.id)},[]),c=g.useCallback((N,k)=>{n(A=>A.map(P=>P.id===N?{...P,...k}:P))},[]),u=g.useCallback(N=>{n(k=>k.filter(A=>A.id!==N)),s===N&&i(null)},[s]),d=g.useCallback(N=>{var A;const k={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)||[],k]})},[t,c]),f=g.useCallback((N,k,A)=>{const P=t.find(M=>M.id===N);if(!P)return;const _=P.parameters.map(M=>M.id===k?{...M,...A}:M);c(N,{parameters:_})},[t,c]),m=g.useCallback((N,k)=>{const A=t.find(_=>_.id===N);if(!A)return;const P=A.parameters.filter(_=>_.id!==k);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');`,k=t.map(P=>{P.path.replace(/[^a-zA-Z0-9]/g,"").toLowerCase()+P.method.toLowerCase();const _=P.path.replace(/{([^}]+)}/g,":$1"),M=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()}('${_}', ${O}${M}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
- ${k}
906
-
907
- module.exports = router;`},[o,t]),j=N=>{const k=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,_=[k,A,P].filter(Boolean).flat(),M=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(k=>{N.paths[k.path]||(N.paths[k.path]={}),N.paths[k.path][k.method.toLowerCase()]={summary:k.summary,description:k.description,tags:k.tags,parameters:k.parameters.map(A=>({name:A.name,in:A.in,required:A.required,description:A.description,schema:{type:A.type}})),responses:Object.entries(k.responses).reduce((A,[P,_])=>(A[P]={description:_.description,content:{"application/json":{schema:p(_.schema)}}},A),{}),...k.security?{security:[{bearerAuth:[]}]}:{}},k.requestBody&&(N.paths[k.path][k.method.toLowerCase()].requestBody={required:!0,content:{"application/json":{schema:p(k.requestBody.schema)}}})}),JSON.stringify(N,null,2)},[o,t]),p=N=>{if(!N||N.length===0)return{type:"object"};const k={},A=[];return N.forEach(P=>{k[P.name]={type:P.type,description:P.label||P.name},P.required&&A.push(P.name),P.validation&&Object.assign(k[P.name],P.validation)}),{type:"object",properties:k,required:A}},h=g.useCallback(()=>{const N=o.name+"Service",k=t.map(A=>{const P=A.path.replace(/[^a-zA-Z0-9]/g,"").toLowerCase()+A.method.toLowerCase(),_=A.parameters.filter($=>$.in==="path").map($=>$.name),M=A.parameters.filter($=>$.in==="query").length>0,O=A.requestBody,F=[];return _.length>0&&F.push(_.join(", ")),M&&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
- ${k}
914
- }
915
-
916
- module.exports = ${N};`},[o,t]),x=g.useCallback(()=>{const N=b(),k=h(),A=v(),P={name:o.name,type:"api-endpoints",files:[{name:"router.js",content:N},{name:"service.js",content:k},{name:"openapi.json",content:A},{name:"README.md",content:y()}]};e(o,{router:N,service:k,openapi:A},P)},[o,b,h,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(k=>`- \`${k.name}\` (${k.type}${k.required?", required":""}): ${k.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(k=>({...k,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(k=>({...k,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(k=>({...k,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(k=>({...k,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(k=>({...k,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(z,{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(z,{size:"sm",variant:"outline",onClick:k=>{k.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:CL.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(z,{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:k=>f(w.id,N.id,{name:k.target.value}),placeholder:"Parameter name",className:"px-2 py-1 border border-gray-300 rounded text-sm"}),r.jsxs("select",{value:N.in,onChange:k=>f(w.id,N.id,{in:k.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:k=>f(w.id,N.id,{type:k.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:k=>f(w.id,N.id,{required:k.target.checked}),className:"mr-1"}),"Required"]}),r.jsx(z,{size:"sm",variant:"outline",onClick:()=>m(w.id,N.id),className:"text-red-600",children:"×"})]})]}),r.jsx("input",{type:"text",value:N.description,onChange:k=>f(w.id,N.id,{description:k.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(z1,{schema:((T=(E=w.responses)==null?void 0:E[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(z,{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"]}},Kx=[{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"}],du=[{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"}],kL=({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(E=>({...E,[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(E=>E!==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(M=>({[`@friggframework/api-module-${M}`]:"^1.0.0"})).reduce((M,O)=>({...M,...O}),{})},devDependencies:{nodemon:"^2.0.0",...t.features.testing?{jest:"^29.0.0",supertest:"^6.3.0"}:{}}},C=d(),E=t.template==="serverless"?f():null,T=t.features.docker?m():null,N=t.features.docker?b():null,k=j(),A=v(),P=[{name:"package.json",content:JSON.stringify(S,null,2)},{name:"app.js",content:C},{name:"README.md",content:k},{name:".env.example",content:A},...E?[{name:"serverless.yml",content:E}]:[],...T?[{name:"Dockerfile",content:T}]:[],...N?[{name:"docker-compose.yml",content:N}]:[],...t.features.ci?[{name:".github/workflows/ci.yml",content:p()}]:[]],_={name:t.name,template:t.template,type:"project-scaffold",files:P};e(t,{files:P},_)},[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`,m=()=>`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(E=>`- ${E}`).join(`
1101
- `)}
1102
-
1103
- ### Integrations
1104
-
1105
- ${t.integrations.length>0?t.integrations.map(E=>{const T=Kx.find(N=>N.id===E);return`- ${T==null?void 0:T.name} (${T==null?void 0:T.category})`}).join(`
1106
- `):"No integrations configured"}
1107
-
1108
- ### Database
1109
-
1110
- - ${(C=du.find(E=>E.value===t.database))==null?void 0:C.label}
1111
-
1112
- ### Additional Features
1113
-
1114
- ${Object.entries(t.features).filter(([,E])=>E).map(([E])=>`- ${E.charAt(0).toUpperCase()+E.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`:""}`,p=()=>`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"}`,h=()=>{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,E])=>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:E.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:E.description}),r.jsx("div",{className:"space-y-1",children:E.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:du.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:Kx.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,E])=>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:E,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=du.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(z,{variant:"outline",onClick:x,disabled:s===0,children:"Previous"}),s===o.length-1?r.jsx(z,{onClick:u,className:"bg-green-600 hover:bg-green-700",children:"Generate Project"}):r.jsx(z,{onClick:h,disabled:!y(),children:"Next"})]})]})},TL=({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(([h,x])=>({name:h.endsWith(".js")?h:`${h}.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((h,x)=>{if(a(y=>({...y,[h]:x})),n){const y=u.map(w=>w.name===h?{...w,content:x}:w);n(y)}},[u,n]),f=g.useCallback(h=>{var x;return o[h]??((x=u.find(y=>y.name===h))==null?void 0:x.content)??""},[o,u]),m=h=>{var y;switch((y=h.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=h=>{var y;switch((y=h.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=(h,x)=>x==="javascript"?h.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>'):h,v=h=>{const x=f(h),y=new Blob([x],{type:"text/plain"}),w=URL.createObjectURL(y),S=document.createElement("a");S.href=w,S.download=h,document.body.appendChild(S),S.click(),document.body.removeChild(S),URL.revokeObjectURL(w)},p=()=>{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(z,{onClick:p,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(h=>r.jsxs("div",{onClick:()=>i(h.name),className:`flex items-center justify-between p-2 rounded cursor-pointer transition-colors ${s===h.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:m(h.name)}),r.jsx("span",{className:"text-sm truncate",children:h.name})]}),r.jsx("button",{onClick:x=>{x.stopPropagation(),v(h.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"})})})]},h.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:m(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:h=>d(s,h.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((h,x)=>h+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((h,x)=>h+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((h,x)=>r.jsx("li",{children:h},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"})]})]})]})},_n={API_MODULE:"api-module",API_ENDPOINT:"api-endpoint",PROJECT_SCAFFOLD:"project-scaffold",CUSTOM:"custom"},AL=()=>{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,p,h)=>{o(p),l(h),t("preview")},[]),f=g.useCallback(v=>{o(v)},[]),m=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 p=await v.json();alert(`Code generated successfully! Files created: ${p.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,p)=>r.jsxs(We.Fragment,{children:[r.jsxs("div",{className:`flex items-center ${v.id===e?"text-blue-600":c.findIndex(h=>h.id===e)>p?"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(h=>h.id===e)>p?"border-green-600 bg-green-50":"border-gray-300 bg-gray-50"}`,children:c.findIndex(h=>h.id===e)>p?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:p+1})}),r.jsx("span",{className:"ml-2 text-sm font-medium",children:v.title})]}),p<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(_n.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(_n.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(_n.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(_n.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===_n.API_MODULE&&r.jsx(SL,{onGenerate:d}),n===_n.API_ENDPOINT&&r.jsx(EL,{onGenerate:d}),n===_n.PROJECT_SCAFFOLD&&r.jsx(kL,{onGenerate:d}),n===_n.CUSTOM&&r.jsx(bL,{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(TL,{code:i,metadata:a,onChange:f}),r.jsxs("div",{className:"flex justify-between mt-6",children:[r.jsx(z,{variant:"outline",onClick:()=>t("configure"),children:"Back to Configuration"}),r.jsx(z,{onClick:m,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()})]})},RL=()=>r.jsx("div",{className:"min-h-screen bg-gray-50",children:r.jsx("div",{className:"py-8",children:r.jsx(AL,{})})});function PL(){const{currentRepository:e,isLoading:t}=_t(),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(uj,{children:r.jsxs(oC,{children:[r.jsx(et,{path:"/welcome",element:r.jsx(Hx,{})}),r.jsx(et,{path:"/",element:r.jsx(Tp,{to:"/dashboard"})}),r.jsx(et,{path:"/dashboard",element:r.jsx(KO,{})}),r.jsx(et,{path:"/integrations",element:r.jsx(GO,{})}),r.jsx(et,{path:"/integrations/discover",element:r.jsx(YO,{})}),r.jsx(et,{path:"/integrations/:integrationName/configure",element:r.jsx(XO,{})}),r.jsx(et,{path:"/integrations/:integrationName/test",element:r.jsx(QO,{})}),r.jsx(et,{path:"/environment",element:r.jsx(sL,{})}),r.jsx(et,{path:"/users",element:r.jsx(iL,{})}),r.jsx(et,{path:"/connections",element:r.jsx(uL,{})}),r.jsx(et,{path:"/simulation",element:r.jsx(fL,{})}),r.jsx(et,{path:"/monitoring",element:r.jsx(yL,{})}),r.jsx(et,{path:"/code-generation",element:r.jsx(RL,{})})]})}):r.jsx(Hx,{})}class _L 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 ML(){return r.jsx(_L,{children:r.jsx(o_,{defaultTheme:"system",children:r.jsx(uE,{children:r.jsx(Vk,{children:r.jsx(mC,{children:r.jsx(PL,{})})})})})})}fu.createRoot(document.getElementById("root")).render(r.jsx(We.StrictMode,{children:r.jsx(ML,{})}));