@hienlh/ppm 0.8.12 → 0.8.13
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.
- package/CHANGELOG.md +5 -0
- package/dist/web/assets/api-settings-CaKDC7_s.js +1 -0
- package/dist/web/assets/chat-tab-i4xcyBjR.js +7 -0
- package/dist/web/assets/{code-editor-DeGbTWsV.js → code-editor-BzeXo2X4.js} +1 -1
- package/dist/web/assets/{database-viewer-DWKAsEpU.js → database-viewer-LeoJOnM8.js} +1 -1
- package/dist/web/assets/{diff-viewer-LIyIbdmY.js → diff-viewer-K4pVS0BQ.js} +1 -1
- package/dist/web/assets/{git-graph-CTY_8cN1.js → git-graph-POg1VqZn.js} +1 -1
- package/dist/web/assets/index-Bu8-Nf_9.js +28 -0
- package/dist/web/assets/keybindings-store-D26m5C4_.js +1 -0
- package/dist/web/assets/{markdown-renderer-Bhc1YkCI.js → markdown-renderer-aPb3zQmt.js} +1 -1
- package/dist/web/assets/{postgres-viewer-CwiXo-4U.js → postgres-viewer-CeiRsLjf.js} +1 -1
- package/dist/web/assets/settings-store-xG6mKqkD.js +2 -0
- package/dist/web/assets/settings-tab-C4NlHP7f.js +1 -0
- package/dist/web/assets/{sqlite-viewer-522y1qCb.js → sqlite-viewer-DkfnHJrB.js} +1 -1
- package/dist/web/assets/switch-C8P-C1hw.js +1 -0
- package/dist/web/assets/{terminal-tab-DxUGsGUg.js → terminal-tab-4RrCMQc8.js} +1 -1
- package/dist/web/assets/{use-monaco-theme-Bt1Lr3jH.js → use-monaco-theme-DlFSiqvG.js} +1 -1
- package/dist/web/index.html +5 -4
- package/dist/web/sw.js +1 -1
- package/package.json +1 -1
- package/src/lib/account-crypto.ts +1 -1
- package/src/server/routes/cloud.ts +1 -1
- package/src/server/routes/settings.ts +40 -0
- package/src/services/account-selector.service.ts +2 -2
- package/src/types/api.ts +2 -1
- package/src/types/config.ts +1 -1
- package/src/types/qrcode-terminal.d.ts +3 -0
- package/src/web/components/settings/settings-tab.tsx +54 -3
- package/src/web/hooks/use-notification-badge.ts +1 -1
- package/src/web/lib/api-settings.ts +4 -0
- package/src/web/stores/settings-store.ts +15 -0
- package/dist/web/assets/chat-tab-CAheoM6s.js +0 -7
- package/dist/web/assets/index-l0SQefAv.js +0 -28
- package/dist/web/assets/keybindings-store-C8plncT4.js +0 -1
- package/dist/web/assets/settings-store-2NQzaOVJ.js +0 -1
- package/dist/web/assets/settings-tab-Ciu7Mb7W.js +0 -1
- package/dist/web/assets/switch-0m9hvYfp.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./react-CYzKIDNi.js";import"./api-client-TUmacMRS.js";import{b as e}from"./index-Bu8-Nf_9.js";export{e as useKeybindingsStore};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as e,t}from"./react-CYzKIDNi.js";import{t as n}from"./jsx-runtime-wQxeESYQ.js";import{t as r}from"./tab-store-0CKk8cSr.js";import{t as i}from"./utils-DC-bdPS3.js";import{i as a,t as o}from"./api-client-TUmacMRS.js";import{
|
|
1
|
+
import{i as e,t}from"./react-CYzKIDNi.js";import{t as n}from"./jsx-runtime-wQxeESYQ.js";import{t as r}from"./tab-store-0CKk8cSr.js";import{t as i}from"./utils-DC-bdPS3.js";import{i as a,t as o}from"./api-client-TUmacMRS.js";import{g as s,m as c}from"./index-Bu8-Nf_9.js";function l(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var u=l();function d(e){u=e}var f={exec:()=>null};function p(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(h.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var m=(()=>{try{return!0}catch{return!1}})(),h={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,`i`),blockquoteBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}>`)},ee=/^(?:[ \t]*(?:\n|$))+/,te=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,ne=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,g=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,re=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,_=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,v=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,ie=p(v).replace(/bull/g,_).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,``).getRegex(),ae=p(v).replace(/bull/g,_).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),y=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,oe=/^[^\n]+/,b=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,se=p(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,b).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),ce=p(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,_).getRegex(),x=`address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul`,S=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,le=p(`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))`,`i`).replace(`comment`,S).replace(`tag`,x).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),C=p(y).replace(`hr`,g).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,x).getRegex(),w={blockquote:p(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,C).getRegex(),code:te,def:se,fences:ne,heading:re,hr:g,html:le,lheading:ie,list:ce,newline:ee,paragraph:C,table:f,text:oe},T=p(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,g).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\n]`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,x).getRegex(),ue={...w,lheading:ae,table:T,paragraph:p(y).replace(`hr`,g).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,T).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,x).getRegex()},de={...w,html:p(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,S).replace(/tag/g,`(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b`).getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:f,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:p(y).replace(`hr`,g).replace(`heading`,` *#{1,6} *[^
|
|
2
2
|
]`).replace(`lheading`,ie).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},fe=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,pe=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,E=/^( {2,}|\\)\n(?!\s*$)/,me=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,D=/[\p{P}\p{S}]/u,O=/[\s\p{P}\p{S}]/u,k=/[^\s\p{P}\p{S}]/u,he=p(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,O).getRegex(),A=/(?!~)[\p{P}\p{S}]/u,ge=/(?!~)[\s\p{P}\p{S}]/u,_e=/(?:[^\s\p{P}\p{S}]|~)/u,j=/(?![*_])[\p{P}\p{S}]/u,ve=/(?![*_])[\s\p{P}\p{S}]/u,ye=/(?:[^\s\p{P}\p{S}]|[*_])/u,be=p(/link|precode-code|html/,`g`).replace(`link`,/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`precode-`,m?"(?<!`)()":"(^^|[^`])").replace(`code`,/(?<b>`+)[^`]+\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),M=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,xe=p(M,`u`).replace(/punct/g,D).getRegex(),Se=p(M,`u`).replace(/punct/g,A).getRegex(),N=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,Ce=p(N,`gu`).replace(/notPunctSpace/g,k).replace(/punctSpace/g,O).replace(/punct/g,D).getRegex(),we=p(N,`gu`).replace(/notPunctSpace/g,_e).replace(/punctSpace/g,ge).replace(/punct/g,A).getRegex(),Te=p(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,k).replace(/punctSpace/g,O).replace(/punct/g,D).getRegex(),Ee=p(/^~~?(?:((?!~)punct)|[^\s~])/,`u`).replace(/punct/g,j).getRegex(),De=p(`^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,ye).replace(/punctSpace/g,ve).replace(/punct/g,j).getRegex(),Oe=p(/\\(punct)/,`gu`).replace(/punct/g,D).getRegex(),ke=p(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace(`scheme`,/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace(`email`,/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Ae=p(S).replace(`(?:-->|$)`,`-->`).getRegex(),je=p(`^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>`).replace(`comment`,Ae).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),P=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,Me=p(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace(`label`,P).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),F=p(/^!?\[(label)\]\[(ref)\]/).replace(`label`,P).replace(`ref`,b).getRegex(),I=p(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,b).getRegex(),Ne=p(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,F).replace(`nolink`,I).getRegex(),L=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,R={_backpedal:f,anyPunctuation:Oe,autolink:ke,blockSkip:be,br:E,code:pe,del:f,delLDelim:f,delRDelim:f,emStrongLDelim:xe,emStrongRDelimAst:Ce,emStrongRDelimUnd:Te,escape:fe,link:Me,nolink:I,punctuation:he,reflink:F,reflinkSearch:Ne,tag:je,text:me,url:f},Pe={...R,link:p(/^!?\[(label)\]\((.*?)\)/).replace(`label`,P).getRegex(),reflink:p(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,P).getRegex()},z={...R,emStrongRDelimAst:we,emStrongLDelim:Se,delLDelim:Ee,delRDelim:De,url:p(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`protocol`,L).replace(`email`,/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:p(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace(`protocol`,L).getRegex()},Fe={...z,br:p(E).replace(`{2,}`,`*`).getRegex(),text:p(z.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},B={normal:w,gfm:ue,pedantic:de},V={normal:R,gfm:z,breaks:Fe,pedantic:Pe},Ie={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`},H=e=>Ie[e];function U(e,t){if(t){if(h.escapeTest.test(e))return e.replace(h.escapeReplace,H)}else if(h.escapeTestNoEncode.test(e))return e.replace(h.escapeReplaceNoEncode,H);return e}function Le(e){try{e=encodeURI(e).replace(h.percentDecode,`%`)}catch{return null}return e}function Re(e,t){let n=e.replace(h.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(h.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t)if(n.length>t)n.splice(t);else for(;n.length<t;)n.push(``);for(;r<n.length;r++)n[r]=n[r].trim().replace(h.slashPipe,`|`);return n}function W(e,t,n){let r=e.length;if(r===0)return``;let i=0;for(;i<r;){let a=e.charAt(r-i-1);if(a===t&&!n)i++;else if(a!==t&&n)i++;else break}return e.slice(0,r-i)}function ze(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]===`\\`)r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function Be(e,t=0){let n=t,r=``;for(let t of e)if(t===` `){let e=4-n%4;r+=` `.repeat(e),n+=e}else r+=t,n++;return r}function Ve(e,t,n,r,i){let a=t.href,o=t.title||null,s=e[1].replace(i.other.outputLinkReplace,`$1`);r.state.inLink=!0;let c={type:e[0].charAt(0)===`!`?`image`:`link`,raw:n,href:a,title:o,text:s,tokens:r.inlineTokens(s)};return r.state.inLink=!1,c}function He(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
|
|
3
3
|
`).map(e=>{let t=e.match(n.other.beginningSpace);if(t===null)return e;let[r]=t;return r.length>=i.length?e.slice(i.length):e}).join(`
|
|
4
4
|
`)}var G=class{options;rules;lexer;constructor(e){this.options=e||u}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:`space`,raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let e=t[0].replace(this.rules.other.codeRemoveIndent,``);return{type:`code`,raw:t[0],codeBlockStyle:`indented`,text:this.options.pedantic?e:W(e,`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e,t}from"./react-CYzKIDNi.js";import{t as n}from"./jsx-runtime-wQxeESYQ.js";import{a as r,c as i,i as a,o,r as s,s as c,t as l}from"./dist-D9RHR8A4.js";import{t as u}from"./table-C0oSLUYn.js";import{t as d}from"./api-client-TUmacMRS.js";import{A as f,E as p,H as m,L as h,U as g,V as _}from"./index-l0SQefAv.js";var v=e(t(),1),y=`/api/postgres`;function b(e){let[t,n]=(0,v.useState)(``),[r,i]=(0,v.useState)(!1),a=e?`/api/db/connections/${e}`:null,[o,s]=(0,v.useState)([]),[c,l]=(0,v.useState)(null),[u,f]=(0,v.useState)(`public`),[p,m]=(0,v.useState)(null),[h,g]=(0,v.useState)([]),[_,b]=(0,v.useState)(!1),[x,S]=(0,v.useState)(null),[C,w]=(0,v.useState)(1),[T,E]=(0,v.useState)(null),[D,O]=(0,v.useState)(null),[k,A]=(0,v.useState)(!1),j=(0,v.useCallback)(async e=>{b(!0),S(null);try{let t=await d.post(`${y}/test`,{connectionString:e});if(!t.ok){S(t.error??`Connection failed`);return}n(e),i(!0);let r=await d.post(`${y}/tables`,{connectionString:e});s(r),r.length>0&&(l(r[0].name),f(r[0].schema))}catch(e){S(e.message)}finally{b(!1)}},[]),M=(0,v.useCallback)(async()=>{if(a){b(!0);try{s(await d.get(`${a}/tables?cached=1`))}catch(e){S(e.message)}finally{b(!1)}return}if(t){b(!0);try{s(await d.post(`${y}/tables`,{connectionString:t}))}catch(e){S(e.message)}finally{b(!1)}}},[a,t,c]);(0,v.useEffect)(()=>{a&&(i(!0),M())},[a]);let N=(0,v.useCallback)(async(e,n,r)=>{let i=e??c,o=n??u;if(i){b(!0);try{if(a){let[e,t]=await Promise.all([d.get(`${a}/data?table=${encodeURIComponent(i)}&schema=${o}&page=${r??C}&limit=100`),d.get(`${a}/schema?table=${encodeURIComponent(i)}&schema=${o}`)]);m(e),g(t)}else{if(!t)return;let[e,n]=await Promise.all([d.post(`${y}/data`,{connectionString:t,table:i,schema:o,page:r??C,limit:100}),d.post(`${y}/schema`,{connectionString:t,table:i,schema:o})]);m(e),g(n)}}catch(e){S(e.message)}finally{b(!1)}}},[a,t,c,u,C]);return{connectionString:t,connected:r,connect:j,tables:o,selectedTable:c,selectTable:(0,v.useCallback)((e,t=`public`)=>{l(e),f(t),w(1),E(null),N(e,t,1)},[N]),tableData:p,schema:h,loading:_,error:x,page:C,setPage:(0,v.useCallback)(e=>{w(e),N(void 0,void 0,e)},[N]),queryResult:T,queryError:D,queryLoading:k,executeQuery:(0,v.useCallback)(async e=>{if(!(!a&&!t)){A(!0),O(null);try{let n=a?await d.post(`${a}/query`,{sql:e}):await d.post(`${y}/query`,{connectionString:t,sql:e});E(n),n.changeType===`modify`&&N()}catch(e){O(e.message)}finally{A(!1)}}},[a,t,N]),updateCell:(0,v.useCallback)(async(e,n,r,i)=>{if(c)try{if(a)await d.put(`${a}/cell`,{table:c,schema:u,pkColumn:e,pkValue:n,column:r,value:i});else{if(!t)return;await d.post(`${y}/cell`,{connectionString:t,table:c,schema:u,pkColumn:e,pkValue:n,column:r,value:i})}N()}catch(e){S(e.message)}},[a,t,c,u,N]),refreshTables:M,refreshData:N}}var x=n();function S({metadata:e}){let t=e?.connectionString??``,n=e?.connectionId,r=b(n);return r.connected?(0,x.jsx)(w,{pg:r,initialTable:e?.tableName,hideTableList:!!n,connectionName:e?.connectionName}):(0,x.jsx)(C,{initialValue:t,onConnect:r.connect,loading:r.loading,error:r.error})}function C({initialValue:e,onConnect:t,loading:n,error:r}){let[i,a]=(0,v.useState)(e);return(0,x.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,x.jsxs)(`div`,{className:`flex flex-col gap-3 w-full max-w-lg px-4`,children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium`,children:[(0,x.jsx)(h,{className:`size-4`}),` Connect to PostgreSQL`]}),(0,x.jsx)(`input`,{className:`w-full px-3 py-2 rounded border border-border bg-background text-sm font-mono outline-none focus:border-primary`,placeholder:`postgresql://user:pass@host:5432/db`,value:i,onChange:e=>a(e.target.value),onKeyDown:e=>{e.key===`Enter`&&i.trim()&&t(i.trim())}}),r&&(0,x.jsxs)(`p`,{className:`text-xs text-destructive flex items-center gap-1`,children:[(0,x.jsx)(_,{className:`size-3`}),r]}),(0,x.jsx)(`button`,{type:`button`,disabled:n||!i.trim(),onClick:()=>t(i.trim()),className:`px-4 py-2 rounded bg-primary text-primary-foreground text-sm hover:bg-primary/90 disabled:opacity-50 transition-colors`,children:n?(0,x.jsx)(f,{className:`size-4 animate-spin mx-auto`}):`Connect`})]})})}function w({pg:e,initialTable:t,hideTableList:n,connectionName:r}){let[i,a]=(0,v.useState)(!1),o=(0,v.useRef)(!1);return(0,v.useEffect)(()=>{if(!(!t||o.current)){if(n&&e.connected)o.current=!0,e.selectTable(t);else if(e.tables.length>0){let n=e.tables.find(e=>e.name===t);n&&(o.current=!0,e.selectTable(n.name,n.schema))}}},[t,e.connected,e.tables]),(0,x.jsxs)(`div`,{className:`flex h-full w-full overflow-hidden`,children:[!n&&(0,x.jsxs)(`div`,{className:`w-48 shrink-0 flex flex-col bg-background overflow-hidden`,children:[(0,x.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-2 border-b border-border`,children:[(0,x.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground uppercase tracking-wider`,children:`Tables`}),(0,x.jsx)(`button`,{type:`button`,onClick:e.refreshTables,className:`text-muted-foreground hover:text-foreground transition-colors`,title:`Refresh`,children:(0,x.jsx)(p,{className:`size-3`})})]}),(0,x.jsxs)(`div`,{className:`flex-1 overflow-y-auto`,children:[e.tables.map(t=>(0,x.jsxs)(`button`,{type:`button`,onClick:()=>e.selectTable(t.name,t.schema),className:`w-full flex items-center gap-2 px-3 py-1.5 text-left text-xs transition-colors ${e.selectedTable===t.name?`bg-muted text-foreground`:`text-muted-foreground hover:bg-muted/50 hover:text-foreground`}`,children:[(0,x.jsx)(u,{className:`size-3 shrink-0`}),(0,x.jsxs)(`span`,{className:`truncate flex-1`,children:[t.schema===`public`?``:`${t.schema}.`,t.name]}),(0,x.jsx)(`span`,{className:`text-[10px] opacity-60`,children:t.rowCount})]},`${t.schema}.${t.name}`)),e.tables.length===0&&(0,x.jsx)(`p`,{className:`px-3 py-4 text-xs text-muted-foreground text-center`,children:`No tables found`})]})]}),(0,x.jsxs)(`div`,{className:`flex-1 flex flex-col overflow-hidden ${n?``:`border-l border-border`}`,children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-1.5 border-b border-border bg-background shrink-0`,children:[(0,x.jsx)(h,{className:`size-3.5 text-muted-foreground`}),(0,x.jsx)(`span`,{className:`text-xs text-muted-foreground truncate`,children:r??`PostgreSQL`}),e.selectedTable&&(0,x.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`/ `,e.selectedTable]}),(0,x.jsx)(`div`,{className:`ml-auto`,children:(0,x.jsx)(`button`,{type:`button`,onClick:()=>a(e=>!e),className:`px-2 py-1 rounded text-xs transition-colors ${i?`bg-muted text-foreground`:`text-muted-foreground hover:text-foreground`}`,children:`SQL`})})]}),(0,x.jsx)(`div`,{className:`flex-1 overflow-hidden ${i?`max-h-[60%]`:``}`,children:(0,x.jsx)(T,{tableData:e.tableData,schema:e.schema,loading:e.loading,page:e.page,onPageChange:e.setPage,onCellUpdate:e.updateCell})}),i&&(0,x.jsx)(`div`,{className:`border-t border-border h-[40%] shrink-0`,children:(0,x.jsx)(E,{onExecute:e.executeQuery,result:e.queryResult,error:e.queryError,loading:e.queryLoading})})]})]})}function T({tableData:e,schema:t,loading:n,page:i,onPageChange:a,onCellUpdate:s}){let[l,u]=(0,v.useState)(null),[d,p]=(0,v.useState)(``),h=(0,v.useMemo)(()=>t.find(e=>e.pk)?.name??null,[t]),_=(0,v.useCallback)((e,t,n)=>{u({rowIdx:e,col:t}),p(n==null?``:String(n))},[]),y=(0,v.useCallback)(()=>{if(!l||!e||!h)return;let t=e.rows[l.rowIdx];if(!t)return;let n=t[l.col];String(n??``)!==d&&s(h,t[h],l.col,d===``?null:d),u(null)},[l,d,e,h,s]),b=(0,v.useCallback)(()=>u(null),[]),S=(0,v.useMemo)(()=>(e?.columns??[]).map(e=>({id:e,accessorFn:t=>t[e],header:()=>(0,x.jsx)(`span`,{className:t.find(t=>t.name===e)?.pk?`font-bold`:``,children:e}),cell:({row:t,getValue:n})=>{let r=l?.rowIdx===t.index&&l?.col===e,i=n();return r?(0,x.jsx)(`input`,{autoFocus:!0,className:`w-full bg-transparent border border-primary/50 rounded px-1 py-0 text-xs outline-none`,value:d,onChange:e=>p(e.target.value),onBlur:y,onKeyDown:e=>{e.key===`Enter`&&y(),e.key===`Escape`&&b()}}):(0,x.jsx)(`span`,{className:`cursor-pointer truncate block ${i==null?`text-muted-foreground/40 italic`:``}`,onDoubleClick:()=>h&&_(t.index,e,i),title:i==null?`NULL`:String(i),children:i==null?`NULL`:String(i)})}})),[e?.columns,t,l,d,y,b,_,h]),C=o({data:e?.rows??[],columns:S,getCoreRowModel:c()});if(!e)return(0,x.jsx)(`div`,{className:`flex items-center justify-center h-full text-xs text-muted-foreground`,children:n?(0,x.jsx)(f,{className:`size-4 animate-spin`}):`Select a table`});let w=Math.ceil(e.total/e.limit)||1;return(0,x.jsxs)(`div`,{className:`flex flex-col h-full overflow-hidden`,children:[(0,x.jsx)(`div`,{className:`flex-1 overflow-auto`,children:(0,x.jsxs)(`table`,{className:`w-full text-xs border-collapse`,children:[(0,x.jsx)(`thead`,{className:`sticky top-0 z-10 bg-muted`,children:C.getHeaderGroups().map(e=>(0,x.jsx)(`tr`,{children:e.headers.map(e=>(0,x.jsx)(`th`,{className:`px-2 py-1.5 text-left font-medium text-muted-foreground border-b border-border whitespace-nowrap`,children:r(e.column.columnDef.header,e.getContext())},e.id))},e.id))}),(0,x.jsxs)(`tbody`,{children:[C.getRowModel().rows.map(e=>(0,x.jsx)(`tr`,{className:`hover:bg-muted/30 border-b border-border/50`,children:e.getVisibleCells().map(e=>(0,x.jsx)(`td`,{className:`px-2 py-1 max-w-[300px]`,children:r(e.column.columnDef.cell,e.getContext())},e.id))},e.id)),e.rows.length===0&&(0,x.jsx)(`tr`,{children:(0,x.jsx)(`td`,{colSpan:e.columns.length,className:`px-2 py-8 text-center text-muted-foreground`,children:`No data`})})]})]})}),(0,x.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,x.jsxs)(`span`,{children:[e.total.toLocaleString(),` rows`]}),(0,x.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,x.jsx)(`button`,{type:`button`,disabled:i<=1,onClick:()=>a(i-1),className:`p-0.5 rounded hover:bg-muted disabled:opacity-30`,children:(0,x.jsx)(g,{className:`size-3.5`})}),(0,x.jsxs)(`span`,{children:[i,` / `,w]}),(0,x.jsx)(`button`,{type:`button`,disabled:i>=w,onClick:()=>a(i+1),className:`p-0.5 rounded hover:bg-muted disabled:opacity-30`,children:(0,x.jsx)(m,{className:`size-3.5`})})]})]})]})}function E({onExecute:e,result:t,error:n,loading:r}){let[o,c]=(0,v.useState)(`SELECT * FROM `),u=(0,v.useCallback)(()=>{let t=o.trim();t&&e(t)},[o,e]);return(0,x.jsxs)(`div`,{className:`flex flex-col h-full overflow-hidden`,children:[(0,x.jsxs)(`div`,{className:`flex items-start gap-1 border-b border-border bg-background`,onKeyDown:(0,v.useCallback)(e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),u())},[u]),children:[(0,x.jsx)(`div`,{className:`flex-1 max-h-[120px] overflow-auto`,children:(0,x.jsx)(a,{value:o,onChange:c,extensions:[s({dialect:l})],basicSetup:{lineNumbers:!1,foldGutter:!1,highlightActiveLine:!1},className:`text-xs [&_.cm-editor]:!outline-none [&_.cm-scroller]:!overflow-auto`})}),(0,x.jsx)(`button`,{type:`button`,onClick:u,disabled:r,title:`Execute (Cmd+Enter)`,className:`shrink-0 m-1 p-1.5 rounded bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-50 transition-colors`,children:r?(0,x.jsx)(f,{className:`size-3.5 animate-spin`}):(0,x.jsx)(i,{className:`size-3.5`})})]}),(0,x.jsxs)(`div`,{className:`flex-1 overflow-auto text-xs`,children:[n&&(0,x.jsx)(`div`,{className:`px-3 py-2 text-destructive bg-destructive/5`,children:n}),t?.changeType===`modify`&&(0,x.jsxs)(`div`,{className:`px-3 py-2 text-green-500`,children:[`Query executed. `,t.rowsAffected,` row(s) affected.`]}),t?.changeType===`select`&&t.rows.length>0&&(0,x.jsxs)(`table`,{className:`w-full border-collapse`,children:[(0,x.jsx)(`thead`,{className:`sticky top-0 bg-muted`,children:(0,x.jsx)(`tr`,{children:t.columns.map(e=>(0,x.jsx)(`th`,{className:`px-2 py-1 text-left font-medium text-muted-foreground border-b border-border whitespace-nowrap`,children:e},e))})}),(0,x.jsx)(`tbody`,{children:t.rows.map((e,n)=>(0,x.jsx)(`tr`,{className:`hover:bg-muted/30 border-b border-border/50`,children:t.columns.map(t=>(0,x.jsx)(`td`,{className:`px-2 py-1 max-w-[300px] truncate`,title:e[t]==null?`NULL`:String(e[t]),children:e[t]==null?(0,x.jsx)(`span`,{className:`text-muted-foreground/40 italic`,children:`NULL`}):String(e[t])},t))},n))})]}),t?.changeType===`select`&&t.rows.length===0&&(0,x.jsx)(`div`,{className:`px-3 py-2 text-muted-foreground`,children:`No results`})]})]})}export{S as PostgresViewer};
|
|
1
|
+
import{i as e,t}from"./react-CYzKIDNi.js";import{t as n}from"./jsx-runtime-wQxeESYQ.js";import{a as r,c as i,i as a,o,r as s,s as c,t as l}from"./dist-D9RHR8A4.js";import{t as u}from"./table-C0oSLUYn.js";import{t as d}from"./api-client-TUmacMRS.js";import{B as f,H as p,I as m,T as h,V as g,k as _}from"./index-Bu8-Nf_9.js";var v=e(t(),1),y=`/api/postgres`;function b(e){let[t,n]=(0,v.useState)(``),[r,i]=(0,v.useState)(!1),a=e?`/api/db/connections/${e}`:null,[o,s]=(0,v.useState)([]),[c,l]=(0,v.useState)(null),[u,f]=(0,v.useState)(`public`),[p,m]=(0,v.useState)(null),[h,g]=(0,v.useState)([]),[_,b]=(0,v.useState)(!1),[x,S]=(0,v.useState)(null),[C,w]=(0,v.useState)(1),[T,E]=(0,v.useState)(null),[D,O]=(0,v.useState)(null),[k,A]=(0,v.useState)(!1),j=(0,v.useCallback)(async e=>{b(!0),S(null);try{let t=await d.post(`${y}/test`,{connectionString:e});if(!t.ok){S(t.error??`Connection failed`);return}n(e),i(!0);let r=await d.post(`${y}/tables`,{connectionString:e});s(r),r.length>0&&(l(r[0].name),f(r[0].schema))}catch(e){S(e.message)}finally{b(!1)}},[]),M=(0,v.useCallback)(async()=>{if(a){b(!0);try{s(await d.get(`${a}/tables?cached=1`))}catch(e){S(e.message)}finally{b(!1)}return}if(t){b(!0);try{s(await d.post(`${y}/tables`,{connectionString:t}))}catch(e){S(e.message)}finally{b(!1)}}},[a,t,c]);(0,v.useEffect)(()=>{a&&(i(!0),M())},[a]);let N=(0,v.useCallback)(async(e,n,r)=>{let i=e??c,o=n??u;if(i){b(!0);try{if(a){let[e,t]=await Promise.all([d.get(`${a}/data?table=${encodeURIComponent(i)}&schema=${o}&page=${r??C}&limit=100`),d.get(`${a}/schema?table=${encodeURIComponent(i)}&schema=${o}`)]);m(e),g(t)}else{if(!t)return;let[e,n]=await Promise.all([d.post(`${y}/data`,{connectionString:t,table:i,schema:o,page:r??C,limit:100}),d.post(`${y}/schema`,{connectionString:t,table:i,schema:o})]);m(e),g(n)}}catch(e){S(e.message)}finally{b(!1)}}},[a,t,c,u,C]);return{connectionString:t,connected:r,connect:j,tables:o,selectedTable:c,selectTable:(0,v.useCallback)((e,t=`public`)=>{l(e),f(t),w(1),E(null),N(e,t,1)},[N]),tableData:p,schema:h,loading:_,error:x,page:C,setPage:(0,v.useCallback)(e=>{w(e),N(void 0,void 0,e)},[N]),queryResult:T,queryError:D,queryLoading:k,executeQuery:(0,v.useCallback)(async e=>{if(!(!a&&!t)){A(!0),O(null);try{let n=a?await d.post(`${a}/query`,{sql:e}):await d.post(`${y}/query`,{connectionString:t,sql:e});E(n),n.changeType===`modify`&&N()}catch(e){O(e.message)}finally{A(!1)}}},[a,t,N]),updateCell:(0,v.useCallback)(async(e,n,r,i)=>{if(c)try{if(a)await d.put(`${a}/cell`,{table:c,schema:u,pkColumn:e,pkValue:n,column:r,value:i});else{if(!t)return;await d.post(`${y}/cell`,{connectionString:t,table:c,schema:u,pkColumn:e,pkValue:n,column:r,value:i})}N()}catch(e){S(e.message)}},[a,t,c,u,N]),refreshTables:M,refreshData:N}}var x=n();function S({metadata:e}){let t=e?.connectionString??``,n=e?.connectionId,r=b(n);return r.connected?(0,x.jsx)(w,{pg:r,initialTable:e?.tableName,hideTableList:!!n,connectionName:e?.connectionName}):(0,x.jsx)(C,{initialValue:t,onConnect:r.connect,loading:r.loading,error:r.error})}function C({initialValue:e,onConnect:t,loading:n,error:r}){let[i,a]=(0,v.useState)(e);return(0,x.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,x.jsxs)(`div`,{className:`flex flex-col gap-3 w-full max-w-lg px-4`,children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium`,children:[(0,x.jsx)(m,{className:`size-4`}),` Connect to PostgreSQL`]}),(0,x.jsx)(`input`,{className:`w-full px-3 py-2 rounded border border-border bg-background text-sm font-mono outline-none focus:border-primary`,placeholder:`postgresql://user:pass@host:5432/db`,value:i,onChange:e=>a(e.target.value),onKeyDown:e=>{e.key===`Enter`&&i.trim()&&t(i.trim())}}),r&&(0,x.jsxs)(`p`,{className:`text-xs text-destructive flex items-center gap-1`,children:[(0,x.jsx)(f,{className:`size-3`}),r]}),(0,x.jsx)(`button`,{type:`button`,disabled:n||!i.trim(),onClick:()=>t(i.trim()),className:`px-4 py-2 rounded bg-primary text-primary-foreground text-sm hover:bg-primary/90 disabled:opacity-50 transition-colors`,children:n?(0,x.jsx)(_,{className:`size-4 animate-spin mx-auto`}):`Connect`})]})})}function w({pg:e,initialTable:t,hideTableList:n,connectionName:r}){let[i,a]=(0,v.useState)(!1),o=(0,v.useRef)(!1);return(0,v.useEffect)(()=>{if(!(!t||o.current)){if(n&&e.connected)o.current=!0,e.selectTable(t);else if(e.tables.length>0){let n=e.tables.find(e=>e.name===t);n&&(o.current=!0,e.selectTable(n.name,n.schema))}}},[t,e.connected,e.tables]),(0,x.jsxs)(`div`,{className:`flex h-full w-full overflow-hidden`,children:[!n&&(0,x.jsxs)(`div`,{className:`w-48 shrink-0 flex flex-col bg-background overflow-hidden`,children:[(0,x.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-2 border-b border-border`,children:[(0,x.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground uppercase tracking-wider`,children:`Tables`}),(0,x.jsx)(`button`,{type:`button`,onClick:e.refreshTables,className:`text-muted-foreground hover:text-foreground transition-colors`,title:`Refresh`,children:(0,x.jsx)(h,{className:`size-3`})})]}),(0,x.jsxs)(`div`,{className:`flex-1 overflow-y-auto`,children:[e.tables.map(t=>(0,x.jsxs)(`button`,{type:`button`,onClick:()=>e.selectTable(t.name,t.schema),className:`w-full flex items-center gap-2 px-3 py-1.5 text-left text-xs transition-colors ${e.selectedTable===t.name?`bg-muted text-foreground`:`text-muted-foreground hover:bg-muted/50 hover:text-foreground`}`,children:[(0,x.jsx)(u,{className:`size-3 shrink-0`}),(0,x.jsxs)(`span`,{className:`truncate flex-1`,children:[t.schema===`public`?``:`${t.schema}.`,t.name]}),(0,x.jsx)(`span`,{className:`text-[10px] opacity-60`,children:t.rowCount})]},`${t.schema}.${t.name}`)),e.tables.length===0&&(0,x.jsx)(`p`,{className:`px-3 py-4 text-xs text-muted-foreground text-center`,children:`No tables found`})]})]}),(0,x.jsxs)(`div`,{className:`flex-1 flex flex-col overflow-hidden ${n?``:`border-l border-border`}`,children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-1.5 border-b border-border bg-background shrink-0`,children:[(0,x.jsx)(m,{className:`size-3.5 text-muted-foreground`}),(0,x.jsx)(`span`,{className:`text-xs text-muted-foreground truncate`,children:r??`PostgreSQL`}),e.selectedTable&&(0,x.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`/ `,e.selectedTable]}),(0,x.jsx)(`div`,{className:`ml-auto`,children:(0,x.jsx)(`button`,{type:`button`,onClick:()=>a(e=>!e),className:`px-2 py-1 rounded text-xs transition-colors ${i?`bg-muted text-foreground`:`text-muted-foreground hover:text-foreground`}`,children:`SQL`})})]}),(0,x.jsx)(`div`,{className:`flex-1 overflow-hidden ${i?`max-h-[60%]`:``}`,children:(0,x.jsx)(T,{tableData:e.tableData,schema:e.schema,loading:e.loading,page:e.page,onPageChange:e.setPage,onCellUpdate:e.updateCell})}),i&&(0,x.jsx)(`div`,{className:`border-t border-border h-[40%] shrink-0`,children:(0,x.jsx)(E,{onExecute:e.executeQuery,result:e.queryResult,error:e.queryError,loading:e.queryLoading})})]})]})}function T({tableData:e,schema:t,loading:n,page:i,onPageChange:a,onCellUpdate:s}){let[l,u]=(0,v.useState)(null),[d,f]=(0,v.useState)(``),m=(0,v.useMemo)(()=>t.find(e=>e.pk)?.name??null,[t]),h=(0,v.useCallback)((e,t,n)=>{u({rowIdx:e,col:t}),f(n==null?``:String(n))},[]),y=(0,v.useCallback)(()=>{if(!l||!e||!m)return;let t=e.rows[l.rowIdx];if(!t)return;let n=t[l.col];String(n??``)!==d&&s(m,t[m],l.col,d===``?null:d),u(null)},[l,d,e,m,s]),b=(0,v.useCallback)(()=>u(null),[]),S=(0,v.useMemo)(()=>(e?.columns??[]).map(e=>({id:e,accessorFn:t=>t[e],header:()=>(0,x.jsx)(`span`,{className:t.find(t=>t.name===e)?.pk?`font-bold`:``,children:e}),cell:({row:t,getValue:n})=>{let r=l?.rowIdx===t.index&&l?.col===e,i=n();return r?(0,x.jsx)(`input`,{autoFocus:!0,className:`w-full bg-transparent border border-primary/50 rounded px-1 py-0 text-xs outline-none`,value:d,onChange:e=>f(e.target.value),onBlur:y,onKeyDown:e=>{e.key===`Enter`&&y(),e.key===`Escape`&&b()}}):(0,x.jsx)(`span`,{className:`cursor-pointer truncate block ${i==null?`text-muted-foreground/40 italic`:``}`,onDoubleClick:()=>m&&h(t.index,e,i),title:i==null?`NULL`:String(i),children:i==null?`NULL`:String(i)})}})),[e?.columns,t,l,d,y,b,h,m]),C=o({data:e?.rows??[],columns:S,getCoreRowModel:c()});if(!e)return(0,x.jsx)(`div`,{className:`flex items-center justify-center h-full text-xs text-muted-foreground`,children:n?(0,x.jsx)(_,{className:`size-4 animate-spin`}):`Select a table`});let w=Math.ceil(e.total/e.limit)||1;return(0,x.jsxs)(`div`,{className:`flex flex-col h-full overflow-hidden`,children:[(0,x.jsx)(`div`,{className:`flex-1 overflow-auto`,children:(0,x.jsxs)(`table`,{className:`w-full text-xs border-collapse`,children:[(0,x.jsx)(`thead`,{className:`sticky top-0 z-10 bg-muted`,children:C.getHeaderGroups().map(e=>(0,x.jsx)(`tr`,{children:e.headers.map(e=>(0,x.jsx)(`th`,{className:`px-2 py-1.5 text-left font-medium text-muted-foreground border-b border-border whitespace-nowrap`,children:r(e.column.columnDef.header,e.getContext())},e.id))},e.id))}),(0,x.jsxs)(`tbody`,{children:[C.getRowModel().rows.map(e=>(0,x.jsx)(`tr`,{className:`hover:bg-muted/30 border-b border-border/50`,children:e.getVisibleCells().map(e=>(0,x.jsx)(`td`,{className:`px-2 py-1 max-w-[300px]`,children:r(e.column.columnDef.cell,e.getContext())},e.id))},e.id)),e.rows.length===0&&(0,x.jsx)(`tr`,{children:(0,x.jsx)(`td`,{colSpan:e.columns.length,className:`px-2 py-8 text-center text-muted-foreground`,children:`No data`})})]})]})}),(0,x.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,x.jsxs)(`span`,{children:[e.total.toLocaleString(),` rows`]}),(0,x.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,x.jsx)(`button`,{type:`button`,disabled:i<=1,onClick:()=>a(i-1),className:`p-0.5 rounded hover:bg-muted disabled:opacity-30`,children:(0,x.jsx)(p,{className:`size-3.5`})}),(0,x.jsxs)(`span`,{children:[i,` / `,w]}),(0,x.jsx)(`button`,{type:`button`,disabled:i>=w,onClick:()=>a(i+1),className:`p-0.5 rounded hover:bg-muted disabled:opacity-30`,children:(0,x.jsx)(g,{className:`size-3.5`})})]})]})]})}function E({onExecute:e,result:t,error:n,loading:r}){let[o,c]=(0,v.useState)(`SELECT * FROM `),u=(0,v.useCallback)(()=>{let t=o.trim();t&&e(t)},[o,e]);return(0,x.jsxs)(`div`,{className:`flex flex-col h-full overflow-hidden`,children:[(0,x.jsxs)(`div`,{className:`flex items-start gap-1 border-b border-border bg-background`,onKeyDown:(0,v.useCallback)(e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),u())},[u]),children:[(0,x.jsx)(`div`,{className:`flex-1 max-h-[120px] overflow-auto`,children:(0,x.jsx)(a,{value:o,onChange:c,extensions:[s({dialect:l})],basicSetup:{lineNumbers:!1,foldGutter:!1,highlightActiveLine:!1},className:`text-xs [&_.cm-editor]:!outline-none [&_.cm-scroller]:!overflow-auto`})}),(0,x.jsx)(`button`,{type:`button`,onClick:u,disabled:r,title:`Execute (Cmd+Enter)`,className:`shrink-0 m-1 p-1.5 rounded bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-50 transition-colors`,children:r?(0,x.jsx)(_,{className:`size-3.5 animate-spin`}):(0,x.jsx)(i,{className:`size-3.5`})})]}),(0,x.jsxs)(`div`,{className:`flex-1 overflow-auto text-xs`,children:[n&&(0,x.jsx)(`div`,{className:`px-3 py-2 text-destructive bg-destructive/5`,children:n}),t?.changeType===`modify`&&(0,x.jsxs)(`div`,{className:`px-3 py-2 text-green-500`,children:[`Query executed. `,t.rowsAffected,` row(s) affected.`]}),t?.changeType===`select`&&t.rows.length>0&&(0,x.jsxs)(`table`,{className:`w-full border-collapse`,children:[(0,x.jsx)(`thead`,{className:`sticky top-0 bg-muted`,children:(0,x.jsx)(`tr`,{children:t.columns.map(e=>(0,x.jsx)(`th`,{className:`px-2 py-1 text-left font-medium text-muted-foreground border-b border-border whitespace-nowrap`,children:e},e))})}),(0,x.jsx)(`tbody`,{children:t.rows.map((e,n)=>(0,x.jsx)(`tr`,{className:`hover:bg-muted/30 border-b border-border/50`,children:t.columns.map(t=>(0,x.jsx)(`td`,{className:`px-2 py-1 max-w-[300px] truncate`,title:e[t]==null?`NULL`:String(e[t]),children:e[t]==null?(0,x.jsx)(`span`,{className:`text-muted-foreground/40 italic`,children:`NULL`}):String(e[t])},t))},n))})]}),t?.changeType===`select`&&t.rows.length===0&&(0,x.jsx)(`div`,{className:`px-3 py-2 text-muted-foreground`,children:`No results`})]})]})}export{S as PostgresViewer};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/api-settings-CaKDC7_s.js","assets/react-CYzKIDNi.js","assets/api-client-TUmacMRS.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{t as e}from"./react-rgzL83kk.js";var t=`modulepreload`,n=function(e){return`/`+e},r={},i=function(e,i,a){let o=Promise.resolve();if(i&&i.length>0){let e=document.getElementsByTagName(`link`),s=document.querySelector(`meta[property=csp-nonce]`),c=s?.nonce||s?.getAttribute(`nonce`);function l(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}o=l(i.map(i=>{if(i=n(i,a),i in r)return;r[i]=!0;let o=i.endsWith(`.css`),s=o?`[rel="stylesheet"]`:``;if(a)for(let t=e.length-1;t>=0;t--){let n=e[t];if(n.href===i&&(!o||n.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${i}"]${s}`))return;let l=document.createElement(`link`);if(l.rel=o?`stylesheet`:t,o||(l.as=`script`),l.crossOrigin=``,l.href=i,c&&l.setAttribute(`nonce`,c),document.head.appendChild(l),o)return new Promise((e,t)=>{l.addEventListener(`load`,e),l.addEventListener(`error`,()=>t(Error(`Unable to preload CSS for ${i}`)))})}))}function s(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return o.then(t=>{for(let e of t||[])e.status===`rejected`&&s(e.reason);return e().catch(s)})},a=`ppm-settings`;function o(){try{let e=localStorage.getItem(a);if(e)return JSON.parse(e)}catch{}return{}}function s(e){let t=o();localStorage.setItem(a,JSON.stringify({...t,...e}))}function c(e){let t=e===`system`?window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:e;document.documentElement.classList.toggle(`dark`,t===`dark`),document.documentElement.classList.toggle(`light`,t===`light`);let n=document.querySelector(`meta[name="theme-color"]`);n&&n.setAttribute(`content`,t===`dark`?`#0f1419`:`#ffffff`)}var l=o(),u=e((e,t)=>({theme:l.theme===`light`||l.theme===`dark`||l.theme===`system`?l.theme:`system`,sidebarCollapsed:l.sidebarCollapsed??!1,sidebarWidth:l.sidebarWidth??280,gitStatusViewMode:l.gitStatusViewMode===`flat`?`flat`:`tree`,wordWrap:l.wordWrap??!1,sidebarActiveTab:[`git`,`settings`,`database`,`search`].includes(l.sidebarActiveTab)?l.sidebarActiveTab:`explorer`,deviceName:null,version:null,setTheme:t=>{s({theme:t}),c(t),e({theme:t}),fetch(`/api/settings/theme`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({theme:t})}).catch(()=>{})},setDeviceName:async t=>{let n=t.trim();e({deviceName:n||null}),n?document.title=`PPM — ${n}`:document.title=`PPM`;try{let{updateDeviceName:e}=await i(async()=>{let{updateDeviceName:e}=await import(`./api-settings-CaKDC7_s.js`).then(e=>e.n);return{updateDeviceName:e}},__vite__mapDeps([0,1,2]));await e(n)}catch{}},toggleSidebar:()=>{let n=!t().sidebarCollapsed;s({sidebarCollapsed:n}),e({sidebarCollapsed:n})},setSidebarWidth:t=>{let n=Math.max(200,Math.min(600,t));s({sidebarWidth:n}),e({sidebarWidth:n})},setGitStatusViewMode:t=>{s({gitStatusViewMode:t}),e({gitStatusViewMode:t})},toggleWordWrap:()=>{let n=!t().wordWrap;s({wordWrap:n}),e({wordWrap:n})},setSidebarActiveTab:t=>{s({sidebarActiveTab:t}),e({sidebarActiveTab:t})},fetchServerInfo:async()=>{try{let[t,n]=await Promise.all([fetch(`/api/info`),fetch(`/api/settings/theme`)]),r=await t.json();if(r.ok){let{device_name:t,version:n}=r.data;e({deviceName:t||null,version:n||null}),t&&(document.title=`PPM — ${t}`)}let i=await n.json();if(i.ok&&i.data?.theme){let t=i.data.theme;s({theme:t}),c(t),e({theme:t})}}catch{}}}));export{u as n,i as r,c as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./react-CYzKIDNi.js";import"./input-CE3bFwLk.js";import"./jsx-runtime-wQxeESYQ.js";import"./switch-C8P-C1hw.js";import"./settings-store-xG6mKqkD.js";import"./api-client-TUmacMRS.js";import"./api-settings-CaKDC7_s.js";import{n as e}from"./index-Bu8-Nf_9.js";export{e as SettingsTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e,t}from"./react-CYzKIDNi.js";import{t as n}from"./jsx-runtime-wQxeESYQ.js";import{a as r,c as i,i as a,n as o,o as s,r as c,s as l}from"./dist-D9RHR8A4.js";import{t as u}from"./table-C0oSLUYn.js";import{i as d,t as f}from"./api-client-TUmacMRS.js";import{A as p,E as m,H as h,L as g,U as _,V as v}from"./index-l0SQefAv.js";var y=e(t(),1);function b(e,t,n){let[r,i]=(0,y.useState)([]),[a,o]=(0,y.useState)(null),[s,c]=(0,y.useState)(null),[l,u]=(0,y.useState)([]),[p,m]=(0,y.useState)(!1),[h,g]=(0,y.useState)(null),[_,v]=(0,y.useState)(1),[b,x]=(0,y.useState)(null),[S,C]=(0,y.useState)(null),[w,T]=(0,y.useState)(!1),E=n?`/api/db/connections/${n}`:null,D=E??`${d(e)}/sqlite`,O=E?``:`path=${encodeURIComponent(t)}`,k=(0,y.useCallback)(async()=>{m(!0),g(null);try{let e=E?`?cached=1`:O?`?${O}`:``,t=await f.get(`${D}/tables${e}`);i(t),!E&&t.length>0&&!a&&o(t[0].name)}catch(e){g(e.message)}finally{m(!1)}},[D,O,E]);(0,y.useEffect)(()=>{k()},[k]);let A=(0,y.useCallback)(async()=>{if(a){m(!0);try{let e=O?`${O}&`:``,[t,n]=await Promise.all([f.get(`${D}/data?${e}table=${encodeURIComponent(a)}&page=${_}&limit=100`),f.get(`${D}/schema?${e}table=${encodeURIComponent(a)}`)]);c(t),u(n)}catch(e){g(e.message)}finally{m(!1)}}},[D,O,a,_]);return(0,y.useEffect)(()=>{A()},[A]),{tables:r,selectedTable:a,selectTable:(0,y.useCallback)(e=>{o(e),v(1),x(null)},[]),tableData:s,schema:l,loading:p,error:h,page:_,setPage:v,queryResult:b,queryError:S,queryLoading:w,executeQuery:(0,y.useCallback)(async e=>{T(!0),C(null);try{let n=E?{sql:e}:{path:t,sql:e},r=await f.post(`${D}/query`,n);x(r),r.changeType===`modify`&&A()}catch(e){C(e.message)}finally{T(!1)}},[D,E,t,A]),updateCell:(0,y.useCallback)(async(e,n,r)=>{if(a)try{E?await f.put(`${D}/cell`,{table:a,pkColumn:`rowid`,pkValue:e,column:n,value:r}):await f.put(`${D}/cell`,{path:t,table:a,rowid:e,column:n,value:r}),A()}catch(e){g(e.message)}},[D,E,t,a,A]),refreshTables:k,refreshData:A}}var x=n();function S({tables:e,selectedTable:t,onSelect:n,onRefresh:r}){return(0,x.jsxs)(`div`,{className:`w-48 shrink-0 flex flex-col bg-background overflow-hidden`,children:[(0,x.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-2 border-b border-border`,children:[(0,x.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground uppercase tracking-wider`,children:`Tables`}),(0,x.jsx)(`button`,{type:`button`,onClick:r,className:`text-muted-foreground hover:text-foreground transition-colors`,title:`Refresh tables`,children:(0,x.jsx)(m,{className:`size-3`})})]}),(0,x.jsxs)(`div`,{className:`flex-1 overflow-y-auto`,children:[e.map(e=>(0,x.jsxs)(`button`,{type:`button`,onClick:()=>n(e.name),className:`w-full flex items-center gap-2 px-3 py-1.5 text-left text-xs transition-colors ${t===e.name?`bg-muted text-foreground`:`text-muted-foreground hover:bg-muted/50 hover:text-foreground`}`,children:[(0,x.jsx)(u,{className:`size-3 shrink-0`}),(0,x.jsx)(`span`,{className:`truncate flex-1`,children:e.name}),(0,x.jsx)(`span`,{className:`text-[10px] opacity-60`,children:e.rowCount})]},e.name)),e.length===0&&(0,x.jsx)(`p`,{className:`px-3 py-4 text-xs text-muted-foreground text-center`,children:`No tables found`})]})]})}function C({tableData:e,schema:t,loading:n,page:r,onPageChange:i,onCellUpdate:a}){if(!e)return(0,x.jsx)(`div`,{className:`flex items-center justify-center h-full text-xs text-muted-foreground`,children:n?(0,x.jsx)(p,{className:`size-4 animate-spin`}):`Select a table`});let o=Math.ceil(e.total/e.limit)||1;return(0,x.jsxs)(`div`,{className:`flex flex-col h-full overflow-hidden`,children:[(0,x.jsx)(`div`,{className:`flex-1 overflow-auto`,children:(0,x.jsx)(w,{columns:e.columns,rows:e.rows,schema:t,onCellUpdate:a})}),(0,x.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,x.jsxs)(`span`,{children:[e.total.toLocaleString(),` rows`]}),(0,x.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,x.jsx)(`button`,{type:`button`,disabled:r<=1,onClick:()=>i(r-1),className:`p-0.5 rounded hover:bg-muted disabled:opacity-30`,children:(0,x.jsx)(_,{className:`size-3.5`})}),(0,x.jsxs)(`span`,{children:[r,` / `,o]}),(0,x.jsx)(`button`,{type:`button`,disabled:r>=o,onClick:()=>i(r+1),className:`p-0.5 rounded hover:bg-muted disabled:opacity-30`,children:(0,x.jsx)(h,{className:`size-3.5`})})]})]})]})}function w({columns:e,rows:t,schema:n,onCellUpdate:i}){let[a,o]=(0,y.useState)(null),[c,u]=(0,y.useState)(``),d=(0,y.useMemo)(()=>new Set(n.filter(e=>e.pk).map(e=>e.name)),[n]),f=(0,y.useCallback)((e,t,n)=>{t!==`rowid`&&(o({rowIdx:e,col:t}),u(n==null?``:String(n)))},[]),p=(0,y.useCallback)(()=>{if(!a)return;let e=t[a.rowIdx];if(!e)return;let n=e.rowid,r=e[a.col];String(r??``)!==c&&i(n,a.col,c===``?null:c),o(null)},[a,c,t,i]),m=(0,y.useCallback)(()=>o(null),[]),h=s({data:t,columns:(0,y.useMemo)(()=>e.map(e=>({id:e,accessorFn:t=>t[e],header:()=>(0,x.jsx)(`span`,{className:`${d.has(e)?`font-bold`:``} ${e===`rowid`?`text-muted-foreground/50`:``}`,children:e}),cell:({row:t,getValue:n})=>{let r=t.index,i=a?.rowIdx===r&&a?.col===e,o=n();return i?(0,x.jsx)(`input`,{autoFocus:!0,className:`w-full bg-transparent border border-primary/50 rounded px-1 py-0 text-xs outline-none`,value:c,onChange:e=>u(e.target.value),onBlur:p,onKeyDown:e=>{e.key===`Enter`&&p(),e.key===`Escape`&&m()}}):(0,x.jsx)(`span`,{className:`cursor-pointer truncate block ${o==null?`text-muted-foreground/40 italic`:``} ${e===`rowid`?`text-muted-foreground/50`:``}`,onDoubleClick:()=>f(r,e,o),title:o==null?`NULL`:String(o),children:o==null?`NULL`:String(o)})}})),[e,d,a,c,p,m,f]),getCoreRowModel:l()});return(0,x.jsxs)(`table`,{className:`w-full text-xs border-collapse`,children:[(0,x.jsx)(`thead`,{className:`sticky top-0 z-10 bg-muted`,children:h.getHeaderGroups().map(e=>(0,x.jsx)(`tr`,{children:e.headers.map(e=>(0,x.jsx)(`th`,{className:`px-2 py-1.5 text-left font-medium text-muted-foreground border-b border-border whitespace-nowrap`,children:r(e.column.columnDef.header,e.getContext())},e.id))},e.id))}),(0,x.jsxs)(`tbody`,{children:[h.getRowModel().rows.map(e=>(0,x.jsx)(`tr`,{className:`hover:bg-muted/30 border-b border-border/50`,children:e.getVisibleCells().map(e=>(0,x.jsx)(`td`,{className:`px-2 py-1 max-w-[300px]`,children:r(e.column.columnDef.cell,e.getContext())},e.id))},e.id)),t.length===0&&(0,x.jsx)(`tr`,{children:(0,x.jsx)(`td`,{colSpan:e.length,className:`px-2 py-8 text-center text-muted-foreground`,children:`No data`})})]})]})}function T({onExecute:e,result:t,error:n,loading:r}){let[s,l]=(0,y.useState)(`SELECT * FROM `),u=(0,y.useCallback)(()=>{let t=s.trim();t&&e(t)},[s,e]);return(0,x.jsxs)(`div`,{className:`flex flex-col h-full overflow-hidden`,children:[(0,x.jsxs)(`div`,{className:`flex items-start gap-1 border-b border-border bg-background`,onKeyDown:(0,y.useCallback)(e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),u())},[u]),children:[(0,x.jsx)(`div`,{className:`flex-1 max-h-[120px] overflow-auto`,children:(0,x.jsx)(a,{value:s,onChange:l,extensions:[c({dialect:o})],basicSetup:{lineNumbers:!1,foldGutter:!1,highlightActiveLine:!1},className:`text-xs [&_.cm-editor]:!outline-none [&_.cm-scroller]:!overflow-auto`})}),(0,x.jsx)(`button`,{type:`button`,onClick:u,disabled:r,className:`shrink-0 m-1 p-1.5 rounded bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-50 transition-colors`,title:`Execute (Cmd+Enter)`,children:r?(0,x.jsx)(p,{className:`size-3.5 animate-spin`}):(0,x.jsx)(i,{className:`size-3.5`})})]}),(0,x.jsxs)(`div`,{className:`flex-1 overflow-auto text-xs`,children:[n&&(0,x.jsx)(`div`,{className:`px-3 py-2 text-destructive bg-destructive/5`,children:n}),t&&t.changeType===`modify`&&(0,x.jsxs)(`div`,{className:`px-3 py-2 text-green-500`,children:[`Query executed. `,t.rowsAffected,` row(s) affected.`]}),t&&t.changeType===`select`&&t.rows.length>0&&(0,x.jsxs)(`table`,{className:`w-full border-collapse`,children:[(0,x.jsx)(`thead`,{className:`sticky top-0 bg-muted`,children:(0,x.jsx)(`tr`,{children:t.columns.map(e=>(0,x.jsx)(`th`,{className:`px-2 py-1 text-left font-medium text-muted-foreground border-b border-border whitespace-nowrap`,children:e},e))})}),(0,x.jsx)(`tbody`,{children:t.rows.map((e,n)=>(0,x.jsx)(`tr`,{className:`hover:bg-muted/30 border-b border-border/50`,children:t.columns.map(t=>(0,x.jsx)(`td`,{className:`px-2 py-1 max-w-[300px] truncate`,title:e[t]==null?`NULL`:String(e[t]),children:e[t]==null?(0,x.jsx)(`span`,{className:`text-muted-foreground/40 italic`,children:`NULL`}):String(e[t])},t))},n))})]}),t&&t.changeType===`select`&&t.rows.length===0&&(0,x.jsx)(`div`,{className:`px-3 py-2 text-muted-foreground`,children:`No results`})]})]})}function E({metadata:e}){let t=e?.filePath,n=e?.projectName,r=e?.connectionId,i=e?.tableName,[a,o]=(0,y.useState)(!1);return r?(0,x.jsx)(D,{projectName:``,dbPath:``,connectionId:r,connectionName:e?.connectionName,initialTable:i,queryPanelOpen:a,onToggleQueryPanel:()=>o(e=>!e),hideTableList:!0}):!t||!n?(0,x.jsxs)(`div`,{className:`flex items-center justify-center h-full text-text-secondary text-sm`,children:[(0,x.jsx)(g,{className:`size-5 mr-2`}),` No database file selected.`]}):(0,x.jsx)(D,{projectName:n,dbPath:t,queryPanelOpen:a,onToggleQueryPanel:()=>o(e=>!e)})}function D({projectName:e,dbPath:t,connectionId:n,connectionName:r,initialTable:i,queryPanelOpen:a,onToggleQueryPanel:o,hideTableList:s}){let c=b(e,t,n),l=(0,y.useRef)(!1);return(0,y.useEffect)(()=>{i&&!l.current&&c.tables.length>0&&(l.current=!0,c.selectTable(i))},[i,c.tables]),c.error&&c.tables.length===0?(0,x.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-text-secondary`,children:[(0,x.jsx)(v,{className:`size-10 text-destructive`}),(0,x.jsx)(`p`,{className:`text-sm`,children:c.error})]}):c.loading&&c.tables.length===0?(0,x.jsxs)(`div`,{className:`flex items-center justify-center h-full gap-2 text-text-secondary`,children:[(0,x.jsx)(p,{className:`size-5 animate-spin`}),(0,x.jsx)(`span`,{className:`text-sm`,children:`Loading database...`})]}):(0,x.jsxs)(`div`,{className:`flex h-full w-full overflow-hidden`,children:[!s&&(0,x.jsx)(S,{tables:c.tables,selectedTable:c.selectedTable,onSelect:c.selectTable,onRefresh:c.refreshTables}),(0,x.jsxs)(`div`,{className:`flex-1 flex flex-col overflow-hidden ${s?``:`border-l border-border`}`,children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-1.5 border-b border-border bg-background shrink-0`,children:[(0,x.jsx)(g,{className:`size-3.5 text-muted-foreground`}),(0,x.jsx)(`span`,{className:`text-xs text-muted-foreground truncate`,children:r??t}),(0,x.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:c.selectedTable&&`/ ${c.selectedTable}`}),(0,x.jsx)(`div`,{className:`ml-auto`,children:(0,x.jsx)(`button`,{type:`button`,onClick:o,className:`px-2 py-1 rounded text-xs transition-colors ${a?`bg-muted text-foreground`:`text-muted-foreground hover:text-foreground`}`,children:`SQL`})})]}),(0,x.jsx)(`div`,{className:`flex-1 overflow-hidden ${a?`max-h-[60%]`:``}`,children:(0,x.jsx)(C,{tableData:c.tableData,schema:c.schema,loading:c.loading,page:c.page,onPageChange:c.setPage,onCellUpdate:c.updateCell})}),a&&(0,x.jsx)(`div`,{className:`border-t border-border h-[40%] shrink-0`,children:(0,x.jsx)(T,{onExecute:c.executeQuery,result:c.queryResult,error:c.queryError,loading:c.queryLoading})})]})]})}export{E as SqliteViewer};
|
|
1
|
+
import{i as e,t}from"./react-CYzKIDNi.js";import{t as n}from"./jsx-runtime-wQxeESYQ.js";import{a as r,c as i,i as a,n as o,o as s,r as c,s as l}from"./dist-D9RHR8A4.js";import{t as u}from"./table-C0oSLUYn.js";import{i as d,t as f}from"./api-client-TUmacMRS.js";import{B as p,H as m,I as h,T as g,V as _,k as v}from"./index-Bu8-Nf_9.js";var y=e(t(),1);function b(e,t,n){let[r,i]=(0,y.useState)([]),[a,o]=(0,y.useState)(null),[s,c]=(0,y.useState)(null),[l,u]=(0,y.useState)([]),[p,m]=(0,y.useState)(!1),[h,g]=(0,y.useState)(null),[_,v]=(0,y.useState)(1),[b,x]=(0,y.useState)(null),[S,C]=(0,y.useState)(null),[w,T]=(0,y.useState)(!1),E=n?`/api/db/connections/${n}`:null,D=E??`${d(e)}/sqlite`,O=E?``:`path=${encodeURIComponent(t)}`,k=(0,y.useCallback)(async()=>{m(!0),g(null);try{let e=E?`?cached=1`:O?`?${O}`:``,t=await f.get(`${D}/tables${e}`);i(t),!E&&t.length>0&&!a&&o(t[0].name)}catch(e){g(e.message)}finally{m(!1)}},[D,O,E]);(0,y.useEffect)(()=>{k()},[k]);let A=(0,y.useCallback)(async()=>{if(a){m(!0);try{let e=O?`${O}&`:``,[t,n]=await Promise.all([f.get(`${D}/data?${e}table=${encodeURIComponent(a)}&page=${_}&limit=100`),f.get(`${D}/schema?${e}table=${encodeURIComponent(a)}`)]);c(t),u(n)}catch(e){g(e.message)}finally{m(!1)}}},[D,O,a,_]);return(0,y.useEffect)(()=>{A()},[A]),{tables:r,selectedTable:a,selectTable:(0,y.useCallback)(e=>{o(e),v(1),x(null)},[]),tableData:s,schema:l,loading:p,error:h,page:_,setPage:v,queryResult:b,queryError:S,queryLoading:w,executeQuery:(0,y.useCallback)(async e=>{T(!0),C(null);try{let n=E?{sql:e}:{path:t,sql:e},r=await f.post(`${D}/query`,n);x(r),r.changeType===`modify`&&A()}catch(e){C(e.message)}finally{T(!1)}},[D,E,t,A]),updateCell:(0,y.useCallback)(async(e,n,r)=>{if(a)try{E?await f.put(`${D}/cell`,{table:a,pkColumn:`rowid`,pkValue:e,column:n,value:r}):await f.put(`${D}/cell`,{path:t,table:a,rowid:e,column:n,value:r}),A()}catch(e){g(e.message)}},[D,E,t,a,A]),refreshTables:k,refreshData:A}}var x=n();function S({tables:e,selectedTable:t,onSelect:n,onRefresh:r}){return(0,x.jsxs)(`div`,{className:`w-48 shrink-0 flex flex-col bg-background overflow-hidden`,children:[(0,x.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-2 border-b border-border`,children:[(0,x.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground uppercase tracking-wider`,children:`Tables`}),(0,x.jsx)(`button`,{type:`button`,onClick:r,className:`text-muted-foreground hover:text-foreground transition-colors`,title:`Refresh tables`,children:(0,x.jsx)(g,{className:`size-3`})})]}),(0,x.jsxs)(`div`,{className:`flex-1 overflow-y-auto`,children:[e.map(e=>(0,x.jsxs)(`button`,{type:`button`,onClick:()=>n(e.name),className:`w-full flex items-center gap-2 px-3 py-1.5 text-left text-xs transition-colors ${t===e.name?`bg-muted text-foreground`:`text-muted-foreground hover:bg-muted/50 hover:text-foreground`}`,children:[(0,x.jsx)(u,{className:`size-3 shrink-0`}),(0,x.jsx)(`span`,{className:`truncate flex-1`,children:e.name}),(0,x.jsx)(`span`,{className:`text-[10px] opacity-60`,children:e.rowCount})]},e.name)),e.length===0&&(0,x.jsx)(`p`,{className:`px-3 py-4 text-xs text-muted-foreground text-center`,children:`No tables found`})]})]})}function C({tableData:e,schema:t,loading:n,page:r,onPageChange:i,onCellUpdate:a}){if(!e)return(0,x.jsx)(`div`,{className:`flex items-center justify-center h-full text-xs text-muted-foreground`,children:n?(0,x.jsx)(v,{className:`size-4 animate-spin`}):`Select a table`});let o=Math.ceil(e.total/e.limit)||1;return(0,x.jsxs)(`div`,{className:`flex flex-col h-full overflow-hidden`,children:[(0,x.jsx)(`div`,{className:`flex-1 overflow-auto`,children:(0,x.jsx)(w,{columns:e.columns,rows:e.rows,schema:t,onCellUpdate:a})}),(0,x.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,x.jsxs)(`span`,{children:[e.total.toLocaleString(),` rows`]}),(0,x.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,x.jsx)(`button`,{type:`button`,disabled:r<=1,onClick:()=>i(r-1),className:`p-0.5 rounded hover:bg-muted disabled:opacity-30`,children:(0,x.jsx)(m,{className:`size-3.5`})}),(0,x.jsxs)(`span`,{children:[r,` / `,o]}),(0,x.jsx)(`button`,{type:`button`,disabled:r>=o,onClick:()=>i(r+1),className:`p-0.5 rounded hover:bg-muted disabled:opacity-30`,children:(0,x.jsx)(_,{className:`size-3.5`})})]})]})]})}function w({columns:e,rows:t,schema:n,onCellUpdate:i}){let[a,o]=(0,y.useState)(null),[c,u]=(0,y.useState)(``),d=(0,y.useMemo)(()=>new Set(n.filter(e=>e.pk).map(e=>e.name)),[n]),f=(0,y.useCallback)((e,t,n)=>{t!==`rowid`&&(o({rowIdx:e,col:t}),u(n==null?``:String(n)))},[]),p=(0,y.useCallback)(()=>{if(!a)return;let e=t[a.rowIdx];if(!e)return;let n=e.rowid,r=e[a.col];String(r??``)!==c&&i(n,a.col,c===``?null:c),o(null)},[a,c,t,i]),m=(0,y.useCallback)(()=>o(null),[]),h=s({data:t,columns:(0,y.useMemo)(()=>e.map(e=>({id:e,accessorFn:t=>t[e],header:()=>(0,x.jsx)(`span`,{className:`${d.has(e)?`font-bold`:``} ${e===`rowid`?`text-muted-foreground/50`:``}`,children:e}),cell:({row:t,getValue:n})=>{let r=t.index,i=a?.rowIdx===r&&a?.col===e,o=n();return i?(0,x.jsx)(`input`,{autoFocus:!0,className:`w-full bg-transparent border border-primary/50 rounded px-1 py-0 text-xs outline-none`,value:c,onChange:e=>u(e.target.value),onBlur:p,onKeyDown:e=>{e.key===`Enter`&&p(),e.key===`Escape`&&m()}}):(0,x.jsx)(`span`,{className:`cursor-pointer truncate block ${o==null?`text-muted-foreground/40 italic`:``} ${e===`rowid`?`text-muted-foreground/50`:``}`,onDoubleClick:()=>f(r,e,o),title:o==null?`NULL`:String(o),children:o==null?`NULL`:String(o)})}})),[e,d,a,c,p,m,f]),getCoreRowModel:l()});return(0,x.jsxs)(`table`,{className:`w-full text-xs border-collapse`,children:[(0,x.jsx)(`thead`,{className:`sticky top-0 z-10 bg-muted`,children:h.getHeaderGroups().map(e=>(0,x.jsx)(`tr`,{children:e.headers.map(e=>(0,x.jsx)(`th`,{className:`px-2 py-1.5 text-left font-medium text-muted-foreground border-b border-border whitespace-nowrap`,children:r(e.column.columnDef.header,e.getContext())},e.id))},e.id))}),(0,x.jsxs)(`tbody`,{children:[h.getRowModel().rows.map(e=>(0,x.jsx)(`tr`,{className:`hover:bg-muted/30 border-b border-border/50`,children:e.getVisibleCells().map(e=>(0,x.jsx)(`td`,{className:`px-2 py-1 max-w-[300px]`,children:r(e.column.columnDef.cell,e.getContext())},e.id))},e.id)),t.length===0&&(0,x.jsx)(`tr`,{children:(0,x.jsx)(`td`,{colSpan:e.length,className:`px-2 py-8 text-center text-muted-foreground`,children:`No data`})})]})]})}function T({onExecute:e,result:t,error:n,loading:r}){let[s,l]=(0,y.useState)(`SELECT * FROM `),u=(0,y.useCallback)(()=>{let t=s.trim();t&&e(t)},[s,e]);return(0,x.jsxs)(`div`,{className:`flex flex-col h-full overflow-hidden`,children:[(0,x.jsxs)(`div`,{className:`flex items-start gap-1 border-b border-border bg-background`,onKeyDown:(0,y.useCallback)(e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),u())},[u]),children:[(0,x.jsx)(`div`,{className:`flex-1 max-h-[120px] overflow-auto`,children:(0,x.jsx)(a,{value:s,onChange:l,extensions:[c({dialect:o})],basicSetup:{lineNumbers:!1,foldGutter:!1,highlightActiveLine:!1},className:`text-xs [&_.cm-editor]:!outline-none [&_.cm-scroller]:!overflow-auto`})}),(0,x.jsx)(`button`,{type:`button`,onClick:u,disabled:r,className:`shrink-0 m-1 p-1.5 rounded bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-50 transition-colors`,title:`Execute (Cmd+Enter)`,children:r?(0,x.jsx)(v,{className:`size-3.5 animate-spin`}):(0,x.jsx)(i,{className:`size-3.5`})})]}),(0,x.jsxs)(`div`,{className:`flex-1 overflow-auto text-xs`,children:[n&&(0,x.jsx)(`div`,{className:`px-3 py-2 text-destructive bg-destructive/5`,children:n}),t&&t.changeType===`modify`&&(0,x.jsxs)(`div`,{className:`px-3 py-2 text-green-500`,children:[`Query executed. `,t.rowsAffected,` row(s) affected.`]}),t&&t.changeType===`select`&&t.rows.length>0&&(0,x.jsxs)(`table`,{className:`w-full border-collapse`,children:[(0,x.jsx)(`thead`,{className:`sticky top-0 bg-muted`,children:(0,x.jsx)(`tr`,{children:t.columns.map(e=>(0,x.jsx)(`th`,{className:`px-2 py-1 text-left font-medium text-muted-foreground border-b border-border whitespace-nowrap`,children:e},e))})}),(0,x.jsx)(`tbody`,{children:t.rows.map((e,n)=>(0,x.jsx)(`tr`,{className:`hover:bg-muted/30 border-b border-border/50`,children:t.columns.map(t=>(0,x.jsx)(`td`,{className:`px-2 py-1 max-w-[300px] truncate`,title:e[t]==null?`NULL`:String(e[t]),children:e[t]==null?(0,x.jsx)(`span`,{className:`text-muted-foreground/40 italic`,children:`NULL`}):String(e[t])},t))},n))})]}),t&&t.changeType===`select`&&t.rows.length===0&&(0,x.jsx)(`div`,{className:`px-3 py-2 text-muted-foreground`,children:`No results`})]})]})}function E({metadata:e}){let t=e?.filePath,n=e?.projectName,r=e?.connectionId,i=e?.tableName,[a,o]=(0,y.useState)(!1);return r?(0,x.jsx)(D,{projectName:``,dbPath:``,connectionId:r,connectionName:e?.connectionName,initialTable:i,queryPanelOpen:a,onToggleQueryPanel:()=>o(e=>!e),hideTableList:!0}):!t||!n?(0,x.jsxs)(`div`,{className:`flex items-center justify-center h-full text-text-secondary text-sm`,children:[(0,x.jsx)(h,{className:`size-5 mr-2`}),` No database file selected.`]}):(0,x.jsx)(D,{projectName:n,dbPath:t,queryPanelOpen:a,onToggleQueryPanel:()=>o(e=>!e)})}function D({projectName:e,dbPath:t,connectionId:n,connectionName:r,initialTable:i,queryPanelOpen:a,onToggleQueryPanel:o,hideTableList:s}){let c=b(e,t,n),l=(0,y.useRef)(!1);return(0,y.useEffect)(()=>{i&&!l.current&&c.tables.length>0&&(l.current=!0,c.selectTable(i))},[i,c.tables]),c.error&&c.tables.length===0?(0,x.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-text-secondary`,children:[(0,x.jsx)(p,{className:`size-10 text-destructive`}),(0,x.jsx)(`p`,{className:`text-sm`,children:c.error})]}):c.loading&&c.tables.length===0?(0,x.jsxs)(`div`,{className:`flex items-center justify-center h-full gap-2 text-text-secondary`,children:[(0,x.jsx)(v,{className:`size-5 animate-spin`}),(0,x.jsx)(`span`,{className:`text-sm`,children:`Loading database...`})]}):(0,x.jsxs)(`div`,{className:`flex h-full w-full overflow-hidden`,children:[!s&&(0,x.jsx)(S,{tables:c.tables,selectedTable:c.selectedTable,onSelect:c.selectTable,onRefresh:c.refreshTables}),(0,x.jsxs)(`div`,{className:`flex-1 flex flex-col overflow-hidden ${s?``:`border-l border-border`}`,children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-1.5 border-b border-border bg-background shrink-0`,children:[(0,x.jsx)(h,{className:`size-3.5 text-muted-foreground`}),(0,x.jsx)(`span`,{className:`text-xs text-muted-foreground truncate`,children:r??t}),(0,x.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:c.selectedTable&&`/ ${c.selectedTable}`}),(0,x.jsx)(`div`,{className:`ml-auto`,children:(0,x.jsx)(`button`,{type:`button`,onClick:o,className:`px-2 py-1 rounded text-xs transition-colors ${a?`bg-muted text-foreground`:`text-muted-foreground hover:text-foreground`}`,children:`SQL`})})]}),(0,x.jsx)(`div`,{className:`flex-1 overflow-hidden ${a?`max-h-[60%]`:``}`,children:(0,x.jsx)(C,{tableData:c.tableData,schema:c.schema,loading:c.loading,page:c.page,onPageChange:c.setPage,onCellUpdate:c.updateCell})}),a&&(0,x.jsx)(`div`,{className:`border-t border-border h-[40%] shrink-0`,children:(0,x.jsx)(T,{onExecute:c.executeQuery,result:c.queryResult,error:c.queryError,loading:c.queryLoading})})]})]})}export{E as SqliteViewer};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e,t}from"./react-CYzKIDNi.js";import{C as n,E as r,M as i,N as a,P as o,S as s,_ as c,a as l,b as u,c as d,d as f,f as p,g as m,h,i as g,k as _,l as v,m as y,n as b,o as x,p as ee,r as S,s as C,t as w,u as T,v as E,y as D}from"./input-CE3bFwLk.js";import{n as O,t as k}from"./jsx-runtime-wQxeESYQ.js";import{n as A}from"./utils-DC-bdPS3.js";import{a as te,p as ne}from"./api-settings-CaKDC7_s.js";var j=O(`bell-off`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742`,key:`178tsu`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05`,key:`1hqiys`}]]),M=O(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),re=O(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),ie=O(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),N=e(t(),1),P=k(),F=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),ae=`VisuallyHidden`,I=N.forwardRef((e,t)=>(0,P.jsx)(n.span,{...e,ref:t,style:{...F,...e.style}}));I.displayName=ae;var L=I;function R(e){let t=N.useRef({value:e,previous:e});return N.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var oe=`Label`,se=N.forwardRef((e,t)=>(0,P.jsx)(n.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));se.displayName=oe;var ce=se;function le(e,[t,n]){return Math.min(n,Math.max(t,e))}var ue=e(o(),1),de=[` `,`Enter`,`ArrowUp`,`ArrowDown`],fe=[` `,`Enter`],z=`Select`,[B,V,pe]=u(z),[H,me]=s(z,[pe,x]),he=x(),[ge,U]=H(z),[_e,ve]=H(z),ye=e=>{let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:u,dir:d,name:f,autoComplete:p,disabled:g,required:_,form:v}=e,y=he(t),[b,x]=N.useState(null),[ee,S]=N.useState(null),[C,w]=N.useState(!1),T=h(d),[E,D]=c({prop:r,defaultProp:i??!1,onChange:a,caller:z}),[O,k]=c({prop:o,defaultProp:s,onChange:u,caller:z}),A=N.useRef(null),te=b?v||!!b.closest(`form`):!0,[ne,j]=N.useState(new Set),M=Array.from(ne).map(e=>e.props.value).join(`;`);return(0,P.jsx)(l,{...y,children:(0,P.jsxs)(ge,{required:_,scope:t,trigger:b,onTriggerChange:x,valueNode:ee,onValueNodeChange:S,valueNodeHasChildren:C,onValueNodeHasChildrenChange:w,contentId:m(),value:O,onValueChange:k,open:E,onOpenChange:D,dir:T,triggerPointerDownPosRef:A,disabled:g,children:[(0,P.jsx)(B.Provider,{scope:t,children:(0,P.jsx)(_e,{scope:e.__scopeSelect,onNativeOptionAdd:N.useCallback(e=>{j(t=>new Set(t).add(e))},[]),onNativeOptionRemove:N.useCallback(e=>{j(t=>{let n=new Set(t);return n.delete(e),n})},[]),children:n})}),te?(0,P.jsxs)(ut,{"aria-hidden":!0,required:_,tabIndex:-1,name:f,autoComplete:p,value:O,onChange:e=>k(e.target.value),disabled:g,form:v,children:[O===void 0?(0,P.jsx)(`option`,{value:``}):null,Array.from(ne)]},M):null]})})};ye.displayName=z;var be=`SelectTrigger`,xe=N.forwardRef((e,t)=>{let{__scopeSelect:r,disabled:i=!1,...a}=e,o=he(r),s=U(be,r),c=s.disabled||i,l=_(t,s.onTriggerChange),u=V(r),d=N.useRef(`touch`),[f,p,m]=ft(e=>{let t=u().filter(e=>!e.disabled),n=pt(t,e,t.find(e=>e.value===s.value));n!==void 0&&s.onValueChange(n.value)}),h=e=>{c||(s.onOpenChange(!0),m()),e&&(s.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,P.jsx)(b,{asChild:!0,...o,children:(0,P.jsx)(n.button,{type:`button`,role:`combobox`,"aria-controls":s.contentId,"aria-expanded":s.open,"aria-required":s.required,"aria-autocomplete":`none`,dir:s.dir,"data-state":s.open?`open`:`closed`,disabled:c,"data-disabled":c?``:void 0,"data-placeholder":dt(s.value)?``:void 0,...a,ref:l,onClick:D(a.onClick,e=>{e.currentTarget.focus(),d.current!==`mouse`&&h(e)}),onPointerDown:D(a.onPointerDown,e=>{d.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(h(e),e.preventDefault())}),onKeyDown:D(a.onKeyDown,e=>{let t=f.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&p(e.key),!(t&&e.key===` `)&&de.includes(e.key)&&(h(),e.preventDefault())})})})});xe.displayName=be;var Se=`SelectValue`,Ce=N.forwardRef((e,t)=>{let{__scopeSelect:r,className:i,style:a,children:o,placeholder:s=``,...c}=e,l=U(Se,r),{onValueNodeHasChildrenChange:u}=l,d=o!==void 0,f=_(t,l.onValueNodeChange);return E(()=>{u(d)},[u,d]),(0,P.jsx)(n.span,{...c,ref:f,style:{pointerEvents:`none`},children:dt(l.value)?(0,P.jsx)(P.Fragment,{children:s}):o})});Ce.displayName=Se;var we=`SelectIcon`,Te=N.forwardRef((e,t)=>{let{__scopeSelect:r,children:i,...a}=e;return(0,P.jsx)(n.span,{"aria-hidden":!0,...a,ref:t,children:i||`▼`})});Te.displayName=we;var Ee=`SelectPortal`,De=e=>(0,P.jsx)(f,{asChild:!0,...e});De.displayName=Ee;var W=`SelectContent`,Oe=N.forwardRef((e,t)=>{let n=U(W,e.__scopeSelect),[r,i]=N.useState();if(E(()=>{i(new DocumentFragment)},[]),!n.open){let t=r;return t?ue.createPortal((0,P.jsx)(ke,{scope:e.__scopeSelect,children:(0,P.jsx)(B.Slot,{scope:e.__scopeSelect,children:(0,P.jsx)(`div`,{children:e.children})})}),t):null}return(0,P.jsx)(Me,{...e,ref:t})});Oe.displayName=W;var G=10,[ke,K]=H(W),Ae=`SelectContentImpl`,je=r(`SelectContent.RemoveScroll`),Me=N.forwardRef((e,t)=>{let{__scopeSelect:n,position:r=`item-aligned`,onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:f,collisionBoundary:m,collisionPadding:h,sticky:g,hideWhenDetached:y,avoidCollisions:b,...x}=e,S=U(W,n),[C,w]=N.useState(null),[E,O]=N.useState(null),k=_(t,e=>w(e)),[A,te]=N.useState(null),[ne,j]=N.useState(null),M=V(n),[re,ie]=N.useState(!1),F=N.useRef(!1);N.useEffect(()=>{if(C)return d(C)},[C]),T();let ae=N.useCallback(e=>{let[t,...n]=M().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&E&&(E.scrollTop=0),n===r&&E&&(E.scrollTop=E.scrollHeight),n?.focus(),document.activeElement!==i))return},[M,E]),I=N.useCallback(()=>ae([A,C]),[ae,A,C]);N.useEffect(()=>{re&&I()},[re,I]);let{onOpenChange:L,triggerPointerDownPosRef:R}=S;N.useEffect(()=>{if(C){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(R.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(R.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():C.contains(n.target)||L(!1),document.removeEventListener(`pointermove`,t),R.current=null};return R.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[C,L,R]),N.useEffect(()=>{let e=()=>L(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[L]);let[oe,se]=ft(e=>{let t=M().filter(e=>!e.disabled),n=pt(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current.focus())}),ce=N.useCallback((e,t,n)=>{let r=!F.current&&!n;(S.value!==void 0&&S.value===t||r)&&(te(e),r&&(F.current=!0))},[S.value]),le=N.useCallback(()=>C?.focus(),[C]),ue=N.useCallback((e,t,n)=>{let r=!F.current&&!n;(S.value!==void 0&&S.value===t||r)&&j(e)},[S.value]),de=r===`popper`?Ie:Pe,fe=de===Ie?{side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:f,collisionBoundary:m,collisionPadding:h,sticky:g,hideWhenDetached:y,avoidCollisions:b}:{};return(0,P.jsx)(ke,{scope:n,content:C,viewport:E,onViewportChange:O,itemRefCallback:ce,selectedItem:A,onItemLeave:le,itemTextRefCallback:ue,focusSelectedItem:I,selectedItemText:ne,position:r,isPositioned:re,searchRef:oe,children:(0,P.jsx)(v,{as:je,allowPinchZoom:!0,children:(0,P.jsx)(p,{asChild:!0,trapped:S.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:D(i,e=>{S.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,P.jsx)(ee,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>S.onOpenChange(!1),children:(0,P.jsx)(de,{role:`listbox`,id:S.contentId,"data-state":S.open?`open`:`closed`,dir:S.dir,onContextMenu:e=>e.preventDefault(),...x,...fe,onPlaced:()=>ie(!0),ref:k,style:{display:`flex`,flexDirection:`column`,outline:`none`,...x.style},onKeyDown:D(x.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&se(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=M().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>ae(t)),e.preventDefault()}})})})})})})});Me.displayName=Ae;var Ne=`SelectItemAlignedPosition`,Pe=N.forwardRef((e,t)=>{let{__scopeSelect:r,onPlaced:i,...a}=e,o=U(W,r),s=K(W,r),[c,l]=N.useState(null),[u,d]=N.useState(null),f=_(t,e=>d(e)),p=V(r),m=N.useRef(!1),h=N.useRef(!0),{viewport:g,selectedItem:v,selectedItemText:y,focusSelectedItem:b}=s,x=N.useCallback(()=>{if(o.trigger&&o.valueNode&&c&&u&&g&&v&&y){let e=o.trigger.getBoundingClientRect(),t=u.getBoundingClientRect(),n=o.valueNode.getBoundingClientRect(),r=y.getBoundingClientRect();if(o.dir!==`rtl`){let i=r.left-t.left,a=n.left-i,o=e.left-a,s=e.width+o,l=Math.max(s,t.width),u=window.innerWidth-G,d=le(a,[G,Math.max(G,u-l)]);c.style.minWidth=s+`px`,c.style.left=d+`px`}else{let i=t.right-r.right,a=window.innerWidth-n.right-i,o=window.innerWidth-e.right-a,s=e.width+o,l=Math.max(s,t.width),u=window.innerWidth-G,d=le(a,[G,Math.max(G,u-l)]);c.style.minWidth=s+`px`,c.style.right=d+`px`}let a=p(),s=window.innerHeight-G*2,l=g.scrollHeight,d=window.getComputedStyle(u),f=parseInt(d.borderTopWidth,10),h=parseInt(d.paddingTop,10),_=parseInt(d.borderBottomWidth,10),b=parseInt(d.paddingBottom,10),x=f+h+l+b+_,ee=Math.min(v.offsetHeight*5,x),S=window.getComputedStyle(g),C=parseInt(S.paddingTop,10),w=parseInt(S.paddingBottom,10),T=e.top+e.height/2-G,E=s-T,D=v.offsetHeight/2,O=v.offsetTop+D,k=f+h+O,A=x-k;if(k<=T){let e=a.length>0&&v===a[a.length-1].ref.current;c.style.bottom=`0px`;let t=u.clientHeight-g.offsetTop-g.offsetHeight,n=k+Math.max(E,D+(e?w:0)+t+_);c.style.height=n+`px`}else{let e=a.length>0&&v===a[0].ref.current;c.style.top=`0px`;let t=Math.max(T,f+g.offsetTop+(e?C:0)+D)+A;c.style.height=t+`px`,g.scrollTop=k-T+g.offsetTop}c.style.margin=`${G}px 0`,c.style.minHeight=ee+`px`,c.style.maxHeight=s+`px`,i?.(),requestAnimationFrame(()=>m.current=!0)}},[p,o.trigger,o.valueNode,c,u,g,v,y,o.dir,i]);E(()=>x(),[x]);let[ee,S]=N.useState();return E(()=>{u&&S(window.getComputedStyle(u).zIndex)},[u]),(0,P.jsx)(Le,{scope:r,contentWrapper:c,shouldExpandOnScrollRef:m,onScrollButtonChange:N.useCallback(e=>{e&&h.current===!0&&(x(),b?.(),h.current=!1)},[x,b]),children:(0,P.jsx)(`div`,{ref:l,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:ee},children:(0,P.jsx)(n.div,{...a,ref:f,style:{boxSizing:`border-box`,maxHeight:`100%`,...a.style}})})})});Pe.displayName=Ne;var Fe=`SelectPopperPosition`,Ie=N.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=G,...a}=e,o=he(n);return(0,P.jsx)(g,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})});Ie.displayName=Fe;var[Le,Re]=H(W,{}),ze=`SelectViewport`,Be=N.forwardRef((e,t)=>{let{__scopeSelect:r,nonce:i,...a}=e,o=K(ze,r),s=Re(ze,r),c=_(t,o.onViewportChange),l=N.useRef(0);return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:i}),(0,P.jsx)(B.Slot,{scope:r,children:(0,P.jsx)(n.div,{"data-radix-select-viewport":``,role:`presentation`,...a,ref:c,style:{position:`relative`,flex:1,overflow:`hidden auto`,...a.style},onScroll:D(a.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=s;if(r?.current&&n){let e=Math.abs(l.current-t.scrollTop);if(e>0){let r=window.innerHeight-G*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}l.current=t.scrollTop})})})]})});Be.displayName=ze;var Ve=`SelectGroup`,[He,Ue]=H(Ve),We=N.forwardRef((e,t)=>{let{__scopeSelect:r,...i}=e,a=m();return(0,P.jsx)(He,{scope:r,id:a,children:(0,P.jsx)(n.div,{role:`group`,"aria-labelledby":a,...i,ref:t})})});We.displayName=Ve;var Ge=`SelectLabel`,Ke=N.forwardRef((e,t)=>{let{__scopeSelect:r,...i}=e,a=Ue(Ge,r);return(0,P.jsx)(n.div,{id:a.id,...i,ref:t})});Ke.displayName=Ge;var qe=`SelectItem`,[Je,Ye]=H(qe),Xe=N.forwardRef((e,t)=>{let{__scopeSelect:r,value:i,disabled:a=!1,textValue:o,...s}=e,c=U(qe,r),l=K(qe,r),u=c.value===i,[d,f]=N.useState(o??``),[p,h]=N.useState(!1),g=_(t,e=>l.itemRefCallback?.(e,i,a)),v=m(),y=N.useRef(`touch`),b=()=>{a||(c.onValueChange(i),c.onOpenChange(!1))};if(i===``)throw Error(`A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.`);return(0,P.jsx)(Je,{scope:r,value:i,disabled:a,textId:v,isSelected:u,onItemTextChange:N.useCallback(e=>{f(t=>t||(e?.textContent??``).trim())},[]),children:(0,P.jsx)(B.ItemSlot,{scope:r,value:i,disabled:a,textValue:d,children:(0,P.jsx)(n.div,{role:`option`,"aria-labelledby":v,"data-highlighted":p?``:void 0,"aria-selected":u&&p,"data-state":u?`checked`:`unchecked`,"aria-disabled":a||void 0,"data-disabled":a?``:void 0,tabIndex:a?void 0:-1,...s,ref:g,onFocus:D(s.onFocus,()=>h(!0)),onBlur:D(s.onBlur,()=>h(!1)),onClick:D(s.onClick,()=>{y.current!==`mouse`&&b()}),onPointerUp:D(s.onPointerUp,()=>{y.current===`mouse`&&b()}),onPointerDown:D(s.onPointerDown,e=>{y.current=e.pointerType}),onPointerMove:D(s.onPointerMove,e=>{y.current=e.pointerType,a?l.onItemLeave?.():y.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:D(s.onPointerLeave,e=>{e.currentTarget===document.activeElement&&l.onItemLeave?.()}),onKeyDown:D(s.onKeyDown,e=>{l.searchRef?.current!==``&&e.key===` `||(fe.includes(e.key)&&b(),e.key===` `&&e.preventDefault())})})})})});Xe.displayName=qe;var q=`SelectItemText`,Ze=N.forwardRef((e,t)=>{let{__scopeSelect:r,className:i,style:a,...o}=e,s=U(q,r),c=K(q,r),l=Ye(q,r),u=ve(q,r),[d,f]=N.useState(null),p=_(t,e=>f(e),l.onItemTextChange,e=>c.itemTextRefCallback?.(e,l.value,l.disabled)),m=d?.textContent,h=N.useMemo(()=>(0,P.jsx)(`option`,{value:l.value,disabled:l.disabled,children:m},l.value),[l.disabled,l.value,m]),{onNativeOptionAdd:g,onNativeOptionRemove:v}=u;return E(()=>(g(h),()=>v(h)),[g,v,h]),(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(n.span,{id:l.textId,...o,ref:p}),l.isSelected&&s.valueNode&&!s.valueNodeHasChildren?ue.createPortal(o.children,s.valueNode):null]})});Ze.displayName=q;var Qe=`SelectItemIndicator`,$e=N.forwardRef((e,t)=>{let{__scopeSelect:r,...i}=e;return Ye(Qe,r).isSelected?(0,P.jsx)(n.span,{"aria-hidden":!0,...i,ref:t}):null});$e.displayName=Qe;var et=`SelectScrollUpButton`,tt=N.forwardRef((e,t)=>{let n=K(et,e.__scopeSelect),r=Re(et,e.__scopeSelect),[i,a]=N.useState(!1),o=_(t,r.onScrollButtonChange);return E(()=>{if(n.viewport&&n.isPositioned){let e=function(){a(t.scrollTop>0)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,P.jsx)(it,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});tt.displayName=et;var nt=`SelectScrollDownButton`,rt=N.forwardRef((e,t)=>{let n=K(nt,e.__scopeSelect),r=Re(nt,e.__scopeSelect),[i,a]=N.useState(!1),o=_(t,r.onScrollButtonChange);return E(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight;a(Math.ceil(t.scrollTop)<e)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,P.jsx)(it,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});rt.displayName=nt;var it=N.forwardRef((e,t)=>{let{__scopeSelect:r,onAutoScroll:i,...a}=e,o=K(`SelectScrollButton`,r),s=N.useRef(null),c=V(r),l=N.useCallback(()=>{s.current!==null&&(window.clearInterval(s.current),s.current=null)},[]);return N.useEffect(()=>()=>l(),[l]),E(()=>{c().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[c]),(0,P.jsx)(n.div,{"aria-hidden":!0,...a,ref:t,style:{flexShrink:0,...a.style},onPointerDown:D(a.onPointerDown,()=>{s.current===null&&(s.current=window.setInterval(i,50))}),onPointerMove:D(a.onPointerMove,()=>{o.onItemLeave?.(),s.current===null&&(s.current=window.setInterval(i,50))}),onPointerLeave:D(a.onPointerLeave,()=>{l()})})}),at=`SelectSeparator`,ot=N.forwardRef((e,t)=>{let{__scopeSelect:r,...i}=e;return(0,P.jsx)(n.div,{"aria-hidden":!0,...i,ref:t})});ot.displayName=at;var st=`SelectArrow`,ct=N.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=he(n),a=U(st,n),o=K(st,n);return a.open&&o.position===`popper`?(0,P.jsx)(S,{...i,...r,ref:t}):null});ct.displayName=st;var lt=`SelectBubbleInput`,ut=N.forwardRef(({__scopeSelect:e,value:t,...r},i)=>{let a=N.useRef(null),o=_(i,a),s=R(t);return N.useEffect(()=>{let e=a.current;if(!e)return;let n=window.HTMLSelectElement.prototype,r=Object.getOwnPropertyDescriptor(n,`value`).set;if(s!==t&&r){let n=new Event(`change`,{bubbles:!0});r.call(e,t),e.dispatchEvent(n)}},[s,t]),(0,P.jsx)(n.select,{...r,style:{...F,...r.style},ref:o,defaultValue:t})});ut.displayName=lt;function dt(e){return e===``||e===void 0}function ft(e){let t=y(e),n=N.useRef(``),r=N.useRef(0),i=N.useCallback(e=>{let i=n.current+e;t(i),(function e(t){n.current=t,window.clearTimeout(r.current),t!==``&&(r.current=window.setTimeout(()=>e(``),1e3))})(i)},[t]),a=N.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return N.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function pt(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=mt(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function mt(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var ht=ye,gt=xe,_t=Ce,vt=Te,yt=De,bt=Oe,xt=Be,St=Xe,Ct=Ze,wt=$e,Tt=tt,Et=rt,Dt=`Switch`,[Ot,kt]=s(Dt),[At,jt]=Ot(Dt),Mt=N.forwardRef((e,t)=>{let{__scopeSwitch:r,name:i,checked:a,defaultChecked:o,required:s,disabled:l,value:u=`on`,onCheckedChange:d,form:f,...p}=e,[m,h]=N.useState(null),g=_(t,e=>h(e)),v=N.useRef(!1),y=m?f||!!m.closest(`form`):!0,[b,x]=c({prop:a,defaultProp:o??!1,onChange:d,caller:Dt});return(0,P.jsxs)(At,{scope:r,checked:b,disabled:l,children:[(0,P.jsx)(n.button,{type:`button`,role:`switch`,"aria-checked":b,"aria-required":s,"data-state":Lt(b),"data-disabled":l?``:void 0,disabled:l,value:u,...p,ref:g,onClick:D(e.onClick,e=>{x(e=>!e),y&&(v.current=e.isPropagationStopped(),v.current||e.stopPropagation())})}),y&&(0,P.jsx)(It,{control:m,bubbles:!v.current,name:i,value:u,checked:b,required:s,disabled:l,form:f,style:{transform:`translateX(-100%)`}})]})});Mt.displayName=Dt;var Nt=`SwitchThumb`,Pt=N.forwardRef((e,t)=>{let{__scopeSwitch:r,...i}=e,a=jt(Nt,r);return(0,P.jsx)(n.span,{"data-state":Lt(a.checked),"data-disabled":a.disabled?``:void 0,...i,ref:t})});Pt.displayName=Nt;var Ft=`SwitchBubbleInput`,It=N.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:r=!0,...i},a)=>{let o=N.useRef(null),s=_(o,a),c=R(n),l=C(t);return N.useEffect(()=>{let e=o.current;if(!e)return;let t=window.HTMLInputElement.prototype,i=Object.getOwnPropertyDescriptor(t,`checked`).set;if(c!==n&&i){let t=new Event(`click`,{bubbles:r});i.call(e,n),e.dispatchEvent(t)}},[c,n,r]),(0,P.jsx)(`input`,{type:`checkbox`,"aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:s,style:{...i.style,...l,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0}})});It.displayName=Ft;function Lt(e){return e?`checked`:`unchecked`}var Rt=Mt,zt=Pt;function J({className:e,...t}){return(0,P.jsx)(ce,{"data-slot":`label`,className:A(`flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,e),...t})}function Y({...e}){return(0,P.jsx)(ht,{"data-slot":`select`,...e})}function X({...e}){return(0,P.jsx)(_t,{"data-slot":`select-value`,...e})}function Z({className:e,size:t=`default`,children:n,...r}){return(0,P.jsxs)(gt,{"data-slot":`select-trigger`,"data-size":t,className:A(`flex w-fit items-center justify-between gap-2 rounded-md border border-input bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[placeholder]:text-muted-foreground data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground`,e),...r,children:[n,(0,P.jsx)(vt,{asChild:!0,children:(0,P.jsx)(i,{className:`size-4 opacity-50`})})]})}function Q({className:e,children:t,position:n=`item-aligned`,align:r=`center`,...i}){return(0,P.jsx)(yt,{children:(0,P.jsxs)(bt,{"data-slot":`select-content`,className:A(`relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover text-popover-foreground shadow-md data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95`,n===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,e),position:n,align:r,...i,children:[(0,P.jsx)(Bt,{}),(0,P.jsx)(xt,{className:A(`p-1`,n===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1`),children:t}),(0,P.jsx)(Vt,{})]})})}function $({className:e,children:t,...n}){return(0,P.jsxs)(St,{"data-slot":`select-item`,className:A(`relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,e),...n,children:[(0,P.jsx)(`span`,{"data-slot":`select-item-indicator`,className:`absolute right-2 flex size-3.5 items-center justify-center`,children:(0,P.jsx)(wt,{children:(0,P.jsx)(a,{className:`size-4`})})}),(0,P.jsx)(Ct,{children:t})]})}function Bt({className:e,...t}){return(0,P.jsx)(Tt,{"data-slot":`select-scroll-up-button`,className:A(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,P.jsx)(M,{className:`size-4`})})}function Vt({className:e,...t}){return(0,P.jsx)(Et,{"data-slot":`select-scroll-down-button`,className:A(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,P.jsx)(i,{className:`size-4`})})}var Ht=[{value:`sdk`,label:`SDK (native)`},{value:`cli`,label:`CLI (claude command)`}],Ut=[{value:`claude-sonnet-4-6`,label:`Claude Sonnet 4.6`},{value:`claude-opus-4-6`,label:`Claude Opus 4.6`},{value:`claude-haiku-4-5`,label:`Claude Haiku 4.5`}],Wt=[{value:`low`,label:`Low`},{value:`medium`,label:`Medium`},{value:`high`,label:`High`}],Gt=[{value:`bypassPermissions`,label:`Bypass permissions (default)`},{value:`default`,label:`Ask before edits`},{value:`acceptEdits`,label:`Edit automatically`},{value:`plan`,label:`Plan mode`}];function Kt({compact:e}={}){let[t,n]=(0,N.useState)(null),[r,i]=(0,N.useState)(!1),[a,o]=(0,N.useState)(null),[s,c]=(0,N.useState)(0);(0,N.useEffect)(()=>{te().then(n).catch(e=>o(e.message))},[]);let l=t?.default_provider??`claude`,u=t?.providers[l],d=async(e,r)=>{if(t){i(!0),o(null);try{n(await ne({providers:{[l]:{[e]:r}}})),c(e=>e+1)}catch(e){o(e.message)}finally{i(!1)}}},f=e?`text-[11px]`:`text-sm`,p=e?`text-xs`:`text-sm`,m=e?`space-y-2`:`space-y-4`,h=e?`space-y-1.5`:`space-y-3`,g=e?`space-y-1`:`space-y-1.5`;return t?(0,P.jsxs)(`div`,{className:m,children:[(0,P.jsx)(`h3`,{className:`${p} font-medium text-text-secondary`,children:`AI Provider`}),(0,P.jsxs)(`div`,{className:h,children:[(0,P.jsxs)(`div`,{className:g,children:[(0,P.jsx)(J,{htmlFor:`ai-execution-mode`,className:e?f:void 0,children:`Execution Mode`}),(0,P.jsxs)(Y,{value:u?.execution_mode??`sdk`,onValueChange:e=>d(`execution_mode`,e),children:[(0,P.jsx)(Z,{id:`ai-execution-mode`,className:`w-full ${e?`h-7 text-[11px]`:``}`,children:(0,P.jsx)(X,{})}),(0,P.jsx)(Q,{children:Ht.map(e=>(0,P.jsx)($,{value:e.value,children:e.label},e.value))})]})]}),(0,P.jsxs)(`div`,{className:g,children:[(0,P.jsx)(J,{htmlFor:`ai-model`,className:e?f:void 0,children:`Model`}),(0,P.jsxs)(Y,{value:u?.model??`claude-sonnet-4-6`,onValueChange:e=>d(`model`,e),children:[(0,P.jsx)(Z,{id:`ai-model`,className:`w-full ${e?`h-7 text-[11px]`:``}`,children:(0,P.jsx)(X,{})}),(0,P.jsx)(Q,{children:Ut.map(e=>(0,P.jsx)($,{value:e.value,children:e.label},e.value))})]})]}),(0,P.jsxs)(`div`,{className:g,children:[(0,P.jsx)(J,{htmlFor:`ai-base-url`,className:e?f:void 0,children:`Base URL`}),(0,P.jsx)(w,{id:`ai-base-url`,type:`url`,defaultValue:u?.base_url??``,placeholder:`https://api.anthropic.com (default)`,className:e?`h-7 text-[11px]`:void 0,onBlur:e=>{d(`base_url`,e.target.value.trim()||void 0)}},`baseurl-${s}`)]}),(0,P.jsxs)(`div`,{className:g,children:[(0,P.jsx)(J,{htmlFor:`ai-effort`,className:e?f:void 0,children:`Effort`}),(0,P.jsxs)(Y,{value:u?.effort??`high`,onValueChange:e=>d(`effort`,e),children:[(0,P.jsx)(Z,{id:`ai-effort`,className:`w-full ${e?`h-7 text-[11px]`:``}`,children:(0,P.jsx)(X,{})}),(0,P.jsx)(Q,{children:Wt.map(e=>(0,P.jsx)($,{value:e.value,children:e.label},e.value))})]})]}),(0,P.jsxs)(`div`,{className:g,children:[(0,P.jsx)(J,{htmlFor:`ai-max-turns`,className:e?f:void 0,children:`Max Turns (1-500)`}),(0,P.jsx)(w,{id:`ai-max-turns`,type:`number`,min:1,max:500,defaultValue:u?.max_turns??100,className:e?`h-7 text-[11px]`:void 0,onBlur:e=>{let t=parseInt(e.target.value);isNaN(t)||d(`max_turns`,t)}},`turns-${s}`)]}),(0,P.jsxs)(`div`,{className:g,children:[(0,P.jsx)(J,{htmlFor:`ai-budget`,className:e?f:void 0,children:`Max Budget (USD)`}),(0,P.jsx)(w,{id:`ai-budget`,type:`number`,step:.1,min:.01,max:50,defaultValue:u?.max_budget_usd??``,placeholder:`No limit`,className:e?`h-7 text-[11px]`:void 0,onBlur:e=>{let t=parseFloat(e.target.value);d(`max_budget_usd`,isNaN(t)?void 0:t)}},`budget-${s}`)]}),(0,P.jsxs)(`div`,{className:g,children:[(0,P.jsx)(J,{htmlFor:`ai-thinking`,className:e?f:void 0,children:`Thinking Budget (tokens)`}),(0,P.jsx)(w,{id:`ai-thinking`,type:`number`,min:0,defaultValue:u?.thinking_budget_tokens??``,placeholder:`Disabled`,className:e?`h-7 text-[11px]`:void 0,onBlur:e=>{let t=parseInt(e.target.value);d(`thinking_budget_tokens`,isNaN(t)?void 0:t)}},`thinking-${s}`)]}),(0,P.jsxs)(`div`,{className:g,children:[(0,P.jsx)(J,{htmlFor:`ai-permission-mode`,className:e?f:void 0,children:`Default Permission Mode`}),(0,P.jsxs)(Y,{value:u?.permission_mode??`bypassPermissions`,onValueChange:e=>d(`permission_mode`,e),children:[(0,P.jsx)(Z,{id:`ai-permission-mode`,className:`w-full ${e?`h-7 text-[11px]`:``}`,children:(0,P.jsx)(X,{})}),(0,P.jsx)(Q,{children:Gt.map(e=>(0,P.jsx)($,{value:e.value,children:e.label},e.value))})]})]}),(0,P.jsxs)(`div`,{className:g,children:[(0,P.jsx)(J,{htmlFor:`ai-system-prompt`,className:e?f:void 0,children:`Additional Instructions`}),(0,P.jsx)(`textarea`,{id:`ai-system-prompt`,rows:4,defaultValue:u?.system_prompt??``,placeholder:`Enter additional instructions for Claude...`,className:`w-full rounded-md border border-input bg-background px-3 py-2 ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 ${e?`text-[11px]`:`text-sm`}`,onBlur:e=>{d(`system_prompt`,e.target.value.trim()||void 0)}},`sysprompt-${s}`)]})]}),r&&(0,P.jsx)(`p`,{className:`text-xs text-text-subtle`,children:`Saving...`}),a&&(0,P.jsx)(`p`,{className:`text-xs text-red-500`,children:a})]}):(0,P.jsxs)(`div`,{className:h,children:[(0,P.jsx)(`h3`,{className:`${p} font-medium text-text-secondary`,children:`AI Provider`}),(0,P.jsx)(`p`,{className:`${f} text-text-subtle`,children:a?`Error: ${a}`:`Loading...`})]})}var qt=N.forwardRef(({className:e,...t},n)=>(0,P.jsx)(Rt,{className:A(`peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input`,e),...t,ref:n,children:(0,P.jsx)(zt,{className:A(`pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0`)})}));qt.displayName=Rt.displayName;export{$ as a,J as c,ie as d,re as f,Q as i,le as l,j as m,Kt as n,Z as o,M as p,Y as r,X as s,qt as t,L as u};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as e,t}from"./react-CYzKIDNi.js";import{t as n}from"./jsx-runtime-wQxeESYQ.js";import{n as r}from"./settings-store-
|
|
1
|
+
import{i as e,t}from"./react-CYzKIDNi.js";import{t as n}from"./jsx-runtime-wQxeESYQ.js";import{n as r}from"./settings-store-xG6mKqkD.js";import{n as i}from"./utils-DC-bdPS3.js";import{L as a,R as o}from"./index-Bu8-Nf_9.js";var s=e(t(),1),c=Object.defineProperty,l=Object.getOwnPropertyDescriptor,u=(e,t)=>{for(var n in t)c(e,n,{get:t[n],enumerable:!0})},d=(e,t,n,r)=>{for(var i=r>1?void 0:r?l(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&c(t,n,i),i},f=(e,t)=>(n,r)=>t(n,r,e),p=`Terminal input`,m={get:()=>p,set:e=>p=e},h=`Too much output to announce, navigate to rows manually to read`,g={get:()=>h,set:e=>h=e};function _(e){return e.replace(/\r?\n/g,`\r`)}function v(e,t){return t?`\x1B[200~`+e+`\x1B[201~`:e}function ee(e,t){e.clipboardData&&e.clipboardData.setData(`text/plain`,t.selectionText),e.preventDefault()}function te(e,t,n,r){e.stopPropagation(),e.clipboardData&&ne(e.clipboardData.getData(`text/plain`),t,n,r)}function ne(e,t,n,r){e=_(e),e=v(e,n.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=``}function re(e,t,n){let r=n.getBoundingClientRect(),i=e.clientX-r.left-10,a=e.clientY-r.top-10;t.style.width=`20px`,t.style.height=`20px`,t.style.left=`${i}px`,t.style.top=`${a}px`,t.style.zIndex=`1000`,t.focus()}function ie(e,t,n,r,i){re(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function y(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function ae(e,t=0,n=e.length){let r=``;for(let i=t;i<n;++i){let t=e[i];t>65535?(t-=65536,r+=String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):r+=String.fromCharCode(t)}return r}var oe=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i=0;if(this._interim){let n=e.charCodeAt(i++);56320<=n&&n<=57343?t[r++]=(this._interim-55296)*1024+n-56320+65536:(t[r++]=this._interim,t[r++]=n),this._interim=0}for(let a=i;a<n;++a){let i=e.charCodeAt(a);if(55296<=i&&i<=56319){if(++a>=n)return this._interim=i,r;let o=e.charCodeAt(a);56320<=o&&o<=57343?t[r++]=(i-55296)*1024+o-56320+65536:(t[r++]=i,t[r++]=o);continue}i!==65279&&(t[r++]=i)}return r}},b=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i,a,o,s,c=0,l=0;if(this.interim[0]){let i=!1,a=this.interim[0];a&=(a&224)==192?31:(a&240)==224?15:7;let o=0,s;for(;(s=this.interim[++o]&63)&&o<4;)a<<=6,a|=s;let c=(this.interim[0]&224)==192?2:(this.interim[0]&240)==224?3:4,u=c-o;for(;l<u;){if(l>=n)return 0;if(s=e[l++],(s&192)!=128){l--,i=!0;break}else this.interim[o++]=s,a<<=6,a|=s&63}i||(c===2?a<128?l--:t[r++]=a:c===3?a<2048||a>=55296&&a<=57343||a===65279||(t[r++]=a):a<65536||a>1114111||(t[r++]=a)),this.interim.fill(0)}let u=n-4,d=l;for(;d<n;){for(;d<u&&!((i=e[d])&128)&&!((a=e[d+1])&128)&&!((o=e[d+2])&128)&&!((s=e[d+3])&128);)t[r++]=i,t[r++]=a,t[r++]=o,t[r++]=s,d+=4;if(i=e[d++],i<128)t[r++]=i;else if((i&224)==192){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(c=(i&31)<<6|a&63,c<128){d--;continue}t[r++]=c}else if((i&240)==224){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(c=(i&15)<<12|(a&63)<<6|o&63,c<2048||c>=55296&&c<=57343||c===65279)continue;t[r++]=c}else if((i&248)==240){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,this.interim[2]=o,r;if(s=e[d++],(s&192)!=128){d--;continue}if(c=(i&7)<<18|(a&63)<<12|(o&63)<<6|s&63,c<65536||c>1114111)continue;t[r++]=c}}return r}},se=``,ce=` `,le=class e{constructor(){this.fg=0,this.bg=0,this.extended=new x}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let t=new e;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)==50331648}isBgRGB(){return(this.bg&50331648)==50331648}isFgPalette(){return(this.fg&50331648)==16777216||(this.fg&50331648)==33554432}isBgPalette(){return(this.bg&50331648)==16777216||(this.bg&50331648)==33554432}isFgDefault(){return(this.fg&50331648)==0}isBgDefault(){return(this.bg&50331648)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==16777216||(this.extended.underlineColor&50331648)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},x=class e{constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new e(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},S=class e extends le{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new x,this.combinedData=``}static fromCharData(t){let n=new e;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?y(this.content&2097151):``}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let t=!1;if(e[1].length>2)t=!0;else if(e[1].length===2){let n=e[1].charCodeAt(0);if(55296<=n&&n<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(n-55296)*1024+r-56320+65536|e[2]<<22:t=!0}else t=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;t&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},ue=`di$target`,de=`di$dependencies`,C=new Map;function fe(e){return e[de]||[]}function w(e){if(C.has(e))return C.get(e);let t=function(e,n,r){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);pe(t,e,r)};return t._id=e,C.set(e,t),t}function pe(e,t,n){t[ue]===t?t[de].push({id:e,index:n}):(t[de]=[{id:e,index:n}],t[ue]=t)}var T=w(`BufferService`),me=w(`CoreMouseService`),E=w(`CoreService`),he=w(`CharsetService`),ge=w(`InstantiationService`),_e=w(`LogService`),D=w(`OptionsService`),ve=w(`OscLinkService`),ye=w(`UnicodeService`),be=w(`DecorationService`),xe=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let r=[],i=this._optionsService.rawOptions.linkHandler,a=new S,o=n.getTrimmedLength(),s=-1,c=-1,l=!1;for(let t=0;t<o;t++)if(!(c===-1&&!n.hasContent(t))){if(n.loadCell(t,a),a.hasExtendedAttrs()&&a.extended.urlId)if(c===-1){c=t,s=a.extended.urlId;continue}else l=a.extended.urlId!==s;else c!==-1&&(l=!0);if(l||c!==-1&&t===o-1){let n=this._oscLinkService.getLinkData(s)?.uri;if(n){let a={start:{x:c+1,y:e},end:{x:t+(!l&&t===o-1?1:0),y:e}},s=!1;if(!i?.allowNonHttpProtocols)try{let e=new URL(n);[`http:`,`https:`].includes(e.protocol)||(s=!0)}catch{s=!0}s||r.push({text:n,range:a,activate:(e,t)=>i?i.activate(e,t,a):Se(e,t),hover:(e,t)=>i?.hover?.(e,t,a),leave:(e,t)=>i?.leave?.(e,t,a)})}l=!1,a.hasExtendedAttrs()&&a.extended.urlId?(c=t,s=a.extended.urlId):(c=-1,s=-1)}}t(r)}};xe=d([f(0,T),f(1,D),f(2,ve)],xe);function Se(e,t){if(confirm(`Do you want to navigate to ${t}?
|
|
2
2
|
|
|
3
3
|
WARNING: This link could potentially be dangerous`)){let e=window.open();if(e){try{e.opener=null}catch{}e.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}}var Ce=w(`CharSizeService`),we=w(`CoreBrowserService`),Te=w(`MouseService`),Ee=w(`RenderService`),De=w(`SelectionService`),Oe=w(`CharacterJoinerService`),ke=w(`ThemeService`),Ae=w(`LinkProviderService`),je=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?Le.isErrorNoTelemetry(e)?new Le(e.message+`
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as e,t}from"./react-CYzKIDNi.js";import{n}from"./settings-store-
|
|
1
|
+
import{i as e,t}from"./react-CYzKIDNi.js";import{n}from"./settings-store-xG6mKqkD.js";function r(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function i(e){if(Array.isArray(e))return e}function a(e,t,n){return(t=m(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t!==0)for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function s(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
2
2
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function c(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 l(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?c(Object(n),!0).forEach(function(t){a(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):c(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function u(e,t){if(e==null)return{};var n,r,i=d(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function d(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}function f(e,t){return i(e)||o(e,t)||h(e,t)||s()}function p(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function m(e){var t=p(e,`string`);return typeof t==`symbol`?t:t+``}function h(e,t){if(e){if(typeof e==`string`)return r(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(e,t):void 0}}function g(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _(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 v(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?_(Object(n),!0).forEach(function(t){g(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function y(){var e=[...arguments];return function(t){return e.reduceRight(function(e,t){return t(e)},t)}}function b(e){return function t(){var n=this,r=[...arguments];return r.length>=e.length?e.apply(this,r):function(){var e=[...arguments];return t.apply(n,[].concat(r,e))}}}function x(e){return{}.toString.call(e).includes(`Object`)}function S(e){return!Object.keys(e).length}function C(e){return typeof e==`function`}function w(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function T(e,t){return x(t)||A(`changeType`),Object.keys(t).some(function(t){return!w(e,t)})&&A(`changeField`),t}function E(e){C(e)||A(`selectorType`)}function D(e){C(e)||x(e)||A(`handlerType`),x(e)&&Object.values(e).some(function(e){return!C(e)})&&A(`handlersType`)}function O(e){e||A(`initialIsRequired`),x(e)||A(`initialType`),S(e)&&A(`initialContent`)}function k(e,t){throw Error(e[t]||e.default)}var A=b(k)({initialIsRequired:`initial state is required`,initialType:`initial state should be an object`,initialContent:`initial state shouldn't be an empty object`,handlerType:`handler should be an object or a function`,handlersType:`all handlers should be a functions`,selectorType:`selector should be a function`,changeType:`provided value of changes should be an object`,changeField:`it seams you want to change a field in the state which is not specified in the "initial" state`,default:"an unknown error accured in `state-local` package"}),j={changes:T,selector:E,handler:D,initial:O};function ee(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};j.initial(e),j.handler(t);var n={current:e},r=b(P)(n,t),i=b(N)(n),a=b(j.changes)(e),o=b(M)(n);function s(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(e){return e};return j.selector(e),e(n.current)}function c(e){y(r,i,a,o)(e)}return[s,c]}function M(e,t){return C(t)?t(e.current):t}function N(e,t){return e.current=v(v({},e.current),t),t}function P(e,t,n){return C(t)?t(e.current):Object.keys(n).forEach(function(n){return t[n]?.call(t,e.current[n])}),n}var F={create:ee},te={paths:{vs:`https://cdn.jsdelivr.net/npm/monaco-editor@0.55.1/min/vs`}};function ne(e){return function t(){var n=this,r=[...arguments];return r.length>=e.length?e.apply(this,r):function(){var e=[...arguments];return t.apply(n,[].concat(r,e))}}}function re(e){return{}.toString.call(e).includes(`Object`)}function ie(e){return e||L(`configIsRequired`),re(e)||L(`configType`),e.urls?(ae(),{paths:{vs:e.urls.monacoBase}}):e}function ae(){console.warn(I.deprecation)}function oe(e,t){throw Error(e[t]||e.default)}var I={configIsRequired:`the configuration object is required`,configType:`the configuration object should be an object`,default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:`Deprecation warning!
|
|
3
3
|
You are using deprecated way of configuration.
|
|
4
4
|
|
package/dist/web/index.html
CHANGED
|
@@ -39,16 +39,17 @@
|
|
|
39
39
|
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
40
40
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
41
41
|
<link href="https://fonts.googleapis.com/css2?family=Geist+Mono:wght@400;500;600;700&family=Geist:wght@400;500;600;700&display=swap" rel="stylesheet" />
|
|
42
|
-
<script type="module" crossorigin src="/assets/index-
|
|
42
|
+
<script type="module" crossorigin src="/assets/index-Bu8-Nf_9.js"></script>
|
|
43
43
|
<link rel="modulepreload" crossorigin href="/assets/react-CYzKIDNi.js">
|
|
44
|
+
<link rel="modulepreload" crossorigin href="/assets/react-rgzL83kk.js">
|
|
45
|
+
<link rel="modulepreload" crossorigin href="/assets/settings-store-xG6mKqkD.js">
|
|
44
46
|
<link rel="modulepreload" crossorigin href="/assets/utils-DC-bdPS3.js">
|
|
45
47
|
<link rel="modulepreload" crossorigin href="/assets/jsx-runtime-wQxeESYQ.js">
|
|
46
48
|
<link rel="modulepreload" crossorigin href="/assets/input-CE3bFwLk.js">
|
|
47
49
|
<link rel="modulepreload" crossorigin href="/assets/api-client-TUmacMRS.js">
|
|
48
|
-
<link rel="modulepreload" crossorigin href="/assets/
|
|
49
|
-
<link rel="modulepreload" crossorigin href="/assets/
|
|
50
|
+
<link rel="modulepreload" crossorigin href="/assets/api-settings-CaKDC7_s.js">
|
|
51
|
+
<link rel="modulepreload" crossorigin href="/assets/switch-C8P-C1hw.js">
|
|
50
52
|
<link rel="modulepreload" crossorigin href="/assets/tab-store-0CKk8cSr.js">
|
|
51
|
-
<link rel="modulepreload" crossorigin href="/assets/settings-store-2NQzaOVJ.js">
|
|
52
53
|
<link rel="stylesheet" crossorigin href="/assets/index-CeNox-VV.css">
|
|
53
54
|
<link rel="manifest" href="/manifest.webmanifest"><script id="vite-plugin-pwa:register-sw" src="/registerSW.js"></script></head>
|
|
54
55
|
<body class="bg-[#0f1419] text-[#e5e7eb] font-sans antialiased">
|
package/dist/web/sw.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
try{self[`workbox:core:7.3.0`]&&_()}catch{}var e=(e,...t)=>{let n=e;return t.length>0&&(n+=` :: ${JSON.stringify(t)}`),n},t=class extends Error{constructor(t,n){let r=e(t,n);super(r),this.name=t,this.details=n}},n={googleAnalytics:`googleAnalytics`,precache:`precache-v2`,prefix:`workbox`,runtime:`runtime`,suffix:typeof registration<`u`?registration.scope:``},r=e=>[n.prefix,e,n.suffix].filter(e=>e&&e.length>0).join(`-`),i=e=>{for(let t of Object.keys(n))e(t)},a={updateDetails:e=>{i(t=>{typeof e[t]==`string`&&(n[t]=e[t])})},getGoogleAnalyticsName:e=>e||r(n.googleAnalytics),getPrecacheName:e=>e||r(n.precache),getPrefix:()=>n.prefix,getRuntimeName:e=>e||r(n.runtime),getSuffix:()=>n.suffix};function o(e,t){let n=t();return e.waitUntil(n),n}try{self[`workbox:precaching:7.3.0`]&&_()}catch{}var s=`__WB_REVISION__`;function c(e){if(!e)throw new t(`add-to-cache-list-unexpected-type`,{entry:e});if(typeof e==`string`){let t=new URL(e,location.href);return{cacheKey:t.href,url:t.href}}let{revision:n,url:r}=e;if(!r)throw new t(`add-to-cache-list-unexpected-type`,{entry:e});if(!n){let e=new URL(r,location.href);return{cacheKey:e.href,url:e.href}}let i=new URL(r,location.href),a=new URL(r,location.href);return i.searchParams.set(s,n),{cacheKey:i.href,url:a.href}}var l=class{constructor(){this.updatedURLs=[],this.notUpdatedURLs=[],this.handlerWillStart=async({request:e,state:t})=>{t&&(t.originalRequest=e)},this.cachedResponseWillBeUsed=async({event:e,state:t,cachedResponse:n})=>{if(e.type===`install`&&t&&t.originalRequest&&t.originalRequest instanceof Request){let e=t.originalRequest.url;n?this.notUpdatedURLs.push(e):this.updatedURLs.push(e)}return n}}},u=class{constructor({precacheController:e}){this.cacheKeyWillBeUsed=async({request:e,params:t})=>{let n=t?.cacheKey||this._precacheController.getCacheKeyForURL(e.url);return n?new Request(n,{headers:e.headers}):e},this._precacheController=e}},d;function f(){if(d===void 0){let e=new Response(``);if(`body`in e)try{new Response(e.body),d=!0}catch{d=!1}d=!1}return d}async function p(e,n){let r=null;if(e.url&&(r=new URL(e.url).origin),r!==self.location.origin)throw new t(`cross-origin-copy-response`,{origin:r});let i=e.clone(),a={headers:new Headers(i.headers),status:i.status,statusText:i.statusText},o=n?n(a):a,s=f()?i.body:await i.blob();return new Response(s,o)}var m=e=>new URL(String(e),location.href).href.replace(RegExp(`^${location.origin}`),``);function h(e,t){let n=new URL(e);for(let e of t)n.searchParams.delete(e);return n.href}async function g(e,t,n,r){let i=h(t.url,n);if(t.url===i)return e.match(t,r);let a=Object.assign(Object.assign({},r),{ignoreSearch:!0}),o=await e.keys(t,a);for(let t of o)if(i===h(t.url,n))return e.match(t,r)}var v=class{constructor(){this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}},y=new Set;async function b(){for(let e of y)await e()}function x(e){return new Promise(t=>setTimeout(t,e))}try{self[`workbox:strategies:7.3.0`]&&_()}catch{}function S(e){return typeof e==`string`?new Request(e):e}var C=class{constructor(e,t){this._cacheKeys={},Object.assign(this,t),this.event=t.event,this._strategy=e,this._handlerDeferred=new v,this._extendLifetimePromises=[],this._plugins=[...e.plugins],this._pluginStateMap=new Map;for(let e of this._plugins)this._pluginStateMap.set(e,{});this.event.waitUntil(this._handlerDeferred.promise)}async fetch(e){let{event:n}=this,r=S(e);if(r.mode===`navigate`&&n instanceof FetchEvent&&n.preloadResponse){let e=await n.preloadResponse;if(e)return e}let i=this.hasCallback(`fetchDidFail`)?r.clone():null;try{for(let e of this.iterateCallbacks(`requestWillFetch`))r=await e({request:r.clone(),event:n})}catch(e){if(e instanceof Error)throw new t(`plugin-error-request-will-fetch`,{thrownErrorMessage:e.message})}let a=r.clone();try{let e;e=await fetch(r,r.mode===`navigate`?void 0:this._strategy.fetchOptions);for(let t of this.iterateCallbacks(`fetchDidSucceed`))e=await t({event:n,request:a,response:e});return e}catch(e){throw i&&await this.runCallbacks(`fetchDidFail`,{error:e,event:n,originalRequest:i.clone(),request:a.clone()}),e}}async fetchAndCachePut(e){let t=await this.fetch(e),n=t.clone();return this.waitUntil(this.cachePut(e,n)),t}async cacheMatch(e){let t=S(e),n,{cacheName:r,matchOptions:i}=this._strategy,a=await this.getCacheKey(t,`read`),o=Object.assign(Object.assign({},i),{cacheName:r});n=await caches.match(a,o);for(let e of this.iterateCallbacks(`cachedResponseWillBeUsed`))n=await e({cacheName:r,matchOptions:i,cachedResponse:n,request:a,event:this.event})||void 0;return n}async cachePut(e,n){let r=S(e);await x(0);let i=await this.getCacheKey(r,`write`);if(!n)throw new t(`cache-put-with-no-response`,{url:m(i.url)});let a=await this._ensureResponseSafeToCache(n);if(!a)return!1;let{cacheName:o,matchOptions:s}=this._strategy,c=await self.caches.open(o),l=this.hasCallback(`cacheDidUpdate`),u=l?await g(c,i.clone(),[`__WB_REVISION__`],s):null;try{await c.put(i,l?a.clone():a)}catch(e){if(e instanceof Error)throw e.name===`QuotaExceededError`&&await b(),e}for(let e of this.iterateCallbacks(`cacheDidUpdate`))await e({cacheName:o,oldResponse:u,newResponse:a.clone(),request:i,event:this.event});return!0}async getCacheKey(e,t){let n=`${e.url} | ${t}`;if(!this._cacheKeys[n]){let r=e;for(let e of this.iterateCallbacks(`cacheKeyWillBeUsed`))r=S(await e({mode:t,request:r,event:this.event,params:this.params}));this._cacheKeys[n]=r}return this._cacheKeys[n]}hasCallback(e){for(let t of this._strategy.plugins)if(e in t)return!0;return!1}async runCallbacks(e,t){for(let n of this.iterateCallbacks(e))await n(t)}*iterateCallbacks(e){for(let t of this._strategy.plugins)if(typeof t[e]==`function`){let n=this._pluginStateMap.get(t);yield r=>{let i=Object.assign(Object.assign({},r),{state:n});return t[e](i)}}}waitUntil(e){return this._extendLifetimePromises.push(e),e}async doneWaiting(){for(;this._extendLifetimePromises.length;){let e=this._extendLifetimePromises.splice(0),t=(await Promise.allSettled(e)).find(e=>e.status===`rejected`);if(t)throw t.reason}}destroy(){this._handlerDeferred.resolve(null)}async _ensureResponseSafeToCache(e){let t=e,n=!1;for(let e of this.iterateCallbacks(`cacheWillUpdate`))if(t=await e({request:this.request,response:t,event:this.event})||void 0,n=!0,!t)break;return n||t&&t.status!==200&&(t=void 0),t}},w=class{constructor(e={}){this.cacheName=a.getRuntimeName(e.cacheName),this.plugins=e.plugins||[],this.fetchOptions=e.fetchOptions,this.matchOptions=e.matchOptions}handle(e){let[t]=this.handleAll(e);return t}handleAll(e){e instanceof FetchEvent&&(e={event:e,request:e.request});let t=e.event,n=typeof e.request==`string`?new Request(e.request):e.request,r=`params`in e?e.params:void 0,i=new C(this,{event:t,request:n,params:r}),a=this._getResponse(i,n,t);return[a,this._awaitComplete(a,i,n,t)]}async _getResponse(e,n,r){await e.runCallbacks(`handlerWillStart`,{event:r,request:n});let i;try{if(i=await this._handle(n,e),!i||i.type===`error`)throw new t(`no-response`,{url:n.url})}catch(t){if(t instanceof Error){for(let a of e.iterateCallbacks(`handlerDidError`))if(i=await a({error:t,event:r,request:n}),i)break}if(!i)throw t}for(let t of e.iterateCallbacks(`handlerWillRespond`))i=await t({event:r,request:n,response:i});return i}async _awaitComplete(e,t,n,r){let i,a;try{i=await e}catch{}try{await t.runCallbacks(`handlerDidRespond`,{event:r,request:n,response:i}),await t.doneWaiting()}catch(e){e instanceof Error&&(a=e)}if(await t.runCallbacks(`handlerDidComplete`,{event:r,request:n,response:i,error:a}),t.destroy(),a)throw a}},T=class e extends w{constructor(t={}){t.cacheName=a.getPrecacheName(t.cacheName),super(t),this._fallbackToNetwork=t.fallbackToNetwork!==!1,this.plugins.push(e.copyRedirectedCacheableResponsesPlugin)}async _handle(e,t){return await t.cacheMatch(e)||(t.event&&t.event.type===`install`?await this._handleInstall(e,t):await this._handleFetch(e,t))}async _handleFetch(e,n){let r,i=n.params||{};if(this._fallbackToNetwork){let t=i.integrity,a=e.integrity,o=!a||a===t;r=await n.fetch(new Request(e,{integrity:e.mode===`no-cors`?void 0:a||t})),t&&o&&e.mode!==`no-cors`&&(this._useDefaultCacheabilityPluginIfNeeded(),await n.cachePut(e,r.clone()))}else throw new t(`missing-precache-entry`,{cacheName:this.cacheName,url:e.url});return r}async _handleInstall(e,n){this._useDefaultCacheabilityPluginIfNeeded();let r=await n.fetch(e);if(!await n.cachePut(e,r.clone()))throw new t(`bad-precaching-response`,{url:e.url,status:r.status});return r}_useDefaultCacheabilityPluginIfNeeded(){let t=null,n=0;for(let[r,i]of this.plugins.entries())i!==e.copyRedirectedCacheableResponsesPlugin&&(i===e.defaultPrecacheCacheabilityPlugin&&(t=r),i.cacheWillUpdate&&n++);n===0?this.plugins.push(e.defaultPrecacheCacheabilityPlugin):n>1&&t!==null&&this.plugins.splice(t,1)}};T.defaultPrecacheCacheabilityPlugin={async cacheWillUpdate({response:e}){return!e||e.status>=400?null:e}},T.copyRedirectedCacheableResponsesPlugin={async cacheWillUpdate({response:e}){return e.redirected?await p(e):e}};var E=class{constructor({cacheName:e,plugins:t=[],fallbackToNetwork:n=!0}={}){this._urlsToCacheKeys=new Map,this._urlsToCacheModes=new Map,this._cacheKeysToIntegrities=new Map,this._strategy=new T({cacheName:a.getPrecacheName(e),plugins:[...t,new u({precacheController:this})],fallbackToNetwork:n}),this.install=this.install.bind(this),this.activate=this.activate.bind(this)}get strategy(){return this._strategy}precache(e){this.addToCacheList(e),this._installAndActiveListenersAdded||=(self.addEventListener(`install`,this.install),self.addEventListener(`activate`,this.activate),!0)}addToCacheList(e){let n=[];for(let r of e){typeof r==`string`?n.push(r):r&&r.revision===void 0&&n.push(r.url);let{cacheKey:e,url:i}=c(r),a=typeof r!=`string`&&r.revision?`reload`:`default`;if(this._urlsToCacheKeys.has(i)&&this._urlsToCacheKeys.get(i)!==e)throw new t(`add-to-cache-list-conflicting-entries`,{firstEntry:this._urlsToCacheKeys.get(i),secondEntry:e});if(typeof r!=`string`&&r.integrity){if(this._cacheKeysToIntegrities.has(e)&&this._cacheKeysToIntegrities.get(e)!==r.integrity)throw new t(`add-to-cache-list-conflicting-integrities`,{url:i});this._cacheKeysToIntegrities.set(e,r.integrity)}if(this._urlsToCacheKeys.set(i,e),this._urlsToCacheModes.set(i,a),n.length>0){let e=`Workbox is precaching URLs without revision info: ${n.join(`, `)}\nThis is generally NOT safe. Learn more at https://bit.ly/wb-precache`;console.warn(e)}}}install(e){return o(e,async()=>{let t=new l;this.strategy.plugins.push(t);for(let[t,n]of this._urlsToCacheKeys){let r=this._cacheKeysToIntegrities.get(n),i=this._urlsToCacheModes.get(t),a=new Request(t,{integrity:r,cache:i,credentials:`same-origin`});await Promise.all(this.strategy.handleAll({params:{cacheKey:n},request:a,event:e}))}let{updatedURLs:n,notUpdatedURLs:r}=t;return{updatedURLs:n,notUpdatedURLs:r}})}activate(e){return o(e,async()=>{let e=await self.caches.open(this.strategy.cacheName),t=await e.keys(),n=new Set(this._urlsToCacheKeys.values()),r=[];for(let i of t)n.has(i.url)||(await e.delete(i),r.push(i.url));return{deletedURLs:r}})}getURLsToCacheKeys(){return this._urlsToCacheKeys}getCachedURLs(){return[...this._urlsToCacheKeys.keys()]}getCacheKeyForURL(e){let t=new URL(e,location.href);return this._urlsToCacheKeys.get(t.href)}getIntegrityForCacheKey(e){return this._cacheKeysToIntegrities.get(e)}async matchPrecache(e){let t=e instanceof Request?e.url:e,n=this.getCacheKeyForURL(t);if(n)return(await self.caches.open(this.strategy.cacheName)).match(n)}createHandlerBoundToURL(e){let n=this.getCacheKeyForURL(e);if(!n)throw new t(`non-precached-url`,{url:e});return t=>(t.request=new Request(e),t.params=Object.assign({cacheKey:n},t.params),this.strategy.handle(t))}},D,O=()=>(D||=new E,D);try{self[`workbox:routing:7.3.0`]&&_()}catch{}var k=e=>e&&typeof e==`object`?e:{handle:e},A=class{constructor(e,t,n=`GET`){this.handler=k(t),this.match=e,this.method=n}setCatchHandler(e){this.catchHandler=k(e)}},j=class extends A{constructor(e,t,n){super(({url:t})=>{let n=e.exec(t.href);if(n&&!(t.origin!==location.origin&&n.index!==0))return n.slice(1)},t,n)}},M=class{constructor(){this._routes=new Map,this._defaultHandlerMap=new Map}get routes(){return this._routes}addFetchListener(){self.addEventListener(`fetch`,(e=>{let{request:t}=e,n=this.handleRequest({request:t,event:e});n&&e.respondWith(n)}))}addCacheListener(){self.addEventListener(`message`,(e=>{if(e.data&&e.data.type===`CACHE_URLS`){let{payload:t}=e.data,n=Promise.all(t.urlsToCache.map(t=>{typeof t==`string`&&(t=[t]);let n=new Request(...t);return this.handleRequest({request:n,event:e})}));e.waitUntil(n),e.ports&&e.ports[0]&&n.then(()=>e.ports[0].postMessage(!0))}}))}handleRequest({request:e,event:t}){let n=new URL(e.url,location.href);if(!n.protocol.startsWith(`http`))return;let r=n.origin===location.origin,{params:i,route:a}=this.findMatchingRoute({event:t,request:e,sameOrigin:r,url:n}),o=a&&a.handler,s=e.method;if(!o&&this._defaultHandlerMap.has(s)&&(o=this._defaultHandlerMap.get(s)),!o)return;let c;try{c=o.handle({url:n,request:e,event:t,params:i})}catch(e){c=Promise.reject(e)}let l=a&&a.catchHandler;return c instanceof Promise&&(this._catchHandler||l)&&(c=c.catch(async r=>{if(l)try{return await l.handle({url:n,request:e,event:t,params:i})}catch(e){e instanceof Error&&(r=e)}if(this._catchHandler)return this._catchHandler.handle({url:n,request:e,event:t});throw r})),c}findMatchingRoute({url:e,sameOrigin:t,request:n,event:r}){let i=this._routes.get(n.method)||[];for(let a of i){let i,o=a.match({url:e,sameOrigin:t,request:n,event:r});if(o)return i=o,(Array.isArray(i)&&i.length===0||o.constructor===Object&&Object.keys(o).length===0||typeof o==`boolean`)&&(i=void 0),{route:a,params:i}}return{}}setDefaultHandler(e,t=`GET`){this._defaultHandlerMap.set(t,k(e))}setCatchHandler(e){this._catchHandler=k(e)}registerRoute(e){this._routes.has(e.method)||this._routes.set(e.method,[]),this._routes.get(e.method).push(e)}unregisterRoute(e){if(!this._routes.has(e.method))throw new t(`unregister-route-but-not-found-with-method`,{method:e.method});let n=this._routes.get(e.method).indexOf(e);if(n>-1)this._routes.get(e.method).splice(n,1);else throw new t(`unregister-route-route-not-registered`)}},N,P=()=>(N||(N=new M,N.addFetchListener(),N.addCacheListener()),N);function F(e,n,r){let i;if(typeof e==`string`){let t=new URL(e,location.href);i=new A(({url:e})=>e.href===t.href,n,r)}else if(e instanceof RegExp)i=new j(e,n,r);else if(typeof e==`function`)i=new A(e,n,r);else if(e instanceof A)i=e;else throw new t(`unsupported-route-type`,{moduleName:`workbox-routing`,funcName:`registerRoute`,paramName:`capture`});return P().registerRoute(i),i}function I(e,t=[]){for(let n of[...e.searchParams.keys()])t.some(e=>e.test(n))&&e.searchParams.delete(n);return e}function*L(e,{ignoreURLParametersMatching:t=[/^utm_/,/^fbclid$/],directoryIndex:n=`index.html`,cleanURLs:r=!0,urlManipulation:i}={}){let a=new URL(e,location.href);a.hash=``,yield a.href;let o=I(a,t);if(yield o.href,n&&o.pathname.endsWith(`/`)){let e=new URL(o.href);e.pathname+=n,yield e.href}if(r){let e=new URL(o.href);e.pathname+=`.html`,yield e.href}if(i){let e=i({url:a});for(let t of e)yield t.href}}var R=class extends A{constructor(e,t){super(({request:n})=>{let r=e.getURLsToCacheKeys();for(let i of L(n.url,t)){let t=r.get(i);if(t)return{cacheKey:t,integrity:e.getIntegrityForCacheKey(t)}}},e.strategy)}};function z(e){F(new R(O(),e))}function B(e){O().precache(e)}function V(e,t){B(e),z(t)}V([{"revision":"1872c500de691dce40960bb85481de07","url":"registerSW.js"},{"revision":"cf25f13e80fbc2b9a7537b6b45c59538","url":"index.html"},{"revision":"a0fb34fc84eb148d51812cd62669f20d","url":"icon-512.svg"},{"revision":"a0fb34fc84eb148d51812cd62669f20d","url":"icon-192.svg"},{"revision":"eb9818b9094675c0c5d303168f273345","url":"monacoeditorwork/ts.worker.bundle.js"},{"revision":"9af0be92dcefdc1f1290441cb5ff5d9b","url":"monacoeditorwork/json.worker.bundle.js"},{"revision":"a261b429c39dbb75ae97972d7d005e6d","url":"monacoeditorwork/html.worker.bundle.js"},{"revision":"79953d804e1bbacecfd79b85fd679016","url":"monacoeditorwork/editor.worker.bundle.js"},{"revision":"fdcba0d09aac31df7a0bc652f6e739bd","url":"monacoeditorwork/css.worker.bundle.js"},{"revision":null,"url":"assets/utils-DC-bdPS3.js"},{"revision":null,"url":"assets/use-monaco-theme-Bt1Lr3jH.js"},{"revision":null,"url":"assets/terminal-tab-DxUGsGUg.js"},{"revision":null,"url":"assets/terminal-tab-BrP-ENHg.css"},{"revision":null,"url":"assets/table-C0oSLUYn.js"},{"revision":null,"url":"assets/tab-store-0CKk8cSr.js"},{"revision":null,"url":"assets/switch-0m9hvYfp.js"},{"revision":null,"url":"assets/sqlite-viewer-522y1qCb.js"},{"revision":null,"url":"assets/settings-tab-Ciu7Mb7W.js"},{"revision":null,"url":"assets/settings-store-2NQzaOVJ.js"},{"revision":null,"url":"assets/react-rgzL83kk.js"},{"revision":null,"url":"assets/react-CYzKIDNi.js"},{"revision":null,"url":"assets/postgres-viewer-CwiXo-4U.js"},{"revision":null,"url":"assets/markdown-renderer-Bhc1YkCI.js"},{"revision":null,"url":"assets/keybindings-store-C8plncT4.js"},{"revision":null,"url":"assets/jsx-runtime-wQxeESYQ.js"},{"revision":null,"url":"assets/input-CE3bFwLk.js"},{"revision":null,"url":"assets/index-l0SQefAv.js"},{"revision":null,"url":"assets/index-CeNox-VV.css"},{"revision":null,"url":"assets/git-graph-CTY_8cN1.js"},{"revision":null,"url":"assets/dist-D9RHR8A4.js"},{"revision":null,"url":"assets/diff-viewer-LIyIbdmY.js"},{"revision":null,"url":"assets/database-viewer-DWKAsEpU.js"},{"revision":null,"url":"assets/columns-2-fz8yNaAo.js"},{"revision":null,"url":"assets/code-editor-DeGbTWsV.js"},{"revision":null,"url":"assets/chat-tab-CAheoM6s.js"},{"revision":null,"url":"assets/api-client-TUmacMRS.js"},{"revision":"79c8870653c8f419f2e3323085e1f4be","url":"manifest.webmanifest"}]),self.addEventListener(`push`,e=>{e.waitUntil(self.clients.matchAll({type:`window`,includeUncontrolled:!0}).then(t=>{if(t.some(e=>e.visibilityState===`visible`))return;let n=e.data?.json()??{title:`PPM`,body:`Chat completed`};return self.registration.showNotification(n.title,{body:n.body,icon:`/icon-192.png`,badge:`/icon-192.png`,tag:`ppm-chat-done`,silent:!1,data:{url:self.location.origin}})}))}),self.addEventListener(`notificationclick`,e=>{e.notification.close(),e.waitUntil(self.clients.matchAll({type:`window`,includeUncontrolled:!0}).then(t=>{for(let e of t)if(e.url.includes(self.location.origin)&&`focus`in e)return e.focus();return self.clients.openWindow(e.notification.data?.url||`/`)}))});
|
|
1
|
+
try{self[`workbox:core:7.3.0`]&&_()}catch{}var e=(e,...t)=>{let n=e;return t.length>0&&(n+=` :: ${JSON.stringify(t)}`),n},t=class extends Error{constructor(t,n){let r=e(t,n);super(r),this.name=t,this.details=n}},n={googleAnalytics:`googleAnalytics`,precache:`precache-v2`,prefix:`workbox`,runtime:`runtime`,suffix:typeof registration<`u`?registration.scope:``},r=e=>[n.prefix,e,n.suffix].filter(e=>e&&e.length>0).join(`-`),i=e=>{for(let t of Object.keys(n))e(t)},a={updateDetails:e=>{i(t=>{typeof e[t]==`string`&&(n[t]=e[t])})},getGoogleAnalyticsName:e=>e||r(n.googleAnalytics),getPrecacheName:e=>e||r(n.precache),getPrefix:()=>n.prefix,getRuntimeName:e=>e||r(n.runtime),getSuffix:()=>n.suffix};function o(e,t){let n=t();return e.waitUntil(n),n}try{self[`workbox:precaching:7.3.0`]&&_()}catch{}var s=`__WB_REVISION__`;function c(e){if(!e)throw new t(`add-to-cache-list-unexpected-type`,{entry:e});if(typeof e==`string`){let t=new URL(e,location.href);return{cacheKey:t.href,url:t.href}}let{revision:n,url:r}=e;if(!r)throw new t(`add-to-cache-list-unexpected-type`,{entry:e});if(!n){let e=new URL(r,location.href);return{cacheKey:e.href,url:e.href}}let i=new URL(r,location.href),a=new URL(r,location.href);return i.searchParams.set(s,n),{cacheKey:i.href,url:a.href}}var l=class{constructor(){this.updatedURLs=[],this.notUpdatedURLs=[],this.handlerWillStart=async({request:e,state:t})=>{t&&(t.originalRequest=e)},this.cachedResponseWillBeUsed=async({event:e,state:t,cachedResponse:n})=>{if(e.type===`install`&&t&&t.originalRequest&&t.originalRequest instanceof Request){let e=t.originalRequest.url;n?this.notUpdatedURLs.push(e):this.updatedURLs.push(e)}return n}}},u=class{constructor({precacheController:e}){this.cacheKeyWillBeUsed=async({request:e,params:t})=>{let n=t?.cacheKey||this._precacheController.getCacheKeyForURL(e.url);return n?new Request(n,{headers:e.headers}):e},this._precacheController=e}},d;function f(){if(d===void 0){let e=new Response(``);if(`body`in e)try{new Response(e.body),d=!0}catch{d=!1}d=!1}return d}async function p(e,n){let r=null;if(e.url&&(r=new URL(e.url).origin),r!==self.location.origin)throw new t(`cross-origin-copy-response`,{origin:r});let i=e.clone(),a={headers:new Headers(i.headers),status:i.status,statusText:i.statusText},o=n?n(a):a,s=f()?i.body:await i.blob();return new Response(s,o)}var m=e=>new URL(String(e),location.href).href.replace(RegExp(`^${location.origin}`),``);function h(e,t){let n=new URL(e);for(let e of t)n.searchParams.delete(e);return n.href}async function g(e,t,n,r){let i=h(t.url,n);if(t.url===i)return e.match(t,r);let a=Object.assign(Object.assign({},r),{ignoreSearch:!0}),o=await e.keys(t,a);for(let t of o)if(i===h(t.url,n))return e.match(t,r)}var v=class{constructor(){this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}},y=new Set;async function b(){for(let e of y)await e()}function x(e){return new Promise(t=>setTimeout(t,e))}try{self[`workbox:strategies:7.3.0`]&&_()}catch{}function S(e){return typeof e==`string`?new Request(e):e}var C=class{constructor(e,t){this._cacheKeys={},Object.assign(this,t),this.event=t.event,this._strategy=e,this._handlerDeferred=new v,this._extendLifetimePromises=[],this._plugins=[...e.plugins],this._pluginStateMap=new Map;for(let e of this._plugins)this._pluginStateMap.set(e,{});this.event.waitUntil(this._handlerDeferred.promise)}async fetch(e){let{event:n}=this,r=S(e);if(r.mode===`navigate`&&n instanceof FetchEvent&&n.preloadResponse){let e=await n.preloadResponse;if(e)return e}let i=this.hasCallback(`fetchDidFail`)?r.clone():null;try{for(let e of this.iterateCallbacks(`requestWillFetch`))r=await e({request:r.clone(),event:n})}catch(e){if(e instanceof Error)throw new t(`plugin-error-request-will-fetch`,{thrownErrorMessage:e.message})}let a=r.clone();try{let e;e=await fetch(r,r.mode===`navigate`?void 0:this._strategy.fetchOptions);for(let t of this.iterateCallbacks(`fetchDidSucceed`))e=await t({event:n,request:a,response:e});return e}catch(e){throw i&&await this.runCallbacks(`fetchDidFail`,{error:e,event:n,originalRequest:i.clone(),request:a.clone()}),e}}async fetchAndCachePut(e){let t=await this.fetch(e),n=t.clone();return this.waitUntil(this.cachePut(e,n)),t}async cacheMatch(e){let t=S(e),n,{cacheName:r,matchOptions:i}=this._strategy,a=await this.getCacheKey(t,`read`),o=Object.assign(Object.assign({},i),{cacheName:r});n=await caches.match(a,o);for(let e of this.iterateCallbacks(`cachedResponseWillBeUsed`))n=await e({cacheName:r,matchOptions:i,cachedResponse:n,request:a,event:this.event})||void 0;return n}async cachePut(e,n){let r=S(e);await x(0);let i=await this.getCacheKey(r,`write`);if(!n)throw new t(`cache-put-with-no-response`,{url:m(i.url)});let a=await this._ensureResponseSafeToCache(n);if(!a)return!1;let{cacheName:o,matchOptions:s}=this._strategy,c=await self.caches.open(o),l=this.hasCallback(`cacheDidUpdate`),u=l?await g(c,i.clone(),[`__WB_REVISION__`],s):null;try{await c.put(i,l?a.clone():a)}catch(e){if(e instanceof Error)throw e.name===`QuotaExceededError`&&await b(),e}for(let e of this.iterateCallbacks(`cacheDidUpdate`))await e({cacheName:o,oldResponse:u,newResponse:a.clone(),request:i,event:this.event});return!0}async getCacheKey(e,t){let n=`${e.url} | ${t}`;if(!this._cacheKeys[n]){let r=e;for(let e of this.iterateCallbacks(`cacheKeyWillBeUsed`))r=S(await e({mode:t,request:r,event:this.event,params:this.params}));this._cacheKeys[n]=r}return this._cacheKeys[n]}hasCallback(e){for(let t of this._strategy.plugins)if(e in t)return!0;return!1}async runCallbacks(e,t){for(let n of this.iterateCallbacks(e))await n(t)}*iterateCallbacks(e){for(let t of this._strategy.plugins)if(typeof t[e]==`function`){let n=this._pluginStateMap.get(t);yield r=>{let i=Object.assign(Object.assign({},r),{state:n});return t[e](i)}}}waitUntil(e){return this._extendLifetimePromises.push(e),e}async doneWaiting(){for(;this._extendLifetimePromises.length;){let e=this._extendLifetimePromises.splice(0),t=(await Promise.allSettled(e)).find(e=>e.status===`rejected`);if(t)throw t.reason}}destroy(){this._handlerDeferred.resolve(null)}async _ensureResponseSafeToCache(e){let t=e,n=!1;for(let e of this.iterateCallbacks(`cacheWillUpdate`))if(t=await e({request:this.request,response:t,event:this.event})||void 0,n=!0,!t)break;return n||t&&t.status!==200&&(t=void 0),t}},w=class{constructor(e={}){this.cacheName=a.getRuntimeName(e.cacheName),this.plugins=e.plugins||[],this.fetchOptions=e.fetchOptions,this.matchOptions=e.matchOptions}handle(e){let[t]=this.handleAll(e);return t}handleAll(e){e instanceof FetchEvent&&(e={event:e,request:e.request});let t=e.event,n=typeof e.request==`string`?new Request(e.request):e.request,r=`params`in e?e.params:void 0,i=new C(this,{event:t,request:n,params:r}),a=this._getResponse(i,n,t);return[a,this._awaitComplete(a,i,n,t)]}async _getResponse(e,n,r){await e.runCallbacks(`handlerWillStart`,{event:r,request:n});let i;try{if(i=await this._handle(n,e),!i||i.type===`error`)throw new t(`no-response`,{url:n.url})}catch(t){if(t instanceof Error){for(let a of e.iterateCallbacks(`handlerDidError`))if(i=await a({error:t,event:r,request:n}),i)break}if(!i)throw t}for(let t of e.iterateCallbacks(`handlerWillRespond`))i=await t({event:r,request:n,response:i});return i}async _awaitComplete(e,t,n,r){let i,a;try{i=await e}catch{}try{await t.runCallbacks(`handlerDidRespond`,{event:r,request:n,response:i}),await t.doneWaiting()}catch(e){e instanceof Error&&(a=e)}if(await t.runCallbacks(`handlerDidComplete`,{event:r,request:n,response:i,error:a}),t.destroy(),a)throw a}},T=class e extends w{constructor(t={}){t.cacheName=a.getPrecacheName(t.cacheName),super(t),this._fallbackToNetwork=t.fallbackToNetwork!==!1,this.plugins.push(e.copyRedirectedCacheableResponsesPlugin)}async _handle(e,t){return await t.cacheMatch(e)||(t.event&&t.event.type===`install`?await this._handleInstall(e,t):await this._handleFetch(e,t))}async _handleFetch(e,n){let r,i=n.params||{};if(this._fallbackToNetwork){let t=i.integrity,a=e.integrity,o=!a||a===t;r=await n.fetch(new Request(e,{integrity:e.mode===`no-cors`?void 0:a||t})),t&&o&&e.mode!==`no-cors`&&(this._useDefaultCacheabilityPluginIfNeeded(),await n.cachePut(e,r.clone()))}else throw new t(`missing-precache-entry`,{cacheName:this.cacheName,url:e.url});return r}async _handleInstall(e,n){this._useDefaultCacheabilityPluginIfNeeded();let r=await n.fetch(e);if(!await n.cachePut(e,r.clone()))throw new t(`bad-precaching-response`,{url:e.url,status:r.status});return r}_useDefaultCacheabilityPluginIfNeeded(){let t=null,n=0;for(let[r,i]of this.plugins.entries())i!==e.copyRedirectedCacheableResponsesPlugin&&(i===e.defaultPrecacheCacheabilityPlugin&&(t=r),i.cacheWillUpdate&&n++);n===0?this.plugins.push(e.defaultPrecacheCacheabilityPlugin):n>1&&t!==null&&this.plugins.splice(t,1)}};T.defaultPrecacheCacheabilityPlugin={async cacheWillUpdate({response:e}){return!e||e.status>=400?null:e}},T.copyRedirectedCacheableResponsesPlugin={async cacheWillUpdate({response:e}){return e.redirected?await p(e):e}};var E=class{constructor({cacheName:e,plugins:t=[],fallbackToNetwork:n=!0}={}){this._urlsToCacheKeys=new Map,this._urlsToCacheModes=new Map,this._cacheKeysToIntegrities=new Map,this._strategy=new T({cacheName:a.getPrecacheName(e),plugins:[...t,new u({precacheController:this})],fallbackToNetwork:n}),this.install=this.install.bind(this),this.activate=this.activate.bind(this)}get strategy(){return this._strategy}precache(e){this.addToCacheList(e),this._installAndActiveListenersAdded||=(self.addEventListener(`install`,this.install),self.addEventListener(`activate`,this.activate),!0)}addToCacheList(e){let n=[];for(let r of e){typeof r==`string`?n.push(r):r&&r.revision===void 0&&n.push(r.url);let{cacheKey:e,url:i}=c(r),a=typeof r!=`string`&&r.revision?`reload`:`default`;if(this._urlsToCacheKeys.has(i)&&this._urlsToCacheKeys.get(i)!==e)throw new t(`add-to-cache-list-conflicting-entries`,{firstEntry:this._urlsToCacheKeys.get(i),secondEntry:e});if(typeof r!=`string`&&r.integrity){if(this._cacheKeysToIntegrities.has(e)&&this._cacheKeysToIntegrities.get(e)!==r.integrity)throw new t(`add-to-cache-list-conflicting-integrities`,{url:i});this._cacheKeysToIntegrities.set(e,r.integrity)}if(this._urlsToCacheKeys.set(i,e),this._urlsToCacheModes.set(i,a),n.length>0){let e=`Workbox is precaching URLs without revision info: ${n.join(`, `)}\nThis is generally NOT safe. Learn more at https://bit.ly/wb-precache`;console.warn(e)}}}install(e){return o(e,async()=>{let t=new l;this.strategy.plugins.push(t);for(let[t,n]of this._urlsToCacheKeys){let r=this._cacheKeysToIntegrities.get(n),i=this._urlsToCacheModes.get(t),a=new Request(t,{integrity:r,cache:i,credentials:`same-origin`});await Promise.all(this.strategy.handleAll({params:{cacheKey:n},request:a,event:e}))}let{updatedURLs:n,notUpdatedURLs:r}=t;return{updatedURLs:n,notUpdatedURLs:r}})}activate(e){return o(e,async()=>{let e=await self.caches.open(this.strategy.cacheName),t=await e.keys(),n=new Set(this._urlsToCacheKeys.values()),r=[];for(let i of t)n.has(i.url)||(await e.delete(i),r.push(i.url));return{deletedURLs:r}})}getURLsToCacheKeys(){return this._urlsToCacheKeys}getCachedURLs(){return[...this._urlsToCacheKeys.keys()]}getCacheKeyForURL(e){let t=new URL(e,location.href);return this._urlsToCacheKeys.get(t.href)}getIntegrityForCacheKey(e){return this._cacheKeysToIntegrities.get(e)}async matchPrecache(e){let t=e instanceof Request?e.url:e,n=this.getCacheKeyForURL(t);if(n)return(await self.caches.open(this.strategy.cacheName)).match(n)}createHandlerBoundToURL(e){let n=this.getCacheKeyForURL(e);if(!n)throw new t(`non-precached-url`,{url:e});return t=>(t.request=new Request(e),t.params=Object.assign({cacheKey:n},t.params),this.strategy.handle(t))}},D,O=()=>(D||=new E,D);try{self[`workbox:routing:7.3.0`]&&_()}catch{}var k=e=>e&&typeof e==`object`?e:{handle:e},A=class{constructor(e,t,n=`GET`){this.handler=k(t),this.match=e,this.method=n}setCatchHandler(e){this.catchHandler=k(e)}},j=class extends A{constructor(e,t,n){super(({url:t})=>{let n=e.exec(t.href);if(n&&!(t.origin!==location.origin&&n.index!==0))return n.slice(1)},t,n)}},M=class{constructor(){this._routes=new Map,this._defaultHandlerMap=new Map}get routes(){return this._routes}addFetchListener(){self.addEventListener(`fetch`,(e=>{let{request:t}=e,n=this.handleRequest({request:t,event:e});n&&e.respondWith(n)}))}addCacheListener(){self.addEventListener(`message`,(e=>{if(e.data&&e.data.type===`CACHE_URLS`){let{payload:t}=e.data,n=Promise.all(t.urlsToCache.map(t=>{typeof t==`string`&&(t=[t]);let n=new Request(...t);return this.handleRequest({request:n,event:e})}));e.waitUntil(n),e.ports&&e.ports[0]&&n.then(()=>e.ports[0].postMessage(!0))}}))}handleRequest({request:e,event:t}){let n=new URL(e.url,location.href);if(!n.protocol.startsWith(`http`))return;let r=n.origin===location.origin,{params:i,route:a}=this.findMatchingRoute({event:t,request:e,sameOrigin:r,url:n}),o=a&&a.handler,s=e.method;if(!o&&this._defaultHandlerMap.has(s)&&(o=this._defaultHandlerMap.get(s)),!o)return;let c;try{c=o.handle({url:n,request:e,event:t,params:i})}catch(e){c=Promise.reject(e)}let l=a&&a.catchHandler;return c instanceof Promise&&(this._catchHandler||l)&&(c=c.catch(async r=>{if(l)try{return await l.handle({url:n,request:e,event:t,params:i})}catch(e){e instanceof Error&&(r=e)}if(this._catchHandler)return this._catchHandler.handle({url:n,request:e,event:t});throw r})),c}findMatchingRoute({url:e,sameOrigin:t,request:n,event:r}){let i=this._routes.get(n.method)||[];for(let a of i){let i,o=a.match({url:e,sameOrigin:t,request:n,event:r});if(o)return i=o,(Array.isArray(i)&&i.length===0||o.constructor===Object&&Object.keys(o).length===0||typeof o==`boolean`)&&(i=void 0),{route:a,params:i}}return{}}setDefaultHandler(e,t=`GET`){this._defaultHandlerMap.set(t,k(e))}setCatchHandler(e){this._catchHandler=k(e)}registerRoute(e){this._routes.has(e.method)||this._routes.set(e.method,[]),this._routes.get(e.method).push(e)}unregisterRoute(e){if(!this._routes.has(e.method))throw new t(`unregister-route-but-not-found-with-method`,{method:e.method});let n=this._routes.get(e.method).indexOf(e);if(n>-1)this._routes.get(e.method).splice(n,1);else throw new t(`unregister-route-route-not-registered`)}},N,P=()=>(N||(N=new M,N.addFetchListener(),N.addCacheListener()),N);function F(e,n,r){let i;if(typeof e==`string`){let t=new URL(e,location.href);i=new A(({url:e})=>e.href===t.href,n,r)}else if(e instanceof RegExp)i=new j(e,n,r);else if(typeof e==`function`)i=new A(e,n,r);else if(e instanceof A)i=e;else throw new t(`unsupported-route-type`,{moduleName:`workbox-routing`,funcName:`registerRoute`,paramName:`capture`});return P().registerRoute(i),i}function I(e,t=[]){for(let n of[...e.searchParams.keys()])t.some(e=>e.test(n))&&e.searchParams.delete(n);return e}function*L(e,{ignoreURLParametersMatching:t=[/^utm_/,/^fbclid$/],directoryIndex:n=`index.html`,cleanURLs:r=!0,urlManipulation:i}={}){let a=new URL(e,location.href);a.hash=``,yield a.href;let o=I(a,t);if(yield o.href,n&&o.pathname.endsWith(`/`)){let e=new URL(o.href);e.pathname+=n,yield e.href}if(r){let e=new URL(o.href);e.pathname+=`.html`,yield e.href}if(i){let e=i({url:a});for(let t of e)yield t.href}}var R=class extends A{constructor(e,t){super(({request:n})=>{let r=e.getURLsToCacheKeys();for(let i of L(n.url,t)){let t=r.get(i);if(t)return{cacheKey:t,integrity:e.getIntegrityForCacheKey(t)}}},e.strategy)}};function z(e){F(new R(O(),e))}function B(e){O().precache(e)}function V(e,t){B(e),z(t)}V([{"revision":"1872c500de691dce40960bb85481de07","url":"registerSW.js"},{"revision":"9092e5b55a766d7b3a19c086fd935f6c","url":"index.html"},{"revision":"a0fb34fc84eb148d51812cd62669f20d","url":"icon-512.svg"},{"revision":"a0fb34fc84eb148d51812cd62669f20d","url":"icon-192.svg"},{"revision":"eb9818b9094675c0c5d303168f273345","url":"monacoeditorwork/ts.worker.bundle.js"},{"revision":"9af0be92dcefdc1f1290441cb5ff5d9b","url":"monacoeditorwork/json.worker.bundle.js"},{"revision":"a261b429c39dbb75ae97972d7d005e6d","url":"monacoeditorwork/html.worker.bundle.js"},{"revision":"79953d804e1bbacecfd79b85fd679016","url":"monacoeditorwork/editor.worker.bundle.js"},{"revision":"fdcba0d09aac31df7a0bc652f6e739bd","url":"monacoeditorwork/css.worker.bundle.js"},{"revision":null,"url":"assets/utils-DC-bdPS3.js"},{"revision":null,"url":"assets/use-monaco-theme-DlFSiqvG.js"},{"revision":null,"url":"assets/terminal-tab-BrP-ENHg.css"},{"revision":null,"url":"assets/terminal-tab-4RrCMQc8.js"},{"revision":null,"url":"assets/table-C0oSLUYn.js"},{"revision":null,"url":"assets/tab-store-0CKk8cSr.js"},{"revision":null,"url":"assets/switch-C8P-C1hw.js"},{"revision":null,"url":"assets/sqlite-viewer-DkfnHJrB.js"},{"revision":null,"url":"assets/settings-tab-C4NlHP7f.js"},{"revision":null,"url":"assets/settings-store-xG6mKqkD.js"},{"revision":null,"url":"assets/react-rgzL83kk.js"},{"revision":null,"url":"assets/react-CYzKIDNi.js"},{"revision":null,"url":"assets/postgres-viewer-CeiRsLjf.js"},{"revision":null,"url":"assets/markdown-renderer-aPb3zQmt.js"},{"revision":null,"url":"assets/keybindings-store-D26m5C4_.js"},{"revision":null,"url":"assets/jsx-runtime-wQxeESYQ.js"},{"revision":null,"url":"assets/input-CE3bFwLk.js"},{"revision":null,"url":"assets/index-CeNox-VV.css"},{"revision":null,"url":"assets/index-Bu8-Nf_9.js"},{"revision":null,"url":"assets/git-graph-POg1VqZn.js"},{"revision":null,"url":"assets/dist-D9RHR8A4.js"},{"revision":null,"url":"assets/diff-viewer-K4pVS0BQ.js"},{"revision":null,"url":"assets/database-viewer-LeoJOnM8.js"},{"revision":null,"url":"assets/columns-2-fz8yNaAo.js"},{"revision":null,"url":"assets/code-editor-BzeXo2X4.js"},{"revision":null,"url":"assets/chat-tab-i4xcyBjR.js"},{"revision":null,"url":"assets/api-settings-CaKDC7_s.js"},{"revision":null,"url":"assets/api-client-TUmacMRS.js"},{"revision":"79c8870653c8f419f2e3323085e1f4be","url":"manifest.webmanifest"}]),self.addEventListener(`push`,e=>{e.waitUntil(self.clients.matchAll({type:`window`,includeUncontrolled:!0}).then(t=>{if(t.some(e=>e.visibilityState===`visible`))return;let n=e.data?.json()??{title:`PPM`,body:`Chat completed`};return self.registration.showNotification(n.title,{body:n.body,icon:`/icon-192.png`,badge:`/icon-192.png`,tag:`ppm-chat-done`,silent:!1,data:{url:self.location.origin}})}))}),self.addEventListener(`notificationclick`,e=>{e.notification.close(),e.waitUntil(self.clients.matchAll({type:`window`,includeUncontrolled:!0}).then(t=>{for(let e of t)if(e.url.includes(self.location.origin)&&`focus`in e)return e.focus();return self.clients.openWindow(e.notification.data?.url||`/`)}))});
|
package/package.json
CHANGED
|
@@ -94,7 +94,7 @@ export function decryptWithPassword(blob: string, password: string): string {
|
|
|
94
94
|
export function decrypt(encoded: string): string {
|
|
95
95
|
const parts = encoded.split(":");
|
|
96
96
|
if (parts.length !== 3) throw new Error("Invalid encrypted format");
|
|
97
|
-
const [ivHex, tagHex, ctHex] = parts;
|
|
97
|
+
const [ivHex, tagHex, ctHex] = parts as [string, string, string];
|
|
98
98
|
const decipher = createDecipheriv(ALGO, getKey(), Buffer.from(ivHex, "hex"));
|
|
99
99
|
decipher.setAuthTag(Buffer.from(tagHex, "hex"));
|
|
100
100
|
return Buffer.concat([
|
|
@@ -68,7 +68,7 @@ cloudRoutes.post("/logout", (_c) => {
|
|
|
68
68
|
|
|
69
69
|
/** POST /api/cloud/link — register device with cloud */
|
|
70
70
|
cloudRoutes.post("/link", async (c) => {
|
|
71
|
-
const body = await c.req.json<{ name?: string }>().catch(() => ({}));
|
|
71
|
+
const body = await c.req.json<{ name?: string }>().catch(() => ({} as { name?: string }));
|
|
72
72
|
|
|
73
73
|
try {
|
|
74
74
|
const device = await linkDevice(body.name);
|
|
@@ -22,6 +22,46 @@ function stripSensitiveFields(ai: { providers: Record<string, unknown> }) {
|
|
|
22
22
|
return clone;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
+
// ── Device Name ──────────────────────────────────────────────────────
|
|
26
|
+
|
|
27
|
+
/** PUT /settings/device-name */
|
|
28
|
+
settingsRoutes.put("/device-name", async (c) => {
|
|
29
|
+
try {
|
|
30
|
+
const { device_name } = await c.req.json<{ device_name: string }>();
|
|
31
|
+
if (typeof device_name !== "string") {
|
|
32
|
+
return c.json(err("device_name must be a string"), 400);
|
|
33
|
+
}
|
|
34
|
+
const trimmed = device_name.trim();
|
|
35
|
+
if (trimmed.length > 100) {
|
|
36
|
+
return c.json(err("device_name must be 100 characters or less"), 400);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Save to config
|
|
40
|
+
configService.set("device_name", trimmed);
|
|
41
|
+
configService.save();
|
|
42
|
+
|
|
43
|
+
// Update cloud device name if linked
|
|
44
|
+
try {
|
|
45
|
+
const { getCloudDevice, saveCloudDevice, linkDevice } = await import("../../services/cloud.service.ts");
|
|
46
|
+
const device = getCloudDevice();
|
|
47
|
+
if (device && trimmed) {
|
|
48
|
+
// Re-link with new name (cloud upserts by machine_id)
|
|
49
|
+
const updated = await linkDevice(trimmed);
|
|
50
|
+
// Also update local cloud-device.json name
|
|
51
|
+
if (updated) {
|
|
52
|
+
saveCloudDevice({ ...updated, name: trimmed });
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
} catch {
|
|
56
|
+
// Cloud update is best-effort
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return c.json(ok({ device_name: trimmed }));
|
|
60
|
+
} catch (e) {
|
|
61
|
+
return c.json(err((e as Error).message), 400);
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
|
|
25
65
|
// ── Theme ─────────────────────────────────────────────────────────────
|
|
26
66
|
|
|
27
67
|
/** GET /settings/theme */
|
|
@@ -70,11 +70,11 @@ class AccountSelectorService {
|
|
|
70
70
|
let pickedId: string;
|
|
71
71
|
if (this.getStrategy() === "fill-first") {
|
|
72
72
|
const sorted = [...active].sort((a, b) => b.priority - a.priority || a.createdAt - b.createdAt);
|
|
73
|
-
pickedId = sorted[0]
|
|
73
|
+
pickedId = sorted[0]!.id;
|
|
74
74
|
} else {
|
|
75
75
|
// Round-robin
|
|
76
76
|
this.cursor = this.cursor % active.length;
|
|
77
|
-
pickedId = active[this.cursor]
|
|
77
|
+
pickedId = active[this.cursor]!.id;
|
|
78
78
|
this.cursor = (this.cursor + 1) % active.length;
|
|
79
79
|
}
|
|
80
80
|
this._lastPickedId = pickedId;
|
package/src/types/api.ts
CHANGED
|
@@ -25,7 +25,8 @@ export type TerminalWsMessage =
|
|
|
25
25
|
export type ChatWsClientMessage =
|
|
26
26
|
| { type: "message"; content: string; permissionMode?: string }
|
|
27
27
|
| { type: "cancel" }
|
|
28
|
-
| { type: "approval_response"; requestId: string; approved: boolean; reason?: string; data?: unknown }
|
|
28
|
+
| { type: "approval_response"; requestId: string; approved: boolean; reason?: string; data?: unknown }
|
|
29
|
+
| { type: "ready" };
|
|
29
30
|
|
|
30
31
|
export type ChatWsServerMessage =
|
|
31
32
|
| { type: "text"; content: string; parentToolUseId?: string }
|
package/src/types/config.ts
CHANGED
|
@@ -53,7 +53,7 @@ export interface AIProviderConfig {
|
|
|
53
53
|
base_url?: string;
|
|
54
54
|
// Agent SDK-specific settings (ignored by mock provider)
|
|
55
55
|
model?: string;
|
|
56
|
-
effort?: "low" | "medium" | "high";
|
|
56
|
+
effort?: "low" | "medium" | "high" | "max";
|
|
57
57
|
max_turns?: number;
|
|
58
58
|
max_budget_usd?: number;
|
|
59
59
|
thinking_budget_tokens?: number;
|