@cuongtran001/kanna 1.76.1 → 1.76.3

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 (95) hide show
  1. package/dist/client/assets/{BoardsPage-ClqCJi3S.js → BoardsPage-DCh9hj51.js} +1 -1
  2. package/dist/client/assets/{BoardsRoutePage-tILf5ZVU.js → BoardsRoutePage-DPw5ve6w.js} +1 -1
  3. package/dist/client/assets/ChatPage-CEeRSI6r.js +93 -0
  4. package/dist/client/assets/{CronJobRow-FbVVkka2.js → CronJobRow-D2ex-2ZV.js} +1 -1
  5. package/dist/client/assets/{CronJobsPage-Cjtn8F5l.js → CronJobsPage-BGk_HGOZ.js} +1 -1
  6. package/dist/client/assets/{FilePreviewSheet-D6Js0oz9.js → FilePreviewSheet-BnQeVNHq.js} +2 -2
  7. package/dist/client/assets/{FlowSurface-BD6Fv7KF.js → FlowSurface-RRPSX4vy.js} +1 -1
  8. package/dist/client/assets/{GenUIBlock-CCn7-ePE.js → GenUIBlock-DKGMRQmN.js} +2 -2
  9. package/dist/client/assets/{KannaSocketProvider-m8QFHU_F.js → KannaSocketProvider-CNmZYIUz.js} +1 -1
  10. package/dist/client/assets/{LocalProjectsPage-CPKymu8m.js → LocalProjectsPage-Dr5JrPMN.js} +1 -1
  11. package/dist/client/assets/SettingsPage-Bhy_51Vm.js +13 -0
  12. package/dist/client/assets/{StackBoardsRoutePage-CzojEmXE.js → StackBoardsRoutePage-B-O5uIvz.js} +1 -1
  13. package/dist/client/assets/{ToolCallMessage-BUbmvfUG.js → ToolCallMessage-C8Z9pIBo.js} +3 -3
  14. package/dist/client/assets/{VChartSurface-CeQqqBBu.js → VChartSurface-C_LuezMZ.js} +1 -1
  15. package/dist/client/assets/{WorkflowsPage-nsRU1QEm.js → WorkflowsPage-BmGlYGWF.js} +1 -1
  16. package/dist/client/assets/{WorkflowsSection-D5tluUkJ.js → WorkflowsSection-SjENofEr.js} +1 -1
  17. package/dist/client/assets/{chart-renderer-6tEMKXRu.js → chart-renderer-Ce4S2Bew.js} +1 -1
  18. package/dist/client/assets/{chatSounds-DHfUpC0L.js → chatSounds-ih86yh5r.js} +1 -1
  19. package/dist/client/assets/chevron-left-DZQr0sRY.js +1 -0
  20. package/dist/client/assets/{clipboard.adapter-CYn3H1oo.js → clipboard.adapter-BLu7Xx3Q.js} +1 -1
  21. package/dist/client/assets/{columnStyle-BOebgRHp.js → columnStyle-CXivQEvf.js} +1 -1
  22. package/dist/client/assets/{contextWindow-D1RRC1b-.js → contextWindow-Cpz1HmWo.js} +1 -1
  23. package/dist/client/assets/copyFeedbackStore-NslkB2Ap.js +1 -0
  24. package/dist/client/assets/{createScopedStore-C0pJOwR9.js → createScopedStore-CZBfIcri.js} +1 -1
  25. package/dist/client/assets/{dist-DRcJM7Lq.js → dist-DHxwilnY.js} +1 -1
  26. package/dist/client/assets/{ellipsis-BrvN3hX9.js → ellipsis-Ba-nFhTR.js} +1 -1
  27. package/dist/client/assets/{flow-kinds-CkaWSYYm.js → flow-kinds-BIh-hHN9.js} +1 -1
  28. package/dist/client/assets/{folder-BunWGsz1.js → folder-B34crHxE.js} +1 -1
  29. package/dist/client/assets/{formatDuration-SKek8N5u.js → formatDuration-JKx5LBF4.js} +1 -1
  30. package/dist/client/assets/{genui-td2w9ZBU.js → genui-DmCmYDHH.js} +1 -1
  31. package/dist/client/assets/{globe-BIvdtBFt.js → globe-DV73QVTP.js} +1 -1
  32. package/dist/client/assets/{host-6jbynfZo.js → host-FY7xgVKG.js} +1 -1
  33. package/dist/client/assets/index-BYus2o1t.css +1 -0
  34. package/dist/client/assets/{index-CVlOrRGa.js → index-MU4WHdaY.js} +3 -3
  35. package/dist/client/assets/{info-DhG2cfVg.js → info-COBF8Hkz.js} +1 -1
  36. package/dist/client/assets/{input-C3R4k6-W.js → input-BJRDZBOh.js} +1 -1
  37. package/dist/client/assets/{lexicalToReact-CfHucecr.js → lexicalToReact-BVHTqlu5.js} +3 -3
  38. package/dist/client/assets/{log-CYjZ_PZ1.js → log-7NXJbErN.js} +1 -1
  39. package/dist/client/assets/{monitor-DwO0L7DX.js → monitor-Wl8GxNgR.js} +1 -1
  40. package/dist/client/assets/{pendingActionsStore-By8_y_o0.js → pendingActionsStore-DDpYeRNm.js} +1 -1
  41. package/dist/client/assets/{play-B-vQkmFp.js → play-CmxvHVzO.js} +1 -1
  42. package/dist/client/assets/{plus-BDLscSN_.js → plus-C3QbbvBk.js} +1 -1
  43. package/dist/client/assets/{popover-104yTR95.js → popover-Dm-pdC4M.js} +1 -1
  44. package/dist/client/assets/{pushClient-DiLvwOUU.js → pushClient-COMO42mb.js} +1 -1
  45. package/dist/client/assets/runDetached-mjGecpjX.js +1 -0
  46. package/dist/client/assets/{segmented-control-CROY-CuD.js → segmented-control-CfauwRtX.js} +1 -1
  47. package/dist/client/assets/{select-BiDB8UlY.js → select-7zTZH1xA.js} +1 -1
  48. package/dist/client/assets/{settings-header-button-DrzrbXmr.js → settings-header-button-TMNvLQQs.js} +1 -1
  49. package/dist/client/assets/{sidebarPendingActions-Db0_daIj.js → sidebarPendingActions-Bd_2oNH_.js} +1 -1
  50. package/dist/client/assets/{square-pen-DXsycXBb.js → square-pen-BB5GlYSZ.js} +1 -1
  51. package/dist/client/assets/{state-mark-C1zpvAww.js → state-mark-x5ennY81.js} +1 -1
  52. package/dist/client/assets/{terminal-BSJXFRP8.js → terminal-D5pfyUjC.js} +1 -1
  53. package/dist/client/assets/{timer.adapter-DsZB_-cb.js → timer.adapter-C5oNrWbM.js} +1 -1
  54. package/dist/client/assets/{tools-MYv8-phR.js → tools-BlXGwwwh.js} +1 -1
  55. package/dist/client/assets/{triangle-alert-Ck2DCXSO.js → triangle-alert-BwAIBaGG.js} +1 -1
  56. package/dist/client/assets/{useAppGlobalState-BwEVtuo2.js → useAppGlobalState-BL9aCLak.js} +1 -1
  57. package/dist/client/assets/{useKannaState-DbEQQ6kC.js → useKannaState-DTILzHBb.js} +1 -1
  58. package/dist/client/assets/{useTheme-BHNSJGUC.js → useTheme-9knhPtrR.js} +1 -1
  59. package/dist/client/index.html +34 -34
  60. package/package.json +1 -1
  61. package/src/server/agent-coordinator-types.ts +1 -0
  62. package/src/server/agent-coordinator.ts +4 -0
  63. package/src/server/beacon-mention-prompt.test.ts +33 -0
  64. package/src/server/beacon-mention-prompt.ts +33 -0
  65. package/src/server/beacon-registry.test.ts +1 -0
  66. package/src/server/beacon-registry.ts +9 -1
  67. package/src/server/beacon-services.test.ts +11 -1
  68. package/src/server/beacon-services.ts +4 -0
  69. package/src/server/beacon-settings.test.ts +74 -1
  70. package/src/server/beacon-settings.ts +54 -3
  71. package/src/server/claude-turn-starter-types.ts +3 -0
  72. package/src/server/claude-turn-starter.test.ts +85 -0
  73. package/src/server/claude-turn-starter.ts +5 -1
  74. package/src/server/kanna-mcp-beacon-transfer.test.ts +1 -0
  75. package/src/server/kanna-mcp-beacon.test.ts +4 -1
  76. package/src/server/kanna-mcp-beacon.ts +16 -5
  77. package/src/server/push/push-manager.test.ts +39 -0
  78. package/src/server/push/push-manager.ts +45 -1
  79. package/src/server/server.ts +1 -0
  80. package/src/server/ws-router-broadcast.ts +1 -1
  81. package/src/server/ws-router-envelope.ts +2 -0
  82. package/src/server/ws-router-settings.test.ts +1 -0
  83. package/src/server/ws-router.test.ts +68 -0
  84. package/src/shared/beacon-alias.test.ts +64 -0
  85. package/src/shared/beacon-alias.ts +120 -0
  86. package/src/shared/beacon-config.ts +2 -0
  87. package/src/shared/beacon-status.test.ts +2 -0
  88. package/src/shared/beacon-status.ts +2 -0
  89. package/src/shared/chat-activity.ts +8 -0
  90. package/dist/client/assets/ChatPage-C8syKflw.js +0 -93
  91. package/dist/client/assets/SettingsPage-04gXMi4Y.js +0 -13
  92. package/dist/client/assets/chevron-left-BO_O7rLs.js +0 -1
  93. package/dist/client/assets/copyFeedbackStore-DdNWcKCp.js +0 -1
  94. package/dist/client/assets/index-D8o_YX_z.css +0 -1
  95. package/dist/client/assets/runDetached-DtQs26wR.js +0 -1
@@ -1 +1 @@
1
- import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{t}from"./react-DiVRNtpo.js";import{s as n}from"./chunk-OB3PAWPO-CCBUsQEH.js";import{t as r}from"./jsx-runtime-BdxMnOeJ.js";import{c as i,d as a,m as o,p as s,t as c}from"./log-CYjZ_PZ1.js";import{a as l,f as u,n as d}from"./pendingActionsStore-By8_y_o0.js";import{zt as f}from"./lexicalToReact-CfHucecr.js";import{l as p,n as m,r as h,s as g,u as _}from"./pushClient-DiLvwOUU.js";import{a as v,i as y,n as b,o as x,r as S,t as C,u as w}from"./timer.adapter-DsZB_-cb.js";import{t as ee}from"./input-C3R4k6-W.js";import{D as te,T,_ as ne,c as re,k as ie,l as E,u as ae,v as oe}from"./useTheme-BHNSJGUC.js";import{t as se}from"./runDetached-DtQs26wR.js";import{c as ce,l as le}from"./contextWindow-D1RRC1b-.js";import{a as ue}from"./formatters-BGORekd-.js";var D=e(r(),1),O=e(t(),1),de=(0,O.createContext)({});function fe(e){let t=(0,O.useRef)(null);return t.current===null&&(t.current=e()),t.current}var pe=typeof window<`u`?O.useLayoutEffect:O.useEffect,me=(0,O.createContext)(null);function he(e,t){e.indexOf(t)===-1&&e.push(t)}function k(e,t){let n=e.indexOf(t);n>-1&&e.splice(n,1)}var ge=(e,t,n)=>n>t?t:n<e?e:n,_e={},ve=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),ye=e=>typeof e==`object`&&!!e,be=e=>/^0[^.\s]+$/u.test(e);function xe(e){let t;return()=>(t===void 0&&(t=e()),t)}var A=e=>e,Se=(...e)=>e.reduce((e,t)=>n=>t(e(n))),Ce=(e,t,n)=>{let r=t-e;return r?(n-e)/r:1},we=class{constructor(){this.subscriptions=[]}add(e){return he(this.subscriptions,e),()=>this.remove(e)}remove(e){k(this.subscriptions,e)}notify(e,t,n){let r=this.subscriptions.length;if(r){if(r===1)this.subscriptions[0](e,t,n);else for(let i=0;i<r;i++){let r=this.subscriptions[i];r&&r(e,t,n)}}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}},Te=e=>e*1e3,Ee=e=>e/1e3,De=(e,t)=>t?1e3/t*e:0,Oe=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,ke=1e-7,Ae=12;function je(e,t,n,r,i){let a,o,s=0;do o=t+(n-t)/2,a=Oe(o,r,i)-e,a>0?n=o:t=o;while(Math.abs(a)>ke&&++s<Ae);return o}function Me(e,t,n,r){if(e===t&&n===r)return A;let i=t=>je(t,0,1,e,n);return e=>e===0||e===1?e:Oe(i(e),t,r)}var Ne=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,Pe=e=>t=>1-e(1-t),Fe=Me(.33,1.53,.69,.99),Ie=Pe(Fe),Le=Ne(Ie),Re=e=>e>=1?1:(e*=2)<1?.5*Ie(e):.5*(2-2**(-10*(e-1))),ze=e=>1-Math.sin(Math.acos(e)),Be=Pe(ze),Ve=Ne(ze),He=Me(.42,0,1,1),Ue=Me(0,0,.58,1),We=Me(.42,0,.58,1),Ge=e=>Array.isArray(e)&&typeof e[0]!=`number`,Ke=e=>Array.isArray(e)&&typeof e[0]==`number`,qe={linear:A,easeIn:He,easeInOut:We,easeOut:Ue,circIn:ze,circInOut:Ve,circOut:Be,backIn:Ie,backInOut:Le,backOut:Fe,anticipate:Re},Je=e=>typeof e==`string`,Ye=e=>{if(Ke(e)){e.length;let[t,n,r,i]=e;return Me(t,n,r,i)}return Je(e)?(qe[e],`${e}`,qe[e]):e},j={delta:0,timestamp:0,isProcessing:!1},Xe;function Ze(){Xe=void 0}var M={now:()=>(Xe===void 0&&M.set(j.isProcessing||_e.useManualTiming?j.timestamp:performance.now()),Xe),set:e=>{Xe=e,queueMicrotask(Ze)}},Qe=e=>Math.round(e*1e5)/1e5,$e=e=>t=>typeof t==`string`&&t.startsWith(e),et=$e(`--`),tt=$e(`var(--`),nt=e=>tt(e)?rt.test(e.split(`/*`)[0].trim()):!1,rt=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function it(e){return typeof e==`string`&&e.split(`/*`)[0].includes(`var(--`)}var at={test:e=>typeof e==`number`,parse:parseFloat,transform:e=>e},ot={...at,transform:e=>ge(0,1,e)},st={...at,default:1},ct=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function lt(e){return e==null}var ut=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,dt=(e,t)=>n=>!!(typeof n==`string`&&ut.test(n)&&n.startsWith(e)||t&&!lt(n)&&Object.prototype.hasOwnProperty.call(n,t)),ft=(e,t,n)=>r=>{if(typeof r!=`string`)return r;let[i,a,o,s]=r.match(ct);return{[e]:parseFloat(i),[t]:parseFloat(a),[n]:parseFloat(o),alpha:s===void 0?1:parseFloat(s)}},pt=e=>ge(0,255,e),mt={...at,transform:e=>Math.round(pt(e))},ht={test:dt(`rgb`,`red`),parse:ft(`red`,`green`,`blue`),transform:({red:e,green:t,blue:n,alpha:r=1})=>`rgba(`+mt.transform(e)+`, `+mt.transform(t)+`, `+mt.transform(n)+`, `+Qe(ot.transform(r))+`)`};function gt(e){let t=``,n=``,r=``,i=``;return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),i=e.substring(4,5),t+=t,n+=n,r+=r,i+=i),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:i?parseInt(i,16)/255:1}}var _t={test:dt(`#`),parse:gt,transform:ht.transform},vt=e=>({test:t=>typeof t==`string`&&t.endsWith(e)&&t.split(` `).length===1,parse:parseFloat,transform:t=>`${t}${e}`}),yt=vt(`deg`),bt=vt(`%`),N=vt(`px`),xt=vt(`vh`),St=vt(`vw`),Ct={...bt,parse:e=>bt.parse(e)/100,transform:e=>bt.transform(e*100)},wt={test:dt(`hsl`,`hue`),parse:ft(`hue`,`saturation`,`lightness`),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>`hsla(`+Math.round(e)+`, `+bt.transform(Qe(t))+`, `+bt.transform(Qe(n))+`, `+Qe(ot.transform(r))+`)`},P={test:e=>ht.test(e)||_t.test(e)||wt.test(e),parse:e=>ht.test(e)?ht.parse(e):wt.test(e)?wt.parse(e):_t.parse(e),transform:e=>typeof e==`string`?e:e.hasOwnProperty(`red`)?ht.transform(e):wt.transform(e),getAnimatableNone:e=>{let t=P.parse(e);return t.alpha=0,P.transform(t)}},Tt=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu,Et=new RegExp(ct.source),Dt=new RegExp(Tt.source,`i`);function Ot(e){return isNaN(e)&&typeof e==`string`&&(Et.test(e)||Dt.test(e))}var kt=`number`,At=`color`,jt=`var`,Mt=`var(`,Nt="${}",Pt=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Ft(e){let t=e.toString();return Et.test(t)||Dt.test(t)}function It(e){let t=e.toString(),n=[],r={color:[],number:[],var:[]},i=[],a=0;return{values:n,split:t.replace(Pt,e=>(P.test(e)?(r.color.push(a),i.push(At),n.push(P.parse(e))):e.startsWith(Mt)?(r.var.push(a),i.push(jt),n.push(e)):(r.number.push(a),i.push(kt),n.push(parseFloat(e))),++a,Nt)).split(Nt),indexes:r,types:i}}function Lt(e){return It(e).values}function Rt({split:e,types:t}){let n=e.length;return r=>{let i=``;for(let a=0;a<n;a++)if(i+=e[a],r[a]!==void 0){let e=t[a];i+=e===kt?Qe(r[a]):e===At?P.transform(r[a]):r[a]}return i}}function zt(e){return Rt(It(e))}var Bt=e=>typeof e==`number`?0:P.test(e)?P.getAnimatableNone(e):e,Vt=(e,t)=>typeof e==`number`?t?.trim().endsWith(`/`)?e:0:Bt(e);function Ht(e){let t=It(e);return Rt(t)(t.values.map((e,n)=>Vt(e,t.split[n])))}var Ut={test:Ot,parse:Lt,createTransformer:zt,getAnimatableNone:Ht};function Wt(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function Gt({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let i=0,a=0,o=0;if(!t)i=a=o=n;else{let r=n<.5?n*(1+t):n+t-n*t,s=2*n-r;i=Wt(s,r,e+1/3),a=Wt(s,r,e),o=Wt(s,r,e-1/3)}return{red:Math.round(i*255),green:Math.round(a*255),blue:Math.round(o*255),alpha:r}}function Kt(e,t){return n=>n>0?t:e}var F=(e,t,n)=>e+(t-e)*n,qt=(e,t,n)=>{let r=e*e,i=n*(t*t-r)+r;return i<0?0:Math.sqrt(i)},Jt=[_t,ht,wt],Yt=e=>Jt.find(t=>t.test(e));function Xt(e){let t=Yt(e);if(!t)return`${e}`,!1;let n=t.parse(e);return t===wt&&(n=Gt(n)),n}var Zt=(e,t)=>{let n=Xt(e),r=Xt(t);if(!n||!r)return Kt(e,t);let i={...n};return e=>(i.red=qt(n.red,r.red,e),i.green=qt(n.green,r.green,e),i.blue=qt(n.blue,r.blue,e),i.alpha=F(n.alpha,r.alpha,e),ht.transform(i))},Qt=new Set([`none`,`hidden`]);function $t(e,t){return Qt.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function en(e,t){return n=>F(e,t,n)}function tn(e){return typeof e==`number`?en:typeof e==`string`?nt(e)?Kt:P.test(e)?Zt:on:Array.isArray(e)?nn:typeof e==`object`?P.test(e)?Zt:rn:Kt}function nn(e,t){let n=[...e],r=n.length,i=e.map((e,n)=>tn(e)(e,t[n]));return e=>{for(let t=0;t<r;t++)n[t]=i[t](e);return n}}function rn(e,t){let n={...e,...t},r={};for(let i in n)e[i]!==void 0&&t[i]!==void 0&&(r[i]=tn(e[i])(e[i],t[i]));return e=>{for(let t in r)n[t]=r[t](e);return n}}function an(e,t){let n=[],r={color:0,var:0,number:0};for(let i=0;i<t.values.length;i++){let a=t.types[i],o=e.indexes[a][r[a]],s=e.values[o]??0;n[i]=s,r[a]++}return n}var on=(e,t)=>{let n=Ut.createTransformer(t),r=It(e),i=It(t);return r.indexes.var.length===i.indexes.var.length&&r.indexes.color.length===i.indexes.color.length&&r.indexes.number.length>=i.indexes.number.length?Qt.has(e)&&!i.values.length||Qt.has(t)&&!r.values.length?$t(e,t):Se(nn(an(r,i),i.values),n):(`${e}${t}`,Kt(e,t))},sn=/^(-?(?:\d+(?:\.\d*)?|\.\d+))([a-z%]*)$/iu;function cn(e,t){let n=sn.exec(e);if(!n)return;let r=sn.exec(t);if(!r||n[2]!==r[2])return;let i=n[2],a=parseFloat(n[1]),o=parseFloat(r[1]);return e=>Qe(F(a,o,e))+i}function ln(e,t,n){if(typeof e==`number`&&typeof t==`number`&&typeof n==`number`)return F(e,t,n);if(typeof e==`string`&&typeof t==`string`){let n=cn(e,t);if(n)return n}return tn(e)(e,t)}var un=[`setup`,`read`,`resolveKeyframes`,`preUpdate`,`update`,`preRender`,`render`,`postRender`];function dn(e){let t=new Set,n=new Set,r=!1,i=!1,a=new Set,o={delta:0,timestamp:0,isProcessing:!1};function s(t){a.has(t)&&(n.add(t),e()),t(o)}let c={schedule:(e,i=!1,o=!1)=>{let s=o&&r?t:n;return i&&a.add(e),s.add(e),e},cancel:e=>{n.delete(e),a.delete(e)},process:e=>{if(o=e,r){i=!0;return}r=!0;let a=t;t=n,n=a,t.forEach(s),t.clear(),r=!1,i&&(i=!1,c.process(e))}};return c}var fn=40;function pn(e,t,n={delta:0,timestamp:0,isProcessing:!1}){let r=!1,i=!0,a=()=>r=!0,o=un.reduce((e,t)=>(e[t]=dn(a),e),{}),{setup:s,read:c,resolveKeyframes:l,preUpdate:u,update:d,preRender:f,render:p,postRender:m}=o,h=()=>{let a=_e.useManualTiming,o=a?n.timestamp:performance.now();r=!1,a||(n.delta=i?1e3/60:Math.max(Math.min(o-n.timestamp,fn),1)),n.timestamp=o,n.isProcessing=!0,s.process(n),c.process(n),l.process(n),u.process(n),d.process(n),f.process(n),p.process(n),m.process(n),n.isProcessing=!1,r&&t&&(i=!1,e(h))},g=()=>{r=!0,i=!0,n.isProcessing||e(h)};return{schedule:un.reduce((e,t)=>{let n=o[t];return e[t]=(e,t=!1,i=!1)=>(r||g(),n.schedule(e,t,i)),e},{}),cancel:e=>{for(let t=0;t<un.length;t++)o[un[t]].cancel(e)},state:n,steps:o}}var{schedule:I,cancel:mn,steps:hn}=pn(typeof requestAnimationFrame<`u`?requestAnimationFrame:A,!0,j),gn=e=>{let t=({timestamp:t})=>e(t);return{start:(e=!0)=>I.update(t,e),stop:()=>mn(t),now:()=>j.isProcessing?j.timestamp:M.now()}},_n=(e,t,n=10)=>{let r=``,i=Math.max(Math.round(t/n),2);for(let t=0;t<i;t++)r+=Math.round(e(t/(i-1))*1e4)/1e4+`, `;return`linear(${r.substring(0,r.length-2)})`},vn=2e4;function yn(e,t=50,n=vn,r){let i=0,a=e.next(i);for(r?.push(a.value);!a.done&&i<n;)i+=t,a=e.next(i),r?.push(a.value);return i>=n?1/0:i}function bn(e,t=100,n){let r=n({...e,keyframes:[0,t]}),i=Math.min(yn(r),vn);return{type:`keyframes`,ease:e=>r.next(i*e).value/t,duration:Ee(i)}}var L={stiffness:100,damping:10,mass:1,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05},xn=e=>e<0?1/Math.max(1+e,L.minDamping):Math.max(1-e,L.minDamping);function Sn(e,t){if(!(e>1))return 1;let n=Math.sqrt(e*e-1),r=e-n,i=e+n,a=2*n*Math.exp(-t)*(1+t);return Tn(e=>i*Math.exp(-r*e)-r*Math.exp(-i*e)-a,e=>Math.exp(-i*e)-Math.exp(-r*e),t)/t}function Cn(e,t){return e*Math.sqrt(1-t*t)}var wn=12;function Tn(e,t,n){let r=n;for(let n=1;n<wn;n++)r-=e(r)/t(r);return r}var En=.001;function Dn({duration:e=L.duration,bounce:t=L.bounce}){let n,r;L.maxDuration;let i=xn(t);e=ge(L.minDuration,L.maxDuration,Ee(e)),i<1?(n=t=>{let n=t*i,r=n*e,a=Cn(t,i),o=Math.exp(-r);return En-n/a*o},r=t=>{let r=t*i*e,a=i*i*t*t*e,o=Math.exp(-r),s=Cn(t*t,i);return(-n(t)+En>0?-1:1)*-a*o/s}):(n=t=>-.001+Math.exp(-t*e)*(t*e+1),r=t=>Math.exp(-t*e)*(-t*(e*e)));let a=5/e,o=Tn(n,r,a),s=o*Sn(i,o*e),c=s*s;return{stiffness:c,damping:i*2*Math.sqrt(c),duration:Te(e)}}var On=(e,t)=>(t?e>=0:e>0)&&e<1/0;function kn(e,t){if(On(e,t))return e}function An(e){let t=kn(e.stiffness),n=kn(e.damping,!0),r=kn(e.mass),i={...e,stiffness:t??L.stiffness,damping:n??L.damping,mass:r??L.mass,isResolvedFromDuration:!1,isTimeDefined:(t??n??r)===void 0&&(e.duration!==void 0||e.bounce!==void 0)};if(i.isTimeDefined){if(e.visualDuration){let t=xn(e.bounce||0),n=2*Math.PI/(e.visualDuration*1.2)*Sn(t,2*Math.PI/1.2);i.stiffness=n*n,i.damping=2*t*Math.sqrt(i.stiffness)}else Object.assign(i,Dn(i)),i.isResolvedFromDuration=!0;(!On(i.stiffness)||!On(i.damping,!0))&&(i.stiffness=L.stiffness,i.damping=L.damping)}return i}function jn(e=L.visualDuration,t=L.bounce){let n=typeof e==`object`?e:{visualDuration:e,keyframes:[0,1],bounce:t},r=n.keyframes[0],i=n.keyframes[n.keyframes.length-1],a={done:!1,value:r},{stiffness:o,damping:s,mass:c,duration:l,isResolvedFromDuration:u,isTimeDefined:d}=An({...n}),f=e=>d?0:-Ee(e),p=s/(2*Math.sqrt(o*c)),m=Ee(Math.sqrt(o/c)),h=p*m,g={target:i,delta:i-r,velocity:f(n.velocity||0)||0,restSpeed:0,restDelta:0},_=()=>{let e=Math.abs(g.delta)<5;g.restSpeed=n.restSpeed||(e?L.restSpeed.granular:L.restSpeed.default),g.restDelta=n.restDelta||(e?L.restDelta.granular:L.restDelta.default)};_();let v,y,b;if(p<1){let e=Cn(m,p),t={A:0,sinC:0,cosC:0,t:-1,env:0,sin:0,cos:0};b=()=>{t.A=(g.velocity+h*g.delta)/e,t.sinC=h*t.A+g.delta*e,t.cosC=h*g.delta-t.A*e};let n=n=>{n!==t.t&&(t.t=n,t.env=Math.exp(-h*n),t.sin=Math.sin(e*n),t.cos=Math.cos(e*n))};v=e=>(n(e),g.target-t.env*(t.A*t.sin+g.delta*t.cos)),y=e=>(n(e),t.env*(t.sinC*t.sin+t.cosC*t.cos))}else if(p===1){v=e=>g.target-Math.exp(-m*e)*(g.delta+(g.velocity+m*g.delta)*e);let e={C:0};b=()=>{e.C=g.velocity+m*g.delta},y=t=>Math.exp(-m*t)*(m*e.C*t-g.velocity)}else{let e=m*Math.sqrt(p*p-1),t=h-e,n=h+e,r=d?1/0:300/e,i=(e,t)=>Math.exp(t>r?-e*r-h*(t-r):-e*t),a={S:0,F:0};b=()=>{let t=(g.velocity+h*g.delta)/e;a.S=(g.delta+t)/2,a.F=(g.delta-t)/2},v=e=>g.target-a.S*i(t,e)-a.F*i(n,e),y=e=>t*a.S*i(t,e)+n*a.F*i(n,e)}b();let x=u&&l||null,S={calculatedDuration:x,retarget:(e,t)=>{g.target=e[e.length-1],g.delta=g.target-e[0],g.velocity=f(t),n.restSpeed&&n.restDelta||_(),S.calculatedDuration=x,a.done=!1,b()},velocity:e=>Te(y(e)),next:e=>{let t=v(e);if(u)a.done=e>=l;else{let n=Te(y(e));a.done=Math.abs(n)<=g.restSpeed&&Math.abs(g.target-t)<=g.restDelta}return a.value=a.done?g.target:t,a},toString:()=>{let e=Math.min(yn(S),vn),t=_n(t=>S.next(e*t).value,e,30);return e+`ms `+t},toTransition:()=>{}};return S}jn.applyToOptions=e=>{let t=bn(e,100,jn);return e.ease=t.ease,e.duration=Te(t.duration),e.type=`keyframes`,e};function Mn({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:a=500,modifyTarget:o,min:s,max:c,restDelta:l=.5,restSpeed:u}){let d=e[0],f={done:!1,value:d},p=e=>e<s||e>c,m=e=>s===void 0?c:c===void 0||Math.abs(s-e)<Math.abs(c-e)?s:c,h=n*t,g=d+h,_=o===void 0?g:o(g);_!==g&&(h=_-d);let v=e=>-h*Math.exp(-e/r),y=e=>{let t=v(e);f.done=Math.abs(t)<=l,f.value=f.done?_:_+t},b,x,S=e=>{p(f.value)&&(b=e,x=jn({keyframes:[f.value,m(f.value)],velocity:-v(e)/r*1e3,damping:i,stiffness:a,restDelta:l,restSpeed:u}))};return S(0),{calculatedDuration:null,next:e=>{let t=!1;return!x&&b===void 0&&(t=!0,y(e),S(e)),b!==void 0&&e>=b?x.next(e-b):(!t&&y(e),f)}}}function Nn(e,t,n){let r=[],i=n||_e.mix||ln,a=e.length-1;for(let n=0;n<a;n++){let a=i(e[n],e[n+1]);t&&(a=Se(Array.isArray(t)?t[n]||A:t,a)),r.push(a)}return r}function Pn(e,t,{clamp:n=!0,ease:r,mixer:i}={}){let a=e.length;if(t.length,a===1)return()=>t[0];if(a===2&&t[0]===t[1])return()=>t[1];let o=e[0]===e[1];e[0]>e[a-1]&&(e=[...e].reverse(),t=[...t].reverse());let s=Nn(t,r,i),c=s.length,l=n=>{if(o&&n<e[0])return t[0];let r=0;if(c>1)for(;r<e.length-2&&!(n<e[r+1]);r++);let i=Ce(e[r],e[r+1],n);return s[r](i)};return n?t=>l(ge(e[0],e[a-1],t)):l}function Fn(e,t){let n=e[e.length-1];for(let r=1;r<=t;r++){let i=Ce(0,t,r);e.push(F(n,1,i))}}function In(e){let t=[0];return Fn(t,e.length-1),t}function Ln(e,t){return e.map(e=>e*t)}function Rn(e,t){return e.map(()=>t||We).splice(0,e.length-1)}function zn({duration:e=300,keyframes:t,times:n,ease:r=`easeInOut`}){let i=Ge(r)?r.map(Ye):Ye(r)||We,a={done:!1,value:t[0]};if(t.length===2&&!Array.isArray(i)&&(!n||n.length!==2||n[0]===0&&n[1]===1)){let[n,r]=t,o=n===r?void 0:(_e.mix||ln)(n,r);return{calculatedDuration:e,next:t=>(a.value=o?o(i(e>0?ge(0,1,t/e):1)):r,a.done=t>=e,a)}}let o=Pn(Ln(n&&n.length===t.length?n:In(t),e),t,{ease:Array.isArray(i)?i:Rn(t,i)});return{calculatedDuration:e,next:t=>(a.value=o(t),a.done=t>=e,a)}}var Bn=5;function Vn(e,t,n){let r=Math.max(t-Bn,0);return De(n-e(r),t-r)}function Hn(e,t,n=0){return t<=0?n:e.velocity?e.velocity(t):Vn(t=>e.next(t).value,t,e.next(t).value)}var Un=e=>e!==null;function Wn(e,{repeat:t,repeatType:n=`loop`},r,i=1){let a=e.filter(Un),o=i<0||t&&n!==`loop`&&t%2==1?0:a.length-1;return!o||r===void 0?a[o]:r}var Gn={decay:Mn,inertia:Mn,tween:zn,keyframes:zn,spring:jn};function Kn(e){typeof e.type==`string`&&(e.type=Gn[e.type])}function qn(e,t){return{kind:e,animation:t,timestamp:M.now(),frameTimestamp:j.timestamp,frameIsProcessing:j.isProcessing}}function Jn(e,t,n){let r=globalThis.__MOTION_INSPECT__;if(r)try{r({...qn(`animation-start`,e),options:n?{...t,...n}:t})}catch{}}function Yn(e,t){let n=globalThis.__MOTION_INSPECT__;if(n)try{n({...qn(`layout-animation-start`,e),node:t})}catch{}}var Xn=class{constructor(){this.isResolved=!1}get finished(){return this._finished||=this.isResolved?Promise.resolve():new Promise(e=>{this._resolve=e}),this._finished}updateFinished(){this._finished=this._resolve=void 0,this.isResolved=!1}notifyFinished(){this.isResolved=!0,this._resolve?.()}then(e,t){return this.finished.then(e,t)}},Zn=e=>e/100,Qn=class extends Xn{constructor(e){super(),this.state=`idle`,this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{let{motionValue:e}=this.options;e&&e.updatedAt!==M.now()&&this.tick(M.now()),this.isStopped=!0,this.state!==`idle`&&(this.teardown(),this.options.onStop?.())},this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause(),Jn(this,this.options)}initAnimation(){let{options:e}=this;Kn(e);let{type:t=zn,repeat:n=0,repeatDelay:r=0,repeatType:i,velocity:a=0}=e,{keyframes:o}=e,s=t||zn;s!==zn&&typeof o[0]!=`number`&&(this.mixKeyframes=Se(Zn,ln(o[0],o[1])),o=[0,100]);let c=s(o===e.keyframes?e:{...e,keyframes:o});i===`mirror`&&(this.mirroredGenerator=s({...e,keyframes:[...o].reverse(),velocity:-a})),c.calculatedDuration===null&&(c.calculatedDuration=yn(c));let{calculatedDuration:l}=c;this.calculatedDuration=l,this.resolvedDuration=l+r,this.totalDuration=this.resolvedDuration*(n+1)-r,this.generator=c}updateTime(e){let t=Math.round(e-this.startTime)*this.playbackSpeed;this.currentTime=this.holdTime===null?t:this.holdTime}tick(e,t=!1){let{generator:n,totalDuration:r,mixKeyframes:i,mirroredGenerator:a,resolvedDuration:o,calculatedDuration:s}=this;if(this.startTime===null)return n.next(0);let{delay:c=0,keyframes:l,repeat:u,repeatType:d,repeatDelay:f,type:p,onUpdate:m,finalKeyframe:h}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-r/this.speed,this.startTime)),t?this.currentTime=e:this.updateTime(e);let g=this.currentTime-c*(this.playbackSpeed>=0?1:-1),_=this.playbackSpeed>=0?g<0:g>r;this.currentTime=Math.max(g,0),this.state===`finished`&&this.holdTime===null&&(this.currentTime=r);let v=this.currentTime,y=n;if(u){let e=Math.min(this.currentTime,r)/o,t=Math.floor(e),n=e%1;!n&&e>=1&&(n=1),n===1&&t--,t=Math.min(t,u+1),t%2&&(d===`reverse`?(n=1-n,f&&(n-=f/o)):d===`mirror`&&(y=a)),v=ge(0,1,n)*o}let b;_?(this.delayState.value=l[0],b=this.delayState):b=y.next(v),i&&!_&&(b.value=i(b.value));let{done:x}=b;!_&&s!==null&&(x=this.playbackSpeed>=0?this.currentTime>=r:this.currentTime<=0);let S=this.holdTime===null&&(this.state===`finished`||this.state===`running`&&x);return S&&p!==Mn&&(b.value=Wn(l,this.options,h,this.speed)),m&&m(b.value),S&&this.finish(),b}then(e,t){return this.finished.then(e,t)}get duration(){return Ee(this.calculatedDuration)}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+Ee(e)}get time(){return Ee(this.currentTime)}set time(e){e=Te(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state=`paused`,this.holdTime=e,this.tick(e))}getGeneratorVelocity(){return Hn(this.generator,this.currentTime,this.options.velocity)}get speed(){return this.playbackSpeed}set speed(e){let t=this.playbackSpeed!==e;t&&this.driver&&this.updateTime(M.now()),this.playbackSpeed=e,t&&this.driver&&(this.time=Ee(this.currentTime))}play(){if(this.isStopped)return;let{driver:e=gn,startTime:t}=this.options;this.driver||=e(e=>this.tick(e)),this.options.onPlay?.();let n=this.driver.now();this.state===`finished`?(this.updateFinished(),this.startTime=n):this.holdTime===null?this.startTime||=t??n:this.startTime=n-this.holdTime,this.state===`finished`&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state=`running`,this.driver.start()}pause(){this.state=`paused`,this.updateTime(M.now()),this.holdTime=this.currentTime}complete(){this.state!==`running`&&this.play(),this.state=`finished`,this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state=`finished`,this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state=`idle`,this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&=(this.driver.stop(),void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){return this.options.allowFlatten&&(this.options.type=`keyframes`,this.options.ease=`linear`,this.initAnimation()),this.driver?.stop(),e.observe(this)}},$n=new Set([`brightness`,`contrast`,`saturate`,`opacity`]);function er(e){let[t,n]=e.slice(0,-1).split(`(`);if(t===`drop-shadow`)return e;let[r]=n.match(ct)||[];if(!r)return e;let i=n.replace(r,``),a=+!!$n.has(t);return r!==n&&(a*=100),t+`(`+a+i+`)`}var tr=/\b([a-z-]*)\(.*?\)/gu,nr={...Ut,getAnimatableNone:e=>{let t=e.match(tr);return t?t.map(er).join(` `):e}},rr={...Ut,getAnimatableNone:e=>{let t=Ut.parse(e);return Ut.createTransformer(e)(t.map(e=>typeof e==`number`?0:typeof e==`object`?{...e,alpha:1}:e))}},ir={...at,transform:Math.round},ar={borderWidth:N,borderTopWidth:N,borderRightWidth:N,borderBottomWidth:N,borderLeftWidth:N,borderRadius:N,borderTopLeftRadius:N,borderTopRightRadius:N,borderBottomRightRadius:N,borderBottomLeftRadius:N,width:N,maxWidth:N,height:N,maxHeight:N,top:N,right:N,bottom:N,left:N,inset:N,insetBlock:N,insetBlockStart:N,insetBlockEnd:N,insetInline:N,insetInlineStart:N,insetInlineEnd:N,padding:N,paddingTop:N,paddingRight:N,paddingBottom:N,paddingLeft:N,paddingBlock:N,paddingBlockStart:N,paddingBlockEnd:N,paddingInline:N,paddingInlineStart:N,paddingInlineEnd:N,margin:N,marginTop:N,marginRight:N,marginBottom:N,marginLeft:N,marginBlock:N,marginBlockStart:N,marginBlockEnd:N,marginInline:N,marginInlineStart:N,marginInlineEnd:N,fontSize:N,backgroundPositionX:N,backgroundPositionY:N,rotate:yt,pathRotation:yt,rotateX:yt,rotateY:yt,rotateZ:yt,scale:st,scaleX:st,scaleY:st,scaleZ:st,skew:yt,skewX:yt,skewY:yt,distance:N,translateX:N,translateY:N,translateZ:N,x:N,y:N,z:N,perspective:N,transformPerspective:N,opacity:ot,originX:Ct,originY:Ct,originZ:N,zIndex:ir,fillOpacity:ot,strokeOpacity:ot,numOctaves:ir},or={...ar,color:P,backgroundColor:P,outlineColor:P,fill:P,stroke:P,borderColor:P,borderTopColor:P,borderRightColor:P,borderBottomColor:P,borderLeftColor:P,filter:nr,WebkitFilter:nr,mask:rr,WebkitMask:rr},sr=e=>or[e],cr=new Set([nr,rr]);function lr(e,t){let n=sr(e);return cr.has(n)||(n=Ut),n.getAnimatableNone?n.getAnimatableNone(t):void 0}function ur(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}var dr=e=>e*180/Math.PI,fr=e=>mr(dr(Math.atan2(e[1],e[0]))),pr={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:fr,rotateZ:fr,skewX:e=>dr(Math.atan(e[1])),skewY:e=>dr(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},mr=e=>(e%=360,e<0&&(e+=360),e),hr=fr,gr=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),_r=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),vr={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:gr,scaleY:_r,scale:e=>(gr(e)+_r(e))/2,rotateX:e=>mr(dr(Math.atan2(e[6],e[5]))),rotateY:e=>mr(dr(Math.atan2(-e[2],e[0]))),rotateZ:hr,rotate:hr,skewX:e=>dr(Math.atan(e[4])),skewY:e=>dr(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function yr(e){return+!!e.includes(`scale`)}function br(e,t){if(!e||e===`none`)return yr(t);let n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u),r,i;if(n)r=vr,i=n;else{let t=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=pr,i=t}if(!i)return yr(t);let a=r[t],o=i[1].split(`,`).map(Sr);return typeof a==`function`?a(o):o[a]}var xr=(e,t)=>{let{transform:n=`none`}=getComputedStyle(e);return br(n,t)};function Sr(e){return parseFloat(e.trim())}var Cr=[`transformPerspective`,`x`,`y`,`z`,`translateX`,`translateY`,`translateZ`,`scale`,`scaleX`,`scaleY`,`rotate`,`rotateX`,`rotateY`,`rotateZ`,`skew`,`skewX`,`skewY`],wr=new Set([...Cr,`pathRotation`]),Tr=e=>e===at||e===N,Er=new Set([`x`,`y`,`z`]),Dr=Cr.filter(e=>!Er.has(e));function Or(e){let t=[];return Dr.forEach(n=>{let r=e.getValue(n);if(r!==void 0){let e=r.get(),i=+!!n.startsWith(`scale`);if(e===i)return;t.push([n,e]),r.set(i)}}),t}var kr=new Set([`bottom`,`right`]);function Ar(e,t,n,r,i,a){let o=parseFloat(e);if(!isNaN(o))return o;let{min:s,max:c}=t()[n],l=c-s;return a===`border-box`?l:l-parseFloat(r)-parseFloat(i)}var jr={width:({width:e,paddingLeft:t=`0`,paddingRight:n=`0`,boxSizing:r},i)=>Ar(e,i,`x`,t,n,r),height:({height:e,paddingTop:t=`0`,paddingBottom:n=`0`,boxSizing:r},i)=>Ar(e,i,`y`,t,n,r),top:({top:e})=>parseFloat(e),left:({left:e})=>parseFloat(e),bottom:({top:e},t)=>{let{y:n}=t();return parseFloat(e)+(n.max-n.min)},right:({left:e},t)=>{let{x:n}=t();return parseFloat(e)+(n.max-n.min)},x:({transform:e})=>br(e,`x`),y:({transform:e})=>br(e,`y`)};jr.translateX=jr.x,jr.translateY=jr.y;var Mr=new Set,Nr=!1,Pr=!1,Fr=!1;function Ir(){if(Pr){let e=[],t=new Set,n=new Set;Mr.forEach(r=>{r.needsMeasurement&&(e.push(r),t.add(r.element),kr.has(r.name)&&n.add(r.element))});let r=new Map;n.forEach(e=>{let t=Or(e);t.length&&(r.set(e,t),e.render())}),e.forEach(e=>e.measureInitialState()),t.forEach(e=>{e.render();let t=r.get(e);t&&t.forEach(([t,n])=>{e.getValue(t)?.set(n)})}),e.forEach(e=>e.measureEndState()),e.forEach(e=>{e.suspendedScrollY!==void 0&&window.scrollTo(0,e.suspendedScrollY)})}Pr=!1,Nr=!1,Mr.forEach(e=>e.complete(Fr)),Mr.clear()}function Lr(){Mr.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(Pr=!0)})}function Rr(){Fr=!0,Lr(),Ir(),Fr=!1}function zr(e,t,n){if(typeof e==`string`){if(ve(e)||be(e))return parseFloat(e);if(!Ut.test(e)&&Ut.test(n))return lr(t,n)}return e??void 0}var Br=class{constructor(e,t,n,r,i,a=!1){this.state=`pending`,this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=t,this.name=n,this.motionValue=r,this.element=i,this.isAsync=a}scheduleResolve(){this.state=`scheduled`,this.isAsync?(Mr.add(this),Nr||(Nr=!0,I.read(Lr),I.resolveKeyframes(Ir))):(this.readKeyframes(),this.complete())}readKeyframes(){let{unresolvedKeyframes:e,name:t,element:n,motionValue:r}=this;if(e[0]===null){let i=r?.get(),a=e[e.length-1];if(i!==void 0)e[0]=i;else if(n&&t){let r=zr(n.readValue(t,a),t,a);r!==void 0&&(e[0]=r)}e[0]===void 0&&(e[0]=a),r&&i===void 0&&r.set(e[0])}ur(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state=`complete`,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),Mr.delete(this)}cancel(){this.state===`scheduled`&&(Mr.delete(this),this.state=`pending`)}resume(){this.state===`pending`&&this.scheduleResolve()}},Vr=e=>e.startsWith(`--`);function Hr(e,t,n){Vr(t)?e.style.setProperty(t,n):e.style[t]=n}var Ur={};function Wr(e,t){let n=xe(e);return()=>Ur[t]??n()}var Gr=Wr(()=>window.ScrollTimeline!==void 0,`scrollTimeline`),Kr=Wr(()=>{try{document.createElement(`div`).animate({opacity:0},{easing:`linear(0, 1)`})}catch{return!1}return!0},`linearEasing`),qr=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,Jr={linear:`linear`,ease:`ease`,easeIn:`ease-in`,easeOut:`ease-out`,easeInOut:`ease-in-out`,circIn:qr([0,.65,.55,1]),circOut:qr([.55,0,1,.45]),backIn:qr([.31,.01,.66,-.59]),backOut:qr([.33,1.53,.69,.99])};function Yr(e,t){if(e)return typeof e==`function`?Kr()?_n(e,t):`ease-out`:Ke(e)?qr(e):Array.isArray(e)?e.map(e=>Yr(e,t)||Jr.easeOut):Jr[e]}function Xr(e,t,n,{delay:r=0,duration:i=300,repeat:a=0,repeatType:o=`loop`,ease:s=`easeOut`,times:c}={},l=void 0){let u={[t]:n};c&&(u.offset=c);let d=Yr(s,i);Array.isArray(d)&&(u.easing=d);let f={delay:r,duration:i,easing:Array.isArray(d)?`linear`:d,fill:`both`,iterations:a+1,direction:o===`reverse`?`alternate`:`normal`};return l&&(f.pseudoElement=l),e.animate(u,f)}function Zr(e){return typeof e==`function`&&`applyToOptions`in e}function Qr({type:e,...t}){return Zr(e)&&Kr()?e.applyToOptions(t):(t.duration??=300,t.ease??=`easeOut`,t)}var $r=class extends Xn{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;let{element:t,name:n,keyframes:r,pseudoElement:i,allowFlatten:a=!1,finalKeyframe:o,onComplete:s}=e;this.isPseudoElement=!!i,this.allowFlatten=a,this.options=e,e.type;let c=Qr(e);this.animation=Xr(t,n,r,c,i),c.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!i){let e=Wn(r,this.options,o,this.speed);this.updateMotionValue&&this.updateMotionValue(e),Hr(t,n,e),this.animation.cancel()}s?.(),this.notifyFinished()},Jn(this,e,c)}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state===`finished`&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;let{state:e}=this;e!==`idle`&&e!==`finished`&&(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){let e=this.options?.element;!this.isPseudoElement&&e?.isConnected&&this.animation.commitStyles?.()}get duration(){let e=this.animation.effect?.getComputedTiming?.().duration||0;return Ee(Number(e))}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+Ee(e)}get time(){return Ee(Number(this.animation.currentTime)||0)}set time(e){let t=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=Te(e),t&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime===null?this.animation.playState:`finished`}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,onAttach:t,observe:n}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:`linear`}),this.animation.onfinish=null,e&&Gr()?(this.animation.timeline=e,t?.(this.animation),A):n(this)}},ei={anticipate:Re,backInOut:Le,circInOut:Ve};function ti(e){return e in ei}function ni(e){typeof e.ease==`string`&&ti(e.ease)&&(e.ease=ei[e.ease])}var ri=10,ii=class extends $r{constructor(e){ni(e),Kn(e),super(e),e.startTime!==void 0&&e.autoplay!==!1&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){let{motionValue:t,onUpdate:n,onComplete:r,element:i,...a}=this.options;if(!t)return;if(e!==void 0){t.set(e);return}let o=new Qn({...a,autoplay:!1}),s=Math.max(ri,M.now()-this.startTime),c=ge(0,ri,s-ri),l=o.sample(s).value,{name:u}=this.options;i&&u&&Hr(i,u,l),t.setWithVelocity(o.sample(Math.max(0,s-c)).value,l,c),o.stop()}},ai=(e,t)=>t!==`zIndex`&&!!(typeof e==`number`||Array.isArray(e)||typeof e==`string`&&(Ut.test(e)||e===`0`)&&!e.startsWith(`url(`));function oi(e){let t=e[0];if(e.length===1)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t)return!0}function si(e,t,n,r){let i=e[0];if(i===null)return!1;if(t===`display`||t===`visibility`)return!0;let a=e[e.length-1],o=ai(i,t),s=ai(a,t);return!o||!s?(o!==s&&`${t}${i}${a}${o?a:i}`,!1):oi(e)||(n===`spring`||Zr(n))&&r}function ci(e){e.duration=0,e.type=`keyframes`}var li=new Set([`opacity`,`clipPath`,`filter`,`transform`,`backgroundColor`]),ui=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;function di(e){for(let t=0;t<e.length;t++)if(typeof e[t]==`string`&&ui.test(e[t]))return!0;return!1}var fi=new Set([`color`,`backgroundColor`,`outlineColor`,`fill`,`stroke`,`borderColor`,`borderTopColor`,`borderRightColor`,`borderBottomColor`,`borderLeftColor`]),pi=xe(()=>Object.hasOwnProperty.call(Element.prototype,`animate`));function mi(e){let{motionValue:t,name:n,repeatDelay:r,repeatType:i,damping:a,type:o,keyframes:s}=e;if(!n||!(li.has(n)||fi.has(n)))return!1;let c=t?.owner?.current;if(!(c instanceof HTMLElement)&&!(c instanceof SVGElement))return!1;let{onUpdate:l,transformTemplate:u}=t.owner.getProps();return pi()&&(li.has(n)||fi.has(n)&&di(s))&&(n!==`transform`||!u)&&!l&&!r&&i!==`mirror`&&a!==0&&o!==`inertia`}var hi=40,gi=class extends Xn{constructor(e){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=M.now();let{keyframes:t,name:n,motionValue:r,element:i}=e,a=e;a.autoplay??=!0,a.delay??=0,a.type??=`keyframes`,a.repeat??=0,a.repeatDelay??=0,a.repeatType??=`loop`;let o=i?.KeyframeResolver||Br;this.keyframeResolver=new o(t,(e,t,n)=>this.onKeyframesResolved(e,t,a,!n),n,r,i),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,t,n,r){this.keyframeResolver=void 0;let{name:i,type:a,velocity:o,delay:s,isHandoff:c,onUpdate:l}=n;this.resolvedAt=M.now();let u=!0;si(e,i,a,o)||(u=!1,(_e.instantAnimations||!s)&&l?.(Wn(e,n,t)),e[0]=e[e.length-1],ci(n),n.repeat=0);let d=r?this.resolvedAt&&this.resolvedAt-this.createdAt>hi?this.resolvedAt:this.createdAt:void 0,{onComplete:f}=n;n.startTime??=d,n.finalKeyframe=t,n.keyframes=e,n.onComplete=()=>{f?.(),this.notifyFinished()};let p=u&&!c&&mi(n),m;if(p){n.element=n.motionValue?.owner?.current;try{m=new ii(n)}catch{m=new Qn(n)}}else m=new Qn(n);this.pendingTimeline&&=(this.stopTimeline=m.attachTimeline(this.pendingTimeline),void 0),this._animation=m}get finished(){return this._animation?this._animation.finished:super.finished}then(e,t){return this.finished.finally(e).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),Rr()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}};function _i(e,t,n,r=0,i=1){let a=Array.from(e).sort((e,t)=>e.sortNodePosition(t)).indexOf(t),o=e.size,s=(o-1)*r;return typeof n==`function`?n(a,o):i===1?a*r:s-a*r}var vi=30,yi=e=>!isNaN(parseFloat(e)),bi={current:void 0},xi=class{constructor(e,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=e=>{let t=M.now();if(this.updatedAt!==t&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(e),this.current!==this.prev&&(this.notifyChange(),this.dependents))for(let e of this.dependents)e.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=t.owner}setCurrent(e){this.current=e,this.updatedAt=M.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=yi(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on(`change`,e)}on(e,t){var n;return e===`change`?this.onChangeSubscribe(t):((n=this.events)[e]||(n[e]=new we)).add(t)}onChangeSubscribe(e){let{events:t}=this;return!t.change&&!this.changeSubscriber?this.changeSubscriber=e:(t.change||(t.change=new we,t.change.add(this.changeSubscriber),this.changeSubscriber=void 0),t.change.add(e)),()=>{this.changeSubscriber===e?this.changeSubscriber=void 0:t.change?.remove(e),this.stopIfUnobserved()}}stopIfUnobserved(){I.read(()=>{!this.changeSubscriber&&!this.events.change?.getSize()&&this.stop()})}clearListeners(){this.changeSubscriber=void 0;for(let e in this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,t,n){this.set(t),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-n}jump(e,t=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,t&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.notifyChange()}notifyChange(){let{current:e,changeSubscriber:t}=this;t?t(e):this.events.change?.notify(e)}addDependent(e){this.dependents||=new Set,this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return bi.current&&bi.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){let e=M.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>vi)return 0;let t=Math.min(this.updatedAt-this.prevUpdatedAt,vi);return De(parseFloat(this.current)-parseFloat(this.prevFrameValue),t)}start(e){return this.stop(),new Promise(t=>{this.hasAnimated=!0;let n=!1,r;r=e(()=>{n=!0,this.events.animationComplete?.notify(),this.animation===r&&this.clearAnimation(),t()}),n||(this.animation=r),this.events.animationStart?.notify()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){this.animation=void 0}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}};function Si(e,t){return new xi(e,t)}function Ci(e,t){if(e?.inherit&&t){let{inherit:n,...r}=e;return{...t,...r}}return e}function wi(e,t){let n=e?.[t]??e?.default??e;return n===e?n:Ci(n,e)}var Ti={type:`spring`,stiffness:500,damping:25,restSpeed:10},Ei=e=>({type:`spring`,stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),Di={type:`keyframes`,duration:.8},Oi={type:`keyframes`,ease:[.25,.1,.35,1],duration:.3},ki=(e,{keyframes:t})=>t.length>2?Di:wr.has(e)?e.startsWith(`scale`)?Ei(t[1]):Ti:Oi,Ai=new Set([`when`,`delay`,`delayChildren`,`staggerChildren`,`staggerDirection`,`repeat`,`repeatType`,`repeatDelay`,`from`,`elapsed`]);function ji(e){for(let t in e)if(!Ai.has(t))return!0;return!1}var Mi=(e,t,n,r={},i,a)=>o=>{let s=wi(r,e)||{},c=s.delay||r.delay||0,{elapsed:l=0}=r;l-=Te(c);let u={keyframes:Array.isArray(n)?n:[null,n],ease:`easeOut`,velocity:t.getVelocity(),...s,delay:-l,onUpdate:e=>{t.set(e),s.onUpdate&&s.onUpdate(e)},onComplete:()=>{o(),s.onComplete&&s.onComplete()},name:e,motionValue:t,element:a?void 0:i};ji(s)||Object.assign(u,ki(e,u)),u.duration&&=Te(u.duration),u.repeatDelay&&=Te(u.repeatDelay),u.from!==void 0&&(u.keyframes[0]=u.from);let d=!1;if((u.type===!1||u.duration===0&&!u.repeatDelay)&&(ci(u),u.delay===0&&(d=!0)),(_e.instantAnimations||_e.skipAnimations||i?.shouldSkipAnimations||s.skipAnimations)&&(d=!0,ci(u),u.delay=0),u.allowFlatten=!s.type&&!s.ease,d&&!a&&t.get()!==void 0){let e=Wn(u.keyframes,s);if(e!==void 0){I.update(()=>{u.onUpdate(e),u.onComplete()});return}}return s.isSync?new Qn(u):new gi(u)},Ni=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function Pi(e){let t=Ni.exec(e);if(!t)return[,];let[,n,r,i]=t;return[`--${n??r}`,i]}function Fi(e,t,n=1){`${e}`;let[r,i]=Pi(e);if(!r)return;let a=window.getComputedStyle(t).getPropertyValue(r);if(a){let e=a.trim();return ve(e)?parseFloat(e):e}return nt(i)?Fi(i,t,n+1):i}function Ii(e){let t=[{},{}];return e?.values.forEach((e,n)=>{t[0][n]=e.get(),t[1][n]=e.getVelocity()}),t}function Li(e,t,n,r){let i=t=>typeof t==`function`?t(n===void 0?e.custom:n,...Ii(r)):t;return t=i(t),typeof t==`string`&&(t=e.variants&&e.variants[t]),i(t)}function Ri(e,t,n){return Li(e.getProps(),t,n,e)}var zi=(e,t)=>t===`exit`?e.presenceContext?.custom:void 0,Bi=new Set([`width`,`height`,`top`,`left`,`right`,`bottom`,...Cr]),Vi=e=>Array.isArray(e);function Hi(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,Si(n))}function Ui(e){return Vi(e)?e[e.length-1]||0:e}function Wi(e,t){let{transitionEnd:n={},transition:r={},...i}=Ri(e,t)||{};i={...i,...n};for(let t in i)Hi(e,t,Ui(i[t]))}var R=e=>!!(e&&e.getVelocity);function Gi(e){return!!(R(e)&&e.add)}function Ki(e,t){let n=e.getValue(`willChange`);if(Gi(n))return n.add(t);if(!n&&_e.WillChange){let n=new _e.WillChange(`auto`);e.addValue(`willChange`,n),n.add(t)}}function qi(e){return e.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}var Ji=`data-`+qi(`framerAppearId`);function Yi(e){return e.props[Ji]}var Xi=typeof window<`u`;function Zi({protectedKeys:e,needsAnimating:t},n){let r=n in e&&!t[n];return t[n]=!1,r}function Qi(e,t,{delay:n=0,transitionOverride:r,type:i}={}){let{transition:a,transitionEnd:o,...s}=t,c=e.getDefaultTransition();a=a?Ci(a,c):c;let l=a?.reduceMotion,u=a?.skipAnimations;r&&(a=r);let d=[],f=i&&e.animationState?.getState()[i],p=a?.path;p&&p.animateVisualElement(e,s,a,n,d);for(let t in s){let r=e.getValue(t,e.latestValues[t]??null),i=s[t];if(i===void 0||f&&Zi(f,t))continue;let o={delay:n,...wi(a||{},t)};u&&(o.skipAnimations=!0);let c=r.get();if(c!==void 0&&!r.isAnimating()&&!Array.isArray(i)&&i===c&&!o.velocity){I.update(()=>r.set(i));continue}let p=!1;if(Xi&&window.MotionHandoffAnimation){let n=Yi(e);if(n){let e=window.MotionHandoffAnimation(n,t,I);e!==null&&(o.startTime=e,p=!0)}}Ki(e,t);let m=l??e.shouldReduceMotion;r.start(Mi(t,r,i,m&&Bi.has(t)?{type:!1}:o,e,p));let h=r.animation;h&&d.push(h)}if(o){let t=()=>I.update(()=>{o&&Wi(e,o)});d.length?Promise.all(d).then(t):t()}return d}function $i(e,t,n={}){let r=Ri(e,t,zi(e,n.type)),i=n.transitionOverride||(r?.transition??(e.getDefaultTransition()||{})),a=()=>Promise.all(r?Qi(e,r,n):[]),o=(r=0)=>{let{variantChildren:a}=e,{delayChildren:o=0,staggerChildren:s,staggerDirection:c}=i,l=[];return a?.forEach(e=>{e.notify(`AnimationStart`,t),l.push($i(e,t,{...n,delay:r+(typeof o==`function`?0:o)+_i(a,e,o,s,c)}).then(()=>e.notify(`AnimationComplete`,t)))}),Promise.all(l)},{when:s}=i;return s?s===`beforeChildren`?a().then(()=>o()):o().then(a):Promise.all([a(),o(n.delay)])}function ea(e,t,n={}){return e.notify(`AnimationStart`,t),(Array.isArray(t)?Promise.all(t.map(t=>$i(e,t,n))):typeof t==`string`?$i(e,t,n):Promise.all(Qi(e,Ri(e,t,n.custom),n))).then(()=>{e.notify(`AnimationComplete`,t)})}var ta={test:e=>e===`auto`,parse:e=>e},na=e=>t=>t.test(e),ra=[at,N,bt,yt,St,xt,ta],ia=e=>ra.find(na(e));function aa(e){return typeof e==`number`?e===0:e===null||e===`none`||e===`0`||be(e)}var oa=new Set([`auto`,`none`,`0`]);function sa(e,t,n){let r=0,i;for(;r<e.length&&!i;){let t=e[r];typeof t==`string`&&!oa.has(t)&&Ft(t)&&(i=e[r]),r++}if(i&&n)for(let r of t)e[r]!==i&&(e[r]=lr(n,i))}var ca=class extends Br{constructor(e,t,n,r,i){super(e,t,n,r,i,!0)}readKeyframes(){let{unresolvedKeyframes:e,element:t,name:n}=this;if(!t||!t.current)return;super.readKeyframes();for(let n=0;n<e.length;n++){let r=e[n];if(typeof r==`string`&&(r=r.trim(),nt(r))){let i=Fi(r,t.current);i!==void 0&&(e[n]=i),n===e.length-1&&(this.finalKeyframe=r)}}if(this.resolveNoneKeyframes(),!Bi.has(n)||e.length!==2)return;let[r,i]=e;if(typeof r==`number`&&typeof i==`number`)return;let a=ia(r),o=ia(i);if(it(r)!==it(i)&&jr[n]){this.needsMeasurement=!0;return}if(a!==o){if(Tr(a)&&Tr(o))for(let t=0;t<e.length;t++){let n=e[t];typeof n==`string`&&(e[t]=parseFloat(n))}else jr[n]&&(this.needsMeasurement=!0)}}resolveNoneKeyframes(){let{unresolvedKeyframes:e,name:t}=this,n=[];for(let t=0;t<e.length;t++)(e[t]===null||aa(e[t]))&&n.push(t);n.length&&sa(e,n,t)}measure(){let{element:e,name:t}=this;return jr[t](window.getComputedStyle(e.current),()=>e.measureViewportBox())}measureInitialState(){let{element:e,unresolvedKeyframes:t,name:n}=this;if(!e||!e.current)return;n===`height`&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=this.measure(),t[0]=this.measuredOrigin;let r=t[t.length-1];r!==void 0&&this.motionValue?.jump(r,!1)}measureEndState(){let{element:e,unresolvedKeyframes:t}=this;if(!e||!e.current)return;this.motionValue?.jump(this.measuredOrigin,!1);let n=t.length-1,r=t[n];t[n]=this.measure(),r!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=r),this.removedTransforms?.length&&this.removedTransforms.forEach(([t,n])=>{e.getValue(t).set(n)}),this.resolveNoneKeyframes()}},la=[`borderTopLeftRadius`,`borderTopRightRadius`,`borderBottomRightRadius`,`borderBottomLeftRadius`];function ua(e){return ye(e)&&`offsetHeight`in e&&!(`ownerSVGElement`in e)}function da(e){return ye(e)&&`ownerSVGElement`in e}var fa=(e,t)=>t&&typeof e==`number`?t.transform(e):e;function pa(e,t,n){if(e==null)return[];if(e instanceof EventTarget)return[e];if(typeof e==`string`){let r=document;t&&(r=t.current);let i=n?.[e]??r.querySelectorAll(e);return i?Array.from(i):[]}return Array.from(e).filter(e=>e!=null)}var ma={x:`translateX`,y:`translateY`,z:`translateZ`,transformPerspective:`perspective`},ha=Cr.length;function ga(e,t,n){let r=``,i=!0;for(let a=0;a<ha;a++){let o=Cr[a],s=e[o];if(s===void 0)continue;let c=!0;if(typeof s==`number`)c=s===+!!o.startsWith(`scale`);else{let e=parseFloat(s);c=o.startsWith(`scale`)?e===1:e===0}if(!c||n){let e=fa(s,ar[o]);if(!c){i=!1;let t=ma[o]||o;r+=`${t}(${e}) `}n&&(t[o]=e)}}let a=e.pathRotation;return a&&(i=!1,r+=`rotate(${fa(a,ar.pathRotation)}) `),r=r.trim(),n?r=n(t,i?``:r):i&&(r=`none`),r}function _a(e,t,n){let{style:r,vars:i,transformOrigin:a}=e,o=!1,s=!1;for(let e in t){let n=t[e];if(wr.has(e)){o=!0;continue}if(et(e)){i[e]=n;continue}{let t=fa(n,ar[e]);e.startsWith(`origin`)?(s=!0,a[e]=t):r[e]=t}}if(t.transform||(o||n?r.transform=ga(t,e.transform,n):r.transform&&=`none`),s){let{originX:e=`50%`,originY:t=`50%`,originZ:n=0}=a;r.transformOrigin=`${e} ${t} ${n}`}}var va={offset:`stroke-dashoffset`,array:`stroke-dasharray`},ya={offset:`strokeDashoffset`,array:`strokeDasharray`};function ba(e,t,n=1,r=0,i=!0){e.pathLength=1;let a=i?va:ya;e[a.offset]=`${-r}`,e[a.array]=`${t} ${n}`}var xa=[`transform`,`opacity`,`offsetDistance`,`offsetPath`,`offsetRotate`,`offsetAnchor`];function Sa(e,{attrX:t,attrY:n,attrScale:r,pathLength:i,pathSpacing:a=1,pathOffset:o=0,...s},c,l,u){if(_a(e,s,l),c){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};let{attrs:d,style:f}=e;for(let e of xa)d[e]!==void 0&&(f[e]=d[e],delete d[e]);(f.transform||d.transformOrigin)&&(f.transformOrigin=d.transformOrigin??`50% 50%`,delete d.transformOrigin),f.transform&&(f.transformBox=u?.transformBox??`fill-box`,delete d.transformBox),t!==void 0&&(d.x=t),n!==void 0&&(d.y=n),r!==void 0&&(d.scale=r),i!==void 0&&ba(d,i,a,o,!1)}function Ca({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function wa({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function Ta(e,t){if(!t)return e;let n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function Ea(e){return e===void 0||e===1}function Da({scale:e,scaleX:t,scaleY:n}){return!Ea(e)||!Ea(t)||!Ea(n)}function Oa(e){return Da(e)||ka(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function ka(e){return Aa(e.x)||Aa(e.y)}function Aa(e){return e&&e!==`0%`}function ja(e,t,n){return n+t*(e-n)}function Ma(e,t,n,r,i){return i!==void 0&&(e=ja(e,i,r)),ja(e,n,r)+t}function Na(e,t=0,n=1,r,i){e.min=Ma(e.min,t,n,r,i),e.max=Ma(e.max,t,n,r,i)}function Pa(e,{x:t,y:n}){Na(e.x,t.translate,t.scale,t.originPoint),Na(e.y,n.translate,n.scale,n.originPoint)}var Fa=.999999999999,Ia=1.0000000000001;function La(e,t,n,r=!1){let i=n.length;if(!i)return;t.x=t.y=1;let a,o;for(let s=0;s<i;s++){a=n[s],o=a.projectionDelta;let{visualElement:i}=a.options;i&&i.props.style&&i.props.style.display===`contents`||(r&&a.options.layoutScroll&&a.scroll&&a!==a.root&&(Ra(e.x,-a.scroll.offset.x),Ra(e.y,-a.scroll.offset.y)),o&&(t.x*=o.x.scale,t.y*=o.y.scale,Pa(e,o)),r&&Oa(a.latestValues)&&Va(e,a.latestValues,a.layout?.layoutBox))}t.x<Ia&&t.x>Fa&&(t.x=1),t.y<Ia&&t.y>Fa&&(t.y=1)}function Ra(e,t){e.min+=t,e.max+=t}function za(e,t,n,r,i=.5){Na(e,t,n,F(e.min,e.max,i),r)}function Ba(e,t){return typeof e==`string`?parseFloat(e)/100*(t.max-t.min):e}function Va(e,t,n){let r=n??e;za(e.x,Ba(t.x,r.x),t.scaleX,t.scale,t.originX),za(e.y,Ba(t.y,r.y),t.scaleY,t.scale,t.originY)}function Ha(e,t){return Ca(Ta(e.getBoundingClientRect(),t))}function Ua(e,t,n){let r=Ha(e,n),{scroll:i}=t;return i&&(Ra(r.x,i.offset.x),Ra(r.y,i.offset.y)),r}var{schedule:Wa,cancel:Ga}=pn(queueMicrotask,!1),Ka={x:!1,y:!1};function qa(){return Ka.x||Ka.y}function Ja(e){return e===`x`||e===`y`?Ka[e]?null:(Ka[e]=!0,()=>{Ka[e]=!1}):Ka.x||Ka.y?null:(Ka.x=Ka.y=!0,()=>{Ka.x=Ka.y=!1})}function Ya(e,t){let n=pa(e),r=new AbortController;return[n,{passive:!0,...t,signal:r.signal},()=>r.abort()]}function Xa(e){return!(e.pointerType===`touch`||qa())}function Za(e,t,n={}){let[r,i,a]=Ya(e,n);return r.forEach(e=>{let n=!1,r=!1,a,o=()=>{e.removeEventListener(`pointerleave`,u)},s=e=>{a&&=(a(e),void 0),o()},c=e=>{n=!1,window.removeEventListener(`pointerup`,c),window.removeEventListener(`pointercancel`,c),r&&(r=!1,s(e))},l=()=>{n=!0,window.addEventListener(`pointerup`,c,i),window.addEventListener(`pointercancel`,c,i)},u=e=>{if(e.pointerType!==`touch`){if(n){r=!0;return}s(e)}};e.addEventListener(`pointerenter`,n=>{if(!Xa(n))return;r=!1;let o=t(e,n);typeof o==`function`&&(a=o,e.addEventListener(`pointerleave`,u,i))},i),e.addEventListener(`pointerdown`,l,i)}),a}var Qa=(e,t)=>t?e===t||Qa(e,t.parentElement):!1,$a=e=>e.pointerType===`mouse`?typeof e.button!=`number`||e.button<=0:e.isPrimary!==!1,eo=new Set([`BUTTON`,`INPUT`,`SELECT`,`TEXTAREA`,`A`]);function to(e){return eo.has(e.tagName)||e.isContentEditable===!0}var no=new Set([`INPUT`,`SELECT`,`TEXTAREA`]);function ro(e){return no.has(e.tagName)||e.isContentEditable===!0}var io=new WeakSet;function ao(e){return t=>{t.key===`Enter`&&e(t)}}function oo(e,t){e.dispatchEvent(new PointerEvent(`pointer`+t,{isPrimary:!0,bubbles:!0}))}var so=(e,t)=>{let n=e.currentTarget;if(!n)return;let r=ao(()=>{if(io.has(n))return;oo(n,`down`);let e=ao(()=>{oo(n,`up`)});n.addEventListener(`keyup`,e,t),n.addEventListener(`blur`,()=>oo(n,`cancel`),t)});n.addEventListener(`keydown`,r,t),n.addEventListener(`blur`,()=>n.removeEventListener(`keydown`,r),t)};function co(e){return $a(e)&&!qa()}var lo=new WeakSet;function uo(e,t,n={}){let[r,i,a]=Ya(e,n),o=e=>{let r=e.currentTarget;if(!co(e)||lo.has(e))return;io.add(r),n.stopPropagation&&lo.add(e);let a=t(r,e),o={...i,capture:!0},s=(e,t)=>{window.removeEventListener(`pointerup`,c,o),window.removeEventListener(`pointercancel`,l,o),io.has(r)&&io.delete(r),co(e)&&typeof a==`function`&&a(e,{success:t})},c=e=>{s(e,r===window||r===document||n.useGlobalTarget||Qa(r,e.target))},l=e=>{s(e,!1)};window.addEventListener(`pointerup`,c,o),window.addEventListener(`pointercancel`,l,o)};return r.forEach(e=>{(n.useGlobalTarget?window:e).addEventListener(`pointerdown`,o,i),ua(e)&&(e.addEventListener(`focus`,e=>so(e,i)),!to(e)&&!e.hasAttribute(`tabindex`)&&(e.tabIndex=0))}),a}var fo=new WeakMap,po,mo=(e,t,n)=>(r,i)=>i&&i[0]?i[0][e+`Size`]:da(r)&&`getBBox`in r?r.getBBox()[t]:r[n],ho=mo(`inline`,`width`,`offsetWidth`),go=mo(`block`,`height`,`offsetHeight`);function _o({target:e,borderBoxSize:t}){fo.get(e)?.forEach(n=>{n(e,{get width(){return ho(e,t)},get height(){return go(e,t)}})})}function vo(e){e.forEach(_o)}function yo(){typeof ResizeObserver<`u`&&(po=new ResizeObserver(vo))}function bo(e,t){po||yo();let n=pa(e);return n.forEach(e=>{let n=fo.get(e);n||(n=new Set,fo.set(e,n)),n.add(t),po?.observe(e)}),()=>{n.forEach(e=>{let n=fo.get(e);n?.delete(t),n?.size||po?.unobserve(e)})}}var xo=new Set,So;function Co(){So=()=>{let e={get width(){return window.innerWidth},get height(){return window.innerHeight}};xo.forEach(t=>t(e))},window.addEventListener(`resize`,So)}function wo(e){return xo.add(e),So||Co(),()=>{xo.delete(e),!xo.size&&typeof So==`function`&&(window.removeEventListener(`resize`,So),So=void 0)}}function To(e,t){return typeof e==`function`?wo(e):bo(e,t)}var Eo={value:null,addProjectionMetrics:null};function Do(e){return da(e)&&e.tagName===`svg`}var Oo=e=>typeof e==`number`?e:parseFloat(e),ko=()=>({translate:0,scale:1,origin:0,originPoint:0}),Ao=()=>({x:ko(),y:ko()}),jo=()=>({min:0,max:0}),z=()=>({x:jo(),y:jo()}),Mo=new WeakMap;function No(e){return typeof e==`object`&&!!e&&typeof e.start==`function`}function Po(e){return typeof e==`string`||Array.isArray(e)}var Fo=[`animate`,`whileInView`,`whileFocus`,`whileHover`,`whileTap`,`whileDrag`,`exit`],Io=[`initial`,...Fo];function Lo(e){if(No(e.animate))return!0;for(let t=0;t<Io.length;t++)if(Po(e[Io[t]]))return!0;return!1}function Ro(e){return!!(Lo(e)||e.variants)}function zo(e,t,n){for(let r in t){let i=t[r],a=n[r];if(R(i))e.addValue(r,i);else if(R(a))e.addValue(r,Si(i,{owner:e}));else if(a!==i){if(e.hasValue(r)){let t=e.getValue(r);t.liveStyle===!0?t.jump(i):t.hasAnimated||t.set(i)}else{let t=e.getStaticValue(r);e.addValue(r,Si(t===void 0?i:t,{owner:e}))}}}for(let r in n)t[r]===void 0&&e.removeValue(r);return t}var Bo={current:null},Vo={current:!1},Ho=typeof window<`u`;function Uo(){if(Vo.current=!0,Ho){if(window.matchMedia){let e=window.matchMedia(`(prefers-reduced-motion)`),t=()=>Bo.current=e.matches;e.addEventListener(`change`,t),t()}else Bo.current=!1}}var Wo=[`AnimationStart`,`AnimationComplete`,`Update`,`BeforeLayoutMeasure`,`LayoutMeasure`,`LayoutAnimationStart`,`LayoutAnimationComplete`],Go={};function Ko(e){Go=e}function qo(){return Go}var Jo=class{scrapeMotionValuesFromProps(e,t,n){return{}}constructor({parent:e,props:t,presenceContext:n,reducedMotionConfig:r,skipAnimations:i,blockInitialAnimation:a,visualState:o},s={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=Br,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify(`Update`,this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{let e=M.now();this.renderScheduledAt<e&&(this.renderScheduledAt=e,I.render(this.render,!1,!0))};let{latestValues:c,renderState:l}=o;this.latestValues=c,this.baseTarget={...c},this.initialValues=t.initial?{...c}:{},this.renderState=l,this.parent=e,this.props=t,this.presenceContext=n,this.depth=e?e.depth+1:0,this.reducedMotionConfig=r,this.skipAnimationsConfig=i,this.options=s,this.blockInitialAnimation=!!a,this.isControllingVariants=Lo(t),this.isVariantNode=Ro(t),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);let{willChange:u,...d}=this.scrapeMotionValuesFromProps(t,{},this);for(let e in d){let t=d[e];c[e]!==void 0&&R(t)&&t.set(c[e])}}mount(e){if(this.hasBeenMounted)for(let e in this.initialValues)this.values.get(e)?.jump(this.initialValues[e]),this.latestValues[e]=this.initialValues[e];if(this.current=e,Mo.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.isVariantNode&&!this.isControllingVariants){let e=this;do e=e.props.inherit!==!1&&e.parent;while(e&&!e.isVariantNode);if(e){let{variantChildren:t}=e;t.add(this),this.removeFromVariantTree=()=>t.delete(this)}}this.values.forEach((e,t)=>this.bindToMotionValue(t,e)),this.reducedMotionConfig===`never`?this.shouldReduceMotion=!1:this.reducedMotionConfig===`always`?this.shouldReduceMotion=!0:(Vo.current||Uo(),this.shouldReduceMotion=Bo.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,this.parent?.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){this.projection&&this.projection.unmount(),mn(this.notifyUpdate),mn(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(let e in this.events)this.events[e].clear();for(let e in this.features){let t=this.features[e];t&&(t.unmount(),t.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??=new Set,this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,t){if(this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)(),t.accelerate&&li.has(e)&&this.current instanceof HTMLElement){let{factory:n,keyframes:r,times:i,ease:a,duration:o}=t.accelerate,s=new $r({element:this.current,name:e,keyframes:r,times:i,ease:a,duration:Te(o)}),c=n(s);this.valueSubscriptions.set(e,()=>{c(),s.cancel()});return}let n=wr.has(e);n&&this.onBindTransform&&this.onBindTransform();let r=t.on(`change`,t=>{this.latestValues[e]=t,this.props.onUpdate&&I.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()}),i;typeof window<`u`&&window.MotionCheckAppearSync&&(i=window.MotionCheckAppearSync(this,e,t)),this.valueSubscriptions.set(e,()=>{r(),i&&i()})}sortNodePosition(e){return!this.current||!e.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e=`animation`;for(e in Go){let t=Go[e];if(!t)continue;let{isEnabled:n,Feature:r}=t;if(!this.features[e]&&r&&n(this.props)&&(this.features[e]=new r(this)),this.features[e]){let t=this.features[e];t.isMounted?t.update():(t.mount(),t.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):z()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,t){this.latestValues[e]=t}update(e,t){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=t;for(let t=0;t<Wo.length;t++){let n=Wo[t];this.propEventSubscriptions[n]&&(this.propEventSubscriptions[n](),delete this.propEventSubscriptions[n]);let r=e[`on`+n];r&&(this.propEventSubscriptions[n]=this.on(n,r))}this.prevMotionValues=zo(this,this.scrapeMotionValuesFromProps(e,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}addValue(e,t){let n=this.values.get(e);if(t!==n){n&&this.removeValue(e),this.bindToMotionValue(e,t),this.values.set(e,t);let r=t.get();r!==void 0&&(this.latestValues[e]=r)}}removeValue(e){this.values.delete(e);let t=this.valueSubscriptions.get(e);t&&(t(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,t){if(this.props.values&&this.props.values[e])return this.props.values[e];let n=this.values.get(e);return n===void 0&&t!==void 0&&(n=Si(t??this.getDefaultValue?.(e),{owner:this}),this.addValue(e,n)),n}readValue(e,t){let n=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return n!=null&&(typeof n==`string`&&(ve(n)||be(n))?n=parseFloat(n):typeof n!=`number`&&!Ut.test(n)&&Ut.test(t)&&(n=lr(e,t)),this.setBaseTarget(e,R(n)?n.get():n)),R(n)?n.get():n}setBaseTarget(e,t){this.baseTarget[e]=t}on(e,t){return this.events[e]||(this.events[e]=new we),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}scheduleRenderMicrotask(){Wa.render(this.render)}},Yo=class extends Jo{constructor(){super(...arguments),this.KeyframeResolver=ca}sortInstanceNodePosition(e,t){return e.compareDocumentPosition(t)&2?1:-1}getBaseTargetFromProps(e,t){let n=e.style;return n?n[t]:void 0}removeValueFromRenderState(e,{vars:t,style:n}){delete t[e],delete n[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);let{children:e}=this.props;R(e)&&(this.childSubscription=e.on(`change`,e=>{this.current&&(this.current.textContent=`${e}`)}))}},Xo=class{constructor(e){this.isMounted=!1,this.node=e}update(){}};function Zo(e,{style:t,vars:n},r,i){let a=e.style,o;for(o in t)a[o]=t[o];for(o in i?.applyProjectionStyles(a,r),n)a.setProperty(o,n[o])}var Qo={};function $o(e,{layout:t,layoutId:n}){return wr.has(e)||e.startsWith(`origin`)||(t||n!==void 0)&&(!!Qo[e]||e===`opacity`)}function es(e,t,n){let r=e.style,i=t?.style,a={};if(!r)return a;for(let t in r)(R(r[t])||i&&R(i[t])||$o(t,e)||n?.getValue(t)?.liveStyle!==void 0)&&(a[t]=r[t]);return a}function ts(e){return window.getComputedStyle(e)}var ns=class extends Yo{constructor(){super(...arguments),this.type=`html`,this.renderInstance=Zo}mount(e){e.style,super.mount(e)}readValueFromInstance(e,t){if(wr.has(t))return this.projection?.isProjecting?yr(t):xr(e,t);{let n=ts(e),r=(et(t)?n.getPropertyValue(t):n[t])||0;return typeof r==`string`?r.trim():r}}measureInstanceViewportBox(e,{transformPagePoint:t}){return Ha(e,t)}build(e,t,n){_a(e,t,n.transformTemplate)}scrapeMotionValuesFromProps(e,t,n){return es(e,t,n)}},rs=new Set([`baseFrequency`,`diffuseConstant`,`kernelMatrix`,`kernelUnitLength`,`keySplines`,`keyTimes`,`limitingConeAngle`,`markerHeight`,`markerWidth`,`numOctaves`,`targetX`,`targetY`,`surfaceScale`,`specularConstant`,`specularExponent`,`stdDeviation`,`tableValues`,`viewBox`,`gradientTransform`,`pathLength`,`startOffset`,`textLength`,`lengthAdjust`]),is=e=>typeof e==`string`&&e.toLowerCase()===`svg`;function as(e,t,n,r){Zo(e,t,void 0,r);for(let n in t.attrs)e.setAttribute(rs.has(n)?n:qi(n),t.attrs[n])}function os(e,t,n){let r=es(e,t,n);for(let n in e)if(R(e[n])||R(t[n])){let t=Cr.indexOf(n)===-1?n:`attr`+n.charAt(0).toUpperCase()+n.substring(1);r[t]=e[n]}return r}var ss=class extends Yo{constructor(){super(...arguments),this.type=`svg`,this.isSVGTag=!1,this.measureInstanceViewportBox=z}getBaseTargetFromProps(e,t){return wr.has(t)?super.getBaseTargetFromProps(e,t)??yr(t):e[t]}getDefaultValue(e){return wr.has(e)?this.latestValues[e]??yr(e):void 0}readValueFromInstance(e,t){if(wr.has(t)){let e=sr(t);return e&&e.default||0}if(xa.includes(t)){let n=getComputedStyle(e)[t];if(typeof n==`string`&&n)return n.trim()}return t=rs.has(t)?t:qi(t),e.getAttribute(t)}scrapeMotionValuesFromProps(e,t,n){return os(e,t,n)}build(e,t,n){Sa(e,t,this.isSVGTag,n.transformTemplate,n.style)}renderInstance(e,t,n,r){as(e,t,n,r)}mount(e){this.isSVGTag=is(e.tagName),super.mount(e)}};function cs(e,t){if(!Array.isArray(t))return!1;let n=t.length;if(n!==e.length)return!1;for(let r=0;r<n;r++)if(t[r]!==e[r])return!1;return!0}var ls=[...Fo].reverse();function us(e){let t=t=>Promise.all(t.map(({animation:t,options:n})=>ea(e,t,n))),n=fs(),r=!0,i=!1;function a(a){let{props:o,parent:s,manuallyAnimateOnMount:c}=e,l=r||i,u=[],d=new Set,f={},p=1/0,m=e;do m=m.props.inherit!==!1&&m.parent;while(m&&!m.isControllingVariants);if(ls.forEach((t,r)=>{let i=n[t],h=o[t],g=m&&m.props[t],_=h===void 0?Po(g)||g===!1?g:void 0:h,v=Po(_),y=t===a?i.isActive:null;y===!1&&(p=r);let b=v&&h===void 0&&!(l&&c);if(i.protectedKeys={...f},!i.isActive&&y===null||!_&&!i.prevProp||No(_)||typeof _==`boolean`)return;if(t===`exit`&&i.isActive&&y!==!0){f={...f,...i.prevResolvedValues};return}let x=ds(i.prevProp,_),S=x||v&&(y&&!b||r>p),C=!1,w=Array.isArray(_)?_:[_],ee={};if(y!==!1)for(let n of w){let{transition:r,transitionEnd:i,...a}=Ri(e,n,zi(e,t))||{};ee={...ee,...a,...i}}let{prevResolvedValues:te}=i;for(let t in{...te,...ee}){if(t in f)continue;let n=ee[t],r=te[t],a=Array.isArray(n)&&Array.isArray(r)?!cs(n,r)||x:n!==r;if(a&&n==null)d.add(t);else if(a||n!==void 0&&d.has(t)){S=!0,d.delete(t)&&(C=!0),i.needsAnimating[t]=!0;let n=e.getValue(t);n&&(n.liveStyle=!1)}else i.protectedKeys[t]=!0}if(i.prevProp=_,i.prevResolvedValues=ee,i.isActive&&(f={...f,...ee}),S&&(!(b&&x)||C))for(let n of w){let r={type:t};if(typeof n==`string`&&l&&c&&s?.enteringChildren){let t=Ri(s,n)?.transition?.delayChildren;r.delay=_i(s.enteringChildren,e,t)}u.push({animation:n,options:r})}}),d.size){let{initial:t}=o,n={},r=typeof t!=`boolean`&&Ri(e,Array.isArray(t)?t[0]:t,e.presenceContext?.custom);r&&r.transition&&(n.transition=r.transition),d.forEach(i=>{let a=e.getValue(i);a&&(a.liveStyle=!0);let s=r&&!Array.isArray(t)?r[i]:void 0,c=e.getBaseTargetFromProps(o,i);n[i]=(s===void 0?c!==void 0&&!R(c)?c:e.initialValues[i]===void 0?e.baseTarget[i]:void 0:s)??null}),u.push({animation:n})}let h=l&&e.blockInitialAnimation||r&&!c&&(o.initial===!1||o.initial===o.animate);return r=i=!1,!h&&u.length?t(u):Promise.resolve()}function o(t,r){if(n[t].isActive===r)return Promise.resolve();e.variantChildren?.forEach(e=>e.animationState?.setActive(t,r)),n[t].isActive=r;let i=a(t);for(let e in n)n[e].protectedKeys={};return i}return{animateChanges:a,setActive:o,setAnimateFunction:n=>{t=n(e)},getState:()=>n,reset:()=>{n=fs(),i=!0}}}function ds(e,t){return typeof t==`string`?t!==e:Array.isArray(t)?!cs(t,e):!1}function fs(){let e={};for(let t of Fo)e[t]={isActive:t===`animate`,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}};return e}function ps(e,t){e.min=t.min,e.max=t.max}function ms(e,t){ps(e.x,t.x),ps(e.y,t.y)}function hs(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}var gs=.9999,_s=1.0001,vs=-.01,ys=.01;function B(e){return e.max-e.min}function bs(e,t,n){return Math.abs(e-t)<=n}function xs(e,t,n,r=.5){e.origin=r,e.originPoint=F(t.min,t.max,e.origin),e.scale=B(n)/B(t),e.translate=F(n.min,n.max,e.origin)-e.originPoint,(e.scale>=gs&&e.scale<=_s||isNaN(e.scale))&&(e.scale=1),(e.translate>=vs&&e.translate<=ys||isNaN(e.translate))&&(e.translate=0)}function Ss(e,t,n,r){xs(e.x,t.x,n.x,r?r.originX:void 0),xs(e.y,t.y,n.y,r?r.originY:void 0)}function Cs(e,t,n,r=0){e.min=(r?F(n.min,n.max,r):n.min)+t.min,e.max=e.min+B(t)}function ws(e,t,n,r){Cs(e.x,t.x,n.x,r?.x),Cs(e.y,t.y,n.y,r?.y)}function Ts(e,t,n,r=0){let i=r?F(n.min,n.max,r):n.min;e.min=t.min-i,e.max=e.min+B(t)}function Es(e,t,n,r){Ts(e.x,t.x,n.x,r?.x),Ts(e.y,t.y,n.y,r?.y)}function Ds(e,t,n,r,i){return e-=t,e=ja(e,1/n,r),i!==void 0&&(e=ja(e,1/i,r)),e}function Os(e,t=0,n=1,r=.5,i,a=e,o=e){if(bt.test(t)&&(t=parseFloat(t),t=F(o.min,o.max,t/100)-o.min),typeof t!=`number`)return;let s=F(a.min,a.max,r);e===a&&(s-=t),e.min=Ds(e.min,t,n,s,i),e.max=Ds(e.max,t,n,s,i)}function ks(e,t,[n,r,i],a,o){Os(e,t[n],t[r],t[i],t.scale,a,o)}var As=[`x`,`scaleX`,`originX`],js=[`y`,`scaleY`,`originY`];function Ms(e,t,n,r){ks(e.x,t,As,n?n.x:void 0,r?r.x:void 0),ks(e.y,t,js,n?n.y:void 0,r?r.y:void 0)}function Ns(e){return e.translate===0&&e.scale===1}function Ps(e){return Ns(e.x)&&Ns(e.y)}function Fs(e,t){return e.min===t.min&&e.max===t.max}function Is(e,t){return Fs(e.x,t.x)&&Fs(e.y,t.y)}function Ls(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function Rs(e,t){return Ls(e.x,t.x)&&Ls(e.y,t.y)}function zs(e){return B(e.x)/B(e.y)}function Bs(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function Vs(e){return[e(`x`),e(`y`)]}function Hs(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}var Us={correct:(e,t)=>{if(!t.target)return e;if(typeof e==`string`){if(N.test(e))e=parseFloat(e);else return e}return`${Hs(e,t.target.x)}% ${Hs(e,t.target.y)}%`}},Ws={correct:(e,{treeScale:t,projectionDelta:n})=>{let r=e,i=Ut.parse(e);if(i.length>5)return r;let a=Ut.createTransformer(e),o=typeof i[0]==`number`?0:1,s=n.x.scale*t.x,c=n.y.scale*t.y;i[0+o]/=s,i[1+o]/=c;let l=F(s,c,.5);return typeof i[2+o]==`number`&&(i[2+o]/=l),typeof i[3+o]==`number`&&(i[3+o]/=l),a(i)}};function Gs(e,t,n){let r=``,i=e.x.translate/t.x,a=e.y.translate/t.y,o=n?.z||0;if((i||a||o)&&(r=`translate3d(${i}px, ${a}px, ${o}px) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){let{transformPerspective:e,rotate:t,pathRotation:i,rotateX:a,rotateY:o,skewX:s,skewY:c}=n;e&&(r=`perspective(${e}px) ${r}`),t&&(r+=`rotate(${t}deg) `),i&&(r+=`rotate(${i}deg) `),a&&(r+=`rotateX(${a}deg) `),o&&(r+=`rotateY(${o}deg) `),s&&(r+=`skewX(${s}deg) `),c&&(r+=`skewY(${c}deg) `)}let s=e.x.scale*t.x,c=e.y.scale*t.y;return(s!==1||c!==1)&&(r+=`scale(${s}, ${c})`),r||`none`}var Ks=la.length,qs=e=>typeof e==`number`||N.test(e);function Js(e,t,n,r,i,a){i?(e.opacity=F(0,n.opacity??1,Xs(r)),e.opacityExit=F(t.opacity??1,0,Zs(r))):a&&(e.opacity=F(t.opacity??1,n.opacity??1,r));for(let i=0;i<Ks;i++){let a=la[i],o=Ys(t,a),s=Ys(n,a);(o!==void 0||s!==void 0)&&(o||=0,s||=0,o===0||s===0||qs(o)===qs(s)?(e[a]=Math.max(F(Oo(o),Oo(s),r),0),(bt.test(s)||bt.test(o))&&(e[a]+=`%`)):e[a]=s)}(t.rotate||n.rotate)&&(e.rotate=F(t.rotate||0,n.rotate||0,r))}function Ys(e,t){return e[t]===void 0?e.borderRadius:e[t]}var Xs=Qs(0,.5,Be),Zs=Qs(.5,.95,A);function Qs(e,t,n){return r=>r<e?0:r>t?1:n(Ce(e,t,r))}function $s(e,t,n){let r=R(e)?e:Si(e);return r.start(Mi(``,r,t,n)),r.animation}function ec(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)}var tc=(e,t)=>e.depth-t.depth,nc=class{constructor(){this.children=[],this.isDirty=!1}add(e){he(this.children,e),this.isDirty=!0}remove(e){k(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(tc),this.isDirty=!1,this.children.forEach(e)}};function rc(e,t){let n=M.now(),r=({timestamp:i})=>{let a=i-n;a>=t&&(mn(r),e(a-t))};return I.setup(r,!0),()=>mn(r)}function ic(e){return R(e)?e.get():e}var ac=class{constructor(){this.members=[]}add(e){he(this.members,e);for(let t=this.members.length-1;t>=0;t--){let n=this.members[t];if(n===e||n===this.lead||n===this.prevLead)continue;let r=n.instance;(!r||r.isConnected===!1)&&!n.snapshot&&(k(this.members,n),n.unmount())}e.scheduleRender()}remove(e){if(k(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){let e=this.members[this.members.length-1];e&&this.promote(e)}}relegate(e){for(let t=this.members.indexOf(e)-1;t>=0;t--){let e=this.members[t];if(e.isPresent!==!1&&e.instance?.isConnected!==!1)return this.promote(e),!0}return!1}promote(e,t){let n=this.lead;if(e!==n&&(this.prevLead=n,this.lead=e,e.show(),n)){n.updateSnapshot(),e.scheduleRender();let{layoutDependency:r}=n.options,{layoutDependency:i}=e.options;(r===void 0||r!==i)&&(e.resumeFrom=n,t&&(n.preserveOpacity=!0),n.snapshot&&(e.snapshot=n.snapshot,e.snapshot.latestValues=n.animationValues||n.latestValues),e.root?.isUpdating&&(e.isLayoutDirty=!0)),e.options.crossfade===!1&&n.hide()}}exitAnimationComplete(){this.members.forEach(e=>{e.options.onExitComplete?.(),e.resumingFrom?.options.onExitComplete?.()})}scheduleRender(){this.members.forEach(e=>e.instance&&e.scheduleRender(!1))}removeLeadSnapshot(){this.lead?.snapshot&&(this.lead.snapshot=void 0)}},oc={borderRadius:{...Us,applyTo:[...la]},borderTopLeftRadius:Us,borderTopRightRadius:Us,borderBottomLeftRadius:Us,borderBottomRightRadius:Us,boxShadow:Ws},sc={hasAnimatedSinceResize:!0,hasEverUpdated:!1};Object.assign(Qo,{...oc,...Qo});var cc={nodes:0,calculatedTargetDeltas:0,calculatedProjections:0},lc=[``,`X`,`Y`,`Z`],uc=1e3,dc=0;function fc(e,t,n,r){let{latestValues:i}=t;i[e]&&(n[e]=i[e],t.setStaticValue(e,0),r&&(r[e]=0))}function pc(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;let{visualElement:t}=e.options;if(!t)return;let n=Yi(t);if(window.MotionHasOptimisedAnimation(n,`transform`)){let{layout:t,layoutId:r}=e.options;window.MotionCancelOptimisedAnimation(n,`transform`,I,!(t||r))}let{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&pc(r)}function mc({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return class{constructor(e={},n=t?.()){this.id=dc++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,Eo.value&&(cc.nodes=cc.calculatedTargetDeltas=cc.calculatedProjections=0),this.nodes.forEach(_c),this.nodes.forEach(Dc),this.nodes.forEach(Oc),this.nodes.forEach(vc),Eo.addProjectionMetrics&&Eo.addProjectionMetrics(cc)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=e,this.root=n?n.root||n:this,this.path=n?[...n.path,n]:[],this.parent=n,this.depth=n?n.depth+1:0;for(let e=0;e<this.path.length;e++)this.path[e].shouldResetTransform=!0;this.root===this&&(this.nodes=new nc)}addEventListener(e,t){return this.eventHandlers.has(e)||this.eventHandlers.set(e,new we),this.eventHandlers.get(e).add(t)}notifyListeners(e,...t){let n=this.eventHandlers.get(e);n&&n.notify(...t)}hasListeners(e){return this.eventHandlers.has(e)}mount(t){if(this.instance)return;this.isSVG=da(t)&&!Do(t),this.instance=t;let{layoutId:n,layout:r,visualElement:i}=this.options;if(i&&!i.current&&i.mount(t),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(r||n)&&(this.isLayoutDirty=!0),e){let n,r=0,i=()=>this.root.updateBlockedByResize=!1;I.read(()=>{r=window.innerWidth}),e(t,()=>{let e=window.innerWidth;e!==r&&(r=e,this.root.updateBlockedByResize=!0,n&&n(),n=rc(i,250),sc.hasAnimatedSinceResize&&(sc.hasAnimatedSinceResize=!1,this.nodes.forEach(Ec)))})}n&&this.root.registerSharedNode(n,this),this.options.animate!==!1&&i&&(n||r)&&this.addEventListener(`didUpdate`,({delta:e,hasLayoutChanged:t,hasRelativeLayoutChanged:n,layout:r})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}let a=this.options.transition||i.getDefaultTransition()||Fc,{onLayoutAnimationStart:o,onLayoutAnimationComplete:s}=i.getProps(),c=!this.targetLayout||!Rs(this.targetLayout,r),l=!t&&n;if(this.options.layoutRoot||this.resumeFrom||l||t&&(c||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);let t={...wi(a,`layout`),onPlay:o,onComplete:s};(i.shouldReduceMotion||this.options.layoutRoot)&&(t.delay=0,t.type=!1),this.startAnimation(t),this.setAnimationOrigin(e,l,t.path)}else t||Ec(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=r})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);let e=this.getStack();e&&e.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),mn(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(kc),this.animationId++)}getTransformTemplate(){let{visualElement:e}=this.options;return e&&e.getProps().transformTemplate}willUpdate(e=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&pc(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let e=0;e<this.path.length;e++){let t=this.path[e];t.shouldResetTransform=!0,(typeof t.latestValues.x==`string`||typeof t.latestValues.y==`string`)&&(t.isLayoutDirty=!0),t.updateScroll(`snapshot`),t.options.layoutRoot&&t.willUpdate(!1)}let{layoutId:t,layout:n}=this.options;if(t===void 0&&!n)return;let r=this.getTransformTemplate();this.prevTransformTemplateValue=r?r(this.latestValues,``):void 0,this.updateSnapshot(),e&&this.notifyListeners(`willUpdate`)}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){let e=this.updateBlockedByResize;this.unblockUpdate(),this.updateBlockedByResize=!1,this.clearAllSnapshots(),e&&this.nodes.forEach(xc),this.nodes.forEach(bc);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(Sc);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(Cc),this.nodes.forEach(wc),this.nodes.forEach(Tc),this.nodes.forEach(hc),this.nodes.forEach(gc)):this.nodes.forEach(Sc),this.clearAllSnapshots();let e=M.now();j.delta=ge(0,1e3/60,e-j.timestamp),j.timestamp=e,j.isProcessing=!0,hn.update.process(j),hn.preRender.process(j),hn.render.process(j),j.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,Wa.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(yc),this.sharedNodes.forEach(Ac)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,I.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){I.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){!this.snapshot&&this.instance&&(this.snapshot=this.measure(),this.snapshot&&!B(this.snapshot.measuredBox.x)&&!B(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let e=0;e<this.path.length;e++)this.path[e].updateScroll();let e=this.layout;this.layout=this.measure(!1),this.layoutCorrected||=z(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners(`measure`,this.layout.layoutBox);let{visualElement:t}=this.options;t&&t.notify(`LayoutMeasure`,this.layout.layoutBox,e?e.layoutBox:void 0)}updateScroll(e=`measure`){let t=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===e&&(t=!1),t&&this.instance){let t=r(this.instance);this.scroll={animationId:this.root.animationId,phase:e,isRoot:t,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:t}}}resetTransform(){if(!i)return;let e=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,t=this.projectionDelta&&!Ps(this.projectionDelta),n=this.getTransformTemplate(),r=n?n(this.latestValues,``):void 0,a=r!==this.prevTransformTemplateValue;e&&this.instance&&(t||Oa(this.latestValues)||a)&&(i(this.instance,r),this.shouldResetTransform=!1,this.scheduleRender())}measure(e=!0){let t=this.measurePageBox(),n=this.removeElementScroll(t);return e&&(n=this.removeTransform(n)),zc(n),{animationId:this.root.animationId,measuredBox:t,layoutBox:n,latestValues:{},source:this.id}}measurePageBox(){let{visualElement:e}=this.options;if(!e)return z();let t=e.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(Vc))){let{scroll:e}=this.root;e&&(Ra(t.x,e.offset.x),Ra(t.y,e.offset.y))}return t}removeElementScroll(e){let t=z();if(ms(t,e),this.scroll?.wasRoot)return t;for(let n=0;n<this.path.length;n++){let r=this.path[n],{scroll:i,options:a}=r;r!==this.root&&i&&a.layoutScroll&&(i.wasRoot&&ms(t,e),Ra(t.x,i.offset.x),Ra(t.y,i.offset.y))}return t}applyTransform(e,t=!1,n){let r=n||z();ms(r,e);for(let e=0;e<this.path.length;e++){let n=this.path[e];!t&&n.options.layoutScroll&&n.scroll&&n!==n.root&&(Ra(r.x,-n.scroll.offset.x),Ra(r.y,-n.scroll.offset.y)),Oa(n.latestValues)&&Va(r,n.latestValues,n.layout?.layoutBox)}return Oa(this.latestValues)&&Va(r,this.latestValues,this.layout?.layoutBox),r}removeTransform(e){let t=z();ms(t,e);for(let e=0;e<this.path.length;e++){let n=this.path[e];if(!Oa(n.latestValues))continue;let r;n.instance&&(Da(n.latestValues)&&n.updateSnapshot(),r=z(),ms(r,n.measurePageBox())),Ms(t,n.latestValues,n.snapshot?.layoutBox,r)}return Oa(this.latestValues)&&Ms(t,this.latestValues),t}setTargetDelta(e){this.targetDelta=e,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(e){this.options={...this.options,...e,crossfade:e.crossfade===void 0||e.crossfade}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==j.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(e=!1){let t=this.getLead();this.isProjectionDirty||=t.isProjectionDirty,this.isTransformDirty||=t.isTransformDirty,this.isSharedProjectionDirty||=t.isSharedProjectionDirty;let n=!!this.resumingFrom||this!==t;if(!(e||n&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;let{layout:r,layoutId:i}=this.options;if(!this.layout||!(r||i))return;this.resolvedRelativeTargetAt=j.timestamp;let a=this.getClosestProjectingParent();!this.targetDelta&&!this.relativeTarget&&(this.options.layoutAnchor!==!1&&a&&a.layout?this.createRelativeTarget(a,this.layout.layoutBox,a.layout.layoutBox):this.removeRelativeTarget()),(this.relativeTarget||this.targetDelta)&&(this.target||(this.target=z(),this.targetWithTransforms=z()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),ws(this.target,this.relativeTarget,this.relativeParent.target,this.options.layoutAnchor||void 0)):this.targetDelta?(this.resumingFrom?this.applyTransform(this.layout.layoutBox,!1,this.target):ms(this.target,this.layout.layoutBox),Pa(this.target,this.targetDelta)):ms(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,this.options.layoutAnchor!==!1&&a&&!!a.resumingFrom==!!this.resumingFrom&&!a.options.layoutScroll&&a.target&&this.animationProgress!==1?this.createRelativeTarget(a,this.target,a.target):this.relativeParent=this.relativeTarget=void 0),Eo.value&&cc.calculatedTargetDeltas++)}getClosestProjectingParent(){if(!(!this.parent||Da(this.parent.latestValues)||ka(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(e,t,n){this.relativeParent=e,this.forceRelativeParentToResolveTarget(),this.relativeTarget=z(),this.relativeTargetOrigin=z(),Es(this.relativeTargetOrigin,t,n,this.options.layoutAnchor||void 0),ms(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){let e=this.getLead(),t=!!this.resumingFrom||this!==e,n=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(n=!1),t&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(n=!1),this.resolvedRelativeTargetAt===j.timestamp&&(n=!1),n)return;let{layout:r,layoutId:i}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(r||i))return;ms(this.layoutCorrected,this.layout.layoutBox);let a=this.treeScale.x,o=this.treeScale.y;La(this.layoutCorrected,this.treeScale,this.path,t),e.layout&&!e.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(e.target=e.layout.layoutBox,e.targetWithTransforms=z());let{target:s}=e;if(!s){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(hs(this.prevProjectionDelta.x,this.projectionDelta.x),hs(this.prevProjectionDelta.y,this.projectionDelta.y)),Ss(this.projectionDelta,this.layoutCorrected,s,this.latestValues),(this.treeScale.x!==a||this.treeScale.y!==o||!Bs(this.projectionDelta.x,this.prevProjectionDelta.x)||!Bs(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners(`projectionUpdate`,s)),Eo.value&&cc.calculatedProjections++}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(e=!0){if(this.options.visualElement?.scheduleRender(),e){let e=this.getStack();e&&e.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=Ao(),this.projectionDelta=Ao(),this.projectionDeltaWithTransform=Ao()}setAnimationOrigin(e,t=!1,n){let r=this.snapshot,i=r?r.latestValues:{},a={...this.latestValues},o=Ao();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!t;let s=z(),c=(r?r.source:void 0)!==(this.layout?this.layout.source:void 0),l=this.getStack(),u=!l||l.members.length<=1,d=!(!c||u||this.options.crossfade!==!0||this.path.some(Pc));this.animationProgress=0;let f,p=n?.interpolateProjection(e);this.mixTargetDelta=t=>{let n=t/1e3,r=p?.(n);r?(o.x.translate=r.x,o.x.scale=F(e.x.scale,1,n),o.x.origin=e.x.origin,o.x.originPoint=e.x.originPoint,o.y.translate=r.y,o.y.scale=F(e.y.scale,1,n),o.y.origin=e.y.origin,o.y.originPoint=e.y.originPoint):(jc(o.x,e.x,n),jc(o.y,e.y,n)),this.setTargetDelta(o),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Es(s,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),Nc(this.relativeTarget,this.relativeTargetOrigin,s,n),f&&Is(this.relativeTarget,f)&&(this.isProjectionDirty=!1),f||=z(),ms(f,this.relativeTarget)),c&&(this.animationValues=a,Js(a,i,this.latestValues,n,d,u)),r&&r.rotate!==void 0&&(this.animationValues||=a,this.animationValues.pathRotation=r.rotate),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=n},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(e){this.notifyListeners(`animationStart`),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&=(mn(this.pendingAnimation),void 0),this.pendingAnimation=I.update(()=>{sc.hasAnimatedSinceResize=!0,this.motionValue||=Si(0),this.motionValue.jump(0,!1),this.currentAnimation=$s(this.motionValue,[0,1e3],{...e,velocity:0,isSync:!0,onUpdate:t=>{this.mixTargetDelta(t),e.onUpdate&&e.onUpdate(t)},onComplete:()=>{e.onComplete&&e.onComplete(),this.completeAnimation()}}),Yn(this.currentAnimation,this),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);let e=this.getStack();e&&e.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners(`animationComplete`)}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(uc),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){let e=this.getLead(),{targetWithTransforms:t,layout:n,latestValues:r}=e,{target:i}=e;if(t&&i&&n){if(this!==e&&this.layout&&n&&Bc(this.options.animationType,this.layout.layoutBox,n.layoutBox)){i=this.target||z();let t=B(this.layout.layoutBox.x);i.x.min=e.target.x.min,i.x.max=i.x.min+t;let n=B(this.layout.layoutBox.y);i.y.min=e.target.y.min,i.y.max=i.y.min+n}ms(t,i),Va(t,r),Ss(this.projectionDeltaWithTransform,this.layoutCorrected,t,r)}}registerSharedNode(e,t){this.sharedNodes.has(e)||this.sharedNodes.set(e,new ac),this.sharedNodes.get(e).add(t);let n=t.options.initialPromotionConfig;t.promote({transition:n?n.transition:void 0,preserveFollowOpacity:n&&n.shouldPreserveFollowOpacity?n.shouldPreserveFollowOpacity(t):void 0})}isLead(){let e=this.getStack();return!e||e.lead===this}getLead(){let{layoutId:e}=this.options;return e&&this.getStack()?.lead||this}getPrevLead(){let{layoutId:e}=this.options;return e?this.getStack()?.prevLead:void 0}getStack(){let{layoutId:e}=this.options;if(e)return this.root.sharedNodes.get(e)}promote({needsReset:e,transition:t,preserveFollowOpacity:n}={}){let r=this.getStack();r&&r.promote(this,n),e&&(this.projectionDelta=void 0,this.needsReset=!0),t&&this.setOptions({transition:t})}relegate(){let e=this.getStack();return e?e.relegate(this):!1}resetSkewAndRotation(){let{visualElement:e}=this.options;if(!e)return;let t=!1,{latestValues:n}=e;if((n.z||n.rotate||n.rotateX||n.rotateY||n.rotateZ||n.skewX||n.skewY)&&(t=!0),!t)return;let r={};n.z&&fc(`z`,e,r,this.animationValues);for(let t=0;t<lc.length;t++)fc(`rotate${lc[t]}`,e,r,this.animationValues),fc(`skew${lc[t]}`,e,r,this.animationValues);e.render();for(let t in r)e.setStaticValue(t,r[t]),this.animationValues&&(this.animationValues[t]=r[t]);e.scheduleRender()}applyProjectionStyles(e,t){if(!this.instance||this.isSVG)return;if(!this.isVisible){e.visibility=`hidden`;return}let n=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,e.visibility=``,e.opacity=``,e.pointerEvents=ic(t?.pointerEvents)||``,e.transform=n?n(this.latestValues,``):`none`;return}let r=this.getLead();if(!this.projectionDelta||!this.layout||!r.target){this.options.layoutId&&(e.opacity=this.latestValues.opacity===void 0?1:this.latestValues.opacity,e.pointerEvents=ic(t?.pointerEvents)||``),this.hasProjected&&!Oa(this.latestValues)&&(e.transform=n?n({},``):`none`,this.hasProjected=!1);return}e.visibility=``;let i=r.animationValues||r.latestValues;this.applyTransformsToTarget();let a=Gs(this.projectionDeltaWithTransform,this.treeScale,i);n&&(a=n(i,a)),e.transform=a;let{x:o,y:s}=this.projectionDelta;e.transformOrigin=`${o.origin*100}% ${s.origin*100}% 0`,e.opacity=r.animationValues?r===this?i.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:i.opacityExit:r===this?i.opacity===void 0?``:i.opacity:i.opacityExit===void 0?0:i.opacityExit;for(let t in Qo){if(i[t]===void 0)continue;let{correct:n,applyTo:o,isCSSVariable:s}=Qo[t],c=a===`none`?i[t]:n(i[t],r);if(o){let t=o.length;for(let n=0;n<t;n++)e[o[n]]=c}else s?this.options.visualElement.renderState.vars[t]=c:e[t]=c}this.options.layoutId&&(e.pointerEvents=r===this?ic(t?.pointerEvents)||``:`none`)}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(e=>e.currentAnimation?.stop()),this.root.nodes.forEach(bc),this.root.sharedNodes.clear()}}}function hc(e){e.updateLayout()}function gc(e){let t=e.resumeFrom?.snapshot||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners(`didUpdate`)){let{layoutBox:n,measuredBox:r}=e.layout,{animationType:i}=e.options,a=t.source!==e.layout.source;if(i===`size`)Vs(e=>{let r=a?t.measuredBox[e]:t.layoutBox[e],i=B(r);r.min=n[e].min,r.max=r.min+i});else if(i===`x`||i===`y`){let e=i===`x`?`y`:`x`;ps(a?t.measuredBox[e]:t.layoutBox[e],n[e])}else Bc(i,t.layoutBox,n)&&Vs(r=>{let i=a?t.measuredBox[r]:t.layoutBox[r],o=B(n[r]);i.max=i.min+o,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[r].max=e.relativeTarget[r].min+o)});let o=Ao();Ss(o,n,t.layoutBox);let s=Ao();a?Ss(s,e.applyTransform(r,!0),t.measuredBox):Ss(s,n,t.layoutBox);let c=!Ps(o),l=!1;if(!e.resumeFrom){let r=e.getClosestProjectingParent();if(r&&!r.resumeFrom){let{snapshot:i,layout:a}=r;if(i&&a){let o=e.options.layoutAnchor||void 0,s=z();Es(s,t.layoutBox,i.layoutBox,o);let c=z();Es(c,n,a.layoutBox,o),Rs(s,c)||(l=!0),r.options.layoutRoot&&(e.relativeTarget=c,e.relativeTargetOrigin=s,e.relativeParent=r)}}}e.notifyListeners(`didUpdate`,{layout:n,snapshot:t,delta:s,layoutDelta:o,hasLayoutChanged:c,hasRelativeLayoutChanged:l})}else if(e.isLead()){let{onExitComplete:t}=e.options;t&&t()}e.options.transition=void 0}function _c(e){Eo.value&&cc.nodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty),e.isTransformDirty||=e.parent.isTransformDirty)}function vc(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function yc(e){e.clearSnapshot()}function bc(e){e.clearMeasurements()}function xc(e){e.isLayoutDirty=!0,e.updateLayout()}function Sc(e){e.isLayoutDirty=!1}function Cc(e){e.isAnimationBlocked&&e.layout&&!e.isLayoutDirty&&(e.snapshot=e.layout,e.isLayoutDirty=!0)}function wc(e){e.relativeTarget&&e.relativeParent?.isLayoutDirty&&(e.currentAnimation?e.isLayoutDirty=!0:(e.targetDelta=void 0,e.removeRelativeTarget()))}function Tc(e){let{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify(`BeforeLayoutMeasure`),e.resetTransform()}function Ec(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function Dc(e){e.resolveTargetDelta()}function Oc(e){e.calcProjection()}function kc(e){e.resetSkewAndRotation()}function Ac(e){e.removeLeadSnapshot()}function jc(e,t,n){e.translate=F(t.translate,0,n),e.scale=F(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function Mc(e,t,n,r){e.min=F(t.min,n.min,r),e.max=F(t.max,n.max,r)}function Nc(e,t,n,r){Mc(e.x,t.x,n.x,r),Mc(e.y,t.y,n.y,r)}function Pc(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}var Fc={duration:.45,ease:[.4,0,.1,1]},Ic=e=>typeof navigator<`u`&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),Lc=Ic(`applewebkit/`)&&!Ic(`chrome/`)?Math.round:A;function Rc(e){e.min=Lc(e.min),e.max=Lc(e.max)}function zc(e){Rc(e.x),Rc(e.y)}function Bc(e,t,n){return e===`position`||e===`preserve-aspect`&&!bs(zs(t),zs(n),.2)}function Vc(e){return e!==e.root&&e.scroll?.wasRoot}var Hc=mc({attachResizeListener:(e,t)=>ec(e,`resize`,t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),Uc={current:void 0},Wc=mc({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!Uc.current){let e=new Hc({});e.mount(window),e.setOptions({layoutScroll:!0}),Uc.current=e}return Uc.current},resetTransform:(e,t)=>{e.style.transform=t===void 0?`none`:t},checkIsScrollRoot:e=>window.getComputedStyle(e).position===`fixed`}),Gc=(0,O.createContext)({transformPagePoint:e=>e,isStatic:!1,reducedMotion:`never`});function Kc(e=!0){let t=(0,O.useContext)(me);if(t===null)return[!0,null];let{isPresent:n,onExitComplete:r,register:i}=t,a=(0,O.useId)();(0,O.useEffect)(()=>{if(e)return i(a)},[e]);let o=(0,O.useCallback)(()=>e&&r&&r(a),[a,r,e]);return!n&&r?[!1,o]:[!0]}var qc=(0,O.createContext)({strict:!1}),Jc={animation:[`animate`,`variants`,`whileHover`,`whileTap`,`exit`,`whileInView`,`whileFocus`,`whileDrag`],exit:[`exit`],drag:[`drag`,`dragControls`],focus:[`whileFocus`],hover:[`whileHover`,`onHoverStart`,`onHoverEnd`],tap:[`whileTap`,`onTap`,`onTapStart`,`onTapCancel`],pan:[`onPan`,`onPanStart`,`onPanSessionStart`,`onPanEnd`],inView:[`whileInView`,`onViewportEnter`,`onViewportLeave`],layout:[`layout`,`layoutId`]},Yc=!1;function Xc(){if(Yc)return;let e={};for(let t in Jc)e[t]={isEnabled:e=>Jc[t].some(t=>!!e[t])};Ko(e),Yc=!0}function Zc(){return Xc(),qo()}function Qc(e){let t=Zc();for(let n in e)t[n]={...t[n],...e[n]};Ko(t)}var $c=(0,O.createContext)({});function el(e,t){if(Lo(e)){let{initial:t,animate:n}=e;return{initial:t===!1||Po(t)?t:void 0,animate:Po(n)?n:void 0}}return e.inherit===!1?{}:t}function tl(e){let{initial:t,animate:n}=el(e,(0,O.useContext)($c));return(0,O.useMemo)(()=>({initial:t,animate:n}),[nl(t),nl(n)])}function nl(e){return Array.isArray(e)?e.join(` `):e}var rl=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function il(e,t,n){for(let r in t)!R(t[r])&&!$o(r,n)&&(e[r]=t[r])}function al({transformTemplate:e},t){return(0,O.useMemo)(()=>{let n=rl();return _a(n,t,e),Object.assign({},n.vars,n.style)},[t])}function ol(e,t){let n=e.style||{},r={};return il(r,n,e),Object.assign(r,al(e,t)),r}function sl(e,t){let n={},r=ol(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout=`none`,r.touchAction=e.drag===!0?`none`:`pan-${e.drag===`x`?`y`:`x`}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=r,n}var cl=()=>({...rl(),attrs:{}});function ll(e,t,n,r){let i=(0,O.useMemo)(()=>{let n=cl();return Sa(n,t,is(r),e.transformTemplate,e.style),{...n.attrs,style:{...n.style}}},[t]);if(e.style){let t={};il(t,e.style,e),i.style={...t,...i.style}}return i}var ul=new Set(`animate.exit.variants.initial.style.values.transition.transformTemplate.custom.inherit.onBeforeLayoutMeasure.onAnimationStart.onAnimationComplete.onUpdate.onDragStart.onDrag.onDragEnd.onMeasureDragConstraints.onDirectionLock.onDragTransitionEnd._dragX._dragY.onHoverStart.onHoverEnd.onViewportEnter.onViewportLeave.globalTapTarget.propagate.ignoreStrict.viewport`.split(`.`));function dl(e){return e.startsWith(`while`)||e.startsWith(`drag`)&&e!==`draggable`||e.startsWith(`layout`)||e.startsWith(`onTap`)||e.startsWith(`onPan`)||e.startsWith(`onLayout`)||ul.has(e)}function fl(e,t){return e.startsWith(`on`)?!dl(e):t?.(e)??!dl(e)}function pl(e,t,n,r){let i={};for(let a in e)(a!==`values`||typeof e.values!=`object`)&&(R(e[a])||(fl(a,r)||n===!0&&dl(a)||!t&&!dl(a)||e.draggable&&a.startsWith(`onDrag`))&&(i[a]=e[a]));return i}var ml=[`animate`,`circle`,`defs`,`desc`,`ellipse`,`g`,`image`,`line`,`filter`,`marker`,`mask`,`metadata`,`path`,`pattern`,`polygon`,`polyline`,`rect`,`stop`,`switch`,`symbol`,`svg`,`text`,`tspan`,`use`,`view`];function hl(e){return typeof e!=`string`||e.includes(`-`)?!1:!!(ml.indexOf(e)>-1||/[A-Z]/u.test(e))}function gl(e,t,n,{latestValues:r},i,a=!1,o,s){let c=(o??hl(e)?ll:sl)(t,r,i,e),l=pl(t,typeof e==`string`,a,s),u=e===O.Fragment?{}:{...l,...c,ref:n},{children:d}=t,f=(0,O.useMemo)(()=>R(d)?d.get():d,[d]);return(0,O.createElement)(e,{...u,children:f})}function _l({scrapeMotionValuesFromProps:e,createRenderState:t},n,r,i){return{latestValues:vl(n,r,i,e),renderState:t()}}function vl(e,t,n,r){let i={},a=r(e,{});for(let e in a)i[e]=ic(a[e]);let{initial:o,animate:s}=e,c=Lo(e),l=Ro(e);t&&l&&!c&&e.inherit!==!1&&(o===void 0&&(o=t.initial),s===void 0&&(s=t.animate));let u=n?n.initial===!1:!1;u||=o===!1;let d=u?s:o;if(d&&typeof d!=`boolean`&&!No(d)){let t=Array.isArray(d)?d:[d];for(let n=0;n<t.length;n++){let r=Li(e,t[n]);if(r){let{transitionEnd:e,transition:t,...n}=r;for(let e in n){let t=n[e];if(Array.isArray(t)){let e=u?t.length-1:0;t=t[e]}t!==null&&(i[e]=t)}for(let t in e)i[t]=e[t]}}}return i}var yl=e=>(t,n)=>{let r=(0,O.useContext)($c),i=(0,O.useContext)(me),a=()=>_l(e,t,r,i);return n?a():fe(a)},bl=yl({scrapeMotionValuesFromProps:es,createRenderState:rl}),xl=yl({scrapeMotionValuesFromProps:os,createRenderState:cl}),Sl=Symbol.for(`motionComponentSymbol`);function Cl(e,t,n){let r=(0,O.useRef)(n);(0,O.useInsertionEffect)(()=>{r.current=n});let i=(0,O.useRef)(null);return(0,O.useCallback)(n=>{n&&e.onMount?.(n),t&&(n?t.mount(n):t.unmount());let a=r.current;if(typeof a==`function`){if(n){let e=a(n);typeof e==`function`&&(i.current=e)}else i.current?(i.current(),i.current=null):a(n)}else a&&(a.current=n)},[t])}var wl=(0,O.createContext)({});function Tl(e){return e&&typeof e==`object`&&Object.prototype.hasOwnProperty.call(e,`current`)}function El(e,t,n,r,i,a){let{visualElement:o}=(0,O.useContext)($c),s=(0,O.useContext)(qc),c=(0,O.useContext)(me),l=(0,O.useContext)(Gc),u=l.reducedMotion,d=l.skipAnimations,f=(0,O.useRef)(null),p=(0,O.useRef)(!1);r||=s.renderer,!f.current&&r&&(f.current=r(e,{visualState:t,parent:o,props:n,presenceContext:c,blockInitialAnimation:c?c.initial===!1:!1,reducedMotionConfig:u,skipAnimations:d,isSVG:a}),p.current&&f.current&&(f.current.manuallyAnimateOnMount=!0));let m=f.current,h=(0,O.useContext)(wl);m&&!m.projection&&i&&(m.type===`html`||m.type===`svg`)&&Dl(f.current,n,i,h);let g=(0,O.useRef)(!1);(0,O.useInsertionEffect)(()=>{m&&g.current&&m.update(n,c)});let _=n[Ji],v=(0,O.useRef)(!!_&&typeof window<`u`&&!window.MotionHandoffIsComplete?.(_)&&window.MotionHasOptimisedAnimation?.(_));return pe(()=>{p.current&&m&&(m.animationState?.animateChanges(),m.enteringChildren=void 0)},[]),pe(()=>{p.current=!0,m&&(g.current=!0,window.MotionIsMounted=!0,m.updateFeatures(),m.scheduleRenderMicrotask(),v.current&&m.animationState&&m.animationState.animateChanges())}),(0,O.useEffect)(()=>{m&&(!v.current&&m.animationState&&m.animationState.animateChanges(),v.current&&=(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(_)}),!1),m.enteringChildren=void 0)}),m}function Dl(e,t,n,r){let{layoutId:i,layout:a,drag:o,dragConstraints:s,layoutScroll:c,layoutRoot:l,layoutAnchor:u,layoutCrossfade:d}=t;e.projection=new n(e.latestValues,t[`data-framer-portal-id`]?void 0:Ol(e.parent)),e.projection.setOptions({layoutId:i,layout:a,alwaysMeasureLayout:!!o||s&&Tl(s),visualElement:e,animationType:typeof a==`string`?a:`both`,initialPromotionConfig:r,crossfade:d,layoutScroll:c,layoutRoot:l,layoutAnchor:u})}function Ol(e){if(e)return e.options.allowProjection===!1?Ol(e.parent):e.projection}function kl(e,{forwardMotionProps:t=!1,type:n}={},r,i){r&&Qc(r);let a=n?n===`svg`:hl(e),o=a?xl:bl;function s(n,s){let c,l={...(0,O.useContext)(Gc),...n,layoutId:Al(n)},{isStatic:u,isValidProp:d}=l,f=tl(n),p=o(n,u);if(!u&&typeof window<`u`){jl(l,r);let t=Ml(l);c=t.MeasureLayout,f.visualElement=El(e,p,l,i,t.ProjectionNode,a)}return(0,D.jsxs)($c.Provider,{value:f,children:[c&&f.visualElement?(0,D.jsx)(c,{visualElement:f.visualElement,...l}):null,gl(e,n,Cl(p,f.visualElement,s),p,u,t,a,d)]})}s.displayName=`motion.${typeof e==`string`?e:`create(${e.displayName??e.name??``})`}`;let c=(0,O.forwardRef)(s);return c[Sl]=e,c}function Al({layoutId:e}){let t=(0,O.useContext)(de).id;return t&&e!==void 0?t+`-`+e:e}function jl(e,t){(0,O.useContext)(qc).strict}function Ml(e){let{drag:t,layout:n}=Zc();if(!t&&!n)return{};let r={...t,...n};return{MeasureLayout:t?.isEnabled(e)||n?.isEnabled(e)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}function Nl(e,t){if(typeof Proxy>`u`)return kl;let n=new Map,r=(n,r)=>kl(n,r,e,t);return new Proxy((e,t)=>r(e,t),{get:(i,a)=>a===`create`?r:(n.has(a)||n.set(a,kl(a,void 0,e,t)),n.get(a))})}var Pl=(e,t)=>t.isSVG??hl(e)?new ss(t):new ns(t,{allowProjection:e!==O.Fragment}),Fl=class extends Xo{constructor(e){super(e),e.animationState||=us(e)}updateAnimationControlsSubscription(){let{animate:e}=this.node.getProps();No(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){let{animate:e}=this.node.getProps(),{animate:t}=this.node.prevProps||{};e!==t&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}},Il=0,Ll={animation:{Feature:Fl},exit:{Feature:class extends Xo{constructor(){super(...arguments),this.id=Il++}update(){let{presenceContext:e,prevPresenceContext:t,animationState:n}=this.node;if(!e||!n)return;let{isPresent:r,onExitComplete:i}=e,a=t?.isPresent;if(r===a)return;if(r&&a===!1){if(this.exit===!0){let{initial:e}=this.node.getProps();if(e&&!Array.isArray(e)){let{transition:t,transitionEnd:n,...r}=Ri(this.node,e)||{};for(let e in r)this.node.getValue(e)?.jump(r[e])}this.node.blockInitialAnimation=!1,n.reset(),n.animateChanges()}else n.setActive(`exit`,!1);this.exit=void 0;return}let o=this.exit=n.setActive(`exit`,!r);i&&!r&&o.then(()=>{this.exit===o&&(this.exit=!0,i(this.id))})}mount(){let{register:e,onExitComplete:t}=this.node.presenceContext||{};t&&t(this.id),e&&(this.unmount=e(this.id))}unmount(){}}}};function Rl(e){return{point:{x:e.pageX,y:e.pageY}}}var zl=e=>t=>$a(t)&&e(t,Rl(t));function Bl(e,t,n,r){return ec(e,t,zl(n),r)}var Vl=({current:e})=>e?e.ownerDocument.defaultView:null,Hl=(e,t)=>Math.abs(e-t);function Ul(e,t){let n=Hl(e.x,t.x),r=Hl(e.y,t.y);return Math.sqrt(n**2+r**2)}var Wl=new Set([`auto`,`scroll`]),Gl=class{constructor(e,t,{transformPagePoint:n,contextWindow:r=window,dragSnapToOrigin:i=!1,distanceThreshold:a=3,element:o}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.lastRawMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=e=>{this.handleScroll(e.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;this.hasPendingMove=!1,this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=Kl(this.lastRawMoveEventInfo,this.transformPagePoint));let e=Jl(this.lastMoveEventInfo,this.history),t=this.startEvent!==null,n=Ul(e.offset,{x:0,y:0})>=this.distanceThreshold;if(!t&&!n)return;let{point:r}=e;this.history.push({...r,timestamp:M.now()});let{onStart:i,onMove:a}=this.handlers;t||(i&&i(this.lastMoveEvent,e),this.startEvent=this.lastMoveEvent),a&&a(this.lastMoveEvent,e)},this.handlePointerMove=(e,t)=>{this.lastMoveEvent=e,this.lastRawMoveEventInfo=t,this.lastMoveEventInfo=Kl(t,this.transformPagePoint),this.hasPendingMove=!0,I.update(this.updatePoint,!0)},this.handlePointerUp=(e,t)=>{this.hasPendingMove&&this.updatePoint(),this.end();let{onEnd:n,onSessionEnd:r,resumeAnimation:i}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&i&&i(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;let a=Jl(e.type===`pointercancel`?this.lastMoveEventInfo:Kl(t,this.transformPagePoint),this.history);this.startEvent&&n&&n(e,a),r&&r(e,a)},!$a(e))return;this.dragSnapToOrigin=i,this.handlers=t,this.transformPagePoint=n,this.distanceThreshold=a,this.contextWindow=r||window;let s=Kl(Rl(e),this.transformPagePoint),{point:c}=s,{timestamp:l}=j;this.history=[{...c,timestamp:l}];let{onSessionStart:u}=t;u&&u(e,Jl(s,this.history));let d={passive:!0,capture:!0};this.removeListeners=Se(Bl(this.contextWindow,`pointermove`,this.handlePointerMove,d),Bl(this.contextWindow,`pointerup`,this.handlePointerUp,d),Bl(this.contextWindow,`pointercancel`,this.handlePointerUp,d)),o&&this.startScrollTracking(o)}startScrollTracking(e){let t=e.parentElement;for(;t;){let e=getComputedStyle(t);(Wl.has(e.overflowX)||Wl.has(e.overflowY))&&this.scrollPositions.set(t,{x:t.scrollLeft,y:t.scrollTop}),t=t.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener(`scroll`,this.onElementScroll,{capture:!0}),window.addEventListener(`scroll`,this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener(`scroll`,this.onElementScroll,{capture:!0}),window.removeEventListener(`scroll`,this.onWindowScroll)}}handleScroll(e){let t=this.scrollPositions.get(e);if(!t)return;let n=e===window,r=n?{x:window.scrollX,y:window.scrollY}:{x:e.scrollLeft,y:e.scrollTop},i={x:r.x-t.x,y:r.y-t.y};(i.x!==0||i.y!==0)&&(n?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=i.x,this.lastMoveEventInfo.point.y+=i.y):this.history.length>0&&(this.history[0].x-=i.x,this.history[0].y-=i.y),this.scrollPositions.set(e,r),I.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),mn(this.updatePoint)}};function Kl(e,t){return t?{point:t(e.point)}:e}function ql(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Jl({point:e},t){return{point:e,delta:ql(e,Xl(t)),offset:ql(e,Yl(t)),velocity:Zl(t,.1)}}function Yl(e){return e[0]}function Xl(e){return e[e.length-1]}function Zl(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null,i=Xl(e);for(;n>=0&&(r=e[n],!(i.timestamp-r.timestamp>Te(t)));)n--;if(!r)return{x:0,y:0};r===e[0]&&e.length>2&&i.timestamp-r.timestamp>Te(t)*2&&(r=e[1]);let a=Ee(i.timestamp-r.timestamp);if(a===0)return{x:0,y:0};let o={x:(i.x-r.x)/a,y:(i.y-r.y)/a};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function Ql(e,{min:t,max:n},r){return t!==void 0&&e<t?e=r?F(t,e,r.min):Math.max(e,t):n!==void 0&&e>n&&(e=r?F(n,e,r.max):Math.min(e,n)),e}function $l(e,t,n){return{min:t===void 0?void 0:e.min+t,max:n===void 0?void 0:e.max+n-(e.max-e.min)}}function eu(e,{top:t,left:n,bottom:r,right:i}){return{x:$l(e.x,n,i),y:$l(e.y,t,r)}}function tu(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.min<e.max-e.min&&([n,r]=[r,n]),{min:n,max:r}}function nu(e,t){return{x:tu(e.x,t.x),y:tu(e.y,t.y)}}function ru(e,t){let n=.5,r=B(e),i=B(t);return i>r?n=Ce(t.min,t.max-r,e.min):r>i&&(n=Ce(e.min,e.max-i,t.min)),ge(0,1,n)}function iu(e,t){let n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}var au=.35;function ou(e=au){return e===!1?e=0:e===!0&&(e=au),{x:su(e,`left`,`right`),y:su(e,`top`,`bottom`)}}function su(e,t,n){return{min:cu(e,t),max:cu(e,n)}}function cu(e,t){return typeof e==`number`?e:e[t]||0}var lu=new WeakMap,uu=class{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=z(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:t=!1,distanceThreshold:n}={}){let{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;let i=e=>{t&&this.snapToCursor(e),this.stopAnimation()},a=(e,t)=>{let{drag:n,dragPropagation:r,onDragStart:i}=this.getProps();if(n&&!r&&(this.openDragLock&&this.openDragLock(),this.openDragLock=Ja(n),!this.openDragLock))return;this.latestPointerEvent=e,this.latestPanInfo=t,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Vs(e=>{let t=this.getAxisMotionValue(e).get()||0;if(bt.test(t)){let{projection:n}=this.visualElement;if(n&&n.layout){let r=n.layout.layoutBox[e];r&&(t=B(r)*(parseFloat(t)/100))}}this.originPoint[e]=t}),i&&I.update(()=>i(e,t),!1,!0),Ki(this.visualElement,`transform`);let{animationState:a}=this.visualElement;a&&a.setActive(`whileDrag`,!0)},o=(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t;let{dragPropagation:n,dragDirectionLock:r,onDirectionLock:i,onDrag:a}=this.getProps();if(!n&&!this.openDragLock)return;let{offset:o}=t;if(r&&this.currentDirection===null){this.currentDirection=mu(o),this.currentDirection!==null&&i&&i(this.currentDirection);return}this.updateAxis(`x`,t.point,o),this.updateAxis(`y`,t.point,o),this.visualElement.render(),a&&I.update(()=>a(e,t),!1,!0)},s=(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t,this.stop(e,t),this.latestPointerEvent=null,this.latestPanInfo=null},c=()=>{let{dragSnapToOrigin:e}=this.getProps();(e||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:l}=this.getProps();this.panSession=new Gl(e,{onSessionStart:i,onStart:a,onMove:o,onSessionEnd:s,resumeAnimation:c},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:l,distanceThreshold:n,contextWindow:Vl(this.visualElement),element:this.visualElement.current})}stop(e,t){let n=e||this.latestPointerEvent,r=t||this.latestPanInfo,i=this.isDragging;if(this.cancel(),!i||!r||!n)return;let{velocity:a}=r;this.startAnimation(a);let{onDragEnd:o}=this.getProps();o&&I.postRender(()=>o(n,r))}cancel(){this.isDragging=!1;let{projection:e,animationState:t}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.endPanSession();let{dragPropagation:n}=this.getProps();!n&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),t&&t.setActive(`whileDrag`,!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(e,t,n){let{drag:r}=this.getProps();if(!n||!pu(e,r,this.currentDirection))return;let i=this.getAxisMotionValue(e),a=this.originPoint[e]+n[e];this.constraints&&this.constraints[e]&&(a=Ql(a,this.constraints[e],this.elastic[e])),i.set(a)}resolveConstraints(){let{dragConstraints:e,dragElastic:t}=this.getProps(),n=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,r=this.constraints;e&&Tl(e)?this.constraints||=this.resolveRefConstraints():this.constraints=e&&n?eu(n.layoutBox,e):!1,this.elastic=ou(t),r!==this.constraints&&!Tl(e)&&n&&this.constraints&&!this.hasMutatedConstraints&&Vs(e=>{this.constraints!==!1&&this.getAxisMotionValue(e)&&(this.constraints[e]=iu(n.layoutBox[e],this.constraints[e]))})}resolveRefConstraints(){let{dragConstraints:e,onMeasureDragConstraints:t}=this.getProps();if(!e||!Tl(e))return!1;let n=e.current,{projection:r}=this.visualElement;if(!r||!r.layout)return!1;r.root&&(r.root.scroll=void 0,r.root.updateScroll());let i=Ua(n,r.root,this.visualElement.getTransformPagePoint()),a=nu(r.layout.layoutBox,i);if(t){let e=t(wa(a));this.hasMutatedConstraints=!!e,e&&(a=Ca(e))}return a}startAnimation(e){let{drag:t,dragMomentum:n,dragElastic:r,dragTransition:i,dragSnapToOrigin:a,onDragTransitionEnd:o}=this.getProps(),s=this.constraints||{},c=Vs(o=>{if(!pu(o,t,this.currentDirection))return;let c=s&&s[o]||{};(a===!0||a===o)&&(c={min:0,max:0});let l=r?200:1e6,u=r?40:1e7,d={type:`inertia`,velocity:n?e[o]:0,bounceStiffness:l,bounceDamping:u,timeConstant:750,restDelta:1,restSpeed:10,...i,...c};return this.startAxisValueAnimation(o,d)});return Promise.all(c).then(o)}startAxisValueAnimation(e,t){let n=this.getAxisMotionValue(e);return Ki(this.visualElement,e),n.start(Mi(e,n,0,t,this.visualElement,!1))}stopAnimation(){Vs(e=>this.getAxisMotionValue(e).stop())}getAxisMotionValue(e){let t=`_drag${e.toUpperCase()}`;return this.visualElement.getProps()[t]||this.visualElement.getValue(e,this.visualElement.latestValues[e]??0)}snapToCursor({clientX:e,clientY:t}){let{drag:n}=this.getProps(),r={x:e,y:t},i=this.visualElement.getTransformPagePoint()?.(r)||r,a=this.visualElement.measureViewportBox();Vs(e=>{if(!pu(e,n,this.currentDirection))return;let t=this.getAxisMotionValue(e),{min:r,max:o}=a[e];t.set((t.get()||0)+i[e]-F(r,o,.5))})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;let{drag:e,dragConstraints:t}=this.getProps(),{projection:n}=this.visualElement;if(!Tl(t)||!n||!this.constraints)return;this.stopAnimation();let r=this.constraints,i={x:0,y:0};Vs(e=>{let t=this.getAxisMotionValue(e).get();i[e]=ru({min:t,max:t},r[e])});let{transformTemplate:a}=this.visualElement.getProps();this.visualElement.current.style.transform=a?a({},``):`none`,n.root&&n.root.updateScroll(),n.updateLayout(),this.constraints=!1,this.resolveConstraints(),Vs(t=>{let n=this.getAxisMotionValue(t);if(!pu(t,e,null)||!n.get())return;let{min:r,max:a}=this.constraints[t];n.set(F(r,a,i[t]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;lu.set(this.visualElement,this);let e=this.visualElement.current,t=Bl(e,`pointerdown`,t=>{let{drag:n,dragListener:r=!0}=this.getProps(),i=t.target,a=i!==e&&ro(i);n&&r&&!a&&this.start(t)}),n,r=()=>{let{dragConstraints:t}=this.getProps();Tl(t)&&t.current&&(this.constraints=this.resolveRefConstraints(),n||=fu(e,t.current,()=>this.scalePositionWithinConstraints()))},{projection:i}=this.visualElement,a=i.addEventListener(`measure`,r);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),I.read(r);let o=ec(window,`resize`,()=>this.scalePositionWithinConstraints()),s=i.addEventListener(`didUpdate`,(({delta:e,hasLayoutChanged:t})=>{this.isDragging&&t&&(Vs(t=>{let n=this.getAxisMotionValue(t);n&&(this.originPoint[t]+=e[t].translate,n.set(n.get()+e[t].translate))}),this.visualElement.render())}));return()=>{o(),t(),a(),s&&s(),n&&n()}}getProps(){let e=this.visualElement.getProps(),{drag:t=!1,dragDirectionLock:n=!1,dragPropagation:r=!1,dragConstraints:i=!1,dragElastic:a=au,dragMomentum:o=!0}=e;return{...e,drag:t,dragDirectionLock:n,dragPropagation:r,dragConstraints:i,dragElastic:a,dragMomentum:o}}};function du(e){let t=!0;return()=>{if(t){t=!1;return}e()}}function fu(e,t,n){let r=To(e,du(n)),i=To(t,du(n));return()=>{r(),i()}}function pu(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function mu(e,t=10){let n=null;return Math.abs(e.y)>t?n=`y`:Math.abs(e.x)>t&&(n=`x`),n}var hu=class extends Xo{constructor(e){super(e),this.removeGroupControls=A,this.removeListeners=A,this.controls=new uu(e)}mount(){let{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||A}update(){let{dragControls:e}=this.node.getProps(),{dragControls:t}=this.node.prevProps||{};e!==t&&(this.removeGroupControls(),e&&(this.removeGroupControls=e.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}},gu=e=>(t,n)=>{e&&I.update(()=>e(t,n),!1,!0)},_u=class extends Xo{constructor(){super(...arguments),this.removePointerDownListener=A}onPointerDown(e){this.session=new Gl(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:Vl(this.node)})}createPanHandlers(){let{onPanSessionStart:e,onPanStart:t,onPan:n,onPanEnd:r}=this.node.getProps();return{onSessionStart:gu(e),onStart:gu(t),onMove:gu(n),onEnd:(e,t)=>{delete this.session,r&&I.postRender(()=>r(e,t))}}}mount(){this.removePointerDownListener=Bl(this.node.current,`pointerdown`,e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}},vu=!1,yu=class extends O.Component{componentDidMount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:n,layoutId:r}=this.props,{projection:i}=e;i&&(t.group&&t.group.add(i),n&&n.register&&r&&n.register(i),vu&&i.root.didUpdate(),i.addEventListener(`animationComplete`,()=>{this.safeToRemove()}),i.setOptions({...i.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),sc.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){let{layoutDependency:t,visualElement:n,drag:r,isPresent:i}=this.props,{projection:a}=n;return a?(a.isPresent=i,e.layoutDependency!==t&&a.setOptions({...a.options,layoutDependency:t}),vu=!0,r||e.layoutDependency!==t||t===void 0||e.isPresent!==i?a.willUpdate():this.safeToRemove(),e.isPresent!==i&&(i?a.promote():a.relegate()||I.postRender(()=>{let e=a.getStack();(!e||!e.members.length)&&this.safeToRemove()})),null):null}componentDidUpdate(){let{visualElement:e,layoutAnchor:t}=this.props,{projection:n}=e;n&&(n.options.layoutAnchor=t,n.root.didUpdate(),Wa.postRender(()=>{!n.currentAnimation&&n.isLead()&&this.safeToRemove()}))}componentWillUnmount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:n}=this.props,{projection:r}=e;vu=!0,r&&(r.scheduleCheckAfterUnmount(),t&&t.group&&t.group.remove(r),n&&n.deregister&&n.deregister(r))}safeToRemove(){let{safeToRemove:e}=this.props;e&&e()}render(){return null}};function bu(e){let[t,n]=Kc(),r=(0,O.useContext)(de);return(0,D.jsx)(yu,{...e,layoutGroup:r,switchLayoutGroup:(0,O.useContext)(wl),isPresent:t,safeToRemove:n})}var xu={pan:{Feature:_u},drag:{Feature:hu,ProjectionNode:Wc,MeasureLayout:bu}};function Su(e,t,n){let{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive(`whileHover`,n===`Start`);let i=r[`onHover`+n];i&&I.postRender(()=>i(t,Rl(t)))}var Cu=class extends Xo{mount(){let{current:e}=this.node;e&&(this.unmount=Za(e,(e,t)=>(Su(this.node,t,`Start`),e=>Su(this.node,e,`End`))))}unmount(){}},wu=class extends Xo{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(`:focus-visible`)}catch{e=!0}e&&this.node.animationState&&(this.node.animationState.setActive(`whileFocus`,!0),this.isActive=!0)}onBlur(){this.isActive&&this.node.animationState&&(this.node.animationState.setActive(`whileFocus`,!1),this.isActive=!1)}mount(){this.unmount=Se(ec(this.node.current,`focus`,()=>this.onFocus()),ec(this.node.current,`blur`,()=>this.onBlur()))}unmount(){}};function Tu(e,t,n){let{props:r}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&r.whileTap&&e.animationState.setActive(`whileTap`,n===`Start`);let i=r[`onTap`+(n===`End`?``:n)];i&&I.postRender(()=>i(t,Rl(t)))}var Eu=class extends Xo{mount(){let{current:e}=this.node;if(!e)return;let{globalTapTarget:t,propagate:n}=this.node.props;this.unmount=uo(e,(e,t)=>(Tu(this.node,t,`Start`),(e,{success:t})=>Tu(this.node,e,t?`End`:`Cancel`)),{useGlobalTarget:t,stopPropagation:n?.tap===!1})}unmount(){}},Du=new WeakMap,Ou=new WeakMap,ku=e=>{let t=Du.get(e.target);t&&t(e)},Au=e=>{e.forEach(ku)};function ju({root:e,...t}){let n=e||document;Ou.has(n)||Ou.set(n,{});let r=Ou.get(n),i=JSON.stringify(t);return r[i]||(r[i]=new IntersectionObserver(Au,{root:e,...t})),r[i]}function Mu(e,t,n){let r=ju(t);return Du.set(e,n),r.observe(e),()=>{Du.delete(e),r.unobserve(e)}}var Nu={some:0,all:1},Pu=class extends Xo{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.stopObserver?.();let{viewport:e={}}=this.node.getProps(),{root:t,margin:n,amount:r=`some`,once:i}=e,a={root:t?t.current:void 0,rootMargin:n,threshold:typeof r==`number`?r:Nu[r]},o=e=>{let{isIntersecting:t}=e;if(this.isInView===t||(this.isInView=t,i&&!t&&this.hasEnteredView))return;t&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive(`whileInView`,t);let{onViewportEnter:n,onViewportLeave:r}=this.node.getProps(),a=t?n:r;a&&a(e)};this.stopObserver=Mu(this.node.current,a,o)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>`u`)return;let{props:e,prevProps:t}=this.node;[`amount`,`margin`,`root`].some(Fu(e,t))&&this.startObserver()}unmount(){this.stopObserver?.(),this.hasEnteredView=!1,this.isInView=!1}};function Fu({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}var Iu={inView:{Feature:Pu},tap:{Feature:Eu},focus:{Feature:wu},hover:{Feature:Cu}},Lu={layout:{ProjectionNode:Wc,MeasureLayout:bu}},Ru=Nl({...Ll,...Iu,...xu,...Lu},Pl),zu={name:`blocks`,size:24,node:[[`path`,{d:`M10 22V7a1 1 0 0 0-1-1H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5a1 1 0 0 0-1-1H2`,key:`1ah6g2`}],[`rect`,{x:`14`,y:`2`,width:`8`,height:`8`,rx:`1`,key:`88lufb`}]]};zu.node;var Bu=u(zu),Vu={name:`code`,size:24,node:[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]};Vu.node;var Hu=u(Vu),Uu={name:`folder-open`,size:24,node:[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`,key:`usdka0`}]]};Uu.node;var Wu=u(Uu),Gu={name:`menu`,size:24,node:[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]};Gu.node;var Ku=u(Gu),qu={name:`trash`,size:24,node:[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]],aliases:[`trash-2`]};qu.node;var Ju=u(qu),Yu=(0,O.createContext)(null);function Xu({children:e,ports:t={}}){let n=t.timer??C,[r,i]=(0,O.useState)(null),[a,o]=(0,O.useState)(``),s=(0,O.useRef)(null);(0,O.useEffect)(()=>{r?.kind===`prompt`&&(o(r.options.initialValue??``),n.setTimeout(()=>{s.current?.focus(),s.current?.select()},0))},[r,n]);let c=(0,O.useCallback)(()=>{i(null),o(``)},[]),u=(0,O.useCallback)(()=>{r&&(r.kind===`confirm`?r.resolve(!1):r.kind===`prompt`?r.resolve(null):r.resolve(),c())},[c,r]),d=(0,O.useCallback)(()=>{r&&(r.kind===`confirm`?r.resolve(!0):r.kind===`prompt`?r.resolve(a.trim()||null):r.resolve(),c())},[c,r,a]),f=(0,O.useCallback)(e=>new Promise(t=>{i({kind:`confirm`,options:e,resolve:t})}),[]),p=(0,O.useCallback)(e=>new Promise(t=>{i({kind:`prompt`,options:e,resolve:t})}),[]),m=(0,O.useCallback)(e=>new Promise(t=>{i({kind:`alert`,options:e,resolve:t})}),[]),h=(0,O.useMemo)(()=>({confirm:f,prompt:p,alert:m}),[m,f,p]),g=`Confirm`;return r&&(r.kind===`alert`?g=r.options.closeLabel??`OK`:`confirmLabel`in r.options&&(g=r.options.confirmLabel??`Confirm`)),(0,D.jsxs)(Yu.Provider,{value:h,children:[e,(0,D.jsx)(b,{open:r!==null,onOpenChange:e=>{!e&&r&&u()},children:(0,D.jsx)(y,{size:`sm`,onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&r&&r.kind===`confirm`&&(e.preventDefault(),d())},children:r?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(S,{className:`space-y-4`,children:[(0,D.jsx)(w,{children:r.options.title}),r.options.description?(0,D.jsx)(v,{children:r.options.description}):null,r.kind===`prompt`?(0,D.jsx)(ee,{ref:s,type:`text`,value:a,onChange:e=>o(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),d())},placeholder:r.options.placeholder}):null]}),(0,D.jsxs)(x,{children:[(0,D.jsx)(l,{variant:`ghost`,size:`sm`,onClick:u,className:r.kind===`alert`?`hidden`:void 0,children:`cancelLabel`in r.options?r.options.cancelLabel??`Cancel`:`Cancel`}),(0,D.jsx)(l,{variant:r.kind===`confirm`?r.options.confirmVariant??`default`:`secondary`,size:`sm`,onClick:d,disabled:r.kind===`prompt`&&!a.trim(),children:g})]})]}):null})})]})}function Zu(){let e=(0,O.useContext)(Yu);if(!e)throw Error(`useAppDialog must be used within AppDialogProvider`);return e}var Qu=typeof window<`u`,$u=Qu?window:null,ed=Qu?document:null,V={OBJECT:0,ATTRIBUTE:1,CSS:2,TRANSFORM:3,CSS_VAR:4},H={NUMBER:0,UNIT:1,COLOR:2,COMPLEX:3},td={NONE:0,AUTO:1,FORCE:2},nd={replace:0,none:1,blend:2},rd=Symbol(),id=Symbol(),ad=Symbol(),od=Symbol(),sd=Symbol(),U=1e-11,cd=0xe8d4a51000,ld=1e3,ud=[],dd=(()=>{let e=new Map;return e.set(`x`,`translateX`),e.set(`y`,`translateY`),e.set(`z`,`translateZ`),e})(),fd=[`perspective`,`translateX`,`translateY`,`translateZ`,`rotate`,`rotateX`,`rotateY`,`rotateZ`,`scale`,`scaleX`,`scaleY`,`scaleZ`,`skew`,`skewX`,`skewY`],pd=fd.reduce((e,t)=>({...e,[t]:t+`(`}),{}),md=()=>{},hd=e=>e,gd=/\)\s*[-.\d]/,_d=/(^#([\da-f]{3}){1,2}$)|(^#([\da-f]{4}){1,2}$)/i,vd=/rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/i,yd=/rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(-?\d+|-?\d*.\d+)\s*\)/i,bd=/hsl\(\s*(-?\d+|-?\d*.\d+)\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)%\s*\)/i,xd=/hsla\(\s*(-?\d+|-?\d*.\d+)\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)\s*\)/i,Sd=/[-+]?\d*\.?\d+(?:e[-+]?\d)?/gi,Cd=/^([-+]?\d*\.?\d+(?:e[-+]?\d+)?)([a-z]+|%)$/i,wd=/([a-z])([A-Z])/g,Td=/var\(\s*(--[\w-]+)(?:\s*,\s*([^)]+))?\s*\)/,Ed={id:null,keyframes:null,playbackEase:null,playbackRate:1,frameRate:240,loop:0,reversed:!1,alternate:!1,autoplay:!0,persist:!1,duration:ld,delay:0,loopDelay:0,ease:`out(2)`,composition:nd.replace,modifier:hd,onBegin:md,onBeforeUpdate:md,onUpdate:md,onLoop:md,onPause:md,onComplete:md,onRender:md},Dd={current:null,root:ed},W={defaults:Ed,precision:4,timeScale:1,tickThreshold:200,editor:null},Od={version:`4.5.0`,engine:null};Qu&&($u.AnimeJS||=[],$u.AnimeJS.push(Od));var kd=e=>e.replace(wd,`$1-$2`).toLowerCase(),Ad=(e,t)=>e.indexOf(t)===0,jd=Date.now,Md=Array.isArray,Nd=e=>e&&e.constructor===Object,Pd=e=>typeof e==`number`&&!isNaN(e),Fd=e=>typeof e==`string`,Id=e=>typeof e==`function`,G=e=>e===void 0,Ld=e=>G(e)||e===null,Rd=e=>Qu&&e instanceof SVGElement,zd=e=>_d.test(e),Bd=e=>Ad(e,`rgb`),Vd=e=>Ad(e,`hsl`),Hd=e=>zd(e)||(Bd(e)||Vd(e))&&(e[e.length-1]===`)`||!gd.test(e)),Ud=e=>!W.defaults.hasOwnProperty(e),Wd=[`opacity`,`rotate`,`overflow`,`color`],Gd=(e,t)=>{if(Wd.includes(t))return!1;if(e.getAttribute(t)||t in e){if(t===`scale`){let t=e.parentNode;return t&&t.tagName===`filter`}return!0}},Kd=Math.pow,qd=Math.sqrt,Jd=Math.sin,Yd=Math.cos,Xd=Math.abs,Zd=Math.exp,Qd=Math.floor,$d=Math.asin,ef=Math.PI,tf=Math.round,nf=(e,t,n)=>e<t?t:e>n?n:e,K=(e,t)=>{if(t<0)return e;if(!t)return tf(e);let n=10**t;return tf(e*n)/n},rf=(e,t,n)=>n===1?t:n===0?e:e+(t-e)*n,af=e=>e===1/0?cd:e===-1/0?-cd:e,of=e=>e<=1e-11?U:af(K(e,11)),q=e=>Md(e)?[...e]:e,sf=(e,t)=>{let n={...e};for(let r in t){let i=e[r];n[r]=G(i)?t[r]:i}return n},J=(e,t,n,r=`_prev`,i=`_next`)=>{let a=e._head,o=i;for(n&&(a=e._tail,o=r);a;){let e=a[o];t(a),a=e}},cf=(e,t,n=`_prev`,r=`_next`)=>{let i=t[n],a=t[r];i?i[r]=a:e._head=a,a?a[n]=i:e._tail=i,t[n]=null,t[r]=null},lf=(e,t,n,r=`_prev`,i=`_next`)=>{let a=e._tail;for(;a&&n&&n(a,t);)a=a[r];let o=a?a[i]:e._head;a?a[i]=t:e._head=t,o?o[r]=t:e._tail=t,t[r]=a,t[i]=o},uf=(e,t,n)=>{let r=e.style.transform;if(r){let i=e[od],a=0,o=r.length,s;for(;a<o;){for(;a<o&&r.charCodeAt(a)===32;)a++;if(a>=o)break;let e=a;for(;a<o&&r.charCodeAt(a)!==40;)a++;if(a>=o)break;let t=r.substring(e,a),n=1,c=a+1,l=-1,u=-1;for(a++;a<o&&n>0;){let e=r.charCodeAt(a);e===40?n++:e===41?n--:e===44&&n===1&&(l===-1?l=a:u===-1&&(u=a)),a++}let d=a-1;t===`translate`||t===`translate3d`?(l===-1?i.translateX=r.substring(c,d).trim():(i.translateX=r.substring(c,l).trim(),u===-1?i.translateY=r.substring(l+1,d).trim():(i.translateY=r.substring(l+1,u).trim(),i.translateZ=r.substring(u+1,d).trim())),s=r.substring(c,d)):t===`scale`||t===`scale3d`?l===-1?i.scale=r.substring(c,d).trim():(i.scaleX=r.substring(c,l).trim(),u===-1?i.scaleY=r.substring(l+1,d).trim():(i.scaleY=r.substring(l+1,u).trim(),i.scaleZ=r.substring(u+1,d).trim())):i[t]=r.substring(c,d)}if(t===`translate3d`&&s)return n&&(n[t]=s),s;let c=i[t];if(!G(c))return n&&(n[t]=c),c}return t===`translate3d`?`0px, 0px, 0px`:t===`rotate3d`?`0, 0, 0, 0deg`:Ad(t,`scale`)?`1`:Ad(t,`rotate`)||Ad(t,`skew`)?`0deg`:`0px`},df=e=>{let t=``;for(let n=0,r=fd.length;n<r;n++){let r=fd[n],i=e[r];if(i!==void 0){if(r===`translateX`){let r=e.translateY;if(r!==void 0){let a=e.translateZ;a===void 0?(t+=`translate(${i},${r}) `,n+=1):(t+=`translate3d(${i},${r},${a}) `,n+=2);continue}}if(r===`scaleX`&&e.scale===void 0){let r=e.scaleY;if(r!==void 0){let a=e.scaleZ;a===void 0?(t+=`scale(${i},${r}) `,n+=1):(t+=`scale3d(${i},${r},${a}) `,n+=2);continue}}t+=`${pd[r]}${i}) `}r===`rotateZ`&&e.rotate3d!==void 0&&(t+=`rotate3d(${e.rotate3d}) `)}return e.matrix!==void 0&&(t+=`matrix(${e.matrix}) `),e.matrix3d!==void 0&&(t+=`matrix3d(${e.matrix3d}) `),t},ff=[];function pf(e,t){if(!e)return null;let n=ff.length;outer:for(let r=0;r<n;r++){let n=ff[r];if(n.detect&&!n.detect(e))continue;let i=n.targetAdapters;for(let n=0,r=i.length;n<r;n++){let r=i[n];if(r.detect(e)){let n=r.props[t];if(n&&(!n.gate||n.gate(e)))return n;break outer}}}for(let r=0;r<n;r++){let n=ff[r];if(n.detect&&!n.detect(e))continue;let i=n.propertyResolvers;for(let n=0,r=i.length;n<r;n++){let r=i[n](e,t);if(r)return r}}return null}var mf=e=>{let t=vd.exec(e)||yd.exec(e),n=G(t[4])?1:+t[4];return[+t[1],+t[2],+t[3],n]},hf=e=>{let t=e.length,n=t===4||t===5;return[+(`0x`+e[1]+e[n?1:2]),+(`0x`+e[n?2:3]+e[n?2:4]),+(`0x`+e[n?3:5]+e[n?3:6]),t===5||t===9?+((`0x`+e[n?4:7]+e[n?4:8])/255).toFixed(3):1]},gf=(e,t,n)=>(n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e),_f=e=>{let t=bd.exec(e)||xd.exec(e),n=t[1]/360,r=t[2]/100,i=t[3]/100,a=G(t[4])?1:+t[4],o,s,c;if(r===0)o=s=c=i;else{let e=i<.5?i*(1+r):i+r-i*r,t=2*i-e;o=K(gf(t,e,n+1/3)*255,0),s=K(gf(t,e,n)*255,0),c=K(gf(t,e,n-1/3)*255,0)}return[o,s,c,a]},vf=e=>Bd(e)?mf(e):zd(e)?hf(e):Vd(e)?_f(e):[0,0,0,1],Y=(e,t)=>G(e)?t:e,yf=(e,t)=>{let n=e.match(Td),r=t[id]?t:document.documentElement,i=getComputedStyle(r)?.getPropertyValue(n[1]);return(!i||i.trim()===``)&&n[2]&&(i=n[2].trim()),i||0},bf=(e,t,n,r,i,a)=>{if(Id(e)){if(!i){let i=e(t,n,r,a);return isNaN(+i)?i||0:+i}let o=()=>{let i=e(t,n,r,a);return isNaN(+i)?i||0:+i};return i.func=o,o()}if(Fd(e)&&Ad(e,`var(`)){if(!i)return yf(e,t);let n=()=>yf(e,t);return i.func=n,n()}return e},xf=(e,t)=>e[id]?e[ad]&&Gd(e,t)?V.ATTRIBUTE:fd.includes(t)||dd.get(t)?V.TRANSFORM:Ad(t,`--`)?V.CSS_VAR:t in e.style?V.CSS:t in e?V.OBJECT:V.ATTRIBUTE:V.OBJECT,Sf=(e,t,n)=>{let r=e.style[t];r&&n&&(n[t]=r);let i=r||getComputedStyle(e[sd]||e).getPropertyValue(t);return i===`auto`?`0`:i},Cf=(e,t,n,r)=>{let i=G(n)?xf(e,t):n,a=pf(e,t);if(a){let n=a.get(e);return n&&r&&(r[t]=n),n??0}if(i===V.OBJECT){let n=e[t];return n&&r&&(r[t]=n),n||0}if(i===V.ATTRIBUTE){let n=e.getAttribute(t);return n&&r&&(r[t]=n),n}return i===V.TRANSFORM?uf(e,t,r):i===V.CSS_VAR?Sf(e,t,r).trimStart():Sf(e,t,r)},wf=(e,t,n)=>n===`-`?e-t:n===`+`?e+t:e*t,Tf=()=>({t:H.NUMBER,n:0,u:null,o:null,d:null,s:null}),Ef=(e,t)=>{if(t.t=H.NUMBER,t.n=0,t.u=null,t.o=null,t.d=null,t.s=null,!e)return t;let n=+e;if(!isNaN(n))return t.n=n,t;let r=e;r[1]===`=`&&(t.o=r[0],r=r.slice(2));let i=!r.includes(` `)&&Cd.exec(r);if(i)return t.t=H.UNIT,t.n=+i[1],t.u=i[2],t;if(t.o)return t.n=+r,t;if(Hd(r))return t.t=H.COLOR,t.d=vf(r),t;{let e=r.match(Sd);return t.t=H.COMPLEX,t.d=e?e.map(Number):[],t.s=r.split(Sd)||[],t}},Df=(e,t)=>(t.t=e._valueType,t.n=e._toNumber,t.u=e._unit,t.o=null,t.d=q(e._toNumbers),t.s=q(e._strings),t),Of=Tf(),kf=(e,t,n)=>{let r=e._modifier,i=e._fromNumbers,a=e._toNumbers,o=e._strings,s=o[0];for(let c=0,l=a.length;c<l;c++){let l=r(K(rf(i[c],a[c],t),n)),u=o[c+1];s+=`${u?l+u:l}`,e._numbers[c]=l}return s},Af=(e,t,n,r,i)=>{let a=e.parent,o=e.duration,s=e.completed,c=e.iterationDuration,l=e.iterationCount,u=e._currentIteration,d=e._loopDelay,f=e._reversed,p=e._alternate,m=e._hasChildren,h=e._delay,g=e._currentTime,_=h+c,v=t-h,y=nf(g,-h,o),b=nf(v,-h,o),x=v-g,S=b>0,C=b>=o,w=o<=U,ee=i===td.FORCE,te=0,T=v,ne=0;if(l>1){let t=c+(C?0:d),n=~~(b/t);e._currentIteration=nf(n,0,l),C&&e._currentIteration--,te=e._currentIteration%2,T=b-n*t||0}let re=f^(p&&te),ie=e._ease,E=C?re?0:o:re?c-T:T;ie&&(E=c*ie(E/c)||0);let ae=(a?a.backwards:v<g)?!re:!!re;if(e._currentTime=v,e._iterationTime=E,e.backwards=ae,S&&!e.began?(e.began=!0,!n&&(!a||!ae&&a.began)&&e.onBegin(e)):v<=0&&(e.began=!1),!n&&!m&&S&&e._currentIteration!==u&&e.onLoop(e),ee||i===td.AUTO&&(t>=(a&&h>0?0:h)&&t<=_||t<=h&&y>h||t>=_&&y!==o)||E>=_&&y!==o||E<=h&&y>0&&!C||t<=y&&y===o&&s||C&&!s&&w){if(S&&(e.computeDeltaTime(y),n||e.onBeforeUpdate(e)),!m){let t=ee||(ae?x*-1:x)>=W.tickThreshold,i=K(e._offset+(a?a._offset:0)+h+E,12),o=e._head,s,c,l,u,d=0;for(;o;){let e=o._composition,n=o._currentTime,a=o._changeDuration,f=o._absoluteStartTime+o._changeDuration,p=o._nextRep,m=o._prevRep,h=e!==nd.none,g=m?m._absoluteStartTime+m._changeDuration:0,_=m&&m.parent!==o.parent,v=!p||p._isOverridden?f:p.parent===o.parent?f+p._delay:p._absoluteStartTime<p._absoluteUpdateStartTime?p._absoluteStartTime:p._absoluteUpdateStartTime;if((t||(n!==a||i<=v||m&&!_&&(!p||p.parent!==o.parent))&&(n!==0||i>=o._absoluteStartTime||_&&!o._hasFromValue&&!m._isOverridden&&i>=g||p&&!p._isOverridden&&p.parent===o.parent&&p._currentTime!==0&&E<p._startTime))&&(!m||_||E>=o._startTime)&&(!h||!o._isOverridden&&(!o._isOverlapped||i<=f)&&(!p||p._isOverridden||i<=v)&&(!m||m._isOverridden||(_?i>=o._absoluteStartTime||!o._hasFromValue&&i>=g:i>=g+o._delay)))){let t=o._currentTime=nf(E-o._startTime,0,a),n=o._ease(t/o._updateDuration),i=o._modifier,f=o._valueType,p=o._tweenType,m=p===V.OBJECT,g=f===H.NUMBER,_=g&&m||n===0||n===1?-1:W.precision,v,y;if(g)v=y=i(K(rf(o._fromNumber,o._toNumber,n),_));else if(f===H.UNIT)y=i(K(rf(o._fromNumber,o._toNumber,n),_)),v=`${y}${o._unit}`;else if(f===H.COLOR){let e=o._numbers,t=o._fromNumbers,a=o._toNumbers,s=1-n,c=t[0],l=t[1],u=t[2],d=a[0],f=a[1],p=a[2];e[0]=i(Math.sqrt(c*c*s+d*d*n)),e[1]=i(Math.sqrt(l*l*s+f*f*n)),e[2]=i(Math.sqrt(u*u*s+p*p*n)),e[3]=i(rf(t[3],a[3],n)),(!o._setter||r)&&(v=`rgba(${K(e[0],0)},${K(e[1],0)},${K(e[2],0)},${e[3]})`)}else f===H.COMPLEX&&(v=kf(o,n,_));if(h&&(o._number=y),!r&&e!==nd.blend){let e=o.property;s=o.target,o._setter?o._setter(s,y,o):m?s[e]=v:p===V.ATTRIBUTE?s.setAttribute(e,v):(c=s.style,p===V.TRANSFORM?(s!==l&&(l=s,u=s[od]),u[e]=v,d=1):p===V.CSS?c[e]=v:p===V.CSS_VAR&&c.setProperty(e,v)),S&&(ne=1)}else o._value=v}else n&&m&&!_&&E<o._startTime&&(o._currentTime=0);d&&o._renderTransforms&&(c.transform=df(u),d=0),o=o._next}!n&&ne&&e.onRender(e)}!n&&S&&e.onUpdate(e)}return a&&w?!n&&(a.began&&!ae&&v>0&&!s||ae&&v<=1e-11&&s)&&(e.onComplete(e),e.completed=!ae):S&&C?l===1/0?e._startTime+=e.duration:e._currentIteration>=l-1&&(e.paused=!0,!s&&!m&&(e.completed=!0,!n&&(!a||!ae&&a.began)&&(e.onComplete(e),e._resolve(e)))):e.completed=!1,ne},jf=(e,t,n,r,i)=>{let a=e._currentIteration;if(Af(e,t,n,r,i),e._hasChildren){let o=e,s=o.backwards,c=r?t:o._iterationTime,l=jd(),u=0,d=!0;if(!r&&o._currentIteration!==a){let e=o.iterationDuration;J(o,t=>{if(!s)!t.completed&&!t.backwards&&t._currentTime<t.iterationDuration&&Af(t,e,n,1,td.FORCE),t.began=!1,t.completed=!1;else{let r=t.duration,i=t._offset+t._delay,a=i+r;!n&&r<=1e-11&&(!i||a===e)&&t.onComplete(t)}}),n||o.onLoop(o)}J(o,e=>{let t=K((c-e._offset)*e._speed,12);if(s&&t>e._delay+e.duration)return;let a=e._fps<o._fps?e.requestTick(l):i;u+=Af(e,t,n,r,a),!e.completed&&d&&(d=!1)},s),!n&&u&&o.onRender(o),(d||s)&&o._currentTime>=o.duration&&(o.paused=!0,o.completed||(o.completed=!0,n||(o.onComplete(o),o._resolve(o))))}},Mf={},Nf=(e,t,n)=>{if(n===V.TRANSFORM)return dd.get(e)||e;if(n===V.CSS||n===V.ATTRIBUTE&&Rd(t)&&e in t.style){let t=Mf[e];if(t)return t;{let t=e&&kd(e);return Mf[e]=t,t}}return e},Pf=(e,t=!1)=>{if(e._hasChildren)J(e,e=>Pf(e,t),!0);else{let n=e;n.pause(),J(n,e=>{let r=e.property,i=e.target,a=e._tweenType,o=e._inlineValue,s=Ld(o)||o===``;if(e._setter){if(!t&&!s){if(Ef(o,Of),Of.d){let t=Of.d,n=e._numbers;for(let e=0,r=t.length;e<r;e++)n[e]=t[e]}else e._number=Of.n;e._setter(e.target,e._number,e)}}else if(a===V.OBJECT)!t&&!s&&(i[r]=o);else if(i[id]){if(a===V.ATTRIBUTE)t||(s?i.removeAttribute(r):i.setAttribute(r,o));else{let t=i.style;if(a===V.TRANSFORM){let n=i[od];s?delete n[r]:n[r]=o,e._renderTransforms&&(Object.keys(n).length?t.transform=df(n):t.removeProperty(`transform`))}else s?t.removeProperty(kd(r)):t[r]=o}}i[id]&&n._tail===e&&n.targets.forEach(e=>{e.getAttribute&&e.getAttribute(`style`)===``&&e.removeAttribute(`style`)})})}return e},Ff=class{constructor(e=0){this.deltaTime=0,this._currentTime=e,this._lastTickTime=e,this._startTime=e,this._lastTime=e,this._frameDuration=ld/240,this._fps=240,this._speed=1,this._hasChildren=!1,this._head=null,this._tail=null}get fps(){return this._fps}set fps(e){let t=+e,n=t<1e-11?U:t,r=ld/n;n>Ed.frameRate&&(Ed.frameRate=n),this._fps=n,this._frameDuration=r}get speed(){return this._speed}set speed(e){let t=+e;this._speed=t<1e-11?U:t}requestTick(e){let t=this._frameDuration,n=e-this._lastTickTime,r=t*.25;return n+(r<4?r:4)<t?td.NONE:(this._lastTickTime=n>=t?e-n%t:e,td.AUTO)}computeDeltaTime(e){let t=e-this._lastTime;return this.deltaTime=t,this._lastTime=e,t}},If={animation:null,update:md},Lf=e=>{let t=If.animation;return t||(t={duration:U,computeDeltaTime:md,_offset:0,_delay:0,_head:null,_tail:null},If.animation=t,If.update=()=>{e.forEach(e=>{for(let t in e){let n=e[t],r=n._head;if(r){let e=r._valueType,t=e===H.COMPLEX||e===H.COLOR?q(r._fromNumbers):null,i=r._fromNumber,a=n._tail;for(;a&&a!==r;){if(t)for(let e=0,n=a._numbers.length;e<n;e++)t[e]+=a._numbers[e];else i+=a._number;a=a._prevAdd}r._toNumber=i,r._toNumbers=t}}}),Af(t,1,1,0,td.FORCE)}),t},Rf=Qu?requestAnimationFrame:setImmediate,zf=Qu?cancelAnimationFrame:clearImmediate,Bf=class extends Ff{constructor(e){super(e),this.useDefaultMainLoop=!0,this.pauseOnDocumentHidden=!0,this.defaults=Ed,this.paused=!0,this.reqId=0}update(){let e=this._currentTime=jd();if(this.requestTick(e)){this.computeDeltaTime(e);let t=this._speed,n=this._fps,r=this._head;for(;r;){let i=r._next;r.paused?(cf(this,r),this._hasChildren=!!this._tail,r._running=!1,r.completed&&!r._cancelled&&r.cancel()):jf(r,(e-r._startTime)*r._speed*t,0,0,r._fps<n?r.requestTick(e):td.AUTO),r=i}If.update()}}wake(){return this.useDefaultMainLoop&&!this.reqId&&(this.requestTick(jd()),this.reqId=Rf(Vf)),this}pause(){if(this.reqId)return this.paused=!0,Hf()}resume(){if(this.paused)return this.paused=!1,J(this,e=>e.resetTime()),this.wake()}get speed(){return this._speed*(W.timeScale===1?1:ld)}set speed(e){let t=e*W.timeScale;this._speed!==t&&(this._speed=t,J(this,e=>e.speed=e._speed))}get timeUnit(){return W.timeScale===1?`ms`:`s`}set timeUnit(e){let t=.001,n=e===`s`,r=n?t:1;if(W.timeScale!==r){W.timeScale=r,W.tickThreshold=200*r;let e=n?t:ld;this.defaults.duration*=e,this._speed*=e}}get precision(){return W.precision}set precision(e){W.precision=e}},X=(()=>{let e=new Bf(jd());return Qu&&(Od.engine=e,ed.addEventListener(`visibilitychange`,()=>{e.pauseOnDocumentHidden&&(ed.hidden?e.pause():e.resume())})),e})(),Vf=()=>{X._head?(X.reqId=Rf(Vf),X.update()):X.reqId=0},Hf=()=>(zf(X.reqId),X.reqId=0,X),Uf={_rep:new WeakMap,_add:new Map},Wf=(e,t,n=`_rep`)=>{let r=Uf[n],i=r.get(e);return i||(i={},r.set(e,i)),i[t]?i[t]:i[t]={_head:null,_tail:null}},Gf=(e,t)=>e._isOverridden||e._absoluteStartTime>t._absoluteStartTime,Kf=e=>{e._isOverlapped=1,e._isOverridden=1,e._changeDuration=U,e._currentTime=U},qf=(e,t)=>{let n=e._composition;if(n===nd.replace){let n=e._absoluteStartTime;lf(t,e,Gf,`_prevRep`,`_nextRep`);let r=e._prevRep;if(r){let t=r.parent,i=r._absoluteEndTime;if(e.parent.id!==t.id&&t.iterationCount>1&&i+(t.duration-t.iterationDuration)>n){Kf(r);let e=r._prevRep;for(;e&&e.parent.id===t.id;)Kf(e),e=e._prevRep}let a=e._absoluteUpdateStartTime;if(i>a){let e=r._startTime,t=K(a-(i-(e+r._updateDuration))-e,12);r._changeDuration=t,r._currentTime=t,r._isOverlapped=1,t<1e-11&&Kf(r)}let o=e.parent.parent;if(!o||o!==t.parent){let e=!0;if(J(t,t=>{t._isOverlapped||(e=!1)}),e){let e=t.parent;if(e){let n=!0;J(e,e=>{e!==t&&J(e,e=>{e._isOverlapped||(n=!1)})}),n&&e.cancel()}else t.cancel()}}}}else if(n===nd.blend){let t=Wf(e.target,e.property,`_add`),n=Lf(Uf._add),r=t._head;r||(r={...e},r._composition=nd.replace,r._updateDuration=U,r._startTime=0,r._numbers=q(e._fromNumbers),r._number=0,r._next=null,r._prev=null,lf(t,r),lf(n,r));let i=e._toNumber;if(e._fromNumber=r._fromNumber-i,e._toNumber=0,e._numbers=q(e._fromNumbers),e._number=0,r._fromNumber=i,e._toNumbers.length){let t=q(e._toNumbers);t.forEach((t,n)=>{e._fromNumbers[n]=r._fromNumbers[n]-t,e._toNumbers[n]=0}),r._fromNumbers=t}lf(t,e,null,`_prevAdd`,`_nextAdd`)}return e},Jf=e=>{let t=e._composition;if(t!==nd.none){let n=e.target,r=e.property,i=Uf._rep.get(n)[r];if(cf(i,e,`_prevRep`,`_nextRep`),t===nd.blend){let t=Uf._add,i=t.get(n);if(!i)return;let a=i[r],o=If.animation;cf(a,e,`_prevAdd`,`_nextAdd`);let s=a._head;if(s&&s===a._tail){cf(a,s,`_prevAdd`,`_nextAdd`),cf(o,s);let e=!0;for(let t in i)if(i[t]._head){e=!1;break}e&&t.delete(n)}}}return e},Yf=e=>(e.paused=!0,e.began=!1,e.completed=!1,e),Xf=e=>e._cancelled?(e._hasChildren?J(e,Xf):J(e,e=>{e._composition!==nd.none&&qf(e,Wf(e.target,e.property))}),e._cancelled=0,e):e,Zf=0,Qf=(e,t)=>e._priority>t._priority,$f=class extends Ff{constructor(e={},t=null,n=0){super(0),++Zf;let{id:r,delay:i,duration:a,reversed:o,alternate:s,loop:c,loopDelay:l,autoplay:u,frameRate:d,playbackRate:f,priority:p,onComplete:m,onLoop:h,onPause:g,onBegin:_,onBeforeUpdate:v,onUpdate:y}=e;Dd.current&&Dd.current.register(this);let b=t?0:X._lastTickTime,x=t?t.defaults:W.defaults,S=Id(i)||G(i)?x.delay:+i,C=Id(a)||G(a)?1/0:+a,w=Y(c,x.loop),ee=Y(l,x.loopDelay),te=w===!0||w===1/0||w<0?1/0:w+1,T=0;t?T=n:(X.reqId||X.requestTick(jd()),T=(X._lastTickTime-X._startTime)*W.timeScale),this.id=G(r)?Zf:r,this.parent=t,this.duration=af((C+ee)*te-ee)||1e-11,this.backwards=!1,this.paused=!0,this.began=!1,this.completed=!1,this.onBegin=_||x.onBegin,this.onBeforeUpdate=v||x.onBeforeUpdate,this.onUpdate=y||x.onUpdate,this.onLoop=h||x.onLoop,this.onPause=g||x.onPause,this.onComplete=m||x.onComplete,this.iterationDuration=C,this.iterationCount=te,this._autoplay=!t&&Y(u,x.autoplay),this._offset=T,this._delay=S,this._loopDelay=ee,this._iterationTime=0,this._currentIteration=0,this._resolve=md,this._running=!1,this._reversed=+Y(o,x.reversed),this._reverse=this._reversed,this._cancelled=0,this._alternate=Y(s,x.alternate),this._prev=null,this._next=null,this._lastTickTime=b,this._startTime=b,this._lastTime=b,this._fps=Y(d,x.frameRate),this._speed=Y(f,x.playbackRate),this._priority=+Y(p,1)}get cancelled(){return!!this._cancelled}set cancelled(e){e?this.cancel():this.reset(!0).play()}get currentTime(){return nf(K(this._currentTime,W.precision),-this._delay,this.duration)}set currentTime(e){let t=this.paused;this.pause().seek(+e),t||this.resume()}get iterationCurrentTime(){return nf(K(this._iterationTime,W.precision),0,this.iterationDuration)}set iterationCurrentTime(e){this.currentTime=this.iterationDuration*this._currentIteration+e}get progress(){return nf(K(this._currentTime/this.duration,10),0,1)}set progress(e){this.currentTime=this.duration*e}get iterationProgress(){return nf(K(this._iterationTime/this.iterationDuration,10),0,1)}set iterationProgress(e){let t=this.iterationDuration;this.currentTime=t*this._currentIteration+t*e}get currentIteration(){return this._currentIteration}set currentIteration(e){this.currentTime=this.iterationDuration*nf(+e,0,this.iterationCount-1)}get reversed(){return!!this._reversed}set reversed(e){e?this.reverse():this.play()}get speed(){return super.speed}set speed(e){super.speed=e,this.resetTime()}reset(e=!1){return Xf(this),this._reversed&&!this._reverse&&(this.reversed=!1),this._iterationTime=this.iterationDuration,jf(this,0,1,~~e,td.FORCE),Yf(this),this._hasChildren&&J(this,Yf),this}init(e=!1){this.fps=this._fps,this.speed=this._speed,!e&&this._hasChildren&&jf(this,this.duration,1,~~e,td.FORCE),this.reset(e);let t=this._autoplay;return t===!0?this.resume():t&&!G(t.linked)&&t.link(this),this}resetTime(){let e=1/(this._speed*X._speed);return this._startTime=jd()-(this._currentTime+this._delay)*e,this}pause(){return this.paused?this:(this.paused=!0,this.onPause(this),this)}resume(){return this.paused?(this.paused=!1,this.duration<=1e-11&&!this._hasChildren?jf(this,U,0,0,td.FORCE):(this._running||=(lf(X,this,Qf),X._hasChildren=!0,!0),this.resetTime(),this._startTime-=12,X.wake()),this):this}restart(){return this.reset().resume()}seek(e,t=0,n=0){Xf(this),this.completed=!1;let r=this.paused;return this.paused=!0,jf(this,e+this._delay,~~t,~~n,td.AUTO),r?this:this.resume()}alternate(){let e=this._reversed,t=this.iterationCount,n=this.iterationDuration,r=t===1/0?Qd(cd/n):t;return this._reversed=+(this._alternate&&!(r%2)?e:!e),t===1/0?this.iterationProgress=this._reversed?1-this.iterationProgress:this.iterationProgress:this.seek(n*r-this._currentTime),this.resetTime(),this}play(){return this._reversed&&this.alternate(),this.resume()}reverse(){return this._reversed||this.alternate(),this.resume()}cancel(){return this._hasChildren?J(this,e=>e.cancel(),!0):J(this,Jf),this._cancelled=1,this.pause()}stretch(e){let t=this.duration,n=of(e);if(t===n)return this;let r=e/t,i=e<=U;return this.duration=i?U:n,this.iterationDuration=i?U:of(this.iterationDuration*r),this._offset*=r,this._delay*=r,this._loopDelay*=r,this}revert(){jf(this,0,1,0,td.AUTO);let e=this._autoplay;return e&&e.linked&&e.linked===this&&e.revert(),this.cancel()}complete(e=0){return this.seek(this.duration,e).cancel()}then(e=md){let t=this.then,n=()=>{this.then=null,e(this),this.then=t,this._resolve=md};return new Promise(e=>(this._resolve=()=>e(n()),this.completed&&this._resolve(),this))}};function ep(e){let t=Fd(e)?Dd.root.querySelectorAll(e):e;if(t instanceof NodeList||t instanceof HTMLCollection)return t}function tp(e){if(Ld(e))return[];if(!Qu)return Md(e)&&e.flat(1/0)||[e];if(Md(e)){let t=e.flat(1/0),n=[];for(let e=0,r=t.length;e<r;e++){let r=t[e];if(!Ld(r)){let e=ep(r);if(e)for(let t=0,r=e.length;t<r;t++){let r=e[t];if(!Ld(r)){let e=!1;for(let t=0,i=n.length;t<i;t++)if(n[t]===r){e=!0;break}e||n.push(r)}}else{let e=!1;for(let t=0,i=n.length;t<i;t++)if(n[t]===r){e=!0;break}e||n.push(r)}}}return n}let t=ep(e);return t?Array.from(t):[e]}function np(e){let t=tp(e),n=t.length;for(let e=0;e<n;e++){let n=t[e];if(!n[rd]){n[rd]=!0;let e=Rd(n);(n.nodeType||e)&&(n[id]=!0,n[ad]=e,n[od]={})}}return t}var rp={deg:1,rad:180/ef,turn:360},ip={},ap=(e,t,n,r=!1)=>{let i=t.u,a=t.n;if(t.t===H.UNIT&&i===n)return t;let o=a+i+n,s=ip[o];if(!G(s)&&!r)t.n=s;else{let r;if(i in rp)r=a*rp[i]/rp[n];else{let t=e.cloneNode(),o=e.parentNode,s=o&&o!==ed?o:ed.body;s.appendChild(t);let c=t.style;c.width=100+i;let l=t.offsetWidth||100;c.width=100+n;let u=l/(t.offsetWidth||100);s.removeChild(t),r=u*a}t.n=r,ip[o]=r}return t.t,H.UNIT,t.u=n,t},op=e=>e,sp=(e=1.68)=>t=>Kd(t,+e),cp={in:e=>t=>e(t),out:e=>t=>1-e(1-t),inOut:e=>t=>t<.5?e(t*2)/2:1-e(t*-2+2)/2,outIn:e=>t=>t<.5?(1-e(1-t*2))/2:(e(t*2-1)+1)/2},lp=ef/2,up=ef*2,dp={"":sp,Quad:sp(2),Cubic:sp(3),Quart:sp(4),Quint:sp(5),Sine:e=>1-Yd(e*lp),Circ:e=>1-qd(1-e*e),Expo:e=>e?Kd(2,10*e-10):0,Bounce:e=>{let t,n=4;for(;e<((t=Kd(2,--n))-1)/11;);return 1/Kd(4,3-n)-7.5625*Kd((t*3-2)/22-e,2)},Back:(e=1.7)=>t=>(+e+1)*t*t*t-+e*t*t,Elastic:(e=1,t=.3)=>{let n=nf(+e,1,10),r=nf(+t,U,2),i=r/up*$d(1/n),a=up/r;return e=>e===0||e===1?e:-n*Kd(2,-10*(1-e))*Jd((1-e-i)*a)}},fp=(()=>{let e={linear:op,none:op};for(let t in cp)for(let n in dp){let r=dp[n],i=cp[t];e[t+n]=n===``||n===`Back`||n===`Elastic`?(e,t)=>i(r(e,t)):i(r)}return e})(),pp={linear:op,none:op},mp=e=>{if(pp[e])return pp[e];if(e.indexOf(`(`)<=-1){let t=cp[e]||e.includes(`Back`)||e.includes(`Elastic`)?fp[e]():fp[e];return t?pp[e]=t:op}{let t=e.slice(0,-1).split(`(`),n=fp[t[0]];return n?pp[e]=n(...t[1].split(`,`)):op}},hp=[`steps(`,`irregular(`,`linear(`,`cubicBezier(`],gp=e=>{if(Fd(e)){for(let t=0,n=hp.length;t<n;t++)if(Ad(e,hp[t]))return console.warn(`String syntax for \`ease: "${e}"\` has been removed from the core and replaced by importing and passing the easing function directly: \`ease: ${e}\``),op}return Id(e)?e:Fd(e)?mp(e):op},Z=Tf(),Q=Tf(),_p={},vp={func:null},yp={func:null},bp=[null],xp=[null,null],Sp={to:null},Cp=0,wp=0,Tp,Ep,Dp=(e,t)=>{let n={};if(Md(e)){let t=[].concat(...e.map(e=>Object.keys(e))).filter(Ud);for(let r=0,i=t.length;r<i;r++){let i=t[r];n[i]=e.map(e=>{let t={};for(let n in e){let r=e[n];Ud(n)?n===i&&(t.to=r):t[n]=r}return t})}}else{let r=Y(t.duration,W.defaults.duration);Object.keys(e).map(t=>({o:parseFloat(t)/100,p:e[t]})).sort((e,t)=>e.o-t.o).forEach(e=>{let t=e.o,i=e.p;for(let e in i)if(Ud(e)){let a=n[e];a||=n[e]=[];let o=t*r,s=a.length,c=a[s-1],l={to:i[e]},u=0;for(let e=0;e<s;e++)u+=a[e].duration;s===1&&(l.from=c.to),i.ease&&(l.ease=i.ease),l.duration=o-(s?u:0),a.push(l)}return e});for(let e in n){let t=n[e],r;for(let e=0,n=t.length;e<n;e++){let n=t[e],i=n.ease;n.ease=r||void 0,r=i}t[0].duration||t.shift()}}return n},Op=class extends $f{constructor(e,t,n,r,i=!1,a=0,o){super(t,n,r),this._head,this._tail,++wp;let s=np(e),c=s.length,l=t.keyframes,u=l?sf(Dp(l,t),t):t,{id:d,delay:f,duration:p,ease:m,playbackEase:h,modifier:g,composition:_,onRender:v}=u,y=n?n.defaults:W.defaults,b=Y(m,y.ease),x=Y(h,y.playbackEase),S=x?gp(x):null,C=!G(b.ease),w=C?b.ease:Y(m,S?`linear`:y.ease),ee=C?b.settlingDuration:Y(p,y.duration),te=Y(f,y.delay),T=g||y.modifier,ne=G(_)&&c>=1e3?nd.none:G(_)?y.composition:_,re=this._offset+(n?n._offset:0);C&&(b.parent=this);let ie=NaN,E=NaN,ae=0,oe=0;for(let e=0;e<c;e++){let t=s[e],r=a||e,c=o||s,l=NaN,d=NaN;for(let e in u)if(Ud(e)){let a=xf(t,e),o=pf(t,e),s=Nf(e,t,a),f=u[e],p=Md(f);if(i&&!p&&(xp[0]=f,xp[1]=f,f=xp),p){let e=f.length,t=!Nd(f[0]);e===2&&t?(Sp.to=f,bp[0]=Sp,Tp=bp):e>2&&t?(Tp=[],f.forEach((e,t)=>{t?t===1?(xp[1]=e,Tp.push(xp)):Tp.push(e):xp[0]=e})):Tp=f}else bp[0]=f,Tp=bp;let m=null,h=null,g=NaN,_=0,v=0;for(let e=Tp.length;v<e;v++){let i=Tp[v];Nd(i)?Ep=i:(Sp.to=i,Ep=Sp),vp.func=null,yp.func=null;let l=bf(Y(Ep.composition,ne),t,r,c,null,null),u=Pd(l)?l:nd[l];!m&&u!==nd.none&&(m=Wf(t,s));let d=m?m._tail:null,f=n&&d&&d.parent.parent===n?d:h,p=bf(Ep.to,t,r,c,vp,f),y;Nd(p)&&!G(p.to)?(Ep=p,y=p.to):y=p;let b=bf(Ep.from,t,r,c,yp,f),x=Ep.ease||w,S=bf(x,t,r,c,null,f),C=Id(S)||Fd(S)?S:x,ie=!G(C)&&!G(C.ease),E=ie?C.ease:C,se=ie?C.settlingDuration:bf(Y(Ep.duration,e>1?bf(ee,t,r,c,null,f)/e:ee),t,r,c,null,f),ce=bf(Y(Ep.delay,v?0:te),t,r,c,null,f),le=Ep.modifier||T,ue=!G(b),D=!G(y),O=Md(y),de=O||ue&&D,fe=h?_:0,pe=h?_+ce:ce,me=K(re+pe,12),he=K(re+fe,12);!oe&&(ue||O)&&(oe=1);let k=h;if(u!==nd.none){let e=m._head;for(;e&&e._absoluteStartTime<=me;)if(e._isOverridden||(k=e),e=e._nextRep,e&&e._absoluteStartTime>=me)for(;e;)Kf(e),e=e._nextRep}if(de){Ef(O?bf(y[0],t,r,c,yp,f):b,Z),Ef(O?bf(y[1],t,r,c,vp,f):y,Q);let e=Cf(t,s,a,_p);Z.t===H.NUMBER&&(k?k._valueType===H.UNIT&&(Z.t=H.UNIT,Z.u=k._unit):(Ef(e,Of),Of.t===H.UNIT&&(Z.t=H.UNIT,Z.u=Of.u)))}else D?Ef(y,Q):h?Df(h,Q):Ef(n&&k&&k.parent.parent===n?k._value:Cf(t,s,a,_p),Q),ue?Ef(b,Z):h?Df(h,Z):Ef(n&&k&&k.parent.parent===n?k._value:Cf(t,s,a,_p),Z);if(Z.o&&(Z.n=wf(k?k._toNumber:Ef(Cf(t,s,a,_p),Of).n,Z.n,Z.o)),Q.o&&(Q.n=wf(Z.n,Q.n,Q.o)),Z.t!==Q.t){if(Z.t===H.COMPLEX||Q.t===H.COMPLEX){let e=Z.t===H.COMPLEX?Z:Q,t=Z.t===H.COMPLEX?Q:Z;t.t=H.COMPLEX,t.s=q(e.s),t.d=e.d.map(()=>t.n)}else if(Z.t===H.UNIT||Q.t===H.UNIT){let e=Z.t===H.UNIT?Z:Q,t=Z.t===H.UNIT?Q:Z;t.t=H.UNIT,t.u=e.u}else if(Z.t===H.COLOR||Q.t===H.COLOR){let e=Z.t===H.COLOR?Z:Q,t=Z.t===H.COLOR?Q:Z;t.t=H.COLOR,t.d=e.d.map(()=>0)}}if(Z.u!==Q.u){let e=Q.u?Z:Q;e=ap(t,e,Q.u?Q.u:Z.u,!1)}if(Q.d&&Z.d&&Q.d.length!==Z.d.length){let e=Z.d.length>Q.d.length?Z:Q,t=e===Z?Q:Z;t.d=e.d.map((e,n)=>G(t.d[n])?0:t.d[n]),t.s=q(e.s)}let ge=K(+se||1e-11,12),_e=_p[s];Ld(_e)||(_p[s]=null);let ve=o?o.set:null;_=K(pe+ge,12);let ye=Z.d,be=Q.d,xe=Q.s,A={parent:this,id:Cp++,property:s,target:t,_value:null,_toFunc:vp.func,_fromFunc:yp.func,_ease:gp(E),_fromNumbers:ye?q(ye):ud,_toNumbers:be?q(be):ud,_strings:xe?q(xe):ud,_fromNumber:Z.n,_toNumber:Q.n,_numbers:ye?q(ye):ud,_number:Z.n,_unit:Q.u,_modifier:le,_currentTime:0,_startTime:pe,_delay:+ce,_updateDuration:ge,_changeDuration:ge,_absoluteStartTime:me,_absoluteUpdateStartTime:he,_absoluteEndTime:K(re+_,12),_hasFromValue:ue||O?1:0,_tweenType:a,_setter:ve,_valueType:Q.t,_composition:u,_isOverlapped:0,_isOverridden:0,_renderTransforms:0,_inlineValue:_e,_prevRep:null,_nextRep:null,_prevAdd:null,_nextAdd:null,_prev:null,_next:null};u!==nd.none&&qf(A,m);let Se=A._valueType;if(Se===H.COMPLEX)A._value=kf(A,1,-1);else if(Se===H.UNIT)A._value=`${le(A._toNumber)}${A._unit}`;else if(Se===H.COLOR){let e=Q.d;A._value=`rgba(${K(e[0],0)},${K(e[1],0)},${K(e[2],0)},${e[3]})`}else A._value=le(A._toNumber);isNaN(g)&&(g=A._startTime),h=A,ae++,lf(this,A)}(isNaN(E)||g<E)&&(E=g),(isNaN(ie)||_>ie)&&(ie=_),a===V.TRANSFORM&&(l=ae-v,d=ae)}if(!isNaN(l)){let e=0;J(this,t=>{e>=l&&e<d&&(t._renderTransforms=1,t._composition===nd.blend&&J(If.animation,e=>{e.id===t.id&&(e._renderTransforms=1)})),e++})}}c||console.warn(`No target found. Make sure the element you're trying to animate is accessible before creating your animation.`),E?(J(this,e=>{e._startTime-e._delay||(e._delay-=E),e._startTime-=E}),ie-=E):E=0,ie||(ie=U,this.iterationCount=0),this.targets=s,this.id=G(d)?wp:d,this.duration=ie===1e-11?U:af((ie+this._loopDelay)*this.iterationCount-this._loopDelay)||1e-11,this.onRender=v||y.onRender,this._ease=S,this._delay=E,this.iterationDuration=ie,!this._autoplay&&oe&&this.onRender(this)}stretch(e){let t=this.duration;if(t===of(e))return this;let n=e/t;return J(this,e=>{e._updateDuration=of(e._updateDuration*n),e._changeDuration=of(e._changeDuration*n),e._currentTime*=n,e._delay*=n,e._startTime*=n,e._absoluteStartTime*=n,e._absoluteUpdateStartTime*=n,e._absoluteEndTime*=n}),super.stretch(e)}refresh(){return J(this,e=>{let t=e._toFunc,n=e._fromFunc;(t||n)&&(n?(Ef(n(),Z),Z.u!==e._unit&&e.target[id]&&ap(e.target,Z,e._unit,!0),e._fromNumbers=q(Z.d),e._fromNumber=Z.n):t&&(Ef(Cf(e.target,e.property,e._tweenType),Of),e._fromNumbers=q(Of.d),e._fromNumber=Of.n),t&&(Ef(t(),Q),e._toNumbers=q(Q.d),e._strings=q(Q.s),e._toNumber=Q.o?wf(e._fromNumber,Q.n,Q.o):Q.n))}),this.duration===1e-11&&this.restart(),this}revert(){return super.revert(),Pf(this)}then(e){return super.then(e)}},kp=(e,t)=>W.editor?W.editor.addAnimation(e,t):new Op(e,t,null,0,!1).init(),Ap={instant:80,quick:160,row:180,carry:240,panel:280,staggerTight:14,staggerRow:26,staggerLoose:40,sequence:860},jp={arriving:`out(3)`,born:`outBack(1.6)`,panel:`cubicBezier(0.22, 1, 0.36, 1)`},Mp={arriving:`cubic-bezier(0.22, 0.61, 0.36, 1)`,panel:`cubic-bezier(0.22, 1, 0.36, 1)`},Np={landing:{stiffness:190,damping:17},indicator:{stiffness:240,damping:26},cardTravel:{stiffness:210,damping:24},drawer:{stiffness:210,damping:22},sheet:{stiffness:200,damping:21}};function Pp(e,t){return Math.min(e,7)*t}var Fp=`(prefers-reduced-motion: reduce)`;function Ip(e=a){return e.matchesMediaQuery(Fp)}function Lp(){X.pauseOnDocumentHidden=!1,X.resume()}var Rp=i((e,t)=>{let n=null;return{spawnedChatId:null,markSpawned:(r,i=C)=>{n!==null&&i.clearTimeout(n),e({spawnedChatId:r}),n=i.setTimeout(()=>{n=null,t().clearSpawned(r)},Ap.sequence)},clearSpawned:n=>{t().spawnedChatId===n&&e({spawnedChatId:null})}}});function zp(e){return t=>e!==null&&t.spawnedChatId===e}function Bp(e){return e.spawnedChatId!==null}var Vp={sm:.875,md:1,lg:1.125,xl:1.25,xxl:1.5};function Hp(e){return typeof e==`string`&&Object.hasOwn(Vp,e)}function Up(e){return typeof e!=`string`||!Hp(e)?Vp.md:Vp[e]}function Wp(e,t){return Hp(e)?e:Hp(t)?t:`md`}function Gp(e){let t=e&&Hp(e.scale)?e.scale:`md`;return{"--kanna-font-scale":String(Vp[t])}}function Kp(e){return Number.isFinite(e)?Math.max(1,Math.round(e)):1}function qp(e){let t=e.trim().slice(0,512);return!t||!/^https?:\/\/\S+$/.test(t)?null:t.replace(/\/+$/,``)}var Jp=8e3,Yp={idleTimeoutMs:6e5,maxConcurrent:4},Xp=6e4,Zp=36e5;({...Yp});var Qp={toggleEmbeddedTerminal:[`cmd+j`,"ctrl+`"],toggleRightSidebar:[`cmd+b`,`ctrl+b`],openInFinder:[`cmd+alt+f`,`ctrl+alt+f`],openInEditor:[`cmd+shift+o`,`ctrl+shift+o`],addSplitTerminal:[`cmd+/`,`ctrl+/`],jumpToSidebarChat:[`cmd+alt`],openProjectSwitcher:[`cmd+k`,`ctrl+k`],openTabSwitcher:["alt+`"],jumpToPaneTab:[`cmd+ctrl`,`ctrl+alt`],createChatInCurrentProject:[`cmd+alt+n`],openAddProject:[`cmd+alt+o`],newStack:[`cmd+alt+w`],newStackChat:[`cmd+alt+shift+n`],jumpToStacks:[`g s`],focusPaneLeft:[`cmd+ctrl+arrowleft`,`ctrl+alt+arrowleft`],focusPaneRight:[`cmd+ctrl+arrowright`,`ctrl+alt+arrowright`],focusPaneUp:[`cmd+ctrl+arrowup`,`ctrl+alt+arrowup`],focusPaneDown:[`cmd+ctrl+arrowdown`,`ctrl+alt+arrowdown`],splitPaneRight:[`cmd+ctrl+d`,`ctrl+alt+d`],splitPaneDown:[`cmd+ctrl+e`,`ctrl+alt+e`],closePaneTab:[`cmd+ctrl+w`,`ctrl+alt+q`],nextPaneTab:[`cmd+ctrl+j`,`ctrl+alt+j`],previousPaneTab:[`cmd+ctrl+k`,`ctrl+alt+k`],resizePaneLeft:[`cmd+ctrl+shift+arrowleft`,`ctrl+alt+shift+arrowleft`],resizePaneRight:[`cmd+ctrl+shift+arrowright`,`ctrl+alt+shift+arrowright`],resizePaneUp:[`cmd+ctrl+shift+arrowup`,`ctrl+alt+shift+arrowup`],resizePaneDown:[`cmd+ctrl+shift+arrowdown`,`ctrl+alt+shift+arrowdown`]},$p=`toggleEmbeddedTerminal.toggleRightSidebar.openInFinder.openInEditor.addSplitTerminal.jumpToSidebarChat.openProjectSwitcher.openTabSwitcher.jumpToPaneTab.createChatInCurrentProject.openAddProject.newStack.newStackChat.jumpToStacks.focusPaneLeft.focusPaneRight.focusPaneUp.focusPaneDown.splitPaneRight.splitPaneDown.closePaneTab.nextPaneTab.previousPaneTab.resizePaneLeft.resizePaneRight.resizePaneUp.resizePaneDown`.split(`.`);function em(e){return e===`cursor`||e===`vscode`||e===`xcode`||e===`windsurf`||e===`custom`}function tm(e){return e===`never`||e===`unfocused`||e===`always`}function nm(e){return e===`blow`||e===`bottle`||e===`frog`||e===`funk`||e===`glass`||e===`ping`||e===`pop`||e===`purr`||e===`tink`}function rm(e){return e===`openai`||e===`openrouter`||e===`custom`}var im=`moonshotai/kimi-k2.5:nitro`,am=[{id:`low`,label:`Low`},{id:`medium`,label:`Medium`},{id:`high`,label:`High`},{id:`xhigh`,label:`XHigh`},{id:`max`,label:`Max`}],om=[{id:`minimal`,label:`Minimal`},{id:`low`,label:`Low`},{id:`medium`,label:`Medium`},{id:`high`,label:`High`},{id:`xhigh`,label:`XHigh`}],sm={reasoningEffort:`high`,contextWindow:`200k`},cm={reasoningEffort:`high`,fastMode:!1};function lm(e){return am.some(t=>t.id===e)}function um(e){return om.some(t=>t.id===e)}var dm=[{id:`200k`,label:`200k`},{id:`1m`,label:`1M`}];function fm(e){return dm.some(t=>t.id===e)}var pm=[`low`,`medium`,`high`,`xhigh`,`max`],mm=[{id:`claude`,label:`Claude`,defaultModel:`claude-sonnet-4-6`,defaultEffort:`high`,supportsPlanMode:!0,models:[{id:`claude-fable-5`,label:`Fable 5`,supportedEfforts:pm,aliases:[`fable`],contextWindowOptions:[...dm]},{id:`claude-opus-5`,label:`Opus 5`,supportedEfforts:pm,aliases:[`opus-5`],contextWindowOptions:[...dm]},{id:`claude-sonnet-5`,label:`Sonnet 5`,supportedEfforts:pm,aliases:[`sonnet-5`],contextWindowOptions:[...dm]},{id:`claude-opus-4-8`,label:`Opus 4.8`,supportedEfforts:pm,aliases:[`opus-4-8`],contextWindowOptions:[...dm]},{id:`claude-opus-4-7`,label:`Opus 4.7`,supportedEfforts:pm,aliases:[`opus`],contextWindowOptions:[...dm]},{id:`claude-sonnet-4-6`,label:`Sonnet 4.6`,supportedEfforts:[`low`,`medium`,`high`,`max`],aliases:[`sonnet`],contextWindowOptions:[...dm]},{id:`claude-haiku-4-5-20251001`,label:`Haiku 4.5`,supportedEfforts:[`low`,`medium`,`high`],aliases:[`haiku`]}],efforts:[...am]},{id:`codex`,label:`Codex`,defaultModel:`gpt-5.5`,supportsPlanMode:!0,models:[{id:`gpt-5.5`,label:`GPT-5.5`},{id:`gpt-5.4`,label:`GPT-5.4`},{id:`gpt-5.3-codex`,label:`GPT-5.3 Codex`,aliases:[`gpt-5-codex`]},{id:`gpt-5.3-codex-spark`,label:`GPT-5.3 Codex Spark`}],efforts:[]},{id:`openrouter`,label:`OpenRouter`,defaultModel:im,supportsPlanMode:!0,models:[],efforts:[]},{id:`custom`,label:`Custom endpoints`,defaultModel:``,supportsPlanMode:!0,models:[],efforts:[]}];function hm(e){let t=mm.find(t=>t.id===e);if(!t)throw Error(`Unknown provider: ${e}`);return t}function gm(e){return{id:e.id,label:e.label,...e.supportedEfforts?{supportedEfforts:e.supportedEfforts}:{},...e.aliases?{aliases:e.aliases}:{},...e.contextWindowOptions?{contextWindowOptions:e.contextWindowOptions}:{}}}function _m(e,t){return e.map(e=>{if(e.id!==`claude`&&e.id!==`codex`)return{...e,models:[...e.models]};let n=t.filter(t=>t.provider===e.id);if(n.length===0)return{...e,models:[...e.models]};let r=n.map(t=>{let n=gm(t),r=e.models.find(e=>e.id===n.id);return r?{...r,...n}:n}),i=r.some(t=>t.id===e.defaultModel)?e.defaultModel:r[0]?.id??e.defaultModel;return{...e,defaultModel:i,models:r}})}function vm(e){return e===`openrouter`||e===`custom`}function ym(e,t){let n=hm(e);if(!t||t.length===0)return n;let[r]=_m([{...n,models:[...n.models]}],t);return r??n}function bm(e,t){return ym(e,t).models}function xm(e,t,n){if(!t)return;let r=bm(e,n);return r.find(e=>e.id===t)??r.find(e=>e.aliases?.includes(t))}function Sm(e,t,n,r){let i=xm(e,t,r);if(i)return i.id;let a=ym(e,r),o=n??a.defaultModel;return!(r?.some(t=>t.provider===e)??!1)||a.models.some(e=>e.id===o)?o:a.defaultModel}function Cm(e,t=`claude-opus-4-7`,n){return Sm(`claude`,e,t,n)}function wm(e,t=`gpt-5.5`,n){return Sm(`codex`,e,t,n)}function Tm(e,t,n){let r=Sm(e,t,void 0,n);return bm(e,n).find(e=>e.id===r)}function Em(e,t){return Tm(`claude`,e,t)}function Dm(e,t){let n=Em(e,t)?.supportedEfforts;return!n||n.length===0?[]:am.filter(e=>n.includes(e.id))}function Om(e,t,n){let r=Em(e,n)?.supportedEfforts;if(!r||r.length===0||r.includes(t))return t;for(let e of[`max`,`xhigh`,`high`,`medium`,`low`])if(r.includes(e))return e;return sm.reasoningEffort}function km(e,t){return Em(e,t)?.contextWindowOptions??[]}function Am(e,t,n){let r=km(e,n);return r.length===0?sm.contextWindow:fm(t)&&r.some(e=>e.id===t)?t:sm.contextWindow}function jm(e,t,n){return n||(mm.find(t=>t.id===e)?.models.find(e=>e.id===t)?.contextWindowOptions??[])}function Mm(e){switch(e){case`1m`:return 1e6;default:return 2e5}}function Nm(e){return e===`claude`||e===`codex`||e===`openrouter`||e===`custom`}var Pm={toggleEmbeddedTerminal:`Toggle Embedded Terminal`,toggleRightSidebar:`Toggle Right Sidebar`,openInFinder:`Open In Finder`,openInEditor:`Open In Editor`,addSplitTerminal:`Add Split Terminal`,jumpToSidebarChat:`Jump To Sidebar Chat`,openProjectSwitcher:`Open Project Switcher`,openTabSwitcher:`Switch To Recent Tab`,jumpToPaneTab:`Jump To Tab By Number`,createChatInCurrentProject:`New Chat In Current Project`,openAddProject:`Open Add Project`,newStack:`New Stack`,newStackChat:`New Stack Chat`,jumpToStacks:`Jump To Stacks`,focusPaneLeft:`Focus Pane Left`,focusPaneRight:`Focus Pane Right`,focusPaneUp:`Focus Pane Up`,focusPaneDown:`Focus Pane Down`,splitPaneRight:`Split Pane Right`,splitPaneDown:`Split Pane Down`,closePaneTab:`Close Tab`,nextPaneTab:`Next Tab`,previousPaneTab:`Previous Tab`,resizePaneLeft:`Resize Pane Left`,resizePaneRight:`Resize Pane Right`,resizePaneUp:`Resize Pane Up`,resizePaneDown:`Resize Pane Down`};function Fm(e){return(e??[]).join(`, `)}function Im(e){return e.split(`,`).map(e=>e.trim()).map(e=>e.toLowerCase()).filter(Boolean)}var Lm=new Map([[`cmd`,`meta`],[`meta`,`meta`],[`ctrl`,`ctrl`],[`control`,`ctrl`],[`alt`,`alt`],[`option`,`alt`],[`shift`,`shift`]]);function Rm(e,t){let n=eh(e);return n?th(t,n.key)&&t.ctrlKey===n.ctrl&&t.metaKey===n.meta&&t.altKey===n.alt&&t.shiftKey===n.shift:!1}function zm(e,t,n){return Vm(e,t).some(e=>Rm(e,n))}function Bm(e,t,n){return Vm(e,t).find(e=>Rm(e,n))??null}function Vm(e,t){return e?.bindings[t]??Qp[t]}function Hm(e){return Object.hasOwn(Qp,e)}function Um(){return Object.keys(Qp).filter(Hm)}function Wm(e){let t={...Qp};for(let n of Um())t[n]=e?.bindings[n]??Qp[n];return{bindings:t,warning:e?.warning??null,filePathDisplay:e?.filePathDisplay??``}}function Gm(e,t){let n=$m(e);return t.metaKey===n.meta&&t.altKey===n.alt&&t.ctrlKey===n.ctrl&&t.shiftKey===n.shift}function Km(e,t){let n=eh(e);return n?th(t,n.key)&&t.ctrlKey===n.ctrl&&t.metaKey===n.meta&&t.altKey===n.alt&&(!n.shift||t.shiftKey):!1}function qm(e,t){let n=$m(e),r=[[n.meta,t.metaKey],[n.ctrl,t.ctrlKey],[n.alt,t.altKey]].filter(([e])=>e);return r.length!==0&&r.some(([,e])=>!e)}function Jm(e,t){let n=e=>$m(e).meta;return e.find(e=>n(e)===t)??(t?e[0]:void 0)??null}var Ym={meta:`⌘`,ctrl:`⌃`,alt:`⌥`,shift:`⇧`},Xm={meta:`Win`,ctrl:`Ctrl`,alt:`Alt`,shift:`Shift`},Zm={arrowleft:`←`,arrowright:`→`,arrowup:`↑`,arrowdown:`↓`,enter:`↵`,escape:`Esc`,tab:`Tab`};function Qm(e,t){let n=t?Ym:Xm;return e.split(`+`).map(e=>e.trim().toLowerCase()).filter(Boolean).map(e=>{let t=Lm.get(e);return t===`ctrl`||t===`meta`||t===`alt`||t===`shift`?n[t]:Zm[e]??(e.length===1?e.toUpperCase():e)})}function $m(e){let t={ctrl:!1,meta:!1,alt:!1,shift:!1};for(let n of e.split(`+`)){let e=Lm.get(n.trim().toLowerCase());(e===`ctrl`||e===`meta`||e===`alt`||e===`shift`)&&(t[e]=!0)}return t}function eh(e){let t=e.split(`+`).map(e=>e.trim()).filter(Boolean);if(t.length===0)return null;let n={key:``,ctrl:!1,meta:!1,alt:!1,shift:!1};for(let e of t){let t=e.toLowerCase(),r=Lm.get(t);if(r===`ctrl`){n.ctrl=!0;continue}if(r===`meta`){n.meta=!0;continue}if(r===`alt`){n.alt=!0;continue}if(r===`shift`){n.shift=!0;continue}if(n.key)return null;n.key=t}return n.key?n:null}function th(e,t){if(e.key.toLowerCase()===t)return!0;let n=nh(t);return n?e.code===n:!1}function nh(e){if(e.length===1&&e>=`a`&&e<=`z`)return`Key${e.toUpperCase()}`;if(e.length===1&&e>=`0`&&e<=`9`)return`Digit${e}`;switch(e){case`/`:return`Slash`;case"`":return`Backquote`;default:return null}}var rh=[],ih=i()(e=>({rows:rh,setRows:t=>e({rows:t.length>0?t:rh})})),ah=e=>e.rows,oh=e=>t=>t.rows.find(t=>t.id===e)??null;function sh(e,t){let n;try{n=e()}catch{return}return{getItem:e=>{let r=e=>e===null?null:JSON.parse(e,t?.reviver),i=n.getItem(e)??null;return i instanceof Promise?i.then(r):r(i)},setItem:(e,r)=>n.setItem(e,JSON.stringify(r,t?.replacer)),removeItem:e=>n.removeItem(e)}}var ch=e=>t=>{try{let n=e(t);return n instanceof Promise?n:{then(e){return ch(e)(n)},catch(e){return this}}}catch(e){return{then(e){return this},catch(t){return ch(t)(e)}}}},lh=(e,t)=>(n,r,i)=>{let a={storage:sh(()=>window.localStorage),partialize:e=>e,version:0,merge:(e,t)=>({...t,...e}),...t},o=!1,s=0,c=new Set,l=new Set,u=a.storage;if(!u)return e((...e)=>{console.warn(`[zustand persist middleware] Unable to update item '${a.name}', the given storage is currently unavailable.`),n(...e)},r,i);let d=()=>{let e=a.partialize({...r()});return u.setItem(a.name,{state:e,version:a.version})},f=i.setState;i.setState=(e,t)=>(f(e,t),d());let p=e((...e)=>(n(...e),d()),r,i);i.getInitialState=()=>p;let m,h=()=>{if(!u)return;let e=++s;o=!1,c.forEach(e=>e(r()??p));let t=a.onRehydrateStorage?.call(a,r()??p)||void 0;return ch(u.getItem.bind(u))(a.name).then(e=>{if(e){if(typeof e.version==`number`&&e.version!==a.version){if(a.migrate){let t=a.migrate(e.state,e.version);return t instanceof Promise?t.then(e=>[!0,e]):[!0,t]}console.error(`State loaded from storage couldn't be migrated since no migrate function was provided`)}else return[!1,e.state]}return[!1,void 0]}).then(t=>{if(e!==s)return;let[i,o]=t;if(m=a.merge(o,r()??p),n(m,!0),i)return d()}).then(()=>{e===s&&(t?.(r(),void 0),m=r(),o=!0,l.forEach(e=>e(m)))}).catch(n=>{e===s&&t?.(void 0,n)})};return i.persist={setOptions:e=>{a={...a,...e},e.storage&&(u=e.storage)},clearStorage:()=>{++s,u?.removeItem(a.name)},getOptions:()=>a,rehydrate:()=>h(),hasHydrated:()=>o,onHydrate:e=>(c.add(e),()=>{c.delete(e)}),onFinishHydration:e=>(l.add(e),()=>{l.delete(e)})},a.skipHydration||h(),m||p};function uh(e){let t={},n=e.reasoningEffort;lm(n)&&(t.reasoningEffort=n);let r=e.contextWindow;return fm(r)&&(t.contextWindow=r),t}function dh(e){let t={},n=e.reasoningEffort;um(n)&&(t.reasoningEffort=n);let r=e.fastMode;return typeof r==`boolean`&&(t.fastMode=r),t}function fh(e,t){return e.reasoningEffort===t.reasoningEffort&&e.contextWindow===t.contextWindow}function ph(e,t){return e.reasoningEffort===t.reasoningEffort&&e.fastMode===t.fastMode}function mh(e,t){return e.claude.model===t.claude.model&&e.claude.planMode===t.claude.planMode&&fh(e.claude.modelOptions,t.claude.modelOptions)&&e.codex.model===t.codex.model&&e.codex.planMode===t.codex.planMode&&ph(e.codex.modelOptions,t.codex.modelOptions)&&e.openrouter.model===t.openrouter.model&&e.openrouter.planMode===t.openrouter.planMode&&e.custom.model===t.custom.model&&e.custom.planMode===t.custom.planMode}function hh(){return T.getState().settings?.customModels??[]}var gh=`__new__`;function _h(e,t){let n=e?.modelOptions?.reasoningEffort,r;r=lm(n)?n:lm(e?.effort)?e.effort:sm.reasoningEffort;let i=Cm(e?.model,void 0,t),a=Am(i,e?.modelOptions?.contextWindow,t);return{model:i,modelOptions:{reasoningEffort:Om(i,r,t),contextWindow:a},planMode:!!e?.planMode}}function vh(e,t){let n=e?.modelOptions?.reasoningEffort,r;return r=um(n)?n:um(e?.effort)?e.effort:cm.reasoningEffort,{model:wm(e?.model,void 0,t),modelOptions:{reasoningEffort:r,fastMode:typeof e?.modelOptions?.fastMode==`boolean`?e.modelOptions.fastMode:cm.fastMode},planMode:!!e?.planMode}}function yh(){return{claude:{model:`claude-opus-4-7`,modelOptions:{...sm},planMode:!1},codex:{model:`gpt-5.5`,modelOptions:{...cm},planMode:!1},openrouter:{model:im,modelOptions:{},planMode:!1},custom:{model:``,modelOptions:{},planMode:!1}}}function bh(e,t){if(t===void 0){c.info(`[chat-preferences] ${e}`);return}c.info(`[chat-preferences] ${e}`,t)}function xh(e,t){if(e===`claude`){let e=t.claude;return{provider:`claude`,model:e.model,modelOptions:{...e.modelOptions},planMode:e.planMode}}if(vm(e)){let n=t[e];return{provider:e,model:n.model,modelOptions:{},planMode:n.planMode}}let n=t.codex;return{provider:`codex`,model:n.model,modelOptions:{...n.modelOptions},planMode:n.planMode}}function Sh(e){return e.provider===`claude`?{provider:`claude`,model:e.model,modelOptions:{...e.modelOptions},planMode:e.planMode}:e.provider===`codex`?{provider:`codex`,model:e.model,modelOptions:{...e.modelOptions},planMode:e.planMode}:{provider:e.provider,model:e.model,modelOptions:{},planMode:e.planMode}}function Ch(e){return e.providerHint?xh(e.providerHint,e.providerDefaults):e.defaultProvider===`last_used`?e.sourceState?Sh(e.sourceState):xh(`claude`,e.providerDefaults):xh(e.defaultProvider,e.providerDefaults)}function wh(e,t){return e.chatStates[t]||Ch({defaultProvider:e.defaultProvider,providerDefaults:e.providerDefaults,legacyComposerState:e.legacyComposerState})}function Th(e,t,n){let r=wh(e,t);return{chatStates:{...e.chatStates,[t]:n(r)}}}var Eh=i()(lh((e,t)=>({defaultProvider:`last_used`,providerDefaults:yh(),chatStates:{},pendingProviderSyncChatIds:new Set,legacyComposerState:{provider:`claude`,model:`claude-opus-4-7`,modelOptions:{...sm},planMode:!1},setDefaultProvider:t=>e({defaultProvider:t}),applyServerDefaults:(t,n)=>e(e=>{if(e.defaultProvider===t&&mh(e.providerDefaults,n))return{defaultProvider:t,providerDefaults:n};let{[gh]:r,...i}=e.chatStates;return{defaultProvider:t,providerDefaults:n,chatStates:i}}),setProviderDefaultModel:(t,n)=>e(e=>{let r=hh();return t===`claude`?{providerDefaults:{...e.providerDefaults,[t]:_h({...e.providerDefaults.claude,model:n},r)}}:vm(t)?{providerDefaults:{...e.providerDefaults,[t]:{...e.providerDefaults[t],model:n}}}:{providerDefaults:{...e.providerDefaults,[t]:vh({...e.providerDefaults.codex,model:n},r)}}}),setProviderDefaultModelOptions:(t,n)=>e(e=>{let r=hh();if(t===`claude`){let i=uh(n);return{providerDefaults:{...e.providerDefaults,[t]:_h({...e.providerDefaults.claude,modelOptions:{...e.providerDefaults.claude.modelOptions,...i}},r)}}}if(vm(t))return{providerDefaults:{...e.providerDefaults,[t]:{...e.providerDefaults[t],modelOptions:{}}}};let i=dh(n);return{providerDefaults:{...e.providerDefaults,[t]:vh({...e.providerDefaults.codex,modelOptions:{...e.providerDefaults.codex.modelOptions,...i}},r)}}}),setProviderDefaultPlanMode:(t,n)=>e(e=>({providerDefaults:{...e.providerDefaults,[t]:{...e.providerDefaults[t],planMode:n}}})),getComposerState:e=>Sh(wh(t(),e)),initializeComposerForChat:(t,n)=>e(e=>{let r=e.chatStates[t],i=n?.providerHint;if(r){if(i&&e.pendingProviderSyncChatIds.has(t)){let n=new Set(e.pendingProviderSyncChatIds);if(n.delete(t),r.provider===i)return bh(`initializeComposerForChat sync skipped`,{chatId:t,provider:i}),{pendingProviderSyncChatIds:n};let a={...xh(i,e.providerDefaults),planMode:r.planMode};return bh(`initializeComposerForChat sync`,{chatId:t,provider:i}),{chatStates:{...e.chatStates,[t]:a},pendingProviderSyncChatIds:n}}return e}let a=Ch({defaultProvider:e.defaultProvider,providerDefaults:e.providerDefaults,sourceState:n?.sourceState,legacyComposerState:e.legacyComposerState,providerHint:i});bh(`initializeComposerForChat`,{chatId:t,composerState:a});let o=i?e.pendingProviderSyncChatIds:new Set([...e.pendingProviderSyncChatIds,t]);return{chatStates:{...e.chatStates,[t]:a},pendingProviderSyncChatIds:o}}),setComposerState:(t,n)=>e(e=>{let r=hh();return{chatStates:{...e.chatStates,[t]:n.provider===`claude`?{provider:`claude`,model:_h(n,r).model,modelOptions:_h(n,r).modelOptions,planMode:n.planMode}:Sh(n)}}}),setChatComposerProvider:(t,n)=>e(e=>Th(e,t,()=>xh(n,e.providerDefaults))),setChatComposerModel:(t,n)=>e(e=>Th(e,t,e=>{let t=hh();if(e.provider===`claude`){let r=_h({...e,model:n},t);return{provider:`claude`,model:r.model,modelOptions:r.modelOptions,planMode:e.planMode}}return e.provider===`codex`?{provider:`codex`,model:n,modelOptions:vh({...e,model:n},t).modelOptions,planMode:e.planMode}:{provider:e.provider,model:n,modelOptions:{},planMode:e.planMode}})),setChatComposerModelOptions:(t,n)=>e(e=>Th(e,t,e=>{let t=hh();if(e.provider===`claude`){let r=uh(n);return{provider:`claude`,model:e.model,modelOptions:_h({...e,modelOptions:{...e.modelOptions,...r}},t).modelOptions,planMode:e.planMode}}if(e.provider===`codex`){let r=dh(n);return{provider:`codex`,model:e.model,modelOptions:vh({...e,modelOptions:{...e.modelOptions,...r}},t).modelOptions,planMode:e.planMode}}return{provider:e.provider,model:e.model,modelOptions:{},planMode:e.planMode}})),setChatComposerPlanMode:(t,n)=>e(e=>Th(e,t,e=>({...e,planMode:n}))),resetChatComposerFromProvider:(t,n)=>e(e=>{let r=new Set(e.pendingProviderSyncChatIds);return r.delete(t),{chatStates:{...e.chatStates,[t]:xh(n,e.providerDefaults)},pendingProviderSyncChatIds:r}}),forgetChats:t=>e(e=>({chatStates:Object.fromEntries(Object.entries(e.chatStates).filter(([e])=>!t.includes(e))),pendingProviderSyncChatIds:new Set([...e.pendingProviderSyncChatIds].filter(e=>!t.includes(e)))}))}),{name:`chat-preferences-state`,version:1,partialize:e=>({chatStates:e.chatStates,legacyComposerState:e.legacyComposerState})})),Dh=`cursor`;function Oh(e){switch(e){case`vscode`:return`code {path}`;case`xcode`:return`xed {path}`;case`windsurf`:return`windsurf {path}`;case`custom`:return`cursor {path}`;default:return`cursor {path}`}}function kh(e){switch(e){case`vscode`:return`VS Code`;case`xcode`:return`Xcode`;case`windsurf`:return`Windsurf`;case`custom`:return`Custom`;default:return`Cursor`}}function Ah(e){return Number.isFinite(e)?Math.min(900,Math.max(250,Math.round(e))):450}function jh(e){switch(e){case`vscode`:case`xcode`:case`windsurf`:case`custom`:case`cursor`:return e;default:return Dh}}function Mh(e,t){let n=e?.trim();return n&&n.length>0?n:Oh(t)}var Nh=i()(e=>({scrollbackLines:te,minColumnWidth:450,editorPreset:Dh,editorCommandTemplate:Oh(Dh),setScrollbackLines:t=>e({scrollbackLines:ie(t)}),setMinColumnWidth:t=>e({minColumnWidth:Ah(t)}),setEditorPreset:t=>e(e=>{let n=jh(t);return{editorPreset:n,editorCommandTemplate:n===`custom`?Mh(e.editorCommandTemplate,n):Oh(n)}}),setEditorCommandTemplate:t=>e(e=>({editorCommandTemplate:Mh(t,e.editorPreset)}))}));function Ph(e){return e===void 0?null:typeof e==`string`?e?{text:e}:null:e.text||e.lexicalState?e:null}var Fh=i()(lh((e,t)=>({drafts:{},attachmentDrafts:{},setDraft:(t,n,r)=>e(e=>{let i;if(typeof n==`string`){if(!n){let{[t]:n,...r}=e.drafts;return{drafts:r}}i={text:n}}else{let a=r??``;if(!a){let{[t]:n,...r}=e.drafts;return{drafts:r}}i={text:a,lexicalState:n}}return{drafts:{...e.drafts,[t]:i}}}),clearDraft:t=>e(e=>{let{[t]:n,...r}=e.drafts;return{drafts:r}}),getDraft:e=>Ph(t().drafts[e]),setAttachmentDrafts:(t,n)=>e(e=>{if(n.length===0){let{[t]:n,...r}=e.attachmentDrafts;return{attachmentDrafts:r}}return{attachmentDrafts:{...e.attachmentDrafts,[t]:n}}}),clearAttachmentDrafts:t=>e(e=>{let{[t]:n,...r}=e.attachmentDrafts;return{attachmentDrafts:r}}),getAttachmentDrafts:e=>t().attachmentDrafts[e]??[],forgetChats:t=>e(e=>({drafts:Object.fromEntries(Object.entries(e.drafts).filter(([e])=>!t.includes(e))),attachmentDrafts:Object.fromEntries(Object.entries(e.attachmentDrafts).filter(([e])=>!t.includes(e)))}))}),{name:`chat-input-drafts`})),Ih=i()(e=>({byProjectId:{},setForProject:(t,n)=>e(e=>({byProjectId:{...e.byProjectId,[t]:n}})),clear:t=>e(e=>{if(!(t in e.byProjectId))return e;let{[t]:n,...r}=e.byProjectId;return{byProjectId:r}})}));function Lh(e){let t=E(e)?e:null,n=Rh(t?.typographyOverride),r=Rh(t?.typographyServerDefaultCache);return{autoResumeOnRateLimit:!!t?.autoResumeOnRateLimit,typographyOverride:n,typographyServerDefaultCache:r}}function Rh(e){if(typeof e==`string`)return Hp(e)?e:void 0}var zh=i()(lh(e=>({autoResumeOnRateLimit:!1,setAutoResumeOnRateLimit:t=>e({autoResumeOnRateLimit:t}),typographyOverride:void 0,typographyServerDefaultCache:void 0,setTypographyOverride:t=>e({typographyOverride:t}),clearTypographyOverride:()=>e({typographyOverride:void 0}),cacheTypographyServerDefault:t=>e({typographyServerDefaultCache:t})}),{name:`kanna-preferences`,version:2,migrate:e=>Lh(ce(e))})),Bh=/^[a-z][a-z0-9-]{0,31}$/,Vh=1024,Hh=4096,Uh=2e6,Wh=/^\S+$/;function Gh(e,t){return`${e}/${t}`}function Kh(e){return e.flatMap(e=>e.models.map(t=>({id:Gh(e.id,t.id),label:`${e.label} · ${t.label||t.id}`})))}function qh(e,t){let n=Kh(t),r=n[0];return r?e.map(e=>e.id===`custom`?{...e,defaultModel:r.id,models:n}:e):e.filter(e=>e.id!==`custom`)}function Jh(e){return Number.isInteger(e)&&e>=4096&&e<=2e6}function Yh(e){if(e.length===0)return{code:`NO_MODELS`,field:`models`,message:`add at least one model`};if(e.length>50)return{code:`INVALID_MODEL`,field:`models`,message:`at most 50 models`};let t=new Set;for(let n of e){if(n.id.length===0||n.id.length>128||!Wh.test(n.id)||n.label.length>64)return{code:`INVALID_MODEL`,field:`models`,message:`invalid model '${n.id}'`};if(t.has(n.id))return{code:`DUPLICATE_MODEL`,field:`models`,message:`model '${n.id}' is listed twice`};t.add(n.id)}return null}function Xh(e,t){return Bh.test(e.id)?t.includes(e.id)?{code:`DUPLICATE_ID`,field:`id`,message:`provider '${e.id}' already exists`}:e.label.trim().length===0||e.label.length>64?{code:`EMPTY_LABEL`,field:`label`,message:`label must be non-empty and <= 64 chars`}:qp(e.baseUrl)===null?{code:`INVALID_BASE_URL`,field:`baseUrl`,message:`base URL must start with http:// or https://`}:e.apiKey.length===0||e.apiKey.length>1024?{code:`MISSING_API_KEY`,field:`apiKey`,message:`an API key of 1-${Vh} characters is required`}:e.contextWindow!==void 0&&!Jh(e.contextWindow)?{code:`INVALID_CONTEXT_WINDOW`,field:`contextWindow`,message:`context window must be a whole number of tokens between ${Hh} and ${Uh}`}:Yh(e.models):{code:`INVALID_ID`,field:`id`,message:`id must match ${Bh}`}}var Zh=[],Qh=i()(e=>({models:Zh,status:`idle`,error:null,setLoading:()=>e({status:`loading`,error:null}),setModels:t=>e({models:t,status:`ready`,error:null}),setError:t=>e({status:`error`,error:t})})),$h=400,eg=800;function tg(e,t,n){for(let r of e.querySelectorAll(`[${t}]`))if(r.getAttribute(t)===n)return r.querySelector(`span.truncate`);return null}async function ng(e,t={}){try{await rg(e,t)}catch{}}async function rg(e,t){let n=t.root??globalThis.document;if(!n?.body||Ip())return;let r=await ig(n,e,t);if(!r)return;let{from:i,to:a,text:o}=r,s=n.createElement(`span`);s.textContent=o,s.setAttribute(`aria-hidden`,`true`),s.style.cssText=[`position:fixed`,`left:${i.left}px`,`top:${i.top}px`,`margin:0`,`white-space:nowrap`,`pointer-events:none`,`z-index:60`].join(`;`);let c=n.defaultView?.getComputedStyle(r.fromElement);c&&(s.style.font=c.font,s.style.color=c.color),n.body.appendChild(s);let l=!1,u=()=>{l||(l=!0,s.remove())},d=setTimeout(u,eg);try{await kp(s,{x:a.left-i.left,y:a.top-i.top,opacity:[1,0],duration:Ap.carry,ease:jp.arriving})}finally{clearTimeout(d),u()}}async function ig(e,t,n){let r=n.now??(()=>Date.now()),i=n.raf??(e=>{requestAnimationFrame(e)}),a=r()+$h;for(;;){let n=tg(e,`data-chat-id`,t),o=tg(e,`data-tab-id`,t);if(n&&o){let e=n.getBoundingClientRect(),t=o.getBoundingClientRect();if(e.width>0&&t.width>0)return{from:e,to:t,fromElement:n,text:n.textContent??``}}if(r()>=a)return null;await new Promise(e=>{i(e)})}}function ag(e){return Number.isFinite(e)?Math.max(20,e):33}function og(){return{isVisible:!1}}function sg(){return{viewMode:`history`,collapsedPaths:{},summary:``,description:``}}function cg(e,t){return e[t]??og()}function lg(e){for(let t of Object.values(e))if(E(t)&&typeof t.size==`number`&&Number.isFinite(t.size))return t.size;return null}function ug(e){if(!E(e))return null;let t={};if(E(e.collapsedPaths))for(let[n,r]of Object.entries(e.collapsedPaths))typeof r==`boolean`&&(t[n]=r);return{viewMode:e.viewMode===`changes`?`changes`:`history`,collapsedPaths:t,summary:typeof e.summary==`string`?e.summary:``,description:typeof e.description==`string`?e.description:``}}function dg(e){if(!E(e))return{size:33,projects:{},projectUi:{}};let t=E(e.projects)?e.projects:{},n=e.size,r=ag(typeof n==`number`&&Number.isFinite(n)?n:lg(t)??33),i={};for(let[e,n]of Object.entries(t))i[e]={isVisible:E(n)&&n.isVisible===!0};let a={};if(E(e.projectUi))for(let[t,n]of Object.entries(e.projectUi)){let e=ug(n);e&&(a[t]=e)}return{size:r,projects:i,projectUi:a}}var fg=i()(lh(e=>({size:33,projects:{},projectUi:{},toggleVisibility:t=>e(e=>({projects:{...e.projects,[t]:{...cg(e.projects,t),isVisible:!cg(e.projects,t).isVisible}}})),setSize:t=>e({size:ag(t)}),reconcileCollapsedPaths:(t,n)=>e(e=>{let r=e.projectUi[t]??sg(),i=Object.fromEntries(n.map(e=>[e,r.collapsedPaths[e]??!0]));return Object.keys(r.collapsedPaths).length===Object.keys(i).length&&Object.entries(i).every(([e,t])=>r.collapsedPaths[e]===t)?e:{projectUi:{...e.projectUi,[t]:{...r,collapsedPaths:i}}}}),toggleCollapsedPath:(t,n)=>e(e=>{let r=e.projectUi[t]??sg();return{projectUi:{...e.projectUi,[t]:{...r,collapsedPaths:{...r.collapsedPaths,[n]:!(r.collapsedPaths[n]??!0)}}}}}),setViewMode:(t,n)=>e(e=>{let r=e.projectUi[t]??sg();return r.viewMode===n?e:{projectUi:{...e.projectUi,[t]:{...r,viewMode:n}}}}),setCommitDraft:(t,n)=>e(e=>{let r=e.projectUi[t]??sg();return r.summary===n.summary&&r.description===n.description?e:{projectUi:{...e.projectUi,[t]:{...r,summary:n.summary,description:n.description}}}}),setCommitSummary:(t,n)=>e(e=>{let r=e.projectUi[t]??sg();return r.summary===n?e:{projectUi:{...e.projectUi,[t]:{...r,summary:n}}}}),setCommitDescription:(t,n)=>e(e=>{let r=e.projectUi[t]??sg();return r.description===n?e:{projectUi:{...e.projectUi,[t]:{...r,description:n}}}}),clearCommitDraft:t=>e(e=>{let n=e.projectUi[t]??sg();return!n.summary&&!n.description?e:{projectUi:{...e.projectUi,[t]:{...n,summary:``,description:``}}}}),clearProject:t=>e(e=>{let{[t]:n,...r}=e.projects,{[t]:i,...a}=e.projectUi;return{projects:r,projectUi:a}})}),{name:`right-sidebar-layouts`,version:4,migrate:e=>dg(ce(e))})),pg={isVisible:!1},mg=[68,32];function hg(){return{isVisible:!1,mainSizes:[...mg],terminals:[],nextTerminalIndex:0}}function gg(e,t){return e[t]??hg()}function _g(e,t){for(let[n,r]of Object.entries(e)){let e=r.terminals.find(e=>e.id===t);if(e)return{projectId:n,terminal:e}}return null}function vg(e){if(e.length===0)return[];let t=e.reduce((e,t)=>e+Math.max(t,0),0);return!Number.isFinite(t)||t<=0?Array.from({length:e.length},()=>100/e.length):e.map(e=>Math.max(e,0)/t*100)}function yg(e){let t=e,n=``;do n=String.fromCharCode(65+t%26)+n,t=Math.floor(t/26)-1;while(t>=0);return`Terminal ${n}`}function bg(e){if(e.length===0)return e;let t=e.length+1;return e.map(n=>({...n,size:n.size*e.length/t}))}function xg(e,t,n){return{...e,[t]:n(gg(e,t))}}var Sg=i()(lh(e=>({projects:{},addTerminal:(t,n)=>e(e=>({projects:xg(e.projects,t,e=>{let t=bg(e.terminals),r={id:globalThis.crypto?.randomUUID?.()??`terminal-${Date.now()}-${e.nextTerminalIndex}`,title:yg(e.nextTerminalIndex),size:100/(t.length+1)},i=n?Math.max(t.findIndex(e=>e.id===n)+1,0):t.length;return{...e,isVisible:!0,nextTerminalIndex:e.nextTerminalIndex+1,terminals:[...t.slice(0,i),r,...t.slice(i)]}})})),removeTerminal:(t,n)=>e(e=>({projects:xg(e.projects,t,e=>{let t=e.terminals.filter(e=>e.id!==n);if(t.length===0)return{...e,isVisible:!1,terminals:[]};let r=vg(t.map(e=>e.size));return{...e,terminals:t.map((e,n)=>({...e,size:r[n]??100/t.length}))}})})),toggleVisibility:t=>e(e=>({projects:xg(e.projects,t,e=>({...e,isVisible:e.terminals.length>0&&!e.isVisible}))})),resetMainSizes:t=>e(e=>({projects:xg(e.projects,t,e=>({...e,mainSizes:[...mg]}))})),setMainSizes:(t,n)=>e(e=>{if(n.length!==2)return e;let[r=50,i=50]=vg(n),a=[r,i];return{projects:xg(e.projects,t,e=>({...e,mainSizes:a}))}}),setTerminalSizes:(t,n)=>e(e=>({projects:xg(e.projects,t,e=>{if(n.length!==e.terminals.length)return e;let t=vg(n);return{...e,terminals:e.terminals.map((e,n)=>({...e,size:t[n]??e.size}))}})})),clearProject:t=>e(e=>{let{[t]:n,...r}=e.projects;return{projects:r}})}),{name:`terminal-layouts`,version:1})),Cg={isVisible:!1,mainSizes:[...mg],terminals:[],nextTerminalIndex:0};function wg(e){return e===void 0||!re(e)?[]:e.filter(e=>typeof e==`string`)}function Tg(e){let t=E(e)?e:{};return{deletedBoardIds:wg(t.deletedBoardIds),failures:wg(t.failures)}}var Eg=[],Dg=i()(e=>({chatIds:Eg,setFollowed:t=>e({chatIds:t})}));function Og(e){return t=>e?t.chatIds.includes(e):!1}function kg(e){if(!E(e))return{ok:!1,error:`Unexpected response from the server`};let{ok:t,code:n,expiresAt:r,error:i}=e;return t===!0&&typeof n==`string`&&typeof r==`number`?{ok:!0,code:n,expiresAt:r}:{ok:!1,error:typeof i==`string`?i:`Could not create a pairing code`}}function Ag(e){return E(e)?e.ok===!0?{ok:!0}:{ok:!1,error:typeof e.error==`string`?e.error:`Could not start the update`}:{ok:!1,error:`Unexpected response from the server`}}var jg=[],Mg=[],Ng=[],Pg={},Fg={},Ig=i()((e,t)=>({changelogPendingAction:null,skillQuery:``,skillResults:jg,skillSearchLoading:!1,skillSearchError:null,installedSkills:Mg,installedSkillIds:new Set,installedLoading:!1,installedError:null,skillOperationError:null,installingSkillId:null,uninstallingSkillId:null,installMessages:Fg,packageUpdateSnapshot:null,pluginInventory:null,pluginInventoryLoading:!1,pluginInventoryError:null,globalInstructionsDraft:``,globalInstructionsPersistedAtMount:``,globalInstructionsSaving:!1,globalInstructionsError:null,changelogStatus:`idle`,signingOut:!1,authEnabled:!1,releases:Ng,changelogError:null,pushPermissionState:m().state,pushDeviceId:h(),pushError:null,scrollbackDraft:``,minColumnWidthDraft:``,tabMinWidthDraft:``,uploadMaxFileSizeDraft:``,claudeIdleMinutesDraft:``,claudeMaxConcurrentDraft:``,editorCommandDraft:``,keybindingDrafts:Pg,keybindingsError:null,appSettingsError:null,analyticsDialogOpen:!1,tunnelError:null,cloudflaredPathDraft:``,pushContactSubjectDraft:``,shareDefaultTtlDraft:``,llmProviderDraft:{provider:`openai`,apiKey:``,model:``,baseUrl:``},llmProviderError:null,llmValidationStatus:`idle`,llmValidationError:null,llmValidationDialogOpen:!1,setChangelogPendingAction:t=>e({changelogPendingAction:t}),setSkillQuery:t=>e({skillQuery:t}),setSkillResults:t=>e({skillResults:t}),setSkillSearchLoading:t=>e({skillSearchLoading:t}),setSkillSearchError:t=>e({skillSearchError:t}),setInstalledSkills:t=>e({installedSkills:t}),setInstalledSkillIds:t=>e({installedSkillIds:t}),addInstalledSkillId:n=>{let r=t().installedSkillIds,i=new Set(r);i.add(n),e({installedSkillIds:i})},removeInstalledSkillId:n=>{let r=t().installedSkillIds,i=new Set(r);i.delete(n),e({installedSkillIds:i})},setInstalledLoading:t=>e({installedLoading:t}),setInstalledError:t=>e({installedError:t}),setSkillOperationError:t=>e({skillOperationError:t}),setInstallingSkillId:t=>e({installingSkillId:t}),setUninstallingSkillId:t=>e({uninstallingSkillId:t}),setInstallMessages:t=>e({installMessages:t}),setInstallMessage:(n,r)=>{let i=t().installMessages;e({installMessages:{...i,[n]:r}})},clearInstallMessage:n=>{let r={...t().installMessages};delete r[n],e({installMessages:r})},clearInstallMessagesForSkill:n=>{let r={...t().installMessages};for(let e of Object.keys(r))(e.endsWith(`/${n}`)||e===n)&&delete r[e];e({installMessages:r})},setPackageUpdateSnapshot:t=>e({packageUpdateSnapshot:t}),setPluginInventory:t=>e({pluginInventory:t}),setPluginInventoryLoading:t=>e({pluginInventoryLoading:t}),setPluginInventoryError:t=>e({pluginInventoryError:t}),setGlobalInstructionsDraft:t=>e({globalInstructionsDraft:t}),setGlobalInstructionsPersistedAtMount:t=>e({globalInstructionsPersistedAtMount:t}),setGlobalInstructionsSaving:t=>e({globalInstructionsSaving:t}),setGlobalInstructionsError:t=>e({globalInstructionsError:t}),setChangelogStatus:t=>e({changelogStatus:t}),setSigningOut:t=>e({signingOut:t}),setAuthEnabled:t=>e({authEnabled:t}),setReleases:t=>e({releases:t}),setChangelogError:t=>e({changelogError:t}),setPushPermissionState:t=>e({pushPermissionState:t}),setPushDeviceId:t=>e({pushDeviceId:t}),setPushError:t=>e({pushError:t}),setScrollbackDraft:t=>e({scrollbackDraft:t}),setMinColumnWidthDraft:t=>e({minColumnWidthDraft:t}),setTabMinWidthDraft:t=>e({tabMinWidthDraft:t}),setUploadMaxFileSizeDraft:t=>e({uploadMaxFileSizeDraft:t}),setClaudeIdleMinutesDraft:t=>e({claudeIdleMinutesDraft:t}),setClaudeMaxConcurrentDraft:t=>e({claudeMaxConcurrentDraft:t}),setEditorCommandDraft:t=>e({editorCommandDraft:t}),setKeybindingDrafts:t=>e({keybindingDrafts:t}),setKeybindingDraft:(t,n)=>e(e=>e.keybindingDrafts[t]===n?e:{keybindingDrafts:{...e.keybindingDrafts,[t]:n}}),setKeybindingsError:t=>e({keybindingsError:t}),setAppSettingsError:t=>e({appSettingsError:t}),setAnalyticsDialogOpen:t=>e({analyticsDialogOpen:t}),setTunnelError:t=>e({tunnelError:t}),setCloudflaredPathDraft:t=>e({cloudflaredPathDraft:t}),setPushContactSubjectDraft:t=>e({pushContactSubjectDraft:t}),setShareDefaultTtlDraft:t=>e({shareDefaultTtlDraft:t}),setLlmProviderDraft:t=>e({llmProviderDraft:t}),setLlmProviderError:t=>e({llmProviderError:t}),setLlmValidationStatus:t=>e({llmValidationStatus:t}),setLlmValidationError:t=>e({llmValidationError:t}),setLlmValidationDialogOpen:t=>e({llmValidationDialogOpen:t})})),Lg=`main`;function Rg(e){return e.kind===`pane`}function zg(e){return e.kind===`group`}var Bg=.1;function Vg(e){return typeof e==`number`&&Number.isFinite(e)&&e>0}function Hg(e){return Array.from({length:e},()=>1/e)}function Ug(e,t){if(t<=0)return[];if(t===1)return[1];let n=Array.from({length:t},(t,n)=>{let r=e?.[n];return Vg(r)?r:1}),r=n.reduce((e,t)=>e+t,0);return r<=0?Hg(t):n.map(e=>e/r)}function Wg(e){let t=e.length;if(t===0)return[];if(t===1)return[1];if(t*.1>1)return Hg(t);let n=Ug(e,t),r=Array(t).fill(0),i=new Set(n.map((e,t)=>t)),a=1;for(;i.size>0;){let e=0;for(let t of i)e+=n[t]??0;if(e<=0){let e=a/i.size;for(let t of i)r[t]=e;break}let t=[];for(let r of i)(n[r]??0)/e*a<.1&&t.push(r);if(t.length===0){for(let t of i)r[t]=(n[t]??0)/e*a;break}for(let e of t)r[e]=Bg,i.delete(e),a-=Bg}return Ug(r,t)}function Gg(e,t,n){let r=e[t],i=e[t+1];if(r===void 0||i===void 0||!Number.isFinite(n))return[...e];let a=r+i;if(a<=0)return[...e];let o=Math.min(Bg,a/2),s=Math.min(a-o,Math.max(o,r+n)),c=[...e];return c[t]=s,c[t+1]=a-s,c}var Kg=[{page:`projects`,pattern:`/`},{page:`settings`,pattern:`/settings/:sectionId`},{page:`settings`,pattern:`/settings`},{page:`cron`,pattern:`/cron`},{page:`workflows`,pattern:`/workflows/:chatId`},{page:`boards`,pattern:`/boards/stack/:stackId`},{page:`boards`,pattern:`/boards/:projectId`}];function qg(e){for(let{page:t,pattern:r}of Kg){let i=n({path:r,end:!0},e);if(!i)continue;let a={};for(let[e,t]of Object.entries(i.params))t!==void 0&&(a[e]=t);return{page:t,params:a}}return null}function Jg(e){let t=qg(e);return t?{kind:`page`,page:t.page,path:e}:null}function Yg(e){return Rg(e)?[e]:e.children.flatMap(Yg)}function Xg(e){return e.target.kind===`chat`?`/chat/${e.target.chatId}`:e.target.kind===`page`?e.target.path:null}function Zg(e){let t=Yg(e.root),n=t.find(t=>t.id===e.focusedPaneId),r=n?.tabs.find(e=>e.tabId===n.focusedTabId),i=r?Xg(r):null;if(i)return i;let a=t.flatMap(e=>e.tabs),o=a.find(e=>e.target.kind===`chat`);if(o)return Xg(o)??`/`;let s=a.find(e=>e.target.kind===`page`);return(s?Xg(s):null)??`/`}function Qg(e){return`${e.length}_${e}`}function $g(e){switch(e.kind){case`chat`:return`chat_${Qg(e.chatId)}`;case`changes`:return`changes`;case`terminal`:return`terminal_${Qg(e.terminalId)}`;case`board`:return`board_${Qg(e.boardId)}`;case`page`:return`page_${e.page}`}}function e_(e){if(typeof e!=`string`)return null;let t=e.trim();return t.length>0?t:null}function t_(e){if(e===void 0||!E(e))return null;switch(e.kind){case`chat`:{let t=e_(e.chatId);return t?{kind:`chat`,chatId:t}:null}case`changes`:return{kind:`changes`};case`terminal`:{let t=e_(e.terminalId);return t?{kind:`terminal`,terminalId:t}:null}case`board`:{let t=e_(e.boardId);return t?{kind:`board`,boardId:t}:null}case`page`:{let t=typeof e.path==`string`?e.path:null,n=t?qg(t):null;return t&&n&&n.page===e.page?{kind:`page`,page:n.page,path:t}:null}default:return null}}function n_(e,t){if(e.kind!==t.kind)return!1;switch(e.kind){case`chat`:return t.kind===`chat`&&e.chatId===t.chatId;case`terminal`:return t.kind===`terminal`&&e.terminalId===t.terminalId;case`board`:return t.kind===`board`&&e.boardId===t.boardId;case`page`:return t.kind===`page`&&e.page===t.page&&e.path===t.path;case`changes`:return!0}}function r_(e,t){return{tabId:$g(e),target:e,createdAt:t}}function i_(e,t=[],n){let r=new Set,i=[];for(let e of t)r.has(e.tabId)||(r.add(e.tabId),i.push(e));return{kind:`pane`,id:e,tabs:i,focusedTabId:n&&r.has(n)?n:i[0]?.tabId??null}}function a_(e,t,n,r){return n.length===0?i_(e):n.length===1?n[0]:{kind:`group`,id:e,direction:t,children:[...n],sizes:Ug(r,n.length)}}function o_(){return{root:i_(Lg),focusedPaneId:Lg}}function s_(e){return Rg(e)?1:1+Math.max(...e.children.map(s_))}function c_(e){return Rg(e)?[e]:e.children.flatMap(c_)}function l_(e,t){if(Rg(e))return e.id===t?[]:null;for(let[n,r]of e.children.entries()){let e=l_(r,t);if(e)return[n,...e]}return null}function u_(e,t){if(Rg(e))return e.tabs.some(e=>e.tabId===t)?{pane:e,path:[]}:null;for(let[n,r]of e.children.entries()){let e=u_(r,t);if(e)return{pane:e.pane,path:[n,...e.path]}}return null}function d_(e,t){let n=e;for(let e of t){if(!n||!zg(n))return null;n=n.children[e]}return n??null}function f_(e,t){let n=l_(e,t);if(!n)return null;for(let t=n.length-1;t>=0;t--){let r=d_(e,n.slice(0,t));if(!r||!zg(r))continue;let i=n[t];for(let e=i-1;e>=0;e--){let t=c_(r.children[e]).at(-1);if(t)return t.id}for(let e=i+1;e<r.children.length;e++){let t=c_(r.children[e])[0];if(t)return t.id}}return null}function p_(e,t,n){if(t.length===0)return n;let[r,...i]=t;if(!zg(e))return e;let a=e.children[r];if(!a)return e;let o=[...e.children];return o[r]=p_(a,i,n),a_(e.id,e.direction,o,e.sizes)}function m_(e,t){if(t.length===0)return i_(e.id);let n=t.slice(0,-1),r=t.at(-1),i=d_(e,n);if(!i||!zg(i))return e;let a=i.children.filter((e,t)=>t!==r),o=i.sizes.filter((e,t)=>t!==r);return p_(e,n,a_(i.id,i.direction,a,Wg(o)))}function h_(e,t,n={}){let r=u_(e,t);if(!r)return{root:e,tab:null,sourcePaneId:null};let{pane:i,path:a}=r,o=i.tabs.find(e=>e.tabId===t)??null,s=i.tabs.filter(e=>e.tabId!==t);if(s.length>0||i.id===n.preserveEmptyPaneId){let n=i.focusedTabId===t?void 0:i.focusedTabId;return{root:p_(e,a,i_(i.id,s,n)),tab:o,sourcePaneId:i.id}}return{root:m_(e,a),tab:o,sourcePaneId:i.id}}function g_(e,t,n,r={}){let i=l_(e,t);if(!i)return null;let a=d_(e,i);if(!a||!Rg(a))return null;let o=a.tabs.filter(e=>e.tabId!==n.tabId),s=r.index??o.length;o.splice(Math.max(0,Math.min(s,o.length)),0,n);let c=r.focus??!0?n.tabId:a.focusedTabId??n.tabId;return p_(e,i,i_(a.id,o,c))}function __(e){return e===`left`||e===`right`?`horizontal`:`vertical`}function v_(e){return e===`right`||e===`bottom`}function y_(e){return c_(e)[0]?.id??null}function b_(e,t){let{tabId:n,targetPaneId:r,position:i,ids:a}=t;if(!l_(e.root,r))return null;let o=u_(e.root,n);if(!o||o.pane.id===r&&o.pane.tabs.length<=1)return null;let s=h_(e.root,n,{preserveEmptyPaneId:r});if(!s.tab)return null;let c=l_(s.root,r);if(!c)return null;let l=__(i),u=v_(i),d=i_(a.paneId,[s.tab],s.tab.tabId),f=c.slice(0,-1),p=f.length>0||c.length>0?d_(s.root,f):null,m;if(p&&zg(p)&&p.direction===l){let e=c.at(-1),t=[...p.children],n=[...p.sizes],r=n[e]??1/t.length,i=u?e+1:e;t.splice(i,0,d),n.splice(i,0,r/2),n[u?e:e+1]=r/2,m=p_(s.root,f,a_(p.id,p.direction,t,n))}else{let e=d_(s.root,c);if(!e)return null;let t=u?[e,d]:[d,e];m=p_(s.root,c,a_(a.groupId,l,t,[.5,.5]))}return s_(m)>4?null:{root:m,focusedPaneId:a.paneId}}function x_(e,t){let n=e.indexOf(t);return n<0?null:e[n+1]??(n>0?e[n-1]??null:null)}function S_(e,t){let n=u_(e.root,t);if(!n)return null;let{pane:r}=n,i=r.focusedTabId===t?x_(r.tabs.map(e=>e.tabId),t):null,a=f_(e.root,r.id),o=h_(e.root,t).root,s={root:o,focusedPaneId:e.focusedPaneId===null?null:(l_(o,e.focusedPaneId)?e.focusedPaneId:null)??(a&&l_(o,a)?a:null)??y_(o)??`main`};return i?w_(s,i)??s:s}function C_(e,t,n,r){let i=u_(e.root,t);if(!i||!l_(e.root,n))return null;let a=i.pane.id===n,o=h_(e.root,t,{preserveEmptyPaneId:a?n:void 0});if(!o.tab)return null;let s=g_(o.root,n,o.tab,{index:r});return s?{root:s,focusedPaneId:n}:null}function w_(e,t){let n=u_(e.root,t);if(!n)return null;let{pane:r,path:i}=n;return r.focusedTabId===t&&e.focusedPaneId===r.id?null:{root:p_(e.root,i,i_(r.id,r.tabs,t)),focusedPaneId:r.id}}function T_(e,t){return e.focusedPaneId===t||!l_(e.root,t)?null:{...e,focusedPaneId:t}}function E_(e,t,n){let r=l_(e.root,t);if(!r)return null;let i=d_(e.root,r);if(!i||!Rg(i))return null;let a=new Map(i.tabs.map(e=>[e.tabId,e])),o=new Set,s=[];for(let e of n){let t=a.get(e);t&&!o.has(e)&&(o.add(e),s.push(t))}for(let e of i.tabs)o.has(e.tabId)||s.push(e);if(s.every((e,t)=>e.tabId===i.tabs[t]?.tabId))return null;let c=p_(e.root,r,i_(i.id,s,i.focusedTabId));return{...e,root:c}}function D_(e,t,n,r){let i=d_(e.root,t);if(!i||!Rg(i))return e;let a=i.tabs.map(e=>e.tabId===n?{...e,target:r}:e);return{...e,root:p_(e.root,t,i_(i.id,a,i.focusedTabId))}}function O_(e,t,n={createdAt:0}){let r=$g(t),i=n.focus??!0,a=u_(e.root,r);if(a){let n=a.pane.tabs.find(e=>e.tabId===r),o=n&&!n_(n.target,t)?D_(e,a.path,r,t):e;return i?{layout:w_(o,r)??o,tabId:r}:{layout:o,tabId:r}}let o=(e.focusedPaneId&&l_(e.root,e.focusedPaneId)?e.focusedPaneId:null)??y_(e.root);if(!o)return null;let s=g_(e.root,o,r_(t,n.createdAt),{focus:i});return s?{layout:{root:s,focusedPaneId:i?o:e.focusedPaneId},tabId:r}:null}function k_(e,t,n=[]){if(zg(e)){if(e.id===t)return n;for(let[r,i]of e.children.entries()){let e=k_(i,t,[...n,r]);if(e)return e}}return null}function A_(e,t,n){let r=k_(e.root,t);if(!r)return null;let i=d_(e.root,r);if(!i||!zg(i)||n.length!==i.children.length)return null;let a=Wg(Ug(n,i.children.length));if(a.every((e,t)=>Math.abs(e-(i.sizes[t]??0))<1e-6))return null;let o=p_(e.root,r,a_(i.id,i.direction,i.children,a));return{...e,root:o}}function j_(e,t,n,r){if(r===0||!Number.isFinite(r))return null;let i=k_(e.root,t);if(!i)return null;let a=d_(e.root,i);if(!a||!zg(a))return null;let o=Gg(a.sizes,n,r);if(o.every((e,t)=>Math.abs(e-(a.sizes[t]??0))<1e-9))return null;let s=p_(e.root,i,a_(a.id,a.direction,a.children,o));return{...e,root:s}}var M_={left:0,top:0,right:1,bottom:1};function N_(e,t=M_){if(Rg(e))return[{paneId:e.id,rect:t}];let n=e.direction===`horizontal`,r=n?t.right-t.left:t.bottom-t.top,i=[],a=n?t.left:t.top;for(let[o,s]of e.children.entries()){let c=(e.sizes[o]??0)*r,l=n?{...t,left:a,right:a+c}:{...t,top:a,bottom:a+c};i.push(...N_(s,l)),a+=c}return i}function P_(e,t,n,r){return t<=n?n-t:r<=e?e-r:0}function F_(e,t,n,r){return Math.max(0,Math.min(t,r)-Math.max(e,n))}function I_(e,t,n){switch(e){case`left`:return t.left-n.right;case`right`:return n.left-t.right;case`up`:return t.top-n.bottom;case`down`:return n.top-t.bottom}}function L_(e,t,n){let r=N_(e),i=r.find(e=>e.paneId===t);if(!i)return null;let a=r.filter(e=>e.paneId!==t).map(e=>{let{rect:t}=e,r=i.rect,a=I_(n,r,t),o=n===`left`||n===`right`,s=o?r.top:r.left,c=o?r.bottom:r.right,l=o?t.top:t.left,u=o?t.bottom:t.right,d=P_(s,c,l,u),f=F_(s,c,l,u),p=Math.abs((s+c)/2-(l+u)/2);return{paneId:e.paneId,primary:a,perpendicular:d,shared:f,centreDistance:p}}).filter(e=>e.primary>=-1e-6);return a.length===0?null:(a.sort((e,t)=>e.primary-t.primary||e.perpendicular-t.perpendicular||t.shared-e.shared||e.centreDistance-t.centreDistance||e.paneId.localeCompare(t.paneId)),a[0]?.paneId??null)}var R_=.05,z_={left:`horizontal`,right:`horizontal`,up:`vertical`,down:`vertical`},B_={left:-1,right:1,up:-1,down:1};function V_(e,t,n,r=R_){let i=l_(e,t);if(!i)return null;let a=z_[n];for(let t=i.length-1;t>=0;t--){let o=d_(e,i.slice(0,t));if(!o||!zg(o)||o.direction!==a)continue;let s=i[t],c=s<o.children.length-1?s:s-1;if(!(c<0))return{groupId:o.id,index:c,deltaRatio:B_[n]*r}}return null}function H_(e,t){return`${e}-recovered-${t||`root`}`}function U_(e){return typeof e==`string`&&e.trim().length>0?e.trim():null}function W_(e){return e===`vertical`?`vertical`:`horizontal`}function G_(e){return typeof e==`number`&&Number.isFinite(e)?e:null}function K_(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){if(!E(n))continue;let e=t_(n.target);e&&t.push(r_(e,G_(n.createdAt)??0))}return t}function q_(e){if(!Array.isArray(e))return;let t=[];for(let n of e){let e=G_(n);e!==null&&t.push(e)}return t}function J_(e,t,n){if(e===void 0||!E(e))return null;let r=U_(e.id);if(e.kind===`pane`)return i_(r??H_(`pane`,n),K_(e.tabs),U_(e.focusedTabId));if(e.kind!==`group`||!Array.isArray(e.children))return null;if(t>=4){let r=e.children.map((e,r)=>J_(e,t,`${n}.${r}`)).filter(e=>e!==null).flatMap(c_),i=r[0];return i?i_(i.id,r.flatMap(e=>e.tabs)):null}let i=e.children.map((e,r)=>J_(e,t+1,`${n}.${r}`)).filter(e=>e!==null);return i.length===0?null:a_(r??H_(`group`,n),W_(e.direction),i,q_(e.sizes))}function Y_(e,t){if(e===null)return null;let n=U_(e);return n&&t.some(e=>e.id===n)?n:t[0]?.id??`main`}function X_(e){if(e===void 0||!E(e))return o_();let t=J_(e.root,1,``);if(!t)return o_();let n=c_(t);return n.length===0?o_():{root:t,focusedPaneId:Y_(e.focusedPaneId,n)}}var Z_=`main`,Q_=`changes`,$_=`workspace`,ev=`terminals`,tv=`root`;function nv(e,t){return!Number.isFinite(e)||e<=0||e>=100?t:e/100}function rv(e){let t=i_(Z_,[]),n=e.terminals.filter(e=>e.id.trim().length>0).map((e,t)=>i_(`terminal-${e.id}`,[r_({kind:`terminal`,terminalId:e.id.trim()},t)])),r=n.length>0?a_(ev,`horizontal`,n,[...e.terminalSizes]):null,i=nv(e.mainSizes[0],.68),a=r?a_($_,`vertical`,[t,r],[i,1-i]):t;if(!e.changesVisible)return{root:a,focusedPaneId:Z_};let o=nv(e.changesSizePercent,.33);return{root:a_(tv,`horizontal`,[a,i_(Q_,[r_({kind:`changes`},0)])],[1-o,o]),focusedPaneId:Z_}}function iv(e){return c_(e.root).find(t=>t.id===e.focusedPaneId)??null}function av(e){return iv(e)?.focusedTabId??null}function ov(e,t){let n=av(t);return!n||e[0]===n?e:[n,...e.filter(e=>e!==n)].slice(0,50)}function sv(e,t){let n=c_(e.root).flatMap((e,t)=>e.tabs.map(e=>({tab:e,paneOrdinal:t+1}))),r=new Map,i=av(e);i&&r.set(i,-1),t.forEach((e,t)=>{r.has(e)||r.set(e,t)});let a=2**53-1;return n.map((e,t)=>({entry:e,layoutIndex:t,rank:r.get(e.tab.tabId)??a})).sort((e,t)=>e.rank-t.rank||e.layoutIndex-t.layoutIndex).map(({entry:e})=>e)}function cv(e,t){return!e||e.tabs.length===0?null:t===9?e.tabs[e.tabs.length-1].tabId:e.tabs[t-1]?.tabId??null}function lv(e,t){return e<8?String(e+1):e===t-1?`9`:null}function uv(e,t){let n=Vm(e,`openTabSwitcher`).find(e=>Km(e,t));if(!n)return null;let r=n.split(`+`).some(e=>e.trim().toLowerCase()===`shift`);return{binding:n,reverse:t.shiftKey&&!r}}function dv(e,t){return Vm(e,`jumpToPaneTab`).some(e=>Gm(e,t))}function fv(e,t){if(!dv(e,t)||!t.code.startsWith(`Digit`))return null;let n=Number(t.code.slice(5));return n>=1&&n<=9?n:null}function pv(e){return c_(e.root).some(e=>e.tabs.length>0)}var mv=i()(lh((e,t)=>{function n(t){e(e=>{let n=t(e.layout);return n?{...e,layout:n,recentTabIds:ov(e.recentTabIds,n)}:e})}function r(){let n=t().nodeSequence+1;return e({nodeSequence:n}),{paneId:`pane-${n}`,groupId:`group-${n}`}}return{layout:o_(),nodeSequence:0,recentTabIds:[],getLayout:()=>t().layout,openTab:e=>n(t=>O_(t,e,{createdAt:0})?.layout??null),closeTab:e=>n(t=>S_(t,e)),closeTabsFor:({chatIds:e,boardIds:t})=>n(n=>{let r=c_(n.root).flatMap(e=>e.tabs).filter(({target:n})=>n.kind===`chat`&&e.includes(n.chatId)||n.kind===`board`&&t.includes(n.boardId));return r.length===0?null:r.reduce((e,t)=>S_(e,t.tabId)??e,n)}),focusTab:e=>n(t=>w_(t,e)),focusPane:e=>n(t=>T_(t,e)),splitPane:e=>{let t=r();n(n=>b_(n,{...e,ids:t}))},moveTabToPane:(e,t,r)=>n(n=>C_(n,e,t,r)),focusAdjacentPane:e=>n(t=>{if(!t.focusedPaneId)return null;let n=L_(t.root,t.focusedPaneId,e);return n?T_(t,n):null}),resizeFocusedPane:e=>n(t=>{if(!t.focusedPaneId)return null;let n=V_(t.root,t.focusedPaneId,e);return n?j_(t,n.groupId,n.index,n.deltaRatio):null}),cycleFocusedPaneTab:e=>n(t=>{let n=c_(t.root).find(e=>e.id===t.focusedPaneId);if(!n||n.tabs.length===0)return null;let r=n.tabs.findIndex(e=>e.tabId===n.focusedTabId),i=(((r===-1?0:r)+e)%n.tabs.length+n.tabs.length)%n.tabs.length;return w_(t,n.tabs[i].tabId)}),closeFocusedTab:()=>n(e=>{let t=c_(e.root).find(t=>t.id===e.focusedPaneId),n=t?.focusedTabId??t?.tabs[0]?.tabId;return n?S_(e,n):null}),splitFocusedPane:e=>{let i=t().layout,a=c_(i.root).find(e=>e.id===i.focusedPaneId),o=a?.focusedTabId??a?.tabs[0]?.tabId;if(!a||!o)return;let s=r();n(t=>b_(t,{tabId:o,targetPaneId:a.id,position:e,ids:s}))},reorderPaneTabs:(e,t)=>n(n=>E_(n,e,t)),resizeGroup:(e,t,r)=>n(n=>j_(n,e,t,r)),setGroupSizes:(e,t)=>n(n=>A_(n,e,t)),seedFromLegacy:t=>e(e=>{if(pv(e.layout))return e;let n=rv(t);return{...e,layout:n,recentTabIds:ov(e.recentTabIds,n)}})}},{name:`pane-layouts`,version:2,migrate:(e,t)=>{if(t>=2)return e;let n=s(e)?e.nodeSequence:void 0;return{nodeSequence:typeof n==`number`?n:0}},merge:(e,t)=>{if(!s(e))return t;let n=X_(ce(e.layout)),r=pv(n)?n:t.layout,i=e.nodeSequence,a=typeof i==`number`&&Number.isFinite(i)?i:0,o=e.recentTabIds,c=Array.isArray(o)?o.filter(e=>typeof e==`string`):t.recentTabIds;return{...t,layout:r,nodeSequence:a,recentTabIds:c}},partialize:e=>({layout:e.layout,nodeSequence:e.nodeSequence,recentTabIds:e.recentTabIds})})),hv=i()(lh(e=>({checkedPathsByProjectId:{},reconcileProject:(t,n)=>e(e=>{let r=e.checkedPathsByProjectId[t]??{},i=Object.fromEntries(n.map(e=>[e,r[e]??!0]));return Object.keys(r).length===Object.keys(i).length&&Object.entries(i).every(([e,t])=>r[e]===t)?e:{checkedPathsByProjectId:{...e.checkedPathsByProjectId,[t]:i}}}),toggleChecked:(t,n)=>e(e=>{let r=e.checkedPathsByProjectId[t]??{};return{checkedPathsByProjectId:{...e.checkedPathsByProjectId,[t]:{...r,[n]:!(r[n]??!0)}}}}),toggleAllChecked:(t,n)=>e(e=>{if(n.length===0)return e;let r=e.checkedPathsByProjectId[t]??{},i=!n.every(e=>r[e]??!0);return{checkedPathsByProjectId:{...e.checkedPathsByProjectId,[t]:{...r,...Object.fromEntries(n.map(e=>[e,i]))}}}}),clearProject:t=>e(e=>{let{[t]:n,...r}=e.checkedPathsByProjectId;return{checkedPathsByProjectId:r}})}),{name:`diff-commit-selections`,version:2}));function gv(e){Fh.getState().forgetChats(e.chatIds),Eh.getState().forgetChats(e.chatIds),mv.getState().closeTabsFor({chatIds:e.chatIds,boardIds:e.boardIds??[]}),e.projectId&&hv.getState().clearProject(e.projectId)}function _v(e,t){let n=t.getItem(e);if(!n)return null;let r=ae(n);return r===null||!E(r)?null:E(r.state)?r.state:null}function vv(e){if(!E(e))return;let t={};if(E(e.claude)){let n=yv(e.claude),r=e.claude.modelOptions;if(E(r)){let e=bv(r.reasoningEffort),t=bv(r.contextWindow);lm(e)&&fm(t)&&(n.modelOptions={reasoningEffort:e,contextWindow:t})}t.claude=n}if(E(e.codex)){let n=yv(e.codex),r=e.codex.modelOptions;if(E(r)){let e=bv(r.reasoningEffort);um(e)&&typeof r.fastMode==`boolean`&&(n.modelOptions={reasoningEffort:e,fastMode:r.fastMode})}t.codex=n}return E(e.openrouter)&&(t.openrouter=yv(e.openrouter)),E(e.custom)&&(t.custom=yv(e.custom)),Object.keys(t).length>0?t:void 0}function yv(e){let t={};return typeof e.model==`string`&&(t.model=e.model),typeof e.planMode==`boolean`&&(t.planMode=e.planMode),t}function bv(e){return typeof e==`string`?e:void 0}async function xv(e,t=f){let n=await t.getJson(`/auth/status`,{cache:`no-store`,signal:e});return n.ok?n.data:{}}async function Sv(e,t=f){let n={password:e.password};return e.next&&(n.next=e.next),(await t.postJson(`/auth/login`,n)).ok}async function Cv(e=f){await e.postJson(`/auth/logout`,{})}function wv(e){let t=(0,O.useCallback)(async t=>{try{await e.command(t),_.getState().setCommandError(null)}catch(e){_.getState().setCommandError(e instanceof Error?e.message:String(e))}},[e]);return{handleCreateStack:(0,O.useCallback)((e,n,r)=>t({type:`stack.create`,title:e,projectIds:n,...r?{instructions:r}:{}}),[t]),handleRenameStack:(0,O.useCallback)((e,n)=>t({type:`stack.rename`,stackId:e,title:n}),[t]),handleRemoveStack:(0,O.useCallback)(e=>t({type:`stack.remove`,stackId:e}),[t]),handleAddProjectToStack:(0,O.useCallback)((e,n)=>t({type:`stack.addProject`,stackId:e,projectId:n}),[t]),handleRemoveProjectFromStack:(0,O.useCallback)((e,n)=>t({type:`stack.removeProject`,stackId:e,projectId:n}),[t]),handleSetProjectInstructions:(0,O.useCallback)((e,n)=>t({type:`project.setInstructions`,projectId:e,instructions:n}),[t]),handleSetStackInstructions:(0,O.useCallback)((e,n)=>t({type:`stack.setInstructions`,stackId:e,instructions:n}),[t])}}function $(e,t){return e===t}function Tv(e,t){for(let n of[`claude`,`codex`,`openrouter`,`custom`])if(e[n]!==t[n])return!1;return!0}function Ev(e,t){return e===t||e.length===t.length&&e.every((e,n)=>{let r=t[n];return r!==void 0&&e.id===r.id&&e.taskType===r.taskType&&e.description===r.description&&e.startedAt===r.startedAt})}var Dv={chatId:$,projectId:$,localPath:$,title:$,status:$,isDraining:$,provider:$,planMode:$,sessionTokensByProvider:Tv,timings:()=>!0,policyOverride:()=>!0,sessionState:()=>!0,backgroundTasks:Ev};function Ov(e,t){return e===t?!0:!e||!t?!1:Dv.chatId(e.chatId,t.chatId)&&Dv.projectId(e.projectId,t.projectId)&&Dv.localPath(e.localPath,t.localPath)&&Dv.title(e.title,t.title)&&Dv.status(e.status,t.status)&&Dv.isDraining(e.isDraining,t.isDraining)&&Dv.provider(e.provider,t.provider)&&Dv.planMode(e.planMode,t.planMode)&&Dv.sessionTokensByProvider(e.sessionTokensByProvider,t.sessionTokensByProvider)&&Dv.timings(e.timings,t.timings)&&Dv.policyOverride(e.policyOverride,t.policyOverride)&&Dv.sessionState(e.sessionState,t.sessionState)&&Dv.backgroundTasks(e.backgroundTasks,t.backgroundTasks)}function kv(e,t){return e===t||e.length===t.length&&e.every((e,n)=>{let r=t[n];return!!r&&e.path===r.path&&e.changeType===r.changeType&&e.isUntracked===r.isUntracked&&e.additions===r.additions&&e.deletions===r.deletions&&e.patchDigest===r.patchDigest&&e.mimeType===r.mimeType&&e.size===r.size})}function Av(e,t){let n=e?.entries??[],r=t?.entries??[];return n.length===r.length&&n.every((e,t)=>{let n=r[t];return!!n&&e.sha===n.sha&&e.summary===n.summary&&e.description===n.description&&e.authorName===n.authorName&&e.authoredAt===n.authoredAt&&e.githubUrl===n.githubUrl&&e.tags.length===n.tags.length&&e.tags.every((e,t)=>e===n.tags[t])})}var jv={status:$,files:kv,branchHistory:Av,branchName:$,defaultBranchName:$,hasOriginRemote:$,originRepoSlug:$,hasUpstream:$,aheadCount:$,behindCount:$,lastFetchedAt:$};function Mv(e,t){return e===t?!0:!e||!t?!1:jv.status(e.status,t.status)&&jv.files(e.files,t.files)&&jv.branchHistory(e.branchHistory,t.branchHistory)&&jv.branchName(e.branchName,t.branchName)&&jv.defaultBranchName(e.defaultBranchName,t.defaultBranchName)&&jv.hasOriginRemote(e.hasOriginRemote,t.hasOriginRemote)&&jv.originRepoSlug(e.originRepoSlug,t.originRepoSlug)&&jv.hasUpstream(e.hasUpstream,t.hasUpstream)&&jv.aheadCount(e.aheadCount,t.aheadCount)&&jv.behindCount(e.behindCount,t.behindCount)&&jv.lastFetchedAt(e.lastFetchedAt,t.lastFetchedAt)}function Nv(e,t){return!!(e&&e.status!==`unknown`&&t&&t.status===`unknown`&&t.files.length===0)}var Pv=`kanna:ui-update-restart`,Fv=`kanna:last-update-reload-request`;function Iv(e,t){return t===`updating`||t===`restart_pending`?{active:!0,label:`Installing update`}:e===`awaiting_disconnect`||e===`awaiting_server_ready`?{active:!0,label:`Re-deploying Kanna`}:{active:!1,label:``}}function Lv(e,t){switch(t.kind){case`reload_requested`:return String(t.reloadRequestedAt)===t.lastHandled?e:`awaiting_disconnect`;case`update_initiated`:return`awaiting_disconnect`;case`connection_status_changed`:return t.connectionStatus===`disconnected`&&e===`awaiting_disconnect`?`awaiting_server_ready`:e;case`server_ready`:return`idle`;case`aborted`:return`idle`;case`update_status_changed`:return e}}var Rv=class{deps;phase;updateStatus=null;pollCancelled=!1;pollTimeoutId=null;isServerReady;constructor(e,t){this.deps=e,this.isServerReady=t.isServerReady;let n=e.storage.getItem(Pv);this.phase=n===`awaiting_disconnect`||n===`awaiting_server_ready`?n:`idle`,this.phase===`awaiting_server_ready`&&this.startPolling()}getSnapshot(){return{phase:this.phase,activity:Iv(this.phase,this.updateStatus)}}emit(){this.deps.onSnapshot(this.getSnapshot())}setPhase(e){e!==this.phase&&(this.phase=e,e===`idle`?this.deps.storage.removeItem(Pv):this.deps.storage.setItem(Pv,e),this.emit())}dispatch(e){if(e.kind===`update_status_changed`){let t=this.updateStatus;this.updateStatus=e.updateStatus,t!==this.updateStatus&&this.emit();return}let t=Lv(this.phase,e);e.kind===`reload_requested`&&t===`awaiting_disconnect`&&this.deps.storage.setItem(Fv,String(e.reloadRequestedAt)),this.setPhase(t),t===`awaiting_server_ready`&&this.startPolling()}startPolling(){this.pollCancelled=!1,se(`appRuntime.poll`,this.poll())}async poll(){try{if(await this.isServerReady()){if(this.pollCancelled)return;this.setPhase(`idle`),this.deps.dom.reload();return}}catch{}this.pollCancelled||(this.pollTimeoutId=this.deps.timer.setTimeout(()=>{se(`appRuntime.poll`,this.poll())},500))}close(){this.pollCancelled=!0,this.pollTimeoutId!==null&&(this.deps.timer.clearTimeout(this.pollTimeoutId),this.pollTimeoutId=null)}static getLastHandledReloadRequest(e){return e.getItem(Fv)}},zv=`settings.readLlmProvider`,Bv=`chat.compose`,Vv=`lever-theme`,Hv=`chat-sound-preferences`,Uv=`terminal-preferences`,Wv=`chat-preferences`;function Gv(e,t){t&&t.projectId===e&&Ih.getState().setForProject(t.projectId,t.commands)}function Kv(e){let t={},n=e.getItem(Vv);(n===`light`||n===`dark`||n===`system`)&&(t.theme=n);let r=_v(Hv,e);(r?.chatSoundPreference===`never`||r?.chatSoundPreference===`unfocused`||r?.chatSoundPreference===`always`)&&(t.chatSoundPreference=r.chatSoundPreference),(r?.chatSoundId===`blow`||r?.chatSoundId===`bottle`||r?.chatSoundId===`frog`||r?.chatSoundId===`funk`||r?.chatSoundId===`glass`||r?.chatSoundId===`ping`||r?.chatSoundId===`pop`||r?.chatSoundId===`purr`||r?.chatSoundId===`tink`)&&(t.chatSoundId=r.chatSoundId);let i=_v(Uv,e);if(i){t.terminal={},typeof i.scrollbackLines==`number`&&(t.terminal.scrollbackLines=i.scrollbackLines),typeof i.minColumnWidth==`number`&&(t.terminal.minColumnWidth=i.minColumnWidth);let e={};(i.editorPreset===`cursor`||i.editorPreset===`vscode`||i.editorPreset===`xcode`||i.editorPreset===`windsurf`||i.editorPreset===`custom`)&&(e.preset=i.editorPreset),typeof i.editorCommandTemplate==`string`&&(e.commandTemplate=i.editorCommandTemplate),Object.keys(e).length>0&&(t.editor=e)}let a=_v(Wv,e);(a?.defaultProvider===`last_used`||a?.defaultProvider===`claude`||a?.defaultProvider===`codex`)&&(t.defaultProvider=a.defaultProvider);let o=a?vv(a.providerDefaults):null;return o&&(t.providerDefaults=o),t.browserSettingsMigrated=!0,Object.keys(t).length>1?t:null}function qv(e){e.removeItem(Vv),e.removeItem(Hv),e.removeItem(Uv),e.removeItem(Wv)}function Jv(e,t){if(!t?.length||e.length<=1)return e;let n=new Map(e.map((e,t)=>[e.groupKey,t])),r=new Set,i=t.map(t=>{if(r.has(t))return null;r.add(t);let i=n.get(t);return i===void 0?null:e[i]}).filter(e=>!!e);if(i.length===0)return e;let a=[...i,...e.filter(e=>!r.has(e.groupKey))];return a.every((t,n)=>t===e[n])?e:a}function Yv(e,t){let n=e.find(e=>e.chats.some(e=>e.chatId===t));return n?n.chats.find(e=>e.chatId!==t)?.chatId??null:null}function Xv(e,t){return t?e.find(e=>e.chats.some(e=>e.chatId===t))?.groupKey??null:null}function Zv(e,t){let n=e.find(e=>e.groupKey===t);return n?n.chats.find(e=>e.provider!=null)?.provider??null??n.sourceProvider??null:null}function Qv(e,t){return t===`updating`||t===`restart_pending`?{active:!0,label:`Installing update`}:e===`awaiting_disconnect`||e===`awaiting_server_ready`?{active:!0,label:`Re-deploying Kanna`}:{active:!1,label:``}}function $v(e){let t=e.selectedProjectId??e.sidebarProjectId??null;return t?{kind:`project_id`,projectId:t}:e.fallbackLocalProjectPath?{kind:`local_path`,localPath:e.fallbackLocalProjectPath}:null}function ey(e,t,n,r,i,a,s,c,l){let u=Zu(),f=_(e=>e.sidebarData),m=_(e=>e.optimisticSidebarProjectOrder),h=_(e=>e.localProjects),v=_(e=>e.updateSnapshot),y=_(e=>e.uiRestartPhase),b=_(e=>e.keybindings),x=T(e=>e.settings),S=_(e=>e.pushConfig),C=_(e=>e.llmProvider),w=_(e=>e.connectionStatus),ee=_(e=>e.sidebarReady),te=_(e=>e.localProjectsReady),re=_(e=>e.sidebarOpen),ie=_(e=>e.sidebarCollapsed),E=_(e=>e.addProjectModalOpen),ae=_(e=>e.commandError),ce=_(e=>e.startingLocalPath),D=_(e=>e.selectedProjectId),de=mv(le(e=>c_(e.layout.root).flatMap(e=>e.tabs).flatMap(e=>e.target.kind===`chat`?[e.target.chatId]:[]))),fe=c?.projectId??null,pe=(0,O.useRef)(null);(0,O.useEffect)(()=>{let e=new Rv({storage:n,dom:r,timer:i,onSnapshot:e=>{_.getState().setUiRestartPhase(e.phase===`idle`?null:e.phase)}},{isServerReady:async()=>{let e=await xv();return Object.keys(e).length>0}});return pe.current=e,()=>{e.close(),pe.current=null}},[r,n,i]),(0,O.useEffect)(()=>{pe.current?.dispatch({kind:`update_status_changed`,updateStatus:v?.status})},[v?.status]),(0,O.useEffect)(()=>{let e=pe.current;e&&v?.reloadRequestedAt&&e.dispatch({kind:`reload_requested`,reloadRequestedAt:v.reloadRequestedAt,lastHandled:Rv.getLastHandledReloadRequest(n)})},[n,v?.reloadRequestedAt]),(0,O.useEffect)(()=>{pe.current?.dispatch({kind:`connection_status_changed`,connectionStatus:w})},[w]);let me=(0,O.useCallback)(e=>{pe.current?.dispatch({kind:`update_initiated`})},[]),he=(0,O.useCallback)(()=>{pe.current?.dispatch({kind:`aborted`})},[]),k=(0,O.useMemo)(()=>Jv(f.projectGroups,m),[m,f.projectGroups]),ge=(0,O.useMemo)(()=>k===f.projectGroups?f:{...f,projectGroups:k},[f,k]),_e=h?.projects[0]?.localPath??null;(0,O.useEffect)(()=>e.onStatus(e=>_.getState().setConnectionStatus(e)),[e]),(0,O.useEffect)(()=>e.subscribe({type:`sidebar`},e=>{let t=_.getState();t.setSidebarData(e),t.setOptimisticSidebarProjectOrder(t=>t&&Jv(e.projectGroups,t)===e.projectGroups?null:t),t.setSidebarReady(!0),t.setCommandError(null)}),[e]),(0,O.useEffect)(()=>e.subscribe({type:`local-projects`},e=>{let t=_.getState();t.setLocalProjects(e),t.setLocalProjectsReady(!0),t.setCommandError(null)}),[e]),(0,O.useEffect)(()=>e.subscribe({type:`update`},e=>{let t=_.getState();t.setUpdateSnapshot(e),t.setCommandError(null)}),[e]),(0,O.useEffect)(()=>e.subscribe({type:`keybindings`},e=>{let t=_.getState();t.setKeybindings(e),t.setCommandError(null)}),[e]),(0,O.useEffect)(()=>e.subscribe({type:`app-settings`},e=>{let t=_.getState();T.getState().setFromServer(e),Eh.getState().applyServerDefaults(e.defaultProvider,e.providerDefaults),t.setCommandError(null)}),[e]),(0,O.useEffect)(()=>e.subscribe({type:`push-config`},e=>{_.getState().setPushConfig(e)}),[e]),(0,O.useEffect)(()=>e.subscribe({type:`followed-sessions`},e=>{Dg.getState().setFollowed(e.chatIds)}),[e]),(0,O.useEffect)(()=>e.subscribe({type:`cron-jobs`},e=>{g.getState().setRows(e.rows)}),[e]),(0,O.useEffect)(()=>e.subscribe({type:`beacons`},e=>{ih.getState().setRows(e.beacons)}),[e]),(0,O.useEffect)(()=>e.subscribe({type:`package-updates`},e=>{Ig.getState().setPackageUpdateSnapshot(e)}),[e]),(0,O.useEffect)(()=>{let t=new Set,n=new Map;for(let e of de){let r=Xv(k,e);r&&(t.add(r),n.set(p(r,e),{projectId:r,chatId:e}))}D&&t.add(D),fe&&t.add(fe);for(let e of t)n.has(e)||n.set(e,{projectId:e});if(t.size===0)return;let r=[];return n.forEach(({projectId:t,chatId:n},i)=>{r.push(e.subscribe({type:`project-git`,projectId:t,...n===void 0?{}:{chatId:n}},e=>{_.getState().setDiffSnapshotsByKey(t=>{let n=e??null;return Nv(t[i]??null,n)||Mv(t[i]??null,n)?t:{...t,[i]:n}}),_.getState().setCommandError(null)}))}),t.forEach(t=>{r.push(e.subscribe({type:`project-commands`,projectId:t},e=>{Gv(t,e)}))}),()=>{r.forEach(e=>e())}},[de,k,fe,D,e]),(0,O.useEffect)(()=>{w===`connected`&&e.command({type:`update.check`,force:!0}).catch(e=>{_.getState().setCommandError(e instanceof Error?e.message:String(e))})},[w,e]),(0,O.useEffect)(()=>{function t(){v?.lastCheckedAt&&(Date.now()-v.lastCheckedAt<=36e5||e.command({type:`update.check`}).catch(e=>{_.getState().setCommandError(e instanceof Error?e.message:String(e))}))}return r.addWindowListener(`focus`,t)},[r,e,v?.lastCheckedAt]),(0,O.useEffect)(()=>{function e(){_.getState().incrementFocusEpoch()}let t=r.addWindowListener(`focus`,e),n=r.addDocumentListener(`visibilitychange`,e);return()=>{t(),n()}},[r]);let ve=(0,O.useCallback)(async()=>{try{T.getState().setHydrationStatus(`loading`);let t=await e.command({type:`settings.readAppSettings`}),n=_.getState();T.getState().setFromServer(t),Eh.getState().applyServerDefaults(t.defaultProvider,t.providerDefaults),n.setCommandError(null)}catch(e){T.getState().setHydrationStatus(`error`),_.getState().setCommandError(e instanceof Error?e.message:String(e))}},[e]),ye=(0,O.useCallback)(async()=>{try{let t=await e.command({type:`settings.readLlmProvider`}),n=_.getState();n.setLlmProvider(t),n.setCommandError(null)}catch(e){_.getState().setCommandError(e instanceof Error?e.message:String(e))}},[e]);(0,O.useEffect)(()=>{w===`connected`&&se(`read app settings`,ve())},[w,ve]),(0,O.useEffect)(()=>{w===`connected`&&(Qh.getState().setLoading(),e.command({type:`settings.listOpenRouterModels`}).then(e=>{Qh.getState().setModels(e)}).catch(o(e=>{let t=e.message;Qh.getState().setError(t)})))},[w,e]);let be=(0,O.useCallback)(async t=>{try{T.getState().applyOptimisticPatch(t);let n=await e.command({type:`settings.writeAppSettingsPatch`,patch:t}),r=_.getState();T.getState().setFromServer(n),Eh.getState().applyServerDefaults(n.defaultProvider,n.providerDefaults),r.setCommandError(null)}catch(e){throw _.getState().setCommandError(e instanceof Error?e.message:String(e)),await ve(),e}},[ve,e]);(0,O.useEffect)(()=>{if(w!==`connected`||x?.browserSettingsMigrated!==!1)return;let e=Kv(t);e&&se(`migrate legacy browser settings`,be(e).then(()=>qv(t)))},[x?.browserSettingsMigrated,w,be,t]),(0,O.useEffect)(()=>{w===`connected`&&d(zv,ye)},[w,ye]),(0,O.useEffect)(()=>{if(D)return;let e=k[0];e&&_.getState().setSelectedProjectId(e.groupKey)},[D,k]);let xe=(0,O.useCallback)(async t=>{try{await e.command({type:`settings.testMcpServer`,id:t}),_.getState().setCommandError(null)}catch(e){throw _.getState().setCommandError(e instanceof Error?e.message:String(e)),e}},[e]),A=(0,O.useCallback)(async()=>{try{return kg(await e.command({type:`beacons.mintPairingCode`}))}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}},[e]),Se=(0,O.useCallback)(async t=>{try{return Ag(await e.command({type:`beacons.update`,beaconId:t}))}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}},[e]),Ce=(0,O.useCallback)(async t=>{try{let n=await e.command({type:`settings.startMcpOAuth`,id:t});return _.getState().setCommandError(null),n}catch(e){let t=e instanceof Error?e.message:String(e);return _.getState().setCommandError(t),{ok:!1,error:t}}},[e]),we=(0,O.useCallback)(async(t,n)=>{try{let r=await e.command({type:`settings.completeMcpOAuth`,id:t,callbackUrl:n});return _.getState().setCommandError(null),r}catch(e){let t=e instanceof Error?e.message:String(e);return _.getState().setCommandError(t),{ok:!1,error:t}}},[e]),Te=(0,O.useCallback)(async(t,n)=>{try{await e.command({type:`chat.setPolicyOverride`,chatId:t,policyOverride:n}),_.getState().setCommandError(null)}catch(e){throw _.getState().setCommandError(e instanceof Error?e.message:String(e)),e}},[e]),Ee=(0,O.useCallback)(async t=>{try{T.getState().applyOptimisticPatch({cloudflareTunnel:t});let n=await e.command({type:`appSettings.setCloudflareTunnel`,patch:t}),r=_.getState();T.getState().setFromServer(n),Eh.getState().applyServerDefaults(n.defaultProvider,n.providerDefaults),r.setCommandError(null)}catch(e){throw _.getState().setCommandError(e instanceof Error?e.message:String(e)),await ve(),e}},[ve,e]),De=(0,O.useCallback)(async t=>{try{T.getState().applyOptimisticPatch({claudeAuth:t});let n=await e.command({type:`appSettings.setClaudeAuth`,patch:t}),r=_.getState();T.getState().setFromServer(n),Eh.getState().applyServerDefaults(n.defaultProvider,n.providerDefaults),r.setCommandError(null)}catch(e){throw _.getState().setCommandError(e instanceof Error?e.message:String(e)),await ve(),e}},[ve,e]),Oe=(0,O.useCallback)(async(t,n)=>await e.command({type:`appSettings.testOAuthToken`,token:t,baseUrl:n}),[e]),ke=(0,O.useCallback)(async t=>{try{let n=await e.command({type:`settings.writeLlmProvider`,provider:t.provider,apiKey:t.apiKey,model:t.model,baseUrl:t.baseUrl}),r=_.getState();r.setLlmProvider(n),r.setCommandError(null)}catch(e){throw _.getState().setCommandError(e instanceof Error?e.message:String(e)),e}},[e]),Ae=(0,O.useCallback)(async t=>await e.command({type:`settings.validateLlmProvider`,provider:t.provider,apiKey:t.apiKey,model:t.model,baseUrl:t.baseUrl}),[e]),je=(0,O.useCallback)(async()=>{try{await Cv(),_.getState().setCommandError(null),r.reload()}catch(e){_.getState().setCommandError(e instanceof Error?e.message:String(e))}},[r]),Me=(0,O.useCallback)(async t=>{try{await e.command({type:`update.check`,force:t?.force}),_.getState().setCommandError(null)}catch(e){_.getState().setCommandError(e instanceof Error?e.message:String(e))}},[e]),Ne=(0,O.useCallback)(async t=>{me(`awaiting_disconnect`);try{let n=await e.command({type:`update.install`,version:t});if(!n.ok){he(),_.getState().setCommandError(null),await u.alert({title:n.userTitle??`Update failed`,description:n.userMessage??`Kanna could not install the update. Try again later.`,closeLabel:`OK`});return}if(n.ok&&n.action===`reload`){r.reload();return}_.getState().setCommandError(null)}catch(e){he(),_.getState().setCommandError(e instanceof Error?e.message:String(e))}},[he,u,r,me,e]),Pe=(0,O.useCallback)(async()=>{me(`awaiting_disconnect`);try{let t=await e.command({type:`update.reload`});if(!t.ok){he(),_.getState().setCommandError(null),await u.alert({title:t.userTitle??`Re-deploy failed`,description:t.userMessage??`Kanna could not re-deploy. Try again later.`,closeLabel:`OK`});return}if(t.action===`reload`){r.reload();return}_.getState().setCommandError(null)}catch(e){he(),_.getState().setCommandError(e instanceof Error?e.message:String(e))}},[he,u,r,me,e]),Fe=(0,O.useCallback)(async t=>{let n=Eh.getState(),r=s?n.getComposerState(s):n.getComposerState(gh),i=n.defaultProvider===`last_used`?Zv(k,t):null,a=await e.command({type:`chat.create`,projectId:t});n.initializeComposerForChat(a.chatId,{sourceState:r,providerHint:i}),Rp.getState().markSpawned(a.chatId),se(`fly chat title to tab`,ng(a.chatId));let o=_.getState();o.setSelectedProjectId(t),o.setPendingChatId(a.chatId),l.openChat(a.chatId),o.setSidebarOpen(!1),o.setCommandError(null)},[s,l,k,e]),Ie=(0,O.useCallback)(async t=>t.kind===`project_id`?{projectId:t.projectId}:t.kind===`local_path`?{projectId:(await e.command({type:`project.open`,localPath:t.localPath})).projectId,localPath:t.localPath}:{projectId:(await e.command(t.project.mode===`new`?{type:`project.create`,localPath:t.project.localPath,title:t.project.title}:{type:`project.open`,localPath:t.project.localPath})).projectId,localPath:t.project.localPath},[e]),Le=(0,O.useCallback)(async e=>{try{let t;t=e.kind===`project_id`?null:e.kind===`local_path`?e.localPath:e.project.localPath,t&&_.getState().setStartingLocalPath(t);let{projectId:n}=await Ie(e);await Fe(n)}catch(e){_.getState().setCommandError(e instanceof Error?e.message:String(e))}finally{_.getState().setStartingLocalPath(null)}},[Fe,Ie]),Re=(0,O.useCallback)(async e=>{await Le({kind:`project_id`,projectId:e})},[Le]),ze=(0,O.useCallback)(async t=>{try{let n=await e.command({type:`chat.fork`,chatId:t.chatId}),r=Eh.getState();r.initializeComposerForChat(n.chatId,{sourceState:r.getComposerState(t.chatId)});let i=_.getState();i.setPendingChatId(n.chatId),l.openChat(n.chatId),i.setSidebarOpen(!1),i.setCommandError(null)}catch(e){_.getState().setCommandError(e instanceof Error?e.message:String(e))}},[l,e]),Be=(0,O.useCallback)(async e=>{await Le({kind:`local_path`,localPath:e})},[Le]),Ve=(0,O.useCallback)(async e=>{await Le({kind:`project_request`,project:e})},[Le]),He=(0,O.useCallback)(async t=>{let n=await u.prompt({title:`Rename Chat`,initialValue:t.title,confirmLabel:`Rename`});if(n&&n!==t.title)try{await e.command({type:`chat.rename`,chatId:t.chatId,title:n}),_.getState().setCommandError(null)}catch(e){_.getState().setCommandError(e instanceof Error?e.message:String(e))}},[u,e]),Ue=(0,O.useCallback)(async t=>{if(await u.confirm({title:`Delete Chat`,description:`Delete "${t.title}"? This cannot be undone.`,confirmLabel:`Delete`,confirmVariant:`destructive`}))try{if(await e.command({type:`chat.delete`,chatId:t.chatId}),gv({chatIds:[t.chatId]}),t.chatId===s){let e=Yv(k,t.chatId);e?l.openChat(e):l.closeChat()}}catch(e){_.getState().setCommandError(e instanceof Error?e.message:String(e))}},[s,l,u,k,e]),We=(0,O.useCallback)(async t=>{if(!t.length)return;let n=t.length;if(!await u.confirm({title:`Delete Chats`,description:`Delete ${n} chat${n===1?``:`s`}? This cannot be undone.`,confirmLabel:`Delete`,confirmVariant:`destructive`}))return;let r=s!=null&&t.includes(s);try{for(let n of t)await e.command({type:`chat.delete`,chatId:n}),gv({chatIds:[n]});if(r){let e=Yv(k,s);e?l.openChat(e):l.closeChat()}}catch(e){_.getState().setCommandError(e instanceof Error?e.message:String(e))}},[s,l,u,k,e]),Ge=(0,O.useCallback)(async t=>{try{if(await e.command({type:`chat.archive`,chatId:t.chatId}),t.chatId===s){let e=Yv(k,t.chatId);e?l.openChat(e):l.closeChat()}_.getState().setCommandError(null)}catch(e){_.getState().setCommandError(e instanceof Error?e.message:String(e))}},[s,l,k,e]),Ke=(0,O.useCallback)(async t=>{try{_.getState().setPendingChatId(t),await e.command({type:`chat.unarchive`,chatId:t}),l.openChat(t),_.getState().setCommandError(null)}catch(e){_.getState().setPendingChatId(null),_.getState().setCommandError(e instanceof Error?e.message:String(e))}},[l,e]),qe=(0,O.useCallback)(e=>{Sg.getState().clearProject(e),fg.getState().clearProject(e),c?.projectId===e&&l.closeChat()},[l,c]),Je=(0,O.useCallback)(async t=>{try{await e.command({type:`project.remove`,projectId:t}),qe(t),_.getState().setCommandError(null)}catch(e){_.getState().setCommandError(e instanceof Error?e.message:String(e))}},[qe,e]),Ye=(0,O.useCallback)(async t=>{let n=k.find(e=>e.groupKey===t),r=n?ue(n.localPath):`this project`,i=[...n?.chats??[],...n?.archivedChats??[]].map(e=>e.chatId);if(await u.confirm({title:`Delete Project`,description:`Delete "${r}" and everything Kanna stored for it: ${i.length} chat${i.length===1?``:`s`} (archived included), boards and their worktrees, share links, and the attachments in .kanna inside the folder. Your own files in the folder are not touched. This cannot be undone.`,confirmLabel:`Delete`,confirmVariant:`destructive`}))try{let n=Tg(await e.command({type:`project.delete`,projectId:t}));qe(t),gv({chatIds:i,boardIds:n.deletedBoardIds,projectId:t}),_.getState().setCommandError(n.failures.length>0?`Project deleted, but some data could not be removed: ${n.failures.join(`; `)}`:null)}catch(e){_.getState().setCommandError(e instanceof Error?e.message:String(e))}},[u,qe,k,e]),j=(0,O.useCallback)(async(t,n)=>{try{await e.command({type:`project.setStar`,projectId:t,starred:n}),_.getState().setCommandError(null)}catch(e){_.getState().setCommandError(e instanceof Error?e.message:String(e))}},[e]),Xe=(0,O.useCallback)(async t=>{_.getState().setOptimisticSidebarProjectOrder(t);try{await e.command({type:`sidebar.reorderProjectGroups`,projectIds:t}),_.getState().setCommandError(null)}catch(e){_.getState().setOptimisticSidebarProjectOrder(null),_.getState().setCommandError(e instanceof Error?e.message:String(e))}},[e]),Ze=wv(e),M=(0,O.useCallback)(async(t,n,r)=>{try{let i=Eh.getState(),a=s?i.getComposerState(s):i.getComposerState(gh),o=await e.command({type:`chat.create`,projectId:t,stackId:n,stackBindings:r});i.initializeComposerForChat(o.chatId,{sourceState:a});let c=_.getState();c.setSelectedProjectId(t),c.setPendingChatId(o.chatId),l.openChat(o.chatId),c.setSidebarOpen(!1),c.setCommandError(null)}catch(e){_.getState().setCommandError(e instanceof Error?e.message:String(e))}},[s,l,e]),Qe=(0,O.useCallback)(async t=>{try{let n=await e.command({type:`stack.listWorktrees`,projectId:t});return _.getState().setCommandError(null),n.worktrees}catch(e){return _.getState().setCommandError(e instanceof Error?e.message:String(e)),[]}},[e]),$e=(0,O.useCallback)(async()=>await e.command({type:`sessions.importClaude`}),[e]),et=(0,O.useCallback)(async t=>await e.command({type:`sessions.importClaudeSession`,sessionIds:t}),[e]),tt=(0,O.useCallback)(async t=>{let n=T.getState();_.getState().setCommandError(null),await e.command({type:`system.openExternal`,...t,editor:t.action===`open_editor`?t.editor??{preset:oe(n),commandTemplate:ne(n)}:void 0})},[e]),nt=(0,O.useCallback)(async(e,t)=>{let n=c?.localPath??h?.projects[0]?.localPath??k[0]?.localPath;if(n)try{await tt({action:e,localPath:n,editor:t})}catch(e){_.getState().setCommandError(e instanceof Error?e.message:String(e))}},[h?.projects,tt,c?.localPath,k]),rt=(0,O.useCallback)(async e=>{try{await a.writeText(e),_.getState().setCommandError(null)}catch(e){_.getState().setCommandError(e instanceof Error?e.message:String(e))}},[a]),it=(0,O.useCallback)(async(e,t=`open_editor`,n)=>{try{await tt({action:t,localPath:e.path,line:e.line,column:e.column,editor:n})}catch(e){_.getState().setCommandError(e instanceof Error?e.message:String(e))}},[tt]),at=(0,O.useCallback)(async(e,t)=>{try{await tt({action:e,localPath:t})}catch(e){_.getState().setCommandError(e instanceof Error?e.message:String(e))}},[tt]),ot=(0,O.useCallback)(()=>_.getState().setSidebarOpen(!0),[]),st=(0,O.useCallback)(()=>_.getState().setSidebarOpen(!1),[]),ct=(0,O.useCallback)(()=>_.getState().setSidebarCollapsed(!0),[]),lt=(0,O.useCallback)(()=>_.getState().setSidebarCollapsed(!1),[]),ut=(0,O.useCallback)(()=>_.getState().setAddProjectModalOpen(!0),[]),dt=(0,O.useCallback)(()=>_.getState().setAddProjectModalOpen(!1),[]),ft=(0,O.useCallback)(()=>{let e=$v({selectedProjectId:D,sidebarProjectId:k[0]?.groupKey,fallbackLocalProjectPath:_e});if(e){d(Bv,()=>Le(e));return}l.goHome()},[l,_e,D,k,Le]),pt=Qv(y,v?.status);return{socket:e,routeChatId:s,sidebarData:ge,localProjects:h,updateSnapshot:v,keybindings:b,pushConfig:S,llmProvider:C,connectionStatus:w,sidebarReady:ee,uiRestartActive:pt.active,uiRestartLabel:pt.label,localProjectsReady:te,commandError:ae,startingLocalPath:ce,sidebarOpen:re,sidebarCollapsed:ie,addProjectModalOpen:E,stacks:ge.stacks,openSidebar:ot,closeSidebar:st,collapseSidebar:ct,expandSidebar:lt,openAddProjectModal:ut,closeAddProjectModal:dt,handleCreateChat:Re,handleForkChat:ze,handleOpenLocalProject:Be,handleCreateProject:Ve,handleCheckForUpdates:Me,handleInstallUpdate:Ne,handleForceReload:Pe,handleReadAppSettings:ve,handleWriteAppSettings:be,handleTestMcpServer:xe,handleMintBeaconPairingCode:A,handleUpdateBeacon:Se,handleStartMcpOAuth:Ce,handleCompleteMcpOAuth:we,handleSetChatPolicyOverride:Te,handleWriteCloudflareTunnel:Ee,handleWriteClaudeAuth:De,handleTestOAuthToken:Oe,handleReadLlmProvider:ye,handleWriteLlmProvider:ke,handleValidateLlmProvider:Ae,handleSignOut:je,handleRenameChat:He,handleArchiveChat:Ge,handleOpenArchivedChat:Ke,handleDeleteChat:Ue,handleDeleteBulkChats:We,handleHideProject:Je,handleDeleteProject:Ye,handleToggleProjectStar:j,handleReorderProjectGroups:Xe,...Ze,handleCreateStackChat:M,handleListStackWorktrees:Qe,importClaudeSessions:$e,importClaudeSession:et,handleCopyPath:rt,handleOpenExternal:nt,handleOpenExternalPath:at,handleOpenLocalLink:it,handleCompose:ft,chatNavigator:l}}export{Qm as $,Yd as $t,fg as A,nm as At,Oh as B,zp as Bt,Ig as C,pe as Cn,Zp as Ct,_g as D,Jp as Dt,Cg as E,Qp as Et,qh as F,Hp as Ft,oh as G,Mp as Gt,Nh as H,Lp as Ht,zh as I,Wp as It,Pm as J,kp as Jt,ah as K,Np as Kt,Ih as L,Up as Lt,Vh as M,em as Mt,Bh as N,rm as Nt,Sg as O,$p as Ot,Xh as P,qp as Pt,Bm as Q,nf as Qt,Fh as R,Gp as Rt,zg as S,me as Sn,Mm as St,Dg as T,de as Tn,Yp as Tt,gh as U,Ip as Ut,kh as V,Rp as Vt,Eh as W,Ap as Wt,Gm as X,ef as Xt,zm as Y,Y as Yt,qm as Z,Xd as Zt,N_ as _,Ru as _n,lm as _t,Ov as a,qd as an,Nm as at,Jg as b,ua as bn,_m as bt,hv as c,U as cn,om as ct,uv as d,Zu as dn,im as dt,Zd as en,Fm as et,sv as f,Ju as fn,mm as ft,cv as g,Bu as gn,fm as gt,lv as h,Hu as hn,hm as ht,ey as i,Jd as in,Jm as it,Qh as j,tm as jt,pg as k,Kp as kt,mv as l,md as ln,sm as lt,fv as m,Wu as mn,Dm as mt,zv as n,Kd as nn,Wm as nt,xv as o,W as on,dm as ot,dv as p,Ku as pn,jm as pt,ih as q,Pp as qt,Xv as r,K as rn,Im as rt,Sv as s,ld as sn,am as st,Bv as t,G as tn,Vm as tt,iv as u,Xu as un,cm as ut,c_ as v,Kc as vn,um as vt,Og as w,fe as wn,Xp as wt,qg as x,Ci as xn,Am as xt,Zg as y,Gc as yn,vm as yt,Dh as z,Bp as zt};
1
+ import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{t}from"./react-DiVRNtpo.js";import{s as n}from"./chunk-OB3PAWPO-CCBUsQEH.js";import{t as r}from"./jsx-runtime-BdxMnOeJ.js";import{c as i,d as a,m as o,p as s,t as c}from"./log-7NXJbErN.js";import{a as l,f as u,n as d}from"./pendingActionsStore-DDpYeRNm.js";import{zt as f}from"./lexicalToReact-BVHTqlu5.js";import{l as p,n as m,r as h,s as g,u as _}from"./pushClient-COMO42mb.js";import{a as v,i as y,n as b,o as x,r as S,t as C,u as w}from"./timer.adapter-C5oNrWbM.js";import{t as ee}from"./input-BJRDZBOh.js";import{D as te,T,_ as ne,c as re,k as ie,l as E,u as ae,v as oe}from"./useTheme-9knhPtrR.js";import{t as se}from"./runDetached-mjGecpjX.js";import{c as ce,l as le}from"./contextWindow-Cpz1HmWo.js";import{a as ue}from"./formatters-BGORekd-.js";var D=e(r(),1),O=e(t(),1),de=(0,O.createContext)({});function fe(e){let t=(0,O.useRef)(null);return t.current===null&&(t.current=e()),t.current}var pe=typeof window<`u`?O.useLayoutEffect:O.useEffect,me=(0,O.createContext)(null);function he(e,t){e.indexOf(t)===-1&&e.push(t)}function k(e,t){let n=e.indexOf(t);n>-1&&e.splice(n,1)}var ge=(e,t,n)=>n>t?t:n<e?e:n,_e={},ve=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),ye=e=>typeof e==`object`&&!!e,be=e=>/^0[^.\s]+$/u.test(e);function xe(e){let t;return()=>(t===void 0&&(t=e()),t)}var A=e=>e,Se=(...e)=>e.reduce((e,t)=>n=>t(e(n))),Ce=(e,t,n)=>{let r=t-e;return r?(n-e)/r:1},we=class{constructor(){this.subscriptions=[]}add(e){return he(this.subscriptions,e),()=>this.remove(e)}remove(e){k(this.subscriptions,e)}notify(e,t,n){let r=this.subscriptions.length;if(r){if(r===1)this.subscriptions[0](e,t,n);else for(let i=0;i<r;i++){let r=this.subscriptions[i];r&&r(e,t,n)}}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}},Te=e=>e*1e3,Ee=e=>e/1e3,De=(e,t)=>t?1e3/t*e:0,Oe=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,ke=1e-7,Ae=12;function je(e,t,n,r,i){let a,o,s=0;do o=t+(n-t)/2,a=Oe(o,r,i)-e,a>0?n=o:t=o;while(Math.abs(a)>ke&&++s<Ae);return o}function Me(e,t,n,r){if(e===t&&n===r)return A;let i=t=>je(t,0,1,e,n);return e=>e===0||e===1?e:Oe(i(e),t,r)}var Ne=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,Pe=e=>t=>1-e(1-t),Fe=Me(.33,1.53,.69,.99),Ie=Pe(Fe),Le=Ne(Ie),Re=e=>e>=1?1:(e*=2)<1?.5*Ie(e):.5*(2-2**(-10*(e-1))),ze=e=>1-Math.sin(Math.acos(e)),Be=Pe(ze),Ve=Ne(ze),He=Me(.42,0,1,1),Ue=Me(0,0,.58,1),We=Me(.42,0,.58,1),Ge=e=>Array.isArray(e)&&typeof e[0]!=`number`,Ke=e=>Array.isArray(e)&&typeof e[0]==`number`,qe={linear:A,easeIn:He,easeInOut:We,easeOut:Ue,circIn:ze,circInOut:Ve,circOut:Be,backIn:Ie,backInOut:Le,backOut:Fe,anticipate:Re},Je=e=>typeof e==`string`,Ye=e=>{if(Ke(e)){e.length;let[t,n,r,i]=e;return Me(t,n,r,i)}return Je(e)?(qe[e],`${e}`,qe[e]):e},j={delta:0,timestamp:0,isProcessing:!1},Xe;function Ze(){Xe=void 0}var M={now:()=>(Xe===void 0&&M.set(j.isProcessing||_e.useManualTiming?j.timestamp:performance.now()),Xe),set:e=>{Xe=e,queueMicrotask(Ze)}},Qe=e=>Math.round(e*1e5)/1e5,$e=e=>t=>typeof t==`string`&&t.startsWith(e),et=$e(`--`),tt=$e(`var(--`),nt=e=>tt(e)?rt.test(e.split(`/*`)[0].trim()):!1,rt=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function it(e){return typeof e==`string`&&e.split(`/*`)[0].includes(`var(--`)}var at={test:e=>typeof e==`number`,parse:parseFloat,transform:e=>e},ot={...at,transform:e=>ge(0,1,e)},st={...at,default:1},ct=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function lt(e){return e==null}var ut=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,dt=(e,t)=>n=>!!(typeof n==`string`&&ut.test(n)&&n.startsWith(e)||t&&!lt(n)&&Object.prototype.hasOwnProperty.call(n,t)),ft=(e,t,n)=>r=>{if(typeof r!=`string`)return r;let[i,a,o,s]=r.match(ct);return{[e]:parseFloat(i),[t]:parseFloat(a),[n]:parseFloat(o),alpha:s===void 0?1:parseFloat(s)}},pt=e=>ge(0,255,e),mt={...at,transform:e=>Math.round(pt(e))},ht={test:dt(`rgb`,`red`),parse:ft(`red`,`green`,`blue`),transform:({red:e,green:t,blue:n,alpha:r=1})=>`rgba(`+mt.transform(e)+`, `+mt.transform(t)+`, `+mt.transform(n)+`, `+Qe(ot.transform(r))+`)`};function gt(e){let t=``,n=``,r=``,i=``;return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),i=e.substring(4,5),t+=t,n+=n,r+=r,i+=i),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:i?parseInt(i,16)/255:1}}var _t={test:dt(`#`),parse:gt,transform:ht.transform},vt=e=>({test:t=>typeof t==`string`&&t.endsWith(e)&&t.split(` `).length===1,parse:parseFloat,transform:t=>`${t}${e}`}),yt=vt(`deg`),bt=vt(`%`),N=vt(`px`),xt=vt(`vh`),St=vt(`vw`),Ct={...bt,parse:e=>bt.parse(e)/100,transform:e=>bt.transform(e*100)},wt={test:dt(`hsl`,`hue`),parse:ft(`hue`,`saturation`,`lightness`),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>`hsla(`+Math.round(e)+`, `+bt.transform(Qe(t))+`, `+bt.transform(Qe(n))+`, `+Qe(ot.transform(r))+`)`},P={test:e=>ht.test(e)||_t.test(e)||wt.test(e),parse:e=>ht.test(e)?ht.parse(e):wt.test(e)?wt.parse(e):_t.parse(e),transform:e=>typeof e==`string`?e:e.hasOwnProperty(`red`)?ht.transform(e):wt.transform(e),getAnimatableNone:e=>{let t=P.parse(e);return t.alpha=0,P.transform(t)}},Tt=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu,Et=new RegExp(ct.source),Dt=new RegExp(Tt.source,`i`);function Ot(e){return isNaN(e)&&typeof e==`string`&&(Et.test(e)||Dt.test(e))}var kt=`number`,At=`color`,jt=`var`,Mt=`var(`,Nt="${}",Pt=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Ft(e){let t=e.toString();return Et.test(t)||Dt.test(t)}function It(e){let t=e.toString(),n=[],r={color:[],number:[],var:[]},i=[],a=0;return{values:n,split:t.replace(Pt,e=>(P.test(e)?(r.color.push(a),i.push(At),n.push(P.parse(e))):e.startsWith(Mt)?(r.var.push(a),i.push(jt),n.push(e)):(r.number.push(a),i.push(kt),n.push(parseFloat(e))),++a,Nt)).split(Nt),indexes:r,types:i}}function Lt(e){return It(e).values}function Rt({split:e,types:t}){let n=e.length;return r=>{let i=``;for(let a=0;a<n;a++)if(i+=e[a],r[a]!==void 0){let e=t[a];i+=e===kt?Qe(r[a]):e===At?P.transform(r[a]):r[a]}return i}}function zt(e){return Rt(It(e))}var Bt=e=>typeof e==`number`?0:P.test(e)?P.getAnimatableNone(e):e,Vt=(e,t)=>typeof e==`number`?t?.trim().endsWith(`/`)?e:0:Bt(e);function Ht(e){let t=It(e);return Rt(t)(t.values.map((e,n)=>Vt(e,t.split[n])))}var Ut={test:Ot,parse:Lt,createTransformer:zt,getAnimatableNone:Ht};function Wt(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function Gt({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let i=0,a=0,o=0;if(!t)i=a=o=n;else{let r=n<.5?n*(1+t):n+t-n*t,s=2*n-r;i=Wt(s,r,e+1/3),a=Wt(s,r,e),o=Wt(s,r,e-1/3)}return{red:Math.round(i*255),green:Math.round(a*255),blue:Math.round(o*255),alpha:r}}function Kt(e,t){return n=>n>0?t:e}var F=(e,t,n)=>e+(t-e)*n,qt=(e,t,n)=>{let r=e*e,i=n*(t*t-r)+r;return i<0?0:Math.sqrt(i)},Jt=[_t,ht,wt],Yt=e=>Jt.find(t=>t.test(e));function Xt(e){let t=Yt(e);if(!t)return`${e}`,!1;let n=t.parse(e);return t===wt&&(n=Gt(n)),n}var Zt=(e,t)=>{let n=Xt(e),r=Xt(t);if(!n||!r)return Kt(e,t);let i={...n};return e=>(i.red=qt(n.red,r.red,e),i.green=qt(n.green,r.green,e),i.blue=qt(n.blue,r.blue,e),i.alpha=F(n.alpha,r.alpha,e),ht.transform(i))},Qt=new Set([`none`,`hidden`]);function $t(e,t){return Qt.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function en(e,t){return n=>F(e,t,n)}function tn(e){return typeof e==`number`?en:typeof e==`string`?nt(e)?Kt:P.test(e)?Zt:on:Array.isArray(e)?nn:typeof e==`object`?P.test(e)?Zt:rn:Kt}function nn(e,t){let n=[...e],r=n.length,i=e.map((e,n)=>tn(e)(e,t[n]));return e=>{for(let t=0;t<r;t++)n[t]=i[t](e);return n}}function rn(e,t){let n={...e,...t},r={};for(let i in n)e[i]!==void 0&&t[i]!==void 0&&(r[i]=tn(e[i])(e[i],t[i]));return e=>{for(let t in r)n[t]=r[t](e);return n}}function an(e,t){let n=[],r={color:0,var:0,number:0};for(let i=0;i<t.values.length;i++){let a=t.types[i],o=e.indexes[a][r[a]],s=e.values[o]??0;n[i]=s,r[a]++}return n}var on=(e,t)=>{let n=Ut.createTransformer(t),r=It(e),i=It(t);return r.indexes.var.length===i.indexes.var.length&&r.indexes.color.length===i.indexes.color.length&&r.indexes.number.length>=i.indexes.number.length?Qt.has(e)&&!i.values.length||Qt.has(t)&&!r.values.length?$t(e,t):Se(nn(an(r,i),i.values),n):(`${e}${t}`,Kt(e,t))},sn=/^(-?(?:\d+(?:\.\d*)?|\.\d+))([a-z%]*)$/iu;function cn(e,t){let n=sn.exec(e);if(!n)return;let r=sn.exec(t);if(!r||n[2]!==r[2])return;let i=n[2],a=parseFloat(n[1]),o=parseFloat(r[1]);return e=>Qe(F(a,o,e))+i}function ln(e,t,n){if(typeof e==`number`&&typeof t==`number`&&typeof n==`number`)return F(e,t,n);if(typeof e==`string`&&typeof t==`string`){let n=cn(e,t);if(n)return n}return tn(e)(e,t)}var un=[`setup`,`read`,`resolveKeyframes`,`preUpdate`,`update`,`preRender`,`render`,`postRender`];function dn(e){let t=new Set,n=new Set,r=!1,i=!1,a=new Set,o={delta:0,timestamp:0,isProcessing:!1};function s(t){a.has(t)&&(n.add(t),e()),t(o)}let c={schedule:(e,i=!1,o=!1)=>{let s=o&&r?t:n;return i&&a.add(e),s.add(e),e},cancel:e=>{n.delete(e),a.delete(e)},process:e=>{if(o=e,r){i=!0;return}r=!0;let a=t;t=n,n=a,t.forEach(s),t.clear(),r=!1,i&&(i=!1,c.process(e))}};return c}var fn=40;function pn(e,t,n={delta:0,timestamp:0,isProcessing:!1}){let r=!1,i=!0,a=()=>r=!0,o=un.reduce((e,t)=>(e[t]=dn(a),e),{}),{setup:s,read:c,resolveKeyframes:l,preUpdate:u,update:d,preRender:f,render:p,postRender:m}=o,h=()=>{let a=_e.useManualTiming,o=a?n.timestamp:performance.now();r=!1,a||(n.delta=i?1e3/60:Math.max(Math.min(o-n.timestamp,fn),1)),n.timestamp=o,n.isProcessing=!0,s.process(n),c.process(n),l.process(n),u.process(n),d.process(n),f.process(n),p.process(n),m.process(n),n.isProcessing=!1,r&&t&&(i=!1,e(h))},g=()=>{r=!0,i=!0,n.isProcessing||e(h)};return{schedule:un.reduce((e,t)=>{let n=o[t];return e[t]=(e,t=!1,i=!1)=>(r||g(),n.schedule(e,t,i)),e},{}),cancel:e=>{for(let t=0;t<un.length;t++)o[un[t]].cancel(e)},state:n,steps:o}}var{schedule:I,cancel:mn,steps:hn}=pn(typeof requestAnimationFrame<`u`?requestAnimationFrame:A,!0,j),gn=e=>{let t=({timestamp:t})=>e(t);return{start:(e=!0)=>I.update(t,e),stop:()=>mn(t),now:()=>j.isProcessing?j.timestamp:M.now()}},_n=(e,t,n=10)=>{let r=``,i=Math.max(Math.round(t/n),2);for(let t=0;t<i;t++)r+=Math.round(e(t/(i-1))*1e4)/1e4+`, `;return`linear(${r.substring(0,r.length-2)})`},vn=2e4;function yn(e,t=50,n=vn,r){let i=0,a=e.next(i);for(r?.push(a.value);!a.done&&i<n;)i+=t,a=e.next(i),r?.push(a.value);return i>=n?1/0:i}function bn(e,t=100,n){let r=n({...e,keyframes:[0,t]}),i=Math.min(yn(r),vn);return{type:`keyframes`,ease:e=>r.next(i*e).value/t,duration:Ee(i)}}var L={stiffness:100,damping:10,mass:1,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05},xn=e=>e<0?1/Math.max(1+e,L.minDamping):Math.max(1-e,L.minDamping);function Sn(e,t){if(!(e>1))return 1;let n=Math.sqrt(e*e-1),r=e-n,i=e+n,a=2*n*Math.exp(-t)*(1+t);return Tn(e=>i*Math.exp(-r*e)-r*Math.exp(-i*e)-a,e=>Math.exp(-i*e)-Math.exp(-r*e),t)/t}function Cn(e,t){return e*Math.sqrt(1-t*t)}var wn=12;function Tn(e,t,n){let r=n;for(let n=1;n<wn;n++)r-=e(r)/t(r);return r}var En=.001;function Dn({duration:e=L.duration,bounce:t=L.bounce}){let n,r;L.maxDuration;let i=xn(t);e=ge(L.minDuration,L.maxDuration,Ee(e)),i<1?(n=t=>{let n=t*i,r=n*e,a=Cn(t,i),o=Math.exp(-r);return En-n/a*o},r=t=>{let r=t*i*e,a=i*i*t*t*e,o=Math.exp(-r),s=Cn(t*t,i);return(-n(t)+En>0?-1:1)*-a*o/s}):(n=t=>-.001+Math.exp(-t*e)*(t*e+1),r=t=>Math.exp(-t*e)*(-t*(e*e)));let a=5/e,o=Tn(n,r,a),s=o*Sn(i,o*e),c=s*s;return{stiffness:c,damping:i*2*Math.sqrt(c),duration:Te(e)}}var On=(e,t)=>(t?e>=0:e>0)&&e<1/0;function kn(e,t){if(On(e,t))return e}function An(e){let t=kn(e.stiffness),n=kn(e.damping,!0),r=kn(e.mass),i={...e,stiffness:t??L.stiffness,damping:n??L.damping,mass:r??L.mass,isResolvedFromDuration:!1,isTimeDefined:(t??n??r)===void 0&&(e.duration!==void 0||e.bounce!==void 0)};if(i.isTimeDefined){if(e.visualDuration){let t=xn(e.bounce||0),n=2*Math.PI/(e.visualDuration*1.2)*Sn(t,2*Math.PI/1.2);i.stiffness=n*n,i.damping=2*t*Math.sqrt(i.stiffness)}else Object.assign(i,Dn(i)),i.isResolvedFromDuration=!0;(!On(i.stiffness)||!On(i.damping,!0))&&(i.stiffness=L.stiffness,i.damping=L.damping)}return i}function jn(e=L.visualDuration,t=L.bounce){let n=typeof e==`object`?e:{visualDuration:e,keyframes:[0,1],bounce:t},r=n.keyframes[0],i=n.keyframes[n.keyframes.length-1],a={done:!1,value:r},{stiffness:o,damping:s,mass:c,duration:l,isResolvedFromDuration:u,isTimeDefined:d}=An({...n}),f=e=>d?0:-Ee(e),p=s/(2*Math.sqrt(o*c)),m=Ee(Math.sqrt(o/c)),h=p*m,g={target:i,delta:i-r,velocity:f(n.velocity||0)||0,restSpeed:0,restDelta:0},_=()=>{let e=Math.abs(g.delta)<5;g.restSpeed=n.restSpeed||(e?L.restSpeed.granular:L.restSpeed.default),g.restDelta=n.restDelta||(e?L.restDelta.granular:L.restDelta.default)};_();let v,y,b;if(p<1){let e=Cn(m,p),t={A:0,sinC:0,cosC:0,t:-1,env:0,sin:0,cos:0};b=()=>{t.A=(g.velocity+h*g.delta)/e,t.sinC=h*t.A+g.delta*e,t.cosC=h*g.delta-t.A*e};let n=n=>{n!==t.t&&(t.t=n,t.env=Math.exp(-h*n),t.sin=Math.sin(e*n),t.cos=Math.cos(e*n))};v=e=>(n(e),g.target-t.env*(t.A*t.sin+g.delta*t.cos)),y=e=>(n(e),t.env*(t.sinC*t.sin+t.cosC*t.cos))}else if(p===1){v=e=>g.target-Math.exp(-m*e)*(g.delta+(g.velocity+m*g.delta)*e);let e={C:0};b=()=>{e.C=g.velocity+m*g.delta},y=t=>Math.exp(-m*t)*(m*e.C*t-g.velocity)}else{let e=m*Math.sqrt(p*p-1),t=h-e,n=h+e,r=d?1/0:300/e,i=(e,t)=>Math.exp(t>r?-e*r-h*(t-r):-e*t),a={S:0,F:0};b=()=>{let t=(g.velocity+h*g.delta)/e;a.S=(g.delta+t)/2,a.F=(g.delta-t)/2},v=e=>g.target-a.S*i(t,e)-a.F*i(n,e),y=e=>t*a.S*i(t,e)+n*a.F*i(n,e)}b();let x=u&&l||null,S={calculatedDuration:x,retarget:(e,t)=>{g.target=e[e.length-1],g.delta=g.target-e[0],g.velocity=f(t),n.restSpeed&&n.restDelta||_(),S.calculatedDuration=x,a.done=!1,b()},velocity:e=>Te(y(e)),next:e=>{let t=v(e);if(u)a.done=e>=l;else{let n=Te(y(e));a.done=Math.abs(n)<=g.restSpeed&&Math.abs(g.target-t)<=g.restDelta}return a.value=a.done?g.target:t,a},toString:()=>{let e=Math.min(yn(S),vn),t=_n(t=>S.next(e*t).value,e,30);return e+`ms `+t},toTransition:()=>{}};return S}jn.applyToOptions=e=>{let t=bn(e,100,jn);return e.ease=t.ease,e.duration=Te(t.duration),e.type=`keyframes`,e};function Mn({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:a=500,modifyTarget:o,min:s,max:c,restDelta:l=.5,restSpeed:u}){let d=e[0],f={done:!1,value:d},p=e=>e<s||e>c,m=e=>s===void 0?c:c===void 0||Math.abs(s-e)<Math.abs(c-e)?s:c,h=n*t,g=d+h,_=o===void 0?g:o(g);_!==g&&(h=_-d);let v=e=>-h*Math.exp(-e/r),y=e=>{let t=v(e);f.done=Math.abs(t)<=l,f.value=f.done?_:_+t},b,x,S=e=>{p(f.value)&&(b=e,x=jn({keyframes:[f.value,m(f.value)],velocity:-v(e)/r*1e3,damping:i,stiffness:a,restDelta:l,restSpeed:u}))};return S(0),{calculatedDuration:null,next:e=>{let t=!1;return!x&&b===void 0&&(t=!0,y(e),S(e)),b!==void 0&&e>=b?x.next(e-b):(!t&&y(e),f)}}}function Nn(e,t,n){let r=[],i=n||_e.mix||ln,a=e.length-1;for(let n=0;n<a;n++){let a=i(e[n],e[n+1]);t&&(a=Se(Array.isArray(t)?t[n]||A:t,a)),r.push(a)}return r}function Pn(e,t,{clamp:n=!0,ease:r,mixer:i}={}){let a=e.length;if(t.length,a===1)return()=>t[0];if(a===2&&t[0]===t[1])return()=>t[1];let o=e[0]===e[1];e[0]>e[a-1]&&(e=[...e].reverse(),t=[...t].reverse());let s=Nn(t,r,i),c=s.length,l=n=>{if(o&&n<e[0])return t[0];let r=0;if(c>1)for(;r<e.length-2&&!(n<e[r+1]);r++);let i=Ce(e[r],e[r+1],n);return s[r](i)};return n?t=>l(ge(e[0],e[a-1],t)):l}function Fn(e,t){let n=e[e.length-1];for(let r=1;r<=t;r++){let i=Ce(0,t,r);e.push(F(n,1,i))}}function In(e){let t=[0];return Fn(t,e.length-1),t}function Ln(e,t){return e.map(e=>e*t)}function Rn(e,t){return e.map(()=>t||We).splice(0,e.length-1)}function zn({duration:e=300,keyframes:t,times:n,ease:r=`easeInOut`}){let i=Ge(r)?r.map(Ye):Ye(r)||We,a={done:!1,value:t[0]};if(t.length===2&&!Array.isArray(i)&&(!n||n.length!==2||n[0]===0&&n[1]===1)){let[n,r]=t,o=n===r?void 0:(_e.mix||ln)(n,r);return{calculatedDuration:e,next:t=>(a.value=o?o(i(e>0?ge(0,1,t/e):1)):r,a.done=t>=e,a)}}let o=Pn(Ln(n&&n.length===t.length?n:In(t),e),t,{ease:Array.isArray(i)?i:Rn(t,i)});return{calculatedDuration:e,next:t=>(a.value=o(t),a.done=t>=e,a)}}var Bn=5;function Vn(e,t,n){let r=Math.max(t-Bn,0);return De(n-e(r),t-r)}function Hn(e,t,n=0){return t<=0?n:e.velocity?e.velocity(t):Vn(t=>e.next(t).value,t,e.next(t).value)}var Un=e=>e!==null;function Wn(e,{repeat:t,repeatType:n=`loop`},r,i=1){let a=e.filter(Un),o=i<0||t&&n!==`loop`&&t%2==1?0:a.length-1;return!o||r===void 0?a[o]:r}var Gn={decay:Mn,inertia:Mn,tween:zn,keyframes:zn,spring:jn};function Kn(e){typeof e.type==`string`&&(e.type=Gn[e.type])}function qn(e,t){return{kind:e,animation:t,timestamp:M.now(),frameTimestamp:j.timestamp,frameIsProcessing:j.isProcessing}}function Jn(e,t,n){let r=globalThis.__MOTION_INSPECT__;if(r)try{r({...qn(`animation-start`,e),options:n?{...t,...n}:t})}catch{}}function Yn(e,t){let n=globalThis.__MOTION_INSPECT__;if(n)try{n({...qn(`layout-animation-start`,e),node:t})}catch{}}var Xn=class{constructor(){this.isResolved=!1}get finished(){return this._finished||=this.isResolved?Promise.resolve():new Promise(e=>{this._resolve=e}),this._finished}updateFinished(){this._finished=this._resolve=void 0,this.isResolved=!1}notifyFinished(){this.isResolved=!0,this._resolve?.()}then(e,t){return this.finished.then(e,t)}},Zn=e=>e/100,Qn=class extends Xn{constructor(e){super(),this.state=`idle`,this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{let{motionValue:e}=this.options;e&&e.updatedAt!==M.now()&&this.tick(M.now()),this.isStopped=!0,this.state!==`idle`&&(this.teardown(),this.options.onStop?.())},this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause(),Jn(this,this.options)}initAnimation(){let{options:e}=this;Kn(e);let{type:t=zn,repeat:n=0,repeatDelay:r=0,repeatType:i,velocity:a=0}=e,{keyframes:o}=e,s=t||zn;s!==zn&&typeof o[0]!=`number`&&(this.mixKeyframes=Se(Zn,ln(o[0],o[1])),o=[0,100]);let c=s(o===e.keyframes?e:{...e,keyframes:o});i===`mirror`&&(this.mirroredGenerator=s({...e,keyframes:[...o].reverse(),velocity:-a})),c.calculatedDuration===null&&(c.calculatedDuration=yn(c));let{calculatedDuration:l}=c;this.calculatedDuration=l,this.resolvedDuration=l+r,this.totalDuration=this.resolvedDuration*(n+1)-r,this.generator=c}updateTime(e){let t=Math.round(e-this.startTime)*this.playbackSpeed;this.currentTime=this.holdTime===null?t:this.holdTime}tick(e,t=!1){let{generator:n,totalDuration:r,mixKeyframes:i,mirroredGenerator:a,resolvedDuration:o,calculatedDuration:s}=this;if(this.startTime===null)return n.next(0);let{delay:c=0,keyframes:l,repeat:u,repeatType:d,repeatDelay:f,type:p,onUpdate:m,finalKeyframe:h}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-r/this.speed,this.startTime)),t?this.currentTime=e:this.updateTime(e);let g=this.currentTime-c*(this.playbackSpeed>=0?1:-1),_=this.playbackSpeed>=0?g<0:g>r;this.currentTime=Math.max(g,0),this.state===`finished`&&this.holdTime===null&&(this.currentTime=r);let v=this.currentTime,y=n;if(u){let e=Math.min(this.currentTime,r)/o,t=Math.floor(e),n=e%1;!n&&e>=1&&(n=1),n===1&&t--,t=Math.min(t,u+1),t%2&&(d===`reverse`?(n=1-n,f&&(n-=f/o)):d===`mirror`&&(y=a)),v=ge(0,1,n)*o}let b;_?(this.delayState.value=l[0],b=this.delayState):b=y.next(v),i&&!_&&(b.value=i(b.value));let{done:x}=b;!_&&s!==null&&(x=this.playbackSpeed>=0?this.currentTime>=r:this.currentTime<=0);let S=this.holdTime===null&&(this.state===`finished`||this.state===`running`&&x);return S&&p!==Mn&&(b.value=Wn(l,this.options,h,this.speed)),m&&m(b.value),S&&this.finish(),b}then(e,t){return this.finished.then(e,t)}get duration(){return Ee(this.calculatedDuration)}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+Ee(e)}get time(){return Ee(this.currentTime)}set time(e){e=Te(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state=`paused`,this.holdTime=e,this.tick(e))}getGeneratorVelocity(){return Hn(this.generator,this.currentTime,this.options.velocity)}get speed(){return this.playbackSpeed}set speed(e){let t=this.playbackSpeed!==e;t&&this.driver&&this.updateTime(M.now()),this.playbackSpeed=e,t&&this.driver&&(this.time=Ee(this.currentTime))}play(){if(this.isStopped)return;let{driver:e=gn,startTime:t}=this.options;this.driver||=e(e=>this.tick(e)),this.options.onPlay?.();let n=this.driver.now();this.state===`finished`?(this.updateFinished(),this.startTime=n):this.holdTime===null?this.startTime||=t??n:this.startTime=n-this.holdTime,this.state===`finished`&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state=`running`,this.driver.start()}pause(){this.state=`paused`,this.updateTime(M.now()),this.holdTime=this.currentTime}complete(){this.state!==`running`&&this.play(),this.state=`finished`,this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state=`finished`,this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state=`idle`,this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&=(this.driver.stop(),void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){return this.options.allowFlatten&&(this.options.type=`keyframes`,this.options.ease=`linear`,this.initAnimation()),this.driver?.stop(),e.observe(this)}},$n=new Set([`brightness`,`contrast`,`saturate`,`opacity`]);function er(e){let[t,n]=e.slice(0,-1).split(`(`);if(t===`drop-shadow`)return e;let[r]=n.match(ct)||[];if(!r)return e;let i=n.replace(r,``),a=+!!$n.has(t);return r!==n&&(a*=100),t+`(`+a+i+`)`}var tr=/\b([a-z-]*)\(.*?\)/gu,nr={...Ut,getAnimatableNone:e=>{let t=e.match(tr);return t?t.map(er).join(` `):e}},rr={...Ut,getAnimatableNone:e=>{let t=Ut.parse(e);return Ut.createTransformer(e)(t.map(e=>typeof e==`number`?0:typeof e==`object`?{...e,alpha:1}:e))}},ir={...at,transform:Math.round},ar={borderWidth:N,borderTopWidth:N,borderRightWidth:N,borderBottomWidth:N,borderLeftWidth:N,borderRadius:N,borderTopLeftRadius:N,borderTopRightRadius:N,borderBottomRightRadius:N,borderBottomLeftRadius:N,width:N,maxWidth:N,height:N,maxHeight:N,top:N,right:N,bottom:N,left:N,inset:N,insetBlock:N,insetBlockStart:N,insetBlockEnd:N,insetInline:N,insetInlineStart:N,insetInlineEnd:N,padding:N,paddingTop:N,paddingRight:N,paddingBottom:N,paddingLeft:N,paddingBlock:N,paddingBlockStart:N,paddingBlockEnd:N,paddingInline:N,paddingInlineStart:N,paddingInlineEnd:N,margin:N,marginTop:N,marginRight:N,marginBottom:N,marginLeft:N,marginBlock:N,marginBlockStart:N,marginBlockEnd:N,marginInline:N,marginInlineStart:N,marginInlineEnd:N,fontSize:N,backgroundPositionX:N,backgroundPositionY:N,rotate:yt,pathRotation:yt,rotateX:yt,rotateY:yt,rotateZ:yt,scale:st,scaleX:st,scaleY:st,scaleZ:st,skew:yt,skewX:yt,skewY:yt,distance:N,translateX:N,translateY:N,translateZ:N,x:N,y:N,z:N,perspective:N,transformPerspective:N,opacity:ot,originX:Ct,originY:Ct,originZ:N,zIndex:ir,fillOpacity:ot,strokeOpacity:ot,numOctaves:ir},or={...ar,color:P,backgroundColor:P,outlineColor:P,fill:P,stroke:P,borderColor:P,borderTopColor:P,borderRightColor:P,borderBottomColor:P,borderLeftColor:P,filter:nr,WebkitFilter:nr,mask:rr,WebkitMask:rr},sr=e=>or[e],cr=new Set([nr,rr]);function lr(e,t){let n=sr(e);return cr.has(n)||(n=Ut),n.getAnimatableNone?n.getAnimatableNone(t):void 0}function ur(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}var dr=e=>e*180/Math.PI,fr=e=>mr(dr(Math.atan2(e[1],e[0]))),pr={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:fr,rotateZ:fr,skewX:e=>dr(Math.atan(e[1])),skewY:e=>dr(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},mr=e=>(e%=360,e<0&&(e+=360),e),hr=fr,gr=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),_r=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),vr={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:gr,scaleY:_r,scale:e=>(gr(e)+_r(e))/2,rotateX:e=>mr(dr(Math.atan2(e[6],e[5]))),rotateY:e=>mr(dr(Math.atan2(-e[2],e[0]))),rotateZ:hr,rotate:hr,skewX:e=>dr(Math.atan(e[4])),skewY:e=>dr(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function yr(e){return+!!e.includes(`scale`)}function br(e,t){if(!e||e===`none`)return yr(t);let n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u),r,i;if(n)r=vr,i=n;else{let t=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=pr,i=t}if(!i)return yr(t);let a=r[t],o=i[1].split(`,`).map(Sr);return typeof a==`function`?a(o):o[a]}var xr=(e,t)=>{let{transform:n=`none`}=getComputedStyle(e);return br(n,t)};function Sr(e){return parseFloat(e.trim())}var Cr=[`transformPerspective`,`x`,`y`,`z`,`translateX`,`translateY`,`translateZ`,`scale`,`scaleX`,`scaleY`,`rotate`,`rotateX`,`rotateY`,`rotateZ`,`skew`,`skewX`,`skewY`],wr=new Set([...Cr,`pathRotation`]),Tr=e=>e===at||e===N,Er=new Set([`x`,`y`,`z`]),Dr=Cr.filter(e=>!Er.has(e));function Or(e){let t=[];return Dr.forEach(n=>{let r=e.getValue(n);if(r!==void 0){let e=r.get(),i=+!!n.startsWith(`scale`);if(e===i)return;t.push([n,e]),r.set(i)}}),t}var kr=new Set([`bottom`,`right`]);function Ar(e,t,n,r,i,a){let o=parseFloat(e);if(!isNaN(o))return o;let{min:s,max:c}=t()[n],l=c-s;return a===`border-box`?l:l-parseFloat(r)-parseFloat(i)}var jr={width:({width:e,paddingLeft:t=`0`,paddingRight:n=`0`,boxSizing:r},i)=>Ar(e,i,`x`,t,n,r),height:({height:e,paddingTop:t=`0`,paddingBottom:n=`0`,boxSizing:r},i)=>Ar(e,i,`y`,t,n,r),top:({top:e})=>parseFloat(e),left:({left:e})=>parseFloat(e),bottom:({top:e},t)=>{let{y:n}=t();return parseFloat(e)+(n.max-n.min)},right:({left:e},t)=>{let{x:n}=t();return parseFloat(e)+(n.max-n.min)},x:({transform:e})=>br(e,`x`),y:({transform:e})=>br(e,`y`)};jr.translateX=jr.x,jr.translateY=jr.y;var Mr=new Set,Nr=!1,Pr=!1,Fr=!1;function Ir(){if(Pr){let e=[],t=new Set,n=new Set;Mr.forEach(r=>{r.needsMeasurement&&(e.push(r),t.add(r.element),kr.has(r.name)&&n.add(r.element))});let r=new Map;n.forEach(e=>{let t=Or(e);t.length&&(r.set(e,t),e.render())}),e.forEach(e=>e.measureInitialState()),t.forEach(e=>{e.render();let t=r.get(e);t&&t.forEach(([t,n])=>{e.getValue(t)?.set(n)})}),e.forEach(e=>e.measureEndState()),e.forEach(e=>{e.suspendedScrollY!==void 0&&window.scrollTo(0,e.suspendedScrollY)})}Pr=!1,Nr=!1,Mr.forEach(e=>e.complete(Fr)),Mr.clear()}function Lr(){Mr.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(Pr=!0)})}function Rr(){Fr=!0,Lr(),Ir(),Fr=!1}function zr(e,t,n){if(typeof e==`string`){if(ve(e)||be(e))return parseFloat(e);if(!Ut.test(e)&&Ut.test(n))return lr(t,n)}return e??void 0}var Br=class{constructor(e,t,n,r,i,a=!1){this.state=`pending`,this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=t,this.name=n,this.motionValue=r,this.element=i,this.isAsync=a}scheduleResolve(){this.state=`scheduled`,this.isAsync?(Mr.add(this),Nr||(Nr=!0,I.read(Lr),I.resolveKeyframes(Ir))):(this.readKeyframes(),this.complete())}readKeyframes(){let{unresolvedKeyframes:e,name:t,element:n,motionValue:r}=this;if(e[0]===null){let i=r?.get(),a=e[e.length-1];if(i!==void 0)e[0]=i;else if(n&&t){let r=zr(n.readValue(t,a),t,a);r!==void 0&&(e[0]=r)}e[0]===void 0&&(e[0]=a),r&&i===void 0&&r.set(e[0])}ur(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state=`complete`,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),Mr.delete(this)}cancel(){this.state===`scheduled`&&(Mr.delete(this),this.state=`pending`)}resume(){this.state===`pending`&&this.scheduleResolve()}},Vr=e=>e.startsWith(`--`);function Hr(e,t,n){Vr(t)?e.style.setProperty(t,n):e.style[t]=n}var Ur={};function Wr(e,t){let n=xe(e);return()=>Ur[t]??n()}var Gr=Wr(()=>window.ScrollTimeline!==void 0,`scrollTimeline`),Kr=Wr(()=>{try{document.createElement(`div`).animate({opacity:0},{easing:`linear(0, 1)`})}catch{return!1}return!0},`linearEasing`),qr=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,Jr={linear:`linear`,ease:`ease`,easeIn:`ease-in`,easeOut:`ease-out`,easeInOut:`ease-in-out`,circIn:qr([0,.65,.55,1]),circOut:qr([.55,0,1,.45]),backIn:qr([.31,.01,.66,-.59]),backOut:qr([.33,1.53,.69,.99])};function Yr(e,t){if(e)return typeof e==`function`?Kr()?_n(e,t):`ease-out`:Ke(e)?qr(e):Array.isArray(e)?e.map(e=>Yr(e,t)||Jr.easeOut):Jr[e]}function Xr(e,t,n,{delay:r=0,duration:i=300,repeat:a=0,repeatType:o=`loop`,ease:s=`easeOut`,times:c}={},l=void 0){let u={[t]:n};c&&(u.offset=c);let d=Yr(s,i);Array.isArray(d)&&(u.easing=d);let f={delay:r,duration:i,easing:Array.isArray(d)?`linear`:d,fill:`both`,iterations:a+1,direction:o===`reverse`?`alternate`:`normal`};return l&&(f.pseudoElement=l),e.animate(u,f)}function Zr(e){return typeof e==`function`&&`applyToOptions`in e}function Qr({type:e,...t}){return Zr(e)&&Kr()?e.applyToOptions(t):(t.duration??=300,t.ease??=`easeOut`,t)}var $r=class extends Xn{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;let{element:t,name:n,keyframes:r,pseudoElement:i,allowFlatten:a=!1,finalKeyframe:o,onComplete:s}=e;this.isPseudoElement=!!i,this.allowFlatten=a,this.options=e,e.type;let c=Qr(e);this.animation=Xr(t,n,r,c,i),c.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!i){let e=Wn(r,this.options,o,this.speed);this.updateMotionValue&&this.updateMotionValue(e),Hr(t,n,e),this.animation.cancel()}s?.(),this.notifyFinished()},Jn(this,e,c)}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state===`finished`&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;let{state:e}=this;e!==`idle`&&e!==`finished`&&(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){let e=this.options?.element;!this.isPseudoElement&&e?.isConnected&&this.animation.commitStyles?.()}get duration(){let e=this.animation.effect?.getComputedTiming?.().duration||0;return Ee(Number(e))}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+Ee(e)}get time(){return Ee(Number(this.animation.currentTime)||0)}set time(e){let t=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=Te(e),t&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime===null?this.animation.playState:`finished`}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,onAttach:t,observe:n}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:`linear`}),this.animation.onfinish=null,e&&Gr()?(this.animation.timeline=e,t?.(this.animation),A):n(this)}},ei={anticipate:Re,backInOut:Le,circInOut:Ve};function ti(e){return e in ei}function ni(e){typeof e.ease==`string`&&ti(e.ease)&&(e.ease=ei[e.ease])}var ri=10,ii=class extends $r{constructor(e){ni(e),Kn(e),super(e),e.startTime!==void 0&&e.autoplay!==!1&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){let{motionValue:t,onUpdate:n,onComplete:r,element:i,...a}=this.options;if(!t)return;if(e!==void 0){t.set(e);return}let o=new Qn({...a,autoplay:!1}),s=Math.max(ri,M.now()-this.startTime),c=ge(0,ri,s-ri),l=o.sample(s).value,{name:u}=this.options;i&&u&&Hr(i,u,l),t.setWithVelocity(o.sample(Math.max(0,s-c)).value,l,c),o.stop()}},ai=(e,t)=>t!==`zIndex`&&!!(typeof e==`number`||Array.isArray(e)||typeof e==`string`&&(Ut.test(e)||e===`0`)&&!e.startsWith(`url(`));function oi(e){let t=e[0];if(e.length===1)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t)return!0}function si(e,t,n,r){let i=e[0];if(i===null)return!1;if(t===`display`||t===`visibility`)return!0;let a=e[e.length-1],o=ai(i,t),s=ai(a,t);return!o||!s?(o!==s&&`${t}${i}${a}${o?a:i}`,!1):oi(e)||(n===`spring`||Zr(n))&&r}function ci(e){e.duration=0,e.type=`keyframes`}var li=new Set([`opacity`,`clipPath`,`filter`,`transform`,`backgroundColor`]),ui=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;function di(e){for(let t=0;t<e.length;t++)if(typeof e[t]==`string`&&ui.test(e[t]))return!0;return!1}var fi=new Set([`color`,`backgroundColor`,`outlineColor`,`fill`,`stroke`,`borderColor`,`borderTopColor`,`borderRightColor`,`borderBottomColor`,`borderLeftColor`]),pi=xe(()=>Object.hasOwnProperty.call(Element.prototype,`animate`));function mi(e){let{motionValue:t,name:n,repeatDelay:r,repeatType:i,damping:a,type:o,keyframes:s}=e;if(!n||!(li.has(n)||fi.has(n)))return!1;let c=t?.owner?.current;if(!(c instanceof HTMLElement)&&!(c instanceof SVGElement))return!1;let{onUpdate:l,transformTemplate:u}=t.owner.getProps();return pi()&&(li.has(n)||fi.has(n)&&di(s))&&(n!==`transform`||!u)&&!l&&!r&&i!==`mirror`&&a!==0&&o!==`inertia`}var hi=40,gi=class extends Xn{constructor(e){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=M.now();let{keyframes:t,name:n,motionValue:r,element:i}=e,a=e;a.autoplay??=!0,a.delay??=0,a.type??=`keyframes`,a.repeat??=0,a.repeatDelay??=0,a.repeatType??=`loop`;let o=i?.KeyframeResolver||Br;this.keyframeResolver=new o(t,(e,t,n)=>this.onKeyframesResolved(e,t,a,!n),n,r,i),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,t,n,r){this.keyframeResolver=void 0;let{name:i,type:a,velocity:o,delay:s,isHandoff:c,onUpdate:l}=n;this.resolvedAt=M.now();let u=!0;si(e,i,a,o)||(u=!1,(_e.instantAnimations||!s)&&l?.(Wn(e,n,t)),e[0]=e[e.length-1],ci(n),n.repeat=0);let d=r?this.resolvedAt&&this.resolvedAt-this.createdAt>hi?this.resolvedAt:this.createdAt:void 0,{onComplete:f}=n;n.startTime??=d,n.finalKeyframe=t,n.keyframes=e,n.onComplete=()=>{f?.(),this.notifyFinished()};let p=u&&!c&&mi(n),m;if(p){n.element=n.motionValue?.owner?.current;try{m=new ii(n)}catch{m=new Qn(n)}}else m=new Qn(n);this.pendingTimeline&&=(this.stopTimeline=m.attachTimeline(this.pendingTimeline),void 0),this._animation=m}get finished(){return this._animation?this._animation.finished:super.finished}then(e,t){return this.finished.finally(e).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),Rr()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}};function _i(e,t,n,r=0,i=1){let a=Array.from(e).sort((e,t)=>e.sortNodePosition(t)).indexOf(t),o=e.size,s=(o-1)*r;return typeof n==`function`?n(a,o):i===1?a*r:s-a*r}var vi=30,yi=e=>!isNaN(parseFloat(e)),bi={current:void 0},xi=class{constructor(e,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=e=>{let t=M.now();if(this.updatedAt!==t&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(e),this.current!==this.prev&&(this.notifyChange(),this.dependents))for(let e of this.dependents)e.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=t.owner}setCurrent(e){this.current=e,this.updatedAt=M.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=yi(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on(`change`,e)}on(e,t){var n;return e===`change`?this.onChangeSubscribe(t):((n=this.events)[e]||(n[e]=new we)).add(t)}onChangeSubscribe(e){let{events:t}=this;return!t.change&&!this.changeSubscriber?this.changeSubscriber=e:(t.change||(t.change=new we,t.change.add(this.changeSubscriber),this.changeSubscriber=void 0),t.change.add(e)),()=>{this.changeSubscriber===e?this.changeSubscriber=void 0:t.change?.remove(e),this.stopIfUnobserved()}}stopIfUnobserved(){I.read(()=>{!this.changeSubscriber&&!this.events.change?.getSize()&&this.stop()})}clearListeners(){this.changeSubscriber=void 0;for(let e in this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,t,n){this.set(t),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-n}jump(e,t=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,t&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.notifyChange()}notifyChange(){let{current:e,changeSubscriber:t}=this;t?t(e):this.events.change?.notify(e)}addDependent(e){this.dependents||=new Set,this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return bi.current&&bi.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){let e=M.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>vi)return 0;let t=Math.min(this.updatedAt-this.prevUpdatedAt,vi);return De(parseFloat(this.current)-parseFloat(this.prevFrameValue),t)}start(e){return this.stop(),new Promise(t=>{this.hasAnimated=!0;let n=!1,r;r=e(()=>{n=!0,this.events.animationComplete?.notify(),this.animation===r&&this.clearAnimation(),t()}),n||(this.animation=r),this.events.animationStart?.notify()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){this.animation=void 0}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}};function Si(e,t){return new xi(e,t)}function Ci(e,t){if(e?.inherit&&t){let{inherit:n,...r}=e;return{...t,...r}}return e}function wi(e,t){let n=e?.[t]??e?.default??e;return n===e?n:Ci(n,e)}var Ti={type:`spring`,stiffness:500,damping:25,restSpeed:10},Ei=e=>({type:`spring`,stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),Di={type:`keyframes`,duration:.8},Oi={type:`keyframes`,ease:[.25,.1,.35,1],duration:.3},ki=(e,{keyframes:t})=>t.length>2?Di:wr.has(e)?e.startsWith(`scale`)?Ei(t[1]):Ti:Oi,Ai=new Set([`when`,`delay`,`delayChildren`,`staggerChildren`,`staggerDirection`,`repeat`,`repeatType`,`repeatDelay`,`from`,`elapsed`]);function ji(e){for(let t in e)if(!Ai.has(t))return!0;return!1}var Mi=(e,t,n,r={},i,a)=>o=>{let s=wi(r,e)||{},c=s.delay||r.delay||0,{elapsed:l=0}=r;l-=Te(c);let u={keyframes:Array.isArray(n)?n:[null,n],ease:`easeOut`,velocity:t.getVelocity(),...s,delay:-l,onUpdate:e=>{t.set(e),s.onUpdate&&s.onUpdate(e)},onComplete:()=>{o(),s.onComplete&&s.onComplete()},name:e,motionValue:t,element:a?void 0:i};ji(s)||Object.assign(u,ki(e,u)),u.duration&&=Te(u.duration),u.repeatDelay&&=Te(u.repeatDelay),u.from!==void 0&&(u.keyframes[0]=u.from);let d=!1;if((u.type===!1||u.duration===0&&!u.repeatDelay)&&(ci(u),u.delay===0&&(d=!0)),(_e.instantAnimations||_e.skipAnimations||i?.shouldSkipAnimations||s.skipAnimations)&&(d=!0,ci(u),u.delay=0),u.allowFlatten=!s.type&&!s.ease,d&&!a&&t.get()!==void 0){let e=Wn(u.keyframes,s);if(e!==void 0){I.update(()=>{u.onUpdate(e),u.onComplete()});return}}return s.isSync?new Qn(u):new gi(u)},Ni=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function Pi(e){let t=Ni.exec(e);if(!t)return[,];let[,n,r,i]=t;return[`--${n??r}`,i]}function Fi(e,t,n=1){`${e}`;let[r,i]=Pi(e);if(!r)return;let a=window.getComputedStyle(t).getPropertyValue(r);if(a){let e=a.trim();return ve(e)?parseFloat(e):e}return nt(i)?Fi(i,t,n+1):i}function Ii(e){let t=[{},{}];return e?.values.forEach((e,n)=>{t[0][n]=e.get(),t[1][n]=e.getVelocity()}),t}function Li(e,t,n,r){let i=t=>typeof t==`function`?t(n===void 0?e.custom:n,...Ii(r)):t;return t=i(t),typeof t==`string`&&(t=e.variants&&e.variants[t]),i(t)}function Ri(e,t,n){return Li(e.getProps(),t,n,e)}var zi=(e,t)=>t===`exit`?e.presenceContext?.custom:void 0,Bi=new Set([`width`,`height`,`top`,`left`,`right`,`bottom`,...Cr]),Vi=e=>Array.isArray(e);function Hi(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,Si(n))}function Ui(e){return Vi(e)?e[e.length-1]||0:e}function Wi(e,t){let{transitionEnd:n={},transition:r={},...i}=Ri(e,t)||{};i={...i,...n};for(let t in i)Hi(e,t,Ui(i[t]))}var R=e=>!!(e&&e.getVelocity);function Gi(e){return!!(R(e)&&e.add)}function Ki(e,t){let n=e.getValue(`willChange`);if(Gi(n))return n.add(t);if(!n&&_e.WillChange){let n=new _e.WillChange(`auto`);e.addValue(`willChange`,n),n.add(t)}}function qi(e){return e.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}var Ji=`data-`+qi(`framerAppearId`);function Yi(e){return e.props[Ji]}var Xi=typeof window<`u`;function Zi({protectedKeys:e,needsAnimating:t},n){let r=n in e&&!t[n];return t[n]=!1,r}function Qi(e,t,{delay:n=0,transitionOverride:r,type:i}={}){let{transition:a,transitionEnd:o,...s}=t,c=e.getDefaultTransition();a=a?Ci(a,c):c;let l=a?.reduceMotion,u=a?.skipAnimations;r&&(a=r);let d=[],f=i&&e.animationState?.getState()[i],p=a?.path;p&&p.animateVisualElement(e,s,a,n,d);for(let t in s){let r=e.getValue(t,e.latestValues[t]??null),i=s[t];if(i===void 0||f&&Zi(f,t))continue;let o={delay:n,...wi(a||{},t)};u&&(o.skipAnimations=!0);let c=r.get();if(c!==void 0&&!r.isAnimating()&&!Array.isArray(i)&&i===c&&!o.velocity){I.update(()=>r.set(i));continue}let p=!1;if(Xi&&window.MotionHandoffAnimation){let n=Yi(e);if(n){let e=window.MotionHandoffAnimation(n,t,I);e!==null&&(o.startTime=e,p=!0)}}Ki(e,t);let m=l??e.shouldReduceMotion;r.start(Mi(t,r,i,m&&Bi.has(t)?{type:!1}:o,e,p));let h=r.animation;h&&d.push(h)}if(o){let t=()=>I.update(()=>{o&&Wi(e,o)});d.length?Promise.all(d).then(t):t()}return d}function $i(e,t,n={}){let r=Ri(e,t,zi(e,n.type)),i=n.transitionOverride||(r?.transition??(e.getDefaultTransition()||{})),a=()=>Promise.all(r?Qi(e,r,n):[]),o=(r=0)=>{let{variantChildren:a}=e,{delayChildren:o=0,staggerChildren:s,staggerDirection:c}=i,l=[];return a?.forEach(e=>{e.notify(`AnimationStart`,t),l.push($i(e,t,{...n,delay:r+(typeof o==`function`?0:o)+_i(a,e,o,s,c)}).then(()=>e.notify(`AnimationComplete`,t)))}),Promise.all(l)},{when:s}=i;return s?s===`beforeChildren`?a().then(()=>o()):o().then(a):Promise.all([a(),o(n.delay)])}function ea(e,t,n={}){return e.notify(`AnimationStart`,t),(Array.isArray(t)?Promise.all(t.map(t=>$i(e,t,n))):typeof t==`string`?$i(e,t,n):Promise.all(Qi(e,Ri(e,t,n.custom),n))).then(()=>{e.notify(`AnimationComplete`,t)})}var ta={test:e=>e===`auto`,parse:e=>e},na=e=>t=>t.test(e),ra=[at,N,bt,yt,St,xt,ta],ia=e=>ra.find(na(e));function aa(e){return typeof e==`number`?e===0:e===null||e===`none`||e===`0`||be(e)}var oa=new Set([`auto`,`none`,`0`]);function sa(e,t,n){let r=0,i;for(;r<e.length&&!i;){let t=e[r];typeof t==`string`&&!oa.has(t)&&Ft(t)&&(i=e[r]),r++}if(i&&n)for(let r of t)e[r]!==i&&(e[r]=lr(n,i))}var ca=class extends Br{constructor(e,t,n,r,i){super(e,t,n,r,i,!0)}readKeyframes(){let{unresolvedKeyframes:e,element:t,name:n}=this;if(!t||!t.current)return;super.readKeyframes();for(let n=0;n<e.length;n++){let r=e[n];if(typeof r==`string`&&(r=r.trim(),nt(r))){let i=Fi(r,t.current);i!==void 0&&(e[n]=i),n===e.length-1&&(this.finalKeyframe=r)}}if(this.resolveNoneKeyframes(),!Bi.has(n)||e.length!==2)return;let[r,i]=e;if(typeof r==`number`&&typeof i==`number`)return;let a=ia(r),o=ia(i);if(it(r)!==it(i)&&jr[n]){this.needsMeasurement=!0;return}if(a!==o){if(Tr(a)&&Tr(o))for(let t=0;t<e.length;t++){let n=e[t];typeof n==`string`&&(e[t]=parseFloat(n))}else jr[n]&&(this.needsMeasurement=!0)}}resolveNoneKeyframes(){let{unresolvedKeyframes:e,name:t}=this,n=[];for(let t=0;t<e.length;t++)(e[t]===null||aa(e[t]))&&n.push(t);n.length&&sa(e,n,t)}measure(){let{element:e,name:t}=this;return jr[t](window.getComputedStyle(e.current),()=>e.measureViewportBox())}measureInitialState(){let{element:e,unresolvedKeyframes:t,name:n}=this;if(!e||!e.current)return;n===`height`&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=this.measure(),t[0]=this.measuredOrigin;let r=t[t.length-1];r!==void 0&&this.motionValue?.jump(r,!1)}measureEndState(){let{element:e,unresolvedKeyframes:t}=this;if(!e||!e.current)return;this.motionValue?.jump(this.measuredOrigin,!1);let n=t.length-1,r=t[n];t[n]=this.measure(),r!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=r),this.removedTransforms?.length&&this.removedTransforms.forEach(([t,n])=>{e.getValue(t).set(n)}),this.resolveNoneKeyframes()}},la=[`borderTopLeftRadius`,`borderTopRightRadius`,`borderBottomRightRadius`,`borderBottomLeftRadius`];function ua(e){return ye(e)&&`offsetHeight`in e&&!(`ownerSVGElement`in e)}function da(e){return ye(e)&&`ownerSVGElement`in e}var fa=(e,t)=>t&&typeof e==`number`?t.transform(e):e;function pa(e,t,n){if(e==null)return[];if(e instanceof EventTarget)return[e];if(typeof e==`string`){let r=document;t&&(r=t.current);let i=n?.[e]??r.querySelectorAll(e);return i?Array.from(i):[]}return Array.from(e).filter(e=>e!=null)}var ma={x:`translateX`,y:`translateY`,z:`translateZ`,transformPerspective:`perspective`},ha=Cr.length;function ga(e,t,n){let r=``,i=!0;for(let a=0;a<ha;a++){let o=Cr[a],s=e[o];if(s===void 0)continue;let c=!0;if(typeof s==`number`)c=s===+!!o.startsWith(`scale`);else{let e=parseFloat(s);c=o.startsWith(`scale`)?e===1:e===0}if(!c||n){let e=fa(s,ar[o]);if(!c){i=!1;let t=ma[o]||o;r+=`${t}(${e}) `}n&&(t[o]=e)}}let a=e.pathRotation;return a&&(i=!1,r+=`rotate(${fa(a,ar.pathRotation)}) `),r=r.trim(),n?r=n(t,i?``:r):i&&(r=`none`),r}function _a(e,t,n){let{style:r,vars:i,transformOrigin:a}=e,o=!1,s=!1;for(let e in t){let n=t[e];if(wr.has(e)){o=!0;continue}if(et(e)){i[e]=n;continue}{let t=fa(n,ar[e]);e.startsWith(`origin`)?(s=!0,a[e]=t):r[e]=t}}if(t.transform||(o||n?r.transform=ga(t,e.transform,n):r.transform&&=`none`),s){let{originX:e=`50%`,originY:t=`50%`,originZ:n=0}=a;r.transformOrigin=`${e} ${t} ${n}`}}var va={offset:`stroke-dashoffset`,array:`stroke-dasharray`},ya={offset:`strokeDashoffset`,array:`strokeDasharray`};function ba(e,t,n=1,r=0,i=!0){e.pathLength=1;let a=i?va:ya;e[a.offset]=`${-r}`,e[a.array]=`${t} ${n}`}var xa=[`transform`,`opacity`,`offsetDistance`,`offsetPath`,`offsetRotate`,`offsetAnchor`];function Sa(e,{attrX:t,attrY:n,attrScale:r,pathLength:i,pathSpacing:a=1,pathOffset:o=0,...s},c,l,u){if(_a(e,s,l),c){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};let{attrs:d,style:f}=e;for(let e of xa)d[e]!==void 0&&(f[e]=d[e],delete d[e]);(f.transform||d.transformOrigin)&&(f.transformOrigin=d.transformOrigin??`50% 50%`,delete d.transformOrigin),f.transform&&(f.transformBox=u?.transformBox??`fill-box`,delete d.transformBox),t!==void 0&&(d.x=t),n!==void 0&&(d.y=n),r!==void 0&&(d.scale=r),i!==void 0&&ba(d,i,a,o,!1)}function Ca({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function wa({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function Ta(e,t){if(!t)return e;let n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function Ea(e){return e===void 0||e===1}function Da({scale:e,scaleX:t,scaleY:n}){return!Ea(e)||!Ea(t)||!Ea(n)}function Oa(e){return Da(e)||ka(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function ka(e){return Aa(e.x)||Aa(e.y)}function Aa(e){return e&&e!==`0%`}function ja(e,t,n){return n+t*(e-n)}function Ma(e,t,n,r,i){return i!==void 0&&(e=ja(e,i,r)),ja(e,n,r)+t}function Na(e,t=0,n=1,r,i){e.min=Ma(e.min,t,n,r,i),e.max=Ma(e.max,t,n,r,i)}function Pa(e,{x:t,y:n}){Na(e.x,t.translate,t.scale,t.originPoint),Na(e.y,n.translate,n.scale,n.originPoint)}var Fa=.999999999999,Ia=1.0000000000001;function La(e,t,n,r=!1){let i=n.length;if(!i)return;t.x=t.y=1;let a,o;for(let s=0;s<i;s++){a=n[s],o=a.projectionDelta;let{visualElement:i}=a.options;i&&i.props.style&&i.props.style.display===`contents`||(r&&a.options.layoutScroll&&a.scroll&&a!==a.root&&(Ra(e.x,-a.scroll.offset.x),Ra(e.y,-a.scroll.offset.y)),o&&(t.x*=o.x.scale,t.y*=o.y.scale,Pa(e,o)),r&&Oa(a.latestValues)&&Va(e,a.latestValues,a.layout?.layoutBox))}t.x<Ia&&t.x>Fa&&(t.x=1),t.y<Ia&&t.y>Fa&&(t.y=1)}function Ra(e,t){e.min+=t,e.max+=t}function za(e,t,n,r,i=.5){Na(e,t,n,F(e.min,e.max,i),r)}function Ba(e,t){return typeof e==`string`?parseFloat(e)/100*(t.max-t.min):e}function Va(e,t,n){let r=n??e;za(e.x,Ba(t.x,r.x),t.scaleX,t.scale,t.originX),za(e.y,Ba(t.y,r.y),t.scaleY,t.scale,t.originY)}function Ha(e,t){return Ca(Ta(e.getBoundingClientRect(),t))}function Ua(e,t,n){let r=Ha(e,n),{scroll:i}=t;return i&&(Ra(r.x,i.offset.x),Ra(r.y,i.offset.y)),r}var{schedule:Wa,cancel:Ga}=pn(queueMicrotask,!1),Ka={x:!1,y:!1};function qa(){return Ka.x||Ka.y}function Ja(e){return e===`x`||e===`y`?Ka[e]?null:(Ka[e]=!0,()=>{Ka[e]=!1}):Ka.x||Ka.y?null:(Ka.x=Ka.y=!0,()=>{Ka.x=Ka.y=!1})}function Ya(e,t){let n=pa(e),r=new AbortController;return[n,{passive:!0,...t,signal:r.signal},()=>r.abort()]}function Xa(e){return!(e.pointerType===`touch`||qa())}function Za(e,t,n={}){let[r,i,a]=Ya(e,n);return r.forEach(e=>{let n=!1,r=!1,a,o=()=>{e.removeEventListener(`pointerleave`,u)},s=e=>{a&&=(a(e),void 0),o()},c=e=>{n=!1,window.removeEventListener(`pointerup`,c),window.removeEventListener(`pointercancel`,c),r&&(r=!1,s(e))},l=()=>{n=!0,window.addEventListener(`pointerup`,c,i),window.addEventListener(`pointercancel`,c,i)},u=e=>{if(e.pointerType!==`touch`){if(n){r=!0;return}s(e)}};e.addEventListener(`pointerenter`,n=>{if(!Xa(n))return;r=!1;let o=t(e,n);typeof o==`function`&&(a=o,e.addEventListener(`pointerleave`,u,i))},i),e.addEventListener(`pointerdown`,l,i)}),a}var Qa=(e,t)=>t?e===t||Qa(e,t.parentElement):!1,$a=e=>e.pointerType===`mouse`?typeof e.button!=`number`||e.button<=0:e.isPrimary!==!1,eo=new Set([`BUTTON`,`INPUT`,`SELECT`,`TEXTAREA`,`A`]);function to(e){return eo.has(e.tagName)||e.isContentEditable===!0}var no=new Set([`INPUT`,`SELECT`,`TEXTAREA`]);function ro(e){return no.has(e.tagName)||e.isContentEditable===!0}var io=new WeakSet;function ao(e){return t=>{t.key===`Enter`&&e(t)}}function oo(e,t){e.dispatchEvent(new PointerEvent(`pointer`+t,{isPrimary:!0,bubbles:!0}))}var so=(e,t)=>{let n=e.currentTarget;if(!n)return;let r=ao(()=>{if(io.has(n))return;oo(n,`down`);let e=ao(()=>{oo(n,`up`)});n.addEventListener(`keyup`,e,t),n.addEventListener(`blur`,()=>oo(n,`cancel`),t)});n.addEventListener(`keydown`,r,t),n.addEventListener(`blur`,()=>n.removeEventListener(`keydown`,r),t)};function co(e){return $a(e)&&!qa()}var lo=new WeakSet;function uo(e,t,n={}){let[r,i,a]=Ya(e,n),o=e=>{let r=e.currentTarget;if(!co(e)||lo.has(e))return;io.add(r),n.stopPropagation&&lo.add(e);let a=t(r,e),o={...i,capture:!0},s=(e,t)=>{window.removeEventListener(`pointerup`,c,o),window.removeEventListener(`pointercancel`,l,o),io.has(r)&&io.delete(r),co(e)&&typeof a==`function`&&a(e,{success:t})},c=e=>{s(e,r===window||r===document||n.useGlobalTarget||Qa(r,e.target))},l=e=>{s(e,!1)};window.addEventListener(`pointerup`,c,o),window.addEventListener(`pointercancel`,l,o)};return r.forEach(e=>{(n.useGlobalTarget?window:e).addEventListener(`pointerdown`,o,i),ua(e)&&(e.addEventListener(`focus`,e=>so(e,i)),!to(e)&&!e.hasAttribute(`tabindex`)&&(e.tabIndex=0))}),a}var fo=new WeakMap,po,mo=(e,t,n)=>(r,i)=>i&&i[0]?i[0][e+`Size`]:da(r)&&`getBBox`in r?r.getBBox()[t]:r[n],ho=mo(`inline`,`width`,`offsetWidth`),go=mo(`block`,`height`,`offsetHeight`);function _o({target:e,borderBoxSize:t}){fo.get(e)?.forEach(n=>{n(e,{get width(){return ho(e,t)},get height(){return go(e,t)}})})}function vo(e){e.forEach(_o)}function yo(){typeof ResizeObserver<`u`&&(po=new ResizeObserver(vo))}function bo(e,t){po||yo();let n=pa(e);return n.forEach(e=>{let n=fo.get(e);n||(n=new Set,fo.set(e,n)),n.add(t),po?.observe(e)}),()=>{n.forEach(e=>{let n=fo.get(e);n?.delete(t),n?.size||po?.unobserve(e)})}}var xo=new Set,So;function Co(){So=()=>{let e={get width(){return window.innerWidth},get height(){return window.innerHeight}};xo.forEach(t=>t(e))},window.addEventListener(`resize`,So)}function wo(e){return xo.add(e),So||Co(),()=>{xo.delete(e),!xo.size&&typeof So==`function`&&(window.removeEventListener(`resize`,So),So=void 0)}}function To(e,t){return typeof e==`function`?wo(e):bo(e,t)}var Eo={value:null,addProjectionMetrics:null};function Do(e){return da(e)&&e.tagName===`svg`}var Oo=e=>typeof e==`number`?e:parseFloat(e),ko=()=>({translate:0,scale:1,origin:0,originPoint:0}),Ao=()=>({x:ko(),y:ko()}),jo=()=>({min:0,max:0}),z=()=>({x:jo(),y:jo()}),Mo=new WeakMap;function No(e){return typeof e==`object`&&!!e&&typeof e.start==`function`}function Po(e){return typeof e==`string`||Array.isArray(e)}var Fo=[`animate`,`whileInView`,`whileFocus`,`whileHover`,`whileTap`,`whileDrag`,`exit`],Io=[`initial`,...Fo];function Lo(e){if(No(e.animate))return!0;for(let t=0;t<Io.length;t++)if(Po(e[Io[t]]))return!0;return!1}function Ro(e){return!!(Lo(e)||e.variants)}function zo(e,t,n){for(let r in t){let i=t[r],a=n[r];if(R(i))e.addValue(r,i);else if(R(a))e.addValue(r,Si(i,{owner:e}));else if(a!==i){if(e.hasValue(r)){let t=e.getValue(r);t.liveStyle===!0?t.jump(i):t.hasAnimated||t.set(i)}else{let t=e.getStaticValue(r);e.addValue(r,Si(t===void 0?i:t,{owner:e}))}}}for(let r in n)t[r]===void 0&&e.removeValue(r);return t}var Bo={current:null},Vo={current:!1},Ho=typeof window<`u`;function Uo(){if(Vo.current=!0,Ho){if(window.matchMedia){let e=window.matchMedia(`(prefers-reduced-motion)`),t=()=>Bo.current=e.matches;e.addEventListener(`change`,t),t()}else Bo.current=!1}}var Wo=[`AnimationStart`,`AnimationComplete`,`Update`,`BeforeLayoutMeasure`,`LayoutMeasure`,`LayoutAnimationStart`,`LayoutAnimationComplete`],Go={};function Ko(e){Go=e}function qo(){return Go}var Jo=class{scrapeMotionValuesFromProps(e,t,n){return{}}constructor({parent:e,props:t,presenceContext:n,reducedMotionConfig:r,skipAnimations:i,blockInitialAnimation:a,visualState:o},s={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=Br,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify(`Update`,this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{let e=M.now();this.renderScheduledAt<e&&(this.renderScheduledAt=e,I.render(this.render,!1,!0))};let{latestValues:c,renderState:l}=o;this.latestValues=c,this.baseTarget={...c},this.initialValues=t.initial?{...c}:{},this.renderState=l,this.parent=e,this.props=t,this.presenceContext=n,this.depth=e?e.depth+1:0,this.reducedMotionConfig=r,this.skipAnimationsConfig=i,this.options=s,this.blockInitialAnimation=!!a,this.isControllingVariants=Lo(t),this.isVariantNode=Ro(t),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);let{willChange:u,...d}=this.scrapeMotionValuesFromProps(t,{},this);for(let e in d){let t=d[e];c[e]!==void 0&&R(t)&&t.set(c[e])}}mount(e){if(this.hasBeenMounted)for(let e in this.initialValues)this.values.get(e)?.jump(this.initialValues[e]),this.latestValues[e]=this.initialValues[e];if(this.current=e,Mo.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.isVariantNode&&!this.isControllingVariants){let e=this;do e=e.props.inherit!==!1&&e.parent;while(e&&!e.isVariantNode);if(e){let{variantChildren:t}=e;t.add(this),this.removeFromVariantTree=()=>t.delete(this)}}this.values.forEach((e,t)=>this.bindToMotionValue(t,e)),this.reducedMotionConfig===`never`?this.shouldReduceMotion=!1:this.reducedMotionConfig===`always`?this.shouldReduceMotion=!0:(Vo.current||Uo(),this.shouldReduceMotion=Bo.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,this.parent?.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){this.projection&&this.projection.unmount(),mn(this.notifyUpdate),mn(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(let e in this.events)this.events[e].clear();for(let e in this.features){let t=this.features[e];t&&(t.unmount(),t.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??=new Set,this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,t){if(this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)(),t.accelerate&&li.has(e)&&this.current instanceof HTMLElement){let{factory:n,keyframes:r,times:i,ease:a,duration:o}=t.accelerate,s=new $r({element:this.current,name:e,keyframes:r,times:i,ease:a,duration:Te(o)}),c=n(s);this.valueSubscriptions.set(e,()=>{c(),s.cancel()});return}let n=wr.has(e);n&&this.onBindTransform&&this.onBindTransform();let r=t.on(`change`,t=>{this.latestValues[e]=t,this.props.onUpdate&&I.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()}),i;typeof window<`u`&&window.MotionCheckAppearSync&&(i=window.MotionCheckAppearSync(this,e,t)),this.valueSubscriptions.set(e,()=>{r(),i&&i()})}sortNodePosition(e){return!this.current||!e.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e=`animation`;for(e in Go){let t=Go[e];if(!t)continue;let{isEnabled:n,Feature:r}=t;if(!this.features[e]&&r&&n(this.props)&&(this.features[e]=new r(this)),this.features[e]){let t=this.features[e];t.isMounted?t.update():(t.mount(),t.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):z()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,t){this.latestValues[e]=t}update(e,t){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=t;for(let t=0;t<Wo.length;t++){let n=Wo[t];this.propEventSubscriptions[n]&&(this.propEventSubscriptions[n](),delete this.propEventSubscriptions[n]);let r=e[`on`+n];r&&(this.propEventSubscriptions[n]=this.on(n,r))}this.prevMotionValues=zo(this,this.scrapeMotionValuesFromProps(e,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}addValue(e,t){let n=this.values.get(e);if(t!==n){n&&this.removeValue(e),this.bindToMotionValue(e,t),this.values.set(e,t);let r=t.get();r!==void 0&&(this.latestValues[e]=r)}}removeValue(e){this.values.delete(e);let t=this.valueSubscriptions.get(e);t&&(t(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,t){if(this.props.values&&this.props.values[e])return this.props.values[e];let n=this.values.get(e);return n===void 0&&t!==void 0&&(n=Si(t??this.getDefaultValue?.(e),{owner:this}),this.addValue(e,n)),n}readValue(e,t){let n=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return n!=null&&(typeof n==`string`&&(ve(n)||be(n))?n=parseFloat(n):typeof n!=`number`&&!Ut.test(n)&&Ut.test(t)&&(n=lr(e,t)),this.setBaseTarget(e,R(n)?n.get():n)),R(n)?n.get():n}setBaseTarget(e,t){this.baseTarget[e]=t}on(e,t){return this.events[e]||(this.events[e]=new we),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}scheduleRenderMicrotask(){Wa.render(this.render)}},Yo=class extends Jo{constructor(){super(...arguments),this.KeyframeResolver=ca}sortInstanceNodePosition(e,t){return e.compareDocumentPosition(t)&2?1:-1}getBaseTargetFromProps(e,t){let n=e.style;return n?n[t]:void 0}removeValueFromRenderState(e,{vars:t,style:n}){delete t[e],delete n[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);let{children:e}=this.props;R(e)&&(this.childSubscription=e.on(`change`,e=>{this.current&&(this.current.textContent=`${e}`)}))}},Xo=class{constructor(e){this.isMounted=!1,this.node=e}update(){}};function Zo(e,{style:t,vars:n},r,i){let a=e.style,o;for(o in t)a[o]=t[o];for(o in i?.applyProjectionStyles(a,r),n)a.setProperty(o,n[o])}var Qo={};function $o(e,{layout:t,layoutId:n}){return wr.has(e)||e.startsWith(`origin`)||(t||n!==void 0)&&(!!Qo[e]||e===`opacity`)}function es(e,t,n){let r=e.style,i=t?.style,a={};if(!r)return a;for(let t in r)(R(r[t])||i&&R(i[t])||$o(t,e)||n?.getValue(t)?.liveStyle!==void 0)&&(a[t]=r[t]);return a}function ts(e){return window.getComputedStyle(e)}var ns=class extends Yo{constructor(){super(...arguments),this.type=`html`,this.renderInstance=Zo}mount(e){e.style,super.mount(e)}readValueFromInstance(e,t){if(wr.has(t))return this.projection?.isProjecting?yr(t):xr(e,t);{let n=ts(e),r=(et(t)?n.getPropertyValue(t):n[t])||0;return typeof r==`string`?r.trim():r}}measureInstanceViewportBox(e,{transformPagePoint:t}){return Ha(e,t)}build(e,t,n){_a(e,t,n.transformTemplate)}scrapeMotionValuesFromProps(e,t,n){return es(e,t,n)}},rs=new Set([`baseFrequency`,`diffuseConstant`,`kernelMatrix`,`kernelUnitLength`,`keySplines`,`keyTimes`,`limitingConeAngle`,`markerHeight`,`markerWidth`,`numOctaves`,`targetX`,`targetY`,`surfaceScale`,`specularConstant`,`specularExponent`,`stdDeviation`,`tableValues`,`viewBox`,`gradientTransform`,`pathLength`,`startOffset`,`textLength`,`lengthAdjust`]),is=e=>typeof e==`string`&&e.toLowerCase()===`svg`;function as(e,t,n,r){Zo(e,t,void 0,r);for(let n in t.attrs)e.setAttribute(rs.has(n)?n:qi(n),t.attrs[n])}function os(e,t,n){let r=es(e,t,n);for(let n in e)if(R(e[n])||R(t[n])){let t=Cr.indexOf(n)===-1?n:`attr`+n.charAt(0).toUpperCase()+n.substring(1);r[t]=e[n]}return r}var ss=class extends Yo{constructor(){super(...arguments),this.type=`svg`,this.isSVGTag=!1,this.measureInstanceViewportBox=z}getBaseTargetFromProps(e,t){return wr.has(t)?super.getBaseTargetFromProps(e,t)??yr(t):e[t]}getDefaultValue(e){return wr.has(e)?this.latestValues[e]??yr(e):void 0}readValueFromInstance(e,t){if(wr.has(t)){let e=sr(t);return e&&e.default||0}if(xa.includes(t)){let n=getComputedStyle(e)[t];if(typeof n==`string`&&n)return n.trim()}return t=rs.has(t)?t:qi(t),e.getAttribute(t)}scrapeMotionValuesFromProps(e,t,n){return os(e,t,n)}build(e,t,n){Sa(e,t,this.isSVGTag,n.transformTemplate,n.style)}renderInstance(e,t,n,r){as(e,t,n,r)}mount(e){this.isSVGTag=is(e.tagName),super.mount(e)}};function cs(e,t){if(!Array.isArray(t))return!1;let n=t.length;if(n!==e.length)return!1;for(let r=0;r<n;r++)if(t[r]!==e[r])return!1;return!0}var ls=[...Fo].reverse();function us(e){let t=t=>Promise.all(t.map(({animation:t,options:n})=>ea(e,t,n))),n=fs(),r=!0,i=!1;function a(a){let{props:o,parent:s,manuallyAnimateOnMount:c}=e,l=r||i,u=[],d=new Set,f={},p=1/0,m=e;do m=m.props.inherit!==!1&&m.parent;while(m&&!m.isControllingVariants);if(ls.forEach((t,r)=>{let i=n[t],h=o[t],g=m&&m.props[t],_=h===void 0?Po(g)||g===!1?g:void 0:h,v=Po(_),y=t===a?i.isActive:null;y===!1&&(p=r);let b=v&&h===void 0&&!(l&&c);if(i.protectedKeys={...f},!i.isActive&&y===null||!_&&!i.prevProp||No(_)||typeof _==`boolean`)return;if(t===`exit`&&i.isActive&&y!==!0){f={...f,...i.prevResolvedValues};return}let x=ds(i.prevProp,_),S=x||v&&(y&&!b||r>p),C=!1,w=Array.isArray(_)?_:[_],ee={};if(y!==!1)for(let n of w){let{transition:r,transitionEnd:i,...a}=Ri(e,n,zi(e,t))||{};ee={...ee,...a,...i}}let{prevResolvedValues:te}=i;for(let t in{...te,...ee}){if(t in f)continue;let n=ee[t],r=te[t],a=Array.isArray(n)&&Array.isArray(r)?!cs(n,r)||x:n!==r;if(a&&n==null)d.add(t);else if(a||n!==void 0&&d.has(t)){S=!0,d.delete(t)&&(C=!0),i.needsAnimating[t]=!0;let n=e.getValue(t);n&&(n.liveStyle=!1)}else i.protectedKeys[t]=!0}if(i.prevProp=_,i.prevResolvedValues=ee,i.isActive&&(f={...f,...ee}),S&&(!(b&&x)||C))for(let n of w){let r={type:t};if(typeof n==`string`&&l&&c&&s?.enteringChildren){let t=Ri(s,n)?.transition?.delayChildren;r.delay=_i(s.enteringChildren,e,t)}u.push({animation:n,options:r})}}),d.size){let{initial:t}=o,n={},r=typeof t!=`boolean`&&Ri(e,Array.isArray(t)?t[0]:t,e.presenceContext?.custom);r&&r.transition&&(n.transition=r.transition),d.forEach(i=>{let a=e.getValue(i);a&&(a.liveStyle=!0);let s=r&&!Array.isArray(t)?r[i]:void 0,c=e.getBaseTargetFromProps(o,i);n[i]=(s===void 0?c!==void 0&&!R(c)?c:e.initialValues[i]===void 0?e.baseTarget[i]:void 0:s)??null}),u.push({animation:n})}let h=l&&e.blockInitialAnimation||r&&!c&&(o.initial===!1||o.initial===o.animate);return r=i=!1,!h&&u.length?t(u):Promise.resolve()}function o(t,r){if(n[t].isActive===r)return Promise.resolve();e.variantChildren?.forEach(e=>e.animationState?.setActive(t,r)),n[t].isActive=r;let i=a(t);for(let e in n)n[e].protectedKeys={};return i}return{animateChanges:a,setActive:o,setAnimateFunction:n=>{t=n(e)},getState:()=>n,reset:()=>{n=fs(),i=!0}}}function ds(e,t){return typeof t==`string`?t!==e:Array.isArray(t)?!cs(t,e):!1}function fs(){let e={};for(let t of Fo)e[t]={isActive:t===`animate`,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}};return e}function ps(e,t){e.min=t.min,e.max=t.max}function ms(e,t){ps(e.x,t.x),ps(e.y,t.y)}function hs(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}var gs=.9999,_s=1.0001,vs=-.01,ys=.01;function B(e){return e.max-e.min}function bs(e,t,n){return Math.abs(e-t)<=n}function xs(e,t,n,r=.5){e.origin=r,e.originPoint=F(t.min,t.max,e.origin),e.scale=B(n)/B(t),e.translate=F(n.min,n.max,e.origin)-e.originPoint,(e.scale>=gs&&e.scale<=_s||isNaN(e.scale))&&(e.scale=1),(e.translate>=vs&&e.translate<=ys||isNaN(e.translate))&&(e.translate=0)}function Ss(e,t,n,r){xs(e.x,t.x,n.x,r?r.originX:void 0),xs(e.y,t.y,n.y,r?r.originY:void 0)}function Cs(e,t,n,r=0){e.min=(r?F(n.min,n.max,r):n.min)+t.min,e.max=e.min+B(t)}function ws(e,t,n,r){Cs(e.x,t.x,n.x,r?.x),Cs(e.y,t.y,n.y,r?.y)}function Ts(e,t,n,r=0){let i=r?F(n.min,n.max,r):n.min;e.min=t.min-i,e.max=e.min+B(t)}function Es(e,t,n,r){Ts(e.x,t.x,n.x,r?.x),Ts(e.y,t.y,n.y,r?.y)}function Ds(e,t,n,r,i){return e-=t,e=ja(e,1/n,r),i!==void 0&&(e=ja(e,1/i,r)),e}function Os(e,t=0,n=1,r=.5,i,a=e,o=e){if(bt.test(t)&&(t=parseFloat(t),t=F(o.min,o.max,t/100)-o.min),typeof t!=`number`)return;let s=F(a.min,a.max,r);e===a&&(s-=t),e.min=Ds(e.min,t,n,s,i),e.max=Ds(e.max,t,n,s,i)}function ks(e,t,[n,r,i],a,o){Os(e,t[n],t[r],t[i],t.scale,a,o)}var As=[`x`,`scaleX`,`originX`],js=[`y`,`scaleY`,`originY`];function Ms(e,t,n,r){ks(e.x,t,As,n?n.x:void 0,r?r.x:void 0),ks(e.y,t,js,n?n.y:void 0,r?r.y:void 0)}function Ns(e){return e.translate===0&&e.scale===1}function Ps(e){return Ns(e.x)&&Ns(e.y)}function Fs(e,t){return e.min===t.min&&e.max===t.max}function Is(e,t){return Fs(e.x,t.x)&&Fs(e.y,t.y)}function Ls(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function Rs(e,t){return Ls(e.x,t.x)&&Ls(e.y,t.y)}function zs(e){return B(e.x)/B(e.y)}function Bs(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function Vs(e){return[e(`x`),e(`y`)]}function Hs(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}var Us={correct:(e,t)=>{if(!t.target)return e;if(typeof e==`string`){if(N.test(e))e=parseFloat(e);else return e}return`${Hs(e,t.target.x)}% ${Hs(e,t.target.y)}%`}},Ws={correct:(e,{treeScale:t,projectionDelta:n})=>{let r=e,i=Ut.parse(e);if(i.length>5)return r;let a=Ut.createTransformer(e),o=typeof i[0]==`number`?0:1,s=n.x.scale*t.x,c=n.y.scale*t.y;i[0+o]/=s,i[1+o]/=c;let l=F(s,c,.5);return typeof i[2+o]==`number`&&(i[2+o]/=l),typeof i[3+o]==`number`&&(i[3+o]/=l),a(i)}};function Gs(e,t,n){let r=``,i=e.x.translate/t.x,a=e.y.translate/t.y,o=n?.z||0;if((i||a||o)&&(r=`translate3d(${i}px, ${a}px, ${o}px) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){let{transformPerspective:e,rotate:t,pathRotation:i,rotateX:a,rotateY:o,skewX:s,skewY:c}=n;e&&(r=`perspective(${e}px) ${r}`),t&&(r+=`rotate(${t}deg) `),i&&(r+=`rotate(${i}deg) `),a&&(r+=`rotateX(${a}deg) `),o&&(r+=`rotateY(${o}deg) `),s&&(r+=`skewX(${s}deg) `),c&&(r+=`skewY(${c}deg) `)}let s=e.x.scale*t.x,c=e.y.scale*t.y;return(s!==1||c!==1)&&(r+=`scale(${s}, ${c})`),r||`none`}var Ks=la.length,qs=e=>typeof e==`number`||N.test(e);function Js(e,t,n,r,i,a){i?(e.opacity=F(0,n.opacity??1,Xs(r)),e.opacityExit=F(t.opacity??1,0,Zs(r))):a&&(e.opacity=F(t.opacity??1,n.opacity??1,r));for(let i=0;i<Ks;i++){let a=la[i],o=Ys(t,a),s=Ys(n,a);(o!==void 0||s!==void 0)&&(o||=0,s||=0,o===0||s===0||qs(o)===qs(s)?(e[a]=Math.max(F(Oo(o),Oo(s),r),0),(bt.test(s)||bt.test(o))&&(e[a]+=`%`)):e[a]=s)}(t.rotate||n.rotate)&&(e.rotate=F(t.rotate||0,n.rotate||0,r))}function Ys(e,t){return e[t]===void 0?e.borderRadius:e[t]}var Xs=Qs(0,.5,Be),Zs=Qs(.5,.95,A);function Qs(e,t,n){return r=>r<e?0:r>t?1:n(Ce(e,t,r))}function $s(e,t,n){let r=R(e)?e:Si(e);return r.start(Mi(``,r,t,n)),r.animation}function ec(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)}var tc=(e,t)=>e.depth-t.depth,nc=class{constructor(){this.children=[],this.isDirty=!1}add(e){he(this.children,e),this.isDirty=!0}remove(e){k(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(tc),this.isDirty=!1,this.children.forEach(e)}};function rc(e,t){let n=M.now(),r=({timestamp:i})=>{let a=i-n;a>=t&&(mn(r),e(a-t))};return I.setup(r,!0),()=>mn(r)}function ic(e){return R(e)?e.get():e}var ac=class{constructor(){this.members=[]}add(e){he(this.members,e);for(let t=this.members.length-1;t>=0;t--){let n=this.members[t];if(n===e||n===this.lead||n===this.prevLead)continue;let r=n.instance;(!r||r.isConnected===!1)&&!n.snapshot&&(k(this.members,n),n.unmount())}e.scheduleRender()}remove(e){if(k(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){let e=this.members[this.members.length-1];e&&this.promote(e)}}relegate(e){for(let t=this.members.indexOf(e)-1;t>=0;t--){let e=this.members[t];if(e.isPresent!==!1&&e.instance?.isConnected!==!1)return this.promote(e),!0}return!1}promote(e,t){let n=this.lead;if(e!==n&&(this.prevLead=n,this.lead=e,e.show(),n)){n.updateSnapshot(),e.scheduleRender();let{layoutDependency:r}=n.options,{layoutDependency:i}=e.options;(r===void 0||r!==i)&&(e.resumeFrom=n,t&&(n.preserveOpacity=!0),n.snapshot&&(e.snapshot=n.snapshot,e.snapshot.latestValues=n.animationValues||n.latestValues),e.root?.isUpdating&&(e.isLayoutDirty=!0)),e.options.crossfade===!1&&n.hide()}}exitAnimationComplete(){this.members.forEach(e=>{e.options.onExitComplete?.(),e.resumingFrom?.options.onExitComplete?.()})}scheduleRender(){this.members.forEach(e=>e.instance&&e.scheduleRender(!1))}removeLeadSnapshot(){this.lead?.snapshot&&(this.lead.snapshot=void 0)}},oc={borderRadius:{...Us,applyTo:[...la]},borderTopLeftRadius:Us,borderTopRightRadius:Us,borderBottomLeftRadius:Us,borderBottomRightRadius:Us,boxShadow:Ws},sc={hasAnimatedSinceResize:!0,hasEverUpdated:!1};Object.assign(Qo,{...oc,...Qo});var cc={nodes:0,calculatedTargetDeltas:0,calculatedProjections:0},lc=[``,`X`,`Y`,`Z`],uc=1e3,dc=0;function fc(e,t,n,r){let{latestValues:i}=t;i[e]&&(n[e]=i[e],t.setStaticValue(e,0),r&&(r[e]=0))}function pc(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;let{visualElement:t}=e.options;if(!t)return;let n=Yi(t);if(window.MotionHasOptimisedAnimation(n,`transform`)){let{layout:t,layoutId:r}=e.options;window.MotionCancelOptimisedAnimation(n,`transform`,I,!(t||r))}let{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&pc(r)}function mc({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return class{constructor(e={},n=t?.()){this.id=dc++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,Eo.value&&(cc.nodes=cc.calculatedTargetDeltas=cc.calculatedProjections=0),this.nodes.forEach(_c),this.nodes.forEach(Dc),this.nodes.forEach(Oc),this.nodes.forEach(vc),Eo.addProjectionMetrics&&Eo.addProjectionMetrics(cc)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=e,this.root=n?n.root||n:this,this.path=n?[...n.path,n]:[],this.parent=n,this.depth=n?n.depth+1:0;for(let e=0;e<this.path.length;e++)this.path[e].shouldResetTransform=!0;this.root===this&&(this.nodes=new nc)}addEventListener(e,t){return this.eventHandlers.has(e)||this.eventHandlers.set(e,new we),this.eventHandlers.get(e).add(t)}notifyListeners(e,...t){let n=this.eventHandlers.get(e);n&&n.notify(...t)}hasListeners(e){return this.eventHandlers.has(e)}mount(t){if(this.instance)return;this.isSVG=da(t)&&!Do(t),this.instance=t;let{layoutId:n,layout:r,visualElement:i}=this.options;if(i&&!i.current&&i.mount(t),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(r||n)&&(this.isLayoutDirty=!0),e){let n,r=0,i=()=>this.root.updateBlockedByResize=!1;I.read(()=>{r=window.innerWidth}),e(t,()=>{let e=window.innerWidth;e!==r&&(r=e,this.root.updateBlockedByResize=!0,n&&n(),n=rc(i,250),sc.hasAnimatedSinceResize&&(sc.hasAnimatedSinceResize=!1,this.nodes.forEach(Ec)))})}n&&this.root.registerSharedNode(n,this),this.options.animate!==!1&&i&&(n||r)&&this.addEventListener(`didUpdate`,({delta:e,hasLayoutChanged:t,hasRelativeLayoutChanged:n,layout:r})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}let a=this.options.transition||i.getDefaultTransition()||Fc,{onLayoutAnimationStart:o,onLayoutAnimationComplete:s}=i.getProps(),c=!this.targetLayout||!Rs(this.targetLayout,r),l=!t&&n;if(this.options.layoutRoot||this.resumeFrom||l||t&&(c||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);let t={...wi(a,`layout`),onPlay:o,onComplete:s};(i.shouldReduceMotion||this.options.layoutRoot)&&(t.delay=0,t.type=!1),this.startAnimation(t),this.setAnimationOrigin(e,l,t.path)}else t||Ec(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=r})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);let e=this.getStack();e&&e.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),mn(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(kc),this.animationId++)}getTransformTemplate(){let{visualElement:e}=this.options;return e&&e.getProps().transformTemplate}willUpdate(e=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&pc(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let e=0;e<this.path.length;e++){let t=this.path[e];t.shouldResetTransform=!0,(typeof t.latestValues.x==`string`||typeof t.latestValues.y==`string`)&&(t.isLayoutDirty=!0),t.updateScroll(`snapshot`),t.options.layoutRoot&&t.willUpdate(!1)}let{layoutId:t,layout:n}=this.options;if(t===void 0&&!n)return;let r=this.getTransformTemplate();this.prevTransformTemplateValue=r?r(this.latestValues,``):void 0,this.updateSnapshot(),e&&this.notifyListeners(`willUpdate`)}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){let e=this.updateBlockedByResize;this.unblockUpdate(),this.updateBlockedByResize=!1,this.clearAllSnapshots(),e&&this.nodes.forEach(xc),this.nodes.forEach(bc);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(Sc);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(Cc),this.nodes.forEach(wc),this.nodes.forEach(Tc),this.nodes.forEach(hc),this.nodes.forEach(gc)):this.nodes.forEach(Sc),this.clearAllSnapshots();let e=M.now();j.delta=ge(0,1e3/60,e-j.timestamp),j.timestamp=e,j.isProcessing=!0,hn.update.process(j),hn.preRender.process(j),hn.render.process(j),j.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,Wa.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(yc),this.sharedNodes.forEach(Ac)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,I.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){I.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){!this.snapshot&&this.instance&&(this.snapshot=this.measure(),this.snapshot&&!B(this.snapshot.measuredBox.x)&&!B(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let e=0;e<this.path.length;e++)this.path[e].updateScroll();let e=this.layout;this.layout=this.measure(!1),this.layoutCorrected||=z(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners(`measure`,this.layout.layoutBox);let{visualElement:t}=this.options;t&&t.notify(`LayoutMeasure`,this.layout.layoutBox,e?e.layoutBox:void 0)}updateScroll(e=`measure`){let t=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===e&&(t=!1),t&&this.instance){let t=r(this.instance);this.scroll={animationId:this.root.animationId,phase:e,isRoot:t,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:t}}}resetTransform(){if(!i)return;let e=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,t=this.projectionDelta&&!Ps(this.projectionDelta),n=this.getTransformTemplate(),r=n?n(this.latestValues,``):void 0,a=r!==this.prevTransformTemplateValue;e&&this.instance&&(t||Oa(this.latestValues)||a)&&(i(this.instance,r),this.shouldResetTransform=!1,this.scheduleRender())}measure(e=!0){let t=this.measurePageBox(),n=this.removeElementScroll(t);return e&&(n=this.removeTransform(n)),zc(n),{animationId:this.root.animationId,measuredBox:t,layoutBox:n,latestValues:{},source:this.id}}measurePageBox(){let{visualElement:e}=this.options;if(!e)return z();let t=e.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(Vc))){let{scroll:e}=this.root;e&&(Ra(t.x,e.offset.x),Ra(t.y,e.offset.y))}return t}removeElementScroll(e){let t=z();if(ms(t,e),this.scroll?.wasRoot)return t;for(let n=0;n<this.path.length;n++){let r=this.path[n],{scroll:i,options:a}=r;r!==this.root&&i&&a.layoutScroll&&(i.wasRoot&&ms(t,e),Ra(t.x,i.offset.x),Ra(t.y,i.offset.y))}return t}applyTransform(e,t=!1,n){let r=n||z();ms(r,e);for(let e=0;e<this.path.length;e++){let n=this.path[e];!t&&n.options.layoutScroll&&n.scroll&&n!==n.root&&(Ra(r.x,-n.scroll.offset.x),Ra(r.y,-n.scroll.offset.y)),Oa(n.latestValues)&&Va(r,n.latestValues,n.layout?.layoutBox)}return Oa(this.latestValues)&&Va(r,this.latestValues,this.layout?.layoutBox),r}removeTransform(e){let t=z();ms(t,e);for(let e=0;e<this.path.length;e++){let n=this.path[e];if(!Oa(n.latestValues))continue;let r;n.instance&&(Da(n.latestValues)&&n.updateSnapshot(),r=z(),ms(r,n.measurePageBox())),Ms(t,n.latestValues,n.snapshot?.layoutBox,r)}return Oa(this.latestValues)&&Ms(t,this.latestValues),t}setTargetDelta(e){this.targetDelta=e,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(e){this.options={...this.options,...e,crossfade:e.crossfade===void 0||e.crossfade}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==j.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(e=!1){let t=this.getLead();this.isProjectionDirty||=t.isProjectionDirty,this.isTransformDirty||=t.isTransformDirty,this.isSharedProjectionDirty||=t.isSharedProjectionDirty;let n=!!this.resumingFrom||this!==t;if(!(e||n&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;let{layout:r,layoutId:i}=this.options;if(!this.layout||!(r||i))return;this.resolvedRelativeTargetAt=j.timestamp;let a=this.getClosestProjectingParent();!this.targetDelta&&!this.relativeTarget&&(this.options.layoutAnchor!==!1&&a&&a.layout?this.createRelativeTarget(a,this.layout.layoutBox,a.layout.layoutBox):this.removeRelativeTarget()),(this.relativeTarget||this.targetDelta)&&(this.target||(this.target=z(),this.targetWithTransforms=z()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),ws(this.target,this.relativeTarget,this.relativeParent.target,this.options.layoutAnchor||void 0)):this.targetDelta?(this.resumingFrom?this.applyTransform(this.layout.layoutBox,!1,this.target):ms(this.target,this.layout.layoutBox),Pa(this.target,this.targetDelta)):ms(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,this.options.layoutAnchor!==!1&&a&&!!a.resumingFrom==!!this.resumingFrom&&!a.options.layoutScroll&&a.target&&this.animationProgress!==1?this.createRelativeTarget(a,this.target,a.target):this.relativeParent=this.relativeTarget=void 0),Eo.value&&cc.calculatedTargetDeltas++)}getClosestProjectingParent(){if(!(!this.parent||Da(this.parent.latestValues)||ka(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(e,t,n){this.relativeParent=e,this.forceRelativeParentToResolveTarget(),this.relativeTarget=z(),this.relativeTargetOrigin=z(),Es(this.relativeTargetOrigin,t,n,this.options.layoutAnchor||void 0),ms(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){let e=this.getLead(),t=!!this.resumingFrom||this!==e,n=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(n=!1),t&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(n=!1),this.resolvedRelativeTargetAt===j.timestamp&&(n=!1),n)return;let{layout:r,layoutId:i}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(r||i))return;ms(this.layoutCorrected,this.layout.layoutBox);let a=this.treeScale.x,o=this.treeScale.y;La(this.layoutCorrected,this.treeScale,this.path,t),e.layout&&!e.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(e.target=e.layout.layoutBox,e.targetWithTransforms=z());let{target:s}=e;if(!s){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(hs(this.prevProjectionDelta.x,this.projectionDelta.x),hs(this.prevProjectionDelta.y,this.projectionDelta.y)),Ss(this.projectionDelta,this.layoutCorrected,s,this.latestValues),(this.treeScale.x!==a||this.treeScale.y!==o||!Bs(this.projectionDelta.x,this.prevProjectionDelta.x)||!Bs(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners(`projectionUpdate`,s)),Eo.value&&cc.calculatedProjections++}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(e=!0){if(this.options.visualElement?.scheduleRender(),e){let e=this.getStack();e&&e.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=Ao(),this.projectionDelta=Ao(),this.projectionDeltaWithTransform=Ao()}setAnimationOrigin(e,t=!1,n){let r=this.snapshot,i=r?r.latestValues:{},a={...this.latestValues},o=Ao();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!t;let s=z(),c=(r?r.source:void 0)!==(this.layout?this.layout.source:void 0),l=this.getStack(),u=!l||l.members.length<=1,d=!(!c||u||this.options.crossfade!==!0||this.path.some(Pc));this.animationProgress=0;let f,p=n?.interpolateProjection(e);this.mixTargetDelta=t=>{let n=t/1e3,r=p?.(n);r?(o.x.translate=r.x,o.x.scale=F(e.x.scale,1,n),o.x.origin=e.x.origin,o.x.originPoint=e.x.originPoint,o.y.translate=r.y,o.y.scale=F(e.y.scale,1,n),o.y.origin=e.y.origin,o.y.originPoint=e.y.originPoint):(jc(o.x,e.x,n),jc(o.y,e.y,n)),this.setTargetDelta(o),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Es(s,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),Nc(this.relativeTarget,this.relativeTargetOrigin,s,n),f&&Is(this.relativeTarget,f)&&(this.isProjectionDirty=!1),f||=z(),ms(f,this.relativeTarget)),c&&(this.animationValues=a,Js(a,i,this.latestValues,n,d,u)),r&&r.rotate!==void 0&&(this.animationValues||=a,this.animationValues.pathRotation=r.rotate),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=n},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(e){this.notifyListeners(`animationStart`),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&=(mn(this.pendingAnimation),void 0),this.pendingAnimation=I.update(()=>{sc.hasAnimatedSinceResize=!0,this.motionValue||=Si(0),this.motionValue.jump(0,!1),this.currentAnimation=$s(this.motionValue,[0,1e3],{...e,velocity:0,isSync:!0,onUpdate:t=>{this.mixTargetDelta(t),e.onUpdate&&e.onUpdate(t)},onComplete:()=>{e.onComplete&&e.onComplete(),this.completeAnimation()}}),Yn(this.currentAnimation,this),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);let e=this.getStack();e&&e.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners(`animationComplete`)}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(uc),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){let e=this.getLead(),{targetWithTransforms:t,layout:n,latestValues:r}=e,{target:i}=e;if(t&&i&&n){if(this!==e&&this.layout&&n&&Bc(this.options.animationType,this.layout.layoutBox,n.layoutBox)){i=this.target||z();let t=B(this.layout.layoutBox.x);i.x.min=e.target.x.min,i.x.max=i.x.min+t;let n=B(this.layout.layoutBox.y);i.y.min=e.target.y.min,i.y.max=i.y.min+n}ms(t,i),Va(t,r),Ss(this.projectionDeltaWithTransform,this.layoutCorrected,t,r)}}registerSharedNode(e,t){this.sharedNodes.has(e)||this.sharedNodes.set(e,new ac),this.sharedNodes.get(e).add(t);let n=t.options.initialPromotionConfig;t.promote({transition:n?n.transition:void 0,preserveFollowOpacity:n&&n.shouldPreserveFollowOpacity?n.shouldPreserveFollowOpacity(t):void 0})}isLead(){let e=this.getStack();return!e||e.lead===this}getLead(){let{layoutId:e}=this.options;return e&&this.getStack()?.lead||this}getPrevLead(){let{layoutId:e}=this.options;return e?this.getStack()?.prevLead:void 0}getStack(){let{layoutId:e}=this.options;if(e)return this.root.sharedNodes.get(e)}promote({needsReset:e,transition:t,preserveFollowOpacity:n}={}){let r=this.getStack();r&&r.promote(this,n),e&&(this.projectionDelta=void 0,this.needsReset=!0),t&&this.setOptions({transition:t})}relegate(){let e=this.getStack();return e?e.relegate(this):!1}resetSkewAndRotation(){let{visualElement:e}=this.options;if(!e)return;let t=!1,{latestValues:n}=e;if((n.z||n.rotate||n.rotateX||n.rotateY||n.rotateZ||n.skewX||n.skewY)&&(t=!0),!t)return;let r={};n.z&&fc(`z`,e,r,this.animationValues);for(let t=0;t<lc.length;t++)fc(`rotate${lc[t]}`,e,r,this.animationValues),fc(`skew${lc[t]}`,e,r,this.animationValues);e.render();for(let t in r)e.setStaticValue(t,r[t]),this.animationValues&&(this.animationValues[t]=r[t]);e.scheduleRender()}applyProjectionStyles(e,t){if(!this.instance||this.isSVG)return;if(!this.isVisible){e.visibility=`hidden`;return}let n=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,e.visibility=``,e.opacity=``,e.pointerEvents=ic(t?.pointerEvents)||``,e.transform=n?n(this.latestValues,``):`none`;return}let r=this.getLead();if(!this.projectionDelta||!this.layout||!r.target){this.options.layoutId&&(e.opacity=this.latestValues.opacity===void 0?1:this.latestValues.opacity,e.pointerEvents=ic(t?.pointerEvents)||``),this.hasProjected&&!Oa(this.latestValues)&&(e.transform=n?n({},``):`none`,this.hasProjected=!1);return}e.visibility=``;let i=r.animationValues||r.latestValues;this.applyTransformsToTarget();let a=Gs(this.projectionDeltaWithTransform,this.treeScale,i);n&&(a=n(i,a)),e.transform=a;let{x:o,y:s}=this.projectionDelta;e.transformOrigin=`${o.origin*100}% ${s.origin*100}% 0`,e.opacity=r.animationValues?r===this?i.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:i.opacityExit:r===this?i.opacity===void 0?``:i.opacity:i.opacityExit===void 0?0:i.opacityExit;for(let t in Qo){if(i[t]===void 0)continue;let{correct:n,applyTo:o,isCSSVariable:s}=Qo[t],c=a===`none`?i[t]:n(i[t],r);if(o){let t=o.length;for(let n=0;n<t;n++)e[o[n]]=c}else s?this.options.visualElement.renderState.vars[t]=c:e[t]=c}this.options.layoutId&&(e.pointerEvents=r===this?ic(t?.pointerEvents)||``:`none`)}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(e=>e.currentAnimation?.stop()),this.root.nodes.forEach(bc),this.root.sharedNodes.clear()}}}function hc(e){e.updateLayout()}function gc(e){let t=e.resumeFrom?.snapshot||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners(`didUpdate`)){let{layoutBox:n,measuredBox:r}=e.layout,{animationType:i}=e.options,a=t.source!==e.layout.source;if(i===`size`)Vs(e=>{let r=a?t.measuredBox[e]:t.layoutBox[e],i=B(r);r.min=n[e].min,r.max=r.min+i});else if(i===`x`||i===`y`){let e=i===`x`?`y`:`x`;ps(a?t.measuredBox[e]:t.layoutBox[e],n[e])}else Bc(i,t.layoutBox,n)&&Vs(r=>{let i=a?t.measuredBox[r]:t.layoutBox[r],o=B(n[r]);i.max=i.min+o,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[r].max=e.relativeTarget[r].min+o)});let o=Ao();Ss(o,n,t.layoutBox);let s=Ao();a?Ss(s,e.applyTransform(r,!0),t.measuredBox):Ss(s,n,t.layoutBox);let c=!Ps(o),l=!1;if(!e.resumeFrom){let r=e.getClosestProjectingParent();if(r&&!r.resumeFrom){let{snapshot:i,layout:a}=r;if(i&&a){let o=e.options.layoutAnchor||void 0,s=z();Es(s,t.layoutBox,i.layoutBox,o);let c=z();Es(c,n,a.layoutBox,o),Rs(s,c)||(l=!0),r.options.layoutRoot&&(e.relativeTarget=c,e.relativeTargetOrigin=s,e.relativeParent=r)}}}e.notifyListeners(`didUpdate`,{layout:n,snapshot:t,delta:s,layoutDelta:o,hasLayoutChanged:c,hasRelativeLayoutChanged:l})}else if(e.isLead()){let{onExitComplete:t}=e.options;t&&t()}e.options.transition=void 0}function _c(e){Eo.value&&cc.nodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty),e.isTransformDirty||=e.parent.isTransformDirty)}function vc(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function yc(e){e.clearSnapshot()}function bc(e){e.clearMeasurements()}function xc(e){e.isLayoutDirty=!0,e.updateLayout()}function Sc(e){e.isLayoutDirty=!1}function Cc(e){e.isAnimationBlocked&&e.layout&&!e.isLayoutDirty&&(e.snapshot=e.layout,e.isLayoutDirty=!0)}function wc(e){e.relativeTarget&&e.relativeParent?.isLayoutDirty&&(e.currentAnimation?e.isLayoutDirty=!0:(e.targetDelta=void 0,e.removeRelativeTarget()))}function Tc(e){let{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify(`BeforeLayoutMeasure`),e.resetTransform()}function Ec(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function Dc(e){e.resolveTargetDelta()}function Oc(e){e.calcProjection()}function kc(e){e.resetSkewAndRotation()}function Ac(e){e.removeLeadSnapshot()}function jc(e,t,n){e.translate=F(t.translate,0,n),e.scale=F(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function Mc(e,t,n,r){e.min=F(t.min,n.min,r),e.max=F(t.max,n.max,r)}function Nc(e,t,n,r){Mc(e.x,t.x,n.x,r),Mc(e.y,t.y,n.y,r)}function Pc(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}var Fc={duration:.45,ease:[.4,0,.1,1]},Ic=e=>typeof navigator<`u`&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),Lc=Ic(`applewebkit/`)&&!Ic(`chrome/`)?Math.round:A;function Rc(e){e.min=Lc(e.min),e.max=Lc(e.max)}function zc(e){Rc(e.x),Rc(e.y)}function Bc(e,t,n){return e===`position`||e===`preserve-aspect`&&!bs(zs(t),zs(n),.2)}function Vc(e){return e!==e.root&&e.scroll?.wasRoot}var Hc=mc({attachResizeListener:(e,t)=>ec(e,`resize`,t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),Uc={current:void 0},Wc=mc({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!Uc.current){let e=new Hc({});e.mount(window),e.setOptions({layoutScroll:!0}),Uc.current=e}return Uc.current},resetTransform:(e,t)=>{e.style.transform=t===void 0?`none`:t},checkIsScrollRoot:e=>window.getComputedStyle(e).position===`fixed`}),Gc=(0,O.createContext)({transformPagePoint:e=>e,isStatic:!1,reducedMotion:`never`});function Kc(e=!0){let t=(0,O.useContext)(me);if(t===null)return[!0,null];let{isPresent:n,onExitComplete:r,register:i}=t,a=(0,O.useId)();(0,O.useEffect)(()=>{if(e)return i(a)},[e]);let o=(0,O.useCallback)(()=>e&&r&&r(a),[a,r,e]);return!n&&r?[!1,o]:[!0]}var qc=(0,O.createContext)({strict:!1}),Jc={animation:[`animate`,`variants`,`whileHover`,`whileTap`,`exit`,`whileInView`,`whileFocus`,`whileDrag`],exit:[`exit`],drag:[`drag`,`dragControls`],focus:[`whileFocus`],hover:[`whileHover`,`onHoverStart`,`onHoverEnd`],tap:[`whileTap`,`onTap`,`onTapStart`,`onTapCancel`],pan:[`onPan`,`onPanStart`,`onPanSessionStart`,`onPanEnd`],inView:[`whileInView`,`onViewportEnter`,`onViewportLeave`],layout:[`layout`,`layoutId`]},Yc=!1;function Xc(){if(Yc)return;let e={};for(let t in Jc)e[t]={isEnabled:e=>Jc[t].some(t=>!!e[t])};Ko(e),Yc=!0}function Zc(){return Xc(),qo()}function Qc(e){let t=Zc();for(let n in e)t[n]={...t[n],...e[n]};Ko(t)}var $c=(0,O.createContext)({});function el(e,t){if(Lo(e)){let{initial:t,animate:n}=e;return{initial:t===!1||Po(t)?t:void 0,animate:Po(n)?n:void 0}}return e.inherit===!1?{}:t}function tl(e){let{initial:t,animate:n}=el(e,(0,O.useContext)($c));return(0,O.useMemo)(()=>({initial:t,animate:n}),[nl(t),nl(n)])}function nl(e){return Array.isArray(e)?e.join(` `):e}var rl=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function il(e,t,n){for(let r in t)!R(t[r])&&!$o(r,n)&&(e[r]=t[r])}function al({transformTemplate:e},t){return(0,O.useMemo)(()=>{let n=rl();return _a(n,t,e),Object.assign({},n.vars,n.style)},[t])}function ol(e,t){let n=e.style||{},r={};return il(r,n,e),Object.assign(r,al(e,t)),r}function sl(e,t){let n={},r=ol(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout=`none`,r.touchAction=e.drag===!0?`none`:`pan-${e.drag===`x`?`y`:`x`}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=r,n}var cl=()=>({...rl(),attrs:{}});function ll(e,t,n,r){let i=(0,O.useMemo)(()=>{let n=cl();return Sa(n,t,is(r),e.transformTemplate,e.style),{...n.attrs,style:{...n.style}}},[t]);if(e.style){let t={};il(t,e.style,e),i.style={...t,...i.style}}return i}var ul=new Set(`animate.exit.variants.initial.style.values.transition.transformTemplate.custom.inherit.onBeforeLayoutMeasure.onAnimationStart.onAnimationComplete.onUpdate.onDragStart.onDrag.onDragEnd.onMeasureDragConstraints.onDirectionLock.onDragTransitionEnd._dragX._dragY.onHoverStart.onHoverEnd.onViewportEnter.onViewportLeave.globalTapTarget.propagate.ignoreStrict.viewport`.split(`.`));function dl(e){return e.startsWith(`while`)||e.startsWith(`drag`)&&e!==`draggable`||e.startsWith(`layout`)||e.startsWith(`onTap`)||e.startsWith(`onPan`)||e.startsWith(`onLayout`)||ul.has(e)}function fl(e,t){return e.startsWith(`on`)?!dl(e):t?.(e)??!dl(e)}function pl(e,t,n,r){let i={};for(let a in e)(a!==`values`||typeof e.values!=`object`)&&(R(e[a])||(fl(a,r)||n===!0&&dl(a)||!t&&!dl(a)||e.draggable&&a.startsWith(`onDrag`))&&(i[a]=e[a]));return i}var ml=[`animate`,`circle`,`defs`,`desc`,`ellipse`,`g`,`image`,`line`,`filter`,`marker`,`mask`,`metadata`,`path`,`pattern`,`polygon`,`polyline`,`rect`,`stop`,`switch`,`symbol`,`svg`,`text`,`tspan`,`use`,`view`];function hl(e){return typeof e!=`string`||e.includes(`-`)?!1:!!(ml.indexOf(e)>-1||/[A-Z]/u.test(e))}function gl(e,t,n,{latestValues:r},i,a=!1,o,s){let c=(o??hl(e)?ll:sl)(t,r,i,e),l=pl(t,typeof e==`string`,a,s),u=e===O.Fragment?{}:{...l,...c,ref:n},{children:d}=t,f=(0,O.useMemo)(()=>R(d)?d.get():d,[d]);return(0,O.createElement)(e,{...u,children:f})}function _l({scrapeMotionValuesFromProps:e,createRenderState:t},n,r,i){return{latestValues:vl(n,r,i,e),renderState:t()}}function vl(e,t,n,r){let i={},a=r(e,{});for(let e in a)i[e]=ic(a[e]);let{initial:o,animate:s}=e,c=Lo(e),l=Ro(e);t&&l&&!c&&e.inherit!==!1&&(o===void 0&&(o=t.initial),s===void 0&&(s=t.animate));let u=n?n.initial===!1:!1;u||=o===!1;let d=u?s:o;if(d&&typeof d!=`boolean`&&!No(d)){let t=Array.isArray(d)?d:[d];for(let n=0;n<t.length;n++){let r=Li(e,t[n]);if(r){let{transitionEnd:e,transition:t,...n}=r;for(let e in n){let t=n[e];if(Array.isArray(t)){let e=u?t.length-1:0;t=t[e]}t!==null&&(i[e]=t)}for(let t in e)i[t]=e[t]}}}return i}var yl=e=>(t,n)=>{let r=(0,O.useContext)($c),i=(0,O.useContext)(me),a=()=>_l(e,t,r,i);return n?a():fe(a)},bl=yl({scrapeMotionValuesFromProps:es,createRenderState:rl}),xl=yl({scrapeMotionValuesFromProps:os,createRenderState:cl}),Sl=Symbol.for(`motionComponentSymbol`);function Cl(e,t,n){let r=(0,O.useRef)(n);(0,O.useInsertionEffect)(()=>{r.current=n});let i=(0,O.useRef)(null);return(0,O.useCallback)(n=>{n&&e.onMount?.(n),t&&(n?t.mount(n):t.unmount());let a=r.current;if(typeof a==`function`){if(n){let e=a(n);typeof e==`function`&&(i.current=e)}else i.current?(i.current(),i.current=null):a(n)}else a&&(a.current=n)},[t])}var wl=(0,O.createContext)({});function Tl(e){return e&&typeof e==`object`&&Object.prototype.hasOwnProperty.call(e,`current`)}function El(e,t,n,r,i,a){let{visualElement:o}=(0,O.useContext)($c),s=(0,O.useContext)(qc),c=(0,O.useContext)(me),l=(0,O.useContext)(Gc),u=l.reducedMotion,d=l.skipAnimations,f=(0,O.useRef)(null),p=(0,O.useRef)(!1);r||=s.renderer,!f.current&&r&&(f.current=r(e,{visualState:t,parent:o,props:n,presenceContext:c,blockInitialAnimation:c?c.initial===!1:!1,reducedMotionConfig:u,skipAnimations:d,isSVG:a}),p.current&&f.current&&(f.current.manuallyAnimateOnMount=!0));let m=f.current,h=(0,O.useContext)(wl);m&&!m.projection&&i&&(m.type===`html`||m.type===`svg`)&&Dl(f.current,n,i,h);let g=(0,O.useRef)(!1);(0,O.useInsertionEffect)(()=>{m&&g.current&&m.update(n,c)});let _=n[Ji],v=(0,O.useRef)(!!_&&typeof window<`u`&&!window.MotionHandoffIsComplete?.(_)&&window.MotionHasOptimisedAnimation?.(_));return pe(()=>{p.current&&m&&(m.animationState?.animateChanges(),m.enteringChildren=void 0)},[]),pe(()=>{p.current=!0,m&&(g.current=!0,window.MotionIsMounted=!0,m.updateFeatures(),m.scheduleRenderMicrotask(),v.current&&m.animationState&&m.animationState.animateChanges())}),(0,O.useEffect)(()=>{m&&(!v.current&&m.animationState&&m.animationState.animateChanges(),v.current&&=(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(_)}),!1),m.enteringChildren=void 0)}),m}function Dl(e,t,n,r){let{layoutId:i,layout:a,drag:o,dragConstraints:s,layoutScroll:c,layoutRoot:l,layoutAnchor:u,layoutCrossfade:d}=t;e.projection=new n(e.latestValues,t[`data-framer-portal-id`]?void 0:Ol(e.parent)),e.projection.setOptions({layoutId:i,layout:a,alwaysMeasureLayout:!!o||s&&Tl(s),visualElement:e,animationType:typeof a==`string`?a:`both`,initialPromotionConfig:r,crossfade:d,layoutScroll:c,layoutRoot:l,layoutAnchor:u})}function Ol(e){if(e)return e.options.allowProjection===!1?Ol(e.parent):e.projection}function kl(e,{forwardMotionProps:t=!1,type:n}={},r,i){r&&Qc(r);let a=n?n===`svg`:hl(e),o=a?xl:bl;function s(n,s){let c,l={...(0,O.useContext)(Gc),...n,layoutId:Al(n)},{isStatic:u,isValidProp:d}=l,f=tl(n),p=o(n,u);if(!u&&typeof window<`u`){jl(l,r);let t=Ml(l);c=t.MeasureLayout,f.visualElement=El(e,p,l,i,t.ProjectionNode,a)}return(0,D.jsxs)($c.Provider,{value:f,children:[c&&f.visualElement?(0,D.jsx)(c,{visualElement:f.visualElement,...l}):null,gl(e,n,Cl(p,f.visualElement,s),p,u,t,a,d)]})}s.displayName=`motion.${typeof e==`string`?e:`create(${e.displayName??e.name??``})`}`;let c=(0,O.forwardRef)(s);return c[Sl]=e,c}function Al({layoutId:e}){let t=(0,O.useContext)(de).id;return t&&e!==void 0?t+`-`+e:e}function jl(e,t){(0,O.useContext)(qc).strict}function Ml(e){let{drag:t,layout:n}=Zc();if(!t&&!n)return{};let r={...t,...n};return{MeasureLayout:t?.isEnabled(e)||n?.isEnabled(e)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}function Nl(e,t){if(typeof Proxy>`u`)return kl;let n=new Map,r=(n,r)=>kl(n,r,e,t);return new Proxy((e,t)=>r(e,t),{get:(i,a)=>a===`create`?r:(n.has(a)||n.set(a,kl(a,void 0,e,t)),n.get(a))})}var Pl=(e,t)=>t.isSVG??hl(e)?new ss(t):new ns(t,{allowProjection:e!==O.Fragment}),Fl=class extends Xo{constructor(e){super(e),e.animationState||=us(e)}updateAnimationControlsSubscription(){let{animate:e}=this.node.getProps();No(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){let{animate:e}=this.node.getProps(),{animate:t}=this.node.prevProps||{};e!==t&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}},Il=0,Ll={animation:{Feature:Fl},exit:{Feature:class extends Xo{constructor(){super(...arguments),this.id=Il++}update(){let{presenceContext:e,prevPresenceContext:t,animationState:n}=this.node;if(!e||!n)return;let{isPresent:r,onExitComplete:i}=e,a=t?.isPresent;if(r===a)return;if(r&&a===!1){if(this.exit===!0){let{initial:e}=this.node.getProps();if(e&&!Array.isArray(e)){let{transition:t,transitionEnd:n,...r}=Ri(this.node,e)||{};for(let e in r)this.node.getValue(e)?.jump(r[e])}this.node.blockInitialAnimation=!1,n.reset(),n.animateChanges()}else n.setActive(`exit`,!1);this.exit=void 0;return}let o=this.exit=n.setActive(`exit`,!r);i&&!r&&o.then(()=>{this.exit===o&&(this.exit=!0,i(this.id))})}mount(){let{register:e,onExitComplete:t}=this.node.presenceContext||{};t&&t(this.id),e&&(this.unmount=e(this.id))}unmount(){}}}};function Rl(e){return{point:{x:e.pageX,y:e.pageY}}}var zl=e=>t=>$a(t)&&e(t,Rl(t));function Bl(e,t,n,r){return ec(e,t,zl(n),r)}var Vl=({current:e})=>e?e.ownerDocument.defaultView:null,Hl=(e,t)=>Math.abs(e-t);function Ul(e,t){let n=Hl(e.x,t.x),r=Hl(e.y,t.y);return Math.sqrt(n**2+r**2)}var Wl=new Set([`auto`,`scroll`]),Gl=class{constructor(e,t,{transformPagePoint:n,contextWindow:r=window,dragSnapToOrigin:i=!1,distanceThreshold:a=3,element:o}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.lastRawMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=e=>{this.handleScroll(e.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;this.hasPendingMove=!1,this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=Kl(this.lastRawMoveEventInfo,this.transformPagePoint));let e=Jl(this.lastMoveEventInfo,this.history),t=this.startEvent!==null,n=Ul(e.offset,{x:0,y:0})>=this.distanceThreshold;if(!t&&!n)return;let{point:r}=e;this.history.push({...r,timestamp:M.now()});let{onStart:i,onMove:a}=this.handlers;t||(i&&i(this.lastMoveEvent,e),this.startEvent=this.lastMoveEvent),a&&a(this.lastMoveEvent,e)},this.handlePointerMove=(e,t)=>{this.lastMoveEvent=e,this.lastRawMoveEventInfo=t,this.lastMoveEventInfo=Kl(t,this.transformPagePoint),this.hasPendingMove=!0,I.update(this.updatePoint,!0)},this.handlePointerUp=(e,t)=>{this.hasPendingMove&&this.updatePoint(),this.end();let{onEnd:n,onSessionEnd:r,resumeAnimation:i}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&i&&i(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;let a=Jl(e.type===`pointercancel`?this.lastMoveEventInfo:Kl(t,this.transformPagePoint),this.history);this.startEvent&&n&&n(e,a),r&&r(e,a)},!$a(e))return;this.dragSnapToOrigin=i,this.handlers=t,this.transformPagePoint=n,this.distanceThreshold=a,this.contextWindow=r||window;let s=Kl(Rl(e),this.transformPagePoint),{point:c}=s,{timestamp:l}=j;this.history=[{...c,timestamp:l}];let{onSessionStart:u}=t;u&&u(e,Jl(s,this.history));let d={passive:!0,capture:!0};this.removeListeners=Se(Bl(this.contextWindow,`pointermove`,this.handlePointerMove,d),Bl(this.contextWindow,`pointerup`,this.handlePointerUp,d),Bl(this.contextWindow,`pointercancel`,this.handlePointerUp,d)),o&&this.startScrollTracking(o)}startScrollTracking(e){let t=e.parentElement;for(;t;){let e=getComputedStyle(t);(Wl.has(e.overflowX)||Wl.has(e.overflowY))&&this.scrollPositions.set(t,{x:t.scrollLeft,y:t.scrollTop}),t=t.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener(`scroll`,this.onElementScroll,{capture:!0}),window.addEventListener(`scroll`,this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener(`scroll`,this.onElementScroll,{capture:!0}),window.removeEventListener(`scroll`,this.onWindowScroll)}}handleScroll(e){let t=this.scrollPositions.get(e);if(!t)return;let n=e===window,r=n?{x:window.scrollX,y:window.scrollY}:{x:e.scrollLeft,y:e.scrollTop},i={x:r.x-t.x,y:r.y-t.y};(i.x!==0||i.y!==0)&&(n?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=i.x,this.lastMoveEventInfo.point.y+=i.y):this.history.length>0&&(this.history[0].x-=i.x,this.history[0].y-=i.y),this.scrollPositions.set(e,r),I.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),mn(this.updatePoint)}};function Kl(e,t){return t?{point:t(e.point)}:e}function ql(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Jl({point:e},t){return{point:e,delta:ql(e,Xl(t)),offset:ql(e,Yl(t)),velocity:Zl(t,.1)}}function Yl(e){return e[0]}function Xl(e){return e[e.length-1]}function Zl(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null,i=Xl(e);for(;n>=0&&(r=e[n],!(i.timestamp-r.timestamp>Te(t)));)n--;if(!r)return{x:0,y:0};r===e[0]&&e.length>2&&i.timestamp-r.timestamp>Te(t)*2&&(r=e[1]);let a=Ee(i.timestamp-r.timestamp);if(a===0)return{x:0,y:0};let o={x:(i.x-r.x)/a,y:(i.y-r.y)/a};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function Ql(e,{min:t,max:n},r){return t!==void 0&&e<t?e=r?F(t,e,r.min):Math.max(e,t):n!==void 0&&e>n&&(e=r?F(n,e,r.max):Math.min(e,n)),e}function $l(e,t,n){return{min:t===void 0?void 0:e.min+t,max:n===void 0?void 0:e.max+n-(e.max-e.min)}}function eu(e,{top:t,left:n,bottom:r,right:i}){return{x:$l(e.x,n,i),y:$l(e.y,t,r)}}function tu(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.min<e.max-e.min&&([n,r]=[r,n]),{min:n,max:r}}function nu(e,t){return{x:tu(e.x,t.x),y:tu(e.y,t.y)}}function ru(e,t){let n=.5,r=B(e),i=B(t);return i>r?n=Ce(t.min,t.max-r,e.min):r>i&&(n=Ce(e.min,e.max-i,t.min)),ge(0,1,n)}function iu(e,t){let n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}var au=.35;function ou(e=au){return e===!1?e=0:e===!0&&(e=au),{x:su(e,`left`,`right`),y:su(e,`top`,`bottom`)}}function su(e,t,n){return{min:cu(e,t),max:cu(e,n)}}function cu(e,t){return typeof e==`number`?e:e[t]||0}var lu=new WeakMap,uu=class{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=z(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:t=!1,distanceThreshold:n}={}){let{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;let i=e=>{t&&this.snapToCursor(e),this.stopAnimation()},a=(e,t)=>{let{drag:n,dragPropagation:r,onDragStart:i}=this.getProps();if(n&&!r&&(this.openDragLock&&this.openDragLock(),this.openDragLock=Ja(n),!this.openDragLock))return;this.latestPointerEvent=e,this.latestPanInfo=t,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Vs(e=>{let t=this.getAxisMotionValue(e).get()||0;if(bt.test(t)){let{projection:n}=this.visualElement;if(n&&n.layout){let r=n.layout.layoutBox[e];r&&(t=B(r)*(parseFloat(t)/100))}}this.originPoint[e]=t}),i&&I.update(()=>i(e,t),!1,!0),Ki(this.visualElement,`transform`);let{animationState:a}=this.visualElement;a&&a.setActive(`whileDrag`,!0)},o=(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t;let{dragPropagation:n,dragDirectionLock:r,onDirectionLock:i,onDrag:a}=this.getProps();if(!n&&!this.openDragLock)return;let{offset:o}=t;if(r&&this.currentDirection===null){this.currentDirection=mu(o),this.currentDirection!==null&&i&&i(this.currentDirection);return}this.updateAxis(`x`,t.point,o),this.updateAxis(`y`,t.point,o),this.visualElement.render(),a&&I.update(()=>a(e,t),!1,!0)},s=(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t,this.stop(e,t),this.latestPointerEvent=null,this.latestPanInfo=null},c=()=>{let{dragSnapToOrigin:e}=this.getProps();(e||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:l}=this.getProps();this.panSession=new Gl(e,{onSessionStart:i,onStart:a,onMove:o,onSessionEnd:s,resumeAnimation:c},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:l,distanceThreshold:n,contextWindow:Vl(this.visualElement),element:this.visualElement.current})}stop(e,t){let n=e||this.latestPointerEvent,r=t||this.latestPanInfo,i=this.isDragging;if(this.cancel(),!i||!r||!n)return;let{velocity:a}=r;this.startAnimation(a);let{onDragEnd:o}=this.getProps();o&&I.postRender(()=>o(n,r))}cancel(){this.isDragging=!1;let{projection:e,animationState:t}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.endPanSession();let{dragPropagation:n}=this.getProps();!n&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),t&&t.setActive(`whileDrag`,!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(e,t,n){let{drag:r}=this.getProps();if(!n||!pu(e,r,this.currentDirection))return;let i=this.getAxisMotionValue(e),a=this.originPoint[e]+n[e];this.constraints&&this.constraints[e]&&(a=Ql(a,this.constraints[e],this.elastic[e])),i.set(a)}resolveConstraints(){let{dragConstraints:e,dragElastic:t}=this.getProps(),n=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,r=this.constraints;e&&Tl(e)?this.constraints||=this.resolveRefConstraints():this.constraints=e&&n?eu(n.layoutBox,e):!1,this.elastic=ou(t),r!==this.constraints&&!Tl(e)&&n&&this.constraints&&!this.hasMutatedConstraints&&Vs(e=>{this.constraints!==!1&&this.getAxisMotionValue(e)&&(this.constraints[e]=iu(n.layoutBox[e],this.constraints[e]))})}resolveRefConstraints(){let{dragConstraints:e,onMeasureDragConstraints:t}=this.getProps();if(!e||!Tl(e))return!1;let n=e.current,{projection:r}=this.visualElement;if(!r||!r.layout)return!1;r.root&&(r.root.scroll=void 0,r.root.updateScroll());let i=Ua(n,r.root,this.visualElement.getTransformPagePoint()),a=nu(r.layout.layoutBox,i);if(t){let e=t(wa(a));this.hasMutatedConstraints=!!e,e&&(a=Ca(e))}return a}startAnimation(e){let{drag:t,dragMomentum:n,dragElastic:r,dragTransition:i,dragSnapToOrigin:a,onDragTransitionEnd:o}=this.getProps(),s=this.constraints||{},c=Vs(o=>{if(!pu(o,t,this.currentDirection))return;let c=s&&s[o]||{};(a===!0||a===o)&&(c={min:0,max:0});let l=r?200:1e6,u=r?40:1e7,d={type:`inertia`,velocity:n?e[o]:0,bounceStiffness:l,bounceDamping:u,timeConstant:750,restDelta:1,restSpeed:10,...i,...c};return this.startAxisValueAnimation(o,d)});return Promise.all(c).then(o)}startAxisValueAnimation(e,t){let n=this.getAxisMotionValue(e);return Ki(this.visualElement,e),n.start(Mi(e,n,0,t,this.visualElement,!1))}stopAnimation(){Vs(e=>this.getAxisMotionValue(e).stop())}getAxisMotionValue(e){let t=`_drag${e.toUpperCase()}`;return this.visualElement.getProps()[t]||this.visualElement.getValue(e,this.visualElement.latestValues[e]??0)}snapToCursor({clientX:e,clientY:t}){let{drag:n}=this.getProps(),r={x:e,y:t},i=this.visualElement.getTransformPagePoint()?.(r)||r,a=this.visualElement.measureViewportBox();Vs(e=>{if(!pu(e,n,this.currentDirection))return;let t=this.getAxisMotionValue(e),{min:r,max:o}=a[e];t.set((t.get()||0)+i[e]-F(r,o,.5))})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;let{drag:e,dragConstraints:t}=this.getProps(),{projection:n}=this.visualElement;if(!Tl(t)||!n||!this.constraints)return;this.stopAnimation();let r=this.constraints,i={x:0,y:0};Vs(e=>{let t=this.getAxisMotionValue(e).get();i[e]=ru({min:t,max:t},r[e])});let{transformTemplate:a}=this.visualElement.getProps();this.visualElement.current.style.transform=a?a({},``):`none`,n.root&&n.root.updateScroll(),n.updateLayout(),this.constraints=!1,this.resolveConstraints(),Vs(t=>{let n=this.getAxisMotionValue(t);if(!pu(t,e,null)||!n.get())return;let{min:r,max:a}=this.constraints[t];n.set(F(r,a,i[t]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;lu.set(this.visualElement,this);let e=this.visualElement.current,t=Bl(e,`pointerdown`,t=>{let{drag:n,dragListener:r=!0}=this.getProps(),i=t.target,a=i!==e&&ro(i);n&&r&&!a&&this.start(t)}),n,r=()=>{let{dragConstraints:t}=this.getProps();Tl(t)&&t.current&&(this.constraints=this.resolveRefConstraints(),n||=fu(e,t.current,()=>this.scalePositionWithinConstraints()))},{projection:i}=this.visualElement,a=i.addEventListener(`measure`,r);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),I.read(r);let o=ec(window,`resize`,()=>this.scalePositionWithinConstraints()),s=i.addEventListener(`didUpdate`,(({delta:e,hasLayoutChanged:t})=>{this.isDragging&&t&&(Vs(t=>{let n=this.getAxisMotionValue(t);n&&(this.originPoint[t]+=e[t].translate,n.set(n.get()+e[t].translate))}),this.visualElement.render())}));return()=>{o(),t(),a(),s&&s(),n&&n()}}getProps(){let e=this.visualElement.getProps(),{drag:t=!1,dragDirectionLock:n=!1,dragPropagation:r=!1,dragConstraints:i=!1,dragElastic:a=au,dragMomentum:o=!0}=e;return{...e,drag:t,dragDirectionLock:n,dragPropagation:r,dragConstraints:i,dragElastic:a,dragMomentum:o}}};function du(e){let t=!0;return()=>{if(t){t=!1;return}e()}}function fu(e,t,n){let r=To(e,du(n)),i=To(t,du(n));return()=>{r(),i()}}function pu(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function mu(e,t=10){let n=null;return Math.abs(e.y)>t?n=`y`:Math.abs(e.x)>t&&(n=`x`),n}var hu=class extends Xo{constructor(e){super(e),this.removeGroupControls=A,this.removeListeners=A,this.controls=new uu(e)}mount(){let{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||A}update(){let{dragControls:e}=this.node.getProps(),{dragControls:t}=this.node.prevProps||{};e!==t&&(this.removeGroupControls(),e&&(this.removeGroupControls=e.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}},gu=e=>(t,n)=>{e&&I.update(()=>e(t,n),!1,!0)},_u=class extends Xo{constructor(){super(...arguments),this.removePointerDownListener=A}onPointerDown(e){this.session=new Gl(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:Vl(this.node)})}createPanHandlers(){let{onPanSessionStart:e,onPanStart:t,onPan:n,onPanEnd:r}=this.node.getProps();return{onSessionStart:gu(e),onStart:gu(t),onMove:gu(n),onEnd:(e,t)=>{delete this.session,r&&I.postRender(()=>r(e,t))}}}mount(){this.removePointerDownListener=Bl(this.node.current,`pointerdown`,e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}},vu=!1,yu=class extends O.Component{componentDidMount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:n,layoutId:r}=this.props,{projection:i}=e;i&&(t.group&&t.group.add(i),n&&n.register&&r&&n.register(i),vu&&i.root.didUpdate(),i.addEventListener(`animationComplete`,()=>{this.safeToRemove()}),i.setOptions({...i.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),sc.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){let{layoutDependency:t,visualElement:n,drag:r,isPresent:i}=this.props,{projection:a}=n;return a?(a.isPresent=i,e.layoutDependency!==t&&a.setOptions({...a.options,layoutDependency:t}),vu=!0,r||e.layoutDependency!==t||t===void 0||e.isPresent!==i?a.willUpdate():this.safeToRemove(),e.isPresent!==i&&(i?a.promote():a.relegate()||I.postRender(()=>{let e=a.getStack();(!e||!e.members.length)&&this.safeToRemove()})),null):null}componentDidUpdate(){let{visualElement:e,layoutAnchor:t}=this.props,{projection:n}=e;n&&(n.options.layoutAnchor=t,n.root.didUpdate(),Wa.postRender(()=>{!n.currentAnimation&&n.isLead()&&this.safeToRemove()}))}componentWillUnmount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:n}=this.props,{projection:r}=e;vu=!0,r&&(r.scheduleCheckAfterUnmount(),t&&t.group&&t.group.remove(r),n&&n.deregister&&n.deregister(r))}safeToRemove(){let{safeToRemove:e}=this.props;e&&e()}render(){return null}};function bu(e){let[t,n]=Kc(),r=(0,O.useContext)(de);return(0,D.jsx)(yu,{...e,layoutGroup:r,switchLayoutGroup:(0,O.useContext)(wl),isPresent:t,safeToRemove:n})}var xu={pan:{Feature:_u},drag:{Feature:hu,ProjectionNode:Wc,MeasureLayout:bu}};function Su(e,t,n){let{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive(`whileHover`,n===`Start`);let i=r[`onHover`+n];i&&I.postRender(()=>i(t,Rl(t)))}var Cu=class extends Xo{mount(){let{current:e}=this.node;e&&(this.unmount=Za(e,(e,t)=>(Su(this.node,t,`Start`),e=>Su(this.node,e,`End`))))}unmount(){}},wu=class extends Xo{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(`:focus-visible`)}catch{e=!0}e&&this.node.animationState&&(this.node.animationState.setActive(`whileFocus`,!0),this.isActive=!0)}onBlur(){this.isActive&&this.node.animationState&&(this.node.animationState.setActive(`whileFocus`,!1),this.isActive=!1)}mount(){this.unmount=Se(ec(this.node.current,`focus`,()=>this.onFocus()),ec(this.node.current,`blur`,()=>this.onBlur()))}unmount(){}};function Tu(e,t,n){let{props:r}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&r.whileTap&&e.animationState.setActive(`whileTap`,n===`Start`);let i=r[`onTap`+(n===`End`?``:n)];i&&I.postRender(()=>i(t,Rl(t)))}var Eu=class extends Xo{mount(){let{current:e}=this.node;if(!e)return;let{globalTapTarget:t,propagate:n}=this.node.props;this.unmount=uo(e,(e,t)=>(Tu(this.node,t,`Start`),(e,{success:t})=>Tu(this.node,e,t?`End`:`Cancel`)),{useGlobalTarget:t,stopPropagation:n?.tap===!1})}unmount(){}},Du=new WeakMap,Ou=new WeakMap,ku=e=>{let t=Du.get(e.target);t&&t(e)},Au=e=>{e.forEach(ku)};function ju({root:e,...t}){let n=e||document;Ou.has(n)||Ou.set(n,{});let r=Ou.get(n),i=JSON.stringify(t);return r[i]||(r[i]=new IntersectionObserver(Au,{root:e,...t})),r[i]}function Mu(e,t,n){let r=ju(t);return Du.set(e,n),r.observe(e),()=>{Du.delete(e),r.unobserve(e)}}var Nu={some:0,all:1},Pu=class extends Xo{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.stopObserver?.();let{viewport:e={}}=this.node.getProps(),{root:t,margin:n,amount:r=`some`,once:i}=e,a={root:t?t.current:void 0,rootMargin:n,threshold:typeof r==`number`?r:Nu[r]},o=e=>{let{isIntersecting:t}=e;if(this.isInView===t||(this.isInView=t,i&&!t&&this.hasEnteredView))return;t&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive(`whileInView`,t);let{onViewportEnter:n,onViewportLeave:r}=this.node.getProps(),a=t?n:r;a&&a(e)};this.stopObserver=Mu(this.node.current,a,o)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>`u`)return;let{props:e,prevProps:t}=this.node;[`amount`,`margin`,`root`].some(Fu(e,t))&&this.startObserver()}unmount(){this.stopObserver?.(),this.hasEnteredView=!1,this.isInView=!1}};function Fu({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}var Iu={inView:{Feature:Pu},tap:{Feature:Eu},focus:{Feature:wu},hover:{Feature:Cu}},Lu={layout:{ProjectionNode:Wc,MeasureLayout:bu}},Ru=Nl({...Ll,...Iu,...xu,...Lu},Pl),zu={name:`blocks`,size:24,node:[[`path`,{d:`M10 22V7a1 1 0 0 0-1-1H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5a1 1 0 0 0-1-1H2`,key:`1ah6g2`}],[`rect`,{x:`14`,y:`2`,width:`8`,height:`8`,rx:`1`,key:`88lufb`}]]};zu.node;var Bu=u(zu),Vu={name:`code`,size:24,node:[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]};Vu.node;var Hu=u(Vu),Uu={name:`folder-open`,size:24,node:[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`,key:`usdka0`}]]};Uu.node;var Wu=u(Uu),Gu={name:`menu`,size:24,node:[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]};Gu.node;var Ku=u(Gu),qu={name:`trash`,size:24,node:[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]],aliases:[`trash-2`]};qu.node;var Ju=u(qu),Yu=(0,O.createContext)(null);function Xu({children:e,ports:t={}}){let n=t.timer??C,[r,i]=(0,O.useState)(null),[a,o]=(0,O.useState)(``),s=(0,O.useRef)(null);(0,O.useEffect)(()=>{r?.kind===`prompt`&&(o(r.options.initialValue??``),n.setTimeout(()=>{s.current?.focus(),s.current?.select()},0))},[r,n]);let c=(0,O.useCallback)(()=>{i(null),o(``)},[]),u=(0,O.useCallback)(()=>{r&&(r.kind===`confirm`?r.resolve(!1):r.kind===`prompt`?r.resolve(null):r.resolve(),c())},[c,r]),d=(0,O.useCallback)(()=>{r&&(r.kind===`confirm`?r.resolve(!0):r.kind===`prompt`?r.resolve(a.trim()||null):r.resolve(),c())},[c,r,a]),f=(0,O.useCallback)(e=>new Promise(t=>{i({kind:`confirm`,options:e,resolve:t})}),[]),p=(0,O.useCallback)(e=>new Promise(t=>{i({kind:`prompt`,options:e,resolve:t})}),[]),m=(0,O.useCallback)(e=>new Promise(t=>{i({kind:`alert`,options:e,resolve:t})}),[]),h=(0,O.useMemo)(()=>({confirm:f,prompt:p,alert:m}),[m,f,p]),g=`Confirm`;return r&&(r.kind===`alert`?g=r.options.closeLabel??`OK`:`confirmLabel`in r.options&&(g=r.options.confirmLabel??`Confirm`)),(0,D.jsxs)(Yu.Provider,{value:h,children:[e,(0,D.jsx)(b,{open:r!==null,onOpenChange:e=>{!e&&r&&u()},children:(0,D.jsx)(y,{size:`sm`,onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&r&&r.kind===`confirm`&&(e.preventDefault(),d())},children:r?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(S,{className:`space-y-4`,children:[(0,D.jsx)(w,{children:r.options.title}),r.options.description?(0,D.jsx)(v,{children:r.options.description}):null,r.kind===`prompt`?(0,D.jsx)(ee,{ref:s,type:`text`,value:a,onChange:e=>o(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),d())},placeholder:r.options.placeholder}):null]}),(0,D.jsxs)(x,{children:[(0,D.jsx)(l,{variant:`ghost`,size:`sm`,onClick:u,className:r.kind===`alert`?`hidden`:void 0,children:`cancelLabel`in r.options?r.options.cancelLabel??`Cancel`:`Cancel`}),(0,D.jsx)(l,{variant:r.kind===`confirm`?r.options.confirmVariant??`default`:`secondary`,size:`sm`,onClick:d,disabled:r.kind===`prompt`&&!a.trim(),children:g})]})]}):null})})]})}function Zu(){let e=(0,O.useContext)(Yu);if(!e)throw Error(`useAppDialog must be used within AppDialogProvider`);return e}var Qu=typeof window<`u`,$u=Qu?window:null,ed=Qu?document:null,V={OBJECT:0,ATTRIBUTE:1,CSS:2,TRANSFORM:3,CSS_VAR:4},H={NUMBER:0,UNIT:1,COLOR:2,COMPLEX:3},td={NONE:0,AUTO:1,FORCE:2},nd={replace:0,none:1,blend:2},rd=Symbol(),id=Symbol(),ad=Symbol(),od=Symbol(),sd=Symbol(),U=1e-11,cd=0xe8d4a51000,ld=1e3,ud=[],dd=(()=>{let e=new Map;return e.set(`x`,`translateX`),e.set(`y`,`translateY`),e.set(`z`,`translateZ`),e})(),fd=[`perspective`,`translateX`,`translateY`,`translateZ`,`rotate`,`rotateX`,`rotateY`,`rotateZ`,`scale`,`scaleX`,`scaleY`,`scaleZ`,`skew`,`skewX`,`skewY`],pd=fd.reduce((e,t)=>({...e,[t]:t+`(`}),{}),md=()=>{},hd=e=>e,gd=/\)\s*[-.\d]/,_d=/(^#([\da-f]{3}){1,2}$)|(^#([\da-f]{4}){1,2}$)/i,vd=/rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/i,yd=/rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(-?\d+|-?\d*.\d+)\s*\)/i,bd=/hsl\(\s*(-?\d+|-?\d*.\d+)\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)%\s*\)/i,xd=/hsla\(\s*(-?\d+|-?\d*.\d+)\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)\s*\)/i,Sd=/[-+]?\d*\.?\d+(?:e[-+]?\d)?/gi,Cd=/^([-+]?\d*\.?\d+(?:e[-+]?\d+)?)([a-z]+|%)$/i,wd=/([a-z])([A-Z])/g,Td=/var\(\s*(--[\w-]+)(?:\s*,\s*([^)]+))?\s*\)/,Ed={id:null,keyframes:null,playbackEase:null,playbackRate:1,frameRate:240,loop:0,reversed:!1,alternate:!1,autoplay:!0,persist:!1,duration:ld,delay:0,loopDelay:0,ease:`out(2)`,composition:nd.replace,modifier:hd,onBegin:md,onBeforeUpdate:md,onUpdate:md,onLoop:md,onPause:md,onComplete:md,onRender:md},Dd={current:null,root:ed},W={defaults:Ed,precision:4,timeScale:1,tickThreshold:200,editor:null},Od={version:`4.5.0`,engine:null};Qu&&($u.AnimeJS||=[],$u.AnimeJS.push(Od));var kd=e=>e.replace(wd,`$1-$2`).toLowerCase(),Ad=(e,t)=>e.indexOf(t)===0,jd=Date.now,Md=Array.isArray,Nd=e=>e&&e.constructor===Object,Pd=e=>typeof e==`number`&&!isNaN(e),Fd=e=>typeof e==`string`,Id=e=>typeof e==`function`,G=e=>e===void 0,Ld=e=>G(e)||e===null,Rd=e=>Qu&&e instanceof SVGElement,zd=e=>_d.test(e),Bd=e=>Ad(e,`rgb`),Vd=e=>Ad(e,`hsl`),Hd=e=>zd(e)||(Bd(e)||Vd(e))&&(e[e.length-1]===`)`||!gd.test(e)),Ud=e=>!W.defaults.hasOwnProperty(e),Wd=[`opacity`,`rotate`,`overflow`,`color`],Gd=(e,t)=>{if(Wd.includes(t))return!1;if(e.getAttribute(t)||t in e){if(t===`scale`){let t=e.parentNode;return t&&t.tagName===`filter`}return!0}},Kd=Math.pow,qd=Math.sqrt,Jd=Math.sin,Yd=Math.cos,Xd=Math.abs,Zd=Math.exp,Qd=Math.floor,$d=Math.asin,ef=Math.PI,tf=Math.round,nf=(e,t,n)=>e<t?t:e>n?n:e,K=(e,t)=>{if(t<0)return e;if(!t)return tf(e);let n=10**t;return tf(e*n)/n},rf=(e,t,n)=>n===1?t:n===0?e:e+(t-e)*n,af=e=>e===1/0?cd:e===-1/0?-cd:e,of=e=>e<=1e-11?U:af(K(e,11)),q=e=>Md(e)?[...e]:e,sf=(e,t)=>{let n={...e};for(let r in t){let i=e[r];n[r]=G(i)?t[r]:i}return n},J=(e,t,n,r=`_prev`,i=`_next`)=>{let a=e._head,o=i;for(n&&(a=e._tail,o=r);a;){let e=a[o];t(a),a=e}},cf=(e,t,n=`_prev`,r=`_next`)=>{let i=t[n],a=t[r];i?i[r]=a:e._head=a,a?a[n]=i:e._tail=i,t[n]=null,t[r]=null},lf=(e,t,n,r=`_prev`,i=`_next`)=>{let a=e._tail;for(;a&&n&&n(a,t);)a=a[r];let o=a?a[i]:e._head;a?a[i]=t:e._head=t,o?o[r]=t:e._tail=t,t[r]=a,t[i]=o},uf=(e,t,n)=>{let r=e.style.transform;if(r){let i=e[od],a=0,o=r.length,s;for(;a<o;){for(;a<o&&r.charCodeAt(a)===32;)a++;if(a>=o)break;let e=a;for(;a<o&&r.charCodeAt(a)!==40;)a++;if(a>=o)break;let t=r.substring(e,a),n=1,c=a+1,l=-1,u=-1;for(a++;a<o&&n>0;){let e=r.charCodeAt(a);e===40?n++:e===41?n--:e===44&&n===1&&(l===-1?l=a:u===-1&&(u=a)),a++}let d=a-1;t===`translate`||t===`translate3d`?(l===-1?i.translateX=r.substring(c,d).trim():(i.translateX=r.substring(c,l).trim(),u===-1?i.translateY=r.substring(l+1,d).trim():(i.translateY=r.substring(l+1,u).trim(),i.translateZ=r.substring(u+1,d).trim())),s=r.substring(c,d)):t===`scale`||t===`scale3d`?l===-1?i.scale=r.substring(c,d).trim():(i.scaleX=r.substring(c,l).trim(),u===-1?i.scaleY=r.substring(l+1,d).trim():(i.scaleY=r.substring(l+1,u).trim(),i.scaleZ=r.substring(u+1,d).trim())):i[t]=r.substring(c,d)}if(t===`translate3d`&&s)return n&&(n[t]=s),s;let c=i[t];if(!G(c))return n&&(n[t]=c),c}return t===`translate3d`?`0px, 0px, 0px`:t===`rotate3d`?`0, 0, 0, 0deg`:Ad(t,`scale`)?`1`:Ad(t,`rotate`)||Ad(t,`skew`)?`0deg`:`0px`},df=e=>{let t=``;for(let n=0,r=fd.length;n<r;n++){let r=fd[n],i=e[r];if(i!==void 0){if(r===`translateX`){let r=e.translateY;if(r!==void 0){let a=e.translateZ;a===void 0?(t+=`translate(${i},${r}) `,n+=1):(t+=`translate3d(${i},${r},${a}) `,n+=2);continue}}if(r===`scaleX`&&e.scale===void 0){let r=e.scaleY;if(r!==void 0){let a=e.scaleZ;a===void 0?(t+=`scale(${i},${r}) `,n+=1):(t+=`scale3d(${i},${r},${a}) `,n+=2);continue}}t+=`${pd[r]}${i}) `}r===`rotateZ`&&e.rotate3d!==void 0&&(t+=`rotate3d(${e.rotate3d}) `)}return e.matrix!==void 0&&(t+=`matrix(${e.matrix}) `),e.matrix3d!==void 0&&(t+=`matrix3d(${e.matrix3d}) `),t},ff=[];function pf(e,t){if(!e)return null;let n=ff.length;outer:for(let r=0;r<n;r++){let n=ff[r];if(n.detect&&!n.detect(e))continue;let i=n.targetAdapters;for(let n=0,r=i.length;n<r;n++){let r=i[n];if(r.detect(e)){let n=r.props[t];if(n&&(!n.gate||n.gate(e)))return n;break outer}}}for(let r=0;r<n;r++){let n=ff[r];if(n.detect&&!n.detect(e))continue;let i=n.propertyResolvers;for(let n=0,r=i.length;n<r;n++){let r=i[n](e,t);if(r)return r}}return null}var mf=e=>{let t=vd.exec(e)||yd.exec(e),n=G(t[4])?1:+t[4];return[+t[1],+t[2],+t[3],n]},hf=e=>{let t=e.length,n=t===4||t===5;return[+(`0x`+e[1]+e[n?1:2]),+(`0x`+e[n?2:3]+e[n?2:4]),+(`0x`+e[n?3:5]+e[n?3:6]),t===5||t===9?+((`0x`+e[n?4:7]+e[n?4:8])/255).toFixed(3):1]},gf=(e,t,n)=>(n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e),_f=e=>{let t=bd.exec(e)||xd.exec(e),n=t[1]/360,r=t[2]/100,i=t[3]/100,a=G(t[4])?1:+t[4],o,s,c;if(r===0)o=s=c=i;else{let e=i<.5?i*(1+r):i+r-i*r,t=2*i-e;o=K(gf(t,e,n+1/3)*255,0),s=K(gf(t,e,n)*255,0),c=K(gf(t,e,n-1/3)*255,0)}return[o,s,c,a]},vf=e=>Bd(e)?mf(e):zd(e)?hf(e):Vd(e)?_f(e):[0,0,0,1],Y=(e,t)=>G(e)?t:e,yf=(e,t)=>{let n=e.match(Td),r=t[id]?t:document.documentElement,i=getComputedStyle(r)?.getPropertyValue(n[1]);return(!i||i.trim()===``)&&n[2]&&(i=n[2].trim()),i||0},bf=(e,t,n,r,i,a)=>{if(Id(e)){if(!i){let i=e(t,n,r,a);return isNaN(+i)?i||0:+i}let o=()=>{let i=e(t,n,r,a);return isNaN(+i)?i||0:+i};return i.func=o,o()}if(Fd(e)&&Ad(e,`var(`)){if(!i)return yf(e,t);let n=()=>yf(e,t);return i.func=n,n()}return e},xf=(e,t)=>e[id]?e[ad]&&Gd(e,t)?V.ATTRIBUTE:fd.includes(t)||dd.get(t)?V.TRANSFORM:Ad(t,`--`)?V.CSS_VAR:t in e.style?V.CSS:t in e?V.OBJECT:V.ATTRIBUTE:V.OBJECT,Sf=(e,t,n)=>{let r=e.style[t];r&&n&&(n[t]=r);let i=r||getComputedStyle(e[sd]||e).getPropertyValue(t);return i===`auto`?`0`:i},Cf=(e,t,n,r)=>{let i=G(n)?xf(e,t):n,a=pf(e,t);if(a){let n=a.get(e);return n&&r&&(r[t]=n),n??0}if(i===V.OBJECT){let n=e[t];return n&&r&&(r[t]=n),n||0}if(i===V.ATTRIBUTE){let n=e.getAttribute(t);return n&&r&&(r[t]=n),n}return i===V.TRANSFORM?uf(e,t,r):i===V.CSS_VAR?Sf(e,t,r).trimStart():Sf(e,t,r)},wf=(e,t,n)=>n===`-`?e-t:n===`+`?e+t:e*t,Tf=()=>({t:H.NUMBER,n:0,u:null,o:null,d:null,s:null}),Ef=(e,t)=>{if(t.t=H.NUMBER,t.n=0,t.u=null,t.o=null,t.d=null,t.s=null,!e)return t;let n=+e;if(!isNaN(n))return t.n=n,t;let r=e;r[1]===`=`&&(t.o=r[0],r=r.slice(2));let i=!r.includes(` `)&&Cd.exec(r);if(i)return t.t=H.UNIT,t.n=+i[1],t.u=i[2],t;if(t.o)return t.n=+r,t;if(Hd(r))return t.t=H.COLOR,t.d=vf(r),t;{let e=r.match(Sd);return t.t=H.COMPLEX,t.d=e?e.map(Number):[],t.s=r.split(Sd)||[],t}},Df=(e,t)=>(t.t=e._valueType,t.n=e._toNumber,t.u=e._unit,t.o=null,t.d=q(e._toNumbers),t.s=q(e._strings),t),Of=Tf(),kf=(e,t,n)=>{let r=e._modifier,i=e._fromNumbers,a=e._toNumbers,o=e._strings,s=o[0];for(let c=0,l=a.length;c<l;c++){let l=r(K(rf(i[c],a[c],t),n)),u=o[c+1];s+=`${u?l+u:l}`,e._numbers[c]=l}return s},Af=(e,t,n,r,i)=>{let a=e.parent,o=e.duration,s=e.completed,c=e.iterationDuration,l=e.iterationCount,u=e._currentIteration,d=e._loopDelay,f=e._reversed,p=e._alternate,m=e._hasChildren,h=e._delay,g=e._currentTime,_=h+c,v=t-h,y=nf(g,-h,o),b=nf(v,-h,o),x=v-g,S=b>0,C=b>=o,w=o<=U,ee=i===td.FORCE,te=0,T=v,ne=0;if(l>1){let t=c+(C?0:d),n=~~(b/t);e._currentIteration=nf(n,0,l),C&&e._currentIteration--,te=e._currentIteration%2,T=b-n*t||0}let re=f^(p&&te),ie=e._ease,E=C?re?0:o:re?c-T:T;ie&&(E=c*ie(E/c)||0);let ae=(a?a.backwards:v<g)?!re:!!re;if(e._currentTime=v,e._iterationTime=E,e.backwards=ae,S&&!e.began?(e.began=!0,!n&&(!a||!ae&&a.began)&&e.onBegin(e)):v<=0&&(e.began=!1),!n&&!m&&S&&e._currentIteration!==u&&e.onLoop(e),ee||i===td.AUTO&&(t>=(a&&h>0?0:h)&&t<=_||t<=h&&y>h||t>=_&&y!==o)||E>=_&&y!==o||E<=h&&y>0&&!C||t<=y&&y===o&&s||C&&!s&&w){if(S&&(e.computeDeltaTime(y),n||e.onBeforeUpdate(e)),!m){let t=ee||(ae?x*-1:x)>=W.tickThreshold,i=K(e._offset+(a?a._offset:0)+h+E,12),o=e._head,s,c,l,u,d=0;for(;o;){let e=o._composition,n=o._currentTime,a=o._changeDuration,f=o._absoluteStartTime+o._changeDuration,p=o._nextRep,m=o._prevRep,h=e!==nd.none,g=m?m._absoluteStartTime+m._changeDuration:0,_=m&&m.parent!==o.parent,v=!p||p._isOverridden?f:p.parent===o.parent?f+p._delay:p._absoluteStartTime<p._absoluteUpdateStartTime?p._absoluteStartTime:p._absoluteUpdateStartTime;if((t||(n!==a||i<=v||m&&!_&&(!p||p.parent!==o.parent))&&(n!==0||i>=o._absoluteStartTime||_&&!o._hasFromValue&&!m._isOverridden&&i>=g||p&&!p._isOverridden&&p.parent===o.parent&&p._currentTime!==0&&E<p._startTime))&&(!m||_||E>=o._startTime)&&(!h||!o._isOverridden&&(!o._isOverlapped||i<=f)&&(!p||p._isOverridden||i<=v)&&(!m||m._isOverridden||(_?i>=o._absoluteStartTime||!o._hasFromValue&&i>=g:i>=g+o._delay)))){let t=o._currentTime=nf(E-o._startTime,0,a),n=o._ease(t/o._updateDuration),i=o._modifier,f=o._valueType,p=o._tweenType,m=p===V.OBJECT,g=f===H.NUMBER,_=g&&m||n===0||n===1?-1:W.precision,v,y;if(g)v=y=i(K(rf(o._fromNumber,o._toNumber,n),_));else if(f===H.UNIT)y=i(K(rf(o._fromNumber,o._toNumber,n),_)),v=`${y}${o._unit}`;else if(f===H.COLOR){let e=o._numbers,t=o._fromNumbers,a=o._toNumbers,s=1-n,c=t[0],l=t[1],u=t[2],d=a[0],f=a[1],p=a[2];e[0]=i(Math.sqrt(c*c*s+d*d*n)),e[1]=i(Math.sqrt(l*l*s+f*f*n)),e[2]=i(Math.sqrt(u*u*s+p*p*n)),e[3]=i(rf(t[3],a[3],n)),(!o._setter||r)&&(v=`rgba(${K(e[0],0)},${K(e[1],0)},${K(e[2],0)},${e[3]})`)}else f===H.COMPLEX&&(v=kf(o,n,_));if(h&&(o._number=y),!r&&e!==nd.blend){let e=o.property;s=o.target,o._setter?o._setter(s,y,o):m?s[e]=v:p===V.ATTRIBUTE?s.setAttribute(e,v):(c=s.style,p===V.TRANSFORM?(s!==l&&(l=s,u=s[od]),u[e]=v,d=1):p===V.CSS?c[e]=v:p===V.CSS_VAR&&c.setProperty(e,v)),S&&(ne=1)}else o._value=v}else n&&m&&!_&&E<o._startTime&&(o._currentTime=0);d&&o._renderTransforms&&(c.transform=df(u),d=0),o=o._next}!n&&ne&&e.onRender(e)}!n&&S&&e.onUpdate(e)}return a&&w?!n&&(a.began&&!ae&&v>0&&!s||ae&&v<=1e-11&&s)&&(e.onComplete(e),e.completed=!ae):S&&C?l===1/0?e._startTime+=e.duration:e._currentIteration>=l-1&&(e.paused=!0,!s&&!m&&(e.completed=!0,!n&&(!a||!ae&&a.began)&&(e.onComplete(e),e._resolve(e)))):e.completed=!1,ne},jf=(e,t,n,r,i)=>{let a=e._currentIteration;if(Af(e,t,n,r,i),e._hasChildren){let o=e,s=o.backwards,c=r?t:o._iterationTime,l=jd(),u=0,d=!0;if(!r&&o._currentIteration!==a){let e=o.iterationDuration;J(o,t=>{if(!s)!t.completed&&!t.backwards&&t._currentTime<t.iterationDuration&&Af(t,e,n,1,td.FORCE),t.began=!1,t.completed=!1;else{let r=t.duration,i=t._offset+t._delay,a=i+r;!n&&r<=1e-11&&(!i||a===e)&&t.onComplete(t)}}),n||o.onLoop(o)}J(o,e=>{let t=K((c-e._offset)*e._speed,12);if(s&&t>e._delay+e.duration)return;let a=e._fps<o._fps?e.requestTick(l):i;u+=Af(e,t,n,r,a),!e.completed&&d&&(d=!1)},s),!n&&u&&o.onRender(o),(d||s)&&o._currentTime>=o.duration&&(o.paused=!0,o.completed||(o.completed=!0,n||(o.onComplete(o),o._resolve(o))))}},Mf={},Nf=(e,t,n)=>{if(n===V.TRANSFORM)return dd.get(e)||e;if(n===V.CSS||n===V.ATTRIBUTE&&Rd(t)&&e in t.style){let t=Mf[e];if(t)return t;{let t=e&&kd(e);return Mf[e]=t,t}}return e},Pf=(e,t=!1)=>{if(e._hasChildren)J(e,e=>Pf(e,t),!0);else{let n=e;n.pause(),J(n,e=>{let r=e.property,i=e.target,a=e._tweenType,o=e._inlineValue,s=Ld(o)||o===``;if(e._setter){if(!t&&!s){if(Ef(o,Of),Of.d){let t=Of.d,n=e._numbers;for(let e=0,r=t.length;e<r;e++)n[e]=t[e]}else e._number=Of.n;e._setter(e.target,e._number,e)}}else if(a===V.OBJECT)!t&&!s&&(i[r]=o);else if(i[id]){if(a===V.ATTRIBUTE)t||(s?i.removeAttribute(r):i.setAttribute(r,o));else{let t=i.style;if(a===V.TRANSFORM){let n=i[od];s?delete n[r]:n[r]=o,e._renderTransforms&&(Object.keys(n).length?t.transform=df(n):t.removeProperty(`transform`))}else s?t.removeProperty(kd(r)):t[r]=o}}i[id]&&n._tail===e&&n.targets.forEach(e=>{e.getAttribute&&e.getAttribute(`style`)===``&&e.removeAttribute(`style`)})})}return e},Ff=class{constructor(e=0){this.deltaTime=0,this._currentTime=e,this._lastTickTime=e,this._startTime=e,this._lastTime=e,this._frameDuration=ld/240,this._fps=240,this._speed=1,this._hasChildren=!1,this._head=null,this._tail=null}get fps(){return this._fps}set fps(e){let t=+e,n=t<1e-11?U:t,r=ld/n;n>Ed.frameRate&&(Ed.frameRate=n),this._fps=n,this._frameDuration=r}get speed(){return this._speed}set speed(e){let t=+e;this._speed=t<1e-11?U:t}requestTick(e){let t=this._frameDuration,n=e-this._lastTickTime,r=t*.25;return n+(r<4?r:4)<t?td.NONE:(this._lastTickTime=n>=t?e-n%t:e,td.AUTO)}computeDeltaTime(e){let t=e-this._lastTime;return this.deltaTime=t,this._lastTime=e,t}},If={animation:null,update:md},Lf=e=>{let t=If.animation;return t||(t={duration:U,computeDeltaTime:md,_offset:0,_delay:0,_head:null,_tail:null},If.animation=t,If.update=()=>{e.forEach(e=>{for(let t in e){let n=e[t],r=n._head;if(r){let e=r._valueType,t=e===H.COMPLEX||e===H.COLOR?q(r._fromNumbers):null,i=r._fromNumber,a=n._tail;for(;a&&a!==r;){if(t)for(let e=0,n=a._numbers.length;e<n;e++)t[e]+=a._numbers[e];else i+=a._number;a=a._prevAdd}r._toNumber=i,r._toNumbers=t}}}),Af(t,1,1,0,td.FORCE)}),t},Rf=Qu?requestAnimationFrame:setImmediate,zf=Qu?cancelAnimationFrame:clearImmediate,Bf=class extends Ff{constructor(e){super(e),this.useDefaultMainLoop=!0,this.pauseOnDocumentHidden=!0,this.defaults=Ed,this.paused=!0,this.reqId=0}update(){let e=this._currentTime=jd();if(this.requestTick(e)){this.computeDeltaTime(e);let t=this._speed,n=this._fps,r=this._head;for(;r;){let i=r._next;r.paused?(cf(this,r),this._hasChildren=!!this._tail,r._running=!1,r.completed&&!r._cancelled&&r.cancel()):jf(r,(e-r._startTime)*r._speed*t,0,0,r._fps<n?r.requestTick(e):td.AUTO),r=i}If.update()}}wake(){return this.useDefaultMainLoop&&!this.reqId&&(this.requestTick(jd()),this.reqId=Rf(Vf)),this}pause(){if(this.reqId)return this.paused=!0,Hf()}resume(){if(this.paused)return this.paused=!1,J(this,e=>e.resetTime()),this.wake()}get speed(){return this._speed*(W.timeScale===1?1:ld)}set speed(e){let t=e*W.timeScale;this._speed!==t&&(this._speed=t,J(this,e=>e.speed=e._speed))}get timeUnit(){return W.timeScale===1?`ms`:`s`}set timeUnit(e){let t=.001,n=e===`s`,r=n?t:1;if(W.timeScale!==r){W.timeScale=r,W.tickThreshold=200*r;let e=n?t:ld;this.defaults.duration*=e,this._speed*=e}}get precision(){return W.precision}set precision(e){W.precision=e}},X=(()=>{let e=new Bf(jd());return Qu&&(Od.engine=e,ed.addEventListener(`visibilitychange`,()=>{e.pauseOnDocumentHidden&&(ed.hidden?e.pause():e.resume())})),e})(),Vf=()=>{X._head?(X.reqId=Rf(Vf),X.update()):X.reqId=0},Hf=()=>(zf(X.reqId),X.reqId=0,X),Uf={_rep:new WeakMap,_add:new Map},Wf=(e,t,n=`_rep`)=>{let r=Uf[n],i=r.get(e);return i||(i={},r.set(e,i)),i[t]?i[t]:i[t]={_head:null,_tail:null}},Gf=(e,t)=>e._isOverridden||e._absoluteStartTime>t._absoluteStartTime,Kf=e=>{e._isOverlapped=1,e._isOverridden=1,e._changeDuration=U,e._currentTime=U},qf=(e,t)=>{let n=e._composition;if(n===nd.replace){let n=e._absoluteStartTime;lf(t,e,Gf,`_prevRep`,`_nextRep`);let r=e._prevRep;if(r){let t=r.parent,i=r._absoluteEndTime;if(e.parent.id!==t.id&&t.iterationCount>1&&i+(t.duration-t.iterationDuration)>n){Kf(r);let e=r._prevRep;for(;e&&e.parent.id===t.id;)Kf(e),e=e._prevRep}let a=e._absoluteUpdateStartTime;if(i>a){let e=r._startTime,t=K(a-(i-(e+r._updateDuration))-e,12);r._changeDuration=t,r._currentTime=t,r._isOverlapped=1,t<1e-11&&Kf(r)}let o=e.parent.parent;if(!o||o!==t.parent){let e=!0;if(J(t,t=>{t._isOverlapped||(e=!1)}),e){let e=t.parent;if(e){let n=!0;J(e,e=>{e!==t&&J(e,e=>{e._isOverlapped||(n=!1)})}),n&&e.cancel()}else t.cancel()}}}}else if(n===nd.blend){let t=Wf(e.target,e.property,`_add`),n=Lf(Uf._add),r=t._head;r||(r={...e},r._composition=nd.replace,r._updateDuration=U,r._startTime=0,r._numbers=q(e._fromNumbers),r._number=0,r._next=null,r._prev=null,lf(t,r),lf(n,r));let i=e._toNumber;if(e._fromNumber=r._fromNumber-i,e._toNumber=0,e._numbers=q(e._fromNumbers),e._number=0,r._fromNumber=i,e._toNumbers.length){let t=q(e._toNumbers);t.forEach((t,n)=>{e._fromNumbers[n]=r._fromNumbers[n]-t,e._toNumbers[n]=0}),r._fromNumbers=t}lf(t,e,null,`_prevAdd`,`_nextAdd`)}return e},Jf=e=>{let t=e._composition;if(t!==nd.none){let n=e.target,r=e.property,i=Uf._rep.get(n)[r];if(cf(i,e,`_prevRep`,`_nextRep`),t===nd.blend){let t=Uf._add,i=t.get(n);if(!i)return;let a=i[r],o=If.animation;cf(a,e,`_prevAdd`,`_nextAdd`);let s=a._head;if(s&&s===a._tail){cf(a,s,`_prevAdd`,`_nextAdd`),cf(o,s);let e=!0;for(let t in i)if(i[t]._head){e=!1;break}e&&t.delete(n)}}}return e},Yf=e=>(e.paused=!0,e.began=!1,e.completed=!1,e),Xf=e=>e._cancelled?(e._hasChildren?J(e,Xf):J(e,e=>{e._composition!==nd.none&&qf(e,Wf(e.target,e.property))}),e._cancelled=0,e):e,Zf=0,Qf=(e,t)=>e._priority>t._priority,$f=class extends Ff{constructor(e={},t=null,n=0){super(0),++Zf;let{id:r,delay:i,duration:a,reversed:o,alternate:s,loop:c,loopDelay:l,autoplay:u,frameRate:d,playbackRate:f,priority:p,onComplete:m,onLoop:h,onPause:g,onBegin:_,onBeforeUpdate:v,onUpdate:y}=e;Dd.current&&Dd.current.register(this);let b=t?0:X._lastTickTime,x=t?t.defaults:W.defaults,S=Id(i)||G(i)?x.delay:+i,C=Id(a)||G(a)?1/0:+a,w=Y(c,x.loop),ee=Y(l,x.loopDelay),te=w===!0||w===1/0||w<0?1/0:w+1,T=0;t?T=n:(X.reqId||X.requestTick(jd()),T=(X._lastTickTime-X._startTime)*W.timeScale),this.id=G(r)?Zf:r,this.parent=t,this.duration=af((C+ee)*te-ee)||1e-11,this.backwards=!1,this.paused=!0,this.began=!1,this.completed=!1,this.onBegin=_||x.onBegin,this.onBeforeUpdate=v||x.onBeforeUpdate,this.onUpdate=y||x.onUpdate,this.onLoop=h||x.onLoop,this.onPause=g||x.onPause,this.onComplete=m||x.onComplete,this.iterationDuration=C,this.iterationCount=te,this._autoplay=!t&&Y(u,x.autoplay),this._offset=T,this._delay=S,this._loopDelay=ee,this._iterationTime=0,this._currentIteration=0,this._resolve=md,this._running=!1,this._reversed=+Y(o,x.reversed),this._reverse=this._reversed,this._cancelled=0,this._alternate=Y(s,x.alternate),this._prev=null,this._next=null,this._lastTickTime=b,this._startTime=b,this._lastTime=b,this._fps=Y(d,x.frameRate),this._speed=Y(f,x.playbackRate),this._priority=+Y(p,1)}get cancelled(){return!!this._cancelled}set cancelled(e){e?this.cancel():this.reset(!0).play()}get currentTime(){return nf(K(this._currentTime,W.precision),-this._delay,this.duration)}set currentTime(e){let t=this.paused;this.pause().seek(+e),t||this.resume()}get iterationCurrentTime(){return nf(K(this._iterationTime,W.precision),0,this.iterationDuration)}set iterationCurrentTime(e){this.currentTime=this.iterationDuration*this._currentIteration+e}get progress(){return nf(K(this._currentTime/this.duration,10),0,1)}set progress(e){this.currentTime=this.duration*e}get iterationProgress(){return nf(K(this._iterationTime/this.iterationDuration,10),0,1)}set iterationProgress(e){let t=this.iterationDuration;this.currentTime=t*this._currentIteration+t*e}get currentIteration(){return this._currentIteration}set currentIteration(e){this.currentTime=this.iterationDuration*nf(+e,0,this.iterationCount-1)}get reversed(){return!!this._reversed}set reversed(e){e?this.reverse():this.play()}get speed(){return super.speed}set speed(e){super.speed=e,this.resetTime()}reset(e=!1){return Xf(this),this._reversed&&!this._reverse&&(this.reversed=!1),this._iterationTime=this.iterationDuration,jf(this,0,1,~~e,td.FORCE),Yf(this),this._hasChildren&&J(this,Yf),this}init(e=!1){this.fps=this._fps,this.speed=this._speed,!e&&this._hasChildren&&jf(this,this.duration,1,~~e,td.FORCE),this.reset(e);let t=this._autoplay;return t===!0?this.resume():t&&!G(t.linked)&&t.link(this),this}resetTime(){let e=1/(this._speed*X._speed);return this._startTime=jd()-(this._currentTime+this._delay)*e,this}pause(){return this.paused?this:(this.paused=!0,this.onPause(this),this)}resume(){return this.paused?(this.paused=!1,this.duration<=1e-11&&!this._hasChildren?jf(this,U,0,0,td.FORCE):(this._running||=(lf(X,this,Qf),X._hasChildren=!0,!0),this.resetTime(),this._startTime-=12,X.wake()),this):this}restart(){return this.reset().resume()}seek(e,t=0,n=0){Xf(this),this.completed=!1;let r=this.paused;return this.paused=!0,jf(this,e+this._delay,~~t,~~n,td.AUTO),r?this:this.resume()}alternate(){let e=this._reversed,t=this.iterationCount,n=this.iterationDuration,r=t===1/0?Qd(cd/n):t;return this._reversed=+(this._alternate&&!(r%2)?e:!e),t===1/0?this.iterationProgress=this._reversed?1-this.iterationProgress:this.iterationProgress:this.seek(n*r-this._currentTime),this.resetTime(),this}play(){return this._reversed&&this.alternate(),this.resume()}reverse(){return this._reversed||this.alternate(),this.resume()}cancel(){return this._hasChildren?J(this,e=>e.cancel(),!0):J(this,Jf),this._cancelled=1,this.pause()}stretch(e){let t=this.duration,n=of(e);if(t===n)return this;let r=e/t,i=e<=U;return this.duration=i?U:n,this.iterationDuration=i?U:of(this.iterationDuration*r),this._offset*=r,this._delay*=r,this._loopDelay*=r,this}revert(){jf(this,0,1,0,td.AUTO);let e=this._autoplay;return e&&e.linked&&e.linked===this&&e.revert(),this.cancel()}complete(e=0){return this.seek(this.duration,e).cancel()}then(e=md){let t=this.then,n=()=>{this.then=null,e(this),this.then=t,this._resolve=md};return new Promise(e=>(this._resolve=()=>e(n()),this.completed&&this._resolve(),this))}};function ep(e){let t=Fd(e)?Dd.root.querySelectorAll(e):e;if(t instanceof NodeList||t instanceof HTMLCollection)return t}function tp(e){if(Ld(e))return[];if(!Qu)return Md(e)&&e.flat(1/0)||[e];if(Md(e)){let t=e.flat(1/0),n=[];for(let e=0,r=t.length;e<r;e++){let r=t[e];if(!Ld(r)){let e=ep(r);if(e)for(let t=0,r=e.length;t<r;t++){let r=e[t];if(!Ld(r)){let e=!1;for(let t=0,i=n.length;t<i;t++)if(n[t]===r){e=!0;break}e||n.push(r)}}else{let e=!1;for(let t=0,i=n.length;t<i;t++)if(n[t]===r){e=!0;break}e||n.push(r)}}}return n}let t=ep(e);return t?Array.from(t):[e]}function np(e){let t=tp(e),n=t.length;for(let e=0;e<n;e++){let n=t[e];if(!n[rd]){n[rd]=!0;let e=Rd(n);(n.nodeType||e)&&(n[id]=!0,n[ad]=e,n[od]={})}}return t}var rp={deg:1,rad:180/ef,turn:360},ip={},ap=(e,t,n,r=!1)=>{let i=t.u,a=t.n;if(t.t===H.UNIT&&i===n)return t;let o=a+i+n,s=ip[o];if(!G(s)&&!r)t.n=s;else{let r;if(i in rp)r=a*rp[i]/rp[n];else{let t=e.cloneNode(),o=e.parentNode,s=o&&o!==ed?o:ed.body;s.appendChild(t);let c=t.style;c.width=100+i;let l=t.offsetWidth||100;c.width=100+n;let u=l/(t.offsetWidth||100);s.removeChild(t),r=u*a}t.n=r,ip[o]=r}return t.t,H.UNIT,t.u=n,t},op=e=>e,sp=(e=1.68)=>t=>Kd(t,+e),cp={in:e=>t=>e(t),out:e=>t=>1-e(1-t),inOut:e=>t=>t<.5?e(t*2)/2:1-e(t*-2+2)/2,outIn:e=>t=>t<.5?(1-e(1-t*2))/2:(e(t*2-1)+1)/2},lp=ef/2,up=ef*2,dp={"":sp,Quad:sp(2),Cubic:sp(3),Quart:sp(4),Quint:sp(5),Sine:e=>1-Yd(e*lp),Circ:e=>1-qd(1-e*e),Expo:e=>e?Kd(2,10*e-10):0,Bounce:e=>{let t,n=4;for(;e<((t=Kd(2,--n))-1)/11;);return 1/Kd(4,3-n)-7.5625*Kd((t*3-2)/22-e,2)},Back:(e=1.7)=>t=>(+e+1)*t*t*t-+e*t*t,Elastic:(e=1,t=.3)=>{let n=nf(+e,1,10),r=nf(+t,U,2),i=r/up*$d(1/n),a=up/r;return e=>e===0||e===1?e:-n*Kd(2,-10*(1-e))*Jd((1-e-i)*a)}},fp=(()=>{let e={linear:op,none:op};for(let t in cp)for(let n in dp){let r=dp[n],i=cp[t];e[t+n]=n===``||n===`Back`||n===`Elastic`?(e,t)=>i(r(e,t)):i(r)}return e})(),pp={linear:op,none:op},mp=e=>{if(pp[e])return pp[e];if(e.indexOf(`(`)<=-1){let t=cp[e]||e.includes(`Back`)||e.includes(`Elastic`)?fp[e]():fp[e];return t?pp[e]=t:op}{let t=e.slice(0,-1).split(`(`),n=fp[t[0]];return n?pp[e]=n(...t[1].split(`,`)):op}},hp=[`steps(`,`irregular(`,`linear(`,`cubicBezier(`],gp=e=>{if(Fd(e)){for(let t=0,n=hp.length;t<n;t++)if(Ad(e,hp[t]))return console.warn(`String syntax for \`ease: "${e}"\` has been removed from the core and replaced by importing and passing the easing function directly: \`ease: ${e}\``),op}return Id(e)?e:Fd(e)?mp(e):op},Z=Tf(),Q=Tf(),_p={},vp={func:null},yp={func:null},bp=[null],xp=[null,null],Sp={to:null},Cp=0,wp=0,Tp,Ep,Dp=(e,t)=>{let n={};if(Md(e)){let t=[].concat(...e.map(e=>Object.keys(e))).filter(Ud);for(let r=0,i=t.length;r<i;r++){let i=t[r];n[i]=e.map(e=>{let t={};for(let n in e){let r=e[n];Ud(n)?n===i&&(t.to=r):t[n]=r}return t})}}else{let r=Y(t.duration,W.defaults.duration);Object.keys(e).map(t=>({o:parseFloat(t)/100,p:e[t]})).sort((e,t)=>e.o-t.o).forEach(e=>{let t=e.o,i=e.p;for(let e in i)if(Ud(e)){let a=n[e];a||=n[e]=[];let o=t*r,s=a.length,c=a[s-1],l={to:i[e]},u=0;for(let e=0;e<s;e++)u+=a[e].duration;s===1&&(l.from=c.to),i.ease&&(l.ease=i.ease),l.duration=o-(s?u:0),a.push(l)}return e});for(let e in n){let t=n[e],r;for(let e=0,n=t.length;e<n;e++){let n=t[e],i=n.ease;n.ease=r||void 0,r=i}t[0].duration||t.shift()}}return n},Op=class extends $f{constructor(e,t,n,r,i=!1,a=0,o){super(t,n,r),this._head,this._tail,++wp;let s=np(e),c=s.length,l=t.keyframes,u=l?sf(Dp(l,t),t):t,{id:d,delay:f,duration:p,ease:m,playbackEase:h,modifier:g,composition:_,onRender:v}=u,y=n?n.defaults:W.defaults,b=Y(m,y.ease),x=Y(h,y.playbackEase),S=x?gp(x):null,C=!G(b.ease),w=C?b.ease:Y(m,S?`linear`:y.ease),ee=C?b.settlingDuration:Y(p,y.duration),te=Y(f,y.delay),T=g||y.modifier,ne=G(_)&&c>=1e3?nd.none:G(_)?y.composition:_,re=this._offset+(n?n._offset:0);C&&(b.parent=this);let ie=NaN,E=NaN,ae=0,oe=0;for(let e=0;e<c;e++){let t=s[e],r=a||e,c=o||s,l=NaN,d=NaN;for(let e in u)if(Ud(e)){let a=xf(t,e),o=pf(t,e),s=Nf(e,t,a),f=u[e],p=Md(f);if(i&&!p&&(xp[0]=f,xp[1]=f,f=xp),p){let e=f.length,t=!Nd(f[0]);e===2&&t?(Sp.to=f,bp[0]=Sp,Tp=bp):e>2&&t?(Tp=[],f.forEach((e,t)=>{t?t===1?(xp[1]=e,Tp.push(xp)):Tp.push(e):xp[0]=e})):Tp=f}else bp[0]=f,Tp=bp;let m=null,h=null,g=NaN,_=0,v=0;for(let e=Tp.length;v<e;v++){let i=Tp[v];Nd(i)?Ep=i:(Sp.to=i,Ep=Sp),vp.func=null,yp.func=null;let l=bf(Y(Ep.composition,ne),t,r,c,null,null),u=Pd(l)?l:nd[l];!m&&u!==nd.none&&(m=Wf(t,s));let d=m?m._tail:null,f=n&&d&&d.parent.parent===n?d:h,p=bf(Ep.to,t,r,c,vp,f),y;Nd(p)&&!G(p.to)?(Ep=p,y=p.to):y=p;let b=bf(Ep.from,t,r,c,yp,f),x=Ep.ease||w,S=bf(x,t,r,c,null,f),C=Id(S)||Fd(S)?S:x,ie=!G(C)&&!G(C.ease),E=ie?C.ease:C,se=ie?C.settlingDuration:bf(Y(Ep.duration,e>1?bf(ee,t,r,c,null,f)/e:ee),t,r,c,null,f),ce=bf(Y(Ep.delay,v?0:te),t,r,c,null,f),le=Ep.modifier||T,ue=!G(b),D=!G(y),O=Md(y),de=O||ue&&D,fe=h?_:0,pe=h?_+ce:ce,me=K(re+pe,12),he=K(re+fe,12);!oe&&(ue||O)&&(oe=1);let k=h;if(u!==nd.none){let e=m._head;for(;e&&e._absoluteStartTime<=me;)if(e._isOverridden||(k=e),e=e._nextRep,e&&e._absoluteStartTime>=me)for(;e;)Kf(e),e=e._nextRep}if(de){Ef(O?bf(y[0],t,r,c,yp,f):b,Z),Ef(O?bf(y[1],t,r,c,vp,f):y,Q);let e=Cf(t,s,a,_p);Z.t===H.NUMBER&&(k?k._valueType===H.UNIT&&(Z.t=H.UNIT,Z.u=k._unit):(Ef(e,Of),Of.t===H.UNIT&&(Z.t=H.UNIT,Z.u=Of.u)))}else D?Ef(y,Q):h?Df(h,Q):Ef(n&&k&&k.parent.parent===n?k._value:Cf(t,s,a,_p),Q),ue?Ef(b,Z):h?Df(h,Z):Ef(n&&k&&k.parent.parent===n?k._value:Cf(t,s,a,_p),Z);if(Z.o&&(Z.n=wf(k?k._toNumber:Ef(Cf(t,s,a,_p),Of).n,Z.n,Z.o)),Q.o&&(Q.n=wf(Z.n,Q.n,Q.o)),Z.t!==Q.t){if(Z.t===H.COMPLEX||Q.t===H.COMPLEX){let e=Z.t===H.COMPLEX?Z:Q,t=Z.t===H.COMPLEX?Q:Z;t.t=H.COMPLEX,t.s=q(e.s),t.d=e.d.map(()=>t.n)}else if(Z.t===H.UNIT||Q.t===H.UNIT){let e=Z.t===H.UNIT?Z:Q,t=Z.t===H.UNIT?Q:Z;t.t=H.UNIT,t.u=e.u}else if(Z.t===H.COLOR||Q.t===H.COLOR){let e=Z.t===H.COLOR?Z:Q,t=Z.t===H.COLOR?Q:Z;t.t=H.COLOR,t.d=e.d.map(()=>0)}}if(Z.u!==Q.u){let e=Q.u?Z:Q;e=ap(t,e,Q.u?Q.u:Z.u,!1)}if(Q.d&&Z.d&&Q.d.length!==Z.d.length){let e=Z.d.length>Q.d.length?Z:Q,t=e===Z?Q:Z;t.d=e.d.map((e,n)=>G(t.d[n])?0:t.d[n]),t.s=q(e.s)}let ge=K(+se||1e-11,12),_e=_p[s];Ld(_e)||(_p[s]=null);let ve=o?o.set:null;_=K(pe+ge,12);let ye=Z.d,be=Q.d,xe=Q.s,A={parent:this,id:Cp++,property:s,target:t,_value:null,_toFunc:vp.func,_fromFunc:yp.func,_ease:gp(E),_fromNumbers:ye?q(ye):ud,_toNumbers:be?q(be):ud,_strings:xe?q(xe):ud,_fromNumber:Z.n,_toNumber:Q.n,_numbers:ye?q(ye):ud,_number:Z.n,_unit:Q.u,_modifier:le,_currentTime:0,_startTime:pe,_delay:+ce,_updateDuration:ge,_changeDuration:ge,_absoluteStartTime:me,_absoluteUpdateStartTime:he,_absoluteEndTime:K(re+_,12),_hasFromValue:ue||O?1:0,_tweenType:a,_setter:ve,_valueType:Q.t,_composition:u,_isOverlapped:0,_isOverridden:0,_renderTransforms:0,_inlineValue:_e,_prevRep:null,_nextRep:null,_prevAdd:null,_nextAdd:null,_prev:null,_next:null};u!==nd.none&&qf(A,m);let Se=A._valueType;if(Se===H.COMPLEX)A._value=kf(A,1,-1);else if(Se===H.UNIT)A._value=`${le(A._toNumber)}${A._unit}`;else if(Se===H.COLOR){let e=Q.d;A._value=`rgba(${K(e[0],0)},${K(e[1],0)},${K(e[2],0)},${e[3]})`}else A._value=le(A._toNumber);isNaN(g)&&(g=A._startTime),h=A,ae++,lf(this,A)}(isNaN(E)||g<E)&&(E=g),(isNaN(ie)||_>ie)&&(ie=_),a===V.TRANSFORM&&(l=ae-v,d=ae)}if(!isNaN(l)){let e=0;J(this,t=>{e>=l&&e<d&&(t._renderTransforms=1,t._composition===nd.blend&&J(If.animation,e=>{e.id===t.id&&(e._renderTransforms=1)})),e++})}}c||console.warn(`No target found. Make sure the element you're trying to animate is accessible before creating your animation.`),E?(J(this,e=>{e._startTime-e._delay||(e._delay-=E),e._startTime-=E}),ie-=E):E=0,ie||(ie=U,this.iterationCount=0),this.targets=s,this.id=G(d)?wp:d,this.duration=ie===1e-11?U:af((ie+this._loopDelay)*this.iterationCount-this._loopDelay)||1e-11,this.onRender=v||y.onRender,this._ease=S,this._delay=E,this.iterationDuration=ie,!this._autoplay&&oe&&this.onRender(this)}stretch(e){let t=this.duration;if(t===of(e))return this;let n=e/t;return J(this,e=>{e._updateDuration=of(e._updateDuration*n),e._changeDuration=of(e._changeDuration*n),e._currentTime*=n,e._delay*=n,e._startTime*=n,e._absoluteStartTime*=n,e._absoluteUpdateStartTime*=n,e._absoluteEndTime*=n}),super.stretch(e)}refresh(){return J(this,e=>{let t=e._toFunc,n=e._fromFunc;(t||n)&&(n?(Ef(n(),Z),Z.u!==e._unit&&e.target[id]&&ap(e.target,Z,e._unit,!0),e._fromNumbers=q(Z.d),e._fromNumber=Z.n):t&&(Ef(Cf(e.target,e.property,e._tweenType),Of),e._fromNumbers=q(Of.d),e._fromNumber=Of.n),t&&(Ef(t(),Q),e._toNumbers=q(Q.d),e._strings=q(Q.s),e._toNumber=Q.o?wf(e._fromNumber,Q.n,Q.o):Q.n))}),this.duration===1e-11&&this.restart(),this}revert(){return super.revert(),Pf(this)}then(e){return super.then(e)}},kp=(e,t)=>W.editor?W.editor.addAnimation(e,t):new Op(e,t,null,0,!1).init(),Ap={instant:80,quick:160,row:180,carry:240,panel:280,staggerTight:14,staggerRow:26,staggerLoose:40,sequence:860},jp={arriving:`out(3)`,born:`outBack(1.6)`,panel:`cubicBezier(0.22, 1, 0.36, 1)`},Mp={arriving:`cubic-bezier(0.22, 0.61, 0.36, 1)`,panel:`cubic-bezier(0.22, 1, 0.36, 1)`},Np={landing:{stiffness:190,damping:17},indicator:{stiffness:240,damping:26},cardTravel:{stiffness:210,damping:24},drawer:{stiffness:210,damping:22},sheet:{stiffness:200,damping:21}};function Pp(e,t){return Math.min(e,7)*t}var Fp=`(prefers-reduced-motion: reduce)`;function Ip(e=a){return e.matchesMediaQuery(Fp)}function Lp(){X.pauseOnDocumentHidden=!1,X.resume()}var Rp=i((e,t)=>{let n=null;return{spawnedChatId:null,markSpawned:(r,i=C)=>{n!==null&&i.clearTimeout(n),e({spawnedChatId:r}),n=i.setTimeout(()=>{n=null,t().clearSpawned(r)},Ap.sequence)},clearSpawned:n=>{t().spawnedChatId===n&&e({spawnedChatId:null})}}});function zp(e){return t=>e!==null&&t.spawnedChatId===e}function Bp(e){return e.spawnedChatId!==null}var Vp={sm:.875,md:1,lg:1.125,xl:1.25,xxl:1.5};function Hp(e){return typeof e==`string`&&Object.hasOwn(Vp,e)}function Up(e){return typeof e!=`string`||!Hp(e)?Vp.md:Vp[e]}function Wp(e,t){return Hp(e)?e:Hp(t)?t:`md`}function Gp(e){let t=e&&Hp(e.scale)?e.scale:`md`;return{"--kanna-font-scale":String(Vp[t])}}function Kp(e){return Number.isFinite(e)?Math.max(1,Math.round(e)):1}function qp(e){let t=e.trim().slice(0,512);return!t||!/^https?:\/\/\S+$/.test(t)?null:t.replace(/\/+$/,``)}var Jp=8e3,Yp={idleTimeoutMs:6e5,maxConcurrent:4},Xp=6e4,Zp=36e5;({...Yp});var Qp={toggleEmbeddedTerminal:[`cmd+j`,"ctrl+`"],toggleRightSidebar:[`cmd+b`,`ctrl+b`],openInFinder:[`cmd+alt+f`,`ctrl+alt+f`],openInEditor:[`cmd+shift+o`,`ctrl+shift+o`],addSplitTerminal:[`cmd+/`,`ctrl+/`],jumpToSidebarChat:[`cmd+alt`],openProjectSwitcher:[`cmd+k`,`ctrl+k`],openTabSwitcher:["alt+`"],jumpToPaneTab:[`cmd+ctrl`,`ctrl+alt`],createChatInCurrentProject:[`cmd+alt+n`],openAddProject:[`cmd+alt+o`],newStack:[`cmd+alt+w`],newStackChat:[`cmd+alt+shift+n`],jumpToStacks:[`g s`],focusPaneLeft:[`cmd+ctrl+arrowleft`,`ctrl+alt+arrowleft`],focusPaneRight:[`cmd+ctrl+arrowright`,`ctrl+alt+arrowright`],focusPaneUp:[`cmd+ctrl+arrowup`,`ctrl+alt+arrowup`],focusPaneDown:[`cmd+ctrl+arrowdown`,`ctrl+alt+arrowdown`],splitPaneRight:[`cmd+ctrl+d`,`ctrl+alt+d`],splitPaneDown:[`cmd+ctrl+e`,`ctrl+alt+e`],closePaneTab:[`cmd+ctrl+w`,`ctrl+alt+q`],nextPaneTab:[`cmd+ctrl+j`,`ctrl+alt+j`],previousPaneTab:[`cmd+ctrl+k`,`ctrl+alt+k`],resizePaneLeft:[`cmd+ctrl+shift+arrowleft`,`ctrl+alt+shift+arrowleft`],resizePaneRight:[`cmd+ctrl+shift+arrowright`,`ctrl+alt+shift+arrowright`],resizePaneUp:[`cmd+ctrl+shift+arrowup`,`ctrl+alt+shift+arrowup`],resizePaneDown:[`cmd+ctrl+shift+arrowdown`,`ctrl+alt+shift+arrowdown`]},$p=`toggleEmbeddedTerminal.toggleRightSidebar.openInFinder.openInEditor.addSplitTerminal.jumpToSidebarChat.openProjectSwitcher.openTabSwitcher.jumpToPaneTab.createChatInCurrentProject.openAddProject.newStack.newStackChat.jumpToStacks.focusPaneLeft.focusPaneRight.focusPaneUp.focusPaneDown.splitPaneRight.splitPaneDown.closePaneTab.nextPaneTab.previousPaneTab.resizePaneLeft.resizePaneRight.resizePaneUp.resizePaneDown`.split(`.`);function em(e){return e===`cursor`||e===`vscode`||e===`xcode`||e===`windsurf`||e===`custom`}function tm(e){return e===`never`||e===`unfocused`||e===`always`}function nm(e){return e===`blow`||e===`bottle`||e===`frog`||e===`funk`||e===`glass`||e===`ping`||e===`pop`||e===`purr`||e===`tink`}function rm(e){return e===`openai`||e===`openrouter`||e===`custom`}var im=`moonshotai/kimi-k2.5:nitro`,am=[{id:`low`,label:`Low`},{id:`medium`,label:`Medium`},{id:`high`,label:`High`},{id:`xhigh`,label:`XHigh`},{id:`max`,label:`Max`}],om=[{id:`minimal`,label:`Minimal`},{id:`low`,label:`Low`},{id:`medium`,label:`Medium`},{id:`high`,label:`High`},{id:`xhigh`,label:`XHigh`}],sm={reasoningEffort:`high`,contextWindow:`200k`},cm={reasoningEffort:`high`,fastMode:!1};function lm(e){return am.some(t=>t.id===e)}function um(e){return om.some(t=>t.id===e)}var dm=[{id:`200k`,label:`200k`},{id:`1m`,label:`1M`}];function fm(e){return dm.some(t=>t.id===e)}var pm=[`low`,`medium`,`high`,`xhigh`,`max`],mm=[{id:`claude`,label:`Claude`,defaultModel:`claude-sonnet-4-6`,defaultEffort:`high`,supportsPlanMode:!0,models:[{id:`claude-fable-5`,label:`Fable 5`,supportedEfforts:pm,aliases:[`fable`],contextWindowOptions:[...dm]},{id:`claude-opus-5`,label:`Opus 5`,supportedEfforts:pm,aliases:[`opus-5`],contextWindowOptions:[...dm]},{id:`claude-sonnet-5`,label:`Sonnet 5`,supportedEfforts:pm,aliases:[`sonnet-5`],contextWindowOptions:[...dm]},{id:`claude-opus-4-8`,label:`Opus 4.8`,supportedEfforts:pm,aliases:[`opus-4-8`],contextWindowOptions:[...dm]},{id:`claude-opus-4-7`,label:`Opus 4.7`,supportedEfforts:pm,aliases:[`opus`],contextWindowOptions:[...dm]},{id:`claude-sonnet-4-6`,label:`Sonnet 4.6`,supportedEfforts:[`low`,`medium`,`high`,`max`],aliases:[`sonnet`],contextWindowOptions:[...dm]},{id:`claude-haiku-4-5-20251001`,label:`Haiku 4.5`,supportedEfforts:[`low`,`medium`,`high`],aliases:[`haiku`]}],efforts:[...am]},{id:`codex`,label:`Codex`,defaultModel:`gpt-5.5`,supportsPlanMode:!0,models:[{id:`gpt-5.5`,label:`GPT-5.5`},{id:`gpt-5.4`,label:`GPT-5.4`},{id:`gpt-5.3-codex`,label:`GPT-5.3 Codex`,aliases:[`gpt-5-codex`]},{id:`gpt-5.3-codex-spark`,label:`GPT-5.3 Codex Spark`}],efforts:[]},{id:`openrouter`,label:`OpenRouter`,defaultModel:im,supportsPlanMode:!0,models:[],efforts:[]},{id:`custom`,label:`Custom endpoints`,defaultModel:``,supportsPlanMode:!0,models:[],efforts:[]}];function hm(e){let t=mm.find(t=>t.id===e);if(!t)throw Error(`Unknown provider: ${e}`);return t}function gm(e){return{id:e.id,label:e.label,...e.supportedEfforts?{supportedEfforts:e.supportedEfforts}:{},...e.aliases?{aliases:e.aliases}:{},...e.contextWindowOptions?{contextWindowOptions:e.contextWindowOptions}:{}}}function _m(e,t){return e.map(e=>{if(e.id!==`claude`&&e.id!==`codex`)return{...e,models:[...e.models]};let n=t.filter(t=>t.provider===e.id);if(n.length===0)return{...e,models:[...e.models]};let r=n.map(t=>{let n=gm(t),r=e.models.find(e=>e.id===n.id);return r?{...r,...n}:n}),i=r.some(t=>t.id===e.defaultModel)?e.defaultModel:r[0]?.id??e.defaultModel;return{...e,defaultModel:i,models:r}})}function vm(e){return e===`openrouter`||e===`custom`}function ym(e,t){let n=hm(e);if(!t||t.length===0)return n;let[r]=_m([{...n,models:[...n.models]}],t);return r??n}function bm(e,t){return ym(e,t).models}function xm(e,t,n){if(!t)return;let r=bm(e,n);return r.find(e=>e.id===t)??r.find(e=>e.aliases?.includes(t))}function Sm(e,t,n,r){let i=xm(e,t,r);if(i)return i.id;let a=ym(e,r),o=n??a.defaultModel;return!(r?.some(t=>t.provider===e)??!1)||a.models.some(e=>e.id===o)?o:a.defaultModel}function Cm(e,t=`claude-opus-4-7`,n){return Sm(`claude`,e,t,n)}function wm(e,t=`gpt-5.5`,n){return Sm(`codex`,e,t,n)}function Tm(e,t,n){let r=Sm(e,t,void 0,n);return bm(e,n).find(e=>e.id===r)}function Em(e,t){return Tm(`claude`,e,t)}function Dm(e,t){let n=Em(e,t)?.supportedEfforts;return!n||n.length===0?[]:am.filter(e=>n.includes(e.id))}function Om(e,t,n){let r=Em(e,n)?.supportedEfforts;if(!r||r.length===0||r.includes(t))return t;for(let e of[`max`,`xhigh`,`high`,`medium`,`low`])if(r.includes(e))return e;return sm.reasoningEffort}function km(e,t){return Em(e,t)?.contextWindowOptions??[]}function Am(e,t,n){let r=km(e,n);return r.length===0?sm.contextWindow:fm(t)&&r.some(e=>e.id===t)?t:sm.contextWindow}function jm(e,t,n){return n||(mm.find(t=>t.id===e)?.models.find(e=>e.id===t)?.contextWindowOptions??[])}function Mm(e){switch(e){case`1m`:return 1e6;default:return 2e5}}function Nm(e){return e===`claude`||e===`codex`||e===`openrouter`||e===`custom`}var Pm={toggleEmbeddedTerminal:`Toggle Embedded Terminal`,toggleRightSidebar:`Toggle Right Sidebar`,openInFinder:`Open In Finder`,openInEditor:`Open In Editor`,addSplitTerminal:`Add Split Terminal`,jumpToSidebarChat:`Jump To Sidebar Chat`,openProjectSwitcher:`Open Project Switcher`,openTabSwitcher:`Switch To Recent Tab`,jumpToPaneTab:`Jump To Tab By Number`,createChatInCurrentProject:`New Chat In Current Project`,openAddProject:`Open Add Project`,newStack:`New Stack`,newStackChat:`New Stack Chat`,jumpToStacks:`Jump To Stacks`,focusPaneLeft:`Focus Pane Left`,focusPaneRight:`Focus Pane Right`,focusPaneUp:`Focus Pane Up`,focusPaneDown:`Focus Pane Down`,splitPaneRight:`Split Pane Right`,splitPaneDown:`Split Pane Down`,closePaneTab:`Close Tab`,nextPaneTab:`Next Tab`,previousPaneTab:`Previous Tab`,resizePaneLeft:`Resize Pane Left`,resizePaneRight:`Resize Pane Right`,resizePaneUp:`Resize Pane Up`,resizePaneDown:`Resize Pane Down`};function Fm(e){return(e??[]).join(`, `)}function Im(e){return e.split(`,`).map(e=>e.trim()).map(e=>e.toLowerCase()).filter(Boolean)}var Lm=new Map([[`cmd`,`meta`],[`meta`,`meta`],[`ctrl`,`ctrl`],[`control`,`ctrl`],[`alt`,`alt`],[`option`,`alt`],[`shift`,`shift`]]);function Rm(e,t){let n=eh(e);return n?th(t,n.key)&&t.ctrlKey===n.ctrl&&t.metaKey===n.meta&&t.altKey===n.alt&&t.shiftKey===n.shift:!1}function zm(e,t,n){return Vm(e,t).some(e=>Rm(e,n))}function Bm(e,t,n){return Vm(e,t).find(e=>Rm(e,n))??null}function Vm(e,t){return e?.bindings[t]??Qp[t]}function Hm(e){return Object.hasOwn(Qp,e)}function Um(){return Object.keys(Qp).filter(Hm)}function Wm(e){let t={...Qp};for(let n of Um())t[n]=e?.bindings[n]??Qp[n];return{bindings:t,warning:e?.warning??null,filePathDisplay:e?.filePathDisplay??``}}function Gm(e,t){let n=$m(e);return t.metaKey===n.meta&&t.altKey===n.alt&&t.ctrlKey===n.ctrl&&t.shiftKey===n.shift}function Km(e,t){let n=eh(e);return n?th(t,n.key)&&t.ctrlKey===n.ctrl&&t.metaKey===n.meta&&t.altKey===n.alt&&(!n.shift||t.shiftKey):!1}function qm(e,t){let n=$m(e),r=[[n.meta,t.metaKey],[n.ctrl,t.ctrlKey],[n.alt,t.altKey]].filter(([e])=>e);return r.length!==0&&r.some(([,e])=>!e)}function Jm(e,t){let n=e=>$m(e).meta;return e.find(e=>n(e)===t)??(t?e[0]:void 0)??null}var Ym={meta:`⌘`,ctrl:`⌃`,alt:`⌥`,shift:`⇧`},Xm={meta:`Win`,ctrl:`Ctrl`,alt:`Alt`,shift:`Shift`},Zm={arrowleft:`←`,arrowright:`→`,arrowup:`↑`,arrowdown:`↓`,enter:`↵`,escape:`Esc`,tab:`Tab`};function Qm(e,t){let n=t?Ym:Xm;return e.split(`+`).map(e=>e.trim().toLowerCase()).filter(Boolean).map(e=>{let t=Lm.get(e);return t===`ctrl`||t===`meta`||t===`alt`||t===`shift`?n[t]:Zm[e]??(e.length===1?e.toUpperCase():e)})}function $m(e){let t={ctrl:!1,meta:!1,alt:!1,shift:!1};for(let n of e.split(`+`)){let e=Lm.get(n.trim().toLowerCase());(e===`ctrl`||e===`meta`||e===`alt`||e===`shift`)&&(t[e]=!0)}return t}function eh(e){let t=e.split(`+`).map(e=>e.trim()).filter(Boolean);if(t.length===0)return null;let n={key:``,ctrl:!1,meta:!1,alt:!1,shift:!1};for(let e of t){let t=e.toLowerCase(),r=Lm.get(t);if(r===`ctrl`){n.ctrl=!0;continue}if(r===`meta`){n.meta=!0;continue}if(r===`alt`){n.alt=!0;continue}if(r===`shift`){n.shift=!0;continue}if(n.key)return null;n.key=t}return n.key?n:null}function th(e,t){if(e.key.toLowerCase()===t)return!0;let n=nh(t);return n?e.code===n:!1}function nh(e){if(e.length===1&&e>=`a`&&e<=`z`)return`Key${e.toUpperCase()}`;if(e.length===1&&e>=`0`&&e<=`9`)return`Digit${e}`;switch(e){case`/`:return`Slash`;case"`":return`Backquote`;default:return null}}var rh=[],ih=i()(e=>({rows:rh,setRows:t=>e({rows:t.length>0?t:rh})})),ah=e=>e.rows,oh=e=>t=>t.rows.find(t=>t.id===e)??null;function sh(e,t){let n;try{n=e()}catch{return}return{getItem:e=>{let r=e=>e===null?null:JSON.parse(e,t?.reviver),i=n.getItem(e)??null;return i instanceof Promise?i.then(r):r(i)},setItem:(e,r)=>n.setItem(e,JSON.stringify(r,t?.replacer)),removeItem:e=>n.removeItem(e)}}var ch=e=>t=>{try{let n=e(t);return n instanceof Promise?n:{then(e){return ch(e)(n)},catch(e){return this}}}catch(e){return{then(e){return this},catch(t){return ch(t)(e)}}}},lh=(e,t)=>(n,r,i)=>{let a={storage:sh(()=>window.localStorage),partialize:e=>e,version:0,merge:(e,t)=>({...t,...e}),...t},o=!1,s=0,c=new Set,l=new Set,u=a.storage;if(!u)return e((...e)=>{console.warn(`[zustand persist middleware] Unable to update item '${a.name}', the given storage is currently unavailable.`),n(...e)},r,i);let d=()=>{let e=a.partialize({...r()});return u.setItem(a.name,{state:e,version:a.version})},f=i.setState;i.setState=(e,t)=>(f(e,t),d());let p=e((...e)=>(n(...e),d()),r,i);i.getInitialState=()=>p;let m,h=()=>{if(!u)return;let e=++s;o=!1,c.forEach(e=>e(r()??p));let t=a.onRehydrateStorage?.call(a,r()??p)||void 0;return ch(u.getItem.bind(u))(a.name).then(e=>{if(e){if(typeof e.version==`number`&&e.version!==a.version){if(a.migrate){let t=a.migrate(e.state,e.version);return t instanceof Promise?t.then(e=>[!0,e]):[!0,t]}console.error(`State loaded from storage couldn't be migrated since no migrate function was provided`)}else return[!1,e.state]}return[!1,void 0]}).then(t=>{if(e!==s)return;let[i,o]=t;if(m=a.merge(o,r()??p),n(m,!0),i)return d()}).then(()=>{e===s&&(t?.(r(),void 0),m=r(),o=!0,l.forEach(e=>e(m)))}).catch(n=>{e===s&&t?.(void 0,n)})};return i.persist={setOptions:e=>{a={...a,...e},e.storage&&(u=e.storage)},clearStorage:()=>{++s,u?.removeItem(a.name)},getOptions:()=>a,rehydrate:()=>h(),hasHydrated:()=>o,onHydrate:e=>(c.add(e),()=>{c.delete(e)}),onFinishHydration:e=>(l.add(e),()=>{l.delete(e)})},a.skipHydration||h(),m||p};function uh(e){let t={},n=e.reasoningEffort;lm(n)&&(t.reasoningEffort=n);let r=e.contextWindow;return fm(r)&&(t.contextWindow=r),t}function dh(e){let t={},n=e.reasoningEffort;um(n)&&(t.reasoningEffort=n);let r=e.fastMode;return typeof r==`boolean`&&(t.fastMode=r),t}function fh(e,t){return e.reasoningEffort===t.reasoningEffort&&e.contextWindow===t.contextWindow}function ph(e,t){return e.reasoningEffort===t.reasoningEffort&&e.fastMode===t.fastMode}function mh(e,t){return e.claude.model===t.claude.model&&e.claude.planMode===t.claude.planMode&&fh(e.claude.modelOptions,t.claude.modelOptions)&&e.codex.model===t.codex.model&&e.codex.planMode===t.codex.planMode&&ph(e.codex.modelOptions,t.codex.modelOptions)&&e.openrouter.model===t.openrouter.model&&e.openrouter.planMode===t.openrouter.planMode&&e.custom.model===t.custom.model&&e.custom.planMode===t.custom.planMode}function hh(){return T.getState().settings?.customModels??[]}var gh=`__new__`;function _h(e,t){let n=e?.modelOptions?.reasoningEffort,r;r=lm(n)?n:lm(e?.effort)?e.effort:sm.reasoningEffort;let i=Cm(e?.model,void 0,t),a=Am(i,e?.modelOptions?.contextWindow,t);return{model:i,modelOptions:{reasoningEffort:Om(i,r,t),contextWindow:a},planMode:!!e?.planMode}}function vh(e,t){let n=e?.modelOptions?.reasoningEffort,r;return r=um(n)?n:um(e?.effort)?e.effort:cm.reasoningEffort,{model:wm(e?.model,void 0,t),modelOptions:{reasoningEffort:r,fastMode:typeof e?.modelOptions?.fastMode==`boolean`?e.modelOptions.fastMode:cm.fastMode},planMode:!!e?.planMode}}function yh(){return{claude:{model:`claude-opus-4-7`,modelOptions:{...sm},planMode:!1},codex:{model:`gpt-5.5`,modelOptions:{...cm},planMode:!1},openrouter:{model:im,modelOptions:{},planMode:!1},custom:{model:``,modelOptions:{},planMode:!1}}}function bh(e,t){if(t===void 0){c.info(`[chat-preferences] ${e}`);return}c.info(`[chat-preferences] ${e}`,t)}function xh(e,t){if(e===`claude`){let e=t.claude;return{provider:`claude`,model:e.model,modelOptions:{...e.modelOptions},planMode:e.planMode}}if(vm(e)){let n=t[e];return{provider:e,model:n.model,modelOptions:{},planMode:n.planMode}}let n=t.codex;return{provider:`codex`,model:n.model,modelOptions:{...n.modelOptions},planMode:n.planMode}}function Sh(e){return e.provider===`claude`?{provider:`claude`,model:e.model,modelOptions:{...e.modelOptions},planMode:e.planMode}:e.provider===`codex`?{provider:`codex`,model:e.model,modelOptions:{...e.modelOptions},planMode:e.planMode}:{provider:e.provider,model:e.model,modelOptions:{},planMode:e.planMode}}function Ch(e){return e.providerHint?xh(e.providerHint,e.providerDefaults):e.defaultProvider===`last_used`?e.sourceState?Sh(e.sourceState):xh(`claude`,e.providerDefaults):xh(e.defaultProvider,e.providerDefaults)}function wh(e,t){return e.chatStates[t]||Ch({defaultProvider:e.defaultProvider,providerDefaults:e.providerDefaults,legacyComposerState:e.legacyComposerState})}function Th(e,t,n){let r=wh(e,t);return{chatStates:{...e.chatStates,[t]:n(r)}}}var Eh=i()(lh((e,t)=>({defaultProvider:`last_used`,providerDefaults:yh(),chatStates:{},pendingProviderSyncChatIds:new Set,legacyComposerState:{provider:`claude`,model:`claude-opus-4-7`,modelOptions:{...sm},planMode:!1},setDefaultProvider:t=>e({defaultProvider:t}),applyServerDefaults:(t,n)=>e(e=>{if(e.defaultProvider===t&&mh(e.providerDefaults,n))return{defaultProvider:t,providerDefaults:n};let{[gh]:r,...i}=e.chatStates;return{defaultProvider:t,providerDefaults:n,chatStates:i}}),setProviderDefaultModel:(t,n)=>e(e=>{let r=hh();return t===`claude`?{providerDefaults:{...e.providerDefaults,[t]:_h({...e.providerDefaults.claude,model:n},r)}}:vm(t)?{providerDefaults:{...e.providerDefaults,[t]:{...e.providerDefaults[t],model:n}}}:{providerDefaults:{...e.providerDefaults,[t]:vh({...e.providerDefaults.codex,model:n},r)}}}),setProviderDefaultModelOptions:(t,n)=>e(e=>{let r=hh();if(t===`claude`){let i=uh(n);return{providerDefaults:{...e.providerDefaults,[t]:_h({...e.providerDefaults.claude,modelOptions:{...e.providerDefaults.claude.modelOptions,...i}},r)}}}if(vm(t))return{providerDefaults:{...e.providerDefaults,[t]:{...e.providerDefaults[t],modelOptions:{}}}};let i=dh(n);return{providerDefaults:{...e.providerDefaults,[t]:vh({...e.providerDefaults.codex,modelOptions:{...e.providerDefaults.codex.modelOptions,...i}},r)}}}),setProviderDefaultPlanMode:(t,n)=>e(e=>({providerDefaults:{...e.providerDefaults,[t]:{...e.providerDefaults[t],planMode:n}}})),getComposerState:e=>Sh(wh(t(),e)),initializeComposerForChat:(t,n)=>e(e=>{let r=e.chatStates[t],i=n?.providerHint;if(r){if(i&&e.pendingProviderSyncChatIds.has(t)){let n=new Set(e.pendingProviderSyncChatIds);if(n.delete(t),r.provider===i)return bh(`initializeComposerForChat sync skipped`,{chatId:t,provider:i}),{pendingProviderSyncChatIds:n};let a={...xh(i,e.providerDefaults),planMode:r.planMode};return bh(`initializeComposerForChat sync`,{chatId:t,provider:i}),{chatStates:{...e.chatStates,[t]:a},pendingProviderSyncChatIds:n}}return e}let a=Ch({defaultProvider:e.defaultProvider,providerDefaults:e.providerDefaults,sourceState:n?.sourceState,legacyComposerState:e.legacyComposerState,providerHint:i});bh(`initializeComposerForChat`,{chatId:t,composerState:a});let o=i?e.pendingProviderSyncChatIds:new Set([...e.pendingProviderSyncChatIds,t]);return{chatStates:{...e.chatStates,[t]:a},pendingProviderSyncChatIds:o}}),setComposerState:(t,n)=>e(e=>{let r=hh();return{chatStates:{...e.chatStates,[t]:n.provider===`claude`?{provider:`claude`,model:_h(n,r).model,modelOptions:_h(n,r).modelOptions,planMode:n.planMode}:Sh(n)}}}),setChatComposerProvider:(t,n)=>e(e=>Th(e,t,()=>xh(n,e.providerDefaults))),setChatComposerModel:(t,n)=>e(e=>Th(e,t,e=>{let t=hh();if(e.provider===`claude`){let r=_h({...e,model:n},t);return{provider:`claude`,model:r.model,modelOptions:r.modelOptions,planMode:e.planMode}}return e.provider===`codex`?{provider:`codex`,model:n,modelOptions:vh({...e,model:n},t).modelOptions,planMode:e.planMode}:{provider:e.provider,model:n,modelOptions:{},planMode:e.planMode}})),setChatComposerModelOptions:(t,n)=>e(e=>Th(e,t,e=>{let t=hh();if(e.provider===`claude`){let r=uh(n);return{provider:`claude`,model:e.model,modelOptions:_h({...e,modelOptions:{...e.modelOptions,...r}},t).modelOptions,planMode:e.planMode}}if(e.provider===`codex`){let r=dh(n);return{provider:`codex`,model:e.model,modelOptions:vh({...e,modelOptions:{...e.modelOptions,...r}},t).modelOptions,planMode:e.planMode}}return{provider:e.provider,model:e.model,modelOptions:{},planMode:e.planMode}})),setChatComposerPlanMode:(t,n)=>e(e=>Th(e,t,e=>({...e,planMode:n}))),resetChatComposerFromProvider:(t,n)=>e(e=>{let r=new Set(e.pendingProviderSyncChatIds);return r.delete(t),{chatStates:{...e.chatStates,[t]:xh(n,e.providerDefaults)},pendingProviderSyncChatIds:r}}),forgetChats:t=>e(e=>({chatStates:Object.fromEntries(Object.entries(e.chatStates).filter(([e])=>!t.includes(e))),pendingProviderSyncChatIds:new Set([...e.pendingProviderSyncChatIds].filter(e=>!t.includes(e)))}))}),{name:`chat-preferences-state`,version:1,partialize:e=>({chatStates:e.chatStates,legacyComposerState:e.legacyComposerState})})),Dh=`cursor`;function Oh(e){switch(e){case`vscode`:return`code {path}`;case`xcode`:return`xed {path}`;case`windsurf`:return`windsurf {path}`;case`custom`:return`cursor {path}`;default:return`cursor {path}`}}function kh(e){switch(e){case`vscode`:return`VS Code`;case`xcode`:return`Xcode`;case`windsurf`:return`Windsurf`;case`custom`:return`Custom`;default:return`Cursor`}}function Ah(e){return Number.isFinite(e)?Math.min(900,Math.max(250,Math.round(e))):450}function jh(e){switch(e){case`vscode`:case`xcode`:case`windsurf`:case`custom`:case`cursor`:return e;default:return Dh}}function Mh(e,t){let n=e?.trim();return n&&n.length>0?n:Oh(t)}var Nh=i()(e=>({scrollbackLines:te,minColumnWidth:450,editorPreset:Dh,editorCommandTemplate:Oh(Dh),setScrollbackLines:t=>e({scrollbackLines:ie(t)}),setMinColumnWidth:t=>e({minColumnWidth:Ah(t)}),setEditorPreset:t=>e(e=>{let n=jh(t);return{editorPreset:n,editorCommandTemplate:n===`custom`?Mh(e.editorCommandTemplate,n):Oh(n)}}),setEditorCommandTemplate:t=>e(e=>({editorCommandTemplate:Mh(t,e.editorPreset)}))}));function Ph(e){return e===void 0?null:typeof e==`string`?e?{text:e}:null:e.text||e.lexicalState?e:null}var Fh=i()(lh((e,t)=>({drafts:{},attachmentDrafts:{},setDraft:(t,n,r)=>e(e=>{let i;if(typeof n==`string`){if(!n){let{[t]:n,...r}=e.drafts;return{drafts:r}}i={text:n}}else{let a=r??``;if(!a){let{[t]:n,...r}=e.drafts;return{drafts:r}}i={text:a,lexicalState:n}}return{drafts:{...e.drafts,[t]:i}}}),clearDraft:t=>e(e=>{let{[t]:n,...r}=e.drafts;return{drafts:r}}),getDraft:e=>Ph(t().drafts[e]),setAttachmentDrafts:(t,n)=>e(e=>{if(n.length===0){let{[t]:n,...r}=e.attachmentDrafts;return{attachmentDrafts:r}}return{attachmentDrafts:{...e.attachmentDrafts,[t]:n}}}),clearAttachmentDrafts:t=>e(e=>{let{[t]:n,...r}=e.attachmentDrafts;return{attachmentDrafts:r}}),getAttachmentDrafts:e=>t().attachmentDrafts[e]??[],forgetChats:t=>e(e=>({drafts:Object.fromEntries(Object.entries(e.drafts).filter(([e])=>!t.includes(e))),attachmentDrafts:Object.fromEntries(Object.entries(e.attachmentDrafts).filter(([e])=>!t.includes(e)))}))}),{name:`chat-input-drafts`})),Ih=i()(e=>({byProjectId:{},setForProject:(t,n)=>e(e=>({byProjectId:{...e.byProjectId,[t]:n}})),clear:t=>e(e=>{if(!(t in e.byProjectId))return e;let{[t]:n,...r}=e.byProjectId;return{byProjectId:r}})}));function Lh(e){let t=E(e)?e:null,n=Rh(t?.typographyOverride),r=Rh(t?.typographyServerDefaultCache);return{autoResumeOnRateLimit:!!t?.autoResumeOnRateLimit,typographyOverride:n,typographyServerDefaultCache:r}}function Rh(e){if(typeof e==`string`)return Hp(e)?e:void 0}var zh=i()(lh(e=>({autoResumeOnRateLimit:!1,setAutoResumeOnRateLimit:t=>e({autoResumeOnRateLimit:t}),typographyOverride:void 0,typographyServerDefaultCache:void 0,setTypographyOverride:t=>e({typographyOverride:t}),clearTypographyOverride:()=>e({typographyOverride:void 0}),cacheTypographyServerDefault:t=>e({typographyServerDefaultCache:t})}),{name:`kanna-preferences`,version:2,migrate:e=>Lh(ce(e))})),Bh=/^[a-z][a-z0-9-]{0,31}$/,Vh=1024,Hh=4096,Uh=2e6,Wh=/^\S+$/;function Gh(e,t){return`${e}/${t}`}function Kh(e){return e.flatMap(e=>e.models.map(t=>({id:Gh(e.id,t.id),label:`${e.label} · ${t.label||t.id}`})))}function qh(e,t){let n=Kh(t),r=n[0];return r?e.map(e=>e.id===`custom`?{...e,defaultModel:r.id,models:n}:e):e.filter(e=>e.id!==`custom`)}function Jh(e){return Number.isInteger(e)&&e>=4096&&e<=2e6}function Yh(e){if(e.length===0)return{code:`NO_MODELS`,field:`models`,message:`add at least one model`};if(e.length>50)return{code:`INVALID_MODEL`,field:`models`,message:`at most 50 models`};let t=new Set;for(let n of e){if(n.id.length===0||n.id.length>128||!Wh.test(n.id)||n.label.length>64)return{code:`INVALID_MODEL`,field:`models`,message:`invalid model '${n.id}'`};if(t.has(n.id))return{code:`DUPLICATE_MODEL`,field:`models`,message:`model '${n.id}' is listed twice`};t.add(n.id)}return null}function Xh(e,t){return Bh.test(e.id)?t.includes(e.id)?{code:`DUPLICATE_ID`,field:`id`,message:`provider '${e.id}' already exists`}:e.label.trim().length===0||e.label.length>64?{code:`EMPTY_LABEL`,field:`label`,message:`label must be non-empty and <= 64 chars`}:qp(e.baseUrl)===null?{code:`INVALID_BASE_URL`,field:`baseUrl`,message:`base URL must start with http:// or https://`}:e.apiKey.length===0||e.apiKey.length>1024?{code:`MISSING_API_KEY`,field:`apiKey`,message:`an API key of 1-${Vh} characters is required`}:e.contextWindow!==void 0&&!Jh(e.contextWindow)?{code:`INVALID_CONTEXT_WINDOW`,field:`contextWindow`,message:`context window must be a whole number of tokens between ${Hh} and ${Uh}`}:Yh(e.models):{code:`INVALID_ID`,field:`id`,message:`id must match ${Bh}`}}var Zh=[],Qh=i()(e=>({models:Zh,status:`idle`,error:null,setLoading:()=>e({status:`loading`,error:null}),setModels:t=>e({models:t,status:`ready`,error:null}),setError:t=>e({status:`error`,error:t})})),$h=400,eg=800;function tg(e,t,n){for(let r of e.querySelectorAll(`[${t}]`))if(r.getAttribute(t)===n)return r.querySelector(`span.truncate`);return null}async function ng(e,t={}){try{await rg(e,t)}catch{}}async function rg(e,t){let n=t.root??globalThis.document;if(!n?.body||Ip())return;let r=await ig(n,e,t);if(!r)return;let{from:i,to:a,text:o}=r,s=n.createElement(`span`);s.textContent=o,s.setAttribute(`aria-hidden`,`true`),s.style.cssText=[`position:fixed`,`left:${i.left}px`,`top:${i.top}px`,`margin:0`,`white-space:nowrap`,`pointer-events:none`,`z-index:60`].join(`;`);let c=n.defaultView?.getComputedStyle(r.fromElement);c&&(s.style.font=c.font,s.style.color=c.color),n.body.appendChild(s);let l=!1,u=()=>{l||(l=!0,s.remove())},d=setTimeout(u,eg);try{await kp(s,{x:a.left-i.left,y:a.top-i.top,opacity:[1,0],duration:Ap.carry,ease:jp.arriving})}finally{clearTimeout(d),u()}}async function ig(e,t,n){let r=n.now??(()=>Date.now()),i=n.raf??(e=>{requestAnimationFrame(e)}),a=r()+$h;for(;;){let n=tg(e,`data-chat-id`,t),o=tg(e,`data-tab-id`,t);if(n&&o){let e=n.getBoundingClientRect(),t=o.getBoundingClientRect();if(e.width>0&&t.width>0)return{from:e,to:t,fromElement:n,text:n.textContent??``}}if(r()>=a)return null;await new Promise(e=>{i(e)})}}function ag(e){return Number.isFinite(e)?Math.max(20,e):33}function og(){return{isVisible:!1}}function sg(){return{viewMode:`history`,collapsedPaths:{},summary:``,description:``}}function cg(e,t){return e[t]??og()}function lg(e){for(let t of Object.values(e))if(E(t)&&typeof t.size==`number`&&Number.isFinite(t.size))return t.size;return null}function ug(e){if(!E(e))return null;let t={};if(E(e.collapsedPaths))for(let[n,r]of Object.entries(e.collapsedPaths))typeof r==`boolean`&&(t[n]=r);return{viewMode:e.viewMode===`changes`?`changes`:`history`,collapsedPaths:t,summary:typeof e.summary==`string`?e.summary:``,description:typeof e.description==`string`?e.description:``}}function dg(e){if(!E(e))return{size:33,projects:{},projectUi:{}};let t=E(e.projects)?e.projects:{},n=e.size,r=ag(typeof n==`number`&&Number.isFinite(n)?n:lg(t)??33),i={};for(let[e,n]of Object.entries(t))i[e]={isVisible:E(n)&&n.isVisible===!0};let a={};if(E(e.projectUi))for(let[t,n]of Object.entries(e.projectUi)){let e=ug(n);e&&(a[t]=e)}return{size:r,projects:i,projectUi:a}}var fg=i()(lh(e=>({size:33,projects:{},projectUi:{},toggleVisibility:t=>e(e=>({projects:{...e.projects,[t]:{...cg(e.projects,t),isVisible:!cg(e.projects,t).isVisible}}})),setSize:t=>e({size:ag(t)}),reconcileCollapsedPaths:(t,n)=>e(e=>{let r=e.projectUi[t]??sg(),i=Object.fromEntries(n.map(e=>[e,r.collapsedPaths[e]??!0]));return Object.keys(r.collapsedPaths).length===Object.keys(i).length&&Object.entries(i).every(([e,t])=>r.collapsedPaths[e]===t)?e:{projectUi:{...e.projectUi,[t]:{...r,collapsedPaths:i}}}}),toggleCollapsedPath:(t,n)=>e(e=>{let r=e.projectUi[t]??sg();return{projectUi:{...e.projectUi,[t]:{...r,collapsedPaths:{...r.collapsedPaths,[n]:!(r.collapsedPaths[n]??!0)}}}}}),setViewMode:(t,n)=>e(e=>{let r=e.projectUi[t]??sg();return r.viewMode===n?e:{projectUi:{...e.projectUi,[t]:{...r,viewMode:n}}}}),setCommitDraft:(t,n)=>e(e=>{let r=e.projectUi[t]??sg();return r.summary===n.summary&&r.description===n.description?e:{projectUi:{...e.projectUi,[t]:{...r,summary:n.summary,description:n.description}}}}),setCommitSummary:(t,n)=>e(e=>{let r=e.projectUi[t]??sg();return r.summary===n?e:{projectUi:{...e.projectUi,[t]:{...r,summary:n}}}}),setCommitDescription:(t,n)=>e(e=>{let r=e.projectUi[t]??sg();return r.description===n?e:{projectUi:{...e.projectUi,[t]:{...r,description:n}}}}),clearCommitDraft:t=>e(e=>{let n=e.projectUi[t]??sg();return!n.summary&&!n.description?e:{projectUi:{...e.projectUi,[t]:{...n,summary:``,description:``}}}}),clearProject:t=>e(e=>{let{[t]:n,...r}=e.projects,{[t]:i,...a}=e.projectUi;return{projects:r,projectUi:a}})}),{name:`right-sidebar-layouts`,version:4,migrate:e=>dg(ce(e))})),pg={isVisible:!1},mg=[68,32];function hg(){return{isVisible:!1,mainSizes:[...mg],terminals:[],nextTerminalIndex:0}}function gg(e,t){return e[t]??hg()}function _g(e,t){for(let[n,r]of Object.entries(e)){let e=r.terminals.find(e=>e.id===t);if(e)return{projectId:n,terminal:e}}return null}function vg(e){if(e.length===0)return[];let t=e.reduce((e,t)=>e+Math.max(t,0),0);return!Number.isFinite(t)||t<=0?Array.from({length:e.length},()=>100/e.length):e.map(e=>Math.max(e,0)/t*100)}function yg(e){let t=e,n=``;do n=String.fromCharCode(65+t%26)+n,t=Math.floor(t/26)-1;while(t>=0);return`Terminal ${n}`}function bg(e){if(e.length===0)return e;let t=e.length+1;return e.map(n=>({...n,size:n.size*e.length/t}))}function xg(e,t,n){return{...e,[t]:n(gg(e,t))}}var Sg=i()(lh(e=>({projects:{},addTerminal:(t,n)=>e(e=>({projects:xg(e.projects,t,e=>{let t=bg(e.terminals),r={id:globalThis.crypto?.randomUUID?.()??`terminal-${Date.now()}-${e.nextTerminalIndex}`,title:yg(e.nextTerminalIndex),size:100/(t.length+1)},i=n?Math.max(t.findIndex(e=>e.id===n)+1,0):t.length;return{...e,isVisible:!0,nextTerminalIndex:e.nextTerminalIndex+1,terminals:[...t.slice(0,i),r,...t.slice(i)]}})})),removeTerminal:(t,n)=>e(e=>({projects:xg(e.projects,t,e=>{let t=e.terminals.filter(e=>e.id!==n);if(t.length===0)return{...e,isVisible:!1,terminals:[]};let r=vg(t.map(e=>e.size));return{...e,terminals:t.map((e,n)=>({...e,size:r[n]??100/t.length}))}})})),toggleVisibility:t=>e(e=>({projects:xg(e.projects,t,e=>({...e,isVisible:e.terminals.length>0&&!e.isVisible}))})),resetMainSizes:t=>e(e=>({projects:xg(e.projects,t,e=>({...e,mainSizes:[...mg]}))})),setMainSizes:(t,n)=>e(e=>{if(n.length!==2)return e;let[r=50,i=50]=vg(n),a=[r,i];return{projects:xg(e.projects,t,e=>({...e,mainSizes:a}))}}),setTerminalSizes:(t,n)=>e(e=>({projects:xg(e.projects,t,e=>{if(n.length!==e.terminals.length)return e;let t=vg(n);return{...e,terminals:e.terminals.map((e,n)=>({...e,size:t[n]??e.size}))}})})),clearProject:t=>e(e=>{let{[t]:n,...r}=e.projects;return{projects:r}})}),{name:`terminal-layouts`,version:1})),Cg={isVisible:!1,mainSizes:[...mg],terminals:[],nextTerminalIndex:0};function wg(e){return e===void 0||!re(e)?[]:e.filter(e=>typeof e==`string`)}function Tg(e){let t=E(e)?e:{};return{deletedBoardIds:wg(t.deletedBoardIds),failures:wg(t.failures)}}var Eg=[],Dg=i()(e=>({chatIds:Eg,setFollowed:t=>e({chatIds:t})}));function Og(e){return t=>e?t.chatIds.includes(e):!1}function kg(e){if(!E(e))return{ok:!1,error:`Unexpected response from the server`};let{ok:t,code:n,expiresAt:r,error:i}=e;return t===!0&&typeof n==`string`&&typeof r==`number`?{ok:!0,code:n,expiresAt:r}:{ok:!1,error:typeof i==`string`?i:`Could not create a pairing code`}}function Ag(e){return E(e)?e.ok===!0?{ok:!0}:{ok:!1,error:typeof e.error==`string`?e.error:`Could not start the update`}:{ok:!1,error:`Unexpected response from the server`}}var jg=[],Mg=[],Ng=[],Pg={},Fg={},Ig=i()((e,t)=>({changelogPendingAction:null,skillQuery:``,skillResults:jg,skillSearchLoading:!1,skillSearchError:null,installedSkills:Mg,installedSkillIds:new Set,installedLoading:!1,installedError:null,skillOperationError:null,installingSkillId:null,uninstallingSkillId:null,installMessages:Fg,packageUpdateSnapshot:null,pluginInventory:null,pluginInventoryLoading:!1,pluginInventoryError:null,globalInstructionsDraft:``,globalInstructionsPersistedAtMount:``,globalInstructionsSaving:!1,globalInstructionsError:null,changelogStatus:`idle`,signingOut:!1,authEnabled:!1,releases:Ng,changelogError:null,pushPermissionState:m().state,pushDeviceId:h(),pushError:null,scrollbackDraft:``,minColumnWidthDraft:``,tabMinWidthDraft:``,uploadMaxFileSizeDraft:``,claudeIdleMinutesDraft:``,claudeMaxConcurrentDraft:``,editorCommandDraft:``,keybindingDrafts:Pg,keybindingsError:null,appSettingsError:null,analyticsDialogOpen:!1,tunnelError:null,cloudflaredPathDraft:``,pushContactSubjectDraft:``,shareDefaultTtlDraft:``,llmProviderDraft:{provider:`openai`,apiKey:``,model:``,baseUrl:``},llmProviderError:null,llmValidationStatus:`idle`,llmValidationError:null,llmValidationDialogOpen:!1,setChangelogPendingAction:t=>e({changelogPendingAction:t}),setSkillQuery:t=>e({skillQuery:t}),setSkillResults:t=>e({skillResults:t}),setSkillSearchLoading:t=>e({skillSearchLoading:t}),setSkillSearchError:t=>e({skillSearchError:t}),setInstalledSkills:t=>e({installedSkills:t}),setInstalledSkillIds:t=>e({installedSkillIds:t}),addInstalledSkillId:n=>{let r=t().installedSkillIds,i=new Set(r);i.add(n),e({installedSkillIds:i})},removeInstalledSkillId:n=>{let r=t().installedSkillIds,i=new Set(r);i.delete(n),e({installedSkillIds:i})},setInstalledLoading:t=>e({installedLoading:t}),setInstalledError:t=>e({installedError:t}),setSkillOperationError:t=>e({skillOperationError:t}),setInstallingSkillId:t=>e({installingSkillId:t}),setUninstallingSkillId:t=>e({uninstallingSkillId:t}),setInstallMessages:t=>e({installMessages:t}),setInstallMessage:(n,r)=>{let i=t().installMessages;e({installMessages:{...i,[n]:r}})},clearInstallMessage:n=>{let r={...t().installMessages};delete r[n],e({installMessages:r})},clearInstallMessagesForSkill:n=>{let r={...t().installMessages};for(let e of Object.keys(r))(e.endsWith(`/${n}`)||e===n)&&delete r[e];e({installMessages:r})},setPackageUpdateSnapshot:t=>e({packageUpdateSnapshot:t}),setPluginInventory:t=>e({pluginInventory:t}),setPluginInventoryLoading:t=>e({pluginInventoryLoading:t}),setPluginInventoryError:t=>e({pluginInventoryError:t}),setGlobalInstructionsDraft:t=>e({globalInstructionsDraft:t}),setGlobalInstructionsPersistedAtMount:t=>e({globalInstructionsPersistedAtMount:t}),setGlobalInstructionsSaving:t=>e({globalInstructionsSaving:t}),setGlobalInstructionsError:t=>e({globalInstructionsError:t}),setChangelogStatus:t=>e({changelogStatus:t}),setSigningOut:t=>e({signingOut:t}),setAuthEnabled:t=>e({authEnabled:t}),setReleases:t=>e({releases:t}),setChangelogError:t=>e({changelogError:t}),setPushPermissionState:t=>e({pushPermissionState:t}),setPushDeviceId:t=>e({pushDeviceId:t}),setPushError:t=>e({pushError:t}),setScrollbackDraft:t=>e({scrollbackDraft:t}),setMinColumnWidthDraft:t=>e({minColumnWidthDraft:t}),setTabMinWidthDraft:t=>e({tabMinWidthDraft:t}),setUploadMaxFileSizeDraft:t=>e({uploadMaxFileSizeDraft:t}),setClaudeIdleMinutesDraft:t=>e({claudeIdleMinutesDraft:t}),setClaudeMaxConcurrentDraft:t=>e({claudeMaxConcurrentDraft:t}),setEditorCommandDraft:t=>e({editorCommandDraft:t}),setKeybindingDrafts:t=>e({keybindingDrafts:t}),setKeybindingDraft:(t,n)=>e(e=>e.keybindingDrafts[t]===n?e:{keybindingDrafts:{...e.keybindingDrafts,[t]:n}}),setKeybindingsError:t=>e({keybindingsError:t}),setAppSettingsError:t=>e({appSettingsError:t}),setAnalyticsDialogOpen:t=>e({analyticsDialogOpen:t}),setTunnelError:t=>e({tunnelError:t}),setCloudflaredPathDraft:t=>e({cloudflaredPathDraft:t}),setPushContactSubjectDraft:t=>e({pushContactSubjectDraft:t}),setShareDefaultTtlDraft:t=>e({shareDefaultTtlDraft:t}),setLlmProviderDraft:t=>e({llmProviderDraft:t}),setLlmProviderError:t=>e({llmProviderError:t}),setLlmValidationStatus:t=>e({llmValidationStatus:t}),setLlmValidationError:t=>e({llmValidationError:t}),setLlmValidationDialogOpen:t=>e({llmValidationDialogOpen:t})})),Lg=`main`;function Rg(e){return e.kind===`pane`}function zg(e){return e.kind===`group`}var Bg=.1;function Vg(e){return typeof e==`number`&&Number.isFinite(e)&&e>0}function Hg(e){return Array.from({length:e},()=>1/e)}function Ug(e,t){if(t<=0)return[];if(t===1)return[1];let n=Array.from({length:t},(t,n)=>{let r=e?.[n];return Vg(r)?r:1}),r=n.reduce((e,t)=>e+t,0);return r<=0?Hg(t):n.map(e=>e/r)}function Wg(e){let t=e.length;if(t===0)return[];if(t===1)return[1];if(t*.1>1)return Hg(t);let n=Ug(e,t),r=Array(t).fill(0),i=new Set(n.map((e,t)=>t)),a=1;for(;i.size>0;){let e=0;for(let t of i)e+=n[t]??0;if(e<=0){let e=a/i.size;for(let t of i)r[t]=e;break}let t=[];for(let r of i)(n[r]??0)/e*a<.1&&t.push(r);if(t.length===0){for(let t of i)r[t]=(n[t]??0)/e*a;break}for(let e of t)r[e]=Bg,i.delete(e),a-=Bg}return Ug(r,t)}function Gg(e,t,n){let r=e[t],i=e[t+1];if(r===void 0||i===void 0||!Number.isFinite(n))return[...e];let a=r+i;if(a<=0)return[...e];let o=Math.min(Bg,a/2),s=Math.min(a-o,Math.max(o,r+n)),c=[...e];return c[t]=s,c[t+1]=a-s,c}var Kg=[{page:`projects`,pattern:`/`},{page:`settings`,pattern:`/settings/:sectionId`},{page:`settings`,pattern:`/settings`},{page:`cron`,pattern:`/cron`},{page:`workflows`,pattern:`/workflows/:chatId`},{page:`boards`,pattern:`/boards/stack/:stackId`},{page:`boards`,pattern:`/boards/:projectId`}];function qg(e){for(let{page:t,pattern:r}of Kg){let i=n({path:r,end:!0},e);if(!i)continue;let a={};for(let[e,t]of Object.entries(i.params))t!==void 0&&(a[e]=t);return{page:t,params:a}}return null}function Jg(e){let t=qg(e);return t?{kind:`page`,page:t.page,path:e}:null}function Yg(e){return Rg(e)?[e]:e.children.flatMap(Yg)}function Xg(e){return e.target.kind===`chat`?`/chat/${e.target.chatId}`:e.target.kind===`page`?e.target.path:null}function Zg(e){let t=Yg(e.root),n=t.find(t=>t.id===e.focusedPaneId),r=n?.tabs.find(e=>e.tabId===n.focusedTabId),i=r?Xg(r):null;if(i)return i;let a=t.flatMap(e=>e.tabs),o=a.find(e=>e.target.kind===`chat`);if(o)return Xg(o)??`/`;let s=a.find(e=>e.target.kind===`page`);return(s?Xg(s):null)??`/`}function Qg(e){return`${e.length}_${e}`}function $g(e){switch(e.kind){case`chat`:return`chat_${Qg(e.chatId)}`;case`changes`:return`changes`;case`terminal`:return`terminal_${Qg(e.terminalId)}`;case`board`:return`board_${Qg(e.boardId)}`;case`page`:return`page_${e.page}`}}function e_(e){if(typeof e!=`string`)return null;let t=e.trim();return t.length>0?t:null}function t_(e){if(e===void 0||!E(e))return null;switch(e.kind){case`chat`:{let t=e_(e.chatId);return t?{kind:`chat`,chatId:t}:null}case`changes`:return{kind:`changes`};case`terminal`:{let t=e_(e.terminalId);return t?{kind:`terminal`,terminalId:t}:null}case`board`:{let t=e_(e.boardId);return t?{kind:`board`,boardId:t}:null}case`page`:{let t=typeof e.path==`string`?e.path:null,n=t?qg(t):null;return t&&n&&n.page===e.page?{kind:`page`,page:n.page,path:t}:null}default:return null}}function n_(e,t){if(e.kind!==t.kind)return!1;switch(e.kind){case`chat`:return t.kind===`chat`&&e.chatId===t.chatId;case`terminal`:return t.kind===`terminal`&&e.terminalId===t.terminalId;case`board`:return t.kind===`board`&&e.boardId===t.boardId;case`page`:return t.kind===`page`&&e.page===t.page&&e.path===t.path;case`changes`:return!0}}function r_(e,t){return{tabId:$g(e),target:e,createdAt:t}}function i_(e,t=[],n){let r=new Set,i=[];for(let e of t)r.has(e.tabId)||(r.add(e.tabId),i.push(e));return{kind:`pane`,id:e,tabs:i,focusedTabId:n&&r.has(n)?n:i[0]?.tabId??null}}function a_(e,t,n,r){return n.length===0?i_(e):n.length===1?n[0]:{kind:`group`,id:e,direction:t,children:[...n],sizes:Ug(r,n.length)}}function o_(){return{root:i_(Lg),focusedPaneId:Lg}}function s_(e){return Rg(e)?1:1+Math.max(...e.children.map(s_))}function c_(e){return Rg(e)?[e]:e.children.flatMap(c_)}function l_(e,t){if(Rg(e))return e.id===t?[]:null;for(let[n,r]of e.children.entries()){let e=l_(r,t);if(e)return[n,...e]}return null}function u_(e,t){if(Rg(e))return e.tabs.some(e=>e.tabId===t)?{pane:e,path:[]}:null;for(let[n,r]of e.children.entries()){let e=u_(r,t);if(e)return{pane:e.pane,path:[n,...e.path]}}return null}function d_(e,t){let n=e;for(let e of t){if(!n||!zg(n))return null;n=n.children[e]}return n??null}function f_(e,t){let n=l_(e,t);if(!n)return null;for(let t=n.length-1;t>=0;t--){let r=d_(e,n.slice(0,t));if(!r||!zg(r))continue;let i=n[t];for(let e=i-1;e>=0;e--){let t=c_(r.children[e]).at(-1);if(t)return t.id}for(let e=i+1;e<r.children.length;e++){let t=c_(r.children[e])[0];if(t)return t.id}}return null}function p_(e,t,n){if(t.length===0)return n;let[r,...i]=t;if(!zg(e))return e;let a=e.children[r];if(!a)return e;let o=[...e.children];return o[r]=p_(a,i,n),a_(e.id,e.direction,o,e.sizes)}function m_(e,t){if(t.length===0)return i_(e.id);let n=t.slice(0,-1),r=t.at(-1),i=d_(e,n);if(!i||!zg(i))return e;let a=i.children.filter((e,t)=>t!==r),o=i.sizes.filter((e,t)=>t!==r);return p_(e,n,a_(i.id,i.direction,a,Wg(o)))}function h_(e,t,n={}){let r=u_(e,t);if(!r)return{root:e,tab:null,sourcePaneId:null};let{pane:i,path:a}=r,o=i.tabs.find(e=>e.tabId===t)??null,s=i.tabs.filter(e=>e.tabId!==t);if(s.length>0||i.id===n.preserveEmptyPaneId){let n=i.focusedTabId===t?void 0:i.focusedTabId;return{root:p_(e,a,i_(i.id,s,n)),tab:o,sourcePaneId:i.id}}return{root:m_(e,a),tab:o,sourcePaneId:i.id}}function g_(e,t,n,r={}){let i=l_(e,t);if(!i)return null;let a=d_(e,i);if(!a||!Rg(a))return null;let o=a.tabs.filter(e=>e.tabId!==n.tabId),s=r.index??o.length;o.splice(Math.max(0,Math.min(s,o.length)),0,n);let c=r.focus??!0?n.tabId:a.focusedTabId??n.tabId;return p_(e,i,i_(a.id,o,c))}function __(e){return e===`left`||e===`right`?`horizontal`:`vertical`}function v_(e){return e===`right`||e===`bottom`}function y_(e){return c_(e)[0]?.id??null}function b_(e,t){let{tabId:n,targetPaneId:r,position:i,ids:a}=t;if(!l_(e.root,r))return null;let o=u_(e.root,n);if(!o||o.pane.id===r&&o.pane.tabs.length<=1)return null;let s=h_(e.root,n,{preserveEmptyPaneId:r});if(!s.tab)return null;let c=l_(s.root,r);if(!c)return null;let l=__(i),u=v_(i),d=i_(a.paneId,[s.tab],s.tab.tabId),f=c.slice(0,-1),p=f.length>0||c.length>0?d_(s.root,f):null,m;if(p&&zg(p)&&p.direction===l){let e=c.at(-1),t=[...p.children],n=[...p.sizes],r=n[e]??1/t.length,i=u?e+1:e;t.splice(i,0,d),n.splice(i,0,r/2),n[u?e:e+1]=r/2,m=p_(s.root,f,a_(p.id,p.direction,t,n))}else{let e=d_(s.root,c);if(!e)return null;let t=u?[e,d]:[d,e];m=p_(s.root,c,a_(a.groupId,l,t,[.5,.5]))}return s_(m)>4?null:{root:m,focusedPaneId:a.paneId}}function x_(e,t){let n=e.indexOf(t);return n<0?null:e[n+1]??(n>0?e[n-1]??null:null)}function S_(e,t){let n=u_(e.root,t);if(!n)return null;let{pane:r}=n,i=r.focusedTabId===t?x_(r.tabs.map(e=>e.tabId),t):null,a=f_(e.root,r.id),o=h_(e.root,t).root,s={root:o,focusedPaneId:e.focusedPaneId===null?null:(l_(o,e.focusedPaneId)?e.focusedPaneId:null)??(a&&l_(o,a)?a:null)??y_(o)??`main`};return i?w_(s,i)??s:s}function C_(e,t,n,r){let i=u_(e.root,t);if(!i||!l_(e.root,n))return null;let a=i.pane.id===n,o=h_(e.root,t,{preserveEmptyPaneId:a?n:void 0});if(!o.tab)return null;let s=g_(o.root,n,o.tab,{index:r});return s?{root:s,focusedPaneId:n}:null}function w_(e,t){let n=u_(e.root,t);if(!n)return null;let{pane:r,path:i}=n;return r.focusedTabId===t&&e.focusedPaneId===r.id?null:{root:p_(e.root,i,i_(r.id,r.tabs,t)),focusedPaneId:r.id}}function T_(e,t){return e.focusedPaneId===t||!l_(e.root,t)?null:{...e,focusedPaneId:t}}function E_(e,t,n){let r=l_(e.root,t);if(!r)return null;let i=d_(e.root,r);if(!i||!Rg(i))return null;let a=new Map(i.tabs.map(e=>[e.tabId,e])),o=new Set,s=[];for(let e of n){let t=a.get(e);t&&!o.has(e)&&(o.add(e),s.push(t))}for(let e of i.tabs)o.has(e.tabId)||s.push(e);if(s.every((e,t)=>e.tabId===i.tabs[t]?.tabId))return null;let c=p_(e.root,r,i_(i.id,s,i.focusedTabId));return{...e,root:c}}function D_(e,t,n,r){let i=d_(e.root,t);if(!i||!Rg(i))return e;let a=i.tabs.map(e=>e.tabId===n?{...e,target:r}:e);return{...e,root:p_(e.root,t,i_(i.id,a,i.focusedTabId))}}function O_(e,t,n={createdAt:0}){let r=$g(t),i=n.focus??!0,a=u_(e.root,r);if(a){let n=a.pane.tabs.find(e=>e.tabId===r),o=n&&!n_(n.target,t)?D_(e,a.path,r,t):e;return i?{layout:w_(o,r)??o,tabId:r}:{layout:o,tabId:r}}let o=(e.focusedPaneId&&l_(e.root,e.focusedPaneId)?e.focusedPaneId:null)??y_(e.root);if(!o)return null;let s=g_(e.root,o,r_(t,n.createdAt),{focus:i});return s?{layout:{root:s,focusedPaneId:i?o:e.focusedPaneId},tabId:r}:null}function k_(e,t,n=[]){if(zg(e)){if(e.id===t)return n;for(let[r,i]of e.children.entries()){let e=k_(i,t,[...n,r]);if(e)return e}}return null}function A_(e,t,n){let r=k_(e.root,t);if(!r)return null;let i=d_(e.root,r);if(!i||!zg(i)||n.length!==i.children.length)return null;let a=Wg(Ug(n,i.children.length));if(a.every((e,t)=>Math.abs(e-(i.sizes[t]??0))<1e-6))return null;let o=p_(e.root,r,a_(i.id,i.direction,i.children,a));return{...e,root:o}}function j_(e,t,n,r){if(r===0||!Number.isFinite(r))return null;let i=k_(e.root,t);if(!i)return null;let a=d_(e.root,i);if(!a||!zg(a))return null;let o=Gg(a.sizes,n,r);if(o.every((e,t)=>Math.abs(e-(a.sizes[t]??0))<1e-9))return null;let s=p_(e.root,i,a_(a.id,a.direction,a.children,o));return{...e,root:s}}var M_={left:0,top:0,right:1,bottom:1};function N_(e,t=M_){if(Rg(e))return[{paneId:e.id,rect:t}];let n=e.direction===`horizontal`,r=n?t.right-t.left:t.bottom-t.top,i=[],a=n?t.left:t.top;for(let[o,s]of e.children.entries()){let c=(e.sizes[o]??0)*r,l=n?{...t,left:a,right:a+c}:{...t,top:a,bottom:a+c};i.push(...N_(s,l)),a+=c}return i}function P_(e,t,n,r){return t<=n?n-t:r<=e?e-r:0}function F_(e,t,n,r){return Math.max(0,Math.min(t,r)-Math.max(e,n))}function I_(e,t,n){switch(e){case`left`:return t.left-n.right;case`right`:return n.left-t.right;case`up`:return t.top-n.bottom;case`down`:return n.top-t.bottom}}function L_(e,t,n){let r=N_(e),i=r.find(e=>e.paneId===t);if(!i)return null;let a=r.filter(e=>e.paneId!==t).map(e=>{let{rect:t}=e,r=i.rect,a=I_(n,r,t),o=n===`left`||n===`right`,s=o?r.top:r.left,c=o?r.bottom:r.right,l=o?t.top:t.left,u=o?t.bottom:t.right,d=P_(s,c,l,u),f=F_(s,c,l,u),p=Math.abs((s+c)/2-(l+u)/2);return{paneId:e.paneId,primary:a,perpendicular:d,shared:f,centreDistance:p}}).filter(e=>e.primary>=-1e-6);return a.length===0?null:(a.sort((e,t)=>e.primary-t.primary||e.perpendicular-t.perpendicular||t.shared-e.shared||e.centreDistance-t.centreDistance||e.paneId.localeCompare(t.paneId)),a[0]?.paneId??null)}var R_=.05,z_={left:`horizontal`,right:`horizontal`,up:`vertical`,down:`vertical`},B_={left:-1,right:1,up:-1,down:1};function V_(e,t,n,r=R_){let i=l_(e,t);if(!i)return null;let a=z_[n];for(let t=i.length-1;t>=0;t--){let o=d_(e,i.slice(0,t));if(!o||!zg(o)||o.direction!==a)continue;let s=i[t],c=s<o.children.length-1?s:s-1;if(!(c<0))return{groupId:o.id,index:c,deltaRatio:B_[n]*r}}return null}function H_(e,t){return`${e}-recovered-${t||`root`}`}function U_(e){return typeof e==`string`&&e.trim().length>0?e.trim():null}function W_(e){return e===`vertical`?`vertical`:`horizontal`}function G_(e){return typeof e==`number`&&Number.isFinite(e)?e:null}function K_(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){if(!E(n))continue;let e=t_(n.target);e&&t.push(r_(e,G_(n.createdAt)??0))}return t}function q_(e){if(!Array.isArray(e))return;let t=[];for(let n of e){let e=G_(n);e!==null&&t.push(e)}return t}function J_(e,t,n){if(e===void 0||!E(e))return null;let r=U_(e.id);if(e.kind===`pane`)return i_(r??H_(`pane`,n),K_(e.tabs),U_(e.focusedTabId));if(e.kind!==`group`||!Array.isArray(e.children))return null;if(t>=4){let r=e.children.map((e,r)=>J_(e,t,`${n}.${r}`)).filter(e=>e!==null).flatMap(c_),i=r[0];return i?i_(i.id,r.flatMap(e=>e.tabs)):null}let i=e.children.map((e,r)=>J_(e,t+1,`${n}.${r}`)).filter(e=>e!==null);return i.length===0?null:a_(r??H_(`group`,n),W_(e.direction),i,q_(e.sizes))}function Y_(e,t){if(e===null)return null;let n=U_(e);return n&&t.some(e=>e.id===n)?n:t[0]?.id??`main`}function X_(e){if(e===void 0||!E(e))return o_();let t=J_(e.root,1,``);if(!t)return o_();let n=c_(t);return n.length===0?o_():{root:t,focusedPaneId:Y_(e.focusedPaneId,n)}}var Z_=`main`,Q_=`changes`,$_=`workspace`,ev=`terminals`,tv=`root`;function nv(e,t){return!Number.isFinite(e)||e<=0||e>=100?t:e/100}function rv(e){let t=i_(Z_,[]),n=e.terminals.filter(e=>e.id.trim().length>0).map((e,t)=>i_(`terminal-${e.id}`,[r_({kind:`terminal`,terminalId:e.id.trim()},t)])),r=n.length>0?a_(ev,`horizontal`,n,[...e.terminalSizes]):null,i=nv(e.mainSizes[0],.68),a=r?a_($_,`vertical`,[t,r],[i,1-i]):t;if(!e.changesVisible)return{root:a,focusedPaneId:Z_};let o=nv(e.changesSizePercent,.33);return{root:a_(tv,`horizontal`,[a,i_(Q_,[r_({kind:`changes`},0)])],[1-o,o]),focusedPaneId:Z_}}function iv(e){return c_(e.root).find(t=>t.id===e.focusedPaneId)??null}function av(e){return iv(e)?.focusedTabId??null}function ov(e,t){let n=av(t);return!n||e[0]===n?e:[n,...e.filter(e=>e!==n)].slice(0,50)}function sv(e,t){let n=c_(e.root).flatMap((e,t)=>e.tabs.map(e=>({tab:e,paneOrdinal:t+1}))),r=new Map,i=av(e);i&&r.set(i,-1),t.forEach((e,t)=>{r.has(e)||r.set(e,t)});let a=2**53-1;return n.map((e,t)=>({entry:e,layoutIndex:t,rank:r.get(e.tab.tabId)??a})).sort((e,t)=>e.rank-t.rank||e.layoutIndex-t.layoutIndex).map(({entry:e})=>e)}function cv(e,t){return!e||e.tabs.length===0?null:t===9?e.tabs[e.tabs.length-1].tabId:e.tabs[t-1]?.tabId??null}function lv(e,t){return e<8?String(e+1):e===t-1?`9`:null}function uv(e,t){let n=Vm(e,`openTabSwitcher`).find(e=>Km(e,t));if(!n)return null;let r=n.split(`+`).some(e=>e.trim().toLowerCase()===`shift`);return{binding:n,reverse:t.shiftKey&&!r}}function dv(e,t){return Vm(e,`jumpToPaneTab`).some(e=>Gm(e,t))}function fv(e,t){if(!dv(e,t)||!t.code.startsWith(`Digit`))return null;let n=Number(t.code.slice(5));return n>=1&&n<=9?n:null}function pv(e){return c_(e.root).some(e=>e.tabs.length>0)}var mv=i()(lh((e,t)=>{function n(t){e(e=>{let n=t(e.layout);return n?{...e,layout:n,recentTabIds:ov(e.recentTabIds,n)}:e})}function r(){let n=t().nodeSequence+1;return e({nodeSequence:n}),{paneId:`pane-${n}`,groupId:`group-${n}`}}return{layout:o_(),nodeSequence:0,recentTabIds:[],getLayout:()=>t().layout,openTab:e=>n(t=>O_(t,e,{createdAt:0})?.layout??null),closeTab:e=>n(t=>S_(t,e)),closeTabsFor:({chatIds:e,boardIds:t})=>n(n=>{let r=c_(n.root).flatMap(e=>e.tabs).filter(({target:n})=>n.kind===`chat`&&e.includes(n.chatId)||n.kind===`board`&&t.includes(n.boardId));return r.length===0?null:r.reduce((e,t)=>S_(e,t.tabId)??e,n)}),focusTab:e=>n(t=>w_(t,e)),focusPane:e=>n(t=>T_(t,e)),splitPane:e=>{let t=r();n(n=>b_(n,{...e,ids:t}))},moveTabToPane:(e,t,r)=>n(n=>C_(n,e,t,r)),focusAdjacentPane:e=>n(t=>{if(!t.focusedPaneId)return null;let n=L_(t.root,t.focusedPaneId,e);return n?T_(t,n):null}),resizeFocusedPane:e=>n(t=>{if(!t.focusedPaneId)return null;let n=V_(t.root,t.focusedPaneId,e);return n?j_(t,n.groupId,n.index,n.deltaRatio):null}),cycleFocusedPaneTab:e=>n(t=>{let n=c_(t.root).find(e=>e.id===t.focusedPaneId);if(!n||n.tabs.length===0)return null;let r=n.tabs.findIndex(e=>e.tabId===n.focusedTabId),i=(((r===-1?0:r)+e)%n.tabs.length+n.tabs.length)%n.tabs.length;return w_(t,n.tabs[i].tabId)}),closeFocusedTab:()=>n(e=>{let t=c_(e.root).find(t=>t.id===e.focusedPaneId),n=t?.focusedTabId??t?.tabs[0]?.tabId;return n?S_(e,n):null}),splitFocusedPane:e=>{let i=t().layout,a=c_(i.root).find(e=>e.id===i.focusedPaneId),o=a?.focusedTabId??a?.tabs[0]?.tabId;if(!a||!o)return;let s=r();n(t=>b_(t,{tabId:o,targetPaneId:a.id,position:e,ids:s}))},reorderPaneTabs:(e,t)=>n(n=>E_(n,e,t)),resizeGroup:(e,t,r)=>n(n=>j_(n,e,t,r)),setGroupSizes:(e,t)=>n(n=>A_(n,e,t)),seedFromLegacy:t=>e(e=>{if(pv(e.layout))return e;let n=rv(t);return{...e,layout:n,recentTabIds:ov(e.recentTabIds,n)}})}},{name:`pane-layouts`,version:2,migrate:(e,t)=>{if(t>=2)return e;let n=s(e)?e.nodeSequence:void 0;return{nodeSequence:typeof n==`number`?n:0}},merge:(e,t)=>{if(!s(e))return t;let n=X_(ce(e.layout)),r=pv(n)?n:t.layout,i=e.nodeSequence,a=typeof i==`number`&&Number.isFinite(i)?i:0,o=e.recentTabIds,c=Array.isArray(o)?o.filter(e=>typeof e==`string`):t.recentTabIds;return{...t,layout:r,nodeSequence:a,recentTabIds:c}},partialize:e=>({layout:e.layout,nodeSequence:e.nodeSequence,recentTabIds:e.recentTabIds})})),hv=i()(lh(e=>({checkedPathsByProjectId:{},reconcileProject:(t,n)=>e(e=>{let r=e.checkedPathsByProjectId[t]??{},i=Object.fromEntries(n.map(e=>[e,r[e]??!0]));return Object.keys(r).length===Object.keys(i).length&&Object.entries(i).every(([e,t])=>r[e]===t)?e:{checkedPathsByProjectId:{...e.checkedPathsByProjectId,[t]:i}}}),toggleChecked:(t,n)=>e(e=>{let r=e.checkedPathsByProjectId[t]??{};return{checkedPathsByProjectId:{...e.checkedPathsByProjectId,[t]:{...r,[n]:!(r[n]??!0)}}}}),toggleAllChecked:(t,n)=>e(e=>{if(n.length===0)return e;let r=e.checkedPathsByProjectId[t]??{},i=!n.every(e=>r[e]??!0);return{checkedPathsByProjectId:{...e.checkedPathsByProjectId,[t]:{...r,...Object.fromEntries(n.map(e=>[e,i]))}}}}),clearProject:t=>e(e=>{let{[t]:n,...r}=e.checkedPathsByProjectId;return{checkedPathsByProjectId:r}})}),{name:`diff-commit-selections`,version:2}));function gv(e){Fh.getState().forgetChats(e.chatIds),Eh.getState().forgetChats(e.chatIds),mv.getState().closeTabsFor({chatIds:e.chatIds,boardIds:e.boardIds??[]}),e.projectId&&hv.getState().clearProject(e.projectId)}function _v(e,t){let n=t.getItem(e);if(!n)return null;let r=ae(n);return r===null||!E(r)?null:E(r.state)?r.state:null}function vv(e){if(!E(e))return;let t={};if(E(e.claude)){let n=yv(e.claude),r=e.claude.modelOptions;if(E(r)){let e=bv(r.reasoningEffort),t=bv(r.contextWindow);lm(e)&&fm(t)&&(n.modelOptions={reasoningEffort:e,contextWindow:t})}t.claude=n}if(E(e.codex)){let n=yv(e.codex),r=e.codex.modelOptions;if(E(r)){let e=bv(r.reasoningEffort);um(e)&&typeof r.fastMode==`boolean`&&(n.modelOptions={reasoningEffort:e,fastMode:r.fastMode})}t.codex=n}return E(e.openrouter)&&(t.openrouter=yv(e.openrouter)),E(e.custom)&&(t.custom=yv(e.custom)),Object.keys(t).length>0?t:void 0}function yv(e){let t={};return typeof e.model==`string`&&(t.model=e.model),typeof e.planMode==`boolean`&&(t.planMode=e.planMode),t}function bv(e){return typeof e==`string`?e:void 0}async function xv(e,t=f){let n=await t.getJson(`/auth/status`,{cache:`no-store`,signal:e});return n.ok?n.data:{}}async function Sv(e,t=f){let n={password:e.password};return e.next&&(n.next=e.next),(await t.postJson(`/auth/login`,n)).ok}async function Cv(e=f){await e.postJson(`/auth/logout`,{})}function wv(e){let t=(0,O.useCallback)(async t=>{try{await e.command(t),_.getState().setCommandError(null)}catch(e){_.getState().setCommandError(e instanceof Error?e.message:String(e))}},[e]);return{handleCreateStack:(0,O.useCallback)((e,n,r)=>t({type:`stack.create`,title:e,projectIds:n,...r?{instructions:r}:{}}),[t]),handleRenameStack:(0,O.useCallback)((e,n)=>t({type:`stack.rename`,stackId:e,title:n}),[t]),handleRemoveStack:(0,O.useCallback)(e=>t({type:`stack.remove`,stackId:e}),[t]),handleAddProjectToStack:(0,O.useCallback)((e,n)=>t({type:`stack.addProject`,stackId:e,projectId:n}),[t]),handleRemoveProjectFromStack:(0,O.useCallback)((e,n)=>t({type:`stack.removeProject`,stackId:e,projectId:n}),[t]),handleSetProjectInstructions:(0,O.useCallback)((e,n)=>t({type:`project.setInstructions`,projectId:e,instructions:n}),[t]),handleSetStackInstructions:(0,O.useCallback)((e,n)=>t({type:`stack.setInstructions`,stackId:e,instructions:n}),[t])}}function $(e,t){return e===t}function Tv(e,t){for(let n of[`claude`,`codex`,`openrouter`,`custom`])if(e[n]!==t[n])return!1;return!0}function Ev(e,t){return e===t||e.length===t.length&&e.every((e,n)=>{let r=t[n];return r!==void 0&&e.id===r.id&&e.taskType===r.taskType&&e.description===r.description&&e.startedAt===r.startedAt})}var Dv={chatId:$,projectId:$,localPath:$,title:$,status:$,isDraining:$,provider:$,planMode:$,sessionTokensByProvider:Tv,timings:()=>!0,policyOverride:()=>!0,sessionState:()=>!0,backgroundTasks:Ev};function Ov(e,t){return e===t?!0:!e||!t?!1:Dv.chatId(e.chatId,t.chatId)&&Dv.projectId(e.projectId,t.projectId)&&Dv.localPath(e.localPath,t.localPath)&&Dv.title(e.title,t.title)&&Dv.status(e.status,t.status)&&Dv.isDraining(e.isDraining,t.isDraining)&&Dv.provider(e.provider,t.provider)&&Dv.planMode(e.planMode,t.planMode)&&Dv.sessionTokensByProvider(e.sessionTokensByProvider,t.sessionTokensByProvider)&&Dv.timings(e.timings,t.timings)&&Dv.policyOverride(e.policyOverride,t.policyOverride)&&Dv.sessionState(e.sessionState,t.sessionState)&&Dv.backgroundTasks(e.backgroundTasks,t.backgroundTasks)}function kv(e,t){return e===t||e.length===t.length&&e.every((e,n)=>{let r=t[n];return!!r&&e.path===r.path&&e.changeType===r.changeType&&e.isUntracked===r.isUntracked&&e.additions===r.additions&&e.deletions===r.deletions&&e.patchDigest===r.patchDigest&&e.mimeType===r.mimeType&&e.size===r.size})}function Av(e,t){let n=e?.entries??[],r=t?.entries??[];return n.length===r.length&&n.every((e,t)=>{let n=r[t];return!!n&&e.sha===n.sha&&e.summary===n.summary&&e.description===n.description&&e.authorName===n.authorName&&e.authoredAt===n.authoredAt&&e.githubUrl===n.githubUrl&&e.tags.length===n.tags.length&&e.tags.every((e,t)=>e===n.tags[t])})}var jv={status:$,files:kv,branchHistory:Av,branchName:$,defaultBranchName:$,hasOriginRemote:$,originRepoSlug:$,hasUpstream:$,aheadCount:$,behindCount:$,lastFetchedAt:$};function Mv(e,t){return e===t?!0:!e||!t?!1:jv.status(e.status,t.status)&&jv.files(e.files,t.files)&&jv.branchHistory(e.branchHistory,t.branchHistory)&&jv.branchName(e.branchName,t.branchName)&&jv.defaultBranchName(e.defaultBranchName,t.defaultBranchName)&&jv.hasOriginRemote(e.hasOriginRemote,t.hasOriginRemote)&&jv.originRepoSlug(e.originRepoSlug,t.originRepoSlug)&&jv.hasUpstream(e.hasUpstream,t.hasUpstream)&&jv.aheadCount(e.aheadCount,t.aheadCount)&&jv.behindCount(e.behindCount,t.behindCount)&&jv.lastFetchedAt(e.lastFetchedAt,t.lastFetchedAt)}function Nv(e,t){return!!(e&&e.status!==`unknown`&&t&&t.status===`unknown`&&t.files.length===0)}var Pv=`kanna:ui-update-restart`,Fv=`kanna:last-update-reload-request`;function Iv(e,t){return t===`updating`||t===`restart_pending`?{active:!0,label:`Installing update`}:e===`awaiting_disconnect`||e===`awaiting_server_ready`?{active:!0,label:`Re-deploying Kanna`}:{active:!1,label:``}}function Lv(e,t){switch(t.kind){case`reload_requested`:return String(t.reloadRequestedAt)===t.lastHandled?e:`awaiting_disconnect`;case`update_initiated`:return`awaiting_disconnect`;case`connection_status_changed`:return t.connectionStatus===`disconnected`&&e===`awaiting_disconnect`?`awaiting_server_ready`:e;case`server_ready`:return`idle`;case`aborted`:return`idle`;case`update_status_changed`:return e}}var Rv=class{deps;phase;updateStatus=null;pollCancelled=!1;pollTimeoutId=null;isServerReady;constructor(e,t){this.deps=e,this.isServerReady=t.isServerReady;let n=e.storage.getItem(Pv);this.phase=n===`awaiting_disconnect`||n===`awaiting_server_ready`?n:`idle`,this.phase===`awaiting_server_ready`&&this.startPolling()}getSnapshot(){return{phase:this.phase,activity:Iv(this.phase,this.updateStatus)}}emit(){this.deps.onSnapshot(this.getSnapshot())}setPhase(e){e!==this.phase&&(this.phase=e,e===`idle`?this.deps.storage.removeItem(Pv):this.deps.storage.setItem(Pv,e),this.emit())}dispatch(e){if(e.kind===`update_status_changed`){let t=this.updateStatus;this.updateStatus=e.updateStatus,t!==this.updateStatus&&this.emit();return}let t=Lv(this.phase,e);e.kind===`reload_requested`&&t===`awaiting_disconnect`&&this.deps.storage.setItem(Fv,String(e.reloadRequestedAt)),this.setPhase(t),t===`awaiting_server_ready`&&this.startPolling()}startPolling(){this.pollCancelled=!1,se(`appRuntime.poll`,this.poll())}async poll(){try{if(await this.isServerReady()){if(this.pollCancelled)return;this.setPhase(`idle`),this.deps.dom.reload();return}}catch{}this.pollCancelled||(this.pollTimeoutId=this.deps.timer.setTimeout(()=>{se(`appRuntime.poll`,this.poll())},500))}close(){this.pollCancelled=!0,this.pollTimeoutId!==null&&(this.deps.timer.clearTimeout(this.pollTimeoutId),this.pollTimeoutId=null)}static getLastHandledReloadRequest(e){return e.getItem(Fv)}},zv=`settings.readLlmProvider`,Bv=`chat.compose`,Vv=`lever-theme`,Hv=`chat-sound-preferences`,Uv=`terminal-preferences`,Wv=`chat-preferences`;function Gv(e,t){t&&t.projectId===e&&Ih.getState().setForProject(t.projectId,t.commands)}function Kv(e){let t={},n=e.getItem(Vv);(n===`light`||n===`dark`||n===`system`)&&(t.theme=n);let r=_v(Hv,e);(r?.chatSoundPreference===`never`||r?.chatSoundPreference===`unfocused`||r?.chatSoundPreference===`always`)&&(t.chatSoundPreference=r.chatSoundPreference),(r?.chatSoundId===`blow`||r?.chatSoundId===`bottle`||r?.chatSoundId===`frog`||r?.chatSoundId===`funk`||r?.chatSoundId===`glass`||r?.chatSoundId===`ping`||r?.chatSoundId===`pop`||r?.chatSoundId===`purr`||r?.chatSoundId===`tink`)&&(t.chatSoundId=r.chatSoundId);let i=_v(Uv,e);if(i){t.terminal={},typeof i.scrollbackLines==`number`&&(t.terminal.scrollbackLines=i.scrollbackLines),typeof i.minColumnWidth==`number`&&(t.terminal.minColumnWidth=i.minColumnWidth);let e={};(i.editorPreset===`cursor`||i.editorPreset===`vscode`||i.editorPreset===`xcode`||i.editorPreset===`windsurf`||i.editorPreset===`custom`)&&(e.preset=i.editorPreset),typeof i.editorCommandTemplate==`string`&&(e.commandTemplate=i.editorCommandTemplate),Object.keys(e).length>0&&(t.editor=e)}let a=_v(Wv,e);(a?.defaultProvider===`last_used`||a?.defaultProvider===`claude`||a?.defaultProvider===`codex`)&&(t.defaultProvider=a.defaultProvider);let o=a?vv(a.providerDefaults):null;return o&&(t.providerDefaults=o),t.browserSettingsMigrated=!0,Object.keys(t).length>1?t:null}function qv(e){e.removeItem(Vv),e.removeItem(Hv),e.removeItem(Uv),e.removeItem(Wv)}function Jv(e,t){if(!t?.length||e.length<=1)return e;let n=new Map(e.map((e,t)=>[e.groupKey,t])),r=new Set,i=t.map(t=>{if(r.has(t))return null;r.add(t);let i=n.get(t);return i===void 0?null:e[i]}).filter(e=>!!e);if(i.length===0)return e;let a=[...i,...e.filter(e=>!r.has(e.groupKey))];return a.every((t,n)=>t===e[n])?e:a}function Yv(e,t){let n=e.find(e=>e.chats.some(e=>e.chatId===t));return n?n.chats.find(e=>e.chatId!==t)?.chatId??null:null}function Xv(e,t){return t?e.find(e=>e.chats.some(e=>e.chatId===t))?.groupKey??null:null}function Zv(e,t){let n=e.find(e=>e.groupKey===t);return n?n.chats.find(e=>e.provider!=null)?.provider??null??n.sourceProvider??null:null}function Qv(e,t){return t===`updating`||t===`restart_pending`?{active:!0,label:`Installing update`}:e===`awaiting_disconnect`||e===`awaiting_server_ready`?{active:!0,label:`Re-deploying Kanna`}:{active:!1,label:``}}function $v(e){let t=e.selectedProjectId??e.sidebarProjectId??null;return t?{kind:`project_id`,projectId:t}:e.fallbackLocalProjectPath?{kind:`local_path`,localPath:e.fallbackLocalProjectPath}:null}function ey(e,t,n,r,i,a,s,c,l){let u=Zu(),f=_(e=>e.sidebarData),m=_(e=>e.optimisticSidebarProjectOrder),h=_(e=>e.localProjects),v=_(e=>e.updateSnapshot),y=_(e=>e.uiRestartPhase),b=_(e=>e.keybindings),x=T(e=>e.settings),S=_(e=>e.pushConfig),C=_(e=>e.llmProvider),w=_(e=>e.connectionStatus),ee=_(e=>e.sidebarReady),te=_(e=>e.localProjectsReady),re=_(e=>e.sidebarOpen),ie=_(e=>e.sidebarCollapsed),E=_(e=>e.addProjectModalOpen),ae=_(e=>e.commandError),ce=_(e=>e.startingLocalPath),D=_(e=>e.selectedProjectId),de=mv(le(e=>c_(e.layout.root).flatMap(e=>e.tabs).flatMap(e=>e.target.kind===`chat`?[e.target.chatId]:[]))),fe=c?.projectId??null,pe=(0,O.useRef)(null);(0,O.useEffect)(()=>{let e=new Rv({storage:n,dom:r,timer:i,onSnapshot:e=>{_.getState().setUiRestartPhase(e.phase===`idle`?null:e.phase)}},{isServerReady:async()=>{let e=await xv();return Object.keys(e).length>0}});return pe.current=e,()=>{e.close(),pe.current=null}},[r,n,i]),(0,O.useEffect)(()=>{pe.current?.dispatch({kind:`update_status_changed`,updateStatus:v?.status})},[v?.status]),(0,O.useEffect)(()=>{let e=pe.current;e&&v?.reloadRequestedAt&&e.dispatch({kind:`reload_requested`,reloadRequestedAt:v.reloadRequestedAt,lastHandled:Rv.getLastHandledReloadRequest(n)})},[n,v?.reloadRequestedAt]),(0,O.useEffect)(()=>{pe.current?.dispatch({kind:`connection_status_changed`,connectionStatus:w})},[w]);let me=(0,O.useCallback)(e=>{pe.current?.dispatch({kind:`update_initiated`})},[]),he=(0,O.useCallback)(()=>{pe.current?.dispatch({kind:`aborted`})},[]),k=(0,O.useMemo)(()=>Jv(f.projectGroups,m),[m,f.projectGroups]),ge=(0,O.useMemo)(()=>k===f.projectGroups?f:{...f,projectGroups:k},[f,k]),_e=h?.projects[0]?.localPath??null;(0,O.useEffect)(()=>e.onStatus(e=>_.getState().setConnectionStatus(e)),[e]),(0,O.useEffect)(()=>e.subscribe({type:`sidebar`},e=>{let t=_.getState();t.setSidebarData(e),t.setOptimisticSidebarProjectOrder(t=>t&&Jv(e.projectGroups,t)===e.projectGroups?null:t),t.setSidebarReady(!0),t.setCommandError(null)}),[e]),(0,O.useEffect)(()=>e.subscribe({type:`local-projects`},e=>{let t=_.getState();t.setLocalProjects(e),t.setLocalProjectsReady(!0),t.setCommandError(null)}),[e]),(0,O.useEffect)(()=>e.subscribe({type:`update`},e=>{let t=_.getState();t.setUpdateSnapshot(e),t.setCommandError(null)}),[e]),(0,O.useEffect)(()=>e.subscribe({type:`keybindings`},e=>{let t=_.getState();t.setKeybindings(e),t.setCommandError(null)}),[e]),(0,O.useEffect)(()=>e.subscribe({type:`app-settings`},e=>{let t=_.getState();T.getState().setFromServer(e),Eh.getState().applyServerDefaults(e.defaultProvider,e.providerDefaults),t.setCommandError(null)}),[e]),(0,O.useEffect)(()=>e.subscribe({type:`push-config`},e=>{_.getState().setPushConfig(e)}),[e]),(0,O.useEffect)(()=>e.subscribe({type:`followed-sessions`},e=>{Dg.getState().setFollowed(e.chatIds)}),[e]),(0,O.useEffect)(()=>e.subscribe({type:`cron-jobs`},e=>{g.getState().setRows(e.rows)}),[e]),(0,O.useEffect)(()=>e.subscribe({type:`beacons`},e=>{ih.getState().setRows(e.beacons)}),[e]),(0,O.useEffect)(()=>e.subscribe({type:`package-updates`},e=>{Ig.getState().setPackageUpdateSnapshot(e)}),[e]),(0,O.useEffect)(()=>{let t=new Set,n=new Map;for(let e of de){let r=Xv(k,e);r&&(t.add(r),n.set(p(r,e),{projectId:r,chatId:e}))}D&&t.add(D),fe&&t.add(fe);for(let e of t)n.has(e)||n.set(e,{projectId:e});if(t.size===0)return;let r=[];return n.forEach(({projectId:t,chatId:n},i)=>{r.push(e.subscribe({type:`project-git`,projectId:t,...n===void 0?{}:{chatId:n}},e=>{_.getState().setDiffSnapshotsByKey(t=>{let n=e??null;return Nv(t[i]??null,n)||Mv(t[i]??null,n)?t:{...t,[i]:n}}),_.getState().setCommandError(null)}))}),t.forEach(t=>{r.push(e.subscribe({type:`project-commands`,projectId:t},e=>{Gv(t,e)}))}),()=>{r.forEach(e=>e())}},[de,k,fe,D,e]),(0,O.useEffect)(()=>{w===`connected`&&e.command({type:`update.check`,force:!0}).catch(e=>{_.getState().setCommandError(e instanceof Error?e.message:String(e))})},[w,e]),(0,O.useEffect)(()=>{function t(){v?.lastCheckedAt&&(Date.now()-v.lastCheckedAt<=36e5||e.command({type:`update.check`}).catch(e=>{_.getState().setCommandError(e instanceof Error?e.message:String(e))}))}return r.addWindowListener(`focus`,t)},[r,e,v?.lastCheckedAt]),(0,O.useEffect)(()=>{function e(){_.getState().incrementFocusEpoch()}let t=r.addWindowListener(`focus`,e),n=r.addDocumentListener(`visibilitychange`,e);return()=>{t(),n()}},[r]);let ve=(0,O.useCallback)(async()=>{try{T.getState().setHydrationStatus(`loading`);let t=await e.command({type:`settings.readAppSettings`}),n=_.getState();T.getState().setFromServer(t),Eh.getState().applyServerDefaults(t.defaultProvider,t.providerDefaults),n.setCommandError(null)}catch(e){T.getState().setHydrationStatus(`error`),_.getState().setCommandError(e instanceof Error?e.message:String(e))}},[e]),ye=(0,O.useCallback)(async()=>{try{let t=await e.command({type:`settings.readLlmProvider`}),n=_.getState();n.setLlmProvider(t),n.setCommandError(null)}catch(e){_.getState().setCommandError(e instanceof Error?e.message:String(e))}},[e]);(0,O.useEffect)(()=>{w===`connected`&&se(`read app settings`,ve())},[w,ve]),(0,O.useEffect)(()=>{w===`connected`&&(Qh.getState().setLoading(),e.command({type:`settings.listOpenRouterModels`}).then(e=>{Qh.getState().setModels(e)}).catch(o(e=>{let t=e.message;Qh.getState().setError(t)})))},[w,e]);let be=(0,O.useCallback)(async t=>{try{T.getState().applyOptimisticPatch(t);let n=await e.command({type:`settings.writeAppSettingsPatch`,patch:t}),r=_.getState();T.getState().setFromServer(n),Eh.getState().applyServerDefaults(n.defaultProvider,n.providerDefaults),r.setCommandError(null)}catch(e){throw _.getState().setCommandError(e instanceof Error?e.message:String(e)),await ve(),e}},[ve,e]);(0,O.useEffect)(()=>{if(w!==`connected`||x?.browserSettingsMigrated!==!1)return;let e=Kv(t);e&&se(`migrate legacy browser settings`,be(e).then(()=>qv(t)))},[x?.browserSettingsMigrated,w,be,t]),(0,O.useEffect)(()=>{w===`connected`&&d(zv,ye)},[w,ye]),(0,O.useEffect)(()=>{if(D)return;let e=k[0];e&&_.getState().setSelectedProjectId(e.groupKey)},[D,k]);let xe=(0,O.useCallback)(async t=>{try{await e.command({type:`settings.testMcpServer`,id:t}),_.getState().setCommandError(null)}catch(e){throw _.getState().setCommandError(e instanceof Error?e.message:String(e)),e}},[e]),A=(0,O.useCallback)(async()=>{try{return kg(await e.command({type:`beacons.mintPairingCode`}))}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}},[e]),Se=(0,O.useCallback)(async t=>{try{return Ag(await e.command({type:`beacons.update`,beaconId:t}))}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}},[e]),Ce=(0,O.useCallback)(async t=>{try{let n=await e.command({type:`settings.startMcpOAuth`,id:t});return _.getState().setCommandError(null),n}catch(e){let t=e instanceof Error?e.message:String(e);return _.getState().setCommandError(t),{ok:!1,error:t}}},[e]),we=(0,O.useCallback)(async(t,n)=>{try{let r=await e.command({type:`settings.completeMcpOAuth`,id:t,callbackUrl:n});return _.getState().setCommandError(null),r}catch(e){let t=e instanceof Error?e.message:String(e);return _.getState().setCommandError(t),{ok:!1,error:t}}},[e]),Te=(0,O.useCallback)(async(t,n)=>{try{await e.command({type:`chat.setPolicyOverride`,chatId:t,policyOverride:n}),_.getState().setCommandError(null)}catch(e){throw _.getState().setCommandError(e instanceof Error?e.message:String(e)),e}},[e]),Ee=(0,O.useCallback)(async t=>{try{T.getState().applyOptimisticPatch({cloudflareTunnel:t});let n=await e.command({type:`appSettings.setCloudflareTunnel`,patch:t}),r=_.getState();T.getState().setFromServer(n),Eh.getState().applyServerDefaults(n.defaultProvider,n.providerDefaults),r.setCommandError(null)}catch(e){throw _.getState().setCommandError(e instanceof Error?e.message:String(e)),await ve(),e}},[ve,e]),De=(0,O.useCallback)(async t=>{try{T.getState().applyOptimisticPatch({claudeAuth:t});let n=await e.command({type:`appSettings.setClaudeAuth`,patch:t}),r=_.getState();T.getState().setFromServer(n),Eh.getState().applyServerDefaults(n.defaultProvider,n.providerDefaults),r.setCommandError(null)}catch(e){throw _.getState().setCommandError(e instanceof Error?e.message:String(e)),await ve(),e}},[ve,e]),Oe=(0,O.useCallback)(async(t,n)=>await e.command({type:`appSettings.testOAuthToken`,token:t,baseUrl:n}),[e]),ke=(0,O.useCallback)(async t=>{try{let n=await e.command({type:`settings.writeLlmProvider`,provider:t.provider,apiKey:t.apiKey,model:t.model,baseUrl:t.baseUrl}),r=_.getState();r.setLlmProvider(n),r.setCommandError(null)}catch(e){throw _.getState().setCommandError(e instanceof Error?e.message:String(e)),e}},[e]),Ae=(0,O.useCallback)(async t=>await e.command({type:`settings.validateLlmProvider`,provider:t.provider,apiKey:t.apiKey,model:t.model,baseUrl:t.baseUrl}),[e]),je=(0,O.useCallback)(async()=>{try{await Cv(),_.getState().setCommandError(null),r.reload()}catch(e){_.getState().setCommandError(e instanceof Error?e.message:String(e))}},[r]),Me=(0,O.useCallback)(async t=>{try{await e.command({type:`update.check`,force:t?.force}),_.getState().setCommandError(null)}catch(e){_.getState().setCommandError(e instanceof Error?e.message:String(e))}},[e]),Ne=(0,O.useCallback)(async t=>{me(`awaiting_disconnect`);try{let n=await e.command({type:`update.install`,version:t});if(!n.ok){he(),_.getState().setCommandError(null),await u.alert({title:n.userTitle??`Update failed`,description:n.userMessage??`Kanna could not install the update. Try again later.`,closeLabel:`OK`});return}if(n.ok&&n.action===`reload`){r.reload();return}_.getState().setCommandError(null)}catch(e){he(),_.getState().setCommandError(e instanceof Error?e.message:String(e))}},[he,u,r,me,e]),Pe=(0,O.useCallback)(async()=>{me(`awaiting_disconnect`);try{let t=await e.command({type:`update.reload`});if(!t.ok){he(),_.getState().setCommandError(null),await u.alert({title:t.userTitle??`Re-deploy failed`,description:t.userMessage??`Kanna could not re-deploy. Try again later.`,closeLabel:`OK`});return}if(t.action===`reload`){r.reload();return}_.getState().setCommandError(null)}catch(e){he(),_.getState().setCommandError(e instanceof Error?e.message:String(e))}},[he,u,r,me,e]),Fe=(0,O.useCallback)(async t=>{let n=Eh.getState(),r=s?n.getComposerState(s):n.getComposerState(gh),i=n.defaultProvider===`last_used`?Zv(k,t):null,a=await e.command({type:`chat.create`,projectId:t});n.initializeComposerForChat(a.chatId,{sourceState:r,providerHint:i}),Rp.getState().markSpawned(a.chatId),se(`fly chat title to tab`,ng(a.chatId));let o=_.getState();o.setSelectedProjectId(t),o.setPendingChatId(a.chatId),l.openChat(a.chatId),o.setSidebarOpen(!1),o.setCommandError(null)},[s,l,k,e]),Ie=(0,O.useCallback)(async t=>t.kind===`project_id`?{projectId:t.projectId}:t.kind===`local_path`?{projectId:(await e.command({type:`project.open`,localPath:t.localPath})).projectId,localPath:t.localPath}:{projectId:(await e.command(t.project.mode===`new`?{type:`project.create`,localPath:t.project.localPath,title:t.project.title}:{type:`project.open`,localPath:t.project.localPath})).projectId,localPath:t.project.localPath},[e]),Le=(0,O.useCallback)(async e=>{try{let t;t=e.kind===`project_id`?null:e.kind===`local_path`?e.localPath:e.project.localPath,t&&_.getState().setStartingLocalPath(t);let{projectId:n}=await Ie(e);await Fe(n)}catch(e){_.getState().setCommandError(e instanceof Error?e.message:String(e))}finally{_.getState().setStartingLocalPath(null)}},[Fe,Ie]),Re=(0,O.useCallback)(async e=>{await Le({kind:`project_id`,projectId:e})},[Le]),ze=(0,O.useCallback)(async t=>{try{let n=await e.command({type:`chat.fork`,chatId:t.chatId}),r=Eh.getState();r.initializeComposerForChat(n.chatId,{sourceState:r.getComposerState(t.chatId)});let i=_.getState();i.setPendingChatId(n.chatId),l.openChat(n.chatId),i.setSidebarOpen(!1),i.setCommandError(null)}catch(e){_.getState().setCommandError(e instanceof Error?e.message:String(e))}},[l,e]),Be=(0,O.useCallback)(async e=>{await Le({kind:`local_path`,localPath:e})},[Le]),Ve=(0,O.useCallback)(async e=>{await Le({kind:`project_request`,project:e})},[Le]),He=(0,O.useCallback)(async t=>{let n=await u.prompt({title:`Rename Chat`,initialValue:t.title,confirmLabel:`Rename`});if(n&&n!==t.title)try{await e.command({type:`chat.rename`,chatId:t.chatId,title:n}),_.getState().setCommandError(null)}catch(e){_.getState().setCommandError(e instanceof Error?e.message:String(e))}},[u,e]),Ue=(0,O.useCallback)(async t=>{if(await u.confirm({title:`Delete Chat`,description:`Delete "${t.title}"? This cannot be undone.`,confirmLabel:`Delete`,confirmVariant:`destructive`}))try{if(await e.command({type:`chat.delete`,chatId:t.chatId}),gv({chatIds:[t.chatId]}),t.chatId===s){let e=Yv(k,t.chatId);e?l.openChat(e):l.closeChat()}}catch(e){_.getState().setCommandError(e instanceof Error?e.message:String(e))}},[s,l,u,k,e]),We=(0,O.useCallback)(async t=>{if(!t.length)return;let n=t.length;if(!await u.confirm({title:`Delete Chats`,description:`Delete ${n} chat${n===1?``:`s`}? This cannot be undone.`,confirmLabel:`Delete`,confirmVariant:`destructive`}))return;let r=s!=null&&t.includes(s);try{for(let n of t)await e.command({type:`chat.delete`,chatId:n}),gv({chatIds:[n]});if(r){let e=Yv(k,s);e?l.openChat(e):l.closeChat()}}catch(e){_.getState().setCommandError(e instanceof Error?e.message:String(e))}},[s,l,u,k,e]),Ge=(0,O.useCallback)(async t=>{try{if(await e.command({type:`chat.archive`,chatId:t.chatId}),t.chatId===s){let e=Yv(k,t.chatId);e?l.openChat(e):l.closeChat()}_.getState().setCommandError(null)}catch(e){_.getState().setCommandError(e instanceof Error?e.message:String(e))}},[s,l,k,e]),Ke=(0,O.useCallback)(async t=>{try{_.getState().setPendingChatId(t),await e.command({type:`chat.unarchive`,chatId:t}),l.openChat(t),_.getState().setCommandError(null)}catch(e){_.getState().setPendingChatId(null),_.getState().setCommandError(e instanceof Error?e.message:String(e))}},[l,e]),qe=(0,O.useCallback)(e=>{Sg.getState().clearProject(e),fg.getState().clearProject(e),c?.projectId===e&&l.closeChat()},[l,c]),Je=(0,O.useCallback)(async t=>{try{await e.command({type:`project.remove`,projectId:t}),qe(t),_.getState().setCommandError(null)}catch(e){_.getState().setCommandError(e instanceof Error?e.message:String(e))}},[qe,e]),Ye=(0,O.useCallback)(async t=>{let n=k.find(e=>e.groupKey===t),r=n?ue(n.localPath):`this project`,i=[...n?.chats??[],...n?.archivedChats??[]].map(e=>e.chatId);if(await u.confirm({title:`Delete Project`,description:`Delete "${r}" and everything Kanna stored for it: ${i.length} chat${i.length===1?``:`s`} (archived included), boards and their worktrees, share links, and the attachments in .kanna inside the folder. Your own files in the folder are not touched. This cannot be undone.`,confirmLabel:`Delete`,confirmVariant:`destructive`}))try{let n=Tg(await e.command({type:`project.delete`,projectId:t}));qe(t),gv({chatIds:i,boardIds:n.deletedBoardIds,projectId:t}),_.getState().setCommandError(n.failures.length>0?`Project deleted, but some data could not be removed: ${n.failures.join(`; `)}`:null)}catch(e){_.getState().setCommandError(e instanceof Error?e.message:String(e))}},[u,qe,k,e]),j=(0,O.useCallback)(async(t,n)=>{try{await e.command({type:`project.setStar`,projectId:t,starred:n}),_.getState().setCommandError(null)}catch(e){_.getState().setCommandError(e instanceof Error?e.message:String(e))}},[e]),Xe=(0,O.useCallback)(async t=>{_.getState().setOptimisticSidebarProjectOrder(t);try{await e.command({type:`sidebar.reorderProjectGroups`,projectIds:t}),_.getState().setCommandError(null)}catch(e){_.getState().setOptimisticSidebarProjectOrder(null),_.getState().setCommandError(e instanceof Error?e.message:String(e))}},[e]),Ze=wv(e),M=(0,O.useCallback)(async(t,n,r)=>{try{let i=Eh.getState(),a=s?i.getComposerState(s):i.getComposerState(gh),o=await e.command({type:`chat.create`,projectId:t,stackId:n,stackBindings:r});i.initializeComposerForChat(o.chatId,{sourceState:a});let c=_.getState();c.setSelectedProjectId(t),c.setPendingChatId(o.chatId),l.openChat(o.chatId),c.setSidebarOpen(!1),c.setCommandError(null)}catch(e){_.getState().setCommandError(e instanceof Error?e.message:String(e))}},[s,l,e]),Qe=(0,O.useCallback)(async t=>{try{let n=await e.command({type:`stack.listWorktrees`,projectId:t});return _.getState().setCommandError(null),n.worktrees}catch(e){return _.getState().setCommandError(e instanceof Error?e.message:String(e)),[]}},[e]),$e=(0,O.useCallback)(async()=>await e.command({type:`sessions.importClaude`}),[e]),et=(0,O.useCallback)(async t=>await e.command({type:`sessions.importClaudeSession`,sessionIds:t}),[e]),tt=(0,O.useCallback)(async t=>{let n=T.getState();_.getState().setCommandError(null),await e.command({type:`system.openExternal`,...t,editor:t.action===`open_editor`?t.editor??{preset:oe(n),commandTemplate:ne(n)}:void 0})},[e]),nt=(0,O.useCallback)(async(e,t)=>{let n=c?.localPath??h?.projects[0]?.localPath??k[0]?.localPath;if(n)try{await tt({action:e,localPath:n,editor:t})}catch(e){_.getState().setCommandError(e instanceof Error?e.message:String(e))}},[h?.projects,tt,c?.localPath,k]),rt=(0,O.useCallback)(async e=>{try{await a.writeText(e),_.getState().setCommandError(null)}catch(e){_.getState().setCommandError(e instanceof Error?e.message:String(e))}},[a]),it=(0,O.useCallback)(async(e,t=`open_editor`,n)=>{try{await tt({action:t,localPath:e.path,line:e.line,column:e.column,editor:n})}catch(e){_.getState().setCommandError(e instanceof Error?e.message:String(e))}},[tt]),at=(0,O.useCallback)(async(e,t)=>{try{await tt({action:e,localPath:t})}catch(e){_.getState().setCommandError(e instanceof Error?e.message:String(e))}},[tt]),ot=(0,O.useCallback)(()=>_.getState().setSidebarOpen(!0),[]),st=(0,O.useCallback)(()=>_.getState().setSidebarOpen(!1),[]),ct=(0,O.useCallback)(()=>_.getState().setSidebarCollapsed(!0),[]),lt=(0,O.useCallback)(()=>_.getState().setSidebarCollapsed(!1),[]),ut=(0,O.useCallback)(()=>_.getState().setAddProjectModalOpen(!0),[]),dt=(0,O.useCallback)(()=>_.getState().setAddProjectModalOpen(!1),[]),ft=(0,O.useCallback)(()=>{let e=$v({selectedProjectId:D,sidebarProjectId:k[0]?.groupKey,fallbackLocalProjectPath:_e});if(e){d(Bv,()=>Le(e));return}l.goHome()},[l,_e,D,k,Le]),pt=Qv(y,v?.status);return{socket:e,routeChatId:s,sidebarData:ge,localProjects:h,updateSnapshot:v,keybindings:b,pushConfig:S,llmProvider:C,connectionStatus:w,sidebarReady:ee,uiRestartActive:pt.active,uiRestartLabel:pt.label,localProjectsReady:te,commandError:ae,startingLocalPath:ce,sidebarOpen:re,sidebarCollapsed:ie,addProjectModalOpen:E,stacks:ge.stacks,openSidebar:ot,closeSidebar:st,collapseSidebar:ct,expandSidebar:lt,openAddProjectModal:ut,closeAddProjectModal:dt,handleCreateChat:Re,handleForkChat:ze,handleOpenLocalProject:Be,handleCreateProject:Ve,handleCheckForUpdates:Me,handleInstallUpdate:Ne,handleForceReload:Pe,handleReadAppSettings:ve,handleWriteAppSettings:be,handleTestMcpServer:xe,handleMintBeaconPairingCode:A,handleUpdateBeacon:Se,handleStartMcpOAuth:Ce,handleCompleteMcpOAuth:we,handleSetChatPolicyOverride:Te,handleWriteCloudflareTunnel:Ee,handleWriteClaudeAuth:De,handleTestOAuthToken:Oe,handleReadLlmProvider:ye,handleWriteLlmProvider:ke,handleValidateLlmProvider:Ae,handleSignOut:je,handleRenameChat:He,handleArchiveChat:Ge,handleOpenArchivedChat:Ke,handleDeleteChat:Ue,handleDeleteBulkChats:We,handleHideProject:Je,handleDeleteProject:Ye,handleToggleProjectStar:j,handleReorderProjectGroups:Xe,...Ze,handleCreateStackChat:M,handleListStackWorktrees:Qe,importClaudeSessions:$e,importClaudeSession:et,handleCopyPath:rt,handleOpenExternal:nt,handleOpenExternalPath:at,handleOpenLocalLink:it,handleCompose:ft,chatNavigator:l}}export{Qm as $,Yd as $t,fg as A,nm as At,Oh as B,zp as Bt,Ig as C,pe as Cn,Zp as Ct,_g as D,Jp as Dt,Cg as E,Qp as Et,qh as F,Hp as Ft,oh as G,Mp as Gt,Nh as H,Lp as Ht,zh as I,Wp as It,Pm as J,kp as Jt,ah as K,Np as Kt,Ih as L,Up as Lt,Vh as M,em as Mt,Bh as N,rm as Nt,Sg as O,$p as Ot,Xh as P,qp as Pt,Bm as Q,nf as Qt,Fh as R,Gp as Rt,zg as S,me as Sn,Mm as St,Dg as T,de as Tn,Yp as Tt,gh as U,Ip as Ut,kh as V,Rp as Vt,Eh as W,Ap as Wt,Gm as X,ef as Xt,zm as Y,Y as Yt,qm as Z,Xd as Zt,N_ as _,Ru as _n,lm as _t,Ov as a,qd as an,Nm as at,Jg as b,ua as bn,_m as bt,hv as c,U as cn,om as ct,uv as d,Zu as dn,im as dt,Zd as en,Fm as et,sv as f,Ju as fn,mm as ft,cv as g,Bu as gn,fm as gt,lv as h,Hu as hn,hm as ht,ey as i,Jd as in,Jm as it,Qh as j,tm as jt,pg as k,Kp as kt,mv as l,md as ln,sm as lt,fv as m,Wu as mn,Dm as mt,zv as n,Kd as nn,Wm as nt,xv as o,W as on,dm as ot,dv as p,Ku as pn,jm as pt,ih as q,Pp as qt,Xv as r,K as rn,Im as rt,Sv as s,ld as sn,am as st,Bv as t,G as tn,Vm as tt,iv as u,Xu as un,cm as ut,c_ as v,Kc as vn,um as vt,Og as w,fe as wn,Xp as wt,qg as x,Ci as xn,Am as xt,Zg as y,Gc as yn,vm as yt,Dh as z,Bp as zt};