nextclaw 0.21.8 → 0.21.9-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/package.json +16 -16
  2. package/ui-dist/assets/{api-B50yVdT8.js → api-C6EDHBDR.js} +1 -1
  3. package/ui-dist/assets/channels-list-page-DKj6m1Hc.js +8 -0
  4. package/ui-dist/assets/chat-page-BXngLJY6.js +105 -0
  5. package/ui-dist/assets/config-split-page-CjlmJy8X.js +1 -0
  6. package/ui-dist/assets/{confirm-dialog-DRSelLdI.js → confirm-dialog-B39X0pYp.js} +1 -1
  7. package/ui-dist/assets/desktop-update-config-DfUQ8nly.js +1 -0
  8. package/ui-dist/assets/{dist-NZRV-BxD.js → dist-BIYV2-Ia.js} +1 -1
  9. package/ui-dist/assets/{dist-D19wiQwB.js → dist-CmMro3nV.js} +1 -1
  10. package/ui-dist/assets/doc-browser-B6Wc_TIY.js +1 -0
  11. package/ui-dist/assets/doc-browser-CDtUtcim.js +1 -0
  12. package/ui-dist/assets/{doc-browser-context-C8KPbj-p.js → doc-browser-context-DZbC9zVB.js} +1 -1
  13. package/ui-dist/assets/{ellipsis-BYy8TP0A.js → ellipsis-DDpgTzgx.js} +1 -1
  14. package/ui-dist/assets/{external-link-528k6MDD.js → external-link-D2cBOCqn.js} +1 -1
  15. package/ui-dist/assets/index-DTb_XVIH.js +103 -0
  16. package/ui-dist/assets/index-ayiPYhf1.css +1 -0
  17. package/ui-dist/assets/mcp-marketplace-page-DZ9H0v05.js +1 -0
  18. package/ui-dist/assets/mcp-marketplace-page-cnVWf7QQ.js +40 -0
  19. package/ui-dist/assets/model-config-page-Bcb35AVv.js +1 -0
  20. package/ui-dist/assets/plus-CYE1onU2.js +1 -0
  21. package/ui-dist/assets/provider-scoped-model-input-kdoNp4HG.js +1 -0
  22. package/ui-dist/assets/providers-config-page-CQSibSwO.js +1 -0
  23. package/ui-dist/assets/{react-Dsotw5vM.js → react-DYQXXGbH.js} +1 -1
  24. package/ui-dist/assets/remote-BlJDbXOI.js +1 -0
  25. package/ui-dist/assets/rotate-cw-BWbvFDAX.js +1 -0
  26. package/ui-dist/assets/runtime-config-page-Tn2yLQ0c.js +1 -0
  27. package/ui-dist/assets/{save-CHDnDTok.js → save-BNVTgBVn.js} +1 -1
  28. package/ui-dist/assets/search-CKCzwLId.js +1 -0
  29. package/ui-dist/assets/search-config-page-DG5Q2hF1.js +1 -0
  30. package/ui-dist/assets/{secrets-config-page-95yaH1fa.js → secrets-config-page-BXn5Uuwp.js} +2 -2
  31. package/ui-dist/assets/select-CIRwTNP4.js +41 -0
  32. package/ui-dist/assets/{tag-chip-Cr8GwpRE.js → tag-chip-DKhVFtTE.js} +1 -1
  33. package/ui-dist/assets/{use-config-TzwzTgg0.js → use-config-DgKM9VIU.js} +1 -1
  34. package/ui-dist/assets/x-Cm3JjYut.js +1 -0
  35. package/ui-dist/index.html +14 -27
  36. package/ui-dist/assets/app-presenter-provider-BI-ewLbO.js +0 -3
  37. package/ui-dist/assets/arrow-left-BOCJyLbQ.js +0 -1
  38. package/ui-dist/assets/book-open-Bd2Xbrrc.js +0 -1
  39. package/ui-dist/assets/channels-list-page-moJkpxtU.js +0 -8
  40. package/ui-dist/assets/chat-page-CO27cl4v.js +0 -105
  41. package/ui-dist/assets/config-split-page-CsQ2rIdq.js +0 -1
  42. package/ui-dist/assets/desktop-update-config-qa-SynOc.js +0 -1
  43. package/ui-dist/assets/doc-browser-2ddUJCA0.js +0 -1
  44. package/ui-dist/assets/doc-browser-BjHUczQb.js +0 -1
  45. package/ui-dist/assets/es2015-BUIIKCNh.js +0 -41
  46. package/ui-dist/assets/host-capabilities-9bB_998Z.js +0 -1
  47. package/ui-dist/assets/index-CMNrRhnG.js +0 -101
  48. package/ui-dist/assets/index-UTmTW1eU.css +0 -1
  49. package/ui-dist/assets/key-round-D3vD9dj7.js +0 -1
  50. package/ui-dist/assets/loader-circle-DV9TSRns.js +0 -1
  51. package/ui-dist/assets/mcp-marketplace-page-CS5Lh3oA.js +0 -1
  52. package/ui-dist/assets/mcp-marketplace-page-DEOMcWb0.js +0 -40
  53. package/ui-dist/assets/model-config-page-BSc4o7pb.js +0 -1
  54. package/ui-dist/assets/notice-card-qqlbsOoR.js +0 -1
  55. package/ui-dist/assets/plus-Bf9qhPDO.js +0 -1
  56. package/ui-dist/assets/popover-BnmPOXe3.js +0 -1
  57. package/ui-dist/assets/provider-scoped-model-input-Ca56s475.js +0 -1
  58. package/ui-dist/assets/providers-config-page-D8Kf4U3u.js +0 -1
  59. package/ui-dist/assets/refresh-cw-Bmx4wc9P.js +0 -1
  60. package/ui-dist/assets/remote-DNMEy_c4.js +0 -1
  61. package/ui-dist/assets/rotate-cw-CL0sVBel.js +0 -1
  62. package/ui-dist/assets/runtime-config-page-CUFtKr0U.js +0 -1
  63. package/ui-dist/assets/search-D7L-TCH-.js +0 -1
  64. package/ui-dist/assets/search-config-page-CA3RVAef.js +0 -1
  65. package/ui-dist/assets/status-dot-Dm4h-bjn.js +0 -1
  66. package/ui-dist/assets/tabs-CJvw5Lqp.js +0 -1
  67. package/ui-dist/assets/tooltip-Bxzi6aDL.js +0 -1
  68. package/ui-dist/assets/trash-2-CSfX-BvU.js +0 -1
  69. package/ui-dist/assets/x-fkIWvi07.js +0 -1
  70. /package/ui-dist/assets/{config-hints-Cl2XAhzV.js → config-hints-CTqBnCDp.js} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nextclaw",
3
- "version": "0.21.8",
3
+ "version": "0.21.9-beta.0",
4
4
  "description": "Powerful AI assistant for coordinating agents, skills, CLI tools, automations, and messaging apps.",
5
5
  "private": false,
6
6
  "type": "module",
@@ -41,20 +41,20 @@
41
41
  "commander": "^12.1.0",
42
42
  "jszip": "^3.10.1",
43
43
  "yaml": "^2.8.1",
44
- "@nextclaw/core": "0.14.4",
45
- "@nextclaw/ncp": "0.6.3",
46
- "@nextclaw/ncp-mcp": "0.1.109",
47
- "@nextclaw/ncp-agent-runtime": "0.3.44",
48
- "@nextclaw/kernel": "0.5.0",
49
- "@nextclaw/ncp-toolkit": "0.5.38",
50
- "@nextclaw/mcp": "0.2.14",
51
- "@nextclaw/nextclaw-ncp-runtime-stdio-client": "0.2.13",
52
- "@nextclaw/nextclaw-hermes-acp-bridge": "0.2.13",
53
- "@nextclaw/nextclaw-ncp-runtime-http-client": "0.2.13",
54
- "@nextclaw/server": "0.14.4",
55
- "@nextclaw/service": "0.2.14",
56
- "@nextclaw/runtime": "0.3.14",
57
- "@nextclaw/remote": "0.2.14"
44
+ "@nextclaw/kernel": "0.5.1-beta.0",
45
+ "@nextclaw/core": "0.14.5-beta.0",
46
+ "@nextclaw/mcp": "0.2.15-beta.0",
47
+ "@nextclaw/ncp": "0.6.4-beta.0",
48
+ "@nextclaw/ncp-agent-runtime": "0.3.45-beta.0",
49
+ "@nextclaw/ncp-mcp": "0.1.110-beta.0",
50
+ "@nextclaw/ncp-toolkit": "0.5.39-beta.0",
51
+ "@nextclaw/nextclaw-ncp-runtime-http-client": "0.2.14-beta.0",
52
+ "@nextclaw/nextclaw-ncp-runtime-stdio-client": "0.2.14-beta.0",
53
+ "@nextclaw/runtime": "0.3.15-beta.0",
54
+ "@nextclaw/service": "0.2.15-beta.0",
55
+ "@nextclaw/server": "0.14.5-beta.0",
56
+ "@nextclaw/remote": "0.2.15-beta.0",
57
+ "@nextclaw/nextclaw-hermes-acp-bridge": "0.2.14-beta.0"
58
58
  },
59
59
  "devDependencies": {
60
60
  "@types/node": "^20.17.6",
@@ -62,7 +62,7 @@
62
62
  "tsx": "^4.19.2",
63
63
  "typescript": "^5.6.3",
64
64
  "vitest": "^4.1.2",
65
- "@nextclaw/ui": "0.14.0"
65
+ "@nextclaw/ui": "0.14.1-beta.0"
66
66
  },
