@hienlh/ppm 0.13.49 → 0.13.51

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 (133) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/assets/skills/ppm/SKILL.md +1 -1
  3. package/assets/skills/ppm/references/http-api.md +1 -1
  4. package/dist/web/assets/ai-settings-section-AuV6Lzz2.js +1 -2
  5. package/dist/web/assets/api-client-DIhJ5qVW.js +1 -2
  6. package/dist/web/assets/api-settings-C3T95dWg.js +1 -2
  7. package/dist/web/assets/arrow-up-Rcw6_KKu.js +1 -2
  8. package/dist/web/assets/{audio-preview-CQ-l5P8I.js → audio-preview-BQWWkcm0.js} +1 -2
  9. package/dist/web/assets/{chat-tab-DbuBr2ax.js → chat-tab-B-QMa-uT.js} +5 -6
  10. package/dist/web/assets/chevron-right-DnHIvvcy.js +1 -2
  11. package/dist/web/assets/code-DGBecc50.js +1 -2
  12. package/dist/web/assets/{code-editor-DEa0t62y.js → code-editor-DChspYxh.js} +3 -4
  13. package/dist/web/assets/{conflict-editor-D5H9urYy.js → conflict-editor-C1dZ8tsU.js} +2 -3
  14. package/dist/web/assets/createLucideIcon-BjHrJDVb.js +1 -2
  15. package/dist/web/assets/csv-parser-Dly5nqE1.js +1 -2
  16. package/dist/web/assets/csv-preview-B3Dyhgho.js +1 -2
  17. package/dist/web/assets/data-grid-overlay-editor-C1UUm7Ob.js +1 -2
  18. package/dist/web/assets/data-grid-types-D2cHE8hx.js +1 -2
  19. package/dist/web/assets/database-DOWH9-Vv.js +1 -2
  20. package/dist/web/assets/{database-viewer-CW60ytCl.js → database-viewer-2KW73oEG.js} +1 -2
  21. package/dist/web/assets/{diff-viewer-BfatMgWw.js → diff-viewer-BMla30lw.js} +2 -3
  22. package/dist/web/assets/dist-BoIkGNC8.js +1 -2
  23. package/dist/web/assets/dist-DVk8T0R5.js +1 -2
  24. package/dist/web/assets/esm-DCbn6xno.js +1 -2
  25. package/dist/web/assets/{extension-webview-DKSDoW_g.js → extension-webview-DpaCcCXq.js} +2 -3
  26. package/dist/web/assets/file-exclamation-point-BwzaQ50n.js +1 -2
  27. package/dist/web/assets/file-store-DOxcU_7s.js +1 -2
  28. package/dist/web/assets/{glide-data-grid-Bx48618B.js → glide-data-grid-D08bJMrD.js} +2 -3
  29. package/dist/web/assets/globe-B4Ilypbs.js +1 -2
  30. package/dist/web/assets/{image-preview-ClY2xl1B.js → image-preview-DVQkHkSo.js} +1 -2
  31. package/dist/web/assets/{index-DkQ6jVSH.js → index-U7GK_3ED.js} +4 -5
  32. package/dist/web/assets/input-_LFQwhzd.js +1 -2
  33. package/dist/web/assets/katex-C10ndCVt.js +1 -2
  34. package/dist/web/assets/keybindings-store-B9gpby19.js +1 -0
  35. package/dist/web/assets/lib-C2D8j3K3.js +1 -2
  36. package/dist/web/assets/{markdown-renderer-BmMmo0F-.js → markdown-renderer-B4_rx1aO.js} +2 -3
  37. package/dist/web/assets/notification-store-7WlicqzJ.js +1 -0
  38. package/dist/web/assets/number-overlay-editor-CyEqxXcg.js +1 -2
  39. package/dist/web/assets/{panel-store-Dy8-7E_g.js → panel-store-C8wwxBpn.js} +1 -2
  40. package/dist/web/assets/{pdf-preview-YylEP_Su.js → pdf-preview-D16LLBdq.js} +1 -2
  41. package/dist/web/assets/{port-forwarding-tab-COdo70kU.js → port-forwarding-tab-CoKoquJZ.js} +1 -2
  42. package/dist/web/assets/{postgres-viewer-3y9VshZZ.js → postgres-viewer-B45DfArf.js} +2 -3
  43. package/dist/web/assets/react-DMIOAtcX.js +1 -2
  44. package/dist/web/assets/refresh-cw-BjrAbUJe.js +1 -2
  45. package/dist/web/assets/scroll-area-BDi_FNzr.js +1 -2
  46. package/dist/web/assets/search-tM8K5zWU.js +1 -2
  47. package/dist/web/assets/settings-store-8FpQDjEA.js +1 -2
  48. package/dist/web/assets/{settings-tab-sYavdJk-.js → settings-tab-Dc8TBxJQ.js} +1 -1
  49. package/dist/web/assets/sparkles-CulWHe4c.js +1 -2
  50. package/dist/web/assets/{sql-query-editor-DlBYx1Ye.js → sql-query-editor-DMk0nmOO.js} +2 -3
  51. package/dist/web/assets/{sqlite-viewer-Bj8oPYho.js → sqlite-viewer-G81XimpL.js} +1 -2
  52. package/dist/web/assets/{tab-store-Dtg1_qL0.js → tab-store-CNas5Ny8.js} +1 -2
  53. package/dist/web/assets/table-BzjWcs87.js +1 -2
  54. package/dist/web/assets/{terminal-tab-B7ECmf95.js → terminal-tab-rslAfxoV.js} +2 -3
  55. package/dist/web/assets/text-wrap-DJz9Bgpa.js +1 -2
  56. package/dist/web/assets/use-blob-url-DB4nNruT.js +1 -2
  57. package/dist/web/assets/use-monaco-theme-DEI-tJAh.js +1 -2
  58. package/dist/web/assets/utils-CQux7CsO.js +1 -2
  59. package/dist/web/assets/vendor-markdown-0Mxgxy0L.js +1 -2
  60. package/dist/web/assets/vendor-mermaid-D2KKkqNs.js +1 -2
  61. package/dist/web/assets/vendor-ui-UXCWAcmi.js +1 -2
  62. package/dist/web/assets/vendor-xterm-D1P36hcr.js +1 -2
  63. package/dist/web/assets/{video-preview-CT78iZBo.js → video-preview-vjw8RpLK.js} +1 -2
  64. package/dist/web/assets/x-BPReZWnP.js +1 -2
  65. package/dist/web/index.html +3 -3
  66. package/dist/web/sw.js +1 -2
  67. package/package.json +1 -1
  68. package/src/web/components/chat/chat-tab.tsx +6 -4
  69. package/src/web/components/layout/tab-pool.tsx +1 -1
  70. package/src/web/hooks/use-chat.ts +7 -6
  71. package/src/web/stores/panel-store.ts +5 -0
  72. package/vite.config.ts +1 -1
  73. package/dist/web/assets/ai-settings-section-AuV6Lzz2.js.map +0 -1
  74. package/dist/web/assets/api-client-DIhJ5qVW.js.map +0 -1
  75. package/dist/web/assets/api-settings-C3T95dWg.js.map +0 -1
  76. package/dist/web/assets/arrow-up-Rcw6_KKu.js.map +0 -1
  77. package/dist/web/assets/audio-preview-CQ-l5P8I.js.map +0 -1
  78. package/dist/web/assets/chat-tab-DbuBr2ax.js.map +0 -1
  79. package/dist/web/assets/chevron-right-DnHIvvcy.js.map +0 -1
  80. package/dist/web/assets/code-DGBecc50.js.map +0 -1
  81. package/dist/web/assets/code-editor-DEa0t62y.js.map +0 -1
  82. package/dist/web/assets/conflict-editor-D5H9urYy.js.map +0 -1
  83. package/dist/web/assets/createLucideIcon-BjHrJDVb.js.map +0 -1
  84. package/dist/web/assets/csv-parser-Dly5nqE1.js.map +0 -1
  85. package/dist/web/assets/csv-preview-B3Dyhgho.js.map +0 -1
  86. package/dist/web/assets/data-grid-overlay-editor-C1UUm7Ob.js.map +0 -1
  87. package/dist/web/assets/data-grid-types-D2cHE8hx.js.map +0 -1
  88. package/dist/web/assets/database-DOWH9-Vv.js.map +0 -1
  89. package/dist/web/assets/database-viewer-CW60ytCl.js.map +0 -1
  90. package/dist/web/assets/diff-viewer-BfatMgWw.js.map +0 -1
  91. package/dist/web/assets/dist-BoIkGNC8.js.map +0 -1
  92. package/dist/web/assets/dist-DVk8T0R5.js.map +0 -1
  93. package/dist/web/assets/esm-DCbn6xno.js.map +0 -1
  94. package/dist/web/assets/extension-webview-DKSDoW_g.js.map +0 -1
  95. package/dist/web/assets/file-exclamation-point-BwzaQ50n.js.map +0 -1
  96. package/dist/web/assets/file-store-DOxcU_7s.js.map +0 -1
  97. package/dist/web/assets/glide-data-grid-Bx48618B.js.map +0 -1
  98. package/dist/web/assets/globe-B4Ilypbs.js.map +0 -1
  99. package/dist/web/assets/image-preview-ClY2xl1B.js.map +0 -1
  100. package/dist/web/assets/index-DkQ6jVSH.js.map +0 -1
  101. package/dist/web/assets/input-_LFQwhzd.js.map +0 -1
  102. package/dist/web/assets/katex-C10ndCVt.js.map +0 -1
  103. package/dist/web/assets/keybindings-store-DrAeg6Gw.js +0 -1
  104. package/dist/web/assets/lib-C2D8j3K3.js.map +0 -1
  105. package/dist/web/assets/markdown-renderer-BmMmo0F-.js.map +0 -1
  106. package/dist/web/assets/notification-store-Bukl8bKo.js +0 -1
  107. package/dist/web/assets/number-overlay-editor-CyEqxXcg.js.map +0 -1
  108. package/dist/web/assets/panel-store-Dy8-7E_g.js.map +0 -1
  109. package/dist/web/assets/pdf-preview-YylEP_Su.js.map +0 -1
  110. package/dist/web/assets/port-forwarding-tab-COdo70kU.js.map +0 -1
  111. package/dist/web/assets/postgres-viewer-3y9VshZZ.js.map +0 -1
  112. package/dist/web/assets/react-DMIOAtcX.js.map +0 -1
  113. package/dist/web/assets/refresh-cw-BjrAbUJe.js.map +0 -1
  114. package/dist/web/assets/scroll-area-BDi_FNzr.js.map +0 -1
  115. package/dist/web/assets/search-tM8K5zWU.js.map +0 -1
  116. package/dist/web/assets/settings-store-8FpQDjEA.js.map +0 -1
  117. package/dist/web/assets/sparkles-CulWHe4c.js.map +0 -1
  118. package/dist/web/assets/sql-query-editor-DlBYx1Ye.js.map +0 -1
  119. package/dist/web/assets/sqlite-viewer-Bj8oPYho.js.map +0 -1
  120. package/dist/web/assets/tab-store-Dtg1_qL0.js.map +0 -1
  121. package/dist/web/assets/table-BzjWcs87.js.map +0 -1
  122. package/dist/web/assets/terminal-tab-B7ECmf95.js.map +0 -1
  123. package/dist/web/assets/text-wrap-DJz9Bgpa.js.map +0 -1
  124. package/dist/web/assets/use-blob-url-DB4nNruT.js.map +0 -1
  125. package/dist/web/assets/use-monaco-theme-DEI-tJAh.js.map +0 -1
  126. package/dist/web/assets/utils-CQux7CsO.js.map +0 -1
  127. package/dist/web/assets/vendor-markdown-0Mxgxy0L.js.map +0 -1
  128. package/dist/web/assets/vendor-mermaid-D2KKkqNs.js.map +0 -1
  129. package/dist/web/assets/vendor-ui-UXCWAcmi.js.map +0 -1
  130. package/dist/web/assets/vendor-xterm-D1P36hcr.js.map +0 -1
  131. package/dist/web/assets/video-preview-CT78iZBo.js.map +0 -1
  132. package/dist/web/assets/x-BPReZWnP.js.map +0 -1
  133. package/dist/web/sw.js.map +0 -1
