studiograph 1.2.0-beta.9 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (226) hide show
  1. package/README.md +13 -18
  2. package/dist/agent/orchestrator.d.ts +56 -0
  3. package/dist/agent/orchestrator.js +167 -22
  4. package/dist/agent/orchestrator.js.map +1 -1
  5. package/dist/agent/prompts/system.md +51 -63
  6. package/dist/agent/skill-loader.js +8 -0
  7. package/dist/agent/skill-loader.js.map +1 -1
  8. package/dist/agent/skills/entity-schema.md +4 -19
  9. package/dist/agent/skills/gather-context.md +1 -1
  10. package/dist/agent/tools/graph-tools.d.ts +41 -1
  11. package/dist/agent/tools/graph-tools.js +133 -57
  12. package/dist/agent/tools/graph-tools.js.map +1 -1
  13. package/dist/agent/tools/ops-tools.js +82 -0
  14. package/dist/agent/tools/ops-tools.js.map +1 -1
  15. package/dist/agent/tools/permission-tools.d.ts +90 -0
  16. package/dist/agent/tools/permission-tools.js +207 -0
  17. package/dist/agent/tools/permission-tools.js.map +1 -0
  18. package/dist/agent/tools/sync-tools.js +2 -2
  19. package/dist/agent/tools/sync-tools.js.map +1 -1
  20. package/dist/auth/github.d.ts +1 -1
  21. package/dist/auth/github.js +21 -13
  22. package/dist/auth/github.js.map +1 -1
  23. package/dist/cli/commands/access.d.ts +11 -0
  24. package/dist/cli/commands/access.js +156 -0
  25. package/dist/cli/commands/access.js.map +1 -0
  26. package/dist/cli/commands/app.js +25 -2
  27. package/dist/cli/commands/app.js.map +1 -1
  28. package/dist/cli/commands/clear.d.ts +5 -0
  29. package/dist/cli/commands/clear.js +36 -0
  30. package/dist/cli/commands/clear.js.map +1 -0
  31. package/dist/cli/commands/clone.js +3 -3
  32. package/dist/cli/commands/clone.js.map +1 -1
  33. package/dist/cli/commands/collection.d.ts +10 -0
  34. package/dist/cli/commands/collection.js +187 -0
  35. package/dist/cli/commands/collection.js.map +1 -0
  36. package/dist/cli/commands/commit.js +2 -1
  37. package/dist/cli/commands/commit.js.map +1 -1
  38. package/dist/cli/commands/config.d.ts +100 -0
  39. package/dist/cli/commands/config.js +1 -1
  40. package/dist/cli/commands/config.js.map +1 -1
  41. package/dist/cli/commands/deploy.js +10 -1
  42. package/dist/cli/commands/deploy.js.map +1 -1
  43. package/dist/cli/commands/index.js +1 -1
  44. package/dist/cli/commands/index.js.map +1 -1
  45. package/dist/cli/commands/init.js +32 -40
  46. package/dist/cli/commands/init.js.map +1 -1
  47. package/dist/cli/commands/join.d.ts +0 -6
  48. package/dist/cli/commands/join.js +26 -111
  49. package/dist/cli/commands/join.js.map +1 -1
  50. package/dist/cli/commands/lint.js +1 -2
  51. package/dist/cli/commands/lint.js.map +1 -1
  52. package/dist/cli/commands/mcp.js +6 -5
  53. package/dist/cli/commands/mcp.js.map +1 -1
  54. package/dist/cli/commands/org.d.ts +10 -0
  55. package/dist/cli/commands/org.js +132 -0
  56. package/dist/cli/commands/org.js.map +1 -0
  57. package/dist/cli/commands/orphans.js +1 -2
  58. package/dist/cli/commands/orphans.js.map +1 -1
  59. package/dist/cli/commands/provision.js +3 -3
  60. package/dist/cli/commands/provision.js.map +1 -1
  61. package/dist/cli/commands/resolve.d.ts +8 -0
  62. package/dist/cli/commands/resolve.js +85 -0
  63. package/dist/cli/commands/resolve.js.map +1 -0
  64. package/dist/cli/commands/serve.js +55 -25
  65. package/dist/cli/commands/serve.js.map +1 -1
  66. package/dist/cli/commands/start.js +22 -205
  67. package/dist/cli/commands/start.js.map +1 -1
  68. package/dist/cli/commands/sync.js +53 -8
  69. package/dist/cli/commands/sync.js.map +1 -1
  70. package/dist/cli/commands/team.d.ts +12 -0
  71. package/dist/cli/commands/team.js +185 -0
  72. package/dist/cli/commands/team.js.map +1 -0
  73. package/dist/cli/index.js +41 -34
  74. package/dist/cli/index.js.map +1 -1
  75. package/dist/cli/scaffolding.d.ts +5 -3
  76. package/dist/cli/scaffolding.js +191 -97
  77. package/dist/cli/scaffolding.js.map +1 -1
  78. package/dist/cli/setup-wizard.js +20 -10
  79. package/dist/cli/setup-wizard.js.map +1 -1
  80. package/dist/cli/sync-review-interactive.js +1 -1
  81. package/dist/cli/sync-review-interactive.js.map +1 -1
  82. package/dist/core/graph.d.ts +5 -10
  83. package/dist/core/graph.js +84 -85
  84. package/dist/core/graph.js.map +1 -1
  85. package/dist/core/migration-runner.d.ts +42 -0
  86. package/dist/core/migration-runner.js +232 -0
  87. package/dist/core/migration-runner.js.map +1 -0
  88. package/dist/core/migration-types.d.ts +101 -0
  89. package/dist/core/migration-types.js +21 -0
  90. package/dist/core/migration-types.js.map +1 -0
  91. package/dist/core/migrations/20260219-formalize-memory-location.d.ts +2 -0
  92. package/dist/core/migrations/20260219-formalize-memory-location.js +35 -0
  93. package/dist/core/migrations/20260219-formalize-memory-location.js.map +1 -0
  94. package/dist/core/migrations/20260220-add-workspace-metadata.d.ts +12 -0
  95. package/dist/core/migrations/20260220-add-workspace-metadata.js +65 -0
  96. package/dist/core/migrations/20260220-add-workspace-metadata.js.map +1 -0
  97. package/dist/core/migrations/20260220-add-workspace-readme.d.ts +11 -0
  98. package/dist/core/migrations/20260220-add-workspace-readme.js +82 -0
  99. package/dist/core/migrations/20260220-add-workspace-readme.js.map +1 -0
  100. package/dist/core/migrations/20260220-migrate-yaml-to-json.d.ts +9 -0
  101. package/dist/core/migrations/20260220-migrate-yaml-to-json.js +64 -0
  102. package/dist/core/migrations/20260220-migrate-yaml-to-json.js.map +1 -0
  103. package/dist/core/migrations/index.d.ts +11 -0
  104. package/dist/core/migrations/index.js +23 -0
  105. package/dist/core/migrations/index.js.map +1 -0
  106. package/dist/core/types.d.ts +19 -34
  107. package/dist/core/types.js +3 -21
  108. package/dist/core/types.js.map +1 -1
  109. package/dist/core/user-config.d.ts +27 -0
  110. package/dist/core/user-config.js +51 -0
  111. package/dist/core/user-config.js.map +1 -1
  112. package/dist/core/validation.d.ts +978 -2182
  113. package/dist/core/validation.js +242 -397
  114. package/dist/core/validation.js.map +1 -1
  115. package/dist/core/workspace-manager.d.ts +32 -31
  116. package/dist/core/workspace-manager.js +171 -186
  117. package/dist/core/workspace-manager.js.map +1 -1
  118. package/dist/core/workspace.d.ts +0 -5
  119. package/dist/core/workspace.js +33 -101
  120. package/dist/core/workspace.js.map +1 -1
  121. package/dist/lib/lib/utils.d.ts +2 -0
  122. package/dist/lib/lib/utils.js +6 -0
  123. package/dist/lib/lib/utils.js.map +1 -0
  124. package/dist/mcp/tools.js +13 -13
  125. package/dist/mcp/tools.js.map +1 -1
  126. package/dist/server/chrome/chrome.css +562 -0
  127. package/dist/server/chrome/chrome.js +540 -0
  128. package/dist/server/index.js +163 -10
  129. package/dist/server/index.js.map +1 -1
  130. package/dist/server/plugin-loader.d.ts +7 -0
  131. package/dist/server/plugin-loader.js +9 -1
  132. package/dist/server/plugin-loader.js.map +1 -1
  133. package/dist/server/routes/chat.d.ts +3 -2
  134. package/dist/server/routes/chat.js +67 -16
  135. package/dist/server/routes/chat.js.map +1 -1
  136. package/dist/server/routes/git-api.d.ts +9 -0
  137. package/dist/server/routes/git-api.js +82 -0
  138. package/dist/server/routes/git-api.js.map +1 -0
  139. package/dist/server/routes/graph-api.d.ts +2 -2
  140. package/dist/server/routes/graph-api.js +267 -3
  141. package/dist/server/routes/graph-api.js.map +1 -1
  142. package/dist/server/routes/permissions-api.d.ts +9 -0
  143. package/dist/server/routes/permissions-api.js +176 -0
  144. package/dist/server/routes/permissions-api.js.map +1 -0
  145. package/dist/server/routes/workspace-api.d.ts +9 -0
  146. package/dist/server/routes/workspace-api.js +283 -0
  147. package/dist/server/routes/workspace-api.js.map +1 -0
  148. package/dist/services/assets/base.d.ts +2 -2
  149. package/dist/services/assets/base.js +4 -4
  150. package/dist/services/assets/base.js.map +1 -1
  151. package/dist/services/assets/index.d.ts +6 -6
  152. package/dist/services/assets/index.js +12 -12
  153. package/dist/services/assets/index.js.map +1 -1
  154. package/dist/services/git.d.ts +35 -0
  155. package/dist/services/git.js +93 -0
  156. package/dist/services/git.js.map +1 -1
  157. package/dist/services/github-provisioner.js +1 -2
  158. package/dist/services/github-provisioner.js.map +1 -1
  159. package/dist/services/github-service.d.ts +99 -0
  160. package/dist/services/github-service.js +310 -0
  161. package/dist/services/github-service.js.map +1 -0
  162. package/dist/services/markdown.js +4 -9
  163. package/dist/services/markdown.js.map +1 -1
  164. package/dist/services/memory-service.d.ts +4 -0
  165. package/dist/services/memory-service.js +13 -1
  166. package/dist/services/memory-service.js.map +1 -1
  167. package/dist/services/sync/commit.d.ts +2 -0
  168. package/dist/services/sync/commit.js +21 -6
  169. package/dist/services/sync/commit.js.map +1 -1
  170. package/dist/services/sync/graphrag-indexer.js +2 -2
  171. package/dist/services/sync/graphrag-indexer.js.map +1 -1
  172. package/dist/utils/git.d.ts +5 -0
  173. package/dist/utils/git.js +10 -0
  174. package/dist/utils/git.js.map +1 -1
  175. package/dist/utils/merge-resolver.d.ts +33 -8
  176. package/dist/utils/merge-resolver.js +157 -55
  177. package/dist/utils/merge-resolver.js.map +1 -1
  178. package/dist/utils/preflight.d.ts +1 -1
  179. package/dist/utils/preflight.js +1 -1
  180. package/dist/web/_app/env.js +1 -0
  181. package/dist/web/_app/immutable/assets/0.CDbX4Cwz.css +1 -0
  182. package/dist/web/_app/immutable/assets/2.DRHi7ABa.css +1 -0
  183. package/dist/web/_app/immutable/assets/3.BJy7pVXi.css +1 -0
  184. package/dist/web/_app/immutable/assets/4.Ad16uh9o.css +1 -0
  185. package/dist/web/_app/immutable/assets/5.BhKgiXd2.css +1 -0
  186. package/dist/web/_app/immutable/assets/6.CeHKR5ZY.css +1 -0
  187. package/dist/web/_app/immutable/assets/AppShell.CXdE5aqF.css +1 -0
  188. package/dist/web/_app/immutable/assets/ChatPanel.RFD5GGYI.css +1 -0
  189. package/dist/web/_app/immutable/assets/editor.CPAf2SRV.css +1 -0
  190. package/dist/web/_app/immutable/chunks/3_5VIr68.js +1 -0
  191. package/dist/web/_app/immutable/chunks/4QY4j-jX.js +1 -0
  192. package/dist/web/_app/immutable/chunks/B0nldqWF.js +23 -0
  193. package/dist/web/_app/immutable/chunks/BB_5th5W.js +3383 -0
  194. package/dist/web/_app/immutable/chunks/BButMJ6M.js +1 -0
  195. package/dist/web/_app/immutable/chunks/BiubvAUI.js +2 -0
  196. package/dist/web/_app/immutable/chunks/CAXuTUkp.js +1 -0
  197. package/dist/web/_app/immutable/chunks/CUzqHQY_.js +1 -0
  198. package/dist/web/_app/immutable/chunks/CYrVHOHA.js +1 -0
  199. package/dist/web/_app/immutable/chunks/CqkleIqs.js +1 -0
  200. package/dist/web/_app/immutable/chunks/DPmdIe6Y.js +1 -0
  201. package/dist/web/_app/immutable/chunks/Dh_H7Owr.js +18 -0
  202. package/dist/web/_app/immutable/chunks/DnlgZ_Tk.js +5 -0
  203. package/dist/web/_app/immutable/chunks/DsERsGWg.js +64 -0
  204. package/dist/web/_app/immutable/chunks/DtVH--hH.js +6 -0
  205. package/dist/web/_app/immutable/chunks/F20aIBpJ.js +1 -0
  206. package/dist/web/_app/immutable/chunks/PPVm8Dsz.js +1 -0
  207. package/dist/web/_app/immutable/chunks/WSUKABI_.js +1 -0
  208. package/dist/web/_app/immutable/chunks/YFT1281h.js +2 -0
  209. package/dist/web/_app/immutable/chunks/aosHekRC.js +1 -0
  210. package/dist/web/_app/immutable/chunks/fwnBoL5x.js +1 -0
  211. package/dist/web/_app/immutable/chunks/hHxe9oXh.js +1 -0
  212. package/dist/web/_app/immutable/chunks/nZKqDQ0w.js +6 -0
  213. package/dist/web/_app/immutable/entry/app.B6Ngvu5P.js +2 -0
  214. package/dist/web/_app/immutable/entry/start.NykKAKQv.js +1 -0
  215. package/dist/web/_app/immutable/nodes/0.DQ5KdeNU.js +1 -0
  216. package/dist/web/_app/immutable/nodes/1.BR6DZ9ov.js +1 -0
  217. package/dist/web/_app/immutable/nodes/2.COSjVZ_C.js +1 -0
  218. package/dist/web/_app/immutable/nodes/3.B9r1XIlO.js +1 -0
  219. package/dist/web/_app/immutable/nodes/4.p-c6hlFf.js +16 -0
  220. package/dist/web/_app/immutable/nodes/5.CPc-Bqal.js +4 -0
  221. package/dist/web/_app/immutable/nodes/6.jJ67YnBc.js +2 -0
  222. package/dist/web/_app/version.json +1 -0
  223. package/dist/web/index.html +43 -0
  224. package/package.json +21 -3
  225. package/dist/agent/skills/bundled/enrich-entities.md +0 -124
  226. package/dist/agent/skills/bundled/gather-context.md +0 -46