67
67
  "scripts": {
68
68
  "dev": "tsx watch --tsconfig ../../scripts/dev/dev-runtime.tsconfig.json src/cli/app/index.ts",
@@ -1,4 +1,4 @@
1
- import{_ as e,f as t,h as n,m as r,p as i,r as a,t as o,u as s,v as c}from"./react-Dsotw5vM.js";var l=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},u={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},d=new class{#e=u;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function f(e){setTimeout(e,0)}var p=typeof window>`u`||`Deno`in globalThis;function m(){}function h(e,t){return typeof e==`function`?e(t):e}function g(e){return typeof e==`number`&&e>=0&&e!==1/0}function _(e,t){return Math.max(e+(t||0)-Date.now(),0)}function v(e,t){return typeof e==`function`?e(t):e}function y(e,t){return typeof e==`function`?e(t):e}function b(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==x(o,t.options))return!1}else if(!C(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function ee(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(S(t.options.mutationKey)!==S(a))return!1}else if(!C(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function x(e,t){return(t?.queryKeyHashFn||S)(e)}function S(e){return JSON.stringify(e,(e,t)=>D(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function C(e,t){return e===t?!0:typeof e==typeof t&&e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(t).every(n=>C(e[n],t[n])):!1}var w=Object.prototype.hasOwnProperty;function te(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=E(e)&&E(t);if(!r&&!(D(e)&&D(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:w.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=te(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function T(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function E(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function D(e){if(!ne(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!ne(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function ne(e){return Object.prototype.toString.call(e)===`[object Object]`}function re(e){return new Promise(t=>{d.setTimeout(t,e)})}function O(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:te(e,t)}function k(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function ie(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var A=Symbol();function j(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===A?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function M(e,t){return typeof e==`function`?e(...t):!!e}function ae(e,t,n){let r=!1,i;return Object.defineProperty(e,`signal`,{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var oe=new class extends l{#e;#t;#n;constructor(){super(),this.#n=e=>{if(!p&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}};function se(){let e,t,n=new Promise((n,r)=>{e=n,t=r});n.status=`pending`,n.catch(()=>{});function r(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.resolve=t=>{r({status:`fulfilled`,value:t}),e(t)},n.reject=e=>{r({status:`rejected`,reason:e}),t(e)},n}var ce=f;function le(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=ce,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var N=le(),ue=new class extends l{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(!p&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function de(e){return Math.min(1e3*2**e,3e4)}function fe(e){return(e??`online`)===`online`?ue.isOnline():!0}var pe=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function P(e){let t=!1,n=0,r,i=se(),a=()=>i.status!==`pending`,o=t=>{if(!a()){let n=new pe(t);f(n),e.onCancel?.(n)}},s=()=>{t=!0},c=()=>{t=!1},l=()=>oe.isFocused()&&(e.networkMode===`always`||ue.isOnline())&&e.canRun(),u=()=>fe(e.networkMode)&&e.canRun(),d=e=>{a()||(r?.(),i.resolve(e))},f=e=>{a()||(r?.(),i.reject(e))},m=()=>new Promise(t=>{r=e=>{(a()||l())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,a()||e.onContinue?.()}),h=()=>{if(a())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(d).catch(r=>{if(a())return;let i=e.retry??(p?0:3),o=e.retryDelay??de,s=typeof o==`function`?o(n,r):o,c=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!c){f(r);return}n++,e.onFail?.(n,r),re(s).then(()=>l()?void 0:m()).then(()=>{t?f(r):h()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r?.(),i),cancelRetry:s,continueRetry:c,canStart:u,start:()=>(u()?h():m().then(h),i)}}var me=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),g(this.gcTime)&&(this.#e=d.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(p?1/0:300*1e3))}clearGcTimeout(){this.#e&&=(d.clearTimeout(this.#e),void 0)}},he=class extends me{#e;#t;#n;#r;#i;#a;#o;constructor(e){super(),this.#o=!1,this.#a=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#r=e.client,this.#n=this.#r.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#e=ge(this.options),this.state=e.state??this.#e,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#i?.promise}setOptions(e){if(this.options={...this.#a,...e},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=ge(this.options);e.data!==void 0&&(this.setState(I(e.data,e.dataUpdatedAt)),this.#e=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#n.remove(this)}setData(e,t){let n=O(this.state.data,e,this.options);return this.#s({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e,t){this.#s({type:`setState`,state:e,setStateOptions:t})}cancel(e){let t=this.#i?.promise;return this.#i?.cancel(e),t?t.then(m).catch(m):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#e)}isActive(){return this.observers.some(e=>y(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===A||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>v(e.options.staleTime,this)===`static`):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!_(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#i?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#i?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#i&&(this.#o?this.#i.cancel({revert:!0}):this.#i.cancelRetry()),this.scheduleGc()),this.#n.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#s({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#i?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#i)return this.#i.continueRetry(),this.#i.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,`signal`,{enumerable:!0,get:()=>(this.#o=!0,n.signal)})},i=()=>{let e=j(this.options,t),n=(()=>{let e={client:this.#r,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#o=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#r,state:this.state,fetchFn:i};return r(e),e})();this.options.behavior?.onFetch(a,this),this.#t=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#s({type:`fetch`,meta:a.fetchOptions?.meta}),this.#i=P({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof pe&&e.revert&&this.setState({...this.#t,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#s({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#s({type:`pause`})},onContinue:()=>{this.#s({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await this.#i.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#n.config.onSuccess?.(e,this),this.#n.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof pe){if(e.silent)return this.#i.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#s({type:`error`,error:e}),this.#n.config.onError?.(e,this),this.#n.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#s(e){this.state=(t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...F(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...I(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#t=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}})(this.state),N.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#n.notify({query:this,type:`updated`,action:e})})}};function F(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:fe(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function I(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function ge(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var _e=class extends l{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=se(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),ye(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return be(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return be(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof y(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!T(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&xe(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||y(this.options.enabled,this.#t)!==y(t.enabled,this.#t)||v(this.options.staleTime,this.#t)!==v(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||y(this.options.enabled,this.#t)!==y(t.enabled,this.#t)||i!==this.#p)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return Se(this,n)&&(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&this.#o.status===`pending`&&this.#o.reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(m)),t}#g(){this.#b();let e=v(this.options.staleTime,this.#t);if(p||this.#r.isStale||!g(e))return;let t=_(this.#r.dataUpdatedAt,e)+1;this.#d=d.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#p=e,!(p||y(this.options.enabled,this.#t)===!1||!g(this.#p)||this.#p===0)&&(this.#f=d.setInterval(()=>{(this.options.refetchIntervalInBackground||oe.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d&&=(d.clearTimeout(this.#d),void 0)}#x(){this.#f&&=(d.clearInterval(this.#f),void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&ye(e,t),o=i&&xe(e,n,t,r);(a||o)&&(l={...l,...F(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(m=`success`,d=O(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h)if(i&&d===a?.data&&t.select===this.#c)d=this.#l;else try{this.#c=t.select,d=t.select(d),d=O(i?.data,d,t),this.#l=d,this.#s=null}catch(e){this.#s=e}this.#s&&(f=this.#s,d=this.#l,p=Date.now(),m=`error`);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,b=_&&g,ee=d!==void 0,x={status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:b,isLoading:b,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:l.dataUpdateCount>0||l.errorUpdateCount>0,isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!ee,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&ee,isStale:L(e,t),refetch:this.refetch,promise:this.#o,isEnabled:y(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=x.data!==void 0,r=x.status===`error`&&!t,i=e=>{r?e.reject(x.error):t&&e.resolve(x.data)},a=()=>{i(this.#o=x.promise=se())},o=this.#o;switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||x.data!==o.value)&&a();break;case`rejected`:(!r||x.error!==o.reason)&&a();break}}return x}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#u=this.#t),!T(t,e)&&(this.#r=t,this.#C({listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#m.size)return!0;let r=new Set(n??this.#m);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})()}))}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#C(e){N.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function ve(e,t){return y(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&t.retryOnMount===!1)}function ye(e,t){return ve(e,t)||e.state.data!==void 0&&be(e,t,t.refetchOnMount)}function be(e,t,n){if(y(t.enabled,e)!==!1&&v(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&L(e,t)}return!1}function xe(e,t,n,r){return(e!==t||y(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&L(e,n)}function L(e,t){return y(t.enabled,e)!==!1&&e.isStaleByTime(v(t.staleTime,e))}function Se(e,t){return!T(e.getCurrentResult(),t)}function R(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{ae(e,()=>t.signal,()=>n=!0)},u=j(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject();if(r==null&&e.pages.length)return Promise.resolve(e);let a=await u((()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})()),{maxPages:o}=t.options,s=i?ie:k;return{pages:s(e.pages,a,o),pageParams:s(e.pageParams,r,o)}};if(i&&a.length){let e=i===`backward`,t=e?we:Ce,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:Ce(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=l}}}function Ce(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function we(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function Te(e,t){return t?Ce(e,t)!=null:!1}function Ee(e,t){return!t||!e.getPreviousPageParam?!1:we(e,t)!=null}var De=class extends me{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||Oe(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=P({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let r=this.state.status===`pending`,i=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:i}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:i})}let a=await this.#r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#n.runNext(this)}}#i(e){this.state=(t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}})(this.state),N.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Oe(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var z=class extends l{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){let r=new De({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=ke(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=ke(e);if(typeof t==`string`){let n=this.#t.get(t);if(n)if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=ke(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}else return!0}runNext(e){let t=ke(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){N.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>ee(t,e))}findAll(e={}){return this.getAll().filter(t=>ee(e,t))}notify(e){N.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return N.batch(()=>Promise.all(e.map(e=>e.continue().catch(m))))}};function ke(e){return e.options.scope?.id}var Ae=class extends l{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),T(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&S(t.mutationKey)!==S(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??Oe();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){N.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}},je=class extends l{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??x(r,t),a=this.get(i);return a||(a=new he({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){N.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>b(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>b(e,t)):t}notify(e){N.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){N.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){N.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Me=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new je,this.#t=e.mutationCache||new z,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=oe.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=ue.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(v(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=h(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return N.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;N.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return N.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=N.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(m).catch(m)}invalidateQueries(e,t={}){return N.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=N.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(m)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(m)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(v(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(m).catch(m)}fetchInfiniteQuery(e){return e.behavior=R(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(m).catch(m)}ensureInfiniteQueryData(e){return e.behavior=R(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return ue.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(S(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{C(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(S(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{C(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=x(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===A&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},B=c(n(),1),V=i(),Ne=B.createContext(void 0),H=e=>{let t=B.useContext(Ne);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},Pe=({client:e,children:t})=>(B.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,V.jsx)(Ne.Provider,{value:e,children:t})),Fe=B.createContext(!1),Ie=()=>B.useContext(Fe);Fe.Provider;function Le(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Re=B.createContext(Le()),ze=()=>B.useContext(Re),Be=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?M(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},Ve=e=>{B.useEffect(()=>{e.clearReset()},[e])},He=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||M(n,[e.error,r])),Ue=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},We=(e,t)=>e.isLoading&&e.isFetching&&!t,Ge=(e,t)=>e?.suspense&&t.isPending,Ke=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function qe(e,t,n){let r=Ie(),i=ze(),a=H(n),o=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let s=a.getQueryCache().get(o.queryHash);o._optimisticResults=r?`isRestoring`:`optimistic`,Ue(o),Be(o,i,s),Ve(i);let c=!a.getQueryCache().get(o.queryHash),[l]=B.useState(()=>new t(a,o)),u=l.getOptimisticResult(o),d=!r&&e.subscribed!==!1;if(B.useSyncExternalStore(B.useCallback(e=>{let t=d?l.subscribe(N.batchCalls(e)):m;return l.updateResult(),t},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),B.useEffect(()=>{l.setOptions(o)},[o,l]),Ge(o,u))throw Ke(o,l,i);if(He({result:u,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw u.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(o,u),o.experimental_prefetchInRender&&!p&&We(u,r)&&(c?Ke(o,l,i):s?.promise)?.catch(m).finally(()=>{l.updateResult()}),o.notifyOnChangeProps?u:l.trackResult(u)}function Je(e,t){return qe(e,_e,t)}function Ye(e,t){let n=H(t),[r]=B.useState(()=>new Ae(n,e));B.useEffect(()=>{r.setOptions(e)},[r,e]);let i=B.useSyncExternalStore(B.useCallback(e=>r.subscribe(N.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=B.useCallback((e,t)=>{r.mutate(e,t).catch(m)},[r]);if(i.error&&M(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}var Xe=c(r(),1),Ze=e=>{switch(e){case`success`:return et;case`info`:return nt;case`warning`:return tt;case`error`:return rt;default:return null}},Qe=Array(12).fill(0),$e=({visible:e,className:t})=>B.createElement(`div`,{className:[`sonner-loading-wrapper`,t].filter(Boolean).join(` `),"data-visible":e},B.createElement(`div`,{className:`sonner-spinner`},Qe.map((e,t)=>B.createElement(`div`,{className:`sonner-loading-bar`,key:`spinner-bar-${t}`})))),et=B.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},B.createElement(`path`,{fillRule:`evenodd`,d:`M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z`,clipRule:`evenodd`})),tt=B.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`currentColor`,height:`20`,width:`20`},B.createElement(`path`,{fillRule:`evenodd`,d:`M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z`,clipRule:`evenodd`})),nt=B.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},B.createElement(`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 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z`,clipRule:`evenodd`})),rt=B.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},B.createElement(`path`,{fillRule:`evenodd`,d:`M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z`,clipRule:`evenodd`})),it=B.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`},B.createElement(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),B.createElement(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})),at=()=>{let[e,t]=B.useState(document.hidden);return B.useEffect(()=>{let e=()=>{t(document.hidden)};return document.addEventListener(`visibilitychange`,e),()=>window.removeEventListener(`visibilitychange`,e)},[]),e},ot=1,U=new class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{let{message:t,...n}=e,r=typeof e?.id==`number`||e.id?.length>0?e.id:ot++,i=this.toasts.find(e=>e.id===r),a=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(r)&&this.dismissedToasts.delete(r),i?this.toasts=this.toasts.map(n=>n.id===r?(this.publish({...n,...e,id:r,title:t}),{...n,...e,id:r,dismissible:a,title:t}):n):this.addToast({title:t,...n,dismissible:a,id:r}),r},this.dismiss=e=>(this.dismissedToasts.add(e),e||this.toasts.forEach(e=>{this.subscribers.forEach(t=>t({id:e.id,dismiss:!0}))}),this.subscribers.forEach(t=>t({id:e,dismiss:!0})),e),this.message=(e,t)=>this.create({...t,message:e}),this.error=(e,t)=>this.create({...t,message:e,type:`error`}),this.success=(e,t)=>this.create({...t,type:`success`,message:e}),this.info=(e,t)=>this.create({...t,type:`info`,message:e}),this.warning=(e,t)=>this.create({...t,type:`warning`,message:e}),this.loading=(e,t)=>this.create({...t,type:`loading`,message:e}),this.promise=(e,t)=>{if(!t)return;let n;t.loading!==void 0&&(n=this.create({...t,promise:e,type:`loading`,message:t.loading,description:typeof t.description==`function`?void 0:t.description}));let r=e instanceof Promise?e:e(),i=n!==void 0,a,o=r.then(async e=>{if(a=[`resolve`,e],B.isValidElement(e))i=!1,this.create({id:n,type:`default`,message:e});else if(ct(e)&&!e.ok){i=!1;let r=typeof t.error==`function`?await t.error(`HTTP error! status: ${e.status}`):t.error,a=typeof t.description==`function`?await t.description(`HTTP error! status: ${e.status}`):t.description;this.create({id:n,type:`error`,message:r,description:a})}else if(t.success!==void 0){i=!1;let r=typeof t.success==`function`?await t.success(e):t.success,a=typeof t.description==`function`?await t.description(e):t.description;this.create({id:n,type:`success`,message:r,description:a})}}).catch(async e=>{if(a=[`reject`,e],t.error!==void 0){i=!1;let r=typeof t.error==`function`?await t.error(e):t.error,a=typeof t.description==`function`?await t.description(e):t.description;this.create({id:n,type:`error`,message:r,description:a})}}).finally(()=>{var e;i&&(this.dismiss(n),n=void 0),(e=t.finally)==null||e.call(t)}),s=()=>new Promise((e,t)=>o.then(()=>a[0]===`reject`?t(a[1]):e(a[1])).catch(t));return typeof n!=`string`&&typeof n!=`number`?{unwrap:s}:Object.assign(n,{unwrap:s})},this.custom=(e,t)=>{let n=t?.id||ot++;return this.create({jsx:e(n),id:n,...t}),n},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},st=(e,t)=>{let n=t?.id||ot++;return U.addToast({title:e,...t,id:n}),n},ct=e=>e&&typeof e==`object`&&`ok`in e&&typeof e.ok==`boolean`&&`status`in e&&typeof e.status==`number`,W=Object.assign(st,{success:U.success,info:U.info,warning:U.warning,error:U.error,custom:U.custom,message:U.message,promise:U.promise,dismiss:U.dismiss,loading:U.loading},{getHistory:()=>U.toasts,getToasts:()=>U.getActiveToasts()});function lt(e,{insertAt:t}={}){if(!e||typeof document>`u`)return;let n=document.head||document.getElementsByTagName(`head`)[0],r=document.createElement(`style`);r.type=`text/css`,t===`top`&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}lt(`:where(html[dir="ltr"]),:where([data-sonner-toaster][dir="ltr"]){--toast-icon-margin-start: -3px;--toast-icon-margin-end: 4px;--toast-svg-margin-start: -1px;--toast-svg-margin-end: 0px;--toast-button-margin-start: auto;--toast-button-margin-end: 0;--toast-close-button-start: 0;--toast-close-button-end: unset;--toast-close-button-transform: translate(-35%, -35%)}:where(html[dir="rtl"]),:where([data-sonner-toaster][dir="rtl"]){--toast-icon-margin-start: 4px;--toast-icon-margin-end: -3px;--toast-svg-margin-start: 0px;--toast-svg-margin-end: -1px;--toast-button-margin-start: 0;--toast-button-margin-end: auto;--toast-close-button-start: unset;--toast-close-button-end: 0;--toast-close-button-transform: translate(35%, -35%)}:where([data-sonner-toaster]){position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1: hsl(0, 0%, 99%);--gray2: hsl(0, 0%, 97.3%);--gray3: hsl(0, 0%, 95.1%);--gray4: hsl(0, 0%, 93%);--gray5: hsl(0, 0%, 90.9%);--gray6: hsl(0, 0%, 88.7%);--gray7: hsl(0, 0%, 85.8%);--gray8: hsl(0, 0%, 78%);--gray9: hsl(0, 0%, 56.1%);--gray10: hsl(0, 0%, 52.3%);--gray11: hsl(0, 0%, 43.5%);--gray12: hsl(0, 0%, 9%);--border-radius: 8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:none;z-index:999999999;transition:transform .4s ease}:where([data-sonner-toaster][data-lifted="true"]){transform:translateY(-10px)}@media (hover: none) and (pointer: coarse){:where([data-sonner-toaster][data-lifted="true"]){transform:none}}:where([data-sonner-toaster][data-x-position="right"]){right:var(--offset-right)}:where([data-sonner-toaster][data-x-position="left"]){left:var(--offset-left)}:where([data-sonner-toaster][data-x-position="center"]){left:50%;transform:translate(-50%)}:where([data-sonner-toaster][data-y-position="top"]){top:var(--offset-top)}:where([data-sonner-toaster][data-y-position="bottom"]){bottom:var(--offset-bottom)}:where([data-sonner-toast]){--y: translateY(100%);--lift-amount: calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);filter:blur(0);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none;overflow-wrap:anywhere}:where([data-sonner-toast][data-styled="true"]){padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}:where([data-sonner-toast]:focus-visible){box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast][data-y-position="top"]){top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}:where([data-sonner-toast][data-y-position="bottom"]){bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}:where([data-sonner-toast]) :where([data-description]){font-weight:400;line-height:1.4;color:inherit}:where([data-sonner-toast]) :where([data-title]){font-weight:500;line-height:1.5;color:inherit}:where([data-sonner-toast]) :where([data-icon]){display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}:where([data-sonner-toast][data-promise="true"]) :where([data-icon])>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}:where([data-sonner-toast]) :where([data-icon])>*{flex-shrink:0}:where([data-sonner-toast]) :where([data-icon]) svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}:where([data-sonner-toast]) :where([data-content]){display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;cursor:pointer;outline:none;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}:where([data-sonner-toast]) :where([data-button]):focus-visible{box-shadow:0 0 0 2px #0006}:where([data-sonner-toast]) :where([data-button]):first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}:where([data-sonner-toast]) :where([data-cancel]){color:var(--normal-text);background:rgba(0,0,0,.08)}:where([data-sonner-toast][data-theme="dark"]) :where([data-cancel]){background:rgba(255,255,255,.3)}:where([data-sonner-toast]) :where([data-close-button]){position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast] [data-close-button]{background:var(--gray1)}:where([data-sonner-toast]) :where([data-close-button]):focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast]) :where([data-disabled="true"]){cursor:not-allowed}:where([data-sonner-toast]):hover :where([data-close-button]):hover{background:var(--gray2);border-color:var(--gray5)}:where([data-sonner-toast][data-swiping="true"]):before{content:"";position:absolute;left:-50%;right:-50%;height:100%;z-index:-1}:where([data-sonner-toast][data-y-position="top"][data-swiping="true"]):before{bottom:50%;transform:scaleY(3) translateY(50%)}:where([data-sonner-toast][data-y-position="bottom"][data-swiping="true"]):before{top:50%;transform:scaleY(3) translateY(-50%)}:where([data-sonner-toast][data-swiping="false"][data-removed="true"]):before{content:"";position:absolute;inset:0;transform:scaleY(2)}:where([data-sonner-toast]):after{content:"";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}:where([data-sonner-toast][data-mounted="true"]){--y: translateY(0);opacity:1}:where([data-sonner-toast][data-expanded="false"][data-front="false"]){--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}:where([data-sonner-toast])>*{transition:opacity .4s}:where([data-sonner-toast][data-expanded="false"][data-front="false"][data-styled="true"])>*{opacity:0}:where([data-sonner-toast][data-visible="false"]){opacity:0;pointer-events:none}:where([data-sonner-toast][data-mounted="true"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}:where([data-sonner-toast][data-removed="true"][data-front="true"][data-swipe-out="false"]){--y: translateY(calc(var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="false"]){--y: translateY(40%);opacity:0;transition:transform .5s,opacity .2s}:where([data-sonner-toast][data-removed="true"][data-front="false"]):before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y, 0px)) translate(var(--swipe-amount-x, 0px));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-theme=light]{--normal-bg: #fff;--normal-border: var(--gray4);--normal-text: var(--gray12);--success-bg: hsl(143, 85%, 96%);--success-border: hsl(145, 92%, 91%);--success-text: hsl(140, 100%, 27%);--info-bg: hsl(208, 100%, 97%);--info-border: hsl(221, 91%, 91%);--info-text: hsl(210, 92%, 45%);--warning-bg: hsl(49, 100%, 97%);--warning-border: hsl(49, 91%, 91%);--warning-text: hsl(31, 92%, 45%);--error-bg: hsl(359, 100%, 97%);--error-border: hsl(359, 100%, 94%);--error-text: hsl(360, 100%, 45%)}[data-sonner-toaster][data-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12)}[data-sonner-toaster][data-theme=dark]{--normal-bg: #000;--normal-bg-hover: hsl(0, 0%, 12%);--normal-border: hsl(0, 0%, 20%);--normal-border-hover: hsl(0, 0%, 25%);--normal-text: var(--gray1);--success-bg: hsl(150, 100%, 6%);--success-border: hsl(147, 100%, 12%);--success-text: hsl(150, 86%, 65%);--info-bg: hsl(215, 100%, 6%);--info-border: hsl(223, 100%, 12%);--info-text: hsl(216, 87%, 65%);--warning-bg: hsl(64, 100%, 6%);--warning-border: hsl(60, 100%, 12%);--warning-text: hsl(46, 87%, 65%);--error-bg: hsl(358, 76%, 10%);--error-border: hsl(357, 89%, 16%);--error-text: hsl(358, 100%, 81%)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success],[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info],[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning],[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error],[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size: 16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:nth-child(1){animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}
1
+ import{_ as e,f as t,h as n,m as r,p as i,r as a,t as o,u as s,v as c}from"./react-DYQXXGbH.js";var l=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},u={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},d=new class{#e=u;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function f(e){setTimeout(e,0)}var p=typeof window>`u`||`Deno`in globalThis;function m(){}function h(e,t){return typeof e==`function`?e(t):e}function g(e){return typeof e==`number`&&e>=0&&e!==1/0}function _(e,t){return Math.max(e+(t||0)-Date.now(),0)}function v(e,t){return typeof e==`function`?e(t):e}function y(e,t){return typeof e==`function`?e(t):e}function b(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==x(o,t.options))return!1}else if(!C(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function ee(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(S(t.options.mutationKey)!==S(a))return!1}else if(!C(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function x(e,t){return(t?.queryKeyHashFn||S)(e)}function S(e){return JSON.stringify(e,(e,t)=>D(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function C(e,t){return e===t?!0:typeof e==typeof t&&e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(t).every(n=>C(e[n],t[n])):!1}var w=Object.prototype.hasOwnProperty;function te(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=E(e)&&E(t);if(!r&&!(D(e)&&D(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:w.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=te(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function T(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function E(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function D(e){if(!ne(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!ne(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function ne(e){return Object.prototype.toString.call(e)===`[object Object]`}function re(e){return new Promise(t=>{d.setTimeout(t,e)})}function O(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:te(e,t)}function k(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function ie(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var A=Symbol();function j(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===A?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function M(e,t){return typeof e==`function`?e(...t):!!e}function ae(e,t,n){let r=!1,i;return Object.defineProperty(e,`signal`,{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var oe=new class extends l{#e;#t;#n;constructor(){super(),this.#n=e=>{if(!p&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}};function se(){let e,t,n=new Promise((n,r)=>{e=n,t=r});n.status=`pending`,n.catch(()=>{});function r(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.resolve=t=>{r({status:`fulfilled`,value:t}),e(t)},n.reject=e=>{r({status:`rejected`,reason:e}),t(e)},n}var ce=f;function le(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=ce,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var N=le(),ue=new class extends l{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(!p&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function de(e){return Math.min(1e3*2**e,3e4)}function fe(e){return(e??`online`)===`online`?ue.isOnline():!0}var pe=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function P(e){let t=!1,n=0,r,i=se(),a=()=>i.status!==`pending`,o=t=>{if(!a()){let n=new pe(t);f(n),e.onCancel?.(n)}},s=()=>{t=!0},c=()=>{t=!1},l=()=>oe.isFocused()&&(e.networkMode===`always`||ue.isOnline())&&e.canRun(),u=()=>fe(e.networkMode)&&e.canRun(),d=e=>{a()||(r?.(),i.resolve(e))},f=e=>{a()||(r?.(),i.reject(e))},m=()=>new Promise(t=>{r=e=>{(a()||l())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,a()||e.onContinue?.()}),h=()=>{if(a())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(d).catch(r=>{if(a())return;let i=e.retry??(p?0:3),o=e.retryDelay??de,s=typeof o==`function`?o(n,r):o,c=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!c){f(r);return}n++,e.onFail?.(n,r),re(s).then(()=>l()?void 0:m()).then(()=>{t?f(r):h()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r?.(),i),cancelRetry:s,continueRetry:c,canStart:u,start:()=>(u()?h():m().then(h),i)}}var me=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),g(this.gcTime)&&(this.#e=d.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(p?1/0:300*1e3))}clearGcTimeout(){this.#e&&=(d.clearTimeout(this.#e),void 0)}},he=class extends me{#e;#t;#n;#r;#i;#a;#o;constructor(e){super(),this.#o=!1,this.#a=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#r=e.client,this.#n=this.#r.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#e=ge(this.options),this.state=e.state??this.#e,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#i?.promise}setOptions(e){if(this.options={...this.#a,...e},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=ge(this.options);e.data!==void 0&&(this.setState(I(e.data,e.dataUpdatedAt)),this.#e=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#n.remove(this)}setData(e,t){let n=O(this.state.data,e,this.options);return this.#s({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e,t){this.#s({type:`setState`,state:e,setStateOptions:t})}cancel(e){let t=this.#i?.promise;return this.#i?.cancel(e),t?t.then(m).catch(m):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#e)}isActive(){return this.observers.some(e=>y(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===A||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>v(e.options.staleTime,this)===`static`):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!_(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#i?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#i?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#i&&(this.#o?this.#i.cancel({revert:!0}):this.#i.cancelRetry()),this.scheduleGc()),this.#n.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#s({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#i?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#i)return this.#i.continueRetry(),this.#i.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,`signal`,{enumerable:!0,get:()=>(this.#o=!0,n.signal)})},i=()=>{let e=j(this.options,t),n=(()=>{let e={client:this.#r,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#o=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#r,state:this.state,fetchFn:i};return r(e),e})();this.options.behavior?.onFetch(a,this),this.#t=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#s({type:`fetch`,meta:a.fetchOptions?.meta}),this.#i=P({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof pe&&e.revert&&this.setState({...this.#t,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#s({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#s({type:`pause`})},onContinue:()=>{this.#s({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await this.#i.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#n.config.onSuccess?.(e,this),this.#n.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof pe){if(e.silent)return this.#i.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#s({type:`error`,error:e}),this.#n.config.onError?.(e,this),this.#n.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#s(e){this.state=(t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...F(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...I(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#t=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}})(this.state),N.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#n.notify({query:this,type:`updated`,action:e})})}};function F(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:fe(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function I(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function ge(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var _e=class extends l{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=se(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),ye(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return be(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return be(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof y(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!T(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&xe(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||y(this.options.enabled,this.#t)!==y(t.enabled,this.#t)||v(this.options.staleTime,this.#t)!==v(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||y(this.options.enabled,this.#t)!==y(t.enabled,this.#t)||i!==this.#p)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return Se(this,n)&&(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&this.#o.status===`pending`&&this.#o.reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(m)),t}#g(){this.#b();let e=v(this.options.staleTime,this.#t);if(p||this.#r.isStale||!g(e))return;let t=_(this.#r.dataUpdatedAt,e)+1;this.#d=d.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#p=e,!(p||y(this.options.enabled,this.#t)===!1||!g(this.#p)||this.#p===0)&&(this.#f=d.setInterval(()=>{(this.options.refetchIntervalInBackground||oe.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d&&=(d.clearTimeout(this.#d),void 0)}#x(){this.#f&&=(d.clearInterval(this.#f),void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&ye(e,t),o=i&&xe(e,n,t,r);(a||o)&&(l={...l,...F(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(m=`success`,d=O(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h)if(i&&d===a?.data&&t.select===this.#c)d=this.#l;else try{this.#c=t.select,d=t.select(d),d=O(i?.data,d,t),this.#l=d,this.#s=null}catch(e){this.#s=e}this.#s&&(f=this.#s,d=this.#l,p=Date.now(),m=`error`);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,b=_&&g,ee=d!==void 0,x={status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:b,isLoading:b,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:l.dataUpdateCount>0||l.errorUpdateCount>0,isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!ee,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&ee,isStale:L(e,t),refetch:this.refetch,promise:this.#o,isEnabled:y(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=x.data!==void 0,r=x.status===`error`&&!t,i=e=>{r?e.reject(x.error):t&&e.resolve(x.data)},a=()=>{i(this.#o=x.promise=se())},o=this.#o;switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||x.data!==o.value)&&a();break;case`rejected`:(!r||x.error!==o.reason)&&a();break}}return x}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#u=this.#t),!T(t,e)&&(this.#r=t,this.#C({listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#m.size)return!0;let r=new Set(n??this.#m);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})()}))}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#C(e){N.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function ve(e,t){return y(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&t.retryOnMount===!1)}function ye(e,t){return ve(e,t)||e.state.data!==void 0&&be(e,t,t.refetchOnMount)}function be(e,t,n){if(y(t.enabled,e)!==!1&&v(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&L(e,t)}return!1}function xe(e,t,n,r){return(e!==t||y(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&L(e,n)}function L(e,t){return y(t.enabled,e)!==!1&&e.isStaleByTime(v(t.staleTime,e))}function Se(e,t){return!T(e.getCurrentResult(),t)}function R(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{ae(e,()=>t.signal,()=>n=!0)},u=j(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject();if(r==null&&e.pages.length)return Promise.resolve(e);let a=await u((()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})()),{maxPages:o}=t.options,s=i?ie:k;return{pages:s(e.pages,a,o),pageParams:s(e.pageParams,r,o)}};if(i&&a.length){let e=i===`backward`,t=e?we:Ce,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:Ce(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=l}}}function Ce(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function we(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function Te(e,t){return t?Ce(e,t)!=null:!1}function Ee(e,t){return!t||!e.getPreviousPageParam?!1:we(e,t)!=null}var De=class extends me{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||Oe(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=P({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let r=this.state.status===`pending`,i=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:i}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:i})}let a=await this.#r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#n.runNext(this)}}#i(e){this.state=(t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}})(this.state),N.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Oe(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var z=class extends l{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){let r=new De({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=ke(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=ke(e);if(typeof t==`string`){let n=this.#t.get(t);if(n)if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=ke(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}else return!0}runNext(e){let t=ke(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){N.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>ee(t,e))}findAll(e={}){return this.getAll().filter(t=>ee(e,t))}notify(e){N.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return N.batch(()=>Promise.all(e.map(e=>e.continue().catch(m))))}};function ke(e){return e.options.scope?.id}var Ae=class extends l{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),T(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&S(t.mutationKey)!==S(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??Oe();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){N.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}},je=class extends l{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??x(r,t),a=this.get(i);return a||(a=new he({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){N.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>b(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>b(e,t)):t}notify(e){N.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){N.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){N.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Me=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new je,this.#t=e.mutationCache||new z,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=oe.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=ue.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(v(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=h(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return N.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;N.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return N.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=N.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(m).catch(m)}invalidateQueries(e,t={}){return N.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=N.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(m)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(m)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(v(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(m).catch(m)}fetchInfiniteQuery(e){return e.behavior=R(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(m).catch(m)}ensureInfiniteQueryData(e){return e.behavior=R(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return ue.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(S(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{C(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(S(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{C(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=x(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===A&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},B=c(n(),1),V=i(),Ne=B.createContext(void 0),H=e=>{let t=B.useContext(Ne);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},Pe=({client:e,children:t})=>(B.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,V.jsx)(Ne.Provider,{value:e,children:t})),Fe=B.createContext(!1),Ie=()=>B.useContext(Fe);Fe.Provider;function Le(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Re=B.createContext(Le()),ze=()=>B.useContext(Re),Be=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?M(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},Ve=e=>{B.useEffect(()=>{e.clearReset()},[e])},He=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||M(n,[e.error,r])),Ue=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},We=(e,t)=>e.isLoading&&e.isFetching&&!t,Ge=(e,t)=>e?.suspense&&t.isPending,Ke=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function qe(e,t,n){let r=Ie(),i=ze(),a=H(n),o=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let s=a.getQueryCache().get(o.queryHash);o._optimisticResults=r?`isRestoring`:`optimistic`,Ue(o),Be(o,i,s),Ve(i);let c=!a.getQueryCache().get(o.queryHash),[l]=B.useState(()=>new t(a,o)),u=l.getOptimisticResult(o),d=!r&&e.subscribed!==!1;if(B.useSyncExternalStore(B.useCallback(e=>{let t=d?l.subscribe(N.batchCalls(e)):m;return l.updateResult(),t},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),B.useEffect(()=>{l.setOptions(o)},[o,l]),Ge(o,u))throw Ke(o,l,i);if(He({result:u,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw u.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(o,u),o.experimental_prefetchInRender&&!p&&We(u,r)&&(c?Ke(o,l,i):s?.promise)?.catch(m).finally(()=>{l.updateResult()}),o.notifyOnChangeProps?u:l.trackResult(u)}function Je(e,t){return qe(e,_e,t)}function Ye(e,t){let n=H(t),[r]=B.useState(()=>new Ae(n,e));B.useEffect(()=>{r.setOptions(e)},[r,e]);let i=B.useSyncExternalStore(B.useCallback(e=>r.subscribe(N.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=B.useCallback((e,t)=>{r.mutate(e,t).catch(m)},[r]);if(i.error&&M(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}var Xe=c(r(),1),Ze=e=>{switch(e){case`success`:return et;case`info`:return nt;case`warning`:return tt;case`error`:return rt;default:return null}},Qe=Array(12).fill(0),$e=({visible:e,className:t})=>B.createElement(`div`,{className:[`sonner-loading-wrapper`,t].filter(Boolean).join(` `),"data-visible":e},B.createElement(`div`,{className:`sonner-spinner`},Qe.map((e,t)=>B.createElement(`div`,{className:`sonner-loading-bar`,key:`spinner-bar-${t}`})))),et=B.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},B.createElement(`path`,{fillRule:`evenodd`,d:`M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z`,clipRule:`evenodd`})),tt=B.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`currentColor`,height:`20`,width:`20`},B.createElement(`path`,{fillRule:`evenodd`,d:`M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z`,clipRule:`evenodd`})),nt=B.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},B.createElement(`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 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z`,clipRule:`evenodd`})),rt=B.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},B.createElement(`path`,{fillRule:`evenodd`,d:`M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z`,clipRule:`evenodd`})),it=B.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`},B.createElement(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),B.createElement(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})),at=()=>{let[e,t]=B.useState(document.hidden);return B.useEffect(()=>{let e=()=>{t(document.hidden)};return document.addEventListener(`visibilitychange`,e),()=>window.removeEventListener(`visibilitychange`,e)},[]),e},ot=1,U=new class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{let{message:t,...n}=e,r=typeof e?.id==`number`||e.id?.length>0?e.id:ot++,i=this.toasts.find(e=>e.id===r),a=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(r)&&this.dismissedToasts.delete(r),i?this.toasts=this.toasts.map(n=>n.id===r?(this.publish({...n,...e,id:r,title:t}),{...n,...e,id:r,dismissible:a,title:t}):n):this.addToast({title:t,...n,dismissible:a,id:r}),r},this.dismiss=e=>(this.dismissedToasts.add(e),e||this.toasts.forEach(e=>{this.subscribers.forEach(t=>t({id:e.id,dismiss:!0}))}),this.subscribers.forEach(t=>t({id:e,dismiss:!0})),e),this.message=(e,t)=>this.create({...t,message:e}),this.error=(e,t)=>this.create({...t,message:e,type:`error`}),this.success=(e,t)=>this.create({...t,type:`success`,message:e}),this.info=(e,t)=>this.create({...t,type:`info`,message:e}),this.warning=(e,t)=>this.create({...t,type:`warning`,message:e}),this.loading=(e,t)=>this.create({...t,type:`loading`,message:e}),this.promise=(e,t)=>{if(!t)return;let n;t.loading!==void 0&&(n=this.create({...t,promise:e,type:`loading`,message:t.loading,description:typeof t.description==`function`?void 0:t.description}));let r=e instanceof Promise?e:e(),i=n!==void 0,a,o=r.then(async e=>{if(a=[`resolve`,e],B.isValidElement(e))i=!1,this.create({id:n,type:`default`,message:e});else if(ct(e)&&!e.ok){i=!1;let r=typeof t.error==`function`?await t.error(`HTTP error! status: ${e.status}`):t.error,a=typeof t.description==`function`?await t.description(`HTTP error! status: ${e.status}`):t.description;this.create({id:n,type:`error`,message:r,description:a})}else if(t.success!==void 0){i=!1;let r=typeof t.success==`function`?await t.success(e):t.success,a=typeof t.description==`function`?await t.description(e):t.description;this.create({id:n,type:`success`,message:r,description:a})}}).catch(async e=>{if(a=[`reject`,e],t.error!==void 0){i=!1;let r=typeof t.error==`function`?await t.error(e):t.error,a=typeof t.description==`function`?await t.description(e):t.description;this.create({id:n,type:`error`,message:r,description:a})}}).finally(()=>{var e;i&&(this.dismiss(n),n=void 0),(e=t.finally)==null||e.call(t)}),s=()=>new Promise((e,t)=>o.then(()=>a[0]===`reject`?t(a[1]):e(a[1])).catch(t));return typeof n!=`string`&&typeof n!=`number`?{unwrap:s}:Object.assign(n,{unwrap:s})},this.custom=(e,t)=>{let n=t?.id||ot++;return this.create({jsx:e(n),id:n,...t}),n},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},st=(e,t)=>{let n=t?.id||ot++;return U.addToast({title:e,...t,id:n}),n},ct=e=>e&&typeof e==`object`&&`ok`in e&&typeof e.ok==`boolean`&&`status`in e&&typeof e.status==`number`,W=Object.assign(st,{success:U.success,info:U.info,warning:U.warning,error:U.error,custom:U.custom,message:U.message,promise:U.promise,dismiss:U.dismiss,loading:U.loading},{getHistory:()=>U.toasts,getToasts:()=>U.getActiveToasts()});function lt(e,{insertAt:t}={}){if(!e||typeof document>`u`)return;let n=document.head||document.getElementsByTagName(`head`)[0],r=document.createElement(`style`);r.type=`text/css`,t===`top`&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}lt(`:where(html[dir="ltr"]),:where([data-sonner-toaster][dir="ltr"]){--toast-icon-margin-start: -3px;--toast-icon-margin-end: 4px;--toast-svg-margin-start: -1px;--toast-svg-margin-end: 0px;--toast-button-margin-start: auto;--toast-button-margin-end: 0;--toast-close-button-start: 0;--toast-close-button-end: unset;--toast-close-button-transform: translate(-35%, -35%)}:where(html[dir="rtl"]),:where([data-sonner-toaster][dir="rtl"]){--toast-icon-margin-start: 4px;--toast-icon-margin-end: -3px;--toast-svg-margin-start: 0px;--toast-svg-margin-end: -1px;--toast-button-margin-start: 0;--toast-button-margin-end: auto;--toast-close-button-start: unset;--toast-close-button-end: 0;--toast-close-button-transform: translate(35%, -35%)}:where([data-sonner-toaster]){position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1: hsl(0, 0%, 99%);--gray2: hsl(0, 0%, 97.3%);--gray3: hsl(0, 0%, 95.1%);--gray4: hsl(0, 0%, 93%);--gray5: hsl(0, 0%, 90.9%);--gray6: hsl(0, 0%, 88.7%);--gray7: hsl(0, 0%, 85.8%);--gray8: hsl(0, 0%, 78%);--gray9: hsl(0, 0%, 56.1%);--gray10: hsl(0, 0%, 52.3%);--gray11: hsl(0, 0%, 43.5%);--gray12: hsl(0, 0%, 9%);--border-radius: 8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:none;z-index:999999999;transition:transform .4s ease}:where([data-sonner-toaster][data-lifted="true"]){transform:translateY(-10px)}@media (hover: none) and (pointer: coarse){:where([data-sonner-toaster][data-lifted="true"]){transform:none}}:where([data-sonner-toaster][data-x-position="right"]){right:var(--offset-right)}:where([data-sonner-toaster][data-x-position="left"]){left:var(--offset-left)}:where([data-sonner-toaster][data-x-position="center"]){left:50%;transform:translate(-50%)}:where([data-sonner-toaster][data-y-position="top"]){top:var(--offset-top)}:where([data-sonner-toaster][data-y-position="bottom"]){bottom:var(--offset-bottom)}:where([data-sonner-toast]){--y: translateY(100%);--lift-amount: calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);filter:blur(0);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none;overflow-wrap:anywhere}:where([data-sonner-toast][data-styled="true"]){padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}:where([data-sonner-toast]:focus-visible){box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast][data-y-position="top"]){top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}:where([data-sonner-toast][data-y-position="bottom"]){bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}:where([data-sonner-toast]) :where([data-description]){font-weight:400;line-height:1.4;color:inherit}:where([data-sonner-toast]) :where([data-title]){font-weight:500;line-height:1.5;color:inherit}:where([data-sonner-toast]) :where([data-icon]){display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}:where([data-sonner-toast][data-promise="true"]) :where([data-icon])>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}:where([data-sonner-toast]) :where([data-icon])>*{flex-shrink:0}:where([data-sonner-toast]) :where([data-icon]) svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}:where([data-sonner-toast]) :where([data-content]){display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;cursor:pointer;outline:none;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}:where([data-sonner-toast]) :where([data-button]):focus-visible{box-shadow:0 0 0 2px #0006}:where([data-sonner-toast]) :where([data-button]):first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}:where([data-sonner-toast]) :where([data-cancel]){color:var(--normal-text);background:rgba(0,0,0,.08)}:where([data-sonner-toast][data-theme="dark"]) :where([data-cancel]){background:rgba(255,255,255,.3)}:where([data-sonner-toast]) :where([data-close-button]){position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast] [data-close-button]{background:var(--gray1)}:where([data-sonner-toast]) :where([data-close-button]):focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast]) :where([data-disabled="true"]){cursor:not-allowed}:where([data-sonner-toast]):hover :where([data-close-button]):hover{background:var(--gray2);border-color:var(--gray5)}:where([data-sonner-toast][data-swiping="true"]):before{content:"";position:absolute;left:-50%;right:-50%;height:100%;z-index:-1}:where([data-sonner-toast][data-y-position="top"][data-swiping="true"]):before{bottom:50%;transform:scaleY(3) translateY(50%)}:where([data-sonner-toast][data-y-position="bottom"][data-swiping="true"]):before{top:50%;transform:scaleY(3) translateY(-50%)}:where([data-sonner-toast][data-swiping="false"][data-removed="true"]):before{content:"";position:absolute;inset:0;transform:scaleY(2)}:where([data-sonner-toast]):after{content:"";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}:where([data-sonner-toast][data-mounted="true"]){--y: translateY(0);opacity:1}:where([data-sonner-toast][data-expanded="false"][data-front="false"]){--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}:where([data-sonner-toast])>*{transition:opacity .4s}:where([data-sonner-toast][data-expanded="false"][data-front="false"][data-styled="true"])>*{opacity:0}:where([data-sonner-toast][data-visible="false"]){opacity:0;pointer-events:none}:where([data-sonner-toast][data-mounted="true"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}:where([data-sonner-toast][data-removed="true"][data-front="true"][data-swipe-out="false"]){--y: translateY(calc(var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="false"]){--y: translateY(40%);opacity:0;transition:transform .5s,opacity .2s}:where([data-sonner-toast][data-removed="true"][data-front="false"]):before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y, 0px)) translate(var(--swipe-amount-x, 0px));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-theme=light]{--normal-bg: #fff;--normal-border: var(--gray4);--normal-text: var(--gray12);--success-bg: hsl(143, 85%, 96%);--success-border: hsl(145, 92%, 91%);--success-text: hsl(140, 100%, 27%);--info-bg: hsl(208, 100%, 97%);--info-border: hsl(221, 91%, 91%);--info-text: hsl(210, 92%, 45%);--warning-bg: hsl(49, 100%, 97%);--warning-border: hsl(49, 91%, 91%);--warning-text: hsl(31, 92%, 45%);--error-bg: hsl(359, 100%, 97%);--error-border: hsl(359, 100%, 94%);--error-text: hsl(360, 100%, 45%)}[data-sonner-toaster][data-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12)}[data-sonner-toaster][data-theme=dark]{--normal-bg: #000;--normal-bg-hover: hsl(0, 0%, 12%);--normal-border: hsl(0, 0%, 20%);--normal-border-hover: hsl(0, 0%, 25%);--normal-text: var(--gray1);--success-bg: hsl(150, 100%, 6%);--success-border: hsl(147, 100%, 12%);--success-text: hsl(150, 86%, 65%);--info-bg: hsl(215, 100%, 6%);--info-border: hsl(223, 100%, 12%);--info-text: hsl(216, 87%, 65%);--warning-bg: hsl(64, 100%, 6%);--warning-border: hsl(60, 100%, 12%);--warning-text: hsl(46, 87%, 65%);--error-bg: hsl(358, 76%, 10%);--error-border: hsl(357, 89%, 16%);--error-text: hsl(358, 100%, 81%)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success],[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info],[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning],[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error],[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size: 16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:nth-child(1){animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}
2
2
  `);function ut(e){return e.label!==void 0}var dt=3,ft=`32px`,pt=`16px`,mt=4e3,ht=356,gt=14,_t=20,vt=200;function G(...e){return e.filter(Boolean).join(` `)}function yt(e){let[t,n]=e.split(`-`),r=[];return t&&r.push(t),n&&r.push(n),r}var bt=e=>{let{invert:t,toast:n,unstyled:r,interacting:i,setHeights:a,visibleToasts:o,heights:s,index:c,toasts:l,expanded:u,removeToast:d,defaultRichColors:f,closeButton:p,style:m,cancelButtonStyle:h,actionButtonStyle:g,className:_=``,descriptionClassName:v=``,duration:y,position:b,gap:ee,loadingIcon:x,expandByDefault:S,classNames:C,icons:w,closeButtonAriaLabel:te=`Close toast`,pauseWhenPageIsHidden:T}=e,[E,D]=B.useState(null),[ne,re]=B.useState(null),[O,k]=B.useState(!1),[ie,A]=B.useState(!1),[j,M]=B.useState(!1),[ae,oe]=B.useState(!1),[se,ce]=B.useState(!1),[le,N]=B.useState(0),[ue,de]=B.useState(0),fe=B.useRef(n.duration||y||mt),pe=B.useRef(null),P=B.useRef(null),me=c===0,he=c+1<=o,F=n.type,I=n.dismissible!==!1,ge=n.className||``,_e=n.descriptionClassName||``,ve=B.useMemo(()=>s.findIndex(e=>e.toastId===n.id)||0,[s,n.id]),ye=B.useMemo(()=>n.closeButton??p,[n.closeButton,p]),be=B.useMemo(()=>n.duration||y||mt,[n.duration,y]),xe=B.useRef(0),L=B.useRef(0),Se=B.useRef(0),R=B.useRef(null),[Ce,we]=b.split(`-`),Te=B.useMemo(()=>s.reduce((e,t,n)=>n>=ve?e:e+t.height,0),[s,ve]),Ee=at(),De=n.invert||t,Oe=F===`loading`;L.current=B.useMemo(()=>ve*ee+Te,[ve,Te]),B.useEffect(()=>{fe.current=be},[be]),B.useEffect(()=>{k(!0)},[]),B.useEffect(()=>{let e=P.current;if(e){let t=e.getBoundingClientRect().height;return de(t),a(e=>[{toastId:n.id,height:t,position:n.position},...e]),()=>a(e=>e.filter(e=>e.toastId!==n.id))}},[a,n.id]),B.useLayoutEffect(()=>{if(!O)return;let e=P.current,t=e.style.height;e.style.height=`auto`;let r=e.getBoundingClientRect().height;e.style.height=t,de(r),a(e=>e.find(e=>e.toastId===n.id)?e.map(e=>e.toastId===n.id?{...e,height:r}:e):[{toastId:n.id,height:r,position:n.position},...e])},[O,n.title,n.description,a,n.id]);let z=B.useCallback(()=>{A(!0),N(L.current),a(e=>e.filter(e=>e.toastId!==n.id)),setTimeout(()=>{d(n)},vt)},[n,d,a,L]);B.useEffect(()=>{if(n.promise&&F===`loading`||n.duration===1/0||n.type===`loading`)return;let e;return u||i||T&&Ee?(()=>{if(Se.current<xe.current){let e=new Date().getTime()-xe.current;fe.current-=e}Se.current=new Date().getTime()})():fe.current!==1/0&&(xe.current=new Date().getTime(),e=setTimeout(()=>{var e;(e=n.onAutoClose)==null||e.call(n,n),z()},fe.current)),()=>clearTimeout(e)},[u,i,n,F,T,Ee,z]),B.useEffect(()=>{n.delete&&z()},[z,n.delete]);function ke(){return w!=null&&w.loading?B.createElement(`div`,{className:G(C?.loader,n?.classNames?.loader,`sonner-loader`),"data-visible":F===`loading`},w.loading):x?B.createElement(`div`,{className:G(C?.loader,n?.classNames?.loader,`sonner-loader`),"data-visible":F===`loading`},x):B.createElement($e,{className:G(C?.loader,n?.classNames?.loader),visible:F===`loading`})}return B.createElement(`li`,{tabIndex:0,ref:P,className:G(_,ge,C?.toast,n?.classNames?.toast,C?.default,C?.[F],n?.classNames?.[F]),"data-sonner-toast":``,"data-rich-colors":n.richColors??f,"data-styled":!(n.jsx||n.unstyled||r),"data-mounted":O,"data-promise":!!n.promise,"data-swiped":se,"data-removed":ie,"data-visible":he,"data-y-position":Ce,"data-x-position":we,"data-index":c,"data-front":me,"data-swiping":j,"data-dismissible":I,"data-type":F,"data-invert":De,"data-swipe-out":ae,"data-swipe-direction":ne,"data-expanded":!!(u||S&&O),style:{"--index":c,"--toasts-before":c,"--z-index":l.length-c,"--offset":`${ie?le:L.current}px`,"--initial-height":S?`auto`:`${ue}px`,...m,...n.style},onDragEnd:()=>{M(!1),D(null),R.current=null},onPointerDown:e=>{Oe||!I||(pe.current=new Date,N(L.current),e.target.setPointerCapture(e.pointerId),e.target.tagName!==`BUTTON`&&(M(!0),R.current={x:e.clientX,y:e.clientY}))},onPointerUp:()=>{var e;if(ae||!I)return;R.current=null;let t=Number(P.current?.style.getPropertyValue(`--swipe-amount-x`).replace(`px`,``)||0),r=Number(P.current?.style.getPropertyValue(`--swipe-amount-y`).replace(`px`,``)||0),i=new Date().getTime()-pe.current?.getTime(),a=E===`x`?t:r,o=Math.abs(a)/i;if(Math.abs(a)>=_t||o>.11){N(L.current),(e=n.onDismiss)==null||e.call(n,n),re(E===`x`?t>0?`right`:`left`:r>0?`down`:`up`),z(),oe(!0),ce(!1);return}M(!1),D(null)},onPointerMove:t=>{var n,r;if(!R.current||!I||window.getSelection()?.toString().length>0)return;let i=t.clientY-R.current.y,a=t.clientX-R.current.x,o=e.swipeDirections??yt(b);!E&&(Math.abs(a)>1||Math.abs(i)>1)&&D(Math.abs(a)>Math.abs(i)?`x`:`y`);let s={x:0,y:0};E===`y`?(o.includes(`top`)||o.includes(`bottom`))&&(o.includes(`top`)&&i<0||o.includes(`bottom`)&&i>0)&&(s.y=i):E===`x`&&(o.includes(`left`)||o.includes(`right`))&&(o.includes(`left`)&&a<0||o.includes(`right`)&&a>0)&&(s.x=a),(Math.abs(s.x)>0||Math.abs(s.y)>0)&&ce(!0),(n=P.current)==null||n.style.setProperty(`--swipe-amount-x`,`${s.x}px`),(r=P.current)==null||r.style.setProperty(`--swipe-amount-y`,`${s.y}px`)}},ye&&!n.jsx?B.createElement(`button`,{"aria-label":te,"data-disabled":Oe,"data-close-button":!0,onClick:Oe||!I?()=>{}:()=>{var e;z(),(e=n.onDismiss)==null||e.call(n,n)},className:G(C?.closeButton,n?.classNames?.closeButton)},w?.close??it):null,n.jsx||(0,B.isValidElement)(n.title)?n.jsx?n.jsx:typeof n.title==`function`?n.title():n.title:B.createElement(B.Fragment,null,F||n.icon||n.promise?B.createElement(`div`,{"data-icon":``,className:G(C?.icon,n?.classNames?.icon)},n.promise||n.type===`loading`&&!n.icon?n.icon||ke():null,n.type===`loading`?null:n.icon||w?.[F]||Ze(F)):null,B.createElement(`div`,{"data-content":``,className:G(C?.content,n?.classNames?.content)},B.createElement(`div`,{"data-title":``,className:G(C?.title,n?.classNames?.title)},typeof n.title==`function`?n.title():n.title),n.description?B.createElement(`div`,{"data-description":``,className:G(v,_e,C?.description,n?.classNames?.description)},typeof n.description==`function`?n.description():n.description):null),(0,B.isValidElement)(n.cancel)?n.cancel:n.cancel&&ut(n.cancel)?B.createElement(`button`,{"data-button":!0,"data-cancel":!0,style:n.cancelButtonStyle||h,onClick:e=>{var t,r;ut(n.cancel)&&I&&((r=(t=n.cancel).onClick)==null||r.call(t,e),z())},className:G(C?.cancelButton,n?.classNames?.cancelButton)},n.cancel.label):null,(0,B.isValidElement)(n.action)?n.action:n.action&&ut(n.action)?B.createElement(`button`,{"data-button":!0,"data-action":!0,style:n.actionButtonStyle||g,onClick:e=>{var t,r;ut(n.action)&&((r=(t=n.action).onClick)==null||r.call(t,e),!e.defaultPrevented&&z())},className:G(C?.actionButton,n?.classNames?.actionButton)},n.action.label):null))};function xt(){if(typeof window>`u`||typeof document>`u`)return`ltr`;let e=document.documentElement.getAttribute(`dir`);return e===`auto`||!e?window.getComputedStyle(document.documentElement).direction:e}function St(e,t){let n={};return[e,t].forEach((e,t)=>{let r=t===1,i=r?`--mobile-offset`:`--offset`,a=r?pt:ft;function o(e){[`top`,`right`,`bottom`,`left`].forEach(t=>{n[`${i}-${t}`]=typeof e==`number`?`${e}px`:e})}typeof e==`number`||typeof e==`string`?o(e):typeof e==`object`?[`top`,`right`,`bottom`,`left`].forEach(t=>{e[t]===void 0?n[`${i}-${t}`]=a:n[`${i}-${t}`]=typeof e[t]==`number`?`${e[t]}px`:e[t]}):o(a)}),n}var Ct=(0,B.forwardRef)(function(e,t){let{invert:n,position:r=`bottom-right`,hotkey:i=[`altKey`,`KeyT`],expand:a,closeButton:o,className:s,offset:c,mobileOffset:l,theme:u=`light`,richColors:d,duration:f,style:p,visibleToasts:m=dt,toastOptions:h,dir:g=xt(),gap:_=gt,loadingIcon:v,icons:y,containerAriaLabel:b=`Notifications`,pauseWhenPageIsHidden:ee}=e,[x,S]=B.useState([]),C=B.useMemo(()=>Array.from(new Set([r].concat(x.filter(e=>e.position).map(e=>e.position)))),[x,r]),[w,te]=B.useState([]),[T,E]=B.useState(!1),[D,ne]=B.useState(!1),[re,O]=B.useState(u===`system`?typeof window<`u`&&window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:u),k=B.useRef(null),ie=i.join(`+`).replace(/Key/g,``).replace(/Digit/g,``),A=B.useRef(null),j=B.useRef(!1),M=B.useCallback(e=>{S(t=>{var n;return(n=t.find(t=>t.id===e.id))!=null&&n.delete||U.dismiss(e.id),t.filter(({id:t})=>t!==e.id)})},[]);return B.useEffect(()=>U.subscribe(e=>{if(e.dismiss){S(t=>t.map(t=>t.id===e.id?{...t,delete:!0}:t));return}setTimeout(()=>{Xe.flushSync(()=>{S(t=>{let n=t.findIndex(t=>t.id===e.id);return n===-1?[e,...t]:[...t.slice(0,n),{...t[n],...e},...t.slice(n+1)]})})})}),[]),B.useEffect(()=>{if(u!==`system`){O(u);return}if(u===`system`&&(window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?O(`dark`):O(`light`)),typeof window>`u`)return;let e=window.matchMedia(`(prefers-color-scheme: dark)`);try{e.addEventListener(`change`,({matches:e})=>{O(e?`dark`:`light`)})}catch{e.addListener(({matches:e})=>{try{O(e?`dark`:`light`)}catch(e){console.error(e)}})}},[u]),B.useEffect(()=>{x.length<=1&&E(!1)},[x]),B.useEffect(()=>{let e=e=>{var t,n;i.every(t=>e[t]||e.code===t)&&(E(!0),(t=k.current)==null||t.focus()),e.code===`Escape`&&(document.activeElement===k.current||(n=k.current)!=null&&n.contains(document.activeElement))&&E(!1)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[i]),B.useEffect(()=>{if(k.current)return()=>{A.current&&(A.current.focus({preventScroll:!0}),A.current=null,j.current=!1)}},[k.current]),B.createElement(`section`,{ref:t,"aria-label":`${b} ${ie}`,tabIndex:-1,"aria-live":`polite`,"aria-relevant":`additions text`,"aria-atomic":`false`,suppressHydrationWarning:!0},C.map((t,r)=>{let[i,u]=t.split(`-`);return x.length?B.createElement(`ol`,{key:t,dir:g===`auto`?xt():g,tabIndex:-1,ref:k,className:s,"data-sonner-toaster":!0,"data-theme":re,"data-y-position":i,"data-lifted":T&&x.length>1&&!a,"data-x-position":u,style:{"--front-toast-height":`${w[0]?.height||0}px`,"--width":`${ht}px`,"--gap":`${_}px`,...p,...St(c,l)},onBlur:e=>{j.current&&!e.currentTarget.contains(e.relatedTarget)&&(j.current=!1,A.current&&=(A.current.focus({preventScroll:!0}),null))},onFocus:e=>{e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`||j.current||(j.current=!0,A.current=e.relatedTarget)},onMouseEnter:()=>E(!0),onMouseMove:()=>E(!0),onMouseLeave:()=>{D||E(!1)},onDragEnd:()=>E(!1),onPointerDown:e=>{e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`||ne(!0)},onPointerUp:()=>ne(!1)},x.filter(e=>!e.position&&r===0||e.position===t).map((r,i)=>B.createElement(bt,{key:r.id,icons:y,index:i,toast:r,defaultRichColors:d,duration:h?.duration??f,className:h?.className,descriptionClassName:h?.descriptionClassName,invert:n,visibleToasts:m,closeButton:h?.closeButton??o,interacting:D,position:t,style:h?.style,unstyled:h?.unstyled,classNames:h?.classNames,cancelButtonStyle:h?.cancelButtonStyle,actionButtonStyle:h?.actionButtonStyle,removeToast:M,toasts:x.filter(e=>e.position==r.position),heights:w.filter(e=>e.position==r.position),setHeights:te,expandByDefault:a,gap:_,loadingIcon:v,expanded:T,pauseWhenPageIsHidden:ee,swipeDirections:e.swipeDirections}))):null}))}),wt=new Me({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!0}}}),Tt=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,Et=t,Dt=(e,t)=>n=>{if(t?.variants==null)return Et(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=Tt(t)||Tt(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return Et(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},Ot=Dt(`inline-flex items-center justify-center whitespace-nowrap rounded-full text-sm font-medium ring-offset-background transition-colors duration-fast focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50`,{variants:{variant:{default:`bg-primary text-primary-foreground hover:bg-primary-600 active:bg-primary-700 shadow-sm`,destructive:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,outline:`border border-gray-200 bg-white hover:bg-gray-50 hover:text-gray-800 text-gray-600`,secondary:`bg-gray-100 text-gray-700 hover:bg-gray-200/80`,ghost:`hover:bg-gray-100/80 hover:text-gray-800`,link:`text-primary underline-offset-4 hover:underline`,primary:`bg-primary text-primary-foreground hover:bg-primary-600 active:bg-primary-700 shadow-sm`,subtle:`bg-gray-100 text-gray-600 hover:bg-gray-200/80`,"primary-outline":`border border-primary/30 text-primary hover:bg-primary hover:text-primary-foreground`},size:{default:`h-9 px-4 py-2`,sm:`h-8 px-3 text-xs`,lg:`h-11 px-5 text-[14px]`,xl:`h-12 px-6 text-[15px]`,icon:`h-9 w-9`}},defaultVariants:{variant:`default`,size:`default`}}),kt=B.forwardRef(({className:e,variant:t,size:n,...r},i)=>(0,V.jsx)(`button`,{className:s(Ot({variant:t,size:n,className:e})),ref:i,...r}));kt.displayName=`Button`;var K=B.forwardRef(({className:e,type:t,...n},r)=>(0,V.jsx)(`input`,{type:t,className:s(`flex h-9 w-full rounded-xl border border-gray-200/80 bg-white px-3.5 py-2 text-sm text-gray-900 file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-gray-300 placeholder:font-normal focus:outline-none focus:ring-1 focus:ring-primary/40 focus:border-primary/40 transition-colors disabled:cursor-not-allowed disabled:opacity-50`,e),ref:r,...n}));K.displayName=`Input`;var At=B.forwardRef(({className:e,...t},n)=>(0,V.jsx)(`label`,{ref:n,className:s(`text-sm font-medium leading-none text-gray-700 peer-disabled:cursor-not-allowed peer-disabled:opacity-70`,e),...t}));At.displayName=`Label`;function jt({children:e,fullHeight:t=!1,className:n}){return(0,V.jsx)(`div`,{className:s(`animate-fade-in`,t?`h-[calc(100vh-80px)] w-full flex flex-col`:`pb-16`,n),children:e})}function Mt({title:e,description:t,actions:n,className:r}){return(0,V.jsxs)(`div`,{className:s(`flex items-center justify-between mb-6 shrink-0`,r),children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`h2`,{className:`text-xl font-semibold text-gray-900`,children:e}),t&&(0,V.jsx)(`p`,{className:`text-sm text-gray-500 mt-1`,children:t})]}),n&&(0,V.jsx)(`div`,{className:`flex items-center gap-2 shrink-0`,children:n})]})}var Nt=B.forwardRef(({className:e,hover:t=!0,...n},r)=>(0,V.jsx)(`div`,{ref:r,className:s(`rounded-2xl border border-gray-200/50 bg-white text-card-foreground shadow-card transition-all duration-base`,t&&`hover:shadow-card-hover hover:border-gray-200`,e),...n}));Nt.displayName=`Card`;var Pt=B.forwardRef(({className:e,...t},n)=>(0,V.jsx)(`div`,{ref:n,className:s(`flex flex-col space-y-1.5 p-6`,e),...t}));Pt.displayName=`CardHeader`;var Ft=B.forwardRef(({className:e,...t},n)=>(0,V.jsx)(`h3`,{ref:n,className:s(`text-[15px] font-semibold leading-tight tracking-tight text-gray-900`,e),...t}));Ft.displayName=`CardTitle`;var It=B.forwardRef(({className:e,...t},n)=>(0,V.jsx)(`p`,{ref:n,className:s(`text-[13px] text-gray-400 leading-relaxed`,e),...t}));It.displayName=`CardDescription`;var Lt=B.forwardRef(({className:e,...t},n)=>(0,V.jsx)(`div`,{ref:n,className:s(`p-6 pt-0`,e),...t}));Lt.displayName=`CardContent`;var Rt=B.forwardRef(({className:e,...t},n)=>(0,V.jsx)(`div`,{ref:n,className:s(`flex items-center justify-between p-6 pt-0`,e),...t}));Rt.displayName=`CardFooter`;function q(e){let t=e.trim();if(!t)throw Error(`typed key id is required`);return{id:t}}function zt(e){return typeof e==`string`?e.trim():e.id}var Bt=class{listeners=new Map;globalListeners=new Set;listenerCount=0;onFirstSubscriber;onListenerError;onNoSubscribers;constructor(e={}){this.onFirstSubscriber=e.onFirstSubscriber,this.onListenerError=e.onListenerError,this.onNoSubscribers=e.onNoSubscribers}emit=(e,t,n={})=>{let r={type:zt(e),payload:t,...n.emittedAt?{emittedAt:n.emittedAt}:{},...n.source?{source:n.source}:{}};this.emitEnvelope(r)};emitEnvelope=e=>{let t=this.listeners.get(e.type);if(t)for(let n of t)this.safeInvokeListener(e,n);if(this.globalListeners.size!==0)for(let t of this.globalListeners)this.safeInvokeGlobalListener(e,t)};on=(e,t)=>{let n=zt(e),r=this.listeners.get(n)??new Set,i=t,a=!r.has(i);return r.add(i),this.listeners.set(n,r),a&&this.registerSubscriber(),()=>{this.off(e,t)}};off=(e,t)=>{let n=zt(e),r=this.listeners.get(n);if(!r)return;let i=r.delete(t);r.size===0&&this.listeners.delete(n),i&&this.unregisterSubscriber()};once=(e,t)=>{let n=this.on(e,(e,r)=>{n(),t(e,r)});return n};subscribeAll=e=>{let t=!this.globalListeners.has(e);return this.globalListeners.add(e),t&&this.registerSubscriber(),()=>{this.globalListeners.delete(e)&&this.unregisterSubscriber()}};registerSubscriber=()=>{this.listenerCount+=1,this.listenerCount===1&&this.onFirstSubscriber?.()};unregisterSubscriber=()=>{this.listenerCount=Math.max(0,this.listenerCount-1),this.listenerCount===0&&this.onNoSubscribers?.()};safeInvokeListener=(e,t)=>{try{t(e.payload,e)}catch(t){this.onListenerError?.({type:e.type,payload:e.payload,error:t})}};safeInvokeGlobalListener=(e,t)=>{try{t(e)}catch(t){this.onListenerError?.({type:e.type,payload:e.payload,error:t})}}};function J(e){return q(e)}var Vt={configUpdated:J(`config.updated`),channelConfigApplyStatus:J(`channel.config.apply-status`),sessionUpdated:J(`session.updated`),sessionRunStatus:J(`session.run-status`),sessionMetadataChanged:J(`session.metadata.changed`),ncpEvent:J(`ncp.event`),sessionSummaryUpsert:J(`session.summary.upsert`),sessionSummaryDelete:J(`session.summary.delete`),uiShowContent:J(`ui.show-content`),configReloadStarted:J(`config.reload.started`),configReloadFinished:J(`config.reload.finished`),error:J(`error`),connectionOpen:J(`connection.open`),connectionClose:J(`connection.close`),connectionError:J(`connection.error`),runtimeUpdateSnapshot:J(`runtime.update.snapshot`)};q(`extension.channel.config.get`),q(`extension.channel.message.submit`),q(`extension.channel.command.list`),q(`extension.channel.command.execute`),q(`extension.response`),q(`agent-run.send`),q(`agent-run.abort`),q(`agent-run.session-message.request`);var Ht=`__nextclaw_runtime_default__`;function Ut(e){return e===Ht}function Wt(e){let t=e.trim().replace(/\/+$/,``);if(!t)throw Error(`NextClaw client baseUrl is required.`);return t}function Gt(e,t){return`${Wt(e)}${t.startsWith(`/`)?t:`/${t}`}`}function Kt(e,t){if(!t)return e;let n=typeof t==`string`?t:t.toString();return n?`${e}${e.includes(`?`)?`&`:`?`}${n}`:e}function qt(e,t){let n=new URL(Gt(e,t));return n.protocol===`https:`?n.protocol=`wss:`:n.protocol===`http:`&&(n.protocol=`ws:`),n.toString()}function Jt(e){let t=e??globalThis.fetch;if(typeof t!=`function`)throw Error(`NextClaw fetch transport is not available in this environment.`);return((e,n)=>t.call(globalThis,e,n))}function Yt(e){let t=e.split(/\r?\n/),n=`message`,r=[];for(let e of t){if(e.startsWith(`event:`)){n=e.slice(6).trim();continue}e.startsWith(`data:`)&&r.push(e.slice(5).trimStart())}return r.length===0?null:{event:n,data:r.join(`
3
3
  `)}}function Xt(e){try{let t=JSON.parse(e);return t&&typeof t==`object`&&`type`in t?t:null}catch{return null}}var Zt=class{baseUrl;defaultHeaders;fetchImpl;transport;constructor(e,t){this.requestService=e;let{baseUrl:n,fetchImpl:r,headers:i,token:a,transport:o}=t;this.baseUrl=n,this.fetchImpl=Jt(r),this.transport=o,this.defaultHeaders={Accept:`application/json`,...i??{},...a?{Authorization:`Bearer ${a}`}:{}}}send=async e=>await this.requestService.post(`/api/agent-runs/send`,e);abort=async e=>await this.requestService.post(`/api/agent-runs/abort`,e);stream=(e,t,n={})=>{if(this.transport)throw Error(`Agent run streaming requires the HTTP fetch transport.`);let r=new AbortController,i=()=>r.abort(n.signal?.reason);return n.signal?.addEventListener(`abort`,i,{once:!0}),this.consumeStream(e,t,r.signal,n.onError).finally(()=>{n.signal?.removeEventListener(`abort`,i)}),{close:()=>{r.abort(),n.signal?.removeEventListener(`abort`,i)}}};consumeStream=async(e,t,n,r)=>{try{let r=new URL(Gt(this.baseUrl,`/api/agent-runs/stream`));r.searchParams.set(`sessionId`,e.sessionId);let i=await this.fetchImpl(r.toString(),{method:`GET`,headers:{...this.defaultHeaders,Accept:`text/event-stream`},signal:n});if(!i.ok)throw Error(`Agent run stream failed with HTTP ${i.status}.`);if(!i.body)throw Error(`Agent run stream response has no body.`);await this.readEventStream(i.body,t,n)}catch(e){if(n.aborted)return;r?.(e)}};readEventStream=async(e,t,n)=>{let r=e.getReader(),i=new TextDecoder,a=``;try{for(;!n.aborted;){let{done:e,value:n}=await r.read();if(e)break;a+=i.decode(n,{stream:!0}),a=this.drainFrames(a,t)}a+=i.decode(),this.drainFrames(`${a}\n\n`,t)}finally{r.releaseLock()}};drainFrames=(e,t)=>{let n=e.replaceAll(`\r
4
4
  `,`
@@ -0,0 +1,8 @@
1
+ import{a as e,g as t,h as n,n as r,p as i,r as a,u as o,v as s}from"./react-DYQXXGbH.js";import{Dt as c,Ft as l,Ht as u,It as d,Lt as f,Nt as p,Pt as m,Ut as h,Vt as g,ct as _,en as v,it as y,mt as b,nt as x,rt as S}from"./api-C6EDHBDR.js";import{c as C}from"./dist-BIYV2-Ia.js";import{S as w,a as T,i as E,n as D,r as O,t as k}from"./select-CIRwTNP4.js";import{t as ee}from"./search-CKCzwLId.js";import{t as A}from"./external-link-D2cBOCqn.js";import{t as te}from"./x-Cm3JjYut.js";import{C as j,S as ne,St as re,b as ie,ht as ae,jt as oe,lt as se,q as ce,v as le,wt as ue,x as de,xt as M,y as N,yt as fe}from"./index-DTb_XVIH.js";import{n as P,o as pe,p as me,r as F,t as I}from"./use-config-DgKM9VIU.js";import{t as he}from"./tag-chip-DKhVFtTE.js";import{t as L}from"./config-hints-CTqBnCDp.js";import{a as R,c as z,i as ge,n as _e,o as B,r as ve,s as ye,t as be}from"./config-split-page-CjlmJy8X.js";var xe=C(`Hash`,[[`line`,{x1:`4`,x2:`20`,y1:`9`,y2:`9`,key:`4lhtct`}],[`line`,{x1:`4`,x2:`20`,y1:`15`,y2:`15`,key:`vyu0kd`}],[`line`,{x1:`10`,x2:`8`,y1:`3`,y2:`21`,key:`1ggp8o`}],[`line`,{x1:`16`,x2:`14`,y1:`3`,y2:`21`,key:`weycgp`}]]),Se=C(`Mail`,[[`rect`,{width:`20`,height:`16`,x:`2`,y:`4`,rx:`2`,key:`18n3k1`}],[`path`,{d:`m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7`,key:`1ocrg3`}]]),V=C(`MessageCircleMore`,[[`path`,{d:`M7.9 20A9 9 0 1 0 4 16.1L2 22Z`,key:`vv11sd`}],[`path`,{d:`M8 12h.01`,key:`czm47f`}],[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M16 12h.01`,key:`1l6xoz`}]]),H=C(`QrCode`,[[`rect`,{width:`5`,height:`5`,x:`3`,y:`3`,rx:`1`,key:`1tu5fj`}],[`rect`,{width:`5`,height:`5`,x:`16`,y:`3`,rx:`1`,key:`1v8r4q`}],[`rect`,{width:`5`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`1x03jg`}],[`path`,{d:`M21 16h-3a2 2 0 0 0-2 2v3`,key:`177gqh`}],[`path`,{d:`M21 21v.01`,key:`ents32`}],[`path`,{d:`M12 7v3a2 2 0 0 1-2 2H7`,key:`8crl2c`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M12 3h.01`,key:`n36tog`}],[`path`,{d:`M12 16v.01`,key:`133mhm`}],[`path`,{d:`M16 12h1`,key:`1slzba`}],[`path`,{d:`M21 12v.01`,key:`1lwtk9`}],[`path`,{d:`M12 21v-1`,key:`1880an`}]]),Ce=C(`ToggleLeft`,[[`rect`,{width:`20`,height:`12`,x:`2`,y:`6`,rx:`6`,ry:`6`,key:`f2vt7d`}],[`circle`,{cx:`8`,cy:`12`,r:`2`,key:`1nvbw3`}]]),U=s(n(),1),W=i();function we({value:e,onChange:t,className:n,placeholder:r=``}){let[i,s]=(0,U.useState)(``),c=n=>{n.key===`Enter`&&i.trim()?(n.preventDefault(),t([...e,i.trim()]),s(``)):n.key===`Backspace`&&!i&&e.length>0&&t(e.slice(0,-1))},l=n=>{t(e.filter((e,t)=>t!==n))};return(0,W.jsxs)(`div`,{className:o(`flex min-h-[42px] flex-wrap gap-2 rounded-xl border border-gray-200/80 bg-white p-2`,n),children:[e.map((e,t)=>(0,W.jsxs)(he,{tone:`info`,className:`gap-1 px-2 py-1 text-sm`,children:[e,(0,W.jsx)(`button`,{type:`button`,onClick:()=>l(t),className:`transition-colors hover:text-rose-200`,children:(0,W.jsx)(te,{className:`h-3 w-3`})})]},t)),(0,W.jsx)(`input`,{type:`text`,value:i,onChange:e=>s(e.target.value),onKeyDown:c,className:`flex-1 outline-none min-w-[100px] bg-transparent text-sm`,placeholder:r||a(`enterTag`)})]})}function Te(e){return e.includes(`token`)||e.includes(`secret`)||e.includes(`password`)?(0,W.jsx)(re,{className:`h-3.5 w-3.5 text-gray-500`}):e.includes(`url`)||e.includes(`host`)?(0,W.jsx)(ue,{className:`h-3.5 w-3.5 text-gray-500`}):e.includes(`email`)||e.includes(`mail`)?(0,W.jsx)(Se,{className:`h-3.5 w-3.5 text-gray-500`}):e.includes(`id`)||e.includes(`from`)?(0,W.jsx)(xe,{className:`h-3.5 w-3.5 text-gray-500`}):e===`enabled`||e===`consentGranted`?(0,W.jsx)(Ce,{className:`h-3.5 w-3.5 text-gray-500`}):(0,W.jsx)(ae,{className:`h-3.5 w-3.5 text-gray-500`})}function Ee({channelName:e,fields:t,formData:n,jsonDrafts:r,setJsonDrafts:i,updateField:o,uiHints:s}){return(0,W.jsx)(W.Fragment,{children:t.map(t=>{let c=L(`channels.${e}.${t.name}`,s),u=c?.label??t.label,f=c?.placeholder;return(0,W.jsxs)(`div`,{className:`space-y-2.5`,children:[(0,W.jsxs)(l,{htmlFor:t.name,className:`flex items-center gap-2 text-sm font-medium text-gray-900`,children:[Te(t.name),u]}),t.type===`boolean`&&(0,W.jsxs)(`div`,{className:`flex items-center justify-between rounded-xl bg-gray-50 p-3`,children:[(0,W.jsx)(`span`,{className:`text-sm text-gray-500`,children:n[t.name]?a(`enabled`):a(`disabled`)}),(0,W.jsx)(b,{id:t.name,checked:n[t.name]||!1,onCheckedChange:e=>o(t.name,e),className:`data-[state=checked]:bg-emerald-500`})]}),(t.type===`text`||t.type===`email`)&&(0,W.jsx)(d,{id:t.name,type:t.type,value:n[t.name]||``,onChange:e=>o(t.name,e.target.value),placeholder:f,className:`rounded-xl`}),t.type===`password`&&(0,W.jsx)(d,{id:t.name,type:`password`,value:n[t.name]||``,onChange:e=>o(t.name,e.target.value),placeholder:f??a(`leaveBlankToKeepUnchanged`),className:`rounded-xl`}),t.type===`number`&&(0,W.jsx)(d,{id:t.name,type:`number`,value:n[t.name]||0,onChange:e=>o(t.name,parseInt(e.target.value,10)||0),placeholder:f,className:`rounded-xl`}),t.type===`tags`&&(0,W.jsx)(we,{value:n[t.name]||[],onChange:e=>o(t.name,e)}),t.type===`select`&&(0,W.jsxs)(k,{value:n[t.name]||``,onValueChange:e=>o(t.name,e),children:[(0,W.jsx)(E,{className:`rounded-xl`,children:(0,W.jsx)(T,{})}),(0,W.jsx)(D,{children:(t.options??[]).map(e=>(0,W.jsx)(O,{value:e.value,children:e.label},e.value))})]}),t.type===`json`&&(0,W.jsx)(`textarea`,{id:t.name,value:r[t.name]??`{}`,onChange:e=>i(n=>({...n,[t.name]:e.target.value})),className:`min-h-[120px] w-full resize-none rounded-lg border border-gray-200 bg-white px-3 py-2 text-xs font-mono`})]},t.name)})})}var De=t(((e,t)=>{t.exports=function(){return typeof Promise==`function`&&Promise.prototype&&Promise.prototype.then}})),G=t((e=>{var t,n=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];e.getSymbolSize=function(e){if(!e)throw Error(`"version" cannot be null or undefined`);if(e<1||e>40)throw Error(`"version" should be in range from 1 to 40`);return e*4+17},e.getSymbolTotalCodewords=function(e){return n[e]},e.getBCHDigit=function(e){let t=0;for(;e!==0;)t++,e>>>=1;return t},e.setToSJISFunction=function(e){if(typeof e!=`function`)throw Error(`"toSJISFunc" is not a valid function.`);t=e},e.isKanjiModeEnabled=function(){return t!==void 0},e.toSJIS=function(e){return t(e)}})),K=t((e=>{e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function t(t){if(typeof t!=`string`)throw Error(`Param is not a string`);switch(t.toLowerCase()){case`l`:case`low`:return e.L;case`m`:case`medium`:return e.M;case`q`:case`quartile`:return e.Q;case`h`:case`high`:return e.H;default:throw Error(`Unknown EC Level: `+t)}}e.isValid=function(e){return e&&e.bit!==void 0&&e.bit>=0&&e.bit<4},e.from=function(n,r){if(e.isValid(n))return n;try{return t(n)}catch{return r}}})),Oe=t(((e,t)=>{function n(){this.buffer=[],this.length=0}n.prototype={get:function(e){let t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)==1},put:function(e,t){for(let n=0;n<t;n++)this.putBit((e>>>t-n-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(e){let t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}},t.exports=n})),ke=t(((e,t)=>{function n(e){if(!e||e<1)throw Error(`BitMatrix size must be defined and greater than 0`);this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}n.prototype.set=function(e,t,n,r){let i=e*this.size+t;this.data[i]=n,r&&(this.reservedBit[i]=!0)},n.prototype.get=function(e,t){return this.data[e*this.size+t]},n.prototype.xor=function(e,t,n){this.data[e*this.size+t]^=n},n.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]},t.exports=n})),Ae=t((e=>{var t=G().getSymbolSize;e.getRowColCoords=function(e){if(e===1)return[];let n=Math.floor(e/7)+2,r=t(e),i=r===145?26:Math.ceil((r-13)/(2*n-2))*2,a=[r-7];for(let e=1;e<n-1;e++)a[e]=a[e-1]-i;return a.push(6),a.reverse()},e.getPositions=function(t){let n=[],r=e.getRowColCoords(t),i=r.length;for(let e=0;e<i;e++)for(let t=0;t<i;t++)e===0&&t===0||e===0&&t===i-1||e===i-1&&t===0||n.push([r[e],r[t]]);return n}})),je=t((e=>{var t=G().getSymbolSize,n=7;e.getPositions=function(e){let r=t(e);return[[0,0],[r-n,0],[0,r-n]]}})),Me=t((e=>{e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var t={N1:3,N2:3,N3:40,N4:10};e.isValid=function(e){return e!=null&&e!==``&&!isNaN(e)&&e>=0&&e<=7},e.from=function(t){return e.isValid(t)?parseInt(t,10):void 0},e.getPenaltyN1=function(e){let n=e.size,r=0,i=0,a=0,o=null,s=null;for(let c=0;c<n;c++){i=a=0,o=s=null;for(let l=0;l<n;l++){let n=e.get(c,l);n===o?i++:(i>=5&&(r+=t.N1+(i-5)),o=n,i=1),n=e.get(l,c),n===s?a++:(a>=5&&(r+=t.N1+(a-5)),s=n,a=1)}i>=5&&(r+=t.N1+(i-5)),a>=5&&(r+=t.N1+(a-5))}return r},e.getPenaltyN2=function(e){let n=e.size,r=0;for(let t=0;t<n-1;t++)for(let i=0;i<n-1;i++){let n=e.get(t,i)+e.get(t,i+1)+e.get(t+1,i)+e.get(t+1,i+1);(n===4||n===0)&&r++}return r*t.N2},e.getPenaltyN3=function(e){let n=e.size,r=0,i=0,a=0;for(let t=0;t<n;t++){i=a=0;for(let o=0;o<n;o++)i=i<<1&2047|e.get(t,o),o>=10&&(i===1488||i===93)&&r++,a=a<<1&2047|e.get(o,t),o>=10&&(a===1488||a===93)&&r++}return r*t.N3},e.getPenaltyN4=function(e){let n=0,r=e.data.length;for(let t=0;t<r;t++)n+=e.data[t];return Math.abs(Math.ceil(n*100/r/5)-10)*t.N4};function n(t,n,r){switch(t){case e.Patterns.PATTERN000:return(n+r)%2==0;case e.Patterns.PATTERN001:return n%2==0;case e.Patterns.PATTERN010:return r%3==0;case e.Patterns.PATTERN011:return(n+r)%3==0;case e.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(r/3))%2==0;case e.Patterns.PATTERN101:return n*r%2+n*r%3==0;case e.Patterns.PATTERN110:return(n*r%2+n*r%3)%2==0;case e.Patterns.PATTERN111:return(n*r%3+(n+r)%2)%2==0;default:throw Error(`bad maskPattern:`+t)}}e.applyMask=function(e,t){let r=t.size;for(let i=0;i<r;i++)for(let a=0;a<r;a++)t.isReserved(a,i)||t.xor(a,i,n(e,a,i))},e.getBestMask=function(t,n){let r=Object.keys(e.Patterns).length,i=0,a=1/0;for(let o=0;o<r;o++){n(o),e.applyMask(o,t);let r=e.getPenaltyN1(t)+e.getPenaltyN2(t)+e.getPenaltyN3(t)+e.getPenaltyN4(t);e.applyMask(o,t),r<a&&(a=r,i=o)}return i}})),q=t((e=>{var t=K(),n=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],r=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];e.getBlocksCount=function(e,r){switch(r){case t.L:return n[(e-1)*4+0];case t.M:return n[(e-1)*4+1];case t.Q:return n[(e-1)*4+2];case t.H:return n[(e-1)*4+3];default:return}},e.getTotalCodewordsCount=function(e,n){switch(n){case t.L:return r[(e-1)*4+0];case t.M:return r[(e-1)*4+1];case t.Q:return r[(e-1)*4+2];case t.H:return r[(e-1)*4+3];default:return}}})),Ne=t((e=>{var t=new Uint8Array(512),n=new Uint8Array(256);(function(){let e=1;for(let r=0;r<255;r++)t[r]=e,n[e]=r,e<<=1,e&256&&(e^=285);for(let e=255;e<512;e++)t[e]=t[e-255]})(),e.log=function(e){if(e<1)throw Error(`log(`+e+`)`);return n[e]},e.exp=function(e){return t[e]},e.mul=function(e,r){return e===0||r===0?0:t[n[e]+n[r]]}})),Pe=t((e=>{var t=Ne();e.mul=function(e,n){let r=new Uint8Array(e.length+n.length-1);for(let i=0;i<e.length;i++)for(let a=0;a<n.length;a++)r[i+a]^=t.mul(e[i],n[a]);return r},e.mod=function(e,n){let r=new Uint8Array(e);for(;r.length-n.length>=0;){let e=r[0];for(let i=0;i<n.length;i++)r[i]^=t.mul(n[i],e);let i=0;for(;i<r.length&&r[i]===0;)i++;r=r.slice(i)}return r},e.generateECPolynomial=function(n){let r=new Uint8Array([1]);for(let i=0;i<n;i++)r=e.mul(r,new Uint8Array([1,t.exp(i)]));return r}})),Fe=t(((e,t)=>{var n=Pe();function r(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}r.prototype.initialize=function(e){this.degree=e,this.genPoly=n.generateECPolynomial(this.degree)},r.prototype.encode=function(e){if(!this.genPoly)throw Error(`Encoder not initialized`);let t=new Uint8Array(e.length+this.degree);t.set(e);let r=n.mod(t,this.genPoly),i=this.degree-r.length;if(i>0){let e=new Uint8Array(this.degree);return e.set(r,i),e}return r},t.exports=r})),Ie=t((e=>{e.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}})),Le=t((e=>{var t=`[0-9]+`,n=`[A-Z $%*+\\-./:]+`,r=`(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+`;r=r.replace(/u/g,`\\u`);var i=`(?:(?![A-Z0-9 $%*+\\-./:]|`+r+`)(?:.|[\r
2
+ ]))+`;e.KANJI=new RegExp(r,`g`),e.BYTE_KANJI=RegExp(`[^A-Z0-9 $%*+\\-./:]+`,`g`),e.BYTE=new RegExp(i,`g`),e.NUMERIC=new RegExp(t,`g`),e.ALPHANUMERIC=new RegExp(n,`g`);var a=RegExp(`^`+r+`$`),o=RegExp(`^`+t+`$`),s=RegExp(`^[A-Z0-9 $%*+\\-./:]+$`);e.testKanji=function(e){return a.test(e)},e.testNumeric=function(e){return o.test(e)},e.testAlphanumeric=function(e){return s.test(e)}})),J=t((e=>{var t=Ie(),n=Le();e.NUMERIC={id:`Numeric`,bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:`Alphanumeric`,bit:2,ccBits:[9,11,13]},e.BYTE={id:`Byte`,bit:4,ccBits:[8,16,16]},e.KANJI={id:`Kanji`,bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(e,n){if(!e.ccBits)throw Error(`Invalid mode: `+e);if(!t.isValid(n))throw Error(`Invalid version: `+n);return n>=1&&n<10?e.ccBits[0]:n<27?e.ccBits[1]:e.ccBits[2]},e.getBestModeForData=function(t){return n.testNumeric(t)?e.NUMERIC:n.testAlphanumeric(t)?e.ALPHANUMERIC:n.testKanji(t)?e.KANJI:e.BYTE},e.toString=function(e){if(e&&e.id)return e.id;throw Error(`Invalid mode`)},e.isValid=function(e){return e&&e.bit&&e.ccBits};function r(t){if(typeof t!=`string`)throw Error(`Param is not a string`);switch(t.toLowerCase()){case`numeric`:return e.NUMERIC;case`alphanumeric`:return e.ALPHANUMERIC;case`kanji`:return e.KANJI;case`byte`:return e.BYTE;default:throw Error(`Unknown mode: `+t)}}e.from=function(t,n){if(e.isValid(t))return t;try{return r(t)}catch{return n}}})),Re=t((e=>{var t=G(),n=q(),r=K(),i=J(),a=Ie(),o=7973,s=t.getBCHDigit(o);function c(t,n,r){for(let i=1;i<=40;i++)if(n<=e.getCapacity(i,r,t))return i}function l(e,t){return i.getCharCountIndicator(e,t)+4}function u(e,t){let n=0;return e.forEach(function(e){let r=l(e.mode,t);n+=r+e.getBitsLength()}),n}function d(t,n){for(let r=1;r<=40;r++)if(u(t,r)<=e.getCapacity(r,n,i.MIXED))return r}e.from=function(e,t){return a.isValid(e)?parseInt(e,10):t},e.getCapacity=function(e,r,o){if(!a.isValid(e))throw Error(`Invalid QR Code version`);o===void 0&&(o=i.BYTE);let s=(t.getSymbolTotalCodewords(e)-n.getTotalCodewordsCount(e,r))*8;if(o===i.MIXED)return s;let c=s-l(o,e);switch(o){case i.NUMERIC:return Math.floor(c/10*3);case i.ALPHANUMERIC:return Math.floor(c/11*2);case i.KANJI:return Math.floor(c/13);case i.BYTE:default:return Math.floor(c/8)}},e.getBestVersionForData=function(e,t){let n,i=r.from(t,r.M);if(Array.isArray(e)){if(e.length>1)return d(e,i);if(e.length===0)return 1;n=e[0]}else n=e;return c(n.mode,n.getLength(),i)},e.getEncodedBits=function(e){if(!a.isValid(e)||e<7)throw Error(`Invalid QR Code version`);let n=e<<12;for(;t.getBCHDigit(n)-s>=0;)n^=o<<t.getBCHDigit(n)-s;return e<<12|n}})),ze=t((e=>{var t=G(),n=1335,r=21522,i=t.getBCHDigit(n);e.getEncodedBits=function(e,a){let o=e.bit<<3|a,s=o<<10;for(;t.getBCHDigit(s)-i>=0;)s^=n<<t.getBCHDigit(s)-i;return(o<<10|s)^r}})),Be=t(((e,t)=>{var n=J();function r(e){this.mode=n.NUMERIC,this.data=e.toString()}r.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(e){let t,n,r;for(t=0;t+3<=this.data.length;t+=3)n=this.data.substr(t,3),r=parseInt(n,10),e.put(r,10);let i=this.data.length-t;i>0&&(n=this.data.substr(t),r=parseInt(n,10),e.put(r,i*3+1))},t.exports=r})),Ve=t(((e,t)=>{var n=J(),r=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`.split(``);function i(e){this.mode=n.ALPHANUMERIC,this.data=e}i.getBitsLength=function(e){return 11*Math.floor(e/2)+e%2*6},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){let t;for(t=0;t+2<=this.data.length;t+=2){let n=r.indexOf(this.data[t])*45;n+=r.indexOf(this.data[t+1]),e.put(n,11)}this.data.length%2&&e.put(r.indexOf(this.data[t]),6)},t.exports=i})),He=t(((e,t)=>{var n=J();function r(e){this.mode=n.BYTE,typeof e==`string`?this.data=new TextEncoder().encode(e):this.data=new Uint8Array(e)}r.getBitsLength=function(e){return e*8},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(e){for(let t=0,n=this.data.length;t<n;t++)e.put(this.data[t],8)},t.exports=r})),Ue=t(((e,t)=>{var n=J(),r=G();function i(e){this.mode=n.KANJI,this.data=e}i.getBitsLength=function(e){return e*13},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){let t;for(t=0;t<this.data.length;t++){let n=r.toSJIS(this.data[t]);if(n>=33088&&n<=40956)n-=33088;else if(n>=57408&&n<=60351)n-=49472;else throw Error(`Invalid SJIS character: `+this.data[t]+`
3
+ Make sure your charset is UTF-8`);n=(n>>>8&255)*192+(n&255),e.put(n,13)}},t.exports=i})),We=t(((e,t)=>{var n={single_source_shortest_paths:function(e,t,r){var i={},a={};a[t]=0;var o=n.PriorityQueue.make();o.push(t,0);for(var s,c,l,u,d,f,p,m,h;!o.empty();)for(l in s=o.pop(),c=s.value,u=s.cost,d=e[c]||{},d)d.hasOwnProperty(l)&&(f=d[l],p=u+f,m=a[l],h=a[l]===void 0,(h||m>p)&&(a[l]=p,o.push(l,p),i[l]=c));if(r!==void 0&&a[r]===void 0){var g=[`Could not find a path from `,t,` to `,r,`.`].join(``);throw Error(g)}return i},extract_shortest_path_from_predecessor_list:function(e,t){for(var n=[],r=t;r;)n.push(r),e[r],r=e[r];return n.reverse(),n},find_path:function(e,t,r){var i=n.single_source_shortest_paths(e,t,r);return n.extract_shortest_path_from_predecessor_list(i,r)},PriorityQueue:{make:function(e){var t=n.PriorityQueue,r={},i;for(i in e||={},t)t.hasOwnProperty(i)&&(r[i]=t[i]);return r.queue=[],r.sorter=e.sorter||t.default_sorter,r},default_sorter:function(e,t){return e.cost-t.cost},push:function(e,t){var n={value:e,cost:t};this.queue.push(n),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};t!==void 0&&(t.exports=n)})),Ge=t((e=>{var t=J(),n=Be(),r=Ve(),i=He(),a=Ue(),o=Le(),s=G(),c=We();function l(e){return unescape(encodeURIComponent(e)).length}function u(e,t,n){let r=[],i;for(;(i=e.exec(n))!==null;)r.push({data:i[0],index:i.index,mode:t,length:i[0].length});return r}function d(e){let n=u(o.NUMERIC,t.NUMERIC,e),r=u(o.ALPHANUMERIC,t.ALPHANUMERIC,e),i,a;return s.isKanjiModeEnabled()?(i=u(o.BYTE,t.BYTE,e),a=u(o.KANJI,t.KANJI,e)):(i=u(o.BYTE_KANJI,t.BYTE,e),a=[]),n.concat(r,i,a).sort(function(e,t){return e.index-t.index}).map(function(e){return{data:e.data,mode:e.mode,length:e.length}})}function f(e,o){switch(o){case t.NUMERIC:return n.getBitsLength(e);case t.ALPHANUMERIC:return r.getBitsLength(e);case t.KANJI:return a.getBitsLength(e);case t.BYTE:return i.getBitsLength(e)}}function p(e){return e.reduce(function(e,t){let n=e.length-1>=0?e[e.length-1]:null;return n&&n.mode===t.mode?(e[e.length-1].data+=t.data,e):(e.push(t),e)},[])}function m(e){let n=[];for(let r=0;r<e.length;r++){let i=e[r];switch(i.mode){case t.NUMERIC:n.push([i,{data:i.data,mode:t.ALPHANUMERIC,length:i.length},{data:i.data,mode:t.BYTE,length:i.length}]);break;case t.ALPHANUMERIC:n.push([i,{data:i.data,mode:t.BYTE,length:i.length}]);break;case t.KANJI:n.push([i,{data:i.data,mode:t.BYTE,length:l(i.data)}]);break;case t.BYTE:n.push([{data:i.data,mode:t.BYTE,length:l(i.data)}])}}return n}function h(e,n){let r={},i={start:{}},a=[`start`];for(let o=0;o<e.length;o++){let s=e[o],c=[];for(let e=0;e<s.length;e++){let l=s[e],u=``+o+e;c.push(u),r[u]={node:l,lastCount:0},i[u]={};for(let e=0;e<a.length;e++){let o=a[e];r[o]&&r[o].node.mode===l.mode?(i[o][u]=f(r[o].lastCount+l.length,l.mode)-f(r[o].lastCount,l.mode),r[o].lastCount+=l.length):(r[o]&&(r[o].lastCount=l.length),i[o][u]=f(l.length,l.mode)+4+t.getCharCountIndicator(l.mode,n))}}a=c}for(let e=0;e<a.length;e++)i[a[e]].end=0;return{map:i,table:r}}function g(e,o){let c,l=t.getBestModeForData(e);if(c=t.from(o,l),c!==t.BYTE&&c.bit<l.bit)throw Error(`"`+e+`" cannot be encoded with mode `+t.toString(c)+`.
4
+ Suggested mode is: `+t.toString(l));switch(c===t.KANJI&&!s.isKanjiModeEnabled()&&(c=t.BYTE),c){case t.NUMERIC:return new n(e);case t.ALPHANUMERIC:return new r(e);case t.KANJI:return new a(e);case t.BYTE:return new i(e)}}e.fromArray=function(e){return e.reduce(function(e,t){return typeof t==`string`?e.push(g(t,null)):t.data&&e.push(g(t.data,t.mode)),e},[])},e.fromString=function(t,n){let r=h(m(d(t,s.isKanjiModeEnabled())),n),i=c.find_path(r.map,`start`,`end`),a=[];for(let e=1;e<i.length-1;e++)a.push(r.table[i[e]].node);return e.fromArray(p(a))},e.rawSplit=function(t){return e.fromArray(d(t,s.isKanjiModeEnabled()))}})),Ke=t((e=>{var t=G(),n=K(),r=Oe(),i=ke(),a=Ae(),o=je(),s=Me(),c=q(),l=Fe(),u=Re(),d=ze(),f=J(),p=Ge();function m(e,t){let n=e.size,r=o.getPositions(t);for(let t=0;t<r.length;t++){let i=r[t][0],a=r[t][1];for(let t=-1;t<=7;t++)if(!(i+t<=-1||n<=i+t))for(let r=-1;r<=7;r++)a+r<=-1||n<=a+r||(t>=0&&t<=6&&(r===0||r===6)||r>=0&&r<=6&&(t===0||t===6)||t>=2&&t<=4&&r>=2&&r<=4?e.set(i+t,a+r,!0,!0):e.set(i+t,a+r,!1,!0))}}function h(e){let t=e.size;for(let n=8;n<t-8;n++){let t=n%2==0;e.set(n,6,t,!0),e.set(6,n,t,!0)}}function g(e,t){let n=a.getPositions(t);for(let t=0;t<n.length;t++){let r=n[t][0],i=n[t][1];for(let t=-2;t<=2;t++)for(let n=-2;n<=2;n++)t===-2||t===2||n===-2||n===2||t===0&&n===0?e.set(r+t,i+n,!0,!0):e.set(r+t,i+n,!1,!0)}}function _(e,t){let n=e.size,r=u.getEncodedBits(t),i,a,o;for(let t=0;t<18;t++)i=Math.floor(t/3),a=t%3+n-8-3,o=(r>>t&1)==1,e.set(i,a,o,!0),e.set(a,i,o,!0)}function v(e,t,n){let r=e.size,i=d.getEncodedBits(t,n),a,o;for(a=0;a<15;a++)o=(i>>a&1)==1,a<6?e.set(a,8,o,!0):a<8?e.set(a+1,8,o,!0):e.set(r-15+a,8,o,!0),a<8?e.set(8,r-a-1,o,!0):a<9?e.set(8,15-a-1+1,o,!0):e.set(8,15-a-1,o,!0);e.set(r-8,8,1,!0)}function y(e,t){let n=e.size,r=-1,i=n-1,a=7,o=0;for(let s=n-1;s>0;s-=2)for(s===6&&s--;;){for(let n=0;n<2;n++)if(!e.isReserved(i,s-n)){let r=!1;o<t.length&&(r=(t[o]>>>a&1)==1),e.set(i,s-n,r),a--,a===-1&&(o++,a=7)}if(i+=r,i<0||n<=i){i-=r,r=-r;break}}}function b(e,n,i){let a=new r;i.forEach(function(t){a.put(t.mode.bit,4),a.put(t.getLength(),f.getCharCountIndicator(t.mode,e)),t.write(a)});let o=(t.getSymbolTotalCodewords(e)-c.getTotalCodewordsCount(e,n))*8;for(a.getLengthInBits()+4<=o&&a.put(0,4);a.getLengthInBits()%8!=0;)a.putBit(0);let s=(o-a.getLengthInBits())/8;for(let e=0;e<s;e++)a.put(e%2?17:236,8);return x(a,e,n)}function x(e,n,r){let i=t.getSymbolTotalCodewords(n),a=i-c.getTotalCodewordsCount(n,r),o=c.getBlocksCount(n,r),s=o-i%o,u=Math.floor(i/o),d=Math.floor(a/o),f=d+1,p=u-d,m=new l(p),h=0,g=Array(o),_=Array(o),v=0,y=new Uint8Array(e.buffer);for(let e=0;e<o;e++){let t=e<s?d:f;g[e]=y.slice(h,h+t),_[e]=m.encode(g[e]),h+=t,v=Math.max(v,t)}let b=new Uint8Array(i),x=0,S,C;for(S=0;S<v;S++)for(C=0;C<o;C++)S<g[C].length&&(b[x++]=g[C][S]);for(S=0;S<p;S++)for(C=0;C<o;C++)b[x++]=_[C][S];return b}function S(e,n,r,a){let o;if(Array.isArray(e))o=p.fromArray(e);else if(typeof e==`string`){let t=n;if(!t){let n=p.rawSplit(e);t=u.getBestVersionForData(n,r)}o=p.fromString(e,t||40)}else throw Error(`Invalid data`);let c=u.getBestVersionForData(o,r);if(!c)throw Error(`The amount of data is too big to be stored in a QR Code`);if(!n)n=c;else if(n<c)throw Error(`
5
+ The chosen QR Code version cannot contain this amount of data.
6
+ Minimum version required to store current data is: `+c+`.
7
+ `);let l=b(n,r,o),d=new i(t.getSymbolSize(n));return m(d,n),h(d),g(d,n),v(d,r,0),n>=7&&_(d,n),y(d,l),isNaN(a)&&(a=s.getBestMask(d,v.bind(null,d,r))),s.applyMask(a,d),v(d,r,a),{modules:d,version:n,errorCorrectionLevel:r,maskPattern:a,segments:o}}e.create=function(e,r){if(e===void 0||e===``)throw Error(`No input text`);let i=n.M,a,o;return r!==void 0&&(i=n.from(r.errorCorrectionLevel,n.M),a=u.from(r.version),o=s.from(r.maskPattern),r.toSJISFunc&&t.setToSJISFunction(r.toSJISFunc)),S(e,a,i,o)}})),qe=t((e=>{function t(e){if(typeof e==`number`&&(e=e.toString()),typeof e!=`string`)throw Error(`Color should be defined as hex string`);let t=e.slice().replace(`#`,``).split(``);if(t.length<3||t.length===5||t.length>8)throw Error(`Invalid hex color: `+e);(t.length===3||t.length===4)&&(t=Array.prototype.concat.apply([],t.map(function(e){return[e,e]}))),t.length===6&&t.push(`F`,`F`);let n=parseInt(t.join(``),16);return{r:n>>24&255,g:n>>16&255,b:n>>8&255,a:n&255,hex:`#`+t.slice(0,6).join(``)}}e.getOptions=function(e){e||={},e.color||={};let n=e.margin===void 0||e.margin===null||e.margin<0?4:e.margin,r=e.width&&e.width>=21?e.width:void 0,i=e.scale||4;return{width:r,scale:r?4:i,margin:n,color:{dark:t(e.color.dark||`#000000ff`),light:t(e.color.light||`#ffffffff`)},type:e.type,rendererOpts:e.rendererOpts||{}}},e.getScale=function(e,t){return t.width&&t.width>=e+t.margin*2?t.width/(e+t.margin*2):t.scale},e.getImageWidth=function(t,n){let r=e.getScale(t,n);return Math.floor((t+n.margin*2)*r)},e.qrToImageData=function(t,n,r){let i=n.modules.size,a=n.modules.data,o=e.getScale(i,r),s=Math.floor((i+r.margin*2)*o),c=r.margin*o,l=[r.color.light,r.color.dark];for(let e=0;e<s;e++)for(let n=0;n<s;n++){let u=(e*s+n)*4,d=r.color.light;if(e>=c&&n>=c&&e<s-c&&n<s-c){let t=Math.floor((e-c)/o),r=Math.floor((n-c)/o);d=l[a[t*i+r]?1:0]}t[u++]=d.r,t[u++]=d.g,t[u++]=d.b,t[u]=d.a}}})),Je=t((e=>{var t=qe();function n(e,t,n){e.clearRect(0,0,t.width,t.height),t.style||={},t.height=n,t.width=n,t.style.height=n+`px`,t.style.width=n+`px`}function r(){try{return document.createElement(`canvas`)}catch{throw Error(`You need to specify a canvas element`)}}e.render=function(e,i,a){let o=a,s=i;o===void 0&&(!i||!i.getContext)&&(o=i,i=void 0),i||(s=r()),o=t.getOptions(o);let c=t.getImageWidth(e.modules.size,o),l=s.getContext(`2d`),u=l.createImageData(c,c);return t.qrToImageData(u.data,e,o),n(l,s,c),l.putImageData(u,0,0),s},e.renderToDataURL=function(t,n,r){let i=r;i===void 0&&(!n||!n.getContext)&&(i=n,n=void 0),i||={};let a=e.render(t,n,i),o=i.type||`image/png`,s=i.rendererOpts||{};return a.toDataURL(o,s.quality)}})),Ye=t((e=>{var t=qe();function n(e,t){let n=e.a/255,r=t+`="`+e.hex+`"`;return n<1?r+` `+t+`-opacity="`+n.toFixed(2).slice(1)+`"`:r}function r(e,t,n){let r=e+t;return n!==void 0&&(r+=` `+n),r}function i(e,t,n){let i=``,a=0,o=!1,s=0;for(let c=0;c<e.length;c++){let l=Math.floor(c%t),u=Math.floor(c/t);!l&&!o&&(o=!0),e[c]?(s++,c>0&&l>0&&e[c-1]||(i+=o?r(`M`,l+n,.5+u+n):r(`m`,a,0),a=0,o=!1),l+1<t&&e[c+1]||(i+=r(`h`,s),s=0)):a++}return i}e.render=function(e,r,a){let o=t.getOptions(r),s=e.modules.size,c=e.modules.data,l=s+o.margin*2,u=o.color.light.a?`<path `+n(o.color.light,`fill`)+` d="M0 0h`+l+`v`+l+`H0z"/>`:``,d=`<path `+n(o.color.dark,`stroke`)+` d="`+i(c,s,o.margin)+`"/>`,f=`viewBox="0 0 `+l+` `+l+`"`,p=`<svg xmlns="http://www.w3.org/2000/svg" `+(o.width?`width="`+o.width+`" height="`+o.width+`" `:``)+f+` shape-rendering="crispEdges">`+u+d+`</svg>
8
+ `;return typeof a==`function`&&a(null,p),p}})),Xe=t((e=>{var t=De(),n=Ke(),r=Je(),i=Ye();function a(e,r,i,a,o){let s=[].slice.call(arguments,1),c=s.length,l=typeof s[c-1]==`function`;if(!l&&!t())throw Error(`Callback required as last argument`);if(l){if(c<2)throw Error(`Too few arguments provided`);c===2?(o=i,i=r,r=a=void 0):c===3&&(r.getContext&&o===void 0?(o=a,a=void 0):(o=a,a=i,i=r,r=void 0))}else{if(c<1)throw Error(`Too few arguments provided`);return c===1?(i=r,r=a=void 0):c===2&&!r.getContext&&(a=i,i=r,r=void 0),new Promise(function(t,o){try{t(e(n.create(i,a),r,a))}catch(e){o(e)}})}try{let t=n.create(i,a);o(null,e(t,r,a))}catch(e){o(e)}}e.create=n.create,e.toCanvas=a.bind(null,r.render),e.toDataURL=a.bind(null,r.renderToDataURL),e.toString=a.bind(null,function(e,t,n){return i.render(e,n)})}))();function Ze(){return u({mutationFn:({channel:e,data:t})=>y(e,t)})}function Qe(){return u({mutationFn:({channel:e,data:t})=>S(e,t)})}function $e(){return u({mutationFn:({channel:e,data:t})=>x(e,t)})}var et={weixin:{title:`weixinAuthTitle`,description:`weixinAuthDescription`,hint:`weixinAuthHint`,capabilityHint:`weixinAuthCapabilityHint`,disabledHint:`weixinAuthDisabledHint`,connect:`weixinAuthConnect`,qrAlt:`weixinAuthQrAlt`,scanPrompt:`weixinAuthScanPrompt`,readyTitle:`weixinAuthReadyTitle`,readyDescription:`weixinAuthReadyDescription`,advancedTitle:`weixinAuthAdvancedTitle`,advancedDescription:`weixinAuthAdvancedDescription`},feishu:{title:`feishuAuthTitle`,description:`feishuAuthDescription`,hint:`feishuAuthHint`,capabilityHint:`feishuAuthCapabilityHint`,disabledHint:`feishuAuthDisabledHint`,connect:`feishuAuthConnect`,qrAlt:`feishuAuthQrAlt`,scanPrompt:`feishuAuthScanPrompt`,readyTitle:`feishuAuthReadyTitle`,readyDescription:`feishuAuthReadyDescription`,advancedTitle:`feishuAuthAdvancedTitle`,advancedDescription:`feishuAuthAdvancedDescription`,domainLabel:`feishuAuthDomain`}};function tt(e){let{accounts:t}=e,n=new Set;if(typeof e.defaultAccountId==`string`&&e.defaultAccountId.trim()&&n.add(e.defaultAccountId.trim()),t&&typeof t==`object`&&!Array.isArray(t))for(let e of Object.keys(t)){let t=e.trim();t&&n.add(t)}return[...n]}function nt(e,t){if(typeof e.baseUrl==`string`&&e.baseUrl.trim())return e.baseUrl.trim();if(typeof t.baseUrl==`string`&&t.baseUrl.trim())return t.baseUrl.trim()}function rt(e,t){return(typeof e.domain==`string`?e.domain.trim():``)||(typeof t.domain==`string`?t.domain.trim():``)||void 0}function it(e,t){return rt(e,t)===`lark`?`lark`:`feishu`}function at(e){return e===`lark`?`https://open.larksuite.com/app`:`https://open.feishu.cn/app`}function ot(e,t){return h({queryKey:[`channel-qr`,e,t],enabled:!!t,queryFn:()=>(0,Xe.toDataURL)(t,{errorCorrectionLevel:`M`,margin:1,width:480})}).data??null}function st({activeSession:e,baseUrl:t,channelEnabled:n,copy:r,connectButtonLabel:i,connectedAccountIds:s,disabled:c,domain:l,handleStartAuth:u,hasConnectedAccount:d,primaryAccountId:p,statusLabel:m}){return(0,W.jsxs)(`div`,{className:`space-y-3`,children:[(0,W.jsxs)(`div`,{className:`inline-flex items-center gap-2 rounded-full bg-white/90 px-3 py-1 text-xs font-medium text-primary shadow-sm`,children:[(0,W.jsx)(H,{className:`h-3.5 w-3.5`}),a(r.title)]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`h4`,{className:`text-base font-semibold text-gray-900`,children:a(r.description)}),(0,W.jsx)(`p`,{className:`mt-1 text-sm text-gray-600`,children:a(r.hint)})]}),(0,W.jsxs)(`div`,{className:o(`inline-flex w-fit items-center gap-2 rounded-full px-3 py-1 text-xs font-medium`,e?`bg-amber-50 text-amber-700`:d?`bg-emerald-50 text-emerald-700`:`bg-gray-100 text-gray-600`),children:[e?(0,W.jsx)(M,{className:`h-3.5 w-3.5 animate-spin`}):(0,W.jsx)(V,{className:`h-3.5 w-3.5`}),m]}),(0,W.jsxs)(`div`,{className:`space-y-1 text-sm text-gray-600`,children:[(0,W.jsx)(`p`,{children:a(n||!d?r.capabilityHint:r.disabledHint)}),p?(0,W.jsxs)(`p`,{children:[a(`weixinAuthPrimaryAccount`),`: `,(0,W.jsx)(`span`,{className:`font-mono text-xs text-gray-900`,children:p})]}):null,s.length>1?(0,W.jsxs)(`p`,{children:[a(`weixinAuthConnectedAccounts`),`: `,(0,W.jsx)(`span`,{className:`font-mono text-xs text-gray-900`,children:s.join(`, `)})]}):null,t?(0,W.jsxs)(`p`,{children:[a(`weixinAuthBaseUrl`),`: `,(0,W.jsx)(`span`,{className:`font-mono text-xs text-gray-900`,children:t})]}):null,l&&r.domainLabel?(0,W.jsxs)(`p`,{children:[a(r.domainLabel),`: `,(0,W.jsx)(`span`,{className:`font-mono text-xs text-gray-900`,children:l})]}):null]}),(0,W.jsx)(f,{type:`button`,onClick:()=>void u(),disabled:c,className:`rounded-xl`,children:i})]})}function ct({activeSession:e,authMessage:t,copy:n,qrDataUrl:i}){return(0,W.jsx)(`div`,{className:`w-full max-w-sm rounded-2xl border border-dashed border-primary/25 bg-white/85 p-4 shadow-sm`,children:e?(0,W.jsxs)(`div`,{className:`space-y-3`,children:[(0,W.jsx)(`div`,{className:`overflow-hidden rounded-2xl border border-gray-100 bg-white p-3`,children:i?(0,W.jsx)(`img`,{src:i,alt:a(n.qrAlt),className:`mx-auto aspect-square w-full max-w-[240px] object-contain`}):(0,W.jsx)(`div`,{className:`flex aspect-square w-full items-center justify-center rounded-xl bg-gray-50 text-gray-500`,children:(0,W.jsxs)(`div`,{className:`flex flex-col items-center gap-2 text-center`,children:[(0,W.jsx)(M,{className:`h-5 w-5 animate-spin`}),(0,W.jsx)(`p`,{className:`text-xs`,children:a(`weixinAuthStarting`)})]})})}),(0,W.jsxs)(`div`,{className:`space-y-1 text-xs text-gray-500`,children:[(0,W.jsx)(`p`,{children:t||e.note||a(n.scanPrompt)}),(0,W.jsxs)(`p`,{children:[a(`weixinAuthExpiresAt`),`: `,r(e.expiresAt)]})]}),(0,W.jsxs)(`a`,{href:e.qrCodeUrl,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1.5 text-xs text-primary transition-colors hover:text-primary-hover`,children:[(0,W.jsx)(A,{className:`h-3.5 w-3.5`}),a(`weixinAuthOpenQr`)]})]}):(0,W.jsxs)(`div`,{className:`flex min-h-[280px] flex-col items-center justify-center rounded-2xl bg-gray-50/80 px-6 text-center`,children:[(0,W.jsx)(H,{className:`h-9 w-9 text-gray-300`}),(0,W.jsx)(`p`,{className:`mt-3 text-sm font-medium text-gray-700`,children:a(n.readyTitle)}),(0,W.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-gray-500`,children:a(n.readyDescription)})]})})}function lt({channelConfig:e,channelEnabled:t,channelName:n,disabled:r,formData:i}){let o=v(),s=Ze(),c=Qe(),[l,u]=(0,U.useState)(null),[d,f]=(0,U.useState)(null),[p,m]=(0,U.useState)(!1),h=(0,U.useMemo)(()=>tt(e),[e]),_=h[0],y=nt(i,e),b=n===`feishu`?rt(i,e):void 0,x=h.length>0,S=x&&!p?null:l,C=ot(n,S?.qrCodeUrl),w=et[n];(0,U.useEffect)(()=>{if(!S)return;let e=!1,t=null,r=async()=>{try{let i=await c.mutateAsync({channel:n,data:{sessionId:S.sessionId}});if(e)return;if(f(i),i.status===`authorized`){await o.invalidateQueries({queryKey:[`config`]}),await o.invalidateQueries({queryKey:[`config-meta`]}),g.success(i.message||a(`weixinAuthAuthorized`)),u(null);return}if(i.status===`expired`||i.status===`error`){g.error(i.message||a(`weixinAuthRetryRequired`)),u(null);return}t=setTimeout(r,i.nextPollMs??S.intervalMs)}catch(t){e||(g.error(`${a(`error`)}: ${t instanceof Error?t.message:String(t)}`),u(null))}};return t=setTimeout(r,S.intervalMs),()=>{e=!0,t&&clearTimeout(t)}},[n,S,c,o]);let T=async()=>{try{let e=await s.mutateAsync({channel:n,data:{baseUrl:y,domain:b,accountId:typeof i.defaultAccountId==`string`&&i.defaultAccountId.trim()?i.defaultAccountId.trim():void 0}});m(x),u(e),f({channel:n,status:`pending`,message:e.note,nextPollMs:e.intervalMs})}catch(e){g.error(`${a(`error`)}: ${e instanceof Error?e.message:String(e)}`)}},E=S?d?.status===`scanned`?a(`weixinAuthScanned`):a(`weixinAuthWaiting`):a(x?t?`weixinAuthAuthorized`:`weixinAuthConnectedDisabled`:`weixinAuthNotConnected`),D=s.isPending?a(`weixinAuthStarting`):a(S?`weixinAuthWaiting`:x?`weixinAuthReconnect`:w.connect),O=x?a(`weixinAuthAuthorized`):d?.message;return(0,W.jsx)(`section`,{className:`rounded-2xl border border-primary/20 bg-gradient-to-br from-primary-50/70 via-white to-emerald-50/60 p-5`,children:(0,W.jsxs)(`div`,{className:`flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between`,children:[(0,W.jsx)(st,{activeSession:S,baseUrl:y,channelEnabled:t,copy:w,connectButtonLabel:D,connectedAccountIds:h,disabled:r||s.isPending||!!S,domain:b,handleStartAuth:T,hasConnectedAccount:x,primaryAccountId:_,statusLabel:E}),(0,W.jsx)(ct,{activeSession:S,authMessage:O,copy:w,qrDataUrl:C})]})})}function ut({channelConfig:e,disabled:t,formData:n}){let r=v(),i=$e(),[o,s]=(0,U.useState)(()=>it(n,e)),[c,u]=(0,U.useState)(``),[p,m]=(0,U.useState)(``),h=at(o),_=!!(c.trim()&&p.trim())&&!t&&!i.isPending,y=async()=>{try{let e=await i.mutateAsync({channel:`feishu`,data:{domain:o,fields:{appId:c.trim(),appSecret:p.trim()}}});await r.invalidateQueries({queryKey:[`config`]}),await r.invalidateQueries({queryKey:[`config-meta`]}),g.success(e.message||a(`feishuExistingAgentConnectSuccess`)),m(``)}catch(e){g.error(`${a(`error`)}: ${e instanceof Error?e.message:String(e)}`)}};return(0,W.jsx)(`section`,{className:`rounded-2xl border border-primary/20 bg-white p-5`,children:(0,W.jsxs)(`div`,{className:`flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between`,children:[(0,W.jsxs)(`div`,{className:`max-w-xl space-y-3`,children:[(0,W.jsxs)(`div`,{className:`inline-flex items-center gap-2 rounded-full bg-gray-100 px-3 py-1 text-xs font-medium text-gray-700`,children:[(0,W.jsx)(V,{className:`h-3.5 w-3.5`}),a(`feishuExistingAgentTitle`)]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`h4`,{className:`text-base font-semibold text-gray-900`,children:a(`feishuExistingAgentDescription`)}),(0,W.jsx)(`p`,{className:`mt-1 text-sm text-gray-600`,children:a(`feishuExistingAgentHint`)})]}),(0,W.jsxs)(`a`,{href:h,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1.5 text-sm text-primary transition-colors hover:text-primary-hover`,children:[(0,W.jsx)(A,{className:`h-4 w-4`}),a(o===`lark`?`feishuExistingAgentOpenLarkList`:`feishuExistingAgentOpenFeishuList`)]})]}),(0,W.jsxs)(`div`,{className:`w-full max-w-sm space-y-4`,children:[(0,W.jsxs)(`div`,{className:`space-y-2`,children:[(0,W.jsx)(l,{htmlFor:`feishu-existing-platform`,children:a(`feishuPlatform`)}),(0,W.jsxs)(k,{value:o,onValueChange:e=>s(e===`lark`?`lark`:`feishu`),children:[(0,W.jsx)(E,{id:`feishu-existing-platform`,className:`rounded-xl`,children:(0,W.jsx)(T,{})}),(0,W.jsxs)(D,{children:[(0,W.jsx)(O,{value:`feishu`,children:`Feishu`}),(0,W.jsx)(O,{value:`lark`,children:`Lark`})]})]})]}),(0,W.jsxs)(`div`,{className:`space-y-2`,children:[(0,W.jsx)(l,{htmlFor:`feishu-existing-app-id`,children:`App ID`}),(0,W.jsx)(d,{id:`feishu-existing-app-id`,value:c,onChange:e=>u(e.target.value),className:`rounded-xl`})]}),(0,W.jsxs)(`div`,{className:`space-y-2`,children:[(0,W.jsx)(l,{htmlFor:`feishu-existing-app-secret`,children:`App Secret`}),(0,W.jsx)(d,{id:`feishu-existing-app-secret`,type:`password`,value:p,onChange:e=>m(e.target.value),className:`rounded-xl`})]}),(0,W.jsx)(f,{type:`button`,onClick:()=>void y(),disabled:!_,className:`w-full rounded-xl`,children:i.isPending?a(`feishuExistingAgentConnecting`):a(`feishuExistingAgentConnect`)})]})]})})}function dt(e){let[t,n]=(0,U.useState)(`create`);return(0,W.jsxs)(ie,{value:t,onValueChange:e=>n(e===`existing`?`existing`:`create`),children:[(0,W.jsxs)(ne,{children:[(0,W.jsx)(j,{value:`create`,children:a(`feishuAuthCreateNew`)}),(0,W.jsx)(j,{value:`existing`,children:a(`feishuAuthConnectExisting`)})]}),(0,W.jsx)(de,{value:`create`,className:`mt-4`,children:(0,W.jsx)(lt,{...e,channelName:`feishu`})}),(0,W.jsx)(de,{value:`existing`,className:`mt-4`,children:(0,W.jsx)(ut,{...e})})]})}var ft=[{value:`pairing`,label:`pairing`},{value:`allowlist`,label:`allowlist`},{value:`open`,label:`open`},{value:`disabled`,label:`disabled`}],Y=[{value:`open`,label:`open`},{value:`allowlist`,label:`allowlist`},{value:`disabled`,label:`disabled`}],pt=[{value:`feishu`,label:`feishu`},{value:`lark`,label:`lark`}],mt=[{value:`off`,label:`off`},{value:`partial`,label:`partial`},{value:`block`,label:`block`},{value:`progress`,label:`progress`}];function ht(){return{fields:[{name:`enabled`,type:`boolean`,label:a(`enabled`),section:`primary`},{name:`defaultAccountId`,type:`text`,label:a(`defaultAccountId`)},{name:`domain`,type:`select`,label:a(`feishuAuthDomain`),options:pt},{name:`allowFrom`,type:`tags`,label:a(`allowFrom`)},{name:`groupPolicy`,type:`select`,label:a(`groupPolicy`),options:Y},{name:`requireMention`,type:`boolean`,label:a(`requireMention`)},{name:`accounts`,type:`json`,label:a(`accountsJson`)}],layout:[{type:`fields`,section:`primary`},{type:`custom`,sectionId:`feishu-auth`},{type:`fields`,section:`advanced`,collapsible:{title:a(`feishuAuthAdvancedTitle`),description:a(`feishuAuthAdvancedDescription`)}}]}}function gt(){return{telegram:{fields:[{name:`enabled`,type:`boolean`,label:a(`enabled`)},{name:`token`,type:`password`,label:a(`botToken`)},{name:`allowFrom`,type:`tags`,label:a(`allowFrom`)},{name:`proxy`,type:`text`,label:a(`proxy`)},{name:`accountId`,type:`text`,label:a(`accountId`)},{name:`dmPolicy`,type:`select`,label:a(`dmPolicy`),options:ft},{name:`groupPolicy`,type:`select`,label:a(`groupPolicy`),options:Y},{name:`groupAllowFrom`,type:`tags`,label:a(`groupAllowFrom`)},{name:`requireMention`,type:`boolean`,label:a(`requireMention`)},{name:`mentionPatterns`,type:`tags`,label:a(`mentionPatterns`)},{name:`groups`,type:`json`,label:a(`groupRulesJson`)}]},discord:{fields:[{name:`enabled`,type:`boolean`,label:a(`enabled`)},{name:`token`,type:`password`,label:a(`botToken`)},{name:`allowBots`,type:`boolean`,label:a(`allowBotMessages`)},{name:`allowFrom`,type:`tags`,label:a(`allowFrom`)},{name:`gatewayUrl`,type:`text`,label:a(`gatewayUrl`)},{name:`intents`,type:`number`,label:a(`intents`)},{name:`proxy`,type:`text`,label:a(`proxy`)},{name:`mediaMaxMb`,type:`number`,label:a(`attachmentMaxSizeMb`)},{name:`streaming`,type:`select`,label:a(`streamingMode`),options:mt},{name:`draftChunk`,type:`json`,label:a(`draftChunkingJson`)},{name:`textChunkLimit`,type:`number`,label:a(`textChunkLimit`)},{name:`accountId`,type:`text`,label:a(`accountId`)},{name:`dmPolicy`,type:`select`,label:a(`dmPolicy`),options:ft},{name:`groupPolicy`,type:`select`,label:a(`groupPolicy`),options:Y},{name:`groupAllowFrom`,type:`tags`,label:a(`groupAllowFrom`)},{name:`requireMention`,type:`boolean`,label:a(`requireMention`)},{name:`mentionPatterns`,type:`tags`,label:a(`mentionPatterns`)},{name:`groups`,type:`json`,label:a(`groupRulesJson`)}]},whatsapp:{fields:[{name:`enabled`,type:`boolean`,label:a(`enabled`)},{name:`bridgeUrl`,type:`text`,label:a(`bridgeUrl`)},{name:`allowFrom`,type:`tags`,label:a(`allowFrom`)}]},feishu:ht(),dingtalk:{fields:[{name:`enabled`,type:`boolean`,label:a(`enabled`)},{name:`clientId`,type:`text`,label:a(`clientId`)},{name:`clientSecret`,type:`password`,label:a(`clientSecret`)},{name:`allowFrom`,type:`tags`,label:a(`allowFrom`)}]},wecom:{fields:[{name:`enabled`,type:`boolean`,label:a(`enabled`)},{name:`corpId`,type:`text`,label:a(`corpId`)},{name:`agentId`,type:`text`,label:a(`agentId`)},{name:`secret`,type:`password`,label:a(`secret`)},{name:`token`,type:`password`,label:a(`token`)},{name:`callbackPort`,type:`number`,label:a(`callbackPort`)},{name:`callbackPath`,type:`text`,label:a(`callbackPath`)},{name:`allowFrom`,type:`tags`,label:a(`allowFrom`)}]},weixin:{fields:[{name:`enabled`,type:`boolean`,label:a(`enabled`),section:`primary`},{name:`defaultAccountId`,type:`text`,label:a(`defaultAccountId`)},{name:`baseUrl`,type:`text`,label:a(`baseUrl`)},{name:`pollTimeoutMs`,type:`number`,label:a(`pollTimeoutMs`)},{name:`allowFrom`,type:`tags`,label:a(`allowFrom`)},{name:`accounts`,type:`json`,label:a(`accountsJson`)}],layout:[{type:`fields`,section:`primary`},{type:`custom`,sectionId:`weixin-auth`},{type:`fields`,section:`advanced`,collapsible:{title:a(`weixinAuthAdvancedTitle`),description:a(`weixinAuthAdvancedDescription`)}}]},slack:{fields:[{name:`enabled`,type:`boolean`,label:a(`enabled`)},{name:`mode`,type:`text`,label:a(`mode`)},{name:`webhookPath`,type:`text`,label:a(`webhookPath`)},{name:`allowBots`,type:`boolean`,label:a(`allowBotMessages`)},{name:`botToken`,type:`password`,label:a(`botToken`)},{name:`appToken`,type:`password`,label:a(`appToken`)}]},email:{fields:[{name:`enabled`,type:`boolean`,label:a(`enabled`)},{name:`consentGranted`,type:`boolean`,label:a(`consentGranted`)},{name:`imapHost`,type:`text`,label:a(`imapHost`)},{name:`imapPort`,type:`number`,label:a(`imapPort`)},{name:`imapUsername`,type:`text`,label:a(`imapUsername`)},{name:`imapPassword`,type:`password`,label:a(`imapPassword`)},{name:`fromAddress`,type:`email`,label:a(`fromAddress`)}]},qq:{fields:[{name:`enabled`,type:`boolean`,label:a(`enabled`)},{name:`appId`,type:`text`,label:a(`appId`)},{name:`secret`,type:`password`,label:a(`appSecret`)},{name:`markdownSupport`,type:`boolean`,label:a(`markdownSupport`)},{name:`allowFrom`,type:`tags`,label:a(`allowFrom`)}]}}}function _t(t){let n=e();return t.tutorialUrls?.[n]||t.tutorialUrls?.default||t.tutorialUrl}var vt=[],yt=[{type:`fields`,section:`all`}],X=new Set,Z=new Map,Q=null;function $(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function bt(e,t){let n={...e};for(let[e,r]of Object.entries(t))n[e]=$(n[e])&&$(r)?bt(n[e],r):r;return n}function xt(e,t){let n={},r=n,i=e.split(`.`);for(let e=0;e<i.length-1;e+=1)r[i[e]]={},r=r[i[e]];return r[i[i.length-1]]=t,n}function St(e,t){return t===`all`?e:e.filter(e=>t===`primary`?e.section===`primary`:e.section!==`primary`)}function Ct(e,t){let n={};return t.filter(e=>e.type===`json`).forEach(t=>{n[t.name]=JSON.stringify(e[t.name]??{},null,2)}),n}function wt(){Q||=_.eventBus.on(c.channelConfigApplyStatus,e=>{Z.set(e.channel,e.status===`started`?{status:`applying`}:e.status===`succeeded`?{status:`applied`}:{status:`failed`,message:e.message}),X.forEach(e=>e())})}function Tt(e){return X.add(e),wt(),()=>{X.delete(e),!X.size&&Q&&(Q(),Q=null,Z.clear())}}function Et(e){return(0,U.useSyncExternalStore)(Tt,()=>e?Z.get(e)??null:null,()=>null)}function Dt(e){return e?e.status===`applying`?{className:`text-amber-600`,label:a(`channelConfigApplying`)}:e.status===`applied`?{className:`text-emerald-600`,label:a(`channelConfigApplied`)}:{className:`text-red-600`,label:`${a(`channelConfigApplyFailed`)}${e.message?`: ${e.message}`:``}`}:null}function Ot({channelApplyStatus:e,channelLabel:t,channelName:n,enabled:r,tutorialUrl:i}){return(0,W.jsx)(z,{className:`px-6 py-5`,children:(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,W.jsxs)(`div`,{className:`min-w-0`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,W.jsx)(le,{name:n,src:N(n),className:o(`h-9 w-9 rounded-lg border`,r?`border-primary/30 bg-white`:`border-gray-200/70 bg-white`),imgClassName:`h-5 w-5 object-contain`,fallback:(0,W.jsx)(`span`,{className:`text-sm font-semibold uppercase text-gray-500`,children:n[0]})}),(0,W.jsx)(`h3`,{className:`truncate text-lg font-semibold text-gray-900 capitalize`,children:t})]}),(0,W.jsx)(`p`,{className:`mt-2 text-sm text-gray-500`,children:a(`channelsFormDescription`)}),e?(0,W.jsx)(`p`,{className:o(`mt-2 text-xs font-medium`,e.className),children:e.label}):null,i?(0,W.jsxs)(`a`,{href:i,className:`mt-2 inline-flex items-center gap-1.5 text-xs text-primary transition-colors hover:text-primary-hover`,children:[(0,W.jsx)(oe,{className:`h-3.5 w-3.5`}),a(`channelsGuideTitle`)]}):null]}),(0,W.jsx)(se,{status:r?`active`:`inactive`,label:a(r?`statusActive`:`statusInactive`)})]})})}function kt({channelConfig:e,channelName:t,disabled:n,enabled:r,fields:i,formData:a,jsonDrafts:o,layoutBlocks:s,setJsonDrafts:c,uiHints:l,updateField:u}){return(0,W.jsx)(W.Fragment,{children:s.map((s,d)=>{if(s.type===`fields`){let e=St(i,s.section);if(e.length===0)return null;let n=(0,W.jsx)(Ee,{channelName:t,fields:e,formData:a,jsonDrafts:o,setJsonDrafts:c,updateField:u,uiHints:l});return s.collapsible?(0,W.jsxs)(`details`,{className:`group rounded-2xl border border-gray-200/80 bg-white`,children:[(0,W.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center justify-between gap-3 px-5 py-4 text-sm font-medium text-gray-900`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`p`,{children:s.collapsible.title}),s.collapsible.description?(0,W.jsx)(`p`,{className:`mt-1 text-xs font-normal text-gray-500`,children:s.collapsible.description}):null]}),(0,W.jsx)(w,{className:`h-4 w-4 text-gray-400 transition-transform group-open:rotate-180`})]}),(0,W.jsx)(`div`,{className:`space-y-6 border-t border-gray-100 px-5 py-5`,children:n})]},`${s.type}-${s.section}-${d}`):(0,W.jsx)(`div`,{children:n},`${s.type}-${s.section}-${d}`)}return s.sectionId===`feishu-auth`?(0,W.jsx)(dt,{channelConfig:e,formData:a,channelEnabled:r,disabled:n},`${s.type}-${s.sectionId}-${d}`):s.sectionId===`weixin-auth`?(0,W.jsx)(lt,{channelConfig:e,formData:a,channelName:`weixin`,channelEnabled:r,disabled:n},`${s.type}-${s.sectionId}-${d}`):null})})}function At({actions:e,channelConfig:t,channelLabel:n,channelName:r,fields:i,layoutBlocks:o,tutorialUrl:s,uiHints:c}){let l=me(),u=pe(),[d,p]=(0,U.useState)(()=>({...t})),[m,h]=(0,U.useState)(()=>Ct(t,i)),[_,v]=(0,U.useState)(null),y=Dt(Et(r)),b=typeof d.enabled==`boolean`?d.enabled:!!t.enabled,x=l.isPending||!!_,S=(e,t)=>p(n=>({...n,[e]:t})),C=e=>{e.preventDefault();let t={...d};for(let e of i){if(e.type===`password`){let n=t[e.name];(typeof n!=`string`||n.length===0)&&delete t[e.name]}if(e.type===`json`)try{t[e.name]=(m[e.name]??``).trim()?JSON.parse(m[e.name]):{}}catch{g.error(`${a(`invalidJson`)}: ${e.name}`);return}}l.mutate({channel:r,data:t})},w=e=>{if(!$(e?.channels)||!$(e.channels[r]))return;let t=e.channels[r];p(e=>bt(e,t)),h(e=>{let n={...e},r=!1;for(let e of i)e.type!==`json`||!Object.prototype.hasOwnProperty.call(t,e.name)||(n[e.name]=JSON.stringify(t[e.name]??{},null,2),r=!0);return r?n:e})},T=async e=>{v(e.id);try{let t=`channels.${r}`,n={...d};e.saveBeforeRun&&(n={...n,...e.savePatch??{}},p(n),await l.mutateAsync({channel:r,data:n}));let i=await u.mutateAsync({actionId:e.id,data:{scope:t,draftConfig:xt(t,n)}});w(i.patch),i.ok?g.success(i.message||a(`success`)):g.error(i.message||a(`error`))}catch(e){g.error(`${a(`error`)}: ${e instanceof Error?e.message:String(e)}`)}finally{v(null)}};return(0,W.jsxs)(R,{children:[(0,W.jsx)(Ot,{channelName:r,channelLabel:n,enabled:b,tutorialUrl:s,channelApplyStatus:y}),(0,W.jsxs)(`form`,{onSubmit:C,className:`flex min-h-0 flex-1 flex-col`,children:[(0,W.jsx)(B,{className:`space-y-6 px-6 py-5`,children:(0,W.jsx)(kt,{channelConfig:t,channelName:r,enabled:b,fields:i,formData:d,jsonDrafts:m,layoutBlocks:o,setJsonDrafts:h,uiHints:c,updateField:S,disabled:x})}),(0,W.jsxs)(ye,{className:`flex flex-wrap items-center justify-between gap-3 px-6 py-4`,children:[(0,W.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:e.filter(e=>e.trigger===`manual`).map(e=>(0,W.jsx)(f,{type:`button`,onClick:()=>void T(e),disabled:x,variant:`secondary`,children:_===e.id?a(`connecting`):e.title},e.id))}),(0,W.jsx)(f,{type:`submit`,disabled:x,children:l.isPending?a(`saving`):a(`save`)})]})]})]})}function jt({channelName:e}){let{data:t}=I(),{data:n}=P(),{data:r}=F(),i=e?t?.channels[e]??null:null,o=n?.channels.find(t=>t.name===e),s=(0,U.useMemo)(()=>gt()[e||``],[e]);if(!e||!o||!i)return(0,W.jsx)(_e,{children:(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`h3`,{className:`text-base font-semibold text-gray-900`,children:a(`channelsSelectTitle`)}),(0,W.jsx)(`p`,{className:`mt-2 text-sm text-gray-500`,children:a(`channelsSelectDescription`)})]})});let c=s?.fields??vt,l=s?.layout??yt,u=r?.uiHints,d=L(`channels.${e}`,u)?.label??e,f=_t(o),p=JSON.stringify({channelName:e,channelConfig:i,jsonFields:c.filter(e=>e.type===`json`).map(e=>e.name)});return(0,W.jsx)(At,{actions:r?.actions?.filter(t=>t.scope===`channels.${e}`)??[],channelConfig:i,channelLabel:d,channelName:e,fields:c,layoutBlocks:l,tutorialUrl:f,uiHints:u},p)}var Mt={telegram:`channelDescTelegram`,slack:`channelDescSlack`,email:`channelDescEmail`,webhook:`channelDescWebhook`,discord:`channelDescDiscord`,feishu:`channelDescFeishu`,weixin:`channelDescWeixin`},Nt=[`weixin`,`feishu`,`discord`,`qq`];function Pt(e){let t=new Map(Nt.map((e,t)=>[e,t]));return e.map((e,t)=>({channel:e,index:t})).sort((e,n)=>{let r=t.get(e.channel.name)??1/0,i=t.get(n.channel.name)??1/0;return r===i?e.index-n.index:r-i}).map(({channel:e})=>e)}function Ft(){let{isMobile:e}=ce(),{data:t}=I(),{data:n}=P(),{data:r}=F(),[i,s]=(0,U.useState)(`enabled`),[c,l]=(0,U.useState)(null),[u,f]=(0,U.useState)(``),h=(0,U.useMemo)(()=>Pt(n?.channels??[]),[n?.channels]),g=t?.channels,_=(0,U.useMemo)(()=>{let e=u.trim().toLowerCase();return h.filter(e=>i!==`enabled`||!!g?.[e.name]?.enabled).filter(t=>e?(t.displayName||t.name).toLowerCase().includes(e)||t.name.toLowerCase().includes(e):!0)},[i,g,h,u]),v=c&&_.some(e=>e.name===c)?c:e?null:_[0]?.name??null;return!t||!n?(0,W.jsx)(`div`,{className:`p-8 text-gray-400`,children:a(`channelsLoading`)}):(0,W.jsxs)(m,{className:`pb-0 xl:flex xl:h-full xl:min-h-0 xl:flex-col`,children:[(0,W.jsx)(p,{title:a(`channelsPageTitle`),description:a(`channelsPageDescription`)}),(0,W.jsxs)(ge,{className:`xl:min-h-0`,mobileView:e?v?`detail`:`list`:void 0,onMobileBack:()=>l(null),mobileListLabel:a(`channelsPageTitle`),children:[(0,W.jsxs)(R,{children:[(0,W.jsx)(z,{className:`px-4 pt-4`,children:(0,W.jsx)(ie,{value:i,onValueChange:s,children:(0,W.jsxs)(ne,{className:`mb-0 h-auto gap-3 border-b-0 bg-transparent p-0`,children:[(0,W.jsxs)(j,{value:`enabled`,className:`gap-1.5 px-0 pb-3`,children:[a(`channelsTabEnabled`),(0,W.jsx)(`span`,{className:`text-[11px] font-medium text-gray-500`,children:h.filter(e=>g?.[e.name]?.enabled).length})]}),(0,W.jsxs)(j,{value:`all`,className:`gap-1.5 px-0 pb-3`,children:[a(`channelsTabAll`),(0,W.jsx)(`span`,{className:`text-[11px] font-medium text-gray-500`,children:h.length})]})]})})}),(0,W.jsx)(`div`,{className:`border-b border-gray-100 px-4 py-3`,children:(0,W.jsxs)(`div`,{className:`relative`,children:[(0,W.jsx)(ee,{className:`pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-gray-400`}),(0,W.jsx)(d,{value:u,onChange:e=>f(e.target.value),placeholder:a(`channelsFilterPlaceholder`),className:`h-10 rounded-xl pl-9`})]})}),(0,W.jsxs)(B,{className:`space-y-2 p-3`,children:[_.map(e=>{let n=!!t.channels[e.name]?.enabled,i=_t(e),s=L(`channels.${e.name}`,r?.uiHints)?.help||a(Mt[e.name]||`channelDescriptionDefault`);return(0,W.jsx)(be,{onClick:()=>l(e.name),active:v===e.name,children:(0,W.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,W.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,W.jsx)(le,{name:e.name,src:N(e.name),className:o(`h-10 w-10 rounded-lg border`,n?`border-primary/30 bg-white`:`border-gray-200/70 bg-white`),imgClassName:`h-5 w-5 object-contain`,fallback:(0,W.jsx)(`span`,{className:`text-sm font-semibold uppercase text-gray-500`,children:e.name[0]})}),(0,W.jsxs)(`div`,{className:`min-w-0`,children:[(0,W.jsx)(`p`,{className:`truncate text-sm font-semibold text-gray-900`,children:e.displayName||e.name}),(0,W.jsx)(`p`,{className:`line-clamp-1 text-[11px] text-gray-500`,children:s})]})]}),(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[i?(0,W.jsx)(`a`,{href:i,onClick:e=>e.stopPropagation(),className:`inline-flex h-7 w-7 items-center justify-center rounded-md text-gray-300 transition-colors hover:bg-gray-100/70 hover:text-gray-500`,title:a(`channelsGuideTitle`),children:(0,W.jsx)(A,{className:`h-3.5 w-3.5`})}):null,(0,W.jsx)(se,{status:n?`active`:`inactive`,label:a(n?`statusActive`:`statusInactive`),className:`min-w-[56px] justify-center`})]})]})},e.name)}),_.length===0?(0,W.jsx)(ve,{icon:fe,title:a(`channelsNoMatch`)}):null]})]}),(0,W.jsx)(jt,{channelName:v??void 0})]})]})}export{Ft as ChannelsList};