@@ -1,3 +1,2 @@
1
1
  import{o as e}from"./rolldown-runtime-FhOqtrmT.js";import{b as t,x as n}from"./vendor-markdown-0Mxgxy0L.js";import{$ as r,$t as i,A as a,At as o,B as s,Bt as c,C as l,Ct as u,D as d,Dt as f,Et as p,F as m,Ft as h,G as g,Gt as _,H as ee,Ht as v,I as te,It as ne,J as y,Jt as b,K as x,Kt as re,L as S,Lt as C,Mt as w,Nt as T,Ot as E,Pt as D,Q as ie,Qt as O,R as ae,Rt as k,S as oe,St as se,T as ce,Tt as le,U as ue,Ut as de,V as A,Vt as fe,W as pe,Wt as me,X as he,Xt as ge,Y as _e,Yt as ve,Z as ye,Zt as be,_ as xe,_t as Se,a as Ce,an as we,at as Te,b as Ee,bt as De,c as Oe,ct as ke,d as Ae,dt as je,en as Me,et as Ne,ft as Pe,gt as Fe,h as Ie,ht as Le,in as Re,it as ze,jt as Be,kt as Ve,lt as He,m as Ue,mt as We,n as Ge,nn as Ke,nt as qe,ot as Je,p as Ye,pt as Xe,q as Ze,qt as Qe,r as $e,rn as j,rt as et,s as tt,st as nt,t as rt,tn as M,tt as it,ut as at,v as ot,vt as st,w as ct,wt as lt,x as ut,xt as dt,yt as ft,z as N,zt as P}from"./dist-DVk8T0R5.js";function pt(){return pt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},pt.apply(null,arguments)}function mt(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var F=e(n()),ht=e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),r=bt(e.state,n.from);return r.line?_t(e):r.block?yt(e):!1};function gt(e,t){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let i=e(t,n);return i?(r(n.update(i)),!0):!1}}var _t=gt(wt,0),vt=gt(Ct,0),yt=gt((e,t)=>Ct(e,t,St(t)),0);function bt(e,t){let n=e.languageDataAt(`commentTokens`,t,1);return n.length?n[0]:{}}var I=50;function xt(e,{open:t,close:n},r,i){let a=e.sliceDoc(r-I,r),o=e.sliceDoc(i,i+I),s=/\s*$/.exec(a)[0].length,c=/^\s*/.exec(o)[0].length,l=a.length-s;if(a.slice(l-t.length,l)==t&&o.slice(c,c+n.length)==n)return{open:{pos:r-s,margin:s&&1},close:{pos:i+c,margin:c&&1}};let u,d;i-r<=2*I?u=d=e.sliceDoc(r,i):(u=e.sliceDoc(r,r+I),d=e.sliceDoc(i-I,i));let f=/^\s*/.exec(u)[0].length,p=/\s*$/.exec(d)[0].length,m=d.length-p-n.length;return u.slice(f,f+t.length)==t&&d.slice(m,m+n.length)==n?{open:{pos:r+f+t.length,margin:/\s/.test(u.charAt(f+t.length))?1:0},close:{pos:i-p-n.length,margin:/\s/.test(d.charAt(m-1))?1:0}}:null}function St(e){let t=[];for(let n of e.selection.ranges){let r=e.doc.lineAt(n.from),i=n.to<=r.to?r:e.doc.lineAt(n.to);i.from>r.from&&i.from==n.to&&(i=n.to==r.to+1?r:e.doc.lineAt(n.to-1));let a=t.length-1;a>=0&&t[a].to>r.from?t[a].to=i.to:t.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:i.to})}return t}function Ct(e,t,n=t.selection.ranges){let r=n.map(e=>bt(t,e.from).block);if(!r.every(e=>e))return null;let i=n.map((e,n)=>xt(t,r[n],e.from,e.to));if(e!=2&&!i.every(e=>e))return{changes:t.changes(n.map((e,t)=>i[t]?[]:[{from:e.from,insert:r[t].open+` `},{from:e.to,insert:` `+r[t].close}]))};if(e!=1&&i.some(e=>e)){let e=[];for(let t=0,n;t<i.length;t++)if(n=i[t]){let i=r[t],{open:a,close:o}=n;e.push({from:a.pos-i.open.length,to:a.pos+a.margin},{from:o.pos-o.margin,to:o.pos+i.close.length})}return{changes:e}}return null}function wt(e,t,n=t.selection.ranges){let r=[],i=-1;ranges:for(let{from:e,to:a}of n){let n=r.length,o=1e9,s;for(let n=e;n<=a;){let c=t.doc.lineAt(n);if(s==null&&(s=bt(t,c.from).line,!s))continue ranges;if(c.from>i&&(e==a||a>c.from)){i=c.from;let e=/^\s*/.exec(c.text)[0].length,t=e==c.length,n=c.text.slice(e,e+s.length)==s?e:-1;e<c.text.length&&e<o&&(o=e),r.push({line:c,comment:n,token:s,indent:e,empty:t,single:!1})}n=c.to+1}if(o<1e9)for(let e=n;e<r.length;e++)r[e].indent<r[e].line.text.length&&(r[e].indent=o);r.length==n+1&&(r[n].single=!0)}if(e!=2&&r.some(e=>e.comment<0&&(!e.empty||e.single))){let e=[];for(let{line:t,token:n,indent:i,empty:a,single:o}of r)(o||!a)&&e.push({from:t.from+i,insert:n+` `});let n=t.changes(e);return{changes:n,selection:t.selection.map(n,1)}}else if(e!=1&&r.some(e=>e.comment>=0)){let e=[];for(let{line:t,comment:n,token:i}of r)if(n>=0){let r=t.from+n,a=r+i.length;t.text[a-t.from]==` `&&a++,e.push({from:r,to:a})}return{changes:e}}return null}var Tt=Be.define(),Et=Be.define(),Dt=P.define(),Ot=P.define({combine(e){return M(e,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(n,r)=>e(n,r)||t(n,r)})}}),kt=ge.define({create(){return z.empty},update(e,t){let n=t.state.facet(Ot),r=t.annotation(Tt);if(r){let i=L.fromTransaction(t,r.selection),a=r.side,o=a==0?e.undone:e.done;return o=i?It(o,o.length,n.minDepth,i):Vt(o,t.startState.selection),new z(a==0?r.rest:o,a==0?o:r.rest)}let i=t.annotation(Et);if((i==`full`||i==`before`)&&(e=e.isolate()),t.annotation(O.addToHistory)===!1)return t.changes.empty?e:e.addMapping(t.changes.desc);let a=L.fromTransaction(t),o=t.annotation(O.time),s=t.annotation(O.userEvent);return a?e=e.addChanges(a,o,s,n,t):t.selection&&(e=e.addSelection(t.startState.selection,o,s,n.newGroupDelay)),(i==`full`||i==`after`)&&(e=e.isolate()),e},toJSON(e){return{done:e.done.map(e=>e.toJSON()),undone:e.undone.map(e=>e.toJSON())}},fromJSON(e){return new z(e.done.map(L.fromJSON),e.undone.map(L.fromJSON))}});function At(e={}){return[kt,Ot.of(e),A.domEventHandlers({beforeinput(e,t){let n=e.inputType==`historyUndo`?Mt:e.inputType==`historyRedo`?Nt:null;return n?(e.preventDefault(),n(t)):!1}})]}function jt(e,t){return function({state:n,dispatch:r}){if(!t&&n.readOnly)return!1;let i=n.field(kt,!1);if(!i)return!1;let a=i.pop(e,n,t);return a?(r(a),!0):!1}}var Mt=jt(0,!1),Nt=jt(1,!1),Pt=jt(0,!0),Ft=jt(1,!0),L=class e{constructor(e,t,n,r,i){this.changes=e,this.effects=t,this.mapped=n,this.startSelection=r,this.selectionsAfter=i}setSelAfter(t){return new e(this.changes,this.effects,this.mapped,this.startSelection,t)}toJSON(){return{changes:this.changes?.toJSON(),mapped:this.mapped?.toJSON(),startSelection:this.startSelection?.toJSON(),selectionsAfter:this.selectionsAfter.map(e=>e.toJSON())}}static fromJSON(t){return new e(t.changes&&D.fromJSON(t.changes),[],t.mapped&&T.fromJSON(t.mapped),t.startSelection&&C.fromJSON(t.startSelection),t.selectionsAfter.map(C.fromJSON))}static fromTransaction(t,n){let r=R;for(let e of t.startState.facet(Dt)){let n=e(t);n.length&&(r=r.concat(n))}return!r.length&&t.changes.empty?null:new e(t.changes.invert(t.startState.doc),r,void 0,n||t.startState.selection,R)}static selection(t){return new e(void 0,R,void 0,void 0,t)}};function It(e,t,n,r){let i=t+1>n+20?t-n-1:0,a=e.slice(i,t);return a.push(r),a}function Lt(e,t){let n=[],r=!1;return e.iterChangedRanges((e,t)=>n.push(e,t)),t.iterChangedRanges((e,t,i,a)=>{for(let e=0;e<n.length;){let t=n[e++],o=n[e++];a>=t&&i<=o&&(r=!0)}}),r}function Rt(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((e,n)=>e.empty!=t.ranges[n].empty).length===0}function zt(e,t){return e.length?t.length?e.concat(t):e:t}var R=[],Bt=200;function Vt(e,t){if(e.length){let n=e[e.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-Bt));return r.length&&r[r.length-1].eq(t)?e:(r.push(t),It(e,e.length-1,1e9,n.setSelAfter(r)))}else return[L.selection([t])]}function Ht(e){let t=e[e.length-1],n=e.slice();return n[e.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),n}function Ut(e,t){if(!e.length)return e;let n=e.length,r=R;for(;n;){let i=Wt(e[n-1],t,r);if(i.changes&&!i.changes.empty||i.effects.length){let t=e.slice(0,n);return t[n-1]=i,t}else t=i.mapped,n--,r=i.selectionsAfter}return r.length?[L.selection(r)]:R}function Wt(e,t,n){let r=zt(e.selectionsAfter.length?e.selectionsAfter.map(e=>e.map(t)):R,n);if(!e.changes)return L.selection(r);let i=e.changes.map(t),a=t.mapDesc(e.changes,!0),o=e.mapped?e.mapped.composeDesc(a):a;return new L(i,b.mapEffects(e.effects,t),o,e.startSelection.map(a),r)}var Gt=/^(input\.type|delete)($|\.)/,z=class e{constructor(e,t,n=0,r=void 0){this.done=e,this.undone=t,this.prevTime=n,this.prevUserEvent=r}isolate(){return this.prevTime?new e(this.done,this.undone):this}addChanges(t,n,r,i,a){let o=this.done,s=o[o.length-1];return o=s&&s.changes&&!s.changes.empty&&t.changes&&(!r||Gt.test(r))&&(!s.selectionsAfter.length&&n-this.prevTime<i.newGroupDelay&&i.joinToEvent(a,Lt(s.changes,t.changes))||r==`input.type.compose`)?It(o,o.length-1,i.minDepth,new L(t.changes.compose(s.changes),zt(b.mapEffects(t.effects,s.changes),s.effects),s.mapped,s.startSelection,R)):It(o,o.length,i.minDepth,t),new e(o,R,n,r)}addSelection(t,n,r,i){let a=this.done.length?this.done[this.done.length-1].selectionsAfter:R;return a.length>0&&n-this.prevTime<i&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&Rt(a[a.length-1],t)?this:new e(Vt(this.done,t),this.undone,n,r)}addMapping(t){return new e(Ut(this.done,t),Ut(this.undone,t),this.prevTime,this.prevUserEvent)}pop(e,t,n){let r=e==0?this.done:this.undone;if(r.length==0)return null;let i=r[r.length-1],a=i.selectionsAfter[0]||(i.startSelection?i.startSelection.map(i.changes.invertedDesc,1):t.selection);if(n&&i.selectionsAfter.length)return t.update({selection:i.selectionsAfter[i.selectionsAfter.length-1],annotations:Tt.of({side:e,rest:Ht(r),selection:a}),userEvent:e==0?`select.undo`:`select.redo`,scrollIntoView:!0});if(i.changes){let n=r.length==1?R:r.slice(0,r.length-1);return i.mapped&&(n=Ut(n,i.mapped)),t.update({changes:i.changes,selection:i.startSelection,effects:i.effects,annotations:Tt.of({side:e,rest:n,selection:a}),filter:!1,userEvent:e==0?`undo`:`redo`,scrollIntoView:!0})}else return null}};z.empty=new z(R,R);var Kt=[{key:`Mod-z`,run:Mt,preventDefault:!0},{key:`Mod-y`,mac:`Mod-Shift-z`,run:Nt,preventDefault:!0},{linux:`Ctrl-Shift-z`,run:Nt,preventDefault:!0},{key:`Mod-u`,run:Pt,preventDefault:!0},{key:`Alt-u`,mac:`Mod-Shift-u`,run:Ft,preventDefault:!0}];function B(e,t){return C.create(e.ranges.map(t),e.mainIndex)}function V(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:`select`})}function H({state:e,dispatch:t},n){let r=B(e.selection,n);return r.eq(e.selection,!0)?!1:(t(V(e,r)),!0)}function qt(e,t){return C.cursor(t?e.to:e.from)}function Jt(e,t){return H(e,n=>n.empty?e.moveByChar(n,t):qt(n,t))}function U(e){return e.textDirectionAt(e.state.selection.main.head)==s.LTR}var Yt=e=>Jt(e,!U(e)),Xt=e=>Jt(e,U(e));function Zt(e,t){return H(e,n=>n.empty?e.moveByGroup(n,t):qt(n,t))}var Qt=e=>Zt(e,!U(e)),$t=e=>Zt(e,U(e));typeof Intl<`u`&&Intl.Segmenter&&new Intl.Segmenter(void 0,{granularity:`word`});function en(e,t,n){if(t.type.prop(n))return!0;let r=t.to-t.from;return r&&(r>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function tn(e,t,n){let r=ce(e).resolveInner(t.head),i=n?a.closedBy:a.openedBy;for(let a=t.head;;){let t=n?r.childAfter(a):r.childBefore(a);if(!t)break;en(e,t,i)?r=t:a=n?t.to:t.from}let o=r.type.prop(i),s,c;return c=o&&(s=n?l(e,r.from,1):l(e,r.to,-1))&&s.matched?n?s.end.to:s.end.from:n?r.to:r.from,C.cursor(c,n?-1:1)}var nn=e=>H(e,t=>tn(e.state,t,!U(e))),rn=e=>H(e,t=>tn(e.state,t,U(e)));function an(e,t){return H(e,n=>{if(!n.empty)return qt(n,t);let r=e.moveVertically(n,t);return r.head==n.head?e.moveToLineBoundary(n,t):r})}var on=e=>an(e,!1),sn=e=>an(e,!0);function cn(e){let t=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,n=0,r=0,i;if(t){for(let t of e.state.facet(A.scrollMargins)){let i=t(e);i?.top&&(n=Math.max(i?.top,n)),i?.bottom&&(r=Math.max(i?.bottom,r))}i=e.scrollDOM.clientHeight-n-r}else i=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:r,selfScroll:t,height:Math.max(e.defaultLineHeight,i-5)}}function ln(e,t){let n=cn(e),{state:r}=e,i=B(r.selection,r=>r.empty?e.moveVertically(r,t,n.height):qt(r,t));if(i.eq(r.selection))return!1;let a;if(n.selfScroll){let t=e.coordsAtPos(r.selection.main.head),o=e.scrollDOM.getBoundingClientRect(),s=o.top+n.marginTop,c=o.bottom-n.marginBottom;t&&t.top>s&&t.bottom<c&&(a=A.scrollIntoView(i.main.head,{y:`start`,yMargin:t.top-s}))}return e.dispatch(V(r,i),{effects:a}),!0}var un=e=>ln(e,!1),dn=e=>ln(e,!0);function W(e,t,n){let r=e.lineBlockAt(t.head),i=e.moveToLineBoundary(t,n);if(i.head==t.head&&i.head!=(n?r.to:r.from)&&(i=e.moveToLineBoundary(t,n,!1)),!n&&i.head==r.from&&r.length){let n=/^\s*/.exec(e.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;n&&t.head!=r.from+n&&(i=C.cursor(r.from+n))}return i}var fn=e=>H(e,t=>W(e,t,!0)),pn=e=>H(e,t=>W(e,t,!1)),mn=e=>H(e,t=>W(e,t,!U(e))),hn=e=>H(e,t=>W(e,t,U(e))),gn=e=>H(e,t=>C.cursor(e.lineBlockAt(t.head).from,1)),_n=e=>H(e,t=>C.cursor(e.lineBlockAt(t.head).to,-1));function vn(e,t,n){let r=!1,i=B(e.selection,t=>{let i=l(e,t.head,-1)||l(e,t.head,1)||t.head>0&&l(e,t.head-1,1)||t.head<e.doc.length&&l(e,t.head+1,-1);if(!i||!i.end)return t;r=!0;let a=i.start.from==t.head?i.end.to:i.end.from;return n?C.range(t.anchor,a):C.cursor(a)});return r?(t(V(e,i)),!0):!1}var yn=({state:e,dispatch:t})=>vn(e,t,!1);function G(e,t){let n=B(e.state.selection,e=>{let n=t(e);return C.range(e.anchor,n.head,n.goalColumn,n.bidiLevel||void 0,n.assoc)});return n.eq(e.state.selection)?!1:(e.dispatch(V(e.state,n)),!0)}function bn(e,t){return G(e,n=>e.moveByChar(n,t))}var xn=e=>bn(e,!U(e)),Sn=e=>bn(e,U(e));function Cn(e,t){return G(e,n=>e.moveByGroup(n,t))}var wn=e=>Cn(e,!U(e)),Tn=e=>Cn(e,U(e)),En=e=>G(e,t=>tn(e.state,t,!U(e))),Dn=e=>G(e,t=>tn(e.state,t,U(e)));function On(e,t){return G(e,n=>e.moveVertically(n,t))}var kn=e=>On(e,!1),An=e=>On(e,!0);function jn(e,t){return G(e,n=>e.moveVertically(n,t,cn(e).height))}var Mn=e=>jn(e,!1),Nn=e=>jn(e,!0),Pn=e=>G(e,t=>W(e,t,!0)),Fn=e=>G(e,t=>W(e,t,!1)),In=e=>G(e,t=>W(e,t,!U(e))),Ln=e=>G(e,t=>W(e,t,U(e))),Rn=e=>G(e,t=>C.cursor(e.lineBlockAt(t.head).from)),zn=e=>G(e,t=>C.cursor(e.lineBlockAt(t.head).to)),Bn=({state:e,dispatch:t})=>(t(V(e,{anchor:0})),!0),Vn=({state:e,dispatch:t})=>(t(V(e,{anchor:e.doc.length})),!0),Hn=({state:e,dispatch:t})=>(t(V(e,{anchor:e.selection.main.anchor,head:0})),!0),Un=({state:e,dispatch:t})=>(t(V(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),Wn=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:`select`})),!0),Gn=({state:e,dispatch:t})=>{let n=ur(e).map(({from:t,to:n})=>C.range(t,Math.min(n+1,e.doc.length)));return t(e.update({selection:C.create(n),userEvent:`select`})),!0},Kn=({state:e,dispatch:t})=>{let n=B(e.selection,t=>{let n=ce(e),r=n.resolveStack(t.from,1);if(t.empty){let e=n.resolveStack(t.from,-1);e.node.from>=r.node.from&&e.node.to<=r.node.to&&(r=e)}for(let e=r;e;e=e.next){let{node:n}=e;if((n.from<t.from&&n.to>=t.to||n.to>t.to&&n.from<=t.from)&&e.next)return C.range(n.to,n.from)}return t});return n.eq(e.selection)?!1:(t(V(e,n)),!0)};function qn(e,t){let{state:n}=e,r=n.selection,i=n.selection.ranges.slice();for(let r of n.selection.ranges){let a=n.doc.lineAt(r.head);if(t?a.to<e.state.doc.length:a.from>0)for(let n=r;;){let r=e.moveVertically(n,t);if(r.head<a.from||r.head>a.to){i.some(e=>e.head==r.head)||i.push(r);break}else if(r.head==n.head)break;else n=r}}return i.length==r.ranges.length?!1:(e.dispatch(V(n,C.create(i,i.length-1))),!0)}var Jn=e=>qn(e,!1),Yn=e=>qn(e,!0),Xn=({state:e,dispatch:t})=>{let n=e.selection,r=null;return n.ranges.length>1?r=C.create([n.main]):n.main.empty||(r=C.create([C.cursor(n.main.head)])),r?(t(V(e,r)),!0):!1};function Zn(e,t){if(e.state.readOnly)return!1;let n=`delete.selection`,{state:r}=e,i=r.changeByRange(r=>{let{from:i,to:a}=r;if(i==a){let o=t(r);o<i?(n=`delete.backward`,o=Qn(e,o,!1)):o>i&&(n=`delete.forward`,o=Qn(e,o,!0)),i=Math.min(i,o),a=Math.max(a,o)}else i=Qn(e,i,!1),a=Qn(e,a,!0);return i==a?{range:r}:{changes:{from:i,to:a},range:C.cursor(i,i<r.head?-1:1)}});return i.changes.empty?!1:(e.dispatch(r.update(i,{scrollIntoView:!0,userEvent:n,effects:n==`delete.selection`?A.announce.of(r.phrase(`Selection deleted`)):void 0})),!0)}function Qn(e,t,n){if(e instanceof A)for(let r of e.state.facet(A.atomicRanges).map(t=>t(e)))r.between(t,t,(e,r)=>{e<t&&r>t&&(t=n?r:e)});return t}var $n=(e,t,n)=>Zn(e,r=>{let i=r.from,{state:a}=e,o=a.doc.lineAt(i),s,c;if(n&&!t&&i>o.from&&i<o.from+200&&!/[^ \t]/.test(s=o.text.slice(0,i-o.from))){if(s[s.length-1]==` `)return i-1;let e=Ke(s,a.tabSize)%xe(a)||xe(a);for(let t=0;t<e&&s[s.length-1-t]==` `;t++)i--;c=i}else c=j(o.text,i-o.from,t,t)+o.from,c==i&&o.number!=(t?a.doc.lines:1)?c+=t?1:-1:!t&&/[\ufe00-\ufe0f]/.test(o.text.slice(c-o.from,i-o.from))&&(c=j(o.text,c-o.from,!1,!1)+o.from);return c}),er=e=>$n(e,!1,!0),tr=e=>$n(e,!0,!1),nr=(e,t)=>Zn(e,n=>{let r=n.head,{state:i}=e,a=i.doc.lineAt(r),o=i.charCategorizer(r);for(let e=null;;){if(r==(t?a.to:a.from)){r==n.head&&a.number!=(t?i.doc.lines:1)&&(r+=t?1:-1);break}let s=j(a.text,r-a.from,t)+a.from,c=a.text.slice(Math.min(r,s)-a.from,Math.max(r,s)-a.from),l=o(c);if(e!=null&&l!=e)break;(c!=` `||r!=n.head)&&(e=l),r=s}return r}),rr=e=>nr(e,!1),ir=e=>nr(e,!0),ar=e=>Zn(e,t=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),or=e=>Zn(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),sr=e=>Zn(e,t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),cr=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(e=>({changes:{from:e.from,to:e.to,insert:be.of([``,``])},range:C.cursor(e.from)}));return t(e.update(n,{scrollIntoView:!0,userEvent:`input`})),!0},lr=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(t=>{if(!t.empty||t.from==0||t.from==e.doc.length)return{range:t};let n=t.from,r=e.doc.lineAt(n),i=n==r.from?n-1:j(r.text,n-r.from,!1)+r.from,a=n==r.to?n+1:j(r.text,n-r.from,!0)+r.from;return{changes:{from:i,to:a,insert:e.doc.slice(n,a).append(e.doc.slice(i,n))},range:C.cursor(a)}});return n.changes.empty?!1:(t(e.update(n,{scrollIntoView:!0,userEvent:`move.character`})),!0)};function ur(e){let t=[],n=-1;for(let r of e.selection.ranges){let i=e.doc.lineAt(r.from),a=e.doc.lineAt(r.to);if(!r.empty&&r.to==a.from&&(a=e.doc.lineAt(r.to-1)),n>=i.number){let e=t[t.length-1];e.to=a.to,e.ranges.push(r)}else t.push({from:i.from,to:a.to,ranges:[r]});n=a.number+1}return t}function dr(e,t,n){if(e.readOnly)return!1;let r=[],i=[];for(let t of ur(e)){if(n?t.to==e.doc.length:t.from==0)continue;let a=e.doc.lineAt(n?t.to+1:t.from-1),o=a.length+1;if(n){r.push({from:t.to,to:a.to},{from:t.from,insert:a.text+e.lineBreak});for(let n of t.ranges)i.push(C.range(Math.min(e.doc.length,n.anchor+o),Math.min(e.doc.length,n.head+o)))}else{r.push({from:a.from,to:t.from},{from:t.to,insert:e.lineBreak+a.text});for(let e of t.ranges)i.push(C.range(e.anchor-o,e.head-o))}}return r.length?(t(e.update({changes:r,scrollIntoView:!0,selection:C.create(i,e.selection.mainIndex),userEvent:`move.line`})),!0):!1}var fr=({state:e,dispatch:t})=>dr(e,t,!1),pr=({state:e,dispatch:t})=>dr(e,t,!0);function mr(e,t,n){if(e.readOnly)return!1;let r=[];for(let t of ur(e))n?r.push({from:t.from,insert:e.doc.slice(t.from,t.to)+e.lineBreak}):r.push({from:t.to,insert:e.lineBreak+e.doc.slice(t.from,t.to)});let i=e.changes(r);return t(e.update({changes:i,selection:e.selection.map(i,n?1:-1),scrollIntoView:!0,userEvent:`input.copyline`})),!0}var hr=({state:e,dispatch:t})=>mr(e,t,!1),gr=({state:e,dispatch:t})=>mr(e,t,!0),_r=e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(ur(t).map(({from:e,to:n})=>(e>0?e--:n<t.doc.length&&n++,{from:e,to:n}))),r=B(t.selection,t=>{let n;if(e.lineWrapping){let r=e.lineBlockAt(t.head),i=e.coordsAtPos(t.head,t.assoc||1);i&&(n=r.bottom+e.documentTop-i.bottom+e.defaultLineHeight/2)}return e.moveVertically(t,!0,n)}).map(n);return e.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:`delete.line`}),!0};function vr(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=ce(e).resolveInner(t),r=n.childBefore(t),i=n.childAfter(t),o;return r&&i&&r.to<=t&&i.from>=t&&(o=r.type.prop(a.closedBy))&&o.indexOf(i.name)>-1&&e.doc.lineAt(r.to).from==e.doc.lineAt(i.from).from&&!/\S/.test(e.sliceDoc(r.to,i.from))?{from:r.to,to:i.from}:null}var yr=xr(!1),br=xr(!0);function xr(e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let r=t.changeByRange(n=>{let{from:r,to:i}=n,a=t.doc.lineAt(r),o=!e&&r==i&&vr(t,r);e&&(r=i=(i<=a.to?a:t.doc.lineAt(i)).to);let s=new Oe(t,{simulateBreak:r,simulateDoubleBreak:!!o}),c=ot(s,r);for(c??=Ke(/^\s*/.exec(t.doc.lineAt(r).text)[0],t.tabSize);i<a.to&&/\s/.test(a.text[i-a.from]);)i++;o?{from:r,to:i}=o:r>a.from&&r<a.from+100&&!/\S/.test(a.text.slice(0,r))&&(r=a.from);let l=[``,ut(t,c)];return o&&l.push(ut(t,s.lineIndent(a.from,-1))),{changes:{from:r,to:i,insert:be.of(l)},range:C.cursor(r+1+l[1].length)}});return n(t.update(r,{scrollIntoView:!0,userEvent:`input`})),!0}}function Sr(e,t){let n=-1;return e.changeByRange(r=>{let i=[];for(let a=r.from;a<=r.to;){let o=e.doc.lineAt(a);o.number>n&&(r.empty||r.to>o.from)&&(t(o,i,r),n=o.number),a=o.to+1}let a=e.changes(i);return{changes:i,range:C.range(a.mapPos(r.anchor,1),a.mapPos(r.head,1))}})}var Cr=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),r=new Oe(e,{overrideIndentation:e=>n[e]??-1}),i=Sr(e,(t,i,a)=>{let o=ot(r,t.from);if(o==null)return;/\S/.test(t.text)||(o=0);let s=/^\s*/.exec(t.text)[0],c=ut(e,o);(s!=c||a.from<t.from+s.length)&&(n[t.from]=o,i.push({from:t.from,to:t.from+s.length,insert:c}))});return i.changes.empty||t(e.update(i,{userEvent:`indent`})),!0},wr=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(Sr(e,(t,n)=>{n.push({from:t.from,insert:e.facet(oe)})}),{userEvent:`input.indent`})),!0),Tr=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(Sr(e,(t,n)=>{let r=/^\s*/.exec(t.text)[0];if(!r)return;let i=Ke(r,e.tabSize),a=0,o=ut(e,Math.max(0,i-xe(e)));for(;a<r.length&&a<o.length&&r.charCodeAt(a)==o.charCodeAt(a);)a++;n.push({from:t.from+a,to:t.from+r.length,insert:o.slice(a)})}),{userEvent:`delete.dedent`})),!0),Er=e=>(e.setTabFocusMode(),!0),Dr=[{key:`Ctrl-b`,run:Yt,shift:xn,preventDefault:!0},{key:`Ctrl-f`,run:Xt,shift:Sn},{key:`Ctrl-p`,run:on,shift:kn},{key:`Ctrl-n`,run:sn,shift:An},{key:`Ctrl-a`,run:gn,shift:Rn},{key:`Ctrl-e`,run:_n,shift:zn},{key:`Ctrl-d`,run:tr},{key:`Ctrl-h`,run:er},{key:`Ctrl-k`,run:ar},{key:`Ctrl-Alt-h`,run:rr},{key:`Ctrl-o`,run:cr},{key:`Ctrl-t`,run:lr},{key:`Ctrl-v`,run:dn}],Or=[{key:`ArrowLeft`,run:Yt,shift:xn,preventDefault:!0},{key:`Mod-ArrowLeft`,mac:`Alt-ArrowLeft`,run:Qt,shift:wn,preventDefault:!0},{mac:`Cmd-ArrowLeft`,run:mn,shift:In,preventDefault:!0},{key:`ArrowRight`,run:Xt,shift:Sn,preventDefault:!0},{key:`Mod-ArrowRight`,mac:`Alt-ArrowRight`,run:$t,shift:Tn,preventDefault:!0},{mac:`Cmd-ArrowRight`,run:hn,shift:Ln,preventDefault:!0},{key:`ArrowUp`,run:on,shift:kn,preventDefault:!0},{mac:`Cmd-ArrowUp`,run:Bn,shift:Hn},{mac:`Ctrl-ArrowUp`,run:un,shift:Mn},{key:`ArrowDown`,run:sn,shift:An,preventDefault:!0},{mac:`Cmd-ArrowDown`,run:Vn,shift:Un},{mac:`Ctrl-ArrowDown`,run:dn,shift:Nn},{key:`PageUp`,run:un,shift:Mn},{key:`PageDown`,run:dn,shift:Nn},{key:`Home`,run:pn,shift:Fn,preventDefault:!0},{key:`Mod-Home`,run:Bn,shift:Hn},{key:`End`,run:fn,shift:Pn,preventDefault:!0},{key:`Mod-End`,run:Vn,shift:Un},{key:`Enter`,run:yr,shift:yr},{key:`Mod-a`,run:Wn},{key:`Backspace`,run:er,shift:er,preventDefault:!0},{key:`Delete`,run:tr,preventDefault:!0},{key:`Mod-Backspace`,mac:`Alt-Backspace`,run:rr,preventDefault:!0},{key:`Mod-Delete`,mac:`Alt-Delete`,run:ir,preventDefault:!0},{mac:`Mod-Backspace`,run:or,preventDefault:!0},{mac:`Mod-Delete`,run:sr,preventDefault:!0}].concat(Dr.map(e=>({mac:e.key,run:e.run,shift:e.shift}))),kr=[{key:`Alt-ArrowLeft`,mac:`Ctrl-ArrowLeft`,run:nn,shift:En},{key:`Alt-ArrowRight`,mac:`Ctrl-ArrowRight`,run:rn,shift:Dn},{key:`Alt-ArrowUp`,run:fr},{key:`Shift-Alt-ArrowUp`,run:hr},{key:`Alt-ArrowDown`,run:pr},{key:`Shift-Alt-ArrowDown`,run:gr},{key:`Mod-Alt-ArrowUp`,run:Jn},{key:`Mod-Alt-ArrowDown`,run:Yn},{key:`Escape`,run:Xn},{key:`Mod-Enter`,run:br},{key:`Alt-l`,mac:`Ctrl-l`,run:Gn},{key:`Mod-i`,run:Kn,preventDefault:!0},{key:`Mod-[`,run:Tr},{key:`Mod-]`,run:wr},{key:`Mod-Alt-\\`,run:Cr},{key:`Shift-Mod-k`,run:_r},{key:`Shift-Mod-\\`,run:yn},{key:`Mod-/`,run:ht},{key:`Alt-A`,run:vt},{key:`Ctrl-m`,mac:`Shift-Alt-m`,run:Er}].concat(Or),Ar={key:`Tab`,run:wr,shift:Tr},jr=typeof String.prototype.normalize==`function`?e=>e.normalize(`NFKD`):e=>e,K=class{constructor(e,t,n=0,r=e.length,i,a){this.test=a,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer=``,this.bufferPos=0,this.iter=e.iterRange(n,r),this.bufferStart=n,this.normalize=i?e=>i(jr(e)):jr,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return i(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=we(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=Me(e);let r=this.normalize(t);if(r.length)for(let e=0,i=n;;e++){let a=r.charCodeAt(e),o=this.match(a,i,this.bufferPos+this.bufferStart);if(e==r.length-1){if(o)return this.value=o,this;break}i==n&&e<t.length&&t.charCodeAt(e)==a&&i++}}}match(e,t,n){let r=null;for(let t=0;t<this.matches.length;t+=2){let i=this.matches[t],a=!1;this.query.charCodeAt(i)==e&&(i==this.query.length-1?r={from:this.matches[t+1],to:n}:(this.matches[t]++,a=!0)),a||(this.matches.splice(t,2),t-=2)}return this.query.charCodeAt(0)==e&&(this.query.length==1?r={from:t,to:n}:this.matches.push(1,t)),r&&this.test&&!this.test(r.from,r.to,this.buffer,this.bufferStart)&&(r=null),r}};typeof Symbol<`u`&&(K.prototype[Symbol.iterator]=function(){return this});var Mr={from:-1,to:-1,match:/.*/.exec(``)},Nr=`gm`+(/x/.unicode==null?``:`u`),Pr=class{constructor(e,t,n,r=0,i=e.length){if(this.text=e,this.to=i,this.curLine=``,this.done=!1,this.value=Mr,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new Lr(e,t,n,r,i);this.re=new RegExp(t,Nr+(n?.ignoreCase?`i`:``)),this.test=n?.test,this.iter=e.iter(),this.curLineStart=e.lineAt(r).from,this.matchPos=zr(e,r),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine=``:(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine=``:this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let n=this.curLineStart+t.index,r=n+t[0].length;if(this.matchPos=zr(this.text,r+(n==r?1:0)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(n<r||n>this.value.to)&&(!this.test||this.test(n,r,t)))return this.value={from:n,to:r,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}},Fr=new WeakMap,Ir=class e{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(t,n,r){let i=Fr.get(t);if(!i||i.from>=r||i.to<=n){let i=new e(n,t.sliceString(n,r));return Fr.set(t,i),i}if(i.from==n&&i.to==r)return i;let{text:a,from:o}=i;return o>n&&(a=t.sliceString(n,o)+a,o=n),i.to<r&&(a+=t.sliceString(i.to,r)),Fr.set(t,new e(o,a)),new e(n,a.slice(n-o,r-o))}},Lr=class{constructor(e,t,n,r,i){this.text=e,this.to=i,this.done=!1,this.value=Mr,this.matchPos=zr(e,r),this.re=new RegExp(t,Nr+(n?.ignoreCase?`i`:``)),this.test=n?.test,this.flat=Ir.get(e,r,this.chunkEnd(r+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let e=this.flat.from+t.index,n=e+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(e,n,t)))return this.value={from:e,to:n,match:t},this.matchPos=zr(this.text,n+(e==n?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Ir.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}};typeof Symbol<`u`&&(Pr.prototype[Symbol.iterator]=Lr.prototype[Symbol.iterator]=function(){return this});function Rr(e){try{return new RegExp(e,Nr),!0}catch{return!1}}function zr(e,t){if(t>=e.length)return t;let n=e.lineAt(t),r;for(;t<n.to&&(r=n.text.charCodeAt(t-n.from))>=56320&&r<57344;)t++;return t}var Br=e=>{let{state:t}=e,n=String(t.doc.lineAt(e.state.selection.main.head).number),{close:r,result:i}=p(e,{label:t.phrase(`Go to line`),input:{type:`text`,name:`line`,value:n},focus:!0,submitLabel:t.phrase(`go`)});return i.then(n=>{let i=n&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(n.elements.line.value);if(!i){e.dispatch({effects:r});return}let a=t.doc.lineAt(t.selection.main.head),[,o,s,c,l]=i,u=c?+c.slice(1):0,d=s?+s:a.number;if(s&&l){let e=d/100;o&&(e=e*(o==`-`?-1:1)+a.number/t.doc.lines),d=Math.round(t.doc.lines*e)}else s&&o&&(d=d*(o==`-`?-1:1)+a.number);let f=t.doc.line(Math.max(1,Math.min(t.doc.lines,d))),p=C.cursor(f.from+Math.max(0,Math.min(u,f.length)));e.dispatch({effects:[r,A.scrollIntoView(p.from,{y:`center`})],selection:p})}),!0},Vr={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},Hr=P.define({combine(e){return M(e,Vr,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function Ur(e){let t=[Yr,Jr];return e&&t.push(Hr.of(e)),t}var Wr=N.mark({class:`cm-selectionMatch`}),Gr=N.mark({class:`cm-selectionMatch cm-selectionMatch-main`});function Kr(e,t,n,r){return(n==0||e(t.sliceDoc(n-1,n))!=h.Word)&&(r==t.doc.length||e(t.sliceDoc(r,r+1))!=h.Word)}function qr(e,t,n,r){return e(t.sliceDoc(n,n+1))==h.Word&&e(t.sliceDoc(r-1,r))==h.Word}var Jr=g.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.selectionSet||e.docChanged||e.viewportChanged)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=e.state.facet(Hr),{state:n}=e,r=n.selection;if(r.ranges.length>1)return N.none;let i=r.main,a,o=null;if(i.empty){if(!t.highlightWordAroundCursor)return N.none;let e=n.wordAt(i.head);if(!e)return N.none;o=n.charCategorizer(i.head),a=n.sliceDoc(e.from,e.to)}else{let e=i.to-i.from;if(e<t.minSelectionLength||e>200)return N.none;if(t.wholeWords){if(a=n.sliceDoc(i.from,i.to),o=n.charCategorizer(i.head),!(Kr(o,n,i.from,i.to)&&qr(o,n,i.from,i.to)))return N.none}else if(a=n.sliceDoc(i.from,i.to),!a)return N.none}let s=[];for(let r of e.visibleRanges){let e=new K(n.doc,a,r.from,r.to);for(;!e.next().done;){let{from:r,to:a}=e.value;if((!o||Kr(o,n,r,a))&&(i.empty&&r<=i.from&&a>=i.to?s.push(Gr.range(r,a)):(r>=i.to||a<=i.from)&&s.push(Wr.range(r,a)),s.length>t.maxMatches))return N.none}}return N.set(s)}},{decorations:e=>e.decorations}),Yr=A.baseTheme({".cm-selectionMatch":{backgroundColor:`#99ff7780`},".cm-searchMatch .cm-selectionMatch":{backgroundColor:`transparent`}}),Xr=({state:e,dispatch:t})=>{let{selection:n}=e,r=C.create(n.ranges.map(t=>e.wordAt(t.head)||C.cursor(t.head)),n.mainIndex);return r.eq(n)?!1:(t(e.update({selection:r})),!0)};function Zr(e,t){let{main:n,ranges:r}=e.selection,i=e.wordAt(n.head),a=i&&i.from==n.from&&i.to==n.to;for(let n=!1,i=new K(e.doc,t,r[r.length-1].to);;)if(i.next(),i.done){if(n)return null;i=new K(e.doc,t,0,Math.max(0,r[r.length-1].from-1)),n=!0}else{if(n&&r.some(e=>e.from==i.value.from))continue;if(a){let t=e.wordAt(i.value.from);if(!t||t.from!=i.value.from||t.to!=i.value.to)continue}return i.value}}var Qr=({state:e,dispatch:t})=>{let{ranges:n}=e.selection;if(n.some(e=>e.from===e.to))return Xr({state:e,dispatch:t});let r=e.sliceDoc(n[0].from,n[0].to);if(e.selection.ranges.some(t=>e.sliceDoc(t.from,t.to)!=r))return!1;let i=Zr(e,r);return i?(t(e.update({selection:e.selection.addRange(C.range(i.from,i.to),!1),effects:A.scrollIntoView(i.to)})),!0):!1},q=P.define({combine(e){return M(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new ki(e),scrollToMatch:e=>A.scrollIntoView(e)})}}),$r=class{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||``,this.valid=!!this.search&&(!this.regexp||Rr(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(e,t)=>t==`n`?`
2
- `:t==`r`?`\r`:t==`t`?` `:`\\`)}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new ci(this):new ri(this)}getCursor(e,t=0,n){let r=e.doc?e:k.create({doc:e});return n??=r.doc.length,this.regexp?Y(this,r,t,n):J(this,r,t,n)}},ei=class{constructor(e){this.spec=e}};function ti(e,t,n){return(r,i,a,o)=>n&&!n(r,i,a,o)?!1:e(r>=o&&i<=o+a.length?a.slice(r-o,i-o):t.doc.sliceString(r,i),t,r,i)}function J(e,t,n,r){let i;return e.wholeWord&&(i=ni(t.doc,t.charCategorizer(t.selection.main.head))),e.test&&(i=ti(e.test,t,i)),new K(t.doc,e.unquoted,n,r,e.caseSensitive?void 0:e=>e.toLowerCase(),i)}function ni(e,t){return(n,r,i,a)=>((a>n||a+i.length<r)&&(a=Math.max(0,n-2),i=e.sliceString(a,Math.min(e.length,r+2))),(t(ai(i,n-a))!=h.Word||t(oi(i,n-a))!=h.Word)&&(t(oi(i,r-a))!=h.Word||t(ai(i,r-a))!=h.Word))}var ri=class extends ei{constructor(e){super(e)}nextMatch(e,t,n){let r=J(this.spec,e,n,e.doc.length).nextOverlapping();if(r.done){let n=Math.min(e.doc.length,t+this.spec.unquoted.length);r=J(this.spec,e,0,n).nextOverlapping()}return r.done||r.value.from==t&&r.value.to==n?null:r.value}prevMatchInRange(e,t,n){for(let r=n;;){let n=Math.max(t,r-1e4-this.spec.unquoted.length),i=J(this.spec,e,n,r),a=null;for(;!i.nextOverlapping().done;)a=i.value;if(a)return a;if(n==t)return null;r-=1e4}}prevMatch(e,t,n){let r=this.prevMatchInRange(e,0,t);return r||=this.prevMatchInRange(e,Math.max(0,n-this.spec.unquoted.length),e.doc.length),r&&(r.from!=t||r.to!=n)?r:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let n=J(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let i=J(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}};function ii(e,t,n){return(r,i,a)=>(!n||n(r,i,a))&&e(a[0],t,r,i)}function Y(e,t,n,r){let i;return e.wholeWord&&(i=si(t.charCategorizer(t.selection.main.head))),e.test&&(i=ii(e.test,t,i)),new Pr(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:i},n,r)}function ai(e,t){return e.slice(j(e,t,!1),t)}function oi(e,t){return e.slice(t,j(e,t))}function si(e){return(t,n,r)=>!r[0].length||(e(ai(r.input,r.index))!=h.Word||e(oi(r.input,r.index))!=h.Word)&&(e(oi(r.input,r.index+r[0].length))!=h.Word||e(ai(r.input,r.index+r[0].length))!=h.Word)}var ci=class extends ei{nextMatch(e,t,n){let r=Y(this.spec,e,n,e.doc.length).next();return r.done&&(r=Y(this.spec,e,0,t).next()),r.done?null:r.value}prevMatchInRange(e,t,n){for(let r=1;;r++){let i=Math.max(t,n-r*1e4),a=Y(this.spec,e,i,n),o=null;for(;!a.next().done;)o=a.value;if(o&&(i==t||o.from>i+10))return o;if(i==t)return null}}prevMatch(e,t,n){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,n)=>{if(n==`&`)return e.match[0];if(n==`$`)return`$`;for(let t=n.length;t>0;t--){let r=+n.slice(0,t);if(r>0&&r<e.match.length)return e.match[r]+n.slice(t)}return t})}matchAll(e,t){let n=Y(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let i=Y(this.spec,e,Math.max(0,t-250),Math.min(n+250,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}},li=b.define(),ui=b.define(),X=ge.define({create(e){return new di(Ci(e).create(),null)},update(e,t){for(let n of t.effects)n.is(li)?e=new di(n.value.create(),e.panel):n.is(ui)&&(e=new di(e.query,n.value?Si:null));return e},provide:e=>f.from(e,e=>e.panel)}),di=class{constructor(e,t){this.query=e,this.panel=t}},fi=N.mark({class:`cm-searchMatch`}),pi=N.mark({class:`cm-searchMatch cm-searchMatch-selected`}),mi=g.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(X))}update(e){let t=e.state.field(X);(t!=e.startState.field(X)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return N.none;let{view:n}=this,r=new _;for(let t=0,i=n.visibleRanges,a=i.length;t<a;t++){let{from:o,to:s}=i[t];for(;t<a-1&&s>i[t+1].from-500;)s=i[++t].to;e.highlight(n.state,o,s,(e,t)=>{let i=n.state.selection.ranges.some(n=>n.from==e&&n.to==t);r.add(e,t,i?pi:fi)})}return r.finish()}},{decorations:e=>e.decorations});function hi(e){return t=>{let n=t.state.field(X,!1);return n&&n.query.spec.valid?e(t,n):Ei(t)}}var gi=hi((e,{query:t})=>{let{to:n}=e.state.selection.main,r=t.nextMatch(e.state,n,n);if(!r)return!1;let i=C.single(r.from,r.to),a=e.state.facet(q);return e.dispatch({selection:i,effects:[Mi(e,r),a.scrollToMatch(i.main,e)],userEvent:`select.search`}),Ti(e),!0}),_i=hi((e,{query:t})=>{let{state:n}=e,{from:r}=n.selection.main,i=t.prevMatch(n,r,r);if(!i)return!1;let a=C.single(i.from,i.to),o=e.state.facet(q);return e.dispatch({selection:a,effects:[Mi(e,i),o.scrollToMatch(a.main,e)],userEvent:`select.search`}),Ti(e),!0}),vi=hi((e,{query:t})=>{let n=t.matchAll(e.state,1e3);return!n||!n.length?!1:(e.dispatch({selection:C.create(n.map(e=>C.range(e.from,e.to))),userEvent:`select.search.matches`}),!0)}),yi=({state:e,dispatch:t})=>{let n=e.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:r,to:i}=n.main,a=[],o=0;for(let t=new K(e.doc,e.sliceDoc(r,i));!t.next().done;){if(a.length>1e3)return!1;t.value.from==r&&(o=a.length),a.push(C.range(t.value.from,t.value.to))}return t(e.update({selection:C.create(a,o),userEvent:`select.search.matches`})),!0},bi=hi((e,{query:t})=>{let{state:n}=e,{from:r,to:i}=n.selection.main;if(n.readOnly)return!1;let a=t.nextMatch(n,r,r);if(!a)return!1;let o=a,s=[],c,l,u=[];o.from==r&&o.to==i&&(l=n.toText(t.getReplacement(o)),s.push({from:o.from,to:o.to,insert:l}),o=t.nextMatch(n,o.from,o.to),u.push(A.announce.of(n.phrase(`replaced match on line $`,n.doc.lineAt(r).number)+`.`)));let d=e.state.changes(s);return o&&(c=C.single(o.from,o.to).map(d),u.push(Mi(e,o)),u.push(n.facet(q).scrollToMatch(c.main,e))),e.dispatch({changes:d,selection:c,effects:u,userEvent:`input.replace`}),!0}),xi=hi((e,{query:t})=>{if(e.state.readOnly)return!1;let n=t.matchAll(e.state,1e9).map(e=>{let{from:n,to:r}=e;return{from:n,to:r,insert:t.getReplacement(e)}});if(!n.length)return!1;let r=e.state.phrase(`replaced $ matches`,n.length)+`.`;return e.dispatch({changes:n,effects:A.announce.of(r),userEvent:`input.replace.all`}),!0});function Si(e){return e.state.facet(q).createPanel(e)}function Ci(e,t){let n=e.selection.main,r=n.empty||n.to>n.from+100?``:e.sliceDoc(n.from,n.to);if(t&&!r)return t;let i=e.facet(q);return new $r({search:t?.literal??i.literal?r:r.replace(/\n/g,`\\n`),caseSensitive:t?.caseSensitive??i.caseSensitive,literal:t?.literal??i.literal,regexp:t?.regexp??i.regexp,wholeWord:t?.wholeWord??i.wholeWord})}function wi(e){let t=it(e,Si);return t&&t.dom.querySelector(`[main-field]`)}function Ti(e){let t=wi(e);t&&t==e.root.activeElement&&t.select()}var Ei=e=>{let t=e.state.field(X,!1);if(t&&t.panel){let n=wi(e);if(n&&n!=e.root.activeElement){let r=Ci(e.state,t.query.spec);r.valid&&e.dispatch({effects:li.of(r)}),n.focus(),n.select()}}else e.dispatch({effects:[ui.of(!0),t?li.of(Ci(e.state,t.query.spec)):b.appendConfig.of(Pi)]});return!0},Di=e=>{let t=e.state.field(X,!1);if(!t||!t.panel)return!1;let n=it(e,Si);return n&&n.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:ui.of(!1)}),!0},Oi=[{key:`Mod-f`,run:Ei,scope:`editor search-panel`},{key:`F3`,run:gi,shift:_i,scope:`editor search-panel`,preventDefault:!0},{key:`Mod-g`,run:gi,shift:_i,scope:`editor search-panel`,preventDefault:!0},{key:`Escape`,run:Di,scope:`editor search-panel`},{key:`Mod-Shift-l`,run:yi},{key:`Mod-Alt-g`,run:Br},{key:`Mod-d`,run:Qr,preventDefault:!0}],ki=class{constructor(e){this.view=e;let t=this.query=e.state.field(X).query.spec;this.commit=this.commit.bind(this),this.searchField=o(`input`,{value:t.search,placeholder:Z(e,`Find`),"aria-label":Z(e,`Find`),class:`cm-textfield`,name:`search`,form:``,"main-field":`true`,onchange:this.commit,onkeyup:this.commit}),this.replaceField=o(`input`,{value:t.replace,placeholder:Z(e,`Replace`),"aria-label":Z(e,`Replace`),class:`cm-textfield`,name:`replace`,form:``,onchange:this.commit,onkeyup:this.commit}),this.caseField=o(`input`,{type:`checkbox`,name:`case`,form:``,checked:t.caseSensitive,onchange:this.commit}),this.reField=o(`input`,{type:`checkbox`,name:`re`,form:``,checked:t.regexp,onchange:this.commit}),this.wordField=o(`input`,{type:`checkbox`,name:`word`,form:``,checked:t.wholeWord,onchange:this.commit});function n(e,t,n){return o(`button`,{class:`cm-button`,name:e,onclick:t,type:`button`},n)}this.dom=o(`div`,{onkeydown:e=>this.keydown(e),class:`cm-search`},[this.searchField,n(`next`,()=>gi(e),[Z(e,`next`)]),n(`prev`,()=>_i(e),[Z(e,`previous`)]),n(`select`,()=>vi(e),[Z(e,`all`)]),o(`label`,null,[this.caseField,Z(e,`match case`)]),o(`label`,null,[this.reField,Z(e,`regexp`)]),o(`label`,null,[this.wordField,Z(e,`by word`)]),...e.state.readOnly?[]:[o(`br`),this.replaceField,n(`replace`,()=>bi(e),[Z(e,`replace`)]),n(`replaceAll`,()=>xi(e),[Z(e,`replace all`)])],o(`button`,{name:`close`,onclick:()=>Di(e),"aria-label":Z(e,`close`),type:`button`},[`×`])])}commit(){let e=new $r({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:li.of(e)}))}keydown(e){lt(this.view,e,`search-panel`)?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?_i:gi)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),bi(this.view))}update(e){for(let t of e.transactions)for(let e of t.effects)e.is(li)&&!e.value.eq(this.query)&&this.setQuery(e.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(q).top}};function Z(e,t){return e.state.phrase(t)}var Ai=30,ji=/[\s\.,:;?!]/;function Mi(e,{from:t,to:n}){let r=e.state.doc.lineAt(t),i=e.state.doc.lineAt(n).to,a=Math.max(r.from,t-Ai),o=Math.min(i,n+Ai),s=e.state.sliceDoc(a,o);if(a!=r.from){for(let e=0;e<Ai;e++)if(!ji.test(s[e+1])&&ji.test(s[e])){s=s.slice(e);break}}if(o!=i){for(let e=s.length-1;e>s.length-Ai;e--)if(!ji.test(s[e-1])&&ji.test(s[e])){s=s.slice(0,e);break}}return A.announce.of(`${e.state.phrase(`current match`)}. ${s} ${e.state.phrase(`on line`)} ${r.number}.`)}var Ni=A.baseTheme({".cm-panel.cm-search":{padding:`2px 6px 4px`,position:`relative`,"& [name=close]":{position:`absolute`,top:`0`,right:`4px`,backgroundColor:`inherit`,border:`none`,font:`inherit`,padding:0,margin:0},"& input, & button, & label":{margin:`.2em .6em .2em 0`},"& input[type=checkbox]":{marginRight:`.2em`},"& label":{fontSize:`80%`,whiteSpace:`pre`}},"&light .cm-searchMatch":{backgroundColor:`#ffff0054`},"&dark .cm-searchMatch":{backgroundColor:`#00ffff8a`},"&light .cm-searchMatch-selected":{backgroundColor:`#ff6a0054`},"&dark .cm-searchMatch-selected":{backgroundColor:`#ff00ff8a`}}),Pi=[X,v.low(mi),Ni],Fi=class{constructor(e,t,n){this.from=e,this.to=t,this.diagnostic=n}},Ii=class e{constructor(e,t,n){this.diagnostics=e,this.panel=t,this.selected=n}static init(t,n,r){let i=r.facet(Ji).markerFilter;i&&(t=i(t,r));let a=t.slice().sort((e,t)=>e.from-t.from||e.to-t.to),o=new _,s=[],c=0,l=r.doc.iter(),u=0,d=r.doc.length;for(let e=0;;){let t=e==a.length?null:a[e];if(!t&&!s.length)break;let n,r;if(s.length)n=c,r=s.reduce((e,t)=>Math.min(e,t.to),t&&t.from>n?t.from:1e8);else{if(n=t.from,n>d)break;r=t.to,s.push(t),e++}for(;e<a.length;){let t=a[e];if(t.from==n&&(t.to>t.from||t.to==n))s.push(t),e++,r=Math.min(t.to,r);else{r=Math.min(t.from,r);break}}r=Math.min(r,d);let i=!1;if(s.some(e=>e.from==n&&(e.to==r||r==d))&&(i=n==r,!i&&r-n<10)){let e=n-(u+l.value.length);e>0&&(l.next(e),u=n);for(let e=n;;){if(e>=r){i=!0;break}if(!l.lineBreak&&u+l.value.length>e)break;e=u+l.value.length,u+=l.value.length,l.next()}}let f=aa(s);if(i)o.add(n,n,N.widget({widget:new Qi(f),diagnostics:s.slice()}));else{let e=s.reduce((e,t)=>t.markClass?e+` `+t.markClass:e,``);o.add(n,r,N.mark({class:`cm-lintRange cm-lintRange-`+f+e,diagnostics:s.slice(),inclusiveEnd:s.some(e=>e.to>r)}))}if(c=r,c==d)break;for(let e=0;e<s.length;e++)s[e].to<=c&&s.splice(e--,1)}let f=o.finish();return new e(f,n,Q(f))}};function Q(e,t=null,n=0){let r=null;return e.between(n,1e9,(e,n,{spec:i})=>{if(!(t&&i.diagnostics.indexOf(t)<0))if(!r)r=new Fi(e,n,t||i.diagnostics[0]);else if(i.diagnostics.indexOf(r.diagnostic)<0)return!1;else r=new Fi(r.from,n,r.diagnostic)}),r}function Li(e,t){let n=t.pos,r=t.end||n,i=e.state.facet(Ji).hideOn(e,n,r);if(i!=null)return i;let a=e.startState.doc.lineAt(t.pos);return!!(e.effects.some(e=>e.is(zi))||e.changes.touchesRange(a.from,Math.max(a.to,r)))}function Ri(e,t){return e.field($,!1)?t:t.concat(b.appendConfig.of(oa))}var zi=b.define(),Bi=b.define(),Vi=b.define(),$=ge.define({create(){return new Ii(N.none,null,null)},update(e,t){if(t.docChanged&&e.diagnostics.size){let n=e.diagnostics.map(t.changes),r=null,i=e.panel;if(e.selected){let i=t.changes.mapPos(e.selected.from,1);r=Q(n,e.selected.diagnostic,i)||Q(n,null,i)}!n.size&&i&&t.state.facet(Ji).autoPanel&&(i=null),e=new Ii(n,i,r)}for(let n of t.effects)if(n.is(zi)){let r=t.state.facet(Ji).autoPanel?n.value.length?ea.open:null:e.panel;e=Ii.init(n.value,r,t.state)}else n.is(Bi)?e=new Ii(e.diagnostics,n.value?ea.open:null,e.selected):n.is(Vi)&&(e=new Ii(e.diagnostics,e.panel,n.value));return e},provide:e=>[f.from(e,e=>e.panel),A.decorations.from(e,e=>e.diagnostics)]}),Hi=N.mark({class:`cm-lintRange cm-lintRange-active`});function Ui(e,t,n){let{diagnostics:r}=e.state.field($),i,a=-1,o=-1;r.between(t-(n<0?1:0),t+(n>0?1:0),(e,r,{spec:s})=>{if(t>=e&&t<=r&&(e==r||(t>e||n>0)&&(t<r||n<0)))return i=s.diagnostics,a=e,o=r,!1});let s=e.state.facet(Ji).tooltipFilter;return i&&s&&(i=s(i,e.state)),i?{pos:a,end:o,above:e.state.doc.lineAt(a).to<o,create(){return{dom:Wi(e,i)}}}:null}function Wi(e,t){return o(`ul`,{class:`cm-tooltip-lint`},t.map(t=>Zi(e,t,!1)))}var Gi=e=>{let t=e.state.field($,!1);(!t||!t.panel)&&e.dispatch({effects:Ri(e.state,[Bi.of(!0)])});let n=it(e,ea.open);return n&&n.dom.querySelector(`.cm-panel-lint ul`).focus(),!0},Ki=e=>{let t=e.state.field($,!1);return!t||!t.panel?!1:(e.dispatch({effects:Bi.of(!1)}),!0)},qi=[{key:`Mod-Shift-m`,run:Gi,preventDefault:!0},{key:`F8`,run:e=>{let t=e.state.field($,!1);if(!t)return!1;let n=e.state.selection.main,r=Q(t.diagnostics,null,n.to+1);return!r&&(r=Q(t.diagnostics,null,0),!r||r.from==n.from&&r.to==n.to)?!1:(e.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),!0)}}],Ji=P.define({combine(e){return{sources:e.map(e=>e.source).filter(e=>e!=null),...M(e.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:Yi,tooltipFilter:Yi,needsRefresh:(e,t)=>e?t?n=>e(n)||t(n):e:t,hideOn:(e,t)=>e?t?(n,r,i)=>e(n,r,i)||t(n,r,i):e:t,autoPanel:(e,t)=>e||t})}}});function Yi(e,t){return e?t?(n,r)=>t(e(n,r),r):e:t}function Xi(e){let t=[];if(e)actions:for(let{name:n}of e){for(let e=0;e<n.length;e++){let r=n[e];if(/[a-zA-Z]/.test(r)&&!t.some(e=>e.toLowerCase()==r.toLowerCase())){t.push(r);continue actions}}t.push(``)}return t}function Zi(e,t,n){let r=n?Xi(t.actions):[];return o(`li`,{class:`cm-diagnostic cm-diagnostic-`+t.severity},o(`span`,{class:`cm-diagnosticText`},t.renderMessage?t.renderMessage(e):t.message),t.actions?.map((n,i)=>{let a=!1,s=r=>{if(r.preventDefault(),a)return;a=!0;let i=Q(e.state.field($).diagnostics,t);i&&n.apply(e,i.from,i.to)},{name:c}=n,l=r[i]?c.indexOf(r[i]):-1,u=l<0?c:[c.slice(0,l),o(`u`,c.slice(l,l+1)),c.slice(l+1)];return o(`button`,{type:`button`,class:`cm-diagnosticAction`+(n.markClass?` `+n.markClass:``),onclick:s,onmousedown:s,"aria-label":` Action: ${c}${l<0?``:` (access key "${r[i]})"`}.`},u)}),t.source&&o(`div`,{class:`cm-diagnosticSource`},t.source))}var Qi=class extends Ze{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return o(`span`,{class:`cm-lintPoint cm-lintPoint-`+this.sev})}},$i=class{constructor(e,t){this.diagnostic=t,this.id=`item_`+Math.floor(Math.random()*4294967295).toString(16),this.dom=Zi(e,t,!0),this.dom.id=this.id,this.dom.setAttribute(`role`,`option`)}},ea=class e{constructor(e){this.view=e,this.items=[];let t=t=>{if(!(t.ctrlKey||t.altKey||t.metaKey)){if(t.keyCode==27)Ki(this.view),this.view.focus();else if(t.keyCode==38||t.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(t.keyCode==40||t.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(t.keyCode==36)this.moveSelection(0);else if(t.keyCode==35)this.moveSelection(this.items.length-1);else if(t.keyCode==13)this.view.focus();else if(t.keyCode>=65&&t.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:n}=this.items[this.selectedIndex],r=Xi(n.actions);for(let i=0;i<r.length;i++)if(r[i].toUpperCase().charCodeAt(0)==t.keyCode){let t=Q(this.view.state.field($).diagnostics,n);t&&n.actions[i].apply(e,t.from,t.to)}}else return;t.preventDefault()}},n=e=>{for(let t=0;t<this.items.length;t++)this.items[t].dom.contains(e.target)&&this.moveSelection(t)};this.list=o(`ul`,{tabIndex:0,role:`listbox`,"aria-label":this.view.state.phrase(`Diagnostics`),onkeydown:t,onclick:n}),this.dom=o(`div`,{class:`cm-panel-lint`},this.list,o(`button`,{type:`button`,name:`close`,"aria-label":this.view.state.phrase(`close`),onclick:()=>Ki(this.view)},`×`)),this.update()}get selectedIndex(){let e=this.view.state.field($).selected;if(!e)return-1;for(let t=0;t<this.items.length;t++)if(this.items[t].diagnostic==e.diagnostic)return t;return-1}update(){let{diagnostics:e,selected:t}=this.view.state.field($),n=0,r=!1,i=null,a=new Set;for(e.between(0,this.view.state.doc.length,(e,o,{spec:s})=>{for(let e of s.diagnostics){if(a.has(e))continue;a.add(e);let o=-1,s;for(let t=n;t<this.items.length;t++)if(this.items[t].diagnostic==e){o=t;break}o<0?(s=new $i(this.view,e),this.items.splice(n,0,s),r=!0):(s=this.items[o],o>n&&(this.items.splice(n,o-n),r=!0)),t&&s.diagnostic==t.diagnostic?s.dom.hasAttribute(`aria-selected`)||(s.dom.setAttribute(`aria-selected`,`true`),i=s):s.dom.hasAttribute(`aria-selected`)&&s.dom.removeAttribute(`aria-selected`),n++}});n<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)r=!0,this.items.pop();this.items.length==0&&(this.items.push(new $i(this.view,{from:-1,to:-1,severity:`info`,message:this.view.state.phrase(`No diagnostics`)})),r=!0),i?(this.list.setAttribute(`aria-activedescendant`,i.id),this.view.requestMeasure({key:this,read:()=>({sel:i.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:e,panel:t})=>{let n=t.height/this.list.offsetHeight;e.top<t.top?this.list.scrollTop-=(t.top-e.top)/n:e.bottom>t.bottom&&(this.list.scrollTop+=(e.bottom-t.bottom)/n)}})):this.selectedIndex<0&&this.list.removeAttribute(`aria-activedescendant`),r&&this.sync()}sync(){let e=this.list.firstChild;function t(){let t=e;e=t.nextSibling,t.remove()}for(let n of this.items)if(n.dom.parentNode==this.list){for(;e!=n.dom;)t();e=n.dom.nextSibling}else this.list.insertBefore(n.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=Q(this.view.state.field($).diagnostics,this.items[e].diagnostic);t&&this.view.dispatch({selection:{anchor:t.from,head:t.to},scrollIntoView:!0,effects:Vi.of(t)})}static open(t){return new e(t)}};function ta(e,t=`viewBox="0 0 40 40"`){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${t}>${encodeURIComponent(e)}</svg>')`}function na(e){return ta(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${e}" fill="none" stroke-width=".7"/>`,`width="6" height="3"`)}var ra=A.baseTheme({".cm-diagnostic":{padding:`3px 6px 3px 8px`,marginLeft:`-1px`,display:`block`,whiteSpace:`pre-wrap`},".cm-diagnostic-error":{borderLeft:`5px solid #d11`},".cm-diagnostic-warning":{borderLeft:`5px solid orange`},".cm-diagnostic-info":{borderLeft:`5px solid #999`},".cm-diagnostic-hint":{borderLeft:`5px solid #66d`},".cm-diagnosticAction":{font:`inherit`,border:`none`,padding:`2px 4px`,backgroundColor:`#444`,color:`white`,borderRadius:`3px`,marginLeft:`8px`,cursor:`pointer`},".cm-diagnosticSource":{fontSize:`70%`,opacity:.7},".cm-lintRange":{backgroundPosition:`left bottom`,backgroundRepeat:`repeat-x`,paddingBottom:`0.7px`},".cm-lintRange-error":{backgroundImage:na(`#d11`)},".cm-lintRange-warning":{backgroundImage:na(`orange`)},".cm-lintRange-info":{backgroundImage:na(`#999`)},".cm-lintRange-hint":{backgroundImage:na(`#66d`)},".cm-lintRange-active":{backgroundColor:`#ffdd9980`},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:`relative`,"&:after":{content:`""`,position:`absolute`,bottom:0,left:`-2px`,borderLeft:`3px solid transparent`,borderRight:`3px solid transparent`,borderBottom:`4px solid #d11`}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:`orange`}},".cm-lintPoint-info":{"&:after":{borderBottomColor:`#999`}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:`#66d`}},".cm-panel.cm-panel-lint":{position:`relative`,"& ul":{maxHeight:`100px`,overflowY:`auto`,"& [aria-selected]":{backgroundColor:`#ddd`,"& u":{textDecoration:`underline`}},"&:focus [aria-selected]":{background_fallback:`#bdf`,backgroundColor:`Highlight`,color_fallback:`white`,color:`HighlightText`},"& u":{textDecoration:`none`},padding:0,margin:0},"& [name=close]":{position:`absolute`,top:`0`,right:`2px`,background:`inherit`,border:`none`,font:`inherit`,padding:0,margin:0}},"&dark .cm-lintRange-active":{backgroundColor:`#86714a80`},"&dark .cm-panel.cm-panel-lint ul":{"& [aria-selected]":{backgroundColor:`#2e343e`}}});function ia(e){return e==`error`?4:e==`warning`?3:e==`info`?2:1}function aa(e){let t=`hint`,n=1;for(let r of e){let e=ia(r.severity);e>n&&(n=e,t=r.severity)}return t}var oa=[$,A.decorations.compute([$],e=>{let{selected:t,panel:n}=e.field($);return!t||!n||t.from==t.to?N.none:N.set([Hi.range(t.from,t.to)])}),Xe(Ui,{hideOn:Li}),ra],sa=function(e){e===void 0&&(e={});var{crosshairCursor:t=!1}=e,n=[];e.closeBracketsKeymap!==!1&&(n=n.concat($e)),e.defaultKeymap!==!1&&(n=n.concat(kr)),e.searchKeymap!==!1&&(n=n.concat(Oi)),e.historyKeymap!==!1&&(n=n.concat(Kt)),e.foldKeymap!==!1&&(n=n.concat(Ie)),e.completionKeymap!==!1&&(n=n.concat(Ce)),e.lintKeymap!==!1&&(n=n.concat(qi));var r=[];return e.lineNumbers!==!1&&r.push(st()),e.highlightActiveLineGutter!==!1&&r.push(He()),e.highlightSpecialChars!==!1&&r.push(at()),e.history!==!1&&r.push(At()),e.foldGutter!==!1&&r.push(Ue()),e.drawSelection!==!1&&r.push(ye()),e.dropCursor!==!1&&r.push(ie()),e.allowMultipleSelections!==!1&&r.push(k.allowMultipleSelections.of(!0)),e.indentOnInput!==!1&&r.push(Ee()),e.syntaxHighlighting!==!1&&r.push(ct(Ye,{fallback:!0})),e.bracketMatching!==!1&&r.push(Ae()),e.closeBrackets!==!1&&r.push(Ge()),e.autocompletion!==!1&&r.push(rt()),e.rectangularSelection!==!1&&r.push(se()),t!==!1&&r.push(he()),e.highlightActiveLine!==!1&&r.push(ke()),e.highlightSelectionMatches!==!1&&r.push(Ur()),e.tabSize&&typeof e.tabSize==`number`&&r.push(oe.of(` `.repeat(e.tabSize))),r.concat([We.of(n.flat())]).filter(Boolean)},ca=function(e){e===void 0&&(e={});var t=[];e.defaultKeymap!==!1&&(t=t.concat(kr)),e.historyKeymap!==!1&&(t=t.concat(Kt));var n=[];return e.highlightSpecialChars!==!1&&n.push(at()),e.history!==!1&&n.push(At()),e.drawSelection!==!1&&n.push(ye()),e.syntaxHighlighting!==!1&&n.push(ct(Ye,{fallback:!0})),n.concat([We.of(t.flat())]).filter(Boolean)},la=`#e5c07b`,ua=`#e06c75`,da=`#56b6c2`,fa=`#ffffff`,pa=`#abb2bf`,ma=`#7d8799`,ha=`#61afef`,ga=`#98c379`,_a=`#d19a66`,va=`#c678dd`,ya=`#21252b`,ba=`#2c313a`,xa=`#282c34`,Sa=`#353a42`,Ca=`#3E4451`,wa=`#528bff`,Ta={chalky:la,coral:ua,cyan:da,invalid:fa,ivory:pa,stone:ma,malibu:ha,sage:ga,whiskey:_a,violet:va,darkBackground:ya,highlightBackground:ba,background:xa,tooltipBackground:Sa,selection:Ca,cursor:wa},Ea=A.theme({"&":{color:pa,backgroundColor:xa},".cm-content":{caretColor:wa},".cm-cursor, .cm-dropCursor":{borderLeftColor:wa},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:Ca},".cm-panels":{backgroundColor:ya,color:pa},".cm-panels.cm-panels-top":{borderBottom:`2px solid black`},".cm-panels.cm-panels-bottom":{borderTop:`2px solid black`},".cm-searchMatch":{backgroundColor:`#72a1ff59`,outline:`1px solid #457dff`},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:`#6199ff2f`},".cm-activeLine":{backgroundColor:`#6699ff0b`},".cm-selectionMatch":{backgroundColor:`#aafe661a`},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:`#bad0f847`},".cm-gutters":{backgroundColor:xa,color:ma,border:`none`},".cm-activeLineGutter":{backgroundColor:ba},".cm-foldPlaceholder":{backgroundColor:`transparent`,border:`none`,color:`#ddd`},".cm-tooltip":{border:`none`,backgroundColor:Sa},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:`transparent`,borderBottomColor:`transparent`},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:Sa,borderBottomColor:Sa},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:ba,color:pa}}},{dark:!0}),Da=tt.define([{tag:d.keyword,color:va},{tag:[d.name,d.deleted,d.character,d.propertyName,d.macroName],color:ua},{tag:[d.function(d.variableName),d.labelName],color:ha},{tag:[d.color,d.constant(d.name),d.standard(d.name)],color:_a},{tag:[d.definition(d.name),d.separator],color:pa},{tag:[d.typeName,d.className,d.number,d.changed,d.annotation,d.modifier,d.self,d.namespace],color:la},{tag:[d.operator,d.operatorKeyword,d.url,d.escape,d.regexp,d.link,d.special(d.string)],color:da},{tag:[d.meta,d.comment],color:ma},{tag:d.strong,fontWeight:`bold`},{tag:d.emphasis,fontStyle:`italic`},{tag:d.strikethrough,textDecoration:`line-through`},{tag:d.link,color:ma,textDecoration:`underline`},{tag:d.heading,fontWeight:`bold`,color:ua},{tag:[d.atom,d.bool,d.special(d.variableName)],color:_a},{tag:[d.processingInstruction,d.string,d.inserted],color:ga},{tag:d.invalid,color:fa}]),Oa=[Ea,ct(Da)],ka=A.theme({"&":{backgroundColor:`#fff`}},{dark:!1}),Aa=function(e){e===void 0&&(e={});var{indentWithTab:t=!0,editable:n=!0,readOnly:r=!1,theme:i=`light`,placeholder:a=``,basicSetup:o=!0}=e,s=[];switch(t&&s.unshift(We.of([Ar])),o&&(typeof o==`boolean`?s.unshift(sa()):s.unshift(sa(o))),a&&s.unshift(dt(a)),i){case`light`:s.push(ka);break;case`dark`:s.push(Oa);break;case`none`:break;default:s.push(i);break}return n===!1&&s.push(A.editable.of(!1)),r&&s.push(k.readOnly.of(!0)),[...s]},ja=e=>({line:e.state.doc.lineAt(e.state.selection.main.from),lineCount:e.state.doc.lines,lineBreak:e.state.lineBreak,length:e.state.doc.length,readOnly:e.state.readOnly,tabSize:e.state.tabSize,selection:e.state.selection,selectionAsSingle:e.state.selection.asSingle().main,ranges:e.state.selection.ranges,selectionCode:e.state.sliceDoc(e.state.selection.main.from,e.state.selection.main.to),selections:e.state.selection.ranges.map(t=>e.state.sliceDoc(t.from,t.to)),selectedText:e.state.selection.ranges.some(e=>!e.empty)}),Ma=class{constructor(e,t){this.timeLeftMS=void 0,this.timeoutMS=void 0,this.isCancelled=!1,this.isTimeExhausted=!1,this.callbacks=[],this.timeLeftMS=t,this.timeoutMS=t,this.callbacks.push(e)}tick(){if(!this.isCancelled&&!this.isTimeExhausted&&(this.timeLeftMS--,this.timeLeftMS<=0)){this.isTimeExhausted=!0;var e=this.callbacks.slice();this.callbacks.length=0,e.forEach(e=>{try{e()}catch(e){console.error(`TimeoutLatch callback error:`,e)}})}}cancel(){this.isCancelled=!0,this.callbacks.length=0}reset(){this.timeLeftMS=this.timeoutMS,this.isCancelled=!1,this.isTimeExhausted=!1}get isDone(){return this.isCancelled||this.isTimeExhausted}},Na=class{constructor(){this.interval=null,this.latches=new Set}add(e){this.latches.add(e),this.start()}remove(e){this.latches.delete(e),this.latches.size===0&&this.stop()}start(){this.interval===null&&(this.interval=setInterval(()=>{this.latches.forEach(e=>{e.tick(),e.isDone&&this.remove(e)})},1))}stop(){this.interval!==null&&(clearInterval(this.interval),this.interval=null)}},Pa=null,Fa=()=>typeof window>`u`?new Na:(Pa||=new Na,Pa),Ia=Be.define(),La=200,Ra=[];function za(e){var{value:t,selection:n,onChange:r,onStatistics:i,onCreateEditor:a,onUpdate:o,extensions:s=Ra,autoFocus:c,theme:l=`light`,height:u=null,minHeight:d=null,maxHeight:f=null,width:p=null,minWidth:m=null,maxWidth:h=null,placeholder:g=``,editable:_=!0,readOnly:ee=!1,indentWithTab:v=!0,basicSetup:te=!0,root:ne,initialState:y}=e,[x,re]=(0,F.useState)(),[S,C]=(0,F.useState)(),[w,T]=(0,F.useState)(),E=(0,F.useState)(()=>({current:null}))[0],D=(0,F.useState)(()=>({current:null}))[0],ie=A.theme({"&":{height:u,minHeight:d,maxHeight:f,width:p,minWidth:m,maxWidth:h},"& .cm-scroller":{height:`100% !important`}}),O=[A.updateListener.of(e=>{e.docChanged&&typeof r==`function`&&!e.transactions.some(e=>e.annotation(Ia))&&(E.current?E.current.reset():(E.current=new Ma(()=>{if(D.current){var e=D.current;D.current=null,e()}E.current=null},La),Fa().add(E.current)),r(e.state.doc.toString(),e)),i&&i(ja(e))}),ie,...Aa({theme:l,editable:_,readOnly:ee,placeholder:g,indentWithTab:v,basicSetup:te})];return o&&typeof o==`function`&&O.push(A.updateListener.of(o)),O=O.concat(s),(0,F.useLayoutEffect)(()=>{if(x&&!w){var e={doc:t,selection:n,extensions:O},r=y?k.fromJSON(y.json,e,y.fields):k.create(e);if(T(r),!S){var i=new A({state:r,parent:x,root:ne});C(i),a&&a(i,r)}}return()=>{S&&(T(void 0),C(void 0))}},[x,w]),(0,F.useEffect)(()=>{e.container&&re(e.container)},[e.container]),(0,F.useEffect)(()=>()=>{S&&(S.destroy(),C(void 0)),E.current&&=(E.current.cancel(),null)},[S]),(0,F.useEffect)(()=>{c&&S&&S.focus()},[c,S]),(0,F.useEffect)(()=>{S&&S.dispatch({effects:b.reconfigure.of(O)})},[l,s,u,d,f,p,m,h,g,_,ee,v,te,r,o]),(0,F.useEffect)(()=>{if(t!==void 0){var e=S?S.state.doc.toString():``;if(S&&t!==e){var n=E.current&&!E.current.isDone,r=()=>{S&&t!==S.state.doc.toString()&&S.dispatch({changes:{from:0,to:S.state.doc.toString().length,insert:t||``},annotations:[Ia.of(!0)]})};n?D.current=r:r()}}},[t,S]),{state:w,setState:T,view:S,setView:C,container:x,setContainer:re}}var Ba=t(),Va=[`className`,`value`,`selection`,`extensions`,`onChange`,`onStatistics`,`onCreateEditor`,`onUpdate`,`autoFocus`,`theme`,`height`,`minHeight`,`maxHeight`,`width`,`minWidth`,`maxWidth`,`basicSetup`,`placeholder`,`indentWithTab`,`editable`,`readOnly`,`root`,`initialState`],Ha=(0,F.forwardRef)((e,t)=>{var{className:n,value:r=``,selection:i,extensions:a=[],onChange:o,onStatistics:s,onCreateEditor:c,onUpdate:l,autoFocus:u,theme:d=`light`,height:f,minHeight:p,maxHeight:m,width:h,minWidth:g,maxWidth:_,basicSetup:ee,placeholder:v,indentWithTab:te,editable:ne,readOnly:y,root:b,initialState:x}=e,re=mt(e,Va),S=(0,F.useRef)(null),{state:C,view:w,container:T,setContainer:E}=za({root:b,value:r,autoFocus:u,theme:d,height:f,minHeight:p,maxHeight:m,width:h,minWidth:g,maxWidth:_,basicSetup:ee,placeholder:v,indentWithTab:te,editable:ne,readOnly:y,selection:i,onChange:o,onStatistics:s,onCreateEditor:c,onUpdate:l,extensions:a,initialState:x});(0,F.useImperativeHandle)(t,()=>({editor:S.current,state:C,view:w}),[S,T,C,w]);var D=(0,F.useCallback)(e=>{S.current=e,E(e)},[E]);if(typeof r!=`string`)throw Error(`value must be typeof string but got `+typeof r);return(0,Ba.jsx)(`div`,pt({ref:D,className:(typeof d==`string`?`cm-theme-`+d:`cm-theme`)+(n?` `+n:``)},re))});Ha.displayName=`CodeMirror`;export{Be as Annotation,w as AnnotationType,m as BidiSpan,te as BlockInfo,S as BlockType,ae as BlockWrapper,T as ChangeDesc,D as ChangeSet,h as CharCategory,ne as Compartment,N as Decoration,s as Direction,C as EditorSelection,k as EditorState,A as EditorView,Ia as ExternalChange,P as Facet,ee as GutterMarker,c as Line,fe as MapMode,ue as MatchDecorator,v as Prec,de as Range,me as RangeSet,_ as RangeSetBuilder,re as RangeValue,pe as RectangleMarker,Qe as SelectionRange,b as StateEffect,ve as StateEffectType,ge as StateField,be as Text,O as Transaction,g as ViewPlugin,x as ViewUpdate,Ze as WidgetType,y as __test,sa as basicSetup,_e as closeHoverTooltips,i as codePointAt,Me as codePointSize,Ta as color,M as combineConfig,Ke as countColumn,he as crosshairCursor,Ha as default,ka as defaultLightThemeOption,ye as drawSelection,ie as dropCursor,j as findClusterBreak,Re as findColumn,we as fromCodePoint,Aa as getDefaultExtensions,r as getDialog,Ne as getDrawSelectionConfig,it as getPanel,ja as getStatistics,qe as getTooltip,et as gutter,ze as gutterLineClass,Te as gutterWidgetClass,Je as gutters,nt as hasHoverTooltips,ke as highlightActiveLine,He as highlightActiveLineGutter,at as highlightSpecialChars,je as highlightTrailingWhitespace,Pe as highlightWhitespace,Xe as hoverTooltip,We as keymap,Le as layer,Fe as lineNumberMarkers,Se as lineNumberWidgetMarker,st as lineNumbers,ft as logException,ca as minimalSetup,Oa as oneDark,Da as oneDarkHighlightStyle,Ea as oneDarkTheme,De as panels,dt as placeholder,se as rectangularSelection,u as repositionTooltips,lt as runScopeHandlers,le as scrollPastEnd,p as showDialog,f as showPanel,E as showTooltip,Ve as tooltips,za as useCodeMirror};
3
- //# sourceMappingURL=esm-DCbn6xno.js.map
2
+ `:t==`r`?`\r`:t==`t`?` `:`\\`)}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new ci(this):new ri(this)}getCursor(e,t=0,n){let r=e.doc?e:k.create({doc:e});return n??=r.doc.length,this.regexp?Y(this,r,t,n):J(this,r,t,n)}},ei=class{constructor(e){this.spec=e}};function ti(e,t,n){return(r,i,a,o)=>n&&!n(r,i,a,o)?!1:e(r>=o&&i<=o+a.length?a.slice(r-o,i-o):t.doc.sliceString(r,i),t,r,i)}function J(e,t,n,r){let i;return e.wholeWord&&(i=ni(t.doc,t.charCategorizer(t.selection.main.head))),e.test&&(i=ti(e.test,t,i)),new K(t.doc,e.unquoted,n,r,e.caseSensitive?void 0:e=>e.toLowerCase(),i)}function ni(e,t){return(n,r,i,a)=>((a>n||a+i.length<r)&&(a=Math.max(0,n-2),i=e.sliceString(a,Math.min(e.length,r+2))),(t(ai(i,n-a))!=h.Word||t(oi(i,n-a))!=h.Word)&&(t(oi(i,r-a))!=h.Word||t(ai(i,r-a))!=h.Word))}var ri=class extends ei{constructor(e){super(e)}nextMatch(e,t,n){let r=J(this.spec,e,n,e.doc.length).nextOverlapping();if(r.done){let n=Math.min(e.doc.length,t+this.spec.unquoted.length);r=J(this.spec,e,0,n).nextOverlapping()}return r.done||r.value.from==t&&r.value.to==n?null:r.value}prevMatchInRange(e,t,n){for(let r=n;;){let n=Math.max(t,r-1e4-this.spec.unquoted.length),i=J(this.spec,e,n,r),a=null;for(;!i.nextOverlapping().done;)a=i.value;if(a)return a;if(n==t)return null;r-=1e4}}prevMatch(e,t,n){let r=this.prevMatchInRange(e,0,t);return r||=this.prevMatchInRange(e,Math.max(0,n-this.spec.unquoted.length),e.doc.length),r&&(r.from!=t||r.to!=n)?r:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let n=J(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let i=J(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}};function ii(e,t,n){return(r,i,a)=>(!n||n(r,i,a))&&e(a[0],t,r,i)}function Y(e,t,n,r){let i;return e.wholeWord&&(i=si(t.charCategorizer(t.selection.main.head))),e.test&&(i=ii(e.test,t,i)),new Pr(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:i},n,r)}function ai(e,t){return e.slice(j(e,t,!1),t)}function oi(e,t){return e.slice(t,j(e,t))}function si(e){return(t,n,r)=>!r[0].length||(e(ai(r.input,r.index))!=h.Word||e(oi(r.input,r.index))!=h.Word)&&(e(oi(r.input,r.index+r[0].length))!=h.Word||e(ai(r.input,r.index+r[0].length))!=h.Word)}var ci=class extends ei{nextMatch(e,t,n){let r=Y(this.spec,e,n,e.doc.length).next();return r.done&&(r=Y(this.spec,e,0,t).next()),r.done?null:r.value}prevMatchInRange(e,t,n){for(let r=1;;r++){let i=Math.max(t,n-r*1e4),a=Y(this.spec,e,i,n),o=null;for(;!a.next().done;)o=a.value;if(o&&(i==t||o.from>i+10))return o;if(i==t)return null}}prevMatch(e,t,n){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,n)=>{if(n==`&`)return e.match[0];if(n==`$`)return`$`;for(let t=n.length;t>0;t--){let r=+n.slice(0,t);if(r>0&&r<e.match.length)return e.match[r]+n.slice(t)}return t})}matchAll(e,t){let n=Y(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let i=Y(this.spec,e,Math.max(0,t-250),Math.min(n+250,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}},li=b.define(),ui=b.define(),X=ge.define({create(e){return new di(Ci(e).create(),null)},update(e,t){for(let n of t.effects)n.is(li)?e=new di(n.value.create(),e.panel):n.is(ui)&&(e=new di(e.query,n.value?Si:null));return e},provide:e=>f.from(e,e=>e.panel)}),di=class{constructor(e,t){this.query=e,this.panel=t}},fi=N.mark({class:`cm-searchMatch`}),pi=N.mark({class:`cm-searchMatch cm-searchMatch-selected`}),mi=g.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(X))}update(e){let t=e.state.field(X);(t!=e.startState.field(X)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return N.none;let{view:n}=this,r=new _;for(let t=0,i=n.visibleRanges,a=i.length;t<a;t++){let{from:o,to:s}=i[t];for(;t<a-1&&s>i[t+1].from-500;)s=i[++t].to;e.highlight(n.state,o,s,(e,t)=>{let i=n.state.selection.ranges.some(n=>n.from==e&&n.to==t);r.add(e,t,i?pi:fi)})}return r.finish()}},{decorations:e=>e.decorations});function hi(e){return t=>{let n=t.state.field(X,!1);return n&&n.query.spec.valid?e(t,n):Ei(t)}}var gi=hi((e,{query:t})=>{let{to:n}=e.state.selection.main,r=t.nextMatch(e.state,n,n);if(!r)return!1;let i=C.single(r.from,r.to),a=e.state.facet(q);return e.dispatch({selection:i,effects:[Mi(e,r),a.scrollToMatch(i.main,e)],userEvent:`select.search`}),Ti(e),!0}),_i=hi((e,{query:t})=>{let{state:n}=e,{from:r}=n.selection.main,i=t.prevMatch(n,r,r);if(!i)return!1;let a=C.single(i.from,i.to),o=e.state.facet(q);return e.dispatch({selection:a,effects:[Mi(e,i),o.scrollToMatch(a.main,e)],userEvent:`select.search`}),Ti(e),!0}),vi=hi((e,{query:t})=>{let n=t.matchAll(e.state,1e3);return!n||!n.length?!1:(e.dispatch({selection:C.create(n.map(e=>C.range(e.from,e.to))),userEvent:`select.search.matches`}),!0)}),yi=({state:e,dispatch:t})=>{let n=e.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:r,to:i}=n.main,a=[],o=0;for(let t=new K(e.doc,e.sliceDoc(r,i));!t.next().done;){if(a.length>1e3)return!1;t.value.from==r&&(o=a.length),a.push(C.range(t.value.from,t.value.to))}return t(e.update({selection:C.create(a,o),userEvent:`select.search.matches`})),!0},bi=hi((e,{query:t})=>{let{state:n}=e,{from:r,to:i}=n.selection.main;if(n.readOnly)return!1;let a=t.nextMatch(n,r,r);if(!a)return!1;let o=a,s=[],c,l,u=[];o.from==r&&o.to==i&&(l=n.toText(t.getReplacement(o)),s.push({from:o.from,to:o.to,insert:l}),o=t.nextMatch(n,o.from,o.to),u.push(A.announce.of(n.phrase(`replaced match on line $`,n.doc.lineAt(r).number)+`.`)));let d=e.state.changes(s);return o&&(c=C.single(o.from,o.to).map(d),u.push(Mi(e,o)),u.push(n.facet(q).scrollToMatch(c.main,e))),e.dispatch({changes:d,selection:c,effects:u,userEvent:`input.replace`}),!0}),xi=hi((e,{query:t})=>{if(e.state.readOnly)return!1;let n=t.matchAll(e.state,1e9).map(e=>{let{from:n,to:r}=e;return{from:n,to:r,insert:t.getReplacement(e)}});if(!n.length)return!1;let r=e.state.phrase(`replaced $ matches`,n.length)+`.`;return e.dispatch({changes:n,effects:A.announce.of(r),userEvent:`input.replace.all`}),!0});function Si(e){return e.state.facet(q).createPanel(e)}function Ci(e,t){let n=e.selection.main,r=n.empty||n.to>n.from+100?``:e.sliceDoc(n.from,n.to);if(t&&!r)return t;let i=e.facet(q);return new $r({search:t?.literal??i.literal?r:r.replace(/\n/g,`\\n`),caseSensitive:t?.caseSensitive??i.caseSensitive,literal:t?.literal??i.literal,regexp:t?.regexp??i.regexp,wholeWord:t?.wholeWord??i.wholeWord})}function wi(e){let t=it(e,Si);return t&&t.dom.querySelector(`[main-field]`)}function Ti(e){let t=wi(e);t&&t==e.root.activeElement&&t.select()}var Ei=e=>{let t=e.state.field(X,!1);if(t&&t.panel){let n=wi(e);if(n&&n!=e.root.activeElement){let r=Ci(e.state,t.query.spec);r.valid&&e.dispatch({effects:li.of(r)}),n.focus(),n.select()}}else e.dispatch({effects:[ui.of(!0),t?li.of(Ci(e.state,t.query.spec)):b.appendConfig.of(Pi)]});return!0},Di=e=>{let t=e.state.field(X,!1);if(!t||!t.panel)return!1;let n=it(e,Si);return n&&n.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:ui.of(!1)}),!0},Oi=[{key:`Mod-f`,run:Ei,scope:`editor search-panel`},{key:`F3`,run:gi,shift:_i,scope:`editor search-panel`,preventDefault:!0},{key:`Mod-g`,run:gi,shift:_i,scope:`editor search-panel`,preventDefault:!0},{key:`Escape`,run:Di,scope:`editor search-panel`},{key:`Mod-Shift-l`,run:yi},{key:`Mod-Alt-g`,run:Br},{key:`Mod-d`,run:Qr,preventDefault:!0}],ki=class{constructor(e){this.view=e;let t=this.query=e.state.field(X).query.spec;this.commit=this.commit.bind(this),this.searchField=o(`input`,{value:t.search,placeholder:Z(e,`Find`),"aria-label":Z(e,`Find`),class:`cm-textfield`,name:`search`,form:``,"main-field":`true`,onchange:this.commit,onkeyup:this.commit}),this.replaceField=o(`input`,{value:t.replace,placeholder:Z(e,`Replace`),"aria-label":Z(e,`Replace`),class:`cm-textfield`,name:`replace`,form:``,onchange:this.commit,onkeyup:this.commit}),this.caseField=o(`input`,{type:`checkbox`,name:`case`,form:``,checked:t.caseSensitive,onchange:this.commit}),this.reField=o(`input`,{type:`checkbox`,name:`re`,form:``,checked:t.regexp,onchange:this.commit}),this.wordField=o(`input`,{type:`checkbox`,name:`word`,form:``,checked:t.wholeWord,onchange:this.commit});function n(e,t,n){return o(`button`,{class:`cm-button`,name:e,onclick:t,type:`button`},n)}this.dom=o(`div`,{onkeydown:e=>this.keydown(e),class:`cm-search`},[this.searchField,n(`next`,()=>gi(e),[Z(e,`next`)]),n(`prev`,()=>_i(e),[Z(e,`previous`)]),n(`select`,()=>vi(e),[Z(e,`all`)]),o(`label`,null,[this.caseField,Z(e,`match case`)]),o(`label`,null,[this.reField,Z(e,`regexp`)]),o(`label`,null,[this.wordField,Z(e,`by word`)]),...e.state.readOnly?[]:[o(`br`),this.replaceField,n(`replace`,()=>bi(e),[Z(e,`replace`)]),n(`replaceAll`,()=>xi(e),[Z(e,`replace all`)])],o(`button`,{name:`close`,onclick:()=>Di(e),"aria-label":Z(e,`close`),type:`button`},[`×`])])}commit(){let e=new $r({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:li.of(e)}))}keydown(e){lt(this.view,e,`search-panel`)?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?_i:gi)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),bi(this.view))}update(e){for(let t of e.transactions)for(let e of t.effects)e.is(li)&&!e.value.eq(this.query)&&this.setQuery(e.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(q).top}};function Z(e,t){return e.state.phrase(t)}var Ai=30,ji=/[\s\.,:;?!]/;function Mi(e,{from:t,to:n}){let r=e.state.doc.lineAt(t),i=e.state.doc.lineAt(n).to,a=Math.max(r.from,t-Ai),o=Math.min(i,n+Ai),s=e.state.sliceDoc(a,o);if(a!=r.from){for(let e=0;e<Ai;e++)if(!ji.test(s[e+1])&&ji.test(s[e])){s=s.slice(e);break}}if(o!=i){for(let e=s.length-1;e>s.length-Ai;e--)if(!ji.test(s[e-1])&&ji.test(s[e])){s=s.slice(0,e);break}}return A.announce.of(`${e.state.phrase(`current match`)}. ${s} ${e.state.phrase(`on line`)} ${r.number}.`)}var Ni=A.baseTheme({".cm-panel.cm-search":{padding:`2px 6px 4px`,position:`relative`,"& [name=close]":{position:`absolute`,top:`0`,right:`4px`,backgroundColor:`inherit`,border:`none`,font:`inherit`,padding:0,margin:0},"& input, & button, & label":{margin:`.2em .6em .2em 0`},"& input[type=checkbox]":{marginRight:`.2em`},"& label":{fontSize:`80%`,whiteSpace:`pre`}},"&light .cm-searchMatch":{backgroundColor:`#ffff0054`},"&dark .cm-searchMatch":{backgroundColor:`#00ffff8a`},"&light .cm-searchMatch-selected":{backgroundColor:`#ff6a0054`},"&dark .cm-searchMatch-selected":{backgroundColor:`#ff00ff8a`}}),Pi=[X,v.low(mi),Ni],Fi=class{constructor(e,t,n){this.from=e,this.to=t,this.diagnostic=n}},Ii=class e{constructor(e,t,n){this.diagnostics=e,this.panel=t,this.selected=n}static init(t,n,r){let i=r.facet(Ji).markerFilter;i&&(t=i(t,r));let a=t.slice().sort((e,t)=>e.from-t.from||e.to-t.to),o=new _,s=[],c=0,l=r.doc.iter(),u=0,d=r.doc.length;for(let e=0;;){let t=e==a.length?null:a[e];if(!t&&!s.length)break;let n,r;if(s.length)n=c,r=s.reduce((e,t)=>Math.min(e,t.to),t&&t.from>n?t.from:1e8);else{if(n=t.from,n>d)break;r=t.to,s.push(t),e++}for(;e<a.length;){let t=a[e];if(t.from==n&&(t.to>t.from||t.to==n))s.push(t),e++,r=Math.min(t.to,r);else{r=Math.min(t.from,r);break}}r=Math.min(r,d);let i=!1;if(s.some(e=>e.from==n&&(e.to==r||r==d))&&(i=n==r,!i&&r-n<10)){let e=n-(u+l.value.length);e>0&&(l.next(e),u=n);for(let e=n;;){if(e>=r){i=!0;break}if(!l.lineBreak&&u+l.value.length>e)break;e=u+l.value.length,u+=l.value.length,l.next()}}let f=aa(s);if(i)o.add(n,n,N.widget({widget:new Qi(f),diagnostics:s.slice()}));else{let e=s.reduce((e,t)=>t.markClass?e+` `+t.markClass:e,``);o.add(n,r,N.mark({class:`cm-lintRange cm-lintRange-`+f+e,diagnostics:s.slice(),inclusiveEnd:s.some(e=>e.to>r)}))}if(c=r,c==d)break;for(let e=0;e<s.length;e++)s[e].to<=c&&s.splice(e--,1)}let f=o.finish();return new e(f,n,Q(f))}};function Q(e,t=null,n=0){let r=null;return e.between(n,1e9,(e,n,{spec:i})=>{if(!(t&&i.diagnostics.indexOf(t)<0))if(!r)r=new Fi(e,n,t||i.diagnostics[0]);else if(i.diagnostics.indexOf(r.diagnostic)<0)return!1;else r=new Fi(r.from,n,r.diagnostic)}),r}function Li(e,t){let n=t.pos,r=t.end||n,i=e.state.facet(Ji).hideOn(e,n,r);if(i!=null)return i;let a=e.startState.doc.lineAt(t.pos);return!!(e.effects.some(e=>e.is(zi))||e.changes.touchesRange(a.from,Math.max(a.to,r)))}function Ri(e,t){return e.field($,!1)?t:t.concat(b.appendConfig.of(oa))}var zi=b.define(),Bi=b.define(),Vi=b.define(),$=ge.define({create(){return new Ii(N.none,null,null)},update(e,t){if(t.docChanged&&e.diagnostics.size){let n=e.diagnostics.map(t.changes),r=null,i=e.panel;if(e.selected){let i=t.changes.mapPos(e.selected.from,1);r=Q(n,e.selected.diagnostic,i)||Q(n,null,i)}!n.size&&i&&t.state.facet(Ji).autoPanel&&(i=null),e=new Ii(n,i,r)}for(let n of t.effects)if(n.is(zi)){let r=t.state.facet(Ji).autoPanel?n.value.length?ea.open:null:e.panel;e=Ii.init(n.value,r,t.state)}else n.is(Bi)?e=new Ii(e.diagnostics,n.value?ea.open:null,e.selected):n.is(Vi)&&(e=new Ii(e.diagnostics,e.panel,n.value));return e},provide:e=>[f.from(e,e=>e.panel),A.decorations.from(e,e=>e.diagnostics)]}),Hi=N.mark({class:`cm-lintRange cm-lintRange-active`});function Ui(e,t,n){let{diagnostics:r}=e.state.field($),i,a=-1,o=-1;r.between(t-(n<0?1:0),t+(n>0?1:0),(e,r,{spec:s})=>{if(t>=e&&t<=r&&(e==r||(t>e||n>0)&&(t<r||n<0)))return i=s.diagnostics,a=e,o=r,!1});let s=e.state.facet(Ji).tooltipFilter;return i&&s&&(i=s(i,e.state)),i?{pos:a,end:o,above:e.state.doc.lineAt(a).to<o,create(){return{dom:Wi(e,i)}}}:null}function Wi(e,t){return o(`ul`,{class:`cm-tooltip-lint`},t.map(t=>Zi(e,t,!1)))}var Gi=e=>{let t=e.state.field($,!1);(!t||!t.panel)&&e.dispatch({effects:Ri(e.state,[Bi.of(!0)])});let n=it(e,ea.open);return n&&n.dom.querySelector(`.cm-panel-lint ul`).focus(),!0},Ki=e=>{let t=e.state.field($,!1);return!t||!t.panel?!1:(e.dispatch({effects:Bi.of(!1)}),!0)},qi=[{key:`Mod-Shift-m`,run:Gi,preventDefault:!0},{key:`F8`,run:e=>{let t=e.state.field($,!1);if(!t)return!1;let n=e.state.selection.main,r=Q(t.diagnostics,null,n.to+1);return!r&&(r=Q(t.diagnostics,null,0),!r||r.from==n.from&&r.to==n.to)?!1:(e.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),!0)}}],Ji=P.define({combine(e){return{sources:e.map(e=>e.source).filter(e=>e!=null),...M(e.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:Yi,tooltipFilter:Yi,needsRefresh:(e,t)=>e?t?n=>e(n)||t(n):e:t,hideOn:(e,t)=>e?t?(n,r,i)=>e(n,r,i)||t(n,r,i):e:t,autoPanel:(e,t)=>e||t})}}});function Yi(e,t){return e?t?(n,r)=>t(e(n,r),r):e:t}function Xi(e){let t=[];if(e)actions:for(let{name:n}of e){for(let e=0;e<n.length;e++){let r=n[e];if(/[a-zA-Z]/.test(r)&&!t.some(e=>e.toLowerCase()==r.toLowerCase())){t.push(r);continue actions}}t.push(``)}return t}function Zi(e,t,n){let r=n?Xi(t.actions):[];return o(`li`,{class:`cm-diagnostic cm-diagnostic-`+t.severity},o(`span`,{class:`cm-diagnosticText`},t.renderMessage?t.renderMessage(e):t.message),t.actions?.map((n,i)=>{let a=!1,s=r=>{if(r.preventDefault(),a)return;a=!0;let i=Q(e.state.field($).diagnostics,t);i&&n.apply(e,i.from,i.to)},{name:c}=n,l=r[i]?c.indexOf(r[i]):-1,u=l<0?c:[c.slice(0,l),o(`u`,c.slice(l,l+1)),c.slice(l+1)];return o(`button`,{type:`button`,class:`cm-diagnosticAction`+(n.markClass?` `+n.markClass:``),onclick:s,onmousedown:s,"aria-label":` Action: ${c}${l<0?``:` (access key "${r[i]})"`}.`},u)}),t.source&&o(`div`,{class:`cm-diagnosticSource`},t.source))}var Qi=class extends Ze{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return o(`span`,{class:`cm-lintPoint cm-lintPoint-`+this.sev})}},$i=class{constructor(e,t){this.diagnostic=t,this.id=`item_`+Math.floor(Math.random()*4294967295).toString(16),this.dom=Zi(e,t,!0),this.dom.id=this.id,this.dom.setAttribute(`role`,`option`)}},ea=class e{constructor(e){this.view=e,this.items=[];let t=t=>{if(!(t.ctrlKey||t.altKey||t.metaKey)){if(t.keyCode==27)Ki(this.view),this.view.focus();else if(t.keyCode==38||t.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(t.keyCode==40||t.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(t.keyCode==36)this.moveSelection(0);else if(t.keyCode==35)this.moveSelection(this.items.length-1);else if(t.keyCode==13)this.view.focus();else if(t.keyCode>=65&&t.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:n}=this.items[this.selectedIndex],r=Xi(n.actions);for(let i=0;i<r.length;i++)if(r[i].toUpperCase().charCodeAt(0)==t.keyCode){let t=Q(this.view.state.field($).diagnostics,n);t&&n.actions[i].apply(e,t.from,t.to)}}else return;t.preventDefault()}},n=e=>{for(let t=0;t<this.items.length;t++)this.items[t].dom.contains(e.target)&&this.moveSelection(t)};this.list=o(`ul`,{tabIndex:0,role:`listbox`,"aria-label":this.view.state.phrase(`Diagnostics`),onkeydown:t,onclick:n}),this.dom=o(`div`,{class:`cm-panel-lint`},this.list,o(`button`,{type:`button`,name:`close`,"aria-label":this.view.state.phrase(`close`),onclick:()=>Ki(this.view)},`×`)),this.update()}get selectedIndex(){let e=this.view.state.field($).selected;if(!e)return-1;for(let t=0;t<this.items.length;t++)if(this.items[t].diagnostic==e.diagnostic)return t;return-1}update(){let{diagnostics:e,selected:t}=this.view.state.field($),n=0,r=!1,i=null,a=new Set;for(e.between(0,this.view.state.doc.length,(e,o,{spec:s})=>{for(let e of s.diagnostics){if(a.has(e))continue;a.add(e);let o=-1,s;for(let t=n;t<this.items.length;t++)if(this.items[t].diagnostic==e){o=t;break}o<0?(s=new $i(this.view,e),this.items.splice(n,0,s),r=!0):(s=this.items[o],o>n&&(this.items.splice(n,o-n),r=!0)),t&&s.diagnostic==t.diagnostic?s.dom.hasAttribute(`aria-selected`)||(s.dom.setAttribute(`aria-selected`,`true`),i=s):s.dom.hasAttribute(`aria-selected`)&&s.dom.removeAttribute(`aria-selected`),n++}});n<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)r=!0,this.items.pop();this.items.length==0&&(this.items.push(new $i(this.view,{from:-1,to:-1,severity:`info`,message:this.view.state.phrase(`No diagnostics`)})),r=!0),i?(this.list.setAttribute(`aria-activedescendant`,i.id),this.view.requestMeasure({key:this,read:()=>({sel:i.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:e,panel:t})=>{let n=t.height/this.list.offsetHeight;e.top<t.top?this.list.scrollTop-=(t.top-e.top)/n:e.bottom>t.bottom&&(this.list.scrollTop+=(e.bottom-t.bottom)/n)}})):this.selectedIndex<0&&this.list.removeAttribute(`aria-activedescendant`),r&&this.sync()}sync(){let e=this.list.firstChild;function t(){let t=e;e=t.nextSibling,t.remove()}for(let n of this.items)if(n.dom.parentNode==this.list){for(;e!=n.dom;)t();e=n.dom.nextSibling}else this.list.insertBefore(n.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=Q(this.view.state.field($).diagnostics,this.items[e].diagnostic);t&&this.view.dispatch({selection:{anchor:t.from,head:t.to},scrollIntoView:!0,effects:Vi.of(t)})}static open(t){return new e(t)}};function ta(e,t=`viewBox="0 0 40 40"`){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${t}>${encodeURIComponent(e)}</svg>')`}function na(e){return ta(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${e}" fill="none" stroke-width=".7"/>`,`width="6" height="3"`)}var ra=A.baseTheme({".cm-diagnostic":{padding:`3px 6px 3px 8px`,marginLeft:`-1px`,display:`block`,whiteSpace:`pre-wrap`},".cm-diagnostic-error":{borderLeft:`5px solid #d11`},".cm-diagnostic-warning":{borderLeft:`5px solid orange`},".cm-diagnostic-info":{borderLeft:`5px solid #999`},".cm-diagnostic-hint":{borderLeft:`5px solid #66d`},".cm-diagnosticAction":{font:`inherit`,border:`none`,padding:`2px 4px`,backgroundColor:`#444`,color:`white`,borderRadius:`3px`,marginLeft:`8px`,cursor:`pointer`},".cm-diagnosticSource":{fontSize:`70%`,opacity:.7},".cm-lintRange":{backgroundPosition:`left bottom`,backgroundRepeat:`repeat-x`,paddingBottom:`0.7px`},".cm-lintRange-error":{backgroundImage:na(`#d11`)},".cm-lintRange-warning":{backgroundImage:na(`orange`)},".cm-lintRange-info":{backgroundImage:na(`#999`)},".cm-lintRange-hint":{backgroundImage:na(`#66d`)},".cm-lintRange-active":{backgroundColor:`#ffdd9980`},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:`relative`,"&:after":{content:`""`,position:`absolute`,bottom:0,left:`-2px`,borderLeft:`3px solid transparent`,borderRight:`3px solid transparent`,borderBottom:`4px solid #d11`}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:`orange`}},".cm-lintPoint-info":{"&:after":{borderBottomColor:`#999`}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:`#66d`}},".cm-panel.cm-panel-lint":{position:`relative`,"& ul":{maxHeight:`100px`,overflowY:`auto`,"& [aria-selected]":{backgroundColor:`#ddd`,"& u":{textDecoration:`underline`}},"&:focus [aria-selected]":{background_fallback:`#bdf`,backgroundColor:`Highlight`,color_fallback:`white`,color:`HighlightText`},"& u":{textDecoration:`none`},padding:0,margin:0},"& [name=close]":{position:`absolute`,top:`0`,right:`2px`,background:`inherit`,border:`none`,font:`inherit`,padding:0,margin:0}},"&dark .cm-lintRange-active":{backgroundColor:`#86714a80`},"&dark .cm-panel.cm-panel-lint ul":{"& [aria-selected]":{backgroundColor:`#2e343e`}}});function ia(e){return e==`error`?4:e==`warning`?3:e==`info`?2:1}function aa(e){let t=`hint`,n=1;for(let r of e){let e=ia(r.severity);e>n&&(n=e,t=r.severity)}return t}var oa=[$,A.decorations.compute([$],e=>{let{selected:t,panel:n}=e.field($);return!t||!n||t.from==t.to?N.none:N.set([Hi.range(t.from,t.to)])}),Xe(Ui,{hideOn:Li}),ra],sa=function(e){e===void 0&&(e={});var{crosshairCursor:t=!1}=e,n=[];e.closeBracketsKeymap!==!1&&(n=n.concat($e)),e.defaultKeymap!==!1&&(n=n.concat(kr)),e.searchKeymap!==!1&&(n=n.concat(Oi)),e.historyKeymap!==!1&&(n=n.concat(Kt)),e.foldKeymap!==!1&&(n=n.concat(Ie)),e.completionKeymap!==!1&&(n=n.concat(Ce)),e.lintKeymap!==!1&&(n=n.concat(qi));var r=[];return e.lineNumbers!==!1&&r.push(st()),e.highlightActiveLineGutter!==!1&&r.push(He()),e.highlightSpecialChars!==!1&&r.push(at()),e.history!==!1&&r.push(At()),e.foldGutter!==!1&&r.push(Ue()),e.drawSelection!==!1&&r.push(ye()),e.dropCursor!==!1&&r.push(ie()),e.allowMultipleSelections!==!1&&r.push(k.allowMultipleSelections.of(!0)),e.indentOnInput!==!1&&r.push(Ee()),e.syntaxHighlighting!==!1&&r.push(ct(Ye,{fallback:!0})),e.bracketMatching!==!1&&r.push(Ae()),e.closeBrackets!==!1&&r.push(Ge()),e.autocompletion!==!1&&r.push(rt()),e.rectangularSelection!==!1&&r.push(se()),t!==!1&&r.push(he()),e.highlightActiveLine!==!1&&r.push(ke()),e.highlightSelectionMatches!==!1&&r.push(Ur()),e.tabSize&&typeof e.tabSize==`number`&&r.push(oe.of(` `.repeat(e.tabSize))),r.concat([We.of(n.flat())]).filter(Boolean)},ca=function(e){e===void 0&&(e={});var t=[];e.defaultKeymap!==!1&&(t=t.concat(kr)),e.historyKeymap!==!1&&(t=t.concat(Kt));var n=[];return e.highlightSpecialChars!==!1&&n.push(at()),e.history!==!1&&n.push(At()),e.drawSelection!==!1&&n.push(ye()),e.syntaxHighlighting!==!1&&n.push(ct(Ye,{fallback:!0})),n.concat([We.of(t.flat())]).filter(Boolean)},la=`#e5c07b`,ua=`#e06c75`,da=`#56b6c2`,fa=`#ffffff`,pa=`#abb2bf`,ma=`#7d8799`,ha=`#61afef`,ga=`#98c379`,_a=`#d19a66`,va=`#c678dd`,ya=`#21252b`,ba=`#2c313a`,xa=`#282c34`,Sa=`#353a42`,Ca=`#3E4451`,wa=`#528bff`,Ta={chalky:la,coral:ua,cyan:da,invalid:fa,ivory:pa,stone:ma,malibu:ha,sage:ga,whiskey:_a,violet:va,darkBackground:ya,highlightBackground:ba,background:xa,tooltipBackground:Sa,selection:Ca,cursor:wa},Ea=A.theme({"&":{color:pa,backgroundColor:xa},".cm-content":{caretColor:wa},".cm-cursor, .cm-dropCursor":{borderLeftColor:wa},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:Ca},".cm-panels":{backgroundColor:ya,color:pa},".cm-panels.cm-panels-top":{borderBottom:`2px solid black`},".cm-panels.cm-panels-bottom":{borderTop:`2px solid black`},".cm-searchMatch":{backgroundColor:`#72a1ff59`,outline:`1px solid #457dff`},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:`#6199ff2f`},".cm-activeLine":{backgroundColor:`#6699ff0b`},".cm-selectionMatch":{backgroundColor:`#aafe661a`},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:`#bad0f847`},".cm-gutters":{backgroundColor:xa,color:ma,border:`none`},".cm-activeLineGutter":{backgroundColor:ba},".cm-foldPlaceholder":{backgroundColor:`transparent`,border:`none`,color:`#ddd`},".cm-tooltip":{border:`none`,backgroundColor:Sa},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:`transparent`,borderBottomColor:`transparent`},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:Sa,borderBottomColor:Sa},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:ba,color:pa}}},{dark:!0}),Da=tt.define([{tag:d.keyword,color:va},{tag:[d.name,d.deleted,d.character,d.propertyName,d.macroName],color:ua},{tag:[d.function(d.variableName),d.labelName],color:ha},{tag:[d.color,d.constant(d.name),d.standard(d.name)],color:_a},{tag:[d.definition(d.name),d.separator],color:pa},{tag:[d.typeName,d.className,d.number,d.changed,d.annotation,d.modifier,d.self,d.namespace],color:la},{tag:[d.operator,d.operatorKeyword,d.url,d.escape,d.regexp,d.link,d.special(d.string)],color:da},{tag:[d.meta,d.comment],color:ma},{tag:d.strong,fontWeight:`bold`},{tag:d.emphasis,fontStyle:`italic`},{tag:d.strikethrough,textDecoration:`line-through`},{tag:d.link,color:ma,textDecoration:`underline`},{tag:d.heading,fontWeight:`bold`,color:ua},{tag:[d.atom,d.bool,d.special(d.variableName)],color:_a},{tag:[d.processingInstruction,d.string,d.inserted],color:ga},{tag:d.invalid,color:fa}]),Oa=[Ea,ct(Da)],ka=A.theme({"&":{backgroundColor:`#fff`}},{dark:!1}),Aa=function(e){e===void 0&&(e={});var{indentWithTab:t=!0,editable:n=!0,readOnly:r=!1,theme:i=`light`,placeholder:a=``,basicSetup:o=!0}=e,s=[];switch(t&&s.unshift(We.of([Ar])),o&&(typeof o==`boolean`?s.unshift(sa()):s.unshift(sa(o))),a&&s.unshift(dt(a)),i){case`light`:s.push(ka);break;case`dark`:s.push(Oa);break;case`none`:break;default:s.push(i);break}return n===!1&&s.push(A.editable.of(!1)),r&&s.push(k.readOnly.of(!0)),[...s]},ja=e=>({line:e.state.doc.lineAt(e.state.selection.main.from),lineCount:e.state.doc.lines,lineBreak:e.state.lineBreak,length:e.state.doc.length,readOnly:e.state.readOnly,tabSize:e.state.tabSize,selection:e.state.selection,selectionAsSingle:e.state.selection.asSingle().main,ranges:e.state.selection.ranges,selectionCode:e.state.sliceDoc(e.state.selection.main.from,e.state.selection.main.to),selections:e.state.selection.ranges.map(t=>e.state.sliceDoc(t.from,t.to)),selectedText:e.state.selection.ranges.some(e=>!e.empty)}),Ma=class{constructor(e,t){this.timeLeftMS=void 0,this.timeoutMS=void 0,this.isCancelled=!1,this.isTimeExhausted=!1,this.callbacks=[],this.timeLeftMS=t,this.timeoutMS=t,this.callbacks.push(e)}tick(){if(!this.isCancelled&&!this.isTimeExhausted&&(this.timeLeftMS--,this.timeLeftMS<=0)){this.isTimeExhausted=!0;var e=this.callbacks.slice();this.callbacks.length=0,e.forEach(e=>{try{e()}catch(e){console.error(`TimeoutLatch callback error:`,e)}})}}cancel(){this.isCancelled=!0,this.callbacks.length=0}reset(){this.timeLeftMS=this.timeoutMS,this.isCancelled=!1,this.isTimeExhausted=!1}get isDone(){return this.isCancelled||this.isTimeExhausted}},Na=class{constructor(){this.interval=null,this.latches=new Set}add(e){this.latches.add(e),this.start()}remove(e){this.latches.delete(e),this.latches.size===0&&this.stop()}start(){this.interval===null&&(this.interval=setInterval(()=>{this.latches.forEach(e=>{e.tick(),e.isDone&&this.remove(e)})},1))}stop(){this.interval!==null&&(clearInterval(this.interval),this.interval=null)}},Pa=null,Fa=()=>typeof window>`u`?new Na:(Pa||=new Na,Pa),Ia=Be.define(),La=200,Ra=[];function za(e){var{value:t,selection:n,onChange:r,onStatistics:i,onCreateEditor:a,onUpdate:o,extensions:s=Ra,autoFocus:c,theme:l=`light`,height:u=null,minHeight:d=null,maxHeight:f=null,width:p=null,minWidth:m=null,maxWidth:h=null,placeholder:g=``,editable:_=!0,readOnly:ee=!1,indentWithTab:v=!0,basicSetup:te=!0,root:ne,initialState:y}=e,[x,re]=(0,F.useState)(),[S,C]=(0,F.useState)(),[w,T]=(0,F.useState)(),E=(0,F.useState)(()=>({current:null}))[0],D=(0,F.useState)(()=>({current:null}))[0],ie=A.theme({"&":{height:u,minHeight:d,maxHeight:f,width:p,minWidth:m,maxWidth:h},"& .cm-scroller":{height:`100% !important`}}),O=[A.updateListener.of(e=>{e.docChanged&&typeof r==`function`&&!e.transactions.some(e=>e.annotation(Ia))&&(E.current?E.current.reset():(E.current=new Ma(()=>{if(D.current){var e=D.current;D.current=null,e()}E.current=null},La),Fa().add(E.current)),r(e.state.doc.toString(),e)),i&&i(ja(e))}),ie,...Aa({theme:l,editable:_,readOnly:ee,placeholder:g,indentWithTab:v,basicSetup:te})];return o&&typeof o==`function`&&O.push(A.updateListener.of(o)),O=O.concat(s),(0,F.useLayoutEffect)(()=>{if(x&&!w){var e={doc:t,selection:n,extensions:O},r=y?k.fromJSON(y.json,e,y.fields):k.create(e);if(T(r),!S){var i=new A({state:r,parent:x,root:ne});C(i),a&&a(i,r)}}return()=>{S&&(T(void 0),C(void 0))}},[x,w]),(0,F.useEffect)(()=>{e.container&&re(e.container)},[e.container]),(0,F.useEffect)(()=>()=>{S&&(S.destroy(),C(void 0)),E.current&&=(E.current.cancel(),null)},[S]),(0,F.useEffect)(()=>{c&&S&&S.focus()},[c,S]),(0,F.useEffect)(()=>{S&&S.dispatch({effects:b.reconfigure.of(O)})},[l,s,u,d,f,p,m,h,g,_,ee,v,te,r,o]),(0,F.useEffect)(()=>{if(t!==void 0){var e=S?S.state.doc.toString():``;if(S&&t!==e){var n=E.current&&!E.current.isDone,r=()=>{S&&t!==S.state.doc.toString()&&S.dispatch({changes:{from:0,to:S.state.doc.toString().length,insert:t||``},annotations:[Ia.of(!0)]})};n?D.current=r:r()}}},[t,S]),{state:w,setState:T,view:S,setView:C,container:x,setContainer:re}}var Ba=t(),Va=[`className`,`value`,`selection`,`extensions`,`onChange`,`onStatistics`,`onCreateEditor`,`onUpdate`,`autoFocus`,`theme`,`height`,`minHeight`,`maxHeight`,`width`,`minWidth`,`maxWidth`,`basicSetup`,`placeholder`,`indentWithTab`,`editable`,`readOnly`,`root`,`initialState`],Ha=(0,F.forwardRef)((e,t)=>{var{className:n,value:r=``,selection:i,extensions:a=[],onChange:o,onStatistics:s,onCreateEditor:c,onUpdate:l,autoFocus:u,theme:d=`light`,height:f,minHeight:p,maxHeight:m,width:h,minWidth:g,maxWidth:_,basicSetup:ee,placeholder:v,indentWithTab:te,editable:ne,readOnly:y,root:b,initialState:x}=e,re=mt(e,Va),S=(0,F.useRef)(null),{state:C,view:w,container:T,setContainer:E}=za({root:b,value:r,autoFocus:u,theme:d,height:f,minHeight:p,maxHeight:m,width:h,minWidth:g,maxWidth:_,basicSetup:ee,placeholder:v,indentWithTab:te,editable:ne,readOnly:y,selection:i,onChange:o,onStatistics:s,onCreateEditor:c,onUpdate:l,extensions:a,initialState:x});(0,F.useImperativeHandle)(t,()=>({editor:S.current,state:C,view:w}),[S,T,C,w]);var D=(0,F.useCallback)(e=>{S.current=e,E(e)},[E]);if(typeof r!=`string`)throw Error(`value must be typeof string but got `+typeof r);return(0,Ba.jsx)(`div`,pt({ref:D,className:(typeof d==`string`?`cm-theme-`+d:`cm-theme`)+(n?` `+n:``)},re))});Ha.displayName=`CodeMirror`;export{Be as Annotation,w as AnnotationType,m as BidiSpan,te as BlockInfo,S as BlockType,ae as BlockWrapper,T as ChangeDesc,D as ChangeSet,h as CharCategory,ne as Compartment,N as Decoration,s as Direction,C as EditorSelection,k as EditorState,A as EditorView,Ia as ExternalChange,P as Facet,ee as GutterMarker,c as Line,fe as MapMode,ue as MatchDecorator,v as Prec,de as Range,me as RangeSet,_ as RangeSetBuilder,re as RangeValue,pe as RectangleMarker,Qe as SelectionRange,b as StateEffect,ve as StateEffectType,ge as StateField,be as Text,O as Transaction,g as ViewPlugin,x as ViewUpdate,Ze as WidgetType,y as __test,sa as basicSetup,_e as closeHoverTooltips,i as codePointAt,Me as codePointSize,Ta as color,M as combineConfig,Ke as countColumn,he as crosshairCursor,Ha as default,ka as defaultLightThemeOption,ye as drawSelection,ie as dropCursor,j as findClusterBreak,Re as findColumn,we as fromCodePoint,Aa as getDefaultExtensions,r as getDialog,Ne as getDrawSelectionConfig,it as getPanel,ja as getStatistics,qe as getTooltip,et as gutter,ze as gutterLineClass,Te as gutterWidgetClass,Je as gutters,nt as hasHoverTooltips,ke as highlightActiveLine,He as highlightActiveLineGutter,at as highlightSpecialChars,je as highlightTrailingWhitespace,Pe as highlightWhitespace,Xe as hoverTooltip,We as keymap,Le as layer,Fe as lineNumberMarkers,Se as lineNumberWidgetMarker,st as lineNumbers,ft as logException,ca as minimalSetup,Oa as oneDark,Da as oneDarkHighlightStyle,Ea as oneDarkTheme,De as panels,dt as placeholder,se as rectangularSelection,u as repositionTooltips,lt as runScopeHandlers,le as scrollPastEnd,p as showDialog,f as showPanel,E as showTooltip,Ve as tooltips,za as useCodeMirror};
@@ -1,4 +1,3 @@
1
- import{o as e}from"./rolldown-runtime-FhOqtrmT.js";import{b as t,x as n}from"./vendor-markdown-0Mxgxy0L.js";import{r}from"./api-client-DIhJ5qVW.js";import{q as i,y as a}from"./index-DkQ6jVSH.js";var o=e(n(),1),s=t(),c=`<script>
1
+ import{o as e}from"./rolldown-runtime-FhOqtrmT.js";import{b as t,x as n}from"./vendor-markdown-0Mxgxy0L.js";import{r}from"./api-client-DIhJ5qVW.js";import{q as i,y as a}from"./index-U7GK_3ED.js";var o=e(n(),1),s=t(),c=`<script>
2
2
  function acquireVsCodeApi(){return{postMessage:function(m){window.parent.postMessage(m,"*")},getState:function(){try{return JSON.parse(sessionStorage.getItem("vscode-state")||"null")}catch{return null}},setState:function(s){sessionStorage.setItem("vscode-state",JSON.stringify(s));return s}}}
3
- <\/script>`;function l(e){if(!e)return e;let t=e.indexOf(`<head>`);return t===-1?c+e:e.slice(0,t+6)+c+e.slice(t+6)}function u({metadata:e}){let t=e?.panelId,n=e?.viewType,c=e?.projectName||void 0,[u,d]=(0,o.useState)(!1),f=a(e=>e.contributions!==null),p=a(e=>{if(t&&e.webviewPanels[t])return e.webviewPanels[t];if(n){let t=n.includes(`.`)?n:`${n}.view`;return Object.values(e.webviewPanels).find(e=>e.viewType===n||e.viewType===t)}}),m=p?.id??t,h=(0,o.useRef)(null),g=p?.html??``,_=l(g),v=(0,o.useRef)(null);(0,o.useEffect)(()=>{if(p||!n||!f||c&&c===v.current)return;c&&(v.current=c);let e=n.includes(`.`)?n:`${n}.view`,t=!1;async function i(){let n=[];if(c)try{let e=r(),t=(await(await fetch(`/api/projects`,e?{headers:{Authorization:`Bearer ${e}`}}:{})).json()).data?.find(e=>e.name===c);t&&(n=[t.path])}catch{}t||window.dispatchEvent(new CustomEvent(`ext:command:execute`,{detail:{command:e,args:n}}))}return i(),()=>{t=!0}},[p,n,c,f]);let y=e?.extensionId,b=a(e=>{if(y&&e.activationErrors[y])return e.activationErrors[y];if(n){for(let[t,r]of Object.entries(e.activationErrors))if(t===`ext-${n}`)return r}}),x=(0,o.useCallback)(()=>{if(d(!1),!n)return;let e=n.includes(`.`)?n:`${n}.view`;(async()=>{try{let t=r(),n=(await(await fetch(`/api/projects`,t?{headers:{Authorization:`Bearer ${t}`}}:{})).json()).data?.find(e=>e.name===c),i=n?[n.path]:[];window.dispatchEvent(new CustomEvent(`ext:command:execute`,{detail:{command:e,args:i}}))}catch{}})()},[n,c]),S=(0,o.useRef)(null),C=(0,o.useRef)(n);return(0,o.useEffect)(()=>{S.current=m??null},[m]),(0,o.useEffect)(()=>{C.current=n},[n]),(0,o.useEffect)(()=>()=>{let e=S.current;if(e){let t=C.current;a.getState().removeWebviewPanel(e),window.dispatchEvent(new CustomEvent(`ext:webview:close`,{detail:{panelId:e,viewType:t}}))}},[]),(0,o.useEffect)(()=>{if(p){d(!1);return}if(!f||!n)return;let e=0,t=setInterval(()=>{if(e++,e>3){clearInterval(t),d(!0);return}x()},2e3);return()=>clearInterval(t)},[p,f,n,x]),(0,o.useEffect)(()=>{if(!m)return;let e=e=>{h.current&&e.source===h.current.contentWindow&&window.dispatchEvent(new CustomEvent(`ext:webview:send`,{detail:{panelId:m,message:e.data}}))};return window.addEventListener(`message`,e),()=>window.removeEventListener(`message`,e)},[m]),(0,o.useEffect)(()=>{if(!m)return;let e=e=>{let{panelId:t,message:n}=e.detail;t===m&&h.current?.contentWindow?.postMessage(n,`*`)};return window.addEventListener(`ext:webview:message`,e),()=>window.removeEventListener(`ext:webview:message`,e)},[m]),!p||!g?(0,s.jsx)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-sm text-text-subtle`,children:u?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(`span`,{className:`text-destructive font-medium`,children:`Extension failed to load`}),b&&(0,s.jsx)(`span`,{className:`text-xs text-muted-foreground max-w-md text-center`,children:b}),(0,s.jsx)(`button`,{onClick:x,className:`text-xs text-primary hover:underline`,children:`Retry`})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(i,{className:`size-5 animate-spin`}),(0,s.jsx)(`span`,{children:`Loading extension...`})]})}):(0,s.jsx)(`div`,{className:`h-full w-full relative`,children:(0,s.jsx)(`iframe`,{ref:h,srcDoc:_,sandbox:`allow-scripts`,className:`w-full h-full border-0 bg-white dark:bg-zinc-900`,title:p.title},m)})}export{u as ExtensionWebview};
4
- //# sourceMappingURL=extension-webview-DKSDoW_g.js.map
3
+ <\/script>`;function l(e){if(!e)return e;let t=e.indexOf(`<head>`);return t===-1?c+e:e.slice(0,t+6)+c+e.slice(t+6)}function u({metadata:e}){let t=e?.panelId,n=e?.viewType,c=e?.projectName||void 0,[u,d]=(0,o.useState)(!1),f=a(e=>e.contributions!==null),p=a(e=>{if(t&&e.webviewPanels[t])return e.webviewPanels[t];if(n){let t=n.includes(`.`)?n:`${n}.view`;return Object.values(e.webviewPanels).find(e=>e.viewType===n||e.viewType===t)}}),m=p?.id??t,h=(0,o.useRef)(null),g=p?.html??``,_=l(g),v=(0,o.useRef)(null);(0,o.useEffect)(()=>{if(p||!n||!f||c&&c===v.current)return;c&&(v.current=c);let e=n.includes(`.`)?n:`${n}.view`,t=!1;async function i(){let n=[];if(c)try{let e=r(),t=(await(await fetch(`/api/projects`,e?{headers:{Authorization:`Bearer ${e}`}}:{})).json()).data?.find(e=>e.name===c);t&&(n=[t.path])}catch{}t||window.dispatchEvent(new CustomEvent(`ext:command:execute`,{detail:{command:e,args:n}}))}return i(),()=>{t=!0}},[p,n,c,f]);let y=e?.extensionId,b=a(e=>{if(y&&e.activationErrors[y])return e.activationErrors[y];if(n){for(let[t,r]of Object.entries(e.activationErrors))if(t===`ext-${n}`)return r}}),x=(0,o.useCallback)(()=>{if(d(!1),!n)return;let e=n.includes(`.`)?n:`${n}.view`;(async()=>{try{let t=r(),n=(await(await fetch(`/api/projects`,t?{headers:{Authorization:`Bearer ${t}`}}:{})).json()).data?.find(e=>e.name===c),i=n?[n.path]:[];window.dispatchEvent(new CustomEvent(`ext:command:execute`,{detail:{command:e,args:i}}))}catch{}})()},[n,c]),S=(0,o.useRef)(null),C=(0,o.useRef)(n);return(0,o.useEffect)(()=>{S.current=m??null},[m]),(0,o.useEffect)(()=>{C.current=n},[n]),(0,o.useEffect)(()=>()=>{let e=S.current;if(e){let t=C.current;a.getState().removeWebviewPanel(e),window.dispatchEvent(new CustomEvent(`ext:webview:close`,{detail:{panelId:e,viewType:t}}))}},[]),(0,o.useEffect)(()=>{if(p){d(!1);return}if(!f||!n)return;let e=0,t=setInterval(()=>{if(e++,e>3){clearInterval(t),d(!0);return}x()},2e3);return()=>clearInterval(t)},[p,f,n,x]),(0,o.useEffect)(()=>{if(!m)return;let e=e=>{h.current&&e.source===h.current.contentWindow&&window.dispatchEvent(new CustomEvent(`ext:webview:send`,{detail:{panelId:m,message:e.data}}))};return window.addEventListener(`message`,e),()=>window.removeEventListener(`message`,e)},[m]),(0,o.useEffect)(()=>{if(!m)return;let e=e=>{let{panelId:t,message:n}=e.detail;t===m&&h.current?.contentWindow?.postMessage(n,`*`)};return window.addEventListener(`ext:webview:message`,e),()=>window.removeEventListener(`ext:webview:message`,e)},[m]),!p||!g?(0,s.jsx)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-sm text-text-subtle`,children:u?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(`span`,{className:`text-destructive font-medium`,children:`Extension failed to load`}),b&&(0,s.jsx)(`span`,{className:`text-xs text-muted-foreground max-w-md text-center`,children:b}),(0,s.jsx)(`button`,{onClick:x,className:`text-xs text-primary hover:underline`,children:`Retry`})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(i,{className:`size-5 animate-spin`}),(0,s.jsx)(`span`,{children:`Loading extension...`})]})}):(0,s.jsx)(`div`,{className:`h-full w-full relative`,children:(0,s.jsx)(`iframe`,{ref:h,srcDoc:_,sandbox:`allow-scripts`,className:`w-full h-full border-0 bg-white dark:bg-zinc-900`,title:p.title},m)})}export{u as ExtensionWebview};
@@ -1,2 +1 @@
1
- import{t as e}from"./createLucideIcon-BjHrJDVb.js";var t=e(`file-exclamation-point`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]);export{t};
2
- //# sourceMappingURL=file-exclamation-point-BwzaQ50n.js.map
1
+ import{t as e}from"./createLucideIcon-BjHrJDVb.js";var t=e(`file-exclamation-point`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]);export{t};
@@ -1,2 +1 @@
1
- import{t as e}from"./react-DMIOAtcX.js";import{i as t,t as n}from"./api-client-DIhJ5qVW.js";var r=`ppm-custom-order`;function i(){try{let e=localStorage.getItem(r);return e?JSON.parse(e):null}catch{return null}}function a(e){try{localStorage.setItem(r,JSON.stringify(e))}catch{}}function o(e,t){if(!t)return[...e];let n=new Map(t.map((e,t)=>[e,t]));return[...e].sort((e,t)=>(n.get(e.name)??1/0)-(n.get(t.name)??1/0))}var s=e((e,t)=>({projects:[],activeProject:null,customOrder:i(),loading:!1,error:null,fetchProjects:async()=>{e({loading:!0,error:null});try{e({projects:await n.get(`/api/projects`),loading:!1})}catch(t){e({error:t instanceof Error?t.message:`Failed to fetch projects`,loading:!1})}},setActiveProject:t=>{e({activeProject:t})},addProject:async(r,i)=>{let a=await n.post(`/api/projects`,{path:r,name:i});await t().fetchProjects();let o=t().projects.find(e=>e.name===(i??a.name)||e.path===r);return o&&e({activeProject:o}),a},setProjectColor:async(e,r)=>{await n.patch(`/api/projects/${encodeURIComponent(e)}/color`,{color:r}),await t().fetchProjects()},moveProject:async(r,i)=>{let{projects:s,customOrder:c}=t(),l=o(s,c),u=l.findIndex(e=>e.name===r);if(u===-1)return;let d=i===`up`?u-1:u+1;if(d<0||d>=l.length)return;let f=l.map(e=>e.name);[f[u],f[d]]=[f[d],f[u]],a(f),await n.patch(`/api/projects/reorder`,{order:f}),e({customOrder:f})},reorderProjects:async t=>{a(t),e({customOrder:t}),await n.patch(`/api/projects/reorder`,{order:t}).catch(()=>{})},renameProject:async(e,r)=>{await n.patch(`/api/projects/${encodeURIComponent(e)}`,{name:r}),await t().fetchProjects()},deleteProject:async t=>{await n.del(`/api/projects/${encodeURIComponent(t)}`),e(e=>{let n=e.projects.filter(e=>e.name!==t),r=e.customOrder?e.customOrder.filter(e=>e!==t):null;return r&&a(r),{projects:n,customOrder:r,activeProject:e.activeProject?.name===t?n[0]??null:e.activeProject}})}}));function c(e,t){return e.map(e=>({name:e.name,path:t?`${t}/${e.name}`:e.name,type:e.type,ignored:e.isIgnored}))}function l(e,t,n){return t?e.map(e=>u(e,t,n)):n.map(t=>{let n=e.find(e=>e.path===t.path);return n?{...t,children:n.children}:t})}function u(e,t,n){if(e.path===t){let t=n.map(t=>{let n=e.children?.find(e=>e.path===t.path);return n?{...t,children:n.children}:t});return{...e,children:t}}return e.children&&t.startsWith(e.path+`/`)?{...e,children:e.children.map(e=>u(e,t,n))}:e}var d=e((e,r)=>({tree:[],fileIndex:[],loading:!1,error:null,expandedPaths:new Set,loadedPaths:new Set,inflight:new Map,indexStatus:`idle`,selectedFiles:[],inlineAction:null,clipboard:null,focusedPath:null,setInlineAction:t=>e({inlineAction:t}),clearInlineAction:()=>e({inlineAction:null}),setClipboard:t=>e({clipboard:t}),setFocusedPath:t=>e({focusedPath:t}),loadRoot:async i=>{e({loading:!0,error:null});try{let a=c(await n.get(`${t(i)}/files/list?path=`),``),o=new Set(r().loadedPaths);o.add(``),e({tree:a,loading:!1,loadedPaths:o})}catch(t){e({error:t instanceof Error?t.message:`Failed to load files`,loading:!1})}},loadChildren:async(i,a)=>{let o=r();if(o.loadedPaths.has(a))return;let s=o.inflight.get(a);s&&s.abort();let u=new AbortController,d=new Map(o.inflight);d.set(a,u),e({inflight:d});try{let o=encodeURIComponent(a),s=await n.get(`${t(i)}/files/list?path=${o}`,{signal:u.signal});if(u.signal.aborted)return;let d=c(s,a),f=r(),p=l(f.tree,a,d),m=new Set(f.loadedPaths);m.add(a);let h=new Map(f.inflight);h.delete(a),e({tree:p,loadedPaths:m,inflight:h})}catch(t){if(t instanceof Error&&t.name===`AbortError`)return;let n=new Map(r().inflight);n.delete(a),e({inflight:n})}},loadIndex:async r=>{e({indexStatus:`loading`});try{e({fileIndex:await n.get(`${t(r)}/files/index`),indexStatus:`ready`})}catch{e({indexStatus:`error`})}},invalidateIndex:()=>{e({indexStatus:`idle`,fileIndex:[]})},invalidateFolder:async(t,n)=>{let i=r();if(!i.loadedPaths.has(n))return;let a=new Set(i.loadedPaths);a.delete(n),e({loadedPaths:a}),(!n||i.expandedPaths.has(n))&&await r().loadChildren(t,n)},toggleExpand:(t,n)=>{let i=r(),a=new Set(i.expandedPaths);a.has(n)?(a.delete(n),e({expandedPaths:a})):(a.add(n),e({expandedPaths:a}),i.loadedPaths.has(n)||r().loadChildren(t,n))},setExpanded:(t,n)=>{let i=new Set(r().expandedPaths);n?i.add(t):i.delete(t),e({expandedPaths:i})},collapseAll:()=>{e({expandedPaths:new Set})},toggleFileSelect:t=>{let n=r().selectedFiles;n.indexOf(t)>=0?e({selectedFiles:n.filter(e=>e!==t)}):e({selectedFiles:[...n,t]})},setSelectedFiles:t=>e({selectedFiles:t}),clearSelection:()=>e({selectedFiles:[]}),reset:()=>{for(let e of r().inflight.values())e.abort();e({tree:[],fileIndex:[],loading:!1,error:null,expandedPaths:new Set,loadedPaths:new Set,inflight:new Map,indexStatus:`idle`,selectedFiles:[],inlineAction:null,clipboard:null,focusedPath:null})},fetchTree:async e=>{await r().loadRoot(e),r().loadIndex(e)}}));function f(){let{tree:e,expandedPaths:t}=d.getState(),n=[];function r(e){let i=[...e].sort((e,t)=>e.type===t.type?e.name.localeCompare(t.name):e.type===`directory`?-1:1);for(let e of i){let i=e;if(e.type===`directory`&&t.has(e.path)&&e.children)for(;i.children&&i.children.length===1&&i.children[0].type===`directory`&&t.has(i.children[0].path);)i=i.children[0];n.push(i.path),i.type===`directory`&&t.has(i.path)&&i.children&&r(i.children)}}return r(e),n}export{s as i,d as n,o as r,f as t};
2
- //# sourceMappingURL=file-store-DOxcU_7s.js.map
1
+ import{t as e}from"./react-DMIOAtcX.js";import{i as t,t as n}from"./api-client-DIhJ5qVW.js";var r=`ppm-custom-order`;function i(){try{let e=localStorage.getItem(r);return e?JSON.parse(e):null}catch{return null}}function a(e){try{localStorage.setItem(r,JSON.stringify(e))}catch{}}function o(e,t){if(!t)return[...e];let n=new Map(t.map((e,t)=>[e,t]));return[...e].sort((e,t)=>(n.get(e.name)??1/0)-(n.get(t.name)??1/0))}var s=e((e,t)=>({projects:[],activeProject:null,customOrder:i(),loading:!1,error:null,fetchProjects:async()=>{e({loading:!0,error:null});try{e({projects:await n.get(`/api/projects`),loading:!1})}catch(t){e({error:t instanceof Error?t.message:`Failed to fetch projects`,loading:!1})}},setActiveProject:t=>{e({activeProject:t})},addProject:async(r,i)=>{let a=await n.post(`/api/projects`,{path:r,name:i});await t().fetchProjects();let o=t().projects.find(e=>e.name===(i??a.name)||e.path===r);return o&&e({activeProject:o}),a},setProjectColor:async(e,r)=>{await n.patch(`/api/projects/${encodeURIComponent(e)}/color`,{color:r}),await t().fetchProjects()},moveProject:async(r,i)=>{let{projects:s,customOrder:c}=t(),l=o(s,c),u=l.findIndex(e=>e.name===r);if(u===-1)return;let d=i===`up`?u-1:u+1;if(d<0||d>=l.length)return;let f=l.map(e=>e.name);[f[u],f[d]]=[f[d],f[u]],a(f),await n.patch(`/api/projects/reorder`,{order:f}),e({customOrder:f})},reorderProjects:async t=>{a(t),e({customOrder:t}),await n.patch(`/api/projects/reorder`,{order:t}).catch(()=>{})},renameProject:async(e,r)=>{await n.patch(`/api/projects/${encodeURIComponent(e)}`,{name:r}),await t().fetchProjects()},deleteProject:async t=>{await n.del(`/api/projects/${encodeURIComponent(t)}`),e(e=>{let n=e.projects.filter(e=>e.name!==t),r=e.customOrder?e.customOrder.filter(e=>e!==t):null;return r&&a(r),{projects:n,customOrder:r,activeProject:e.activeProject?.name===t?n[0]??null:e.activeProject}})}}));function c(e,t){return e.map(e=>({name:e.name,path:t?`${t}/${e.name}`:e.name,type:e.type,ignored:e.isIgnored}))}function l(e,t,n){return t?e.map(e=>u(e,t,n)):n.map(t=>{let n=e.find(e=>e.path===t.path);return n?{...t,children:n.children}:t})}function u(e,t,n){if(e.path===t){let t=n.map(t=>{let n=e.children?.find(e=>e.path===t.path);return n?{...t,children:n.children}:t});return{...e,children:t}}return e.children&&t.startsWith(e.path+`/`)?{...e,children:e.children.map(e=>u(e,t,n))}:e}var d=e((e,r)=>({tree:[],fileIndex:[],loading:!1,error:null,expandedPaths:new Set,loadedPaths:new Set,inflight:new Map,indexStatus:`idle`,selectedFiles:[],inlineAction:null,clipboard:null,focusedPath:null,setInlineAction:t=>e({inlineAction:t}),clearInlineAction:()=>e({inlineAction:null}),setClipboard:t=>e({clipboard:t}),setFocusedPath:t=>e({focusedPath:t}),loadRoot:async i=>{e({loading:!0,error:null});try{let a=c(await n.get(`${t(i)}/files/list?path=`),``),o=new Set(r().loadedPaths);o.add(``),e({tree:a,loading:!1,loadedPaths:o})}catch(t){e({error:t instanceof Error?t.message:`Failed to load files`,loading:!1})}},loadChildren:async(i,a)=>{let o=r();if(o.loadedPaths.has(a))return;let s=o.inflight.get(a);s&&s.abort();let u=new AbortController,d=new Map(o.inflight);d.set(a,u),e({inflight:d});try{let o=encodeURIComponent(a),s=await n.get(`${t(i)}/files/list?path=${o}`,{signal:u.signal});if(u.signal.aborted)return;let d=c(s,a),f=r(),p=l(f.tree,a,d),m=new Set(f.loadedPaths);m.add(a);let h=new Map(f.inflight);h.delete(a),e({tree:p,loadedPaths:m,inflight:h})}catch(t){if(t instanceof Error&&t.name===`AbortError`)return;let n=new Map(r().inflight);n.delete(a),e({inflight:n})}},loadIndex:async r=>{e({indexStatus:`loading`});try{e({fileIndex:await n.get(`${t(r)}/files/index`),indexStatus:`ready`})}catch{e({indexStatus:`error`})}},invalidateIndex:()=>{e({indexStatus:`idle`,fileIndex:[]})},invalidateFolder:async(t,n)=>{let i=r();if(!i.loadedPaths.has(n))return;let a=new Set(i.loadedPaths);a.delete(n),e({loadedPaths:a}),(!n||i.expandedPaths.has(n))&&await r().loadChildren(t,n)},toggleExpand:(t,n)=>{let i=r(),a=new Set(i.expandedPaths);a.has(n)?(a.delete(n),e({expandedPaths:a})):(a.add(n),e({expandedPaths:a}),i.loadedPaths.has(n)||r().loadChildren(t,n))},setExpanded:(t,n)=>{let i=new Set(r().expandedPaths);n?i.add(t):i.delete(t),e({expandedPaths:i})},collapseAll:()=>{e({expandedPaths:new Set})},toggleFileSelect:t=>{let n=r().selectedFiles;n.indexOf(t)>=0?e({selectedFiles:n.filter(e=>e!==t)}):e({selectedFiles:[...n,t]})},setSelectedFiles:t=>e({selectedFiles:t}),clearSelection:()=>e({selectedFiles:[]}),reset:()=>{for(let e of r().inflight.values())e.abort();e({tree:[],fileIndex:[],loading:!1,error:null,expandedPaths:new Set,loadedPaths:new Set,inflight:new Map,indexStatus:`idle`,selectedFiles:[],inlineAction:null,clipboard:null,focusedPath:null})},fetchTree:async e=>{await r().loadRoot(e),r().loadIndex(e)}}));function f(){let{tree:e,expandedPaths:t}=d.getState(),n=[];function r(e){let i=[...e].sort((e,t)=>e.type===t.type?e.name.localeCompare(t.name):e.type===`directory`?-1:1);for(let e of i){let i=e;if(e.type===`directory`&&t.has(e.path)&&e.children)for(;i.children&&i.children.length===1&&i.children[0].type===`directory`&&t.has(i.children[0].path);)i=i.children[0];n.push(i.path),i.type===`directory`&&t.has(i.path)&&i.children&&r(i.children)}}return r(e),n}export{s as i,d as n,o as r,f as t};
@@ -1,5 +1,5 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/data-grid-overlay-editor-C1UUm7Ob.js","assets/rolldown-runtime-FhOqtrmT.js","assets/dist-BoIkGNC8.js","assets/vendor-markdown-0Mxgxy0L.js","assets/vendor-ui-UXCWAcmi.js","assets/data-grid-types-D2cHE8hx.js","assets/number-overlay-editor-CyEqxXcg.js"])))=>i.map(i=>d[i]);
2
- import{o as e,t}from"./rolldown-runtime-FhOqtrmT.js";import{b as n,x as r}from"./vendor-markdown-0Mxgxy0L.js";import{Y as i}from"./vendor-ui-UXCWAcmi.js";import{t as a}from"./createLucideIcon-BjHrJDVb.js";import{n as o,r as s}from"./csv-parser-Dly5nqE1.js";import{t as c}from"./arrow-up-Rcw6_KKu.js";import{n as l}from"./database-DOWH9-Vv.js";import{t as u}from"./chevron-right-DnHIvvcy.js";import{i as d,n as f,r as p,t as m}from"./search-tM8K5zWU.js";import{a as h,i as g,n as _,r as v,t as y}from"./x-BPReZWnP.js";import{t as b}from"./sparkles-CulWHe4c.js";import{t as x}from"./text-wrap-DJz9Bgpa.js";import{K as S,j as C}from"./vendor-mermaid-D2KKkqNs.js";import{t as w}from"./tab-store-Dtg1_qL0.js";import{J as T,L as E,h as D,q as O,tt as k}from"./index-DkQ6jVSH.js";import{A,B as ee,C as te,D as ne,E as j,F as re,G as ie,H as ae,I as M,L as oe,M as N,N as P,O as se,P as ce,R as le,S as F,T as I,U as ue,V as de,W as fe,_ as pe,a as me,b as he,c as ge,d as _e,f as ve,g as L,h as ye,i as be,j as xe,k as R,l as Se,m as Ce,n as z,o as B,p as we,r as V,s as H,t as U,u as Te,v as Ee,w as W,x as De,y as Oe,z as ke}from"./data-grid-types-D2cHE8hx.js";import{t as G}from"./dist-BoIkGNC8.js";import{n as Ae,t as je}from"./use-monaco-theme-DEI-tJAh.js";var Me=a(`funnel`,[[`path`,{d:`M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z`,key:`sc7q7i`}]]),Ne=a(`save`,[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`,key:`1c8476`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`,key:`1ydtos`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`,key:`t51u73`}]]),Pe=`SELECT.FROM.WHERE.INSERT.INTO.VALUES.UPDATE.SET.DELETE.CREATE.TABLE.ALTER.DROP.INDEX.JOIN.LEFT.RIGHT.INNER.OUTER.ON.AND.OR.NOT.NULL.IS.IN.LIKE.BETWEEN.HAVING.LIMIT.OFFSET.AS.DISTINCT.COUNT.SUM.AVG.MIN.MAX.CASE.WHEN.THEN.ELSE.END.EXISTS.UNION.ALL.ASC.DESC.ORDER BY.GROUP BY.LEFT JOIN.RIGHT JOIN.INNER JOIN.CROSS JOIN.FULL OUTER JOIN.IS NULL.IS NOT NULL`.split(`.`),Fe=[`COUNT`,`SUM`,`AVG`,`MIN`,`MAX`],Ie=[`=`,`!=`,`<>`,`>`,`<`,`>=`,`<=`,`LIKE`,`ILIKE`,`IN`,`NOT IN`,`BETWEEN`,`IS NULL`,`IS NOT NULL`],Le=[`ASC`,`DESC`],Re=new Map,ze=new Set(`WHERE.SET.ON.ORDER.GROUP.HAVING.LIMIT.LEFT.RIGHT.INNER.OUTER.CROSS.FULL.JOIN.AND.OR.VALUES.SELECT.FROM.INTO.UPDATE.DELETE.INSERT.CREATE.ALTER.DROP`.split(`.`));function Be(e){let t=new Set,n=new Map,r=e.matchAll(/\b(?:FROM|JOIN|UPDATE|INTO)\s+"?(\w+)"?(?:\s+AS\s+(\w+)|\s+(?!(?:FROM|JOIN|UPDATE|INTO|WHERE|SET|ON|ORDER|GROUP|HAVING|LIMIT|LEFT|RIGHT|INNER|OUTER|CROSS|FULL|AND|OR|VALUES|SELECT)\b)(\w+))?/gi);for(let e of r){let r=e[1];t.add(r);let i=e[2]??e[3];i&&!ze.has(i.toUpperCase())&&n.set(i.toLowerCase(),r)}return{tableRefs:t,aliasMap:n}}function Ve(e,t){return t.get(e.toLowerCase())??e}async function He(e,t){let n=e.toLowerCase(),r=Re.get(n);if(!r)try{r=await t.getColumns(e),Re.set(n,r)}catch{r=[]}return r}async function Ue(e,t,n,r){let i=[],a=new Set;for(let o of e){let e=await He(o,t);for(let t of e){if(a.has(t.name))continue;a.add(t.name);let e=/[A-Z]/.test(t.name);i.push({label:t.name,kind:n.languages.CompletionItemKind.Field,detail:`${o} · ${t.type}`,insertText:e?`"${t.name}"`:t.name,range:r,sortText:`0`+t.name})}}return i}function We(e){if(/(\w+)\.\s*$/.test(e))return`dot`;let t=e.match(/\b(?:ORDER|GROUP)\s+BY\s+(?:[\w"]+\s+(?:ASC|DESC)\s*,\s*)*[\w"]+\s+(\w*)$/i);if(t){let e=t[1].toUpperCase();return e===`ASC`||e===`DESC`?`after-direction`:`sort-direction`}return/\b(?:ORDER|GROUP)\s+BY\s+.*(?:ASC|DESC)\s*,\s*\w*$/i.test(e)?`order-by-next-col`:/\b(?:WHERE|AND|OR)\s+[\w"]+\s+\S*$/i.test(e)?`operator`:/\b(?:FROM|JOIN|INTO|UPDATE|TABLE)\s+\w*$/i.test(e)?`table`:/\bINSERT\s+INTO\s+[\w"]+\s*\(\s*(?:[\w"]+\s*,\s*)*\w*$/i.test(e)?`insert-cols`:/\b(?:SELECT|WHERE|ORDER\s+BY|GROUP\s+BY|HAVING|SET|ON|AND|OR)\s+(?:[\w"]+\s*,\s*)*\w*$/i.test(e)?`columns`:/,\s*\w*$/.test(e)?`comma-cols`:`default`}function Ge(e,t){return{triggerCharacters:[`.`,`,`],provideCompletionItems:async(n,r)=>{try{let i=n.getValueInRange({startLineNumber:1,startColumn:1,endLineNumber:r.lineNumber,endColumn:r.column}),a=n.getWordUntilPosition(r),o={startLineNumber:r.lineNumber,endLineNumber:r.lineNumber,startColumn:a.startColumn,endColumn:a.endColumn},{tableRefs:s,aliasMap:c}=Be(n.getValue()),l=[],u=We(i);if(u===`dot`){let n=i.match(/(\w+)\.\s*$/);if(n){let r=n[1],i=await He(Ve(r,c),t);for(let t of i){let n=/[A-Z]/.test(t.name);l.push({label:t.name,kind:e.languages.CompletionItemKind.Field,detail:t.type,insertText:n?`"${t.name}"`:t.name,range:o})}}return{suggestions:l}}if(u===`sort-direction`){for(let t of Le)l.push({label:t,kind:e.languages.CompletionItemKind.Keyword,insertText:t,range:o,sortText:`0`+t});return{suggestions:l}}if(u===`after-direction`)return{suggestions:[]};if(u===`order-by-next-col`)return l.push(...await Ue(s,t,e,o)),{suggestions:l};if(u===`operator`){for(let t of Ie)l.push({label:t,kind:e.languages.CompletionItemKind.Operator,insertText:t,range:o,sortText:`0`+t});return{suggestions:l}}if(u===`table`){for(let n of t.tables)l.push({label:n.name,kind:e.languages.CompletionItemKind.Struct,detail:n.schema,insertText:n.name,range:o,sortText:`0`+n.name});return{suggestions:l}}if(u===`insert-cols`)return l.push(...await Ue(s,t,e,o)),{suggestions:l};if(u===`columns`){if(l.push(...await Ue(s,t,e,o)),/\bSELECT\s+/i.test(i)){l.push({label:`*`,kind:e.languages.CompletionItemKind.Value,insertText:`*`,range:o,sortText:`00*`});for(let t of Fe)l.push({label:`${t}()`,kind:e.languages.CompletionItemKind.Function,insertText:`${t}($0)`,insertTextRules:e.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:o,sortText:`1`+t})}for(let t of Pe)l.push({label:t,kind:e.languages.CompletionItemKind.Keyword,insertText:t,range:o,sortText:`3`+t});return{suggestions:l}}if(u===`comma-cols`&&s.size>0)return l.push(...await Ue(s,t,e,o)),{suggestions:l};for(let t of Pe)l.push({label:t,kind:e.languages.CompletionItemKind.Keyword,insertText:t,range:o,sortText:`2`+t});for(let n of t.tables)l.push({label:n.name,kind:e.languages.CompletionItemKind.Struct,detail:n.schema,insertText:n.name,range:o,sortText:`1`+n.name});return{suggestions:l}}catch{return{suggestions:[]}}}}}function Ke(){Re.clear()}var K=e(r(),1),qe=e(i(),1),q=n();function Je(e,t,n){let r=new Blob([t],{type:n}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=e,a.click(),URL.revokeObjectURL(i)}function Ye({columns:e,rows:t,filename:n=`export`,exportAllUrl:r}){let[i,a]=(0,K.useState)(!1),[s,c]=(0,K.useState)(!1),l=(0,K.useRef)(null),u=(0,K.useRef)(null);(0,K.useEffect)(()=>{if(!i)return;let e=e=>{u.current&&!u.current.contains(e.target)&&l.current&&!l.current.contains(e.target)&&a(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[i]);let d=(0,K.useCallback)(()=>a(e=>!e),[]),f=()=>{let r=o(e,t.map(t=>e.map(e=>String(t[e]??``))));Je(`${n}.csv`,r,`text/csv`),a(!1)},p=()=>{let e=JSON.stringify(t,null,2);Je(`${n}.json`,e,`application/json`),a(!1)},m=async()=>{let n=e.join(` `),r=t.map(t=>e.map(e=>String(t[e]??``)).join(` `)).join(`
2
+ import{o as e,t}from"./rolldown-runtime-FhOqtrmT.js";import{b as n,x as r}from"./vendor-markdown-0Mxgxy0L.js";import{Y as i}from"./vendor-ui-UXCWAcmi.js";import{t as a}from"./createLucideIcon-BjHrJDVb.js";import{n as o,r as s}from"./csv-parser-Dly5nqE1.js";import{t as c}from"./arrow-up-Rcw6_KKu.js";import{n as l}from"./database-DOWH9-Vv.js";import{t as u}from"./chevron-right-DnHIvvcy.js";import{i as d,n as f,r as p,t as m}from"./search-tM8K5zWU.js";import{a as h,i as g,n as _,r as v,t as y}from"./x-BPReZWnP.js";import{t as b}from"./sparkles-CulWHe4c.js";import{t as x}from"./text-wrap-DJz9Bgpa.js";import{K as S,j as C}from"./vendor-mermaid-D2KKkqNs.js";import{t as w}from"./tab-store-CNas5Ny8.js";import{J as T,L as E,h as D,q as O,tt as k}from"./index-U7GK_3ED.js";import{A,B as ee,C as te,D as ne,E as j,F as re,G as ie,H as ae,I as M,L as oe,M as N,N as P,O as se,P as ce,R as le,S as F,T as I,U as ue,V as de,W as fe,_ as pe,a as me,b as he,c as ge,d as _e,f as ve,g as L,h as ye,i as be,j as xe,k as R,l as Se,m as Ce,n as z,o as B,p as we,r as V,s as H,t as U,u as Te,v as Ee,w as W,x as De,y as Oe,z as ke}from"./data-grid-types-D2cHE8hx.js";import{t as G}from"./dist-BoIkGNC8.js";import{n as Ae,t as je}from"./use-monaco-theme-DEI-tJAh.js";var Me=a(`funnel`,[[`path`,{d:`M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z`,key:`sc7q7i`}]]),Ne=a(`save`,[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`,key:`1c8476`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`,key:`1ydtos`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`,key:`t51u73`}]]),Pe=`SELECT.FROM.WHERE.INSERT.INTO.VALUES.UPDATE.SET.DELETE.CREATE.TABLE.ALTER.DROP.INDEX.JOIN.LEFT.RIGHT.INNER.OUTER.ON.AND.OR.NOT.NULL.IS.IN.LIKE.BETWEEN.HAVING.LIMIT.OFFSET.AS.DISTINCT.COUNT.SUM.AVG.MIN.MAX.CASE.WHEN.THEN.ELSE.END.EXISTS.UNION.ALL.ASC.DESC.ORDER BY.GROUP BY.LEFT JOIN.RIGHT JOIN.INNER JOIN.CROSS JOIN.FULL OUTER JOIN.IS NULL.IS NOT NULL`.split(`.`),Fe=[`COUNT`,`SUM`,`AVG`,`MIN`,`MAX`],Ie=[`=`,`!=`,`<>`,`>`,`<`,`>=`,`<=`,`LIKE`,`ILIKE`,`IN`,`NOT IN`,`BETWEEN`,`IS NULL`,`IS NOT NULL`],Le=[`ASC`,`DESC`],Re=new Map,ze=new Set(`WHERE.SET.ON.ORDER.GROUP.HAVING.LIMIT.LEFT.RIGHT.INNER.OUTER.CROSS.FULL.JOIN.AND.OR.VALUES.SELECT.FROM.INTO.UPDATE.DELETE.INSERT.CREATE.ALTER.DROP`.split(`.`));function Be(e){let t=new Set,n=new Map,r=e.matchAll(/\b(?:FROM|JOIN|UPDATE|INTO)\s+"?(\w+)"?(?:\s+AS\s+(\w+)|\s+(?!(?:FROM|JOIN|UPDATE|INTO|WHERE|SET|ON|ORDER|GROUP|HAVING|LIMIT|LEFT|RIGHT|INNER|OUTER|CROSS|FULL|AND|OR|VALUES|SELECT)\b)(\w+))?/gi);for(let e of r){let r=e[1];t.add(r);let i=e[2]??e[3];i&&!ze.has(i.toUpperCase())&&n.set(i.toLowerCase(),r)}return{tableRefs:t,aliasMap:n}}function Ve(e,t){return t.get(e.toLowerCase())??e}async function He(e,t){let n=e.toLowerCase(),r=Re.get(n);if(!r)try{r=await t.getColumns(e),Re.set(n,r)}catch{r=[]}return r}async function Ue(e,t,n,r){let i=[],a=new Set;for(let o of e){let e=await He(o,t);for(let t of e){if(a.has(t.name))continue;a.add(t.name);let e=/[A-Z]/.test(t.name);i.push({label:t.name,kind:n.languages.CompletionItemKind.Field,detail:`${o} · ${t.type}`,insertText:e?`"${t.name}"`:t.name,range:r,sortText:`0`+t.name})}}return i}function We(e){if(/(\w+)\.\s*$/.test(e))return`dot`;let t=e.match(/\b(?:ORDER|GROUP)\s+BY\s+(?:[\w"]+\s+(?:ASC|DESC)\s*,\s*)*[\w"]+\s+(\w*)$/i);if(t){let e=t[1].toUpperCase();return e===`ASC`||e===`DESC`?`after-direction`:`sort-direction`}return/\b(?:ORDER|GROUP)\s+BY\s+.*(?:ASC|DESC)\s*,\s*\w*$/i.test(e)?`order-by-next-col`:/\b(?:WHERE|AND|OR)\s+[\w"]+\s+\S*$/i.test(e)?`operator`:/\b(?:FROM|JOIN|INTO|UPDATE|TABLE)\s+\w*$/i.test(e)?`table`:/\bINSERT\s+INTO\s+[\w"]+\s*\(\s*(?:[\w"]+\s*,\s*)*\w*$/i.test(e)?`insert-cols`:/\b(?:SELECT|WHERE|ORDER\s+BY|GROUP\s+BY|HAVING|SET|ON|AND|OR)\s+(?:[\w"]+\s*,\s*)*\w*$/i.test(e)?`columns`:/,\s*\w*$/.test(e)?`comma-cols`:`default`}function Ge(e,t){return{triggerCharacters:[`.`,`,`],provideCompletionItems:async(n,r)=>{try{let i=n.getValueInRange({startLineNumber:1,startColumn:1,endLineNumber:r.lineNumber,endColumn:r.column}),a=n.getWordUntilPosition(r),o={startLineNumber:r.lineNumber,endLineNumber:r.lineNumber,startColumn:a.startColumn,endColumn:a.endColumn},{tableRefs:s,aliasMap:c}=Be(n.getValue()),l=[],u=We(i);if(u===`dot`){let n=i.match(/(\w+)\.\s*$/);if(n){let r=n[1],i=await He(Ve(r,c),t);for(let t of i){let n=/[A-Z]/.test(t.name);l.push({label:t.name,kind:e.languages.CompletionItemKind.Field,detail:t.type,insertText:n?`"${t.name}"`:t.name,range:o})}}return{suggestions:l}}if(u===`sort-direction`){for(let t of Le)l.push({label:t,kind:e.languages.CompletionItemKind.Keyword,insertText:t,range:o,sortText:`0`+t});return{suggestions:l}}if(u===`after-direction`)return{suggestions:[]};if(u===`order-by-next-col`)return l.push(...await Ue(s,t,e,o)),{suggestions:l};if(u===`operator`){for(let t of Ie)l.push({label:t,kind:e.languages.CompletionItemKind.Operator,insertText:t,range:o,sortText:`0`+t});return{suggestions:l}}if(u===`table`){for(let n of t.tables)l.push({label:n.name,kind:e.languages.CompletionItemKind.Struct,detail:n.schema,insertText:n.name,range:o,sortText:`0`+n.name});return{suggestions:l}}if(u===`insert-cols`)return l.push(...await Ue(s,t,e,o)),{suggestions:l};if(u===`columns`){if(l.push(...await Ue(s,t,e,o)),/\bSELECT\s+/i.test(i)){l.push({label:`*`,kind:e.languages.CompletionItemKind.Value,insertText:`*`,range:o,sortText:`00*`});for(let t of Fe)l.push({label:`${t}()`,kind:e.languages.CompletionItemKind.Function,insertText:`${t}($0)`,insertTextRules:e.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:o,sortText:`1`+t})}for(let t of Pe)l.push({label:t,kind:e.languages.CompletionItemKind.Keyword,insertText:t,range:o,sortText:`3`+t});return{suggestions:l}}if(u===`comma-cols`&&s.size>0)return l.push(...await Ue(s,t,e,o)),{suggestions:l};for(let t of Pe)l.push({label:t,kind:e.languages.CompletionItemKind.Keyword,insertText:t,range:o,sortText:`2`+t});for(let n of t.tables)l.push({label:n.name,kind:e.languages.CompletionItemKind.Struct,detail:n.schema,insertText:n.name,range:o,sortText:`1`+n.name});return{suggestions:l}}catch{return{suggestions:[]}}}}}function Ke(){Re.clear()}var K=e(r(),1),qe=e(i(),1),q=n();function Je(e,t,n){let r=new Blob([t],{type:n}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=e,a.click(),URL.revokeObjectURL(i)}function Ye({columns:e,rows:t,filename:n=`export`,exportAllUrl:r}){let[i,a]=(0,K.useState)(!1),[s,c]=(0,K.useState)(!1),l=(0,K.useRef)(null),u=(0,K.useRef)(null);(0,K.useEffect)(()=>{if(!i)return;let e=e=>{u.current&&!u.current.contains(e.target)&&l.current&&!l.current.contains(e.target)&&a(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[i]);let d=(0,K.useCallback)(()=>a(e=>!e),[]),f=()=>{let r=o(e,t.map(t=>e.map(e=>String(t[e]??``))));Je(`${n}.csv`,r,`text/csv`),a(!1)},p=()=>{let e=JSON.stringify(t,null,2);Je(`${n}.json`,e,`application/json`),a(!1)},m=async()=>{let n=e.join(` `),r=t.map(t=>e.map(e=>String(t[e]??``)).join(` `)).join(`
3
3
  `);await navigator.clipboard.writeText(n+`
4
4
  `+r),a(!1)},g=async e=>{if(r){c(!0);try{let t=await(await fetch(`${r}&format=${e}&limit=10000`)).text(),i=e===`csv`?`text/csv`:`application/json`;Je(`${n}-all.${e}`,t,i)}catch{}c(!1),a(!1)}};if(e.length===0||t.length===0)return null;let _=l.current?.getBoundingClientRect(),v=document.getElementById(`portal`);return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`button`,{ref:l,type:`button`,onClick:d,className:`p-1 rounded text-muted-foreground hover:text-foreground transition-colors`,title:`Export`,children:(0,q.jsx)(h,{className:`size-3.5`})}),i&&v&&_&&(0,qe.createPortal)((0,q.jsxs)(`div`,{ref:u,style:{position:`fixed`,left:Math.min(_.left,window.innerWidth-170),top:_.bottom+4,zIndex:1e4},className:`bg-popover border border-border rounded-md shadow-md py-1 min-w-[160px] text-xs`,children:[(0,q.jsx)(`button`,{onClick:m,className:`w-full text-left px-3 py-1.5 hover:bg-muted transition-colors text-foreground`,children:`Copy to Clipboard (TSV)`}),(0,q.jsx)(`button`,{onClick:f,className:`w-full text-left px-3 py-1.5 hover:bg-muted transition-colors text-foreground`,children:`Export Page (CSV)`}),(0,q.jsx)(`button`,{onClick:p,className:`w-full text-left px-3 py-1.5 hover:bg-muted transition-colors text-foreground`,children:`Export Page (JSON)`}),r&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`div`,{className:`border-t border-border my-1`}),(0,q.jsx)(`button`,{onClick:()=>g(`csv`),disabled:s,className:`w-full text-left px-3 py-1.5 hover:bg-muted transition-colors disabled:opacity-50 text-foreground`,children:s?`Exporting…`:`Export All (CSV)`}),(0,q.jsx)(`button`,{onClick:()=>g(`json`),disabled:s,className:`w-full text-left px-3 py-1.5 hover:bg-muted transition-colors disabled:opacity-50 text-foreground`,children:s?`Exporting…`:`Export All (JSON)`})]})]}),v)]})}var Xe=G(`div`)({name:`ImageOverlayEditorStyle`,class:`gdg-i2iowwq`,propsAsIs:!1}),Ze=t(((e,t)=>{t.exports=`SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED`})),Qe=t(((e,t)=>{var n=Ze();function r(){}function i(){}i.resetWarningCache=r,t.exports=function(){function e(e,t,r,i,a,o){if(o!==n){var s=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name=`Invariant Violation`,s}}e.isRequired=e;function t(){return e}var a={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:r};return a.PropTypes=a,a}})),$e=t(((e,t)=>{t.exports=Qe()()})),et=t((e=>{(function(t,n){if(typeof define==`function`&&define.amd)define([`exports`,`react`,`prop-types`],n);else if(e!==void 0)n(e,r(),$e());else{var i={exports:{}};n(i.exports,t.react,t.propTypes),t.reactSwipe=i.exports}})(e,function(e,t,n){Object.defineProperty(e,`__esModule`,{value:!0}),e.setHasSupportToCaptureOption=p;var r=a(t),i=a(n);function a(e){return e&&e.__esModule?e:{default:e}}var o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e};function s(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function c(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}var l=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();function u(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function d(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var f=!1;function p(e){f=e}try{addEventListener(`test`,null,Object.defineProperty({},`capture`,{get:function(){p(!0)}}))}catch{}function m(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{capture:!0};return f?e:e.capture}function h(e){if(`touches`in e){var t=e.touches[0];return{x:t.pageX,y:t.pageY}}return{x:e.screenX,y:e.screenY}}var g=function(e){d(t,e);function t(){var e;c(this,t);var n=[...arguments],r=u(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(n)));return r._handleSwipeStart=r._handleSwipeStart.bind(r),r._handleSwipeMove=r._handleSwipeMove.bind(r),r._handleSwipeEnd=r._handleSwipeEnd.bind(r),r._onMouseDown=r._onMouseDown.bind(r),r._onMouseMove=r._onMouseMove.bind(r),r._onMouseUp=r._onMouseUp.bind(r),r._setSwiperRef=r._setSwiperRef.bind(r),r}return l(t,[{key:`componentDidMount`,value:function(){this.swiper&&this.swiper.addEventListener(`touchmove`,this._handleSwipeMove,m({capture:!0,passive:!1}))}},{key:`componentWillUnmount`,value:function(){this.swiper&&this.swiper.removeEventListener(`touchmove`,this._handleSwipeMove,m({capture:!0,passive:!1}))}},{key:`_onMouseDown`,value:function(e){this.props.allowMouseEvents&&(this.mouseDown=!0,document.addEventListener(`mouseup`,this._onMouseUp),document.addEventListener(`mousemove`,this._onMouseMove),this._handleSwipeStart(e))}},{key:`_onMouseMove`,value:function(e){this.mouseDown&&this._handleSwipeMove(e)}},{key:`_onMouseUp`,value:function(e){this.mouseDown=!1,document.removeEventListener(`mouseup`,this._onMouseUp),document.removeEventListener(`mousemove`,this._onMouseMove),this._handleSwipeEnd(e)}},{key:`_handleSwipeStart`,value:function(e){var t=h(e);this.moveStart={x:t.x,y:t.y},this.props.onSwipeStart(e)}},{key:`_handleSwipeMove`,value:function(e){if(this.moveStart){var t=h(e),n=t.x,r=t.y,i=n-this.moveStart.x,a=r-this.moveStart.y;this.moving=!0,this.props.onSwipeMove({x:i,y:a},e)&&e.cancelable&&e.preventDefault(),this.movePosition={deltaX:i,deltaY:a}}}},{key:`_handleSwipeEnd`,value:function(e){this.props.onSwipeEnd(e);var t=this.props.tolerance;this.moving&&this.movePosition&&(this.movePosition.deltaX<-t?this.props.onSwipeLeft(1,e):this.movePosition.deltaX>t&&this.props.onSwipeRight(1,e),this.movePosition.deltaY<-t?this.props.onSwipeUp(1,e):this.movePosition.deltaY>t&&this.props.onSwipeDown(1,e)),this.moveStart=null,this.moving=!1,this.movePosition=null}},{key:`_setSwiperRef`,value:function(e){this.swiper=e,this.props.innerRef(e)}},{key:`render`,value:function(){var e=this.props;e.tagName;var t=e.className,n=e.style,i=e.children;e.allowMouseEvents,e.onSwipeUp,e.onSwipeDown,e.onSwipeLeft,e.onSwipeRight,e.onSwipeStart,e.onSwipeMove,e.onSwipeEnd,e.innerRef,e.tolerance;var a=s(e,[`tagName`,`className`,`style`,`children`,`allowMouseEvents`,`onSwipeUp`,`onSwipeDown`,`onSwipeLeft`,`onSwipeRight`,`onSwipeStart`,`onSwipeMove`,`onSwipeEnd`,`innerRef`,`tolerance`]);return r.default.createElement(this.props.tagName,o({ref:this._setSwiperRef,onMouseDown:this._onMouseDown,onTouchStart:this._handleSwipeStart,onTouchEnd:this._handleSwipeEnd,className:t,style:n},a),i)}}]),t}(t.Component);g.displayName=`ReactSwipe`,g.propTypes={tagName:i.default.string,className:i.default.string,style:i.default.object,children:i.default.node,allowMouseEvents:i.default.bool,onSwipeUp:i.default.func,onSwipeDown:i.default.func,onSwipeLeft:i.default.func,onSwipeRight:i.default.func,onSwipeStart:i.default.func,onSwipeMove:i.default.func,onSwipeEnd:i.default.func,innerRef:i.default.func,tolerance:i.default.number.isRequired},g.defaultProps={tagName:`div`,allowMouseEvents:!1,onSwipeUp:function(){},onSwipeDown:function(){},onSwipeLeft:function(){},onSwipeRight:function(){},onSwipeStart:function(){},onSwipeMove:function(){},onSwipeEnd:function(){},innerRef:function(){},tolerance:0},e.default=g})})),tt=t((e=>{(function(t,n){if(typeof define==`function`&&define.amd)define([`exports`,`./react-swipe`],n);else if(e!==void 0)n(e,et());else{var r={exports:{}};n(r.exports,t.reactSwipe),t.index=r.exports}})(e,function(e,t){Object.defineProperty(e,`__esModule`,{value:!0});var n=r(t);function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default})})),nt=t(((e,t)=>{(function(){var e={}.hasOwnProperty;function n(){for(var e=``,t=0;t<arguments.length;t++){var n=arguments[t];n&&(e=i(e,r(n)))}return e}function r(t){if(typeof t==`string`||typeof t==`number`)return t;if(typeof t!=`object`)return``;if(Array.isArray(t))return n.apply(null,t);if(t.toString!==Object.prototype.toString&&!t.toString.toString().includes(`[native code]`))return t.toString();var r=``;for(var a in t)e.call(t,a)&&t[a]&&(r=i(r,a));return r}function i(e,t){return t?e?e+` `+t:e+t:e}t!==void 0&&t.exports?(n.default=n,t.exports=n):typeof define==`function`&&typeof define.amd==`object`&&define.amd?define(`classnames`,[],function(){return n}):window.classNames=n})()})),rt=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var t=n(nt());function n(e){return e&&e.__esModule?e:{default:e}}function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}e.default={ROOT:function(e){return(0,t.default)(r({"carousel-root":!0},e||``,!!e))},CAROUSEL:function(e){return(0,t.default)({carousel:!0,"carousel-slider":e})},WRAPPER:function(e,n){return(0,t.default)({"thumbs-wrapper":!e,"slider-wrapper":e,"axis-horizontal":n===`horizontal`,"axis-vertical":n!==`horizontal`})},SLIDER:function(e,n){return(0,t.default)({thumbs:!e,slider:e,animated:!n})},ITEM:function(e,n,r){return(0,t.default)({thumb:!e,slide:e,selected:n,previous:r})},ARROW_PREV:function(e){return(0,t.default)({"control-arrow control-prev":!0,"control-disabled":e})},ARROW_NEXT:function(e){return(0,t.default)({"control-arrow control-next":!0,"control-disabled":e})},DOT:function(e){return(0,t.default)({dot:!0,selected:e})}}})),it=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.outerWidth=void 0,e.outerWidth=function(e){var t=e.offsetWidth,n=getComputedStyle(e);return t+=parseInt(n.marginLeft)+parseInt(n.marginRight),t}})),at=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0,e.default=function(e,t,n){var r=e===0?e:e+t;return`translate3d`+(`(`+(n===`horizontal`?[r,0,0]:[0,r,0]).join(`,`)+`)`)}})),ot=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0,e.default=function(){return window}})),st=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var t=u(r()),n=c(rt()),i=it(),a=c(at()),o=c(tt()),s=c(ot());function c(e){return e&&e.__esModule?e:{default:e}}function l(){if(typeof WeakMap!=`function`)return null;var e=new WeakMap;return l=function(){return e},e}function u(e){if(e&&e.__esModule)return e;if(e===null||d(e)!==`object`&&typeof e!=`function`)return{default:e};var t=l();if(t&&t.has(e))return t.get(e);var n={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if(Object.prototype.hasOwnProperty.call(e,i)){var a=r?Object.getOwnPropertyDescriptor(e,i):null;a&&(a.get||a.set)?Object.defineProperty(n,i,a):n[i]=e[i]}return n.default=e,t&&t.set(e,n),n}function d(e){"@babel/helpers - typeof";return d=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},d(e)}function f(){return f=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},f.apply(this,arguments)}function p(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function m(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function h(e,t,n){return t&&m(e.prototype,t),n&&m(e,n),e}function g(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function`);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&_(e,t)}function _(e,t){return _=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},_(e,t)}function v(e){var t=x();return function(){var n=S(e),r;if(t){var i=S(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return y(this,r)}}function y(e,t){return t&&(d(t)===`object`||typeof t==`function`)?t:b(e)}function b(e){if(e===void 0)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return e}function x(){if(typeof Reflect>`u`||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy==`function`)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}function S(e){return S=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},S(e)}function C(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var w=function(e){return e.hasOwnProperty(`key`)},T=function(e){g(c,e);var r=v(c);function c(e){var n;return p(this,c),n=r.call(this,e),C(b(n),`itemsWrapperRef`,void 0),C(b(n),`itemsListRef`,void 0),C(b(n),`thumbsRef`,void 0),C(b(n),`setItemsWrapperRef`,function(e){n.itemsWrapperRef=e}),C(b(n),`setItemsListRef`,function(e){n.itemsListRef=e}),C(b(n),`setThumbsRef`,function(e,t){n.thumbsRef||=[],n.thumbsRef[t]=e}),C(b(n),`updateSizes`,function(){if(!(!n.props.children||!n.itemsWrapperRef||!n.thumbsRef)){var e=t.Children.count(n.props.children),r=n.itemsWrapperRef.clientWidth,a=n.props.thumbWidth?n.props.thumbWidth:(0,i.outerWidth)(n.thumbsRef[0]),o=Math.floor(r/a),s=o<e,c=s?e-o:0;n.setState(function(e,t){return{itemSize:a,visibleItems:o,firstItem:s?n.getFirstItem(t.selectedItem):0,lastPosition:c,showArrows:s}})}}),C(b(n),`handleClickItem`,function(e,t,r){if(!w(r)||r.key===`Enter`){var i=n.props.onSelectItem;typeof i==`function`&&i(e,t)}}),C(b(n),`onSwipeStart`,function(){n.setState({swiping:!0})}),C(b(n),`onSwipeEnd`,function(){n.setState({swiping:!1})}),C(b(n),`onSwipeMove`,function(e){var r=e.x;if(!n.state.itemSize||!n.itemsWrapperRef||!n.state.visibleItems)return!1;var i=0,o=t.Children.count(n.props.children),s=-(n.state.firstItem*100)/n.state.visibleItems,c=-Math.max(o-n.state.visibleItems,0)*100/n.state.visibleItems;s===i&&r>0&&(r=0),s===c&&r<0&&(r=0);var l=s+100/(n.itemsWrapperRef.clientWidth/r);return n.itemsListRef&&[`WebkitTransform`,`MozTransform`,`MsTransform`,`OTransform`,`transform`,`msTransform`].forEach(function(e){n.itemsListRef.style[e]=(0,a.default)(l,`%`,n.props.axis)}),!0}),C(b(n),`slideRight`,function(e){n.moveTo(n.state.firstItem-(typeof e==`number`?e:1))}),C(b(n),`slideLeft`,function(e){n.moveTo(n.state.firstItem+(typeof e==`number`?e:1))}),C(b(n),`moveTo`,function(e){e=e<0?0:e,e=e>=n.state.lastPosition?n.state.lastPosition:e,n.setState({firstItem:e})}),n.state={selectedItem:e.selectedItem,swiping:!1,showArrows:!1,firstItem:0,visibleItems:0,lastPosition:0},n}return h(c,[{key:`componentDidMount`,value:function(){this.setupThumbs()}},{key:`componentDidUpdate`,value:function(e){this.props.selectedItem!==this.state.selectedItem&&this.setState({selectedItem:this.props.selectedItem,firstItem:this.getFirstItem(this.props.selectedItem)}),this.props.children!==e.children&&this.updateSizes()}},{key:`componentWillUnmount`,value:function(){this.destroyThumbs()}},{key:`setupThumbs`,value:function(){(0,s.default)().addEventListener(`resize`,this.updateSizes),(0,s.default)().addEventListener(`DOMContentLoaded`,this.updateSizes),this.updateSizes()}},{key:`destroyThumbs`,value:function(){(0,s.default)().removeEventListener(`resize`,this.updateSizes),(0,s.default)().removeEventListener(`DOMContentLoaded`,this.updateSizes)}},{key:`getFirstItem`,value:function(e){var t=e;return e>=this.state.lastPosition&&(t=this.state.lastPosition),e<this.state.firstItem+this.state.visibleItems&&(t=this.state.firstItem),e<this.state.firstItem&&(t=e),t}},{key:`renderItems`,value:function(){var e=this;return this.props.children.map(function(r,i){var a={key:i,ref:function(t){return e.setThumbsRef(t,i)},className:n.default.ITEM(!1,i===e.state.selectedItem),onClick:e.handleClickItem.bind(e,i,e.props.children[i]),onKeyDown:e.handleClickItem.bind(e,i,e.props.children[i]),"aria-label":`${e.props.labels.item} ${i+1}`,style:{width:e.props.thumbWidth}};return t.default.createElement(`li`,f({},a,{role:`button`,tabIndex:0}),r)})}},{key:`render`,value:function(){var e=this;if(!this.props.children)return null;var r=t.Children.count(this.props.children)>1,i=this.state.showArrows&&this.state.firstItem>0,s=this.state.showArrows&&this.state.firstItem<this.state.lastPosition,c={},l=-this.state.firstItem*(this.state.itemSize||0),u=(0,a.default)(l,`px`,this.props.axis),d=this.props.transitionTime+`ms`;return c={WebkitTransform:u,MozTransform:u,MsTransform:u,OTransform:u,transform:u,msTransform:u,WebkitTransitionDuration:d,MozTransitionDuration:d,MsTransitionDuration:d,OTransitionDuration:d,transitionDuration:d,msTransitionDuration:d},t.default.createElement(`div`,{className:n.default.CAROUSEL(!1)},t.default.createElement(`div`,{className:n.default.WRAPPER(!1),ref:this.setItemsWrapperRef},t.default.createElement(`button`,{type:`button`,className:n.default.ARROW_PREV(!i),onClick:function(){return e.slideRight()},"aria-label":this.props.labels.leftArrow}),r?t.default.createElement(o.default,{tagName:`ul`,className:n.default.SLIDER(!1,this.state.swiping),onSwipeLeft:this.slideLeft,onSwipeRight:this.slideRight,onSwipeMove:this.onSwipeMove,onSwipeStart:this.onSwipeStart,onSwipeEnd:this.onSwipeEnd,style:c,innerRef:this.setItemsListRef,allowMouseEvents:this.props.emulateTouch},this.renderItems()):t.default.createElement(`ul`,{className:n.default.SLIDER(!1,this.state.swiping),ref:function(t){return e.setItemsListRef(t)},style:c},this.renderItems()),t.default.createElement(`button`,{type:`button`,className:n.default.ARROW_NEXT(!s),onClick:function(){return e.slideLeft()},"aria-label":this.props.labels.rightArrow})))}}]),c}(t.Component);e.default=T,C(T,`displayName`,`Thumbs`),C(T,`defaultProps`,{axis:`horizontal`,labels:{leftArrow:`previous slide / item`,rightArrow:`next slide / item`,item:`slide item`},selectedItem:0,thumbWidth:80,transitionTime:350})})),ct=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0,e.default=function(){return document}})),lt=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.setPosition=e.getPosition=e.isKeyboardEvent=e.defaultStatusFormatter=e.noop=void 0;var t=r(),n=i(at());function i(e){return e&&e.__esModule?e:{default:e}}e.noop=function(){},e.defaultStatusFormatter=function(e,t){return`${e} of ${t}`},e.isKeyboardEvent=function(e){return e?e.hasOwnProperty(`key`):!1},e.getPosition=function(e,n){if(n.infiniteLoop&&++e,e===0)return 0;var r=t.Children.count(n.children);if(n.centerMode&&n.axis===`horizontal`){var i=-e*n.centerSlidePercentage,a=r-1;return e&&(e!==a||n.infiniteLoop)?i+=(100-n.centerSlidePercentage)/2:e===a&&(i+=100-n.centerSlidePercentage),i}return-e*100},e.setPosition=function(e,t){var r={};return[`WebkitTransform`,`MozTransform`,`MsTransform`,`OTransform`,`transform`,`msTransform`].forEach(function(i){r[i]=(0,n.default)(e,`%`,t)}),r}})),ut=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.fadeAnimationHandler=e.slideStopSwipingHandler=e.slideSwipeAnimationHandler=e.slideAnimationHandler=void 0;var t=r(),n=a(at()),i=lt();function a(e){return e&&e.__esModule?e:{default:e}}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function s(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?o(Object(n),!0).forEach(function(t){c(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function c(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}e.slideAnimationHandler=function(e,r){var a={},o=r.selectedItem,c=o,l=t.Children.count(e.children)-1;if(e.infiniteLoop&&(o<0||o>l))return c<0?e.centerMode&&e.centerSlidePercentage&&e.axis===`horizontal`?a.itemListStyle=(0,i.setPosition)(-(l+2)*e.centerSlidePercentage-(100-e.centerSlidePercentage)/2,e.axis):a.itemListStyle=(0,i.setPosition)(-(l+2)*100,e.axis):c>l&&(a.itemListStyle=(0,i.setPosition)(0,e.axis)),a;var u=(0,i.getPosition)(o,e),d=(0,n.default)(u,`%`,e.axis),f=e.transitionTime+`ms`;return a.itemListStyle={WebkitTransform:d,msTransform:d,OTransform:d,transform:d},r.swiping||(a.itemListStyle=s(s({},a.itemListStyle),{},{WebkitTransitionDuration:f,MozTransitionDuration:f,OTransitionDuration:f,transitionDuration:f,msTransitionDuration:f})),a},e.slideSwipeAnimationHandler=function(e,n,r,a){var o={},s=n.axis===`horizontal`,c=t.Children.count(n.children),l=0,u=(0,i.getPosition)(r.selectedItem,n),d=n.infiniteLoop?(0,i.getPosition)(c-1,n)-100:(0,i.getPosition)(c-1,n),f=s?e.x:e.y,p=f;u===l&&f>0&&(p=0),u===d&&f<0&&(p=0);var m=u+100/(r.itemSize/p),h=Math.abs(f)>n.swipeScrollTolerance;return n.infiniteLoop&&h&&(r.selectedItem===0&&m>-100?m-=c*100:r.selectedItem===c-1&&m<-c*100&&(m+=c*100)),(!n.preventMovementUntilSwipeScrollTolerance||h||r.swipeMovementStarted)&&(r.swipeMovementStarted||a({swipeMovementStarted:!0}),o.itemListStyle=(0,i.setPosition)(m,n.axis)),h&&!r.cancelClick&&a({cancelClick:!0}),o},e.slideStopSwipingHandler=function(e,t){var n=(0,i.getPosition)(t.selectedItem,e);return{itemListStyle:(0,i.setPosition)(n,e.axis)}},e.fadeAnimationHandler=function(e,t){var n=e.transitionTime+`ms`,r=`ease-in-out`,i={position:`absolute`,display:`block`,zIndex:-2,minHeight:`100%`,opacity:0,top:0,right:0,left:0,bottom:0,transitionTimingFunction:r,msTransitionTimingFunction:r,MozTransitionTimingFunction:r,WebkitTransitionTimingFunction:r,OTransitionTimingFunction:r};return t.swiping||(i=s(s({},i),{},{WebkitTransitionDuration:n,MozTransitionDuration:n,OTransitionDuration:n,transitionDuration:n,msTransitionDuration:n})),{slideStyle:i,selectedStyle:s(s({},i),{},{opacity:1,position:`relative`}),prevStyle:s({},i)}}})),dt=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var t=f(r()),n=u(tt()),i=u(rt()),a=u(st()),o=u(ct()),s=u(ot()),c=lt(),l=ut();function u(e){return e&&e.__esModule?e:{default:e}}function d(){if(typeof WeakMap!=`function`)return null;var e=new WeakMap;return d=function(){return e},e}function f(e){if(e&&e.__esModule)return e;if(e===null||p(e)!==`object`&&typeof e!=`function`)return{default:e};var t=d();if(t&&t.has(e))return t.get(e);var n={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if(Object.prototype.hasOwnProperty.call(e,i)){var a=r?Object.getOwnPropertyDescriptor(e,i):null;a&&(a.get||a.set)?Object.defineProperty(n,i,a):n[i]=e[i]}return n.default=e,t&&t.set(e,n),n}function p(e){"@babel/helpers - typeof";return p=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},p(e)}function m(){return m=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},m.apply(this,arguments)}function h(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function g(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?h(Object(n),!0).forEach(function(t){D(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):h(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function _(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function v(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function y(e,t,n){return t&&v(e.prototype,t),n&&v(e,n),e}function b(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function`);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&x(e,t)}function x(e,t){return x=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},x(e,t)}function S(e){var t=T();return function(){var n=E(e),r;if(t){var i=E(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return C(this,r)}}function C(e,t){return t&&(p(t)===`object`||typeof t==`function`)?t:w(e)}function w(e){if(e===void 0)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return e}function T(){if(typeof Reflect>`u`||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy==`function`)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}function E(e){return E=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},E(e)}function D(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var O=function(e){b(u,e);var r=S(u);function u(e){var n;_(this,u),n=r.call(this,e),D(w(n),`thumbsRef`,void 0),D(w(n),`carouselWrapperRef`,void 0),D(w(n),`listRef`,void 0),D(w(n),`itemsRef`,void 0),D(w(n),`timer`,void 0),D(w(n),`animationHandler`,void 0),D(w(n),`setThumbsRef`,function(e){n.thumbsRef=e}),D(w(n),`setCarouselWrapperRef`,function(e){n.carouselWrapperRef=e}),D(w(n),`setListRef`,function(e){n.listRef=e}),D(w(n),`setItemsRef`,function(e,t){n.itemsRef||=[],n.itemsRef[t]=e}),D(w(n),`autoPlay`,function(){t.Children.count(n.props.children)<=1||(n.clearAutoPlay(),n.props.autoPlay&&(n.timer=setTimeout(function(){n.increment()},n.props.interval)))}),D(w(n),`clearAutoPlay`,function(){n.timer&&clearTimeout(n.timer)}),D(w(n),`resetAutoPlay`,function(){n.clearAutoPlay(),n.autoPlay()}),D(w(n),`stopOnHover`,function(){n.setState({isMouseEntered:!0},n.clearAutoPlay)}),D(w(n),`startOnLeave`,function(){n.setState({isMouseEntered:!1},n.autoPlay)}),D(w(n),`isFocusWithinTheCarousel`,function(){return n.carouselWrapperRef?!!((0,o.default)().activeElement===n.carouselWrapperRef||n.carouselWrapperRef.contains((0,o.default)().activeElement)):!1}),D(w(n),`navigateWithKeyboard`,function(e){if(n.isFocusWithinTheCarousel()){var t=n.props.axis===`horizontal`,r={ArrowUp:38,ArrowRight:39,ArrowDown:40,ArrowLeft:37},i=t?r.ArrowRight:r.ArrowDown,a=t?r.ArrowLeft:r.ArrowUp;i===e.keyCode?n.increment():a===e.keyCode&&n.decrement()}}),D(w(n),`updateSizes`,function(){if(!(!n.state.initialized||!n.itemsRef||n.itemsRef.length===0)){var e=n.props.axis===`horizontal`,t=n.itemsRef[0];if(t){var r=e?t.clientWidth:t.clientHeight;n.setState({itemSize:r}),n.thumbsRef&&n.thumbsRef.updateSizes()}}}),D(w(n),`setMountState`,function(){n.setState({hasMount:!0}),n.updateSizes()}),D(w(n),`handleClickItem`,function(e,r){if(t.Children.count(n.props.children)!==0){if(n.state.cancelClick){n.setState({cancelClick:!1});return}n.props.onClickItem(e,r),e!==n.state.selectedItem&&n.setState({selectedItem:e})}}),D(w(n),`handleOnChange`,function(e,r){t.Children.count(n.props.children)<=1||n.props.onChange(e,r)}),D(w(n),`handleClickThumb`,function(e,t){n.props.onClickThumb(e,t),n.moveTo(e)}),D(w(n),`onSwipeStart`,function(e){n.setState({swiping:!0}),n.props.onSwipeStart(e)}),D(w(n),`onSwipeEnd`,function(e){n.setState({swiping:!1,cancelClick:!1,swipeMovementStarted:!1}),n.props.onSwipeEnd(e),n.clearAutoPlay(),n.state.autoPlay&&n.autoPlay()}),D(w(n),`onSwipeMove`,function(e,t){n.props.onSwipeMove(t);var r=n.props.swipeAnimationHandler(e,n.props,n.state,n.setState.bind(w(n)));return n.setState(g({},r)),!!Object.keys(r).length}),D(w(n),`decrement`,function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1;n.moveTo(n.state.selectedItem-(typeof e==`number`?e:1))}),D(w(n),`increment`,function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1;n.moveTo(n.state.selectedItem+(typeof e==`number`?e:1))}),D(w(n),`moveTo`,function(e){if(typeof e==`number`){var r=t.Children.count(n.props.children)-1;e<0&&(e=n.props.infiniteLoop?r:0),e>r&&(e=n.props.infiniteLoop?0:r),n.selectItem({selectedItem:e}),n.state.autoPlay&&n.state.isMouseEntered===!1&&n.resetAutoPlay()}}),D(w(n),`onClickNext`,function(){n.increment(1)}),D(w(n),`onClickPrev`,function(){n.decrement(1)}),D(w(n),`onSwipeForward`,function(){n.increment(1),n.props.emulateTouch&&n.setState({cancelClick:!0})}),D(w(n),`onSwipeBackwards`,function(){n.decrement(1),n.props.emulateTouch&&n.setState({cancelClick:!0})}),D(w(n),`changeItem`,function(e){return function(t){(!(0,c.isKeyboardEvent)(t)||t.key===`Enter`)&&n.moveTo(e)}}),D(w(n),`selectItem`,function(e){n.setState(g({previousItem:n.state.selectedItem},e),function(){n.setState(n.animationHandler(n.props,n.state))}),n.handleOnChange(e.selectedItem,t.Children.toArray(n.props.children)[e.selectedItem])}),D(w(n),`getInitialImage`,function(){var e=n.props.selectedItem,t=n.itemsRef&&n.itemsRef[e];return(t&&t.getElementsByTagName(`img`)||[])[0]}),D(w(n),`getVariableItemHeight`,function(e){var t=n.itemsRef&&n.itemsRef[e];if(n.state.hasMount&&t&&t.children.length){var r=t.children[0].getElementsByTagName(`img`)||[];if(r.length>0){var i=r[0];i.complete||i.addEventListener(`load`,function e(){n.forceUpdate(),i.removeEventListener(`load`,e)})}var a=(r[0]||t.children[0]).clientHeight;return a>0?a:null}return null});var i={initialized:!1,previousItem:e.selectedItem,selectedItem:e.selectedItem,hasMount:!1,isMouseEntered:!1,autoPlay:e.autoPlay,swiping:!1,swipeMovementStarted:!1,cancelClick:!1,itemSize:1,itemListStyle:{},slideStyle:{},selectedStyle:{},prevStyle:{}};return n.animationHandler=typeof e.animationHandler==`function`&&e.animationHandler||e.animationHandler===`fade`&&l.fadeAnimationHandler||l.slideAnimationHandler,n.state=g(g({},i),n.animationHandler(e,i)),n}return y(u,[{key:`componentDidMount`,value:function(){this.props.children&&this.setupCarousel()}},{key:`componentDidUpdate`,value:function(e,t){!e.children&&this.props.children&&!this.state.initialized&&this.setupCarousel(),!e.autoFocus&&this.props.autoFocus&&this.forceFocus(),t.swiping&&!this.state.swiping&&this.setState(g({},this.props.stopSwipingHandler(this.props,this.state))),(e.selectedItem!==this.props.selectedItem||e.centerMode!==this.props.centerMode)&&(this.updateSizes(),this.moveTo(this.props.selectedItem)),e.autoPlay!==this.props.autoPlay&&(this.props.autoPlay?this.setupAutoPlay():this.destroyAutoPlay(),this.setState({autoPlay:this.props.autoPlay}))}},{key:`componentWillUnmount`,value:function(){this.destroyCarousel()}},{key:`setupCarousel`,value:function(){var e=this;this.bindEvents(),this.state.autoPlay&&t.Children.count(this.props.children)>1&&this.setupAutoPlay(),this.props.autoFocus&&this.forceFocus(),this.setState({initialized:!0},function(){var t=e.getInitialImage();t&&!t.complete?t.addEventListener(`load`,e.setMountState):e.setMountState()})}},{key:`destroyCarousel`,value:function(){this.state.initialized&&(this.unbindEvents(),this.destroyAutoPlay())}},{key:`setupAutoPlay`,value:function(){this.autoPlay();var e=this.carouselWrapperRef;this.props.stopOnHover&&e&&(e.addEventListener(`mouseenter`,this.stopOnHover),e.addEventListener(`mouseleave`,this.startOnLeave))}},{key:`destroyAutoPlay`,value:function(){this.clearAutoPlay();var e=this.carouselWrapperRef;this.props.stopOnHover&&e&&(e.removeEventListener(`mouseenter`,this.stopOnHover),e.removeEventListener(`mouseleave`,this.startOnLeave))}},{key:`bindEvents`,value:function(){(0,s.default)().addEventListener(`resize`,this.updateSizes),(0,s.default)().addEventListener(`DOMContentLoaded`,this.updateSizes),this.props.useKeyboardArrows&&(0,o.default)().addEventListener(`keydown`,this.navigateWithKeyboard)}},{key:`unbindEvents`,value:function(){(0,s.default)().removeEventListener(`resize`,this.updateSizes),(0,s.default)().removeEventListener(`DOMContentLoaded`,this.updateSizes);var e=this.getInitialImage();e&&e.removeEventListener(`load`,this.setMountState),this.props.useKeyboardArrows&&(0,o.default)().removeEventListener(`keydown`,this.navigateWithKeyboard)}},{key:`forceFocus`,value:function(){var e;(e=this.carouselWrapperRef)==null||e.focus()}},{key:`renderItems`,value:function(e){var n=this;return this.props.children?t.Children.map(this.props.children,function(r,a){var o=a===n.state.selectedItem,s=a===n.state.previousItem,c=o&&n.state.selectedStyle||s&&n.state.prevStyle||n.state.slideStyle||{};n.props.centerMode&&n.props.axis===`horizontal`&&(c=g(g({},c),{},{minWidth:n.props.centerSlidePercentage+`%`})),n.state.swiping&&n.state.swipeMovementStarted&&(c=g(g({},c),{},{pointerEvents:`none`}));var l={ref:function(e){return n.setItemsRef(e,a)},key:`itemKey`+a+(e?`clone`:``),className:i.default.ITEM(!0,a===n.state.selectedItem,a===n.state.previousItem),onClick:n.handleClickItem.bind(n,a,r),style:c};return t.default.createElement(`li`,l,n.props.renderItem(r,{isSelected:a===n.state.selectedItem,isPrevious:a===n.state.previousItem}))}):[]}},{key:`renderControls`,value:function(){var e=this,n=this.props,r=n.showIndicators,i=n.labels,a=n.renderIndicator,o=n.children;return r?t.default.createElement(`ul`,{className:`control-dots`},t.Children.map(o,function(t,n){return a&&a(e.changeItem(n),n===e.state.selectedItem,n,i.item)})):null}},{key:`renderStatus`,value:function(){return this.props.showStatus?t.default.createElement(`p`,{className:`carousel-status`},this.props.statusFormatter(this.state.selectedItem+1,t.Children.count(this.props.children))):null}},{key:`renderThumbs`,value:function(){return!this.props.showThumbs||!this.props.children||t.Children.count(this.props.children)===0?null:t.default.createElement(a.default,{ref:this.setThumbsRef,onSelectItem:this.handleClickThumb,selectedItem:this.state.selectedItem,transitionTime:this.props.transitionTime,thumbWidth:this.props.thumbWidth,labels:this.props.labels,emulateTouch:this.props.emulateTouch},this.props.renderThumbs(this.props.children))}},{key:`render`,value:function(){var e=this;if(!this.props.children||t.Children.count(this.props.children)===0)return null;var r=this.props.swipeable&&t.Children.count(this.props.children)>1,a=this.props.axis===`horizontal`,o=this.props.showArrows&&t.Children.count(this.props.children)>1,s=o&&(this.state.selectedItem>0||this.props.infiniteLoop)||!1,c=o&&(this.state.selectedItem<t.Children.count(this.props.children)-1||this.props.infiniteLoop)||!1,l=this.renderItems(!0),u=l.shift(),d=l.pop(),f={className:i.default.SLIDER(!0,this.state.swiping),onSwipeMove:this.onSwipeMove,onSwipeStart:this.onSwipeStart,onSwipeEnd:this.onSwipeEnd,style:this.state.itemListStyle,tolerance:this.props.swipeScrollTolerance},p={};return a?(f.onSwipeLeft=this.onSwipeForward,f.onSwipeRight=this.onSwipeBackwards,this.props.dynamicHeight&&(p.height=this.getVariableItemHeight(this.state.selectedItem)||`auto`)):(f.onSwipeUp=this.props.verticalSwipe===`natural`?this.onSwipeBackwards:this.onSwipeForward,f.onSwipeDown=this.props.verticalSwipe===`natural`?this.onSwipeForward:this.onSwipeBackwards,f.style=g(g({},f.style),{},{height:this.state.itemSize}),p.height=this.state.itemSize),t.default.createElement(`div`,{"aria-label":this.props.ariaLabel,className:i.default.ROOT(this.props.className),ref:this.setCarouselWrapperRef,tabIndex:this.props.useKeyboardArrows?0:void 0},t.default.createElement(`div`,{className:i.default.CAROUSEL(!0),style:{width:this.props.width}},this.renderControls(),this.props.renderArrowPrev(this.onClickPrev,s,this.props.labels.leftArrow),t.default.createElement(`div`,{className:i.default.WRAPPER(!0,this.props.axis),style:p},r?t.default.createElement(n.default,m({tagName:`ul`,innerRef:this.setListRef},f,{allowMouseEvents:this.props.emulateTouch}),this.props.infiniteLoop&&d,this.renderItems(),this.props.infiniteLoop&&u):t.default.createElement(`ul`,{className:i.default.SLIDER(!0,this.state.swiping),ref:function(t){return e.setListRef(t)},style:this.state.itemListStyle||{}},this.props.infiniteLoop&&d,this.renderItems(),this.props.infiniteLoop&&u)),this.props.renderArrowNext(this.onClickNext,c,this.props.labels.rightArrow),this.renderStatus()),this.renderThumbs())}}]),u}(t.default.Component);e.default=O,D(O,`displayName`,`Carousel`),D(O,`defaultProps`,{ariaLabel:void 0,axis:`horizontal`,centerSlidePercentage:80,interval:3e3,labels:{leftArrow:`previous slide / item`,rightArrow:`next slide / item`,item:`slide item`},onClickItem:c.noop,onClickThumb:c.noop,onChange:c.noop,onSwipeStart:function(){},onSwipeEnd:function(){},onSwipeMove:function(){return!1},preventMovementUntilSwipeScrollTolerance:!1,renderArrowPrev:function(e,n,r){return t.default.createElement(`button`,{type:`button`,"aria-label":r,className:i.default.ARROW_PREV(!n),onClick:e})},renderArrowNext:function(e,n,r){return t.default.createElement(`button`,{type:`button`,"aria-label":r,className:i.default.ARROW_NEXT(!n),onClick:e})},renderIndicator:function(e,n,r,a){return t.default.createElement(`li`,{className:i.default.DOT(n),onClick:e,onKeyDown:e,value:r,key:r,role:`button`,tabIndex:0,"aria-label":`${a} ${r+1}`})},renderItem:function(e){return e},renderThumbs:function(e){var n=t.Children.map(e,function(e){var n=e;if(e.type!==`img`&&(n=t.Children.toArray(e.props.children).find(function(e){return e.type===`img`})),n)return n});return n.filter(function(e){return e}).length===0?(console.warn(`No images found! Can't build the thumb list without images. If you don't need thumbs, set showThumbs={false} in the Carousel. Note that it's not possible to get images rendered inside custom components. More info at https://github.com/leandrowd/react-responsive-carousel/blob/master/TROUBLESHOOTING.md`),[]):n},statusFormatter:c.defaultStatusFormatter,selectedItem:0,showArrows:!0,showIndicators:!0,showStatus:!0,showThumbs:!0,stopOnHover:!0,swipeScrollTolerance:5,swipeable:!0,transitionTime:350,verticalSwipe:`standard`,width:`100%`,animationHandler:`slide`,swipeAnimationHandler:l.slideSwipeAnimationHandler,stopSwipingHandler:l.slideStopSwipingHandler})})),ft=t((()=>{})),pt=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),Object.defineProperty(e,`Carousel`,{enumerable:!0,get:function(){return t.default}}),Object.defineProperty(e,`CarouselProps`,{enumerable:!0,get:function(){return n.CarouselProps}}),Object.defineProperty(e,`Thumbs`,{enumerable:!0,get:function(){return r.default}});var t=i(dt()),n=ft(),r=i(st());function i(e){return e&&e.__esModule?e:{default:e}}})),mt=t(((e,t)=>{var n=xe();t.exports=function(){return n.Date.now()}})),ht=t(((e,t)=>{var n=/\s/;function r(e){for(var t=e.length;t--&&n.test(e.charAt(t)););return t}t.exports=r})),gt=t(((e,t)=>{var n=ht(),r=/^\s+/;function i(e){return e&&e.slice(0,n(e)+1).replace(r,``)}t.exports=i})),_t=t(((e,t)=>{var n=gt(),r=I(),i=ne(),a=NaN,o=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,c=/^0o[0-7]+$/i,l=parseInt;function u(e){if(typeof e==`number`)return e;if(i(e))return a;if(r(e)){var t=typeof e.valueOf==`function`?e.valueOf():e;e=r(t)?t+``:t}if(typeof e!=`string`)return e===0?e:+e;e=n(e);var u=s.test(e);return u||c.test(e)?l(e.slice(2),u?2:8):o.test(e)?a:+e}t.exports=u})),vt=t(((e,t)=>{var n=I(),r=mt(),i=_t(),a=`Expected a function`,o=Math.max,s=Math.min;function c(e,t,c){var l,u,d,f,p,m,h=0,g=!1,_=!1,v=!0;if(typeof e!=`function`)throw TypeError(a);t=i(t)||0,n(c)&&(g=!!c.leading,_=`maxWait`in c,d=_?o(i(c.maxWait)||0,t):d,v=`trailing`in c?!!c.trailing:v);function y(t){var n=l,r=u;return l=u=void 0,h=t,f=e.apply(r,n),f}function b(e){return h=e,p=setTimeout(C,t),g?y(e):f}function x(e){var n=e-m,r=e-h,i=t-n;return _?s(i,d-r):i}function S(e){var n=e-m,r=e-h;return m===void 0||n>=t||n<0||_&&r>=d}function C(){var e=r();if(S(e))return w(e);p=setTimeout(C,x(e))}function w(e){return p=void 0,v&&l?y(e):(l=u=void 0,f)}function T(){p!==void 0&&clearTimeout(p),h=0,l=m=u=p=void 0}function E(){return p===void 0?f:w(r())}function D(){var e=r(),n=S(e);if(l=arguments,u=this,m=e,n){if(p===void 0)return b(m);if(_)return clearTimeout(p),p=setTimeout(C,t),y(m)}return p===void 0&&(p=setTimeout(C,t)),f}return D.cancel=T,D.flush=E,D}t.exports=c})),yt=e(vt(),1);function bt(e,t,n,r,i=!1){let a=K.useRef();a.current=t,K.useEffect(()=>{if(n===null||n.addEventListener===void 0)return;let t=n,o=e=>{a.current?.call(t,e)};return t.addEventListener(e,o,{passive:r,capture:i}),()=>{t.removeEventListener(e,o,{capture:i})}},[e,n,r,i])}function xt(e,t){return e===void 0?void 0:t}var St=Math.PI;function Ct(e){return e*St/180}var wt=(e,t,n)=>({x1:e-n/2,y1:t-n/2,x2:e+n/2,y2:t+n/2}),Tt=(e,t,n,r,i)=>{switch(e){case`left`:return Math.floor(t)+r+i/2;case`center`:return Math.floor(t+n/2);case`right`:return Math.floor(t+n)-r-i/2}},Et=(e,t,n)=>Math.min(e,t-n*2),Dt=(e,t,n)=>n.x1<=e&&e<=n.x2&&n.y1<=t&&t<=n.y2,Ot=e=>{let t=e.fgColor??`currentColor`;return K.createElement(`svg`,{viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},K.createElement(`path`,{d:`M12.7073 7.05029C7.87391 11.8837 10.4544 9.30322 6.03024 13.7273C5.77392 13.9836 5.58981 14.3071 5.50189 14.6587L4.52521 18.5655C4.38789 19.1148 4.88543 19.6123 5.43472 19.475L9.34146 18.4983C9.69313 18.4104 10.0143 18.2286 10.2706 17.9722L16.9499 11.2929`,stroke:t,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,fill:`none`,vectorEffect:`non-scaling-stroke`}),K.createElement(`path`,{d:`M20.4854 4.92901L19.0712 3.5148C18.2901 2.73375 17.0238 2.73375 16.2428 3.5148L14.475 5.28257C15.5326 7.71912 16.4736 8.6278 18.7176 9.52521L20.4854 7.75744C21.2665 6.97639 21.2665 5.71006 20.4854 4.92901Z`,stroke:t,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,fill:`none`,vectorEffect:`non-scaling-stroke`}))},kt=e=>{let t=e.fgColor??`currentColor`;return K.createElement(`svg`,{viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},K.createElement(`path`,{d:`M19 6L10.3802 17L5.34071 11.8758`,vectorEffect:`non-scaling-stroke`,stroke:t,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`}))};function At(e,t,n){let[r,i]=K.useState(e),a=K.useRef(!0);K.useEffect(()=>()=>{a.current=!1},[]);let o=K.useRef((0,yt.default)(e=>{a.current&&i(e)},n));return K.useLayoutEffect(()=>{a.current&&o.current(()=>e())},t),r}var jt=RegExp(`^[^A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿]*[֑-߿יִ-﷽ﹰ-ﻼ]`);function Mt(e){return jt.test(e)?`rtl`:`not-rtl`}var Nt=void 0;function Pt(){if(typeof document>`u`)return 0;if(Nt!==void 0)return Nt;let e=document.createElement(`p`);e.style.width=`100%`,e.style.height=`200px`;let t=document.createElement(`div`);t.id=`testScrollbar`,t.style.position=`absolute`,t.style.top=`0px`,t.style.left=`0px`,t.style.visibility=`hidden`,t.style.width=`200px`,t.style.height=`150px`,t.style.overflow=`hidden`,t.append(e),document.body.append(t);let n=e.offsetWidth;t.style.overflow=`scroll`;let r=e.offsetWidth;return n===r&&(r=t.clientWidth),t.remove(),Nt=n-r,Nt}var Ft=Symbol();function It(e){let t=K.useRef([Ft,e]);t.current[1]!==e&&(t.current[0]=e),t.current[1]=e;let[n,r]=K.useState(e),[,i]=K.useState(),a=K.useCallback(e=>{let n=t.current[0];n!==Ft&&(e=typeof e==`function`?e(n):e,e===n)||(n!==Ft&&i({}),r(t=>typeof e==`function`?e(n===Ft?t:n):e),t.current[0]=Ft)},[]),o=K.useCallback(()=>{t.current[0]=Ft,i({})},[]);return[t.current[0]===Ft?n:t.current[0],a,o]}function Lt(e){if(e.length===0)return``;let t=0,n=0;for(let r of e){if(n+=r.length,n>1e4)break;t++}return e.slice(0,t).join(`, `)}function Rt(e){let t=K.useRef(e);return M(e,t.current)||(t.current=e),t.current}var zt=pt(),Bt=e=>{let{urls:t,canWrite:n,onEditClick:r,renderImage:i}=e,a=t.filter(e=>e!==``);if(a.length===0)return null;let o=a.length>1;return K.createElement(Xe,{"data-testid":`GDG-default-image-overlay-editor`},K.createElement(zt.Carousel,{showArrows:o,showThumbs:!1,swipeable:o,emulateTouch:o,infiniteLoop:o},a.map(e=>{let t=i?.(e)??K.createElement(`img`,{draggable:!1,src:e});return K.createElement(`div`,{className:`gdg-centering-container`,key:e},t)})),n&&r&&K.createElement(`button`,{className:`gdg-edit-icon`,onClick:r},K.createElement(Ot,null)))},Vt=G(`div`)({name:`MarkdownContainer`,class:`gdg-mnuv029`,propsAsIs:!1}),Ht=class extends K.PureComponent{targetElement=null;renderMarkdownIntoDiv(){let{targetElement:e,props:t}=this;if(e===null)return;let{contents:n,createNode:r}=t,i=C(n),a=document.createRange();a.selectNodeContents(e),a.deleteContents();let o=r?.(i);if(o===void 0){let e=document.createElement(`template`);e.innerHTML=i,o=e.content}e.append(o);let s=e.getElementsByTagName(`a`);for(let e of s)e.target=`_blank`,e.rel=`noreferrer noopener`}containerRefHook=e=>{this.targetElement=e,this.renderMarkdownIntoDiv()};render(){return this.renderMarkdownIntoDiv(),K.createElement(Vt,{ref:this.containerRefHook})}},Ut=G(`textarea`)({name:`InputBox`,class:`gdg-izpuzkl`,propsAsIs:!1}),Wt=G(`div`)({name:`ShadowBox`,class:`gdg-s69h75o`,propsAsIs:!1}),Gt=G(`div`)({name:`GrowingEntryStyle`,class:`gdg-g1y0xocz`,propsAsIs:!1}),Kt=0,qt=e=>{let{placeholder:t,value:n,onKeyDown:r,highlight:i,altNewline:a,validatedSelection:o,...s}=e,{onChange:c,className:l}=s,u=K.useRef(null),d=n??``;ce(c!==void 0,`GrowingEntry must be a controlled input area`);let[f]=K.useState(()=>`input-box-`+(Kt=(Kt+1)%1e7));K.useEffect(()=>{let e=u.current;if(e===null||e.disabled)return;let t=d.toString().length;e.focus(),e.setSelectionRange(i?0:t,t)},[]),K.useLayoutEffect(()=>{if(o!==void 0){let e=typeof o==`number`?[o,null]:o;u.current?.setSelectionRange(e[0],e[1])}},[o]);let p=K.useCallback(e=>{e.key===`Enter`&&e.shiftKey&&a===!0||r?.(e)},[a,r]);return K.createElement(Gt,{className:`gdg-growing-entry`},K.createElement(Wt,{className:l},d+`
5
5
  `),K.createElement(Ut,{...s,className:(l??``)+` gdg-input`,id:f,ref:u,onKeyDown:p,value:d,placeholder:t,dir:`auto`}))},Jt=new Map,Yt=new Map,Xt=new Map;function Zt(){Jt.clear(),Xt.clear(),Yt.clear()}function Qt(e,t,n,r,i){let a=0,o={};for(let t of e)a+=n.get(t)??i,o[t]=(o[t]??0)+1;let s=t-a;for(let e of Object.keys(o)){let t=o[e],c=n.get(e)??i,l=c+s*(c*t/a)*r/t;n.set(e,l)}}function $t(e,t){let n=new Map,r=0;for(let t of`abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890,.-+=?`){let i=e.measureText(t).width;n.set(t,i),r+=i}let i=r/n.size,a=(t/i+3)/4,o=n.keys();for(let e of o)n.set(e,(n.get(e)??i)*a);return n}function en(e,t,n,r){let i=Yt.get(n);if(r&&i!==void 0&&i.count>2e4){let r=Xt.get(n);if(r===void 0&&(r=$t(e,i.size),Xt.set(n,r)),i.count>5e5){let e=0;for(let n of t)e+=r.get(n)??i.size;return e*1.01}let a=e.measureText(t);return Qt(t,a.width,r,Math.max(.05,1-i.count/2e5),i.size),Yt.set(n,{count:i.count+t.length,size:i.size}),a.width}let a=e.measureText(t),o=a.width/t.length;if((i?.count??0)>2e4)return a.width;if(i===void 0)Yt.set(n,{count:t.length,size:o});else{let e=o-i.size,r=t.length/(i.count+t.length),a=i.size+e*r;Yt.set(n,{count:i.count+t.length,size:a})}return a.width}function tn(e,t,n,r,i,a,o,s){if(t.length<=1)return t.length;if(i<n)return-1;let c=Math.floor(n/i*a),l=en(e,t.slice(0,Math.max(0,c)),r,o),u=s?.(t);if(l!==n)if(l<n){for(;l<n;)c++,l=en(e,t.slice(0,Math.max(0,c)),r,o);c--}else for(;l>n;){let n=u===void 0?t.lastIndexOf(` `,c-1):0;n>0?c=n:c--,l=en(e,t.slice(0,Math.max(0,c)),r,o)}if(t[c]!==` `){let e=0;if(u===void 0)e=t.lastIndexOf(` `,c);else for(let t of u){if(t>c)break;e=t}e>0&&(c=e)}return c}function J(e,t,n,r,i,a){let o=`${t}_${n}_${r}px`,s=Jt.get(o);if(s!==void 0)return s;if(r<=0)return[];let c=[],l=t.split(`
@@ -133,5 +133,4 @@ import{o as e,t}from"./rolldown-runtime-FhOqtrmT.js";import{b as n,x as r}from".
133
133
  `,t.allowWrapping===!0?void 0:1),i=0;for(let t of r)i=Math.max(i,e.measureText(t).width);return i+2*n.cellHorizontalPadding},onDelete:e=>({...e,data:``}),provideEditor:e=>({disablePadding:e.allowWrapping===!0,editor:t=>{let{isHighlighted:n,onChange:r,value:i,validatedSelection:a}=t;return K.createElement(qt,{style:e.allowWrapping===!0?{padding:`3px 8.5px`}:void 0,highlight:n,autoFocus:i.readonly!==!0,disabled:i.readonly===!0,altNewline:!0,value:i.data,validatedSelection:a,onChange:e=>r({...i,data:e.target.value})})}}),onPaste:(e,t,n)=>e===t.data?void 0:{...t,data:e,displayData:n.formattedString??t.displayData}},Fs=G(`div`)({name:`UriOverlayEditorStyle`,class:`gdg-u1rrojo`,propsAsIs:!1}),Is=e=>{let{uri:t,onChange:n,forceEditMode:r,readonly:i,validatedSelection:a,preview:o}=e,[s,c]=K.useState(!i&&(t===``||r)),l=K.useCallback(()=>{c(!0)},[]);return s?K.createElement(qt,{validatedSelection:a,highlight:!0,autoFocus:!0,value:t,onChange:n}):K.createElement(Fs,null,K.createElement(`a`,{className:`gdg-link-area`,href:t,target:`_blank`,rel:`noopener noreferrer`},o),!i&&K.createElement(`div`,{className:`gdg-edit-icon`,onClick:l},K.createElement(Ot,null)),K.createElement(`textarea`,{className:`gdg-input`,autoFocus:!0}))};function Ls(e,t,n,r){let i=n.cellHorizontalPadding,a=t.height/2-e.actualBoundingBoxAscent/2,o=e.width,s=e.actualBoundingBoxAscent;return r===`right`?i=t.width-o-n.cellHorizontalPadding:r===`center`&&(i=t.width/2-o/2),{x:i,y:a,width:o,height:s}}var Rs=[Cs,Ds,es,is,ls,ms,vs,Ss,As,js,Ns,Ps,{getAccessibilityString:e=>e.data?.toString()??``,kind:z.Uri,needsHover:e=>e.hoverEffect===!0,needsHoverPosition:!0,useLabel:!0,drawPrep:kn,draw:e=>{let{cell:t,theme:n,overrideCursor:r,hoverX:i,hoverY:a,rect:o,ctx:s}=e,c=t.displayData??t.data,l=t.hoverEffect===!0;if(r!==void 0&&l&&i!==void 0&&a!==void 0){let{x:l,y:u,width:d,height:f}=Ls(Sn(c,s,n.baseFontFull),o,n,t.contentAlign);if(i>=l-4&&i<=l-4+d+8&&a>=u-4&&a<=u-4+f+8){let i=wn(s,n.baseFontFull);r(`pointer`);let a=u-i;s.beginPath(),s.moveTo(o.x+l,Math.floor(o.y+a+f+5)+.5),s.lineTo(o.x+l+d,Math.floor(o.y+a+f+5)+.5),s.strokeStyle=n.linkColor,s.stroke(),s.save(),s.fillStyle=e.cellFillColor,Pn({...e,rect:{...o,x:o.x-1}},c,t.contentAlign),Pn({...e,rect:{...o,x:o.x-2}},c,t.contentAlign),Pn({...e,rect:{...o,x:o.x+1}},c,t.contentAlign),Pn({...e,rect:{...o,x:o.x+2}},c,t.contentAlign),s.restore()}}s.fillStyle=l?n.linkColor:n.textDark,Pn(e,c,t.contentAlign)},onClick:e=>{let{cell:t,bounds:n,posX:r,posY:i,theme:a}=e,o=t.displayData??t.data;if(t.hoverEffect!==!0||t.onClickUri===void 0)return;let s=Cn(o,a.baseFontFull);if(s===void 0)return;let c=Ls(s,n,a,t.contentAlign);Br({x:c.x-4,y:c.y-4,width:c.width+8,height:c.height+8},r,i)&&t.onClickUri(e)},measure:(e,t,n)=>e.measureText(t.displayData??t.data).width+n.cellHorizontalPadding*2,onDelete:e=>({...e,data:``}),provideEditor:e=>t=>{let{onChange:n,value:r,forceEditMode:i,validatedSelection:a}=t;return K.createElement(Is,{forceEditMode:r.readonly!==!0&&(i||e.hoverEffect===!0&&e.onClickUri!==void 0),uri:r.data,preview:r.displayData??r.data,validatedSelection:a,readonly:r.readonly===!0,onChange:e=>n({...r,data:e.target.value})})},onPaste:(e,t,n)=>e===t.data?void 0:{...t,data:e,displayData:n.formattedString??t.displayData}}],zs=e(t(((e,t)=>{var n=vt(),r=I(),i=`Expected a function`;function a(e,t,a){var o=!0,s=!0;if(typeof e!=`function`)throw TypeError(i);return r(a)&&(o=`leading`in a?!!a.leading:o,s=`trailing`in a?!!a.trailing:s),n(e,t,{leading:o,maxWait:t,trailing:s})}t.exports=a}))(),1),Bs=[],Vs=class extends Un{imageLoaded=()=>void 0;loadedLocations=[];cache={};setCallback(e){this.imageLoaded=e}sendLoaded=(0,zs.default)(()=>{this.imageLoaded(new Gn(this.loadedLocations)),this.loadedLocations=[]},20);clearOutOfWindow=()=>{let e=Object.keys(this.cache);for(let t of e){let e=this.cache[t],n=!1;for(let t=0;t<e.cells.length;t++){let r=e.cells[t];if(this.isInWindow(r)){n=!0;break}}n?e.cells=e.cells.filter(this.isInWindow):(e.cancel(),delete this.cache[t])}};loadImage(e,t,n,r){let i=!1,a=Bs.pop()??new Image,o=!1,s={img:void 0,cells:[X(t,n)],url:e,cancel:()=>{o||(o=!0,Bs.length<12?Bs.unshift(a):i||(a.src=``))}},c=new Promise(e=>a.addEventListener(`load`,()=>e(null)));requestAnimationFrame(async()=>{try{a.src=e,await c,await a.decode();let t=this.cache[r];if(t!==void 0&&!o){t.img=a;for(let e of t.cells)this.loadedLocations.push(Hn(e));i=!0,this.sendLoaded()}}catch{s.cancel()}}),this.cache[r]=s}loadOrGetImage(e,t,n){let r=e,i=this.cache[r];if(i!==void 0){let e=X(t,n);return i.cells.includes(e)||i.cells.push(e),i.img}else this.loadImage(e,t,n,r)}},Hs=K.forwardRef((e,t)=>{let n=K.useMemo(()=>({...Ar,...e.headerIcons}),[e.headerIcons]),r=K.useMemo(()=>e.imageWindowLoader??new Vs,[e.imageWindowLoader]);return K.createElement(Qo,{...e,renderers:Rs,headerIcons:n,ref:t,imageWindowLoader:r})});function Us(e){return getComputedStyle(document.documentElement).getPropertyValue(e).trim()}function Ws(e,t){if(e.startsWith(`#`)){let n=e.slice(1);return`rgba(${parseInt(n.slice(0,2),16)}, ${parseInt(n.slice(2,4),16)}, ${parseInt(n.slice(4,6),16)}, ${t})`}return e}function Gs(){let e=Us(`--color-background`),t=Us(`--color-foreground`),n=Us(`--color-muted`),r=Us(`--color-muted-foreground`),i=Us(`--color-primary`),a=Us(`--color-primary-foreground`),o=Us(`--color-border`),s=Us(`--color-accent`),c=Us(`--color-text-secondary`),l=Us(`--color-text-subtle`),u=Us(`--font-sans`)||`Geist, system-ui, sans-serif`;return{bgCell:e,bgCellMedium:n,bgHeader:n,bgHeaderHasFocus:s,bgHeaderHovered:s,bgBubble:s,bgBubbleSelected:i,textDark:t,textMedium:c,textLight:l,textHeader:r,textGroupHeader:r,textHeaderSelected:t,textBubble:t,accentColor:i,accentFg:a,accentLight:Ws(i,.12),borderColor:o,horizontalBorderColor:o,fontFamily:u,baseFontStyle:`13px`,headerFontStyle:`600 12px`,editorFontSize:`13px`,lineHeight:1.5,cellHorizontalPadding:8,cellVerticalPadding:4,headerIconSize:16}}function Ks(){let[e,t]=(0,K.useState)(0);return(0,K.useEffect)(()=>{let e=new MutationObserver(()=>t(e=>e+1));return e.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`]}),()=>e.disconnect()},[]),(0,K.useMemo)(()=>Gs(),[e])}function qs(e,t,n){let r=e.length*9+40,i=0,a=Math.min(t.length,20);for(let n=0;n<a;n++){let r=t[n]?.[e];if(r==null)continue;let a=typeof r==`object`?12:String(r).length;i=Math.max(i,a*8)}let o=/^(int|serial|bigint|smallint|float|double|decimal|numeric|real|money|bool)/.test(n.toLowerCase())?80:100;return Math.max(o,Math.min(Math.max(r,i)+16,400))}function Js(e,t,n,r,i,a,o){return(0,K.useMemo)(()=>{let s=t.filter(e=>n.has(e)),c=t.filter(e=>!n.has(e)),l=[...s,...c],u=new Map(e.map(e=>[e.name,e]));return{columns:l.map(e=>{let t=u.get(e),n=t?.pk??!1,s;return a===e?s=o===`ASC`?`sortAsc`:`sortDesc`:n?s=`headerRowID`:t?.fk&&(s=`headerFk`),{title:e,id:e,width:r.get(e)??qs(e,i,t?.type??`text`),hasMenu:!0,icon:s}}),freezeColumns:s.length,columnOrder:l}},[e,t,n,r,i,a,o])}function Ys(e){if(e==null)return!1;if(typeof e==`object`)return!0;let t=String(e);if(t.length>=200)return!0;let n=t.trimStart();return!!((n[0]===`{`||n[0]===`[`)&&(n.endsWith(`}`)||n.endsWith(`]`))||n.startsWith(`<?xml`)||n.startsWith(`<`)&&n.endsWith(`>`))}function Xs(e){return e==null?`NULL`:typeof e==`object`?JSON.stringify(e):String(e)}function Zs(e){let t=e.trimStart();if(t[0]===`{`||t[0]===`[`)try{return JSON.parse(t),`json`}catch{}return t.startsWith(`<?xml`)||t.startsWith(`<`)&&/<\/\w+>/.test(t)?`xml`:t.startsWith(`---`)||/^\w+:\s/m.test(t)?`yaml`:`plaintext`}function Qs(e){let t=e.toLowerCase();return/^(int|serial|bigint|smallint|float|double|decimal|numeric|real|money)/.test(t)?z.Number:/^bool/.test(t)?z.Boolean:z.Text}function $s(e){let t=e.type.toLowerCase();return!!(/^(serial|bigserial|smallserial)/.test(t)||/^(int|bigint|smallint|integer)/.test(t)&&e.defaultValue&&/nextval|identity|auto_increment/i.test(e.defaultValue)||t===`integer`&&e.pk&&!e.defaultValue)}function ec(e,t=200){return e.length>t?e.slice(0,t)+`…`:e}var tc={bgCell:`rgba(251, 191, 36, 0.15)`};function nc(e,t,n,r,i,a){let o=(0,K.useRef)(e);o.current=e;let s=(0,K.useRef)(t);s.current=t;let c=(0,K.useRef)(new Map);return c.current=new Map(n.map(e=>[e.name,e])),{getCellContent:(0,K.useCallback)(([e,t])=>{let n=s.current[e],i=o.current[t];if(!n||!i)return{kind:z.Text,data:``,displayData:``,allowOverlay:!1};let l=c.current.get(n),u=l?Qs(l.type):z.Text,d=l?.pk??!1,f=r?i[r]:void 0,p=typeof f==`string`&&f.startsWith(`__new_`),m=`${f}:${n}`,h=a.current.get(m),g=h===void 0?i[n]:h.newVal,_=h!==void 0;if(d&&p){if(l&&$s(l))return{kind:z.Text,data:``,displayData:`AUTO`,allowOverlay:!1,readonly:!0,themeOverride:{textDark:`#6b7280`}};let e=h===void 0?``:String(h.newVal??``);return{kind:z.Text,data:e,displayData:e||`Enter ID…`,allowOverlay:!0,readonly:!1,themeOverride:e?_?tc:void 0:{textDark:`#9ca3af`}}}if(g==null){let e=p?``:`NULL`;if(p&&!_&&l){let t=l.type.toLowerCase();l.defaultValue?e=l.defaultValue:/^(timestamp|datetime|date)/.test(t)?e=`NOW()`:/^(uuid)/.test(t)&&(e=`gen_random_uuid()`)}return{kind:z.Text,data:``,displayData:e,allowOverlay:!d,readonly:d,themeOverride:_?tc:p||e!==`NULL`?{textDark:`#9ca3af`}:{textDark:`#6b7280`}}}if(u===z.Number&&typeof g==`number`)return{kind:z.Number,data:g,displayData:String(g),allowOverlay:!d,readonly:d,themeOverride:_?tc:void 0};if(u===z.Boolean&&typeof g==`boolean`)return{kind:z.Boolean,data:g,readonly:d,allowOverlay:!1};let v=Xs(g);return{kind:z.Text,data:v,displayData:ec(v),allowOverlay:!d,readonly:d,themeOverride:_?tc:void 0}},[]),onCellEdited:(0,K.useCallback)(([e,t],n)=>{if(!r)return;let a=s.current[e],c=o.current[t];if(!a||!c)return;let l=c[r],u;if(n.kind===z.Text)u=n.data===``?null:n.data;else if(n.kind===z.Number)u=n.data;else if(n.kind===z.Boolean)u=n.data;else return;i(l,a,u)},[r,i])}}var rc={columns:U.empty(),rows:U.empty()};function ic(){let[e,t]=(0,K.useState)(rc);return{gridSelection:e,onGridSelectionChange:(0,K.useCallback)(e=>{t(e)},[]),selectedRowIndices:(0,K.useMemo)(()=>{let t=[];if(e.rows)for(let n of e.rows)if(Array.isArray(n))for(let e=n[0];e<n[1];e++)t.push(e);else t.push(n);return t},[e.rows]),clearSelection:(0,K.useCallback)(()=>{t(rc)},[])}}function ac(e,t,n){let[r,i]=(0,K.useState)(new Map),a=(0,K.useRef)(r);a.current=r;let o=(0,K.useRef)(!1);return{pendingEdits:r,pendingRef:a,addEdit:(0,K.useCallback)((e,t,n)=>{let r=`${e}:${t}`;i(i=>new Map(i).set(r,{pkVal:e,col:t,newVal:n}))},[]),commitAll:(0,K.useCallback)(async()=>{if(!e)return;let r=new Map;for(let n of a.current.values()){let i=String(n.pkVal);i.startsWith(`__new_`)?(r.has(i)||r.set(i,{}),r.get(i)[n.col]=n.newVal):t(e,n.pkVal,n.col,n.newVal)}if(n)for(let e of r.values())await n(e);o.current=!0},[e,t,n]),discardAll:(0,K.useCallback)(()=>{i(new Map),o.current=!1},[]),hasPending:r.size>0,pendingCount:r.size,committedRef:o}}function oc(e,t){let[n,r]=(0,K.useState)(new Set);return{effectiveRows:(0,K.useMemo)(()=>{if(n.size===0||!t)return e;let r=[],i=[];for(let a of e)n.has(String(a[t]??``))?i.push(a):r.push(a);return[...r,...i]},[e,n,t]),pinnedCount:n.size,pinnedPks:n,setPinnedPks:r}}function sc(e){let{displayRows:t,columnOrder:n,schema:r,pkCol:i,connectionId:a,connectionName:o,selectedTable:s,selectedSchema:c,addEdit:l,gridSelection:u,containerRef:d}=e,{openTab:f}=w(D(e=>({openTab:e.openTab}))),[p,m]=(0,K.useState)(null),h=(0,K.useRef)(t);h.current=t;let g=(0,K.useRef)(n);g.current=n;let _=(0,K.useCallback)(e=>{let n=t[e];if(!n)return;let r=i?String(n[i]??``):``,o=s??``,c=JSON.stringify(n,null,2);m({title:r?`Row #${r}${o?` — ${o}`:``}`:`Row — ${o}`,content:c,language:`json`,viewerKey:`${a}:${o}:row:${r}`})},[t,i,s,a]),v=(0,K.useCallback)((e,r)=>{let o=t[e];if(!o)return;let c=n[r];if(!c)return;let l=Xs(o[c]),u=i?String(o[i]??e):String(e),d=s??``;m({title:`${c} #${u}${d?` — ${d}`:``}`,content:l,language:Zs(l),viewerKey:`${a}:${d}:${c}:${u}`})},[t,n,i,s,a]),y=(0,K.useCallback)(()=>{p&&f({type:`editor`,title:p.title,projectId:null,closable:!0,metadata:{inlineContent:p.content,inlineLanguage:p.language,viewerKey:p.viewerKey}})},[f,p]),b=(0,K.useCallback)((e,t)=>{if(!i)return!1;let[n,a]=e;for(let e=0;e<t.length;e++){let o=h.current[a+e];if(!o)continue;let s=o[i];for(let i=0;i<t[e].length;i++){let a=g.current[n+i];if(!a||r.find(e=>e.name===a)?.pk)continue;let o=t[e][i];l(s,a,o===``?null:o)}}return!1},[i,r,l]),x=(0,K.useRef)(r);x.current=r;let S=(0,K.useRef)(u);S.current=u;let C=(0,K.useRef)(l);C.current=l;let T=(0,K.useRef)(i);return T.current=i,(0,K.useEffect)(()=>{if(!d)return;let e=e=>{let t=d.current;if(!t||!t.contains(document.activeElement))return;let n=document.activeElement?.tagName;if(n===`INPUT`||n===`TEXTAREA`)return;let r=T.current;if(!r)return;let i=S.current?.current;if(!i)return;let a=e.clipboardData?.getData(`text/plain`);if(!a)return;let o=a.split(/\r?\n/).filter(e=>e.length>0).map(e=>e.split(` `));if(o.length===0)return;let[s,c]=i.cell;for(let e=0;e<o.length;e++){let t=h.current[c+e];if(!t)continue;let n=t[r];for(let t=0;t<o[e].length;t++){let r=g.current[s+t];if(!r||x.current.find(e=>e.name===r)?.pk)continue;let i=o[e][t];C.current(n,r,i===``?null:i)}}e.preventDefault()};return document.addEventListener(`paste`,e),()=>document.removeEventListener(`paste`,e)},[d]),{previewData:p,setPreviewData:m,openRowPreview:_,openCellPreview:v,openPreviewInTab:y,handlePaste:b,getContextFk:(0,K.useCallback)(e=>e?r.find(t=>t.name===e)?.fk??null:null,[r]),isCellViewable:(0,K.useCallback)((e,t)=>e&&t?Ys(e[t]):!1,[]),openFkTable:(0,K.useCallback)((e,t)=>{t==null||!a||f({type:`database`,title:`${o??`DB`} · ${e.table}`,projectId:null,closable:!0,metadata:{connectionId:a,connectionName:o,tableName:e.table,schemaName:c??`public`,initialSql:`SELECT * FROM "${e.table}" WHERE "${e.column}" = '${String(t).replace(/'/g,`''`)}'`}})},[a,o,c,f])}}function cc({colName:e,bounds:t,isPinned:n,filterValue:r,sortState:i,onFilter:a,onSort:o,onClearSort:l,onTogglePin:u,onClose:d}){let[m,h]=(0,K.useState)(r),g=(0,K.useRef)(null),_=(0,K.useRef)(void 0);(0,K.useEffect)(()=>{let e=e=>{g.current&&!g.current.contains(e.target)&&d()};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[d]),(0,K.useEffect)(()=>{let e=e=>{e.key===`Escape`&&d()};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[d]);let v=e=>{h(e),clearTimeout(_.current),_.current=setTimeout(()=>a(e),300)},b=Math.min(t.x,window.innerWidth-220-8),x=t.y+t.height+2,S=document.getElementById(`portal`);return S?(0,qe.createPortal)((0,q.jsxs)(`div`,{ref:g,style:{position:`fixed`,left:b,top:x,zIndex:1e4},className:`w-[220px] bg-popover border border-border rounded-md shadow-lg text-xs overflow-hidden`,children:[(0,q.jsx)(`div`,{className:`px-3 py-1.5 border-b border-border text-muted-foreground font-medium truncate`,children:e}),(0,q.jsx)(`div`,{className:`px-2 py-1.5 border-b border-border`,children:(0,q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,q.jsx)(Me,{className:`size-3 text-muted-foreground shrink-0`}),(0,q.jsx)(`input`,{autoFocus:!0,type:`text`,value:m,onChange:e=>v(e.target.value),placeholder:`Filter (ILIKE)…`,className:`flex-1 bg-transparent outline-none text-foreground placeholder:text-muted-foreground text-xs`}),m&&(0,q.jsx)(`button`,{type:`button`,onClick:()=>v(``),className:`text-muted-foreground hover:text-foreground`,children:(0,q.jsx)(y,{className:`size-3`})})]})}),(0,q.jsxs)(`div`,{className:`py-1`,children:[(0,q.jsxs)(`button`,{type:`button`,onClick:()=>{o(),d()},className:`w-full text-left px-3 py-1.5 hover:bg-muted flex items-center gap-2 text-foreground`,children:[i===`asc`?(0,q.jsx)(s,{className:`size-3`}):(0,q.jsx)(c,{className:`size-3`}),i===`asc`?`Sort Descending`:`Sort Ascending`]}),i&&l&&(0,q.jsxs)(`button`,{type:`button`,onClick:()=>{l(),d()},className:`w-full text-left px-3 py-1.5 hover:bg-muted flex items-center gap-2 text-foreground`,children:[(0,q.jsx)(y,{className:`size-3`}),`Clear Sort`]}),(0,q.jsxs)(`button`,{type:`button`,onClick:()=>{u(),d()},className:`w-full text-left px-3 py-1.5 hover:bg-muted flex items-center gap-2 text-foreground`,children:[n?(0,q.jsx)(p,{className:`size-3`}):(0,q.jsx)(f,{className:`size-3`}),n?`Unpin Column`:`Pin Column`]})]})]}),S):null}function lc({position:e,isPinned:t,onViewRow:n,onViewCell:r,onPinRow:i,onDeleteRow:a,onOpenFkTable:o,fkLabel:s,onClose:c}){let[l,u]=(0,K.useState)(!1),d=(0,K.useRef)(null);(0,K.useEffect)(()=>{let e=e=>{d.current&&!d.current.contains(e.target)&&c()};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[c]),(0,K.useEffect)(()=>{let e=e=>{e.key===`Escape`&&c()};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[c]);let m=Math.min(e.x,window.innerWidth-180-8),h=Math.min(e.y,window.innerHeight-130-8),v=document.getElementById(`portal`);return v?(0,qe.createPortal)((0,q.jsxs)(`div`,{ref:d,style:{position:`fixed`,left:m,top:h,zIndex:1e4},className:`w-[180px] bg-popover border border-border rounded-md shadow-lg text-xs overflow-hidden py-1`,children:[(0,q.jsxs)(`button`,{type:`button`,onClick:()=>{n(),c()},className:`w-full text-left px-3 py-1.5 hover:bg-muted flex items-center gap-2 text-foreground`,children:[(0,q.jsx)(g,{className:`size-3`}),` View as JSON`]}),r&&(0,q.jsxs)(`button`,{type:`button`,onClick:()=>{r(),c()},className:`w-full text-left px-3 py-1.5 hover:bg-muted flex items-center gap-2 text-foreground`,children:[(0,q.jsx)(g,{className:`size-3`}),` View Cell`]}),o&&(0,q.jsxs)(`button`,{type:`button`,onClick:()=>{o(),c()},className:`w-full text-left px-3 py-1.5 hover:bg-muted flex items-center gap-2 text-blue-400`,children:[(0,q.jsx)(k,{className:`size-3`}),` `,s??`Open Referenced Table`]}),(0,q.jsxs)(`button`,{type:`button`,onClick:()=>{i(),c()},className:`w-full text-left px-3 py-1.5 hover:bg-muted flex items-center gap-2 text-foreground`,children:[t?(0,q.jsx)(p,{className:`size-3`}):(0,q.jsx)(f,{className:`size-3`}),t?`Unpin Row`:`Pin Row`]}),(0,q.jsx)(`div`,{className:`border-t border-border my-0.5`}),l?(0,q.jsxs)(`div`,{className:`px-3 py-1.5 flex items-center gap-2`,children:[(0,q.jsx)(`button`,{type:`button`,onClick:()=>{a(),c()},className:`text-destructive font-medium hover:underline`,children:`Delete?`}),(0,q.jsx)(`button`,{type:`button`,onClick:()=>u(!1),className:`text-muted-foreground hover:underline`,children:`Cancel`})]}):(0,q.jsxs)(`button`,{type:`button`,onClick:()=>u(!0),className:`w-full text-left px-3 py-1.5 hover:bg-muted flex items-center gap-2 text-destructive`,children:[(0,q.jsx)(_,{className:`size-3`}),` Delete Row`]})]}),v):null}function uc({columns:e,onSelect:t,onClose:n,anchorRect:r}){let[i,a]=(0,K.useState)(``),[o,s]=(0,K.useState)(0),c=(0,K.useRef)(null),l=(0,K.useRef)(null),u=i?e.filter(e=>e.toLowerCase().includes(i.toLowerCase())):e;(0,K.useEffect)(()=>{s(0)},[i]),(0,K.useEffect)(()=>{let e=l.current;e&&e.children[o]?.scrollIntoView({block:`nearest`})},[o]),(0,K.useEffect)(()=>{let e=e=>{c.current&&!c.current.contains(e.target)&&n()};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[n]);let d=(0,K.useCallback)(e=>{if(e.key===`Escape`){n();return}if(e.key===`ArrowDown`){e.preventDefault(),s(e=>Math.min(e+1,u.length-1));return}if(e.key===`ArrowUp`){e.preventDefault(),s(e=>Math.max(e-1,0));return}if(e.key===`Enter`){e.preventDefault();let r=u[o];r&&(t(r),n())}},[u,o,t,n]),f=document.getElementById(`portal`);return f?(0,qe.createPortal)((0,q.jsxs)(`div`,{ref:c,style:{position:`fixed`,left:Math.min(r.x,window.innerWidth-216),top:Math.min(r.y,window.innerHeight-308),zIndex:1e4},className:`w-[200px] max-h-[300px] bg-popover border border-border rounded-md shadow-lg text-xs overflow-hidden flex flex-col`,children:[(0,q.jsx)(`div`,{className:`px-2 py-1.5 border-b border-border`,children:(0,q.jsx)(`input`,{autoFocus:!0,value:i,onChange:e=>a(e.target.value),onKeyDown:d,placeholder:`Search columns…`,className:`w-full bg-transparent outline-none text-foreground placeholder:text-muted-foreground text-xs`})}),(0,q.jsxs)(`div`,{ref:l,className:`overflow-y-auto py-1`,children:[u.map((e,r)=>(0,q.jsx)(`button`,{type:`button`,onClick:()=>{t(e),n()},onMouseEnter:()=>s(r),className:`w-full text-left px-3 py-1 truncate text-foreground ${r===o?`bg-muted`:`hover:bg-muted`}`,children:e},e)),u.length===0&&(0,q.jsx)(`div`,{className:`px-3 py-2 text-muted-foreground`,children:`No columns found`})]})]}),f):null}function dc({hasSelection:e,selectedCount:t,onBulkDelete:n,onInsertRow:r,columns:i,selectedRows:a,connectionName:o,searchTerm:s,onSearchChange:c,onColumnJump:l,colSearchOpen:u,onColSearchChange:f}){let[p,h]=(0,K.useState)(!1),[g,b]=(0,K.useState)(!1),x=u??g,S=f??b,C=(0,K.useRef)(null),w=C.current?(()=>{let e=C.current.getBoundingClientRect();return{x:e.left,y:e.bottom+4}})():{x:0,y:0};return(0,q.jsxs)(`div`,{className:`flex items-center gap-2 px-2 py-1 border-b border-border bg-background shrink-0`,children:[e&&(0,q.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs`,children:[(0,q.jsxs)(`span`,{className:`text-muted-foreground`,children:[t,` selected`]}),n&&(p?(0,q.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,q.jsxs)(`button`,{type:`button`,onClick:()=>{n(),h(!1)},className:`text-destructive text-[10px] font-medium hover:underline`,children:[`Delete `,t,`?`]}),(0,q.jsx)(`button`,{type:`button`,onClick:()=>h(!1),className:`text-muted-foreground text-[10px] hover:underline`,children:`Cancel`})]}):(0,q.jsx)(`button`,{type:`button`,onClick:()=>h(!0),className:`p-0.5 text-muted-foreground hover:text-destructive`,children:(0,q.jsx)(_,{className:`size-3`})})),(0,q.jsx)(Ye,{columns:i,rows:a,filename:`${o??`db`}-selected`})]}),(0,q.jsx)(`div`,{className:`flex-1`}),(0,q.jsxs)(`div`,{className:`flex items-center gap-1 text-xs`,children:[(0,q.jsx)(m,{className:`size-3 text-muted-foreground`}),(0,q.jsx)(`input`,{value:s,onChange:e=>c(e.target.value),placeholder:`Search page…`,className:`w-24 bg-transparent outline-none text-foreground placeholder:text-muted-foreground text-xs`}),s&&(0,q.jsx)(`button`,{type:`button`,onClick:()=>c(``),className:`text-muted-foreground hover:text-foreground`,children:(0,q.jsx)(y,{className:`size-3`})})]}),l&&(0,q.jsx)(`button`,{ref:C,type:`button`,onClick:()=>S(!x),className:`p-0.5 rounded text-muted-foreground hover:text-foreground transition-colors`,title:`Jump to column (/)`,children:(0,q.jsx)(d,{className:`size-3.5`})}),r&&(0,q.jsx)(`button`,{type:`button`,onClick:r,className:`p-0.5 rounded text-muted-foreground hover:text-primary transition-colors`,title:`Insert row`,children:(0,q.jsx)(v,{className:`size-3.5`})}),x&&l&&(0,q.jsx)(uc,{columns:i,onSelect:l,onClose:()=>S(!1),anchorRect:w})]})}function fc({pendingCount:e,onSave:t,onDiscard:n}){return e===0?null:(0,q.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-1.5 border-t border-amber-400/50 bg-amber-50 dark:bg-amber-950/30 shrink-0 text-xs`,children:[(0,q.jsxs)(`span`,{className:`text-amber-700 dark:text-amber-300 font-medium`,children:[e,` pending edit`,e>1?`s`:``]}),(0,q.jsx)(`div`,{className:`flex-1`}),(0,q.jsxs)(`button`,{type:`button`,onClick:n,className:`flex items-center gap-1 px-2 py-0.5 rounded text-muted-foreground hover:text-foreground hover:bg-muted transition-colors`,children:[(0,q.jsx)(E,{className:`size-3`}),` Discard`]}),(0,q.jsxs)(`button`,{type:`button`,onClick:t,className:`flex items-center gap-1 px-2 py-0.5 rounded bg-primary text-primary-foreground hover:bg-primary/90 transition-colors`,children:[(0,q.jsx)(Ne,{className:`size-3`}),` Save`,(0,q.jsx)(`kbd`,{className:`ml-1 text-[9px] opacity-70`,children:`⌘↵`})]})]})}function pc({total:e,page:t,totalPages:n,onPageChange:r}){return(0,q.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-1.5 border-t border-border bg-background shrink-0 text-xs text-muted-foreground`,children:[(0,q.jsxs)(`span`,{children:[e.toLocaleString(),` rows`]}),(0,q.jsxs)(`div`,{className:`hidden md:flex items-center gap-2 text-[10px] text-muted-foreground/50`,children:[(0,q.jsxs)(`span`,{children:[(0,q.jsx)(`kbd`,{className:`px-1 py-0.5 rounded bg-muted text-[9px]`,children:`/`}),` columns`]}),(0,q.jsxs)(`span`,{children:[(0,q.jsxs)(`kbd`,{className:`px-1 py-0.5 rounded bg-muted text-[9px]`,children:[`⌘`,`A`]}),` select all`]}),(0,q.jsxs)(`span`,{children:[(0,q.jsxs)(`kbd`,{className:`px-1 py-0.5 rounded bg-muted text-[9px]`,children:[`⌘`,`C`]}),` copy`]})]}),(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(`button`,{type:`button`,disabled:t<=1,onClick:()=>r(t-1),className:`p-0.5 rounded hover:bg-muted disabled:opacity-30`,children:(0,q.jsx)(l,{className:`size-3.5`})}),(0,q.jsxs)(`span`,{children:[t,` / `,n]}),(0,q.jsx)(`button`,{type:`button`,disabled:t>=n,onClick:()=>r(t+1),className:`p-0.5 rounded hover:bg-muted disabled:opacity-30`,children:(0,q.jsx)(u,{className:`size-3.5`})})]})]})}function mc({data:e,onClose:t,onOpenInTab:n}){let r=je(),[i,a]=(0,K.useState)(!0),[o,s]=(0,K.useState)(e.content),[c,l]=(0,K.useState)(!1),u=e.language===`json`||e.language===`xml`,d=(0,K.useRef)(e.title);d.current!==e.title&&(d.current=e.title,s(e.content),l(!1));let f=(0,K.useCallback)(()=>{if(c)s(e.content),l(!1);else if(e.language===`json`)try{s(JSON.stringify(JSON.parse(e.content.trim()),null,2)),l(!0)}catch{}else if(e.language===`xml`){let t=0;s(e.content.trim().replace(/>\s*</g,`>
134
134
  <`).split(`
135
135
  `).map(e=>{let n=e.trim();n.startsWith(`</`)&&(t=Math.max(0,t-1));let r=` `.repeat(t)+n;return n.startsWith(`<`)&&!n.startsWith(`</`)&&!n.endsWith(`/>`)&&!n.startsWith(`<?`)&&t++,r}).join(`
136
- `)),l(!0)}},[c,e.content,e.language]),[p,m]=(0,K.useState)(200),h=(0,K.useCallback)(e=>{e.preventDefault();let t=e.clientY,n=p,r=e=>m(Math.max(80,n+(t-e.clientY))),i=()=>{document.removeEventListener(`mousemove`,r),document.removeEventListener(`mouseup`,i)};document.addEventListener(`mousemove`,r),document.addEventListener(`mouseup`,i)},[p]);return(0,q.jsxs)(`div`,{className:`shrink-0 border-t border-border flex flex-col`,style:{height:p},children:[(0,q.jsx)(`div`,{onMouseDown:h,className:`shrink-0 h-1.5 cursor-row-resize bg-border/50 hover:bg-primary/30 flex items-center justify-center transition-colors`,children:(0,q.jsx)(T,{className:`size-3 text-muted-foreground/50`})}),(0,q.jsxs)(`div`,{className:`flex items-center gap-1 px-2 py-1 bg-muted/50 border-b border-border shrink-0`,children:[(0,q.jsx)(g,{className:`size-3 text-muted-foreground`}),(0,q.jsx)(`span`,{className:`text-xs font-medium text-foreground truncate flex-1`,children:e.title}),u&&(0,q.jsx)(`button`,{type:`button`,onClick:f,title:c?`Raw`:`Beautify`,className:`p-0.5 rounded transition-colors ${c?`text-primary`:`text-muted-foreground hover:text-foreground`}`,children:(0,q.jsx)(b,{className:`size-3`})}),(0,q.jsx)(`button`,{type:`button`,onClick:()=>a(!i),title:i?`No wrap`:`Word wrap`,className:`p-0.5 rounded transition-colors ${i?`text-primary`:`text-muted-foreground hover:text-foreground`}`,children:(0,q.jsx)(x,{className:`size-3`})}),(0,q.jsxs)(`button`,{type:`button`,onClick:n,title:`Open in new tab`,className:`flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] text-muted-foreground hover:text-foreground hover:bg-muted transition-colors`,children:[(0,q.jsx)(k,{className:`size-3`}),(0,q.jsx)(`span`,{className:`hidden sm:inline`,children:`Open in Tab`})]}),(0,q.jsx)(`button`,{type:`button`,onClick:t,title:`Close preview (Esc)`,className:`p-0.5 rounded text-muted-foreground hover:text-foreground transition-colors`,children:(0,q.jsx)(y,{className:`size-3`})})]}),(0,q.jsx)(`div`,{className:`flex-1 min-h-0`,children:(0,q.jsx)(Ae,{height:`100%`,language:e.language===`plaintext`?void 0:e.language,value:o,theme:r,options:{readOnly:!0,minimap:{enabled:!1},scrollBeyondLastLine:!1,wordWrap:i?`on`:`off`,lineNumbers:`on`,fontSize:12,folding:!0,bracketPairColorization:{enabled:!0},domReadOnly:!0,contextmenu:!1,overviewRulerLanes:0},loading:(0,q.jsx)(O,{className:`size-4 animate-spin text-muted-foreground`})})})]})}var hc={sortAsc:e=>`<svg viewBox="0 0 16 16" fill="${e.fgColor}"><path d="M8 4l4 6H4z"/></svg>`,sortDesc:e=>`<svg viewBox="0 0 16 16" fill="${e.fgColor}"><path d="M8 12l4-6H4z"/></svg>`,headerFk:()=>`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="#3b82f6" stroke-width="1.5" stroke-linecap="round"><path d="M6 4.5H4.5a2.5 2.5 0 000 5H6M10 4.5h1.5a2.5 2.5 0 010 5H10M5 7h6"/></svg>`};function gc(e){let{columns:t,rows:n,total:r,limit:i,schema:a,loading:o,page:s,onPageChange:c,onCellUpdate:l,onRowDelete:u,onBulkDelete:d,onInsertRow:f,orderBy:p,orderDir:m,onToggleSort:h,onClearSort:g,columnFilters:_={},onColumnFilter:v,connectionId:y,selectedTable:b,selectedSchema:x,connectionName:S}=e,C=Ks(),w=(0,K.useRef)(null),T=(0,K.useRef)(null),E=(0,K.useMemo)(()=>{let e=new Set(a.map(e=>e.name));return t.filter(t=>e.has(t))},[t,a]),[D,k]=(0,K.useState)(new Set),[A,ee]=(0,K.useState)(new Map),[te,ne]=(0,K.useState)(null),[j,re]=(0,K.useState)(null),[ie,ae]=(0,K.useState)(``),[M,oe]=(0,K.useState)([]),N=(0,K.useMemo)(()=>a.find(e=>e.pk)?.name??a.find(e=>e.name.toLowerCase()===`id`)?.name??null,[a]),{effectiveRows:P,pinnedCount:se,pinnedPks:ce,setPinnedPks:le}=oc(n,N),F=(0,K.useMemo)(()=>{if(se===0)return[...P,...M];let e=P.slice(0,P.length-se),t=P.slice(P.length-se);return[...e,...M,...t]},[P,M,se]),I=(0,K.useMemo)(()=>{if(!ie.trim())return F;let e=ie.toLowerCase();return F.filter(t=>E.some(n=>String(t[n]??``).toLowerCase().includes(e)))},[F,E,ie]),ue=(0,K.useMemo)(()=>se===0||!N?0:ie.trim()?I.filter(e=>ce.has(String(e[N]??``))).length:se,[se,N,ie,I,ce]),{pendingRef:de,addEdit:fe,commitAll:pe,discardAll:me,hasPending:he,pendingCount:ge,committedRef:_e}=ac(N,l,f),{columns:ve,freezeColumns:L,columnOrder:ye}=Js(a,E,D,A,I,p,m),{getCellContent:be,onCellEdited:xe}=nc(I,ye,a,N,fe,de),{gridSelection:R,onGridSelectionChange:Se,selectedRowIndices:Ce,clearSelection:z}=ic(),{previewData:B,setPreviewData:we,openRowPreview:V,openCellPreview:H,openPreviewInTab:U,handlePaste:Te,getContextFk:Ee,isCellViewable:W,openFkTable:De}=sc({displayRows:I,columnOrder:ye,schema:a,pkCol:N,connectionId:y,connectionName:S,selectedTable:b,selectedSchema:x,addEdit:fe,gridSelection:R,containerRef:T});(0,K.useEffect)(()=>{_e.current&&(_e.current=!1,me(),oe([]))},[n]);let Oe=(0,K.useCallback)((e,t)=>{ee(n=>new Map(n).set(e.id??e.title,t))},[]),ke=(0,K.useCallback)((e,t)=>{let n=ye[e];n&&ne({colName:n,bounds:t})},[ye]),G=(0,K.useCallback)(([e,t],n)=>{n.preventDefault(),re({position:{x:n.bounds.x+n.localEventX,y:n.bounds.y+n.localEventY},rowIdx:t,colIdx:e})},[]),Ae=(0,K.useCallback)(e=>{k(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),je=(0,K.useCallback)(e=>{if(!N)return;let t=I[e];if(!t)return;let n=String(t[N]??``);le(e=>{let t=new Set(e);return t.has(n)?t.delete(n):t.add(n),t})},[N,I,le]),Me=(0,K.useCallback)(e=>{if(ce.size===0||!N)return;let t=I[e];if(t&&ce.has(String(t[N]??``)))return{bgCell:C.bgCellMedium??C.bgHeader}},[ce,N,I,C]),Ne=(0,K.useCallback)(()=>{!N||!d||(d(N,Ce.map(e=>I[e]?.[N]).filter(e=>e!=null)),z())},[N,d,Ce,I,z]),[Pe,Fe]=(0,K.useState)(!1),Ie=(0,K.useCallback)(e=>{if(e.key===`Escape`){we(null),Fe(!1);return}(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&he&&(e.preventDefault(),pe());let t=e.target?.tagName;e.key===`/`&&t!==`INPUT`&&t!==`TEXTAREA`&&(e.preventDefault(),Fe(!0))},[he,pe]),Le=(0,K.useCallback)(()=>{!N||!f||oe(e=>[...e,{[N]:`__new_${Date.now()}`}])},[N,f]),Re=(0,K.useCallback)(e=>{let t=ye.indexOf(e);t>=0&&w.current?.scrollTo&&w.current.scrollTo(t,0)},[ye]),ze=j?I[j.rowIdx]:null,Be=ze&&N?String(ze[N]??``):``,Ve=j?ye[j.colIdx]:null,He=W(ze??null,Ve??null),Ue=Ee(Ve??null),We=ze&&Ve?ze[Ve]:null;return E.length?(0,q.jsxs)(`div`,{ref:T,className:`flex flex-col h-full overflow-hidden relative`,tabIndex:0,onKeyDown:Ie,children:[(0,q.jsx)(dc,{hasSelection:Ce.length>0,selectedCount:Ce.length,onBulkDelete:d&&N?Ne:void 0,onInsertRow:f&&N?Le:void 0,columns:E,selectedRows:Ce.map(e=>I[e]).filter(Boolean),connectionName:S,searchTerm:ie,onSearchChange:ae,onColumnJump:Re,colSearchOpen:Pe,onColSearchChange:Fe}),o&&(0,q.jsx)(`div`,{className:`absolute inset-0 z-30 flex items-center justify-center bg-background/60`,children:(0,q.jsx)(O,{className:`size-5 animate-spin text-primary`})}),(0,q.jsx)(`div`,{className:`flex-1 min-h-0`,children:(0,q.jsx)(Hs,{ref:w,columns:ve,rows:I.length,getCellContent:be,getCellsForSelection:!0,onCellEdited:xe,onPaste:Te,theme:C,freezeColumns:L,freezeTrailingRows:ue,rowMarkers:N?`checkbox-visible`:`number`,gridSelection:R,onGridSelectionChange:Se,onColumnResize:Oe,onHeaderMenuClick:ke,onCellContextMenu:G,getRowThemeOverride:Me,trailingRowOptions:f&&N?{sticky:!0,tint:!0}:void 0,onRowAppended:f?Le:void 0,headerIcons:hc,smoothScrollX:!0,smoothScrollY:!0,width:`100%`,height:`100%`})}),he&&(0,q.jsx)(fc,{pendingCount:ge,onSave:pe,onDiscard:()=>{me(),oe([])}}),B&&(0,q.jsx)(mc,{data:B,onClose:()=>we(null),onOpenInTab:U}),(0,q.jsx)(pc,{total:r,page:s,totalPages:Math.ceil(r/i)||1,onPageChange:c}),te&&(0,q.jsx)(cc,{colName:te.colName,bounds:te.bounds,isPinned:D.has(te.colName),filterValue:_[te.colName]??``,sortState:p===te.colName?m===`ASC`?`asc`:`desc`:null,onFilter:e=>{if(!v)return;let t={..._};e?t[te.colName]=e:delete t[te.colName],v(t)},onSort:()=>{h&&h(te.colName)},onClearSort:g,onTogglePin:()=>Ae(te.colName),onClose:()=>ne(null)}),j&&ze&&(0,q.jsx)(lc,{position:j.position,isPinned:ce.has(Be),onViewRow:()=>V(j.rowIdx),onViewCell:He?()=>H(j.rowIdx,j.colIdx):void 0,onPinRow:()=>je(j.rowIdx),onDeleteRow:()=>{N&&u&&ze&&u(N,ze[N])},onOpenFkTable:Ue&&We!=null&&y?()=>De(Ue,We):void 0,fkLabel:Ue?`Open ${Ue.table}.${Ue.column}`:void 0,onClose:()=>re(null)})]}):(0,q.jsx)(`div`,{className:`flex items-center justify-center h-full text-xs text-muted-foreground`,children:o?(0,q.jsx)(O,{className:`size-4 animate-spin`}):`Select a table`})}export{Ge as i,Ye as n,Ke as r,gc as t};
137
- //# sourceMappingURL=glide-data-grid-Bx48618B.js.map
136
+ `)),l(!0)}},[c,e.content,e.language]),[p,m]=(0,K.useState)(200),h=(0,K.useCallback)(e=>{e.preventDefault();let t=e.clientY,n=p,r=e=>m(Math.max(80,n+(t-e.clientY))),i=()=>{document.removeEventListener(`mousemove`,r),document.removeEventListener(`mouseup`,i)};document.addEventListener(`mousemove`,r),document.addEventListener(`mouseup`,i)},[p]);return(0,q.jsxs)(`div`,{className:`shrink-0 border-t border-border flex flex-col`,style:{height:p},children:[(0,q.jsx)(`div`,{onMouseDown:h,className:`shrink-0 h-1.5 cursor-row-resize bg-border/50 hover:bg-primary/30 flex items-center justify-center transition-colors`,children:(0,q.jsx)(T,{className:`size-3 text-muted-foreground/50`})}),(0,q.jsxs)(`div`,{className:`flex items-center gap-1 px-2 py-1 bg-muted/50 border-b border-border shrink-0`,children:[(0,q.jsx)(g,{className:`size-3 text-muted-foreground`}),(0,q.jsx)(`span`,{className:`text-xs font-medium text-foreground truncate flex-1`,children:e.title}),u&&(0,q.jsx)(`button`,{type:`button`,onClick:f,title:c?`Raw`:`Beautify`,className:`p-0.5 rounded transition-colors ${c?`text-primary`:`text-muted-foreground hover:text-foreground`}`,children:(0,q.jsx)(b,{className:`size-3`})}),(0,q.jsx)(`button`,{type:`button`,onClick:()=>a(!i),title:i?`No wrap`:`Word wrap`,className:`p-0.5 rounded transition-colors ${i?`text-primary`:`text-muted-foreground hover:text-foreground`}`,children:(0,q.jsx)(x,{className:`size-3`})}),(0,q.jsxs)(`button`,{type:`button`,onClick:n,title:`Open in new tab`,className:`flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] text-muted-foreground hover:text-foreground hover:bg-muted transition-colors`,children:[(0,q.jsx)(k,{className:`size-3`}),(0,q.jsx)(`span`,{className:`hidden sm:inline`,children:`Open in Tab`})]}),(0,q.jsx)(`button`,{type:`button`,onClick:t,title:`Close preview (Esc)`,className:`p-0.5 rounded text-muted-foreground hover:text-foreground transition-colors`,children:(0,q.jsx)(y,{className:`size-3`})})]}),(0,q.jsx)(`div`,{className:`flex-1 min-h-0`,children:(0,q.jsx)(Ae,{height:`100%`,language:e.language===`plaintext`?void 0:e.language,value:o,theme:r,options:{readOnly:!0,minimap:{enabled:!1},scrollBeyondLastLine:!1,wordWrap:i?`on`:`off`,lineNumbers:`on`,fontSize:12,folding:!0,bracketPairColorization:{enabled:!0},domReadOnly:!0,contextmenu:!1,overviewRulerLanes:0},loading:(0,q.jsx)(O,{className:`size-4 animate-spin text-muted-foreground`})})})]})}var hc={sortAsc:e=>`<svg viewBox="0 0 16 16" fill="${e.fgColor}"><path d="M8 4l4 6H4z"/></svg>`,sortDesc:e=>`<svg viewBox="0 0 16 16" fill="${e.fgColor}"><path d="M8 12l4-6H4z"/></svg>`,headerFk:()=>`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="#3b82f6" stroke-width="1.5" stroke-linecap="round"><path d="M6 4.5H4.5a2.5 2.5 0 000 5H6M10 4.5h1.5a2.5 2.5 0 010 5H10M5 7h6"/></svg>`};function gc(e){let{columns:t,rows:n,total:r,limit:i,schema:a,loading:o,page:s,onPageChange:c,onCellUpdate:l,onRowDelete:u,onBulkDelete:d,onInsertRow:f,orderBy:p,orderDir:m,onToggleSort:h,onClearSort:g,columnFilters:_={},onColumnFilter:v,connectionId:y,selectedTable:b,selectedSchema:x,connectionName:S}=e,C=Ks(),w=(0,K.useRef)(null),T=(0,K.useRef)(null),E=(0,K.useMemo)(()=>{let e=new Set(a.map(e=>e.name));return t.filter(t=>e.has(t))},[t,a]),[D,k]=(0,K.useState)(new Set),[A,ee]=(0,K.useState)(new Map),[te,ne]=(0,K.useState)(null),[j,re]=(0,K.useState)(null),[ie,ae]=(0,K.useState)(``),[M,oe]=(0,K.useState)([]),N=(0,K.useMemo)(()=>a.find(e=>e.pk)?.name??a.find(e=>e.name.toLowerCase()===`id`)?.name??null,[a]),{effectiveRows:P,pinnedCount:se,pinnedPks:ce,setPinnedPks:le}=oc(n,N),F=(0,K.useMemo)(()=>{if(se===0)return[...P,...M];let e=P.slice(0,P.length-se),t=P.slice(P.length-se);return[...e,...M,...t]},[P,M,se]),I=(0,K.useMemo)(()=>{if(!ie.trim())return F;let e=ie.toLowerCase();return F.filter(t=>E.some(n=>String(t[n]??``).toLowerCase().includes(e)))},[F,E,ie]),ue=(0,K.useMemo)(()=>se===0||!N?0:ie.trim()?I.filter(e=>ce.has(String(e[N]??``))).length:se,[se,N,ie,I,ce]),{pendingRef:de,addEdit:fe,commitAll:pe,discardAll:me,hasPending:he,pendingCount:ge,committedRef:_e}=ac(N,l,f),{columns:ve,freezeColumns:L,columnOrder:ye}=Js(a,E,D,A,I,p,m),{getCellContent:be,onCellEdited:xe}=nc(I,ye,a,N,fe,de),{gridSelection:R,onGridSelectionChange:Se,selectedRowIndices:Ce,clearSelection:z}=ic(),{previewData:B,setPreviewData:we,openRowPreview:V,openCellPreview:H,openPreviewInTab:U,handlePaste:Te,getContextFk:Ee,isCellViewable:W,openFkTable:De}=sc({displayRows:I,columnOrder:ye,schema:a,pkCol:N,connectionId:y,connectionName:S,selectedTable:b,selectedSchema:x,addEdit:fe,gridSelection:R,containerRef:T});(0,K.useEffect)(()=>{_e.current&&(_e.current=!1,me(),oe([]))},[n]);let Oe=(0,K.useCallback)((e,t)=>{ee(n=>new Map(n).set(e.id??e.title,t))},[]),ke=(0,K.useCallback)((e,t)=>{let n=ye[e];n&&ne({colName:n,bounds:t})},[ye]),G=(0,K.useCallback)(([e,t],n)=>{n.preventDefault(),re({position:{x:n.bounds.x+n.localEventX,y:n.bounds.y+n.localEventY},rowIdx:t,colIdx:e})},[]),Ae=(0,K.useCallback)(e=>{k(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),je=(0,K.useCallback)(e=>{if(!N)return;let t=I[e];if(!t)return;let n=String(t[N]??``);le(e=>{let t=new Set(e);return t.has(n)?t.delete(n):t.add(n),t})},[N,I,le]),Me=(0,K.useCallback)(e=>{if(ce.size===0||!N)return;let t=I[e];if(t&&ce.has(String(t[N]??``)))return{bgCell:C.bgCellMedium??C.bgHeader}},[ce,N,I,C]),Ne=(0,K.useCallback)(()=>{!N||!d||(d(N,Ce.map(e=>I[e]?.[N]).filter(e=>e!=null)),z())},[N,d,Ce,I,z]),[Pe,Fe]=(0,K.useState)(!1),Ie=(0,K.useCallback)(e=>{if(e.key===`Escape`){we(null),Fe(!1);return}(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&he&&(e.preventDefault(),pe());let t=e.target?.tagName;e.key===`/`&&t!==`INPUT`&&t!==`TEXTAREA`&&(e.preventDefault(),Fe(!0))},[he,pe]),Le=(0,K.useCallback)(()=>{!N||!f||oe(e=>[...e,{[N]:`__new_${Date.now()}`}])},[N,f]),Re=(0,K.useCallback)(e=>{let t=ye.indexOf(e);t>=0&&w.current?.scrollTo&&w.current.scrollTo(t,0)},[ye]),ze=j?I[j.rowIdx]:null,Be=ze&&N?String(ze[N]??``):``,Ve=j?ye[j.colIdx]:null,He=W(ze??null,Ve??null),Ue=Ee(Ve??null),We=ze&&Ve?ze[Ve]:null;return E.length?(0,q.jsxs)(`div`,{ref:T,className:`flex flex-col h-full overflow-hidden relative`,tabIndex:0,onKeyDown:Ie,children:[(0,q.jsx)(dc,{hasSelection:Ce.length>0,selectedCount:Ce.length,onBulkDelete:d&&N?Ne:void 0,onInsertRow:f&&N?Le:void 0,columns:E,selectedRows:Ce.map(e=>I[e]).filter(Boolean),connectionName:S,searchTerm:ie,onSearchChange:ae,onColumnJump:Re,colSearchOpen:Pe,onColSearchChange:Fe}),o&&(0,q.jsx)(`div`,{className:`absolute inset-0 z-30 flex items-center justify-center bg-background/60`,children:(0,q.jsx)(O,{className:`size-5 animate-spin text-primary`})}),(0,q.jsx)(`div`,{className:`flex-1 min-h-0`,children:(0,q.jsx)(Hs,{ref:w,columns:ve,rows:I.length,getCellContent:be,getCellsForSelection:!0,onCellEdited:xe,onPaste:Te,theme:C,freezeColumns:L,freezeTrailingRows:ue,rowMarkers:N?`checkbox-visible`:`number`,gridSelection:R,onGridSelectionChange:Se,onColumnResize:Oe,onHeaderMenuClick:ke,onCellContextMenu:G,getRowThemeOverride:Me,trailingRowOptions:f&&N?{sticky:!0,tint:!0}:void 0,onRowAppended:f?Le:void 0,headerIcons:hc,smoothScrollX:!0,smoothScrollY:!0,width:`100%`,height:`100%`})}),he&&(0,q.jsx)(fc,{pendingCount:ge,onSave:pe,onDiscard:()=>{me(),oe([])}}),B&&(0,q.jsx)(mc,{data:B,onClose:()=>we(null),onOpenInTab:U}),(0,q.jsx)(pc,{total:r,page:s,totalPages:Math.ceil(r/i)||1,onPageChange:c}),te&&(0,q.jsx)(cc,{colName:te.colName,bounds:te.bounds,isPinned:D.has(te.colName),filterValue:_[te.colName]??``,sortState:p===te.colName?m===`ASC`?`asc`:`desc`:null,onFilter:e=>{if(!v)return;let t={..._};e?t[te.colName]=e:delete t[te.colName],v(t)},onSort:()=>{h&&h(te.colName)},onClearSort:g,onTogglePin:()=>Ae(te.colName),onClose:()=>ne(null)}),j&&ze&&(0,q.jsx)(lc,{position:j.position,isPinned:ce.has(Be),onViewRow:()=>V(j.rowIdx),onViewCell:He?()=>H(j.rowIdx,j.colIdx):void 0,onPinRow:()=>je(j.rowIdx),onDeleteRow:()=>{N&&u&&ze&&u(N,ze[N])},onOpenFkTable:Ue&&We!=null&&y?()=>De(Ue,We):void 0,fkLabel:Ue?`Open ${Ue.table}.${Ue.column}`:void 0,onClose:()=>re(null)})]}):(0,q.jsx)(`div`,{className:`flex items-center justify-center h-full text-xs text-muted-foreground`,children:o?(0,q.jsx)(O,{className:`size-4 animate-spin`}):`Select a table`})}export{Ge as i,Ye as n,Ke as r,gc as t};
@@ -1,2 +1 @@
1
- import{t as e}from"./createLucideIcon-BjHrJDVb.js";var t=e(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),n=e(`globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]);export{t as n,n as t};
2
- //# sourceMappingURL=globe-B4Ilypbs.js.map
1
+ import{t as e}from"./createLucideIcon-BjHrJDVb.js";var t=e(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),n=e(`globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]);export{t as n,n as t};
@@ -1,2 +1 @@
1
- import{b as e}from"./vendor-markdown-0Mxgxy0L.js";import{t}from"./file-exclamation-point-BwzaQ50n.js";import"./api-client-DIhJ5qVW.js";import{q as n}from"./index-DkQ6jVSH.js";import{t as r}from"./use-blob-url-DB4nNruT.js";var i=e();function a({filePath:e,projectName:a}){let{blobUrl:o,error:s}=r(e,a);return s?(0,i.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-text-secondary`,children:[(0,i.jsx)(t,{className:`size-10 text-text-subtle`}),(0,i.jsx)(`p`,{className:`text-sm`,children:`Failed to load image.`})]}):o?(0,i.jsx)(`div`,{className:`flex items-center justify-center h-full p-4 bg-surface overflow-auto`,children:(0,i.jsx)(`img`,{src:o,alt:e,className:`max-w-full max-h-full object-contain`})}):(0,i.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,i.jsx)(n,{className:`size-5 animate-spin text-text-subtle`})})}export{a as ImagePreview};
2
- //# sourceMappingURL=image-preview-ClY2xl1B.js.map
1
+ import{b as e}from"./vendor-markdown-0Mxgxy0L.js";import{t}from"./file-exclamation-point-BwzaQ50n.js";import"./api-client-DIhJ5qVW.js";import{q as n}from"./index-U7GK_3ED.js";import{t as r}from"./use-blob-url-DB4nNruT.js";var i=e();function a({filePath:e,projectName:a}){let{blobUrl:o,error:s}=r(e,a);return s?(0,i.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-text-secondary`,children:[(0,i.jsx)(t,{className:`size-10 text-text-subtle`}),(0,i.jsx)(`p`,{className:`text-sm`,children:`Failed to load image.`})]}):o?(0,i.jsx)(`div`,{className:`flex items-center justify-center h-full p-4 bg-surface overflow-auto`,children:(0,i.jsx)(`img`,{src:o,alt:e,className:`max-w-full max-h-full object-contain`})}):(0,i.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,i.jsx)(n,{className:`size-5 animate-spin text-text-subtle`})})}export{a as ImagePreview};