@@ -0,0 +1,6 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./DtVH--hH.js","./DnlgZ_Tk.js","./Dh_H7Owr.js","./4QY4j-jX.js","./CUzqHQY_.js","./aosHekRC.js"])))=>i.map(i=>d[i]);
2
+ import{g as ri,j as wt,e as De,a as A,d as L,f as K,q as lt,s as gn}from"./hHxe9oXh.js";import{b1 as bo,h as xo,a as So,br as Ao,b as Eo,au as Oo,B as tn,n as ut,P as B,Q as qt,A as vt,aM as ii,t as R,u as nt,w as M,F as c,T as m,q as dt,V as D,x as yt,Y as _,bs as Or,a0 as To,a1 as _e,bt as Po,o as Ln,R as Co,z as _o,bq as pt,bu as ko,bv as oi,S as si,X as Mo,v as Pn,W as qe,bc as Fo}from"./fwnBoL5x.js";import{s as ht,c as ai,m as Ro,u as Do}from"./BiubvAUI.js";import{p as x,i as at,b as Yn,s as Mt,r as ie,l as ve}from"./BButMJ6M.js";import{b as ci,e as Yt,i as te,I as pe,s as me,T as Io,C as No,P as Tr}from"./B0nldqWF.js";import{c as ae}from"./F20aIBpJ.js";import{r as Bn,b as Qe,w as Gn,m as Cn,s as st,h as ue,e as Lo,j as _n,a as Bo,u as Pr,g as Cr,n as Wo}from"./YFT1281h.js";import{g as zo}from"./DPmdIe6Y.js";import{B as Vo}from"./3_5VIr68.js";import"./CAXuTUkp.js";import{_ as be}from"./PPVm8Dsz.js";function Ko(){return Symbol(bo)}const Ho=Symbol("NaN");function Uo(e,t,n){xo&&So();var r=new Vo(e),i=!Ao();Eo(()=>{var s=t();s!==s&&(s=Ho),i&&s!==null&&typeof s=="object"&&(s={}),r.ensure(s,n)})}function jo(e,t,n){Oo(()=>{var r=tn(()=>t(e,n?.())||{});if(r?.destroy)return()=>r.destroy()})}var Yo=K('<span class="chip svelte-84vb17"> <button class="chip-remove svelte-84vb17">&times;</button></span>'),Go=K('<div><span class="entity-title svelte-84vb17"> </span> <span class="entity-meta svelte-84vb17"><span class="entity-type-badge svelte-84vb17"> </span> <span class="entity-repo svelte-84vb17"> </span></span></div>'),qo=K('<div class="dropdown svelte-84vb17"></div>'),Xo=K('<div class="autocomplete svelte-84vb17"><div class="input-row svelte-84vb17"><!> <input class="ac-input svelte-84vb17" type="text" placeholder="Search entities..."/></div> <!></div>');function Zo(e,t){ut(t,!0);let n=x(t,"multi",3,!1),r=B(""),i=B(0),s;const o=_(()=>Gn.repos.flatMap(O=>O.entities.map(k=>({id:k.id,title:k.title,entityType:k.entityType,repo:O.name})))),a=_(()=>()=>{const O=c(r).toLowerCase().trim();return O?c(o).filter(k=>k.title.toLowerCase().includes(O)||k.id.toLowerCase().includes(O)).slice(0,20):c(o).slice(0,20)}),l=Array.isArray(t.value)?[...t.value]:t.value?[t.value]:[];let u=B(qt(l));vt(()=>{ii().then(()=>s?.focus())});function f(O){n()?(c(u).includes(O)||m(u,[...c(u),O],!0),m(r,""),m(i,0),s?.focus()):t.onselect(O)}function d(O){m(u,c(u).filter(k=>k!==O),!0)}function g(){c(u).length===l.length&&c(u).every((k,j)=>k===l[j])?t.oncancel():t.onselect(c(u))}function v(O){const k=c(a)();O.key==="ArrowDown"?(O.preventDefault(),m(i,Math.min(c(i)+1,k.length-1),!0)):O.key==="ArrowUp"?(O.preventDefault(),m(i,Math.max(c(i)-1,0),!0)):O.key==="Enter"?(O.preventDefault(),k.length>0?f(k[c(i)].id):n()&&g()):O.key==="Escape"?n()&&c(u).length>0?g():t.oncancel():O.key==="Backspace"&&!c(r)&&n()&&c(u).length>0&&m(u,c(u).slice(0,-1),!0)}var p=Xo(),h=R(p),y=R(h);{var b=O=>{var k=L(),j=D(k);Yt(j,17,()=>c(u),te,(W,F)=>{var I=Yo(),H=R(I),q=nt(H);M(I),yt(()=>ht(H,`${c(F)??""} `)),wt("click",q,()=>d(c(F))),A(W,I)}),A(O,k)};at(y,O=>{n()&&O(b)})}var E=nt(y,2);Bn(E),Yn(E,O=>s=O,()=>s),M(h);var C=nt(h,2);{var S=O=>{var k=qo();Yt(k,21,()=>c(a)(),te,(j,W,F)=>{var I=Go();let H;var q=R(I),X=R(q,!0);M(q);var J=nt(q,2),z=R(J),G=R(z,!0);M(z);var Z=nt(z,2),At=R(Z,!0);M(Z),M(J),M(I),yt(()=>{H=Qe(I,1,"dropdown-item svelte-84vb17",null,H,{highlighted:F===c(i)}),ht(X,c(W).title),ht(G,c(W).entityType),ht(At,c(W).repo)}),wt("mousedown",I,Te=>{Te.preventDefault(),f(c(W).id)}),De("mouseenter",I,()=>m(i,F,!0)),A(j,I)}),M(k),A(O,k)},N=_(()=>c(a)().length>0);at(C,O=>{c(N)&&O(S)})}M(p),wt("keydown",E,v),De("blur",E,()=>{setTimeout(()=>{n()&&c(u).length>0?g():n()||t.oncancel()},150)}),ci(E,()=>c(r),O=>m(r,O)),A(e,p),dt()}ri(["click","keydown","mousedown"]);function Jo(e){return typeof e=="function"}function Be(e){return e!==null&&typeof e=="object"}const Qo=["string","number","bigint","boolean"];function Wn(e){return e==null||Qo.includes(typeof e)?!0:Array.isArray(e)?e.every(t=>Wn(t)):typeof e=="object"?Object.getPrototypeOf(e)===Object.prototype:!1}const Se=Symbol("box"),vn=Symbol("is-writable");function T(e,t){const n=_(e);return t?{[Se]:!0,[vn]:!0,get current(){return c(n)},set current(r){t(r)}}:{[Se]:!0,get current(){return e()}}}function We(e){return Be(e)&&Se in e}function qn(e){return We(e)&&vn in e}function li(e){return We(e)?e:Jo(e)?T(e):Wt(e)}function $o(e){return Object.entries(e).reduce((t,[n,r])=>We(r)?(qn(r)?Object.defineProperty(t,n,{get(){return r.current},set(i){r.current=i}}):Object.defineProperty(t,n,{get(){return r.current}}),t):Object.assign(t,{[n]:r}),{})}function ts(e){return qn(e)?{[Se]:!0,get current(){return e.current}}:e}function Wt(e){let t=B(qt(e));return{[Se]:!0,[vn]:!0,get current(){return c(t)},set current(n){m(t,n,!0)}}}function ye(e){let t=B(qt(e));return{[Se]:!0,[vn]:!0,get current(){return c(t)},set current(n){m(t,n,!0)}}}ye.from=li;ye.with=T;ye.flatten=$o;ye.readonly=ts;ye.isBox=We;ye.isWritableBox=qn;function ui(...e){return function(t){for(const n of e)if(n){if(t.defaultPrevented)return;typeof n=="function"?n.call(this,t):n.current?.call(this,t)}}}var _r=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,es=/\n/g,ns=/^\s*/,rs=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,is=/^:\s*/,os=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,ss=/^[;\s]*/,as=/^\s+|\s+$/g,cs=`
3
+ `,kr="/",Mr="*",le="",ls="comment",us="declaration";function ds(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,r=1;function i(p){var h=p.match(es);h&&(n+=h.length);var y=p.lastIndexOf(cs);r=~y?p.length-y:r+p.length}function s(){var p={line:n,column:r};return function(h){return h.position=new o(p),u(),h}}function o(p){this.start=p,this.end={line:n,column:r},this.source=t.source}o.prototype.content=e;function a(p){var h=new Error(t.source+":"+n+":"+r+": "+p);if(h.reason=p,h.filename=t.source,h.line=n,h.column=r,h.source=e,!t.silent)throw h}function l(p){var h=p.exec(e);if(h){var y=h[0];return i(y),e=e.slice(y.length),h}}function u(){l(ns)}function f(p){var h;for(p=p||[];h=d();)h!==!1&&p.push(h);return p}function d(){var p=s();if(!(kr!=e.charAt(0)||Mr!=e.charAt(1))){for(var h=2;le!=e.charAt(h)&&(Mr!=e.charAt(h)||kr!=e.charAt(h+1));)++h;if(h+=2,le===e.charAt(h-1))return a("End of comment missing");var y=e.slice(2,h-2);return r+=2,i(y),e=e.slice(h),r+=2,p({type:ls,comment:y})}}function g(){var p=s(),h=l(rs);if(h){if(d(),!l(is))return a("property missing ':'");var y=l(os),b=p({type:us,property:Fr(h[0].replace(_r,le)),value:y?Fr(y[0].replace(_r,le)):le});return l(ss),b}}function v(){var p=[];f(p);for(var h;h=g();)h!==!1&&(p.push(h),f(p));return p}return u(),v()}function Fr(e){return e?e.replace(as,le):le}function fs(e,t){let n=null;if(!e||typeof e!="string")return n;const r=ds(e),i=typeof t=="function";return r.forEach(s=>{if(s.type!=="declaration")return;const{property:o,value:a}=s;i?t(o,a,s):a&&(n=n||{},n[o]=a)}),n}const hs=/\d/,gs=["-","_","/","."];function vs(e=""){if(!hs.test(e))return e!==e.toLowerCase()}function ps(e){const t=[];let n="",r,i;for(const s of e){const o=gs.includes(s);if(o===!0){t.push(n),n="",r=void 0;continue}const a=vs(s);if(i===!1){if(r===!1&&a===!0){t.push(n),n=s,r=a;continue}if(r===!0&&a===!1&&n.length>1){const l=n.at(-1);t.push(n.slice(0,Math.max(0,n.length-1))),n=l+s,r=a;continue}}n+=s,r=a,i=o}return t.push(n),t}function di(e){return e?ps(e).map(t=>ys(t)).join(""):""}function ms(e){return ws(di(e||""))}function ys(e){return e?e[0].toUpperCase()+e.slice(1):""}function ws(e){return e?e[0].toLowerCase()+e.slice(1):""}function Re(e){if(!e)return{};const t={};function n(r,i){if(r.startsWith("-moz-")||r.startsWith("-webkit-")||r.startsWith("-ms-")||r.startsWith("-o-")){t[di(r)]=i;return}if(r.startsWith("--")){t[r]=i;return}t[ms(r)]=i}return fs(e,n),t}function de(...e){return(...t)=>{for(const n of e)typeof n=="function"&&n(...t)}}function bs(e,t){const n=RegExp(e,"g");return r=>{if(typeof r!="string")throw new TypeError(`expected an argument of type string, but got ${typeof r}`);return r.match(n)?r.replace(n,t):r}}const xs=bs(/[A-Z]/,e=>`-${e.toLowerCase()}`);function Ss(e){if(!e||typeof e!="object"||Array.isArray(e))throw new TypeError(`expected an argument of type object, but got ${typeof e}`);return Object.keys(e).map(t=>`${xs(t)}: ${e[t]};`).join(`
4
+ `)}function fi(e={}){return Ss(e).replace(`
5
+ `," ")}const As=["onabort","onanimationcancel","onanimationend","onanimationiteration","onanimationstart","onauxclick","onbeforeinput","onbeforetoggle","onblur","oncancel","oncanplay","oncanplaythrough","onchange","onclick","onclose","oncompositionend","oncompositionstart","oncompositionupdate","oncontextlost","oncontextmenu","oncontextrestored","oncopy","oncuechange","oncut","ondblclick","ondrag","ondragend","ondragenter","ondragleave","ondragover","ondragstart","ondrop","ondurationchange","onemptied","onended","onerror","onfocus","onfocusin","onfocusout","onformdata","ongotpointercapture","oninput","oninvalid","onkeydown","onkeypress","onkeyup","onload","onloadeddata","onloadedmetadata","onloadstart","onlostpointercapture","onmousedown","onmouseenter","onmouseleave","onmousemove","onmouseout","onmouseover","onmouseup","onpaste","onpause","onplay","onplaying","onpointercancel","onpointerdown","onpointerenter","onpointerleave","onpointermove","onpointerout","onpointerover","onpointerup","onprogress","onratechange","onreset","onresize","onscroll","onscrollend","onsecuritypolicyviolation","onseeked","onseeking","onselect","onselectionchange","onselectstart","onslotchange","onstalled","onsubmit","onsuspend","ontimeupdate","ontoggle","ontouchcancel","ontouchend","ontouchmove","ontouchstart","ontransitioncancel","ontransitionend","ontransitionrun","ontransitionstart","onvolumechange","onwaiting","onwebkitanimationend","onwebkitanimationiteration","onwebkitanimationstart","onwebkittransitionend","onwheel"],Es=new Set(As);function Os(e){return Es.has(e)}function Xt(...e){const t={...e[0]};for(let n=1;n<e.length;n++){const r=e[n];if(r){for(const i of Object.keys(r)){const s=t[i],o=r[i],a=typeof s=="function",l=typeof o=="function";if(a&&Os(i)){const u=s,f=o;t[i]=ui(u,f)}else if(a&&l)t[i]=de(s,o);else if(i==="class"){const u=Wn(s),f=Wn(o);u&&f?t[i]=Cn(s,o):u?t[i]=Cn(s):f&&(t[i]=Cn(o))}else if(i==="style"){const u=typeof s=="object",f=typeof o=="object",d=typeof s=="string",g=typeof o=="string";if(u&&f)t[i]={...s,...o};else if(u&&g){const v=Re(o);t[i]={...s,...v}}else if(d&&f){const v=Re(s);t[i]={...v,...o}}else if(d&&g){const v=Re(s),p=Re(o);t[i]={...v,...p}}else u?t[i]=s:f?t[i]=o:d?t[i]=s:g&&(t[i]=o)}else t[i]=o!==void 0?o:s}for(const i of Object.getOwnPropertySymbols(r)){const s=t[i],o=r[i];t[i]=o!==void 0?o:s}}}return typeof t.style=="object"&&(t.style=fi(t.style).replaceAll(`
6
+ `," ")),t.hidden===!1&&(t.hidden=void 0,delete t.hidden),t.disabled===!1&&(t.disabled=void 0,delete t.disabled),t}const hi=typeof window<"u"?window:void 0;function Ts(e){let t=e.activeElement;for(;t?.shadowRoot;){const n=t.shadowRoot.activeElement;if(n===t)break;t=n}return t}class Ps extends Map{#t=new Map;#e=B(0);#n=B(0);#r=Or||-1;constructor(t){if(super(),t){for(var[n,r]of t)super.set(n,r);this.#n.v=super.size}}#i(t){return Or===this.#r?B(t):To(t)}has(t){var n=this.#t,r=n.get(t);if(r===void 0)if(super.has(t))r=this.#i(0),n.set(t,r);else return c(this.#e),!1;return c(r),!0}forEach(t,n){this.#o(),super.forEach(t,n)}get(t){var n=this.#t,r=n.get(t);if(r===void 0)if(super.has(t))r=this.#i(0),n.set(t,r);else{c(this.#e);return}return c(r),super.get(t)}set(t,n){var r=this.#t,i=r.get(t),s=super.get(t),o=super.set(t,n),a=this.#e;if(i===void 0)i=this.#i(0),r.set(t,i),m(this.#n,super.size),_e(a);else if(s!==n){_e(i);var l=a.reactions===null?null:new Set(a.reactions),u=l===null||!i.reactions?.every(f=>l.has(f));u&&_e(a)}return o}delete(t){var n=this.#t,r=n.get(t),i=super.delete(t);return r!==void 0&&(n.delete(t),m(r,-1)),i&&(m(this.#n,super.size),_e(this.#e)),i}clear(){if(super.size!==0){super.clear();var t=this.#t;m(this.#n,0);for(var n of t.values())m(n,-1);_e(this.#e),t.clear()}}#o(){c(this.#e);var t=this.#t;if(this.#n.v!==t.size){for(var n of super.keys())if(!t.has(n)){var r=this.#i(0);t.set(n,r)}}for([,r]of this.#t)c(r)}keys(){return c(this.#e),super.keys()}values(){return this.#o(),super.values()}entries(){return this.#o(),super.entries()}[Symbol.iterator](){return this.entries()}get size(){return c(this.#n),super.size}}class Cs{#t;#e;constructor(t={}){const{window:n=hi,document:r=n?.document}=t;n!==void 0&&(this.#t=r,this.#e=ai(i=>{const s=lt(n,"focusin",i),o=lt(n,"focusout",i);return()=>{s(),o()}}))}get current(){return this.#e?.(),this.#t?Ts(this.#t):null}}new Cs;function _s(e){return typeof e=="function"}class we{#t;#e;constructor(t){this.#t=t,this.#e=Symbol(t)}get key(){return this.#e}exists(){return Po(this.#e)}get(){const t=Ln(this.#e);if(t===void 0)throw new Error(`Context "${this.#t}" not found`);return t}getOr(t){const n=Ln(this.#e);return n===void 0?t:n}set(t){return Co(this.#e,t)}}function ks(e,t){switch(e){case"post":vt(t);break;case"pre":_o(t);break}}function gi(e,t,n,r={}){const{lazy:i=!1}=r;let s=!i,o=Array.isArray(e)?[]:void 0;ks(t,()=>{const a=Array.isArray(e)?e.map(u=>u()):e();if(!s){s=!0,o=a;return}const l=tn(()=>n(a,o));return o=a,l})}function St(e,t,n){gi(e,"post",t,n)}function Ms(e,t,n){gi(e,"pre",t,n)}St.pre=Ms;function Rr(e){return _s(e)?e():e}class Fs{#t={width:0,height:0};#e=!1;#n;#r;#i;#o=_(()=>(c(this.#s)?.(),this.getSize().width));#a=_(()=>(c(this.#s)?.(),this.getSize().height));#s=_(()=>{const t=Rr(this.#r);if(t)return ai(n=>{if(!this.#i)return;const r=new this.#i.ResizeObserver(i=>{this.#e=!0;for(const s of i){const o=this.#n.box==="content-box"?s.contentBoxSize:s.borderBoxSize,a=Array.isArray(o)?o:[o];this.#t.width=a.reduce((l,u)=>Math.max(l,u.inlineSize),0),this.#t.height=a.reduce((l,u)=>Math.max(l,u.blockSize),0)}n()});return r.observe(t),()=>{this.#e=!1,r.disconnect()}})});constructor(t,n={box:"border-box"}){this.#i=n.window??hi,this.#n=n,this.#r=t,this.#t={width:0,height:0}}calculateSize(){const t=Rr(this.#r);if(!t||!this.#i)return;const n=t.offsetWidth,r=t.offsetHeight;if(this.#n.box==="border-box")return{width:n,height:r};const i=this.#i.getComputedStyle(t),s=parseFloat(i.paddingLeft)+parseFloat(i.paddingRight),o=parseFloat(i.paddingTop)+parseFloat(i.paddingBottom),a=parseFloat(i.borderLeftWidth)+parseFloat(i.borderRightWidth),l=parseFloat(i.borderTopWidth)+parseFloat(i.borderBottomWidth),u=n-s-a,f=r-o-l;return{width:u,height:f}}getSize(){return this.#e?this.#t:this.calculateSize()??this.#t}get current(){return c(this.#s)?.(),this.getSize()}get width(){return c(this.#o)}get height(){return c(this.#a)}}function ze(e){vt(()=>()=>{e()})}function Rs(e,t){return setTimeout(t,e)}function Gt(e){ii().then(e)}const Ds=1,Is=9,Ns=11;function zn(e){return Be(e)&&e.nodeType===Ds&&typeof e.nodeName=="string"}function vi(e){return Be(e)&&e.nodeType===Is}function Ls(e){return Be(e)&&e.constructor?.name==="VisualViewport"}function Bs(e){return Be(e)&&e.nodeType!==void 0}function pi(e){return Bs(e)&&e.nodeType===Ns&&"host"in e}function Ws(e,t){if(!e||!t||!zn(e)||!zn(t))return!1;const n=t.getRootNode?.();if(e===t||e.contains(t))return!0;if(n&&pi(n)){let r=t;for(;r;){if(e===r)return!0;r=r.parentNode||r.host}}return!1}function Ve(e){return vi(e)?e:Ls(e)?e.document:e?.ownerDocument??document}function Xn(e){return pi(e)?Xn(e.host):vi(e)?e.defaultView??window:zn(e)?e.ownerDocument?.defaultView??window:window}function zs(e){let t=e.activeElement;for(;t?.shadowRoot;){const n=t.shadowRoot.activeElement;if(n===t)break;t=n}return t}class Zn{element;#t=_(()=>this.element.current?this.element.current.getRootNode()??document:document);get root(){return c(this.#t)}set root(t){m(this.#t,t)}constructor(t){typeof t=="function"?this.element=T(t):this.element=t}getDocument=()=>Ve(this.root);getWindow=()=>this.getDocument().defaultView??window;getActiveElement=()=>zs(this.root);isActiveElement=t=>t===this.getActiveElement();getElementById(t){return this.root.getElementById(t)}querySelector=t=>this.root?this.root.querySelector(t):null;querySelectorAll=t=>this.root?this.root.querySelectorAll(t):[];setTimeout=(t,n)=>this.getWindow().setTimeout(t,n);clearTimeout=t=>this.getWindow().clearTimeout(t)}function fe(e,t){return{[Ko()]:n=>We(e)?(e.current=n,tn(()=>t?.(n)),()=>{"isConnected"in n&&n.isConnected||(e.current=null,t?.(null))}):(e(n),tn(()=>t?.(n)),()=>{"isConnected"in n&&n.isConnected||(e(null),t?.(null))})}}function mi(e){return e?"true":"false"}function yi(e){return e?"":void 0}function wi(e){return e?"open":"closed"}class Vs{#t;#e;attrs;constructor(t){this.#t=t.getVariant?t.getVariant():null,this.#e=this.#t?`data-${this.#t}-`:`data-${t.component}-`,this.getAttr=this.getAttr.bind(this),this.selector=this.selector.bind(this),this.attrs=Object.fromEntries(t.parts.map(n=>[n,this.getAttr(n)]))}getAttr(t,n){return n?`data-${n}-${t}`:`${this.#e}${t}`}selector(t,n){return`[${this.getAttr(t,n)}]`}}function Ks(e){const t=new Vs(e);return{...t.attrs,selector:t.selector,getAttr:t.getAttr}}const Ne="ArrowDown",Jn="ArrowLeft",Qn="ArrowRight",en="ArrowUp",bi="End",xi="Enter",Hs="Escape",Si="Home",Us="PageDown",js="PageUp",$n=" ",Ys="Tab";function Gs(e){return window.getComputedStyle(e).getPropertyValue("direction")}function qs(e="ltr",t="horizontal"){return{horizontal:e==="rtl"?Jn:Qn,vertical:Ne}[t]}function Xs(e="ltr",t="horizontal"){return{horizontal:e==="rtl"?Qn:Jn,vertical:en}[t]}function Zs(e="ltr",t="horizontal"){return["ltr","rtl"].includes(e)||(e="ltr"),["horizontal","vertical"].includes(t)||(t="horizontal"),{nextKey:qs(e,t),prevKey:Xs(e,t)}}const Ai=typeof document<"u",Dr=Js();function Js(){return Ai&&window?.navigator?.userAgent&&(/iP(ad|hone|od)/.test(window.navigator.userAgent)||window?.navigator?.maxTouchPoints>2&&/iPad|Macintosh/.test(window?.navigator.userAgent))}function Zt(e){return e instanceof HTMLElement}function Vn(e){return e instanceof Element}function Ei(e){return e instanceof Element||e instanceof SVGElement}function Qs(e){return e!==null}function $s(e){return e instanceof HTMLInputElement&&"select"in e}class ta{#t;#e=ye(null);constructor(t){this.#t=t}getCandidateNodes(){return this.#t.rootNode.current?this.#t.candidateSelector?Array.from(this.#t.rootNode.current.querySelectorAll(this.#t.candidateSelector)):this.#t.candidateAttr?Array.from(this.#t.rootNode.current.querySelectorAll(`[${this.#t.candidateAttr}]:not([data-disabled])`)):[]:[]}focusFirstCandidate(){const t=this.getCandidateNodes();t.length&&t[0]?.focus()}handleKeydown(t,n,r=!1){const i=this.#t.rootNode.current;if(!i||!t)return;const s=this.getCandidateNodes();if(!s.length)return;const o=s.indexOf(t),a=Gs(i),{nextKey:l,prevKey:u}=Zs(a,this.#t.orientation.current),f=this.#t.loop.current,d={[l]:o+1,[u]:o-1,[Si]:0,[bi]:s.length-1};if(r){const p=l===Ne?Qn:Ne,h=u===en?Jn:en;d[p]=o+1,d[h]=o-1}let g=d[n.key];if(g===void 0)return;n.preventDefault(),g<0&&f?g=s.length-1:g===s.length&&f&&(g=0);const v=s[g];if(v)return v.focus(),this.#e.current=v.id,this.#t.onCandidateFocus?.(v),v}getTabIndex(t){const n=this.getCandidateNodes(),r=this.#e.current!==null;return t&&!r&&n[0]===t?(this.#e.current=t.id,0):t?.id===this.#e.current?0:-1}setCurrentTabStopId(t){this.#e.current=t}focusCurrentTabStop(){const t=this.#e.current;if(!t)return;const n=this.#t.rootNode.current?.querySelector(`#${t}`);!n||!Zt(n)||n.focus()}}class ea{#t;#e=null;constructor(t){this.#t=t,ze(()=>this.#n())}#n(){this.#e&&(window.cancelAnimationFrame(this.#e),this.#e=null)}run(t){this.#n();const n=this.#t.ref.current;if(n){if(typeof n.getAnimations!="function"){this.#r(t);return}this.#e=window.requestAnimationFrame(()=>{const r=n.getAnimations();if(r.length===0){this.#r(t);return}Promise.allSettled(r.map(i=>i.finished)).then(()=>{this.#r(t)})})}}#r(t){const n=()=>{t()};this.#t.afterTick?Gt(n):n()}}class na{#t;#e;#n;#r=B(!1);constructor(t){this.#t=t,m(this.#r,t.open.current,!0),this.#e=t.enabled??!0,this.#n=new ea({ref:this.#t.ref,afterTick:this.#t.open}),St(()=>this.#t.open.current,n=>{n&&m(this.#r,!0),this.#e&&this.#n.run(()=>{n===this.#t.open.current&&(this.#t.open.current||m(this.#r,!1),this.#t.onComplete?.())})})}get shouldRender(){return c(this.#r)}}function ct(){}function pn(e,t){return`bits-${e}`}function ra(e,t){var n=L(),r=D(n);Uo(r,()=>t.children,i=>{var s=L(),o=D(s);st(o,()=>t.children??pt),A(i,s)}),A(e,n)}const ia=new we("BitsConfig");function oa(){const e=new sa(null,{});return ia.getOr(e).opts}class sa{opts;constructor(t,n){const r=aa(t,n);this.opts={defaultPortalTo:r(i=>i.defaultPortalTo),defaultLocale:r(i=>i.defaultLocale)}}}function aa(e,t){return n=>T(()=>{const i=n(t)?.current;if(i!==void 0)return i;if(e!==null)return n(e.opts)?.current})}function ca(e,t){return n=>{const r=oa();return T(()=>{const i=n();if(i!==void 0)return i;const s=e(r).current;return s!==void 0?s:t})}}const la=ca(e=>e.defaultPortalTo,"body");function ua(e,t){ut(t,!0);const n=la(()=>t.to),r=ko();let i=_(s);function s(){if(!Ai||t.disabled)return null;let d=null;return typeof n.current=="string"?d=document.querySelector(n.current):d=n.current,d}let o;function a(){o&&(Do(o),o=null)}St([()=>c(i),()=>t.disabled],([d,g])=>{if(!d||g){a();return}return o=Ro(ra,{target:d,props:{children:t.children},context:r}),()=>{a()}});var l=L(),u=D(l);{var f=d=>{var g=L(),v=D(g);st(v,()=>t.children??pt),A(d,g)};at(u,d=>{t.disabled&&d(f)})}A(e,l),dt()}class da{eventName;options;constructor(t,n={bubbles:!0,cancelable:!0}){this.eventName=t,this.options=n}createEvent(t){return new CustomEvent(this.eventName,{...this.options,detail:t})}dispatch(t,n){const r=this.createEvent(n);return t.dispatchEvent(r),r}listen(t,n,r){const i=s=>{n(s)};return lt(t,this.eventName,i,r)}}function Ir(e,t=500){let n=null;const r=(...i)=>{n!==null&&clearTimeout(n),n=setTimeout(()=>{e(...i)},t)};return r.destroy=()=>{n!==null&&(clearTimeout(n),n=null)},r}function Oi(e,t){return e===t||e.contains(t)}function Ti(e){return e?.ownerDocument??document}function fa(e,t){const{clientX:n,clientY:r}=e,i=t.getBoundingClientRect();return n<i.left||n>i.right||r<i.top||r>i.bottom}const ha=[xi,$n],ga=[Ne,js,Si],Pi=[en,Us,bi],va=[...ga,...Pi];function Nr(e){return e.pointerType==="mouse"}function pa(e,{select:t=!1}={}){if(!e||!e.focus)return;const n=Ve(e);if(n.activeElement===e)return;const r=n.activeElement;e.focus({preventScroll:!0}),e!==r&&$s(e)&&t&&e.select()}function ma(e,{select:t=!1}={},n){const r=n();for(const i of e)if(pa(i,{select:t}),n()!==r)return!0}let ke=B(!1);class ee{static _refs=0;static _cleanup;constructor(){vt(()=>(ee._refs===0&&(ee._cleanup=oi(()=>{const t=[],n=i=>{m(ke,!1)},r=i=>{m(ke,!0)};return t.push(lt(document,"pointerdown",n,{capture:!0}),lt(document,"pointermove",n,{capture:!0}),lt(document,"keydown",r,{capture:!0})),de(...t)})),ee._refs++,()=>{ee._refs--,ee._refs===0&&(m(ke,!1),ee._cleanup?.())}))}get current(){return c(ke)}set current(t){m(ke,t,!0)}}var Ci=["input:not([inert]):not([inert] *)","select:not([inert]):not([inert] *)","textarea:not([inert]):not([inert] *)","a[href]:not([inert]):not([inert] *)","button:not([inert]):not([inert] *)","[tabindex]:not(slot):not([inert]):not([inert] *)","audio[controls]:not([inert]):not([inert] *)","video[controls]:not([inert]):not([inert] *)",'[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)',"details>summary:first-of-type:not([inert]):not([inert] *)","details:not([inert]):not([inert] *)"],nn=Ci.join(","),_i=typeof Element>"u",he=_i?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,rn=!_i&&Element.prototype.getRootNode?function(e){var t;return e==null||(t=e.getRootNode)===null||t===void 0?void 0:t.call(e)}:function(e){return e?.ownerDocument},on=function(t,n){var r;n===void 0&&(n=!0);var i=t==null||(r=t.getAttribute)===null||r===void 0?void 0:r.call(t,"inert"),s=i===""||i==="true",o=s||n&&t&&(typeof t.closest=="function"?t.closest("[inert]"):on(t.parentNode));return o},ya=function(t){var n,r=t==null||(n=t.getAttribute)===null||n===void 0?void 0:n.call(t,"contenteditable");return r===""||r==="true"},ki=function(t,n,r){if(on(t))return[];var i=Array.prototype.slice.apply(t.querySelectorAll(nn));return n&&he.call(t,nn)&&i.unshift(t),i=i.filter(r),i},sn=function(t,n,r){for(var i=[],s=Array.from(t);s.length;){var o=s.shift();if(!on(o,!1))if(o.tagName==="SLOT"){var a=o.assignedElements(),l=a.length?a:o.children,u=sn(l,!0,r);r.flatten?i.push.apply(i,u):i.push({scopeParent:o,candidates:u})}else{var f=he.call(o,nn);f&&r.filter(o)&&(n||!t.includes(o))&&i.push(o);var d=o.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(o),g=!on(d,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(o));if(d&&g){var v=sn(d===!0?o.children:d.children,!0,r);r.flatten?i.push.apply(i,v):i.push({scopeParent:o,candidates:v})}else s.unshift.apply(s,o.children)}}return i},Mi=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},Fi=function(t){if(!t)throw new Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||ya(t))&&!Mi(t)?0:t.tabIndex},wa=function(t,n){var r=Fi(t);return r<0&&n&&!Mi(t)?0:r},ba=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},Ri=function(t){return t.tagName==="INPUT"},xa=function(t){return Ri(t)&&t.type==="hidden"},Sa=function(t){var n=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(r){return r.tagName==="SUMMARY"});return n},Aa=function(t,n){for(var r=0;r<t.length;r++)if(t[r].checked&&t[r].form===n)return t[r]},Ea=function(t){if(!t.name)return!0;var n=t.form||rn(t),r=function(a){return n.querySelectorAll('input[type="radio"][name="'+a+'"]')},i;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")i=r(window.CSS.escape(t.name));else try{i=r(t.name)}catch(o){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",o.message),!1}var s=Aa(i,t.form);return!s||s===t},Oa=function(t){return Ri(t)&&t.type==="radio"},Ta=function(t){return Oa(t)&&!Ea(t)},Pa=function(t){var n,r=t&&rn(t),i=(n=r)===null||n===void 0?void 0:n.host,s=!1;if(r&&r!==t){var o,a,l;for(s=!!((o=i)!==null&&o!==void 0&&(a=o.ownerDocument)!==null&&a!==void 0&&a.contains(i)||t!=null&&(l=t.ownerDocument)!==null&&l!==void 0&&l.contains(t));!s&&i;){var u,f,d;r=rn(i),i=(u=r)===null||u===void 0?void 0:u.host,s=!!((f=i)!==null&&f!==void 0&&(d=f.ownerDocument)!==null&&d!==void 0&&d.contains(i))}}return s},Lr=function(t){var n=t.getBoundingClientRect(),r=n.width,i=n.height;return r===0&&i===0},Ca=function(t,n){var r=n.displayCheck,i=n.getShadowRoot;if(r==="full-native"&&"checkVisibility"in t){var s=t.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});return!s}if(getComputedStyle(t).visibility==="hidden")return!0;var o=he.call(t,"details>summary:first-of-type"),a=o?t.parentElement:t;if(he.call(a,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="full-native"||r==="legacy-full"){if(typeof i=="function"){for(var l=t;t;){var u=t.parentElement,f=rn(t);if(u&&!u.shadowRoot&&i(u)===!0)return Lr(t);t.assignedSlot?t=t.assignedSlot:!u&&f!==t.ownerDocument?t=f.host:t=u}t=l}if(Pa(t))return!t.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return Lr(t);return!1},_a=function(t){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(t.tagName))for(var n=t.parentElement;n;){if(n.tagName==="FIELDSET"&&n.disabled){for(var r=0;r<n.children.length;r++){var i=n.children.item(r);if(i.tagName==="LEGEND")return he.call(n,"fieldset[disabled] *")?!0:!i.contains(t)}return!0}n=n.parentElement}return!1},an=function(t,n){return!(n.disabled||xa(n)||Ca(n,t)||Sa(n)||_a(n))},Kn=function(t,n){return!(Ta(n)||Fi(n)<0||!an(t,n))},ka=function(t){var n=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},Di=function(t){var n=[],r=[];return t.forEach(function(i,s){var o=!!i.scopeParent,a=o?i.scopeParent:i,l=wa(a,o),u=o?Di(i.candidates):a;l===0?o?n.push.apply(n,u):n.push(a):r.push({documentOrder:s,tabIndex:l,item:i,isScope:o,content:u})}),r.sort(ba).reduce(function(i,s){return s.isScope?i.push.apply(i,s.content):i.push(s.content),i},[]).concat(n)},Ii=function(t,n){n=n||{};var r;return n.getShadowRoot?r=sn([t],n.includeContainer,{filter:Kn.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:ka}):r=ki(t,n.includeContainer,Kn.bind(null,n)),Di(r)},Ni=function(t,n){n=n||{};var r;return n.getShadowRoot?r=sn([t],n.includeContainer,{filter:an.bind(null,n),flatten:!0,getShadowRoot:n.getShadowRoot}):r=ki(t,n.includeContainer,an.bind(null,n)),r},tr=function(t,n){if(n=n||{},!t)throw new Error("No node provided");return he.call(t,nn)===!1?!1:Kn(n,t)},Ma=Ci.concat("iframe:not([inert]):not([inert] *)").join(","),Li=function(t,n){if(n=n||{},!t)throw new Error("No node provided");return he.call(t,Ma)===!1?!1:an(n,t)};function Ie(){return{getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"}}function Fa(e,t){if(!tr(e,Ie()))return Ra(e,t);const n=Ve(e),r=Ii(n.body,Ie());t==="prev"&&r.reverse();const i=r.indexOf(e);return i===-1?n.body:r.slice(i+1)[0]}function Ra(e,t){const n=Ve(e);if(!Li(e,Ie()))return n.body;const r=Ni(n.body,Ie());t==="prev"&&r.reverse();const i=r.indexOf(e);return i===-1?n.body:r.slice(i+1).find(o=>tr(o,Ie()))??n.body}function Bi(e,t,n){const r=t.toLowerCase();if(r.endsWith(" ")){const d=r.slice(0,-1);if(e.filter(h=>h.toLowerCase().startsWith(d)).length<=1)return Bi(e,d,n);const v=n?.toLowerCase();if(v&&v.startsWith(d)&&v.charAt(d.length)===" "&&t.trim()===d)return n;const p=e.filter(h=>h.toLowerCase().startsWith(r));if(p.length>0){const h=n?e.indexOf(n):-1;return Br(p,Math.max(h,0)).find(E=>E!==n)||n}}const s=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,o=s.toLowerCase(),a=n?e.indexOf(n):-1;let l=Br(e,Math.max(a,0));s.length===1&&(l=l.filter(d=>d!==n));const f=l.find(d=>d?.toLowerCase().startsWith(o));return f!==n?f:void 0}function Br(e,t){return e.map((n,r)=>e[(t+r)%e.length])}const Da={afterMs:1e4,onChange:ct};function Wi(e,t){const{afterMs:n,onChange:r,getWindow:i}={...Da,...t};let s=null,o=B(qt(e));function a(){return i().setTimeout(()=>{m(o,e,!0),r?.(e)},n)}return vt(()=>()=>{s&&i().clearTimeout(s)}),T(()=>c(o),l=>{m(o,l,!0),r?.(l),s&&i().clearTimeout(s),s=a()})}class Ia{#t;#e;#n=_(()=>this.#t.onMatch?this.#t.onMatch:t=>t.focus());#r=_(()=>this.#t.getCurrentItem?this.#t.getCurrentItem:this.#t.getActiveElement);constructor(t){this.#t=t,this.#e=Wi("",{afterMs:1e3,getWindow:t.getWindow}),this.handleTypeaheadSearch=this.handleTypeaheadSearch.bind(this),this.resetTypeahead=this.resetTypeahead.bind(this)}handleTypeaheadSearch(t,n){if(!n.length)return;this.#e.current=this.#e.current+t;const r=c(this.#r)(),i=n.find(l=>l===r)?.textContent?.trim()??"",s=n.map(l=>l.textContent?.trim()??""),o=Bi(s,this.#e.current,i),a=n.find(l=>l.textContent?.trim()===o);return a&&c(this.#n)(a),a}resetTypeahead(){this.#e.current=""}get search(){return this.#e.current}}class Na{#t;#e;#n;#r=B(null);constructor(t){this.#t=t,this.#e=_(()=>this.#t.enabled()),this.#n=Wi(!1,{afterMs:t.transitTimeout??300,onChange:n=>{c(this.#e)&&this.#t.setIsPointerInTransit?.(n)},getWindow:()=>Xn(this.#t.triggerNode())}),St([t.triggerNode,t.contentNode,t.enabled],([n,r,i])=>{if(!n||!r||!i)return;const s=a=>{this.#o(a,r)},o=a=>{this.#o(a,n)};return de(lt(n,"pointerleave",s),lt(r,"pointerleave",o))}),St(()=>c(this.#r),()=>{const n=i=>{if(!c(this.#r))return;const s=i.target;if(!Vn(s))return;const o={x:i.clientX,y:i.clientY},a=t.triggerNode()?.contains(s)||t.contentNode()?.contains(s),l=!za(o,c(this.#r));a?this.#i():l&&(this.#i(),t.onPointerExit())},r=Ve(t.triggerNode()??t.contentNode());if(r)return lt(r,"pointermove",n)})}#i(){m(this.#r,null),this.#n.current=!1}#o(t,n){const r=t.currentTarget;if(!Zt(r))return;const i={x:t.clientX,y:t.clientY},s=La(i,r.getBoundingClientRect()),o=Ba(i,s),a=Wa(n.getBoundingClientRect()),l=Va([...o,...a]);m(this.#r,l,!0),this.#n.current=!0}}function La(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),s=Math.abs(t.left-e.x);switch(Math.min(n,r,i,s)){case s:return"left";case i:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function Ba(e,t,n=5){const r=n*1.5;switch(t){case"top":return[{x:e.x-n,y:e.y+n},{x:e.x,y:e.y-r},{x:e.x+n,y:e.y+n}];case"bottom":return[{x:e.x-n,y:e.y-n},{x:e.x,y:e.y+r},{x:e.x+n,y:e.y-n}];case"left":return[{x:e.x+n,y:e.y-n},{x:e.x-r,y:e.y},{x:e.x+n,y:e.y+n}];case"right":return[{x:e.x-n,y:e.y-n},{x:e.x+r,y:e.y},{x:e.x-n,y:e.y+n}]}}function Wa(e){const{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function za(e,t){const{x:n,y:r}=e;let i=!1;for(let s=0,o=t.length-1;s<t.length;o=s++){const a=t[s].x,l=t[s].y,u=t[o].x,f=t[o].y;l>r!=f>r&&n<(u-a)*(r-l)/(f-l)+a&&(i=!i)}return i}function Va(e){const t=e.slice();return t.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),Ka(t)}function Ka(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const i=e[r];for(;t.length>=2;){const s=t[t.length-1],o=t[t.length-2];if((s.x-o.x)*(i.y-o.y)>=(s.y-o.y)*(i.x-o.x))t.pop();else break}t.push(i)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const i=e[r];for(;n.length>=2;){const s=n[n.length-1],o=n[n.length-2];if((s.x-o.x)*(i.y-o.y)>=(s.y-o.y)*(i.x-o.x))n.pop();else break}n.push(i)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}const Ha="data-context-menu-trigger",Ua="data-context-menu-content",zi=new we("Menu.Root"),er=new we("Menu.Root | Menu.Sub"),Vi=new we("Menu.Content"),ja=new da("bitsmenuopen",{bubbles:!1,cancelable:!0}),Ya=Ks({component:"menu",parts:["trigger","content","sub-trigger","item","group","group-heading","checkbox-group","checkbox-item","radio-group","radio-item","separator","sub-content","arrow"]});class nr{static create(t){const n=new nr(t);return zi.set(n)}opts;isUsingKeyboard=new ee;#t=B(!1);get ignoreCloseAutoFocus(){return c(this.#t)}set ignoreCloseAutoFocus(t){m(this.#t,t,!0)}#e=B(!1);get isPointerInTransit(){return c(this.#e)}set isPointerInTransit(t){m(this.#e,t,!0)}constructor(t){this.opts=t}getBitsAttr=t=>Ya.getAttr(t,this.opts.variant.current)}class rr{static create(t,n){return er.set(new rr(t,n,null))}opts;root;parentMenu;contentId=T(()=>"");#t=B(null);get contentNode(){return c(this.#t)}set contentNode(t){m(this.#t,t,!0)}contentPresence;#e=B(null);get triggerNode(){return c(this.#e)}set triggerNode(t){m(this.#e,t,!0)}constructor(t,n,r){this.opts=t,this.root=n,this.parentMenu=r,this.contentPresence=new na({ref:T(()=>this.contentNode),open:this.opts.open,onComplete:()=>{this.opts.onOpenChangeComplete.current(this.opts.open.current)}}),r&&St(()=>r.opts.open.current,()=>{r.opts.open.current||(this.opts.open.current=!1)})}toggleOpen(){this.opts.open.current=!this.opts.open.current}onOpen(){this.opts.open.current=!0}onClose(){this.opts.open.current=!1}}class ir{static create(t){return Vi.set(new ir(t,er.get()))}opts;parentMenu;rovingFocusGroup;domContext;attachment;#t=B("");get search(){return c(this.#t)}set search(t){m(this.#t,t,!0)}#e=0;#n;#r=B(!1);get mounted(){return c(this.#r)}set mounted(t){m(this.#r,t,!0)}#i;constructor(t,n){this.opts=t,this.parentMenu=n,this.domContext=new Zn(t.ref),this.attachment=fe(this.opts.ref,r=>{this.parentMenu.contentNode!==r&&(this.parentMenu.contentNode=r)}),n.contentId=t.id,this.#i=t.isSub??!1,this.onkeydown=this.onkeydown.bind(this),this.onblur=this.onblur.bind(this),this.onfocus=this.onfocus.bind(this),this.handleInteractOutside=this.handleInteractOutside.bind(this),new Na({contentNode:()=>this.parentMenu.contentNode,triggerNode:()=>this.parentMenu.triggerNode,enabled:()=>this.parentMenu.opts.open.current&&!!this.parentMenu.triggerNode?.hasAttribute(this.parentMenu.root.getBitsAttr("sub-trigger")),onPointerExit:()=>{this.parentMenu.opts.open.current=!1},setIsPointerInTransit:r=>{this.parentMenu.root.isPointerInTransit=r}}),this.#n=new Ia({getActiveElement:()=>this.domContext.getActiveElement(),getWindow:()=>this.domContext.getWindow()}).handleTypeaheadSearch,this.rovingFocusGroup=new ta({rootNode:T(()=>this.parentMenu.contentNode),candidateAttr:this.parentMenu.root.getBitsAttr("item"),loop:this.opts.loop,orientation:T(()=>"vertical")}),St(()=>this.parentMenu.contentNode,r=>{if(!r)return;const i=()=>{Gt(()=>{this.parentMenu.root.isUsingKeyboard.current&&this.rovingFocusGroup.focusFirstCandidate()})};return ja.listen(r,i)}),vt(()=>{this.parentMenu.opts.open.current||this.domContext.getWindow().clearTimeout(this.#e)})}#o(){const t=this.parentMenu.contentNode;return t?Array.from(t.querySelectorAll(`[${this.parentMenu.root.getBitsAttr("item")}]:not([data-disabled])`)):[]}#a(){return this.parentMenu.root.isPointerInTransit}onCloseAutoFocus=t=>{this.opts.onCloseAutoFocus.current?.(t),!(t.defaultPrevented||this.#i)&&this.parentMenu.triggerNode&&tr(this.parentMenu.triggerNode)&&(t.preventDefault(),this.parentMenu.triggerNode.focus())};handleTabKeyDown(t){let n=this.parentMenu;for(;n.parentMenu!==null;)n=n.parentMenu;if(!n.triggerNode)return;t.preventDefault();const r=Fa(n.triggerNode,t.shiftKey?"prev":"next");r?(this.parentMenu.root.ignoreCloseAutoFocus=!0,n.onClose(),Gt(()=>{r.focus(),Gt(()=>{this.parentMenu.root.ignoreCloseAutoFocus=!1})})):this.domContext.getDocument().body.focus()}onkeydown(t){if(t.defaultPrevented)return;if(t.key===Ys){this.handleTabKeyDown(t);return}const n=t.target,r=t.currentTarget;if(!Zt(n)||!Zt(r))return;const i=n.closest(`[${this.parentMenu.root.getBitsAttr("content")}]`)?.id===this.parentMenu.contentId.current,s=t.ctrlKey||t.altKey||t.metaKey,o=t.key.length===1;if(this.rovingFocusGroup.handleKeydown(n,t)||t.code==="Space")return;const l=this.#o();i&&!s&&o&&this.#n(t.key,l),t.target?.id===this.parentMenu.contentId.current&&va.includes(t.key)&&(t.preventDefault(),Pi.includes(t.key)&&l.reverse(),ma(l,{select:!1},()=>this.domContext.getActiveElement()))}onblur(t){Vn(t.currentTarget)&&Vn(t.target)&&(t.currentTarget.contains?.(t.target)||(this.domContext.getWindow().clearTimeout(this.#e),this.search=""))}onfocus(t){this.parentMenu.root.isUsingKeyboard.current&&Gt(()=>this.rovingFocusGroup.focusFirstCandidate())}onItemEnter(){return this.#a()}onItemLeave(t){if(t.currentTarget.hasAttribute(this.parentMenu.root.getBitsAttr("sub-trigger"))||this.#a()||this.parentMenu.root.isUsingKeyboard.current)return;this.parentMenu.contentNode?.focus(),this.rovingFocusGroup.setCurrentTabStopId("")}onTriggerLeave(){return!!this.#a()}handleInteractOutside(t){if(!Ei(t.target))return;const n=this.parentMenu.triggerNode?.id;if(t.target.id===n){t.preventDefault();return}t.target.closest(`#${n}`)&&t.preventDefault()}get shouldRender(){return this.parentMenu.contentPresence.shouldRender}#s=_(()=>({open:this.parentMenu.opts.open.current}));get snippetProps(){return c(this.#s)}set snippetProps(t){m(this.#s,t)}#c=_(()=>({id:this.opts.id.current,role:"menu","aria-orientation":"vertical",[this.parentMenu.root.getBitsAttr("content")]:"","data-state":wi(this.parentMenu.opts.open.current),onkeydown:this.onkeydown,onblur:this.onblur,onfocus:this.onfocus,dir:this.parentMenu.root.opts.dir.current,style:{pointerEvents:"auto",contain:"layout style"},...this.attachment}));get props(){return c(this.#c)}set props(t){m(this.#c,t)}popperProps={onCloseAutoFocus:t=>this.onCloseAutoFocus(t)}}class Ga{opts;content;attachment;#t=B(!1);constructor(t,n){this.opts=t,this.content=n,this.attachment=fe(this.opts.ref),this.onpointermove=this.onpointermove.bind(this),this.onpointerleave=this.onpointerleave.bind(this),this.onfocus=this.onfocus.bind(this),this.onblur=this.onblur.bind(this)}onpointermove(t){if(!t.defaultPrevented&&Nr(t))if(this.opts.disabled.current)this.content.onItemLeave(t);else{if(this.content.onItemEnter())return;const r=t.currentTarget;if(!Zt(r))return;r.focus()}}onpointerleave(t){t.defaultPrevented||Nr(t)&&this.content.onItemLeave(t)}onfocus(t){Gt(()=>{t.defaultPrevented||this.opts.disabled.current||m(this.#t,!0)})}onblur(t){Gt(()=>{t.defaultPrevented||m(this.#t,!1)})}#e=_(()=>({id:this.opts.id.current,tabindex:-1,role:"menuitem","aria-disabled":mi(this.opts.disabled.current),"data-disabled":yi(this.opts.disabled.current),"data-highlighted":c(this.#t)?"":void 0,[this.content.parentMenu.root.getBitsAttr("item")]:"",onpointermove:this.onpointermove,onpointerleave:this.onpointerleave,onfocus:this.onfocus,onblur:this.onblur,...this.attachment}));get props(){return c(this.#e)}set props(t){m(this.#e,t)}}class or{static create(t){const n=new Ga(t,Vi.get());return new or(t,n)}opts;item;root;#t=!1;constructor(t,n){this.opts=t,this.item=n,this.root=n.content.parentMenu.root,this.onkeydown=this.onkeydown.bind(this),this.onclick=this.onclick.bind(this),this.onpointerdown=this.onpointerdown.bind(this),this.onpointerup=this.onpointerup.bind(this)}#e(){if(this.item.opts.disabled.current)return;const t=new CustomEvent("menuitemselect",{bubbles:!0,cancelable:!0});if(this.opts.onSelect.current(t),t.defaultPrevented){this.item.content.parentMenu.root.isUsingKeyboard.current=!1;return}this.opts.closeOnSelect.current&&this.item.content.parentMenu.root.opts.onClose()}onkeydown(t){const n=this.item.content.search!=="";if(!(this.item.opts.disabled.current||n&&t.key===$n)&&ha.includes(t.key)){if(!Zt(t.currentTarget))return;t.currentTarget.click(),t.preventDefault()}}onclick(t){this.item.opts.disabled.current||this.#e()}onpointerup(t){if(!t.defaultPrevented&&!this.#t){if(!Zt(t.currentTarget))return;t.currentTarget?.click()}}onpointerdown(t){this.#t=!0}#n=_(()=>Xt(this.item.props,{onclick:this.onclick,onpointerdown:this.onpointerdown,onpointerup:this.onpointerup,onkeydown:this.onkeydown}));get props(){return c(this.#n)}set props(t){m(this.#n,t)}}class sr{static create(t){return new sr(t,zi.get())}opts;root;attachment;constructor(t,n){this.opts=t,this.root=n,this.attachment=fe(this.opts.ref)}#t=_(()=>({id:this.opts.id.current,role:"group",[this.root.getBitsAttr("separator")]:"",...this.attachment}));get props(){return c(this.#t)}set props(t){m(this.#t,t)}}class ar{static create(t){return new ar(t,er.get())}opts;parentMenu;attachment;constructor(t,n){this.opts=t,this.parentMenu=n,this.attachment=fe(this.opts.ref,r=>this.parentMenu.triggerNode=r)}onclick=t=>{this.opts.disabled.current||t.detail!==0||(this.parentMenu.toggleOpen(),t.preventDefault())};onpointerdown=t=>{if(!this.opts.disabled.current){if(t.pointerType==="touch")return t.preventDefault();t.button===0&&t.ctrlKey===!1&&(this.parentMenu.toggleOpen(),this.parentMenu.opts.open.current||t.preventDefault())}};onpointerup=t=>{this.opts.disabled.current||t.pointerType==="touch"&&(t.preventDefault(),this.parentMenu.toggleOpen())};onkeydown=t=>{if(!this.opts.disabled.current){if(t.key===$n||t.key===xi){this.parentMenu.toggleOpen(),t.preventDefault();return}t.key===Ne&&(this.parentMenu.onOpen(),t.preventDefault())}};#t=_(()=>{if(this.parentMenu.opts.open.current&&this.parentMenu.contentId.current)return this.parentMenu.contentId.current});#e=_(()=>({id:this.opts.id.current,disabled:this.opts.disabled.current,"aria-haspopup":"menu","aria-expanded":mi(this.parentMenu.opts.open.current),"aria-controls":c(this.#t),"data-disabled":yi(this.opts.disabled.current),"data-state":wi(this.parentMenu.opts.open.current),[this.parentMenu.root.getBitsAttr("trigger")]:"",onclick:this.onclick,onpointerdown:this.onpointerdown,onpointerup:this.onpointerup,onkeydown:this.onkeydown,...this.attachment}));get props(){return c(this.#e)}set props(t){m(this.#e,t)}}globalThis.bitsDismissableLayers??=new Map;class cr{static create(t){return new cr(t)}opts;#t;#e;#n={pointerdown:!1};#r=!1;#i=!1;#o=void 0;#a;#s=ct;constructor(t){this.opts=t,this.#e=t.interactOutsideBehavior,this.#t=t.onInteractOutside,this.#a=t.onFocusOutside,vt(()=>{this.#o=Ti(this.opts.ref.current)});let n=ct;const r=()=>{this.#f(),globalThis.bitsDismissableLayers.delete(this),this.#l.destroy(),n()};St([()=>this.opts.enabled.current,()=>this.opts.ref.current],()=>{if(!(!this.opts.enabled.current||!this.opts.ref.current))return Rs(1,()=>{this.opts.ref.current&&(globalThis.bitsDismissableLayers.set(this,this.#e),n(),n=this.#d())}),r}),ze(()=>{this.#f.destroy(),globalThis.bitsDismissableLayers.delete(this),this.#l.destroy(),this.#s(),n()})}#c=t=>{t.defaultPrevented||this.opts.ref.current&&Gt(()=>{!this.opts.ref.current||this.#p(t.target)||t.target&&!this.#i&&this.#a.current?.(t)})};#d(){return de(lt(this.#o,"pointerdown",de(this.#h,this.#v),{capture:!0}),lt(this.#o,"pointerdown",de(this.#g,this.#l)),lt(this.#o,"focusin",this.#c))}#u=t=>{let n=t;n.defaultPrevented&&(n=Wr(t)),this.#t.current(t)};#l=Ir(t=>{if(!this.opts.ref.current){this.#s();return}const n=this.opts.isValidEvent.current(t,this.opts.ref.current)||Za(t,this.opts.ref.current);if(!this.#r||this.#m()||!n){this.#s();return}let r=t;if(r.defaultPrevented&&(r=Wr(r)),this.#e.current!=="close"&&this.#e.current!=="defer-otherwise-close"){this.#s();return}t.pointerType==="touch"?(this.#s(),this.#s=lt(this.#o,"click",this.#u,{once:!0})):this.#t.current(r)},10);#h=t=>{this.#n[t.type]=!0};#g=t=>{this.#n[t.type]=!1};#v=()=>{this.opts.ref.current&&(this.#r=Xa(this.opts.ref.current))};#p=t=>this.opts.ref.current?Oi(this.opts.ref.current,t):!1;#f=Ir(()=>{for(const t in this.#n)this.#n[t]=!1;this.#r=!1},20);#m(){return Object.values(this.#n).some(Boolean)}#y=()=>{this.#i=!0};#w=()=>{this.#i=!1};props={onfocuscapture:this.#y,onblurcapture:this.#w}}function qa(e=[...globalThis.bitsDismissableLayers]){return e.findLast(([t,{current:n}])=>n==="close"||n==="ignore")}function Xa(e){const t=[...globalThis.bitsDismissableLayers],n=qa(t);if(n)return n[0].opts.ref.current===e;const[r]=t[0];return r.opts.ref.current===e}function Za(e,t){const n=e.target;if(!Ei(n))return!1;const r=!!n.closest(`[${Ha}]`);if("button"in e&&e.button>0&&!r)return!1;if("button"in e&&e.button===0&&r)return!0;const i=!!t.closest(`[${Ua}]`);return r&&i?!1:Ti(n).documentElement.contains(n)&&!Oi(t,n)&&fa(e,t)}function Wr(e){const t=e.currentTarget,n=e.target;let r;e instanceof PointerEvent?r=new PointerEvent(e.type,e):r=new PointerEvent("pointerdown",e);let i=!1;return new Proxy(r,{get:(o,a)=>a==="currentTarget"?t:a==="target"?n:a==="preventDefault"?()=>{i=!0,typeof o.preventDefault=="function"&&o.preventDefault()}:a==="defaultPrevented"?i:a in o?o[a]:e[a]})}function Ja(e,t){ut(t,!0);let n=x(t,"interactOutsideBehavior",3,"close"),r=x(t,"onInteractOutside",3,ct),i=x(t,"onFocusOutside",3,ct),s=x(t,"isValidEvent",3,()=>!1);const o=cr.create({id:T(()=>t.id),interactOutsideBehavior:T(()=>n()),onInteractOutside:T(()=>r()),enabled:T(()=>t.enabled),onFocusOutside:T(()=>i()),isValidEvent:T(()=>s()),ref:t.ref});var a=L(),l=D(a);st(l,()=>t.children??pt,()=>({props:o.props})),A(e,a),dt()}globalThis.bitsEscapeLayers??=new Map;class lr{static create(t){return new lr(t)}opts;domContext;constructor(t){this.opts=t,this.domContext=new Zn(this.opts.ref);let n=ct;St(()=>t.enabled.current,r=>(r&&(globalThis.bitsEscapeLayers.set(this,t.escapeKeydownBehavior),n=this.#t()),()=>{n(),globalThis.bitsEscapeLayers.delete(this)}))}#t=()=>lt(this.domContext.getDocument(),"keydown",this.#e,{passive:!1});#e=t=>{if(t.key!==Hs||!Qa(this))return;const n=new KeyboardEvent(t.type,t);t.preventDefault();const r=this.opts.escapeKeydownBehavior.current;r!=="close"&&r!=="defer-otherwise-close"||this.opts.onEscapeKeydown.current(n)}}function Qa(e){const t=[...globalThis.bitsEscapeLayers],n=t.findLast(([i,{current:s}])=>s==="close"||s==="ignore");if(n)return n[0]===e;const[r]=t[0];return r===e}function $a(e,t){ut(t,!0);let n=x(t,"escapeKeydownBehavior",3,"close"),r=x(t,"onEscapeKeydown",3,ct);lr.create({escapeKeydownBehavior:T(()=>n()),onEscapeKeydown:T(()=>r()),enabled:T(()=>t.enabled),ref:t.ref});var i=L(),s=D(i);st(s,()=>t.children??pt),A(e,i),dt()}class ur{static instance;#t=Wt([]);#e=new WeakMap;#n=new WeakMap;static getInstance(){return this.instance||(this.instance=new ur),this.instance}register(t){const n=this.getActive();n&&n!==t&&n.pause();const r=document.activeElement;r&&r!==document.body&&this.#n.set(t,r),this.#t.current=this.#t.current.filter(i=>i!==t),this.#t.current.unshift(t)}unregister(t){this.#t.current=this.#t.current.filter(r=>r!==t);const n=this.getActive();n&&n.resume()}getActive(){return this.#t.current[0]}setFocusMemory(t,n){this.#e.set(t,n)}getFocusMemory(t){return this.#e.get(t)}isActiveScope(t){return this.getActive()===t}setPreFocusMemory(t,n){this.#n.set(t,n)}getPreFocusMemory(t){return this.#n.get(t)}clearPreFocusMemory(t){this.#n.delete(t)}}class dr{#t=!1;#e=null;#n=ur.getInstance();#r=[];#i;constructor(t){this.#i=t}get paused(){return this.#t}pause(){this.#t=!0}resume(){this.#t=!1}#o(){for(const t of this.#r)t();this.#r=[]}mount(t){this.#e&&this.unmount(),this.#e=t,this.#n.register(this),this.#c(),this.#a()}unmount(){this.#e&&(this.#o(),this.#s(),this.#n.unregister(this),this.#n.clearPreFocusMemory(this),this.#e=null)}#a(){if(!this.#e)return;const t=new CustomEvent("focusScope.onOpenAutoFocus",{bubbles:!1,cancelable:!0});this.#i.onOpenAutoFocus.current(t),t.defaultPrevented||requestAnimationFrame(()=>{if(!this.#e)return;const n=this.#u();n?(n.focus(),this.#n.setFocusMemory(this,n)):this.#e.focus()})}#s(){const t=new CustomEvent("focusScope.onCloseAutoFocus",{bubbles:!1,cancelable:!0});if(this.#i.onCloseAutoFocus.current?.(t),!t.defaultPrevented){const n=this.#n.getPreFocusMemory(this);if(n&&document.contains(n))try{n.focus()}catch{document.body.focus()}}}#c(){if(!this.#e||!this.#i.trap.current)return;const t=this.#e,n=t.ownerDocument,r=o=>{if(this.#t||!this.#n.isActiveScope(this))return;const a=o.target;if(!a)return;if(t.contains(a))this.#n.setFocusMemory(this,a);else{const u=this.#n.getFocusMemory(this);if(u&&t.contains(u)&&Li(u))o.preventDefault(),u.focus();else{const f=this.#u(),d=this.#l()[0];(f||d||t).focus()}}},i=o=>{if(!this.#i.loop||this.#t||o.key!=="Tab"||!this.#n.isActiveScope(this))return;const a=this.#d();if(a.length===0)return;const l=a[0],u=a[a.length-1];!o.shiftKey&&n.activeElement===u?(o.preventDefault(),l.focus()):o.shiftKey&&n.activeElement===l&&(o.preventDefault(),u.focus())};this.#r.push(lt(n,"focusin",r,{capture:!0}),lt(t,"keydown",i));const s=new MutationObserver(()=>{const o=this.#n.getFocusMemory(this);if(o&&!t.contains(o)){const a=this.#u(),l=this.#l()[0],u=a||l;u?(u.focus(),this.#n.setFocusMemory(this,u)):t.focus()}});s.observe(t,{childList:!0,subtree:!0}),this.#r.push(()=>s.disconnect())}#d(){return this.#e?Ii(this.#e,{includeContainer:!1,getShadowRoot:!0}):[]}#u(){return this.#d()[0]||null}#l(){return this.#e?Ni(this.#e,{includeContainer:!1,getShadowRoot:!0}):[]}static use(t){let n=null;return St([()=>t.ref.current,()=>t.enabled.current],([r,i])=>{r&&i?(n||(n=new dr(t)),n.mount(r)):n&&(n.unmount(),n=null)}),ze(()=>{n?.unmount()}),{get props(){return{tabindex:-1}}}}}function tc(e,t){ut(t,!0);let n=x(t,"enabled",3,!1),r=x(t,"trapFocus",3,!1),i=x(t,"loop",3,!1),s=x(t,"onCloseAutoFocus",3,ct),o=x(t,"onOpenAutoFocus",3,ct);const a=dr.use({enabled:T(()=>n()),trap:T(()=>r()),loop:i(),onCloseAutoFocus:T(()=>s()),onOpenAutoFocus:T(()=>o()),ref:t.ref});var l=L(),u=D(l);st(u,()=>t.focusScope??pt,()=>({props:a.props})),A(e,l),dt()}globalThis.bitsTextSelectionLayers??=new Map;class fr{static create(t){return new fr(t)}opts;domContext;#t=ct;constructor(t){this.opts=t,this.domContext=new Zn(t.ref);let n=ct;St(()=>this.opts.enabled.current,r=>(r&&(globalThis.bitsTextSelectionLayers.set(this,this.opts.enabled),n(),n=this.#e()),()=>{n(),this.#r(),globalThis.bitsTextSelectionLayers.delete(this)}))}#e(){return de(lt(this.domContext.getDocument(),"pointerdown",this.#n),lt(this.domContext.getDocument(),"pointerup",ui(this.#r,this.opts.onPointerUp.current)))}#n=t=>{const n=this.opts.ref.current,r=t.target;!Zt(n)||!Zt(r)||!this.opts.enabled.current||!nc(this)||!Ws(n,r)||(this.opts.onPointerDown.current(t),!t.defaultPrevented&&(this.#t=ec(n,this.domContext.getDocument().body)))};#r=()=>{this.#t(),this.#t=ct}}const zr=e=>e.style.userSelect||e.style.webkitUserSelect;function ec(e,t){const n=zr(t),r=zr(e);return Xe(t,"none"),Xe(e,"text"),()=>{Xe(t,n),Xe(e,r)}}function Xe(e,t){e.style.userSelect=t,e.style.webkitUserSelect=t}function nc(e){const t=[...globalThis.bitsTextSelectionLayers];if(!t.length)return!1;const n=t.at(-1);return n?n[0]===e:!1}function rc(e,t){ut(t,!0);let n=x(t,"preventOverflowTextSelection",3,!0),r=x(t,"onPointerDown",3,ct),i=x(t,"onPointerUp",3,ct);fr.create({id:T(()=>t.id),onPointerDown:T(()=>r()),onPointerUp:T(()=>i()),enabled:T(()=>t.enabled&&n()),ref:t.ref});var s=L(),o=D(s);st(o,()=>t.children??pt),A(e,s),dt()}globalThis.bitsIdCounter??={current:0};function hr(e="bits"){return globalThis.bitsIdCounter.current++,`${e}-${globalThis.bitsIdCounter.current}`}class ic{#t;#e=0;#n=B();#r;constructor(t){this.#t=t}#i(){this.#e-=1,this.#r&&this.#e<=0&&(this.#r(),m(this.#n,void 0),this.#r=void 0)}get(...t){return this.#e+=1,c(this.#n)===void 0&&(this.#r=oi(()=>{m(this.#n,this.#t(...t),!0)})),vt(()=>()=>{this.#i()}),c(this.#n)}}const $e=new Ps;let Ze=B(null),kn=null,Me=null,Fe=!1;const Vr=T(()=>{for(const e of $e.values())if(e)return!0;return!1});let Mn=null;const oc=new ic(()=>{function e(){document.body.setAttribute("style",c(Ze)??""),document.body.style.removeProperty("--scrollbar-width"),Dr&&kn?.(),m(Ze,null)}function t(){Me!==null&&(window.clearTimeout(Me),Me=null)}function n(i,s){t(),Fe=!0,Mn=Date.now();const o=Mn,a=()=>{Me=null,Mn===o&&(Ki($e)?Fe=!1:(Fe=!1,s()))},l=i===null?24:i;Me=window.setTimeout(a,l)}function r(){c(Ze)===null&&$e.size===0&&!Fe&&m(Ze,document.body.getAttribute("style"),!0)}return St(()=>Vr.current,()=>{if(!Vr.current)return;r(),Fe=!1;const i=getComputedStyle(document.documentElement),s=getComputedStyle(document.body),o=i.scrollbarGutter?.includes("stable")||s.scrollbarGutter?.includes("stable"),a=window.innerWidth-document.documentElement.clientWidth,u={padding:Number.parseInt(s.paddingRight??"0",10)+a,margin:Number.parseInt(s.marginRight??"0",10)};a>0&&!o&&(document.body.style.paddingRight=`${u.padding}px`,document.body.style.marginRight=`${u.margin}px`,document.body.style.setProperty("--scrollbar-width",`${a}px`)),document.body.style.overflow="hidden",Dr&&(kn=lt(document,"touchmove",f=>{f.target===document.documentElement&&(f.touches.length>1||f.preventDefault())},{passive:!1})),Gt(()=>{document.body.style.pointerEvents="none",document.body.style.overflow="hidden"})}),ze(()=>()=>{kn?.()}),{get lockMap(){return $e},resetBodyStyle:e,scheduleCleanupIfNoNewLocks:n,cancelPendingCleanup:t,ensureInitialStyleCaptured:r}});class sc{#t=hr();#e;#n=()=>null;#r;locked;constructor(t,n=()=>null){this.#e=t,this.#n=n,this.#r=oc.get(),this.#r&&(this.#r.cancelPendingCleanup(),this.#r.ensureInitialStyleCaptured(),this.#r.lockMap.set(this.#t,this.#e??!1),this.locked=T(()=>this.#r.lockMap.get(this.#t)??!1,r=>this.#r.lockMap.set(this.#t,r)),ze(()=>{if(this.#r.lockMap.delete(this.#t),Ki(this.#r.lockMap))return;const r=this.#n();this.#r.scheduleCleanupIfNoNewLocks(r,()=>{this.#r.resetBodyStyle()})}))}}function Ki(e){for(const[t,n]of e)if(n)return!0;return!1}function Kr(e,t){ut(t,!0);let n=x(t,"preventScroll",3,!0),r=x(t,"restoreScrollDelay",3,null);n()&&new sc(n(),()=>r()),dt()}const ac=["top","right","bottom","left"],ne=Math.min,Tt=Math.max,cn=Math.round,Je=Math.floor,Vt=e=>({x:e,y:e}),cc={left:"right",right:"left",bottom:"top",top:"bottom"},lc={start:"end",end:"start"};function Hn(e,t,n){return Tt(e,ne(t,n))}function Jt(e,t){return typeof e=="function"?e(t):e}function Qt(e){return e.split("-")[0]}function Ee(e){return e.split("-")[1]}function gr(e){return e==="x"?"y":"x"}function vr(e){return e==="y"?"height":"width"}const uc=new Set(["top","bottom"]);function zt(e){return uc.has(Qt(e))?"y":"x"}function pr(e){return gr(zt(e))}function dc(e,t,n){n===void 0&&(n=!1);const r=Ee(e),i=pr(e),s=vr(i);let o=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(o=ln(o)),[o,ln(o)]}function fc(e){const t=ln(e);return[Un(e),t,Un(t)]}function Un(e){return e.replace(/start|end/g,t=>lc[t])}const Hr=["left","right"],Ur=["right","left"],hc=["top","bottom"],gc=["bottom","top"];function vc(e,t,n){switch(e){case"top":case"bottom":return n?t?Ur:Hr:t?Hr:Ur;case"left":case"right":return t?hc:gc;default:return[]}}function pc(e,t,n,r){const i=Ee(e);let s=vc(Qt(e),n==="start",r);return i&&(s=s.map(o=>o+"-"+i),t&&(s=s.concat(s.map(Un)))),s}function ln(e){return e.replace(/left|right|bottom|top/g,t=>cc[t])}function mc(e){return{top:0,right:0,bottom:0,left:0,...e}}function Hi(e){return typeof e!="number"?mc(e):{top:e,right:e,bottom:e,left:e}}function un(e){const{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function jr(e,t,n){let{reference:r,floating:i}=e;const s=zt(t),o=pr(t),a=vr(o),l=Qt(t),u=s==="y",f=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,g=r[a]/2-i[a]/2;let v;switch(l){case"top":v={x:f,y:r.y-i.height};break;case"bottom":v={x:f,y:r.y+r.height};break;case"right":v={x:r.x+r.width,y:d};break;case"left":v={x:r.x-i.width,y:d};break;default:v={x:r.x,y:r.y}}switch(Ee(t)){case"start":v[o]-=g*(n&&u?-1:1);break;case"end":v[o]+=g*(n&&u?-1:1);break}return v}async function yc(e,t){var n;t===void 0&&(t={});const{x:r,y:i,platform:s,rects:o,elements:a,strategy:l}=e,{boundary:u="clippingAncestors",rootBoundary:f="viewport",elementContext:d="floating",altBoundary:g=!1,padding:v=0}=Jt(t,e),p=Hi(v),y=a[g?d==="floating"?"reference":"floating":d],b=un(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(y)))==null||n?y:y.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:u,rootBoundary:f,strategy:l})),E=d==="floating"?{x:r,y:i,width:o.floating.width,height:o.floating.height}:o.reference,C=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),S=await(s.isElement==null?void 0:s.isElement(C))?await(s.getScale==null?void 0:s.getScale(C))||{x:1,y:1}:{x:1,y:1},N=un(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:E,offsetParent:C,strategy:l}):E);return{top:(b.top-N.top+p.top)/S.y,bottom:(N.bottom-b.bottom+p.bottom)/S.y,left:(b.left-N.left+p.left)/S.x,right:(N.right-b.right+p.right)/S.x}}const wc=async(e,t,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:o}=n,a=s.filter(Boolean),l=await(o.isRTL==null?void 0:o.isRTL(t));let u=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:f,y:d}=jr(u,r,l),g=r,v={},p=0;for(let y=0;y<a.length;y++){var h;const{name:b,fn:E}=a[y],{x:C,y:S,data:N,reset:O}=await E({x:f,y:d,initialPlacement:r,placement:g,strategy:i,middlewareData:v,rects:u,platform:{...o,detectOverflow:(h=o.detectOverflow)!=null?h:yc},elements:{reference:e,floating:t}});f=C??f,d=S??d,v={...v,[b]:{...v[b],...N}},O&&p<=50&&(p++,typeof O=="object"&&(O.placement&&(g=O.placement),O.rects&&(u=O.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):O.rects),{x:f,y:d}=jr(u,g,l)),y=-1)}return{x:f,y:d,placement:g,strategy:i,middlewareData:v}},bc=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:i,rects:s,platform:o,elements:a,middlewareData:l}=t,{element:u,padding:f=0}=Jt(e,t)||{};if(u==null)return{};const d=Hi(f),g={x:n,y:r},v=pr(i),p=vr(v),h=await o.getDimensions(u),y=v==="y",b=y?"top":"left",E=y?"bottom":"right",C=y?"clientHeight":"clientWidth",S=s.reference[p]+s.reference[v]-g[v]-s.floating[p],N=g[v]-s.reference[v],O=await(o.getOffsetParent==null?void 0:o.getOffsetParent(u));let k=O?O[C]:0;(!k||!await(o.isElement==null?void 0:o.isElement(O)))&&(k=a.floating[C]||s.floating[p]);const j=S/2-N/2,W=k/2-h[p]/2-1,F=ne(d[b],W),I=ne(d[E],W),H=F,q=k-h[p]-I,X=k/2-h[p]/2+j,J=Hn(H,X,q),z=!l.arrow&&Ee(i)!=null&&X!==J&&s.reference[p]/2-(X<H?F:I)-h[p]/2<0,G=z?X<H?X-H:X-q:0;return{[v]:g[v]+G,data:{[v]:J,centerOffset:X-J-G,...z&&{alignmentOffset:G}},reset:z}}}),xc=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:i,middlewareData:s,rects:o,initialPlacement:a,platform:l,elements:u}=t,{mainAxis:f=!0,crossAxis:d=!0,fallbackPlacements:g,fallbackStrategy:v="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:h=!0,...y}=Jt(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const b=Qt(i),E=zt(a),C=Qt(a)===a,S=await(l.isRTL==null?void 0:l.isRTL(u.floating)),N=g||(C||!h?[ln(a)]:fc(a)),O=p!=="none";!g&&O&&N.push(...pc(a,h,p,S));const k=[a,...N],j=await l.detectOverflow(t,y),W=[];let F=((r=s.flip)==null?void 0:r.overflows)||[];if(f&&W.push(j[b]),d){const X=dc(i,o,S);W.push(j[X[0]],j[X[1]])}if(F=[...F,{placement:i,overflows:W}],!W.every(X=>X<=0)){var I,H;const X=(((I=s.flip)==null?void 0:I.index)||0)+1,J=k[X];if(J&&(!(d==="alignment"?E!==zt(J):!1)||F.every(Z=>zt(Z.placement)===E?Z.overflows[0]>0:!0)))return{data:{index:X,overflows:F},reset:{placement:J}};let z=(H=F.filter(G=>G.overflows[0]<=0).sort((G,Z)=>G.overflows[1]-Z.overflows[1])[0])==null?void 0:H.placement;if(!z)switch(v){case"bestFit":{var q;const G=(q=F.filter(Z=>{if(O){const At=zt(Z.placement);return At===E||At==="y"}return!0}).map(Z=>[Z.placement,Z.overflows.filter(At=>At>0).reduce((At,Te)=>At+Te,0)]).sort((Z,At)=>Z[1]-At[1])[0])==null?void 0:q[0];G&&(z=G);break}case"initialPlacement":z=a;break}if(i!==z)return{reset:{placement:z}}}return{}}}};function Yr(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Gr(e){return ac.some(t=>e[t]>=0)}const Sc=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:i="referenceHidden",...s}=Jt(e,t);switch(i){case"referenceHidden":{const o=await r.detectOverflow(t,{...s,elementContext:"reference"}),a=Yr(o,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:Gr(a)}}}case"escaped":{const o=await r.detectOverflow(t,{...s,altBoundary:!0}),a=Yr(o,n.floating);return{data:{escapedOffsets:a,escaped:Gr(a)}}}default:return{}}}}},Ui=new Set(["left","top"]);async function Ac(e,t){const{placement:n,platform:r,elements:i}=e,s=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Qt(n),a=Ee(n),l=zt(n)==="y",u=Ui.has(o)?-1:1,f=s&&l?-1:1,d=Jt(t,e);let{mainAxis:g,crossAxis:v,alignmentAxis:p}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return a&&typeof p=="number"&&(v=a==="end"?p*-1:p),l?{x:v*f,y:g*u}:{x:g*u,y:v*f}}const Ec=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:i,y:s,placement:o,middlewareData:a}=t,l=await Ac(t,e);return o===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:i+l.x,y:s+l.y,data:{...l,placement:o}}}}},Oc=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:i,platform:s}=t,{mainAxis:o=!0,crossAxis:a=!1,limiter:l={fn:b=>{let{x:E,y:C}=b;return{x:E,y:C}}},...u}=Jt(e,t),f={x:n,y:r},d=await s.detectOverflow(t,u),g=zt(Qt(i)),v=gr(g);let p=f[v],h=f[g];if(o){const b=v==="y"?"top":"left",E=v==="y"?"bottom":"right",C=p+d[b],S=p-d[E];p=Hn(C,p,S)}if(a){const b=g==="y"?"top":"left",E=g==="y"?"bottom":"right",C=h+d[b],S=h-d[E];h=Hn(C,h,S)}const y=l.fn({...t,[v]:p,[g]:h});return{...y,data:{x:y.x-n,y:y.y-r,enabled:{[v]:o,[g]:a}}}}}},Tc=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:i,rects:s,middlewareData:o}=t,{offset:a=0,mainAxis:l=!0,crossAxis:u=!0}=Jt(e,t),f={x:n,y:r},d=zt(i),g=gr(d);let v=f[g],p=f[d];const h=Jt(a,t),y=typeof h=="number"?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(l){const C=g==="y"?"height":"width",S=s.reference[g]-s.floating[C]+y.mainAxis,N=s.reference[g]+s.reference[C]-y.mainAxis;v<S?v=S:v>N&&(v=N)}if(u){var b,E;const C=g==="y"?"width":"height",S=Ui.has(Qt(i)),N=s.reference[d]-s.floating[C]+(S&&((b=o.offset)==null?void 0:b[d])||0)+(S?0:y.crossAxis),O=s.reference[d]+s.reference[C]+(S?0:((E=o.offset)==null?void 0:E[d])||0)-(S?y.crossAxis:0);p<N?p=N:p>O&&(p=O)}return{[g]:v,[d]:p}}}},Pc=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:i,rects:s,platform:o,elements:a}=t,{apply:l=()=>{},...u}=Jt(e,t),f=await o.detectOverflow(t,u),d=Qt(i),g=Ee(i),v=zt(i)==="y",{width:p,height:h}=s.floating;let y,b;d==="top"||d==="bottom"?(y=d,b=g===(await(o.isRTL==null?void 0:o.isRTL(a.floating))?"start":"end")?"left":"right"):(b=d,y=g==="end"?"top":"bottom");const E=h-f.top-f.bottom,C=p-f.left-f.right,S=ne(h-f[y],E),N=ne(p-f[b],C),O=!t.middlewareData.shift;let k=S,j=N;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(j=C),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(k=E),O&&!g){const F=Tt(f.left,0),I=Tt(f.right,0),H=Tt(f.top,0),q=Tt(f.bottom,0);v?j=p-2*(F!==0||I!==0?F+I:Tt(f.left,f.right)):k=h-2*(H!==0||q!==0?H+q:Tt(f.top,f.bottom))}await l({...t,availableWidth:j,availableHeight:k});const W=await o.getDimensions(a.floating);return p!==W.width||h!==W.height?{reset:{rects:!0}}:{}}}};function mn(){return typeof window<"u"}function Oe(e){return ji(e)?(e.nodeName||"").toLowerCase():"#document"}function Pt(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ht(e){var t;return(t=(ji(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function ji(e){return mn()?e instanceof Node||e instanceof Pt(e).Node:!1}function Lt(e){return mn()?e instanceof Element||e instanceof Pt(e).Element:!1}function Kt(e){return mn()?e instanceof HTMLElement||e instanceof Pt(e).HTMLElement:!1}function qr(e){return!mn()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Pt(e).ShadowRoot}const Cc=new Set(["inline","contents"]);function Ke(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=Bt(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!Cc.has(i)}const _c=new Set(["table","td","th"]);function kc(e){return _c.has(Oe(e))}const Mc=[":popover-open",":modal"];function yn(e){return Mc.some(t=>{try{return e.matches(t)}catch{return!1}})}const Fc=["transform","translate","scale","rotate","perspective"],Rc=["transform","translate","scale","rotate","perspective","filter"],Dc=["paint","layout","strict","content"];function mr(e){const t=yr(),n=Lt(e)?Bt(e):e;return Fc.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||Rc.some(r=>(n.willChange||"").includes(r))||Dc.some(r=>(n.contain||"").includes(r))}function Ic(e){let t=re(e);for(;Kt(t)&&!Ae(t);){if(mr(t))return t;if(yn(t))return null;t=re(t)}return null}function yr(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const Nc=new Set(["html","body","#document"]);function Ae(e){return Nc.has(Oe(e))}function Bt(e){return Pt(e).getComputedStyle(e)}function wn(e){return Lt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function re(e){if(Oe(e)==="html")return e;const t=e.assignedSlot||e.parentNode||qr(e)&&e.host||Ht(e);return qr(t)?t.host:t}function Yi(e){const t=re(e);return Ae(t)?e.ownerDocument?e.ownerDocument.body:e.body:Kt(t)&&Ke(t)?t:Yi(t)}function Le(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=Yi(e),s=i===((r=e.ownerDocument)==null?void 0:r.body),o=Pt(i);if(s){const a=jn(o);return t.concat(o,o.visualViewport||[],Ke(i)?i:[],a&&n?Le(a):[])}return t.concat(i,Le(i,[],n))}function jn(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Gi(e){const t=Bt(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=Kt(e),s=i?e.offsetWidth:n,o=i?e.offsetHeight:r,a=cn(n)!==s||cn(r)!==o;return a&&(n=s,r=o),{width:n,height:r,$:a}}function wr(e){return Lt(e)?e:e.contextElement}function xe(e){const t=wr(e);if(!Kt(t))return Vt(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:s}=Gi(t);let o=(s?cn(n.width):n.width)/r,a=(s?cn(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const Lc=Vt(0);function qi(e){const t=Pt(e);return!yr()||!t.visualViewport?Lc:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Bc(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Pt(e)?!1:t}function ge(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),s=wr(e);let o=Vt(1);t&&(r?Lt(r)&&(o=xe(r)):o=xe(e));const a=Bc(s,n,r)?qi(s):Vt(0);let l=(i.left+a.x)/o.x,u=(i.top+a.y)/o.y,f=i.width/o.x,d=i.height/o.y;if(s){const g=Pt(s),v=r&&Lt(r)?Pt(r):r;let p=g,h=jn(p);for(;h&&r&&v!==p;){const y=xe(h),b=h.getBoundingClientRect(),E=Bt(h),C=b.left+(h.clientLeft+parseFloat(E.paddingLeft))*y.x,S=b.top+(h.clientTop+parseFloat(E.paddingTop))*y.y;l*=y.x,u*=y.y,f*=y.x,d*=y.y,l+=C,u+=S,p=Pt(h),h=jn(p)}}return un({width:f,height:d,x:l,y:u})}function bn(e,t){const n=wn(e).scrollLeft;return t?t.left+n:ge(Ht(e)).left+n}function Xi(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-bn(e,n),i=n.top+t.scrollTop;return{x:r,y:i}}function Wc(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const s=i==="fixed",o=Ht(r),a=t?yn(t.floating):!1;if(r===o||a&&s)return n;let l={scrollLeft:0,scrollTop:0},u=Vt(1);const f=Vt(0),d=Kt(r);if((d||!d&&!s)&&((Oe(r)!=="body"||Ke(o))&&(l=wn(r)),Kt(r))){const v=ge(r);u=xe(r),f.x=v.x+r.clientLeft,f.y=v.y+r.clientTop}const g=o&&!d&&!s?Xi(o,l):Vt(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-l.scrollLeft*u.x+f.x+g.x,y:n.y*u.y-l.scrollTop*u.y+f.y+g.y}}function zc(e){return Array.from(e.getClientRects())}function Vc(e){const t=Ht(e),n=wn(e),r=e.ownerDocument.body,i=Tt(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=Tt(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+bn(e);const a=-n.scrollTop;return Bt(r).direction==="rtl"&&(o+=Tt(t.clientWidth,r.clientWidth)-i),{width:i,height:s,x:o,y:a}}const Xr=25;function Kc(e,t){const n=Pt(e),r=Ht(e),i=n.visualViewport;let s=r.clientWidth,o=r.clientHeight,a=0,l=0;if(i){s=i.width,o=i.height;const f=yr();(!f||f&&t==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}const u=bn(r);if(u<=0){const f=r.ownerDocument,d=f.body,g=getComputedStyle(d),v=f.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,p=Math.abs(r.clientWidth-d.clientWidth-v);p<=Xr&&(s-=p)}else u<=Xr&&(s+=u);return{width:s,height:o,x:a,y:l}}const Hc=new Set(["absolute","fixed"]);function Uc(e,t){const n=ge(e,!0,t==="fixed"),r=n.top+e.clientTop,i=n.left+e.clientLeft,s=Kt(e)?xe(e):Vt(1),o=e.clientWidth*s.x,a=e.clientHeight*s.y,l=i*s.x,u=r*s.y;return{width:o,height:a,x:l,y:u}}function Zr(e,t,n){let r;if(t==="viewport")r=Kc(e,n);else if(t==="document")r=Vc(Ht(e));else if(Lt(t))r=Uc(t,n);else{const i=qi(e);r={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return un(r)}function Zi(e,t){const n=re(e);return n===t||!Lt(n)||Ae(n)?!1:Bt(n).position==="fixed"||Zi(n,t)}function jc(e,t){const n=t.get(e);if(n)return n;let r=Le(e,[],!1).filter(a=>Lt(a)&&Oe(a)!=="body"),i=null;const s=Bt(e).position==="fixed";let o=s?re(e):e;for(;Lt(o)&&!Ae(o);){const a=Bt(o),l=mr(o);!l&&a.position==="fixed"&&(i=null),(s?!l&&!i:!l&&a.position==="static"&&!!i&&Hc.has(i.position)||Ke(o)&&!l&&Zi(e,o))?r=r.filter(f=>f!==o):i=a,o=re(o)}return t.set(e,r),r}function Yc(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const o=[...n==="clippingAncestors"?yn(t)?[]:jc(t,this._c):[].concat(n),r],a=o[0],l=o.reduce((u,f)=>{const d=Zr(t,f,i);return u.top=Tt(d.top,u.top),u.right=ne(d.right,u.right),u.bottom=ne(d.bottom,u.bottom),u.left=Tt(d.left,u.left),u},Zr(t,a,i));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function Gc(e){const{width:t,height:n}=Gi(e);return{width:t,height:n}}function qc(e,t,n){const r=Kt(t),i=Ht(t),s=n==="fixed",o=ge(e,!0,s,t);let a={scrollLeft:0,scrollTop:0};const l=Vt(0);function u(){l.x=bn(i)}if(r||!r&&!s)if((Oe(t)!=="body"||Ke(i))&&(a=wn(t)),r){const v=ge(t,!0,s,t);l.x=v.x+t.clientLeft,l.y=v.y+t.clientTop}else i&&u();s&&!r&&i&&u();const f=i&&!r&&!s?Xi(i,a):Vt(0),d=o.left+a.scrollLeft-l.x-f.x,g=o.top+a.scrollTop-l.y-f.y;return{x:d,y:g,width:o.width,height:o.height}}function Fn(e){return Bt(e).position==="static"}function Jr(e,t){if(!Kt(e)||Bt(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Ht(e)===n&&(n=n.ownerDocument.body),n}function Ji(e,t){const n=Pt(e);if(yn(e))return n;if(!Kt(e)){let i=re(e);for(;i&&!Ae(i);){if(Lt(i)&&!Fn(i))return i;i=re(i)}return n}let r=Jr(e,t);for(;r&&kc(r)&&Fn(r);)r=Jr(r,t);return r&&Ae(r)&&Fn(r)&&!mr(r)?n:r||Ic(e)||n}const Xc=async function(e){const t=this.getOffsetParent||Ji,n=this.getDimensions,r=await n(e.floating);return{reference:qc(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Zc(e){return Bt(e).direction==="rtl"}const Jc={convertOffsetParentRelativeRectToViewportRelativeRect:Wc,getDocumentElement:Ht,getClippingRect:Yc,getOffsetParent:Ji,getElementRects:Xc,getClientRects:zc,getDimensions:Gc,getScale:xe,isElement:Lt,isRTL:Zc};function Qi(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Qc(e,t){let n=null,r;const i=Ht(e);function s(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function o(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),s();const u=e.getBoundingClientRect(),{left:f,top:d,width:g,height:v}=u;if(a||t(),!g||!v)return;const p=Je(d),h=Je(i.clientWidth-(f+g)),y=Je(i.clientHeight-(d+v)),b=Je(f),C={rootMargin:-p+"px "+-h+"px "+-y+"px "+-b+"px",threshold:Tt(0,ne(1,l))||1};let S=!0;function N(O){const k=O[0].intersectionRatio;if(k!==l){if(!S)return o();k?o(!1,k):r=setTimeout(()=>{o(!1,1e-7)},1e3)}k===1&&!Qi(u,e.getBoundingClientRect())&&o(),S=!1}try{n=new IntersectionObserver(N,{...C,root:i.ownerDocument})}catch{n=new IntersectionObserver(N,C)}n.observe(e)}return o(!0),s}function $c(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,u=wr(e),f=i||s?[...u?Le(u):[],...Le(t)]:[];f.forEach(b=>{i&&b.addEventListener("scroll",n,{passive:!0}),s&&b.addEventListener("resize",n)});const d=u&&a?Qc(u,n):null;let g=-1,v=null;o&&(v=new ResizeObserver(b=>{let[E]=b;E&&E.target===u&&v&&(v.unobserve(t),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var C;(C=v)==null||C.observe(t)})),n()}),u&&!l&&v.observe(u),v.observe(t));let p,h=l?ge(e):null;l&&y();function y(){const b=ge(e);h&&!Qi(h,b)&&n(),h=b,p=requestAnimationFrame(y)}return n(),()=>{var b;f.forEach(E=>{i&&E.removeEventListener("scroll",n),s&&E.removeEventListener("resize",n)}),d?.(),(b=v)==null||b.disconnect(),v=null,l&&cancelAnimationFrame(p)}}const tl=Ec,el=Oc,nl=xc,rl=Pc,il=Sc,ol=bc,sl=Tc,al=(e,t,n)=>{const r=new Map,i={platform:Jc,...n},s={...i.platform,_c:r};return wc(e,t,{...i,platform:s})};function ce(e){return typeof e=="function"?e():e}function $i(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Qr(e,t){const n=$i(e);return Math.round(t*n)/n}function $r(e){return{[`--bits-${e}-content-transform-origin`]:"var(--bits-floating-transform-origin)",[`--bits-${e}-content-available-width`]:"var(--bits-floating-available-width)",[`--bits-${e}-content-available-height`]:"var(--bits-floating-available-height)",[`--bits-${e}-anchor-width`]:"var(--bits-floating-anchor-width)",[`--bits-${e}-anchor-height`]:"var(--bits-floating-anchor-height)"}}function cl(e){const t=e.whileElementsMounted,n=_(()=>ce(e.open)??!0),r=_(()=>ce(e.middleware)),i=_(()=>ce(e.transform)??!0),s=_(()=>ce(e.placement)??"bottom"),o=_(()=>ce(e.strategy)??"absolute"),a=_(()=>ce(e.sideOffset)??0),l=_(()=>ce(e.alignOffset)??0),u=e.reference;let f=B(0),d=B(0);const g=Wt(null);let v=B(qt(c(o))),p=B(qt(c(s))),h=B(qt({})),y=B(!1),b=!1;const E=_(()=>{const W=g.current?Qr(g.current,c(f)):c(f),F=g.current?Qr(g.current,c(d)):c(d);return c(i)?{position:c(v),left:"0",top:"0",transform:`translate(${W}px, ${F}px)`,...g.current&&$i(g.current)>=1.5&&{willChange:"transform"}}:{position:c(v),left:`${W}px`,top:`${F}px`}});let C;function S(){u.current===null||g.current===null||al(u.current,g.current,{middleware:c(r),placement:c(s),strategy:c(o)}).then(W=>{const F=u.current;if(ll(F)){m(h,{...c(h),hide:{...c(h).hide,referenceHidden:!0}},!0);return}if(!c(n)&&c(f)!==0&&c(d)!==0){const H=Math.max(Math.abs(c(a)),Math.abs(c(l)),15);if(W.x<=H&&W.y<=H)return}m(f,W.x,!0),m(d,W.y,!0),m(v,W.strategy,!0),m(p,W.placement,!0),m(h,W.middlewareData,!0),m(y,!0)})}function N(){typeof C=="function"&&(C(),C=void 0)}function O(){if(N(),t===void 0){S();return}c(n)&&(u.current===null||g.current===null||(C=t(u.current,g.current,S)))}function k(){c(n)||m(y,!1)}function j(){return[c(r),c(s),c(o),c(a),c(l),c(n)]}return vt(()=>{t===void 0&&c(n)&&S()}),vt(O),vt(()=>{if(t!==void 0){if(j(),!c(n)){b=!1;return}if(!c(y)){b=!1;return}if(!b){b=!0;return}S()}}),vt(k),vt(()=>N),{floating:g,reference:u,get strategy(){return c(v)},get placement(){return c(p)},get middlewareData(){return c(h)},get isPositioned(){return c(y)},get floatingStyles(){return c(E)},get update(){return S}}}function ll(e){return e instanceof Element?!e.isConnected||e instanceof HTMLElement&&e.hidden?!0:e.getClientRects().length===0:!1}const ul={top:"bottom",right:"left",bottom:"top",left:"right"},br=new we("Floating.Root"),ti=new we("Floating.Content"),xr=new we("Floating.Root");class dn{static create(t=!1){return t?xr.set(new dn):br.set(new dn)}anchorNode=Wt(null);customAnchorNode=Wt(null);triggerNode=Wt(null);constructor(){vt(()=>{this.customAnchorNode.current?typeof this.customAnchorNode.current=="string"?this.anchorNode.current=document.querySelector(this.customAnchorNode.current):this.anchorNode.current=this.customAnchorNode.current:this.anchorNode.current=this.triggerNode.current})}}class fn{static create(t,n=!1){return n?ti.set(new fn(t,xr.get())):ti.set(new fn(t,br.get()))}opts;root;contentRef=Wt(null);wrapperRef=Wt(null);arrowRef=Wt(null);contentAttachment=fe(this.contentRef);wrapperAttachment=fe(this.wrapperRef);arrowAttachment=fe(this.arrowRef);arrowId=Wt(hr());#t=_(()=>{if(typeof this.opts.style=="string")return Re(this.opts.style);if(!this.opts.style)return{}});#e=void 0;#n=new Fs(()=>this.arrowRef.current??void 0);#r=_(()=>this.#n?.width??0);#i=_(()=>this.#n?.height??0);#o=_(()=>this.opts.side?.current+(this.opts.align.current!=="center"?`-${this.opts.align.current}`:""));#a=_(()=>Array.isArray(this.opts.collisionBoundary.current)?this.opts.collisionBoundary.current:[this.opts.collisionBoundary.current]);#s=_(()=>c(this.#a).length>0);get hasExplicitBoundaries(){return c(this.#s)}set hasExplicitBoundaries(t){m(this.#s,t)}#c=_(()=>({padding:this.opts.collisionPadding.current,boundary:c(this.#a).filter(Qs),altBoundary:this.hasExplicitBoundaries}));get detectOverflowOptions(){return c(this.#c)}set detectOverflowOptions(t){m(this.#c,t)}#d=B(void 0);#u=B(void 0);#l=B(void 0);#h=B(void 0);#g=_(()=>[tl({mainAxis:this.opts.sideOffset.current+c(this.#i),alignmentAxis:this.opts.alignOffset.current}),this.opts.avoidCollisions.current&&el({mainAxis:!0,crossAxis:!1,limiter:this.opts.sticky.current==="partial"?sl():void 0,...this.detectOverflowOptions}),this.opts.avoidCollisions.current&&nl({...this.detectOverflowOptions}),rl({...this.detectOverflowOptions,apply:({rects:t,availableWidth:n,availableHeight:r})=>{const{width:i,height:s}=t.reference;m(this.#d,n,!0),m(this.#u,r,!0),m(this.#l,i,!0),m(this.#h,s,!0)}}),this.arrowRef.current&&ol({element:this.arrowRef.current,padding:this.opts.arrowPadding.current}),dl({arrowWidth:c(this.#r),arrowHeight:c(this.#i)}),this.opts.hideWhenDetached.current&&il({strategy:"referenceHidden",...this.detectOverflowOptions})].filter(Boolean));get middleware(){return c(this.#g)}set middleware(t){m(this.#g,t)}floating;#v=_(()=>fl(this.floating.placement));get placedSide(){return c(this.#v)}set placedSide(t){m(this.#v,t)}#p=_(()=>hl(this.floating.placement));get placedAlign(){return c(this.#p)}set placedAlign(t){m(this.#p,t)}#f=_(()=>this.floating.middlewareData.arrow?.x??0);get arrowX(){return c(this.#f)}set arrowX(t){m(this.#f,t)}#m=_(()=>this.floating.middlewareData.arrow?.y??0);get arrowY(){return c(this.#m)}set arrowY(t){m(this.#m,t)}#y=_(()=>this.floating.middlewareData.arrow?.centerOffset!==0);get cannotCenterArrow(){return c(this.#y)}set cannotCenterArrow(t){m(this.#y,t)}#w=B();get contentZIndex(){return c(this.#w)}set contentZIndex(t){m(this.#w,t,!0)}#b=_(()=>ul[this.placedSide]);get arrowBaseSide(){return c(this.#b)}set arrowBaseSide(t){m(this.#b,t)}#x=_(()=>({id:this.opts.wrapperId.current,"data-bits-floating-content-wrapper":"",style:{...this.floating.floatingStyles,transform:this.floating.isPositioned?this.floating.floatingStyles.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:this.contentZIndex,"--bits-floating-transform-origin":`${this.floating.middlewareData.transformOrigin?.x} ${this.floating.middlewareData.transformOrigin?.y}`,"--bits-floating-available-width":`${c(this.#d)}px`,"--bits-floating-available-height":`${c(this.#u)}px`,"--bits-floating-anchor-width":`${c(this.#l)}px`,"--bits-floating-anchor-height":`${c(this.#h)}px`,...this.floating.middlewareData.hide?.referenceHidden&&{visibility:"hidden","pointer-events":"none"},...c(this.#t)},dir:this.opts.dir.current,...this.wrapperAttachment}));get wrapperProps(){return c(this.#x)}set wrapperProps(t){m(this.#x,t)}#S=_(()=>({"data-side":this.placedSide,"data-align":this.placedAlign,style:fi({...c(this.#t)}),...this.contentAttachment}));get props(){return c(this.#S)}set props(t){m(this.#S,t)}#A=_(()=>({position:"absolute",left:this.arrowX?`${this.arrowX}px`:void 0,top:this.arrowY?`${this.arrowY}px`:void 0,[this.arrowBaseSide]:0,"transform-origin":{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[this.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[this.placedSide],visibility:this.cannotCenterArrow?"hidden":void 0}));get arrowStyle(){return c(this.#A)}set arrowStyle(t){m(this.#A,t)}constructor(t,n){this.opts=t,this.root=n,this.#e=t.updatePositionStrategy,t.customAnchor&&(this.root.customAnchorNode.current=t.customAnchor.current),St(()=>t.customAnchor.current,r=>{this.root.customAnchorNode.current=r}),this.floating=cl({strategy:()=>this.opts.strategy.current,placement:()=>c(this.#o),middleware:()=>this.middleware,reference:this.root.anchorNode,whileElementsMounted:(...r)=>$c(...r,{animationFrame:this.#e?.current==="always"}),open:()=>this.opts.enabled.current,sideOffset:()=>this.opts.sideOffset.current,alignOffset:()=>this.opts.alignOffset.current}),vt(()=>{this.floating.isPositioned&&this.opts.onPlaced?.current()}),St(()=>this.contentRef.current,r=>{if(!r||!this.opts.enabled.current)return;const i=Xn(r),s=i.requestAnimationFrame(()=>{if(this.contentRef.current!==r||!this.opts.enabled.current)return;const o=i.getComputedStyle(r).zIndex;o!==this.contentZIndex&&(this.contentZIndex=o)});return()=>{i.cancelAnimationFrame(s)}}),vt(()=>{this.floating.floating.current=this.wrapperRef.current})}}class hn{static create(t,n=!1){return n?new hn(t,xr.get()):new hn(t,br.get())}opts;root;constructor(t,n){this.opts=t,this.root=n,t.virtualEl&&t.virtualEl.current?n.triggerNode=li(t.virtualEl.current):n.triggerNode=t.ref}}function dl(e){return{name:"transformOrigin",options:e,fn(t){const{placement:n,rects:r,middlewareData:i}=t,o=i.arrow?.centerOffset!==0,a=o?0:e.arrowWidth,l=o?0:e.arrowHeight,[u,f]=Sr(n),d={start:"0%",center:"50%",end:"100%"}[f],g=(i.arrow?.x??0)+a/2,v=(i.arrow?.y??0)+l/2;let p="",h="";return u==="bottom"?(p=o?d:`${g}px`,h=`${-l}px`):u==="top"?(p=o?d:`${g}px`,h=`${r.floating.height+l}px`):u==="right"?(p=`${-l}px`,h=o?d:`${v}px`):u==="left"&&(p=`${r.floating.width+l}px`,h=o?d:`${v}px`),{data:{x:p,y:h}}}}}function Sr(e){const[t,n="center"]=e.split("-");return[t,n]}function fl(e){return Sr(e)[0]}function hl(e){return Sr(e)[1]}function gl(e,t){ut(t,!0);let n=x(t,"tooltip",3,!1);dn.create(n());var r=L(),i=D(r);st(i,()=>t.children??pt),A(e,r),dt()}function vl(e,t){ut(t,!0);let n=x(t,"tooltip",3,!1);hn.create({id:T(()=>t.id),virtualEl:T(()=>t.virtualEl),ref:t.ref},n());var r=L(),i=D(r);st(i,()=>t.children??pt),A(e,r),dt()}function pl(e,t){ut(t,!0);let n=x(t,"side",3,"bottom"),r=x(t,"sideOffset",3,0),i=x(t,"align",3,"center"),s=x(t,"alignOffset",3,0),o=x(t,"arrowPadding",3,0),a=x(t,"avoidCollisions",3,!0),l=x(t,"collisionBoundary",19,()=>[]),u=x(t,"collisionPadding",3,0),f=x(t,"hideWhenDetached",3,!1),d=x(t,"onPlaced",3,()=>{}),g=x(t,"sticky",3,"partial"),v=x(t,"updatePositionStrategy",3,"optimized"),p=x(t,"strategy",3,"fixed"),h=x(t,"dir",3,"ltr"),y=x(t,"style",19,()=>({})),b=x(t,"wrapperId",19,hr),E=x(t,"customAnchor",3,null),C=x(t,"tooltip",3,!1);const S=fn.create({side:T(()=>n()),sideOffset:T(()=>r()),align:T(()=>i()),alignOffset:T(()=>s()),id:T(()=>t.id),arrowPadding:T(()=>o()),avoidCollisions:T(()=>a()),collisionBoundary:T(()=>l()),collisionPadding:T(()=>u()),hideWhenDetached:T(()=>f()),onPlaced:T(()=>d()),sticky:T(()=>g()),updatePositionStrategy:T(()=>v()),strategy:T(()=>p()),dir:T(()=>h()),style:T(()=>y()),enabled:T(()=>t.enabled),wrapperId:T(()=>b()),customAnchor:T(()=>E())},C()),N=_(()=>Xt(S.wrapperProps,{style:{pointerEvents:"auto"}}));var O=L(),k=D(O);st(k,()=>t.content??pt,()=>({props:S.props,wrapperProps:c(N)})),A(e,O),dt()}function ml(e,t){ut(t,!0),si(()=>{t.onPlaced?.()});var n=L(),r=D(n);st(r,()=>t.content??pt,()=>({props:{},wrapperProps:{}})),A(e,n),dt()}function yl(e,t){let n=x(t,"isStatic",3,!1),r=ie(t,["$$slots","$$events","$$legacy","content","isStatic","onPlaced"]);var i=L(),s=D(i);{var o=l=>{ml(l,{get content(){return t.content},get onPlaced(){return t.onPlaced}})},a=l=>{pl(l,Mt({get content(){return t.content},get onPlaced(){return t.onPlaced}},()=>r))};at(s,l=>{n()?l(o):l(a,!1)})}A(e,i)}var wl=K("<!> <!>",1);function to(e,t){ut(t,!0);let n=x(t,"interactOutsideBehavior",3,"close"),r=x(t,"trapFocus",3,!0),i=x(t,"isValidEvent",3,()=>!1),s=x(t,"customAnchor",3,null),o=x(t,"isStatic",3,!1),a=x(t,"tooltip",3,!1),l=x(t,"contentPointerEvents",3,"auto"),u=ie(t,["$$slots","$$events","$$legacy","popper","onEscapeKeydown","escapeKeydownBehavior","preventOverflowTextSelection","id","onPointerDown","onPointerUp","side","sideOffset","align","alignOffset","arrowPadding","avoidCollisions","collisionBoundary","collisionPadding","sticky","hideWhenDetached","updatePositionStrategy","strategy","dir","preventScroll","wrapperId","style","onPlaced","onInteractOutside","onCloseAutoFocus","onOpenAutoFocus","onFocusOutside","interactOutsideBehavior","loop","trapFocus","isValidEvent","customAnchor","isStatic","enabled","ref","tooltip","contentPointerEvents"]);yl(e,{get isStatic(){return o()},get id(){return t.id},get side(){return t.side},get sideOffset(){return t.sideOffset},get align(){return t.align},get alignOffset(){return t.alignOffset},get arrowPadding(){return t.arrowPadding},get avoidCollisions(){return t.avoidCollisions},get collisionBoundary(){return t.collisionBoundary},get collisionPadding(){return t.collisionPadding},get sticky(){return t.sticky},get hideWhenDetached(){return t.hideWhenDetached},get updatePositionStrategy(){return t.updatePositionStrategy},get strategy(){return t.strategy},get dir(){return t.dir},get wrapperId(){return t.wrapperId},get style(){return t.style},get onPlaced(){return t.onPlaced},get customAnchor(){return s()},get enabled(){return t.enabled},get tooltip(){return a()},content:(d,g)=>{let v=()=>g?.().props,p=()=>g?.().wrapperProps;var h=wl(),y=D(h);{var b=S=>{Kr(S,{get preventScroll(){return t.preventScroll}})},E=S=>{Kr(S,{get preventScroll(){return t.preventScroll}})};at(y,S=>{t.forceMount&&t.enabled?S(b):t.forceMount||S(E,1)})}var C=nt(y,2);tc(C,{get onOpenAutoFocus(){return t.onOpenAutoFocus},get onCloseAutoFocus(){return t.onCloseAutoFocus},get loop(){return t.loop},get enabled(){return t.enabled},get trapFocus(){return r()},get forceMount(){return t.forceMount},get ref(){return t.ref},focusScope:(N,O)=>{let k=()=>O?.().props;$a(N,{get onEscapeKeydown(){return t.onEscapeKeydown},get escapeKeydownBehavior(){return t.escapeKeydownBehavior},get enabled(){return t.enabled},get ref(){return t.ref},children:(j,W)=>{Ja(j,{get id(){return t.id},get onInteractOutside(){return t.onInteractOutside},get onFocusOutside(){return t.onFocusOutside},get interactOutsideBehavior(){return n()},get isValidEvent(){return i()},get enabled(){return t.enabled},get ref(){return t.ref},children:(I,H)=>{let q=()=>H?.().props;rc(I,{get id(){return t.id},get preventOverflowTextSelection(){return t.preventOverflowTextSelection},get onPointerDown(){return t.onPointerDown},get onPointerUp(){return t.onPointerUp},get enabled(){return t.enabled},get ref(){return t.ref},children:(X,J)=>{var z=L(),G=D(z);{let Z=_(()=>({props:Xt(u,v(),q(),k(),{style:{pointerEvents:l()}}),wrapperProps:p()}));st(G,()=>t.popper??pt,()=>c(Z))}A(X,z)},$$slots:{default:!0}})},$$slots:{default:!0}})},$$slots:{default:!0}})},$$slots:{focusScope:!0}}),A(d,h)},$$slots:{content:!0}}),dt()}function bl(e,t){let n=x(t,"interactOutsideBehavior",3,"close"),r=x(t,"trapFocus",3,!0),i=x(t,"isValidEvent",3,()=>!1),s=x(t,"customAnchor",3,null),o=x(t,"isStatic",3,!1),a=ie(t,["$$slots","$$events","$$legacy","popper","open","onEscapeKeydown","escapeKeydownBehavior","preventOverflowTextSelection","id","onPointerDown","onPointerUp","side","sideOffset","align","alignOffset","arrowPadding","avoidCollisions","collisionBoundary","collisionPadding","sticky","hideWhenDetached","updatePositionStrategy","strategy","dir","preventScroll","wrapperId","style","onPlaced","onInteractOutside","onCloseAutoFocus","onOpenAutoFocus","onFocusOutside","interactOutsideBehavior","loop","trapFocus","isValidEvent","customAnchor","isStatic","ref","shouldRender"]);var l=L(),u=D(l);{var f=d=>{to(d,Mt({get popper(){return t.popper},get onEscapeKeydown(){return t.onEscapeKeydown},get escapeKeydownBehavior(){return t.escapeKeydownBehavior},get preventOverflowTextSelection(){return t.preventOverflowTextSelection},get id(){return t.id},get onPointerDown(){return t.onPointerDown},get onPointerUp(){return t.onPointerUp},get side(){return t.side},get sideOffset(){return t.sideOffset},get align(){return t.align},get alignOffset(){return t.alignOffset},get arrowPadding(){return t.arrowPadding},get avoidCollisions(){return t.avoidCollisions},get collisionBoundary(){return t.collisionBoundary},get collisionPadding(){return t.collisionPadding},get sticky(){return t.sticky},get hideWhenDetached(){return t.hideWhenDetached},get updatePositionStrategy(){return t.updatePositionStrategy},get strategy(){return t.strategy},get dir(){return t.dir},get preventScroll(){return t.preventScroll},get wrapperId(){return t.wrapperId},get style(){return t.style},get onPlaced(){return t.onPlaced},get customAnchor(){return s()},get isStatic(){return o()},get enabled(){return t.open},get onInteractOutside(){return t.onInteractOutside},get onCloseAutoFocus(){return t.onCloseAutoFocus},get onOpenAutoFocus(){return t.onOpenAutoFocus},get interactOutsideBehavior(){return n()},get loop(){return t.loop},get trapFocus(){return r()},get isValidEvent(){return i()},get onFocusOutside(){return t.onFocusOutside},forceMount:!1,get ref(){return t.ref}},()=>a))};at(u,d=>{t.shouldRender&&d(f)})}A(e,l)}function xl(e,t){let n=x(t,"interactOutsideBehavior",3,"close"),r=x(t,"trapFocus",3,!0),i=x(t,"isValidEvent",3,()=>!1),s=x(t,"customAnchor",3,null),o=x(t,"isStatic",3,!1),a=ie(t,["$$slots","$$events","$$legacy","popper","onEscapeKeydown","escapeKeydownBehavior","preventOverflowTextSelection","id","onPointerDown","onPointerUp","side","sideOffset","align","alignOffset","arrowPadding","avoidCollisions","collisionBoundary","collisionPadding","sticky","hideWhenDetached","updatePositionStrategy","strategy","dir","preventScroll","wrapperId","style","onPlaced","onInteractOutside","onCloseAutoFocus","onOpenAutoFocus","onFocusOutside","interactOutsideBehavior","loop","trapFocus","isValidEvent","customAnchor","isStatic","enabled"]);to(e,Mt({get popper(){return t.popper},get onEscapeKeydown(){return t.onEscapeKeydown},get escapeKeydownBehavior(){return t.escapeKeydownBehavior},get preventOverflowTextSelection(){return t.preventOverflowTextSelection},get id(){return t.id},get onPointerDown(){return t.onPointerDown},get onPointerUp(){return t.onPointerUp},get side(){return t.side},get sideOffset(){return t.sideOffset},get align(){return t.align},get alignOffset(){return t.alignOffset},get arrowPadding(){return t.arrowPadding},get avoidCollisions(){return t.avoidCollisions},get collisionBoundary(){return t.collisionBoundary},get collisionPadding(){return t.collisionPadding},get sticky(){return t.sticky},get hideWhenDetached(){return t.hideWhenDetached},get updatePositionStrategy(){return t.updatePositionStrategy},get strategy(){return t.strategy},get dir(){return t.dir},get preventScroll(){return t.preventScroll},get wrapperId(){return t.wrapperId},get style(){return t.style},get onPlaced(){return t.onPlaced},get customAnchor(){return s()},get isStatic(){return o()},get enabled(){return t.enabled},get onInteractOutside(){return t.onInteractOutside},get onCloseAutoFocus(){return t.onCloseAutoFocus},get onOpenAutoFocus(){return t.onOpenAutoFocus},get interactOutsideBehavior(){return n()},get loop(){return t.loop},get trapFocus(){return r()},get isValidEvent(){return i()},get onFocusOutside(){return t.onFocusOutside}},()=>a,{forceMount:!0}))}var Sl=K("<div><!></div>");function Al(e,t){const n=gn();ut(t,!0);let r=x(t,"ref",15,null),i=x(t,"id",19,()=>pn(n)),s=x(t,"disabled",3,!1),o=x(t,"onSelect",3,ct),a=x(t,"closeOnSelect",3,!0),l=ie(t,["$$slots","$$events","$$legacy","child","children","ref","id","disabled","onSelect","closeOnSelect"]);const u=or.create({id:T(()=>i()),disabled:T(()=>s()),onSelect:T(()=>o()),ref:T(()=>r(),h=>r(h)),closeOnSelect:T(()=>a())}),f=_(()=>Xt(l,u.props));var d=L(),g=D(d);{var v=h=>{var y=L(),b=D(y);st(b,()=>t.child,()=>({props:c(f)})),A(h,y)},p=h=>{var y=Sl();ue(y,()=>({...c(f)}));var b=R(y);st(b,()=>t.children??pt),M(y),A(h,y)};at(g,h=>{t.child?h(v):h(p,!1)})}A(e,d),dt()}var El=K("<div><!></div>");function Ol(e,t){const n=gn();ut(t,!0);let r=x(t,"ref",15,null),i=x(t,"id",19,()=>pn(n)),s=ie(t,["$$slots","$$events","$$legacy","ref","id","child","children"]);const o=sr.create({id:T(()=>i()),ref:T(()=>r(),g=>r(g))}),a=_(()=>Xt(s,o.props));var l=L(),u=D(l);{var f=g=>{var v=L(),p=D(v);st(p,()=>t.child,()=>({props:c(a)})),A(g,v)},d=g=>{var v=El();ue(v,()=>({...c(a)}));var p=R(v);st(p,()=>t.children??pt),M(v),A(g,v)};at(u,g=>{t.child?g(f):g(d,!1)})}A(e,l),dt()}function Tl(e,t){ut(t,!0);let n=x(t,"open",15,!1),r=x(t,"dir",3,"ltr"),i=x(t,"onOpenChange",3,ct),s=x(t,"onOpenChangeComplete",3,ct),o=x(t,"_internal_variant",3,"dropdown-menu");const a=nr.create({variant:T(()=>o()),dir:T(()=>r()),onClose:()=>{n(!1),i()(!1)}});rr.create({open:T(()=>n(),l=>{n(l),i()(l)}),onOpenChangeComplete:T(()=>s())},a),gl(e,{children:(l,u)=>{var f=L(),d=D(f);st(d,()=>t.children??pt),A(l,f)},$$slots:{default:!0}}),dt()}var Pl=K("<div><div><!></div></div>"),Cl=K("<div><div><!></div></div>");function _l(e,t){const n=gn();ut(t,!0);let r=x(t,"id",19,()=>pn(n)),i=x(t,"ref",15,null),s=x(t,"loop",3,!0),o=x(t,"onInteractOutside",3,ct),a=x(t,"onEscapeKeydown",3,ct),l=x(t,"onCloseAutoFocus",3,ct),u=x(t,"forceMount",3,!1),f=x(t,"trapFocus",3,!1),d=ie(t,["$$slots","$$events","$$legacy","id","child","children","ref","loop","onInteractOutside","onEscapeKeydown","onCloseAutoFocus","forceMount","trapFocus","style"]);const g=ir.create({id:T(()=>r()),loop:T(()=>s()),ref:T(()=>i(),S=>i(S)),onCloseAutoFocus:T(()=>l())}),v=_(()=>Xt(d,g.props));function p(S){if(g.handleInteractOutside(S),!S.defaultPrevented&&(o()(S),!S.defaultPrevented)){if(S.target&&S.target instanceof Element){const N=`[${g.parentMenu.root.getBitsAttr("sub-content")}]`;if(S.target.closest(N))return}g.parentMenu.onClose()}}function h(S){a()(S),!S.defaultPrevented&&g.parentMenu.onClose()}var y=L(),b=D(y);{var E=S=>{xl(S,Mt(()=>c(v),()=>g.popperProps,{get ref(){return g.opts.ref},get enabled(){return g.parentMenu.opts.open.current},onInteractOutside:p,onEscapeKeydown:h,get trapFocus(){return f()},get loop(){return s()},forceMount:!0,get id(){return r()},get shouldRender(){return g.shouldRender},popper:(O,k)=>{let j=()=>k?.().props,W=()=>k?.().wrapperProps;const F=_(()=>Xt(j(),{style:$r("dropdown-menu")},{style:t.style}));var I=L(),H=D(I);{var q=J=>{var z=L(),G=D(z);{let Z=_(()=>({props:c(F),wrapperProps:W(),...g.snippetProps}));st(G,()=>t.child,()=>c(Z))}A(J,z)},X=J=>{var z=Pl();ue(z,()=>({...W()}));var G=R(z);ue(G,()=>({...c(F)}));var Z=R(G);st(Z,()=>t.children??pt),M(G),M(z),A(J,z)};at(H,J=>{t.child?J(q):J(X,!1)})}A(O,I)},$$slots:{popper:!0}}))},C=S=>{bl(S,Mt(()=>c(v),()=>g.popperProps,{get ref(){return g.opts.ref},get open(){return g.parentMenu.opts.open.current},onInteractOutside:p,onEscapeKeydown:h,get trapFocus(){return f()},get loop(){return s()},forceMount:!1,get id(){return r()},get shouldRender(){return g.shouldRender},popper:(O,k)=>{let j=()=>k?.().props,W=()=>k?.().wrapperProps;const F=_(()=>Xt(j(),{style:$r("dropdown-menu")},{style:t.style}));var I=L(),H=D(I);{var q=J=>{var z=L(),G=D(z);{let Z=_(()=>({props:c(F),wrapperProps:W(),...g.snippetProps}));st(G,()=>t.child,()=>c(Z))}A(J,z)},X=J=>{var z=Cl();ue(z,()=>({...W()}));var G=R(z);ue(G,()=>({...c(F)}));var Z=R(G);st(Z,()=>t.children??pt),M(G),M(z),A(J,z)};at(H,J=>{t.child?J(q):J(X,!1)})}A(O,I)},$$slots:{popper:!0}}))};at(b,S=>{u()?S(E):u()||S(C,1)})}A(e,y),dt()}var kl=K("<button><!></button>");function Ml(e,t){const n=gn();ut(t,!0);let r=x(t,"id",19,()=>pn(n)),i=x(t,"ref",15,null),s=x(t,"disabled",3,!1),o=x(t,"type",3,"button"),a=ie(t,["$$slots","$$events","$$legacy","id","ref","child","children","disabled","type"]);const l=ar.create({id:T(()=>r()),disabled:T(()=>s()??!1),ref:T(()=>i(),f=>i(f))}),u=_(()=>Xt(a,l.props,{type:o()}));vl(e,{get id(){return r()},get ref(){return l.opts.ref},children:(f,d)=>{var g=L(),v=D(g);{var p=y=>{var b=L(),E=D(b);st(E,()=>t.child,()=>({props:c(u)})),A(y,b)},h=y=>{var b=kl();ue(b,()=>({...c(u)}));var E=R(b);st(E,()=>t.children??pt),M(b),A(y,b)};at(v,y=>{t.child?y(p):y(h,!1)})}A(f,g)},$$slots:{default:!0}}),dt()}const Fl=Tl,Rl=Ml,Dl=ua,Il=_l,ei=Al,Nl=Ol;function Rn(e,t){const n=ve(t,["children","$$slots","$$events","$$legacy"]);const r=[["path",{d:"M12 4v16"}],["path",{d:"M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2"}],["path",{d:"M9 20h6"}]];pe(e,Mt({name:"type"},()=>n,{get iconNode(){return r},children:(i,s)=>{var o=L(),a=D(o);me(a,t,"default",{}),A(i,o)},$$slots:{default:!0}}))}function Dn(e,t){const n=ve(t,["children","$$slots","$$events","$$legacy"]);const r=[["path",{d:"M8 2v4"}],["path",{d:"M16 2v4"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2"}],["path",{d:"M3 10h18"}]];pe(e,Mt({name:"calendar"},()=>n,{get iconNode(){return r},children:(i,s)=>{var o=L(),a=D(o);me(a,t,"default",{}),A(i,o)},$$slots:{default:!0}}))}function In(e,t){const n=ve(t,["children","$$slots","$$events","$$legacy"]);const r=[["circle",{cx:"12",cy:"12",r:"10"}],["circle",{cx:"12",cy:"12",r:"1"}]];pe(e,Mt({name:"circle-dot"},()=>n,{get iconNode(){return r},children:(i,s)=>{var o=L(),a=D(o);me(a,t,"default",{}),A(i,o)},$$slots:{default:!0}}))}function Nn(e,t){const n=ve(t,["children","$$slots","$$events","$$legacy"]);const r=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"}]];pe(e,Mt({name:"link"},()=>n,{get iconNode(){return r},children:(i,s)=>{var o=L(),a=D(o);me(a,t,"default",{}),A(i,o)},$$slots:{default:!0}}))}function Ll(e,t){const n=ve(t,["children","$$slots","$$events","$$legacy"]);const r=[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor"}]];pe(e,Mt({name:"tag"},()=>n,{get iconNode(){return r},children:(i,s)=>{var o=L(),a=D(o);me(a,t,"default",{}),A(i,o)},$$slots:{default:!0}}))}function Bl(e,t){const n=ve(t,["children","$$slots","$$events","$$legacy"]);const r=[["path",{d:"M20 6 9 17l-5-5"}]];pe(e,Mt({name:"check"},()=>n,{get iconNode(){return r},children:(i,s)=>{var o=L(),a=D(o);me(a,t,"default",{}),A(i,o)},$$slots:{default:!0}}))}function Wl(e,t){const n=ve(t,["children","$$slots","$$events","$$legacy"]);const r=[["path",{d:"m15 18-6-6 6-6"}]];pe(e,Mt({name:"chevron-left"},()=>n,{get iconNode(){return r},children:(i,s)=>{var o=L(),a=D(o);me(a,t,"default",{}),A(i,o)},$$slots:{default:!0}}))}var zl=K('<span class="ip-menu-check svelte-x7sio8"><!></span>'),Vl=K('<span class="ip-menu-item-icon svelte-x7sio8"><!></span> <span> </span> <!>',1),Kl=K('<span class="ip-menu-item-icon svelte-x7sio8"><!></span> <span>Remove</span>',1),Hl=K("<!> <!> <!>",1),Ul=K("<!> <!>",1),jl=K('<input class="ip-edit-input svelte-x7sio8" type="text"/>'),Yl=K('<button><span class="ip-status-dot svelte-x7sio8"></span> </button>'),Gl=K('<div class="ip-status-wrap svelte-x7sio8"><div class="ip-status-value svelte-x7sio8"><span class="ip-status-dot svelte-x7sio8"></span> <span class="ip-status-text svelte-x7sio8"> </span></div> <div class="ip-status-dropdown svelte-x7sio8"></div></div>'),ql=K('<span class="ip-cal-wd svelte-x7sio8"> </span>'),Xl=K("<button> </button>"),Zl=K('<div class="ip-cal-week svelte-x7sio8"></div>'),Jl=K('<div class="ip-cal-wrap svelte-x7sio8"><span class="ip-date-text svelte-x7sio8"> </span> <div class="ip-cal-dropdown svelte-x7sio8"><div class="ip-cal-header svelte-x7sio8"><button class="ip-cal-nav svelte-x7sio8"><!></button> <span class="ip-cal-title svelte-x7sio8"> </span> <button class="ip-cal-nav svelte-x7sio8"><!></button></div> <div class="ip-cal-weekdays svelte-x7sio8"></div> <!></div></div>'),Ql=K('<span class="ip-badge svelte-x7sio8"> </span>'),$l=K('<button class="ip-wikilink-chip svelte-x7sio8"> </button>'),tu=K('<div class="ip-wikilink-group svelte-x7sio8"></div>'),eu=K('<div class="ip-status-value svelte-x7sio8"><span class="ip-status-dot svelte-x7sio8"></span> <span class="ip-status-text svelte-x7sio8"> </span></div>'),nu=K('<span class="ip-date-text svelte-x7sio8"> </span>'),ru=K('<a class="ip-url-link svelte-x7sio8" target="_blank" rel="noopener noreferrer"> </a>'),iu=K('<span class="ip-text-value svelte-x7sio8"> </span>'),ou=K('<div><div class="ip-icon svelte-x7sio8"><!></div> <div class="ip-key svelte-x7sio8"> </div> <div class="ip-value svelte-x7sio8"><!></div></div>'),su=K('<div class="ip-row ip-add-row svelte-x7sio8"><div class="ip-icon svelte-x7sio8"><!></div> <div class="ip-key svelte-x7sio8"><input class="ip-add-key-input svelte-x7sio8" type="text" placeholder="Property name"/></div> <div class="ip-value svelte-x7sio8"></div></div>'),au=K('<button class="ip-add-btn svelte-x7sio8"><!> <span>Add property</span></button>'),cu=K('<div class="inline-properties svelte-x7sio8"><!> <!></div>');function _u(e,t){ut(t,!0);let n=x(t,"editable",3,!1);const r=[{type:"text",label:"Text"},{type:"date",label:"Date"},{type:"status",label:"Status"},{type:"wikilink",label:"Link"}],i=["active","inactive","in-progress","completed","draft","archived","current","former","won","lost","open","closed"];let s=B(null),o=B(!1),a=B(""),l=B(void 0);function u(P){switch(P.toLowerCase()){case"active":case"current":case"won":return"#3ecf8e";case"in-progress":case"open":return"#f0c246";case"inactive":case"lost":case"closed":case"former":return"#e54d4d";default:return"#5c5c66"}}function f(P){for(const w of Gn.repos){const rt=w.entities.find(Ct=>Ct.id===P);if(rt){zo(`/${w.name}/${rt.entityType}/${rt.id}`);return}}}function d(P){return typeof P.value=="string"?P.value:P.value[0]}function g(P){return/^https?:\/\//.test(P)}function v(P){try{return new Date(P).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})}catch{return P}}let p=B(qt(new Date().getFullYear())),h=B(qt(new Date().getMonth()));const y=["Su","Mo","Tu","We","Th","Fr","Sa"],b=["January","February","March","April","May","June","July","August","September","October","November","December"];function E(P,w){const rt=new Date(P,w,1).getDay(),Ct=new Date(P,w+1,0).getDate(),oe=new Date(P,w,0).getDate(),xt=[];let bt=[];for(let Ft=rt-1;Ft>=0;Ft--){const Pe=oe-Ft,se=w===0?11:w-1,xn=w===0?P-1:P;bt.push({day:Pe,month:se,year:xn,outside:!0})}for(let Ft=1;Ft<=Ct;Ft++)bt.push({day:Ft,month:w,year:P,outside:!1}),bt.length===7&&(xt.push(bt),bt=[]);if(bt.length>0){const Ft=w===11?0:w+1,Pe=w===11?P+1:P;let se=1;for(;bt.length<7;)bt.push({day:se++,month:Ft,year:Pe,outside:!0});xt.push(bt)}return xt}function C(P){const w=new Date;return P.day===w.getDate()&&P.month===w.getMonth()&&P.year===w.getFullYear()}function S(P,w){const rt=w.slice(0,10).split("-");return P.year===+rt[0]&&P.month===+rt[1]-1&&P.day===+rt[2]}function N(){c(h)===0?(m(h,11),qe(p,-1)):qe(h,-1)}function O(){c(h)===11?(m(h,0),qe(p)):qe(h)}function k(P){try{const w=P.slice(0,10).split("-");m(p,+w[0]),m(h,+w[1]-1)}catch{const w=new Date;m(p,w.getFullYear(),!0),m(h,w.getMonth(),!0)}}function j(P){requestAnimationFrame(()=>{P.focus(),P.select()})}function W(P){!n()||P.type==="badge"||(P.type==="date"&&k(d(P)),m(s,P.key,!0))}function F(P,w){t.onedit&&t.onedit(P,w),m(s,null)}function I(P,w){const rt=`${w.year}-${String(w.month+1).padStart(2,"0")}-${String(w.day).padStart(2,"0")}`;t.onedit&&t.onedit(P,rt),m(s,null)}function H(P,w){t.ontypechange&&t.ontypechange(P,w)}function q(P){m(s,null),t.onremove&&t.onremove(P)}function X(){m(o,!0),m(a,""),requestAnimationFrame(()=>c(l)?.focus())}function J(){const P=c(a).trim();P&&t.onadd&&t.onadd(P,""),m(o,!1),m(a,"")}function z(){m(o,!1),m(a,"")}function G(P){P.key==="Enter"?(P.preventDefault(),J()):P.key==="Escape"&&z()}var Z=cu();De("click",Mo,()=>{m(s,null)});var At=R(Z);Yt(At,17,()=>t.properties,P=>P.key,(P,w)=>{const rt=_(()=>c(s)===c(w).key);var Ct=ou();let oe;var xt=R(Ct),bt=R(xt);{var Ft=$=>{var Q=L(),tt=D(Q);ae(tt,()=>Fl,(Et,Rt)=>{Rt(Et,{children:(_t,Dt)=>{var It=Ul(),Y=D(It);ae(Y,()=>Rl,(U,V)=>{V(U,{class:"ip-icon-trigger",children:(it,ot)=>{var et=L(),Ot=D(et);{var gt=ft=>{Dn(ft,{size:14})},Ut=ft=>{In(ft,{size:14})},jt=ft=>{Nn(ft,{size:14})},$t=ft=>{Rn(ft,{size:14})};at(Ot,ft=>{c(w).type==="date"?ft(gt):c(w).type==="status"?ft(Ut,1):c(w).type==="wikilink"?ft(jt,2):ft($t,!1)})}A(it,et)},$$slots:{default:!0}})});var kt=nt(Y,2);ae(kt,()=>Dl,(U,V)=>{V(U,{children:(it,ot)=>{var et=L(),Ot=D(et);ae(Ot,()=>Il,(gt,Ut)=>{Ut(gt,{class:"ip-menu-content",sideOffset:4,align:"start",children:(jt,$t)=>{var ft=Hl(),He=D(ft);Yt(He,17,()=>r,te,(Ce,Nt)=>{var je=L(),Ar=D(je);ae(Ar,()=>ei,(Ye,Ge)=>{Ge(Ye,{class:"ip-menu-item",onSelect:()=>H(c(w).key,c(Nt).type),children:(An,mu)=>{var Er=Vl(),En=D(Er),uo=R(En);{var fo=mt=>{Rn(mt,{size:13})},ho=mt=>{Dn(mt,{size:13})},go=mt=>{In(mt,{size:13})},vo=mt=>{Nn(mt,{size:13})};at(uo,mt=>{c(Nt).type==="text"?mt(fo):c(Nt).type==="date"?mt(ho,1):c(Nt).type==="status"?mt(go,2):c(Nt).type==="wikilink"&&mt(vo,3)})}M(En);var On=nt(En,2),po=R(On,!0);M(On);var mo=nt(On,2);{var yo=mt=>{var Tn=zl(),wo=R(Tn);Bl(wo,{size:12}),M(Tn),A(mt,Tn)};at(mo,mt=>{c(w).type===c(Nt).type&&mt(yo)})}yt(()=>ht(po,c(Nt).label)),A(An,Er)},$$slots:{default:!0}})}),A(Ce,je)});var Ue=nt(He,2);ae(Ue,()=>Nl,(Ce,Nt)=>{Nt(Ce,{class:"ip-menu-sep"})});var lo=nt(Ue,2);ae(lo,()=>ei,(Ce,Nt)=>{Nt(Ce,{class:"ip-menu-item ip-menu-destructive",onSelect:()=>q(c(w).key),children:(je,Ar)=>{var Ye=Kl(),Ge=D(Ye),An=R(Ge);Io(An,{size:13}),M(Ge),Pn(2),A(je,Ye)},$$slots:{default:!0}})}),A(jt,ft)},$$slots:{default:!0}})}),A(it,et)},$$slots:{default:!0}})}),A(_t,It)},$$slots:{default:!0}})}),A($,Q)},Pe=$=>{var Q=L(),tt=D(Q);{var Et=Y=>{Dn(Y,{size:14})},Rt=Y=>{In(Y,{size:14})},_t=Y=>{Nn(Y,{size:14})},Dt=Y=>{Ll(Y,{size:14})},It=Y=>{Rn(Y,{size:14})};at(tt,Y=>{c(w).type==="date"?Y(Et):c(w).type==="status"?Y(Rt,1):c(w).type==="wikilink"?Y(_t,2):c(w).type==="badge"?Y(Dt,3):Y(It,!1)})}A($,Q)};at(bt,$=>{n()&&c(w).type!=="badge"?$(Ft):$(Pe,!1)})}M(xt);var se=nt(xt,2),xn=R(se,!0);M(se);var Sn=nt(se,2),ro=R(Sn);{var io=$=>{var Q=jl();Bn(Q),jo(Q,tt=>j?.(tt)),yt(tt=>Lo(Q,tt),[()=>d(c(w))]),De("blur",Q,tt=>{const Et=tt.currentTarget.value;Et!==d(c(w))&&t.onedit?.(c(w).key,Et),m(s,null)}),wt("keydown",Q,tt=>{tt.key==="Enter"?tt.currentTarget.blur():tt.key==="Escape"&&(tt.currentTarget.value=d(c(w)),m(s,null))}),A($,Q)},oo=$=>{var Q=Gl(),tt=R(Q),Et=R(tt);let Rt;var _t=nt(Et,2),Dt=R(_t,!0);M(_t),M(tt);var It=nt(tt,2);Yt(It,21,()=>i,te,(Y,kt)=>{var U=Yl();let V;var it=R(U);let ot;var et=nt(it);M(U),yt((Ot,gt)=>{V=Qe(U,1,"ip-status-option svelte-x7sio8",null,V,Ot),ot=_n(it,"",ot,gt),ht(et,` ${c(kt)??""}`)},[()=>({selected:d(c(w))===c(kt)}),()=>({background:u(c(kt))})]),wt("click",U,()=>F(c(w).key,c(kt))),A(Y,U)}),M(It),M(Q),yt((Y,kt)=>{Rt=_n(Et,"",Rt,Y),ht(Dt,kt)},[()=>({background:u(d(c(w)))}),()=>d(c(w))]),wt("click",Q,Y=>Y.stopPropagation()),A($,Q)},so=$=>{var Q=Jl(),tt=R(Q),Et=R(tt,!0);M(tt);var Rt=nt(tt,2),_t=R(Rt),Dt=R(_t),It=R(Dt);Wl(It,{size:14}),M(Dt);var Y=nt(Dt,2),kt=R(Y);M(Y);var U=nt(Y,2),V=R(U);No(V,{size:14}),M(U),M(_t);var it=nt(_t,2);Yt(it,21,()=>y,te,(et,Ot)=>{var gt=ql(),Ut=R(gt,!0);M(gt),yt(()=>ht(Ut,c(Ot))),A(et,gt)}),M(it);var ot=nt(it,2);Yt(ot,17,()=>E(c(p),c(h)),te,(et,Ot)=>{var gt=Zl();Yt(gt,21,()=>c(Ot),te,(Ut,jt)=>{var $t=Xl();let ft;var He=R($t,!0);M($t),yt(Ue=>{ft=Qe($t,1,"ip-cal-day svelte-x7sio8",null,ft,Ue),ht(He,c(jt).day)},[()=>({outside:c(jt).outside,today:C(c(jt)),selected:S(c(jt),d(c(w)))})]),wt("click",$t,()=>I(c(w).key,c(jt))),A(Ut,$t)}),M(gt),A(et,gt)}),M(Rt),M(Q),yt(et=>{ht(Et,et),ht(kt,`${b[c(h)]??""} ${c(p)??""}`)},[()=>v(d(c(w)))]),wt("click",Q,et=>et.stopPropagation()),wt("click",Dt,N),wt("click",U,O),A($,Q)},ao=$=>{{let Q=_(()=>Array.isArray(c(w).value));Zo($,{get value(){return c(w).value},get multi(){return c(Q)},onselect:tt=>{t.onedit?.(c(w).key,tt),m(s,null)},oncancel:()=>{m(s,null)}})}},co=$=>{var Q=L(),tt=D(Q);{var Et=U=>{var V=Ql(),it=R(V,!0);M(V),yt(ot=>ht(it,ot),[()=>d(c(w))]),A(U,V)},Rt=U=>{var V=tu();Yt(V,21,()=>Array.isArray(c(w).value)?c(w).value:[c(w).value],te,(it,ot)=>{var et=$l(),Ot=R(et,!0);M(et),yt(()=>ht(Ot,c(ot))),wt("click",et,gt=>{gt.stopPropagation(),f(c(ot))}),A(it,et)}),M(V),A(U,V)},_t=U=>{var V=eu(),it=R(V);let ot;var et=nt(it,2),Ot=R(et,!0);M(et),M(V),yt((gt,Ut)=>{ot=_n(it,"",ot,gt),ht(Ot,Ut)},[()=>({background:u(d(c(w)))}),()=>d(c(w))]),A(U,V)},Dt=U=>{var V=nu(),it=R(V,!0);M(V),yt(ot=>ht(it,ot),[()=>v(d(c(w)))]),A(U,V)},It=U=>{var V=ru(),it=R(V,!0);M(V),yt((ot,et)=>{Bo(V,"href",ot),ht(it,et)},[()=>d(c(w)),()=>d(c(w))]),wt("click",V,ot=>ot.stopPropagation()),A(U,V)},Y=_(()=>g(d(c(w)))),kt=U=>{var V=iu(),it=R(V,!0);M(V),yt(ot=>ht(it,ot),[()=>d(c(w))]),A(U,V)};at(tt,U=>{c(w).type==="badge"?U(Et):c(w).type==="wikilink"?U(Rt,1):c(w).type==="status"?U(_t,2):c(w).type==="date"?U(Dt,3):c(Y)?U(It,4):U(kt,!1)})}A($,Q)};at(ro,$=>{c(rt)&&c(w).type==="text"?$(io):c(rt)&&c(w).type==="status"?$(oo,1):c(rt)&&c(w).type==="date"?$(so,2):c(rt)&&c(w).type==="wikilink"?$(ao,3):$(co,!1)})}M(Sn),M(Ct),yt(()=>{oe=Qe(Ct,1,"ip-row svelte-x7sio8",null,oe,{"ip-focused":c(rt)}),ht(xn,c(w).key)}),wt("click",xt,$=>$.stopPropagation()),wt("click",Sn,$=>{$.stopPropagation(),W(c(w))}),A(P,Ct)});var Te=nt(At,2);{var eo=P=>{var w=su(),rt=R(w),Ct=R(rt);Tr(Ct,{size:14}),M(rt);var oe=nt(rt,2),xt=R(oe);Bn(xt),Yn(xt,bt=>m(l,bt),()=>c(l)),M(oe),Pn(2),M(w),wt("keydown",xt,G),De("blur",xt,z),ci(xt,()=>c(a),bt=>m(a,bt)),A(P,w)},no=P=>{var w=au(),rt=R(w);Tr(rt,{size:14}),Pn(2),M(w),wt("click",w,Ct=>{Ct.stopPropagation(),X()}),A(P,w)};at(Te,P=>{c(o)?P(eo):n()&&P(no,1)})}M(Z),A(e,Z),dt()}ri(["click","keydown"]);var lu=K('<div class="editor-wrap svelte-ok7wy5"><div class="cm-container svelte-ok7wy5"></div></div>');function ku(e,t){ut(t,!0);let n=x(t,"readonly",3,!0),r=x(t,"resetKey",3,0);const i=Ln("theme");let s,o=null,a=t.content,l=!1;function u(g,v){return g.theme({"&":{backgroundColor:"transparent",color:"var(--color-text-primary)",fontSize:"15px",fontFamily:"var(--font-sans)"},".cm-content":{padding:"32px 40px",fontFamily:"var(--font-sans)",caretColor:"var(--color-accent)",lineHeight:"1.6"},".cm-cursor":{borderLeftColor:"var(--color-accent)"},".cm-selectionBackground":{backgroundColor:v?"rgba(110,110,232,0.2)":"rgba(110,110,232,0.15)"},"&.cm-focused .cm-selectionBackground":{backgroundColor:v?"rgba(110,110,232,0.3)":"rgba(110,110,232,0.2)"},".cm-gutters":{display:"none"},".cm-activeLine":{backgroundColor:"transparent"},".cm-line":{padding:"0"},".cm-header-1":{fontSize:"22px",fontWeight:"600"},".cm-header-2":{fontSize:"16px",fontWeight:"600"},".cm-header-3":{fontSize:"15px",fontWeight:"600"},".cm-formatting":{color:"var(--color-text-tertiary)",opacity:"0.5"},".cm-link":{color:"var(--color-link)",textDecoration:"none"}},{dark:v})}si(async()=>{const{EditorState:g}=await be(async()=>{const{EditorState:F}=await import("./DnlgZ_Tk.js");return{EditorState:F}},[],import.meta.url),{EditorView:v,keymap:p}=await be(async()=>{const{EditorView:F,keymap:I}=await import("./DtVH--hH.js").then(H=>H.i);return{EditorView:F,keymap:I}},__vite__mapDeps([0,1]),import.meta.url),{markdown:h}=await be(async()=>{const{markdown:F}=await import("./Dh_H7Owr.js");return{markdown:F}},__vite__mapDeps([2,1,0,3,4]),import.meta.url),{syntaxHighlighting:y,HighlightStyle:b}=await be(async()=>{const{syntaxHighlighting:F,HighlightStyle:I}=await import("./4QY4j-jX.js");return{syntaxHighlighting:F,HighlightStyle:I}},__vite__mapDeps([3,4,1,0]),import.meta.url),{tags:E}=await be(async()=>{const{tags:F}=await import("./CUzqHQY_.js").then(I=>I.i);return{tags:F}},[],import.meta.url),{livePreviewPlugin:C,livePreviewTheme:S}=await be(async()=>{const{livePreviewPlugin:F,livePreviewTheme:I}=await import("./aosHekRC.js");return{livePreviewPlugin:F,livePreviewTheme:I}},__vite__mapDeps([5,0,1,3,4]),import.meta.url),N=i.current==="dark",O=u(v,N),k=b.define([{tag:E.processingInstruction,color:"var(--color-text-tertiary)",opacity:"0.7"}]),j=[h(),O,y(k),C,S,v.lineWrapping];n()&&j.push(g.readOnly.of(!0)),t.onchange&&j.push(v.updateListener.of(F=>{if(F.docChanged&&!l){const I=F.state.doc.toString();a=I,t.onchange(I)}})),j.push(v.domEventHandlers({click(F){const I=F.target;if(t.onwikilinkclick){const q=I.closest(".cm-live-wikilink");if(q){F.preventDefault();const X=q.textContent?.replace(/^\[{1,2}|\]{1,2}$/g,"").trim();return X&&t.onwikilinkclick(X),!0}}const H=I.closest(".cm-live-link");if(H){const q=H.getAttribute("data-href");if(q)return F.preventDefault(),window.open(q,"_blank","noopener,noreferrer"),!0}return!1}})),t.onsave&&j.push(p.of([{key:"Mod-s",run:()=>(t.onsave(),!0)}]));const W=g.create({doc:t.content,extensions:j});o=new v({state:W,parent:s})}),vt(()=>{if(r(),o&&t.content!==a){a=t.content;const g=s.closest(".document-scroll"),v=g?.scrollTop??0;l=!0,o.dispatch({changes:{from:0,to:o.state.doc.length,insert:t.content}}),l=!1,g&&requestAnimationFrame(()=>{g.scrollTop=v})}}),Fo(()=>{o?.destroy()});var f=lu(),d=R(f);Yn(d,g=>s=g,()=>s),M(f),A(e,f),dt()}const uu=/^\d{4}-\d{2}-\d{2}/,du=new Set(["active","inactive","in-progress","completed","draft","archived","current","former","contractor","client","partner","won","lost","open","closed"]),fu=new Set(["entity_type","format"]),hu=new Set(["entity_id","created_at","updated_at","created_by","updated_by"]);function Mu(e,t){const n=[];for(const[r,i]of Object.entries(e)){if(hu.has(r)||i==null)continue;const s=gu(r,i);s&&n.push(s)}return n}function gu(e,t){if(fu.has(e))return{key:e,value:String(t).toUpperCase(),type:"badge"};if(e==="status")return{key:e,value:String(t),type:"status"};if(Array.isArray(t)){const i=t.map(String),s=i.some(a=>/^\[\[.+?\]\]$/.test(a)),o=i.map(a=>{const l=a.match(/^\[\[(.+?)\]\]$/);return l?l[1]:a});return s||o.every(a=>ni(a))?{key:e,value:o,type:"wikilink"}:{key:e,value:i.join(", "),type:"text"}}const n=String(t),r=n.match(/^\[\[(.+?)\]\]$/);return r?{key:e,value:r[1],type:"wikilink"}:uu.test(n)?{key:e,value:n,type:"date"}:du.has(n.toLowerCase())?{key:e,value:n,type:"status"}:ni(n)&&!n.includes(" ")?{key:e,value:n,type:"wikilink"}:{key:e,value:n,type:"text"}}function ni(e){return/^[a-z0-9][a-z0-9-]*[a-z0-9]$/.test(e)&&e.includes("-")}const vu=800;function pu(){let e=B(!1),t=B(null),n=B(null),r=null,i=null,s=null,o=!1;function a(h,y,b,E){r&&r.repo===h&&r.type===y&&r.id===b?(E.data!==void 0&&(r.payload.data=E.data),E.content!==void 0&&(r.payload.content=E.content)):r={repo:h,type:y,id:b,payload:{...E}},i=null,u()}function l(h,y,b,E,C){i={repo:h,type:y,id:b,filePath:E,content:C},r=null,u()}function u(){s&&clearTimeout(s),s=setTimeout(f,vu)}async function f(){if(s=null,!o){if(r){const{repo:h,type:y,id:b,payload:E}=r;r=null,o=!0,m(e,!0),m(n,null);try{if(await Pr(h,y,b,E),m(t,new Date,!0),E.data?.name){const S=Gn.repos.find(N=>N.name===h)?.entities.find(N=>N.id===b);S&&(S.title=E.data.name)}d()}catch(C){m(n,C.message??"Save failed",!0),r={repo:h,type:y,id:b,payload:E}}finally{m(e,!1),o=!1,(r||i)&&f()}}else if(i){const{repo:h,type:y,id:b,filePath:E,content:C}=i;i=null,o=!0,m(e,!0),m(n,null);try{await Wo(h,y,b,E,C),m(t,new Date,!0),d()}catch(S){m(n,S.message??"Save failed",!0),i={repo:h,type:y,id:b,filePath:E,content:C}}finally{m(e,!1),o=!1,(r||i)&&f()}}}}function d(){Cr.refresh()}function g(){s&&(clearTimeout(s),s=null),(r||i)&&f()}async function v(h,y,b,E){m(e,!0),m(n,null);try{const C=await Pr(h,y,b,E);return m(t,new Date,!0),await Cr.refresh(),C}catch(C){return m(n,C.message??"Save failed",!0),null}finally{m(e,!1)}}function p(){m(n,null),m(t,null),r=null,i=null,s&&(clearTimeout(s),s=null)}return{get saving(){return c(e)},get lastSaved(){return c(t)},get error(){return c(n)},get hasPending(){return!!(r||i||o)},scheduleAutoSave:a,scheduleContentFileSave:l,flush:g,saveEntity:v,reset:p}}const Fu=pu();export{ku as C,_u as I,Fu as e,Mu as t};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../nodes/0.DQ5KdeNU.js","../chunks/hHxe9oXh.js","../chunks/fwnBoL5x.js","../chunks/YFT1281h.js","../chunks/3_5VIr68.js","../assets/0.CDbX4Cwz.css","../nodes/1.BR6DZ9ov.js","../chunks/CAXuTUkp.js","../chunks/BiubvAUI.js","../chunks/DPmdIe6Y.js","../nodes/2.COSjVZ_C.js","../chunks/BButMJ6M.js","../chunks/B0nldqWF.js","../assets/AppShell.CXdE5aqF.css","../chunks/DsERsGWg.js","../assets/ChatPanel.RFD5GGYI.css","../assets/2.DRHi7ABa.css","../nodes/3.B9r1XIlO.js","../chunks/nZKqDQ0w.js","../chunks/F20aIBpJ.js","../chunks/PPVm8Dsz.js","../assets/editor.CPAf2SRV.css","../assets/3.BJy7pVXi.css","../nodes/4.p-c6hlFf.js","../chunks/CqkleIqs.js","../assets/4.Ad16uh9o.css","../nodes/5.CPc-Bqal.js","../assets/5.BhKgiXd2.css","../nodes/6.jJ67YnBc.js","../assets/6.CeHKR5ZY.css"])))=>i.map(i=>d[i]);
2
+ import{_ as l}from"../chunks/PPVm8Dsz.js";import{T as E,ay as F,F as m,aJ as G,aK as J,aL as K,n as B,z as H,A as N,S as Q,aM as U,V as y,u as W,q as X,P as b,t as Z,w as $,x as tt,Y as p}from"../chunks/fwnBoL5x.js";import{h as et,m as rt,u as at,s as st}from"../chunks/BiubvAUI.js";import{a as h,d as P,f as w,t as ot}from"../chunks/hHxe9oXh.js";import{p as O,i as R,b as x}from"../chunks/BButMJ6M.js";import{c as A}from"../chunks/F20aIBpJ.js";function nt(s){return class extends it{constructor(t){super({component:s,...t})}}}class it{#e;#t;constructor(t){var a=new Map,n=(e,r)=>{var c=K(r,!1,!1);return a.set(e,c),c};const i=new Proxy({...t.props||{},$$events:{}},{get(e,r){return m(a.get(r)??n(r,Reflect.get(e,r)))},has(e,r){return r===F?!0:(m(a.get(r)??n(r,Reflect.get(e,r))),Reflect.has(e,r))},set(e,r,c){return E(a.get(r)??n(r,c),c),Reflect.set(e,r,c)}});this.#t=(t.hydrate?et:rt)(t.component,{target:t.target,anchor:t.anchor,props:i,context:t.context,intro:t.intro??!1,recover:t.recover,transformError:t.transformError}),(!t?.props?.$$host||t.sync===!1)&&G(),this.#e=i.$$events;for(const e of Object.keys(this.#t))e==="$set"||e==="$destroy"||e==="$on"||J(this,e,{get(){return this.#t[e]},set(r){this.#t[e]=r},enumerable:!0});this.#t.$set=e=>{Object.assign(i,e)},this.#t.$destroy=()=>{at(this.#t)}}$set(t){this.#t.$set(t)}$on(t,a){this.#e[t]=this.#e[t]||[];const n=(...i)=>a.call(this,...i);return this.#e[t].push(n),()=>{this.#e[t]=this.#e[t].filter(i=>i!==n)}}$destroy(){this.#t.$destroy()}}const Et={};var ct=w('<div id="svelte-announcer" aria-live="assertive" aria-atomic="true" style="position: absolute; left: 0; top: 0; clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; white-space: nowrap; width: 1px; height: 1px"><!></div>'),mt=w("<!> <!>",1);function ut(s,t){B(t,!0);let a=O(t,"components",23,()=>[]),n=O(t,"data_0",3,null),i=O(t,"data_1",3,null);H(()=>t.stores.page.set(t.page)),N(()=>{t.stores,t.page,t.constructors,a(),t.form,n(),i(),t.stores.page.notify()});let e=b(!1),r=b(!1),c=b(null);Q(()=>{const o=t.stores.page.subscribe(()=>{m(e)&&(E(r,!0),U().then(()=>{E(c,document.title||"untitled page",!0)}))});return E(e,!0),o});const I=p(()=>t.constructors[1]);var L=mt(),T=y(L);{var j=o=>{const u=p(()=>t.constructors[0]);var d=P(),v=y(d);A(v,()=>m(u),(_,f)=>{x(f(_,{get data(){return n()},get form(){return t.form},get params(){return t.page.params},children:(g,_t)=>{var V=P(),M=y(V);A(M,()=>m(I),(Y,q)=>{x(q(Y,{get data(){return i()},get form(){return t.form},get params(){return t.page.params}}),z=>a()[1]=z,()=>a()?.[1])}),h(g,V)},$$slots:{default:!0}}),g=>a()[0]=g,()=>a()?.[0])}),h(o,d)},k=o=>{const u=p(()=>t.constructors[0]);var d=P(),v=y(d);A(v,()=>m(u),(_,f)=>{x(f(_,{get data(){return n()},get form(){return t.form},get params(){return t.page.params}}),g=>a()[0]=g,()=>a()?.[0])}),h(o,d)};R(T,o=>{t.constructors[1]?o(j):o(k,!1)})}var C=W(T,2);{var S=o=>{var u=ct(),d=Z(u);{var v=_=>{var f=ot();tt(()=>st(f,m(c))),h(_,f)};R(d,_=>{m(r)&&_(v)})}$(u),h(o,u)};R(C,o=>{m(e)&&o(S)})}h(s,L),X()}const bt=nt(ut),pt=[()=>l(()=>import("../nodes/0.DQ5KdeNU.js"),__vite__mapDeps([0,1,2,3,4,5]),import.meta.url),()=>l(()=>import("../nodes/1.BR6DZ9ov.js"),__vite__mapDeps([6,1,2,7,8,9]),import.meta.url),()=>l(()=>import("../nodes/2.COSjVZ_C.js"),__vite__mapDeps([10,1,2,7,8,11,4,12,3,9,13,14,15,16]),import.meta.url),()=>l(()=>import("../nodes/3.B9r1XIlO.js"),__vite__mapDeps([17,3,2,4,1,8,11,12,9,7,13,14,15,18,19,20,21,22]),import.meta.url),()=>l(()=>import("../nodes/4.p-c6hlFf.js"),__vite__mapDeps([23,3,2,4,1,8,11,12,9,7,13,14,15,18,19,20,21,24,25]),import.meta.url),()=>l(()=>import("../nodes/5.CPc-Bqal.js"),__vite__mapDeps([26,3,2,4,1,8,11,12,9,7,13,27]),import.meta.url),()=>l(()=>import("../nodes/6.jJ67YnBc.js"),__vite__mapDeps([28,3,2,4,1,11,12,9,8,7,13,14,15,20,29]),import.meta.url)],Pt=[],Ot={"/":[2],"/graph":[6],"/[repo]/[type]/[id]":[3],"/[repo]/[type]/[id]/edit":[5],"/[repo]/[type]/[id]/[...path]":[4]},D={handleError:(({error:s})=>{console.error(s)}),reroute:(()=>{}),transport:{}},dt=Object.fromEntries(Object.entries(D.transport).map(([s,t])=>[s,t.decode])),Rt=Object.fromEntries(Object.entries(D.transport).map(([s,t])=>[s,t.encode])),xt=!1,At=(s,t)=>dt[s](t);export{At as decode,dt as decoders,Ot as dictionary,Rt as encoders,xt as hash,D as hooks,Et as matchers,pt as nodes,bt as root,Pt as server_loads};
@@ -0,0 +1 @@
1
+ import{l as o,a as r}from"../chunks/DPmdIe6Y.js";export{o as load_css,r as start};
@@ -0,0 +1 @@
1
+ import{a as v,f as E}from"../chunks/hHxe9oXh.js";import{i as S,b as w,K as O,L as x,h as c,M as C,N as g,d as u,c as h,e as b,O as k,n as F,P as f,Q as I,R as p,A as T,F as a,S as A,x as M,q as D,T as n,U as N,t as R,w as q,$ as L}from"../chunks/fwnBoL5x.js";import{s as P,w as y,g as V,a as $}from"../chunks/YFT1281h.js";function H(d,l){let o=null,t=c;var i;if(c){o=b;for(var e=k(document.head);e!==null&&(e.nodeType!==C||e.data!==d);)e=g(e);if(e===null)u(!1);else{var s=g(e);e.remove(),h(s)}}c||(i=document.head.appendChild(S()));try{w(()=>l(i),O|x)}finally{t&&(u(!0),h(o))}}var K=E('<div style="display: contents;"><!></div>');function B(d,l){F(l,!0);const o=typeof localStorage<"u"?localStorage.getItem("theme"):null;let t=f(I(o==="light"?"light":"dark"));p("theme",{get current(){return a(t)},toggle(){n(t,a(t)==="dark"?"light":"dark",!0),localStorage.setItem("theme",a(t))}});const e=typeof localStorage<"u"?localStorage.getItem("chatOpen"):null;let s=f(e==="true");p("chat",{get open(){return a(s)},toggle(){n(s,!a(s)),localStorage.setItem("chatOpen",String(a(s)))},close(){n(s,!1),localStorage.setItem("chatOpen","false")}}),T(()=>{document.documentElement.setAttribute("data-theme",a(t))}),A(()=>{y.load(),V.refreshAll(),window.addEventListener("sg-theme-change",m=>{n(t,m.detail,!0)})});var r=K();H("12qhfyh",m=>{N(()=>{L.title=(y.name||"Studiograph")??""})});var _=R(r);P(_,()=>l.children),q(r),M(()=>$(r,"data-theme",a(t))),v(d,r),D()}export{B as component};
@@ -0,0 +1 @@
1
+ import{a as u,f as h}from"../chunks/hHxe9oXh.js";import{i as g}from"../chunks/CAXuTUkp.js";import{n as l,V as v,x as d,q as x,t as a,w as e,u as _}from"../chunks/fwnBoL5x.js";import{s as o}from"../chunks/BiubvAUI.js";import{s as $,p}from"../chunks/DPmdIe6Y.js";const k={get error(){return p.error},get status(){return p.status}};$.updated.check;const m=k;var b=h("<h1> </h1> <p> </p>",1);function y(i,f){l(f,!1),g();var t=b(),r=v(t),n=a(r,!0);e(r);var s=_(r,2),c=a(s,!0);e(s),d(()=>{o(n,m.status),o(c,m.error?.message)}),u(i,t),x()}export{y as component};
@@ -0,0 +1 @@
1
+ import{a as v,f as d}from"../chunks/hHxe9oXh.js";import{i as b}from"../chunks/CAXuTUkp.js";import{n as y,o as C,q as S,t,u as l,v as V,w as e,x as k}from"../chunks/fwnBoL5x.js";import{s as A}from"../chunks/BiubvAUI.js";import{i as m}from"../chunks/BButMJ6M.js";import{n as P,A as q}from"../chunks/B0nldqWF.js";import{V as E,C as L}from"../chunks/DsERsGWg.js";import{w as p}from"../chunks/YFT1281h.js";var T=d('<h2 class="svelte-1uha8ag"> </h2>'),W=d('<div class="content-row svelte-1uha8ag"><div class="entity-area svelte-1uha8ag"><!> <div class="welcome svelte-1uha8ag"><!> <p class="svelte-1uha8ag">Select an entity from the sidebar to get started.</p></div></div> <!></div>');function K(c,f){y(f,!1);const h=C("chat");P.showEntity(),b(),q(c,{children:(g,j)=>{var o=W(),s=t(o),i=t(s);E(i,{activeView:"entity"});var n=l(i,2),u=t(n);{var _=a=>{var r=T(),$=t(r);e(r),k(()=>A($,`Welcome to ${(p.name||"Studiograph")??""}`)),v(a,r)};m(u,a=>{p.nameLoaded&&a(_)})}V(2),e(n),e(s);var w=l(s,2);{var x=a=>{L(a,{})};m(w,a=>{h.open&&a(x)})}e(o),v(g,o)},$$slots:{default:!0}}),S()}export{K as component};
@@ -0,0 +1 @@
1
+ import{f as lt,g as vt,w as z,c as ut,b as ft,a as yt}from"../chunks/YFT1281h.js";import{e as mt,a as y,f as _}from"../chunks/hHxe9oXh.js";import{n as _t,o as ht,P as m,Q as gt,A as Q,F as a,T as c,W as pt,q as bt,X as xt,t as v,u,Y as E,V as Ct,w as l,x as K}from"../chunks/fwnBoL5x.js";import{s as M}from"../chunks/BiubvAUI.js";import{i as w}from"../chunks/BButMJ6M.js";import{n as I,A as kt,e as wt,i as St}from"../chunks/B0nldqWF.js";import{g as X}from"../chunks/DPmdIe6Y.js";import{c as At,V as Pt,C as Tt}from"../chunks/DsERsGWg.js";import{e as o,I as Et,C as Kt,t as Mt}from"../chunks/nZKqDQ0w.js";const It=async({params:S,fetch:t})=>{const{repo:C,type:h,id:g}=S,p=await lt(C,h,g);return{repo:C,type:h,id:g,entity:p}},Gt=Object.freeze(Object.defineProperty({__proto__:null,load:It},Symbol.toStringTag,{value:"Module"}));var Ot=_('<span class="bc-sep svelte-1dc9loe">/</span>'),Vt=_("<!><span> </span>",1),Ft=_('<span class="status-text saving svelte-1dc9loe">Saving...</span>'),Rt=_('<span class="status-text error svelte-1dc9loe"> </span>'),jt=_('<a class="action-btn open-app svelte-1dc9loe"> </a>'),Dt=_('<div class="content-row svelte-1dc9loe"><div class="entity-area svelte-1dc9loe"><!> <div class="editor-bar svelte-1dc9loe"><div class="breadcrumb-path svelte-1dc9loe"></div> <div class="editor-actions svelte-1dc9loe"><!> <!></div></div> <div class="document-scroll svelte-1dc9loe"><!> <!></div></div> <!></div>');function Jt(S,t){_t(t,!0);const C=ht("chat"),h=E(()=>z.getAppForEntityType(t.data.entity.document?.frontmatter?.entity_type??t.data.type)),g=E(()=>()=>{const e=t.data.entity.path;if(e){const r=e.lastIndexOf(`/${t.data.repo}/`);if(r>=0)return e.substring(r+1).split("/")}return[t.data.repo,t.data.id,"main.md"]});let p=m(""),d=m(gt({})),O=m(0);const Y=E(()=>Mt(a(d)));let k=m(""),V=m(0),F=m(0);Q(()=>{const e=`${t.data.repo}/${t.data.type}/${t.data.id}`,r=vt.revertCount,i=At.mutationCount;(e!==a(k)||r!==a(V)||i!==a(F))&&(a(k)&&e!==a(k)&&o.flush(),c(k,e),c(V,r,!0),c(F,i,!0),c(p,(t.data.entity.document?.content??"").trim(),!0),c(d,{...t.data.entity.document?.frontmatter??t.data.entity.data??{}},!0),pt(O),o.reset())}),Q(()=>{I.select(t.data.repo,t.data.type,t.data.id),I.showEntity()});function B(e){c(p,e,!0),o.scheduleAutoSave(t.data.repo,t.data.type,t.data.id,{content:e})}function G(e,r){c(d,{...a(d),[e]:r},!0),o.scheduleAutoSave(t.data.repo,t.data.type,t.data.id,{data:a(d)})}function J(e){const{[e]:r,...i}=a(d);c(d,i,!0),o.scheduleAutoSave(t.data.repo,t.data.type,t.data.id,{data:a(d)})}function N(e,r){c(d,{...a(d),[e]:r},!0),o.scheduleAutoSave(t.data.repo,t.data.type,t.data.id,{data:a(d)})}function U(e,r){o.scheduleAutoSave(t.data.repo,t.data.type,t.data.id,{data:a(d)})}function Z(e){for(const r of z.repos){const i=r.entities.find(b=>b.id===e);if(i){X(`/${r.name}/${i.entityType}/${i.id}`);return}}}function $(e){(e.metaKey||e.ctrlKey)&&e.key==="s"&&(e.preventDefault(),o.flush()),e.key==="Escape"&&!(e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement)&&(o.flush(),I.deselect(),X("/"))}mt("keydown",xt,$),kt(S,{children:(e,r)=>{var i=Dt(),b=v(i),R=v(b);Pt(R,{activeView:"entity"});var A=u(R,2),P=v(A);wt(P,21,()=>a(g)(),St,(n,s,f)=>{var W=Vt(),q=Ct(W);{var it=x=>{var ct=Ot();y(x,ct)};w(q,x=>{f>0&&x(it)})}var T=u(q),st=v(T,!0);l(T),K(x=>{ft(T,1,x,"svelte-1dc9loe"),M(st,a(s))},[()=>ut(f===a(g)().length-1?"bc-current":"bc-segment")]),y(n,W)}),l(P);var j=u(P,2),D=v(j);{var tt=n=>{var s=Ft();y(n,s)},et=n=>{var s=Rt(),f=v(s,!0);l(s),K(()=>M(f,o.error)),y(n,s)};w(D,n=>{o.saving?n(tt):o.error&&n(et,1)})}var at=u(D,2);{var nt=n=>{var s=jt(),f=v(s);l(s),K(()=>{yt(s,"href",`/${t.data.repo??""}/${t.data.type??""}/${t.data.id??""}/edit`),M(f,`Open in ${a(h).name??""} →`)}),y(n,s)};w(at,n=>{a(h)&&n(nt)})}l(j),l(A);var H=u(A,2),L=v(H);Et(L,{get properties(){return a(Y)},editable:!0,onedit:G,onremove:J,onadd:N,ontypechange:U});var rt=u(L,2);Kt(rt,{get content(){return a(p)},readonly:!1,onchange:B,onsave:()=>o.flush(),onwikilinkclick:Z,get resetKey(){return a(O)}}),l(H),l(b);var ot=u(b,2);{var dt=n=>{Tt(n,{})};w(ot,n=>{C.open&&n(dt)})}l(i),y(e,i)},$$slots:{default:!0}}),bt()}export{Jt as component,Gt as universal};
@@ -0,0 +1,16 @@
1
+ import{d as Qt,r as jt,e as zt,b as Jt,c as Zt,w as Vt}from"../chunks/YFT1281h.js";import{g as Yt,j as ht,a as nt,f as it,e as Xt}from"../chunks/hHxe9oXh.js";import{n as Nt,P as yt,Q as Dt,A as Ft,t as U,u as X,F as l,w as z,x as At,T as N,v as Gt,q as Bt,o as $t,W as te,Y as Rt,X as ee,V as re}from"../chunks/fwnBoL5x.js";import{s as Mt}from"../chunks/BiubvAUI.js";import{i as Et,b as ne}from"../chunks/BButMJ6M.js";import{e as St,X as qt,i as Ot,P as Kt,n as It,A as ie}from"../chunks/B0nldqWF.js";import{g as se}from"../chunks/DPmdIe6Y.js";import{V as ae,C as oe}from"../chunks/DsERsGWg.js";import{e as ft,I as le,C as ue,t as he}from"../chunks/nZKqDQ0w.js";import{g as fe}from"../chunks/CqkleIqs.js";const de=async({params:O})=>{const{repo:v,type:w,id:a,path:F}=O,W=await Qt(v,w,a,F);return{repo:v,type:w,id:a,filePath:F,fileName:F.split("/").pop()??F,content:W}},Ie=Object.freeze(Object.defineProperty({__proto__:null,load:de},Symbol.toStringTag,{value:"Module"}));var xt={exports:{}};var ce=xt.exports,Wt;function pe(){return Wt||(Wt=1,(function(O,v){((w,a)=>{O.exports=a()})(ce,function w(){var a=typeof self<"u"?self:typeof window<"u"?window:a!==void 0?a:{},F,W=!a.document&&!!a.postMessage,H=a.IS_PAPA_WORKER||!1,J={},dt=0,d={};function Z(t){this._handle=null,this._finished=!1,this._completed=!1,this._halted=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},(function(e){var r=lt(e);r.chunkSize=parseInt(r.chunkSize),e.step||e.chunk||(r.chunkSize=null),this._handle=new vt(r),(this._handle.streamer=this)._config=r}).call(this,t),this.parseChunk=function(e,r){var s=parseInt(this._config.skipFirstNLines)||0;if(this.isFirstChunk&&0<s){let y=this._config.newline;y||(i=this._config.quoteChar||'"',y=this._handle.guessLineEndings(e,i)),e=[...e.split(y).slice(s)].join(y)}this.isFirstChunk&&m(this._config.beforeFirstChunk)&&(i=this._config.beforeFirstChunk(e))!==void 0&&(e=i),this.isFirstChunk=!1,this._halted=!1;var s=this._partialLine+e,i=(this._partialLine="",this._handle.parse(s,this._baseIndex,!this._finished));if(!this._handle.paused()&&!this._handle.aborted()){if(e=i.meta.cursor,s=(this._finished||(this._partialLine=s.substring(e-this._baseIndex),this._baseIndex=e),i&&i.data&&(this._rowCount+=i.data.length),this._finished||this._config.preview&&this._rowCount>=this._config.preview),H)a.postMessage({results:i,workerId:d.WORKER_ID,finished:s});else if(m(this._config.chunk)&&!r){if(this._config.chunk(i,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);this._completeResults=i=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(i.data),this._completeResults.errors=this._completeResults.errors.concat(i.errors),this._completeResults.meta=i.meta),this._completed||!s||!m(this._config.complete)||i&&i.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),s||i&&i.meta.paused||this._nextChunk(),i}this._halted=!0},this._sendError=function(e){m(this._config.error)?this._config.error(e):H&&this._config.error&&a.postMessage({workerId:d.WORKER_ID,error:e,finished:!1})}}function $(t){var e;(t=t||{}).chunkSize||(t.chunkSize=d.RemoteChunkSize),Z.call(this,t),this._nextChunk=W?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(r){this._input=r,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(e=new XMLHttpRequest,this._config.withCredentials&&(e.withCredentials=this._config.withCredentials),W||(e.onload=b(this._chunkLoaded,this),e.onerror=b(this._chunkError,this)),e.open(this._config.downloadRequestBody?"POST":"GET",this._input,!W),this._config.downloadRequestHeaders){var r,s=this._config.downloadRequestHeaders;for(r in s)e.setRequestHeader(r,s[r])}var i;this._config.chunkSize&&(i=this._start+this._config.chunkSize-1,e.setRequestHeader("Range","bytes="+this._start+"-"+i));try{e.send(this._config.downloadRequestBody)}catch(y){this._chunkError(y.message)}W&&e.status===0&&this._chunkError()}},this._chunkLoaded=function(){e.readyState===4&&(e.status<200||400<=e.status?this._chunkError():(this._start+=this._config.chunkSize||e.responseText.length,this._finished=!this._config.chunkSize||this._start>=(r=>(r=r.getResponseHeader("Content-Range"))!==null?parseInt(r.substring(r.lastIndexOf("/")+1)):-1)(e),this.parseChunk(e.responseText)))},this._chunkError=function(r){r=e.statusText||r,this._sendError(new Error(r))}}function st(t){(t=t||{}).chunkSize||(t.chunkSize=d.LocalChunkSize),Z.call(this,t);var e,r,s=typeof FileReader<"u";this.stream=function(i){this._input=i,r=i.slice||i.webkitSlice||i.mozSlice,s?((e=new FileReader).onload=b(this._chunkLoaded,this),e.onerror=b(this._chunkError,this)):e=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount<this._config.preview)||this._readChunk()},this._readChunk=function(){var i=this._input,y=(this._config.chunkSize&&(y=Math.min(this._start+this._config.chunkSize,this._input.size),i=r.call(i,this._start,y)),e.readAsText(i,this._config.encoding));s||this._chunkLoaded({target:{result:y}})},this._chunkLoaded=function(i){this._start+=this._config.chunkSize,this._finished=!this._config.chunkSize||this._start>=this._input.size,this.parseChunk(i.target.result)},this._chunkError=function(){this._sendError(e.error)}}function at(t){var e;Z.call(this,t=t||{}),this.stream=function(r){return e=r,this._nextChunk()},this._nextChunk=function(){var r,s;if(!this._finished)return r=this._config.chunkSize,e=r?(s=e.substring(0,r),e.substring(r)):(s=e,""),this._finished=!e,this.parseChunk(s)}}function L(t){Z.call(this,t=t||{});var e=[],r=!0,s=!1;this.pause=function(){Z.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){Z.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(i){this._input=i,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){s&&e.length===1&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),e.length?this.parseChunk(e.shift()):r=!0},this._streamData=b(function(i){try{e.push(typeof i=="string"?i:i.toString(this._config.encoding)),r&&(r=!1,this._checkIsFinished(),this.parseChunk(e.shift()))}catch(y){this._streamError(y)}},this),this._streamError=b(function(i){this._streamCleanUp(),this._sendError(i)},this),this._streamEnd=b(function(){this._streamCleanUp(),s=!0,this._streamData("")},this),this._streamCleanUp=b(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)},this)}function vt(t){var e,r,s,i,y=Math.pow(2,53),M=-y,u=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,h=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,n=this,R=0,f=0,q=!1,_=!1,c=[],o={data:[],errors:[],meta:{}};function D(k){return t.skipEmptyLines==="greedy"?k.join("").trim()==="":k.length===1&&k[0].length===0}function g(){if(o&&s&&(B("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+d.DefaultDelimiter+"'"),s=!1),t.skipEmptyLines&&(o.data=o.data.filter(function(p){return!D(p)})),A()){let p=function(j,K){m(t.transformHeader)&&(j=t.transformHeader(j,K)),c.push(j)};if(o)if(Array.isArray(o.data[0])){for(var k=0;A()&&k<o.data.length;k++)o.data[k].forEach(p);o.data.splice(0,1)}else o.data.forEach(p)}function C(p,j){for(var K=t.header?{}:[],x=0;x<p.length;x++){var T=x,S=p[x],S=((G,E)=>(I=>(t.dynamicTypingFunction&&t.dynamicTyping[I]===void 0&&(t.dynamicTyping[I]=t.dynamicTypingFunction(I)),(t.dynamicTyping[I]||t.dynamicTyping)===!0))(G)?E==="true"||E==="TRUE"||E!=="false"&&E!=="FALSE"&&((I=>{if(u.test(I)&&(I=parseFloat(I),M<I&&I<y))return 1})(E)?parseFloat(E):h.test(E)?new Date(E):E===""?null:E):E)(T=t.header?x>=c.length?"__parsed_extra":c[x]:T,S=t.transform?t.transform(S,T):S);T==="__parsed_extra"?(K[T]=K[T]||[],K[T].push(S)):K[T]=S}return t.header&&(x>c.length?B("FieldMismatch","TooManyFields","Too many fields: expected "+c.length+" fields but parsed "+x,f+j):x<c.length&&B("FieldMismatch","TooFewFields","Too few fields: expected "+c.length+" fields but parsed "+x,f+j)),K}var P;o&&(t.header||t.dynamicTyping||t.transform)&&(P=1,!o.data.length||Array.isArray(o.data[0])?(o.data=o.data.map(C),P=o.data.length):o.data=C(o.data,0),t.header&&o.meta&&(o.meta.fields=c),f+=P)}function A(){return t.header&&c.length===0}function B(k,C,P,p){k={type:k,code:C,message:P},p!==void 0&&(k.row=p),o.errors.push(k)}m(t.step)&&(i=t.step,t.step=function(k){o=k,A()?g():(g(),o.data.length!==0&&(R+=k.data.length,t.preview&&R>t.preview?r.abort():(o.data=o.data[0],i(o,n))))}),this.parse=function(k,C,P){var p=t.quoteChar||'"',p=(t.newline||(t.newline=this.guessLineEndings(k,p)),s=!1,t.delimiter?m(t.delimiter)&&(t.delimiter=t.delimiter(k),o.meta.delimiter=t.delimiter):((p=((j,K,x,T,S)=>{var G,E,I,gt;S=S||[","," ","|",";",d.RECORD_SEP,d.UNIT_SEP];for(var kt=0;kt<S.length;kt++){for(var tt,wt=S[kt],V=0,et=0,Q=0,Y=(I=void 0,new mt({comments:T,delimiter:wt,newline:K,preview:10}).parse(j)),ut=0;ut<Y.data.length;ut++)x&&D(Y.data[ut])?Q++:(tt=Y.data[ut].length,et+=tt,I===void 0?I=tt:0<tt&&(V+=Math.abs(tt-I),I=tt));0<Y.data.length&&(et/=Y.data.length-Q),(E===void 0||V<=E)&&(gt===void 0||gt<et)&&1.99<et&&(E=V,G=wt,gt=et)}return{successful:!!(t.delimiter=G),bestDelimiter:G}})(k,t.newline,t.skipEmptyLines,t.comments,t.delimitersToGuess)).successful?t.delimiter=p.bestDelimiter:(s=!0,t.delimiter=d.DefaultDelimiter),o.meta.delimiter=t.delimiter),lt(t));return t.preview&&t.header&&p.preview++,e=k,r=new mt(p),o=r.parse(e,C,P),g(),q?{meta:{paused:!0}}:o||{meta:{paused:!1}}},this.paused=function(){return q},this.pause=function(){q=!0,r.abort(),e=m(t.chunk)?"":e.substring(r.getCharIndex())},this.resume=function(){n.streamer._halted?(q=!1,n.streamer.parseChunk(e,!0)):setTimeout(n.resume,3)},this.aborted=function(){return _},this.abort=function(){_=!0,r.abort(),o.meta.aborted=!0,m(t.complete)&&t.complete(o),e=""},this.guessLineEndings=function(j,p){j=j.substring(0,1048576);var p=new RegExp(ot(p)+"([^]*?)"+ot(p),"gm"),P=(j=j.replace(p,"")).split("\r"),p=j.split(`
2
+ `),j=1<p.length&&p[0].length<P[0].length;if(P.length===1||j)return`
3
+ `;for(var K=0,x=0;x<P.length;x++)P[x][0]===`
4
+ `&&K++;return K>=P.length/2?`\r
5
+ `:"\r"}}function ot(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function mt(t){var e=(t=t||{}).delimiter,r=t.newline,s=t.comments,i=t.step,y=t.preview,M=t.fastMode,u=null,h=!1,n=t.quoteChar==null?'"':t.quoteChar,R=n;if(t.escapeChar!==void 0&&(R=t.escapeChar),(typeof e!="string"||-1<d.BAD_DELIMITERS.indexOf(e))&&(e=","),s===e)throw new Error("Comment character same as delimiter");s===!0?s="#":(typeof s!="string"||-1<d.BAD_DELIMITERS.indexOf(s))&&(s=!1),r!==`
6
+ `&&r!=="\r"&&r!==`\r
7
+ `&&(r=`
8
+ `);var f=0,q=!1;this.parse=function(_,c,o){if(typeof _!="string")throw new Error("Input must be a string");var D=_.length,g=e.length,A=r.length,B=s.length,k=m(i),C=[],P=[],p=[],j=f=0;if(!_)return V();if(M||M!==!1&&_.indexOf(n)===-1){for(var K=_.split(r),x=0;x<K.length;x++){if(p=K[x],f+=p.length,x!==K.length-1)f+=r.length;else if(o)return V();if(!s||p.substring(0,B)!==s){if(k){if(C=[],gt(p.split(e)),et(),q)return V()}else gt(p.split(e));if(y&&y<=x)return C=C.slice(0,y),V(!0)}}return V()}for(var T=_.indexOf(e,f),S=_.indexOf(r,f),G=new RegExp(ot(R)+ot(n),"g"),E=_.indexOf(n,f);;)if(_[f]===n)for(E=f,f++;;){if((E=_.indexOf(n,E+1))===-1)return o||P.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:C.length,index:f}),tt();if(E===D-1)return tt(_.substring(f,E).replace(G,n));if(n===R&&_[E+1]===R)E++;else if(n===R||E===0||_[E-1]!==R){T!==-1&&T<E+1&&(T=_.indexOf(e,E+1));var I=kt((S=S!==-1&&S<E+1?_.indexOf(r,E+1):S)===-1?T:Math.min(T,S));if(_.substr(E+1+I,g)===e){p.push(_.substring(f,E).replace(G,n)),_[f=E+1+I+g]!==n&&(E=_.indexOf(n,f)),T=_.indexOf(e,f),S=_.indexOf(r,f);break}if(I=kt(S),_.substring(E+1+I,E+1+I+A)===r){if(p.push(_.substring(f,E).replace(G,n)),wt(E+1+I+A),T=_.indexOf(e,f),E=_.indexOf(n,f),k&&(et(),q))return V();if(y&&C.length>=y)return V(!0);break}P.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:C.length,index:f}),E++}}else if(s&&p.length===0&&_.substring(f,f+B)===s){if(S===-1)return V();f=S+A,S=_.indexOf(r,f),T=_.indexOf(e,f)}else if(T!==-1&&(T<S||S===-1))p.push(_.substring(f,T)),f=T+g,T=_.indexOf(e,f);else{if(S===-1)break;if(p.push(_.substring(f,S)),wt(S+A),k&&(et(),q))return V();if(y&&C.length>=y)return V(!0)}return tt();function gt(Q){C.push(Q),j=f}function kt(Q){var Y=0;return Y=Q!==-1&&(Q=_.substring(E+1,Q))&&Q.trim()===""?Q.length:Y}function tt(Q){return o||(Q===void 0&&(Q=_.substring(f)),p.push(Q),f=D,gt(p),k&&et()),V()}function wt(Q){f=Q,gt(p),p=[],S=_.indexOf(r,f)}function V(Q){if(t.header&&!c&&C.length&&!h){var Y=C[0],ut=Object.create(null),Tt=new Set(Y);let Lt=!1;for(let bt=0;bt<Y.length;bt++){let rt=Y[bt];if(ut[rt=m(t.transformHeader)?t.transformHeader(rt,bt):rt]){let Ct,Pt=ut[rt];for(;Ct=rt+"_"+Pt,Pt++,Tt.has(Ct););Tt.add(Ct),Y[bt]=Ct,ut[rt]++,Lt=!0,(u=u===null?{}:u)[Ct]=rt}else ut[rt]=1,Y[bt]=rt;Tt.add(rt)}Lt&&console.warn("Duplicate headers found and renamed."),h=!0}return{data:C,errors:P,meta:{delimiter:e,linebreak:r,aborted:q,truncated:!!Q,cursor:j+(c||0),renamedHeaders:u}}}function et(){i(V()),C=[],P=[]}},this.abort=function(){q=!0},this.getCharIndex=function(){return f}}function ct(t){var e=t.data,r=J[e.workerId],s=!1;if(e.error)r.userError(e.error,e.file);else if(e.results&&e.results.data){var i={abort:function(){s=!0,pt(e.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:_t,resume:_t};if(m(r.userStep)){for(var y=0;y<e.results.data.length&&(r.userStep({data:e.results.data[y],errors:e.results.errors,meta:e.results.meta},i),!s);y++);delete e.results}else m(r.userChunk)&&(r.userChunk(e.results,i,e.file),delete e.results)}e.finished&&!s&&pt(e.workerId,e.results)}function pt(t,e){var r=J[t];m(r.userComplete)&&r.userComplete(e),r.terminate(),delete J[t]}function _t(){throw new Error("Not implemented.")}function lt(t){if(typeof t!="object"||t===null)return t;var e,r=Array.isArray(t)?[]:{};for(e in t)r[e]=lt(t[e]);return r}function b(t,e){return function(){t.apply(e,arguments)}}function m(t){return typeof t=="function"}return d.parse=function(t,e){var r=(e=e||{}).dynamicTyping||!1;if(m(r)&&(e.dynamicTypingFunction=r,r={}),e.dynamicTyping=r,e.transform=!!m(e.transform)&&e.transform,!e.worker||!d.WORKERS_SUPPORTED)return r=null,d.NODE_STREAM_INPUT,typeof t=="string"?(t=(s=>s.charCodeAt(0)!==65279?s:s.slice(1))(t),r=new(e.download?$:at)(e)):t.readable===!0&&m(t.read)&&m(t.on)?r=new L(e):(a.File&&t instanceof File||t instanceof Object)&&(r=new st(e)),r.stream(t);(r=(()=>{var s;return!!d.WORKERS_SUPPORTED&&(s=(()=>{var i=a.URL||a.webkitURL||null,y=w.toString();return d.BLOB_URL||(d.BLOB_URL=i.createObjectURL(new Blob(["var global = (function() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return {}; })(); global.IS_PAPA_WORKER=true; ","(",y,")();"],{type:"text/javascript"})))})(),(s=new a.Worker(s)).onmessage=ct,s.id=dt++,J[s.id]=s)})()).userStep=e.step,r.userChunk=e.chunk,r.userComplete=e.complete,r.userError=e.error,e.step=m(e.step),e.chunk=m(e.chunk),e.complete=m(e.complete),e.error=m(e.error),delete e.worker,r.postMessage({input:t,config:e,workerId:r.id})},d.unparse=function(t,e){var r=!1,s=!0,i=",",y=`\r
9
+ `,M='"',u=M+M,h=!1,n=null,R=!1,f=((()=>{if(typeof e=="object"){if(typeof e.delimiter!="string"||d.BAD_DELIMITERS.filter(function(c){return e.delimiter.indexOf(c)!==-1}).length||(i=e.delimiter),typeof e.quotes!="boolean"&&typeof e.quotes!="function"&&!Array.isArray(e.quotes)||(r=e.quotes),typeof e.skipEmptyLines!="boolean"&&typeof e.skipEmptyLines!="string"||(h=e.skipEmptyLines),typeof e.newline=="string"&&(y=e.newline),typeof e.quoteChar=="string"&&(M=e.quoteChar),typeof e.header=="boolean"&&(s=e.header),Array.isArray(e.columns)){if(e.columns.length===0)throw new Error("Option columns is empty");n=e.columns}e.escapeChar!==void 0&&(u=e.escapeChar+M),e.escapeFormulae instanceof RegExp?R=e.escapeFormulae:typeof e.escapeFormulae=="boolean"&&e.escapeFormulae&&(R=/^[=+\-@\t\r].*$/)}})(),new RegExp(ot(M),"g"));if(typeof t=="string"&&(t=JSON.parse(t)),Array.isArray(t)){if(!t.length||Array.isArray(t[0]))return q(null,t,h);if(typeof t[0]=="object")return q(n||Object.keys(t[0]),t,h)}else if(typeof t=="object")return typeof t.data=="string"&&(t.data=JSON.parse(t.data)),Array.isArray(t.data)&&(t.fields||(t.fields=t.meta&&t.meta.fields||n),t.fields||(t.fields=Array.isArray(t.data[0])?t.fields:typeof t.data[0]=="object"?Object.keys(t.data[0]):[]),Array.isArray(t.data[0])||typeof t.data[0]=="object"||(t.data=[t.data])),q(t.fields||[],t.data||[],h);throw new Error("Unable to serialize unrecognized input");function q(c,o,D){var g="",A=(typeof c=="string"&&(c=JSON.parse(c)),typeof o=="string"&&(o=JSON.parse(o)),Array.isArray(c)&&0<c.length),B=!Array.isArray(o[0]);if(A&&s){for(var k=0;k<c.length;k++)0<k&&(g+=i),g+=_(c[k],k);0<o.length&&(g+=y)}for(var C=0;C<o.length;C++){var P=(A?c:o[C]).length,p=!1,j=A?Object.keys(o[C]).length===0:o[C].length===0;if(D&&!A&&(p=D==="greedy"?o[C].join("").trim()==="":o[C].length===1&&o[C][0].length===0),D==="greedy"&&A){for(var K=[],x=0;x<P;x++){var T=B?c[x]:x;K.push(o[C][T])}p=K.join("").trim()===""}if(!p){for(var S=0;S<P;S++){0<S&&!j&&(g+=i);var G=A&&B?c[S]:S;g+=_(o[C][G],S)}C<o.length-1&&(!D||0<P&&!j)&&(g+=y)}}return g}function _(c,o){var D,g;return c==null?"":c.constructor===Date?JSON.stringify(c).slice(1,25):(g=!1,R&&typeof c=="string"&&R.test(c)&&(c="'"+c,g=!0),D=c.toString().replace(f,u),(g=g||r===!0||typeof r=="function"&&r(c,o)||Array.isArray(r)&&r[o]||((A,B)=>{for(var k=0;k<B.length;k++)if(-1<A.indexOf(B[k]))return!0;return!1})(D,d.BAD_DELIMITERS)||-1<D.indexOf(i)||D.charAt(0)===" "||D.charAt(D.length-1)===" ")?M+D+M:D)}},d.RECORD_SEP="",d.UNIT_SEP="",d.BYTE_ORDER_MARK="\uFEFF",d.BAD_DELIMITERS=["\r",`
10
+ `,'"',d.BYTE_ORDER_MARK],d.WORKERS_SUPPORTED=!W&&!!a.Worker,d.NODE_STREAM_INPUT=1,d.LocalChunkSize=10485760,d.RemoteChunkSize=5242880,d.DefaultDelimiter=",",d.Parser=mt,d.ParserHandle=vt,d.NetworkStreamer=$,d.FileStreamer=st,d.StringStreamer=at,d.ReadableStreamStreamer=L,a.jQuery&&((F=a.jQuery).fn.parse=function(t){var e=t.config||{},r=[];return this.each(function(y){if(!(F(this).prop("tagName").toUpperCase()==="INPUT"&&F(this).attr("type").toLowerCase()==="file"&&a.FileReader)||!this.files||this.files.length===0)return!0;for(var M=0;M<this.files.length;M++)r.push({file:this.files[M],inputElem:this,instanceConfig:F.extend({},e)})}),s(),this;function s(){if(r.length===0)m(t.complete)&&t.complete();else{var y,M,u,h,n=r[0];if(m(t.before)){var R=t.before(n.file,n.inputElem);if(typeof R=="object"){if(R.action==="abort")return y="AbortError",M=n.file,u=n.inputElem,h=R.reason,void(m(t.error)&&t.error({name:y},M,u,h));if(R.action==="skip")return void i();typeof R.config=="object"&&(n.instanceConfig=F.extend(n.instanceConfig,R.config))}else if(R==="skip")return void i()}var f=n.instanceConfig.complete;n.instanceConfig.complete=function(q){m(f)&&f(q,n.file,n.inputElem),i()},d.parse(n.file,n.instanceConfig)}}function i(){r.splice(0,1),s()}}),H&&(a.onmessage=function(t){t=t.data,d.WORKER_ID===void 0&&t&&(d.WORKER_ID=t.workerId),typeof t.input=="string"?a.postMessage({workerId:d.WORKER_ID,results:d.parse(t.input,t.config),finished:!0}):(a.File&&t.input instanceof File||t.input instanceof Object)&&(t=d.parse(t.input,t.config))&&a.postMessage({workerId:d.WORKER_ID,results:t,finished:!0})}),($.prototype=Object.create(Z.prototype)).constructor=$,(st.prototype=Object.create(Z.prototype)).constructor=st,(at.prototype=Object.create(at.prototype)).constructor=at,(L.prototype=Object.create(Z.prototype)).constructor=L,d})})(xt)),xt.exports}var _e=pe();const Ut=fe(_e);var ge=it('<button class="col-delete-btn svelte-63hltt" title="Delete column"><!></button>'),ve=it('<th class="svelte-63hltt"><input class="cell-input header-input svelte-63hltt"/> <!></th>'),me=it('<td class="svelte-63hltt"><input class="cell-input svelte-63hltt"/></td>'),ye=it('<tr class="svelte-63hltt"><td class="row-num svelte-63hltt"></td><!><td class="actions svelte-63hltt"><button class="delete-btn svelte-63hltt" title="Delete row"><!></button></td></tr>'),ke=it('<div class="csv-editor svelte-63hltt"><div class="table-scroll svelte-63hltt"><table class="svelte-63hltt"><thead><tr><th class="row-num svelte-63hltt"></th><!><th class="col-add svelte-63hltt"><button class="col-add-btn svelte-63hltt" title="Add column"><!></button></th></tr></thead><tbody></tbody></table></div> <div class="csv-footer svelte-63hltt"><button class="add-row-btn svelte-63hltt"><!> <span>Add row</span></button></div></div>');function be(O,v){Nt(v,!0);let w=yt(Dt([])),a=yt(Dt([])),F=yt(void 0);function W(u){const h=Ut.parse(u.trim(),{header:!1,skipEmptyLines:!0});h.data.length>0?(N(w,h.data[0],!0),N(a,h.data.slice(1),!0)):(N(w,[],!0),N(a,[],!0))}W(v.content),Ft(()=>{W(v.content)});function H(){return Ut.unparse([l(w),...l(a)])}function J(){v.onchange?.(H())}function dt(u,h,n){l(a)[u][h]=n,N(a,[...l(a)],!0),J()}function d(u,h){l(w)[u]=h,N(w,[...l(w)],!0),J()}function Z(){N(a,[...l(a),l(w).map(()=>"")],!0),J(),L(l(a).length-1,0)}function $(u){N(a,l(a).filter((h,n)=>n!==u),!0),J()}function st(){const u=`col${l(w).length+1}`;N(w,[...l(w),u],!0),N(a,l(a).map(h=>[...h,""]),!0),J(),requestAnimationFrame(()=>{const h=l(F)?.querySelector(`thead th:nth-child(${l(w).length+1}) input`);h&&(h.focus(),h.select())})}function at(u){l(w).length<=1||(N(w,l(w).filter((h,n)=>n!==u),!0),N(a,l(a).map(h=>h.filter((n,R)=>R!==u)),!0),J())}function L(u,h){requestAnimationFrame(()=>{if(!l(F))return;let n=null;u<0?n=l(F).querySelector(`thead th:nth-child(${h+2}) input`):n=l(F).querySelector(`tbody tr:nth-child(${u+1}) td:nth-child(${h+2}) input`),n&&(n.focus(),n.select())})}function vt(u,h,n){if(u.key==="Tab"){u.preventDefault(),u.shiftKey?n>0?L(h,n-1):h>0?L(h-1,l(w).length-1):h===0&&L(-1,l(w).length-1):n<l(w).length-1?L(h,n+1):h<l(a).length-1?L(h+1,0):h===l(a).length-1&&Z();return}if(u.key==="Enter"){u.preventDefault(),u.shiftKey?h>0?L(h-1,n):L(-1,n):h<l(a).length-1?L(h+1,n):Z();return}if(u.key==="Escape"){u.target.blur();return}}function ot(u,h){if(u.key==="Tab"){u.preventDefault(),u.shiftKey?h>0&&L(-1,h-1):h<l(w).length-1?L(-1,h+1):l(a).length>0&&L(0,0);return}if(u.key==="Enter"){u.preventDefault(),l(a).length>0?L(0,h):Z();return}if(u.key==="Escape"){u.target.blur();return}}function mt(u){(u.metaKey||u.ctrlKey)&&u.key==="s"&&(u.preventDefault(),v.onsave?.())}var ct=ke(),pt=U(ct),_t=U(pt),lt=U(_t),b=U(lt),m=X(U(b));St(m,17,()=>l(w),Ot,(u,h,n)=>{var R=ve(),f=U(R);jt(f);var q=X(f,2);{var _=c=>{var o=ge(),D=U(o);qt(D,{size:12}),z(o),ht("click",o,()=>at(n)),nt(c,o)};Et(q,c=>{l(w).length>1&&c(_)})}z(R),At(()=>zt(f,l(h))),ht("input",f,c=>d(n,c.currentTarget.value)),ht("keydown",f,c=>ot(c,n)),nt(u,R)});var t=X(m),e=U(t),r=U(e);Kt(r,{size:14}),z(e),z(t),z(b),z(lt);var s=X(lt);St(s,21,()=>l(a),Ot,(u,h,n)=>{var R=ye(),f=U(R);f.textContent=n+1;var q=X(f);St(q,17,()=>l(h),Ot,(D,g,A)=>{var B=me(),k=U(B);jt(k),z(B),At(()=>zt(k,l(g))),ht("input",k,C=>dt(n,A,C.currentTarget.value)),ht("keydown",k,C=>vt(C,n,A)),nt(D,B)});var _=X(q),c=U(_),o=U(c);qt(o,{size:12}),z(c),z(_),z(R),ht("click",c,()=>$(n)),nt(u,R)}),z(s),z(_t),ne(_t,u=>N(F,u),()=>l(F)),z(pt);var i=X(pt,2),y=U(i),M=U(y);Kt(M,{size:14}),Gt(2),z(y),z(i),z(ct),ht("keydown",ct,mt),ht("click",e,st),ht("click",y,Z),nt(O,ct),Bt()}Yt(["keydown","input","click"]);function Ee(O){if(!O.startsWith("---"))return{frontmatter:{},content:O};const v=O.indexOf(`
11
+ ---`,3);if(v===-1)return{frontmatter:{},content:O};const w=O.slice(4,v),a=O.slice(v+4).replace(/^\n/,"");try{return{frontmatter:we(w),content:a}}catch{return{frontmatter:{},content:O}}}function we(O){const v={},w=O.split(`
12
+ `);let a=0;for(;a<w.length;){const F=w[a];if(!F.trim()||F.trim().startsWith("#")){a++;continue}const W=F.match(/^([a-zA-Z_][a-zA-Z0-9_-]*):\s*(.*)/);if(!W){a++;continue}const H=W[1],J=W[2].trim();if(!J&&a+1<w.length&&w[a+1]?.match(/^\s+-\s/)){const dt=[];for(a++;a<w.length&&w[a].match(/^\s+-\s/);){const d=w[a].match(/^\s+-\s+(.*)/);d&&dt.push(Ht(d[1].trim())),a++}v[H]=dt;continue}v[H]=Ce(J),a++}return v}function Ht(O){return O.startsWith("'")&&O.endsWith("'")||O.startsWith('"')&&O.endsWith('"')?O.slice(1,-1):O}function Ce(O){if(!O)return"";const v=Ht(O);return v==="true"?!0:v==="false"?!1:v==="null"||v==="~"?null:O===v&&/^-?\d+(\.\d+)?$/.test(O)?Number(O):v}var Re=it('<span class="bc-sep svelte-xtfs5g">/</span>'),Se=it("<!><span> </span>",1),Oe=it('<span class="status-text saving svelte-xtfs5g">Saving...</span>'),xe=it('<span class="status-text error svelte-xtfs5g"> </span>'),Ae=it('<div class="content-row svelte-xtfs5g"><div class="entity-area svelte-xtfs5g"><!> <div class="editor-bar svelte-xtfs5g"><div class="breadcrumb-path svelte-xtfs5g"></div> <div class="editor-actions svelte-xtfs5g"><!></div></div> <div class="document-scroll svelte-xtfs5g"><!> <!></div></div> <!></div>');function We(O,v){Nt(v,!0);const w=$t("chat"),a=Rt(()=>v.data.fileName.endsWith(".csv")),F=Rt(()=>v.data.fileName.endsWith(".md"));let W=yt(""),H=yt(Dt({})),J=yt(0);const dt=Rt(()=>he(l(H))),d=Rt(()=>Object.keys(l(H)).length>0),Z=Rt(()=>[v.data.repo,v.data.id,...v.data.filePath.split("/")]);let $=yt("");Ft(()=>{const b=`${v.data.repo}/${v.data.type}/${v.data.id}/${v.data.filePath}`;if(b!==l($)){if(l($)&&ft.flush(),N($,b),l(F)||l(a)){const m=Ee(v.data.content);N(H,{...m.frontmatter},!0),N(W,m.content,!0)}else N(H,{},!0),N(W,v.data.content,!0);te(J),ft.reset()}}),Ft(()=>{It.select(v.data.repo,v.data.type,v.data.id,v.data.filePath),It.showEntity()});function st(b){return/[\[\]{}'":,#|>&*!?]/.test(b)||/^\s|\s$/.test(b)}function at(){if(l(d)){const b=[];for(const[m,t]of Object.entries(l(H)))if(Array.isArray(t)){b.push(`${m}:`);for(const e of t){const r=String(e);b.push(` - ${st(r)?`'${r}'`:r}`)}}else{const e=String(t??"");b.push(`${m}: ${st(e)?`'${e}'`:e}`)}return`---
13
+ ${b.join(`
14
+ `)}
15
+ ---
16
+ ${l(W)}`}return l(W)}function L(){const b=at();ft.scheduleContentFileSave(v.data.repo,v.data.type,v.data.id,v.data.filePath,b)}function vt(b){N(W,b,!0),L()}function ot(b,m){N(H,{...l(H),[b]:m},!0),L()}function mt(b){const{[b]:m,...t}=l(H);N(H,t,!0),L()}function ct(b,m){N(H,{...l(H),[b]:m},!0),L()}function pt(b,m){L()}function _t(b){for(const m of Vt.repos){const t=m.entities.find(e=>e.id===b);if(t){se(`/${m.name}/${t.entityType}/${t.id}`);return}}}function lt(b){(b.metaKey||b.ctrlKey)&&b.key==="s"&&(b.preventDefault(),ft.flush())}Xt("keydown",ee,lt),ie(O,{children:(b,m)=>{var t=Ae(),e=U(t),r=U(e);ae(r,{activeView:"entity"});var s=X(r,2),i=U(s);St(i,21,()=>l(Z),Ot,(g,A,B)=>{var k=Se(),C=re(k);{var P=K=>{var x=Re();nt(K,x)};Et(C,K=>{B>0&&K(P)})}var p=X(C),j=U(p,!0);z(p),At(()=>{Jt(p,1,Zt(B===l(Z).length-1?"bc-current":"bc-segment"),"svelte-xtfs5g"),Mt(j,l(A))}),nt(g,k)}),z(i);var y=X(i,2),M=U(y);{var u=g=>{var A=Oe();nt(g,A)},h=g=>{var A=xe(),B=U(A,!0);z(A),At(()=>Mt(B,ft.error)),nt(g,A)};Et(M,g=>{ft.saving?g(u):ft.error&&g(h,1)})}z(y),z(s);var n=X(s,2),R=U(n);{var f=g=>{le(g,{get properties(){return l(dt)},editable:!0,onedit:ot,onremove:mt,onadd:ct,ontypechange:pt})};Et(R,g=>{l(d)&&g(f)})}var q=X(R,2);{var _=g=>{be(g,{get content(){return l(W)},onchange:vt,onsave:()=>ft.flush()})},c=g=>{ue(g,{get content(){return l(W)},readonly:!1,onchange:vt,onsave:()=>ft.flush(),onwikilinkclick:_t,get resetKey(){return l(J)}})};Et(q,g=>{l(a)?g(_):g(c,!1)})}z(n),z(e);var o=X(e,2);{var D=g=>{oe(g,{})};Et(o,g=>{w.open&&g(D)})}z(t),nt(b,t)},$$slots:{default:!0}}),Bt()}export{We as component,Ie as universal};
@@ -0,0 +1,4 @@
1
+ import{f as dt,b as G,w as ut}from"../chunks/YFT1281h.js";import{a as k,f as M,d as ft}from"../chunks/hHxe9oXh.js";import{n as Z,A as $,S as mt,t as H,u as T,F as v,w as F,x as I,q as tt,P as J,T as S,V as ht,Y as vt}from"../chunks/fwnBoL5x.js";import{s as et}from"../chunks/BiubvAUI.js";import{b as Q,i as O}from"../chunks/BButMJ6M.js";import{n as X,A as yt}from"../chunks/B0nldqWF.js";import{g as pt}from"../chunks/DPmdIe6Y.js";const bt=async({params:g})=>{const{repo:o,type:l,id:c}=g,f=await dt(o,l,c);return{repo:o,type:l,id:c,entity:f}},Ht=Object.freeze(Object.defineProperty({__proto__:null,load:bt},Symbol.toStringTag,{value:"Module"}));var gt=M('<div class="loading-indicator svelte-1fltv0h">Loading editor...</div>'),wt=M('<div class="error-indicator svelte-1fltv0h"> </div>'),_t=M('<div><div class="header-mount svelte-1fltv0h"></div> <!> <!> <div></div></div>');function At(g,o){Z(o,!0);let l,c,f=J(!0),m=J(null),p=[],b=[],w=[],d={},y=[],h=null,_=null,A=0;function j(){const e=window.StudioChrome,i=document.querySelector(".sg-chrome-overflow-menu");if(i&&(i.innerHTML=""),e&&(e.clearViewAction(),e.clearSaveHandlers()),_&&(_.el.removeEventListener("click",_.handler,!0),_=null),e){e.unmountHeader();for(const{event:r,fn:s}of w)e.off(r,s)}w=[];for(const r of p)r.remove();p=[];for(const r of b)r.remove();b=[],h&&(h.remove(),h=null);for(const[r,s]of Object.entries(d))s===void 0?document.body.removeAttribute(r):document.body.setAttribute(r,s);d={};for(const r of y)document.body.classList.remove(r);y=[],c&&(c.innerHTML="")}async function q(){const e=++A;S(f,!0),S(m,null),j();try{const i=`${o.appMountPath}/edit/${encodeURIComponent(o.repo)}/${encodeURIComponent(o.entityId)}`,r=await fetch(i);if(!r.ok)throw new Error(`Failed to load editor: ${r.status}`);if(e!==A)return;const s=await r.text(),P=new DOMParser().parseFromString(s,"text/html"),at=P.querySelectorAll('link[rel="stylesheet"]');for(const t of at){if(t.href.includes("chrome.css"))continue;let n=t.getAttribute("href")||"";n&&!n.startsWith("http")&&!n.startsWith("/")&&(n=`${o.appMountPath}/${n}`);const a=document.createElement("link");a.rel="stylesheet",a.href=n,document.head.appendChild(a),p.push(a)}const it=P.querySelectorAll("head style");for(const t of it){const n=document.createElement("style");n.textContent=t.textContent,document.head.appendChild(n),p.push(n)}h=document.createElement("style"),h.textContent=`
2
+ body.sg-chrome-active { height: auto !important; }
3
+ body.sg-chrome-active > :not(.sg-chrome-header):not(.sg-chrome-footer) { overflow: visible !important; }
4
+ `,document.head.appendChild(h);const L=P.body;for(const t of Array.from(L.attributes))t.name.startsWith("data-")&&(d[t.name]=document.body.getAttribute(t.name)??void 0,document.body.setAttribute(t.name,t.value));const st=Array.from(L.classList);for(const t of st)t!=="sg-chrome-active"&&(document.body.classList.contains(t)||(document.body.classList.add(t),y.push(t)));const ct=L.querySelectorAll("script"),R=[],K=[];for(const t of ct){if(t.src){const n=t.getAttribute("src")||"";if(n.includes("chrome.js"))continue;let a=n;a&&!a.startsWith("http")&&!a.startsWith("/")&&(a=`${o.appMountPath}/${a}`),R.push(a)}else t.textContent&&K.push(t.textContent);t.remove()}c.innerHTML=L.innerHTML;const u=window.StudioChrome;if(u){u.updateBreadcrumb(o.repo,o.entityId),u.mountHeader(l);const t=document.body.dataset.sgViewUrl,n=document.body.dataset.sgViewLabel;t?u.setViewAction(t,n):u.clearViewAction();const a=l.querySelector(".sg-chrome-back");if(a){const N=Y=>{Y.preventDefault(),Y.stopPropagation(),pt(`/${o.repo}/${o.entityType}/${o.entityId}`)};a.addEventListener("click",N,!0),_={el:a,handler:N}}}let E=null;u&&(E=u.on,u.on=function(t,n){w.push({event:t,fn:n}),E.call(this,t,n)});const lt=`?_v=${Date.now()}`;for(const t of R){if(e!==A)return;await ot(t+lt)}for(const t of K){if(e!==A)return;const n=document.createElement("script");n.textContent=t,document.body.appendChild(n),b.push(n)}u&&E&&(u.on=E),S(f,!1)}catch(i){if(e!==A)return;S(m,i.message||"Failed to load editor",!0),S(f,!1)}}function ot(e){return new Promise((i,r)=>{const s=document.createElement("script");s.src=e,s.onload=()=>i(),s.onerror=()=>r(new Error(`Failed to load script: ${e}`)),document.body.appendChild(s),b.push(s)})}let x="";$(()=>{const e=`${o.appMountPath}|${o.repo}|${o.entityId}`;x&&x!==e&&c&&q(),x=e}),mt(()=>(q(),j));var C=_t();let V;var B=H(C);Q(B,e=>l=e,()=>l);var W=T(B,2);{var nt=e=>{var i=gt();k(e,i)};O(W,e=>{v(f)&&e(nt)})}var U=T(W,2);{var rt=e=>{var i=wt(),r=H(i,!0);F(i),I(()=>et(r,v(m))),k(e,i)};O(U,e=>{v(m)&&e(rt)})}var D=T(U,2);let z;Q(D,e=>c=e,()=>c),F(C),I(()=>{V=G(C,1,"editor-frame svelte-1fltv0h",null,V,{loading:v(f)}),z=G(D,1,"editor-container svelte-1fltv0h",null,z,{hidden:v(f)||!!v(m)})}),k(g,C),tt()}var St=M('<div class="no-editor svelte-bzivfp"> </div>');function Ft(g,o){Z(o,!0);const l=vt(()=>ut.getAppForEntityType(o.data.type));$(()=>{X.select(o.data.repo,o.data.type,o.data.id),X.showEntity()}),yt(g,{showSidebar:!1,children:(c,f)=>{var m=ft(),p=ht(m);{var b=d=>{At(d,{get appMountPath(){return v(l).mountPath},get repo(){return o.data.repo},get entityId(){return o.data.id},get entityType(){return o.data.type}})},w=d=>{var y=St(),h=H(y);F(y),I(()=>et(h,`No app editor available for entity type "${o.data.type??""}"`)),k(d,y)};O(p,d=>{v(l)?d(b):d(w,!1)})}k(c,m)},$$slots:{default:!0}}),tt()}export{Ft as component,Ht as universal};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../chunks/BB_5th5W.js","../chunks/PPVm8Dsz.js","../chunks/CqkleIqs.js"])))=>i.map(i=>d[i]);
2
+ import{i as Te,b as De,j as ee,w as ne}from"../chunks/YFT1281h.js";import{g as Se,j as Nt,a as Ht,f as Bt,e as ie}from"../chunks/hHxe9oXh.js";import{n as he,o as de,A as vt,F as D,Y as wt,S as Ee,bc as ze,x as re,q as ge,t as st,u as St,w as et,T as At,P as oe}from"../chunks/fwnBoL5x.js";import{p as Tt,b as Pe,i as ke}from"../chunks/BButMJ6M.js";import{c as yt,e as Fe,i as Re,n as Yt,A as Oe}from"../chunks/B0nldqWF.js";import{V as je,c as Ge,C as Le}from"../chunks/DsERsGWg.js";import{_ as Xe}from"../chunks/PPVm8Dsz.js";import{s as ae}from"../chunks/BiubvAUI.js";import{g as Ye}from"../chunks/DPmdIe6Y.js";function He(){return Te("/api/graph")}const Ve=async()=>({graphData:await He()}),Hn=Object.freeze(Object.defineProperty({__proto__:null,load:Ve},Symbol.toStringTag,{value:"Module"}));function Ue(t,e){var n,i=1;t==null&&(t=0),e==null&&(e=0);function r(){var o,c=n.length,d,w=0,a=0;for(o=0;o<c;++o)d=n[o],w+=d.x,a+=d.y;for(w=(w/c-t)*i,a=(a/c-e)*i,o=0;o<c;++o)d=n[o],d.x-=w,d.y-=a}return r.initialize=function(o){n=o},r.x=function(o){return arguments.length?(t=+o,r):t},r.y=function(o){return arguments.length?(e=+o,r):e},r.strength=function(o){return arguments.length?(i=+o,r):i},r}function Be(t){const e=+this._x.call(null,t),n=+this._y.call(null,t);return pe(this.cover(e,n),e,n,t)}function pe(t,e,n,i){if(isNaN(e)||isNaN(n))return t;var r,o=t._root,c={data:i},d=t._x0,w=t._y0,a=t._x1,y=t._y1,_,x,l,M,f,s,u,g;if(!o)return t._root=c,t;for(;o.length;)if((f=e>=(_=(d+a)/2))?d=_:a=_,(s=n>=(x=(w+y)/2))?w=x:y=x,r=o,!(o=o[u=s<<1|f]))return r[u]=c,t;if(l=+t._x.call(null,o.data),M=+t._y.call(null,o.data),e===l&&n===M)return c.next=o,r?r[u]=c:t._root=c,t;do r=r?r[u]=new Array(4):t._root=new Array(4),(f=e>=(_=(d+a)/2))?d=_:a=_,(s=n>=(x=(w+y)/2))?w=x:y=x;while((u=s<<1|f)===(g=(M>=x)<<1|l>=_));return r[g]=o,r[u]=c,t}function We(t){var e,n,i=t.length,r,o,c=new Array(i),d=new Array(i),w=1/0,a=1/0,y=-1/0,_=-1/0;for(n=0;n<i;++n)isNaN(r=+this._x.call(null,e=t[n]))||isNaN(o=+this._y.call(null,e))||(c[n]=r,d[n]=o,r<w&&(w=r),r>y&&(y=r),o<a&&(a=o),o>_&&(_=o));if(w>y||a>_)return this;for(this.cover(w,a).cover(y,_),n=0;n<i;++n)pe(this,c[n],d[n],t[n]);return this}function Qe(t,e){if(isNaN(t=+t)||isNaN(e=+e))return this;var n=this._x0,i=this._y0,r=this._x1,o=this._y1;if(isNaN(n))r=(n=Math.floor(t))+1,o=(i=Math.floor(e))+1;else{for(var c=r-n||1,d=this._root,w,a;n>t||t>=r||i>e||e>=o;)switch(a=(e<i)<<1|t<n,w=new Array(4),w[a]=d,d=w,c*=2,a){case 0:r=n+c,o=i+c;break;case 1:n=r-c,o=i+c;break;case 2:r=n+c,i=o-c;break;case 3:n=r-c,i=o-c;break}this._root&&this._root.length&&(this._root=d)}return this._x0=n,this._y0=i,this._x1=r,this._y1=o,this}function Ke(){var t=[];return this.visit(function(e){if(!e.length)do t.push(e.data);while(e=e.next)}),t}function Je(t){return arguments.length?this.cover(+t[0][0],+t[0][1]).cover(+t[1][0],+t[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}function U(t,e,n,i,r){this.node=t,this.x0=e,this.y0=n,this.x1=i,this.y1=r}function Ze(t,e,n){var i,r=this._x0,o=this._y0,c,d,w,a,y=this._x1,_=this._y1,x=[],l=this._root,M,f;for(l&&x.push(new U(l,r,o,y,_)),n==null?n=1/0:(r=t-n,o=e-n,y=t+n,_=e+n,n*=n);M=x.pop();)if(!(!(l=M.node)||(c=M.x0)>y||(d=M.y0)>_||(w=M.x1)<r||(a=M.y1)<o))if(l.length){var s=(c+w)/2,u=(d+a)/2;x.push(new U(l[3],s,u,w,a),new U(l[2],c,u,s,a),new U(l[1],s,d,w,u),new U(l[0],c,d,s,u)),(f=(e>=u)<<1|t>=s)&&(M=x[x.length-1],x[x.length-1]=x[x.length-1-f],x[x.length-1-f]=M)}else{var g=t-+this._x.call(null,l.data),b=e-+this._y.call(null,l.data),p=g*g+b*b;if(p<n){var C=Math.sqrt(n=p);r=t-C,o=e-C,y=t+C,_=e+C,i=l.data}}return i}function qe(t){if(isNaN(y=+this._x.call(null,t))||isNaN(_=+this._y.call(null,t)))return this;var e,n=this._root,i,r,o,c=this._x0,d=this._y0,w=this._x1,a=this._y1,y,_,x,l,M,f,s,u;if(!n)return this;if(n.length)for(;;){if((M=y>=(x=(c+w)/2))?c=x:w=x,(f=_>=(l=(d+a)/2))?d=l:a=l,e=n,!(n=n[s=f<<1|M]))return this;if(!n.length)break;(e[s+1&3]||e[s+2&3]||e[s+3&3])&&(i=e,u=s)}for(;n.data!==t;)if(r=n,!(n=n.next))return this;return(o=n.next)&&delete n.next,r?(o?r.next=o:delete r.next,this):e?(o?e[s]=o:delete e[s],(n=e[0]||e[1]||e[2]||e[3])&&n===(e[3]||e[2]||e[1]||e[0])&&!n.length&&(i?i[u]=n:this._root=n),this):(this._root=o,this)}function $e(t){for(var e=0,n=t.length;e<n;++e)this.remove(t[e]);return this}function tn(){return this._root}function en(){var t=0;return this.visit(function(e){if(!e.length)do++t;while(e=e.next)}),t}function nn(t){var e=[],n,i=this._root,r,o,c,d,w;for(i&&e.push(new U(i,this._x0,this._y0,this._x1,this._y1));n=e.pop();)if(!t(i=n.node,o=n.x0,c=n.y0,d=n.x1,w=n.y1)&&i.length){var a=(o+d)/2,y=(c+w)/2;(r=i[3])&&e.push(new U(r,a,y,d,w)),(r=i[2])&&e.push(new U(r,o,y,a,w)),(r=i[1])&&e.push(new U(r,a,c,d,y)),(r=i[0])&&e.push(new U(r,o,c,a,y))}return this}function rn(t){var e=[],n=[],i;for(this._root&&e.push(new U(this._root,this._x0,this._y0,this._x1,this._y1));i=e.pop();){var r=i.node;if(r.length){var o,c=i.x0,d=i.y0,w=i.x1,a=i.y1,y=(c+w)/2,_=(d+a)/2;(o=r[0])&&e.push(new U(o,c,d,y,_)),(o=r[1])&&e.push(new U(o,y,d,w,_)),(o=r[2])&&e.push(new U(o,c,_,y,a)),(o=r[3])&&e.push(new U(o,y,_,w,a))}n.push(i)}for(;i=n.pop();)t(i.node,i.x0,i.y0,i.x1,i.y1);return this}function on(t){return t[0]}function an(t){return arguments.length?(this._x=t,this):this._x}function sn(t){return t[1]}function ln(t){return arguments.length?(this._y=t,this):this._y}function Wt(t,e,n){var i=new Qt(e??on,n??sn,NaN,NaN,NaN,NaN);return t==null?i:i.addAll(t)}function Qt(t,e,n,i,r,o){this._x=t,this._y=e,this._x0=n,this._y0=i,this._x1=r,this._y1=o,this._root=void 0}function se(t){for(var e={data:t.data},n=e;t=t.next;)n=n.next={data:t.data};return e}var B=Wt.prototype=Qt.prototype;B.copy=function(){var t=new Qt(this._x,this._y,this._x0,this._y0,this._x1,this._y1),e=this._root,n,i;if(!e)return t;if(!e.length)return t._root=se(e),t;for(n=[{source:e,target:t._root=new Array(4)}];e=n.pop();)for(var r=0;r<4;++r)(i=e.source[r])&&(i.length?n.push({source:i,target:e.target[r]=new Array(4)}):e.target[r]=se(i));return t};B.add=Be;B.addAll=We;B.cover=Qe;B.data=Ke;B.extent=Je;B.find=Ze;B.remove=qe;B.removeAll=$e;B.root=tn;B.size=en;B.visit=nn;B.visitAfter=rn;B.x=an;B.y=ln;function lt(t){return function(){return t}}function nt(t){return(t()-.5)*1e-6}function fn(t){return t.x+t.vx}function cn(t){return t.y+t.vy}function un(t){var e,n,i,r=1,o=1;typeof t!="function"&&(t=lt(t==null?1:+t));function c(){for(var a,y=e.length,_,x,l,M,f,s,u=0;u<o;++u)for(_=Wt(e,fn,cn).visitAfter(d),a=0;a<y;++a)x=e[a],f=n[x.index],s=f*f,l=x.x+x.vx,M=x.y+x.vy,_.visit(g);function g(b,p,C,k,G){var F=b.data,W=b.r,R=f+W;if(F){if(F.index>x.index){var L=l-F.x-F.vx,q=M-F.y-F.vy,Y=L*L+q*q;Y<R*R&&(L===0&&(L=nt(i),Y+=L*L),q===0&&(q=nt(i),Y+=q*q),Y=(R-(Y=Math.sqrt(Y)))/Y*r,x.vx+=(L*=Y)*(R=(W*=W)/(s+W)),x.vy+=(q*=Y)*R,F.vx-=L*(R=1-R),F.vy-=q*R)}return}return p>l+R||k<l-R||C>M+R||G<M-R}}function d(a){if(a.data)return a.r=n[a.data.index];for(var y=a.r=0;y<4;++y)a[y]&&a[y].r>a.r&&(a.r=a[y].r)}function w(){if(e){var a,y=e.length,_;for(n=new Array(y),a=0;a<y;++a)_=e[a],n[_.index]=+t(_,a,e)}}return c.initialize=function(a,y){e=a,i=y,w()},c.iterations=function(a){return arguments.length?(o=+a,c):o},c.strength=function(a){return arguments.length?(r=+a,c):r},c.radius=function(a){return arguments.length?(t=typeof a=="function"?a:lt(+a),w(),c):t},c}function hn(t){return t.index}function le(t,e){var n=t.get(e);if(!n)throw new Error("node not found: "+e);return n}function dn(t){var e=hn,n=_,i,r=lt(30),o,c,d,w,a,y=1;t==null&&(t=[]);function _(s){return 1/Math.min(d[s.source.index],d[s.target.index])}function x(s){for(var u=0,g=t.length;u<y;++u)for(var b=0,p,C,k,G,F,W,R;b<g;++b)p=t[b],C=p.source,k=p.target,G=k.x+k.vx-C.x-C.vx||nt(a),F=k.y+k.vy-C.y-C.vy||nt(a),W=Math.sqrt(G*G+F*F),W=(W-o[b])/W*s*i[b],G*=W,F*=W,k.vx-=G*(R=w[b]),k.vy-=F*R,C.vx+=G*(R=1-R),C.vy+=F*R}function l(){if(c){var s,u=c.length,g=t.length,b=new Map(c.map((C,k)=>[e(C,k,c),C])),p;for(s=0,d=new Array(u);s<g;++s)p=t[s],p.index=s,typeof p.source!="object"&&(p.source=le(b,p.source)),typeof p.target!="object"&&(p.target=le(b,p.target)),d[p.source.index]=(d[p.source.index]||0)+1,d[p.target.index]=(d[p.target.index]||0)+1;for(s=0,w=new Array(g);s<g;++s)p=t[s],w[s]=d[p.source.index]/(d[p.source.index]+d[p.target.index]);i=new Array(g),M(),o=new Array(g),f()}}function M(){if(c)for(var s=0,u=t.length;s<u;++s)i[s]=+n(t[s],s,t)}function f(){if(c)for(var s=0,u=t.length;s<u;++s)o[s]=+r(t[s],s,t)}return x.initialize=function(s,u){c=s,a=u,l()},x.links=function(s){return arguments.length?(t=s,l(),x):t},x.id=function(s){return arguments.length?(e=s,x):e},x.iterations=function(s){return arguments.length?(y=+s,x):y},x.strength=function(s){return arguments.length?(n=typeof s=="function"?s:lt(+s),M(),x):n},x.distance=function(s){return arguments.length?(r=typeof s=="function"?s:lt(+s),f(),x):r},x}var gn={value:()=>{}};function ve(){for(var t=0,e=arguments.length,n={},i;t<e;++t){if(!(i=arguments[t]+"")||i in n||/[\s.]/.test(i))throw new Error("illegal type: "+i);n[i]=[]}return new Dt(n)}function Dt(t){this._=t}function pn(t,e){return t.trim().split(/^|\s+/).map(function(n){var i="",r=n.indexOf(".");if(r>=0&&(i=n.slice(r+1),n=n.slice(0,r)),n&&!e.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:i}})}Dt.prototype=ve.prototype={constructor:Dt,on:function(t,e){var n=this._,i=pn(t+"",n),r,o=-1,c=i.length;if(arguments.length<2){for(;++o<c;)if((r=(t=i[o]).type)&&(r=vn(n[r],t.name)))return r;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++o<c;)if(r=(t=i[o]).type)n[r]=fe(n[r],t.name,e);else if(e==null)for(r in n)n[r]=fe(n[r],t.name,null);return this},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new Dt(t)},call:function(t,e){if((r=arguments.length-2)>0)for(var n=new Array(r),i=0,r,o;i<r;++i)n[i]=arguments[i+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(o=this._[t],i=0,r=o.length;i<r;++i)o[i].value.apply(e,n)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var i=this._[t],r=0,o=i.length;r<o;++r)i[r].value.apply(e,n)}};function vn(t,e){for(var n=0,i=t.length,r;n<i;++n)if((r=t[n]).name===e)return r.value}function fe(t,e,n){for(var i=0,r=t.length;i<r;++i)if(t[i].name===e){t[i]=gn,t=t.slice(0,i).concat(t.slice(i+1));break}return n!=null&&t.push({name:e,value:n}),t}var ut=0,_t=0,xt=0,ye=1e3,Et,mt,zt=0,ft=0,Pt=0,bt=typeof performance=="object"&&performance.now?performance:Date,xe=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function we(){return ft||(xe(yn),ft=bt.now()+Pt)}function yn(){ft=0}function Vt(){this._call=this._time=this._next=null}Vt.prototype=_e.prototype={constructor:Vt,restart:function(t,e,n){if(typeof t!="function")throw new TypeError("callback is not a function");n=(n==null?we():+n)+(e==null?0:+e),!this._next&&mt!==this&&(mt?mt._next=this:Et=this,mt=this),this._call=t,this._time=n,Ut()},stop:function(){this._call&&(this._call=null,this._time=1/0,Ut())}};function _e(t,e,n){var i=new Vt;return i.restart(t,e,n),i}function xn(){we(),++ut;for(var t=Et,e;t;)(e=ft-t._time)>=0&&t._call.call(void 0,e),t=t._next;--ut}function ce(){ft=(zt=bt.now())+Pt,ut=_t=0;try{xn()}finally{ut=0,_n(),ft=0}}function wn(){var t=bt.now(),e=t-zt;e>ye&&(Pt-=e,zt=t)}function _n(){for(var t,e=Et,n,i=1/0;e;)e._call?(i>e._time&&(i=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:Et=n);mt=t,Ut(i)}function Ut(t){if(!ut){_t&&(_t=clearTimeout(_t));var e=t-ft;e>24?(t<1/0&&(_t=setTimeout(ce,t-bt.now()-Pt)),xt&&(xt=clearInterval(xt))):(xt||(zt=bt.now(),xt=setInterval(wn,ye)),ut=1,xe(ce))}}const mn=1664525,bn=1013904223,ue=4294967296;function Mn(){let t=1;return()=>(t=(mn*t+bn)%ue)/ue}function In(t){return t.x}function Cn(t){return t.y}var Nn=10,An=Math.PI*(3-Math.sqrt(5));function Tn(t){var e,n=1,i=.001,r=1-Math.pow(i,1/300),o=0,c=.6,d=new Map,w=_e(_),a=ve("tick","end"),y=Mn();t==null&&(t=[]);function _(){x(),a.call("tick",e),n<i&&(w.stop(),a.call("end",e))}function x(f){var s,u=t.length,g;f===void 0&&(f=1);for(var b=0;b<f;++b)for(n+=(o-n)*r,d.forEach(function(p){p(n)}),s=0;s<u;++s)g=t[s],g.fx==null?g.x+=g.vx*=c:(g.x=g.fx,g.vx=0),g.fy==null?g.y+=g.vy*=c:(g.y=g.fy,g.vy=0);return e}function l(){for(var f=0,s=t.length,u;f<s;++f){if(u=t[f],u.index=f,u.fx!=null&&(u.x=u.fx),u.fy!=null&&(u.y=u.fy),isNaN(u.x)||isNaN(u.y)){var g=Nn*Math.sqrt(.5+f),b=f*An;u.x=g*Math.cos(b),u.y=g*Math.sin(b)}(isNaN(u.vx)||isNaN(u.vy))&&(u.vx=u.vy=0)}}function M(f){return f.initialize&&f.initialize(t,y),f}return l(),e={tick:x,restart:function(){return w.restart(_),e},stop:function(){return w.stop(),e},nodes:function(f){return arguments.length?(t=f,l(),d.forEach(M),e):t},alpha:function(f){return arguments.length?(n=+f,e):n},alphaMin:function(f){return arguments.length?(i=+f,e):i},alphaDecay:function(f){return arguments.length?(r=+f,e):+r},alphaTarget:function(f){return arguments.length?(o=+f,e):o},velocityDecay:function(f){return arguments.length?(c=1-f,e):1-c},randomSource:function(f){return arguments.length?(y=f,d.forEach(M),e):y},force:function(f,s){return arguments.length>1?(s==null?d.delete(f):d.set(f,M(s)),e):d.get(f)},find:function(f,s,u){var g=0,b=t.length,p,C,k,G,F;for(u==null?u=1/0:u*=u,g=0;g<b;++g)G=t[g],p=f-G.x,C=s-G.y,k=p*p+C*C,k<u&&(F=G,u=k);return F},on:function(f,s){return arguments.length>1?(a.on(f,s),e):a.on(f)}}}function Dn(){var t,e,n,i,r=lt(-30),o,c=1,d=1/0,w=.81;function a(l){var M,f=t.length,s=Wt(t,In,Cn).visitAfter(_);for(i=l,M=0;M<f;++M)e=t[M],s.visit(x)}function y(){if(t){var l,M=t.length,f;for(o=new Array(M),l=0;l<M;++l)f=t[l],o[f.index]=+r(f,l,t)}}function _(l){var M=0,f,s,u=0,g,b,p;if(l.length){for(g=b=p=0;p<4;++p)(f=l[p])&&(s=Math.abs(f.value))&&(M+=f.value,u+=s,g+=s*f.x,b+=s*f.y);l.x=g/u,l.y=b/u}else{f=l,f.x=f.data.x,f.y=f.data.y;do M+=o[f.data.index];while(f=f.next)}l.value=M}function x(l,M,f,s){if(!l.value)return!0;var u=l.x-e.x,g=l.y-e.y,b=s-M,p=u*u+g*g;if(b*b/w<p)return p<d&&(u===0&&(u=nt(n),p+=u*u),g===0&&(g=nt(n),p+=g*g),p<c&&(p=Math.sqrt(c*p)),e.vx+=u*l.value*i/p,e.vy+=g*l.value*i/p),!0;if(l.length||p>=d)return;(l.data!==e||l.next)&&(u===0&&(u=nt(n),p+=u*u),g===0&&(g=nt(n),p+=g*g),p<c&&(p=Math.sqrt(c*p)));do l.data!==e&&(b=o[l.data.index]*i/p,e.vx+=u*b,e.vy+=g*b);while(l=l.next)}return a.initialize=function(l,M){t=l,n=M,y()},a.strength=function(l){return arguments.length?(r=typeof l=="function"?l:lt(+l),y(),a):r},a.distanceMin=function(l){return arguments.length?(c=l*l,a):Math.sqrt(c)},a.distanceMax=function(l){return arguments.length?(d=l*l,a):Math.sqrt(d)},a.theta=function(l){return arguments.length?(w=l*l,a):Math.sqrt(w)},a}var Sn=Bt('<div><span class="legend-dot svelte-1i33fky"></span> <span class="legend-label svelte-1i33fky"> </span> <span class="legend-count svelte-1i33fky"> </span></div>'),En=Bt('<div class="graph-view svelte-1i33fky"><div class="canvas-wrap svelte-1i33fky"><div class="legend-panel svelte-1i33fky"></div></div></div>');function zn(t,e){he(e,!0);let n=Tt(e,"selectedEntityId",3,null),i=Tt(e,"filteredIds",3,null),r=Tt(e,"sidebarHoveredId",3,null),o=Tt(e,"highlightedIds",3,null);function c(h){return e.nameMap?.get(h)??h.replace(/-/g," ").replace(/\b\w/g,m=>m.toUpperCase())}const d=de("theme"),w=wt(()=>d.current==="light"?{default:14211288,dim:15263976,conn:12632256,labelText:1710623}:{default:2763306,dim:1315860,conn:4210752,labelText:15592943}),a=wt(()=>d.current==="light"?16316666:592139),y=.75;vt(()=>{d.current,Q&&(Q.style.fill=D(w).labelText);const h=D(jt);for(const m of l)yt(m.type)===gt&&(m.color=h);X()}),vt(()=>{i(),X()}),vt(()=>{o(),X()}),vt(()=>{n(),X()}),vt(()=>{const h=r();if(h){const m=l.find(v=>v.id===h)??null;p=m,Ft(),K=m?1:0}else C||(K=0);X()});let _,x=null,l=[],M=[],f=!1,s=0,u=0,g=0,b=1,p=null,C=null,k=oe(!1),G=0,F=0,W=0,R=0,L=new Set,q=!1,Y=oe(null),tt=0,K=0;const Kt=4;let H=null,ht=null,dt=null,Mt=null,Jt=new Map,J=null,Q=null,Z=null;function me(h){return Math.max(2,Math.min(2*Math.sqrt(h+1),10))}function kt(h,m){const v=_.getBoundingClientRect();return{x:(h-v.left-u)/b,y:(m-v.top-g)/b}}function Zt(h,m){for(let v=l.length-1;v>=0;v--){const N=l[v],S=h-N.x,P=m-N.y,E=(N.r*1.5+4)/b;if(S*S+P*P<=E*E)return N}return null}function Ft(){const h=p??null;if(L.clear(),!!h){L.add(h.id);for(const m of M)m.source.id===h.id&&L.add(m.target.id),m.target.id===h.id&&L.add(m.source.id)}}function qt(){if(l.length===0||!_)return;let h=1/0,m=-1/0,v=1/0,N=-1/0,S=0;for(const z of l)z.x<h&&(h=z.x),z.x>m&&(m=z.x),z.y<v&&(v=z.y),z.y>N&&(N=z.y),z.r>S&&(S=z.r);const P=_.clientWidth,E=_.clientHeight,O=m-h,V=N-v;if(O===0||V===0)return;const $=(60+S)*2;b=Math.min((P-$)/O,(E-$)/V,3),u=P/2-(h+m)/2*b,g=E/2-(v+N)/2*b,X()}function X(){f=!0,s=0}function Rt(h){return parseInt(h.replace("#",""),16)}function it(h,m,v){const N=(h>>16&255)+v*((m>>16&255)-(h>>16&255)),S=(h>>8&255)+v*((m>>8&255)-(h>>8&255)),P=(h&255)+v*((m&255)-(h&255));return Math.round(N)<<16|Math.round(S)<<8|Math.round(P)}function be(){if(!Z||!ht||!dt)return;ht.clear(),dt.clear();const m=p!==null,v=tt,N=D(Y),S=o(),P=i(),E=D(w).default,O=D(w).dim,V=D(w).conn;for(let $=0;$<M.length;$++){const z=M[$],ct=z.source.x*b+u,A=z.source.y*b+g,T=z.target.x*b+u,ot=z.target.y*b+g,at=m&&v>.01&&L.has(z.source.id)&&L.has(z.target.id);let I=E;m&&v>.01?I=at?it(E,V,v):it(E,O,v):(N!==null||S!==null||P!==null)&&(I=O);const j=at?dt:ht;j.setStrokeStyle({width:1,color:I,alpha:1}),j.moveTo(ct,A),j.lineTo(T,ot),j.stroke()}}function Me(){if(!Z)return;const h=p,m=h!==null,v=tt,N=D(Y),S=o(),P=i(),E=!h&&n()?l.find(A=>A.id===n())??null:null,O=new Set;if(E){O.add(E.id);for(const A of M)A.source.id===E.id&&O.add(A.target.id),A.target.id===E.id&&O.add(A.source.id)}for(const A of l){const T=Jt.get(A.id);if(!T)continue;const ot=A.x*b+u,at=A.y*b+g;T.position.set(ot,at),T.scale.set(A.r/50),T.alpha=1;const I=Rt(A.color);if(E&&!h){const j=O.has(A.id);T.tint=j?I:it(I,D(a),y),T.zIndex=A===E?2:j?1:0}else{const j=A===h,Ct=m&&L.has(A.id),te=N!==null&&(N==="other"?yt(A.type)===gt:A.type===N);if(j&&v>.01)T.tint=I,T.scale.set(A.r*(1+v*.4)/50),T.zIndex=2;else if(Ct)T.tint=I,T.zIndex=1;else if(N!==null)T.tint=te?I:it(I,D(a),y),T.zIndex=te?1:0;else if(S!==null){const pt=S.has(A.id),Xt=pt?v*y:y;T.tint=it(I,D(a),Xt),T.zIndex=pt?1:0}else if(P!==null){const pt=P.has(A.id),Xt=pt?v*y:y;T.tint=it(I,D(a),Xt),T.zIndex=pt?1:0}else T.tint=it(I,D(a),v*y),T.zIndex=0}}const V=h??E,$=h?v>.01:!!E;if(V&&$&&J){J.visible=!0;const A=V.x*b+u,T=V.y*b+g;J.position.set(A,T),J.scale.set(V.r*5/64),J.alpha=h?v*.25:.25,J.tint=Rt(V.color)}else J&&(J.visible=!1);const z=h??E,ct=h?v>.01:!!E;if(z&&ct&&Q){const A=z.x*b+u,T=z.y*b+g;Q.text=c(z.id),Q.style.fontSize=12,Q.position.set(A,T+z.r+8),Q.alpha=h?v:1,Q.visible=!0}else Q&&(Q.visible=!1)}let It=!1;function Ie(h){if(h.button!==0)return;It=!1;const m=kt(h.clientX,h.clientY),v=Zt(m.x,m.y);v?(C=v,q=!0,v.fx=v.x,v.fy=v.y,x?.alphaTarget(.3).restart(),X()):(At(k,!0),G=h.clientX,F=h.clientY,W=u,R=g),_.setPointerCapture(h.pointerId),window.addEventListener("pointerup",Ot,{once:!0})}function Ce(h){if(C){It=!0;const m=kt(h.clientX,h.clientY);C.fx=m.x,C.fy=m.y,X()}else if(D(k))It=!0,u=W+(h.clientX-G),g=R+(h.clientY-F),X();else{const m=kt(h.clientX,h.clientY),v=Zt(m.x,m.y);v?v!==p?(p&&(tt=.15),p=v,Ft(),K=1,_.style.cursor="pointer",X()):K!==1&&(K=1,_.style.cursor="pointer",X()):K!==0&&(K=0,_.style.cursor="grab",X())}}function Ot(h){if(!C&&!D(k))return;window.removeEventListener("pointerup",Ot);const m=It;if(C){const v=C;C.fx=null,C.fy=null,x?.alphaTarget(0),C=null,K=0,X(),m||Ye(`/${v.repo}/${v.type}/${v.id}`)}else D(k)&&At(k,!1);try{_.releasePointerCapture(h.pointerId)}catch{}}const gt="#5c5c66",Ne="#b0b0b8",jt=wt(()=>d.current==="light"?Ne:gt),Ae=wt(()=>{const h=new Map;for(const N of e.graphData.nodes)h.set(N.type,(h.get(N.type)??0)+1);const m=[];let v=0;for(const[N,S]of h){const P=yt(N);P===gt?v+=S:m.push({name:N,color:P,count:S})}return m.sort((N,S)=>S.count-N.count),v>0&&m.push({name:"other",color:D(jt),count:v}),m});Ee(async()=>{Z=await Xe(()=>import("../chunks/BB_5th5W.js"),__vite__mapDeps([0,1,2]),import.meta.url),H=new Z.Application,await H.init({antialias:!0,resolution:window.devicePixelRatio||1,autoDensity:!0,backgroundAlpha:0,resizeTo:_}),_.insertBefore(H.canvas,_.firstChild),H.canvas.style.position="absolute",H.canvas.style.inset="0",ht=new Z.Graphics,H.stage.addChild(ht),dt=new Z.Graphics,H.stage.addChild(dt),Mt=new Z.Container,Mt.sortableChildren=!0,H.stage.addChild(Mt);const h=document.createElement("canvas");h.width=128,h.height=128;const m=h.getContext("2d"),v=m.createRadialGradient(64,64,0,64,64,64);v.addColorStop(0,"rgba(255,255,255,0.5)"),v.addColorStop(1,"rgba(255,255,255,0)"),m.fillStyle=v,m.fillRect(0,0,128,128);const N=Z.Texture.from(h);J=new Z.Sprite(N),J.anchor.set(.5),J.visible=!1,H.stage.addChild(J);const S=document.createElement("canvas");S.width=100,S.height=100;const P=S.getContext("2d");P.beginPath(),P.arc(50,50,48,0,Math.PI*2),P.fillStyle="#ffffff",P.fill();const E=Z.Texture.from(S),O=new Map;for(const I of e.graphData.edges)O.set(I.source,(O.get(I.source)??0)+1),O.set(I.target,(O.get(I.target)??0)+1);const V=new Map,z=3600*e.graphData.nodes.length,ct=Math.sqrt(z);l=e.graphData.nodes.map(I=>{const j=O.get(I.id)??0,Ct={id:I.id,type:I.type,repo:I.repo,color:yt(I.type)===gt?D(jt):yt(I.type),weight:j,x:(Math.random()-.5)*ct,y:(Math.random()-.5)*ct,vx:0,vy:0,r:me(j)};return V.set(I.id,Ct),Ct});for(const I of l){const j=new Z.Sprite(E);j.anchor.set(.5),j.tint=Rt(I.color),Mt.addChild(j),Jt.set(I.id,j)}Q=new Z.Text({text:"",style:{fontFamily:"Inter, system-ui, sans-serif",fontWeight:"500",fontSize:12,fill:D(w).labelText,align:"center"}}),Q.anchor.set(.5,0),Q.visible=!1,H.stage.addChild(Q);const A=e.graphData.edges.map(I=>({source:I.source,target:I.target})),T=dn(A).id(I=>I.id).distance(250);x=Tn(l).force("link",T).force("charge",Dn().strength(-1e3).distanceMin(30)).force("center",Ue(0,0)).force("collide",un().radius(60).strength(.5)).velocityDecay(.4).alpha(1).on("tick",()=>{q||qt(),X()}),M=T.links();let ot=0;H.ticker.add(()=>{const I=performance.now(),j=ot?Math.min((I-ot)/1e3,.05):.016;ot=I,tt<K?(tt=Math.min(K,tt+Kt*j),f=!0):tt>K&&(tt=Math.max(K,tt-Kt*j),f=!0),tt===0&&K===0&&p&&!C&&(p=null,Ft(),f=!0),(f||s<120)&&(be(),Me(),f=!1,s++)});const at=new ResizeObserver(()=>{H.renderer.resize(_.clientWidth,_.clientHeight),qt()});return at.observe(_),()=>{at.disconnect()}}),ze(()=>{x?.stop(),H&&(H.destroy(!0,{children:!0}),H=null)});var Gt=En(),rt=st(Gt);let $t;var Lt=st(rt);Fe(Lt,21,()=>D(Ae),Re,(h,m)=>{var v=Sn();let N;var S=st(v);let P;var E=St(S,2),O=st(E,!0);et(E);var V=St(E,2),$=st(V,!0);et(V),et(v),re(()=>{N=De(v,1,"legend-item svelte-1i33fky",null,N,{"legend-item-active":D(Y)===D(m).name}),P=ee(S,"",P,{background:D(m).color}),ae(O,D(m).name),ae($,D(m).count)}),ie("mouseenter",v,()=>{At(Y,D(m).name,!0),X()}),ie("mouseleave",v,()=>{At(Y,null),X()}),Ht(h,v)}),et(Lt),et(rt),Pe(rt,h=>_=h,()=>_),et(Gt),re(()=>$t=ee(rt,"",$t,{cursor:D(k)?"grabbing":"grab"})),Nt("pointerdown",rt,Ie),Nt("pointermove",rt,Ce),Nt("pointerup",rt,Ot),Nt("pointerdown",Lt,h=>h.stopPropagation()),Ht(t,Gt),ge()}Se(["pointerdown","pointermove","pointerup"]);var Pn=Bt('<div class="content-row svelte-315y67"><div class="graph-area svelte-315y67"><!> <!></div> <!></div>');function Vn(t,e){he(e,!0);const n=de("chat");Yt.showGraph();const i=wt(()=>{const r=new Map;for(const o of ne.repos)for(const c of o.entities)r.set(c.id,c.title);return r});Oe(t,{children:(r,o)=>{var c=Pn(),d=st(c),w=st(d);je(w,{activeView:"graph"});var a=St(w,2);zn(a,{get graphData(){return e.data.graphData},get selectedEntityId(){return Yt.selectedId},get nameMap(){return D(i)},get filteredIds(){return ne.filteredIds},get sidebarHoveredId(){return Yt.hoveredEntityId},get highlightedIds(){return Ge.highlightedIds}}),et(d);var y=St(d,2);{var _=x=>{Le(x,{})};ke(y,x=>{n.open&&x(_)})}et(c),Ht(r,c)},$$slots:{default:!0}}),ge()}export{Vn as component,Hn as universal};
@@ -0,0 +1 @@
1
+ {"version":"1773030977797"}