diff --git a/backend/openui/dist/assets/CodeEditor-DeI0yxJE.js b/backend/openui/dist/assets/CodeEditor-BNtUY-yF.js similarity index 99% rename from backend/openui/dist/assets/CodeEditor-DeI0yxJE.js rename to backend/openui/dist/assets/CodeEditor-BNtUY-yF.js index f385e9b..5f1fdca 100644 --- a/backend/openui/dist/assets/CodeEditor-DeI0yxJE.js +++ b/backend/openui/dist/assets/CodeEditor-BNtUY-yF.js @@ -1,5 +1,5 @@ -const __vite__fileDeps=["assets/html-CDMIPMTW.js","assets/index-BJTdd6TP.js","assets/index-PeCuZIBW.css","assets/index-BT0QP1aV.js","assets/javascript-CNZSM6YK.js","assets/typescript-Dox8aIts.js","assets/python-BPLqGtcV.js","assets/yaml-S2dQc2cB.js","assets/cssMode-BN7yDFsj.js","assets/htmlMode-C9ncgpq_.js","assets/jsonMode-Bd5P6a30.js","assets/tsMode-CkyNDC04.js"],__vite__mapDeps=i=>i.map(i=>__vite__fileDeps[i]); -var LZ=Object.defineProperty;var xZ=(s,e,t)=>e in s?LZ(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var Z1=(s,e,t)=>(xZ(s,typeof e!="symbol"?e+"":e,t),t);import{d as _t,W as vm,K as Jo,O as kZ,U as EZ,a0 as IZ,F as TZ,E as NZ,D as AZ,P as MZ,Q as RZ,j as PZ,ao as FZ,Y as OZ}from"./index-BJTdd6TP.js";import{C as BZ}from"./index-BT0QP1aV.js";function WZ(s,e,t){return e in s?Object.defineProperty(s,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):s[e]=t,s}function o5(s,e){var t=Object.keys(s);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(s);e&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(s,n).enumerable})),t.push.apply(t,i)}return t}function r5(s){for(var e=1;e=0)&&(t[n]=s[n]);return t}function VZ(s,e){if(s==null)return{};var t=HZ(s,e),i,n;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(s);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(s,i)&&(t[i]=s[i])}return t}function zZ(s,e){return UZ(s)||$Z(s,e)||jZ(s,e)||KZ()}function UZ(s){if(Array.isArray(s))return s}function $Z(s,e){if(!(typeof Symbol>"u"||!(Symbol.iterator in Object(s)))){var t=[],i=!0,n=!1,o=void 0;try{for(var r=s[Symbol.iterator](),a;!(i=(a=r.next()).done)&&(t.push(a.value),!(e&&t.length===e));i=!0);}catch(l){n=!0,o=l}finally{try{!i&&r.return!=null&&r.return()}finally{if(n)throw o}}return t}}function jZ(s,e){if(s){if(typeof s=="string")return a5(s,e);var t=Object.prototype.toString.call(s).slice(8,-1);if(t==="Object"&&s.constructor&&(t=s.constructor.name),t==="Map"||t==="Set")return Array.from(s);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return a5(s,e)}}function a5(s,e){(e==null||e>s.length)&&(e=s.length);for(var t=0,i=new Array(e);ti.map(i=>__vite__fileDeps[i]); +var LZ=Object.defineProperty;var xZ=(s,e,t)=>e in s?LZ(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var Z1=(s,e,t)=>(xZ(s,typeof e!="symbol"?e+"":e,t),t);import{d as _t,W as vm,M as Jo,Q as kZ,X as EZ,a2 as IZ,H as TZ,G as NZ,F as AZ,U as MZ,V as RZ,j as PZ,aq as FZ,a0 as OZ}from"./index-DM-gbCDZ.js";import{C as BZ}from"./index-0JY1nCFV.js";function WZ(s,e,t){return e in s?Object.defineProperty(s,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):s[e]=t,s}function o5(s,e){var t=Object.keys(s);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(s);e&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(s,n).enumerable})),t.push.apply(t,i)}return t}function r5(s){for(var e=1;e=0)&&(t[n]=s[n]);return t}function VZ(s,e){if(s==null)return{};var t=HZ(s,e),i,n;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(s);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(s,i)&&(t[i]=s[i])}return t}function zZ(s,e){return UZ(s)||$Z(s,e)||jZ(s,e)||KZ()}function UZ(s){if(Array.isArray(s))return s}function $Z(s,e){if(!(typeof Symbol>"u"||!(Symbol.iterator in Object(s)))){var t=[],i=!0,n=!1,o=void 0;try{for(var r=s[Symbol.iterator](),a;!(i=(a=r.next()).done)&&(t.push(a.value),!(e&&t.length===e));i=!0);}catch(l){n=!0,o=l}finally{try{!i&&r.return!=null&&r.return()}finally{if(n)throw o}}return t}}function jZ(s,e){if(s){if(typeof s=="string")return a5(s,e);var t=Object.prototype.toString.call(s).slice(8,-1);if(t==="Object"&&s.constructor&&(t=s.constructor.name),t==="Map"||t==="Set")return Array.from(s);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return a5(s,e)}}function a5(s,e){(e==null||e>s.length)&&(e=s.length);for(var t=0,i=new Array(e);t=s.length?s.apply(this,n):function(){for(var r=arguments.length,a=new Array(r),l=0;l1&&arguments[1]!==void 0?arguments[1]:{};X1.initial(s),X1.handler(e);var t={current:s},i=iv(rX)(t,e),n=iv(oX)(t),o=iv(X1.changes)(s),r=iv(sX)(t);function a(){var d=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(c){return c};return X1.selector(d),d(t.current)}function l(d){GZ(i,n,o,r)(d)}return[a,l]}function sX(s,e){return pb(e)?e(s.current):e}function oX(s,e){return s.current=d5(d5({},s.current),e),e}function rX(s,e,t){return pb(e)?e(s.current):Object.keys(t).forEach(function(i){var n;return(n=e[i])===null||n===void 0?void 0:n.call(e,s.current[i])}),t}var aX={create:nX},lX={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.43.0/min/vs"}};function dX(s){return function e(){for(var t=this,i=arguments.length,n=new Array(i),o=0;o=s.length?s.apply(this,n):function(){for(var r=arguments.length,a=new Array(r),l=0;l{if(e&&typeof e=="object"||typeof e=="function")for(let n of rLe(e))!aLe.call(s,n)&&n!==t&&sLe(s,n,{get:()=>e[n],enumerable:!(i=oLe(e,n))||i.enumerable});return s},dLe=(s,e,t)=>(lLe(s,e,"default"),t),yv={};dLe(yv,c0);var NK={},YI={},cLe=class AK{static getOrCreate(e){return YI[e]||(YI[e]=new AK(e)),YI[e]}constructor(e){this._languageId=e,this._loadingTriggered=!1,this._lazyLoadPromise=new Promise((t,i)=>{this._lazyLoadPromiseResolve=t,this._lazyLoadPromiseReject=i})}load(){return this._loadingTriggered||(this._loadingTriggered=!0,NK[this._languageId].loader().then(e=>this._lazyLoadPromiseResolve(e),e=>this._lazyLoadPromiseReject(e))),this._lazyLoadPromise}};function up(s){const e=s.id;NK[e]=s,yv.languages.register(s);const t=cLe.getOrCreate(e);yv.languages.registerTokensProviderFactory(e,{create:async()=>(await t.load()).language}),yv.languages.onLanguageEncountered(e,async()=>{const i=await t.load();yv.languages.setLanguageConfiguration(e,i.conf)})}up({id:"css",extensions:[".css"],aliases:["CSS","css"],mimetypes:["text/css"],loader:()=>Jo(()=>import("./css-D1nB4Vcj.js"),[])});up({id:"html",extensions:[".html",".htm",".shtml",".xhtml",".mdoc",".jsp",".asp",".aspx",".jshtm"],aliases:["HTML","htm","html","xhtml"],mimetypes:["text/html","text/x-jshtm","text/template","text/ng-template"],loader:()=>Jo(()=>import("./html-CDMIPMTW.js"),__vite__mapDeps([0,1,2,3]))});up({id:"javascript",extensions:[".js",".es6",".jsx",".mjs",".cjs"],firstLine:"^#!.*\\bnode",filenames:["jakefile"],aliases:["JavaScript","javascript","js"],mimetypes:["text/javascript"],loader:()=>Jo(()=>import("./javascript-CNZSM6YK.js"),__vite__mapDeps([4,5,1,2,3]))});up({id:"markdown",extensions:[".md",".markdown",".mdown",".mkdn",".mkd",".mdwn",".mdtxt",".mdtext"],aliases:["Markdown","markdown"],loader:()=>Jo(()=>import("./markdown-7fQo6M4U.js"),[])});up({id:"python",extensions:[".py",".rpy",".pyw",".cpy",".gyp",".gypi"],aliases:["Python","py"],firstLine:"^#!/.*\\bpython[0-9.-]*\\b",loader:()=>Jo(()=>import("./python-BPLqGtcV.js"),__vite__mapDeps([6,1,2,3]))});up({id:"typescript",extensions:[".ts",".tsx",".cts",".mts"],aliases:["TypeScript","ts","typescript"],mimetypes:["text/typescript"],loader:()=>Jo(()=>import("./typescript-Dox8aIts.js"),__vite__mapDeps([5,1,2,3]))});up({id:"yaml",extensions:[".yaml",".yml"],aliases:["YAML","yaml","YML","yml"],mimetypes:["application/x-yaml","text/x-yaml"],loader:()=>Jo(()=>import("./yaml-S2dQc2cB.js"),__vite__mapDeps([7,1,2,3]))});class uLe extends Ks{constructor(){super({id:"diffEditor.toggleCollapseUnchangedRegions",title:Ve("toggleCollapseUnchangedRegions","Toggle Collapse Unchanged Regions"),icon:oe.map,toggled:G.has("config.diffEditor.hideUnchangedRegions.enabled"),precondition:G.has("isInDiffEditor"),menu:{when:G.has("isInDiffEditor"),id:k.EditorTitle,order:22,group:"navigation"}})}run(e,...t){const i=e.get(rt),n=!i.getValue("diffEditor.hideUnchangedRegions.enabled");i.updateValue("diffEditor.hideUnchangedRegions.enabled",n)}}class MK extends Ks{constructor(){super({id:"diffEditor.toggleShowMovedCodeBlocks",title:Ve("toggleShowMovedCodeBlocks","Toggle Show Moved Code Blocks"),precondition:G.has("isInDiffEditor")})}run(e,...t){const i=e.get(rt),n=!i.getValue("diffEditor.experimental.showMoves");i.updateValue("diffEditor.experimental.showMoves",n)}}class RK extends Ks{constructor(){super({id:"diffEditor.toggleUseInlineViewWhenSpaceIsLimited",title:Ve("toggleUseInlineViewWhenSpaceIsLimited","Toggle Use Inline View When Space Is Limited"),precondition:G.has("isInDiffEditor")})}run(e,...t){const i=e.get(rt),n=!i.getValue("diffEditor.useInlineViewWhenSpaceIsLimited");i.updateValue("diffEditor.useInlineViewWhenSpaceIsLimited",n)}}const P1=Ve("diffEditor","Diff Editor");class hLe extends gl{constructor(){super({id:"diffEditor.switchSide",title:Ve("switchSide","Switch Side"),icon:oe.arrowSwap,precondition:G.has("isInDiffEditor"),f1:!0,category:P1})}runEditorCommand(e,t,i){const n=h0(e);if(n instanceof Uc){if(i&&i.dryRun)return{destinationSelection:n.mapToOtherSide().destinationSelection};n.switchSide()}}}class gLe extends gl{constructor(){super({id:"diffEditor.exitCompareMove",title:Ve("exitCompareMove","Exit Compare Move"),icon:oe.close,precondition:T.comparingMovedCode,f1:!1,category:P1,keybinding:{weight:1e4,primary:9}})}runEditorCommand(e,t,...i){const n=h0(e);n instanceof Uc&&n.exitCompareMove()}}class fLe extends gl{constructor(){super({id:"diffEditor.collapseAllUnchangedRegions",title:Ve("collapseAllUnchangedRegions","Collapse All Unchanged Regions"),icon:oe.fold,precondition:G.has("isInDiffEditor"),f1:!0,category:P1})}runEditorCommand(e,t,...i){const n=h0(e);n instanceof Uc&&n.collapseAllUnchangedRegions()}}class pLe extends gl{constructor(){super({id:"diffEditor.showAllUnchangedRegions",title:Ve("showAllUnchangedRegions","Show All Unchanged Regions"),icon:oe.unfold,precondition:G.has("isInDiffEditor"),f1:!0,category:P1})}runEditorCommand(e,t,...i){const n=h0(e);n instanceof Uc&&n.showAllUnchangedRegions()}}class xM extends Ks{constructor(){super({id:"diffEditor.revert",title:Ve("revert","Revert"),f1:!1,category:P1})}run(e,t){var i;const n=mLe(e,t.originalUri,t.modifiedUri);n instanceof Uc&&n.revertRangeMappings((i=t.mapping.innerChanges)!==null&&i!==void 0?i:[])}}const PK=Ve("accessibleDiffViewer","Accessible Diff Viewer");class u0 extends Ks{constructor(){super({id:u0.id,title:Ve("editor.action.accessibleDiffViewer.next","Go to Next Difference"),category:PK,precondition:G.has("isInDiffEditor"),keybinding:{primary:65,weight:100},f1:!0})}run(e){const t=h0(e);t==null||t.accessibleDiffViewerNext()}}u0.id="editor.action.accessibleDiffViewer.next";class F1 extends Ks{constructor(){super({id:F1.id,title:Ve("editor.action.accessibleDiffViewer.prev","Go to Previous Difference"),category:PK,precondition:G.has("isInDiffEditor"),keybinding:{primary:1089,weight:100},f1:!0})}run(e){const t=h0(e);t==null||t.accessibleDiffViewerPrev()}}F1.id="editor.action.accessibleDiffViewer.prev";function mLe(s,e,t){return s.get(xt).listDiffEditors().find(o=>{var r,a;const l=o.getModifiedEditor(),d=o.getOriginalEditor();return l&&((r=l.getModel())===null||r===void 0?void 0:r.uri.toString())===t.toString()&&d&&((a=d.getModel())===null||a===void 0?void 0:a.uri.toString())===e.toString()})||null}function h0(s){const t=s.get(xt).listDiffEditors(),i=Xn();if(i)for(const n of t){const o=n.getContainerDomNode();if(_Le(o,i))return n}return null}function _Le(s,e){let t=e;for(;t;){if(t===s)return!0;t=t.parentElement}return!1}qt(uLe);qt(MK);qt(RK);Sn.appendMenuItem(k.EditorTitle,{command:{id:new RK().desc.id,title:p("useInlineViewWhenSpaceIsLimited","Use Inline View When Space Is Limited"),toggled:G.has("config.diffEditor.useInlineViewWhenSpaceIsLimited"),precondition:G.has("isInDiffEditor")},order:11,group:"1_diff",when:G.and(T.diffEditorRenderSideBySideInlineBreakpointReached,G.has("isInDiffEditor"))});Sn.appendMenuItem(k.EditorTitle,{command:{id:new MK().desc.id,title:p("showMoves","Show Moved Code Blocks"),icon:oe.move,toggled:J_.create("config.diffEditor.experimental.showMoves",!0),precondition:G.has("isInDiffEditor")},order:10,group:"1_diff",when:G.has("isInDiffEditor")});qt(xM);for(const s of[{icon:oe.arrowRight,key:T.diffEditorInlineMode.toNegated()},{icon:oe.discard,key:T.diffEditorInlineMode}])Sn.appendMenuItem(k.DiffEditorHunkToolbar,{command:{id:new xM().desc.id,title:p("revertHunk","Revert Block"),icon:s.icon},when:G.and(T.diffEditorModifiedWritable,s.key),order:5,group:"primary"}),Sn.appendMenuItem(k.DiffEditorSelectionToolbar,{command:{id:new xM().desc.id,title:p("revertSelection","Revert Selection"),icon:s.icon},when:G.and(T.diffEditorModifiedWritable,s.key),order:5,group:"primary"});qt(hLe);qt(gLe);qt(fLe);qt(pLe);Sn.appendMenuItem(k.EditorTitle,{command:{id:u0.id,title:p("Open Accessible Diff Viewer","Open Accessible Diff Viewer"),precondition:G.has("isInDiffEditor")},order:10,group:"2_diff",when:G.and(T.accessibleDiffViewerVisible.negate(),G.has("isInDiffEditor"))});pt.registerCommandAlias("editor.action.diffReview.next",u0.id);qt(u0);pt.registerCommandAlias("editor.action.diffReview.prev",F1.id);qt(F1);var vLe=function(s,e,t,i){var n=arguments.length,o=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,e,t,i);else for(var a=s.length-1;a>=0;a--)(r=s[a])&&(o=(n<3?r(o):n>3?r(e,t,o):r(e,t))||o);return n>3&&o&&Object.defineProperty(e,t,o),o},bLe=function(s,e){return function(t,i){e(t,i,s)}},kM;const gk=new ue("selectionAnchorSet",!1);let $c=kM=class{static get(e){return e.getContribution(kM.ID)}constructor(e,t){this.editor=e,this.selectionAnchorSetContextKey=gk.bindTo(t),this.modelChangeListener=e.onDidChangeModel(()=>this.selectionAnchorSetContextKey.reset())}setSelectionAnchor(){if(this.editor.hasModel()){const e=this.editor.getPosition();this.editor.changeDecorations(t=>{this.decorationId&&t.removeDecoration(this.decorationId),this.decorationId=t.addDecoration(we.fromPositions(e,e),{description:"selection-anchor",stickiness:1,hoverMessage:new ss().appendText(p("selectionAnchor","Selection Anchor")),className:"selection-anchor"})}),this.selectionAnchorSetContextKey.set(!!this.decorationId),go(p("anchorSet","Anchor set at {0}:{1}",e.lineNumber,e.column))}}goToSelectionAnchor(){if(this.editor.hasModel()&&this.decorationId){const e=this.editor.getModel().getDecorationRange(this.decorationId);e&&this.editor.setPosition(e.getStartPosition())}}selectFromAnchorToCursor(){if(this.editor.hasModel()&&this.decorationId){const e=this.editor.getModel().getDecorationRange(this.decorationId);if(e){const t=this.editor.getPosition();this.editor.setSelection(we.fromPositions(e.getStartPosition(),t)),this.cancelSelectionAnchor()}}}cancelSelectionAnchor(){if(this.decorationId){const e=this.decorationId;this.editor.changeDecorations(t=>{t.removeDecoration(e),this.decorationId=void 0}),this.selectionAnchorSetContextKey.set(!1)}}dispose(){this.cancelSelectionAnchor(),this.modelChangeListener.dispose()}};$c.ID="editor.contrib.selectionAnchorController";$c=kM=vLe([bLe(1,Be)],$c);class CLe extends me{constructor(){super({id:"editor.action.setSelectionAnchor",label:p("setSelectionAnchor","Set Selection Anchor"),alias:"Set Selection Anchor",precondition:void 0,kbOpts:{kbExpr:T.editorTextFocus,primary:an(2089,2080),weight:100}})}async run(e,t){var i;(i=$c.get(t))===null||i===void 0||i.setSelectionAnchor()}}class wLe extends me{constructor(){super({id:"editor.action.goToSelectionAnchor",label:p("goToSelectionAnchor","Go to Selection Anchor"),alias:"Go to Selection Anchor",precondition:gk})}async run(e,t){var i;(i=$c.get(t))===null||i===void 0||i.goToSelectionAnchor()}}class yLe extends me{constructor(){super({id:"editor.action.selectFromAnchorToCursor",label:p("selectFromAnchorToCursor","Select from Anchor to Cursor"),alias:"Select from Anchor to Cursor",precondition:gk,kbOpts:{kbExpr:T.editorTextFocus,primary:an(2089,2089),weight:100}})}async run(e,t){var i;(i=$c.get(t))===null||i===void 0||i.selectFromAnchorToCursor()}}class SLe extends me{constructor(){super({id:"editor.action.cancelSelectionAnchor",label:p("cancelSelectionAnchor","Cancel Selection Anchor"),alias:"Cancel Selection Anchor",precondition:gk,kbOpts:{kbExpr:T.editorTextFocus,primary:9,weight:100}})}async run(e,t){var i;(i=$c.get(t))===null||i===void 0||i.cancelSelectionAnchor()}}kt($c.ID,$c,4);te(CLe);te(wLe);te(yLe);te(SLe);const DLe=N("editorOverviewRuler.bracketMatchForeground",{dark:"#A0A0A0",light:"#A0A0A0",hcDark:"#A0A0A0",hcLight:"#A0A0A0"},p("overviewRulerBracketMatchForeground","Overview ruler marker color for matching brackets."));class LLe extends me{constructor(){super({id:"editor.action.jumpToBracket",label:p("smartSelect.jumpBracket","Go to Bracket"),alias:"Go to Bracket",precondition:void 0,kbOpts:{kbExpr:T.editorTextFocus,primary:3165,weight:100}})}run(e,t){var i;(i=ga.get(t))===null||i===void 0||i.jumpToBracket()}}class xLe extends me{constructor(){super({id:"editor.action.selectToBracket",label:p("smartSelect.selectToBracket","Select to Bracket"),alias:"Select to Bracket",precondition:void 0,metadata:{description:Ve("smartSelect.selectToBracketDescription","Select the text inside and including the brackets or curly braces"),args:[{name:"args",schema:{type:"object",properties:{selectBrackets:{type:"boolean",default:!0}}}}]}})}run(e,t,i){var n;let o=!0;i&&i.selectBrackets===!1&&(o=!1),(n=ga.get(t))===null||n===void 0||n.selectToBracket(o)}}class kLe extends me{constructor(){super({id:"editor.action.removeBrackets",label:p("smartSelect.removeBrackets","Remove Brackets"),alias:"Remove Brackets",precondition:void 0,kbOpts:{kbExpr:T.editorTextFocus,primary:2561,weight:100}})}run(e,t){var i;(i=ga.get(t))===null||i===void 0||i.removeBrackets(this.id)}}class ELe{constructor(e,t,i){this.position=e,this.brackets=t,this.options=i}}class ga extends V{static get(e){return e.getContribution(ga.ID)}constructor(e){super(),this._editor=e,this._lastBracketsData=[],this._lastVersionId=0,this._decorations=this._editor.createDecorationsCollection(),this._updateBracketsSoon=this._register(new Ht(()=>this._updateBrackets(),50)),this._matchBrackets=this._editor.getOption(72),this._updateBracketsSoon.schedule(),this._register(e.onDidChangeCursorPosition(t=>{this._matchBrackets!=="never"&&this._updateBracketsSoon.schedule()})),this._register(e.onDidChangeModelContent(t=>{this._updateBracketsSoon.schedule()})),this._register(e.onDidChangeModel(t=>{this._lastBracketsData=[],this._updateBracketsSoon.schedule()})),this._register(e.onDidChangeModelLanguageConfiguration(t=>{this._lastBracketsData=[],this._updateBracketsSoon.schedule()})),this._register(e.onDidChangeConfiguration(t=>{t.hasChanged(72)&&(this._matchBrackets=this._editor.getOption(72),this._decorations.clear(),this._lastBracketsData=[],this._lastVersionId=0,this._updateBracketsSoon.schedule())})),this._register(e.onDidBlurEditorWidget(()=>{this._updateBracketsSoon.schedule()})),this._register(e.onDidFocusEditorWidget(()=>{this._updateBracketsSoon.schedule()}))}jumpToBracket(){if(!this._editor.hasModel())return;const e=this._editor.getModel(),t=this._editor.getSelections().map(i=>{const n=i.getStartPosition(),o=e.bracketPairs.matchBracket(n);let r=null;if(o)o[0].containsPosition(n)&&!o[1].containsPosition(n)?r=o[1].getStartPosition():o[1].containsPosition(n)&&(r=o[0].getStartPosition());else{const a=e.bracketPairs.findEnclosingBrackets(n);if(a)r=a[1].getStartPosition();else{const l=e.bracketPairs.findNextBracket(n);l&&l.range&&(r=l.range.getStartPosition())}}return r?new we(r.lineNumber,r.column,r.lineNumber,r.column):new we(n.lineNumber,n.column,n.lineNumber,n.column)});this._editor.setSelections(t),this._editor.revealRange(t[0])}selectToBracket(e){if(!this._editor.hasModel())return;const t=this._editor.getModel(),i=[];this._editor.getSelections().forEach(n=>{const o=n.getStartPosition();let r=t.bracketPairs.matchBracket(o);if(!r&&(r=t.bracketPairs.findEnclosingBrackets(o),!r)){const d=t.bracketPairs.findNextBracket(o);d&&d.range&&(r=t.bracketPairs.matchBracket(d.range.getStartPosition()))}let a=null,l=null;if(r){r.sort(x.compareRangesUsingStarts);const[d,c]=r;if(a=e?d.getStartPosition():d.getEndPosition(),l=e?c.getEndPosition():c.getStartPosition(),c.containsPosition(o)){const u=a;a=l,l=u}}a&&l&&i.push(new we(a.lineNumber,a.column,l.lineNumber,l.column))}),i.length>0&&(this._editor.setSelections(i),this._editor.revealRange(i[0]))}removeBrackets(e){if(!this._editor.hasModel())return;const t=this._editor.getModel();this._editor.getSelections().forEach(i=>{const n=i.getPosition();let o=t.bracketPairs.matchBracket(n);o||(o=t.bracketPairs.findEnclosingBrackets(n)),o&&(this._editor.pushUndoStop(),this._editor.executeEdits(e,[{range:o[0],text:""},{range:o[1],text:""}]),this._editor.pushUndoStop())})}_updateBrackets(){if(this._matchBrackets==="never")return;this._recomputeBrackets();const e=[];let t=0;for(const i of this._lastBracketsData){const n=i.brackets;n&&(e[t++]={range:n[0],options:i.options},e[t++]={range:n[1],options:i.options})}this._decorations.set(e)}_recomputeBrackets(){if(!this._editor.hasModel()||!this._editor.hasWidgetFocus()){this._lastBracketsData=[],this._lastVersionId=0;return}const e=this._editor.getSelections();if(e.length>100){this._lastBracketsData=[],this._lastVersionId=0;return}const t=this._editor.getModel(),i=t.getVersionId();let n=[];this._lastVersionId===i&&(n=this._lastBracketsData);const o=[];let r=0;for(let u=0,h=e.length;u1&&o.sort(W.compare);const a=[];let l=0,d=0;const c=n.length;for(let u=0,h=o.length;u0&&(t.pushUndoStop(),t.executeCommands(this.id,n),t.pushUndoStop())}}te(ALe);const fk=function(){if(typeof crypto=="object"&&typeof crypto.randomUUID=="function")return crypto.randomUUID.bind(crypto);let s;typeof crypto=="object"&&typeof crypto.getRandomValues=="function"?s=crypto.getRandomValues.bind(crypto):s=function(i){for(let n=0;ns,asFile:()=>{},value:typeof s=="string"?s:void 0}}function MLe(s,e,t){const i={id:fk(),name:s,uri:e,data:t};return{asString:async()=>"",asFile:()=>i,value:void 0}}class OK{constructor(){this._entries=new Map}get size(){let e=0;for(const t of this._entries)e++;return e}has(e){return this._entries.has(this.toKey(e))}matches(e){const t=[...this._entries.keys()];return ft.some(this,([i,n])=>n.asFile())&&t.push("files"),WK(sL(e),t)}get(e){var t;return(t=this._entries.get(this.toKey(e)))===null||t===void 0?void 0:t[0]}append(e,t){const i=this._entries.get(e);i?i.push(t):this._entries.set(this.toKey(e),[t])}replace(e,t){this._entries.set(this.toKey(e),[t])}delete(e){this._entries.delete(this.toKey(e))}*[Symbol.iterator](){for(const[e,t]of this._entries)for(const i of t)yield[e,i]}toKey(e){return sL(e)}}function sL(s){return s.toLowerCase()}function BK(s,e){return WK(sL(s),e.map(sL))}function WK(s,e){if(s==="*/*")return e.length>0;if(e.includes(s))return!0;const t=s.match(/^([a-z]+)\/([a-z]+|\*)$/i);if(!t)return!1;const[i,n,o]=t;return o==="*"?e.some(r=>r.startsWith(n+"/")):!1}const pk=Object.freeze({create:s=>Oc(s.map(e=>e.toString())).join(`\r + *-----------------------------------------------------------------------------*/var sLe=Object.defineProperty,oLe=Object.getOwnPropertyDescriptor,rLe=Object.getOwnPropertyNames,aLe=Object.prototype.hasOwnProperty,lLe=(s,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of rLe(e))!aLe.call(s,n)&&n!==t&&sLe(s,n,{get:()=>e[n],enumerable:!(i=oLe(e,n))||i.enumerable});return s},dLe=(s,e,t)=>(lLe(s,e,"default"),t),yv={};dLe(yv,c0);var NK={},YI={},cLe=class AK{static getOrCreate(e){return YI[e]||(YI[e]=new AK(e)),YI[e]}constructor(e){this._languageId=e,this._loadingTriggered=!1,this._lazyLoadPromise=new Promise((t,i)=>{this._lazyLoadPromiseResolve=t,this._lazyLoadPromiseReject=i})}load(){return this._loadingTriggered||(this._loadingTriggered=!0,NK[this._languageId].loader().then(e=>this._lazyLoadPromiseResolve(e),e=>this._lazyLoadPromiseReject(e))),this._lazyLoadPromise}};function up(s){const e=s.id;NK[e]=s,yv.languages.register(s);const t=cLe.getOrCreate(e);yv.languages.registerTokensProviderFactory(e,{create:async()=>(await t.load()).language}),yv.languages.onLanguageEncountered(e,async()=>{const i=await t.load();yv.languages.setLanguageConfiguration(e,i.conf)})}up({id:"css",extensions:[".css"],aliases:["CSS","css"],mimetypes:["text/css"],loader:()=>Jo(()=>import("./css-D1nB4Vcj.js"),[])});up({id:"html",extensions:[".html",".htm",".shtml",".xhtml",".mdoc",".jsp",".asp",".aspx",".jshtm"],aliases:["HTML","htm","html","xhtml"],mimetypes:["text/html","text/x-jshtm","text/template","text/ng-template"],loader:()=>Jo(()=>import("./html-BIdIcXKn.js"),__vite__mapDeps([0,1,2,3]))});up({id:"javascript",extensions:[".js",".es6",".jsx",".mjs",".cjs"],firstLine:"^#!.*\\bnode",filenames:["jakefile"],aliases:["JavaScript","javascript","js"],mimetypes:["text/javascript"],loader:()=>Jo(()=>import("./javascript-v91L9PnX.js"),__vite__mapDeps([4,5,1,2,3]))});up({id:"markdown",extensions:[".md",".markdown",".mdown",".mkdn",".mkd",".mdwn",".mdtxt",".mdtext"],aliases:["Markdown","markdown"],loader:()=>Jo(()=>import("./markdown-7fQo6M4U.js"),[])});up({id:"python",extensions:[".py",".rpy",".pyw",".cpy",".gyp",".gypi"],aliases:["Python","py"],firstLine:"^#!/.*\\bpython[0-9.-]*\\b",loader:()=>Jo(()=>import("./python-CXc8ROBf.js"),__vite__mapDeps([6,1,2,3]))});up({id:"typescript",extensions:[".ts",".tsx",".cts",".mts"],aliases:["TypeScript","ts","typescript"],mimetypes:["text/typescript"],loader:()=>Jo(()=>import("./typescript-DiSP2avv.js"),__vite__mapDeps([5,1,2,3]))});up({id:"yaml",extensions:[".yaml",".yml"],aliases:["YAML","yaml","YML","yml"],mimetypes:["application/x-yaml","text/x-yaml"],loader:()=>Jo(()=>import("./yaml-Bd3_JZ66.js"),__vite__mapDeps([7,1,2,3]))});class uLe extends Ks{constructor(){super({id:"diffEditor.toggleCollapseUnchangedRegions",title:Ve("toggleCollapseUnchangedRegions","Toggle Collapse Unchanged Regions"),icon:oe.map,toggled:G.has("config.diffEditor.hideUnchangedRegions.enabled"),precondition:G.has("isInDiffEditor"),menu:{when:G.has("isInDiffEditor"),id:k.EditorTitle,order:22,group:"navigation"}})}run(e,...t){const i=e.get(rt),n=!i.getValue("diffEditor.hideUnchangedRegions.enabled");i.updateValue("diffEditor.hideUnchangedRegions.enabled",n)}}class MK extends Ks{constructor(){super({id:"diffEditor.toggleShowMovedCodeBlocks",title:Ve("toggleShowMovedCodeBlocks","Toggle Show Moved Code Blocks"),precondition:G.has("isInDiffEditor")})}run(e,...t){const i=e.get(rt),n=!i.getValue("diffEditor.experimental.showMoves");i.updateValue("diffEditor.experimental.showMoves",n)}}class RK extends Ks{constructor(){super({id:"diffEditor.toggleUseInlineViewWhenSpaceIsLimited",title:Ve("toggleUseInlineViewWhenSpaceIsLimited","Toggle Use Inline View When Space Is Limited"),precondition:G.has("isInDiffEditor")})}run(e,...t){const i=e.get(rt),n=!i.getValue("diffEditor.useInlineViewWhenSpaceIsLimited");i.updateValue("diffEditor.useInlineViewWhenSpaceIsLimited",n)}}const P1=Ve("diffEditor","Diff Editor");class hLe extends gl{constructor(){super({id:"diffEditor.switchSide",title:Ve("switchSide","Switch Side"),icon:oe.arrowSwap,precondition:G.has("isInDiffEditor"),f1:!0,category:P1})}runEditorCommand(e,t,i){const n=h0(e);if(n instanceof Uc){if(i&&i.dryRun)return{destinationSelection:n.mapToOtherSide().destinationSelection};n.switchSide()}}}class gLe extends gl{constructor(){super({id:"diffEditor.exitCompareMove",title:Ve("exitCompareMove","Exit Compare Move"),icon:oe.close,precondition:T.comparingMovedCode,f1:!1,category:P1,keybinding:{weight:1e4,primary:9}})}runEditorCommand(e,t,...i){const n=h0(e);n instanceof Uc&&n.exitCompareMove()}}class fLe extends gl{constructor(){super({id:"diffEditor.collapseAllUnchangedRegions",title:Ve("collapseAllUnchangedRegions","Collapse All Unchanged Regions"),icon:oe.fold,precondition:G.has("isInDiffEditor"),f1:!0,category:P1})}runEditorCommand(e,t,...i){const n=h0(e);n instanceof Uc&&n.collapseAllUnchangedRegions()}}class pLe extends gl{constructor(){super({id:"diffEditor.showAllUnchangedRegions",title:Ve("showAllUnchangedRegions","Show All Unchanged Regions"),icon:oe.unfold,precondition:G.has("isInDiffEditor"),f1:!0,category:P1})}runEditorCommand(e,t,...i){const n=h0(e);n instanceof Uc&&n.showAllUnchangedRegions()}}class xM extends Ks{constructor(){super({id:"diffEditor.revert",title:Ve("revert","Revert"),f1:!1,category:P1})}run(e,t){var i;const n=mLe(e,t.originalUri,t.modifiedUri);n instanceof Uc&&n.revertRangeMappings((i=t.mapping.innerChanges)!==null&&i!==void 0?i:[])}}const PK=Ve("accessibleDiffViewer","Accessible Diff Viewer");class u0 extends Ks{constructor(){super({id:u0.id,title:Ve("editor.action.accessibleDiffViewer.next","Go to Next Difference"),category:PK,precondition:G.has("isInDiffEditor"),keybinding:{primary:65,weight:100},f1:!0})}run(e){const t=h0(e);t==null||t.accessibleDiffViewerNext()}}u0.id="editor.action.accessibleDiffViewer.next";class F1 extends Ks{constructor(){super({id:F1.id,title:Ve("editor.action.accessibleDiffViewer.prev","Go to Previous Difference"),category:PK,precondition:G.has("isInDiffEditor"),keybinding:{primary:1089,weight:100},f1:!0})}run(e){const t=h0(e);t==null||t.accessibleDiffViewerPrev()}}F1.id="editor.action.accessibleDiffViewer.prev";function mLe(s,e,t){return s.get(xt).listDiffEditors().find(o=>{var r,a;const l=o.getModifiedEditor(),d=o.getOriginalEditor();return l&&((r=l.getModel())===null||r===void 0?void 0:r.uri.toString())===t.toString()&&d&&((a=d.getModel())===null||a===void 0?void 0:a.uri.toString())===e.toString()})||null}function h0(s){const t=s.get(xt).listDiffEditors(),i=Xn();if(i)for(const n of t){const o=n.getContainerDomNode();if(_Le(o,i))return n}return null}function _Le(s,e){let t=e;for(;t;){if(t===s)return!0;t=t.parentElement}return!1}qt(uLe);qt(MK);qt(RK);Sn.appendMenuItem(k.EditorTitle,{command:{id:new RK().desc.id,title:p("useInlineViewWhenSpaceIsLimited","Use Inline View When Space Is Limited"),toggled:G.has("config.diffEditor.useInlineViewWhenSpaceIsLimited"),precondition:G.has("isInDiffEditor")},order:11,group:"1_diff",when:G.and(T.diffEditorRenderSideBySideInlineBreakpointReached,G.has("isInDiffEditor"))});Sn.appendMenuItem(k.EditorTitle,{command:{id:new MK().desc.id,title:p("showMoves","Show Moved Code Blocks"),icon:oe.move,toggled:J_.create("config.diffEditor.experimental.showMoves",!0),precondition:G.has("isInDiffEditor")},order:10,group:"1_diff",when:G.has("isInDiffEditor")});qt(xM);for(const s of[{icon:oe.arrowRight,key:T.diffEditorInlineMode.toNegated()},{icon:oe.discard,key:T.diffEditorInlineMode}])Sn.appendMenuItem(k.DiffEditorHunkToolbar,{command:{id:new xM().desc.id,title:p("revertHunk","Revert Block"),icon:s.icon},when:G.and(T.diffEditorModifiedWritable,s.key),order:5,group:"primary"}),Sn.appendMenuItem(k.DiffEditorSelectionToolbar,{command:{id:new xM().desc.id,title:p("revertSelection","Revert Selection"),icon:s.icon},when:G.and(T.diffEditorModifiedWritable,s.key),order:5,group:"primary"});qt(hLe);qt(gLe);qt(fLe);qt(pLe);Sn.appendMenuItem(k.EditorTitle,{command:{id:u0.id,title:p("Open Accessible Diff Viewer","Open Accessible Diff Viewer"),precondition:G.has("isInDiffEditor")},order:10,group:"2_diff",when:G.and(T.accessibleDiffViewerVisible.negate(),G.has("isInDiffEditor"))});pt.registerCommandAlias("editor.action.diffReview.next",u0.id);qt(u0);pt.registerCommandAlias("editor.action.diffReview.prev",F1.id);qt(F1);var vLe=function(s,e,t,i){var n=arguments.length,o=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,e,t,i);else for(var a=s.length-1;a>=0;a--)(r=s[a])&&(o=(n<3?r(o):n>3?r(e,t,o):r(e,t))||o);return n>3&&o&&Object.defineProperty(e,t,o),o},bLe=function(s,e){return function(t,i){e(t,i,s)}},kM;const gk=new ue("selectionAnchorSet",!1);let $c=kM=class{static get(e){return e.getContribution(kM.ID)}constructor(e,t){this.editor=e,this.selectionAnchorSetContextKey=gk.bindTo(t),this.modelChangeListener=e.onDidChangeModel(()=>this.selectionAnchorSetContextKey.reset())}setSelectionAnchor(){if(this.editor.hasModel()){const e=this.editor.getPosition();this.editor.changeDecorations(t=>{this.decorationId&&t.removeDecoration(this.decorationId),this.decorationId=t.addDecoration(we.fromPositions(e,e),{description:"selection-anchor",stickiness:1,hoverMessage:new ss().appendText(p("selectionAnchor","Selection Anchor")),className:"selection-anchor"})}),this.selectionAnchorSetContextKey.set(!!this.decorationId),go(p("anchorSet","Anchor set at {0}:{1}",e.lineNumber,e.column))}}goToSelectionAnchor(){if(this.editor.hasModel()&&this.decorationId){const e=this.editor.getModel().getDecorationRange(this.decorationId);e&&this.editor.setPosition(e.getStartPosition())}}selectFromAnchorToCursor(){if(this.editor.hasModel()&&this.decorationId){const e=this.editor.getModel().getDecorationRange(this.decorationId);if(e){const t=this.editor.getPosition();this.editor.setSelection(we.fromPositions(e.getStartPosition(),t)),this.cancelSelectionAnchor()}}}cancelSelectionAnchor(){if(this.decorationId){const e=this.decorationId;this.editor.changeDecorations(t=>{t.removeDecoration(e),this.decorationId=void 0}),this.selectionAnchorSetContextKey.set(!1)}}dispose(){this.cancelSelectionAnchor(),this.modelChangeListener.dispose()}};$c.ID="editor.contrib.selectionAnchorController";$c=kM=vLe([bLe(1,Be)],$c);class CLe extends me{constructor(){super({id:"editor.action.setSelectionAnchor",label:p("setSelectionAnchor","Set Selection Anchor"),alias:"Set Selection Anchor",precondition:void 0,kbOpts:{kbExpr:T.editorTextFocus,primary:an(2089,2080),weight:100}})}async run(e,t){var i;(i=$c.get(t))===null||i===void 0||i.setSelectionAnchor()}}class wLe extends me{constructor(){super({id:"editor.action.goToSelectionAnchor",label:p("goToSelectionAnchor","Go to Selection Anchor"),alias:"Go to Selection Anchor",precondition:gk})}async run(e,t){var i;(i=$c.get(t))===null||i===void 0||i.goToSelectionAnchor()}}class yLe extends me{constructor(){super({id:"editor.action.selectFromAnchorToCursor",label:p("selectFromAnchorToCursor","Select from Anchor to Cursor"),alias:"Select from Anchor to Cursor",precondition:gk,kbOpts:{kbExpr:T.editorTextFocus,primary:an(2089,2089),weight:100}})}async run(e,t){var i;(i=$c.get(t))===null||i===void 0||i.selectFromAnchorToCursor()}}class SLe extends me{constructor(){super({id:"editor.action.cancelSelectionAnchor",label:p("cancelSelectionAnchor","Cancel Selection Anchor"),alias:"Cancel Selection Anchor",precondition:gk,kbOpts:{kbExpr:T.editorTextFocus,primary:9,weight:100}})}async run(e,t){var i;(i=$c.get(t))===null||i===void 0||i.cancelSelectionAnchor()}}kt($c.ID,$c,4);te(CLe);te(wLe);te(yLe);te(SLe);const DLe=N("editorOverviewRuler.bracketMatchForeground",{dark:"#A0A0A0",light:"#A0A0A0",hcDark:"#A0A0A0",hcLight:"#A0A0A0"},p("overviewRulerBracketMatchForeground","Overview ruler marker color for matching brackets."));class LLe extends me{constructor(){super({id:"editor.action.jumpToBracket",label:p("smartSelect.jumpBracket","Go to Bracket"),alias:"Go to Bracket",precondition:void 0,kbOpts:{kbExpr:T.editorTextFocus,primary:3165,weight:100}})}run(e,t){var i;(i=ga.get(t))===null||i===void 0||i.jumpToBracket()}}class xLe extends me{constructor(){super({id:"editor.action.selectToBracket",label:p("smartSelect.selectToBracket","Select to Bracket"),alias:"Select to Bracket",precondition:void 0,metadata:{description:Ve("smartSelect.selectToBracketDescription","Select the text inside and including the brackets or curly braces"),args:[{name:"args",schema:{type:"object",properties:{selectBrackets:{type:"boolean",default:!0}}}}]}})}run(e,t,i){var n;let o=!0;i&&i.selectBrackets===!1&&(o=!1),(n=ga.get(t))===null||n===void 0||n.selectToBracket(o)}}class kLe extends me{constructor(){super({id:"editor.action.removeBrackets",label:p("smartSelect.removeBrackets","Remove Brackets"),alias:"Remove Brackets",precondition:void 0,kbOpts:{kbExpr:T.editorTextFocus,primary:2561,weight:100}})}run(e,t){var i;(i=ga.get(t))===null||i===void 0||i.removeBrackets(this.id)}}class ELe{constructor(e,t,i){this.position=e,this.brackets=t,this.options=i}}class ga extends V{static get(e){return e.getContribution(ga.ID)}constructor(e){super(),this._editor=e,this._lastBracketsData=[],this._lastVersionId=0,this._decorations=this._editor.createDecorationsCollection(),this._updateBracketsSoon=this._register(new Ht(()=>this._updateBrackets(),50)),this._matchBrackets=this._editor.getOption(72),this._updateBracketsSoon.schedule(),this._register(e.onDidChangeCursorPosition(t=>{this._matchBrackets!=="never"&&this._updateBracketsSoon.schedule()})),this._register(e.onDidChangeModelContent(t=>{this._updateBracketsSoon.schedule()})),this._register(e.onDidChangeModel(t=>{this._lastBracketsData=[],this._updateBracketsSoon.schedule()})),this._register(e.onDidChangeModelLanguageConfiguration(t=>{this._lastBracketsData=[],this._updateBracketsSoon.schedule()})),this._register(e.onDidChangeConfiguration(t=>{t.hasChanged(72)&&(this._matchBrackets=this._editor.getOption(72),this._decorations.clear(),this._lastBracketsData=[],this._lastVersionId=0,this._updateBracketsSoon.schedule())})),this._register(e.onDidBlurEditorWidget(()=>{this._updateBracketsSoon.schedule()})),this._register(e.onDidFocusEditorWidget(()=>{this._updateBracketsSoon.schedule()}))}jumpToBracket(){if(!this._editor.hasModel())return;const e=this._editor.getModel(),t=this._editor.getSelections().map(i=>{const n=i.getStartPosition(),o=e.bracketPairs.matchBracket(n);let r=null;if(o)o[0].containsPosition(n)&&!o[1].containsPosition(n)?r=o[1].getStartPosition():o[1].containsPosition(n)&&(r=o[0].getStartPosition());else{const a=e.bracketPairs.findEnclosingBrackets(n);if(a)r=a[1].getStartPosition();else{const l=e.bracketPairs.findNextBracket(n);l&&l.range&&(r=l.range.getStartPosition())}}return r?new we(r.lineNumber,r.column,r.lineNumber,r.column):new we(n.lineNumber,n.column,n.lineNumber,n.column)});this._editor.setSelections(t),this._editor.revealRange(t[0])}selectToBracket(e){if(!this._editor.hasModel())return;const t=this._editor.getModel(),i=[];this._editor.getSelections().forEach(n=>{const o=n.getStartPosition();let r=t.bracketPairs.matchBracket(o);if(!r&&(r=t.bracketPairs.findEnclosingBrackets(o),!r)){const d=t.bracketPairs.findNextBracket(o);d&&d.range&&(r=t.bracketPairs.matchBracket(d.range.getStartPosition()))}let a=null,l=null;if(r){r.sort(x.compareRangesUsingStarts);const[d,c]=r;if(a=e?d.getStartPosition():d.getEndPosition(),l=e?c.getEndPosition():c.getStartPosition(),c.containsPosition(o)){const u=a;a=l,l=u}}a&&l&&i.push(new we(a.lineNumber,a.column,l.lineNumber,l.column))}),i.length>0&&(this._editor.setSelections(i),this._editor.revealRange(i[0]))}removeBrackets(e){if(!this._editor.hasModel())return;const t=this._editor.getModel();this._editor.getSelections().forEach(i=>{const n=i.getPosition();let o=t.bracketPairs.matchBracket(n);o||(o=t.bracketPairs.findEnclosingBrackets(n)),o&&(this._editor.pushUndoStop(),this._editor.executeEdits(e,[{range:o[0],text:""},{range:o[1],text:""}]),this._editor.pushUndoStop())})}_updateBrackets(){if(this._matchBrackets==="never")return;this._recomputeBrackets();const e=[];let t=0;for(const i of this._lastBracketsData){const n=i.brackets;n&&(e[t++]={range:n[0],options:i.options},e[t++]={range:n[1],options:i.options})}this._decorations.set(e)}_recomputeBrackets(){if(!this._editor.hasModel()||!this._editor.hasWidgetFocus()){this._lastBracketsData=[],this._lastVersionId=0;return}const e=this._editor.getSelections();if(e.length>100){this._lastBracketsData=[],this._lastVersionId=0;return}const t=this._editor.getModel(),i=t.getVersionId();let n=[];this._lastVersionId===i&&(n=this._lastBracketsData);const o=[];let r=0;for(let u=0,h=e.length;u1&&o.sort(W.compare);const a=[];let l=0,d=0;const c=n.length;for(let u=0,h=o.length;u0&&(t.pushUndoStop(),t.executeCommands(this.id,n),t.pushUndoStop())}}te(ALe);const fk=function(){if(typeof crypto=="object"&&typeof crypto.randomUUID=="function")return crypto.randomUUID.bind(crypto);let s;typeof crypto=="object"&&typeof crypto.getRandomValues=="function"?s=crypto.getRandomValues.bind(crypto):s=function(i){for(let n=0;ns,asFile:()=>{},value:typeof s=="string"?s:void 0}}function MLe(s,e,t){const i={id:fk(),name:s,uri:e,data:t};return{asString:async()=>"",asFile:()=>i,value:void 0}}class OK{constructor(){this._entries=new Map}get size(){let e=0;for(const t of this._entries)e++;return e}has(e){return this._entries.has(this.toKey(e))}matches(e){const t=[...this._entries.keys()];return ft.some(this,([i,n])=>n.asFile())&&t.push("files"),WK(sL(e),t)}get(e){var t;return(t=this._entries.get(this.toKey(e)))===null||t===void 0?void 0:t[0]}append(e,t){const i=this._entries.get(e);i?i.push(t):this._entries.set(this.toKey(e),[t])}replace(e,t){this._entries.set(this.toKey(e),[t])}delete(e){this._entries.delete(this.toKey(e))}*[Symbol.iterator](){for(const[e,t]of this._entries)for(const i of t)yield[e,i]}toKey(e){return sL(e)}}function sL(s){return s.toLowerCase()}function BK(s,e){return WK(sL(s),e.map(sL))}function WK(s,e){if(s==="*/*")return e.length>0;if(e.includes(s))return!0;const t=s.match(/^([a-z]+)\/([a-z]+|\*)$/i);if(!t)return!1;const[i,n,o]=t;return o==="*"?e.some(r=>r.startsWith(n+"/")):!1}const pk=Object.freeze({create:s=>Oc(s.map(e=>e.toString())).join(`\r `),split:s=>s.split(`\r `),parse:s=>pk.split(s).filter(e=>!e.startsWith("#"))});class Wt{constructor(e){this.value=e}equals(e){return this.value===e.value}contains(e){return this.equals(e)||this.value===""||e.value.startsWith(this.value+Wt.sep)}intersects(e){return this.contains(e)||e.contains(this)}append(...e){return new Wt((this.value?[this.value,...e]:e).join(Wt.sep))}}Wt.sep=".";Wt.None=new Wt("@@none@@");Wt.Empty=new Wt("");const L7={EDITORS:"CodeEditors",FILES:"CodeFiles"};class RLe{}const PLe={DragAndDropContribution:"workbench.contributions.dragAndDrop"};Ji.add(PLe.DragAndDropContribution,new RLe);class DC{constructor(){}static getInstance(){return DC.INSTANCE}hasData(e){return e&&e===this.proto}getData(e){if(this.hasData(e))return this.data}}DC.INSTANCE=new DC;function HK(s){const e=new OK;for(const t of s.items){const i=t.type;if(t.kind==="string"){const n=new Promise(o=>t.getAsString(o));e.append(i,i4(n))}else if(t.kind==="file"){const n=t.getAsFile();n&&e.append(i,FLe(n))}}return e}function FLe(s){const e=s.path?Ae.parse(s.path):void 0;return MLe(s.name,e,async()=>new Uint8Array(await s.arrayBuffer()))}const OLe=Object.freeze([L7.EDITORS,L7.FILES,rC.RESOURCES,rC.INTERNAL_URI_LIST]);function VK(s,e=!1){const t=HK(s),i=t.get(rC.INTERNAL_URI_LIST);if(i)t.replace(Ii.uriList,i);else if(e||!t.has(Ii.uriList)){const n=[];for(const o of s.items){const r=o.getAsFile();if(r){const a=r.path;try{a?n.push(Ae.file(a).toString()):n.push(Ae.parse(r.name,!0).toString())}catch{}}}n.length&&t.replace(Ii.uriList,i4(pk.create(n)))}for(const n of OLe)t.delete(n);return t}var n4=function(s,e,t,i){var n=arguments.length,o=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,e,t,i);else for(var a=s.length-1;a>=0;a--)(r=s[a])&&(o=(n<3?r(o):n>3?r(e,t,o):r(e,t))||o);return n>3&&o&&Object.defineProperty(e,t,o),o},LC=function(s,e){return function(t,i){e(t,i,s)}};class s4{async provideDocumentPasteEdits(e,t,i,n,o){const r=await this.getEdit(i,o);if(r)return{dispose(){},edits:[{insertText:r.insertText,title:r.title,kind:r.kind,handledMimeType:r.handledMimeType,yieldTo:r.yieldTo}]}}async provideDocumentDropEdits(e,t,i,n){const o=await this.getEdit(i,n);return o?[{insertText:o.insertText,title:o.title,kind:o.kind,handledMimeType:o.handledMimeType,yieldTo:o.yieldTo}]:void 0}}class jc extends s4{constructor(){super(...arguments),this.kind=jc.kind,this.dropMimeTypes=[Ii.text],this.pasteMimeTypes=[Ii.text]}async getEdit(e,t){const i=e.get(Ii.text);if(!i||e.has(Ii.uriList))return;const n=await i.asString();return{handledMimeType:Ii.text,title:p("text.label","Insert Plain Text"),insertText:n,kind:this.kind}}}jc.id="text";jc.kind=new Wt("text.plain");class zK extends s4{constructor(){super(...arguments),this.kind=new Wt("uri.absolute"),this.dropMimeTypes=[Ii.uriList],this.pasteMimeTypes=[Ii.uriList]}async getEdit(e,t){const i=await UK(e);if(!i.length||t.isCancellationRequested)return;let n=0;const o=i.map(({uri:a,originalText:l})=>a.scheme===qe.file?a.fsPath:(n++,l)).join(" ");let r;return n>0?r=i.length>1?p("defaultDropProvider.uriList.uris","Insert Uris"):p("defaultDropProvider.uriList.uri","Insert Uri"):r=i.length>1?p("defaultDropProvider.uriList.paths","Insert Paths"):p("defaultDropProvider.uriList.path","Insert Path"),{handledMimeType:Ii.uriList,insertText:o,title:r,kind:this.kind}}}let oL=class extends s4{constructor(e){super(),this._workspaceContextService=e,this.kind=new Wt("uri.relative"),this.dropMimeTypes=[Ii.uriList],this.pasteMimeTypes=[Ii.uriList]}async getEdit(e,t){const i=await UK(e);if(!i.length||t.isCancellationRequested)return;const n=fd(i.map(({uri:o})=>{const r=this._workspaceContextService.getWorkspaceFolder(o);return r?zpe(r.uri,o):void 0}));if(n.length)return{handledMimeType:Ii.uriList,insertText:n.join(" "),title:i.length>1?p("defaultDropProvider.uriList.relativePaths","Insert Relative Paths"):p("defaultDropProvider.uriList.relativePath","Insert Relative Path"),kind:this.kind}}};oL=n4([LC(0,kf)],oL);class BLe{constructor(){this.kind=new Wt("html"),this.pasteMimeTypes=["text/html"],this._yieldTo=[{mimeType:Ii.text}]}async provideDocumentPasteEdits(e,t,i,n,o){var r;if(n.triggerKind!==xb.PasteAs&&!(!((r=n.only)===null||r===void 0)&&r.contains(this.kind)))return;const a=i.get("text/html"),l=await(a==null?void 0:a.asString());if(!(!l||o.isCancellationRequested))return{dispose(){},edits:[{insertText:l,yieldTo:this._yieldTo,title:p("pasteHtmlLabel","Insert HTML"),kind:this.kind}]}}}async function UK(s){const e=s.get(Ii.uriList);if(!e)return[];const t=await e.asString(),i=[];for(const n of pk.parse(t))try{i.push({uri:Ae.parse(n),originalText:n})}catch{}return i}let EM=class extends V{constructor(e,t){super(),this._register(e.documentDropEditProvider.register("*",new jc)),this._register(e.documentDropEditProvider.register("*",new zK)),this._register(e.documentDropEditProvider.register("*",new oL(t)))}};EM=n4([LC(0,be),LC(1,kf)],EM);let IM=class extends V{constructor(e,t){super(),this._register(e.documentPasteEditProvider.register("*",new jc)),this._register(e.documentPasteEditProvider.register("*",new zK)),this._register(e.documentPasteEditProvider.register("*",new oL(t))),this._register(e.documentPasteEditProvider.register("*",new BLe))}};IM=n4([LC(0,be),LC(1,kf)],IM);class ea{constructor(){this.value="",this.pos=0}static isDigitCharacter(e){return e>=48&&e<=57}static isVariableCharacter(e){return e===95||e>=97&&e<=122||e>=65&&e<=90}text(e){this.value=e,this.pos=0}tokenText(e){return this.value.substr(e.pos,e.len)}next(){if(this.pos>=this.value.length)return{type:14,pos:this.pos,len:0};const e=this.pos;let t=0,i=this.value.charCodeAt(e),n;if(n=ea._table[i],typeof n=="number")return this.pos+=1,{type:n,pos:e,len:1};if(ea.isDigitCharacter(i)){n=8;do t+=1,i=this.value.charCodeAt(e+t);while(ea.isDigitCharacter(i));return this.pos+=t,{type:n,pos:e,len:t}}if(ea.isVariableCharacter(i)){n=9;do i=this.value.charCodeAt(e+ ++t);while(ea.isVariableCharacter(i)||ea.isDigitCharacter(i));return this.pos+=t,{type:n,pos:e,len:t}}n=10;do t+=1,i=this.value.charCodeAt(e+t);while(!isNaN(i)&&typeof ea._table[i]>"u"&&!ea.isDigitCharacter(i)&&!ea.isVariableCharacter(i));return this.pos+=t,{type:n,pos:e,len:t}}}ea._table={36:0,58:1,44:2,123:3,125:4,92:5,47:6,124:7,43:11,45:12,63:13};class g0{constructor(){this._children=[]}appendChild(e){return e instanceof Ts&&this._children[this._children.length-1]instanceof Ts?this._children[this._children.length-1].value+=e.value:(e.parent=this,this._children.push(e)),this}replace(e,t){const{parent:i}=e,n=i.children.indexOf(e),o=i.children.slice(0);o.splice(n,1,...t),i._children=o,function r(a,l){for(const d of a)d.parent=l,r(d.children,d)}(t,i)}get children(){return this._children}get rightMostDescendant(){return this._children.length>0?this._children[this._children.length-1].rightMostDescendant:this}get snippet(){let e=this;for(;;){if(!e)return;if(e instanceof O1)return e;e=e.parent}}toString(){return this.children.reduce((e,t)=>e+t.toString(),"")}len(){return 0}}class Ts extends g0{constructor(e){super(),this.value=e}toString(){return this.value}len(){return this.value.length}clone(){return new Ts(this.value)}}class $K extends g0{}class br extends $K{static compareByIndex(e,t){return e.index===t.index?0:e.isFinalTabstop?1:t.isFinalTabstop||e.indext.index?1:0}constructor(e){super(),this.index=e}get isFinalTabstop(){return this.index===0}get choice(){return this._children.length===1&&this._children[0]instanceof f0?this._children[0]:void 0}clone(){const e=new br(this.index);return this.transform&&(e.transform=this.transform.clone()),e._children=this.children.map(t=>t.clone()),e}}class f0 extends g0{constructor(){super(...arguments),this.options=[]}appendChild(e){return e instanceof Ts&&(e.parent=this,this.options.push(e)),this}toString(){return this.options[0].value}len(){return this.options[0].len()}clone(){const e=new f0;return this.options.forEach(e.appendChild,e),e}}class o4 extends g0{constructor(){super(...arguments),this.regexp=new RegExp("")}resolve(e){const t=this;let i=!1,n=e.replace(this.regexp,function(){return i=!0,t._replace(Array.prototype.slice.call(arguments,0,-2))});return!i&&this._children.some(o=>o instanceof Oa&&!!o.elseValue)&&(n=this._replace([])),n}_replace(e){let t="";for(const i of this._children)if(i instanceof Oa){let n=e[i.index]||"";n=i.resolve(n),t+=n}else t+=i.toString();return t}toString(){return""}clone(){const e=new o4;return e.regexp=new RegExp(this.regexp.source,(this.regexp.ignoreCase?"i":"")+(this.regexp.global?"g":"")),e._children=this.children.map(t=>t.clone()),e}}class Oa extends g0{constructor(e,t,i,n){super(),this.index=e,this.shorthandName=t,this.ifValue=i,this.elseValue=n}resolve(e){return this.shorthandName==="upcase"?e?e.toLocaleUpperCase():"":this.shorthandName==="downcase"?e?e.toLocaleLowerCase():"":this.shorthandName==="capitalize"?e?e[0].toLocaleUpperCase()+e.substr(1):"":this.shorthandName==="pascalcase"?e?this._toPascalCase(e):"":this.shorthandName==="camelcase"?e?this._toCamelCase(e):"":e&&typeof this.ifValue=="string"?this.ifValue:!e&&typeof this.elseValue=="string"?this.elseValue:e||""}_toPascalCase(e){const t=e.match(/[a-z0-9]+/gi);return t?t.map(i=>i.charAt(0).toUpperCase()+i.substr(1)).join(""):e}_toCamelCase(e){const t=e.match(/[a-z0-9]+/gi);return t?t.map((i,n)=>n===0?i.charAt(0).toLowerCase()+i.substr(1):i.charAt(0).toUpperCase()+i.substr(1)).join(""):e}clone(){return new Oa(this.index,this.shorthandName,this.ifValue,this.elseValue)}}class xC extends $K{constructor(e){super(),this.name=e}resolve(e){let t=e.resolve(this);return this.transform&&(t=this.transform.resolve(t||"")),t!==void 0?(this._children=[new Ts(t)],!0):!1}clone(){const e=new xC(this.name);return this.transform&&(e.transform=this.transform.clone()),e._children=this.children.map(t=>t.clone()),e}}function x7(s,e){const t=[...s];for(;t.length>0;){const i=t.shift();if(!e(i))break;t.unshift(...i.children)}}class O1 extends g0{get placeholderInfo(){if(!this._placeholders){const e=[];let t;this.walk(function(i){return i instanceof br&&(e.push(i),t=!t||t.indexn===e?(i=!0,!1):(t+=n.len(),!0)),i?t:-1}fullLen(e){let t=0;return x7([e],i=>(t+=i.len(),!0)),t}enclosingPlaceholders(e){const t=[];let{parent:i}=e;for(;i;)i instanceof br&&t.push(i),i=i.parent;return t}resolveVariables(e){return this.walk(t=>(t instanceof xC&&t.resolve(e)&&(this._placeholders=void 0),!0)),this}appendChild(e){return this._placeholders=void 0,super.appendChild(e)}replace(e,t){return this._placeholders=void 0,super.replace(e,t)}clone(){const e=new O1;return this._children=this.children.map(t=>t.clone()),e}walk(e){x7(this.children,e)}}class Af{constructor(){this._scanner=new ea,this._token={type:14,pos:0,len:0}}static escape(e){return e.replace(/\$|}|\\/g,"\\$&")}static guessNeedsClipboard(e){return/\${?CLIPBOARD/.test(e)}parse(e,t,i){const n=new O1;return this.parseFragment(e,n),this.ensureFinalTabstop(n,i??!1,t??!1),n}parseFragment(e,t){const i=t.children.length;for(this._scanner.text(e),this._token=this._scanner.next();this._parse(t););const n=new Map,o=[];t.walk(l=>(l instanceof br&&(l.isFinalTabstop?n.set(0,void 0):!n.has(l.index)&&l.children.length>0?n.set(l.index,l.children):o.push(l)),!0));const r=(l,d)=>{const c=n.get(l.index);if(!c)return;const u=new br(l.index);u.transform=l.transform;for(const h of c){const g=h.clone();u.appendChild(g),g instanceof br&&n.has(g.index)&&!d.has(g.index)&&(d.add(g.index),r(g,d),d.delete(g.index))}t.replace(l,[u])},a=new Set;for(const l of o)r(l,a);return t.children.slice(i)}ensureFinalTabstop(e,t,i){(t||i&&e.placeholders.length>0)&&(e.placeholders.find(o=>o.index===0)||e.appendChild(new br(0)))}_accept(e,t){if(e===void 0||this._token.type===e){const i=t?this._scanner.tokenText(this._token):!0;return this._token=this._scanner.next(),i}return!1}_backTo(e){return this._scanner.pos=e.pos+e.len,this._token=e,!1}_until(e){const t=this._token;for(;this._token.type!==e;){if(this._token.type===14)return!1;if(this._token.type===5){const n=this._scanner.next();if(n.type!==0&&n.type!==4&&n.type!==5)return!1}this._token=this._scanner.next()}const i=this._scanner.value.substring(t.pos,this._token.pos).replace(/\\(\$|}|\\)/g,"$1");return this._token=this._scanner.next(),i}_parse(e){return this._parseEscaped(e)||this._parseTabstopOrVariableName(e)||this._parseComplexPlaceholder(e)||this._parseComplexVariable(e)||this._parseAnything(e)}_parseEscaped(e){let t;return(t=this._accept(5,!0))?(t=this._accept(0,!0)||this._accept(4,!0)||this._accept(5,!0)||t,e.appendChild(new Ts(t)),!0):!1}_parseTabstopOrVariableName(e){let t;const i=this._token;return this._accept(0)&&(t=this._accept(9,!0)||this._accept(8,!0))?(e.appendChild(/^\d+$/.test(t)?new br(Number(t)):new xC(t)),!0):this._backTo(i)}_parseComplexPlaceholder(e){let t;const i=this._token;if(!(this._accept(0)&&this._accept(3)&&(t=this._accept(8,!0))))return this._backTo(i);const o=new br(Number(t));if(this._accept(1))for(;;){if(this._accept(4))return e.appendChild(o),!0;if(!this._parse(o))return e.appendChild(new Ts("${"+t+":")),o.children.forEach(e.appendChild,e),!0}else if(o.index>0&&this._accept(7)){const r=new f0;for(;;){if(this._parseChoiceElement(r)){if(this._accept(2))continue;if(this._accept(7)&&(o.appendChild(r),this._accept(4)))return e.appendChild(o),!0}return this._backTo(i),!1}}else return this._accept(6)?this._parseTransform(o)?(e.appendChild(o),!0):(this._backTo(i),!1):this._accept(4)?(e.appendChild(o),!0):this._backTo(i)}_parseChoiceElement(e){const t=this._token,i=[];for(;!(this._token.type===2||this._token.type===7);){let n;if((n=this._accept(5,!0))?n=this._accept(2,!0)||this._accept(7,!0)||this._accept(5,!0)||n:n=this._accept(void 0,!0),!n)return this._backTo(t),!1;i.push(n)}return i.length===0?(this._backTo(t),!1):(e.appendChild(new Ts(i.join(""))),!0)}_parseComplexVariable(e){let t;const i=this._token;if(!(this._accept(0)&&this._accept(3)&&(t=this._accept(9,!0))))return this._backTo(i);const o=new xC(t);if(this._accept(1))for(;;){if(this._accept(4))return e.appendChild(o),!0;if(!this._parse(o))return e.appendChild(new Ts("${"+t+":")),o.children.forEach(e.appendChild,e),!0}else return this._accept(6)?this._parseTransform(o)?(e.appendChild(o),!0):(this._backTo(i),!1):this._accept(4)?(e.appendChild(o),!0):this._backTo(i)}_parseTransform(e){const t=new o4;let i="",n="";for(;!this._accept(6);){let o;if(o=this._accept(5,!0)){o=this._accept(6,!0)||o,i+=o;continue}if(this._token.type!==14){i+=this._accept(void 0,!0);continue}return!1}for(;!this._accept(6);){let o;if(o=this._accept(5,!0)){o=this._accept(5,!0)||this._accept(6,!0)||o,t.appendChild(new Ts(o));continue}if(!(this._parseFormatString(t)||this._parseAnything(t)))return!1}for(;!this._accept(4);){if(this._token.type!==14){n+=this._accept(void 0,!0);continue}return!1}try{t.regexp=new RegExp(i,n)}catch{return!1}return e.transform=t,!0}_parseFormatString(e){const t=this._token;if(!this._accept(0))return!1;let i=!1;this._accept(3)&&(i=!0);const n=this._accept(8,!0);if(n)if(i){if(this._accept(4))return e.appendChild(new Oa(Number(n))),!0;if(!this._accept(1))return this._backTo(t),!1}else return e.appendChild(new Oa(Number(n))),!0;else return this._backTo(t),!1;if(this._accept(6)){const o=this._accept(9,!0);return!o||!this._accept(4)?(this._backTo(t),!1):(e.appendChild(new Oa(Number(n),o)),!0)}else if(this._accept(11)){const o=this._until(4);if(o)return e.appendChild(new Oa(Number(n),void 0,o,void 0)),!0}else if(this._accept(12)){const o=this._until(4);if(o)return e.appendChild(new Oa(Number(n),void 0,void 0,o)),!0}else if(this._accept(13)){const o=this._until(1);if(o){const r=this._until(4);if(r)return e.appendChild(new Oa(Number(n),void 0,o,r)),!0}}else{const o=this._until(4);if(o)return e.appendChild(new Oa(Number(n),void 0,void 0,o)),!0}return this._backTo(t),!1}_parseAnything(e){return this._token.type!==14?(e.appendChild(new Ts(this._scanner.tokenText(this._token))),this._accept(void 0),!0):!1}}function jK(s,e,t){var i,n,o,r;return(typeof t.insertText=="string"?t.insertText==="":t.insertText.snippet==="")?{edits:(n=(i=t.additionalEdit)===null||i===void 0?void 0:i.edits)!==null&&n!==void 0?n:[]}:{edits:[...e.map(a=>new sh(s,{range:a,text:typeof t.insertText=="string"?Af.escape(t.insertText)+"$0":t.insertText.snippet,insertAsSnippet:!0})),...(r=(o=t.additionalEdit)===null||o===void 0?void 0:o.edits)!==null&&r!==void 0?r:[]]}}function KK(s){var e;function t(a,l){return"mimeType"in a?a.mimeType===l.handledMimeType:!!l.kind&&a.kind.contains(l.kind)}const i=new Map;for(const a of s)for(const l of(e=a.yieldTo)!==null&&e!==void 0?e:[])for(const d of s)if(d!==a&&t(l,d)){let c=i.get(a);c||(c=[],i.set(a,c)),c.push(d)}if(!i.size)return Array.from(s);const n=new Set,o=[];function r(a){if(!a.length)return[];const l=a[0];if(o.includes(l))return console.warn("Yield to cycle detected",l),a;if(n.has(l))return r(a.slice(1));let d=[];const c=i.get(l);return c&&(o.push(l),d=r(c),o.pop()),n.add(l),[...d,l,...r(a.slice(1))]}return r(Array.from(s))}var WLe=function(s,e,t,i){var n=arguments.length,o=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,e,t,i);else for(var a=s.length-1;a>=0;a--)(r=s[a])&&(o=(n<3?r(o):n>3?r(e,t,o):r(e,t))||o);return n>3&&o&&Object.defineProperty(e,t,o),o},HLe=function(s,e){return function(t,i){e(t,i,s)}};const VLe=Xe.register({description:"inline-progress-widget",stickiness:1,showIfCollapsed:!0,after:{content:nz,inlineClassName:"inline-editor-progress-decoration",inlineClassNameAffectsLetterSpacing:!0}});class mk extends V{constructor(e,t,i,n,o){super(),this.typeId=e,this.editor=t,this.range=i,this.delegate=o,this.allowEditorOverflow=!1,this.suppressMouseDown=!0,this.create(n),this.editor.addContentWidget(this),this.editor.layoutContentWidget(this)}create(e){this.domNode=he(".inline-progress-widget"),this.domNode.role="button",this.domNode.title=e;const t=he("span.icon");this.domNode.append(t),t.classList.add(...Pe.asClassNameArray(oe.loading),"codicon-modifier-spin");const i=()=>{const n=this.editor.getOption(67);this.domNode.style.height=`${n}px`,this.domNode.style.width=`${Math.ceil(.8*n)}px`};i(),this._register(this.editor.onDidChangeConfiguration(n=>{(n.hasChanged(52)||n.hasChanged(67))&&i()})),this._register(K(this.domNode,ee.CLICK,n=>{this.delegate.cancel()}))}getId(){return mk.baseId+"."+this.typeId}getDomNode(){return this.domNode}getPosition(){return{position:{lineNumber:this.range.startLineNumber,column:this.range.startColumn},preference:[0]}}dispose(){super.dispose(),this.editor.removeContentWidget(this)}}mk.baseId="editor.widget.inlineProgressWidget";let rL=class extends V{constructor(e,t,i){super(),this.id=e,this._editor=t,this._instantiationService=i,this._showDelay=500,this._showPromise=this._register(new $n),this._currentWidget=new $n,this._operationIdPool=0,this._currentDecorations=t.createDecorationsCollection()}async showWhile(e,t,i){const n=this._operationIdPool++;this._currentOperation=n,this.clear(),this._showPromise.value=bh(()=>{const o=x.fromPositions(e);this._currentDecorations.set([{range:o,options:VLe}]).length>0&&(this._currentWidget.value=this._instantiationService.createInstance(mk,this.id,this._editor,o,t,i))},this._showDelay);try{return await i}finally{this._currentOperation===n&&(this.clear(),this._currentOperation=void 0)}}clear(){this._showPromise.clear(),this._currentDecorations.clear(),this._currentWidget.clear()}};rL=WLe([HLe(2,Ne)],rL);var zLe=function(s,e,t,i){var n=arguments.length,o=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,e,t,i);else for(var a=s.length-1;a>=0;a--)(r=s[a])&&(o=(n<3?r(o):n>3?r(e,t,o):r(e,t))||o);return n>3&&o&&Object.defineProperty(e,t,o),o},k7=function(s,e){return function(t,i){e(t,i,s)}},rS;let Hs=rS=class{static get(e){return e.getContribution(rS.ID)}constructor(e,t,i){this._openerService=i,this._messageWidget=new $n,this._messageListeners=new Y,this._mouseOverMessage=!1,this._editor=e,this._visible=rS.MESSAGE_VISIBLE.bindTo(t)}dispose(){var e;(e=this._message)===null||e===void 0||e.dispose(),this._messageListeners.dispose(),this._messageWidget.dispose(),this._visible.reset()}showMessage(e,t){go(il(e)?e.value:e),this._visible.set(!0),this._messageWidget.clear(),this._messageListeners.clear(),this._message=il(e)?Wx(e,{actionHandler:{callback:n=>{this.closeMessage(),vO(this._openerService,n,il(e)?e.isTrusted:void 0)},disposables:this._messageListeners}}):void 0,this._messageWidget.value=new E7(this._editor,t,typeof e=="string"?e:this._message.element),this._messageListeners.add(ae.debounce(this._editor.onDidBlurEditorText,(n,o)=>o,0)(()=>{this._mouseOverMessage||this._messageWidget.value&&An(Xn(),this._messageWidget.value.getDomNode())||this.closeMessage()})),this._messageListeners.add(this._editor.onDidChangeCursorPosition(()=>this.closeMessage())),this._messageListeners.add(this._editor.onDidDispose(()=>this.closeMessage())),this._messageListeners.add(this._editor.onDidChangeModel(()=>this.closeMessage())),this._messageListeners.add(K(this._messageWidget.value.getDomNode(),ee.MOUSE_ENTER,()=>this._mouseOverMessage=!0,!0)),this._messageListeners.add(K(this._messageWidget.value.getDomNode(),ee.MOUSE_LEAVE,()=>this._mouseOverMessage=!1,!0));let i;this._messageListeners.add(this._editor.onMouseMove(n=>{n.target.position&&(i?i.containsPosition(n.target.position)||this.closeMessage():i=new x(t.lineNumber-3,1,n.target.position.lineNumber+3,1))}))}closeMessage(){this._visible.reset(),this._messageListeners.clear(),this._messageWidget.value&&this._messageListeners.add(E7.fadeOut(this._messageWidget.value))}};Hs.ID="editor.contrib.messageController";Hs.MESSAGE_VISIBLE=new ue("messageVisible",!1,p("messageVisible","Whether the editor is currently showing an inline message"));Hs=rS=zLe([k7(1,Be),k7(2,Oo)],Hs);const ULe=mn.bindToContribution(Hs.get);de(new ULe({id:"leaveEditorMessage",precondition:Hs.MESSAGE_VISIBLE,handler:s=>s.closeMessage(),kbOpts:{weight:130,primary:9}}));let E7=class{static fadeOut(e){const t=()=>{e.dispose(),clearTimeout(i),e.getDomNode().removeEventListener("animationend",t)},i=setTimeout(t,110);return e.getDomNode().addEventListener("animationend",t),e.getDomNode().classList.add("fadeOut"),{dispose:t}}constructor(e,{lineNumber:t,column:i},n){this.allowEditorOverflow=!0,this.suppressMouseDown=!1,this._editor=e,this._editor.revealLinesInCenterIfOutsideViewport(t,t,0),this._position={lineNumber:t,column:i},this._domNode=document.createElement("div"),this._domNode.classList.add("monaco-editor-overlaymessage"),this._domNode.style.marginLeft="-6px";const o=document.createElement("div");o.classList.add("anchor","top"),this._domNode.appendChild(o);const r=document.createElement("div");typeof n=="string"?(r.classList.add("message"),r.textContent=n):(n.classList.add("message"),r.appendChild(n)),this._domNode.appendChild(r);const a=document.createElement("div");a.classList.add("anchor","below"),this._domNode.appendChild(a),this._editor.addContentWidget(this),this._domNode.classList.add("fadeIn")}dispose(){this._editor.removeContentWidget(this)}getId(){return"messageoverlay"}getDomNode(){return this._domNode}getPosition(){return{position:this._position,preference:[1,2],positionAffinity:1}}afterRender(e){this._domNode.classList.toggle("below",e===2)}};kt(Hs.ID,Hs,4);var qK=function(s,e,t,i){var n=arguments.length,o=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,e,t,i);else for(var a=s.length-1;a>=0;a--)(r=s[a])&&(o=(n<3?r(o):n>3?r(e,t,o):r(e,t))||o);return n>3&&o&&Object.defineProperty(e,t,o),o},ob=function(s,e){return function(t,i){e(t,i,s)}},TM;let aL=TM=class extends V{constructor(e,t,i,n,o,r,a,l,d,c){super(),this.typeId=e,this.editor=t,this.showCommand=n,this.range=o,this.edits=r,this.onSelectNewEdit=a,this._contextMenuService=l,this._keybindingService=c,this.allowEditorOverflow=!0,this.suppressMouseDown=!0,this.create(),this.visibleContext=i.bindTo(d),this.visibleContext.set(!0),this._register(Ie(()=>this.visibleContext.reset())),this.editor.addContentWidget(this),this.editor.layoutContentWidget(this),this._register(Ie(()=>this.editor.removeContentWidget(this))),this._register(this.editor.onDidChangeCursorPosition(u=>{o.containsPosition(u.position)||this.dispose()})),this._register(ae.runAndSubscribe(c.onDidUpdateKeybindings,()=>{this._updateButtonTitle()}))}_updateButtonTitle(){var e;const t=(e=this._keybindingService.lookupKeybinding(this.showCommand.id))===null||e===void 0?void 0:e.getLabel();this.button.element.title=this.showCommand.label+(t?` (${t})`:"")}create(){this.domNode=he(".post-edit-widget"),this.button=this._register(new $D(this.domNode,{supportIcons:!0})),this.button.label="$(insert)",this._register(K(this.domNode,ee.CLICK,()=>this.showSelector()))}getId(){return TM.baseId+"."+this.typeId}getDomNode(){return this.domNode}getPosition(){return{position:this.range.getEndPosition(),preference:[2]}}showSelector(){this._contextMenuService.showContextMenu({getAnchor:()=>{const e=qi(this.button.element);return{x:e.left+e.width,y:e.top+e.height}},getActions:()=>this.edits.allEdits.map((e,t)=>tf({id:"",label:e.title,checked:t===this.edits.activeEditIndex,run:()=>{if(t!==this.edits.activeEditIndex)return this.onSelectNewEdit(t)}}))})}};aL.baseId="editor.widget.postEditWidget";aL=TM=qK([ob(7,Fo),ob(8,Be),ob(9,At)],aL);let lL=class extends V{constructor(e,t,i,n,o,r){super(),this._id=e,this._editor=t,this._visibleContext=i,this._showCommand=n,this._instantiationService=o,this._bulkEditService=r,this._currentWidget=this._register(new $n),this._register(ae.any(t.onDidChangeModel,t.onDidChangeModelContent)(()=>this.clear()))}async applyEditAndShowIfNeeded(e,t,i,n,o){const r=this._editor.getModel();if(!r||!e.length)return;const a=t.allEdits.at(t.activeEditIndex);if(!a)return;const l=await n(a,o);if(o.isCancellationRequested)return;const d=jK(r.uri,e,l),c=e[0],u=r.deltaDecorations([],[{range:c,options:{description:"paste-line-suffix",stickiness:0}}]);this._editor.focus();let h,g;try{h=await this._bulkEditService.apply(d,{editor:this._editor,token:o}),g=r.getDecorationRange(u[0])}finally{r.deltaDecorations(u,[])}o.isCancellationRequested||i&&h.isApplied&&t.allEdits.length>1&&this.show(g??c,t,async f=>{const m=this._editor.getModel();m&&(await m.undo(),this.applyEditAndShowIfNeeded(e,{activeEditIndex:f,allEdits:t.allEdits},i,n,o))})}show(e,t,i){this.clear(),this._editor.hasModel()&&(this._currentWidget.value=this._instantiationService.createInstance(aL,this._id,this._editor,this._visibleContext,this._showCommand,e,t,i))}clear(){this._currentWidget.clear()}tryShowSelector(){var e;(e=this._currentWidget.value)===null||e===void 0||e.showSelector()}};lL=qK([ob(4,Ne),ob(5,S1)],lL);var $Le=function(s,e,t,i){var n=arguments.length,o=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,e,t,i);else for(var a=s.length-1;a>=0;a--)(r=s[a])&&(o=(n<3?r(o):n>3?r(e,t,o):r(e,t))||o);return n>3&&o&&Object.defineProperty(e,t,o),o},Ip=function(s,e){return function(t,i){e(t,i,s)}},Eg;const GK="editor.changePasteType",r4=new ue("pasteWidgetVisible",!1,p("pasteWidgetVisible","Whether the paste widget is showing")),QI="application/vnd.code.copyMetadata";let Ld=Eg=class extends V{static get(e){return e.getContribution(Eg.ID)}constructor(e,t,i,n,o,r,a){super(),this._bulkEditService=i,this._clipboardService=n,this._languageFeaturesService=o,this._quickInputService=r,this._progressService=a,this._editor=e;const l=e.getContainerDomNode();this._register(K(l,"copy",d=>this.handleCopy(d))),this._register(K(l,"cut",d=>this.handleCopy(d))),this._register(K(l,"paste",d=>this.handlePaste(d),!0)),this._pasteProgressManager=this._register(new rL("pasteIntoEditor",e,t)),this._postPasteWidgetManager=this._register(t.createInstance(lL,"pasteIntoEditor",e,r4,{id:GK,label:p("postPasteWidgetTitle","Show paste options...")}))}changePasteType(){this._postPasteWidgetManager.tryShowSelector()}pasteAs(e){this._editor.focus();try{this._pasteAsActionContext={preferred:e},Q_().execCommand("paste")}finally{this._pasteAsActionContext=void 0}}clearWidgets(){this._postPasteWidgetManager.clear()}isPasteAsEnabled(){return this._editor.getOption(85).enabled&&!this._editor.getOption(91)}async finishedPaste(){await this._currentPasteOperation}handleCopy(e){var t,i;if(!this._editor.hasTextFocus()||(qh&&this._clipboardService.writeResources([]),!e.clipboardData||!this.isPasteAsEnabled()))return;const n=this._editor.getModel(),o=this._editor.getSelections();if(!n||!(o!=null&&o.length))return;const r=this._editor.getOption(37);let a=o;const l=o.length===1&&o[0].isEmpty();if(l){if(!r)return;a=[new x(a[0].startLineNumber,1,a[0].startLineNumber,1+n.getLineLength(a[0].startLineNumber))]}const d=(t=this._editor._getViewModel())===null||t===void 0?void 0:t.getPlainTextToCopy(o,r,as),u={multicursorText:Array.isArray(d)?d:null,pasteOnNewLine:l,mode:null},h=this._languageFeaturesService.documentPasteEditProvider.ordered(n).filter(v=>!!v.prepareDocumentPaste);if(!h.length){this.setCopyMetadata(e.clipboardData,{defaultPastePayload:u});return}const g=HK(e.clipboardData),f=h.flatMap(v=>{var b;return(b=v.copyMimeTypes)!==null&&b!==void 0?b:[]}),m=fk();this.setCopyMetadata(e.clipboardData,{id:m,providerCopyMimeTypes:f,defaultPastePayload:u});const _=Ln(async v=>{const b=fd(await Promise.all(h.map(async C=>{try{return await C.prepareDocumentPaste(n,a,g,v)}catch(w){console.error(w);return}})));b.reverse();for(const C of b)for(const[w,y]of C)g.replace(w,y);return g});(i=Eg._currentCopyOperation)===null||i===void 0||i.dataTransferPromise.cancel(),Eg._currentCopyOperation={handle:m,dataTransferPromise:_}}async handlePaste(e){var t,i,n,o;if(!e.clipboardData||!this._editor.hasTextFocus())return;(t=Hs.get(this._editor))===null||t===void 0||t.closeMessage(),(i=this._currentPasteOperation)===null||i===void 0||i.cancel(),this._currentPasteOperation=void 0;const r=this._editor.getModel(),a=this._editor.getSelections();if(!(a!=null&&a.length)||!r||!this.isPasteAsEnabled()&&!this._pasteAsActionContext)return;const l=this.fetchCopyMetadata(e),d=VK(e.clipboardData);d.delete(QI);const c=[...e.clipboardData.types,...(n=l==null?void 0:l.providerCopyMimeTypes)!==null&&n!==void 0?n:[],Ii.uriList],u=this._languageFeaturesService.documentPasteEditProvider.ordered(r).filter(h=>{var g,f;const m=(g=this._pasteAsActionContext)===null||g===void 0?void 0:g.preferred;return m&&h.providedPasteEditKinds&&!this.providerMatchesPreference(h,m)?!1:(f=h.pasteMimeTypes)===null||f===void 0?void 0:f.some(_=>BK(_,c))});if(!u.length){!((o=this._pasteAsActionContext)===null||o===void 0)&&o.preferred&&this.showPasteAsNoEditMessage(a,this._pasteAsActionContext.preferred);return}e.preventDefault(),e.stopImmediatePropagation(),this._pasteAsActionContext?this.showPasteAsPick(this._pasteAsActionContext.preferred,u,a,d,l):this.doPasteInline(u,a,d,l,e)}showPasteAsNoEditMessage(e,t){var i;(i=Hs.get(this._editor))===null||i===void 0||i.showMessage(p("pasteAsError","No paste edits for '{0}' found",t instanceof Wt?t.value:t.providerId),e[0].getStartPosition())}doPasteInline(e,t,i,n,o){const r=Ln(async a=>{const l=this._editor;if(!l.hasModel())return;const d=l.getModel(),c=new Th(l,3,void 0,a);try{if(await this.mergeInDataFromCopy(i,n,c.token),c.token.isCancellationRequested)return;const u=e.filter(f=>this.isSupportedPasteProvider(f,i));if(!u.length||u.length===1&&u[0]instanceof jc)return this.applyDefaultPasteHandler(i,n,c.token,o);const h={triggerKind:xb.Automatic},g=await this.getPasteEdits(u,i,d,t,h,c.token);if(c.token.isCancellationRequested)return;if(g.length===1&&g[0].provider instanceof jc)return this.applyDefaultPasteHandler(i,n,c.token,o);if(g.length){const f=l.getOption(85).showPasteSelector==="afterPaste";return this._postPasteWidgetManager.applyEditAndShowIfNeeded(t,{activeEditIndex:0,allEdits:g},f,async(m,_)=>{var v,b;const C=await((b=(v=m.provider).resolveDocumentPasteEdit)===null||b===void 0?void 0:b.call(v,m,_));return C&&(m.additionalEdit=C.additionalEdit),m},c.token)}await this.applyDefaultPasteHandler(i,n,c.token,o)}finally{c.dispose(),this._currentPasteOperation===r&&(this._currentPasteOperation=void 0)}});this._pasteProgressManager.showWhile(t[0].getEndPosition(),p("pasteIntoEditorProgress","Running paste handlers. Click to cancel"),r),this._currentPasteOperation=r}showPasteAsPick(e,t,i,n,o){const r=Ln(async a=>{const l=this._editor;if(!l.hasModel())return;const d=l.getModel(),c=new Th(l,3,void 0,a);try{if(await this.mergeInDataFromCopy(n,o,c.token),c.token.isCancellationRequested)return;let u=t.filter(_=>this.isSupportedPasteProvider(_,n,e));e&&(u=u.filter(_=>this.providerMatchesPreference(_,e)));const h={triggerKind:xb.PasteAs,only:e&&e instanceof Wt?e:void 0};let g=await this.getPasteEdits(u,n,d,i,h,c.token);if(c.token.isCancellationRequested)return;if(e&&(g=g.filter(_=>e instanceof Wt?e.contains(_.kind):e.providerId===_.provider.id)),!g.length){h.only&&this.showPasteAsNoEditMessage(i,h.only);return}let f;if(e)f=g.at(0);else{const _=await this._quickInputService.pick(g.map(v=>{var b;return{label:v.title,description:(b=v.kind)===null||b===void 0?void 0:b.value,edit:v}}),{placeHolder:p("pasteAsPickerPlaceholder","Select Paste Action")});f=_==null?void 0:_.edit}if(!f)return;const m=jK(d.uri,i,f);await this._bulkEditService.apply(m,{editor:this._editor})}finally{c.dispose(),this._currentPasteOperation===r&&(this._currentPasteOperation=void 0)}});this._progressService.withProgress({location:10,title:p("pasteAsProgress","Running paste handlers")},()=>r)}setCopyMetadata(e,t){e.setData(QI,JSON.stringify(t))}fetchCopyMetadata(e){var t;if(!e.clipboardData)return;const i=e.clipboardData.getData(QI);if(i)try{return JSON.parse(i)}catch{return}const[n,o]=EA.getTextData(e.clipboardData);if(o)return{defaultPastePayload:{mode:o.mode,multicursorText:(t=o.multicursorText)!==null&&t!==void 0?t:null,pasteOnNewLine:!!o.isFromEmptySelection}}}async mergeInDataFromCopy(e,t,i){var n;if(t!=null&&t.id&&((n=Eg._currentCopyOperation)===null||n===void 0?void 0:n.handle)===t.id){const o=await Eg._currentCopyOperation.dataTransferPromise;if(i.isCancellationRequested)return;for(const[r,a]of o)e.replace(r,a)}if(!e.has(Ii.uriList)){const o=await this._clipboardService.readResources();if(i.isCancellationRequested)return;o.length&&e.append(Ii.uriList,i4(pk.create(o)))}}async getPasteEdits(e,t,i,n,o,r){const a=await d1(Promise.all(e.map(async d=>{var c,u;try{const h=await((c=d.provideDocumentPasteEdits)===null||c===void 0?void 0:c.call(d,i,n,t,o,r));return(u=h==null?void 0:h.edits)===null||u===void 0?void 0:u.map(g=>({...g,provider:d}))}catch(h){console.error(h)}})),r),l=fd(a??[]).flat().filter(d=>!o.only||o.only.contains(d.kind));return KK(l)}async applyDefaultPasteHandler(e,t,i,n){var o,r,a,l;const d=(o=e.get(Ii.text))!==null&&o!==void 0?o:e.get("text"),c=(r=await(d==null?void 0:d.asString()))!==null&&r!==void 0?r:"";if(i.isCancellationRequested)return;const u={clipboardEvent:n,text:c,pasteOnNewLine:(a=t==null?void 0:t.defaultPastePayload.pasteOnNewLine)!==null&&a!==void 0?a:!1,multicursorText:(l=t==null?void 0:t.defaultPastePayload.multicursorText)!==null&&l!==void 0?l:null,mode:null};this._editor.trigger("keyboard","paste",u)}isSupportedPasteProvider(e,t,i){var n;return!((n=e.pasteMimeTypes)===null||n===void 0)&&n.some(o=>t.matches(o))?!i||this.providerMatchesPreference(e,i):!1}providerMatchesPreference(e,t){return t instanceof Wt?e.providedPasteEditKinds?e.providedPasteEditKinds.some(i=>t.contains(i)):!0:e.id===t.providerId}};Ld.ID="editor.contrib.copyPasteActionController";Ld=Eg=$Le([Ip(1,Ne),Ip(2,S1),Ip(3,tu),Ip(4,be),Ip(5,lp),Ip(6,tj)],Ld);const Mf="9_cutcopypaste",jLe=Ya||document.queryCommandSupported("cut"),ZK=Ya||document.queryCommandSupported("copy"),KLe=typeof navigator.clipboard>"u"||Pr?document.queryCommandSupported("paste"):!0;function a4(s){return s.register(),s}const qLe=jLe?a4(new e0({id:"editor.action.clipboardCutAction",precondition:void 0,kbOpts:Ya?{primary:2102,win:{primary:2102,secondary:[1044]},weight:100}:void 0,menuOpts:[{menuId:k.MenubarEditMenu,group:"2_ccp",title:p({key:"miCut",comment:["&& denotes a mnemonic"]},"Cu&&t"),order:1},{menuId:k.EditorContext,group:Mf,title:p("actions.clipboard.cutLabel","Cut"),when:T.writable,order:1},{menuId:k.CommandPalette,group:"",title:p("actions.clipboard.cutLabel","Cut"),order:1},{menuId:k.SimpleEditorContext,group:Mf,title:p("actions.clipboard.cutLabel","Cut"),when:T.writable,order:1}]})):void 0,GLe=ZK?a4(new e0({id:"editor.action.clipboardCopyAction",precondition:void 0,kbOpts:Ya?{primary:2081,win:{primary:2081,secondary:[2067]},weight:100}:void 0,menuOpts:[{menuId:k.MenubarEditMenu,group:"2_ccp",title:p({key:"miCopy",comment:["&& denotes a mnemonic"]},"&&Copy"),order:2},{menuId:k.EditorContext,group:Mf,title:p("actions.clipboard.copyLabel","Copy"),order:2},{menuId:k.CommandPalette,group:"",title:p("actions.clipboard.copyLabel","Copy"),order:1},{menuId:k.SimpleEditorContext,group:Mf,title:p("actions.clipboard.copyLabel","Copy"),order:2}]})):void 0;Sn.appendMenuItem(k.MenubarEditMenu,{submenu:k.MenubarCopy,title:Ve("copy as","Copy As"),group:"2_ccp",order:3});Sn.appendMenuItem(k.EditorContext,{submenu:k.EditorContextCopy,title:Ve("copy as","Copy As"),group:Mf,order:3});Sn.appendMenuItem(k.EditorContext,{submenu:k.EditorContextShare,title:Ve("share","Share"),group:"11_share",order:-1,when:G.and(G.notEquals("resourceScheme","output"),T.editorTextFocus)});Sn.appendMenuItem(k.EditorTitleContext,{submenu:k.EditorTitleContextShare,title:Ve("share","Share"),group:"11_share",order:-1});Sn.appendMenuItem(k.ExplorerContext,{submenu:k.ExplorerContextShare,title:Ve("share","Share"),group:"11_share",order:-1});const JI=KLe?a4(new e0({id:"editor.action.clipboardPasteAction",precondition:void 0,kbOpts:Ya?{primary:2100,win:{primary:2100,secondary:[1043]},linux:{primary:2100,secondary:[1043]},weight:100}:void 0,menuOpts:[{menuId:k.MenubarEditMenu,group:"2_ccp",title:p({key:"miPaste",comment:["&& denotes a mnemonic"]},"&&Paste"),order:4},{menuId:k.EditorContext,group:Mf,title:p("actions.clipboard.pasteLabel","Paste"),when:T.writable,order:4},{menuId:k.CommandPalette,group:"",title:p("actions.clipboard.pasteLabel","Paste"),order:1},{menuId:k.SimpleEditorContext,group:Mf,title:p("actions.clipboard.pasteLabel","Paste"),when:T.writable,order:4}]})):void 0;class ZLe extends me{constructor(){super({id:"editor.action.clipboardCopyWithSyntaxHighlightingAction",label:p("actions.clipboard.copyWithSyntaxHighlightingLabel","Copy With Syntax Highlighting"),alias:"Copy With Syntax Highlighting",precondition:void 0,kbOpts:{kbExpr:T.textInputFocus,primary:0,weight:100}})}run(e,t){!t.hasModel()||!t.getOption(37)&&t.getSelection().isEmpty()||(xA.forceCopyWithSyntaxHighlighting=!0,t.focus(),t.getContainerDomNode().ownerDocument.execCommand("copy"),xA.forceCopyWithSyntaxHighlighting=!1)}}function XK(s,e){s&&(s.addImplementation(1e4,"code-editor",(t,i)=>{const n=t.get(xt).getFocusedCodeEditor();if(n&&n.hasTextFocus()){const o=n.getOption(37),r=n.getSelection();return r&&r.isEmpty()&&!o||n.getContainerDomNode().ownerDocument.execCommand(e),!0}return!1}),s.addImplementation(0,"generic-dom",(t,i)=>(Q_().execCommand(e),!0)))}XK(qLe,"cut");XK(GLe,"copy");JI&&(JI.addImplementation(1e4,"code-editor",(s,e)=>{var t,i;const n=s.get(xt),o=s.get(tu),r=n.getFocusedCodeEditor();return r&&r.hasTextFocus()?r.getContainerDomNode().ownerDocument.execCommand("paste")?(i=(t=Ld.get(r))===null||t===void 0?void 0:t.finishedPaste())!==null&&i!==void 0?i:Promise.resolve():qh?(async()=>{const l=await o.readText();if(l!==""){const d=Gb.INSTANCE.get(l);let c=!1,u=null,h=null;d&&(c=r.getOption(37)&&!!d.isFromEmptySelection,u=typeof d.multicursorText<"u"?d.multicursorText:null,h=d.mode),r.trigger("keyboard","paste",{text:l,pasteOnNewLine:c,multicursorText:u,mode:h})}})():!0:!1}),JI.addImplementation(0,"generic-dom",(s,e)=>(Q_().execCommand("paste"),!0)));ZK&&te(ZLe);const ai=new class{constructor(){this.QuickFix=new Wt("quickfix"),this.Refactor=new Wt("refactor"),this.RefactorExtract=this.Refactor.append("extract"),this.RefactorInline=this.Refactor.append("inline"),this.RefactorMove=this.Refactor.append("move"),this.RefactorRewrite=this.Refactor.append("rewrite"),this.Notebook=new Wt("notebook"),this.Source=new Wt("source"),this.SourceOrganizeImports=this.Source.append("organizeImports"),this.SourceFixAll=this.Source.append("fixAll"),this.SurroundWith=this.Refactor.append("surround")}};var Mo;(function(s){s.Refactor="refactor",s.RefactorPreview="refactor preview",s.Lightbulb="lightbulb",s.Default="other (default)",s.SourceAction="source action",s.QuickFix="quick fix action",s.FixAll="fix all",s.OrganizeImports="organize imports",s.AutoFix="auto fix",s.QuickFixHover="quick fix hover window",s.OnSave="save participants",s.ProblemsView="problems view"})(Mo||(Mo={}));function XLe(s,e){return!(s.include&&!s.include.intersects(e)||s.excludes&&s.excludes.some(t=>YK(e,t,s.include))||!s.includeSourceActions&&ai.Source.contains(e))}function YLe(s,e){const t=e.kind?new Wt(e.kind):void 0;return!(s.include&&(!t||!s.include.contains(t))||s.excludes&&t&&s.excludes.some(i=>YK(t,i,s.include))||!s.includeSourceActions&&t&&ai.Source.contains(t)||s.onlyIncludePreferredActions&&!e.isPreferred)}function YK(s,e,t){return!(!e.contains(s)||t&&e.contains(t))}class ql{static fromUser(e,t){return!e||typeof e!="object"?new ql(t.kind,t.apply,!1):new ql(ql.getKindFromUser(e,t.kind),ql.getApplyFromUser(e,t.apply),ql.getPreferredUser(e))}static getApplyFromUser(e,t){switch(typeof e.apply=="string"?e.apply.toLowerCase():""){case"first":return"first";case"never":return"never";case"ifsingle":return"ifSingle";default:return t}}static getKindFromUser(e,t){return typeof e.kind=="string"?new Wt(e.kind):t}static getPreferredUser(e){return typeof e.preferred=="boolean"?e.preferred:!1}constructor(e,t,i){this.kind=e,this.apply=t,this.preferred=i}}class QLe{constructor(e,t,i){this.action=e,this.provider=t,this.highlightRange=i}async resolve(e){var t;if(!((t=this.provider)===null||t===void 0)&&t.resolveCodeAction&&!this.action.edit){let i;try{i=await this.provider.resolveCodeAction(this.action,e)}catch(n){Ni(n)}i&&(this.action.edit=i.edit)}return this}}const QK="editor.action.codeAction",l4="editor.action.quickFix",JK="editor.action.autoFix",eq="editor.action.refactor",tq="editor.action.sourceAction",d4="editor.action.organizeImports",c4="editor.action.fixAll";class rb extends V{static codeActionsPreferredComparator(e,t){return e.isPreferred&&!t.isPreferred?-1:!e.isPreferred&&t.isPreferred?1:0}static codeActionsComparator({action:e},{action:t}){return e.isAI&&!t.isAI?1:!e.isAI&&t.isAI?-1:rs(e.diagnostics)?rs(t.diagnostics)?rb.codeActionsPreferredComparator(e,t):-1:rs(t.diagnostics)?1:rb.codeActionsPreferredComparator(e,t)}constructor(e,t,i){super(),this.documentation=t,this._register(i),this.allActions=[...e].sort(rb.codeActionsComparator),this.validActions=this.allActions.filter(({action:n})=>!n.disabled)}get hasAutoFix(){return this.validActions.some(({action:e})=>!!e.kind&&ai.QuickFix.contains(new Wt(e.kind))&&!!e.isPreferred)}get hasAIFix(){return this.validActions.some(({action:e})=>!!e.isAI)}get allAIFixes(){return this.validActions.every(({action:e})=>!!e.isAI)}}const I7={actions:[],documentation:void 0};async function ab(s,e,t,i,n,o){var r;const a=i.filter||{},l={...a,excludes:[...a.excludes||[],ai.Notebook]},d={only:(r=a.include)===null||r===void 0?void 0:r.value,trigger:i.type},c=new t4(e,o),u=i.type===2,h=JLe(s,e,u?l:a),g=new Y,f=h.map(async _=>{try{n.report(_);const v=await _.provideCodeActions(e,t,d,c.token);if(v&&g.add(v),c.token.isCancellationRequested)return I7;const b=((v==null?void 0:v.actions)||[]).filter(w=>w&&YLe(a,w)),C=txe(_,b,a.include);return{actions:b.map(w=>new QLe(w,_)),documentation:C}}catch(v){if(kd(v))throw v;return Ni(v),I7}}),m=s.onDidChange(()=>{const _=s.all(e);wi(_,h)||c.cancel()});try{const _=await Promise.all(f),v=_.map(C=>C.actions).flat(),b=[...fd(_.map(C=>C.documentation)),...exe(s,e,i,v)];return new rb(v,b,g)}finally{m.dispose(),c.dispose()}}function JLe(s,e,t){return s.all(e).filter(i=>i.providedCodeActionKinds?i.providedCodeActionKinds.some(n=>XLe(t,new Wt(n))):!0)}function*exe(s,e,t,i){var n,o,r;if(e&&i.length)for(const a of s.all(e))a._getAdditionalMenuItems&&(yield*(n=a._getAdditionalMenuItems)===null||n===void 0?void 0:n.call(a,{trigger:t.type,only:(r=(o=t.filter)===null||o===void 0?void 0:o.include)===null||r===void 0?void 0:r.value},i.map(l=>l.action)))}function txe(s,e,t){if(!s.documentation)return;const i=s.documentation.map(n=>({kind:new Wt(n.kind),command:n.command}));if(t){let n;for(const o of i)o.kind.contains(t)&&(n?n.kind.contains(o.kind)&&(n=o):n=o);if(n)return n==null?void 0:n.command}for(const n of e)if(n.kind){for(const o of i)if(o.kind.contains(new Wt(n.kind)))return o.command}}var Yg;(function(s){s.OnSave="onSave",s.FromProblemsView="fromProblemsView",s.FromCodeActions="fromCodeActions",s.FromAILightbulb="fromAILightbulb"})(Yg||(Yg={}));async function ixe(s,e,t,i,n=dt.None){var o;const r=s.get(S1),a=s.get(ui),l=s.get(qs),d=s.get(en);if(l.publicLog2("codeAction.applyCodeAction",{codeActionTitle:e.action.title,codeActionKind:e.action.kind,codeActionIsPreferred:!!e.action.isPreferred,reason:t}),await e.resolve(n),!n.isCancellationRequested&&!(!((o=e.action.edit)===null||o===void 0)&&o.edits.length&&!(await r.apply(e.action.edit,{editor:i==null?void 0:i.editor,label:e.action.title,quotableLabel:e.action.title,code:"undoredo.codeAction",respectAutoSaveConfig:t!==Yg.OnSave,showPreview:i==null?void 0:i.preview})).isApplied)&&e.action.command)try{await a.executeCommand(e.action.command.id,...e.action.command.arguments||[])}catch(c){const u=nxe(c);d.error(typeof u=="string"?u:p("applyCodeActionFailed","An unknown error occurred while applying the code action"))}}function nxe(s){return typeof s=="string"?s:s instanceof Error&&typeof s.message=="string"?s.message:void 0}pt.registerCommand("_executeCodeActionProvider",async function(s,e,t,i,n){if(!(e instanceof Ae))throw Ar();const{codeActionProvider:o}=s.get(be),r=s.get(_i).getModel(e);if(!r)throw Ar();const a=we.isISelection(t)?we.liftSelection(t):x.isIRange(t)?r.validateRange(t):void 0;if(!a)throw Ar();const l=typeof i=="string"?new Wt(i):void 0,d=await ab(o,r,a,{type:1,triggerAction:Mo.Default,filter:{includeSourceActions:!0,include:l}},Tc.None,dt.None),c=[],u=Math.min(d.validActions.length,typeof n=="number"?n:0);for(let h=0;hh.action)}finally{setTimeout(()=>d.dispose(),100)}});var sxe=function(s,e,t,i){var n=arguments.length,o=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,e,t,i);else for(var a=s.length-1;a>=0;a--)(r=s[a])&&(o=(n<3?r(o):n>3?r(e,t,o):r(e,t))||o);return n>3&&o&&Object.defineProperty(e,t,o),o},oxe=function(s,e){return function(t,i){e(t,i,s)}},NM;let dL=NM=class{constructor(e){this.keybindingService=e}getResolver(){const e=new hl(()=>this.keybindingService.getKeybindings().filter(t=>NM.codeActionCommands.indexOf(t.command)>=0).filter(t=>t.resolvedKeybinding).map(t=>{let i=t.commandArgs;return t.command===d4?i={kind:ai.SourceOrganizeImports.value}:t.command===c4&&(i={kind:ai.SourceFixAll.value}),{resolvedKeybinding:t.resolvedKeybinding,...ql.fromUser(i,{kind:Wt.None,apply:"never"})}}));return t=>{if(t.kind){const i=this.bestKeybindingForCodeAction(t,e.value);return i==null?void 0:i.resolvedKeybinding}}}bestKeybindingForCodeAction(e,t){if(!e.kind)return;const i=new Wt(e.kind);return t.filter(n=>n.kind.contains(i)).filter(n=>n.preferred?e.isPreferred:!0).reduceRight((n,o)=>n?n.kind.contains(o.kind)?o:n:o,void 0)}};dL.codeActionCommands=[eq,QK,tq,d4,c4];dL=NM=sxe([oxe(0,At)],dL);N("symbolIcon.arrayForeground",{dark:re,light:re,hcDark:re,hcLight:re},p("symbolIcon.arrayForeground","The foreground color for array symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));N("symbolIcon.booleanForeground",{dark:re,light:re,hcDark:re,hcLight:re},p("symbolIcon.booleanForeground","The foreground color for boolean symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));N("symbolIcon.classForeground",{dark:"#EE9D28",light:"#D67E00",hcDark:"#EE9D28",hcLight:"#D67E00"},p("symbolIcon.classForeground","The foreground color for class symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));N("symbolIcon.colorForeground",{dark:re,light:re,hcDark:re,hcLight:re},p("symbolIcon.colorForeground","The foreground color for color symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));N("symbolIcon.constantForeground",{dark:re,light:re,hcDark:re,hcLight:re},p("symbolIcon.constantForeground","The foreground color for constant symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));N("symbolIcon.constructorForeground",{dark:"#B180D7",light:"#652D90",hcDark:"#B180D7",hcLight:"#652D90"},p("symbolIcon.constructorForeground","The foreground color for constructor symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));N("symbolIcon.enumeratorForeground",{dark:"#EE9D28",light:"#D67E00",hcDark:"#EE9D28",hcLight:"#D67E00"},p("symbolIcon.enumeratorForeground","The foreground color for enumerator symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));N("symbolIcon.enumeratorMemberForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},p("symbolIcon.enumeratorMemberForeground","The foreground color for enumerator member symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));N("symbolIcon.eventForeground",{dark:"#EE9D28",light:"#D67E00",hcDark:"#EE9D28",hcLight:"#D67E00"},p("symbolIcon.eventForeground","The foreground color for event symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));N("symbolIcon.fieldForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},p("symbolIcon.fieldForeground","The foreground color for field symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));N("symbolIcon.fileForeground",{dark:re,light:re,hcDark:re,hcLight:re},p("symbolIcon.fileForeground","The foreground color for file symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));N("symbolIcon.folderForeground",{dark:re,light:re,hcDark:re,hcLight:re},p("symbolIcon.folderForeground","The foreground color for folder symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));N("symbolIcon.functionForeground",{dark:"#B180D7",light:"#652D90",hcDark:"#B180D7",hcLight:"#652D90"},p("symbolIcon.functionForeground","The foreground color for function symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));N("symbolIcon.interfaceForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},p("symbolIcon.interfaceForeground","The foreground color for interface symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));N("symbolIcon.keyForeground",{dark:re,light:re,hcDark:re,hcLight:re},p("symbolIcon.keyForeground","The foreground color for key symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));N("symbolIcon.keywordForeground",{dark:re,light:re,hcDark:re,hcLight:re},p("symbolIcon.keywordForeground","The foreground color for keyword symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));N("symbolIcon.methodForeground",{dark:"#B180D7",light:"#652D90",hcDark:"#B180D7",hcLight:"#652D90"},p("symbolIcon.methodForeground","The foreground color for method symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));N("symbolIcon.moduleForeground",{dark:re,light:re,hcDark:re,hcLight:re},p("symbolIcon.moduleForeground","The foreground color for module symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));N("symbolIcon.namespaceForeground",{dark:re,light:re,hcDark:re,hcLight:re},p("symbolIcon.namespaceForeground","The foreground color for namespace symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));N("symbolIcon.nullForeground",{dark:re,light:re,hcDark:re,hcLight:re},p("symbolIcon.nullForeground","The foreground color for null symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));N("symbolIcon.numberForeground",{dark:re,light:re,hcDark:re,hcLight:re},p("symbolIcon.numberForeground","The foreground color for number symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));N("symbolIcon.objectForeground",{dark:re,light:re,hcDark:re,hcLight:re},p("symbolIcon.objectForeground","The foreground color for object symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));N("symbolIcon.operatorForeground",{dark:re,light:re,hcDark:re,hcLight:re},p("symbolIcon.operatorForeground","The foreground color for operator symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));N("symbolIcon.packageForeground",{dark:re,light:re,hcDark:re,hcLight:re},p("symbolIcon.packageForeground","The foreground color for package symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));N("symbolIcon.propertyForeground",{dark:re,light:re,hcDark:re,hcLight:re},p("symbolIcon.propertyForeground","The foreground color for property symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));N("symbolIcon.referenceForeground",{dark:re,light:re,hcDark:re,hcLight:re},p("symbolIcon.referenceForeground","The foreground color for reference symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));N("symbolIcon.snippetForeground",{dark:re,light:re,hcDark:re,hcLight:re},p("symbolIcon.snippetForeground","The foreground color for snippet symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));N("symbolIcon.stringForeground",{dark:re,light:re,hcDark:re,hcLight:re},p("symbolIcon.stringForeground","The foreground color for string symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));N("symbolIcon.structForeground",{dark:re,light:re,hcDark:re,hcLight:re},p("symbolIcon.structForeground","The foreground color for struct symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));N("symbolIcon.textForeground",{dark:re,light:re,hcDark:re,hcLight:re},p("symbolIcon.textForeground","The foreground color for text symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));N("symbolIcon.typeParameterForeground",{dark:re,light:re,hcDark:re,hcLight:re},p("symbolIcon.typeParameterForeground","The foreground color for type parameter symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));N("symbolIcon.unitForeground",{dark:re,light:re,hcDark:re,hcLight:re},p("symbolIcon.unitForeground","The foreground color for unit symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));N("symbolIcon.variableForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},p("symbolIcon.variableForeground","The foreground color for variable symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));const iq=Object.freeze({kind:Wt.Empty,title:p("codeAction.widget.id.more","More Actions...")}),rxe=Object.freeze([{kind:ai.QuickFix,title:p("codeAction.widget.id.quickfix","Quick Fix")},{kind:ai.RefactorExtract,title:p("codeAction.widget.id.extract","Extract"),icon:oe.wrench},{kind:ai.RefactorInline,title:p("codeAction.widget.id.inline","Inline"),icon:oe.wrench},{kind:ai.RefactorRewrite,title:p("codeAction.widget.id.convert","Rewrite"),icon:oe.wrench},{kind:ai.RefactorMove,title:p("codeAction.widget.id.move","Move"),icon:oe.wrench},{kind:ai.SurroundWith,title:p("codeAction.widget.id.surround","Surround With"),icon:oe.surroundWith},{kind:ai.Source,title:p("codeAction.widget.id.source","Source Action"),icon:oe.symbolFile},iq]);function axe(s,e,t){if(!e)return s.map(o=>{var r;return{kind:"action",item:o,group:iq,disabled:!!o.action.disabled,label:o.action.disabled||o.action.title,canPreview:!!(!((r=o.action.edit)===null||r===void 0)&&r.edits.length)}});const i=rxe.map(o=>({group:o,actions:[]}));for(const o of s){const r=o.action.kind?new Wt(o.action.kind):Wt.None;for(const a of i)if(a.group.kind.contains(r)){a.actions.push(o);break}}const n=[];for(const o of i)if(o.actions.length){n.push({kind:"header",group:o.group});for(const r of o.actions){const a=o.group;n.push({kind:"action",item:r,group:r.action.isAI?{title:a.title,kind:a.kind,icon:oe.sparkle}:a,label:r.action.title,disabled:!!r.action.disabled,keybinding:t(r.action)})}}return n}var lxe=function(s,e,t,i){var n=arguments.length,o=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,e,t,i);else for(var a=s.length-1;a>=0;a--)(r=s[a])&&(o=(n<3?r(o):n>3?r(e,t,o):r(e,t))||o);return n>3&&o&&Object.defineProperty(e,t,o),o},T7=function(s,e){return function(t,i){e(t,i,s)}},AM,fm;(function(s){s.Hidden={type:0};class e{constructor(i,n,o,r){this.actions=i,this.trigger=n,this.editorPosition=o,this.widgetPosition=r,this.type=1}}s.Showing=e})(fm||(fm={}));let Rf=AM=class extends V{constructor(e,t,i){super(),this._editor=e,this._keybindingService=t,this._onClick=this._register(new B),this.onClick=this._onClick.event,this._state=fm.Hidden,this._iconClasses=[],this._domNode=he("div.lightBulbWidget"),this._domNode.role="listbox",this._register(Gt.ignoreTarget(this._domNode)),this._editor.addContentWidget(this),this._register(this._editor.onDidChangeModelContent(n=>{const o=this._editor.getModel();(this.state.type!==1||!o||this.state.editorPosition.lineNumber>=o.getLineCount())&&this.hide()})),this._register(eae(this._domNode,n=>{if(this.state.type!==1)return;this._editor.focus(),n.preventDefault();const{top:o,height:r}=qi(this._domNode),a=this._editor.getOption(67);let l=Math.floor(a/3);this.state.widgetPosition.position!==null&&this.state.widgetPosition.position.lineNumber{(n.buttons&1)===1&&this.hide()})),this._register(ae.runAndSubscribe(this._keybindingService.onDidUpdateKeybindings,()=>{var n,o,r,a;this._preferredKbLabel=(o=(n=this._keybindingService.lookupKeybinding(JK))===null||n===void 0?void 0:n.getLabel())!==null&&o!==void 0?o:void 0,this._quickFixKbLabel=(a=(r=this._keybindingService.lookupKeybinding(l4))===null||r===void 0?void 0:r.getLabel())!==null&&a!==void 0?a:void 0,this._updateLightBulbTitleAndIcon()}))}dispose(){super.dispose(),this._editor.removeContentWidget(this)}getId(){return"LightBulbWidget"}getDomNode(){return this._domNode}getPosition(){return this._state.type===1?this._state.widgetPosition:null}update(e,t,i){if(e.validActions.length<=0)return this.hide();if(!this._editor.getOptions().get(65).enabled)return this.hide();const o=this._editor.getModel();if(!o)return this.hide();const{lineNumber:r,column:a}=o.validatePosition(i),l=o.getOptions().tabSize,d=this._editor.getOptions().get(50),c=o.getLineContent(r),u=Ix(c,l),h=d.spaceWidth*u>22,g=_=>_>2&&this._editor.getTopForLineNumber(_)===this._editor.getTopForLineNumber(_-1);let f=r,m=1;if(!h){if(r>1&&!g(r-1))f-=1;else if(r=0;a--)(r=s[a])&&(o=(n<3?r(o):n>3?r(e,t,o):r(e,t))||o);return n>3&&o&&Object.defineProperty(e,t,o),o},MM=function(s,e){return function(t,i){e(t,i,s)}};const sq="acceptSelectedCodeAction",oq="previewSelectedCodeAction";class dxe{get templateId(){return"header"}renderTemplate(e){e.classList.add("group-header");const t=document.createElement("span");return e.append(t),{container:e,text:t}}renderElement(e,t,i){var n,o;i.text.textContent=(o=(n=e.group)===null||n===void 0?void 0:n.title)!==null&&o!==void 0?o:""}disposeTemplate(e){}}let RM=class{get templateId(){return"action"}constructor(e,t){this._supportsPreview=e,this._keybindingService=t}renderTemplate(e){e.classList.add(this.templateId);const t=document.createElement("div");t.className="icon",e.append(t);const i=document.createElement("span");i.className="title",e.append(i);const n=new d0(e,Do);return{container:e,icon:t,text:i,keybinding:n}}renderElement(e,t,i){var n,o,r;if(!((n=e.group)===null||n===void 0)&&n.icon?(i.icon.className=Pe.asClassName(e.group.icon),e.group.icon.color&&(i.icon.style.color=fe(e.group.icon.color.id))):(i.icon.className=Pe.asClassName(oe.lightBulb),i.icon.style.color="var(--vscode-editorLightBulb-foreground)"),!e.item||!e.label)return;i.text.textContent=rq(e.label),i.keybinding.set(e.keybinding),pae(!!e.keybinding,i.keybinding.element);const a=(o=this._keybindingService.lookupKeybinding(sq))===null||o===void 0?void 0:o.getLabel(),l=(r=this._keybindingService.lookupKeybinding(oq))===null||r===void 0?void 0:r.getLabel();i.container.classList.toggle("option-disabled",e.disabled),e.disabled?i.container.title=e.label:a&&l?this._supportsPreview&&e.canPreview?i.container.title=p({key:"label-preview",comment:['placeholders are keybindings, e.g "F2 to Apply, Shift+F2 to Preview"']},"{0} to Apply, {1} to Preview",a,l):i.container.title=p({key:"label",comment:['placeholder is a keybinding, e.g "F2 to Apply"']},"{0} to Apply",a):i.container.title=""}disposeTemplate(e){e.keybinding.dispose()}};RM=nq([MM(1,At)],RM);class cxe extends UIEvent{constructor(){super("acceptSelectedAction")}}class N7 extends UIEvent{constructor(){super("previewSelectedAction")}}function uxe(s){if(s.kind==="action")return s.label}let PM=class extends V{constructor(e,t,i,n,o,r){super(),this._delegate=n,this._contextViewService=o,this._keybindingService=r,this._actionLineHeight=24,this._headerLineHeight=26,this.cts=this._register(new Hi),this.domNode=document.createElement("div"),this.domNode.classList.add("actionList");const a={getHeight:l=>l.kind==="header"?this._headerLineHeight:this._actionLineHeight,getTemplateId:l=>l.kind};this._list=this._register(new hr(e,this.domNode,a,[new RM(t,this._keybindingService),new dxe],{keyboardSupport:!1,typeNavigationEnabled:!0,keyboardNavigationLabelProvider:{getKeyboardNavigationLabel:uxe},accessibilityProvider:{getAriaLabel:l=>{if(l.kind==="action"){let d=l.label?rq(l==null?void 0:l.label):"";return l.disabled&&(d=p({key:"customQuickFixWidget.labels",comment:["Action widget labels for accessibility."]},"{0}, Disabled Reason: {1}",d,l.disabled)),d}return null},getWidgetAriaLabel:()=>p({key:"customQuickFixWidget",comment:["An action widget option"]},"Action Widget"),getRole:l=>l.kind==="action"?"option":"separator",getWidgetRole:()=>"listbox"}})),this._list.style(rp),this._register(this._list.onMouseClick(l=>this.onListClick(l))),this._register(this._list.onMouseOver(l=>this.onListHover(l))),this._register(this._list.onDidChangeFocus(()=>this.onFocus())),this._register(this._list.onDidChangeSelection(l=>this.onListSelection(l))),this._allMenuItems=i,this._list.splice(0,this._list.length,this._allMenuItems),this._list.length&&this.focusNext()}focusCondition(e){return!e.disabled&&e.kind==="action"}hide(e){this._delegate.onHide(e),this.cts.cancel(),this._contextViewService.hideContextView()}layout(e){const t=this._allMenuItems.filter(l=>l.kind==="header").length,n=this._allMenuItems.length*this._actionLineHeight+t*this._headerLineHeight-t*this._actionLineHeight;this._list.layout(n);let o=e;if(this._allMenuItems.length>=50)o=380;else{const l=this._allMenuItems.map((d,c)=>{const u=this.domNode.ownerDocument.getElementById(this._list.getElementID(c));if(u){u.style.width="auto";const h=u.getBoundingClientRect().width;return u.style.width="",h}return 0});o=Math.max(...l,e)}const a=Math.min(n,this.domNode.ownerDocument.body.clientHeight*.7);return this._list.layout(a,o),this.domNode.style.height=`${a}px`,this._list.domFocus(),o}focusPrevious(){this._list.focusPrevious(1,!0,void 0,this.focusCondition)}focusNext(){this._list.focusNext(1,!0,void 0,this.focusCondition)}acceptSelected(e){const t=this._list.getFocus();if(t.length===0)return;const i=t[0],n=this._list.element(i);if(!this.focusCondition(n))return;const o=e?new N7:new cxe;this._list.setSelection([i],o)}onListSelection(e){if(!e.elements.length)return;const t=e.elements[0];t.item&&this.focusCondition(t)?this._delegate.onSelect(t.item,e.browserEvent instanceof N7):this._list.setSelection([])}onFocus(){var e,t;const i=this._list.getFocus();if(i.length===0)return;const n=i[0],o=this._list.element(n);(t=(e=this._delegate).onFocus)===null||t===void 0||t.call(e,o.item)}async onListHover(e){const t=e.element;if(t&&t.item&&this.focusCondition(t)){if(this._delegate.onHover&&!t.disabled&&t.kind==="action"){const i=await this._delegate.onHover(t.item,this.cts.token);t.canPreview=i?i.canPreview:void 0}e.index&&this._list.splice(e.index,1,[t])}this._list.setFocus(typeof e.index=="number"?[e.index]:[])}onListClick(e){e.element&&this.focusCondition(e.element)&&this._list.setFocus([])}};PM=nq([MM(4,Qc),MM(5,At)],PM);function rq(s){return s.replace(/\r\n|\r|\n/g," ")}var hxe=function(s,e,t,i){var n=arguments.length,o=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,e,t,i);else for(var a=s.length-1;a>=0;a--)(r=s[a])&&(o=(n<3?r(o):n>3?r(e,t,o):r(e,t))||o);return n>3&&o&&Object.defineProperty(e,t,o),o},eT=function(s,e){return function(t,i){e(t,i,s)}};N("actionBar.toggledBackground",{dark:$g,light:$g,hcDark:$g,hcLight:$g},p("actionBar.toggledBackground","Background color for toggled action items in action bar."));const Pf={Visible:new ue("codeActionMenuVisible",!1,p("codeActionMenuVisible","Whether the action widget list is visible"))},hp=ut("actionWidgetService");let Ff=class extends V{get isVisible(){return Pf.Visible.getValue(this._contextKeyService)||!1}constructor(e,t,i){super(),this._contextViewService=e,this._contextKeyService=t,this._instantiationService=i,this._list=this._register(new $n)}show(e,t,i,n,o,r,a){const l=Pf.Visible.bindTo(this._contextKeyService),d=this._instantiationService.createInstance(PM,e,t,i,n);this._contextViewService.showContextView({getAnchor:()=>o,render:c=>(l.set(!0),this._renderWidget(c,d,a??[])),onHide:c=>{l.reset(),this._onWidgetClosed(c)}},r,!1)}acceptSelected(e){var t;(t=this._list.value)===null||t===void 0||t.acceptSelected(e)}focusPrevious(){var e,t;(t=(e=this._list)===null||e===void 0?void 0:e.value)===null||t===void 0||t.focusPrevious()}focusNext(){var e,t;(t=(e=this._list)===null||e===void 0?void 0:e.value)===null||t===void 0||t.focusNext()}hide(e){var t;(t=this._list.value)===null||t===void 0||t.hide(e),this._list.clear()}_renderWidget(e,t,i){var n;const o=document.createElement("div");if(o.classList.add("action-widget"),e.appendChild(o),this._list.value=t,this._list.value)o.appendChild(this._list.value.domNode);else throw new Error("List has no value");const r=new Y,a=document.createElement("div"),l=e.appendChild(a);l.classList.add("context-view-block"),r.add(K(l,ee.MOUSE_DOWN,f=>f.stopPropagation()));const d=document.createElement("div"),c=e.appendChild(d);c.classList.add("context-view-pointerBlock"),r.add(K(c,ee.POINTER_MOVE,()=>c.remove())),r.add(K(c,ee.MOUSE_DOWN,()=>c.remove()));let u=0;if(i.length){const f=this._createActionBar(".action-widget-action-bar",i);f&&(o.appendChild(f.getContainer().parentElement),r.add(f),u=f.getContainer().offsetWidth)}const h=(n=this._list.value)===null||n===void 0?void 0:n.layout(u);o.style.width=`${h}px`;const g=r.add(Ca(e));return r.add(g.onDidBlur(()=>this.hide(!0))),r}_createActionBar(e,t){if(!t.length)return;const i=he(e),n=new Hr(i);return n.push(t,{icon:!1,label:!0}),n}_onWidgetClosed(e){var t;(t=this._list.value)===null||t===void 0||t.hide(e)}};Ff=hxe([eT(0,Qc),eT(1,Be),eT(2,Ne)],Ff);mt(hp,Ff,1);const B1=1100;qt(class extends Ks{constructor(){super({id:"hideCodeActionWidget",title:Ve("hideCodeActionWidget.title","Hide action widget"),precondition:Pf.Visible,keybinding:{weight:B1,primary:9,secondary:[1033]}})}run(s){s.get(hp).hide(!0)}});qt(class extends Ks{constructor(){super({id:"selectPrevCodeAction",title:Ve("selectPrevCodeAction.title","Select previous action"),precondition:Pf.Visible,keybinding:{weight:B1,primary:16,secondary:[2064],mac:{primary:16,secondary:[2064,302]}}})}run(s){const e=s.get(hp);e instanceof Ff&&e.focusPrevious()}});qt(class extends Ks{constructor(){super({id:"selectNextCodeAction",title:Ve("selectNextCodeAction.title","Select next action"),precondition:Pf.Visible,keybinding:{weight:B1,primary:18,secondary:[2066],mac:{primary:18,secondary:[2066,300]}}})}run(s){const e=s.get(hp);e instanceof Ff&&e.focusNext()}});qt(class extends Ks{constructor(){super({id:sq,title:Ve("acceptSelected.title","Accept selected action"),precondition:Pf.Visible,keybinding:{weight:B1,primary:3,secondary:[2137]}})}run(s){const e=s.get(hp);e instanceof Ff&&e.acceptSelected()}});qt(class extends Ks{constructor(){super({id:oq,title:Ve("previewSelected.title","Preview selected action"),precondition:Pf.Visible,keybinding:{weight:B1,primary:2051}})}run(s){const e=s.get(hp);e instanceof Ff&&e.acceptSelected(!0)}});const aq=new ue("supportedCodeAction",""),A7="_typescript.applyFixAllCodeAction";class gxe extends V{constructor(e,t,i,n=250){super(),this._editor=e,this._markerService=t,this._signalChange=i,this._delay=n,this._autoTriggerTimer=this._register(new ya),this._register(this._markerService.onMarkerChanged(o=>this._onMarkerChanges(o))),this._register(this._editor.onDidChangeCursorPosition(()=>this._tryAutoTrigger()))}trigger(e){const t=this._getRangeOfSelectionUnlessWhitespaceEnclosed(e);this._signalChange(t?{trigger:e,selection:t}:void 0)}_onMarkerChanges(e){const t=this._editor.getModel();t&&e.some(i=>KF(i,t.uri))&&this._tryAutoTrigger()}_tryAutoTrigger(){this._autoTriggerTimer.cancelAndSet(()=>{this.trigger({type:2,triggerAction:Mo.Default})},this._delay)}_getRangeOfSelectionUnlessWhitespaceEnclosed(e){if(!this._editor.hasModel())return;const t=this._editor.getSelection();if(e.type===1)return t;const i=this._editor.getOption(65).enabled;if(i!==ia.Off){{if(i===ia.On)return t;if(i===ia.OnCode){if(!t.isEmpty())return t;const o=this._editor.getModel(),{lineNumber:r,column:a}=t.getPosition(),l=o.getLineContent(r);if(l.length===0)return;if(a===1){if(/\s/.test(l[0]))return}else if(a===o.getLineMaxColumn(r)){if(/\s/.test(l[l.length-1]))return}else if(/\s/.test(l[a-2])&&/\s/.test(l[a-1]))return}}return t}}}var Wg;(function(s){s.Empty={type:0};class e{constructor(i,n,o){this.trigger=i,this.position=n,this._cancellablePromise=o,this.type=1,this.actions=o.catch(r=>{if(kd(r))return lq;throw r})}cancel(){this._cancellablePromise.cancel()}}s.Triggered=e})(Wg||(Wg={}));const lq=Object.freeze({allActions:[],validActions:[],dispose:()=>{},documentation:[],hasAutoFix:!1,hasAIFix:!1,allAIFixes:!1});class fxe extends V{constructor(e,t,i,n,o,r){super(),this._editor=e,this._registry=t,this._markerService=i,this._progressService=o,this._configurationService=r,this._codeActionOracle=this._register(new $n),this._state=Wg.Empty,this._onDidChangeState=this._register(new B),this.onDidChangeState=this._onDidChangeState.event,this._disposed=!1,this._supportedCodeActions=aq.bindTo(n),this._register(this._editor.onDidChangeModel(()=>this._update())),this._register(this._editor.onDidChangeModelLanguage(()=>this._update())),this._register(this._registry.onDidChange(()=>this._update())),this._register(this._editor.onDidChangeConfiguration(a=>{a.hasChanged(65)&&this._update()})),this._update()}dispose(){this._disposed||(this._disposed=!0,super.dispose(),this.setState(Wg.Empty,!0))}_settingEnabledNearbyQuickfixes(){var e;const t=(e=this._editor)===null||e===void 0?void 0:e.getModel();return this._configurationService?this._configurationService.getValue("editor.codeActionWidget.includeNearbyQuickFixes",{resource:t==null?void 0:t.uri}):!1}_update(){if(this._disposed)return;this._codeActionOracle.value=void 0,this.setState(Wg.Empty);const e=this._editor.getModel();if(e&&this._registry.has(e)&&!this._editor.getOption(91)){const t=this._registry.all(e).flatMap(i=>{var n;return(n=i.providedCodeActionKinds)!==null&&n!==void 0?n:[]});this._supportedCodeActions.set(t.join(" ")),this._codeActionOracle.value=new gxe(this._editor,this._markerService,i=>{var n;if(!i){this.setState(Wg.Empty);return}const o=i.selection.getStartPosition(),r=Ln(async d=>{var c,u,h,g,f,m,_,v,b,C;if(this._settingEnabledNearbyQuickfixes()&&i.trigger.type===1&&(i.trigger.triggerAction===Mo.QuickFix||!((u=(c=i.trigger.filter)===null||c===void 0?void 0:c.include)===null||u===void 0)&&u.contains(ai.QuickFix))){const w=await ab(this._registry,e,i.selection,i.trigger,Tc.None,d),y=[...w.allActions];if(d.isCancellationRequested)return lq;const S=(h=w.validActions)===null||h===void 0?void 0:h.some(E=>E.action.kind?ai.QuickFix.contains(new Wt(E.action.kind)):!1),L=this._markerService.read({resource:e.uri});if(S){for(const E of w.validActions)!((f=(g=E.action.command)===null||g===void 0?void 0:g.arguments)===null||f===void 0)&&f.some(I=>typeof I=="string"&&I.includes(A7))&&(E.action.diagnostics=[...L.filter(I=>I.relatedInformation)]);return{validActions:w.validActions,allActions:y,documentation:w.documentation,hasAutoFix:w.hasAutoFix,hasAIFix:w.hasAIFix,allAIFixes:w.allAIFixes,dispose:()=>{w.dispose()}}}else if(!S&&L.length>0){const E=i.selection.getPosition();let I=E,O=Number.MAX_VALUE;const P=[...w.validActions];for(const F of L){const H=F.endColumn,U=F.endLineNumber,J=F.startLineNumber;if(U===E.lineNumber||J===E.lineNumber){I=new W(U,H);const pe={type:i.trigger.type,triggerAction:i.trigger.triggerAction,filter:{include:!((m=i.trigger.filter)===null||m===void 0)&&m.include?(_=i.trigger.filter)===null||_===void 0?void 0:_.include:ai.QuickFix},autoApply:i.trigger.autoApply,context:{notAvailableMessage:((v=i.trigger.context)===null||v===void 0?void 0:v.notAvailableMessage)||"",position:I}},Se=new we(I.lineNumber,I.column,I.lineNumber,I.column),ge=await ab(this._registry,e,Se,pe,Tc.None,d);if(ge.validActions.length!==0){for(const We of ge.validActions)!((C=(b=We.action.command)===null||b===void 0?void 0:b.arguments)===null||C===void 0)&&C.some(ye=>typeof ye=="string"&&ye.includes(A7))&&(We.action.diagnostics=[...L.filter(ye=>ye.relatedInformation)]);w.allActions.length===0&&y.push(...ge.allActions),Math.abs(E.column-H)U.findIndex(J=>J.action.title===F.action.title)===H);return R.sort((F,H)=>F.action.isPreferred&&!H.action.isPreferred?-1:!F.action.isPreferred&&H.action.isPreferred||F.action.isAI&&!H.action.isAI?1:!F.action.isAI&&H.action.isAI?-1:0),{validActions:R,allActions:y,documentation:w.documentation,hasAutoFix:w.hasAutoFix,hasAIFix:w.hasAIFix,allAIFixes:w.allAIFixes,dispose:()=>{w.dispose()}}}}return ab(this._registry,e,i.selection,i.trigger,Tc.None,d)});i.trigger.type===1&&((n=this._progressService)===null||n===void 0||n.showWhile(r,250));const a=new Wg.Triggered(i.trigger,o,r);let l=!1;this._state.type===1&&(l=this._state.trigger.type===1&&a.type===1&&a.trigger.type===2&&this._state.position!==a.position),l?setTimeout(()=>{this.setState(a)},500):this.setState(a)},void 0),this._codeActionOracle.value.trigger({type:2,triggerAction:Mo.Default})}else this._supportedCodeActions.reset()}trigger(e){var t;(t=this._codeActionOracle.value)===null||t===void 0||t.trigger(e)}setState(e,t){e!==this._state&&(this._state.type===1&&this._state.cancel(),this._state=e,!t&&!this._disposed&&this._onDidChangeState.fire(e))}}var pxe=function(s,e,t,i){var n=arguments.length,o=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,e,t,i);else for(var a=s.length-1;a>=0;a--)(r=s[a])&&(o=(n<3?r(o):n>3?r(e,t,o):r(e,t))||o);return n>3&&o&&Object.defineProperty(e,t,o),o},Sl=function(s,e){return function(t,i){e(t,i,s)}},Vp;const mxe="quickfix-edit-highlight";let Ah=Vp=class extends V{static get(e){return e.getContribution(Vp.ID)}constructor(e,t,i,n,o,r,a,l,d,c,u){super(),this._commandService=a,this._configurationService=l,this._actionWidgetService=d,this._instantiationService=c,this._telemetryService=u,this._activeCodeActions=this._register(new $n),this._showDisabled=!1,this._disposed=!1,this._editor=e,this._model=this._register(new fxe(this._editor,o.codeActionProvider,t,i,r,l)),this._register(this._model.onDidChangeState(h=>this.update(h))),this._lightBulbWidget=new hl(()=>{const h=this._editor.getContribution(Rf.ID);return h&&this._register(h.onClick(g=>this.showCodeActionsFromLightbulb(g.actions,g))),h}),this._resolver=n.createInstance(dL),this._register(this._editor.onDidLayoutChange(()=>this._actionWidgetService.hide()))}dispose(){this._disposed=!0,super.dispose()}async showCodeActionsFromLightbulb(e,t){if(this._telemetryService.publicLog2("codeAction.showCodeActionsFromLightbulb",{codeActionListLength:e.validActions.length,codeActions:e.validActions.map(i=>i.action.title),codeActionProviders:e.validActions.map(i=>{var n,o;return(o=(n=i.provider)===null||n===void 0?void 0:n.displayName)!==null&&o!==void 0?o:""})}),e.allAIFixes&&e.validActions.length===1){const i=e.validActions[0],n=i.action.command;n&&n.id==="inlineChat.start"&&n.arguments&&n.arguments.length>=1&&(n.arguments[0]={...n.arguments[0],autoSend:!1}),await this._applyCodeAction(i,!1,!1,Yg.FromAILightbulb);return}await this.showCodeActionList(e,t,{includeDisabledActions:!1,fromLightbulb:!0})}showCodeActions(e,t,i){return this.showCodeActionList(t,i,{includeDisabledActions:!1,fromLightbulb:!1})}manualTriggerAtCurrentPosition(e,t,i,n){var o;if(!this._editor.hasModel())return;(o=Hs.get(this._editor))===null||o===void 0||o.closeMessage();const r=this._editor.getPosition();this._trigger({type:1,triggerAction:t,filter:i,autoApply:n,context:{notAvailableMessage:e,position:r}})}_trigger(e){return this._model.trigger(e)}async _applyCodeAction(e,t,i,n){try{await this._instantiationService.invokeFunction(ixe,e,n,{preview:i,editor:this._editor})}finally{t&&this._trigger({type:2,triggerAction:Mo.QuickFix,filter:{}})}}async update(e){var t,i,n,o,r,a,l;if(e.type!==1){(t=this._lightBulbWidget.rawValue)===null||t===void 0||t.hide();return}let d;try{d=await e.actions}catch(c){Ge(c);return}if(!this._disposed)if((i=this._lightBulbWidget.value)===null||i===void 0||i.update(d,e.trigger,e.position),e.trigger.type===1){if(!((n=e.trigger.filter)===null||n===void 0)&&n.include){const u=this.tryGetValidActionToApply(e.trigger,d);if(u){try{(o=this._lightBulbWidget.value)===null||o===void 0||o.hide(),await this._applyCodeAction(u,!1,!1,Yg.FromCodeActions)}finally{d.dispose()}return}if(e.trigger.context){const h=this.getInvalidActionThatWouldHaveBeenApplied(e.trigger,d);if(h&&h.action.disabled){(r=Hs.get(this._editor))===null||r===void 0||r.showMessage(h.action.disabled,e.trigger.context.position),d.dispose();return}}}const c=!!(!((a=e.trigger.filter)===null||a===void 0)&&a.include);if(e.trigger.context&&(!d.allActions.length||!c&&!d.validActions.length)){(l=Hs.get(this._editor))===null||l===void 0||l.showMessage(e.trigger.context.notAvailableMessage,e.trigger.context.position),this._activeCodeActions.value=d,d.dispose();return}this._activeCodeActions.value=d,this.showCodeActionList(d,this.toCoords(e.position),{includeDisabledActions:c,fromLightbulb:!1})}else this._actionWidgetService.isVisible?d.dispose():this._activeCodeActions.value=d}getInvalidActionThatWouldHaveBeenApplied(e,t){if(t.allActions.length&&(e.autoApply==="first"&&t.validActions.length===0||e.autoApply==="ifSingle"&&t.allActions.length===1))return t.allActions.find(({action:i})=>i.disabled)}tryGetValidActionToApply(e,t){if(t.validActions.length&&(e.autoApply==="first"&&t.validActions.length>0||e.autoApply==="ifSingle"&&t.validActions.length===1))return t.validActions[0]}async showCodeActionList(e,t,i){const n=this._editor.createDecorationsCollection(),o=this._editor.getDomNode();if(!o)return;const r=i.includeDisabledActions&&(this._showDisabled||e.validActions.length===0)?e.allActions:e.validActions;if(!r.length)return;const a=W.isIPosition(t)?this.toCoords(t):t,l={onSelect:async(d,c)=>{this._applyCodeAction(d,!0,!!c,i.fromLightbulb?Yg.FromAILightbulb:Yg.FromCodeActions),this._actionWidgetService.hide(!1),n.clear()},onHide:d=>{var c;(c=this._editor)===null||c===void 0||c.focus(),n.clear(),i.fromLightbulb&&d!==void 0&&this._telemetryService.publicLog2("codeAction.showCodeActionList.onHide",{codeActionListLength:e.validActions.length,didCancel:d})},onHover:async(d,c)=>{var u;if(c.isCancellationRequested)return;let h=!1;const g=d.action.kind;if(g){const f=new Wt(g);h=[ai.RefactorExtract,ai.RefactorInline,ai.RefactorRewrite,ai.RefactorMove,ai.Source].some(_=>_.contains(f))}return{canPreview:h||!!(!((u=d.action.edit)===null||u===void 0)&&u.edits.length)}},onFocus:d=>{var c,u;if(d&&d.action){const h=d.action.ranges,g=d.action.diagnostics;if(n.clear(),h&&h.length>0){const f=g&&(g==null?void 0:g.length)>1?g.map(m=>({range:m,options:Vp.DECORATION})):h.map(m=>({range:m,options:Vp.DECORATION}));n.set(f)}else if(g&&g.length>0){const f=g.map(_=>({range:_,options:Vp.DECORATION}));n.set(f);const m=g[0];if(m.startLineNumber&&m.startColumn){const _=(u=(c=this._editor.getModel())===null||c===void 0?void 0:c.getWordAtPosition({lineNumber:m.startLineNumber,column:m.startColumn}))===null||u===void 0?void 0:u.word;zc(p("editingNewSelection","Context: {0} at line {1} and column {2}.",_,m.startLineNumber,m.startColumn))}}}else n.clear()}};this._actionWidgetService.show("codeActionWidget",!0,axe(r,this._shouldShowHeaders(),this._resolver.getResolver()),l,a,o,this._getActionBarActions(e,t,i))}toCoords(e){if(!this._editor.hasModel())return{x:0,y:0};this._editor.revealPosition(e,1),this._editor.render();const t=this._editor.getScrolledVisiblePosition(e),i=qi(this._editor.getDomNode()),n=i.left+t.left,o=i.top+t.top+t.height;return{x:n,y:o}}_shouldShowHeaders(){var e;const t=(e=this._editor)===null||e===void 0?void 0:e.getModel();return this._configurationService.getValue("editor.codeActionWidget.showHeaders",{resource:t==null?void 0:t.uri})}_getActionBarActions(e,t,i){if(i.fromLightbulb)return[];const n=e.documentation.map(o=>{var r;return{id:o.id,label:o.title,tooltip:(r=o.tooltip)!==null&&r!==void 0?r:"",class:void 0,enabled:!0,run:()=>{var a;return this._commandService.executeCommand(o.id,...(a=o.arguments)!==null&&a!==void 0?a:[])}}});return i.includeDisabledActions&&e.validActions.length>0&&e.allActions.length!==e.validActions.length&&n.push(this._showDisabled?{id:"hideMoreActions",label:p("hideMoreActions","Hide Disabled"),enabled:!0,tooltip:"",class:void 0,run:()=>(this._showDisabled=!1,this.showCodeActionList(e,t,i))}:{id:"showMoreActions",label:p("showMoreActions","Show Disabled"),enabled:!0,tooltip:"",class:void 0,run:()=>(this._showDisabled=!0,this.showCodeActionList(e,t,i))}),n}};Ah.ID="editor.contrib.codeActionController";Ah.DECORATION=Xe.register({description:"quickfix-highlight",className:mxe});Ah=Vp=pxe([Sl(1,Md),Sl(2,Be),Sl(3,Ne),Sl(4,be),Sl(5,Qh),Sl(6,ui),Sl(7,rt),Sl(8,hp),Sl(9,Ne),Sl(10,qs)],Ah);zr((s,e)=>{((n,o)=>{o&&e.addRule(`.monaco-editor ${n} { background-color: ${o}; }`)})(".quickfix-edit-highlight",s.getColor(fc));const i=s.getColor(Ou);i&&e.addRule(`.monaco-editor .quickfix-edit-highlight { border: 1px ${ad(s.type)?"dotted":"solid"} ${i}; box-sizing: border-box; }`)});function W1(s){return G.regex(aq.keys()[0],new RegExp("(\\s|^)"+sr(s.value)+"\\b"))}const u4={type:"object",defaultSnippets:[{body:{kind:""}}],properties:{kind:{type:"string",description:p("args.schema.kind","Kind of the code action to run.")},apply:{type:"string",description:p("args.schema.apply","Controls when the returned actions are applied."),default:"ifSingle",enum:["first","ifSingle","never"],enumDescriptions:[p("args.schema.apply.first","Always apply the first returned code action."),p("args.schema.apply.ifSingle","Apply the first returned code action if it is the only one."),p("args.schema.apply.never","Do not apply the returned code actions.")]},preferred:{type:"boolean",default:!1,description:p("args.schema.preferred","Controls if only preferred code actions should be returned.")}}};function gp(s,e,t,i,n=Mo.Default){if(s.hasModel()){const o=Ah.get(s);o==null||o.manualTriggerAtCurrentPosition(e,n,t,i)}}class _xe extends me{constructor(){super({id:l4,label:p("quickfix.trigger.label","Quick Fix..."),alias:"Quick Fix...",precondition:G.and(T.writable,T.hasCodeActionsProvider),kbOpts:{kbExpr:T.textInputFocus,primary:2137,weight:100}})}run(e,t){return gp(t,p("editor.action.quickFix.noneMessage","No code actions available"),void 0,void 0,Mo.QuickFix)}}class vxe extends mn{constructor(){super({id:QK,precondition:G.and(T.writable,T.hasCodeActionsProvider),metadata:{description:"Trigger a code action",args:[{name:"args",schema:u4}]}})}runEditorCommand(e,t,i){const n=ql.fromUser(i,{kind:Wt.Empty,apply:"ifSingle"});return gp(t,typeof(i==null?void 0:i.kind)=="string"?n.preferred?p("editor.action.codeAction.noneMessage.preferred.kind","No preferred code actions for '{0}' available",i.kind):p("editor.action.codeAction.noneMessage.kind","No code actions for '{0}' available",i.kind):n.preferred?p("editor.action.codeAction.noneMessage.preferred","No preferred code actions available"):p("editor.action.codeAction.noneMessage","No code actions available"),{include:n.kind,includeSourceActions:!0,onlyIncludePreferredActions:n.preferred},n.apply)}}class bxe extends me{constructor(){super({id:eq,label:p("refactor.label","Refactor..."),alias:"Refactor...",precondition:G.and(T.writable,T.hasCodeActionsProvider),kbOpts:{kbExpr:T.textInputFocus,primary:3120,mac:{primary:1328},weight:100},contextMenuOpts:{group:"1_modification",order:2,when:G.and(T.writable,W1(ai.Refactor))},metadata:{description:"Refactor...",args:[{name:"args",schema:u4}]}})}run(e,t,i){const n=ql.fromUser(i,{kind:ai.Refactor,apply:"never"});return gp(t,typeof(i==null?void 0:i.kind)=="string"?n.preferred?p("editor.action.refactor.noneMessage.preferred.kind","No preferred refactorings for '{0}' available",i.kind):p("editor.action.refactor.noneMessage.kind","No refactorings for '{0}' available",i.kind):n.preferred?p("editor.action.refactor.noneMessage.preferred","No preferred refactorings available"):p("editor.action.refactor.noneMessage","No refactorings available"),{include:ai.Refactor.contains(n.kind)?n.kind:Wt.None,onlyIncludePreferredActions:n.preferred},n.apply,Mo.Refactor)}}class Cxe extends me{constructor(){super({id:tq,label:p("source.label","Source Action..."),alias:"Source Action...",precondition:G.and(T.writable,T.hasCodeActionsProvider),contextMenuOpts:{group:"1_modification",order:2.1,when:G.and(T.writable,W1(ai.Source))},metadata:{description:"Source Action...",args:[{name:"args",schema:u4}]}})}run(e,t,i){const n=ql.fromUser(i,{kind:ai.Source,apply:"never"});return gp(t,typeof(i==null?void 0:i.kind)=="string"?n.preferred?p("editor.action.source.noneMessage.preferred.kind","No preferred source actions for '{0}' available",i.kind):p("editor.action.source.noneMessage.kind","No source actions for '{0}' available",i.kind):n.preferred?p("editor.action.source.noneMessage.preferred","No preferred source actions available"):p("editor.action.source.noneMessage","No source actions available"),{include:ai.Source.contains(n.kind)?n.kind:Wt.None,includeSourceActions:!0,onlyIncludePreferredActions:n.preferred},n.apply,Mo.SourceAction)}}class wxe extends me{constructor(){super({id:d4,label:p("organizeImports.label","Organize Imports"),alias:"Organize Imports",precondition:G.and(T.writable,W1(ai.SourceOrganizeImports)),kbOpts:{kbExpr:T.textInputFocus,primary:1581,weight:100}})}run(e,t){return gp(t,p("editor.action.organize.noneMessage","No organize imports action available"),{include:ai.SourceOrganizeImports,includeSourceActions:!0},"ifSingle",Mo.OrganizeImports)}}class yxe extends me{constructor(){super({id:c4,label:p("fixAll.label","Fix All"),alias:"Fix All",precondition:G.and(T.writable,W1(ai.SourceFixAll))})}run(e,t){return gp(t,p("fixAll.noneMessage","No fix all action available"),{include:ai.SourceFixAll,includeSourceActions:!0},"ifSingle",Mo.FixAll)}}class Sxe extends me{constructor(){super({id:JK,label:p("autoFix.label","Auto Fix..."),alias:"Auto Fix...",precondition:G.and(T.writable,W1(ai.QuickFix)),kbOpts:{kbExpr:T.textInputFocus,primary:1625,mac:{primary:2649},weight:100}})}run(e,t){return gp(t,p("editor.action.autoFix.noneMessage","No auto fixes available"),{include:ai.QuickFix,onlyIncludePreferredActions:!0},"ifSingle",Mo.AutoFix)}}kt(Ah.ID,Ah,3);kt(Rf.ID,Rf,4);te(_xe);te(bxe);te(Cxe);te(wxe);te(Sxe);te(yxe);de(new vxe);Ji.as(fl.Configuration).registerConfiguration({...Hx,properties:{"editor.codeActionWidget.showHeaders":{type:"boolean",scope:5,description:p("showCodeActionHeaders","Enable/disable showing group headers in the Code Action menu."),default:!0}}});Ji.as(fl.Configuration).registerConfiguration({...Hx,properties:{"editor.codeActionWidget.includeNearbyQuickFixes":{type:"boolean",scope:5,description:p("includeNearbyQuickFixes","Enable/disable showing nearest Quick Fix within a line when not currently on a diagnostic."),default:!0}}});class FM{constructor(){this.lenses=[],this._disposables=new Y}dispose(){this._disposables.dispose()}get isDisposed(){return this._disposables.isDisposed}add(e,t){this._disposables.add(e);for(const i of e.lenses)this.lenses.push({symbol:i,provider:t})}}async function dq(s,e,t){const i=s.ordered(e),n=new Map,o=new FM,r=i.map(async(a,l)=>{n.set(a,l);try{const d=await Promise.resolve(a.provideCodeLenses(e,t));d&&o.add(d,a)}catch(d){Ni(d)}});return await Promise.all(r),o.lenses=o.lenses.sort((a,l)=>a.symbol.range.startLineNumberl.symbol.range.startLineNumber?1:n.get(a.provider)n.get(l.provider)?1:a.symbol.range.startColumnl.symbol.range.startColumn?1:0),o}pt.registerCommand("_executeCodeLensProvider",function(s,...e){let[t,i]=e;yt(Ae.isUri(t)),yt(typeof i=="number"||!i);const{codeLensProvider:n}=s.get(be),o=s.get(_i).getModel(t);if(!o)throw Ar();const r=[],a=new Y;return dq(n,o,dt.None).then(l=>{a.add(l);const d=[];for(const c of l.lenses)i==null||c.symbol.command?r.push(c.symbol):i-- >0&&c.provider.resolveCodeLens&&d.push(Promise.resolve(c.provider.resolveCodeLens(o,c.symbol,dt.None)).then(u=>r.push(u||c.symbol)));return Promise.all(d)}).then(()=>r).finally(()=>{setTimeout(()=>a.dispose(),100)})});var Dxe=function(s,e,t,i){var n=arguments.length,o=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,e,t,i);else for(var a=s.length-1;a>=0;a--)(r=s[a])&&(o=(n<3?r(o):n>3?r(e,t,o):r(e,t))||o);return n>3&&o&&Object.defineProperty(e,t,o),o},Lxe=function(s,e){return function(t,i){e(t,i,s)}};const cq=ut("ICodeLensCache");class M7{constructor(e,t){this.lineCount=e,this.data=t}}let OM=class{constructor(e){this._fakeProvider=new class{provideCodeLenses(){throw new Error("not supported")}},this._cache=new Yc(20,.75);const t="codelens/cache";sv(Bt,()=>e.remove(t,1));const i="codelens/cache2",n=e.get(i,1,"{}");this._deserialize(n),ae.once(e.onWillSaveState)(o=>{o.reason===xD.SHUTDOWN&&e.store(i,this._serialize(),1,1)})}put(e,t){const i=t.lenses.map(r=>{var a;return{range:r.symbol.range,command:r.symbol.command&&{id:"",title:(a=r.symbol.command)===null||a===void 0?void 0:a.title}}}),n=new FM;n.add({lenses:i,dispose:()=>{}},this._fakeProvider);const o=new M7(e.getLineCount(),n);this._cache.set(e.uri.toString(),o)}get(e){const t=this._cache.get(e.uri.toString());return t&&t.lineCount===e.getLineCount()?t.data:void 0}delete(e){this._cache.delete(e.uri.toString())}_serialize(){const e=Object.create(null);for(const[t,i]of this._cache){const n=new Set;for(const o of i.data.lenses)n.add(o.symbol.range.startLineNumber);e[t]={lineCount:i.lineCount,lines:[...n.values()]}}return JSON.stringify(e)}_deserialize(e){try{const t=JSON.parse(e);for(const i in t){const n=t[i],o=[];for(const a of n.lines)o.push({range:new x(a,1,a,11)});const r=new FM;r.add({lenses:o,dispose(){}},this._fakeProvider),this._cache.set(i,new M7(n.lineCount,r))}}catch{}}};OM=Dxe([Lxe(0,Ad)],OM);mt(cq,OM,1);class xxe{constructor(e,t,i){this.afterColumn=1073741824,this.afterLineNumber=e,this.heightInPx=t,this._onHeight=i,this.suppressMouseDown=!0,this.domNode=document.createElement("div")}onComputedHeight(e){this._lastHeight===void 0?this._lastHeight=e:this._lastHeight!==e&&(this._lastHeight=e,this._onHeight())}isVisible(){return this._lastHeight!==0&&this.domNode.hasAttribute("monaco-visible-view-zone")}}class kC{constructor(e,t){this.allowEditorOverflow=!1,this.suppressMouseDown=!0,this._commands=new Map,this._isEmpty=!0,this._editor=e,this._id=`codelens.widget-${kC._idPool++}`,this.updatePosition(t),this._domNode=document.createElement("span"),this._domNode.className="codelens-decoration"}withCommands(e,t){this._commands.clear();const i=[];let n=!1;for(let o=0;o{d.symbol.command&&l.push(d.symbol),i.addDecoration({range:d.symbol.range,options:R7},u=>this._decorationIds[c]=u),a?a=x.plusRange(a,d.symbol.range):a=x.lift(d.symbol.range)}),this._viewZone=new xxe(a.startLineNumber-1,o,r),this._viewZoneId=n.addZone(this._viewZone),l.length>0&&(this._createContentWidgetIfNecessary(),this._contentWidget.withCommands(l,!1))}_createContentWidgetIfNecessary(){this._contentWidget?this._editor.layoutContentWidget(this._contentWidget):(this._contentWidget=new kC(this._editor,this._viewZone.afterLineNumber+1),this._editor.addContentWidget(this._contentWidget))}dispose(e,t){this._decorationIds.forEach(e.removeDecoration,e),this._decorationIds=[],t==null||t.removeZone(this._viewZoneId),this._contentWidget&&(this._editor.removeContentWidget(this._contentWidget),this._contentWidget=void 0),this._isDisposed=!0}isDisposed(){return this._isDisposed}isValid(){return this._decorationIds.some((e,t)=>{const i=this._editor.getModel().getDecorationRange(e),n=this._data[t].symbol;return!!(i&&x.isEmpty(n.range)===i.isEmpty())})}updateCodeLensSymbols(e,t){this._decorationIds.forEach(t.removeDecoration,t),this._decorationIds=[],this._data=e,this._data.forEach((i,n)=>{t.addDecoration({range:i.symbol.range,options:R7},o=>this._decorationIds[n]=o)})}updateHeight(e,t){this._viewZone.heightInPx=e,t.layoutZone(this._viewZoneId),this._contentWidget&&this._editor.layoutContentWidget(this._contentWidget)}computeIfNecessary(e){if(!this._viewZone.isVisible())return null;for(let t=0;t=0;a--)(r=s[a])&&(o=(n<3?r(o):n>3?r(e,t,o):r(e,t))||o);return n>3&&o&&Object.defineProperty(e,t,o),o},q0=function(s,e){return function(t,i){e(t,i,s)}};let A_=class{constructor(e,t,i,n,o,r){this._editor=e,this._languageFeaturesService=t,this._commandService=n,this._notificationService=o,this._codeLensCache=r,this._disposables=new Y,this._localToDispose=new Y,this._lenses=[],this._oldCodeLensModels=new Y,this._provideCodeLensDebounce=i.for(t.codeLensProvider,"CodeLensProvide",{min:250}),this._resolveCodeLensesDebounce=i.for(t.codeLensProvider,"CodeLensResolve",{min:250,salt:"resolve"}),this._resolveCodeLensesScheduler=new Ht(()=>this._resolveCodeLensesInViewport(),this._resolveCodeLensesDebounce.default()),this._disposables.add(this._editor.onDidChangeModel(()=>this._onModelChange())),this._disposables.add(this._editor.onDidChangeModelLanguage(()=>this._onModelChange())),this._disposables.add(this._editor.onDidChangeConfiguration(a=>{(a.hasChanged(50)||a.hasChanged(19)||a.hasChanged(18))&&this._updateLensStyle(),a.hasChanged(17)&&this._onModelChange()})),this._disposables.add(t.codeLensProvider.onDidChange(this._onModelChange,this)),this._onModelChange(),this._updateLensStyle()}dispose(){var e;this._localDispose(),this._disposables.dispose(),this._oldCodeLensModels.dispose(),(e=this._currentCodeLensModel)===null||e===void 0||e.dispose()}_getLayoutInfo(){const e=Math.max(1.3,this._editor.getOption(67)/this._editor.getOption(52));let t=this._editor.getOption(19);return(!t||t<5)&&(t=this._editor.getOption(52)*.9|0),{fontSize:t,codeLensHeight:t*e|0}}_updateLensStyle(){const{codeLensHeight:e,fontSize:t}=this._getLayoutInfo(),i=this._editor.getOption(18),n=this._editor.getOption(50),{style:o}=this._editor.getContainerDomNode();o.setProperty("--vscode-editorCodeLens-lineHeight",`${e}px`),o.setProperty("--vscode-editorCodeLens-fontSize",`${t}px`),o.setProperty("--vscode-editorCodeLens-fontFeatureSettings",n.fontFeatureSettings),i&&(o.setProperty("--vscode-editorCodeLens-fontFamily",i),o.setProperty("--vscode-editorCodeLens-fontFamilyDefault",lo.fontFamily)),this._editor.changeViewZones(r=>{for(const a of this._lenses)a.updateHeight(e,r)})}_localDispose(){var e,t,i;(e=this._getCodeLensModelPromise)===null||e===void 0||e.cancel(),this._getCodeLensModelPromise=void 0,(t=this._resolveCodeLensesPromise)===null||t===void 0||t.cancel(),this._resolveCodeLensesPromise=void 0,this._localToDispose.clear(),this._oldCodeLensModels.clear(),(i=this._currentCodeLensModel)===null||i===void 0||i.dispose()}_onModelChange(){this._localDispose();const e=this._editor.getModel();if(!e||!this._editor.getOption(17)||e.isTooLargeForTokenization())return;const t=this._codeLensCache.get(e);if(t&&this._renderCodeLensSymbols(t),!this._languageFeaturesService.codeLensProvider.has(e)){t&&bh(()=>{const n=this._codeLensCache.get(e);t===n&&(this._codeLensCache.delete(e),this._onModelChange())},30*1e3,this._localToDispose);return}for(const n of this._languageFeaturesService.codeLensProvider.all(e))if(typeof n.onDidChange=="function"){const o=n.onDidChange(()=>i.schedule());this._localToDispose.add(o)}const i=new Ht(()=>{var n;const o=Date.now();(n=this._getCodeLensModelPromise)===null||n===void 0||n.cancel(),this._getCodeLensModelPromise=Ln(r=>dq(this._languageFeaturesService.codeLensProvider,e,r)),this._getCodeLensModelPromise.then(r=>{this._currentCodeLensModel&&this._oldCodeLensModels.add(this._currentCodeLensModel),this._currentCodeLensModel=r,this._codeLensCache.put(e,r);const a=this._provideCodeLensDebounce.update(e,Date.now()-o);i.delay=a,this._renderCodeLensSymbols(r),this._resolveCodeLensesInViewportSoon()},Ge)},this._provideCodeLensDebounce.get(e));this._localToDispose.add(i),this._localToDispose.add(Ie(()=>this._resolveCodeLensesScheduler.cancel())),this._localToDispose.add(this._editor.onDidChangeModelContent(()=>{var n;this._editor.changeDecorations(o=>{this._editor.changeViewZones(r=>{const a=[];let l=-1;this._lenses.forEach(c=>{!c.isValid()||l===c.getLineNumber()?a.push(c):(c.update(r),l=c.getLineNumber())});const d=new tT;a.forEach(c=>{c.dispose(d,r),this._lenses.splice(this._lenses.indexOf(c),1)}),d.commit(o)})}),i.schedule(),this._resolveCodeLensesScheduler.cancel(),(n=this._resolveCodeLensesPromise)===null||n===void 0||n.cancel(),this._resolveCodeLensesPromise=void 0})),this._localToDispose.add(this._editor.onDidFocusEditorWidget(()=>{i.schedule()})),this._localToDispose.add(this._editor.onDidBlurEditorText(()=>{i.cancel()})),this._localToDispose.add(this._editor.onDidScrollChange(n=>{n.scrollTopChanged&&this._lenses.length>0&&this._resolveCodeLensesInViewportSoon()})),this._localToDispose.add(this._editor.onDidLayoutChange(()=>{this._resolveCodeLensesInViewportSoon()})),this._localToDispose.add(Ie(()=>{if(this._editor.getModel()){const n=cl.capture(this._editor);this._editor.changeDecorations(o=>{this._editor.changeViewZones(r=>{this._disposeAllLenses(o,r)})}),n.restore(this._editor)}else this._disposeAllLenses(void 0,void 0)})),this._localToDispose.add(this._editor.onMouseDown(n=>{if(n.target.type!==9)return;let o=n.target.element;if((o==null?void 0:o.tagName)==="SPAN"&&(o=o.parentElement),(o==null?void 0:o.tagName)==="A")for(const r of this._lenses){const a=r.getCommand(o);if(a){this._commandService.executeCommand(a.id,...a.arguments||[]).catch(l=>this._notificationService.error(l));break}}})),i.schedule()}_disposeAllLenses(e,t){const i=new tT;for(const n of this._lenses)n.dispose(i,t);e&&i.commit(e),this._lenses.length=0}_renderCodeLensSymbols(e){if(!this._editor.hasModel())return;const t=this._editor.getModel().getLineCount(),i=[];let n;for(const a of e.lenses){const l=a.symbol.range.startLineNumber;l<1||l>t||(n&&n[n.length-1].symbol.range.startLineNumber===l?n.push(a):(n=[a],i.push(n)))}if(!i.length&&!this._lenses.length)return;const o=cl.capture(this._editor),r=this._getLayoutInfo();this._editor.changeDecorations(a=>{this._editor.changeViewZones(l=>{const d=new tT;let c=0,u=0;for(;uthis._resolveCodeLensesInViewportSoon())),c++,u++)}for(;cthis._resolveCodeLensesInViewportSoon())),u++;d.commit(a)})}),o.restore(this._editor)}_resolveCodeLensesInViewportSoon(){this._editor.getModel()&&this._resolveCodeLensesScheduler.schedule()}_resolveCodeLensesInViewport(){var e;(e=this._resolveCodeLensesPromise)===null||e===void 0||e.cancel(),this._resolveCodeLensesPromise=void 0;const t=this._editor.getModel();if(!t)return;const i=[],n=[];if(this._lenses.forEach(a=>{const l=a.computeIfNecessary(t);l&&(i.push(l),n.push(a))}),i.length===0)return;const o=Date.now(),r=Ln(a=>{const l=i.map((d,c)=>{const u=new Array(d.length),h=d.map((g,f)=>!g.symbol.command&&typeof g.provider.resolveCodeLens=="function"?Promise.resolve(g.provider.resolveCodeLens(t,g.symbol,a)).then(m=>{u[f]=m},Ni):(u[f]=g.symbol,Promise.resolve(void 0)));return Promise.all(h).then(()=>{!a.isCancellationRequested&&!n[c].isDisposed()&&n[c].updateCommands(u)})});return Promise.all(l)});this._resolveCodeLensesPromise=r,this._resolveCodeLensesPromise.then(()=>{const a=this._resolveCodeLensesDebounce.update(t,Date.now()-o);this._resolveCodeLensesScheduler.delay=a,this._currentCodeLensModel&&this._codeLensCache.put(t,this._currentCodeLensModel),this._oldCodeLensModels.clear(),r===this._resolveCodeLensesPromise&&(this._resolveCodeLensesPromise=void 0)},a=>{Ge(a),r===this._resolveCodeLensesPromise&&(this._resolveCodeLensesPromise=void 0)})}async getModel(){var e;return await this._getCodeLensModelPromise,await this._resolveCodeLensesPromise,!((e=this._currentCodeLensModel)===null||e===void 0)&&e.isDisposed?void 0:this._currentCodeLensModel}};A_.ID="css.editor.codeLens";A_=kxe([q0(1,be),q0(2,Ur),q0(3,ui),q0(4,en),q0(5,cq)],A_);kt(A_.ID,A_,1);te(class extends me{constructor(){super({id:"codelens.showLensesInCurrentLine",precondition:T.hasCodeLensProvider,label:p("showLensOnLine","Show CodeLens Commands For Current Line"),alias:"Show CodeLens Commands For Current Line"})}async run(e,t){if(!t.hasModel())return;const i=e.get(lp),n=e.get(ui),o=e.get(en),r=t.getSelection().positionLineNumber,a=t.getContribution(A_.ID);if(!a)return;const l=await a.getModel();if(!l)return;const d=[];for(const h of l.lenses)h.symbol.command&&h.symbol.range.startLineNumber===r&&d.push({label:h.symbol.command.title,command:h.symbol.command});if(d.length===0)return;const c=await i.pick(d,{canPickMany:!1,placeHolder:p("placeHolder","Select a command")});if(!c)return;let u=c.command;if(l.isDisposed){const h=await a.getModel(),g=h==null?void 0:h.lenses.find(f=>{var m;return f.symbol.range.startLineNumber===r&&((m=f.symbol.command)===null||m===void 0?void 0:m.title)===u.title});if(!g||!g.symbol.command)return;u=g.symbol.command}try{await n.executeCommand(u.id,...u.arguments||[])}catch(h){o.error(h)}}});var Exe=function(s,e,t,i){var n=arguments.length,o=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,e,t,i);else for(var a=s.length-1;a>=0;a--)(r=s[a])&&(o=(n<3?r(o):n>3?r(e,t,o):r(e,t))||o);return n>3&&o&&Object.defineProperty(e,t,o),o},iT=function(s,e){return function(t,i){e(t,i,s)}};class h4{constructor(e,t){this._editorWorkerClient=new yF(e,!1,"editorWorkerService",t)}async provideDocumentColors(e,t){return this._editorWorkerClient.computeDefaultDocumentColors(e.uri)}provideColorPresentations(e,t,i){const n=t.range,o=t.color,r=o.alpha,a=new $(new bt(Math.round(255*o.red),Math.round(255*o.green),Math.round(255*o.blue),r)),l=r?$.Format.CSS.formatRGB(a):$.Format.CSS.formatRGBA(a),d=r?$.Format.CSS.formatHSL(a):$.Format.CSS.formatHSLA(a),c=r?$.Format.CSS.formatHex(a):$.Format.CSS.formatHexA(a),u=[];return u.push({label:l,textEdit:{range:n,text:l}}),u.push({label:d,textEdit:{range:n,text:d}}),u.push({label:c,textEdit:{range:n,text:c}}),u}}let BM=class extends V{constructor(e,t,i){super(),this._register(i.colorProvider.register("*",new h4(e,t)))}};BM=Exe([iT(0,_i),iT(1,Yt),iT(2,be)],BM);M1(BM);async function uq(s,e,t,i=!0){return g4(new Ixe,s,e,t,i)}function hq(s,e,t,i){return Promise.resolve(t.provideColorPresentations(s,e,i))}class Ixe{constructor(){}async compute(e,t,i,n){const o=await e.provideDocumentColors(t,i);if(Array.isArray(o))for(const r of o)n.push({colorInfo:r,provider:e});return Array.isArray(o)}}class Txe{constructor(){}async compute(e,t,i,n){const o=await e.provideDocumentColors(t,i);if(Array.isArray(o))for(const r of o)n.push({range:r.range,color:[r.color.red,r.color.green,r.color.blue,r.color.alpha]});return Array.isArray(o)}}class Nxe{constructor(e){this.colorInfo=e}async compute(e,t,i,n){const o=await e.provideColorPresentations(t,this.colorInfo,dt.None);return Array.isArray(o)&&n.push(...o),Array.isArray(o)}}async function g4(s,e,t,i,n){let o=!1,r;const a=[],l=e.ordered(t);for(let d=l.length-1;d>=0;d--){const c=l[d];if(c instanceof h4)r=c;else try{await s.compute(c,t,i,a)&&(o=!0)}catch(u){Ni(u)}}return o?a:r&&n?(await s.compute(r,t,i,a),a):[]}function gq(s,e){const{colorProvider:t}=s.get(be),i=s.get(_i).getModel(e);if(!i)throw Ar();const n=s.get(rt).getValue("editor.defaultColorDecorators",{resource:e});return{model:i,colorProviderRegistry:t,isDefaultColorDecoratorsEnabled:n}}pt.registerCommand("_executeDocumentColorProvider",function(s,...e){const[t]=e;if(!(t instanceof Ae))throw Ar();const{model:i,colorProviderRegistry:n,isDefaultColorDecoratorsEnabled:o}=gq(s,t);return g4(new Txe,n,i,dt.None,o)});pt.registerCommand("_executeColorPresentationProvider",function(s,...e){const[t,i]=e,{uri:n,range:o}=i;if(!(n instanceof Ae)||!Array.isArray(t)||t.length!==4||!x.isIRange(o))throw Ar();const{model:r,colorProviderRegistry:a,isDefaultColorDecoratorsEnabled:l}=gq(s,n),[d,c,u,h]=t;return g4(new Nxe({range:o,color:{red:d,green:c,blue:u,alpha:h}}),a,r,dt.None,l)});var Axe=function(s,e,t,i){var n=arguments.length,o=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,e,t,i);else for(var a=s.length-1;a>=0;a--)(r=s[a])&&(o=(n<3?r(o):n>3?r(e,t,o):r(e,t))||o);return n>3&&o&&Object.defineProperty(e,t,o),o},nT=function(s,e){return function(t,i){e(t,i,s)}},WM;const fq=Object.create({});let Mh=WM=class extends V{constructor(e,t,i,n){super(),this._editor=e,this._configurationService=t,this._languageFeaturesService=i,this._localToDispose=this._register(new Y),this._decorationsIds=[],this._colorDatas=new Map,this._colorDecoratorIds=this._editor.createDecorationsCollection(),this._ruleFactory=new p1(this._editor),this._decoratorLimitReporter=new Mxe,this._colorDecorationClassRefs=this._register(new Y),this._debounceInformation=n.for(i.colorProvider,"Document Colors",{min:WM.RECOMPUTE_TIME}),this._register(e.onDidChangeModel(()=>{this._isColorDecoratorsEnabled=this.isEnabled(),this.updateColors()})),this._register(e.onDidChangeModelLanguage(()=>this.updateColors())),this._register(i.colorProvider.onDidChange(()=>this.updateColors())),this._register(e.onDidChangeConfiguration(o=>{const r=this._isColorDecoratorsEnabled;this._isColorDecoratorsEnabled=this.isEnabled(),this._isDefaultColorDecoratorsEnabled=this._editor.getOption(147);const a=r!==this._isColorDecoratorsEnabled||o.hasChanged(21),l=o.hasChanged(147);(a||l)&&(this._isColorDecoratorsEnabled?this.updateColors():this.removeAllDecorations())})),this._timeoutTimer=null,this._computePromise=null,this._isColorDecoratorsEnabled=this.isEnabled(),this._isDefaultColorDecoratorsEnabled=this._editor.getOption(147),this.updateColors()}isEnabled(){const e=this._editor.getModel();if(!e)return!1;const t=e.getLanguageId(),i=this._configurationService.getValue(t);if(i&&typeof i=="object"){const n=i.colorDecorators;if(n&&n.enable!==void 0&&!n.enable)return n.enable}return this._editor.getOption(20)}static get(e){return e.getContribution(this.ID)}dispose(){this.stop(),this.removeAllDecorations(),super.dispose()}updateColors(){if(this.stop(),!this._isColorDecoratorsEnabled)return;const e=this._editor.getModel();!e||!this._languageFeaturesService.colorProvider.has(e)||(this._localToDispose.add(this._editor.onDidChangeModelContent(()=>{this._timeoutTimer||(this._timeoutTimer=new ya,this._timeoutTimer.cancelAndSet(()=>{this._timeoutTimer=null,this.beginCompute()},this._debounceInformation.get(e)))})),this.beginCompute())}async beginCompute(){this._computePromise=Ln(async e=>{const t=this._editor.getModel();if(!t)return[];const i=new Jn(!1),n=await uq(this._languageFeaturesService.colorProvider,t,e,this._isDefaultColorDecoratorsEnabled);return this._debounceInformation.update(t,i.elapsed()),n});try{const e=await this._computePromise;this.updateDecorations(e),this.updateColorDecorators(e),this._computePromise=null}catch(e){Ge(e)}}stop(){this._timeoutTimer&&(this._timeoutTimer.cancel(),this._timeoutTimer=null),this._computePromise&&(this._computePromise.cancel(),this._computePromise=null),this._localToDispose.clear()}updateDecorations(e){const t=e.map(i=>({range:{startLineNumber:i.colorInfo.range.startLineNumber,startColumn:i.colorInfo.range.startColumn,endLineNumber:i.colorInfo.range.endLineNumber,endColumn:i.colorInfo.range.endColumn},options:Xe.EMPTY}));this._editor.changeDecorations(i=>{this._decorationsIds=i.deltaDecorations(this._decorationsIds,t),this._colorDatas=new Map,this._decorationsIds.forEach((n,o)=>this._colorDatas.set(n,e[o]))})}updateColorDecorators(e){this._colorDecorationClassRefs.clear();const t=[],i=this._editor.getOption(21);for(let o=0;othis._colorDatas.has(n.id));return i.length===0?null:this._colorDatas.get(i[0].id)}isColorDecoration(e){return this._colorDecoratorIds.has(e)}};Mh.ID="editor.contrib.colorDetector";Mh.RECOMPUTE_TIME=1e3;Mh=WM=Axe([nT(1,rt),nT(2,be),nT(3,Ur)],Mh);class Mxe{constructor(){this._onDidChange=new B,this._computed=0,this._limited=!1}update(e,t){(e!==this._computed||t!==this._limited)&&(this._computed=e,this._limited=t,this._onDidChange.fire())}}kt(Mh.ID,Mh,1);class Rxe{get color(){return this._color}set color(e){this._color.equals(e)||(this._color=e,this._onDidChangeColor.fire(e))}get presentation(){return this.colorPresentations[this.presentationIndex]}get colorPresentations(){return this._colorPresentations}set colorPresentations(e){this._colorPresentations=e,this.presentationIndex>e.length-1&&(this.presentationIndex=0),this._onDidChangePresentation.fire(this.presentation)}constructor(e,t,i){this.presentationIndex=i,this._onColorFlushed=new B,this.onColorFlushed=this._onColorFlushed.event,this._onDidChangeColor=new B,this.onDidChangeColor=this._onDidChangeColor.event,this._onDidChangePresentation=new B,this.onDidChangePresentation=this._onDidChangePresentation.event,this.originalColor=e,this._color=e,this._colorPresentations=t}selectNextColorPresentation(){this.presentationIndex=(this.presentationIndex+1)%this.colorPresentations.length,this.flushColor(),this._onDidChangePresentation.fire(this.presentation)}guessColorPresentation(e,t){let i=-1;for(let n=0;n{this.backgroundColor=r.getColor(eD)||$.white})),this._register(K(this._pickedColorNode,ee.CLICK,()=>this.model.selectNextColorPresentation())),this._register(K(this._originalColorNode,ee.CLICK,()=>{this.model.color=this.model.originalColor,this.model.flushColor()})),this._register(t.onDidChangeColor(this.onDidChangeColor,this)),this._register(t.onDidChangePresentation(this.onDidChangePresentation,this)),this._pickedColorNode.style.backgroundColor=$.Format.CSS.format(t.color)||"",this._pickedColorNode.classList.toggle("light",t.color.rgba.a<.5?this.backgroundColor.isLighter():t.color.isLighter()),this.onDidChangeColor(this.model.color),this.showingStandaloneColorPicker&&(this._domNode.classList.add("standalone-colorpicker"),this._closeButton=this._register(new Fxe(this._domNode)))}get closeButton(){return this._closeButton}get pickedColorNode(){return this._pickedColorNode}get originalColorNode(){return this._originalColorNode}onDidChangeColor(e){this._pickedColorNode.style.backgroundColor=$.Format.CSS.format(e)||"",this._pickedColorNode.classList.toggle("light",e.rgba.a<.5?this.backgroundColor.isLighter():e.isLighter()),this.onDidChangePresentation()}onDidChangePresentation(){this._pickedColorPresentation.textContent=this.model.presentation?this.model.presentation.label:""}}class Fxe extends V{constructor(e){super(),this._onClicked=this._register(new B),this.onClicked=this._onClicked.event,this._button=document.createElement("div"),this._button.classList.add("close-button"),Q(e,this._button);const t=document.createElement("div");t.classList.add("close-button-inner-div"),Q(this._button,t),Q(t,Xo(".button"+Pe.asCSSSelector(Li("color-picker-close",oe.close,p("closeIcon","Icon to close the color picker"))))).classList.add("close-icon"),this._register(K(this._button,ee.CLICK,()=>{this._onClicked.fire()}))}}class Oxe extends V{constructor(e,t,i,n=!1){super(),this.model=t,this.pixelRatio=i,this._insertButton=null,this._domNode=Xo(".colorpicker-body"),Q(e,this._domNode),this._saturationBox=new Bxe(this._domNode,this.model,this.pixelRatio),this._register(this._saturationBox),this._register(this._saturationBox.onDidChange(this.onDidSaturationValueChange,this)),this._register(this._saturationBox.onColorFlushed(this.flushColor,this)),this._opacityStrip=new Wxe(this._domNode,this.model,n),this._register(this._opacityStrip),this._register(this._opacityStrip.onDidChange(this.onDidOpacityChange,this)),this._register(this._opacityStrip.onColorFlushed(this.flushColor,this)),this._hueStrip=new Hxe(this._domNode,this.model,n),this._register(this._hueStrip),this._register(this._hueStrip.onDidChange(this.onDidHueChange,this)),this._register(this._hueStrip.onColorFlushed(this.flushColor,this)),n&&(this._insertButton=this._register(new Vxe(this._domNode)),this._domNode.classList.add("standalone-colorpicker"))}flushColor(){this.model.flushColor()}onDidSaturationValueChange({s:e,v:t}){const i=this.model.color.hsva;this.model.color=new $(new Zl(i.h,e,t,i.a))}onDidOpacityChange(e){const t=this.model.color.hsva;this.model.color=new $(new Zl(t.h,t.s,t.v,e))}onDidHueChange(e){const t=this.model.color.hsva,i=(1-e)*360;this.model.color=new $(new Zl(i===360?0:i,t.s,t.v,t.a))}get domNode(){return this._domNode}get saturationBox(){return this._saturationBox}get enterButton(){return this._insertButton}layout(){this._saturationBox.layout(),this._opacityStrip.layout(),this._hueStrip.layout()}}class Bxe extends V{constructor(e,t,i){super(),this.model=t,this.pixelRatio=i,this._onDidChange=new B,this.onDidChange=this._onDidChange.event,this._onColorFlushed=new B,this.onColorFlushed=this._onColorFlushed.event,this._domNode=Xo(".saturation-wrap"),Q(e,this._domNode),this._canvas=document.createElement("canvas"),this._canvas.className="saturation-box",Q(this._domNode,this._canvas),this.selection=Xo(".saturation-selection"),Q(this._domNode,this.selection),this.layout(),this._register(K(this._domNode,ee.POINTER_DOWN,n=>this.onPointerDown(n))),this._register(this.model.onDidChangeColor(this.onDidChangeColor,this)),this.monitor=null}get domNode(){return this._domNode}onPointerDown(e){if(!e.target||!(e.target instanceof Element))return;this.monitor=this._register(new n0);const t=qi(this._domNode);e.target!==this.selection&&this.onDidChangePosition(e.offsetX,e.offsetY),this.monitor.startMonitoring(e.target,e.pointerId,e.buttons,n=>this.onDidChangePosition(n.pageX-t.left,n.pageY-t.top),()=>null);const i=K(e.target.ownerDocument,ee.POINTER_UP,()=>{this._onColorFlushed.fire(),i.dispose(),this.monitor&&(this.monitor.stopMonitoring(!0),this.monitor=null)},!0)}onDidChangePosition(e,t){const i=Math.max(0,Math.min(1,e/this.width)),n=Math.max(0,Math.min(1,1-t/this.height));this.paintSelection(i,n),this._onDidChange.fire({s:i,v:n})}layout(){this.width=this._domNode.offsetWidth,this.height=this._domNode.offsetHeight,this._canvas.width=this.width*this.pixelRatio,this._canvas.height=this.height*this.pixelRatio,this.paint();const e=this.model.color.hsva;this.paintSelection(e.s,e.v)}paint(){const e=this.model.color.hsva,t=new $(new Zl(e.h,1,1,1)),i=this._canvas.getContext("2d"),n=i.createLinearGradient(0,0,this._canvas.width,0);n.addColorStop(0,"rgba(255, 255, 255, 1)"),n.addColorStop(.5,"rgba(255, 255, 255, 0.5)"),n.addColorStop(1,"rgba(255, 255, 255, 0)");const o=i.createLinearGradient(0,0,0,this._canvas.height);o.addColorStop(0,"rgba(0, 0, 0, 0)"),o.addColorStop(1,"rgba(0, 0, 0, 1)"),i.rect(0,0,this._canvas.width,this._canvas.height),i.fillStyle=$.Format.CSS.format(t),i.fill(),i.fillStyle=n,i.fill(),i.fillStyle=o,i.fill()}paintSelection(e,t){this.selection.style.left=`${e*this.width}px`,this.selection.style.top=`${this.height-t*this.height}px`}onDidChangeColor(e){if(this.monitor&&this.monitor.isMonitoring())return;this.paint();const t=e.hsva;this.paintSelection(t.s,t.v)}}class pq extends V{constructor(e,t,i=!1){super(),this.model=t,this._onDidChange=new B,this.onDidChange=this._onDidChange.event,this._onColorFlushed=new B,this.onColorFlushed=this._onColorFlushed.event,i?(this.domNode=Q(e,Xo(".standalone-strip")),this.overlay=Q(this.domNode,Xo(".standalone-overlay"))):(this.domNode=Q(e,Xo(".strip")),this.overlay=Q(this.domNode,Xo(".overlay"))),this.slider=Q(this.domNode,Xo(".slider")),this.slider.style.top="0px",this._register(K(this.domNode,ee.POINTER_DOWN,n=>this.onPointerDown(n))),this._register(t.onDidChangeColor(this.onDidChangeColor,this)),this.layout()}layout(){this.height=this.domNode.offsetHeight-this.slider.offsetHeight;const e=this.getValue(this.model.color);this.updateSliderPosition(e)}onDidChangeColor(e){const t=this.getValue(e);this.updateSliderPosition(t)}onPointerDown(e){if(!e.target||!(e.target instanceof Element))return;const t=this._register(new n0),i=qi(this.domNode);this.domNode.classList.add("grabbing"),e.target!==this.slider&&this.onDidChangeTop(e.offsetY),t.startMonitoring(e.target,e.pointerId,e.buttons,o=>this.onDidChangeTop(o.pageY-i.top),()=>null);const n=K(e.target.ownerDocument,ee.POINTER_UP,()=>{this._onColorFlushed.fire(),n.dispose(),t.stopMonitoring(!0),this.domNode.classList.remove("grabbing")},!0)}onDidChangeTop(e){const t=Math.max(0,Math.min(1,1-e/this.height));this.updateSliderPosition(t),this._onDidChange.fire(t)}updateSliderPosition(e){this.slider.style.top=`${(1-e)*this.height}px`}}class Wxe extends pq{constructor(e,t,i=!1){super(e,t,i),this.domNode.classList.add("opacity-strip"),this.onDidChangeColor(this.model.color)}onDidChangeColor(e){super.onDidChangeColor(e);const{r:t,g:i,b:n}=e.rgba,o=new $(new bt(t,i,n,1)),r=new $(new bt(t,i,n,0));this.overlay.style.background=`linear-gradient(to bottom, ${o} 0%, ${r} 100%)`}getValue(e){return e.hsva.a}}class Hxe extends pq{constructor(e,t,i=!1){super(e,t,i),this.domNode.classList.add("hue-strip")}getValue(e){return 1-e.hsva.h/360}}class Vxe extends V{constructor(e){super(),this._onClicked=this._register(new B),this.onClicked=this._onClicked.event,this._button=Q(e,document.createElement("button")),this._button.classList.add("insert-button"),this._button.textContent="Insert",this._register(K(this._button,ee.CLICK,()=>{this._onClicked.fire()}))}get button(){return this._button}}class zxe extends ur{constructor(e,t,i,n,o=!1){super(),this.model=t,this.pixelRatio=i,this._register(Ab.getInstance(Te(e)).onDidChange(()=>this.layout()));const r=Xo(".colorpicker-widget");e.appendChild(r),this.header=this._register(new Pxe(r,this.model,n,o)),this.body=this._register(new Oxe(r,this.model,this.pixelRatio,o))}layout(){this.body.layout()}}var mq=function(s,e,t,i){var n=arguments.length,o=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,e,t,i);else for(var a=s.length-1;a>=0;a--)(r=s[a])&&(o=(n<3?r(o):n>3?r(e,t,o):r(e,t))||o);return n>3&&o&&Object.defineProperty(e,t,o),o},_q=function(s,e){return function(t,i){e(t,i,s)}};class Uxe{constructor(e,t,i,n){this.owner=e,this.range=t,this.model=i,this.provider=n,this.forceShowAtRange=!0}isValidForHoverAnchor(e){return e.type===1&&this.range.startColumn<=e.range.startColumn&&this.range.endColumn>=e.range.endColumn}}let cL=class{constructor(e,t){this._editor=e,this._themeService=t,this.hoverOrdinal=2}computeSync(e,t){return[]}computeAsync(e,t,i){return Xi.fromPromise(this._computeAsync(e,t,i))}async _computeAsync(e,t,i){if(!this._editor.hasModel())return[];const n=Mh.get(this._editor);if(!n)return[];for(const o of t){if(!n.isColorDecoration(o))continue;const r=n.getColorData(o.range.getStartPosition());if(r)return[await vq(this,this._editor.getModel(),r.colorInfo,r.provider)]}return[]}renderHoverParts(e,t){return bq(this,this._editor,this._themeService,t,e)}};cL=mq([_q(1,_n)],cL);class $xe{constructor(e,t,i,n){this.owner=e,this.range=t,this.model=i,this.provider=n}}let EC=class{constructor(e,t){this._editor=e,this._themeService=t,this._color=null}async createColorHover(e,t,i){if(!this._editor.hasModel()||!Mh.get(this._editor))return null;const o=await uq(i,this._editor.getModel(),dt.None);let r=null,a=null;for(const u of o){const h=u.colorInfo;x.containsRange(h.range,e.range)&&(r=h,a=u.provider)}const l=r??e,d=a??t,c=!!r;return{colorHover:await vq(this,this._editor.getModel(),l,d),foundInEditor:c}}async updateEditorModel(e){if(!this._editor.hasModel())return;const t=e.model;let i=new x(e.range.startLineNumber,e.range.startColumn,e.range.endLineNumber,e.range.endColumn);this._color&&(await aS(this._editor.getModel(),t,this._color,i,e),i=Cq(this._editor,i,t))}renderHoverParts(e,t){return bq(this,this._editor,this._themeService,t,e)}set color(e){this._color=e}get color(){return this._color}};EC=mq([_q(1,_n)],EC);async function vq(s,e,t,i){const n=e.getValueInRange(t.range),{red:o,green:r,blue:a,alpha:l}=t.color,d=new bt(Math.round(o*255),Math.round(r*255),Math.round(a*255),l),c=new $(d),u=await hq(e,t,i,dt.None),h=new Rxe(c,[],0);return h.colorPresentations=u||[],h.guessColorPresentation(c,n),s instanceof cL?new Uxe(s,x.lift(t.range),h,i):new $xe(s,x.lift(t.range),h,i)}function bq(s,e,t,i,n){if(i.length===0||!e.hasModel())return V.None;if(n.setMinimumDimensions){const h=e.getOption(67)+8;n.setMinimumDimensions(new Dt(302,h))}const o=new Y,r=i[0],a=e.getModel(),l=r.model,d=o.add(new zxe(n.fragment,l,e.getOption(143),t,s instanceof EC));n.setColorPicker(d);let c=!1,u=new x(r.range.startLineNumber,r.range.startColumn,r.range.endLineNumber,r.range.endColumn);if(s instanceof EC){const h=i[0].model.color;s.color=h,aS(a,l,h,u,r),o.add(l.onColorFlushed(g=>{s.color=g}))}else o.add(l.onColorFlushed(async h=>{await aS(a,l,h,u,r),c=!0,u=Cq(e,u,l)}));return o.add(l.onDidChangeColor(h=>{aS(a,l,h,u,r)})),o.add(e.onDidChangeModelContent(h=>{c?c=!1:(n.hide(),e.focus())})),o}function Cq(s,e,t){var i,n;const o=[],r=(i=t.presentation.textEdit)!==null&&i!==void 0?i:{range:e,text:t.presentation.label,forceMoveMarkers:!1};o.push(r),t.presentation.additionalTextEdits&&o.push(...t.presentation.additionalTextEdits);const a=x.lift(r.range),l=s.getModel()._setTrackedRange(null,a,3);return s.executeEdits("colorpicker",o),s.pushUndoStop(),(n=s.getModel()._getTrackedRange(l))!==null&&n!==void 0?n:a}async function aS(s,e,t,i,n){const o=await hq(s,{range:i,color:{red:t.rgba.r/255,green:t.rgba.g/255,blue:t.rgba.b/255,alpha:t.rgba.a}},n.provider,dt.None);e.colorPresentations=o||[]}const wq="editor.action.showHover",jxe="editor.action.showDefinitionPreviewHover",Kxe="editor.action.scrollUpHover",qxe="editor.action.scrollDownHover",Gxe="editor.action.scrollLeftHover",Zxe="editor.action.scrollRightHover",Xxe="editor.action.pageUpHover",Yxe="editor.action.pageDownHover",Qxe="editor.action.goToTopHover",Jxe="editor.action.goToBottomHover",f4="editor.action.increaseHoverVerbosityLevel",p4="editor.action.decreaseHoverVerbosityLevel",yq="editor.action.inlineSuggest.commit",Sq="editor.action.inlineSuggest.showPrevious",Dq="editor.action.inlineSuggest.showNext";var m4=function(s,e,t,i){var n=arguments.length,o=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,e,t,i);else for(var a=s.length-1;a>=0;a--)(r=s[a])&&(o=(n<3?r(o):n>3?r(e,t,o):r(e,t))||o);return n>3&&o&&Object.defineProperty(e,t,o),o},oa=function(s,e){return function(t,i){e(t,i,s)}},lS;let HM=class extends V{constructor(e,t,i){super(),this.editor=e,this.model=t,this.instantiationService=i,this.alwaysShowToolbar=Ft(this.editor.onDidChangeConfiguration,()=>this.editor.getOption(62).showToolbar==="always"),this.sessionPosition=void 0,this.position=$e(this,n=>{var o,r,a;const l=(o=this.model.read(n))===null||o===void 0?void 0:o.primaryGhostText.read(n);if(!this.alwaysShowToolbar.read(n)||!l||l.parts.length===0)return this.sessionPosition=void 0,null;const d=l.parts[0].column;this.sessionPosition&&this.sessionPosition.lineNumber!==l.lineNumber&&(this.sessionPosition=void 0);const c=new W(l.lineNumber,Math.min(d,(a=(r=this.sessionPosition)===null||r===void 0?void 0:r.column)!==null&&a!==void 0?a:Number.MAX_SAFE_INTEGER));return this.sessionPosition=c,c}),this._register(Wr((n,o)=>{const r=this.model.read(n);if(!r||!this.alwaysShowToolbar.read(n))return;const a=o.add(this.instantiationService.createInstance(Rh,this.editor,!0,this.position,r.selectedInlineCompletionIndex,r.inlineCompletionsCount,r.activeCommands));e.addContentWidget(a),o.add(Ie(()=>e.removeContentWidget(a))),o.add(st(l=>{this.position.read(l)&&r.lastTriggerKind.read(l)!==xc.Explicit&&r.triggerExplicitly()}))}))}};HM=m4([oa(2,Ne)],HM);const eke=Li("inline-suggestion-hints-next",oe.chevronRight,p("parameterHintsNextIcon","Icon for show next parameter hint.")),tke=Li("inline-suggestion-hints-previous",oe.chevronLeft,p("parameterHintsPreviousIcon","Icon for show previous parameter hint."));let Rh=lS=class extends V{static get dropDownVisible(){return this._dropDownVisible}createCommandAction(e,t,i){const n=new ko(e,t,i,!0,()=>this._commandService.executeCommand(e)),o=this.keybindingService.lookupKeybinding(e,this._contextKeyService);let r=t;return o&&(r=p({key:"content",comment:["A label","A keybinding"]},"{0} ({1})",t,o.getLabel())),n.tooltip=r,n}constructor(e,t,i,n,o,r,a,l,d,c,u){super(),this.editor=e,this.withBorder=t,this._position=i,this._currentSuggestionIdx=n,this._suggestionCount=o,this._extraCommands=r,this._commandService=a,this.keybindingService=d,this._contextKeyService=c,this._menuService=u,this.id=`InlineSuggestionHintsContentWidget${lS.id++}`,this.allowEditorOverflow=!0,this.suppressMouseDown=!1,this.nodes=Nt("div.inlineSuggestionsHints",{className:this.withBorder?".withBorder":""},[Nt("div@toolBar")]),this.previousAction=this.createCommandAction(Sq,p("previous","Previous"),Pe.asClassName(tke)),this.availableSuggestionCountAction=new ko("inlineSuggestionHints.availableSuggestionCount","",void 0,!1),this.nextAction=this.createCommandAction(Dq,p("next","Next"),Pe.asClassName(eke)),this.inlineCompletionsActionsMenus=this._register(this._menuService.createMenu(k.InlineCompletionsActions,this._contextKeyService)),this.clearAvailableSuggestionCountLabelDebounced=this._register(new Ht(()=>{this.availableSuggestionCountAction.label=""},100)),this.disableButtonsDebounced=this._register(new Ht(()=>{this.previousAction.enabled=this.nextAction.enabled=!1},100)),this.toolBar=this._register(l.createInstance(VM,this.nodes.toolBar,k.InlineSuggestionToolbar,{menuOptions:{renderShortTitle:!0},toolbarOptions:{primaryGroup:h=>h.startsWith("primary")},actionViewItemProvider:(h,g)=>{if(h instanceof Eo)return l.createInstance(nke,h,void 0);if(h===this.availableSuggestionCountAction){const f=new ike(void 0,h,{label:!0,icon:!1});return f.setClass("availableSuggestionCount"),f}},telemetrySource:"InlineSuggestionToolbar"})),this.toolBar.setPrependedPrimaryActions([this.previousAction,this.availableSuggestionCountAction,this.nextAction]),this._register(this.toolBar.onDidChangeDropdownVisibility(h=>{lS._dropDownVisible=h})),this._register(st(h=>{this._position.read(h),this.editor.layoutContentWidget(this)})),this._register(st(h=>{const g=this._suggestionCount.read(h),f=this._currentSuggestionIdx.read(h);g!==void 0?(this.clearAvailableSuggestionCountLabelDebounced.cancel(),this.availableSuggestionCountAction.label=`${f+1}/${g}`):this.clearAvailableSuggestionCountLabelDebounced.schedule(),g!==void 0&&g>1?(this.disableButtonsDebounced.cancel(),this.previousAction.enabled=this.nextAction.enabled=!0):this.disableButtonsDebounced.schedule()})),this._register(st(h=>{const f=this._extraCommands.read(h).map(m=>({class:void 0,id:m.id,enabled:!0,tooltip:m.tooltip||"",label:m.title,run:_=>this._commandService.executeCommand(m.id)}));for(const[m,_]of this.inlineCompletionsActionsMenus.getActions())for(const v of _)v instanceof Eo&&f.push(v);f.length>0&&f.unshift(new rn),this.toolBar.setAdditionalSecondaryActions(f)}))}getId(){return this.id}getDomNode(){return this.nodes.root}getPosition(){return{position:this._position.get(),preference:[1,2],positionAffinity:3}}};Rh._dropDownVisible=!1;Rh.id=0;Rh=lS=m4([oa(6,ui),oa(7,Ne),oa(8,At),oa(9,Be),oa(10,dr)],Rh);class ike extends D_{constructor(){super(...arguments),this._className=void 0}setClass(e){this._className=e}render(e){super.render(e),this._className&&e.classList.add(this._className)}updateTooltip(){}}let nke=class extends Eh{updateLabel(){const e=this._keybindingService.lookupKeybinding(this._action.id,this._contextKeyService);if(!e)return super.updateLabel();if(this.label){const t=Nt("div.keybinding").root;this._register(new d0(t,Do,{disableTitle:!0,...Gj})).set(e),this.label.textContent=this._action.label,this.label.appendChild(t),this.label.classList.add("inlineSuggestionStatusBarItemLabel")}}updateTooltip(){}},VM=class extends CC{constructor(e,t,i,n,o,r,a,l,d){super(e,{resetMenu:t,...i},n,o,r,a,l,d),this.menuId=t,this.options2=i,this.menuService=n,this.contextKeyService=o,this.menu=this._store.add(this.menuService.createMenu(this.menuId,this.contextKeyService,{emitEventsForSubmenuChanges:!0})),this.additionalActions=[],this.prependedPrimaryActions=[],this._store.add(this.menu.onDidChange(()=>this.updateToolbar())),this.updateToolbar()}updateToolbar(){var e,t,i,n,o,r,a;const l=[],d=[];Yx(this.menu,(e=this.options2)===null||e===void 0?void 0:e.menuOptions,{primary:l,secondary:d},(i=(t=this.options2)===null||t===void 0?void 0:t.toolbarOptions)===null||i===void 0?void 0:i.primaryGroup,(o=(n=this.options2)===null||n===void 0?void 0:n.toolbarOptions)===null||o===void 0?void 0:o.shouldInlineSubmenu,(a=(r=this.options2)===null||r===void 0?void 0:r.toolbarOptions)===null||a===void 0?void 0:a.useSeparatorsInPrimaryActions),d.push(...this.additionalActions),l.unshift(...this.prependedPrimaryActions),this.setActions(l,d)}setPrependedPrimaryActions(e){wi(this.prependedPrimaryActions,e,(t,i)=>t===i)||(this.prependedPrimaryActions=e,this.updateToolbar())}setAdditionalSecondaryActions(e){wi(this.additionalActions,e,(t,i)=>t===i)||(this.additionalActions=e,this.updateToolbar())}};VM=m4([oa(3,dr),oa(4,Be),oa(5,Fo),oa(6,At),oa(7,ui),oa(8,qs)],VM);class _4{constructor(){this._onDidWillResize=new B,this.onDidWillResize=this._onDidWillResize.event,this._onDidResize=new B,this.onDidResize=this._onDidResize.event,this._sashListener=new Y,this._size=new Dt(0,0),this._minSize=new Dt(0,0),this._maxSize=new Dt(Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER),this.domNode=document.createElement("div"),this._eastSash=new is(this.domNode,{getVerticalSashLeft:()=>this._size.width},{orientation:0}),this._westSash=new is(this.domNode,{getVerticalSashLeft:()=>0},{orientation:0}),this._northSash=new is(this.domNode,{getHorizontalSashTop:()=>0},{orientation:1,orthogonalEdge:PD.North}),this._southSash=new is(this.domNode,{getHorizontalSashTop:()=>this._size.height},{orientation:1,orthogonalEdge:PD.South}),this._northSash.orthogonalStartSash=this._westSash,this._northSash.orthogonalEndSash=this._eastSash,this._southSash.orthogonalStartSash=this._westSash,this._southSash.orthogonalEndSash=this._eastSash;let e,t=0,i=0;this._sashListener.add(ae.any(this._northSash.onDidStart,this._eastSash.onDidStart,this._southSash.onDidStart,this._westSash.onDidStart)(()=>{e===void 0&&(this._onDidWillResize.fire(),e=this._size,t=0,i=0)})),this._sashListener.add(ae.any(this._northSash.onDidEnd,this._eastSash.onDidEnd,this._southSash.onDidEnd,this._westSash.onDidEnd)(()=>{e!==void 0&&(e=void 0,t=0,i=0,this._onDidResize.fire({dimension:this._size,done:!0}))})),this._sashListener.add(this._eastSash.onDidChange(n=>{e&&(i=n.currentX-n.startX,this.layout(e.height+t,e.width+i),this._onDidResize.fire({dimension:this._size,done:!1,east:!0}))})),this._sashListener.add(this._westSash.onDidChange(n=>{e&&(i=-(n.currentX-n.startX),this.layout(e.height+t,e.width+i),this._onDidResize.fire({dimension:this._size,done:!1,west:!0}))})),this._sashListener.add(this._northSash.onDidChange(n=>{e&&(t=-(n.currentY-n.startY),this.layout(e.height+t,e.width+i),this._onDidResize.fire({dimension:this._size,done:!1,north:!0}))})),this._sashListener.add(this._southSash.onDidChange(n=>{e&&(t=n.currentY-n.startY,this.layout(e.height+t,e.width+i),this._onDidResize.fire({dimension:this._size,done:!1,south:!0}))})),this._sashListener.add(ae.any(this._eastSash.onDidReset,this._westSash.onDidReset)(n=>{this._preferredSize&&(this.layout(this._size.height,this._preferredSize.width),this._onDidResize.fire({dimension:this._size,done:!0}))})),this._sashListener.add(ae.any(this._northSash.onDidReset,this._southSash.onDidReset)(n=>{this._preferredSize&&(this.layout(this._preferredSize.height,this._size.width),this._onDidResize.fire({dimension:this._size,done:!0}))}))}dispose(){this._northSash.dispose(),this._southSash.dispose(),this._eastSash.dispose(),this._westSash.dispose(),this._sashListener.dispose(),this._onDidResize.dispose(),this._onDidWillResize.dispose(),this.domNode.remove()}enableSashes(e,t,i,n){this._northSash.state=e?3:0,this._eastSash.state=t?3:0,this._southSash.state=i?3:0,this._westSash.state=n?3:0}layout(e=this.size.height,t=this.size.width){const{height:i,width:n}=this._minSize,{height:o,width:r}=this._maxSize;e=Math.max(i,Math.min(o,e)),t=Math.max(n,Math.min(r,t));const a=new Dt(t,e);Dt.equals(a,this._size)||(this.domNode.style.height=e+"px",this.domNode.style.width=t+"px",this._size=a,this._northSash.layout(),this._eastSash.layout(),this._southSash.layout(),this._westSash.layout())}clearSashHoverState(){this._eastSash.clearSashHoverState(),this._westSash.clearSashHoverState(),this._northSash.clearSashHoverState(),this._southSash.clearSashHoverState()}get size(){return this._size}set maxSize(e){this._maxSize=e}get maxSize(){return this._maxSize}set minSize(e){this._minSize=e}get minSize(){return this._minSize}set preferredSize(e){this._preferredSize=e}get preferredSize(){return this._preferredSize}}const ske=30,oke=24;class rke extends V{constructor(e,t=new Dt(10,10)){super(),this._editor=e,this.allowEditorOverflow=!0,this.suppressMouseDown=!1,this._resizableNode=this._register(new _4),this._contentPosition=null,this._isResizing=!1,this._resizableNode.domNode.style.position="absolute",this._resizableNode.minSize=Dt.lift(t),this._resizableNode.layout(t.height,t.width),this._resizableNode.enableSashes(!0,!0,!0,!0),this._register(this._resizableNode.onDidResize(i=>{this._resize(new Dt(i.dimension.width,i.dimension.height)),i.done&&(this._isResizing=!1)})),this._register(this._resizableNode.onDidWillResize(()=>{this._isResizing=!0}))}get isResizing(){return this._isResizing}getDomNode(){return this._resizableNode.domNode}getPosition(){return this._contentPosition}get position(){var e;return!((e=this._contentPosition)===null||e===void 0)&&e.position?W.lift(this._contentPosition.position):void 0}_availableVerticalSpaceAbove(e){const t=this._editor.getDomNode(),i=this._editor.getScrolledVisiblePosition(e);return!t||!i?void 0:qi(t).top+i.top-ske}_availableVerticalSpaceBelow(e){const t=this._editor.getDomNode(),i=this._editor.getScrolledVisiblePosition(e);if(!t||!i)return;const n=qi(t),o=Ch(t.ownerDocument.body),r=n.top+i.top+i.height;return o.height-r-oke}_findPositionPreference(e,t){var i,n;const o=Math.min((i=this._availableVerticalSpaceBelow(t))!==null&&i!==void 0?i:1/0,e),r=Math.min((n=this._availableVerticalSpaceAbove(t))!==null&&n!==void 0?n:1/0,e),a=Math.min(Math.max(r,o),e),l=Math.min(e,a);let d;return this._editor.getOption(60).above?d=l<=r?1:2:d=l<=o?2:1,d===1?this._resizableNode.enableSashes(!0,!0,!1,!1):this._resizableNode.enableSashes(!1,!0,!0,!1),d}_resize(e){this._resizableNode.layout(e.height,e.width)}}var ake=function(s,e,t,i){var n=arguments.length,o=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,e,t,i);else for(var a=s.length-1;a>=0;a--)(r=s[a])&&(o=(n<3?r(o):n>3?r(e,t,o):r(e,t))||o);return n>3&&o&&Object.defineProperty(e,t,o),o},ey=function(s,e){return function(t,i){e(t,i,s)}},Tl;const F7=30,lke=6;let M_=Tl=class extends rke{get isColorPickerVisible(){var e;return!!(!((e=this._visibleData)===null||e===void 0)&&e.colorPicker)}get isVisibleFromKeyboard(){var e;return((e=this._visibleData)===null||e===void 0?void 0:e.source)===1}get isVisible(){var e;return(e=this._hoverVisibleKey.get())!==null&&e!==void 0?e:!1}get isFocused(){var e;return(e=this._hoverFocusedKey.get())!==null&&e!==void 0?e:!1}constructor(e,t,i,n,o){const r=e.getOption(67)+8,a=150,l=new Dt(a,r);super(e,l),this._configurationService=i,this._accessibilityService=n,this._keybindingService=o,this._hover=this._register(new cO),this._minimumSize=l,this._hoverVisibleKey=T.hoverVisible.bindTo(t),this._hoverFocusedKey=T.hoverFocused.bindTo(t),Q(this._resizableNode.domNode,this._hover.containerDomNode),this._resizableNode.domNode.style.zIndex="50",this._register(this._editor.onDidLayoutChange(()=>{this.isVisible&&this._updateMaxDimensions()})),this._register(this._editor.onDidChangeConfiguration(c=>{c.hasChanged(50)&&this._updateFont()}));const d=this._register(Ca(this._resizableNode.domNode));this._register(d.onDidFocus(()=>{this._hoverFocusedKey.set(!0)})),this._register(d.onDidBlur(()=>{this._hoverFocusedKey.set(!1)})),this._setHoverData(void 0),this._editor.addContentWidget(this)}dispose(){var e;super.dispose(),(e=this._visibleData)===null||e===void 0||e.disposables.dispose(),this._editor.removeContentWidget(this)}getId(){return Tl.ID}static _applyDimensions(e,t,i){const n=typeof t=="number"?`${t}px`:t,o=typeof i=="number"?`${i}px`:i;e.style.width=n,e.style.height=o}_setContentsDomNodeDimensions(e,t){const i=this._hover.contentsDomNode;return Tl._applyDimensions(i,e,t)}_setContainerDomNodeDimensions(e,t){const i=this._hover.containerDomNode;return Tl._applyDimensions(i,e,t)}_setHoverWidgetDimensions(e,t){this._setContentsDomNodeDimensions(e,t),this._setContainerDomNodeDimensions(e,t),this._layoutContentWidget()}static _applyMaxDimensions(e,t,i){const n=typeof t=="number"?`${t}px`:t,o=typeof i=="number"?`${i}px`:i;e.style.maxWidth=n,e.style.maxHeight=o}_setHoverWidgetMaxDimensions(e,t){Tl._applyMaxDimensions(this._hover.contentsDomNode,e,t),Tl._applyMaxDimensions(this._hover.containerDomNode,e,t),this._hover.containerDomNode.style.setProperty("--vscode-hover-maxWidth",typeof e=="number"?`${e}px`:e),this._layoutContentWidget()}_setAdjustedHoverWidgetDimensions(e){this._setHoverWidgetMaxDimensions("none","none");const t=e.width,i=e.height;this._setHoverWidgetDimensions(t,i)}_updateResizableNodeMaxDimensions(){var e,t;const i=(e=this._findMaximumRenderingWidth())!==null&&e!==void 0?e:1/0,n=(t=this._findMaximumRenderingHeight())!==null&&t!==void 0?t:1/0;this._resizableNode.maxSize=new Dt(i,n),this._setHoverWidgetMaxDimensions(i,n)}_resize(e){var t,i;Tl._lastDimensions=new Dt(e.width,e.height),this._setAdjustedHoverWidgetDimensions(e),this._resizableNode.layout(e.height,e.width),this._updateResizableNodeMaxDimensions(),this._hover.scrollbar.scanDomNode(),this._editor.layoutContentWidget(this),(i=(t=this._visibleData)===null||t===void 0?void 0:t.colorPicker)===null||i===void 0||i.layout()}_findAvailableSpaceVertically(){var e;const t=(e=this._visibleData)===null||e===void 0?void 0:e.showAtPosition;if(t)return this._positionPreference===1?this._availableVerticalSpaceAbove(t):this._availableVerticalSpaceBelow(t)}_findMaximumRenderingHeight(){const e=this._findAvailableSpaceVertically();if(!e)return;let t=lke;return Array.from(this._hover.contentsDomNode.children).forEach(i=>{t+=i.clientHeight}),Math.min(e,t)}_isHoverTextOverflowing(){this._hover.containerDomNode.style.setProperty("--vscode-hover-whiteSpace","nowrap"),this._hover.containerDomNode.style.setProperty("--vscode-hover-sourceWhiteSpace","nowrap");const e=Array.from(this._hover.contentsDomNode.children).some(t=>t.scrollWidth>t.clientWidth);return this._hover.containerDomNode.style.removeProperty("--vscode-hover-whiteSpace"),this._hover.containerDomNode.style.removeProperty("--vscode-hover-sourceWhiteSpace"),e}_findMaximumRenderingWidth(){if(!this._editor||!this._editor.hasModel())return;const e=this._isHoverTextOverflowing(),t=typeof this._contentWidth>"u"?0:this._contentWidth-2;return e||this._hover.containerDomNode.clientWidth"u"||typeof this._visibleData.initialMousePosY>"u")return this._visibleData.initialMousePosX=e,this._visibleData.initialMousePosY=t,!1;const i=qi(this.getDomNode());typeof this._visibleData.closestMouseDistance>"u"&&(this._visibleData.closestMouseDistance=O7(this._visibleData.initialMousePosX,this._visibleData.initialMousePosY,i.left,i.top,i.width,i.height));const n=O7(e,t,i.left,i.top,i.width,i.height);return n>this._visibleData.closestMouseDistance+4?!1:(this._visibleData.closestMouseDistance=Math.min(this._visibleData.closestMouseDistance,n),!0)}_setHoverData(e){var t;(t=this._visibleData)===null||t===void 0||t.disposables.dispose(),this._visibleData=e,this._hoverVisibleKey.set(!!e),this._hover.containerDomNode.classList.toggle("hidden",!e)}_updateFont(){const{fontSize:e,lineHeight:t}=this._editor.getOption(50),i=this._hover.contentsDomNode;i.style.fontSize=`${e}px`,i.style.lineHeight=`${t/e}`,Array.prototype.slice.call(this._hover.contentsDomNode.getElementsByClassName("code")).forEach(o=>this._editor.applyFontInfo(o))}_updateContent(e){const t=this._hover.contentsDomNode;t.style.paddingBottom="",t.textContent="",t.appendChild(e)}_layoutContentWidget(){this._editor.layoutContentWidget(this),this._hover.onContentsChanged()}_updateMaxDimensions(){const e=Math.max(this._editor.getLayoutInfo().height/4,250,Tl._lastDimensions.height),t=Math.max(this._editor.getLayoutInfo().width*.66,500,Tl._lastDimensions.width);this._setHoverWidgetMaxDimensions(t,e)}_render(e,t){this._setHoverData(t),this._updateFont(),this._updateContent(e),this._updateMaxDimensions(),this.onContentsChanged(),this._editor.render()}getPosition(){var e;return this._visibleData?{position:this._visibleData.showAtPosition,secondaryPosition:this._visibleData.showAtSecondaryPosition,positionAffinity:this._visibleData.isBeforeContent?3:void 0,preference:[(e=this._positionPreference)!==null&&e!==void 0?e:1]}:null}showAt(e,t){var i,n,o,r;if(!this._editor||!this._editor.hasModel())return;this._render(e,t);const a=cc(this._hover.containerDomNode),l=t.showAtPosition;this._positionPreference=(i=this._findPositionPreference(a,l))!==null&&i!==void 0?i:1,this.onContentsChanged(),t.stoleFocus&&this._hover.containerDomNode.focus(),(n=t.colorPicker)===null||n===void 0||n.layout();const c=this._hover.containerDomNode.ownerDocument.activeElement===this._hover.containerDomNode&&H$(this._configurationService.getValue("accessibility.verbosity.hover")===!0&&this._accessibilityService.isScreenReaderOptimized(),(r=(o=this._keybindingService.lookupKeybinding("editor.action.accessibleView"))===null||o===void 0?void 0:o.getAriaLabel())!==null&&r!==void 0?r:"");c&&(this._hover.contentsDomNode.ariaLabel=this._hover.contentsDomNode.textContent+", "+c)}hide(){if(!this._visibleData)return;const e=this._visibleData.stoleFocus||this._hoverFocusedKey.get();this._setHoverData(void 0),this._resizableNode.maxSize=new Dt(1/0,1/0),this._resizableNode.clearSashHoverState(),this._hoverFocusedKey.set(!1),this._editor.layoutContentWidget(this),e&&this._editor.focus()}_removeConstraintsRenderNormally(){const e=this._editor.getLayoutInfo();this._resizableNode.layout(e.height,e.width),this._setHoverWidgetDimensions("auto","auto")}setMinimumDimensions(e){this._minimumSize=new Dt(Math.max(this._minimumSize.width,e.width),Math.max(this._minimumSize.height,e.height)),this._updateMinimumWidth()}_updateMinimumWidth(){const e=typeof this._contentWidth>"u"?this._minimumSize.width:Math.min(this._contentWidth,this._minimumSize.width);this._resizableNode.minSize=new Dt(e,this._minimumSize.height)}onContentsChanged(){var e;this._removeConstraintsRenderNormally();const t=this._hover.containerDomNode;let i=cc(t),n=Co(t);if(this._resizableNode.layout(i,n),this._setHoverWidgetDimensions(n,i),i=cc(t),n=Co(t),this._contentWidth=n,this._updateMinimumWidth(),this._resizableNode.layout(i,n),!((e=this._visibleData)===null||e===void 0)&&e.showAtPosition){const o=cc(this._hover.containerDomNode);this._positionPreference=this._findPositionPreference(o,this._visibleData.showAtPosition)}this._layoutContentWidget()}focus(){this._hover.containerDomNode.focus()}scrollUp(){const e=this._hover.scrollbar.getScrollPosition().scrollTop,t=this._editor.getOption(50);this._hover.scrollbar.setScrollPosition({scrollTop:e-t.lineHeight})}scrollDown(){const e=this._hover.scrollbar.getScrollPosition().scrollTop,t=this._editor.getOption(50);this._hover.scrollbar.setScrollPosition({scrollTop:e+t.lineHeight})}scrollLeft(){const e=this._hover.scrollbar.getScrollPosition().scrollLeft;this._hover.scrollbar.setScrollPosition({scrollLeft:e-F7})}scrollRight(){const e=this._hover.scrollbar.getScrollPosition().scrollLeft;this._hover.scrollbar.setScrollPosition({scrollLeft:e+F7})}pageUp(){const e=this._hover.scrollbar.getScrollPosition().scrollTop,t=this._hover.scrollbar.getScrollDimensions().height;this._hover.scrollbar.setScrollPosition({scrollTop:e-t})}pageDown(){const e=this._hover.scrollbar.getScrollPosition().scrollTop,t=this._hover.scrollbar.getScrollDimensions().height;this._hover.scrollbar.setScrollPosition({scrollTop:e+t})}goToTop(){this._hover.scrollbar.setScrollPosition({scrollTop:0})}goToBottom(){this._hover.scrollbar.setScrollPosition({scrollTop:this._hover.scrollbar.getScrollDimensions().scrollHeight})}};M_.ID="editor.contrib.resizableContentHoverWidget";M_._lastDimensions=new Dt(0,0);M_=Tl=ake([ey(1,Be),ey(2,rt),ey(3,cr),ey(4,At)],M_);function O7(s,e,t,i,n,o){const r=t+n/2,a=i+o/2,l=Math.max(Math.abs(s-r)-n/2,0),d=Math.max(Math.abs(e-a)-o/2,0);return Math.sqrt(l*l+d*d)}let dke=class{constructor(e,t,i){this.value=e,this.isComplete=t,this.hasLoadingMessage=i}};class Lq extends V{constructor(e,t){super(),this._editor=e,this._computer=t,this._onResult=this._register(new B),this.onResult=this._onResult.event,this._firstWaitScheduler=this._register(new Ht(()=>this._triggerAsyncComputation(),0)),this._secondWaitScheduler=this._register(new Ht(()=>this._triggerSyncComputation(),0)),this._loadingMessageScheduler=this._register(new Ht(()=>this._triggerLoadingMessage(),0)),this._state=0,this._asyncIterable=null,this._asyncIterableDone=!1,this._result=[]}dispose(){this._asyncIterable&&(this._asyncIterable.cancel(),this._asyncIterable=null),super.dispose()}get _hoverTime(){return this._editor.getOption(60).delay}get _firstWaitTime(){return this._hoverTime/2}get _secondWaitTime(){return this._hoverTime-this._firstWaitTime}get _loadingMessageTime(){return 3*this._hoverTime}_setState(e,t=!0){this._state=e,t&&this._fireResult()}_triggerAsyncComputation(){this._setState(2),this._secondWaitScheduler.schedule(this._secondWaitTime),this._computer.computeAsync?(this._asyncIterableDone=!1,this._asyncIterable=wre(e=>this._computer.computeAsync(e)),(async()=>{try{for await(const e of this._asyncIterable)e&&(this._result.push(e),this._fireResult());this._asyncIterableDone=!0,(this._state===3||this._state===4)&&this._setState(0)}catch(e){Ge(e)}})()):this._asyncIterableDone=!0}_triggerSyncComputation(){this._computer.computeSync&&(this._result=this._result.concat(this._computer.computeSync())),this._setState(this._asyncIterableDone?0:3)}_triggerLoadingMessage(){this._state===3&&this._setState(4)}_fireResult(){if(this._state===1||this._state===2)return;const e=this._state===0,t=this._state===4;this._onResult.fire(new dke(this._result.slice(0),e,t))}start(e){if(e===0)this._state===0&&(this._setState(1),this._firstWaitScheduler.schedule(this._firstWaitTime),this._loadingMessageScheduler.schedule(this._loadingMessageTime));else switch(this._state){case 0:this._triggerAsyncComputation(),this._secondWaitScheduler.cancel(),this._triggerSyncComputation();break;case 2:this._secondWaitScheduler.cancel(),this._triggerSyncComputation();break}}cancel(){this._firstWaitScheduler.cancel(),this._secondWaitScheduler.cancel(),this._loadingMessageScheduler.cancel(),this._asyncIterable&&(this._asyncIterable.cancel(),this._asyncIterable=null),this._result=[],this._setState(0,!1)}}class sT{constructor(e,t,i,n){this.priority=e,this.range=t,this.initialMousePosX=i,this.initialMousePosY=n,this.type=1}equals(e){return e.type===1&&this.range.equalsRange(e.range)}canAdoptVisibleHover(e,t){return e.type===1&&t.lineNumber===this.range.startLineNumber}}class af{constructor(e,t,i,n,o,r){this.priority=e,this.owner=t,this.range=i,this.initialMousePosX=n,this.initialMousePosY=o,this.supportsMarkerHover=r,this.type=2}equals(e){return e.type===2&&this.owner===e.owner}canAdoptVisibleHover(e,t){return e.type===2&&this.owner===e.owner}}const tg=new class{constructor(){this._participants=[]}register(e){this._participants.push(e)}getAll(){return this._participants}};class cke{constructor(e,t,i){this.provider=e,this.hover=t,this.ordinal=i}}async function uke(s,e,t,i,n){const o=await Promise.resolve(s.provideHover(t,i,n)).catch(Ni);if(!(!o||!gke(o)))return new cke(s,o,e)}function v4(s,e,t,i){const o=s.ordered(e).map((r,a)=>uke(r,a,e,t,i));return Xi.fromPromises(o).coalesce()}function hke(s,e,t,i){return v4(s,e,t,i).map(n=>n.hover).toPromise()}Td("_executeHoverProvider",(s,e,t)=>{const i=s.get(be);return hke(i.hoverProvider,e,t,dt.None)});function gke(s){const e=typeof s.range<"u",t=typeof s.contents<"u"&&s.contents&&s.contents.length>0;return e&&t}var fke=function(s,e,t,i){var n=arguments.length,o=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,e,t,i);else for(var a=s.length-1;a>=0;a--)(r=s[a])&&(o=(n<3?r(o):n>3?r(e,t,o):r(e,t))||o);return n>3&&o&&Object.defineProperty(e,t,o),o},Tp=function(s,e){return function(t,i){e(t,i,s)}};const pm=he,pke=Li("hover-increase-verbosity",oe.add,p("increaseHoverVerbosity","Icon for increaseing hover verbosity.")),mke=Li("hover-decrease-verbosity",oe.remove,p("decreaseHoverVerbosity","Icon for decreasing hover verbosity."));class Ka{constructor(e,t,i,n,o,r=void 0){this.owner=e,this.range=t,this.contents=i,this.isBeforeContent=n,this.ordinal=o,this.source=r}isValidForHoverAnchor(e){return e.type===1&&this.range.startColumn<=e.range.startColumn&&this.range.endColumn>=e.range.endColumn}}class xq{constructor(e,t,i){this.hover=e,this.hoverProvider=t,this.hoverPosition=i}supportsVerbosityAction(e){var t,i;switch(e){case ja.Increase:return(t=this.hover.canIncreaseVerbosity)!==null&&t!==void 0?t:!1;case ja.Decrease:return(i=this.hover.canDecreaseVerbosity)!==null&&i!==void 0?i:!1}}}let IC=class{constructor(e,t,i,n,o,r,a){this._editor=e,this._languageService=t,this._openerService=i,this._configurationService=n,this._languageFeaturesService=o,this._keybindingService=r,this._hoverService=a,this.hoverOrdinal=3}createLoadingMessage(e){return new Ka(this,e.range,[new ss().appendText(p("modesContentHover.loading","Loading..."))],!1,2e3)}computeSync(e,t){if(!this._editor.hasModel()||e.type!==1)return[];const i=this._editor.getModel(),n=e.range.startLineNumber,o=i.getLineMaxColumn(n),r=[];let a=1e3;const l=i.getLineLength(n),d=i.getLanguageIdAtPosition(e.range.startLineNumber,e.range.startColumn),c=this._editor.getOption(117),u=this._configurationService.getValue("editor.maxTokenizationLineLength",{overrideIdentifier:d});let h=!1;c>=0&&l>c&&e.range.startColumn>=c&&(h=!0,r.push(new Ka(this,e.range,[{value:p("stopped rendering","Rendering paused for long line for performance reasons. This can be configured via `editor.stopRenderingLineAfter`.")}],!1,a++))),!h&&typeof u=="number"&&l>=u&&r.push(new Ka(this,e.range,[{value:p("too many characters","Tokenization is skipped for long lines for performance reasons. This can be configured via `editor.maxTokenizationLineLength`.")}],!1,a++));let g=!1;for(const f of t){const m=f.range.startLineNumber===n?f.range.startColumn:1,_=f.range.endLineNumber===n?f.range.endColumn:o,v=f.options.hoverMessage;if(!v||v_(v))continue;f.options.beforeContentClassName&&(g=!0);const b=new x(e.range.startLineNumber,m,e.range.startLineNumber,_);r.push(new Ka(this,b,RP(v),g,a++))}return r}computeAsync(e,t,i){if(!this._editor.hasModel()||e.type!==1)return Xi.EMPTY;const n=this._editor.getModel(),o=this._languageFeaturesService.hoverProvider;return o.has(n)?this._getMarkdownHovers(o,n,e,i):Xi.EMPTY}_getMarkdownHovers(e,t,i,n){const o=i.range.getStartPosition();return v4(e,t,o,n).filter(l=>!v_(l.hover.contents)).map(l=>{const d=l.hover.range?x.lift(l.hover.range):i.range,c=new xq(l.hover,l.provider,o);return new Ka(this,d,l.hover.contents,!1,l.ordinal,c)})}renderHoverParts(e,t){return this._renderedHoverParts=new _ke(t,e.fragment,this._editor,this._languageService,this._openerService,this._keybindingService,this._hoverService,this._configurationService,e.onContentsChanged),this._renderedHoverParts}updateFocusedMarkdownHoverPartVerbosityLevel(e){var t;(t=this._renderedHoverParts)===null||t===void 0||t.updateFocusedHoverPartVerbosityLevel(e)}};IC=fke([Tp(1,vi),Tp(2,Oo),Tp(3,rt),Tp(4,be),Tp(5,At),Tp(6,Nd)],IC);class _ke extends V{constructor(e,t,i,n,o,r,a,l,d){super(),this._editor=i,this._languageService=n,this._openerService=o,this._keybindingService=r,this._hoverService=a,this._configurationService=l,this._onFinishedRendering=d,this._hoverFocusInfo={hoverPartIndex:-1,focusRemains:!1},this._renderedHoverParts=this._renderHoverParts(e,t,this._onFinishedRendering),this._register(Ie(()=>{this._renderedHoverParts.forEach(c=>{c.disposables.dispose()})}))}_renderHoverParts(e,t,i){return e.sort(ro(n=>n.ordinal,ua)),e.map((n,o)=>{const r=this._renderHoverPart(o,n.contents,n.source,i);return t.appendChild(r.renderedMarkdown),r})}_renderHoverPart(e,t,i,n){const{renderedMarkdown:o,disposables:r}=this._renderMarkdownContent(t,n);if(!i)return{renderedMarkdown:o,disposables:r};const a=i.supportsVerbosityAction(ja.Increase),l=i.supportsVerbosityAction(ja.Decrease);if(!a&&!l)return{renderedMarkdown:o,disposables:r,hoverSource:i};const d=pm("div.verbosity-actions");o.prepend(d),r.add(this._renderHoverExpansionAction(d,ja.Increase,a)),r.add(this._renderHoverExpansionAction(d,ja.Decrease,l));const c=r.add(Ca(o));return r.add(c.onDidFocus(()=>{this._hoverFocusInfo={hoverPartIndex:e,focusRemains:!0}})),r.add(c.onDidBlur(()=>{var u;if(!((u=this._hoverFocusInfo)===null||u===void 0)&&u.focusRemains){this._hoverFocusInfo.focusRemains=!1;return}})),{renderedMarkdown:o,disposables:r,hoverSource:i}}_renderMarkdownContent(e,t){const i=pm("div.hover-row");i.tabIndex=0;const n=pm("div.hover-row-contents");i.appendChild(n);const o=new Y;return o.add(kq(this._editor,n,e,this._languageService,this._openerService,t)),{renderedMarkdown:i,disposables:o}}_renderHoverExpansionAction(e,t,i){const n=new Y,o=t===ja.Increase,r=Q(e,pm(Pe.asCSSSelector(o?pke:mke)));r.tabIndex=0;const a=new m_("mouse",!1,{target:e,position:{hoverPosition:0}},this._configurationService,this._hoverService);if(o){const d=this._keybindingService.lookupKeybinding(f4);n.add(this._hoverService.setupUpdatableHover(a,r,d?p("increaseVerbosityWithKb","Increase Verbosity ({0})",d.getLabel()):p("increaseVerbosity","Increase Verbosity")))}else{const d=this._keybindingService.lookupKeybinding(p4);n.add(this._hoverService.setupUpdatableHover(a,r,d?p("decreaseVerbosityWithKb","Decrease Verbosity ({0})",d.getLabel()):p("decreaseVerbosity","Decrease Verbosity")))}if(!i)return r.classList.add("disabled"),n;r.classList.add("enabled");const l=()=>this.updateFocusedHoverPartVerbosityLevel(t);return n.add(new V$(r,l)),n.add(new z$(r,l,[3,10])),n}async updateFocusedHoverPartVerbosityLevel(e){var t;const i=this._editor.getModel();if(!i)return;const n=this._hoverFocusInfo.hoverPartIndex,o=this._getRenderedHoverPartAtIndex(n);if(!o||!(!((t=o.hoverSource)===null||t===void 0)&&t.supportsVerbosityAction(e)))return;const r=o.hoverSource.hoverPosition,a=o.hoverSource.hoverProvider,l=o.hoverSource.hover,d={verbosityRequest:{action:e,previousHover:l}};let c;try{c=await Promise.resolve(a.provideHover(i,r,dt.None,d))}catch(g){Ni(g)}if(!c)return;const u=new xq(c,a,r),h=this._renderHoverPart(n,c.contents,u,this._onFinishedRendering);this._replaceRenderedHoverPartAtIndex(n,h),this._focusOnHoverPartWithIndex(n),this._onFinishedRendering()}_replaceRenderedHoverPartAtIndex(e,t){if(e>=this._renderHoverParts.length||e<0)return;const i=this._renderedHoverParts[e];i.renderedMarkdown.replaceWith(t.renderedMarkdown),i.disposables.dispose(),this._renderedHoverParts[e]=t}_focusOnHoverPartWithIndex(e){this._renderedHoverParts[e].renderedMarkdown.focus(),this._hoverFocusInfo.focusRemains=!0}_getRenderedHoverPartAtIndex(e){return this._renderedHoverParts[e]}}function vke(s,e,t,i,n){e.sort(ro(r=>r.ordinal,ua));const o=new Y;for(const r of e)o.add(kq(t,s.fragment,r.contents,i,n,s.onContentsChanged));return o}function kq(s,e,t,i,n,o){const r=new Y;for(const a of t){if(v_(a))continue;const l=pm("div.markdown-hover"),d=Q(l,pm("div.hover-contents")),c=r.add(new Cd({editor:s},i,n));r.add(c.onDidRenderAsync(()=>{d.className="hover-contents code-hover-contents",o()}));const u=r.add(c.render(a));d.appendChild(u.element),e.appendChild(l)}return r}function zM(s,e){return!!s[e]}class oT{constructor(e,t){this.target=e.target,this.isLeftClick=e.event.leftButton,this.isMiddleClick=e.event.middleButton,this.isRightClick=e.event.rightButton,this.hasTriggerModifier=zM(e.event,t.triggerModifier),this.hasSideBySideModifier=zM(e.event,t.triggerSideBySideModifier),this.isNoneOrSingleMouseDown=e.event.detail<=1}}class B7{constructor(e,t){this.keyCodeIsTriggerKey=e.keyCode===t.triggerKey,this.keyCodeIsSideBySideKey=e.keyCode===t.triggerSideBySideKey,this.hasTriggerModifier=zM(e,t.triggerModifier)}}class ty{constructor(e,t,i,n){this.triggerKey=e,this.triggerModifier=t,this.triggerSideBySideKey=i,this.triggerSideBySideModifier=n}equals(e){return this.triggerKey===e.triggerKey&&this.triggerModifier===e.triggerModifier&&this.triggerSideBySideKey===e.triggerSideBySideKey&&this.triggerSideBySideModifier===e.triggerSideBySideModifier}}function W7(s){return s==="altKey"?lt?new ty(57,"metaKey",6,"altKey"):new ty(5,"ctrlKey",6,"altKey"):lt?new ty(6,"altKey",57,"metaKey"):new ty(6,"altKey",5,"ctrlKey")}class _k extends V{constructor(e,t){var i;super(),this._onMouseMoveOrRelevantKeyDown=this._register(new B),this.onMouseMoveOrRelevantKeyDown=this._onMouseMoveOrRelevantKeyDown.event,this._onExecute=this._register(new B),this.onExecute=this._onExecute.event,this._onCancel=this._register(new B),this.onCancel=this._onCancel.event,this._editor=e,this._extractLineNumberFromMouseEvent=(i=t==null?void 0:t.extractLineNumberFromMouseEvent)!==null&&i!==void 0?i:n=>n.target.position?n.target.position.lineNumber:0,this._opts=W7(this._editor.getOption(78)),this._lastMouseMoveEvent=null,this._hasTriggerKeyOnMouseDown=!1,this._lineNumberOnMouseDown=0,this._register(this._editor.onDidChangeConfiguration(n=>{if(n.hasChanged(78)){const o=W7(this._editor.getOption(78));if(this._opts.equals(o))return;this._opts=o,this._lastMouseMoveEvent=null,this._hasTriggerKeyOnMouseDown=!1,this._lineNumberOnMouseDown=0,this._onCancel.fire()}})),this._register(this._editor.onMouseMove(n=>this._onEditorMouseMove(new oT(n,this._opts)))),this._register(this._editor.onMouseDown(n=>this._onEditorMouseDown(new oT(n,this._opts)))),this._register(this._editor.onMouseUp(n=>this._onEditorMouseUp(new oT(n,this._opts)))),this._register(this._editor.onKeyDown(n=>this._onEditorKeyDown(new B7(n,this._opts)))),this._register(this._editor.onKeyUp(n=>this._onEditorKeyUp(new B7(n,this._opts)))),this._register(this._editor.onMouseDrag(()=>this._resetHandler())),this._register(this._editor.onDidChangeCursorSelection(n=>this._onDidChangeCursorSelection(n))),this._register(this._editor.onDidChangeModel(n=>this._resetHandler())),this._register(this._editor.onDidChangeModelContent(()=>this._resetHandler())),this._register(this._editor.onDidScrollChange(n=>{(n.scrollTopChanged||n.scrollLeftChanged)&&this._resetHandler()}))}_onDidChangeCursorSelection(e){e.selection&&e.selection.startColumn!==e.selection.endColumn&&this._resetHandler()}_onEditorMouseMove(e){this._lastMouseMoveEvent=e,this._onMouseMoveOrRelevantKeyDown.fire([e,null])}_onEditorMouseDown(e){this._hasTriggerKeyOnMouseDown=e.hasTriggerModifier,this._lineNumberOnMouseDown=this._extractLineNumberFromMouseEvent(e)}_onEditorMouseUp(e){const t=this._extractLineNumberFromMouseEvent(e);this._hasTriggerKeyOnMouseDown&&this._lineNumberOnMouseDown&&this._lineNumberOnMouseDown===t&&this._onExecute.fire(e)}_onEditorKeyDown(e){this._lastMouseMoveEvent&&(e.keyCodeIsTriggerKey||e.keyCodeIsSideBySideKey&&e.hasTriggerModifier)?this._onMouseMoveOrRelevantKeyDown.fire([this._lastMouseMoveEvent,e]):e.hasTriggerModifier&&this._onCancel.fire()}_onEditorKeyUp(e){e.keyCodeIsTriggerKey&&this._onCancel.fire()}_resetHandler(){this._lastMouseMoveEvent=null,this._hasTriggerKeyOnMouseDown=!1,this._onCancel.fire()}}class Eq{constructor(e,t){this.range=e,this.direction=t}}class b4{constructor(e,t,i){this.hint=e,this.anchor=t,this.provider=i,this._isResolved=!1}with(e){const t=new b4(this.hint,e.anchor,this.provider);return t._isResolved=this._isResolved,t._currentResolve=this._currentResolve,t}async resolve(e){if(typeof this.provider.resolveInlayHint=="function"){if(this._currentResolve)return await this._currentResolve,e.isCancellationRequested?void 0:this.resolve(e);this._isResolved||(this._currentResolve=this._doResolve(e).finally(()=>this._currentResolve=void 0)),await this._currentResolve}}async _doResolve(e){var t,i,n;try{const o=await Promise.resolve(this.provider.resolveInlayHint(this.hint,e));this.hint.tooltip=(t=o==null?void 0:o.tooltip)!==null&&t!==void 0?t:this.hint.tooltip,this.hint.label=(i=o==null?void 0:o.label)!==null&&i!==void 0?i:this.hint.label,this.hint.textEdits=(n=o==null?void 0:o.textEdits)!==null&&n!==void 0?n:this.hint.textEdits,this._isResolved=!0}catch(o){Ni(o),this._isResolved=!1}}}class lf{static async create(e,t,i,n){const o=[],r=e.ordered(t).reverse().map(a=>i.map(async l=>{try{const d=await a.provideInlayHints(t,l,n);(d!=null&&d.hints.length||a.onDidChangeInlayHints)&&o.push([d??lf._emptyInlayHintList,a])}catch(d){Ni(d)}}));if(await Promise.all(r.flat()),n.isCancellationRequested||t.isDisposed())throw new sl;return new lf(i,o,t)}constructor(e,t,i){this._disposables=new Y,this.ranges=e,this.provider=new Set;const n=[];for(const[o,r]of t){this._disposables.add(o),this.provider.add(r);for(const a of o.hints){const l=i.validatePosition(a.position);let d="before";const c=lf._getRangeAtPosition(i,l);let u;c.getStartPosition().isBefore(l)?(u=x.fromPositions(c.getStartPosition(),l),d="after"):(u=x.fromPositions(l,c.getEndPosition()),d="before"),n.push(new b4(a,new Eq(u,d),r))}}this.items=n.sort((o,r)=>W.compare(o.hint.position,r.hint.position))}dispose(){this._disposables.dispose()}static _getRangeAtPosition(e,t){const i=t.lineNumber,n=e.getWordAtPosition(t);if(n)return new x(i,n.startColumn,i,n.endColumn);e.tokenization.tokenizeIfCheap(i);const o=e.tokenization.getLineTokens(i),r=t.column-1,a=o.findTokenIndexAtOffset(r);let l=o.getStartOffset(a),d=o.getEndOffset(a);return d-l===1&&(l===r&&a>1?(l=o.getStartOffset(a-1),d=o.getEndOffset(a-1)):d===r&&a=0;a--)(r=s[a])&&(o=(n<3?r(o):n>3?r(e,t,o):r(e,t))||o);return n>3&&o&&Object.defineProperty(e,t,o),o},Vd=function(s,e){return function(t,i){e(t,i,s)}};let Ph=class extends p_{constructor(e,t,i,n,o,r,a,l,d,c,u,h,g){super(e,{...n.getRawOptions(),overflowWidgetsDomNode:n.getOverflowWidgetsDomNode()},i,o,r,a,l,d,c,u,h,g),this._parentEditor=n,this._overwriteOptions=t,super.updateOptions(this._overwriteOptions),this._register(n.onDidChangeConfiguration(f=>this._onParentConfigurationChanged(f)))}getParentEditor(){return this._parentEditor}_onParentConfigurationChanged(e){super.updateOptions(this._parentEditor.getRawOptions()),super.updateOptions(this._overwriteOptions)}updateOptions(e){UL(this._overwriteOptions,e,!0),super.updateOptions(this._overwriteOptions)}};Ph=Cke([Vd(4,Ne),Vd(5,xt),Vd(6,ui),Vd(7,Be),Vd(8,_n),Vd(9,en),Vd(10,cr),Vd(11,Yt),Vd(12,be)],Ph);const H7=new $(new bt(0,122,204)),wke={showArrow:!0,showFrame:!0,className:"",frameColor:H7,arrowColor:H7,keepEditorSelection:!1},yke="vs.editor.contrib.zoneWidget";class Ske{constructor(e,t,i,n,o,r,a,l){this.id="",this.domNode=e,this.afterLineNumber=t,this.afterColumn=i,this.heightInLines=n,this.showInHiddenAreas=a,this.ordinal=l,this._onDomNodeTop=o,this._onComputedHeight=r}onDomNodeTop(e){this._onDomNodeTop(e)}onComputedHeight(e){this._onComputedHeight(e)}}class Dke{constructor(e,t){this._id=e,this._domNode=t}getId(){return this._id}getDomNode(){return this._domNode}getPosition(){return null}}class vk{constructor(e){this._editor=e,this._ruleName=vk._IdGenerator.nextId(),this._decorations=this._editor.createDecorationsCollection(),this._color=null,this._height=-1}dispose(){this.hide(),tA(this._ruleName)}set color(e){this._color!==e&&(this._color=e,this._updateStyle())}set height(e){this._height!==e&&(this._height=e,this._updateStyle())}_updateStyle(){tA(this._ruleName),zS(`.monaco-editor ${this._ruleName}`,`border-style: solid; border-color: transparent; border-bottom-color: ${this._color}; border-width: ${this._height}px; bottom: -${this._height}px !important; margin-left: -${this._height}px; `)}show(e){e.column===1&&(e={lineNumber:e.lineNumber,column:2}),this._decorations.set([{range:x.fromPositions(e),options:{description:"zone-widget-arrow",className:this._ruleName,stickiness:1}}])}hide(){this._decorations.clear()}}vk._IdGenerator=new mO(".arrow-decoration-");class Lke{constructor(e,t={}){this._arrow=null,this._overlayWidget=null,this._resizeSash=null,this._viewZone=null,this._disposables=new Y,this.container=null,this._isShowing=!1,this.editor=e,this._positionMarkerId=this.editor.createDecorationsCollection(),this.options=Yd(t),UL(this.options,wke,!1),this.domNode=document.createElement("div"),this.options.isAccessible||(this.domNode.setAttribute("aria-hidden","true"),this.domNode.setAttribute("role","presentation")),this._disposables.add(this.editor.onDidLayoutChange(i=>{const n=this._getWidth(i);this.domNode.style.width=n+"px",this.domNode.style.left=this._getLeft(i)+"px",this._onWidth(n)}))}dispose(){this._overlayWidget&&(this.editor.removeOverlayWidget(this._overlayWidget),this._overlayWidget=null),this._viewZone&&this.editor.changeViewZones(e=>{this._viewZone&&e.removeZone(this._viewZone.id),this._viewZone=null}),this._positionMarkerId.clear(),this._disposables.dispose()}create(){this.domNode.classList.add("zone-widget"),this.options.className&&this.domNode.classList.add(this.options.className),this.container=document.createElement("div"),this.container.classList.add("zone-widget-container"),this.domNode.appendChild(this.container),this.options.showArrow&&(this._arrow=new vk(this.editor),this._disposables.add(this._arrow)),this._fillContainer(this.container),this._initSash(),this._applyStyles()}style(e){e.frameColor&&(this.options.frameColor=e.frameColor),e.arrowColor&&(this.options.arrowColor=e.arrowColor),this._applyStyles()}_applyStyles(){if(this.container&&this.options.frameColor){const e=this.options.frameColor.toString();this.container.style.borderTopColor=e,this.container.style.borderBottomColor=e}if(this._arrow&&this.options.arrowColor){const e=this.options.arrowColor.toString();this._arrow.color=e}}_getWidth(e){return e.width-e.minimap.minimapWidth-e.verticalScrollbarWidth}_getLeft(e){return e.minimap.minimapWidth>0&&e.minimap.minimapLeft===0?e.minimap.minimapWidth:0}_onViewZoneTop(e){this.domNode.style.top=e+"px"}_onViewZoneHeight(e){var t;if(this.domNode.style.height=`${e}px`,this.container){const i=e-this._decoratingElementsHeight();this.container.style.height=`${i}px`;const n=this.editor.getLayoutInfo();this._doLayout(i,this._getWidth(n))}(t=this._resizeSash)===null||t===void 0||t.layout()}get position(){const e=this._positionMarkerId.getRange(0);if(e)return e.getStartPosition()}show(e,t){const i=x.isIRange(e)?x.lift(e):x.fromPositions(e);this._isShowing=!0,this._showImpl(i,t),this._isShowing=!1,this._positionMarkerId.set([{range:i,options:Xe.EMPTY}])}hide(){var e;this._viewZone&&(this.editor.changeViewZones(t=>{this._viewZone&&t.removeZone(this._viewZone.id)}),this._viewZone=null),this._overlayWidget&&(this.editor.removeOverlayWidget(this._overlayWidget),this._overlayWidget=null),(e=this._arrow)===null||e===void 0||e.hide(),this._positionMarkerId.clear()}_decoratingElementsHeight(){const e=this.editor.getOption(67);let t=0;if(this.options.showArrow){const i=Math.round(e/3);t+=2*i}if(this.options.showFrame){const i=Math.round(e/9);t+=2*i}return t}_showImpl(e,t){const i=e.getStartPosition(),n=this.editor.getLayoutInfo(),o=this._getWidth(n);this.domNode.style.width=`${o}px`,this.domNode.style.left=this._getLeft(n)+"px";const r=document.createElement("div");r.style.overflow="hidden";const a=this.editor.getOption(67);if(!this.options.allowUnlimitedHeight){const h=Math.max(12,this.editor.getLayoutInfo().height/a*.8);t=Math.min(t,h)}let l=0,d=0;if(this._arrow&&this.options.showArrow&&(l=Math.round(a/3),this._arrow.height=l,this._arrow.show(i)),this.options.showFrame&&(d=Math.round(a/9)),this.editor.changeViewZones(h=>{this._viewZone&&h.removeZone(this._viewZone.id),this._overlayWidget&&(this.editor.removeOverlayWidget(this._overlayWidget),this._overlayWidget=null),this.domNode.style.top="-1000px",this._viewZone=new Ske(r,i.lineNumber,i.column,t,g=>this._onViewZoneTop(g),g=>this._onViewZoneHeight(g),this.options.showInHiddenAreas,this.options.ordinal),this._viewZone.id=h.addZone(this._viewZone),this._overlayWidget=new Dke(yke+this._viewZone.id,this.domNode),this.editor.addOverlayWidget(this._overlayWidget)}),this.container&&this.options.showFrame){const h=this.options.frameWidth?this.options.frameWidth:d;this.container.style.borderTopWidth=h+"px",this.container.style.borderBottomWidth=h+"px"}const c=t*a-this._decoratingElementsHeight();this.container&&(this.container.style.top=l+"px",this.container.style.height=c+"px",this.container.style.overflow="hidden"),this._doLayout(c,o),this.options.keepEditorSelection||this.editor.setSelection(e);const u=this.editor.getModel();if(u){const h=u.validateRange(new x(e.startLineNumber,1,e.endLineNumber+1,1));this.revealRange(h,h.startLineNumber===u.getLineCount())}}revealRange(e,t){t?this.editor.revealLineNearTop(e.endLineNumber,0):this.editor.revealRange(e,0)}setCssClass(e,t){this.container&&(t&&this.container.classList.remove(t),this.container.classList.add(e))}_onWidth(e){}_doLayout(e,t){}_relayout(e){this._viewZone&&this._viewZone.heightInLines!==e&&this.editor.changeViewZones(t=>{this._viewZone&&(this._viewZone.heightInLines=e,t.layoutZone(this._viewZone.id))})}_initSash(){if(this._resizeSash)return;this._resizeSash=this._disposables.add(new is(this.domNode,this,{orientation:1})),this.options.isResizeable||(this._resizeSash.state=0);let e;this._disposables.add(this._resizeSash.onDidStart(t=>{this._viewZone&&(e={startY:t.startY,heightInLines:this._viewZone.heightInLines})})),this._disposables.add(this._resizeSash.onDidEnd(()=>{e=void 0})),this._disposables.add(this._resizeSash.onDidChange(t=>{if(e){const i=(t.currentY-e.startY)/this.editor.getOption(67),n=i<0?Math.ceil(i):Math.floor(i),o=e.heightInLines+n;o>5&&o<35&&this._relayout(o)}}))}getHorizontalSashLeft(){return 0}getHorizontalSashTop(){return(this.domNode.style.height===null?0:parseInt(this.domNode.style.height))-this._decoratingElementsHeight()/2}getHorizontalSashWidth(){const e=this.editor.getLayoutInfo();return e.width-e.minimap.minimapWidth}}var Iq=function(s,e,t,i){var n=arguments.length,o=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,e,t,i);else for(var a=s.length-1;a>=0;a--)(r=s[a])&&(o=(n<3?r(o):n>3?r(e,t,o):r(e,t))||o);return n>3&&o&&Object.defineProperty(e,t,o),o},Tq=function(s,e){return function(t,i){e(t,i,s)}};const Nq=ut("IPeekViewService");mt(Nq,class{constructor(){this._widgets=new Map}addExclusiveWidget(s,e){const t=this._widgets.get(s);t&&(t.listener.dispose(),t.widget.dispose());const i=()=>{const n=this._widgets.get(s);n&&n.widget===e&&(n.listener.dispose(),this._widgets.delete(s))};this._widgets.set(s,{widget:e,listener:e.onDidClose(i)})}},1);var fo;(function(s){s.inPeekEditor=new ue("inReferenceSearchEditor",!0,p("inReferenceSearchEditor","Whether the current code editor is embedded inside peek")),s.notInPeekEditor=s.inPeekEditor.toNegated()})(fo||(fo={}));let TC=class{constructor(e,t){e instanceof Ph&&fo.inPeekEditor.bindTo(t)}dispose(){}};TC.ID="editor.contrib.referenceController";TC=Iq([Tq(1,Be)],TC);kt(TC.ID,TC,0);function xke(s){const e=s.get(xt).getFocusedCodeEditor();return e instanceof Ph?e.getParentEditor():e}const kke={headerBackgroundColor:$.white,primaryHeadingColor:$.fromHex("#333333"),secondaryHeadingColor:$.fromHex("#6c6c6cb3")};let uL=class extends Lke{constructor(e,t,i){super(e,t),this.instantiationService=i,this._onDidClose=new B,this.onDidClose=this._onDidClose.event,UL(this.options,kke,!1)}dispose(){this.disposed||(this.disposed=!0,super.dispose(),this._onDidClose.fire(this))}style(e){const t=this.options;e.headerBackgroundColor&&(t.headerBackgroundColor=e.headerBackgroundColor),e.primaryHeadingColor&&(t.primaryHeadingColor=e.primaryHeadingColor),e.secondaryHeadingColor&&(t.secondaryHeadingColor=e.secondaryHeadingColor),super.style(e)}_applyStyles(){super._applyStyles();const e=this.options;this._headElement&&e.headerBackgroundColor&&(this._headElement.style.backgroundColor=e.headerBackgroundColor.toString()),this._primaryHeading&&e.primaryHeadingColor&&(this._primaryHeading.style.color=e.primaryHeadingColor.toString()),this._secondaryHeading&&e.secondaryHeadingColor&&(this._secondaryHeading.style.color=e.secondaryHeadingColor.toString()),this._bodyElement&&e.frameColor&&(this._bodyElement.style.borderColor=e.frameColor.toString())}_fillContainer(e){this.setCssClass("peekview-widget"),this._headElement=he(".head"),this._bodyElement=he(".body"),this._fillHead(this._headElement),this._fillBody(this._bodyElement),e.appendChild(this._headElement),e.appendChild(this._bodyElement)}_fillHead(e,t){this._titleElement=he(".peekview-title"),this.options.supportOnTitleClick&&(this._titleElement.classList.add("clickable"),Ti(this._titleElement,"click",o=>this._onTitleClick(o))),Q(this._headElement,this._titleElement),this._fillTitleIcon(this._titleElement),this._primaryHeading=he("span.filename"),this._secondaryHeading=he("span.dirname"),this._metaHeading=he("span.meta"),Q(this._titleElement,this._primaryHeading,this._secondaryHeading,this._metaHeading);const i=he(".peekview-actions");Q(this._headElement,i);const n=this._getActionBarOptions();this._actionbarWidget=new Hr(i,n),this._disposables.add(this._actionbarWidget),t||this._actionbarWidget.push(new ko("peekview.close",p("label.close","Close"),Pe.asClassName(oe.close),!0,()=>(this.dispose(),Promise.resolve())),{label:!1,icon:!0})}_fillTitleIcon(e){}_getActionBarOptions(){return{actionViewItemProvider:Cj.bind(void 0,this.instantiationService),orientation:0}}_onTitleClick(e){}setTitle(e,t){this._primaryHeading&&this._secondaryHeading&&(this._primaryHeading.innerText=e,this._primaryHeading.setAttribute("title",e),t?this._secondaryHeading.innerText=t:zn(this._secondaryHeading))}setMetaTitle(e){this._metaHeading&&(e?(this._metaHeading.innerText=e,So(this._metaHeading)):Es(this._metaHeading))}_doLayout(e,t){if(!this._isShowing&&e<0){this.dispose();return}const i=Math.ceil(this.editor.getOption(67)*1.2),n=Math.round(e-(i+2));this._doLayoutHead(i,t),this._doLayoutBody(n,t)}_doLayoutHead(e,t){this._headElement&&(this._headElement.style.height=`${e}px`,this._headElement.style.lineHeight=this._headElement.style.height)}_doLayoutBody(e,t){this._bodyElement&&(this._bodyElement.style.height=`${e}px`)}};uL=Iq([Tq(2,Ne)],uL);const Eke=N("peekViewTitle.background",{dark:"#252526",light:"#F3F3F3",hcDark:$.black,hcLight:$.white},p("peekViewTitleBackground","Background color of the peek view title area.")),Aq=N("peekViewTitleLabel.foreground",{dark:$.white,light:$.black,hcDark:$.white,hcLight:Er},p("peekViewTitleForeground","Color of the peek view title.")),Mq=N("peekViewTitleDescription.foreground",{dark:"#ccccccb3",light:"#616161",hcDark:"#FFFFFF99",hcLight:"#292929"},p("peekViewTitleInfoForeground","Color of the peek view title info.")),Ike=N("peekView.border",{dark:oo,light:oo,hcDark:gt,hcLight:gt},p("peekViewBorder","Color of the peek view borders and arrow.")),Tke=N("peekViewResult.background",{dark:"#252526",light:"#F3F3F3",hcDark:$.black,hcLight:$.white},p("peekViewResultsBackground","Background color of the peek view result list."));N("peekViewResult.lineForeground",{dark:"#bbbbbb",light:"#646465",hcDark:$.white,hcLight:Er},p("peekViewResultsMatchForeground","Foreground color for line nodes in the peek view result list."));N("peekViewResult.fileForeground",{dark:$.white,light:"#1E1E1E",hcDark:$.white,hcLight:Er},p("peekViewResultsFileForeground","Foreground color for file nodes in the peek view result list."));N("peekViewResult.selectionBackground",{dark:"#3399ff33",light:"#3399ff33",hcDark:null,hcLight:null},p("peekViewResultsSelectionBackground","Background color of the selected entry in the peek view result list."));N("peekViewResult.selectionForeground",{dark:$.white,light:"#6C6C6C",hcDark:$.white,hcLight:Er},p("peekViewResultsSelectionForeground","Foreground color of the selected entry in the peek view result list."));const Ku=N("peekViewEditor.background",{dark:"#001F33",light:"#F2F8FC",hcDark:$.black,hcLight:$.white},p("peekViewEditorBackground","Background color of the peek view editor."));N("peekViewEditorGutter.background",{dark:Ku,light:Ku,hcDark:Ku,hcLight:Ku},p("peekViewEditorGutterBackground","Background color of the gutter in the peek view editor."));N("peekViewEditorStickyScroll.background",{dark:Ku,light:Ku,hcDark:Ku,hcLight:Ku},p("peekViewEditorStickScrollBackground","Background color of sticky scroll in the peek view editor."));N("peekViewResult.matchHighlightBackground",{dark:"#ea5c004d",light:"#ea5c004d",hcDark:null,hcLight:null},p("peekViewResultsMatchHighlight","Match highlight color in the peek view result list."));N("peekViewEditor.matchHighlightBackground",{dark:"#ff8f0099",light:"#f5d802de",hcDark:null,hcLight:null},p("peekViewEditorMatchHighlight","Match highlight color in the peek view editor."));N("peekViewEditor.matchHighlightBorder",{dark:null,light:null,hcDark:li,hcLight:li},p("peekViewEditorMatchHighlightBorder","Match highlight border in the peek view editor."));class Fh{constructor(e,t,i,n){this.isProviderFirst=e,this.parent=t,this.link=i,this._rangeCallback=n,this.id=r2.nextId()}get uri(){return this.link.uri}get range(){var e,t;return(t=(e=this._range)!==null&&e!==void 0?e:this.link.targetSelectionRange)!==null&&t!==void 0?t:this.link.range}set range(e){this._range=e,this._rangeCallback(this)}get ariaMessage(){var e;const t=(e=this.parent.getPreview(this))===null||e===void 0?void 0:e.preview(this.range);return t?p({key:"aria.oneReference.preview",comment:["Placeholders are: 0: filename, 1:line number, 2: column number, 3: preview snippet of source code"]},"{0} in {1} on line {2} at column {3}",t.value,Br(this.uri),this.range.startLineNumber,this.range.startColumn):p("aria.oneReference","in {0} on line {1} at column {2}",Br(this.uri),this.range.startLineNumber,this.range.startColumn)}}class Nke{constructor(e){this._modelReference=e}dispose(){this._modelReference.dispose()}preview(e,t=8){const i=this._modelReference.object.textEditorModel;if(!i)return;const{startLineNumber:n,startColumn:o,endLineNumber:r,endColumn:a}=e,l=i.getWordUntilPosition({lineNumber:n,column:o-t}),d=new x(n,l.startColumn,n,o),c=new x(r,a,r,1073741824),u=i.getValueInRange(d).replace(/^\s+/,""),h=i.getValueInRange(e),g=i.getValueInRange(c).replace(/\s+$/,"");return{value:u+h+g,highlight:{start:u.length,end:u.length+h.length}}}}class NC{constructor(e,t){this.parent=e,this.uri=t,this.children=[],this._previews=new Bi}dispose(){jt(this._previews.values()),this._previews.clear()}getPreview(e){return this._previews.get(e.uri)}get ariaMessage(){const e=this.children.length;return e===1?p("aria.fileReferences.1","1 symbol in {0}, full path {1}",Br(this.uri),this.uri.fsPath):p("aria.fileReferences.N","{0} symbols in {1}, full path {2}",e,Br(this.uri),this.uri.fsPath)}async resolve(e){if(this._previews.size!==0)return this;for(const t of this.children)if(!this._previews.has(t.uri))try{const i=await e.createModelReference(t.uri);this._previews.set(t.uri,new Nke(i))}catch(i){Ge(i)}return this}}class Io{constructor(e,t){this.groups=[],this.references=[],this._onDidChangeReferenceRange=new B,this.onDidChangeReferenceRange=this._onDidChangeReferenceRange.event,this._links=e,this._title=t;const[i]=e;e.sort(Io._compareReferences);let n;for(const o of e)if((!n||!di.isEqual(n.uri,o.uri,!0))&&(n=new NC(this,o.uri),this.groups.push(n)),n.children.length===0||Io._compareReferences(o,n.children[n.children.length-1])!==0){const r=new Fh(i===o,n,o,a=>this._onDidChangeReferenceRange.fire(a));this.references.push(r),n.children.push(r)}}dispose(){jt(this.groups),this._onDidChangeReferenceRange.dispose(),this.groups.length=0}clone(){return new Io(this._links,this._title)}get title(){return this._title}get isEmpty(){return this.groups.length===0}get ariaMessage(){return this.isEmpty?p("aria.result.0","No results found"):this.references.length===1?p("aria.result.1","Found 1 symbol in {0}",this.references[0].uri.fsPath):this.groups.length===1?p("aria.result.n1","Found {0} symbols in {1}",this.references.length,this.groups[0].uri.fsPath):p("aria.result.nm","Found {0} symbols in {1} files",this.references.length,this.groups.length)}nextOrPreviousReference(e,t){const{parent:i}=e;let n=i.children.indexOf(e);const o=i.children.length,r=i.parent.groups.length;return r===1||t&&n+10?(t?n=(n+1)%o:n=(n+o-1)%o,i.children[n]):(n=i.parent.groups.indexOf(i),t?(n=(n+1)%r,i.parent.groups[n].children[0]):(n=(n+r-1)%r,i.parent.groups[n].children[i.parent.groups[n].children.length-1]))}nearestReference(e,t){const i=this.references.map((n,o)=>({idx:o,prefixLen:mh(n.uri.toString(),e.toString()),offsetDist:Math.abs(n.range.startLineNumber-t.lineNumber)*100+Math.abs(n.range.startColumn-t.column)})).sort((n,o)=>n.prefixLen>o.prefixLen?-1:n.prefixLeno.offsetDist?1:0)[0];if(i)return this.references[i.idx]}referenceAt(e,t){for(const i of this.references)if(i.uri.toString()===e.toString()&&x.containsPosition(i.range,t))return i}firstReference(){for(const e of this.references)if(e.isProviderFirst)return e;return this.references[0]}static _compareReferences(e,t){return di.compare(e.uri,t.uri)||x.compareRangesUsingStarts(e.range,t.range)}}var bk=function(s,e,t,i){var n=arguments.length,o=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,e,t,i);else for(var a=s.length-1;a>=0;a--)(r=s[a])&&(o=(n<3?r(o):n>3?r(e,t,o):r(e,t))||o);return n>3&&o&&Object.defineProperty(e,t,o),o},Ck=function(s,e){return function(t,i){e(t,i,s)}},UM;let $M=class{constructor(e){this._resolverService=e}hasChildren(e){return e instanceof Io||e instanceof NC}getChildren(e){if(e instanceof Io)return e.groups;if(e instanceof NC)return e.resolve(this._resolverService).then(t=>t.children);throw new Error("bad tree")}};$M=bk([Ck(0,po)],$M);class Ake{getHeight(){return 23}getTemplateId(e){return e instanceof NC?AC.id:H1.id}}let jM=class{constructor(e){this._keybindingService=e}getKeyboardNavigationLabel(e){var t;if(e instanceof Fh){const i=(t=e.parent.getPreview(e))===null||t===void 0?void 0:t.preview(e.range);if(i)return i.value}return Br(e.uri)}};jM=bk([Ck(0,At)],jM);class Mke{getId(e){return e instanceof Fh?e.id:e.uri}}let KM=class extends V{constructor(e,t){super(),this._labelService=t;const i=document.createElement("div");i.classList.add("reference-file"),this.file=this._register(new UD(i,{supportHighlights:!0})),this.badge=new z2(Q(i,he(".count")),{},vj),e.appendChild(i)}set(e,t){const i=Nx(e.uri);this.file.setLabel(this._labelService.getUriBasenameLabel(e.uri),this._labelService.getUriLabel(i,{relative:!0}),{title:this._labelService.getUriLabel(e.uri),matches:t});const n=e.children.length;this.badge.setCount(n),n>1?this.badge.setTitleFormat(p("referencesCount","{0} references",n)):this.badge.setTitleFormat(p("referenceCount","{0} reference",n))}};KM=bk([Ck(1,C_)],KM);let AC=UM=class{constructor(e){this._instantiationService=e,this.templateId=UM.id}renderTemplate(e){return this._instantiationService.createInstance(KM,e)}renderElement(e,t,i){i.set(e.element,Ox(e.filterData))}disposeTemplate(e){e.dispose()}};AC.id="FileReferencesRenderer";AC=UM=bk([Ck(0,Ne)],AC);class Rke extends V{constructor(e){super(),this.label=this._register(new rh(e))}set(e,t){var i;const n=(i=e.parent.getPreview(e))===null||i===void 0?void 0:i.preview(e.range);if(!n||!n.value)this.label.set(`${Br(e.uri)}:${e.range.startLineNumber+1}:${e.range.startColumn+1}`);else{const{value:o,highlight:r}=n;t&&!tl.isDefault(t)?(this.label.element.classList.toggle("referenceMatch",!1),this.label.set(o,Ox(t))):(this.label.element.classList.toggle("referenceMatch",!0),this.label.set(o,[r]))}}}class H1{constructor(){this.templateId=H1.id}renderTemplate(e){return new Rke(e)}renderElement(e,t,i){i.set(e.element,e.filterData)}disposeTemplate(e){e.dispose()}}H1.id="OneReferenceRenderer";class Pke{getWidgetAriaLabel(){return p("treeAriaLabel","References")}getAriaLabel(e){return e.ariaMessage}}var Fke=function(s,e,t,i){var n=arguments.length,o=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,e,t,i);else for(var a=s.length-1;a>=0;a--)(r=s[a])&&(o=(n<3?r(o):n>3?r(e,t,o):r(e,t))||o);return n>3&&o&&Object.defineProperty(e,t,o),o},zd=function(s,e){return function(t,i){e(t,i,s)}};class wk{constructor(e,t){this._editor=e,this._model=t,this._decorations=new Map,this._decorationIgnoreSet=new Set,this._callOnDispose=new Y,this._callOnModelChange=new Y,this._callOnDispose.add(this._editor.onDidChangeModel(()=>this._onModelChanged())),this._onModelChanged()}dispose(){this._callOnModelChange.dispose(),this._callOnDispose.dispose(),this.removeDecorations()}_onModelChanged(){this._callOnModelChange.clear();const e=this._editor.getModel();if(e){for(const t of this._model.references)if(t.uri.toString()===e.uri.toString()){this._addDecorations(t.parent);return}}}_addDecorations(e){if(!this._editor.hasModel())return;this._callOnModelChange.add(this._editor.getModel().onDidChangeDecorations(()=>this._onDecorationChanged()));const t=[],i=[];for(let n=0,o=e.children.length;n{const o=n.deltaDecorations([],t);for(let r=0;r{o.equals(9)&&(this._keybindingService.dispatchEvent(o,o.target),o.stopPropagation())},!0)),this._tree=this._instantiationService.createInstance(Bke,"ReferencesWidget",this._treeContainer,new Ake,[this._instantiationService.createInstance(AC),this._instantiationService.createInstance(H1)],this._instantiationService.createInstance($M),i),this._splitView.addView({onDidChange:ae.None,element:this._previewContainer,minimumSize:200,maximumSize:Number.MAX_VALUE,layout:o=>{this._preview.layout({height:this._dim.height,width:o})}},OD.Distribute),this._splitView.addView({onDidChange:ae.None,element:this._treeContainer,minimumSize:100,maximumSize:Number.MAX_VALUE,layout:o=>{this._treeContainer.style.height=`${this._dim.height}px`,this._treeContainer.style.width=`${o}px`,this._tree.layout(this._dim.height,o)}},OD.Distribute),this._disposables.add(this._splitView.onDidSashChange(()=>{this._dim.width&&(this.layoutData.ratio=this._splitView.getViewSize(0)/this._dim.width)},void 0));const n=(o,r)=>{o instanceof Fh&&(r==="show"&&this._revealReference(o,!1),this._onDidSelectReference.fire({element:o,kind:r,source:"tree"}))};this._tree.onDidOpen(o=>{o.sideBySide?n(o.element,"side"):o.editorOptions.pinned?n(o.element,"goto"):n(o.element,"show")}),Es(this._treeContainer)}_onWidth(e){this._dim&&this._doLayoutBody(this._dim.height,e)}_doLayoutBody(e,t){super._doLayoutBody(e,t),this._dim=new Dt(t,e),this.layoutData.heightInLines=this._viewZone?this._viewZone.heightInLines:this.layoutData.heightInLines,this._splitView.layout(t),this._splitView.resizeView(0,t*this.layoutData.ratio)}setSelection(e){return this._revealReference(e,!0).then(()=>{this._model&&(this._tree.setSelection([e]),this._tree.setFocus([e]))})}setModel(e){return this._disposeOnNewModel.clear(),this._model=e,this._model?this._onNewModel():Promise.resolve()}_onNewModel(){return this._model?this._model.isEmpty?(this.setTitle(""),this._messageContainer.innerText=p("noResults","No results"),So(this._messageContainer),Promise.resolve(void 0)):(Es(this._messageContainer),this._decorationsManager=new wk(this._preview,this._model),this._disposeOnNewModel.add(this._decorationsManager),this._disposeOnNewModel.add(this._model.onDidChangeReferenceRange(e=>this._tree.rerender(e))),this._disposeOnNewModel.add(this._preview.onMouseDown(e=>{const{event:t,target:i}=e;if(t.detail!==2)return;const n=this._getFocusedReference();n&&this._onDidSelectReference.fire({element:{uri:n.uri,range:i.range},kind:t.ctrlKey||t.metaKey||t.altKey?"side":"open",source:"editor"})})),this.container.classList.add("results-loaded"),So(this._treeContainer),So(this._previewContainer),this._splitView.layout(this._dim.width),this.focusOnReferenceTree(),this._tree.setInput(this._model.groups.length===1?this._model.groups[0]:this._model)):Promise.resolve(void 0)}_getFocusedReference(){const[e]=this._tree.getFocus();if(e instanceof Fh)return e;if(e instanceof NC&&e.children.length>0)return e.children[0]}async revealReference(e){await this._revealReference(e,!1),this._onDidSelectReference.fire({element:e,kind:"goto",source:"tree"})}async _revealReference(e,t){if(this._revealedReference===e)return;this._revealedReference=e,e.uri.scheme!==qe.inMemory?this.setTitle(Bpe(e.uri),this._uriLabel.getUriLabel(Nx(e.uri))):this.setTitle(p("peekView.alternateTitle","References"));const i=this._textModelResolverService.createModelReference(e.uri);this._tree.getInput()===e.parent?this._tree.reveal(e):(t&&this._tree.reveal(e.parent),await this._tree.expand(e.parent),this._tree.reveal(e));const n=await i;if(!this._model){n.dispose();return}jt(this._previewModelReference);const o=n.object;if(o){const r=this._preview.getModel()===o.textEditorModel?0:1,a=x.lift(e.range).collapseToStart();this._previewModelReference=n,this._preview.setModel(o.textEditorModel),this._preview.setSelection(a),this._preview.revealRangeInCenter(a,r)}else this._preview.setModel(this._previewNotAvailableMessage),n.dispose()}};qM=Fke([zd(3,_n),zd(4,po),zd(5,Ne),zd(6,Nq),zd(7,C_),zd(8,Ax),zd(9,At),zd(10,vi),zd(11,Yt)],qM);var Wke=function(s,e,t,i){var n=arguments.length,o=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,e,t,i);else for(var a=s.length-1;a>=0;a--)(r=s[a])&&(o=(n<3?r(o):n>3?r(e,t,o):r(e,t))||o);return n>3&&o&&Object.defineProperty(e,t,o),o},Np=function(s,e){return function(t,i){e(t,i,s)}},dS;const fp=new ue("referenceSearchVisible",!1,p("referenceSearchVisible","Whether reference peek is visible, like 'Peek References' or 'Peek Definition'"));let R_=dS=class{static get(e){return e.getContribution(dS.ID)}constructor(e,t,i,n,o,r,a,l){this._defaultTreeKeyboardSupport=e,this._editor=t,this._editorService=n,this._notificationService=o,this._instantiationService=r,this._storageService=a,this._configurationService=l,this._disposables=new Y,this._requestIdPool=0,this._ignoreModelChangeEvent=!1,this._referenceSearchVisible=fp.bindTo(i)}dispose(){var e,t;this._referenceSearchVisible.reset(),this._disposables.dispose(),(e=this._widget)===null||e===void 0||e.dispose(),(t=this._model)===null||t===void 0||t.dispose(),this._widget=void 0,this._model=void 0}toggleWidget(e,t,i){let n;if(this._widget&&(n=this._widget.position),this.closeWidget(),n&&e.containsPosition(n))return;this._peekMode=i,this._referenceSearchVisible.set(!0),this._disposables.add(this._editor.onDidChangeModelLanguage(()=>{this.closeWidget()})),this._disposables.add(this._editor.onDidChangeModel(()=>{this._ignoreModelChangeEvent||this.closeWidget()}));const o="peekViewLayout",r=Oke.fromJSON(this._storageService.get(o,0,"{}"));this._widget=this._instantiationService.createInstance(qM,this._editor,this._defaultTreeKeyboardSupport,r),this._widget.setTitle(p("labelLoading","Loading...")),this._widget.show(e),this._disposables.add(this._widget.onDidClose(()=>{t.cancel(),this._widget&&(this._storageService.store(o,JSON.stringify(this._widget.layoutData),0,1),this._widget=void 0),this.closeWidget()})),this._disposables.add(this._widget.onDidSelectReference(l=>{const{element:d,kind:c}=l;if(d)switch(c){case"open":(l.source!=="editor"||!this._configurationService.getValue("editor.stablePeek"))&&this.openReference(d,!1,!1);break;case"side":this.openReference(d,!0,!1);break;case"goto":i?this._gotoReference(d,!0):this.openReference(d,!1,!0);break}}));const a=++this._requestIdPool;t.then(l=>{var d;if(a!==this._requestIdPool||!this._widget){l.dispose();return}return(d=this._model)===null||d===void 0||d.dispose(),this._model=l,this._widget.setModel(this._model).then(()=>{if(this._widget&&this._model&&this._editor.hasModel()){this._model.isEmpty?this._widget.setMetaTitle(""):this._widget.setMetaTitle(p("metaTitle.N","{0} ({1})",this._model.title,this._model.references.length));const c=this._editor.getModel().uri,u=new W(e.startLineNumber,e.startColumn),h=this._model.nearestReference(c,u);if(h)return this._widget.setSelection(h).then(()=>{this._widget&&this._editor.getOption(87)==="editor"&&this._widget.focusOnPreviewEditor()})}})},l=>{this._notificationService.error(l)})}changeFocusBetweenPreviewAndReferences(){this._widget&&(this._widget.isPreviewEditorFocused()?this._widget.focusOnReferenceTree():this._widget.focusOnPreviewEditor())}async goToNextOrPreviousReference(e){if(!this._editor.hasModel()||!this._model||!this._widget)return;const t=this._widget.position;if(!t)return;const i=this._model.nearestReference(this._editor.getModel().uri,t);if(!i)return;const n=this._model.nextOrPreviousReference(i,e),o=this._editor.hasTextFocus(),r=this._widget.isPreviewEditorFocused();await this._widget.setSelection(n),await this._gotoReference(n,!1),o?this._editor.focus():this._widget&&r&&this._widget.focusOnPreviewEditor()}async revealReference(e){!this._editor.hasModel()||!this._model||!this._widget||await this._widget.revealReference(e)}closeWidget(e=!0){var t,i;(t=this._widget)===null||t===void 0||t.dispose(),(i=this._model)===null||i===void 0||i.dispose(),this._referenceSearchVisible.reset(),this._disposables.clear(),this._widget=void 0,this._model=void 0,e&&this._editor.focus(),this._requestIdPool+=1}_gotoReference(e,t){var i;(i=this._widget)===null||i===void 0||i.hide(),this._ignoreModelChangeEvent=!0;const n=x.lift(e.range).collapseToStart();return this._editorService.openCodeEditor({resource:e.uri,options:{selection:n,selectionSource:"code.jump",pinned:t}},this._editor).then(o=>{var r;if(this._ignoreModelChangeEvent=!1,!o||!this._widget){this.closeWidget();return}if(this._editor===o)this._widget.show(n),this._widget.focusOnReferenceTree();else{const a=dS.get(o),l=this._model.clone();this.closeWidget(),o.focus(),a==null||a.toggleWidget(n,Ln(d=>Promise.resolve(l)),(r=this._peekMode)!==null&&r!==void 0?r:!1)}},o=>{this._ignoreModelChangeEvent=!1,Ge(o)})}openReference(e,t,i){t||this.closeWidget();const{uri:n,range:o}=e;this._editorService.openCodeEditor({resource:n,options:{selection:o,selectionSource:"code.jump",pinned:i}},this._editor,t)}};R_.ID="editor.contrib.referencesController";R_=dS=Wke([Np(2,Be),Np(3,xt),Np(4,en),Np(5,Ne),Np(6,Ad),Np(7,rt)],R_);function pp(s,e){const t=xke(s);if(!t)return;const i=R_.get(t);i&&e(i)}ho.registerCommandAndKeybindingRule({id:"togglePeekWidgetFocus",weight:100,primary:an(2089,60),when:G.or(fp,fo.inPeekEditor),handler(s){pp(s,e=>{e.changeFocusBetweenPreviewAndReferences()})}});ho.registerCommandAndKeybindingRule({id:"goToNextReference",weight:90,primary:62,secondary:[70],when:G.or(fp,fo.inPeekEditor),handler(s){pp(s,e=>{e.goToNextOrPreviousReference(!0)})}});ho.registerCommandAndKeybindingRule({id:"goToPreviousReference",weight:90,primary:1086,secondary:[1094],when:G.or(fp,fo.inPeekEditor),handler(s){pp(s,e=>{e.goToNextOrPreviousReference(!1)})}});pt.registerCommandAlias("goToNextReferenceFromEmbeddedEditor","goToNextReference");pt.registerCommandAlias("goToPreviousReferenceFromEmbeddedEditor","goToPreviousReference");pt.registerCommandAlias("closeReferenceSearchEditor","closeReferenceSearch");pt.registerCommand("closeReferenceSearch",s=>pp(s,e=>e.closeWidget()));ho.registerKeybindingRule({id:"closeReferenceSearch",weight:-1,primary:9,secondary:[1033],when:G.and(fo.inPeekEditor,G.not("config.editor.stablePeek"))});ho.registerKeybindingRule({id:"closeReferenceSearch",weight:250,primary:9,secondary:[1033],when:G.and(fp,G.not("config.editor.stablePeek"),G.or(T.editorTextFocus,H1e.negate()))});ho.registerCommandAndKeybindingRule({id:"revealReference",weight:200,primary:3,mac:{primary:3,secondary:[2066]},when:G.and(fp,zj,OO.negate(),BO.negate()),handler(s){var e;const i=(e=s.get(Kr).lastFocusedList)===null||e===void 0?void 0:e.getFocus();Array.isArray(i)&&i[0]instanceof Fh&&pp(s,n=>n.revealReference(i[0]))}});ho.registerCommandAndKeybindingRule({id:"openReferenceToSide",weight:100,primary:2051,mac:{primary:259},when:G.and(fp,zj,OO.negate(),BO.negate()),handler(s){var e;const i=(e=s.get(Kr).lastFocusedList)===null||e===void 0?void 0:e.getFocus();Array.isArray(i)&&i[0]instanceof Fh&&pp(s,n=>n.openReference(i[0],!0,!0))}});pt.registerCommand("openReference",s=>{var e;const i=(e=s.get(Kr).lastFocusedList)===null||e===void 0?void 0:e.getFocus();Array.isArray(i)&&i[0]instanceof Fh&&pp(s,n=>n.openReference(i[0],!1,!0))});var Rq=function(s,e,t,i){var n=arguments.length,o=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,e,t,i);else for(var a=s.length-1;a>=0;a--)(r=s[a])&&(o=(n<3?r(o):n>3?r(e,t,o):r(e,t))||o);return n>3&&o&&Object.defineProperty(e,t,o),o},Sv=function(s,e){return function(t,i){e(t,i,s)}};const C4=new ue("hasSymbols",!1,p("hasSymbols","Whether there are symbol locations that can be navigated via keyboard-only.")),yk=ut("ISymbolNavigationService");let GM=class{constructor(e,t,i,n){this._editorService=t,this._notificationService=i,this._keybindingService=n,this._currentModel=void 0,this._currentIdx=-1,this._ignoreEditorChange=!1,this._ctxHasSymbols=C4.bindTo(e)}reset(){var e,t;this._ctxHasSymbols.reset(),(e=this._currentState)===null||e===void 0||e.dispose(),(t=this._currentMessage)===null||t===void 0||t.dispose(),this._currentModel=void 0,this._currentIdx=-1}put(e){const t=e.parent.parent;if(t.references.length<=1){this.reset();return}this._currentModel=t,this._currentIdx=t.references.indexOf(e),this._ctxHasSymbols.set(!0),this._showMessage();const i=new ZM(this._editorService),n=i.onDidChange(o=>{if(this._ignoreEditorChange)return;const r=this._editorService.getActiveCodeEditor();if(!r)return;const a=r.getModel(),l=r.getPosition();if(!a||!l)return;let d=!1,c=!1;for(const u of t.references)if(KF(u.uri,a.uri))d=!0,c=c||x.containsPosition(u.range,l);else if(d)break;(!d||!c)&&this.reset()});this._currentState=ha(i,n)}revealNext(e){if(!this._currentModel)return Promise.resolve();this._currentIdx+=1,this._currentIdx%=this._currentModel.references.length;const t=this._currentModel.references[this._currentIdx];return this._showMessage(),this._ignoreEditorChange=!0,this._editorService.openCodeEditor({resource:t.uri,options:{selection:x.collapseToStart(t.range),selectionRevealType:3}},e).finally(()=>{this._ignoreEditorChange=!1})}_showMessage(){var e;(e=this._currentMessage)===null||e===void 0||e.dispose();const t=this._keybindingService.lookupKeybinding("editor.gotoNextSymbolFromResult"),i=t?p("location.kb","Symbol {0} of {1}, {2} for next",this._currentIdx+1,this._currentModel.references.length,t.getLabel()):p("location","Symbol {0} of {1}",this._currentIdx+1,this._currentModel.references.length);this._currentMessage=this._notificationService.status(i)}};GM=Rq([Sv(0,Be),Sv(1,xt),Sv(2,en),Sv(3,At)],GM);mt(yk,GM,1);de(new class extends mn{constructor(){super({id:"editor.gotoNextSymbolFromResult",precondition:C4,kbOpts:{weight:100,primary:70}})}runEditorCommand(s,e){return s.get(yk).revealNext(e)}});ho.registerCommandAndKeybindingRule({id:"editor.gotoNextSymbolFromResult.cancel",weight:100,when:C4,primary:9,handler(s){s.get(yk).reset()}});let ZM=class{constructor(e){this._listener=new Map,this._disposables=new Y,this._onDidChange=new B,this.onDidChange=this._onDidChange.event,this._disposables.add(e.onCodeEditorRemove(this._onDidRemoveEditor,this)),this._disposables.add(e.onCodeEditorAdd(this._onDidAddEditor,this)),e.listCodeEditors().forEach(this._onDidAddEditor,this)}dispose(){this._disposables.dispose(),this._onDidChange.dispose(),jt(this._listener.values())}_onDidAddEditor(e){this._listener.set(e,ha(e.onDidChangeCursorPosition(t=>this._onDidChange.fire({editor:e})),e.onDidChangeModelContent(t=>this._onDidChange.fire({editor:e}))))}_onDidRemoveEditor(e){var t;(t=this._listener.get(e))===null||t===void 0||t.dispose(),this._listener.delete(e)}};ZM=Rq([Sv(0,xt)],ZM);async function V1(s,e,t,i){const o=t.ordered(s).map(a=>Promise.resolve(i(a,s,e)).then(void 0,l=>{Ni(l)})),r=await Promise.all(o);return fd(r.flat())}function Sk(s,e,t,i){return V1(e,t,s,(n,o,r)=>n.provideDefinition(o,r,i))}function Pq(s,e,t,i){return V1(e,t,s,(n,o,r)=>n.provideDeclaration(o,r,i))}function Fq(s,e,t,i){return V1(e,t,s,(n,o,r)=>n.provideImplementation(o,r,i))}function Oq(s,e,t,i){return V1(e,t,s,(n,o,r)=>n.provideTypeDefinition(o,r,i))}function Dk(s,e,t,i,n){return V1(e,t,s,async(o,r,a)=>{const l=await o.provideReferences(r,a,{includeDeclaration:!0},n);if(!i||!l||l.length!==2)return l;const d=await o.provideReferences(r,a,{includeDeclaration:!1},n);return d&&d.length===1?d:l})}async function z1(s){const e=await s(),t=new Io(e,""),i=t.references.map(n=>n.link);return t.dispose(),i}Td("_executeDefinitionProvider",(s,e,t)=>{const i=s.get(be),n=Sk(i.definitionProvider,e,t,dt.None);return z1(()=>n)});Td("_executeTypeDefinitionProvider",(s,e,t)=>{const i=s.get(be),n=Oq(i.typeDefinitionProvider,e,t,dt.None);return z1(()=>n)});Td("_executeDeclarationProvider",(s,e,t)=>{const i=s.get(be),n=Pq(i.declarationProvider,e,t,dt.None);return z1(()=>n)});Td("_executeReferenceProvider",(s,e,t)=>{const i=s.get(be),n=Dk(i.referenceProvider,e,t,!1,dt.None);return z1(()=>n)});Td("_executeImplementationProvider",(s,e,t)=>{const i=s.get(be),n=Fq(i.implementationProvider,e,t,dt.None);return z1(()=>n)});var G0,Z0,X0,iy,ny,sy,oy,ry;Sn.appendMenuItem(k.EditorContext,{submenu:k.EditorContextPeek,title:p("peek.submenu","Peek"),group:"navigation",order:100});class P_{static is(e){return!e||typeof e!="object"?!1:!!(e instanceof P_||W.isIPosition(e.position)&&e.model)}constructor(e,t){this.model=e,this.position=t}}class _s extends gl{static all(){return _s._allSymbolNavigationCommands.values()}static _patchConfig(e){const t={...e,f1:!0};if(t.menu)for(const i of ft.wrap(t.menu))(i.id===k.EditorContext||i.id===k.EditorContextPeek)&&(i.when=G.and(e.precondition,i.when));return t}constructor(e,t){super(_s._patchConfig(t)),this.configuration=e,_s._allSymbolNavigationCommands.set(t.id,this)}runEditorCommand(e,t,i,n){if(!t.hasModel())return Promise.resolve(void 0);const o=e.get(en),r=e.get(xt),a=e.get(Qh),l=e.get(yk),d=e.get(be),c=e.get(Ne),u=t.getModel(),h=t.getPosition(),g=P_.is(i)?i:new P_(u,h),f=new Th(t,5),m=d1(this._getLocationModel(d,g.model,g.position,f.token),f.token).then(async _=>{var v;if(!_||f.token.isCancellationRequested)return;go(_.ariaMessage);let b;if(_.referenceAt(u.uri,h)){const w=this._getAlternativeCommand(t);!_s._activeAlternativeCommands.has(w)&&_s._allSymbolNavigationCommands.has(w)&&(b=_s._allSymbolNavigationCommands.get(w))}const C=_.references.length;if(C===0){if(!this.configuration.muteMessage){const w=u.getWordAtPosition(h);(v=Hs.get(t))===null||v===void 0||v.showMessage(this._getNoResultFoundMessage(w),h)}}else if(C===1&&b)_s._activeAlternativeCommands.add(this.desc.id),c.invokeFunction(w=>b.runEditorCommand(w,t,i,n).finally(()=>{_s._activeAlternativeCommands.delete(this.desc.id)}));else return this._onResult(r,l,t,_,n)},_=>{o.error(_)}).finally(()=>{f.dispose()});return a.showWhile(m,250),m}async _onResult(e,t,i,n,o){const r=this._getGoToPreference(i);if(!(i instanceof Ph)&&(this.configuration.openInPeek||r==="peek"&&n.references.length>1))this._openInPeek(i,n,o);else{const a=n.firstReference(),l=n.references.length>1&&r==="gotoAndPeek",d=await this._openReference(i,e,a,this.configuration.openToSide,!l);l&&d?this._openInPeek(d,n,o):n.dispose(),r==="goto"&&t.put(a)}}async _openReference(e,t,i,n,o){let r;if(Woe(i)&&(r=i.targetSelectionRange),r||(r=i.range),!r)return;const a=await t.openCodeEditor({resource:i.uri,options:{selection:x.collapseToStart(r),selectionRevealType:3,selectionSource:"code.jump"}},e,n);if(a){if(o){const l=a.getModel(),d=a.createDecorationsCollection([{range:r,options:{description:"symbol-navigate-action-highlight",className:"symbolHighlight"}}]);setTimeout(()=>{a.getModel()===l&&d.clear()},350)}return a}}_openInPeek(e,t,i){const n=R_.get(e);n&&e.hasModel()?n.toggleWidget(i??e.getSelection(),Ln(o=>Promise.resolve(t)),this.configuration.openInPeek):t.dispose()}}_s._allSymbolNavigationCommands=new Map;_s._activeAlternativeCommands=new Set;class U1 extends _s{async _getLocationModel(e,t,i,n){return new Io(await Sk(e.definitionProvider,t,i,n),p("def.title","Definitions"))}_getNoResultFoundMessage(e){return e&&e.word?p("noResultWord","No definition found for '{0}'",e.word):p("generic.noResults","No definition found")}_getAlternativeCommand(e){return e.getOption(58).alternativeDefinitionCommand}_getGoToPreference(e){return e.getOption(58).multipleDefinitions}}qt((G0=class extends U1{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:G0.id,title:{...Ve("actions.goToDecl.label","Go to Definition"),mnemonicTitle:p({key:"miGotoDefinition",comment:["&& denotes a mnemonic"]},"Go to &&Definition")},precondition:T.hasDefinitionProvider,keybinding:[{when:T.editorTextFocus,primary:70,weight:100},{when:G.and(T.editorTextFocus,Bj),primary:2118,weight:100}],menu:[{id:k.EditorContext,group:"navigation",order:1.1},{id:k.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:2}]}),pt.registerCommandAlias("editor.action.goToDeclaration",G0.id)}},G0.id="editor.action.revealDefinition",G0));qt((Z0=class extends U1{constructor(){super({openToSide:!0,openInPeek:!1,muteMessage:!1},{id:Z0.id,title:Ve("actions.goToDeclToSide.label","Open Definition to the Side"),precondition:G.and(T.hasDefinitionProvider,T.isInEmbeddedEditor.toNegated()),keybinding:[{when:T.editorTextFocus,primary:an(2089,70),weight:100},{when:G.and(T.editorTextFocus,Bj),primary:an(2089,2118),weight:100}]}),pt.registerCommandAlias("editor.action.openDeclarationToTheSide",Z0.id)}},Z0.id="editor.action.revealDefinitionAside",Z0));qt((X0=class extends U1{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:X0.id,title:Ve("actions.previewDecl.label","Peek Definition"),precondition:G.and(T.hasDefinitionProvider,fo.notInPeekEditor,T.isInEmbeddedEditor.toNegated()),keybinding:{when:T.editorTextFocus,primary:582,linux:{primary:3140},weight:100},menu:{id:k.EditorContextPeek,group:"peek",order:2}}),pt.registerCommandAlias("editor.action.previewDeclaration",X0.id)}},X0.id="editor.action.peekDefinition",X0));class Bq extends _s{async _getLocationModel(e,t,i,n){return new Io(await Pq(e.declarationProvider,t,i,n),p("decl.title","Declarations"))}_getNoResultFoundMessage(e){return e&&e.word?p("decl.noResultWord","No declaration found for '{0}'",e.word):p("decl.generic.noResults","No declaration found")}_getAlternativeCommand(e){return e.getOption(58).alternativeDeclarationCommand}_getGoToPreference(e){return e.getOption(58).multipleDeclarations}}qt((iy=class extends Bq{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:iy.id,title:{...Ve("actions.goToDeclaration.label","Go to Declaration"),mnemonicTitle:p({key:"miGotoDeclaration",comment:["&& denotes a mnemonic"]},"Go to &&Declaration")},precondition:G.and(T.hasDeclarationProvider,T.isInEmbeddedEditor.toNegated()),menu:[{id:k.EditorContext,group:"navigation",order:1.3},{id:k.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:3}]})}_getNoResultFoundMessage(e){return e&&e.word?p("decl.noResultWord","No declaration found for '{0}'",e.word):p("decl.generic.noResults","No declaration found")}},iy.id="editor.action.revealDeclaration",iy));qt(class extends Bq{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:"editor.action.peekDeclaration",title:Ve("actions.peekDecl.label","Peek Declaration"),precondition:G.and(T.hasDeclarationProvider,fo.notInPeekEditor,T.isInEmbeddedEditor.toNegated()),menu:{id:k.EditorContextPeek,group:"peek",order:3}})}});class Wq extends _s{async _getLocationModel(e,t,i,n){return new Io(await Oq(e.typeDefinitionProvider,t,i,n),p("typedef.title","Type Definitions"))}_getNoResultFoundMessage(e){return e&&e.word?p("goToTypeDefinition.noResultWord","No type definition found for '{0}'",e.word):p("goToTypeDefinition.generic.noResults","No type definition found")}_getAlternativeCommand(e){return e.getOption(58).alternativeTypeDefinitionCommand}_getGoToPreference(e){return e.getOption(58).multipleTypeDefinitions}}qt((ny=class extends Wq{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:ny.ID,title:{...Ve("actions.goToTypeDefinition.label","Go to Type Definition"),mnemonicTitle:p({key:"miGotoTypeDefinition",comment:["&& denotes a mnemonic"]},"Go to &&Type Definition")},precondition:T.hasTypeDefinitionProvider,keybinding:{when:T.editorTextFocus,primary:0,weight:100},menu:[{id:k.EditorContext,group:"navigation",order:1.4},{id:k.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:3}]})}},ny.ID="editor.action.goToTypeDefinition",ny));qt((sy=class extends Wq{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:sy.ID,title:Ve("actions.peekTypeDefinition.label","Peek Type Definition"),precondition:G.and(T.hasTypeDefinitionProvider,fo.notInPeekEditor,T.isInEmbeddedEditor.toNegated()),menu:{id:k.EditorContextPeek,group:"peek",order:4}})}},sy.ID="editor.action.peekTypeDefinition",sy));class Hq extends _s{async _getLocationModel(e,t,i,n){return new Io(await Fq(e.implementationProvider,t,i,n),p("impl.title","Implementations"))}_getNoResultFoundMessage(e){return e&&e.word?p("goToImplementation.noResultWord","No implementation found for '{0}'",e.word):p("goToImplementation.generic.noResults","No implementation found")}_getAlternativeCommand(e){return e.getOption(58).alternativeImplementationCommand}_getGoToPreference(e){return e.getOption(58).multipleImplementations}}qt((oy=class extends Hq{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:oy.ID,title:{...Ve("actions.goToImplementation.label","Go to Implementations"),mnemonicTitle:p({key:"miGotoImplementation",comment:["&& denotes a mnemonic"]},"Go to &&Implementations")},precondition:T.hasImplementationProvider,keybinding:{when:T.editorTextFocus,primary:2118,weight:100},menu:[{id:k.EditorContext,group:"navigation",order:1.45},{id:k.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:4}]})}},oy.ID="editor.action.goToImplementation",oy));qt((ry=class extends Hq{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:ry.ID,title:Ve("actions.peekImplementation.label","Peek Implementations"),precondition:G.and(T.hasImplementationProvider,fo.notInPeekEditor,T.isInEmbeddedEditor.toNegated()),keybinding:{when:T.editorTextFocus,primary:3142,weight:100},menu:{id:k.EditorContextPeek,group:"peek",order:5}})}},ry.ID="editor.action.peekImplementation",ry));class Vq extends _s{_getNoResultFoundMessage(e){return e?p("references.no","No references found for '{0}'",e.word):p("references.noGeneric","No references found")}_getAlternativeCommand(e){return e.getOption(58).alternativeReferenceCommand}_getGoToPreference(e){return e.getOption(58).multipleReferences}}qt(class extends Vq{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:"editor.action.goToReferences",title:{...Ve("goToReferences.label","Go to References"),mnemonicTitle:p({key:"miGotoReference",comment:["&& denotes a mnemonic"]},"Go to &&References")},precondition:G.and(T.hasReferenceProvider,fo.notInPeekEditor,T.isInEmbeddedEditor.toNegated()),keybinding:{when:T.editorTextFocus,primary:1094,weight:100},menu:[{id:k.EditorContext,group:"navigation",order:1.45},{id:k.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:5}]})}async _getLocationModel(e,t,i,n){return new Io(await Dk(e.referenceProvider,t,i,!0,n),p("ref.title","References"))}});qt(class extends Vq{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:"editor.action.referenceSearch.trigger",title:Ve("references.action.label","Peek References"),precondition:G.and(T.hasReferenceProvider,fo.notInPeekEditor,T.isInEmbeddedEditor.toNegated()),menu:{id:k.EditorContextPeek,group:"peek",order:6}})}async _getLocationModel(e,t,i,n){return new Io(await Dk(e.referenceProvider,t,i,!1,n),p("ref.title","References"))}});class Hke extends _s{constructor(e,t,i){super(e,{id:"editor.action.goToLocation",title:Ve("label.generic","Go to Any Symbol"),precondition:G.and(fo.notInPeekEditor,T.isInEmbeddedEditor.toNegated())}),this._references=t,this._gotoMultipleBehaviour=i}async _getLocationModel(e,t,i,n){return new Io(this._references,p("generic.title","Locations"))}_getNoResultFoundMessage(e){return e&&p("generic.noResult","No results for '{0}'",e.word)||""}_getGoToPreference(e){var t;return(t=this._gotoMultipleBehaviour)!==null&&t!==void 0?t:e.getOption(58).multipleReferences}_getAlternativeCommand(){return""}}pt.registerCommand({id:"editor.action.goToLocations",metadata:{description:"Go to locations from a position in a file",args:[{name:"uri",description:"The text document in which to start",constraint:Ae},{name:"position",description:"The position at which to start",constraint:W.isIPosition},{name:"locations",description:"An array of locations.",constraint:Array},{name:"multiple",description:"Define what to do when having multiple results, either `peek`, `gotoAndPeek`, or `goto`"},{name:"noResultsMessage",description:"Human readable message that shows when locations is empty."}]},handler:async(s,e,t,i,n,o,r)=>{yt(Ae.isUri(e)),yt(W.isIPosition(t)),yt(Array.isArray(i)),yt(typeof n>"u"||typeof n=="string"),yt(typeof r>"u"||typeof r=="boolean");const a=s.get(xt),l=await a.openCodeEditor({resource:e},a.getFocusedCodeEditor());if(Nh(l))return l.setPosition(t),l.revealPositionInCenterIfOutsideViewport(t,0),l.invokeWithinContext(d=>{const c=new class extends Hke{_getNoResultFoundMessage(u){return o||super._getNoResultFoundMessage(u)}}({muteMessage:!o,openInPeek:!!r,openToSide:!1},i,n);d.get(Ne).invokeFunction(c.run.bind(c),l)})}});pt.registerCommand({id:"editor.action.peekLocations",metadata:{description:"Peek locations from a position in a file",args:[{name:"uri",description:"The text document in which to start",constraint:Ae},{name:"position",description:"The position at which to start",constraint:W.isIPosition},{name:"locations",description:"An array of locations.",constraint:Array},{name:"multiple",description:"Define what to do when having multiple results, either `peek`, `gotoAndPeek`, or `goto`"}]},handler:async(s,e,t,i,n)=>{s.get(ui).executeCommand("editor.action.goToLocations",e,t,i,n,void 0,!0)}});pt.registerCommand({id:"editor.action.findReferences",handler:(s,e,t)=>{yt(Ae.isUri(e)),yt(W.isIPosition(t));const i=s.get(be),n=s.get(xt);return n.openCodeEditor({resource:e},n.getFocusedCodeEditor()).then(o=>{if(!Nh(o)||!o.hasModel())return;const r=R_.get(o);if(!r)return;const a=Ln(d=>Dk(i.referenceProvider,o.getModel(),W.lift(t),!1,d).then(c=>new Io(c,p("ref.title","References")))),l=new x(t.lineNumber,t.column,t.lineNumber,t.column);return Promise.resolve(r.toggleWidget(l,a,!1))})}});pt.registerCommandAlias("editor.action.showReferences","editor.action.peekLocations");async function Vke(s,e,t,i){var n;const o=s.get(po),r=s.get(Fo),a=s.get(ui),l=s.get(Ne),d=s.get(en);if(await i.item.resolve(dt.None),!i.part.location)return;const c=i.part.location,u=[],h=new Set(Sn.getMenuItems(k.EditorContext).map(f=>Xp(f)?f.command.id:fk()));for(const f of _s.all())h.has(f.desc.id)&&u.push(new ko(f.desc.id,Eo.label(f.desc,{renderShortTitle:!0}),void 0,!0,async()=>{const m=await o.createModelReference(c.uri);try{const _=new P_(m.object.textEditorModel,x.getStartPosition(c.range)),v=i.item.anchor.range;await l.invokeFunction(f.runEditorCommand.bind(f),e,_,v)}finally{m.dispose()}}));if(i.part.command){const{command:f}=i.part;u.push(new rn),u.push(new ko(f.id,f.title,void 0,!0,async()=>{var m;try{await a.executeCommand(f.id,...(m=f.arguments)!==null&&m!==void 0?m:[])}catch(_){d.notify({severity:Mx.Error,source:i.item.provider.displayName,message:_})}}))}const g=e.getOption(127);r.showContextMenu({domForShadowRoot:g&&(n=e.getDomNode())!==null&&n!==void 0?n:void 0,getAnchor:()=>{const f=qi(t);return{x:f.left,y:f.top+f.height+8}},getActions:()=>u,onHide:()=>{e.focus()},autoSelectFirstItem:!0})}async function zq(s,e,t,i){const o=await s.get(po).createModelReference(i.uri);await t.invokeWithinContext(async r=>{const a=e.hasSideBySideModifier,l=r.get(Be),d=fo.inPeekEditor.getValue(l),c=!a&&t.getOption(88)&&!d;return new U1({openToSide:a,openInPeek:c,muteMessage:!0},{title:{value:"",original:""},id:"",precondition:void 0}).run(r,new P_(o.object.textEditorModel,x.getStartPosition(i.range)),x.lift(i.range))}),o.dispose()}var zke=function(s,e,t,i){var n=arguments.length,o=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,e,t,i);else for(var a=s.length-1;a>=0;a--)(r=s[a])&&(o=(n<3?r(o):n>3?r(e,t,o):r(e,t))||o);return n>3&&o&&Object.defineProperty(e,t,o),o},Ap=function(s,e){return function(t,i){e(t,i,s)}},zp;class hL{constructor(){this._entries=new Yc(50)}get(e){const t=hL._key(e);return this._entries.get(t)}set(e,t){const i=hL._key(e);this._entries.set(i,t)}static _key(e){return`${e.uri.toString()}/${e.getVersionId()}`}}const Uq=ut("IInlayHintsCache");mt(Uq,hL,1);class XM{constructor(e,t){this.item=e,this.index=t}get part(){const e=this.item.hint.label;return typeof e=="string"?{label:e}:e[this.index]}}class Uke{constructor(e,t){this.part=e,this.hasTriggerModifier=t}}let Oh=zp=class{static get(e){var t;return(t=e.getContribution(zp.ID))!==null&&t!==void 0?t:void 0}constructor(e,t,i,n,o,r,a){this._editor=e,this._languageFeaturesService=t,this._inlayHintsCache=n,this._commandService=o,this._notificationService=r,this._instaService=a,this._disposables=new Y,this._sessionDisposables=new Y,this._decorationsMetadata=new Map,this._ruleFactory=new p1(this._editor),this._activeRenderMode=0,this._debounceInfo=i.for(t.inlayHintsProvider,"InlayHint",{min:25}),this._disposables.add(t.inlayHintsProvider.onDidChange(()=>this._update())),this._disposables.add(e.onDidChangeModel(()=>this._update())),this._disposables.add(e.onDidChangeModelLanguage(()=>this._update())),this._disposables.add(e.onDidChangeConfiguration(l=>{l.hasChanged(141)&&this._update()})),this._update()}dispose(){this._sessionDisposables.dispose(),this._removeAllDecorations(),this._disposables.dispose()}_update(){this._sessionDisposables.clear(),this._removeAllDecorations();const e=this._editor.getOption(141);if(e.enabled==="off")return;const t=this._editor.getModel();if(!t||!this._languageFeaturesService.inlayHintsProvider.has(t))return;if(e.enabled==="on")this._activeRenderMode=0;else{let a,l;e.enabled==="onUnlessPressed"?(a=0,l=1):(a=1,l=0),this._activeRenderMode=a,this._sessionDisposables.add(uc.getInstance().event(d=>{if(!this._editor.hasModel())return;const c=d.altKey&&d.ctrlKey&&!(d.shiftKey||d.metaKey)?l:a;if(c!==this._activeRenderMode){this._activeRenderMode=c;const u=this._editor.getModel(),h=this._copyInlayHintsWithCurrentAnchor(u);this._updateHintsDecorators([u.getFullModelRange()],h),r.schedule(0)}}))}const i=this._inlayHintsCache.get(t);i&&this._updateHintsDecorators([t.getFullModelRange()],i),this._sessionDisposables.add(Ie(()=>{t.isDisposed()||this._cacheHintsForFastRestore(t)}));let n;const o=new Set,r=new Ht(async()=>{const a=Date.now();n==null||n.dispose(!0),n=new Hi;const l=t.onWillDispose(()=>n==null?void 0:n.cancel());try{const d=n.token,c=await lf.create(this._languageFeaturesService.inlayHintsProvider,t,this._getHintsRanges(),d);if(r.delay=this._debounceInfo.update(t,Date.now()-a),d.isCancellationRequested){c.dispose();return}for(const u of c.provider)typeof u.onDidChangeInlayHints=="function"&&!o.has(u)&&(o.add(u),this._sessionDisposables.add(u.onDidChangeInlayHints(()=>{r.isScheduled()||r.schedule()})));this._sessionDisposables.add(c),this._updateHintsDecorators(c.ranges,c.items),this._cacheHintsForFastRestore(t)}catch(d){Ge(d)}finally{n.dispose(),l.dispose()}},this._debounceInfo.get(t));this._sessionDisposables.add(r),this._sessionDisposables.add(Ie(()=>n==null?void 0:n.dispose(!0))),r.schedule(0),this._sessionDisposables.add(this._editor.onDidScrollChange(a=>{(a.scrollTopChanged||!r.isScheduled())&&r.schedule()})),this._sessionDisposables.add(this._editor.onDidChangeModelContent(a=>{n==null||n.cancel();const l=Math.max(r.delay,1250);r.schedule(l)})),this._sessionDisposables.add(this._installDblClickGesture(()=>r.schedule(0))),this._sessionDisposables.add(this._installLinkGesture()),this._sessionDisposables.add(this._installContextMenu())}_installLinkGesture(){const e=new Y,t=e.add(new _k(this._editor)),i=new Y;return e.add(i),e.add(t.onMouseMoveOrRelevantKeyDown(n=>{const[o]=n,r=this._getInlayHintLabelPart(o),a=this._editor.getModel();if(!r||!a){i.clear();return}const l=new Hi;i.add(Ie(()=>l.dispose(!0))),r.item.resolve(l.token),this._activeInlayHintPart=r.part.command||r.part.location?new Uke(r,o.hasTriggerModifier):void 0;const d=a.validatePosition(r.item.hint.position).lineNumber,c=new x(d,1,d,a.getLineMaxColumn(d)),u=this._getInlineHintsForRange(c);this._updateHintsDecorators([c],u),i.add(Ie(()=>{this._activeInlayHintPart=void 0,this._updateHintsDecorators([c],u)}))})),e.add(t.onCancel(()=>i.clear())),e.add(t.onExecute(async n=>{const o=this._getInlayHintLabelPart(n);if(o){const r=o.part;r.location?this._instaService.invokeFunction(zq,n,this._editor,r.location):eN.is(r.command)&&await this._invokeCommand(r.command,o.item)}})),e}_getInlineHintsForRange(e){const t=new Set;for(const i of this._decorationsMetadata.values())e.containsRange(i.item.anchor.range)&&t.add(i.item);return Array.from(t)}_installDblClickGesture(e){return this._editor.onMouseUp(async t=>{if(t.event.detail!==2)return;const i=this._getInlayHintLabelPart(t);if(i&&(t.event.preventDefault(),await i.item.resolve(dt.None),rs(i.item.hint.textEdits))){const n=i.item.hint.textEdits.map(o=>fi.replace(x.lift(o.range),o.text));this._editor.executeEdits("inlayHint.default",n),e()}})}_installContextMenu(){return this._editor.onContextMenu(async e=>{if(!(e.event.target instanceof HTMLElement))return;const t=this._getInlayHintLabelPart(e);t&&await this._instaService.invokeFunction(Vke,this._editor,e.event.target,t)})}_getInlayHintLabelPart(e){var t;if(e.target.type!==6)return;const i=(t=e.target.detail.injectedText)===null||t===void 0?void 0:t.options;if(i instanceof kh&&(i==null?void 0:i.attachedData)instanceof XM)return i.attachedData}async _invokeCommand(e,t){var i;try{await this._commandService.executeCommand(e.id,...(i=e.arguments)!==null&&i!==void 0?i:[])}catch(n){this._notificationService.notify({severity:Mx.Error,source:t.provider.displayName,message:n})}}_cacheHintsForFastRestore(e){const t=this._copyInlayHintsWithCurrentAnchor(e);this._inlayHintsCache.set(e,t)}_copyInlayHintsWithCurrentAnchor(e){const t=new Map;for(const[i,n]of this._decorationsMetadata){if(t.has(n.item))continue;const o=e.getDecorationRange(i);if(o){const r=new Eq(o,n.item.anchor.direction),a=n.item.with({anchor:r});t.set(n.item,a)}}return Array.from(t.values())}_getHintsRanges(){const t=this._editor.getModel(),i=this._editor.getVisibleRangesPlusViewportAboveBelow(),n=[];for(const o of i.sort(x.compareRangesUsingStarts)){const r=t.validateRange(new x(o.startLineNumber-30,o.startColumn,o.endLineNumber+30,o.endColumn));n.length===0||!x.areIntersectingOrTouching(n[n.length-1],r)?n.push(r):n[n.length-1]=x.plusRange(n[n.length-1],r)}return n}_updateHintsDecorators(e,t){var i,n;const o=[],r=(_,v,b,C,w)=>{const y={content:b,inlineClassNameAffectsLetterSpacing:!0,inlineClassName:v.className,cursorStops:C,attachedData:w};o.push({item:_,classNameRef:v,decoration:{range:_.anchor.range,options:{description:"InlayHint",showIfCollapsed:_.anchor.range.isEmpty(),collapseOnReplaceEdit:!_.anchor.range.isEmpty(),stickiness:0,[_.anchor.direction]:this._activeRenderMode===0?y:void 0}}})},a=(_,v)=>{const b=this._ruleFactory.createClassNameRef({width:`${l/3|0}px`,display:"inline-block"});r(_,b," ",v?aa.Right:aa.None)},{fontSize:l,fontFamily:d,padding:c,isUniform:u}=this._getLayoutInfo(),h="--code-editorInlayHintsFontFamily";this._editor.getContainerDomNode().style.setProperty(h,d);let g={line:0,totalLen:0};for(const _ of t){if(g.line!==_.anchor.range.startLineNumber&&(g={line:_.anchor.range.startLineNumber,totalLen:0}),g.totalLen>zp._MAX_LABEL_LEN)continue;_.hint.paddingLeft&&a(_,!1);const v=typeof _.hint.label=="string"?[{label:_.hint.label}]:_.hint.label;for(let b=0;b0&&(L=L.slice(0,-I)+"…",E=!0),r(_,this._ruleFactory.createClassNameRef(S),$ke(L),y&&!_.hint.paddingRight?aa.Right:aa.None,new XM(_,b)),E)break}if(_.hint.paddingRight&&a(_,!0),o.length>zp._MAX_DECORATORS)break}const f=[];for(const[_,v]of this._decorationsMetadata){const b=(n=this._editor.getModel())===null||n===void 0?void 0:n.getDecorationRange(_);b&&e.some(C=>C.containsRange(b))&&(f.push(_),v.classNameRef.dispose(),this._decorationsMetadata.delete(_))}const m=cl.capture(this._editor);this._editor.changeDecorations(_=>{const v=_.deltaDecorations(f,o.map(b=>b.decoration));for(let b=0;bi)&&(o=i);const r=e.fontFamily||n;return{fontSize:o,fontFamily:r,padding:t,isUniform:!t&&r===n&&o===i}}_removeAllDecorations(){this._editor.removeDecorations(Array.from(this._decorationsMetadata.keys()));for(const e of this._decorationsMetadata.values())e.classNameRef.dispose();this._decorationsMetadata.clear()}};Oh.ID="editor.contrib.InlayHints";Oh._MAX_DECORATORS=1500;Oh._MAX_LABEL_LEN=43;Oh=zp=zke([Ap(1,be),Ap(2,Ur),Ap(3,Uq),Ap(4,ui),Ap(5,en),Ap(6,Ne)],Oh);function $ke(s){return s.replace(/[ \t]/g," ")}pt.registerCommand("_executeInlayHintProvider",async(s,...e)=>{const[t,i]=e;yt(Ae.isUri(t)),yt(x.isIRange(i));const{inlayHintsProvider:n}=s.get(be),o=await s.get(po).createModelReference(t);try{const r=await lf.create(n,o.object.textEditorModel,[x.lift(i)],dt.None),a=r.items.map(l=>l.hint);return setTimeout(()=>r.dispose(),0),a}finally{o.dispose()}});var jke=function(s,e,t,i){var n=arguments.length,o=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,e,t,i);else for(var a=s.length-1;a>=0;a--)(r=s[a])&&(o=(n<3?r(o):n>3?r(e,t,o):r(e,t))||o);return n>3&&o&&Object.defineProperty(e,t,o),o},bg=function(s,e){return function(t,i){e(t,i,s)}};class V7 extends af{constructor(e,t,i,n){super(10,t,e.item.anchor.range,i,n,!0),this.part=e}}let gL=class extends IC{constructor(e,t,i,n,o,r,a,l){super(e,t,i,r,l,n,o),this._resolverService=a,this.hoverOrdinal=6}suggestHoverAnchor(e){var t;if(!Oh.get(this._editor)||e.target.type!==6)return null;const n=(t=e.target.detail.injectedText)===null||t===void 0?void 0:t.options;return n instanceof kh&&n.attachedData instanceof XM?new V7(n.attachedData,this,e.event.posx,e.event.posy):null}computeSync(){return[]}computeAsync(e,t,i){return e instanceof V7?new Xi(async n=>{const{part:o}=e;if(await o.item.resolve(i),i.isCancellationRequested)return;let r;typeof o.item.hint.tooltip=="string"?r=new ss().appendText(o.item.hint.tooltip):o.item.hint.tooltip&&(r=o.item.hint.tooltip),r&&n.emitOne(new Ka(this,e.range,[r],!1,0)),rs(o.item.hint.textEdits)&&n.emitOne(new Ka(this,e.range,[new ss().appendText(p("hint.dbl","Double-click to insert"))],!1,10001));let a;if(typeof o.part.tooltip=="string"?a=new ss().appendText(o.part.tooltip):o.part.tooltip&&(a=o.part.tooltip),a&&n.emitOne(new Ka(this,e.range,[a],!1,1)),o.part.location||o.part.command){let d;const u=this._editor.getOption(78)==="altKey"?lt?p("links.navigate.kb.meta.mac","cmd + click"):p("links.navigate.kb.meta","ctrl + click"):lt?p("links.navigate.kb.alt.mac","option + click"):p("links.navigate.kb.alt","alt + click");o.part.location&&o.part.command?d=new ss().appendText(p("hint.defAndCommand","Go to Definition ({0}), right click for more",u)):o.part.location?d=new ss().appendText(p("hint.def","Go to Definition ({0})",u)):o.part.command&&(d=new ss(`[${p("hint.cmd","Execute Command")}](${bke(o.part.command)} "${o.part.command.title}") (${u})`,{isTrusted:!0})),d&&n.emitOne(new Ka(this,e.range,[d],!1,1e4))}const l=await this._resolveInlayHintLabelPartHover(o,i);for await(const d of l)n.emitOne(d)}):Xi.EMPTY}async _resolveInlayHintLabelPartHover(e,t){if(!e.part.location)return Xi.EMPTY;const{uri:i,range:n}=e.part.location,o=await this._resolverService.createModelReference(i);try{const r=o.object.textEditorModel;return this._languageFeaturesService.hoverProvider.has(r)?v4(this._languageFeaturesService.hoverProvider,r,new W(n.startLineNumber,n.startColumn),t).filter(a=>!v_(a.hover.contents)).map(a=>new Ka(this,e.item.anchor.range,a.hover.contents,!1,2+a.ordinal)):Xi.EMPTY}finally{o.dispose()}}};gL=jke([bg(1,vi),bg(2,Oo),bg(3,At),bg(4,Nd),bg(5,rt),bg(6,po),bg(7,be)],gL);class fL{get anchor(){return this._anchor}set anchor(e){this._anchor=e}get shouldFocus(){return this._shouldFocus}set shouldFocus(e){this._shouldFocus=e}get source(){return this._source}set source(e){this._source=e}get insistOnKeepingHoverVisible(){return this._insistOnKeepingHoverVisible}set insistOnKeepingHoverVisible(e){this._insistOnKeepingHoverVisible=e}constructor(e,t){this._editor=e,this._participants=t,this._anchor=null,this._shouldFocus=!1,this._source=0,this._insistOnKeepingHoverVisible=!1}static _getLineDecorations(e,t){if(t.type!==1&&!t.supportsMarkerHover)return[];const i=e.getModel(),n=t.range.startLineNumber;if(n>i.getLineCount())return[];const o=i.getLineMaxColumn(n);return e.getLineDecorations(n).filter(r=>{if(r.options.isWholeLine)return!0;const a=r.range.startLineNumber===n?r.range.startColumn:1,l=r.range.endLineNumber===n?r.range.endColumn:o;if(r.options.showIfCollapsed){if(a>t.range.startColumn+1||t.range.endColumn-1>l)return!1}else if(a>t.range.startColumn||t.range.endColumn>l)return!1;return!0})}computeAsync(e){const t=this._anchor;if(!this._editor.hasModel()||!t)return Xi.EMPTY;const i=fL._getLineDecorations(this._editor,t);return Xi.merge(this._participants.map(n=>n.computeAsync?n.computeAsync(t,i,e):Xi.EMPTY))}computeSync(){if(!this._editor.hasModel()||!this._anchor)return[];const e=fL._getLineDecorations(this._editor,this._anchor);let t=[];for(const i of this._participants)t=t.concat(i.computeSync(this._anchor,e));return fd(t)}}class $q{constructor(e,t,i){this.anchor=e,this.messages=t,this.isComplete=i}filter(e){const t=this.messages.filter(i=>i.isValidForHoverAnchor(e));return t.length===this.messages.length?this:new Kke(this,this.anchor,t,this.isComplete)}}class Kke extends $q{constructor(e,t,i,n){super(t,i,n),this.original=e}filter(e){return this.original.filter(e)}}class qke{constructor(e,t,i,n,o,r,a,l,d,c){this.initialMousePosX=e,this.initialMousePosY=t,this.colorPicker=i,this.showAtPosition=n,this.showAtSecondaryPosition=o,this.preferAbove=r,this.stoleFocus=a,this.source=l,this.isBeforeContent=d,this.disposables=c,this.closestMouseDistance=void 0}}var Gke=function(s,e,t,i){var n=arguments.length,o=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,e,t,i);else for(var a=s.length-1;a>=0;a--)(r=s[a])&&(o=(n<3?r(o):n>3?r(e,t,o):r(e,t))||o);return n>3&&o&&Object.defineProperty(e,t,o),o},Zke=function(s,e){return function(t,i){e(t,i,s)}};const z7=he;let pL=class extends V{get hasContent(){return this._hasContent}constructor(e){super(),this._keybindingService=e,this._hasContent=!1,this.hoverElement=z7("div.hover-row.status-bar"),this.hoverElement.tabIndex=0,this.actionsElement=Q(this.hoverElement,z7("div.actions"))}addAction(e){const t=this._keybindingService.lookupKeybinding(e.commandId),i=t?t.getLabel():null;return this._hasContent=!0,this._register(Px.render(this.actionsElement,e,i))}append(e){const t=Q(this.actionsElement,e);return this._hasContent=!0,t}};pL=Gke([Zke(0,At)],pL);var Xke=function(s,e,t,i){var n=arguments.length,o=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,e,t,i);else for(var a=s.length-1;a>=0;a--)(r=s[a])&&(o=(n<3?r(o):n>3?r(e,t,o):r(e,t))||o);return n>3&&o&&Object.defineProperty(e,t,o),o},U7=function(s,e){return function(t,i){e(t,i,s)}},cS;let mL=cS=class extends V{constructor(e,t,i){super(),this._editor=e,this._instantiationService=t,this._keybindingService=i,this._currentResult=null,this._widget=this._register(this._instantiationService.createInstance(M_,this._editor)),this._participants=[];for(const n of tg.getAll()){const o=this._instantiationService.createInstance(n,this._editor);o instanceof IC&&!(o instanceof gL)&&(this._markdownHoverParticipant=o),this._participants.push(o)}this._participants.sort((n,o)=>n.hoverOrdinal-o.hoverOrdinal),this._computer=new fL(this._editor,this._participants),this._hoverOperation=this._register(new Lq(this._editor,this._computer)),this._register(this._hoverOperation.onResult(n=>{if(!this._computer.anchor)return;const o=n.hasLoadingMessage?this._addLoadingMessage(n.value):n.value;this._withResult(new $q(this._computer.anchor,o,n.isComplete))})),this._register(Ti(this._widget.getDomNode(),"keydown",n=>{n.equals(9)&&this.hide()})),this._register(Ki.onDidChange(()=>{this._widget.position&&this._currentResult&&this._setCurrentResult(this._currentResult)}))}_startShowingOrUpdateHover(e,t,i,n,o){return!this._widget.position||!this._currentResult?e?(this._startHoverOperationIfNecessary(e,t,i,n,!1),!0):!1:this._editor.getOption(60).sticky&&o&&this._widget.isMouseGettingCloser(o.event.posx,o.event.posy)?(e&&this._startHoverOperationIfNecessary(e,t,i,n,!0),!0):e?e&&this._currentResult.anchor.equals(e)?!0:e.canAdoptVisibleHover(this._currentResult.anchor,this._widget.position)?(this._setCurrentResult(this._currentResult.filter(e)),this._startHoverOperationIfNecessary(e,t,i,n,!1),!0):(this._setCurrentResult(null),this._startHoverOperationIfNecessary(e,t,i,n,!1),!0):(this._setCurrentResult(null),!1)}_startHoverOperationIfNecessary(e,t,i,n,o){this._computer.anchor&&this._computer.anchor.equals(e)||(this._hoverOperation.cancel(),this._computer.anchor=e,this._computer.shouldFocus=n,this._computer.source=i,this._computer.insistOnKeepingHoverVisible=o,this._hoverOperation.start(t))}_setCurrentResult(e){this._currentResult!==e&&(e&&e.messages.length===0&&(e=null),this._currentResult=e,this._currentResult?this._renderMessages(this._currentResult.anchor,this._currentResult.messages):this._widget.hide())}_addLoadingMessage(e){if(this._computer.anchor){for(const t of this._participants)if(t.createLoadingMessage){const i=t.createLoadingMessage(this._computer.anchor);if(i)return e.slice(0).concat([i])}}return e}_withResult(e){this._widget.position&&this._currentResult&&this._currentResult.isComplete&&(!e.isComplete||this._computer.insistOnKeepingHoverVisible&&e.messages.length===0)||this._setCurrentResult(e)}_renderMessages(e,t){const{showAtPosition:i,showAtSecondaryPosition:n,highlightRange:o}=cS.computeHoverRanges(this._editor,e.range,t),r=new Y,a=r.add(new pL(this._keybindingService)),l=document.createDocumentFragment();let d=null;const c={fragment:l,statusBar:a,setColorPicker:h=>d=h,onContentsChanged:()=>this._widget.onContentsChanged(),setMinimumDimensions:h=>this._widget.setMinimumDimensions(h),hide:()=>this.hide()};for(const h of this._participants){const g=t.filter(f=>f.owner===h);g.length>0&&r.add(h.renderHoverParts(c,g))}const u=t.some(h=>h.isBeforeContent);if(a.hasContent&&l.appendChild(a.hoverElement),l.hasChildNodes()){if(o){const h=this._editor.createDecorationsCollection();h.set([{range:o,options:cS._DECORATION_OPTIONS}]),r.add(Ie(()=>{h.clear()}))}this._widget.showAt(l,new qke(e.initialMousePosX,e.initialMousePosY,d,i,n,this._editor.getOption(60).above,this._computer.shouldFocus,this._computer.source,u,r))}else r.dispose()}static computeHoverRanges(e,t,i){let n=1;if(e.hasModel()){const u=e._getViewModel(),h=u.coordinatesConverter,g=h.convertModelRangeToViewRange(t),f=new W(g.startLineNumber,u.getLineMinColumn(g.startLineNumber));n=h.convertViewPositionToModelPosition(f).column}const o=t.startLineNumber;let r=t.startColumn,a=i[0].range,l=null;for(const u of i)a=x.plusRange(a,u.range),u.range.startLineNumber===o&&u.range.endLineNumber===o&&(r=Math.max(Math.min(r,u.range.startColumn),n)),u.forceShowAtRange&&(l=u.range);const d=l?l.getStartPosition():new W(o,t.startColumn),c=l?l.getStartPosition():new W(o,r);return{showAtPosition:d,showAtSecondaryPosition:c,highlightRange:a}}showsOrWillShow(e){if(this._widget.isResizing)return!0;const t=[];for(const n of this._participants)if(n.suggestHoverAnchor){const o=n.suggestHoverAnchor(e);o&&t.push(o)}const i=e.target;if(i.type===6&&t.push(new sT(0,i.range,e.event.posx,e.event.posy)),i.type===7){const n=this._editor.getOption(50).typicalHalfwidthCharacterWidth/2;!i.detail.isAfterLines&&typeof i.detail.horizontalDistanceToText=="number"&&i.detail.horizontalDistanceToTexto.priority-n.priority),this._startShowingOrUpdateHover(t[0],0,0,!1,e))}startShowingAtRange(e,t,i,n){this._startShowingOrUpdateHover(new sT(0,e,void 0,void 0),t,i,n,null)}async updateFocusedMarkdownHoverVerbosityLevel(e){var t;(t=this._markdownHoverParticipant)===null||t===void 0||t.updateFocusedMarkdownHoverPartVerbosityLevel(e)}containsNode(e){return e?this._widget.getDomNode().contains(e):!1}focus(){this._widget.focus()}scrollUp(){this._widget.scrollUp()}scrollDown(){this._widget.scrollDown()}scrollLeft(){this._widget.scrollLeft()}scrollRight(){this._widget.scrollRight()}pageUp(){this._widget.pageUp()}pageDown(){this._widget.pageDown()}goToTop(){this._widget.goToTop()}goToBottom(){this._widget.goToBottom()}hide(){this._computer.anchor=null,this._hoverOperation.cancel(),this._setCurrentResult(null)}get isColorPickerVisible(){return this._widget.isColorPickerVisible}get isVisibleFromKeyboard(){return this._widget.isVisibleFromKeyboard}get isVisible(){return this._widget.isVisible}get isFocused(){return this._widget.isFocused}get isResizing(){return this._widget.isResizing}get widget(){return this._widget}};mL._DECORATION_OPTIONS=Xe.register({description:"content-hover-highlight",className:"hoverHighlight"});mL=cS=Xke([U7(1,Ne),U7(2,At)],mL);class Yke{get lineNumber(){return this._lineNumber}set lineNumber(e){this._lineNumber=e}get lane(){return this._laneOrLine}set lane(e){this._laneOrLine=e}constructor(e){this._editor=e,this._lineNumber=-1,this._laneOrLine=_d.Center}computeSync(){var e,t;const i=a=>({value:a}),n=this._editor.getLineDecorations(this._lineNumber),o=[],r=this._laneOrLine==="lineNo";if(!n)return o;for(const a of n){const l=(t=(e=a.options.glyphMargin)===null||e===void 0?void 0:e.position)!==null&&t!==void 0?t:_d.Center;if(!r&&l!==this._laneOrLine)continue;const d=r?a.options.lineNumberHoverMessage:a.options.glyphMarginHoverMessage;!d||v_(d)||o.push(...RP(d).map(i))}return o}}const $7=he;class MC extends V{constructor(e,t,i){super(),this._renderDisposeables=this._register(new Y),this._editor=e,this._isVisible=!1,this._messages=[],this._hover=this._register(new cO),this._hover.containerDomNode.classList.toggle("hidden",!this._isVisible),this._markdownRenderer=this._register(new Cd({editor:this._editor},t,i)),this._computer=new Yke(this._editor),this._hoverOperation=this._register(new Lq(this._editor,this._computer)),this._register(this._hoverOperation.onResult(n=>{this._withResult(n.value)})),this._register(this._editor.onDidChangeModelDecorations(()=>this._onModelDecorationsChanged())),this._register(this._editor.onDidChangeConfiguration(n=>{n.hasChanged(50)&&this._updateFont()})),this._editor.addOverlayWidget(this)}dispose(){this._editor.removeOverlayWidget(this),super.dispose()}getId(){return MC.ID}getDomNode(){return this._hover.containerDomNode}getPosition(){return null}_updateFont(){Array.prototype.slice.call(this._hover.contentsDomNode.getElementsByClassName("code")).forEach(t=>this._editor.applyFontInfo(t))}_onModelDecorationsChanged(){this._isVisible&&(this._hoverOperation.cancel(),this._hoverOperation.start(0))}showsOrWillShow(e){const t=e.target;return t.type===2&&t.detail.glyphMarginLane?(this._startShowingAt(t.position.lineNumber,t.detail.glyphMarginLane),!0):t.type===3?(this._startShowingAt(t.position.lineNumber,"lineNo"),!0):!1}_startShowingAt(e,t){this._computer.lineNumber===e&&this._computer.lane===t||(this._hoverOperation.cancel(),this.hide(),this._computer.lineNumber=e,this._computer.lane=t,this._hoverOperation.start(0))}hide(){this._computer.lineNumber=-1,this._hoverOperation.cancel(),this._isVisible&&(this._isVisible=!1,this._hover.containerDomNode.classList.toggle("hidden",!this._isVisible))}_withResult(e){this._messages=e,this._messages.length>0?this._renderMessages(this._computer.lineNumber,this._messages):this.hide()}_renderMessages(e,t){this._renderDisposeables.clear();const i=document.createDocumentFragment();for(const n of t){const o=$7("div.hover-row.markdown-hover"),r=Q(o,$7("div.hover-contents")),a=this._renderDisposeables.add(this._markdownRenderer.render(n.value));r.appendChild(a.element),i.appendChild(o)}this._updateContents(i),this._showAt(e)}_updateContents(e){this._hover.contentsDomNode.textContent="",this._hover.contentsDomNode.appendChild(e),this._updateFont()}_showAt(e){this._isVisible||(this._isVisible=!0,this._hover.containerDomNode.classList.toggle("hidden",!this._isVisible));const t=this._editor.getLayoutInfo(),i=this._editor.getTopForLineNumber(e),n=this._editor.getScrollTop(),o=this._editor.getOption(67),r=this._hover.containerDomNode.clientHeight,a=i-n-(r-o)/2,l=t.glyphMarginLeft+t.glyphMarginWidth+(this._computer.lane==="lineNo"?t.lineNumbersWidth:0);this._hover.containerDomNode.style.left=`${l}px`,this._hover.containerDomNode.style.top=`${Math.max(Math.round(a),0)}px`}}MC.ID="editor.contrib.modesGlyphHoverWidget";var Qke=function(s,e,t,i){var n=arguments.length,o=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,e,t,i);else for(var a=s.length-1;a>=0;a--)(r=s[a])&&(o=(n<3?r(o):n>3?r(e,t,o):r(e,t))||o);return n>3&&o&&Object.defineProperty(e,t,o),o},j7=function(s,e){return function(t,i){e(t,i,s)}},YM;const Jke=!1;let ws=YM=class extends V{constructor(e,t,i){super(),this._editor=e,this._instantiationService=t,this._keybindingService=i,this._listenersStore=new Y,this._hoverState={mouseDown:!1,activatedByDecoratorClick:!1},this._reactToEditorMouseMoveRunner=this._register(new Ht(()=>this._reactToEditorMouseMove(this._mouseMoveEvent),0)),this._hookListeners(),this._register(this._editor.onDidChangeConfiguration(n=>{n.hasChanged(60)&&(this._unhookListeners(),this._hookListeners())}))}static get(e){return e.getContribution(YM.ID)}_hookListeners(){const e=this._editor.getOption(60);this._hoverSettings={enabled:e.enabled,sticky:e.sticky,hidingDelay:e.delay},e.enabled?(this._listenersStore.add(this._editor.onMouseDown(t=>this._onEditorMouseDown(t))),this._listenersStore.add(this._editor.onMouseUp(()=>this._onEditorMouseUp())),this._listenersStore.add(this._editor.onMouseMove(t=>this._onEditorMouseMove(t))),this._listenersStore.add(this._editor.onKeyDown(t=>this._onKeyDown(t)))):(this._listenersStore.add(this._editor.onMouseMove(t=>this._onEditorMouseMove(t))),this._listenersStore.add(this._editor.onKeyDown(t=>this._onKeyDown(t)))),this._listenersStore.add(this._editor.onMouseLeave(t=>this._onEditorMouseLeave(t))),this._listenersStore.add(this._editor.onDidChangeModel(()=>{this._cancelScheduler(),this._hideWidgets()})),this._listenersStore.add(this._editor.onDidChangeModelContent(()=>this._cancelScheduler())),this._listenersStore.add(this._editor.onDidScrollChange(t=>this._onEditorScrollChanged(t)))}_unhookListeners(){this._listenersStore.clear()}_cancelScheduler(){this._mouseMoveEvent=void 0,this._reactToEditorMouseMoveRunner.cancel()}_onEditorScrollChanged(e){(e.scrollTopChanged||e.scrollLeftChanged)&&this._hideWidgets()}_onEditorMouseDown(e){this._hoverState.mouseDown=!0,!this._shouldNotHideCurrentHoverWidget(e)&&this._hideWidgets()}_shouldNotHideCurrentHoverWidget(e){return!!(this._isMouseOnContentHoverWidget(e)||this._isMouseOnMarginHoverWidget(e)||this._isContentWidgetResizing())}_isMouseOnMarginHoverWidget(e){const t=e.target;return t?t.type===12&&t.detail===MC.ID:!1}_isMouseOnContentHoverWidget(e){const t=e.target;return t?t.type===9&&t.detail===M_.ID:!1}_onEditorMouseUp(){this._hoverState.mouseDown=!1}_onEditorMouseLeave(e){this._cancelScheduler(),!this._shouldNotHideCurrentHoverWidget(e)&&this._hideWidgets()}_shouldNotRecomputeCurrentHoverWidget(e){const t=this._hoverSettings.sticky,i=(a,l)=>{const d=this._isMouseOnMarginHoverWidget(a);return l&&d},n=(a,l)=>{const d=this._isMouseOnContentHoverWidget(a);return l&&d},o=a=>{var l;const d=this._isMouseOnContentHoverWidget(a),c=(l=this._contentWidget)===null||l===void 0?void 0:l.isColorPickerVisible;return d&&c},r=(a,l)=>{var d,c,u,h;return l&&((d=this._contentWidget)===null||d===void 0?void 0:d.containsNode((c=a.event.browserEvent.view)===null||c===void 0?void 0:c.document.activeElement))&&!(!((h=(u=a.event.browserEvent.view)===null||u===void 0?void 0:u.getSelection())===null||h===void 0)&&h.isCollapsed)};return!!(i(e,t)||n(e,t)||o(e)||r(e,t))}_onEditorMouseMove(e){var t,i,n,o;if(this._mouseMoveEvent=e,!((t=this._contentWidget)===null||t===void 0)&&t.isFocused||!((i=this._contentWidget)===null||i===void 0)&&i.isResizing)return;const r=this._hoverSettings.sticky;if(r&&(!((n=this._contentWidget)===null||n===void 0)&&n.isVisibleFromKeyboard))return;if(this._shouldNotRecomputeCurrentHoverWidget(e)){this._reactToEditorMouseMoveRunner.cancel();return}const l=this._hoverSettings.hidingDelay;if(((o=this._contentWidget)===null||o===void 0?void 0:o.isVisible)&&r&&l>0){this._reactToEditorMouseMoveRunner.isScheduled()||this._reactToEditorMouseMoveRunner.schedule(l);return}this._reactToEditorMouseMove(e)}_reactToEditorMouseMove(e){var t;if(!e)return;const n=(t=e.target.element)===null||t===void 0?void 0:t.classList.contains("colorpicker-color-decoration"),o=this._editor.getOption(148),r=this._hoverSettings.enabled,a=this._hoverState.activatedByDecoratorClick;if(n&&(o==="click"&&!a||o==="hover"&&!r&&!Jke||o==="clickAndHover"&&!r&&!a)||!n&&!r&&!a){this._hideWidgets();return}this._tryShowHoverWidget(e,0)||this._tryShowHoverWidget(e,1)||this._hideWidgets()}_tryShowHoverWidget(e,t){const i=this._getOrCreateContentWidget(),n=this._getOrCreateGlyphWidget();let o,r;switch(t){case 0:o=i,r=n;break;case 1:o=n,r=i;break;default:throw new Error(`HoverWidgetType ${t} is unrecognized`)}const a=o.showsOrWillShow(e);return a&&r.hide(),a}_onKeyDown(e){var t;if(!this._editor.hasModel())return;const i=this._keybindingService.softDispatch(e,this._editor.getDomNode()),n=i.kind===1||i.kind===2&&(i.commandId===wq||i.commandId===f4||i.commandId===p4)&&((t=this._contentWidget)===null||t===void 0?void 0:t.isVisible);e.keyCode===5||e.keyCode===6||e.keyCode===57||e.keyCode===4||n||this._hideWidgets()}_hideWidgets(){var e,t,i;this._hoverState.mouseDown&&(!((e=this._contentWidget)===null||e===void 0)&&e.isColorPickerVisible)||Rh.dropDownVisible||(this._hoverState.activatedByDecoratorClick=!1,(t=this._glyphWidget)===null||t===void 0||t.hide(),(i=this._contentWidget)===null||i===void 0||i.hide())}_getOrCreateContentWidget(){return this._contentWidget||(this._contentWidget=this._instantiationService.createInstance(mL,this._editor)),this._contentWidget}_getOrCreateGlyphWidget(){return this._glyphWidget||(this._glyphWidget=this._instantiationService.createInstance(MC,this._editor)),this._glyphWidget}showContentHover(e,t,i,n,o=!1){this._hoverState.activatedByDecoratorClick=o,this._getOrCreateContentWidget().startShowingAtRange(e,t,i,n)}_isContentWidgetResizing(){var e;return((e=this._contentWidget)===null||e===void 0?void 0:e.widget.isResizing)||!1}updateFocusedMarkdownHoverVerbosityLevel(e){this._getOrCreateContentWidget().updateFocusedMarkdownHoverVerbosityLevel(e)}focus(){var e;(e=this._contentWidget)===null||e===void 0||e.focus()}scrollUp(){var e;(e=this._contentWidget)===null||e===void 0||e.scrollUp()}scrollDown(){var e;(e=this._contentWidget)===null||e===void 0||e.scrollDown()}scrollLeft(){var e;(e=this._contentWidget)===null||e===void 0||e.scrollLeft()}scrollRight(){var e;(e=this._contentWidget)===null||e===void 0||e.scrollRight()}pageUp(){var e;(e=this._contentWidget)===null||e===void 0||e.pageUp()}pageDown(){var e;(e=this._contentWidget)===null||e===void 0||e.pageDown()}goToTop(){var e;(e=this._contentWidget)===null||e===void 0||e.goToTop()}goToBottom(){var e;(e=this._contentWidget)===null||e===void 0||e.goToBottom()}get isColorPickerVisible(){var e;return(e=this._contentWidget)===null||e===void 0?void 0:e.isColorPickerVisible}get isHoverVisible(){var e;return(e=this._contentWidget)===null||e===void 0?void 0:e.isVisible}dispose(){var e,t;super.dispose(),this._unhookListeners(),this._listenersStore.dispose(),(e=this._glyphWidget)===null||e===void 0||e.dispose(),(t=this._contentWidget)===null||t===void 0||t.dispose()}};ws.ID="editor.contrib.hover";ws=YM=Qke([j7(1,Ne),j7(2,At)],ws);class QM extends V{constructor(e){super(),this._editor=e,this._register(e.onMouseDown(t=>this.onMouseDown(t)))}dispose(){super.dispose()}onMouseDown(e){const t=this._editor.getOption(148);if(t!=="click"&&t!=="clickAndHover")return;const i=e.target;if(i.type!==6||!i.detail.injectedText||i.detail.injectedText.options.attachedData!==fq||!i.range)return;const n=this._editor.getContribution(ws.ID);if(n&&!n.isColorPickerVisible){const o=new x(i.range.startLineNumber,i.range.startColumn+1,i.range.endLineNumber,i.range.endColumn+1);n.showContentHover(o,1,0,!1,!0)}}}QM.ID="editor.contrib.colorContribution";kt(QM.ID,QM,2);tg.register(cL);var jq=function(s,e,t,i){var n=arguments.length,o=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,e,t,i);else for(var a=s.length-1;a>=0;a--)(r=s[a])&&(o=(n<3?r(o):n>3?r(e,t,o):r(e,t))||o);return n>3&&o&&Object.defineProperty(e,t,o),o},za=function(s,e){return function(t,i){e(t,i,s)}},JM,eR;let Bh=JM=class extends V{constructor(e,t,i,n,o,r,a){super(),this._editor=e,this._modelService=i,this._keybindingService=n,this._instantiationService=o,this._languageFeatureService=r,this._languageConfigurationService=a,this._standaloneColorPickerWidget=null,this._standaloneColorPickerVisible=T.standaloneColorPickerVisible.bindTo(t),this._standaloneColorPickerFocused=T.standaloneColorPickerFocused.bindTo(t)}showOrFocus(){var e;this._editor.hasModel()&&(this._standaloneColorPickerVisible.get()?this._standaloneColorPickerFocused.get()||(e=this._standaloneColorPickerWidget)===null||e===void 0||e.focus():this._standaloneColorPickerWidget=new _L(this._editor,this._standaloneColorPickerVisible,this._standaloneColorPickerFocused,this._instantiationService,this._modelService,this._keybindingService,this._languageFeatureService,this._languageConfigurationService))}hide(){var e;this._standaloneColorPickerFocused.set(!1),this._standaloneColorPickerVisible.set(!1),(e=this._standaloneColorPickerWidget)===null||e===void 0||e.hide(),this._editor.focus()}insertColor(){var e;(e=this._standaloneColorPickerWidget)===null||e===void 0||e.updateEditor(),this.hide()}static get(e){return e.getContribution(JM.ID)}};Bh.ID="editor.contrib.standaloneColorPickerController";Bh=JM=jq([za(1,Be),za(2,_i),za(3,At),za(4,Ne),za(5,be),za(6,Yt)],Bh);kt(Bh.ID,Bh,1);const K7=8,eEe=22;let _L=eR=class extends V{constructor(e,t,i,n,o,r,a,l){var d;super(),this._editor=e,this._standaloneColorPickerVisible=t,this._standaloneColorPickerFocused=i,this._modelService=o,this._keybindingService=r,this._languageFeaturesService=a,this._languageConfigurationService=l,this.allowEditorOverflow=!0,this._position=void 0,this._body=document.createElement("div"),this._colorHover=null,this._selectionSetInEditor=!1,this._onResult=this._register(new B),this.onResult=this._onResult.event,this._standaloneColorPickerVisible.set(!0),this._standaloneColorPickerParticipant=n.createInstance(EC,this._editor),this._position=(d=this._editor._getViewModel())===null||d===void 0?void 0:d.getPrimaryCursorState().modelState.position;const c=this._editor.getSelection(),u=c?{startLineNumber:c.startLineNumber,startColumn:c.startColumn,endLineNumber:c.endLineNumber,endColumn:c.endColumn}:{startLineNumber:0,endLineNumber:0,endColumn:0,startColumn:0},h=this._register(Ca(this._body));this._register(h.onDidBlur(g=>{this.hide()})),this._register(h.onDidFocus(g=>{this.focus()})),this._register(this._editor.onDidChangeCursorPosition(()=>{this._selectionSetInEditor?this._selectionSetInEditor=!1:this.hide()})),this._register(this._editor.onMouseMove(g=>{var f;const m=(f=g.target.element)===null||f===void 0?void 0:f.classList;m&&m.contains("colorpicker-color-decoration")&&this.hide()})),this._register(this.onResult(g=>{this._render(g.value,g.foundInEditor)})),this._start(u),this._body.style.zIndex="50",this._editor.addContentWidget(this)}updateEditor(){this._colorHover&&this._standaloneColorPickerParticipant.updateEditorModel(this._colorHover)}getId(){return eR.ID}getDomNode(){return this._body}getPosition(){if(!this._position)return null;const e=this._editor.getOption(60).above;return{position:this._position,secondaryPosition:this._position,preference:e?[1,2]:[2,1],positionAffinity:2}}hide(){this.dispose(),this._standaloneColorPickerVisible.set(!1),this._standaloneColorPickerFocused.set(!1),this._editor.removeContentWidget(this),this._editor.focus()}focus(){this._standaloneColorPickerFocused.set(!0),this._body.focus()}async _start(e){const t=await this._computeAsync(e);t&&this._onResult.fire(new tEe(t.result,t.foundInEditor))}async _computeAsync(e){if(!this._editor.hasModel())return null;const t={range:e,color:{red:0,green:0,blue:0,alpha:1}},i=await this._standaloneColorPickerParticipant.createColorHover(t,new h4(this._modelService,this._languageConfigurationService),this._languageFeaturesService.colorProvider);return i?{result:i.colorHover,foundInEditor:i.foundInEditor}:null}_render(e,t){const i=document.createDocumentFragment(),n=this._register(new pL(this._keybindingService));let o;const r={fragment:i,statusBar:n,setColorPicker:m=>o=m,onContentsChanged:()=>{},hide:()=>this.hide()};if(this._colorHover=e,this._register(this._standaloneColorPickerParticipant.renderHoverParts(r,[e])),o===void 0)return;this._body.classList.add("standalone-colorpicker-body"),this._body.style.maxHeight=Math.max(this._editor.getLayoutInfo().height/4,250)+"px",this._body.style.maxWidth=Math.max(this._editor.getLayoutInfo().width*.66,500)+"px",this._body.tabIndex=0,this._body.appendChild(i),o.layout();const a=o.body,l=a.saturationBox.domNode.clientWidth,d=a.domNode.clientWidth-l-eEe-K7,c=o.body.enterButton;c==null||c.onClicked(()=>{this.updateEditor(),this.hide()});const u=o.header,h=u.pickedColorNode;h.style.width=l+K7+"px";const g=u.originalColorNode;g.style.width=d+"px";const f=o.header.closeButton;f==null||f.onClicked(()=>{this.hide()}),t&&(c&&(c.button.textContent="Replace"),this._selectionSetInEditor=!0,this._editor.setSelection(e.range)),this._editor.layoutContentWidget(this)}};_L.ID="editor.contrib.standaloneColorPickerWidget";_L=eR=jq([za(3,Ne),za(4,_i),za(5,At),za(6,be),za(7,Yt)],_L);class tEe{constructor(e,t){this.value=e,this.foundInEditor=t}}class iEe extends gl{constructor(){super({id:"editor.action.showOrFocusStandaloneColorPicker",title:{...Ve("showOrFocusStandaloneColorPicker","Show or Focus Standalone Color Picker"),mnemonicTitle:p({key:"mishowOrFocusStandaloneColorPicker",comment:["&& denotes a mnemonic"]},"&&Show or Focus Standalone Color Picker")},precondition:void 0,menu:[{id:k.CommandPalette}],metadata:{description:Ve("showOrFocusStandaloneColorPickerDescription","Show or focus a standalone color picker which uses the default color provider. It displays hex/rgb/hsl colors.")}})}runEditorCommand(e,t){var i;(i=Bh.get(t))===null||i===void 0||i.showOrFocus()}}class nEe extends me{constructor(){super({id:"editor.action.hideColorPicker",label:p({key:"hideColorPicker",comment:["Action that hides the color picker"]},"Hide the Color Picker"),alias:"Hide the Color Picker",precondition:T.standaloneColorPickerVisible.isEqualTo(!0),kbOpts:{primary:9,weight:100},metadata:{description:Ve("hideColorPickerDescription","Hide the standalone color picker.")}})}run(e,t){var i;(i=Bh.get(t))===null||i===void 0||i.hide()}}class sEe extends me{constructor(){super({id:"editor.action.insertColorWithStandaloneColorPicker",label:p({key:"insertColorWithStandaloneColorPicker",comment:["Action that inserts color with standalone color picker"]},"Insert Color with Standalone Color Picker"),alias:"Insert Color with Standalone Color Picker",precondition:T.standaloneColorPickerFocused.isEqualTo(!0),kbOpts:{primary:3,weight:100},metadata:{description:Ve("insertColorWithStandaloneColorPickerDescription","Insert hex/rgb/hsl colors with the focused standalone color picker.")}})}run(e,t){var i;(i=Bh.get(t))===null||i===void 0||i.insertColor()}}te(nEe);te(sEe);qt(iEe);class qu{constructor(e,t,i){this.languageConfigurationService=i,this._selection=e,this._insertSpace=t,this._usedEndToken=null}static _haystackHasNeedleAtOffset(e,t,i){if(i<0)return!1;const n=t.length,o=e.length;if(i+n>o)return!1;for(let r=0;r=65&&a<=90&&a+32===l)&&!(l>=65&&l<=90&&l+32===a))return!1}return!0}_createOperationsForBlockComment(e,t,i,n,o,r){const a=e.startLineNumber,l=e.startColumn,d=e.endLineNumber,c=e.endColumn,u=o.getLineContent(a),h=o.getLineContent(d);let g=u.lastIndexOf(t,l-1+t.length),f=h.indexOf(i,c-1-i.length);if(g!==-1&&f!==-1)if(a===d)u.substring(g+t.length,f).indexOf(i)>=0&&(g=-1,f=-1);else{const _=u.substring(g+t.length),v=h.substring(0,f);(_.indexOf(i)>=0||v.indexOf(i)>=0)&&(g=-1,f=-1)}let m;g!==-1&&f!==-1?(n&&g+t.length0&&h.charCodeAt(f-1)===32&&(i=" "+i,f-=1),m=qu._createRemoveBlockCommentOperations(new x(a,g+t.length+1,d,f+1),t,i)):(m=qu._createAddBlockCommentOperations(e,t,i,this._insertSpace),this._usedEndToken=m.length===1?i:null);for(const _ of m)r.addTrackedEditOperation(_.range,_.text)}static _createRemoveBlockCommentOperations(e,t,i){const n=[];return x.isEmpty(e)?n.push(fi.delete(new x(e.startLineNumber,e.startColumn-t.length,e.endLineNumber,e.endColumn+i.length))):(n.push(fi.delete(new x(e.startLineNumber,e.startColumn-t.length,e.startLineNumber,e.startColumn))),n.push(fi.delete(new x(e.endLineNumber,e.endColumn,e.endLineNumber,e.endColumn+i.length)))),n}static _createAddBlockCommentOperations(e,t,i,n){const o=[];return x.isEmpty(e)?o.push(fi.replace(new x(e.startLineNumber,e.startColumn,e.endLineNumber,e.endColumn),t+" "+i)):(o.push(fi.insert(new W(e.startLineNumber,e.startColumn),t+(n?" ":""))),o.push(fi.insert(new W(e.endLineNumber,e.endColumn),(n?" ":"")+i))),o}getEditOperations(e,t){const i=this._selection.startLineNumber,n=this._selection.startColumn;e.tokenization.tokenizeIfCheap(i);const o=e.getLanguageIdAtPosition(i,n),r=this.languageConfigurationService.getLanguageConfiguration(o).comments;!r||!r.blockCommentStartToken||!r.blockCommentEndToken||this._createOperationsForBlockComment(this._selection,r.blockCommentStartToken,r.blockCommentEndToken,this._insertSpace,e,t)}computeCursorState(e,t){const i=t.getInverseEditOperations();if(i.length===2){const n=i[0],o=i[1];return new we(n.range.endLineNumber,n.range.endColumn,o.range.startLineNumber,o.range.startColumn)}else{const n=i[0].range,o=this._usedEndToken?-this._usedEndToken.length-1:0;return new we(n.endLineNumber,n.endColumn+o,n.endLineNumber,n.endColumn+o)}}}class Xd{constructor(e,t,i,n,o,r,a){this.languageConfigurationService=e,this._selection=t,this._indentSize=i,this._type=n,this._insertSpace=o,this._selectionId=null,this._deltaColumn=0,this._moveEndPositionDown=!1,this._ignoreEmptyLines=r,this._ignoreFirstLine=a||!1}static _gatherPreflightCommentStrings(e,t,i,n){e.tokenization.tokenizeIfCheap(t);const o=e.getLanguageIdAtPosition(t,1),r=n.getLanguageConfiguration(o).comments,a=r?r.lineCommentToken:null;if(!a)return null;const l=[];for(let d=0,c=i-t+1;do?t[l].commentStrOffset=r-1:t[l].commentStrOffset=r}}}class w4 extends me{constructor(e,t){super(t),this._type=e}run(e,t){const i=e.get(Yt);if(!t.hasModel())return;const n=t.getModel(),o=[],r=n.getOptions(),a=t.getOption(23),l=t.getSelections().map((c,u)=>({selection:c,index:u,ignoreFirstLine:!1}));l.sort((c,u)=>x.compareRangesUsingStarts(c.selection,u.selection));let d=l[0];for(let c=1;c=0;a--)(r=s[a])&&(o=(n<3?r(o):n>3?r(e,t,o):r(e,t))||o);return n>3&&o&&Object.defineProperty(e,t,o),o},Cg=function(s,e){return function(t,i){e(t,i,s)}},tR;let F_=tR=class{static get(e){return e.getContribution(tR.ID)}constructor(e,t,i,n,o,r,a,l){this._contextMenuService=t,this._contextViewService=i,this._contextKeyService=n,this._keybindingService=o,this._menuService=r,this._configurationService=a,this._workspaceContextService=l,this._toDispose=new Y,this._contextMenuIsBeingShownCount=0,this._editor=e,this._toDispose.add(this._editor.onContextMenu(d=>this._onContextMenu(d))),this._toDispose.add(this._editor.onMouseWheel(d=>{if(this._contextMenuIsBeingShownCount>0){const c=this._contextViewService.getContextViewElement(),u=d.srcElement;u.shadowRoot&&wf(c)===u.shadowRoot||this._contextViewService.hideContextView()}})),this._toDispose.add(this._editor.onKeyDown(d=>{this._editor.getOption(24)&&d.keyCode===58&&(d.preventDefault(),d.stopPropagation(),this.showContextMenu())}))}_onContextMenu(e){if(!this._editor.hasModel())return;if(!this._editor.getOption(24)){this._editor.focus(),e.target.position&&!this._editor.getSelection().containsPosition(e.target.position)&&this._editor.setPosition(e.target.position);return}if(e.target.type===12||e.target.type===6&&e.target.detail.injectedText)return;if(e.event.preventDefault(),e.event.stopPropagation(),e.target.type===11)return this._showScrollbarContextMenu(e.event);if(e.target.type!==6&&e.target.type!==7&&e.target.type!==1)return;if(this._editor.focus(),e.target.position){let i=!1;for(const n of this._editor.getSelections())if(n.containsPosition(e.target.position)){i=!0;break}i||this._editor.setPosition(e.target.position)}let t=null;e.target.type!==1&&(t=e.event),this.showContextMenu(t)}showContextMenu(e){if(!this._editor.getOption(24)||!this._editor.hasModel())return;const t=this._getMenuActions(this._editor.getModel(),this._editor.contextMenuId);t.length>0&&this._doShowContextMenu(t,e)}_getMenuActions(e,t){const i=[],n=this._menuService.createMenu(t,this._contextKeyService),o=n.getActions({arg:e.uri});n.dispose();for(const r of o){const[,a]=r;let l=0;for(const d of a)if(d instanceof Sm){const c=this._getMenuActions(e,d.item.submenu);c.length>0&&(i.push(new n_(d.id,d.label,c)),l++)}else i.push(d),l++;l&&i.push(new rn)}return i.length&&i.pop(),i}_doShowContextMenu(e,t=null){if(!this._editor.hasModel())return;const i=this._editor.getOption(60);this._editor.updateOptions({hover:{enabled:!1}});let n=t;if(!n){this._editor.revealPosition(this._editor.getPosition(),1),this._editor.render();const r=this._editor.getScrolledVisiblePosition(this._editor.getPosition()),a=qi(this._editor.getDomNode()),l=a.left+r.left,d=a.top+r.top+r.height;n={x:l,y:d}}const o=this._editor.getOption(127)&&!pd;this._contextMenuIsBeingShownCount++,this._contextMenuService.showContextMenu({domForShadowRoot:o?this._editor.getDomNode():void 0,getAnchor:()=>n,getActions:()=>e,getActionViewItem:r=>{const a=this._keybindingFor(r);if(a)return new D_(r,r,{label:!0,keybinding:a.getLabel(),isMenu:!0});const l=r;return typeof l.getActionViewItem=="function"?l.getActionViewItem():new D_(r,r,{icon:!0,label:!0,isMenu:!0})},getKeyBinding:r=>this._keybindingFor(r),onHide:r=>{this._contextMenuIsBeingShownCount--,this._editor.updateOptions({hover:i})}})}_showScrollbarContextMenu(e){if(!this._editor.hasModel()||tbe(this._workspaceContextService.getWorkspace()))return;const t=this._editor.getOption(73);let i=0;const n=d=>({id:`menu-action-${++i}`,label:d.label,tooltip:"",class:void 0,enabled:typeof d.enabled>"u"?!0:d.enabled,checked:d.checked,run:d.run}),o=(d,c)=>new n_(`menu-action-${++i}`,d,c,void 0),r=(d,c,u,h,g)=>{if(!c)return n({label:d,enabled:c,run:()=>{}});const f=_=>()=>{this._configurationService.updateValue(u,_)},m=[];for(const _ of g)m.push(n({label:_.label,checked:h===_.value,run:f(_.value)}));return o(d,m)},a=[];a.push(n({label:p("context.minimap.minimap","Minimap"),checked:t.enabled,run:()=>{this._configurationService.updateValue("editor.minimap.enabled",!t.enabled)}})),a.push(new rn),a.push(n({label:p("context.minimap.renderCharacters","Render Characters"),enabled:t.enabled,checked:t.renderCharacters,run:()=>{this._configurationService.updateValue("editor.minimap.renderCharacters",!t.renderCharacters)}})),a.push(r(p("context.minimap.size","Vertical size"),t.enabled,"editor.minimap.size",t.size,[{label:p("context.minimap.size.proportional","Proportional"),value:"proportional"},{label:p("context.minimap.size.fill","Fill"),value:"fill"},{label:p("context.minimap.size.fit","Fit"),value:"fit"}])),a.push(r(p("context.minimap.slider","Slider"),t.enabled,"editor.minimap.showSlider",t.showSlider,[{label:p("context.minimap.slider.mouseover","Mouse Over"),value:"mouseover"},{label:p("context.minimap.slider.always","Always"),value:"always"}]));const l=this._editor.getOption(127)&&!pd;this._contextMenuIsBeingShownCount++,this._contextMenuService.showContextMenu({domForShadowRoot:l?this._editor.getDomNode():void 0,getAnchor:()=>e,getActions:()=>a,onHide:d=>{this._contextMenuIsBeingShownCount--,this._editor.focus()}})}_keybindingFor(e){return this._keybindingService.lookupKeybinding(e.id)}dispose(){this._contextMenuIsBeingShownCount>0&&this._contextViewService.hideContextView(),this._toDispose.dispose()}};F_.ID="editor.contrib.contextmenu";F_=tR=dEe([Cg(1,Fo),Cg(2,Qc),Cg(3,Be),Cg(4,At),Cg(5,dr),Cg(6,rt),Cg(7,kf)],F_);class cEe extends me{constructor(){super({id:"editor.action.showContextMenu",label:p("action.showContextMenu.label","Show Editor Context Menu"),alias:"Show Editor Context Menu",precondition:void 0,kbOpts:{kbExpr:T.textInputFocus,primary:1092,weight:100}})}run(e,t){var i;(i=F_.get(t))===null||i===void 0||i.showContextMenu()}}kt(F_.ID,F_,2);te(cEe);class rT{constructor(e){this.selections=e}equals(e){const t=this.selections.length,i=e.selections.length;if(t!==i)return!1;for(let n=0;n{this._undoStack=[],this._redoStack=[]})),this._register(e.onDidChangeModelContent(t=>{this._undoStack=[],this._redoStack=[]})),this._register(e.onDidChangeCursorSelection(t=>{if(this._isCursorUndoRedo||!t.oldSelections||t.oldModelVersionId!==t.modelVersionId)return;const i=new rT(t.oldSelections);this._undoStack.length>0&&this._undoStack[this._undoStack.length-1].cursorState.equals(i)||(this._undoStack.push(new aT(i,e.getScrollTop(),e.getScrollLeft())),this._redoStack=[],this._undoStack.length>50&&this._undoStack.shift())}))}cursorUndo(){!this._editor.hasModel()||this._undoStack.length===0||(this._redoStack.push(new aT(new rT(this._editor.getSelections()),this._editor.getScrollTop(),this._editor.getScrollLeft())),this._applyState(this._undoStack.pop()))}cursorRedo(){!this._editor.hasModel()||this._redoStack.length===0||(this._undoStack.push(new aT(new rT(this._editor.getSelections()),this._editor.getScrollTop(),this._editor.getScrollLeft())),this._applyState(this._redoStack.pop()))}_applyState(e){this._isCursorUndoRedo=!0,this._editor.setSelections(e.cursorState.selections),this._editor.setScrollPosition({scrollTop:e.scrollTop,scrollLeft:e.scrollLeft}),this._isCursorUndoRedo=!1}}Of.ID="editor.contrib.cursorUndoRedoController";class uEe extends me{constructor(){super({id:"cursorUndo",label:p("cursor.undo","Cursor Undo"),alias:"Cursor Undo",precondition:void 0,kbOpts:{kbExpr:T.textInputFocus,primary:2099,weight:100}})}run(e,t,i){var n;(n=Of.get(t))===null||n===void 0||n.cursorUndo()}}class hEe extends me{constructor(){super({id:"cursorRedo",label:p("cursor.redo","Cursor Redo"),alias:"Cursor Redo",precondition:void 0})}run(e,t,i){var n;(n=Of.get(t))===null||n===void 0||n.cursorRedo()}}kt(Of.ID,Of,0);te(uEe);te(hEe);class gEe{constructor(e,t,i){this.selection=e,this.targetPosition=t,this.copy=i,this.targetSelection=null}getEditOperations(e,t){const i=e.getValueInRange(this.selection);if(this.copy||t.addEditOperation(this.selection,null),t.addEditOperation(new x(this.targetPosition.lineNumber,this.targetPosition.column,this.targetPosition.lineNumber,this.targetPosition.column),i),this.selection.containsPosition(this.targetPosition)&&!(this.copy&&(this.selection.getEndPosition().equals(this.targetPosition)||this.selection.getStartPosition().equals(this.targetPosition)))){this.targetSelection=this.selection;return}if(this.copy){this.targetSelection=new we(this.targetPosition.lineNumber,this.targetPosition.column,this.selection.endLineNumber-this.selection.startLineNumber+this.targetPosition.lineNumber,this.selection.startLineNumber===this.selection.endLineNumber?this.targetPosition.column+this.selection.endColumn-this.selection.startColumn:this.selection.endColumn);return}if(this.targetPosition.lineNumber>this.selection.endLineNumber){this.targetSelection=new we(this.targetPosition.lineNumber-this.selection.endLineNumber+this.selection.startLineNumber,this.targetPosition.column,this.targetPosition.lineNumber,this.selection.startLineNumber===this.selection.endLineNumber?this.targetPosition.column+this.selection.endColumn-this.selection.startColumn:this.selection.endColumn);return}if(this.targetPosition.lineNumberthis._onEditorMouseDown(t))),this._register(this._editor.onMouseUp(t=>this._onEditorMouseUp(t))),this._register(this._editor.onMouseDrag(t=>this._onEditorMouseDrag(t))),this._register(this._editor.onMouseDrop(t=>this._onEditorMouseDrop(t))),this._register(this._editor.onMouseDropCanceled(()=>this._onEditorMouseDropCanceled())),this._register(this._editor.onKeyDown(t=>this.onEditorKeyDown(t))),this._register(this._editor.onKeyUp(t=>this.onEditorKeyUp(t))),this._register(this._editor.onDidBlurEditorWidget(()=>this.onEditorBlur())),this._register(this._editor.onDidBlurEditorText(()=>this.onEditorBlur())),this._mouseDown=!1,this._modifierPressed=!1,this._dragSelection=null}onEditorBlur(){this._removeDecoration(),this._dragSelection=null,this._mouseDown=!1,this._modifierPressed=!1}onEditorKeyDown(e){!this._editor.getOption(35)||this._editor.getOption(22)||(Mp(e)&&(this._modifierPressed=!0),this._mouseDown&&Mp(e)&&this._editor.updateOptions({mouseStyle:"copy"}))}onEditorKeyUp(e){!this._editor.getOption(35)||this._editor.getOption(22)||(Mp(e)&&(this._modifierPressed=!1),this._mouseDown&&e.keyCode===Nc.TRIGGER_KEY_VALUE&&this._editor.updateOptions({mouseStyle:"default"}))}_onEditorMouseDown(e){this._mouseDown=!0}_onEditorMouseUp(e){this._mouseDown=!1,this._editor.updateOptions({mouseStyle:"text"})}_onEditorMouseDrag(e){const t=e.target;if(this._dragSelection===null){const n=(this._editor.getSelections()||[]).filter(o=>t.position&&o.containsPosition(t.position));if(n.length===1)this._dragSelection=n[0];else return}Mp(e.event)?this._editor.updateOptions({mouseStyle:"copy"}):this._editor.updateOptions({mouseStyle:"default"}),t.position&&(this._dragSelection.containsPosition(t.position)?this._removeDecoration():this.showAt(t.position))}_onEditorMouseDropCanceled(){this._editor.updateOptions({mouseStyle:"text"}),this._removeDecoration(),this._dragSelection=null,this._mouseDown=!1}_onEditorMouseDrop(e){if(e.target&&(this._hitContent(e.target)||this._hitMargin(e.target))&&e.target.position){const t=new W(e.target.position.lineNumber,e.target.position.column);if(this._dragSelection===null){let i=null;if(e.event.shiftKey){const n=this._editor.getSelection();if(n){const{selectionStartLineNumber:o,selectionStartColumn:r}=n;i=[new we(o,r,t.lineNumber,t.column)]}}else i=(this._editor.getSelections()||[]).map(n=>n.containsPosition(t)?new we(t.lineNumber,t.column,t.lineNumber,t.column):n);this._editor.setSelections(i||[],"mouse",3)}else(!this._dragSelection.containsPosition(t)||(Mp(e.event)||this._modifierPressed)&&(this._dragSelection.getEndPosition().equals(t)||this._dragSelection.getStartPosition().equals(t)))&&(this._editor.pushUndoStop(),this._editor.executeCommand(Nc.ID,new gEe(this._dragSelection,t,Mp(e.event)||this._modifierPressed)),this._editor.pushUndoStop())}this._editor.updateOptions({mouseStyle:"text"}),this._removeDecoration(),this._dragSelection=null,this._mouseDown=!1}showAt(e){this._dndDecorationIds.set([{range:new x(e.lineNumber,e.column,e.lineNumber,e.column),options:Nc._DECORATION_OPTIONS}]),this._editor.revealPosition(e,1)}_removeDecoration(){this._dndDecorationIds.clear()}_hitContent(e){return e.type===6||e.type===7}_hitMargin(e){return e.type===2||e.type===3||e.type===4}dispose(){this._removeDecoration(),this._dragSelection=null,this._mouseDown=!1,this._modifierPressed=!1,super.dispose()}}Nc.ID="editor.contrib.dragAndDrop";Nc.TRIGGER_KEY_VALUE=lt?6:5;Nc._DECORATION_OPTIONS=Xe.register({description:"dnd-target",className:"dnd-target"});kt(Nc.ID,Nc,2);var ay;kt(Ld.ID,Ld,0);M1(IM);de(new class extends mn{constructor(){super({id:GK,precondition:r4,kbOpts:{weight:100,primary:2137}})}runEditorCommand(s,e){var t;return(t=Ld.get(e))===null||t===void 0?void 0:t.changePasteType()}});de(new class extends mn{constructor(){super({id:"editor.hidePasteWidget",precondition:r4,kbOpts:{weight:100,primary:9}})}runEditorCommand(s,e){var t;(t=Ld.get(e))===null||t===void 0||t.clearWidgets()}});te((ay=class extends me{constructor(){super({id:"editor.action.pasteAs",label:p("pasteAs","Paste As..."),alias:"Paste As...",precondition:T.writable,metadata:{description:"Paste as",args:[{name:"args",schema:ay.argsSchema}]}})}run(e,t,i){var n;let o=typeof(i==null?void 0:i.kind)=="string"?i.kind:void 0;return!o&&i&&(o=typeof i.id=="string"?i.id:void 0),(n=Ld.get(t))===null||n===void 0?void 0:n.pasteAs(o?new Wt(o):void 0)}},ay.argsSchema={type:"object",properties:{kind:{type:"string",description:p("pasteAs.kind","The kind of the paste edit to try applying. If not provided or there are multiple edits for this kind, the editor will show a picker.")}}},ay));te(class extends me{constructor(){super({id:"editor.action.pasteAsText",label:p("pasteAsText","Paste as Text"),alias:"Paste as Text",precondition:T.writable})}run(s,e){var t;return(t=Ld.get(e))===null||t===void 0?void 0:t.pasteAs({providerId:jc.id})}});class fEe{constructor(){this._dragOperations=new Map}removeDragOperationTransfer(e){if(e&&this._dragOperations.has(e)){const t=this._dragOperations.get(e);return this._dragOperations.delete(e),t}}}class q7{constructor(e){this.identifier=e}}const Kq=ut("treeViewsDndService");mt(Kq,fEe,1);var pEe=function(s,e,t,i){var n=arguments.length,o=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,e,t,i);else for(var a=s.length-1;a>=0;a--)(r=s[a])&&(o=(n<3?r(o):n>3?r(e,t,o):r(e,t))||o);return n>3&&o&&Object.defineProperty(e,t,o),o},ly=function(s,e){return function(t,i){e(t,i,s)}},iR;const qq="editor.experimental.dropIntoEditor.defaultProvider",Gq="editor.changeDropType",y4=new ue("dropWidgetVisible",!1,p("dropWidgetVisible","Whether the drop widget is showing"));let Bf=iR=class extends V{static get(e){return e.getContribution(iR.ID)}constructor(e,t,i,n,o){super(),this._configService=i,this._languageFeaturesService=n,this._treeViewsDragAndDropService=o,this.treeItemsTransfer=DC.getInstance(),this._dropProgressManager=this._register(t.createInstance(rL,"dropIntoEditor",e)),this._postDropWidgetManager=this._register(t.createInstance(lL,"dropIntoEditor",e,y4,{id:Gq,label:p("postDropWidgetTitle","Show drop options...")})),this._register(e.onDropIntoEditor(r=>this.onDropIntoEditor(e,r.position,r.event)))}clearWidgets(){this._postDropWidgetManager.clear()}changeDropType(){this._postDropWidgetManager.tryShowSelector()}async onDropIntoEditor(e,t,i){var n;if(!i.dataTransfer||!e.hasModel())return;(n=this._currentOperation)===null||n===void 0||n.cancel(),e.focus(),e.setPosition(t);const o=Ln(async r=>{const a=new Th(e,1,void 0,r);try{const l=await this.extractDataTransferData(i);if(l.size===0||a.token.isCancellationRequested)return;const d=e.getModel();if(!d)return;const c=this._languageFeaturesService.documentDropEditProvider.ordered(d).filter(h=>h.dropMimeTypes?h.dropMimeTypes.some(g=>l.matches(g)):!0),u=await this.getDropEdits(c,d,t,l,a);if(a.token.isCancellationRequested)return;if(u.length){const h=this.getInitialActiveEditIndex(d,u),g=e.getOption(36).showDropSelector==="afterDrop";await this._postDropWidgetManager.applyEditAndShowIfNeeded([x.fromPositions(t)],{activeEditIndex:h,allEdits:u},g,async f=>f,r)}}finally{a.dispose(),this._currentOperation===o&&(this._currentOperation=void 0)}});this._dropProgressManager.showWhile(t,p("dropIntoEditorProgress","Running drop handlers. Click to cancel"),o),this._currentOperation=o}async getDropEdits(e,t,i,n,o){const r=await d1(Promise.all(e.map(async l=>{try{const d=await l.provideDocumentDropEdits(t,i,n,o.token);return d==null?void 0:d.map(c=>({...c,providerId:l.id}))}catch(d){console.error(d)}})),o.token),a=fd(r??[]).flat();return KK(a)}getInitialActiveEditIndex(e,t){const i=this._configService.getValue(qq,{resource:e.uri});for(const[n,o]of Object.entries(i)){const r=new Wt(o),a=t.findIndex(l=>r.value===l.providerId&&l.handledMimeType&&BK(n,[l.handledMimeType]));if(a>=0)return a}return 0}async extractDataTransferData(e){if(!e.dataTransfer)return new OK;const t=VK(e.dataTransfer);if(this.treeItemsTransfer.hasData(q7.prototype)){const i=this.treeItemsTransfer.getData(q7.prototype);if(Array.isArray(i))for(const n of i){const o=await this._treeViewsDragAndDropService.removeDragOperationTransfer(n.identifier);if(o)for(const[r,a]of o)t.replace(r,a)}}return t}};Bf.ID="editor.contrib.dropIntoEditorController";Bf=iR=pEe([ly(1,Ne),ly(2,rt),ly(3,be),ly(4,Kq)],Bf);kt(Bf.ID,Bf,2);M1(EM);de(new class extends mn{constructor(){super({id:Gq,precondition:y4,kbOpts:{weight:100,primary:2137}})}runEditorCommand(s,e,t){var i;(i=Bf.get(e))===null||i===void 0||i.changeDropType()}});de(new class extends mn{constructor(){super({id:"editor.hideDropWidget",precondition:y4,kbOpts:{weight:100,primary:9}})}runEditorCommand(s,e,t){var i;(i=Bf.get(e))===null||i===void 0||i.clearWidgets()}});Ji.as(fl.Configuration).registerConfiguration({...Hx,properties:{[qq]:{type:"object",scope:5,description:p("defaultProviderDescription","Configures the default drop provider to use for content of a given mime type."),default:{},additionalProperties:{type:"string"}}}});class ps{constructor(e){this._editor=e,this._decorations=[],this._overviewRulerApproximateDecorations=[],this._findScopeDecorationIds=[],this._rangeHighlightDecorationId=null,this._highlightedDecorationId=null,this._startPosition=this._editor.getPosition()}dispose(){this._editor.removeDecorations(this._allDecorations()),this._decorations=[],this._overviewRulerApproximateDecorations=[],this._findScopeDecorationIds=[],this._rangeHighlightDecorationId=null,this._highlightedDecorationId=null}reset(){this._decorations=[],this._overviewRulerApproximateDecorations=[],this._findScopeDecorationIds=[],this._rangeHighlightDecorationId=null,this._highlightedDecorationId=null}getCount(){return this._decorations.length}getFindScope(){return this._findScopeDecorationIds[0]?this._editor.getModel().getDecorationRange(this._findScopeDecorationIds[0]):null}getFindScopes(){if(this._findScopeDecorationIds.length){const e=this._findScopeDecorationIds.map(t=>this._editor.getModel().getDecorationRange(t)).filter(t=>!!t);if(e.length)return e}return null}getStartPosition(){return this._startPosition}setStartPosition(e){this._startPosition=e,this.setCurrentFindMatch(null)}_getDecorationIndex(e){const t=this._decorations.indexOf(e);return t>=0?t+1:1}getDecorationRangeAt(e){const t=e{if(this._highlightedDecorationId!==null&&(n.changeDecorationOptions(this._highlightedDecorationId,ps._FIND_MATCH_DECORATION),this._highlightedDecorationId=null),t!==null&&(this._highlightedDecorationId=t,n.changeDecorationOptions(this._highlightedDecorationId,ps._CURRENT_FIND_MATCH_DECORATION)),this._rangeHighlightDecorationId!==null&&(n.removeDecoration(this._rangeHighlightDecorationId),this._rangeHighlightDecorationId=null),t!==null){let o=this._editor.getModel().getDecorationRange(t);if(o.startLineNumber!==o.endLineNumber&&o.endColumn===1){const r=o.endLineNumber-1,a=this._editor.getModel().getLineMaxColumn(r);o=new x(o.startLineNumber,o.startColumn,r,a)}this._rangeHighlightDecorationId=n.addDecoration(o,ps._RANGE_HIGHLIGHT_DECORATION)}}),i}set(e,t){this._editor.changeDecorations(i=>{let n=ps._FIND_MATCH_DECORATION;const o=[];if(e.length>1e3){n=ps._FIND_MATCH_NO_OVERVIEW_DECORATION;const a=this._editor.getModel().getLineCount(),d=this._editor.getLayoutInfo().height/a,c=Math.max(2,Math.ceil(3/d));let u=e[0].range.startLineNumber,h=e[0].range.endLineNumber;for(let g=1,f=e.length;g=m.startLineNumber?m.endLineNumber>h&&(h=m.endLineNumber):(o.push({range:new x(u,1,h,1),options:ps._FIND_MATCH_ONLY_OVERVIEW_DECORATION}),u=m.startLineNumber,h=m.endLineNumber)}o.push({range:new x(u,1,h,1),options:ps._FIND_MATCH_ONLY_OVERVIEW_DECORATION})}const r=new Array(e.length);for(let a=0,l=e.length;ai.removeDecoration(a)),this._findScopeDecorationIds=[]),t!=null&&t.length&&(this._findScopeDecorationIds=t.map(a=>i.addDecoration(a,ps._FIND_SCOPE_DECORATION)))})}matchBeforePosition(e){if(this._decorations.length===0)return null;for(let t=this._decorations.length-1;t>=0;t--){const i=this._decorations[t],n=this._editor.getModel().getDecorationRange(i);if(!(!n||n.endLineNumber>e.lineNumber)){if(n.endLineNumbere.column))return n}}return this._editor.getModel().getDecorationRange(this._decorations[this._decorations.length-1])}matchAfterPosition(e){if(this._decorations.length===0)return null;for(let t=0,i=this._decorations.length;te.lineNumber)return o;if(!(o.startColumn0){const i=[];for(let r=0;rx.compareRangesUsingStarts(r.range,a.range));const n=[];let o=i[0];for(let r=1;r0?e[0].toUpperCase()+e.substr(1):s[0][0].toUpperCase()!==s[0][0]&&e.length>0?e[0].toLowerCase()+e.substr(1):e}else return e}function G7(s,e,t){return s[0].indexOf(t)!==-1&&e.indexOf(t)!==-1&&s[0].split(t).length===e.split(t).length}function Z7(s,e,t){const i=e.split(t),n=s[0].split(t);let o="";return i.forEach((r,a)=>{o+=Zq([n[a]],r)+t}),o.slice(0,-1)}class X7{constructor(e){this.staticValue=e,this.kind=0}}class _Ee{constructor(e){this.pieces=e,this.kind=1}}class O_{static fromStaticValue(e){return new O_([df.staticValue(e)])}get hasReplacementPatterns(){return this._state.kind===1}constructor(e){!e||e.length===0?this._state=new X7(""):e.length===1&&e[0].staticValue!==null?this._state=new X7(e[0].staticValue):this._state=new _Ee(e)}buildReplaceString(e,t){if(this._state.kind===0)return t?Zq(e,this._state.staticValue):this._state.staticValue;let i="";for(let n=0,o=this._state.pieces.length;n0){const l=[],d=r.caseOps.length;let c=0;for(let u=0,h=a.length;u=d){l.push(a.slice(u));break}switch(r.caseOps[c]){case"U":l.push(a[u].toUpperCase());break;case"u":l.push(a[u].toUpperCase()),c++;break;case"L":l.push(a[u].toLowerCase());break;case"l":l.push(a[u].toLowerCase()),c++;break;default:l.push(a[u])}}a=l.join("")}i+=a}return i}static _substitute(e,t){if(t===null)return"";if(e===0)return t[0];let i="";for(;e>0;){if(e=n)break;const r=s.charCodeAt(i);switch(r){case 92:t.emitUnchanged(i-1),t.emitStatic("\\",i+1);break;case 110:t.emitUnchanged(i-1),t.emitStatic(` @@ -884,14 +884,14 @@ ${e.toString()}`}}class GD{constructor(e=new y1,t=!1,i,n=jwe){var o;this._servic * Version: 0.49.0(383fdf3fc0e1e1a024068b8d0fd4f3dcbae74d04) * Released under the MIT license * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt - *-----------------------------------------------------------------------------*/var aRe=Object.defineProperty,lRe=Object.getOwnPropertyDescriptor,dRe=Object.getOwnPropertyNames,cRe=Object.prototype.hasOwnProperty,uRe=(s,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of dRe(e))!cRe.call(s,n)&&n!==t&&aRe(s,n,{get:()=>e[n],enumerable:!(i=lRe(e,n))||i.enumerable});return s},hRe=(s,e,t)=>(uRe(s,e,"default"),t),w0={};hRe(w0,c0);var X4=class{constructor(e,t,i){this._onDidChange=new w0.Emitter,this._languageId=e,this.setOptions(t),this.setModeConfiguration(i)}get onDidChange(){return this._onDidChange.event}get languageId(){return this._languageId}get modeConfiguration(){return this._modeConfiguration}get diagnosticsOptions(){return this.options}get options(){return this._options}setOptions(e){this._options=e||Object.create(null),this._onDidChange.fire(this)}setDiagnosticsOptions(e){this.setOptions(e)}setModeConfiguration(e){this._modeConfiguration=e||Object.create(null),this._onDidChange.fire(this)}},Y4={validate:!0,lint:{compatibleVendorPrefixes:"ignore",vendorPrefix:"warning",duplicateProperties:"warning",emptyRules:"warning",importStatement:"ignore",boxModel:"ignore",universalSelector:"ignore",zeroUnits:"ignore",fontFaceProperties:"warning",hexColorLength:"error",argumentsInColorFunction:"error",unknownProperties:"warning",ieHack:"ignore",unknownVendorSpecificProperties:"ignore",propertyIgnoredDueToDisplay:"warning",important:"ignore",float:"ignore",idSelector:"ignore"},data:{useDefaultDataProvider:!0},format:{newlineBetweenSelectors:!0,newlineBetweenRules:!0,spaceAroundSelectorSeparator:!1,braceStyle:"collapse",maxPreserveNewLines:void 0,preserveNewLines:!0}},Q4={completionItems:!0,hovers:!0,documentSymbols:!0,definitions:!0,references:!0,documentHighlights:!0,rename:!0,colors:!0,foldingRanges:!0,diagnostics:!0,selectionRanges:!0,documentFormattingEdits:!0,documentRangeFormattingEdits:!0},rZ=new X4("css",Y4,Q4),aZ=new X4("scss",Y4,Q4),lZ=new X4("less",Y4,Q4);w0.languages.css={cssDefaults:rZ,lessDefaults:lZ,scssDefaults:aZ};function J4(){return Jo(()=>import("./cssMode-BN7yDFsj.js"),__vite__mapDeps([8,1,2,3]))}w0.languages.onLanguage("less",()=>{J4().then(s=>s.setupMode(lZ))});w0.languages.onLanguage("scss",()=>{J4().then(s=>s.setupMode(aZ))});w0.languages.onLanguage("css",()=>{J4().then(s=>s.setupMode(rZ))});/*!----------------------------------------------------------------------------- + *-----------------------------------------------------------------------------*/var aRe=Object.defineProperty,lRe=Object.getOwnPropertyDescriptor,dRe=Object.getOwnPropertyNames,cRe=Object.prototype.hasOwnProperty,uRe=(s,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of dRe(e))!cRe.call(s,n)&&n!==t&&aRe(s,n,{get:()=>e[n],enumerable:!(i=lRe(e,n))||i.enumerable});return s},hRe=(s,e,t)=>(uRe(s,e,"default"),t),w0={};hRe(w0,c0);var X4=class{constructor(e,t,i){this._onDidChange=new w0.Emitter,this._languageId=e,this.setOptions(t),this.setModeConfiguration(i)}get onDidChange(){return this._onDidChange.event}get languageId(){return this._languageId}get modeConfiguration(){return this._modeConfiguration}get diagnosticsOptions(){return this.options}get options(){return this._options}setOptions(e){this._options=e||Object.create(null),this._onDidChange.fire(this)}setDiagnosticsOptions(e){this.setOptions(e)}setModeConfiguration(e){this._modeConfiguration=e||Object.create(null),this._onDidChange.fire(this)}},Y4={validate:!0,lint:{compatibleVendorPrefixes:"ignore",vendorPrefix:"warning",duplicateProperties:"warning",emptyRules:"warning",importStatement:"ignore",boxModel:"ignore",universalSelector:"ignore",zeroUnits:"ignore",fontFaceProperties:"warning",hexColorLength:"error",argumentsInColorFunction:"error",unknownProperties:"warning",ieHack:"ignore",unknownVendorSpecificProperties:"ignore",propertyIgnoredDueToDisplay:"warning",important:"ignore",float:"ignore",idSelector:"ignore"},data:{useDefaultDataProvider:!0},format:{newlineBetweenSelectors:!0,newlineBetweenRules:!0,spaceAroundSelectorSeparator:!1,braceStyle:"collapse",maxPreserveNewLines:void 0,preserveNewLines:!0}},Q4={completionItems:!0,hovers:!0,documentSymbols:!0,definitions:!0,references:!0,documentHighlights:!0,rename:!0,colors:!0,foldingRanges:!0,diagnostics:!0,selectionRanges:!0,documentFormattingEdits:!0,documentRangeFormattingEdits:!0},rZ=new X4("css",Y4,Q4),aZ=new X4("scss",Y4,Q4),lZ=new X4("less",Y4,Q4);w0.languages.css={cssDefaults:rZ,lessDefaults:lZ,scssDefaults:aZ};function J4(){return Jo(()=>import("./cssMode-DZ6KqNzN.js"),__vite__mapDeps([8,1,2,3]))}w0.languages.onLanguage("less",()=>{J4().then(s=>s.setupMode(lZ))});w0.languages.onLanguage("scss",()=>{J4().then(s=>s.setupMode(aZ))});w0.languages.onLanguage("css",()=>{J4().then(s=>s.setupMode(rZ))});/*!----------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Version: 0.49.0(383fdf3fc0e1e1a024068b8d0fd4f3dcbae74d04) * Released under the MIT license * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt - *-----------------------------------------------------------------------------*/var gRe=Object.defineProperty,fRe=Object.getOwnPropertyDescriptor,pRe=Object.getOwnPropertyNames,mRe=Object.prototype.hasOwnProperty,_Re=(s,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of pRe(e))!mRe.call(s,n)&&n!==t&&gRe(s,n,{get:()=>e[n],enumerable:!(i=fRe(e,n))||i.enumerable});return s},vRe=(s,e,t)=>(_Re(s,e,"default"),t),tE={};vRe(tE,c0);var bRe=class{constructor(e,t,i){this._onDidChange=new tE.Emitter,this._languageId=e,this.setOptions(t),this.setModeConfiguration(i)}get onDidChange(){return this._onDidChange.event}get languageId(){return this._languageId}get options(){return this._options}get modeConfiguration(){return this._modeConfiguration}setOptions(e){this._options=e||Object.create(null),this._onDidChange.fire(this)}setModeConfiguration(e){this._modeConfiguration=e||Object.create(null),this._onDidChange.fire(this)}},CRe={tabSize:4,insertSpaces:!1,wrapLineLength:120,unformatted:'default": "a, abbr, acronym, b, bdo, big, br, button, cite, code, dfn, em, i, img, input, kbd, label, map, object, q, samp, select, small, span, strong, sub, sup, textarea, tt, var',contentUnformatted:"pre",indentInnerHtml:!1,preserveNewLines:!0,maxPreserveNewLines:void 0,indentHandlebars:!1,endWithNewline:!1,extraLiners:"head, body, /html",wrapAttributes:"auto"},iE={format:CRe,suggest:{},data:{useDefaultDataProvider:!0}};function nE(s){return{completionItems:!0,hovers:!0,documentSymbols:!0,links:!0,documentHighlights:!0,rename:!0,colors:!0,foldingRanges:!0,selectionRanges:!0,diagnostics:s===fb,documentFormattingEdits:s===fb,documentRangeFormattingEdits:s===fb}}var fb="html",G9="handlebars",Z9="razor",dZ=sE(fb,iE,nE(fb)),wRe=dZ.defaults,cZ=sE(G9,iE,nE(G9)),yRe=cZ.defaults,uZ=sE(Z9,iE,nE(Z9)),SRe=uZ.defaults;tE.languages.html={htmlDefaults:wRe,razorDefaults:SRe,handlebarDefaults:yRe,htmlLanguageService:dZ,handlebarLanguageService:cZ,razorLanguageService:uZ,registerHTMLLanguageService:sE};function DRe(){return Jo(()=>import("./htmlMode-C9ncgpq_.js"),__vite__mapDeps([9,1,2,3]))}function sE(s,e=iE,t=nE(s)){const i=new bRe(s,e,t);let n;const o=tE.languages.onLanguage(s,async()=>{n=(await DRe()).setupMode(i)});return{defaults:i,dispose(){o.dispose(),n==null||n.dispose(),n=void 0}}}var LRe=class{constructor(e,t,i){this._onDidChange=new TK,this._languageId=e,this.setDiagnosticsOptions(t),this.setModeConfiguration(i)}get onDidChange(){return this._onDidChange.event}get languageId(){return this._languageId}get modeConfiguration(){return this._modeConfiguration}get diagnosticsOptions(){return this._diagnosticsOptions}setDiagnosticsOptions(e){this._diagnosticsOptions=e||Object.create(null),this._onDidChange.fire(this)}setModeConfiguration(e){this._modeConfiguration=e||Object.create(null),this._onDidChange.fire(this)}},xRe={validate:!0,allowComments:!0,schemas:[],enableSchemaRequest:!1,schemaRequest:"warning",schemaValidation:"warning",comments:"error",trailingCommas:"error"},kRe={documentFormattingEdits:!0,documentRangeFormattingEdits:!0,completionItems:!0,hovers:!0,documentSymbols:!0,tokens:!0,colors:!0,foldingRanges:!0,diagnostics:!0,selectionRanges:!0},hZ=new LRe("json",xRe,kRe),ERe=()=>gZ().then(s=>s.getWorker());R1.json={jsonDefaults:hZ,getWorker:ERe};function gZ(){return Jo(()=>import("./jsonMode-Bd5P6a30.js"),__vite__mapDeps([10,1,2,3]))}R1.register({id:"json",extensions:[".json",".bowerrc",".jshintrc",".jscsrc",".eslintrc",".babelrc",".har"],aliases:["JSON","json"],mimetypes:["application/json"]});R1.onLanguage("json",()=>{gZ().then(s=>s.setupMode(hZ))});/*!----------------------------------------------------------------------------- + *-----------------------------------------------------------------------------*/var gRe=Object.defineProperty,fRe=Object.getOwnPropertyDescriptor,pRe=Object.getOwnPropertyNames,mRe=Object.prototype.hasOwnProperty,_Re=(s,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of pRe(e))!mRe.call(s,n)&&n!==t&&gRe(s,n,{get:()=>e[n],enumerable:!(i=fRe(e,n))||i.enumerable});return s},vRe=(s,e,t)=>(_Re(s,e,"default"),t),tE={};vRe(tE,c0);var bRe=class{constructor(e,t,i){this._onDidChange=new tE.Emitter,this._languageId=e,this.setOptions(t),this.setModeConfiguration(i)}get onDidChange(){return this._onDidChange.event}get languageId(){return this._languageId}get options(){return this._options}get modeConfiguration(){return this._modeConfiguration}setOptions(e){this._options=e||Object.create(null),this._onDidChange.fire(this)}setModeConfiguration(e){this._modeConfiguration=e||Object.create(null),this._onDidChange.fire(this)}},CRe={tabSize:4,insertSpaces:!1,wrapLineLength:120,unformatted:'default": "a, abbr, acronym, b, bdo, big, br, button, cite, code, dfn, em, i, img, input, kbd, label, map, object, q, samp, select, small, span, strong, sub, sup, textarea, tt, var',contentUnformatted:"pre",indentInnerHtml:!1,preserveNewLines:!0,maxPreserveNewLines:void 0,indentHandlebars:!1,endWithNewline:!1,extraLiners:"head, body, /html",wrapAttributes:"auto"},iE={format:CRe,suggest:{},data:{useDefaultDataProvider:!0}};function nE(s){return{completionItems:!0,hovers:!0,documentSymbols:!0,links:!0,documentHighlights:!0,rename:!0,colors:!0,foldingRanges:!0,selectionRanges:!0,diagnostics:s===fb,documentFormattingEdits:s===fb,documentRangeFormattingEdits:s===fb}}var fb="html",G9="handlebars",Z9="razor",dZ=sE(fb,iE,nE(fb)),wRe=dZ.defaults,cZ=sE(G9,iE,nE(G9)),yRe=cZ.defaults,uZ=sE(Z9,iE,nE(Z9)),SRe=uZ.defaults;tE.languages.html={htmlDefaults:wRe,razorDefaults:SRe,handlebarDefaults:yRe,htmlLanguageService:dZ,handlebarLanguageService:cZ,razorLanguageService:uZ,registerHTMLLanguageService:sE};function DRe(){return Jo(()=>import("./htmlMode-OnVneu3b.js"),__vite__mapDeps([9,1,2,3]))}function sE(s,e=iE,t=nE(s)){const i=new bRe(s,e,t);let n;const o=tE.languages.onLanguage(s,async()=>{n=(await DRe()).setupMode(i)});return{defaults:i,dispose(){o.dispose(),n==null||n.dispose(),n=void 0}}}var LRe=class{constructor(e,t,i){this._onDidChange=new TK,this._languageId=e,this.setDiagnosticsOptions(t),this.setModeConfiguration(i)}get onDidChange(){return this._onDidChange.event}get languageId(){return this._languageId}get modeConfiguration(){return this._modeConfiguration}get diagnosticsOptions(){return this._diagnosticsOptions}setDiagnosticsOptions(e){this._diagnosticsOptions=e||Object.create(null),this._onDidChange.fire(this)}setModeConfiguration(e){this._modeConfiguration=e||Object.create(null),this._onDidChange.fire(this)}},xRe={validate:!0,allowComments:!0,schemas:[],enableSchemaRequest:!1,schemaRequest:"warning",schemaValidation:"warning",comments:"error",trailingCommas:"error"},kRe={documentFormattingEdits:!0,documentRangeFormattingEdits:!0,completionItems:!0,hovers:!0,documentSymbols:!0,tokens:!0,colors:!0,foldingRanges:!0,diagnostics:!0,selectionRanges:!0},hZ=new LRe("json",xRe,kRe),ERe=()=>gZ().then(s=>s.getWorker());R1.json={jsonDefaults:hZ,getWorker:ERe};function gZ(){return Jo(()=>import("./jsonMode-BtuHdEcQ.js"),__vite__mapDeps([10,1,2,3]))}R1.register({id:"json",extensions:[".json",".bowerrc",".jshintrc",".jscsrc",".eslintrc",".babelrc",".har"],aliases:["JSON","json"],mimetypes:["application/json"]});R1.onLanguage("json",()=>{gZ().then(s=>s.setupMode(hZ))});/*!----------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Version: 0.49.0(383fdf3fc0e1e1a024068b8d0fd4f3dcbae74d04) * Released under the MIT license * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt - *-----------------------------------------------------------------------------*/var IRe=Object.defineProperty,TRe=Object.getOwnPropertyDescriptor,NRe=Object.getOwnPropertyNames,ARe=Object.prototype.hasOwnProperty,MRe=(s,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of NRe(e))!ARe.call(s,n)&&n!==t&&IRe(s,n,{get:()=>e[n],enumerable:!(i=TRe(e,n))||i.enumerable});return s},RRe=(s,e,t)=>(MRe(s,e,"default"),t),PRe="5.0.2",U_={};RRe(U_,c0);var fZ=(s=>(s[s.None=0]="None",s[s.CommonJS=1]="CommonJS",s[s.AMD=2]="AMD",s[s.UMD=3]="UMD",s[s.System=4]="System",s[s.ES2015=5]="ES2015",s[s.ESNext=99]="ESNext",s))(fZ||{}),pZ=(s=>(s[s.None=0]="None",s[s.Preserve=1]="Preserve",s[s.React=2]="React",s[s.ReactNative=3]="ReactNative",s[s.ReactJSX=4]="ReactJSX",s[s.ReactJSXDev=5]="ReactJSXDev",s))(pZ||{}),mZ=(s=>(s[s.CarriageReturnLineFeed=0]="CarriageReturnLineFeed",s[s.LineFeed=1]="LineFeed",s))(mZ||{}),_Z=(s=>(s[s.ES3=0]="ES3",s[s.ES5=1]="ES5",s[s.ES2015=2]="ES2015",s[s.ES2016=3]="ES2016",s[s.ES2017=4]="ES2017",s[s.ES2018=5]="ES2018",s[s.ES2019=6]="ES2019",s[s.ES2020=7]="ES2020",s[s.ESNext=99]="ESNext",s[s.JSON=100]="JSON",s[s.Latest=99]="Latest",s))(_Z||{}),vZ=(s=>(s[s.Classic=1]="Classic",s[s.NodeJs=2]="NodeJs",s))(vZ||{}),bZ=class{constructor(s,e,t,i,n){this._onDidChange=new U_.Emitter,this._onDidExtraLibsChange=new U_.Emitter,this._extraLibs=Object.create(null),this._removedExtraLibs=Object.create(null),this._eagerModelSync=!1,this.setCompilerOptions(s),this.setDiagnosticsOptions(e),this.setWorkerOptions(t),this.setInlayHintsOptions(i),this.setModeConfiguration(n),this._onDidExtraLibsChangeTimeout=-1}get onDidChange(){return this._onDidChange.event}get onDidExtraLibsChange(){return this._onDidExtraLibsChange.event}get modeConfiguration(){return this._modeConfiguration}get workerOptions(){return this._workerOptions}get inlayHintsOptions(){return this._inlayHintsOptions}getExtraLibs(){return this._extraLibs}addExtraLib(s,e){let t;if(typeof e>"u"?t=`ts:extralib-${Math.random().toString(36).substring(2,15)}`:t=e,this._extraLibs[t]&&this._extraLibs[t].content===s)return{dispose:()=>{}};let i=1;return this._removedExtraLibs[t]&&(i=this._removedExtraLibs[t]+1),this._extraLibs[t]&&(i=this._extraLibs[t].version+1),this._extraLibs[t]={content:s,version:i},this._fireOnDidExtraLibsChangeSoon(),{dispose:()=>{let n=this._extraLibs[t];n&&n.version===i&&(delete this._extraLibs[t],this._removedExtraLibs[t]=i,this._fireOnDidExtraLibsChangeSoon())}}}setExtraLibs(s){for(const e in this._extraLibs)this._removedExtraLibs[e]=this._extraLibs[e].version;if(this._extraLibs=Object.create(null),s&&s.length>0)for(const e of s){const t=e.filePath||`ts:extralib-${Math.random().toString(36).substring(2,15)}`,i=e.content;let n=1;this._removedExtraLibs[t]&&(n=this._removedExtraLibs[t]+1),this._extraLibs[t]={content:i,version:n}}this._fireOnDidExtraLibsChangeSoon()}_fireOnDidExtraLibsChangeSoon(){this._onDidExtraLibsChangeTimeout===-1&&(this._onDidExtraLibsChangeTimeout=window.setTimeout(()=>{this._onDidExtraLibsChangeTimeout=-1,this._onDidExtraLibsChange.fire(void 0)},0))}getCompilerOptions(){return this._compilerOptions}setCompilerOptions(s){this._compilerOptions=s||Object.create(null),this._onDidChange.fire(void 0)}getDiagnosticsOptions(){return this._diagnosticsOptions}setDiagnosticsOptions(s){this._diagnosticsOptions=s||Object.create(null),this._onDidChange.fire(void 0)}setWorkerOptions(s){this._workerOptions=s||Object.create(null),this._onDidChange.fire(void 0)}setInlayHintsOptions(s){this._inlayHintsOptions=s||Object.create(null),this._onDidChange.fire(void 0)}setMaximumWorkerIdleTime(s){}setEagerModelSync(s){this._eagerModelSync=s}getEagerModelSync(){return this._eagerModelSync}setModeConfiguration(s){this._modeConfiguration=s||Object.create(null),this._onDidChange.fire(void 0)}},FRe=PRe,CZ={completionItems:!0,hovers:!0,documentSymbols:!0,definitions:!0,references:!0,documentHighlights:!0,rename:!0,diagnostics:!0,documentRangeFormattingEdits:!0,signatureHelp:!0,onTypeFormattingEdits:!0,codeActions:!0,inlayHints:!0},wZ=new bZ({allowNonTsExtensions:!0,target:99},{noSemanticValidation:!1,noSyntaxValidation:!1,onlyVisible:!1},{},{},CZ),yZ=new bZ({allowNonTsExtensions:!0,allowJs:!0,target:99},{noSemanticValidation:!0,noSyntaxValidation:!1,onlyVisible:!1},{},{},CZ),ORe=()=>oE().then(s=>s.getTypeScriptWorker()),BRe=()=>oE().then(s=>s.getJavaScriptWorker());U_.languages.typescript={ModuleKind:fZ,JsxEmit:pZ,NewLineKind:mZ,ScriptTarget:_Z,ModuleResolutionKind:vZ,typescriptVersion:FRe,typescriptDefaults:wZ,javascriptDefaults:yZ,getTypeScriptWorker:ORe,getJavaScriptWorker:BRe};function oE(){return Jo(()=>import("./tsMode-CkyNDC04.js"),__vite__mapDeps([11,1,2,3]))}U_.languages.onLanguage("typescript",()=>oE().then(s=>s.setupTypeScript(wZ)));U_.languages.onLanguage("javascript",()=>oE().then(s=>s.setupJavaScript(yZ)));globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(s,e){return this.cache.has(s)?this.cache.get(s):(this.cache.set(s,e),e)}};R1.css.cssDefaults.setOptions({data:{dataProviders:{tailwindcssData:VY}}});UY(c0,{tailwindConfig:{darkMode:["class"],theme:{extend:{colors:{border:"hsl(var(--border))",input:"hsl(var(--input))",ring:"hsl(var(--ring))",background:"hsl(var(--background))",foreground:"hsl(var(--foreground))",primary:{DEFAULT:"hsl(var(--primary))",foreground:"hsl(var(--primary-foreground))"},secondary:{DEFAULT:"hsl(var(--secondary))",foreground:"hsl(var(--secondary-foreground))"},destructive:{DEFAULT:"hsl(var(--destructive))",foreground:"hsl(var(--destructive-foreground))"},muted:{DEFAULT:"hsl(var(--muted))",foreground:"hsl(var(--muted-foreground))"},accent:{DEFAULT:"hsl(var(--accent))",foreground:"hsl(var(--accent-foreground))"},popover:{DEFAULT:"hsl(var(--popover))",foreground:"hsl(var(--popover-foreground))"},card:{DEFAULT:"hsl(var(--card))",foreground:"hsl(var(--card-foreground))"}}}}}});IL.config({monaco:c0});IL.init().catch(s=>{console.error("Unable to initialize monaco",s)});const WRe=s=>{u5.base="vs-dark",s.editor.defineTheme("openui",u5)};function HRe({code:s,framework:e}){const o=kZ().id??"new",r=_t.useContext(BZ),[a,l]=_t.useState(e!=="html"),d=_t.useRef(),[c,u]=_t.useState(),[h,g]=_t.useState(""),[f,m]=_t.useState(""),_=_t.useRef(),[v,b]=_t.useState(!1),C=EZ(s),w=IZ(),[y,S]=TZ(NZ({id:o})),L=AZ(OZ),E=_t.useMemo(()=>new MZ(y,S,w),[y,S,w]),[I,O]=RZ(E);_t.useEffect(()=>{if(c){if(!E.version(I).includes(".")){const H=E.editChapter(h,I);O(H),setTimeout(()=>{var U;(U=d.current)==null||U.setPosition(c)},100)}u(void 0)}},[c,u,I,O]);const P=(F,H)=>{H.editor.setTheme("openui"),d.current=F;let U,J=!1;F.onDidChangeModelContent(()=>{U&&(U=void 0)}),F.onDidChangeCursorPosition(pe=>{J&&(U=pe.position,J=!1,u(U))}),F.onDidFocusEditorWidget(()=>{J=!0}),d.current.setValue(h.trim())};_t.useEffect(()=>{l(e!=="html")},[e]);const R=_t.useMemo(()=>{const[F]=FZ(e);return`${o}.${I}${F}`},[o,I,e]);return _t.useEffect(()=>{m(""),b(!1)},[R]),_t.useEffect(()=>{clearTimeout(_.current),f!==""&&(_.current=setTimeout(()=>{r.emit("ui-state",{editedHTML:f}),E.editChapter(f,I)},2e3))},[f,I]),_t.useEffect(()=>{d.current&&!v&&d.current.setValue(h.trim())},[L.rendering,v,h,R]),_t.useEffect(()=>{(async()=>{const H=await Jo(()=>import("./standalone-HCIxKaAs.js"),[]),J=[await Jo(()=>import("./html-DCTwL4e8.js"),[])];if(e!=="html"){const Se=await Jo(()=>import("./babel-IQvuBHGA.js"),[]);J.unshift(Se),J.unshift(Bne)}const pe=await H.format(s,{plugins:J,parser:e==="html"?"html":"babel",semi:!1,singleQuote:!0,trailingComma:"all",jsxBracketSameLine:!0,tabWidth:2,printWidth:200});g(pe)})().catch(()=>{console.warn("Unable to format code"),g(s)})},[C,e]),PZ.jsx($X,{defaultValue:h.trim(),path:R,options:{readOnly:a,lineNumbers:"off",minimap:{enabled:!1},overviewRulerLanes:0,scrollBeyondLastLine:!1},className:"h-[calc(100vh-364px)] pt-2",beforeMount:WRe,onMount:P,onChange:F=>{F&&e==="html"&&!L.rendering&&F!==h.trim()&&(console.log("Edit mode enabled for code editor"),b(!0),m(F))}},R)}const A5e=Object.freeze(Object.defineProperty({__proto__:null,default:HRe},Symbol.toStringTag,{value:"Module"}));export{A5e as C,c0 as m,wZ as t}; + *-----------------------------------------------------------------------------*/var IRe=Object.defineProperty,TRe=Object.getOwnPropertyDescriptor,NRe=Object.getOwnPropertyNames,ARe=Object.prototype.hasOwnProperty,MRe=(s,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of NRe(e))!ARe.call(s,n)&&n!==t&&IRe(s,n,{get:()=>e[n],enumerable:!(i=TRe(e,n))||i.enumerable});return s},RRe=(s,e,t)=>(MRe(s,e,"default"),t),PRe="5.0.2",U_={};RRe(U_,c0);var fZ=(s=>(s[s.None=0]="None",s[s.CommonJS=1]="CommonJS",s[s.AMD=2]="AMD",s[s.UMD=3]="UMD",s[s.System=4]="System",s[s.ES2015=5]="ES2015",s[s.ESNext=99]="ESNext",s))(fZ||{}),pZ=(s=>(s[s.None=0]="None",s[s.Preserve=1]="Preserve",s[s.React=2]="React",s[s.ReactNative=3]="ReactNative",s[s.ReactJSX=4]="ReactJSX",s[s.ReactJSXDev=5]="ReactJSXDev",s))(pZ||{}),mZ=(s=>(s[s.CarriageReturnLineFeed=0]="CarriageReturnLineFeed",s[s.LineFeed=1]="LineFeed",s))(mZ||{}),_Z=(s=>(s[s.ES3=0]="ES3",s[s.ES5=1]="ES5",s[s.ES2015=2]="ES2015",s[s.ES2016=3]="ES2016",s[s.ES2017=4]="ES2017",s[s.ES2018=5]="ES2018",s[s.ES2019=6]="ES2019",s[s.ES2020=7]="ES2020",s[s.ESNext=99]="ESNext",s[s.JSON=100]="JSON",s[s.Latest=99]="Latest",s))(_Z||{}),vZ=(s=>(s[s.Classic=1]="Classic",s[s.NodeJs=2]="NodeJs",s))(vZ||{}),bZ=class{constructor(s,e,t,i,n){this._onDidChange=new U_.Emitter,this._onDidExtraLibsChange=new U_.Emitter,this._extraLibs=Object.create(null),this._removedExtraLibs=Object.create(null),this._eagerModelSync=!1,this.setCompilerOptions(s),this.setDiagnosticsOptions(e),this.setWorkerOptions(t),this.setInlayHintsOptions(i),this.setModeConfiguration(n),this._onDidExtraLibsChangeTimeout=-1}get onDidChange(){return this._onDidChange.event}get onDidExtraLibsChange(){return this._onDidExtraLibsChange.event}get modeConfiguration(){return this._modeConfiguration}get workerOptions(){return this._workerOptions}get inlayHintsOptions(){return this._inlayHintsOptions}getExtraLibs(){return this._extraLibs}addExtraLib(s,e){let t;if(typeof e>"u"?t=`ts:extralib-${Math.random().toString(36).substring(2,15)}`:t=e,this._extraLibs[t]&&this._extraLibs[t].content===s)return{dispose:()=>{}};let i=1;return this._removedExtraLibs[t]&&(i=this._removedExtraLibs[t]+1),this._extraLibs[t]&&(i=this._extraLibs[t].version+1),this._extraLibs[t]={content:s,version:i},this._fireOnDidExtraLibsChangeSoon(),{dispose:()=>{let n=this._extraLibs[t];n&&n.version===i&&(delete this._extraLibs[t],this._removedExtraLibs[t]=i,this._fireOnDidExtraLibsChangeSoon())}}}setExtraLibs(s){for(const e in this._extraLibs)this._removedExtraLibs[e]=this._extraLibs[e].version;if(this._extraLibs=Object.create(null),s&&s.length>0)for(const e of s){const t=e.filePath||`ts:extralib-${Math.random().toString(36).substring(2,15)}`,i=e.content;let n=1;this._removedExtraLibs[t]&&(n=this._removedExtraLibs[t]+1),this._extraLibs[t]={content:i,version:n}}this._fireOnDidExtraLibsChangeSoon()}_fireOnDidExtraLibsChangeSoon(){this._onDidExtraLibsChangeTimeout===-1&&(this._onDidExtraLibsChangeTimeout=window.setTimeout(()=>{this._onDidExtraLibsChangeTimeout=-1,this._onDidExtraLibsChange.fire(void 0)},0))}getCompilerOptions(){return this._compilerOptions}setCompilerOptions(s){this._compilerOptions=s||Object.create(null),this._onDidChange.fire(void 0)}getDiagnosticsOptions(){return this._diagnosticsOptions}setDiagnosticsOptions(s){this._diagnosticsOptions=s||Object.create(null),this._onDidChange.fire(void 0)}setWorkerOptions(s){this._workerOptions=s||Object.create(null),this._onDidChange.fire(void 0)}setInlayHintsOptions(s){this._inlayHintsOptions=s||Object.create(null),this._onDidChange.fire(void 0)}setMaximumWorkerIdleTime(s){}setEagerModelSync(s){this._eagerModelSync=s}getEagerModelSync(){return this._eagerModelSync}setModeConfiguration(s){this._modeConfiguration=s||Object.create(null),this._onDidChange.fire(void 0)}},FRe=PRe,CZ={completionItems:!0,hovers:!0,documentSymbols:!0,definitions:!0,references:!0,documentHighlights:!0,rename:!0,diagnostics:!0,documentRangeFormattingEdits:!0,signatureHelp:!0,onTypeFormattingEdits:!0,codeActions:!0,inlayHints:!0},wZ=new bZ({allowNonTsExtensions:!0,target:99},{noSemanticValidation:!1,noSyntaxValidation:!1,onlyVisible:!1},{},{},CZ),yZ=new bZ({allowNonTsExtensions:!0,allowJs:!0,target:99},{noSemanticValidation:!0,noSyntaxValidation:!1,onlyVisible:!1},{},{},CZ),ORe=()=>oE().then(s=>s.getTypeScriptWorker()),BRe=()=>oE().then(s=>s.getJavaScriptWorker());U_.languages.typescript={ModuleKind:fZ,JsxEmit:pZ,NewLineKind:mZ,ScriptTarget:_Z,ModuleResolutionKind:vZ,typescriptVersion:FRe,typescriptDefaults:wZ,javascriptDefaults:yZ,getTypeScriptWorker:ORe,getJavaScriptWorker:BRe};function oE(){return Jo(()=>import("./tsMode--eUIVZBU.js"),__vite__mapDeps([11,1,2,3]))}U_.languages.onLanguage("typescript",()=>oE().then(s=>s.setupTypeScript(wZ)));U_.languages.onLanguage("javascript",()=>oE().then(s=>s.setupJavaScript(yZ)));globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(s,e){return this.cache.has(s)?this.cache.get(s):(this.cache.set(s,e),e)}};R1.css.cssDefaults.setOptions({data:{dataProviders:{tailwindcssData:VY}}});UY(c0,{tailwindConfig:{darkMode:["class"],theme:{extend:{colors:{border:"hsl(var(--border))",input:"hsl(var(--input))",ring:"hsl(var(--ring))",background:"hsl(var(--background))",foreground:"hsl(var(--foreground))",primary:{DEFAULT:"hsl(var(--primary))",foreground:"hsl(var(--primary-foreground))"},secondary:{DEFAULT:"hsl(var(--secondary))",foreground:"hsl(var(--secondary-foreground))"},destructive:{DEFAULT:"hsl(var(--destructive))",foreground:"hsl(var(--destructive-foreground))"},muted:{DEFAULT:"hsl(var(--muted))",foreground:"hsl(var(--muted-foreground))"},accent:{DEFAULT:"hsl(var(--accent))",foreground:"hsl(var(--accent-foreground))"},popover:{DEFAULT:"hsl(var(--popover))",foreground:"hsl(var(--popover-foreground))"},card:{DEFAULT:"hsl(var(--card))",foreground:"hsl(var(--card-foreground))"}}}}}});IL.config({monaco:c0});IL.init().catch(s=>{console.error("Unable to initialize monaco",s)});const WRe=s=>{u5.base="vs-dark",s.editor.defineTheme("openui",u5)};function HRe({code:s,framework:e}){const o=kZ().id??"new",r=_t.useContext(BZ),[a,l]=_t.useState(e!=="html"),d=_t.useRef(),[c,u]=_t.useState(),[h,g]=_t.useState(""),[f,m]=_t.useState(""),_=_t.useRef(),[v,b]=_t.useState(!1),C=EZ(s),w=IZ(),[y,S]=TZ(NZ({id:o})),L=AZ(OZ),E=_t.useMemo(()=>new MZ(y,S,w),[y,S,w]),[I,O]=RZ(E);_t.useEffect(()=>{if(c){if(!E.version(I).includes(".")){const H=E.editChapter(h,I);O(H),setTimeout(()=>{var U;(U=d.current)==null||U.setPosition(c)},100)}u(void 0)}},[c,u,I,O]);const P=(F,H)=>{H.editor.setTheme("openui"),d.current=F;let U,J=!1;F.onDidChangeModelContent(()=>{U&&(U=void 0)}),F.onDidChangeCursorPosition(pe=>{J&&(U=pe.position,J=!1,u(U))}),F.onDidFocusEditorWidget(()=>{J=!0}),d.current.setValue(h.trim())};_t.useEffect(()=>{l(e!=="html")},[e]);const R=_t.useMemo(()=>{const[F]=FZ(e);return`${o}.${I}${F}`},[o,I,e]);return _t.useEffect(()=>{m(""),b(!1)},[R]),_t.useEffect(()=>{clearTimeout(_.current),f!==""&&(_.current=setTimeout(()=>{r.emit("ui-state",{editedHTML:f}),E.editChapter(f,I)},2e3))},[f,I]),_t.useEffect(()=>{d.current&&!v&&d.current.setValue(h.trim())},[L.rendering,v,h,R]),_t.useEffect(()=>{(async()=>{const H=await Jo(()=>import("./standalone-HCIxKaAs.js"),[]),J=[await Jo(()=>import("./html-DCTwL4e8.js"),[])];if(e!=="html"){const Se=await Jo(()=>import("./babel-IQvuBHGA.js"),[]);J.unshift(Se),J.unshift(Bne)}const pe=await H.format(s,{plugins:J,parser:e==="html"?"html":"babel",semi:!1,singleQuote:!0,trailingComma:"all",jsxBracketSameLine:!0,tabWidth:2,printWidth:200});g(pe)})().catch(()=>{console.warn("Unable to format code"),g(s)})},[C,e]),PZ.jsx($X,{defaultValue:h.trim(),path:R,options:{readOnly:a,lineNumbers:"off",minimap:{enabled:!1},overviewRulerLanes:0,scrollBeyondLastLine:!1},className:"h-[calc(100vh-364px)] pt-2",beforeMount:WRe,onMount:P,onChange:F=>{F&&e==="html"&&!L.rendering&&F!==h.trim()&&(console.log("Edit mode enabled for code editor"),b(!0),m(F))}},R)}const A5e=Object.freeze(Object.defineProperty({__proto__:null,default:HRe},Symbol.toStringTag,{value:"Module"}));export{A5e as C,c0 as m,wZ as t}; diff --git a/backend/openui/dist/assets/cssMode-BN7yDFsj.js b/backend/openui/dist/assets/cssMode-DZ6KqNzN.js similarity index 99% rename from backend/openui/dist/assets/cssMode-BN7yDFsj.js rename to backend/openui/dist/assets/cssMode-DZ6KqNzN.js index 0f76586..be96cf7 100644 --- a/backend/openui/dist/assets/cssMode-BN7yDFsj.js +++ b/backend/openui/dist/assets/cssMode-DZ6KqNzN.js @@ -1,4 +1,4 @@ -import{m as Le}from"./CodeEditor-DeI0yxJE.js";import"./index-BJTdd6TP.js";import"./index-BT0QP1aV.js";/*!----------------------------------------------------------------------------- +import{m as Le}from"./CodeEditor-BNtUY-yF.js";import"./index-DM-gbCDZ.js";import"./index-0JY1nCFV.js";/*!----------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Version: 0.49.0(383fdf3fc0e1e1a024068b8d0fd4f3dcbae74d04) * Released under the MIT license diff --git a/backend/openui/dist/assets/html-CDMIPMTW.js b/backend/openui/dist/assets/html-BIdIcXKn.js similarity index 97% rename from backend/openui/dist/assets/html-CDMIPMTW.js rename to backend/openui/dist/assets/html-BIdIcXKn.js index babee7a..10ce2ab 100644 --- a/backend/openui/dist/assets/html-CDMIPMTW.js +++ b/backend/openui/dist/assets/html-BIdIcXKn.js @@ -1,4 +1,4 @@ -import{m as s}from"./CodeEditor-DeI0yxJE.js";import"./index-BJTdd6TP.js";import"./index-BT0QP1aV.js";/*!----------------------------------------------------------------------------- +import{m as s}from"./CodeEditor-BNtUY-yF.js";import"./index-DM-gbCDZ.js";import"./index-0JY1nCFV.js";/*!----------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Version: 0.49.0(383fdf3fc0e1e1a024068b8d0fd4f3dcbae74d04) * Released under the MIT license diff --git a/backend/openui/dist/assets/htmlMode-C9ncgpq_.js b/backend/openui/dist/assets/htmlMode-OnVneu3b.js similarity index 99% rename from backend/openui/dist/assets/htmlMode-C9ncgpq_.js rename to backend/openui/dist/assets/htmlMode-OnVneu3b.js index e497d0d..8fee4b7 100644 --- a/backend/openui/dist/assets/htmlMode-C9ncgpq_.js +++ b/backend/openui/dist/assets/htmlMode-OnVneu3b.js @@ -1,4 +1,4 @@ -import{m as $e}from"./CodeEditor-DeI0yxJE.js";import"./index-BJTdd6TP.js";import"./index-BT0QP1aV.js";/*!----------------------------------------------------------------------------- +import{m as $e}from"./CodeEditor-BNtUY-yF.js";import"./index-DM-gbCDZ.js";import"./index-0JY1nCFV.js";/*!----------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Version: 0.49.0(383fdf3fc0e1e1a024068b8d0fd4f3dcbae74d04) * Released under the MIT license diff --git a/backend/openui/dist/assets/index-0JY1nCFV.js b/backend/openui/dist/assets/index-0JY1nCFV.js new file mode 100644 index 0000000..bff4797 --- /dev/null +++ b/backend/openui/dist/assets/index-0JY1nCFV.js @@ -0,0 +1,150 @@ +const __vite__fileDeps=["assets/CodeEditor-BNtUY-yF.js","assets/index-DM-gbCDZ.js","assets/index-PeCuZIBW.css","assets/CodeEditor-DM7e4Gfc.css"],__vite__mapDeps=i=>i.map(i=>__vite__fileDeps[i]); +var Xs=Object.defineProperty;var Qs=(e,t,o)=>t in e?Xs(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o;var Ho=(e,t,o)=>(Qs(e,typeof t!="symbol"?t+"":t,o),o),Vo=(e,t,o)=>{if(!t.has(e))throw TypeError("Cannot "+o)};var N=(e,t,o)=>(Vo(e,t,"read from private field"),o?o.call(e):t.get(e)),ce=(e,t,o)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,o)},le=(e,t,o,r)=>(Vo(e,t,"write to private field"),r?r.call(e,o):t.set(e,o),o);var he=(e,t,o)=>(Vo(e,t,"access private method"),o);import{S as Js,s as Qo,n as ec,i as Bn,a as Un,t as tc,f as oc,b as nc,r as Kn,c as Er,d as n,u as rc,R as ac,$ as z,_ as C,g as sc,e as cc,j as s,h as T,k as rt,l as Ne,m as qe,o as ze,p as ho,q as po,v as j,w as Ie,x as Z,y as Wt,z as mo,A as Sr,W as Le,B as bt,C as He,D as jr,E as ic,F as ne,G as Me,H as ee,T as je,I as ke,J as Re,K as lc,L as kr,M as dc,N as go,O as Rr,P as Mr,Q as Ye,U as $t,V as Ct,X as Nr,Y as Jo,Z as Wn,a0 as yt,a1 as $n,a2 as Cn,a3 as Gt,a4 as Ve,a5 as Ze,a6 as yn,a7 as Tr,a8 as _r,a9 as En,aa as Pr,ab as Ke,ac as vo,ad as Ir,ae as uc,af as zo,ag as fc,ah as hc,ai as pc,aj as Ar,ak as Lr,al as Dr,am as Or,an as bo,ao as mc,ap as gc,aq as vc,ar as bc,as as xc,at as wc,au as $c,av as Be,aw as Fr,ax as Cc,ay as yc,az as Ec,aA as Sc,aB as Hr,aC as jc,aD as kc}from"./index-DM-gbCDZ.js";var $e,se,Dt,xe,Je,pt,Oe,Ot,mt,gt,et,tt,Ge,vt,ot,Nt,Ft,en,Ht,tn,Vt,on,zt,nn,Bt,rn,Ut,an,Kt,sn,fo,Vr,yr,Rc=(yr=class extends Js{constructor(t,o){super();ce(this,ot);ce(this,Ft);ce(this,Ht);ce(this,Vt);ce(this,zt);ce(this,Bt);ce(this,Ut);ce(this,Kt);ce(this,fo);ce(this,$e,void 0);ce(this,se,void 0);ce(this,Dt,void 0);ce(this,xe,void 0);ce(this,Je,void 0);ce(this,pt,void 0);ce(this,Oe,void 0);ce(this,Ot,void 0);ce(this,mt,void 0);ce(this,gt,void 0);ce(this,et,void 0);ce(this,tt,void 0);ce(this,Ge,void 0);ce(this,vt,new Set);this.options=o,le(this,$e,t),le(this,Oe,null),this.bindMethods(),this.setOptions(o)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(N(this,se).addObserver(this),Gn(N(this,se),this.options)?he(this,ot,Nt).call(this):this.updateResult(),he(this,zt,nn).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return cn(N(this,se),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return cn(N(this,se),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,he(this,Bt,rn).call(this),he(this,Ut,an).call(this),N(this,se).removeObserver(this)}setOptions(t,o){const r=this.options,a=N(this,se);if(this.options=N(this,$e).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean")throw new Error("Expected enabled to be a boolean");he(this,Kt,sn).call(this),N(this,se).setOptions(this.options),r._defaulted&&!Qo(this.options,r)&&N(this,$e).getQueryCache().notify({type:"observerOptionsUpdated",query:N(this,se),observer:this});const c=this.hasListeners();c&&Zn(N(this,se),a,this.options,r)&&he(this,ot,Nt).call(this),this.updateResult(o),c&&(N(this,se)!==a||this.options.enabled!==r.enabled||this.options.staleTime!==r.staleTime)&&he(this,Ft,en).call(this);const l=he(this,Ht,tn).call(this);c&&(N(this,se)!==a||this.options.enabled!==r.enabled||l!==N(this,Ge))&&he(this,Vt,on).call(this,l)}getOptimisticResult(t){const o=N(this,$e).getQueryCache().build(N(this,$e),t),r=this.createResult(o,t);return Nc(this,r)&&(le(this,xe,r),le(this,pt,this.options),le(this,Je,N(this,se).state)),r}getCurrentResult(){return N(this,xe)}trackResult(t,o){const r={};return Object.keys(t).forEach(a=>{Object.defineProperty(r,a,{configurable:!1,enumerable:!0,get:()=>(this.trackProp(a),o==null||o(a),t[a])})}),r}trackProp(t){N(this,vt).add(t)}getCurrentQuery(){return N(this,se)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const o=N(this,$e).defaultQueryOptions(t),r=N(this,$e).getQueryCache().build(N(this,$e),o);return r.isFetchingOptimistic=!0,r.fetch().then(()=>this.createResult(r,o))}fetch(t){return he(this,ot,Nt).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),N(this,xe)))}createResult(t,o){var y;const r=N(this,se),a=this.options,c=N(this,xe),l=N(this,Je),i=N(this,pt),u=t!==r?t.state:N(this,Dt),{state:h}=t;let f={...h},m=!1,b;if(o._optimisticResults){const I=this.hasListeners(),O=!I&&Gn(t,o),H=I&&Zn(t,r,o,a);(O||H)&&(f={...f,...nc(h.data,t.options)}),o._optimisticResults==="isRestoring"&&(f.fetchStatus="idle")}let{error:g,errorUpdatedAt:p,status:x}=f;if(o.select&&f.data!==void 0)if(c&&f.data===(l==null?void 0:l.data)&&o.select===N(this,Ot))b=N(this,mt);else try{le(this,Ot,o.select),b=o.select(f.data),b=Kn(c==null?void 0:c.data,b,o),le(this,mt,b),le(this,Oe,null)}catch(I){le(this,Oe,I)}else b=f.data;if(o.placeholderData!==void 0&&b===void 0&&x==="pending"){let I;if(c!=null&&c.isPlaceholderData&&o.placeholderData===(i==null?void 0:i.placeholderData))I=c.data;else if(I=typeof o.placeholderData=="function"?o.placeholderData((y=N(this,gt))==null?void 0:y.state.data,N(this,gt)):o.placeholderData,o.select&&I!==void 0)try{I=o.select(I),le(this,Oe,null)}catch(O){le(this,Oe,O)}I!==void 0&&(x="success",b=Kn(c==null?void 0:c.data,I,o),m=!0)}N(this,Oe)&&(g=N(this,Oe),b=N(this,mt),p=Date.now(),x="error");const w=f.fetchStatus==="fetching",v=x==="pending",$=x==="error",E=v&&w,k=b!==void 0;return{status:x,fetchStatus:f.fetchStatus,isPending:v,isSuccess:x==="success",isError:$,isInitialLoading:E,isLoading:E,data:b,dataUpdatedAt:f.dataUpdatedAt,error:g,errorUpdatedAt:p,failureCount:f.fetchFailureCount,failureReason:f.fetchFailureReason,errorUpdateCount:f.errorUpdateCount,isFetched:f.dataUpdateCount>0||f.errorUpdateCount>0,isFetchedAfterMount:f.dataUpdateCount>u.dataUpdateCount||f.errorUpdateCount>u.errorUpdateCount,isFetching:w,isRefetching:w&&!v,isLoadingError:$&&!k,isPaused:f.fetchStatus==="paused",isPlaceholderData:m,isRefetchError:$&&k,isStale:Sn(t,o),refetch:this.refetch}}updateResult(t){const o=N(this,xe),r=this.createResult(N(this,se),this.options);if(le(this,Je,N(this,se).state),le(this,pt,this.options),N(this,Je).data!==void 0&&le(this,gt,N(this,se)),Qo(r,o))return;le(this,xe,r);const a={},c=()=>{if(!o)return!0;const{notifyOnChangeProps:l}=this.options,i=typeof l=="function"?l():l;if(i==="all"||!i&&!N(this,vt).size)return!0;const d=new Set(i??N(this,vt));return this.options.throwOnError&&d.add("error"),Object.keys(N(this,xe)).some(u=>{const h=u;return N(this,xe)[h]!==o[h]&&d.has(h)})};(t==null?void 0:t.listeners)!==!1&&c()&&(a.listeners=!0),he(this,fo,Vr).call(this,{...a,...t})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&he(this,zt,nn).call(this)}},$e=new WeakMap,se=new WeakMap,Dt=new WeakMap,xe=new WeakMap,Je=new WeakMap,pt=new WeakMap,Oe=new WeakMap,Ot=new WeakMap,mt=new WeakMap,gt=new WeakMap,et=new WeakMap,tt=new WeakMap,Ge=new WeakMap,vt=new WeakMap,ot=new WeakSet,Nt=function(t){he(this,Kt,sn).call(this);let o=N(this,se).fetch(this.options,t);return t!=null&&t.throwOnError||(o=o.catch(ec)),o},Ft=new WeakSet,en=function(){if(he(this,Bt,rn).call(this),Bn||N(this,xe).isStale||!Un(this.options.staleTime))return;const o=tc(N(this,xe).dataUpdatedAt,this.options.staleTime)+1;le(this,et,setTimeout(()=>{N(this,xe).isStale||this.updateResult()},o))},Ht=new WeakSet,tn=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(N(this,se)):this.options.refetchInterval)??!1},Vt=new WeakSet,on=function(t){he(this,Ut,an).call(this),le(this,Ge,t),!(Bn||this.options.enabled===!1||!Un(N(this,Ge))||N(this,Ge)===0)&&le(this,tt,setInterval(()=>{(this.options.refetchIntervalInBackground||oc.isFocused())&&he(this,ot,Nt).call(this)},N(this,Ge)))},zt=new WeakSet,nn=function(){he(this,Ft,en).call(this),he(this,Vt,on).call(this,he(this,Ht,tn).call(this))},Bt=new WeakSet,rn=function(){N(this,et)&&(clearTimeout(N(this,et)),le(this,et,void 0))},Ut=new WeakSet,an=function(){N(this,tt)&&(clearInterval(N(this,tt)),le(this,tt,void 0))},Kt=new WeakSet,sn=function(){const t=N(this,$e).getQueryCache().build(N(this,$e),this.options);if(t===N(this,se))return;const o=N(this,se);le(this,se,t),le(this,Dt,t.state),this.hasListeners()&&(o==null||o.removeObserver(this),t.addObserver(this))},fo=new WeakSet,Vr=function(t){Er.batch(()=>{t.listeners&&this.listeners.forEach(o=>{o(N(this,xe))}),N(this,$e).getQueryCache().notify({query:N(this,se),type:"observerResultsUpdated"})})},yr);function Mc(e,t){return t.enabled!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function Gn(e,t){return Mc(e,t)||e.state.data!==void 0&&cn(e,t,t.refetchOnMount)}function cn(e,t,o){if(t.enabled!==!1){const r=typeof o=="function"?o(e):o;return r==="always"||r!==!1&&Sn(e,t)}return!1}function Zn(e,t,o,r){return(e!==t||r.enabled===!1)&&(!o.suspense||e.state.status!=="error")&&Sn(e,o)}function Sn(e,t){return t.enabled!==!1&&e.isStaleByTime(t.staleTime)}function Nc(e,t){return!Qo(e.getCurrentResult(),t)}var zr=n.createContext(!1),Tc=()=>n.useContext(zr);zr.Provider;function _c(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Pc=n.createContext(_c()),Ic=()=>n.useContext(Pc);function Ac(e,t){return typeof e=="function"?e(...t):!!e}var Lc=(e,t)=>{(e.suspense||e.throwOnError)&&(t.isReset()||(e.retryOnMount=!1))},Dc=e=>{n.useEffect(()=>{e.clearReset()},[e])},Oc=({result:e,errorResetBoundary:t,throwOnError:o,query:r})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&Ac(o,[e.error,r]),Fc=e=>{e.suspense&&typeof e.staleTime!="number"&&(e.staleTime=1e3)},Hc=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,Vc=(e,t,o)=>t.fetchOptimistic(e).catch(()=>{o.clearReset()});function zc(e,t,o){const r=rc(),a=Tc(),c=Ic(),l=r.defaultQueryOptions(e);l._optimisticResults=a?"isRestoring":"optimistic",Fc(l),Lc(l,c),Dc(c);const[i]=n.useState(()=>new t(r,l)),d=i.getOptimisticResult(l);if(n.useSyncExternalStore(n.useCallback(u=>{const h=a?()=>{}:i.subscribe(Er.batchCalls(u));return i.updateResult(),h},[i,a]),()=>i.getCurrentResult(),()=>i.getCurrentResult()),n.useEffect(()=>{i.setOptions(l,{listeners:!1})},[l,i]),Hc(l,d))throw Vc(l,i,c);if(Oc({result:d,errorResetBoundary:c,throwOnError:l.throwOnError,query:r.getQueryCache().get(l.queryHash)}))throw d.error;return l.notifyOnChangeProps?d:i.trackResult(d)}function Bc(e,t){return zc(e,Rc)}const xo=n.forwardRef((e,t)=>{var o;const{container:r=globalThis==null||(o=globalThis.document)===null||o===void 0?void 0:o.body,...a}=e;return r?ac.createPortal(n.createElement(z.div,C({},a,{ref:t})),r):null});var Fe=function(){return Fe=Object.assign||function(t){for(var o,r=1,a=arguments.length;r"u")return si;var t=ci(e),o=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-o+t[2]-t[0])}},li=Kr(),ht="data-scroll-locked",di=function(e,t,o,r){var a=e.left,c=e.top,l=e.right,i=e.gap;return o===void 0&&(o="margin"),` + .`.concat(Kc,` { + overflow: hidden `).concat(r,`; + padding-right: `).concat(i,"px ").concat(r,`; + } + body[`).concat(ht,`] { + overflow: hidden `).concat(r,`; + overscroll-behavior: contain; + `).concat([t&&"position: relative ".concat(r,";"),o==="margin"&&` + padding-left: `.concat(a,`px; + padding-top: `).concat(c,`px; + padding-right: `).concat(l,`px; + margin-left:0; + margin-top:0; + margin-right: `).concat(i,"px ").concat(r,`; + `),o==="padding"&&"padding-right: ".concat(i,"px ").concat(r,";")].filter(Boolean).join(""),` + } + + .`).concat(ro,` { + right: `).concat(i,"px ").concat(r,`; + } + + .`).concat(ao,` { + margin-right: `).concat(i,"px ").concat(r,`; + } + + .`).concat(ro," .").concat(ro,` { + right: 0 `).concat(r,`; + } + + .`).concat(ao," .").concat(ao,` { + margin-right: 0 `).concat(r,`; + } + + body[`).concat(ht,`] { + `).concat(Wc,": ").concat(i,`px; + } +`)},Yn=function(){var e=parseInt(document.body.getAttribute(ht)||"0",10);return isFinite(e)?e:0},ui=function(){n.useEffect(function(){return document.body.setAttribute(ht,(Yn()+1).toString()),function(){var e=Yn()-1;e<=0?document.body.removeAttribute(ht):document.body.setAttribute(ht,e.toString())}},[])},fi=function(e){var t=e.noRelative,o=e.noImportant,r=e.gapMode,a=r===void 0?"margin":r;ui();var c=n.useMemo(function(){return ii(a)},[a]);return n.createElement(li,{styles:di(c,!t,a,o?"":"!important")})};function hi(){if(console&&console.warn){for(var e=arguments.length,t=new Array(e),o=0;o()=>{if(e.isInitialized)t();else{const o=()=>{setTimeout(()=>{e.off("initialized",o)},0),t()};e.on("initialized",o)}};function Qn(e,t,o){e.loadNamespaces(t,Wr(e,o))}function Jn(e,t,o,r){typeof o=="string"&&(o=[o]),o.forEach(a=>{e.options.ns.indexOf(a)<0&&e.options.ns.push(a)}),e.loadLanguages(t,Wr(e,r))}function pi(e,t){let o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const r=t.languages[0],a=t.options?t.options.fallbackLng:!1,c=t.languages[t.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const l=(i,d)=>{const u=t.services.backendConnector.state[`${i}|${d}`];return u===-1||u===2};return o.bindI18n&&o.bindI18n.indexOf("languageChanging")>-1&&t.services.backendConnector.backend&&t.isLanguageChangingTo&&!l(t.isLanguageChangingTo,e)?!1:!!(t.hasResourceBundle(r,e)||!t.services.backendConnector.backend||t.options.resources&&!t.options.partialBundledLanguages||l(r,e)&&(!a||l(c,e)))}function mi(e,t){let o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return!t.languages||!t.languages.length?(ln("i18n.languages were undefined or empty",t.languages),!0):t.options.ignoreJSONStructure!==void 0?t.hasLoadedNamespace(e,{lng:o.lng,precheck:(a,c)=>{if(o.bindI18n&&o.bindI18n.indexOf("languageChanging")>-1&&a.services.backendConnector.backend&&a.isLanguageChangingTo&&!c(a.isLanguageChangingTo,e))return!1}}):pi(e,t,o)}const gi=n.createContext();class vi{constructor(){this.usedNamespaces={}}addUsedNamespaces(t){t.forEach(o=>{this.usedNamespaces[o]||(this.usedNamespaces[o]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const bi=(e,t)=>{const o=n.useRef();return n.useEffect(()=>{o.current=e},[e,t]),o.current};function Gr(e,t,o,r){return e.getFixedT(t,o,r)}function xi(e,t,o,r){return n.useCallback(Gr(e,t,o,r),[e,t,o,r])}function wi(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{i18n:o}=t,{i18n:r,defaultNS:a}=n.useContext(gi)||{},c=o||r||cc();if(c&&!c.reportNamespaces&&(c.reportNamespaces=new vi),!c){ln("You will need to pass in an i18next instance by using initReactI18next");const E=(D,y)=>typeof y=="string"?y:y&&typeof y=="object"&&typeof y.defaultValue=="string"?y.defaultValue:Array.isArray(D)?D[D.length-1]:D,k=[E,{},!1];return k.t=E,k.i18n={},k.ready=!1,k}c.options.react&&c.options.react.wait!==void 0&&ln("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const l={...sc(),...c.options.react,...t},{useSuspense:i,keyPrefix:d}=l;let u=a||c.options&&c.options.defaultNS;u=typeof u=="string"?[u]:u||["translation"],c.reportNamespaces.addUsedNamespaces&&c.reportNamespaces.addUsedNamespaces(u);const h=(c.isInitialized||c.initializedStoreOnce)&&u.every(E=>mi(E,c,l)),f=xi(c,t.lng||null,l.nsMode==="fallback"?u:u[0],d),m=()=>f,b=()=>Gr(c,t.lng||null,l.nsMode==="fallback"?u:u[0],d),[g,p]=n.useState(m);let x=u.join();t.lng&&(x=`${t.lng}${x}`);const w=bi(x),v=n.useRef(!0);n.useEffect(()=>{const{bindI18n:E,bindI18nStore:k}=l;v.current=!0,!h&&!i&&(t.lng?Jn(c,t.lng,u,()=>{v.current&&p(b)}):Qn(c,u,()=>{v.current&&p(b)})),h&&w&&w!==x&&v.current&&p(b);function D(){v.current&&p(b)}return E&&c&&c.on(E,D),k&&c&&c.store.on(k,D),()=>{v.current=!1,E&&c&&E.split(" ").forEach(y=>c.off(y,D)),k&&c&&k.split(" ").forEach(y=>c.store.off(y,D))}},[c,x]),n.useEffect(()=>{v.current&&h&&p(m)},[c,d,h]);const $=[g,c,h];if($.t=g,$.i18n=c,$.ready=h,h||!h&&!i)return $;throw new Promise(E=>{t.lng?Jn(c,t.lng,u,()=>E()):Qn(c,u,()=>E())})}function Ce(e,t){if(e==null)return{};var o={},r=Object.keys(e),a,c;for(c=0;c=0)&&(o[a]=e[a]);return o}var $i=["color"],Ci=n.forwardRef(function(e,t){var o=e.color,r=o===void 0?"currentColor":o,a=Ce(e,$i);return n.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},a,{ref:t}),n.createElement("path",{d:"M0.877014 7.49988C0.877014 3.84219 3.84216 0.877045 7.49985 0.877045C11.1575 0.877045 14.1227 3.84219 14.1227 7.49988C14.1227 11.1575 11.1575 14.1227 7.49985 14.1227C3.84216 14.1227 0.877014 11.1575 0.877014 7.49988ZM7.49985 1.82704C4.36683 1.82704 1.82701 4.36686 1.82701 7.49988C1.82701 8.97196 2.38774 10.3131 3.30727 11.3213C4.19074 9.94119 5.73818 9.02499 7.50023 9.02499C9.26206 9.02499 10.8093 9.94097 11.6929 11.3208C12.6121 10.3127 13.1727 8.97172 13.1727 7.49988C13.1727 4.36686 10.6328 1.82704 7.49985 1.82704ZM10.9818 11.9787C10.2839 10.7795 8.9857 9.97499 7.50023 9.97499C6.01458 9.97499 4.71624 10.7797 4.01845 11.9791C4.97952 12.7272 6.18765 13.1727 7.49985 13.1727C8.81227 13.1727 10.0206 12.727 10.9818 11.9787ZM5.14999 6.50487C5.14999 5.207 6.20212 4.15487 7.49999 4.15487C8.79786 4.15487 9.84999 5.207 9.84999 6.50487C9.84999 7.80274 8.79786 8.85487 7.49999 8.85487C6.20212 8.85487 5.14999 7.80274 5.14999 6.50487ZM7.49999 5.10487C6.72679 5.10487 6.09999 5.73167 6.09999 6.50487C6.09999 7.27807 6.72679 7.90487 7.49999 7.90487C8.27319 7.90487 8.89999 7.27807 8.89999 6.50487C8.89999 5.73167 8.27319 5.10487 7.49999 5.10487Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),yi=["color"],Ei=n.forwardRef(function(e,t){var o=e.color,r=o===void 0?"currentColor":o,a=Ce(e,yi);return n.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},a,{ref:t}),n.createElement("path",{d:"M3.13523 6.15803C3.3241 5.95657 3.64052 5.94637 3.84197 6.13523L7.5 9.56464L11.158 6.13523C11.3595 5.94637 11.6759 5.95657 11.8648 6.15803C12.0536 6.35949 12.0434 6.67591 11.842 6.86477L7.84197 10.6148C7.64964 10.7951 7.35036 10.7951 7.15803 10.6148L3.15803 6.86477C2.95657 6.67591 2.94637 6.35949 3.13523 6.15803Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),Si=["color"],ji=n.forwardRef(function(e,t){var o=e.color,r=o===void 0?"currentColor":o,a=Ce(e,Si);return n.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},a,{ref:t}),n.createElement("path",{d:"M9.96424 2.68571C10.0668 2.42931 9.94209 2.13833 9.6857 2.03577C9.4293 1.93322 9.13832 2.05792 9.03576 2.31432L5.03576 12.3143C4.9332 12.5707 5.05791 12.8617 5.3143 12.9642C5.5707 13.0668 5.86168 12.9421 5.96424 12.6857L9.96424 2.68571ZM3.85355 5.14646C4.04882 5.34172 4.04882 5.6583 3.85355 5.85356L2.20711 7.50001L3.85355 9.14646C4.04882 9.34172 4.04882 9.6583 3.85355 9.85356C3.65829 10.0488 3.34171 10.0488 3.14645 9.85356L1.14645 7.85356C0.951184 7.6583 0.951184 7.34172 1.14645 7.14646L3.14645 5.14646C3.34171 4.9512 3.65829 4.9512 3.85355 5.14646ZM11.1464 5.14646C11.3417 4.9512 11.6583 4.9512 11.8536 5.14646L13.8536 7.14646C14.0488 7.34172 14.0488 7.6583 13.8536 7.85356L11.8536 9.85356C11.6583 10.0488 11.3417 10.0488 11.1464 9.85356C10.9512 9.6583 10.9512 9.34172 11.1464 9.14646L12.7929 7.50001L11.1464 5.85356C10.9512 5.6583 10.9512 5.34172 11.1464 5.14646Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),ki=["color"],Ri=n.forwardRef(function(e,t){var o=e.color,r=o===void 0?"currentColor":o,a=Ce(e,ki);return n.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},a,{ref:t}),n.createElement("path",{d:"M13.15 7.49998C13.15 4.66458 10.9402 1.84998 7.50002 1.84998C4.72167 1.84998 3.34849 3.9064 2.76335 5H4.5C4.77614 5 5 5.22386 5 5.5C5 5.77614 4.77614 6 4.5 6H1.5C1.22386 6 1 5.77614 1 5.5V2.5C1 2.22386 1.22386 2 1.5 2C1.77614 2 2 2.22386 2 2.5V4.31318C2.70453 3.07126 4.33406 0.849976 7.50002 0.849976C11.5628 0.849976 14.15 4.18537 14.15 7.49998C14.15 10.8146 11.5628 14.15 7.50002 14.15C5.55618 14.15 3.93778 13.3808 2.78548 12.2084C2.16852 11.5806 1.68668 10.839 1.35816 10.0407C1.25306 9.78536 1.37488 9.49315 1.63024 9.38806C1.8856 9.28296 2.17781 9.40478 2.2829 9.66014C2.56374 10.3425 2.97495 10.9745 3.4987 11.5074C4.47052 12.4963 5.83496 13.15 7.50002 13.15C10.9402 13.15 13.15 10.3354 13.15 7.49998ZM7.5 4.00001C7.77614 4.00001 8 4.22387 8 4.50001V7.29291L9.85355 9.14646C10.0488 9.34172 10.0488 9.65831 9.85355 9.85357C9.65829 10.0488 9.34171 10.0488 9.14645 9.85357L7.14645 7.85357C7.05268 7.7598 7 7.63262 7 7.50001V4.50001C7 4.22387 7.22386 4.00001 7.5 4.00001Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),Mi=["color"],Ni=n.forwardRef(function(e,t){var o=e.color,r=o===void 0?"currentColor":o,a=Ce(e,Mi);return n.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},a,{ref:t}),n.createElement("path",{d:"M12.8536 2.85355C13.0488 2.65829 13.0488 2.34171 12.8536 2.14645C12.6583 1.95118 12.3417 1.95118 12.1464 2.14645L7.5 6.79289L2.85355 2.14645C2.65829 1.95118 2.34171 1.95118 2.14645 2.14645C1.95118 2.34171 1.95118 2.65829 2.14645 2.85355L6.79289 7.5L2.14645 12.1464C1.95118 12.3417 1.95118 12.6583 2.14645 12.8536C2.34171 13.0488 2.65829 13.0488 2.85355 12.8536L7.5 8.20711L12.1464 12.8536C12.3417 13.0488 12.6583 13.0488 12.8536 12.8536C13.0488 12.6583 13.0488 12.3417 12.8536 12.1464L8.20711 7.5L12.8536 2.85355Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),Ti=["color"],_i=n.forwardRef(function(e,t){var o=e.color,r=o===void 0?"currentColor":o,a=Ce(e,Ti);return n.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},a,{ref:t}),n.createElement("path",{d:"M3.625 7.5C3.625 8.12132 3.12132 8.625 2.5 8.625C1.87868 8.625 1.375 8.12132 1.375 7.5C1.375 6.87868 1.87868 6.375 2.5 6.375C3.12132 6.375 3.625 6.87868 3.625 7.5ZM8.625 7.5C8.625 8.12132 8.12132 8.625 7.5 8.625C6.87868 8.625 6.375 8.12132 6.375 7.5C6.375 6.87868 6.87868 6.375 7.5 6.375C8.12132 6.375 8.625 6.87868 8.625 7.5ZM12.5 8.625C13.1213 8.625 13.625 8.12132 13.625 7.5C13.625 6.87868 13.1213 6.375 12.5 6.375C11.8787 6.375 11.375 6.87868 11.375 7.5C11.375 8.12132 11.8787 8.625 12.5 8.625Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),Pi=["color"],Ii=n.forwardRef(function(e,t){var o=e.color,r=o===void 0?"currentColor":o,a=Ce(e,Pi);return n.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},a,{ref:t}),n.createElement("path",{d:"M7.50005 1.04999C7.74858 1.04999 7.95005 1.25146 7.95005 1.49999V8.41359L10.1819 6.18179C10.3576 6.00605 10.6425 6.00605 10.8182 6.18179C10.994 6.35753 10.994 6.64245 10.8182 6.81819L7.81825 9.81819C7.64251 9.99392 7.35759 9.99392 7.18185 9.81819L4.18185 6.81819C4.00611 6.64245 4.00611 6.35753 4.18185 6.18179C4.35759 6.00605 4.64251 6.00605 4.81825 6.18179L7.05005 8.41359V1.49999C7.05005 1.25146 7.25152 1.04999 7.50005 1.04999ZM2.5 10C2.77614 10 3 10.2239 3 10.5V12C3 12.5539 3.44565 13 3.99635 13H11.0012C11.5529 13 12 12.5528 12 12V10.5C12 10.2239 12.2239 10 12.5 10C12.7761 10 13 10.2239 13 10.5V12C13 13.1041 12.1062 14 11.0012 14H3.99635C2.89019 14 2 13.103 2 12V10.5C2 10.2239 2.22386 10 2.5 10Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),Ai=["color"],Li=n.forwardRef(function(e,t){var o=e.color,r=o===void 0?"currentColor":o,a=Ce(e,Ai);return n.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},a,{ref:t}),n.createElement("path",{d:"M7.07095 0.650238C6.67391 0.650238 6.32977 0.925096 6.24198 1.31231L6.0039 2.36247C5.6249 2.47269 5.26335 2.62363 4.92436 2.81013L4.01335 2.23585C3.67748 2.02413 3.23978 2.07312 2.95903 2.35386L2.35294 2.95996C2.0722 3.2407 2.0232 3.6784 2.23493 4.01427L2.80942 4.92561C2.62307 5.2645 2.47227 5.62594 2.36216 6.00481L1.31209 6.24287C0.924883 6.33065 0.650024 6.6748 0.650024 7.07183V7.92897C0.650024 8.32601 0.924883 8.67015 1.31209 8.75794L2.36228 8.99603C2.47246 9.375 2.62335 9.73652 2.80979 10.0755L2.2354 10.9867C2.02367 11.3225 2.07267 11.7602 2.35341 12.041L2.95951 12.6471C3.24025 12.9278 3.67795 12.9768 4.01382 12.7651L4.92506 12.1907C5.26384 12.377 5.62516 12.5278 6.0039 12.6379L6.24198 13.6881C6.32977 14.0753 6.67391 14.3502 7.07095 14.3502H7.92809C8.32512 14.3502 8.66927 14.0753 8.75705 13.6881L8.99505 12.6383C9.37411 12.5282 9.73573 12.3773 10.0748 12.1909L10.986 12.7653C11.3218 12.977 11.7595 12.928 12.0403 12.6473L12.6464 12.0412C12.9271 11.7604 12.9761 11.3227 12.7644 10.9869L12.1902 10.076C12.3768 9.73688 12.5278 9.37515 12.638 8.99596L13.6879 8.75794C14.0751 8.67015 14.35 8.32601 14.35 7.92897V7.07183C14.35 6.6748 14.0751 6.33065 13.6879 6.24287L12.6381 6.00488C12.528 5.62578 12.3771 5.26414 12.1906 4.92507L12.7648 4.01407C12.9766 3.6782 12.9276 3.2405 12.6468 2.95975L12.0407 2.35366C11.76 2.07292 11.3223 2.02392 10.9864 2.23565L10.0755 2.80989C9.73622 2.62328 9.37437 2.47229 8.99505 2.36209L8.75705 1.31231C8.66927 0.925096 8.32512 0.650238 7.92809 0.650238H7.07095ZM4.92053 3.81251C5.44724 3.44339 6.05665 3.18424 6.71543 3.06839L7.07095 1.50024H7.92809L8.28355 3.06816C8.94267 3.18387 9.5524 3.44302 10.0794 3.81224L11.4397 2.9547L12.0458 3.56079L11.1882 4.92117C11.5573 5.44798 11.8164 6.0575 11.9321 6.71638L13.5 7.07183V7.92897L11.932 8.28444C11.8162 8.94342 11.557 9.55301 11.1878 10.0798L12.0453 11.4402L11.4392 12.0462L10.0787 11.1886C9.55192 11.5576 8.94241 11.8166 8.28355 11.9323L7.92809 13.5002H7.07095L6.71543 11.932C6.0569 11.8162 5.44772 11.5572 4.92116 11.1883L3.56055 12.046L2.95445 11.4399L3.81213 10.0794C3.4431 9.55266 3.18403 8.94326 3.06825 8.2845L1.50002 7.92897V7.07183L3.06818 6.71632C3.18388 6.05765 3.44283 5.44833 3.81171 4.92165L2.95398 3.561L3.56008 2.95491L4.92053 3.81251ZM9.02496 7.50008C9.02496 8.34226 8.34223 9.02499 7.50005 9.02499C6.65786 9.02499 5.97513 8.34226 5.97513 7.50008C5.97513 6.65789 6.65786 5.97516 7.50005 5.97516C8.34223 5.97516 9.02496 6.65789 9.02496 7.50008ZM9.92496 7.50008C9.92496 8.83932 8.83929 9.92499 7.50005 9.92499C6.1608 9.92499 5.07513 8.83932 5.07513 7.50008C5.07513 6.16084 6.1608 5.07516 7.50005 5.07516C8.83929 5.07516 9.92496 6.16084 9.92496 7.50008Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),Di=["color"],Oi=n.forwardRef(function(e,t){var o=e.color,r=o===void 0?"currentColor":o,a=Ce(e,Di);return n.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},a,{ref:t}),n.createElement("path",{d:"M7.49933 0.25C3.49635 0.25 0.25 3.49593 0.25 7.50024C0.25 10.703 2.32715 13.4206 5.2081 14.3797C5.57084 14.446 5.70302 14.2222 5.70302 14.0299C5.70302 13.8576 5.69679 13.4019 5.69323 12.797C3.67661 13.235 3.25112 11.825 3.25112 11.825C2.92132 10.9874 2.44599 10.7644 2.44599 10.7644C1.78773 10.3149 2.49584 10.3238 2.49584 10.3238C3.22353 10.375 3.60629 11.0711 3.60629 11.0711C4.25298 12.1788 5.30335 11.8588 5.71638 11.6732C5.78225 11.205 5.96962 10.8854 6.17658 10.7043C4.56675 10.5209 2.87415 9.89918 2.87415 7.12104C2.87415 6.32925 3.15677 5.68257 3.62053 5.17563C3.54576 4.99226 3.29697 4.25521 3.69174 3.25691C3.69174 3.25691 4.30015 3.06196 5.68522 3.99973C6.26337 3.83906 6.8838 3.75895 7.50022 3.75583C8.1162 3.75895 8.73619 3.83906 9.31523 3.99973C10.6994 3.06196 11.3069 3.25691 11.3069 3.25691C11.7026 4.25521 11.4538 4.99226 11.3795 5.17563C11.8441 5.68257 12.1245 6.32925 12.1245 7.12104C12.1245 9.9063 10.4292 10.5192 8.81452 10.6985C9.07444 10.9224 9.30633 11.3648 9.30633 12.0413C9.30633 13.0102 9.29742 13.7922 9.29742 14.0299C9.29742 14.2239 9.42828 14.4496 9.79591 14.3788C12.6746 13.4179 14.75 10.7025 14.75 7.50024C14.75 3.49593 11.5036 0.25 7.49933 0.25Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),Fi=["color"],Hi=n.forwardRef(function(e,t){var o=e.color,r=o===void 0?"currentColor":o,a=Ce(e,Fi);return n.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},a,{ref:t}),n.createElement("path",{d:"M8 2.75C8 2.47386 7.77614 2.25 7.5 2.25C7.22386 2.25 7 2.47386 7 2.75V7H2.75C2.47386 7 2.25 7.22386 2.25 7.5C2.25 7.77614 2.47386 8 2.75 8H7V12.25C7 12.5261 7.22386 12.75 7.5 12.75C7.77614 12.75 8 12.5261 8 12.25V8H12.25C12.5261 8 12.75 7.77614 12.75 7.5C12.75 7.22386 12.5261 7 12.25 7H8V2.75Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),Vi=["color"],zi=n.forwardRef(function(e,t){var o=e.color,r=o===void 0?"currentColor":o,a=Ce(e,Vi);return n.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},a,{ref:t}),n.createElement("path",{d:"M7.49991 0.876892C3.84222 0.876892 0.877075 3.84204 0.877075 7.49972C0.877075 11.1574 3.84222 14.1226 7.49991 14.1226C11.1576 14.1226 14.1227 11.1574 14.1227 7.49972C14.1227 3.84204 11.1576 0.876892 7.49991 0.876892ZM1.82707 7.49972C1.82707 4.36671 4.36689 1.82689 7.49991 1.82689C10.6329 1.82689 13.1727 4.36671 13.1727 7.49972C13.1727 10.6327 10.6329 13.1726 7.49991 13.1726C4.36689 13.1726 1.82707 10.6327 1.82707 7.49972ZM7.50003 4C7.77617 4 8.00003 4.22386 8.00003 4.5V7H10.5C10.7762 7 11 7.22386 11 7.5C11 7.77614 10.7762 8 10.5 8H8.00003V10.5C8.00003 10.7761 7.77617 11 7.50003 11C7.22389 11 7.00003 10.7761 7.00003 10.5V8H4.50003C4.22389 8 4.00003 7.77614 4.00003 7.5C4.00003 7.22386 4.22389 7 4.50003 7H7.00003V4.5C7.00003 4.22386 7.22389 4 7.50003 4Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),Bi=["color"],Ui=n.forwardRef(function(e,t){var o=e.color,r=o===void 0?"currentColor":o,a=Ce(e,Bi);return n.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},a,{ref:t}),n.createElement("path",{d:"M0.877075 7.49972C0.877075 3.84204 3.84222 0.876892 7.49991 0.876892C11.1576 0.876892 14.1227 3.84204 14.1227 7.49972C14.1227 11.1574 11.1576 14.1226 7.49991 14.1226C3.84222 14.1226 0.877075 11.1574 0.877075 7.49972ZM7.49991 1.82689C4.36689 1.82689 1.82708 4.36671 1.82708 7.49972C1.82708 10.6327 4.36689 13.1726 7.49991 13.1726C10.6329 13.1726 13.1727 10.6327 13.1727 7.49972C13.1727 4.36671 10.6329 1.82689 7.49991 1.82689ZM8.24993 10.5C8.24993 10.9142 7.91414 11.25 7.49993 11.25C7.08571 11.25 6.74993 10.9142 6.74993 10.5C6.74993 10.0858 7.08571 9.75 7.49993 9.75C7.91414 9.75 8.24993 10.0858 8.24993 10.5ZM6.05003 6.25C6.05003 5.57211 6.63511 4.925 7.50003 4.925C8.36496 4.925 8.95003 5.57211 8.95003 6.25C8.95003 6.74118 8.68002 6.99212 8.21447 7.27494C8.16251 7.30651 8.10258 7.34131 8.03847 7.37854L8.03841 7.37858C7.85521 7.48497 7.63788 7.61119 7.47449 7.73849C7.23214 7.92732 6.95003 8.23198 6.95003 8.7C6.95004 9.00376 7.19628 9.25 7.50004 9.25C7.8024 9.25 8.04778 9.00601 8.05002 8.70417L8.05056 8.7033C8.05924 8.6896 8.08493 8.65735 8.15058 8.6062C8.25207 8.52712 8.36508 8.46163 8.51567 8.37436L8.51571 8.37433C8.59422 8.32883 8.68296 8.27741 8.78559 8.21506C9.32004 7.89038 10.05 7.35382 10.05 6.25C10.05 4.92789 8.93511 3.825 7.50003 3.825C6.06496 3.825 4.95003 4.92789 4.95003 6.25C4.95003 6.55376 5.19628 6.8 5.50003 6.8C5.80379 6.8 6.05003 6.55376 6.05003 6.25Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),Ki=["color"],Wi=n.forwardRef(function(e,t){var o=e.color,r=o===void 0?"currentColor":o,a=Ce(e,Ki);return n.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},a,{ref:t}),n.createElement("path",{d:"M3.5 5.00006C3.22386 5.00006 3 5.22392 3 5.50006L3 11.5001C3 11.7762 3.22386 12.0001 3.5 12.0001L11.5 12.0001C11.7761 12.0001 12 11.7762 12 11.5001L12 5.50006C12 5.22392 11.7761 5.00006 11.5 5.00006L10.25 5.00006C9.97386 5.00006 9.75 4.7762 9.75 4.50006C9.75 4.22392 9.97386 4.00006 10.25 4.00006L11.5 4.00006C12.3284 4.00006 13 4.67163 13 5.50006L13 11.5001C13 12.3285 12.3284 13.0001 11.5 13.0001L3.5 13.0001C2.67157 13.0001 2 12.3285 2 11.5001L2 5.50006C2 4.67163 2.67157 4.00006 3.5 4.00006L4.75 4.00006C5.02614 4.00006 5.25 4.22392 5.25 4.50006C5.25 4.7762 5.02614 5.00006 4.75 5.00006L3.5 5.00006ZM7 1.6364L5.5682 3.0682C5.39246 3.24393 5.10754 3.24393 4.9318 3.0682C4.75607 2.89246 4.75607 2.60754 4.9318 2.4318L7.1818 0.181802C7.26619 0.09741 7.38065 0.049999 7.5 0.049999C7.61935 0.049999 7.73381 0.09741 7.8182 0.181802L10.0682 2.4318C10.2439 2.60754 10.2439 2.89246 10.0682 3.0682C9.89246 3.24393 9.60754 3.24393 9.4318 3.0682L8 1.6364L8 8.5C8 8.77614 7.77614 9 7.5 9C7.22386 9 7 8.77614 7 8.5L7 1.6364Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),Gi=["color"],Zi=n.forwardRef(function(e,t){var o=e.color,r=o===void 0?"currentColor":o,a=Ce(e,Gi);return n.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},a,{ref:t}),n.createElement("path",{d:"M5.5 1C5.22386 1 5 1.22386 5 1.5C5 1.77614 5.22386 2 5.5 2H9.5C9.77614 2 10 1.77614 10 1.5C10 1.22386 9.77614 1 9.5 1H5.5ZM3 3.5C3 3.22386 3.22386 3 3.5 3H5H10H11.5C11.7761 3 12 3.22386 12 3.5C12 3.77614 11.7761 4 11.5 4H11V12C11 12.5523 10.5523 13 10 13H5C4.44772 13 4 12.5523 4 12V4L3.5 4C3.22386 4 3 3.77614 3 3.5ZM5 4H10V12H5V4Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),qi={BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};const wo=qi.VITE_API_HOST??"/v1";async function Yi(e,t,o){const r=await fetch(`${wo}/share/${e}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:t.prompt(o),html:t.pureHTML(o),name:t.name,emoji:t.emoji})});if(r.status!==201){const a=await r.json();throw new Error(a.error.message)}}async function Xi(e,t,o){const r=await fetch(`${wo}/vote`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:t.prompt(o),html:t.pureHTML(o),name:t.name,emoji:t.emoji,vote:e})});if(r.status!==201){const a=await r.json();throw new Error(a.error.message)}}async function Qi(e){const t=await fetch(`${wo}/share/${e}`);if(t.status!==200){const r=await t.json();throw new Error(r.error.message)}const o=await t.json();return o.createdAt=new Date,o}async function Ji(){const e=await fetch(`${wo}/session`);if(e.status!==404)return await e.json()}function Zr(e){var t,o,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;ttypeof e=="boolean"?"".concat(e):e===0?"0":e,tr=el,qr=(e,t)=>o=>{var r;if((t==null?void 0:t.variants)==null)return tr(e,o==null?void 0:o.class,o==null?void 0:o.className);const{variants:a,defaultVariants:c}=t,l=Object.keys(a).map(u=>{const h=o==null?void 0:o[u],f=c==null?void 0:c[u];if(h===null)return null;const m=er(h)||er(f);return a[u][m]}),i=o&&Object.entries(o).reduce((u,h)=>{let[f,m]=h;return m===void 0||(u[f]=m),u},{}),d=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((u,h)=>{let{class:f,className:m,...b}=h;return Object.entries(b).every(g=>{let[p,x]=g;return Array.isArray(x)?x.includes({...c,...i}[p]):{...c,...i}[p]===x})?[...u,f,m]:u},[]);return tr(e,l,d,o==null?void 0:o.class,o==null?void 0:o.className)};globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};const tl=qr("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),J=n.forwardRef(({className:e,variant:t,size:o,asChild:r=!1,...a},c)=>{const l=r?rt:"button";return s.jsx(l,{className:T(tl({variant:t,size:o,className:e})),ref:c,...a})});J.displayName="Button";globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};function ol(e){const t=e.split(` +`),[o,r]=[t[0],t.slice(1)];return[o,r.join(` +`)]}function Yr({mode:e="html",error:t,isLoading:o=!1}){const r=o?"animate-pulse":"";if(t){const[a,c]=ol(t);return s.jsx("div",{className:"mx-auto mt-10 w-full max-w-[80%]",children:s.jsx("div",{className:"bg-secondary text-black dark:text-white",children:s.jsxs("div",{role:"alert",className:"relative mb-2 rounded border-l-4 border-red-500 p-4",children:[s.jsx("strong",{className:"font-bold",children:"Error! "}),s.jsx("span",{className:"block sm:inline",children:a}),c!==""&&s.jsx("p",{className:"mt-4 text-sm text-muted-foreground",children:c})]})})})}return s.jsxs("div",{className:"ml-[15%] w-full max-w-[80%]",children:[" ",s.jsxs("div",{role:"status",className:`my-7 ${r}`,children:[" ",s.jsx("div",{className:"mb-4 h-2.5 w-[82%] rounded-full bg-zinc-300 dark:bg-zinc-700"}),s.jsx("div",{className:"mb-2.5 h-2 max-w-[75%] rounded-full bg-zinc-200 dark:bg-zinc-700"}),s.jsx("div",{className:"mb-2.5 h-2 max-w-[80%] rounded-full bg-zinc-200 dark:bg-zinc-700"}),s.jsx("div",{className:"mb-2.5 h-2 max-w-[75%] rounded-full bg-zinc-200 dark:bg-zinc-700"}),s.jsx("div",{className:"mb-2.5 h-2 max-w-[70%] rounded-full bg-zinc-200 dark:bg-zinc-700"}),s.jsx("div",{className:"h-2 max-w-[80%] rounded-full bg-zinc-200 dark:bg-zinc-700"}),s.jsx("span",{className:"sr-only",children:"Loading..."})," "]}),e==="html"&&s.jsxs("div",{role:"status",className:`mb-7 max-w-[80%] ${r}`,children:[" ",s.jsxs("div",{className:"flex h-48 w-full items-center justify-center rounded bg-zinc-300 dark:bg-zinc-700",children:[" ",s.jsx("svg",{className:"h-12 w-12 text-gray-200",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",fill:"currentColor",viewBox:"0 0 640 512",children:s.jsx("path",{d:"M480 80C480 35.82 515.8 0 560 0C604.2 0 640 35.82 640 80C640 124.2 604.2 160 560 160C515.8 160 480 124.2 480 80zM0 456.1C0 445.6 2.964 435.3 8.551 426.4L225.3 81.01C231.9 70.42 243.5 64 256 64C268.5 64 280.1 70.42 286.8 81.01L412.7 281.7L460.9 202.7C464.1 196.1 472.2 192 480 192C487.8 192 495 196.1 499.1 202.7L631.1 419.1C636.9 428.6 640 439.7 640 450.9C640 484.6 612.6 512 578.9 512H55.91C25.03 512 .0006 486.1 .0006 456.1L0 456.1z"})})," "]}),s.jsx("span",{className:"sr-only",children:"Loading..."})," "]}),s.jsxs("div",{role:"status",className:`my-6 ${r}`,children:[" ",s.jsx("div",{className:"mb-2.5 h-2 max-w-[80%] rounded-full bg-zinc-200 dark:bg-zinc-700"}),s.jsx("div",{className:"mb-2.5 h-2 max-w-[78%] rounded-full bg-zinc-200 dark:bg-zinc-700"}),s.jsx("div",{className:"mb-2.5 h-2 max-w-[80%] rounded-full bg-zinc-200 dark:bg-zinc-700"}),s.jsx("div",{className:"mb-2.5 h-2 max-w-[82%] rounded-full bg-zinc-200 dark:bg-zinc-700"}),s.jsx("div",{className:"mb-2.5 h-2 max-w-[78%] rounded-full bg-zinc-200 dark:bg-zinc-700"}),s.jsx("div",{className:"mb-2.5 h-2 max-w-[75%] rounded-full bg-zinc-200 dark:bg-zinc-700"}),s.jsx("div",{className:"h-2 max-w-[75%] rounded-full bg-zinc-200 dark:bg-zinc-700"}),s.jsx("span",{className:"sr-only",children:"Loading..."})," "]}),s.jsxs("div",{role:"status",className:`my-6 ${r}`,children:[" ",s.jsx("div",{className:"mb-2.5 h-2 max-w-[78%] rounded-full bg-zinc-200 dark:bg-zinc-700"}),s.jsx("div",{className:"mb-2.5 h-2 max-w-[78%] rounded-full bg-zinc-200 dark:bg-zinc-700"}),s.jsx("div",{className:"mb-2.5 h-2 max-w-[80%] rounded-full bg-zinc-200 dark:bg-zinc-700"}),s.jsx("div",{className:"mb-2.5 h-2 max-w-[82%] rounded-full bg-zinc-200 dark:bg-zinc-700"}),s.jsx("span",{className:"sr-only",children:"Loading..."})," "]}),s.jsxs("div",{role:"status",className:`mb-6 mt-7 ${r}`,children:[" ",s.jsx("div",{className:"mb-4 h-2.5 w-[82%] rounded-full bg-zinc-300 dark:bg-zinc-700"}),s.jsx("div",{className:"mb-2.5 h-2 max-w-[78%] rounded-full bg-zinc-200 dark:bg-zinc-700"}),s.jsx("div",{className:"mb-2.5 h-2 max-w-[75%] rounded-full bg-zinc-200 dark:bg-zinc-700"}),s.jsx("div",{className:"mb-2.5 h-2 max-w-[78%] rounded-full bg-zinc-200 dark:bg-zinc-700"}),s.jsx("div",{className:"mb-2.5 h-2 max-w-[80%] rounded-full bg-zinc-200 dark:bg-zinc-700"}),s.jsx("div",{className:"mb-2.5 h-2 max-w-[75%] rounded-full bg-zinc-200 dark:bg-zinc-700"}),s.jsx("div",{className:"mb-2.5 h-2 max-w-[72%] rounded-full bg-zinc-200 dark:bg-zinc-700"}),s.jsx("div",{className:"mb-2.5 h-2 max-w-[78%] rounded-full bg-zinc-200 dark:bg-zinc-700"}),s.jsx("div",{className:"mb-2.5 h-2 max-w-[80%] rounded-full bg-zinc-200 dark:bg-zinc-700"}),s.jsx("div",{className:"h-2 max-w-[75%] rounded-full bg-zinc-200 dark:bg-zinc-700"}),s.jsx("span",{className:"sr-only",children:"Loading..."})," "]}),s.jsxs("div",{role:"status",className:`my-6 ${r}`,children:[" ",s.jsx("div",{className:"mb-2.5 h-2 max-w-[78%] rounded-full bg-zinc-200 dark:bg-zinc-700"}),s.jsx("div",{className:"mb-2.5 h-2 max-w-[75%] rounded-full bg-zinc-200 dark:bg-zinc-700"}),s.jsx("span",{className:"sr-only",children:"Loading..."})," "]})]})}let Ko;const Xr="HoverCard",[Qr,w1]=Ne(Xr,[qe]),$o=qe(),[nl,jn]=Qr(Xr),rl=e=>{const{__scopeHoverCard:t,children:o,open:r,defaultOpen:a,onOpenChange:c,openDelay:l=700,closeDelay:i=300}=e,d=$o(t),u=n.useRef(0),h=n.useRef(0),f=n.useRef(!1),m=n.useRef(!1),[b=!1,g]=ze({prop:r,defaultProp:a,onChange:c}),p=n.useCallback(()=>{clearTimeout(h.current),u.current=window.setTimeout(()=>g(!0),l)},[l,g]),x=n.useCallback(()=>{clearTimeout(u.current),!f.current&&!m.current&&(h.current=window.setTimeout(()=>g(!1),i))},[i,g]),w=n.useCallback(()=>g(!1),[g]);return n.useEffect(()=>()=>{clearTimeout(u.current),clearTimeout(h.current)},[]),n.createElement(nl,{scope:t,open:b,onOpenChange:g,onOpen:p,onClose:x,onDismiss:w,hasSelectionRef:f,isPointerDownOnContentRef:m},n.createElement(ho,d,o))},al="HoverCardTrigger",sl=n.forwardRef((e,t)=>{const{__scopeHoverCard:o,...r}=e,a=jn(al,o),c=$o(o);return n.createElement(po,C({asChild:!0},c),n.createElement(z.a,C({"data-state":a.open?"open":"closed"},r,{ref:t,onPointerEnter:j(e.onPointerEnter,so(a.onOpen)),onPointerLeave:j(e.onPointerLeave,so(a.onClose)),onFocus:j(e.onFocus,a.onOpen),onBlur:j(e.onBlur,a.onClose),onTouchStart:j(e.onTouchStart,l=>l.preventDefault())})))}),cl="HoverCardPortal",[$1,il]=Qr(cl,{forceMount:void 0}),dn="HoverCardContent",ll=n.forwardRef((e,t)=>{const o=il(dn,e.__scopeHoverCard),{forceMount:r=o.forceMount,...a}=e,c=jn(dn,e.__scopeHoverCard);return n.createElement(Ie,{present:r||c.open},n.createElement(dl,C({"data-state":c.open?"open":"closed"},a,{onPointerEnter:j(e.onPointerEnter,so(c.onOpen)),onPointerLeave:j(e.onPointerLeave,so(c.onClose)),ref:t})))}),dl=n.forwardRef((e,t)=>{const{__scopeHoverCard:o,onEscapeKeyDown:r,onPointerDownOutside:a,onFocusOutside:c,onInteractOutside:l,...i}=e,d=jn(dn,o),u=$o(o),h=n.useRef(null),f=Z(t,h),[m,b]=n.useState(!1);return n.useEffect(()=>{if(m){const g=document.body;return Ko=g.style.userSelect||g.style.webkitUserSelect,g.style.userSelect="none",g.style.webkitUserSelect="none",()=>{g.style.userSelect=Ko,g.style.webkitUserSelect=Ko}}},[m]),n.useEffect(()=>{if(h.current){const g=()=>{b(!1),d.isPointerDownOnContentRef.current=!1,setTimeout(()=>{var p;((p=document.getSelection())===null||p===void 0?void 0:p.toString())!==""&&(d.hasSelectionRef.current=!0)})};return document.addEventListener("pointerup",g),()=>{document.removeEventListener("pointerup",g),d.hasSelectionRef.current=!1,d.isPointerDownOnContentRef.current=!1}}},[d.isPointerDownOnContentRef,d.hasSelectionRef]),n.useEffect(()=>{h.current&&fl(h.current).forEach(p=>p.setAttribute("tabindex","-1"))}),n.createElement(Wt,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:l,onEscapeKeyDown:r,onPointerDownOutside:a,onFocusOutside:j(c,g=>{g.preventDefault()}),onDismiss:d.onDismiss},n.createElement(mo,C({},u,i,{onPointerDown:j(i.onPointerDown,g=>{g.currentTarget.contains(g.target)&&b(!0),d.hasSelectionRef.current=!1,d.isPointerDownOnContentRef.current=!0}),ref:f,style:{...i.style,userSelect:m?"text":void 0,WebkitUserSelect:m?"text":void 0,"--radix-hover-card-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-hover-card-content-available-width":"var(--radix-popper-available-width)","--radix-hover-card-content-available-height":"var(--radix-popper-available-height)","--radix-hover-card-trigger-width":"var(--radix-popper-anchor-width)","--radix-hover-card-trigger-height":"var(--radix-popper-anchor-height)"}})))}),ul=n.forwardRef((e,t)=>{const{__scopeHoverCard:o,...r}=e,a=$o(o);return n.createElement(Sr,C({},a,r,{ref:t}))});function so(e){return t=>t.pointerType==="touch"?void 0:e()}function fl(e){const t=[],o=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP});for(;o.nextNode();)t.push(o.currentNode);return t}const hl=rl,pl=sl,Jr=ll,ea=ul;globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};const kn=hl,Rn=pl,ta=n.forwardRef(({className:e,...t},o)=>s.jsx(ea,{ref:o,className:T("!bottom-[1px] fill-background",e),style:{clipPath:"inset(0 -10px -10px -10px)",filter:"drop-shadow(0 0 3px gray)"},...t}));ta.displayName=ea.displayName;const Co=n.forwardRef(({className:e,align:t="center",sideOffset:o=4,...r},a)=>s.jsx(Jr,{ref:a,align:t,sideOffset:o,className:T("z-50 w-64 rounded-md bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 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",e),...r}));Co.displayName=Jr.displayName;globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};const kt=["Make me a flashy landing page for an AI SaaS startup. Come up with an exciting name and create a navigation bar up top.","Create a responsive navigation bar with dropdown menus, using a dark theme.","I need a user profile card with an avatar, name, and social media links in Tailwind CSS.","Generate a modal popup for user feedback, including text area and submit button.","Can you make a pricing table with three tiers, highlighting the best value tier?","Build a responsive image gallery grid that supports lightbox viewing.","I'm looking for a login form with email and password fields, plus a remember me checkbox.","Design a newsletter signup section with an input field and a subscribe button, featuring a minimalist aesthetic.","Create a footer with columns for links, a brief about section, and social media icons.","Generate a dashboard layout with a sidebar navigation, header, and content area.","I need an accordion FAQ section where questions expand to show answers on click.","Produce a blog post template with a featured image, title, date, author, and content area.","Design a to-do list app interface with tasks, checkboxes, and an add task form.","Create a progress bar component that shows percentage completion and can be styled dynamically.","Generate a contact form with name, email, message fields, and a send button, with validation styles.","Design a carousel slider for featured articles with previous and next controls, using a sleek, modern look.","Create a set of social share buttons with icons for Facebook, Twitter, LinkedIn, and Instagram, with a hover effect.","Generate a responsive table with sortable columns, row highlight on hover, and pagination.","I need a card layout for product listings, including an image, title, price, and 'Add to Cart' button.","Build a timeline component for displaying a project's milestones, with vertical lines and circular markers.","Design a weather widget showing the current temperature, weather condition icons, and a 5-day forecast.","Create an alert component with success, warning, and error variations that can be dismissed.","Generate a multi-step form for a checkout process, including progress indicators.","I'm looking for a tab component with horizontal navigation and dynamically loaded content.","Design a search bar with autocomplete suggestions that appear as the user types.","Create a sticky header that becomes visible when scrolling up and hides on scrolling down.","Generate a set of animated loading spinners with different styles for asynchronous data loading.","I need a grid of cards for team members, including photo, name, role, and a short bio, with a flip effect on hover.","Build a testimonial slider with quotes from customers, including their names and photos.","Design a date picker component that integrates with a form and supports range selection.","Generate a set of badges for different status levels like New, In Progress, and Completed, with customizable colors."],or=["creative","colorful","enterprise","modern","minimal","weirder"],oa=[/^gpt-/,/^llava/,/^moondream/,/^gemini-1\.5/,/^claude/,/^phi-3-vision/];globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};const _e=[{name:"zinc",label:"Zinc",activeColor:{light:"240 5.9% 10%",dark:"240 5.2% 33.9%"},cssVars:{light:{background:"0 0% 100%",foreground:"240 10% 3.9%",card:"0 0% 100%","card-foreground":"240 10% 3.9%",popover:"0 0% 100%","popover-foreground":"240 10% 3.9%",primary:"240 5.9% 10%","primary-foreground":"0 0% 98%",secondary:"240 4.8% 95.9%","secondary-foreground":"240 5.9% 10%",muted:"240 4.8% 95.9%","muted-foreground":"240 3.8% 46.1%",accent:"240 4.8% 95.9%","accent-foreground":"240 5.9% 10%",destructive:"0 84.2% 60.2%","destructive-foreground":"0 0% 98%",border:"240 5.9% 90%",input:"240 5.9% 90%",ring:"240 5.9% 10%",radius:"0.5rem"},dark:{background:"240 10% 3.9%",foreground:"0 0% 98%",card:"240 10% 3.9%","card-foreground":"0 0% 98%",popover:"240 10% 3.9%","popover-foreground":"0 0% 98%",primary:"0 0% 98%","primary-foreground":"240 5.9% 10%",secondary:"240 3.7% 15.9%","secondary-foreground":"0 0% 98%",muted:"240 3.7% 15.9%","muted-foreground":"240 5% 64.9%",accent:"240 3.7% 15.9%","accent-foreground":"0 0% 98%",destructive:"0 62.8% 30.6%","destructive-foreground":"0 0% 98%",border:"240 3.7% 15.9%",input:"240 3.7% 15.9%",ring:"240 4.9% 83.9%"}}},{name:"slate",label:"Slate",activeColor:{light:"215.4 16.3% 46.9%",dark:"215.3 19.3% 34.5%"},cssVars:{light:{background:"0 0% 100%",foreground:"222.2 84% 4.9%",card:"0 0% 100%","card-foreground":"222.2 84% 4.9%",popover:"0 0% 100%","popover-foreground":"222.2 84% 4.9%",primary:"222.2 47.4% 11.2%","primary-foreground":"210 40% 98%",secondary:"210 40% 96.1%","secondary-foreground":"222.2 47.4% 11.2%",muted:"210 40% 96.1%","muted-foreground":"215.4 16.3% 46.9%",accent:"210 40% 96.1%","accent-foreground":"222.2 47.4% 11.2%",destructive:"0 84.2% 60.2%","destructive-foreground":"210 40% 98%",border:"214.3 31.8% 91.4%",input:"214.3 31.8% 91.4%",ring:"222.2 84% 4.9%",radius:"0.5rem"},dark:{background:"222.2 84% 4.9%",foreground:"210 40% 98%",card:"222.2 84% 4.9%","card-foreground":"210 40% 98%",popover:"222.2 84% 4.9%","popover-foreground":"210 40% 98%",primary:"210 40% 98%","primary-foreground":"222.2 47.4% 11.2%",secondary:"217.2 32.6% 17.5%","secondary-foreground":"210 40% 98%",muted:"217.2 32.6% 17.5%","muted-foreground":"215 20.2% 65.1%",accent:"217.2 32.6% 17.5%","accent-foreground":"210 40% 98%",destructive:"0 62.8% 30.6%","destructive-foreground":"210 40% 98%",border:"217.2 32.6% 17.5%",input:"217.2 32.6% 17.5%",ring:"212.7 26.8% 83.9"}}},{name:"stone",label:"Stone",activeColor:{light:"25 5.3% 44.7%",dark:"33.3 5.5% 32.4%"},cssVars:{light:{background:"0 0% 100%",foreground:"20 14.3% 4.1%",card:"0 0% 100%","card-foreground":"20 14.3% 4.1%",popover:"0 0% 100%","popover-foreground":"20 14.3% 4.1%",primary:"24 9.8% 10%","primary-foreground":"60 9.1% 97.8%",secondary:"60 4.8% 95.9%","secondary-foreground":"24 9.8% 10%",muted:"60 4.8% 95.9%","muted-foreground":"25 5.3% 44.7%",accent:"60 4.8% 95.9%","accent-foreground":"24 9.8% 10%",destructive:"0 84.2% 60.2%","destructive-foreground":"60 9.1% 97.8%",border:"20 5.9% 90%",input:"20 5.9% 90%",ring:"20 14.3% 4.1%",radius:"0.95rem"},dark:{background:"20 14.3% 4.1%",foreground:"60 9.1% 97.8%",card:"20 14.3% 4.1%","card-foreground":"60 9.1% 97.8%",popover:"20 14.3% 4.1%","popover-foreground":"60 9.1% 97.8%",primary:"60 9.1% 97.8%","primary-foreground":"24 9.8% 10%",secondary:"12 6.5% 15.1%","secondary-foreground":"60 9.1% 97.8%",muted:"12 6.5% 15.1%","muted-foreground":"24 5.4% 63.9%",accent:"12 6.5% 15.1%","accent-foreground":"60 9.1% 97.8%",destructive:"0 62.8% 30.6%","destructive-foreground":"60 9.1% 97.8%",border:"12 6.5% 15.1%",input:"12 6.5% 15.1%",ring:"24 5.7% 82.9%"}}},{name:"gray",label:"Gray",activeColor:{light:"220 8.9% 46.1%",dark:"215 13.8% 34.1%"},cssVars:{light:{background:"0 0% 100%",foreground:"224 71.4% 4.1%",card:"0 0% 100%","card-foreground":"224 71.4% 4.1%",popover:"0 0% 100%","popover-foreground":"224 71.4% 4.1%",primary:"220.9 39.3% 11%","primary-foreground":"210 20% 98%",secondary:"220 14.3% 95.9%","secondary-foreground":"220.9 39.3% 11%",muted:"220 14.3% 95.9%","muted-foreground":"220 8.9% 46.1%",accent:"220 14.3% 95.9%","accent-foreground":"220.9 39.3% 11%",destructive:"0 84.2% 60.2%","destructive-foreground":"210 20% 98%",border:"220 13% 91%",input:"220 13% 91%",ring:"224 71.4% 4.1%",radius:"0.35rem"},dark:{background:"224 71.4% 4.1%",foreground:"210 20% 98%",card:"224 71.4% 4.1%","card-foreground":"210 20% 98%",popover:"224 71.4% 4.1%","popover-foreground":"210 20% 98%",primary:"210 20% 98%","primary-foreground":"220.9 39.3% 11%",secondary:"215 27.9% 16.9%","secondary-foreground":"210 20% 98%",muted:"215 27.9% 16.9%","muted-foreground":"217.9 10.6% 64.9%",accent:"215 27.9% 16.9%","accent-foreground":"210 20% 98%",destructive:"0 62.8% 30.6%","destructive-foreground":"210 20% 98%",border:"215 27.9% 16.9%",input:"215 27.9% 16.9%",ring:"216 12.2% 83.9%"}}},{name:"neutral",label:"Neutral",activeColor:{light:"0 0% 45.1%",dark:"0 0% 32.2%"},cssVars:{light:{background:"0 0% 100%",foreground:"0 0% 3.9%",card:"0 0% 100%","card-foreground":"0 0% 3.9%",popover:"0 0% 100%","popover-foreground":"0 0% 3.9%",primary:"0 0% 9%","primary-foreground":"0 0% 98%",secondary:"0 0% 96.1%","secondary-foreground":"0 0% 9%",muted:"0 0% 96.1%","muted-foreground":"0 0% 45.1%",accent:"0 0% 96.1%","accent-foreground":"0 0% 9%",destructive:"0 84.2% 60.2%","destructive-foreground":"0 0% 98%",border:"0 0% 89.8%",input:"0 0% 89.8%",ring:"0 0% 3.9%"},dark:{background:"0 0% 3.9%",foreground:"0 0% 98%",card:"0 0% 3.9%","card-foreground":"0 0% 98%",popover:"0 0% 3.9%","popover-foreground":"0 0% 98%",primary:"0 0% 98%","primary-foreground":"0 0% 9%",secondary:"0 0% 14.9%","secondary-foreground":"0 0% 98%",muted:"0 0% 14.9%","muted-foreground":"0 0% 63.9%",accent:"0 0% 14.9%","accent-foreground":"0 0% 98%",destructive:"0 62.8% 30.6%","destructive-foreground":"0 0% 98%",border:"0 0% 14.9%",input:"0 0% 14.9%",ring:"0 0% 83.1%"}}},{name:"red",label:"Red",activeColor:{light:"0 72.2% 50.6%",dark:"0 72.2% 50.6%"},cssVars:{light:{background:"0 0% 100%",foreground:"0 0% 3.9%",card:"0 0% 100%","card-foreground":"0 0% 3.9%",popover:"0 0% 100%","popover-foreground":"0 0% 3.9%",primary:"0 72.2% 50.6%","primary-foreground":"0 85.7% 97.3%",secondary:"0 0% 96.1%","secondary-foreground":"0 0% 9%",muted:"0 0% 96.1%","muted-foreground":"0 0% 45.1%",accent:"0 0% 96.1%","accent-foreground":"0 0% 9%",destructive:"0 84.2% 60.2%","destructive-foreground":"0 0% 98%",border:"0 0% 89.8%",input:"0 0% 89.8%",ring:"0 72.2% 50.6%",radius:"0.4rem"},dark:{background:"0 0% 3.9%",foreground:"0 0% 98%",card:"0 0% 3.9%","card-foreground":"0 0% 98%",popover:"0 0% 3.9%","popover-foreground":"0 0% 98%",primary:"0 72.2% 50.6%","primary-foreground":"0 85.7% 97.3%",secondary:"0 0% 14.9%","secondary-foreground":"0 0% 98%",muted:"0 0% 14.9%","muted-foreground":"0 0% 63.9%",accent:"0 0% 14.9%","accent-foreground":"0 0% 98%",destructive:"0 62.8% 30.6%","destructive-foreground":"0 0% 98%",border:"0 0% 14.9%",input:"0 0% 14.9%",ring:"0 72.2% 50.6%"}}},{name:"rose",label:"Rose",activeColor:{light:"346.8 77.2% 49.8%",dark:"346.8 77.2% 49.8%"},cssVars:{light:{background:"0 0% 100%",foreground:"240 10% 3.9%",card:"0 0% 100%","card-foreground":"240 10% 3.9%",popover:"0 0% 100%","popover-foreground":"240 10% 3.9%",primary:"346.8 77.2% 49.8%","primary-foreground":"355.7 100% 97.3%",secondary:"240 4.8% 95.9%","secondary-foreground":"240 5.9% 10%",muted:"240 4.8% 95.9%","muted-foreground":"240 3.8% 46.1%",accent:"240 4.8% 95.9%","accent-foreground":"240 5.9% 10%",destructive:"0 84.2% 60.2%","destructive-foreground":"0 0% 98%",border:"240 5.9% 90%",input:"240 5.9% 90%",ring:"346.8 77.2% 49.8%",radius:"0.5rem"},dark:{background:"20 14.3% 4.1%",foreground:"0 0% 95%",popover:"0 0% 9%","popover-foreground":"0 0% 95%",card:"24 9.8% 10%","card-foreground":"0 0% 95%",primary:"346.8 77.2% 49.8%","primary-foreground":"355.7 100% 97.3%",secondary:"240 3.7% 15.9%","secondary-foreground":"0 0% 98%",muted:"0 0% 15%","muted-foreground":"240 5% 64.9%",accent:"12 6.5% 15.1%","accent-foreground":"0 0% 98%",destructive:"0 62.8% 30.6%","destructive-foreground":"0 85.7% 97.3%",border:"240 3.7% 15.9%",input:"240 3.7% 15.9%",ring:"346.8 77.2% 49.8%"}}},{name:"orange",label:"Orange",activeColor:{light:"24.6 95% 53.1%",dark:"20.5 90.2% 48.2%"},cssVars:{light:{background:"0 0% 100%",foreground:"20 14.3% 4.1%",card:"0 0% 100%","card-foreground":"20 14.3% 4.1%",popover:"0 0% 100%","popover-foreground":"20 14.3% 4.1%",primary:"24.6 95% 53.1%","primary-foreground":"60 9.1% 97.8%",secondary:"60 4.8% 95.9%","secondary-foreground":"24 9.8% 10%",muted:"60 4.8% 95.9%","muted-foreground":"25 5.3% 44.7%",accent:"60 4.8% 95.9%","accent-foreground":"24 9.8% 10%",destructive:"0 84.2% 60.2%","destructive-foreground":"60 9.1% 97.8%",border:"20 5.9% 90%",input:"20 5.9% 90%",ring:"24.6 95% 53.1%",radius:"0.95rem"},dark:{background:"20 14.3% 4.1%",foreground:"60 9.1% 97.8%",card:"20 14.3% 4.1%","card-foreground":"60 9.1% 97.8%",popover:"20 14.3% 4.1%","popover-foreground":"60 9.1% 97.8%",primary:"20.5 90.2% 48.2%","primary-foreground":"60 9.1% 97.8%",secondary:"12 6.5% 15.1%","secondary-foreground":"60 9.1% 97.8%",muted:"12 6.5% 15.1%","muted-foreground":"24 5.4% 63.9%",accent:"12 6.5% 15.1%","accent-foreground":"60 9.1% 97.8%",destructive:"0 72.2% 50.6%","destructive-foreground":"60 9.1% 97.8%",border:"12 6.5% 15.1%",input:"12 6.5% 15.1%",ring:"20.5 90.2% 48.2%"}}},{name:"green",label:"Green",activeColor:{light:"142.1 76.2% 36.3%",dark:"142.1 70.6% 45.3%"},cssVars:{light:{background:"0 0% 100%",foreground:"240 10% 3.9%",card:"0 0% 100%","card-foreground":"240 10% 3.9%",popover:"0 0% 100%","popover-foreground":"240 10% 3.9%",primary:"142.1 76.2% 36.3%","primary-foreground":"355.7 100% 97.3%",secondary:"240 4.8% 95.9%","secondary-foreground":"240 5.9% 10%",muted:"240 4.8% 95.9%","muted-foreground":"240 3.8% 46.1%",accent:"240 4.8% 95.9%","accent-foreground":"240 5.9% 10%",destructive:"0 84.2% 60.2%","destructive-foreground":"0 0% 98%",border:"240 5.9% 90%",input:"240 5.9% 90%",ring:"142.1 76.2% 36.3%"},dark:{background:"20 14.3% 4.1%",foreground:"0 0% 95%",popover:"0 0% 9%","popover-foreground":"0 0% 95%",card:"24 9.8% 10%","card-foreground":"0 0% 95%",primary:"142.1 70.6% 45.3%","primary-foreground":"144.9 80.4% 10%",secondary:"240 3.7% 15.9%","secondary-foreground":"0 0% 98%",muted:"0 0% 15%","muted-foreground":"240 5% 64.9%",accent:"12 6.5% 15.1%","accent-foreground":"0 0% 98%",destructive:"0 62.8% 30.6%","destructive-foreground":"0 85.7% 97.3%",border:"240 3.7% 15.9%",input:"240 3.7% 15.9%",ring:"142.4 71.8% 29.2%"}}},{name:"blue",label:"Blue",activeColor:{light:"221.2 83.2% 53.3%",dark:"217.2 91.2% 59.8%"},cssVars:{light:{background:"0 0% 100%",foreground:"222.2 84% 4.9%",card:"0 0% 100%","card-foreground":"222.2 84% 4.9%",popover:"0 0% 100%","popover-foreground":"222.2 84% 4.9%",primary:"221.2 83.2% 53.3%","primary-foreground":"210 40% 98%",secondary:"210 40% 96.1%","secondary-foreground":"222.2 47.4% 11.2%",muted:"210 40% 96.1%","muted-foreground":"215.4 16.3% 46.9%",accent:"210 40% 96.1%","accent-foreground":"222.2 47.4% 11.2%",destructive:"0 84.2% 60.2%","destructive-foreground":"210 40% 98%",border:"214.3 31.8% 91.4%",input:"214.3 31.8% 91.4%",ring:"221.2 83.2% 53.3%"},dark:{background:"222.2 84% 4.9%",foreground:"210 40% 98%",card:"222.2 84% 4.9%","card-foreground":"210 40% 98%",popover:"222.2 84% 4.9%","popover-foreground":"210 40% 98%",primary:"217.2 91.2% 59.8%","primary-foreground":"222.2 47.4% 11.2%",secondary:"217.2 32.6% 17.5%","secondary-foreground":"210 40% 98%",muted:"217.2 32.6% 17.5%","muted-foreground":"215 20.2% 65.1%",accent:"217.2 32.6% 17.5%","accent-foreground":"210 40% 98%",destructive:"0 62.8% 30.6%","destructive-foreground":"210 40% 98%",border:"217.2 32.6% 17.5%",input:"217.2 32.6% 17.5%",ring:"224.3 76.3% 48%"}}},{name:"yellow",label:"Yellow",activeColor:{light:"47.9 95.8% 53.1%",dark:"47.9 95.8% 53.1%"},cssVars:{light:{background:"0 0% 100%",foreground:"20 14.3% 4.1%",card:"0 0% 100%","card-foreground":"20 14.3% 4.1%",popover:"0 0% 100%","popover-foreground":"20 14.3% 4.1%",primary:"47.9 95.8% 53.1%","primary-foreground":"26 83.3% 14.1%",secondary:"60 4.8% 95.9%","secondary-foreground":"24 9.8% 10%",muted:"60 4.8% 95.9%","muted-foreground":"25 5.3% 44.7%",accent:"60 4.8% 95.9%","accent-foreground":"24 9.8% 10%",destructive:"0 84.2% 60.2%","destructive-foreground":"60 9.1% 97.8%",border:"20 5.9% 90%",input:"20 5.9% 90%",ring:"20 14.3% 4.1%",radius:"0.95rem"},dark:{background:"20 14.3% 4.1%",foreground:"60 9.1% 97.8%",card:"20 14.3% 4.1%","card-foreground":"60 9.1% 97.8%",popover:"20 14.3% 4.1%","popover-foreground":"60 9.1% 97.8%",primary:"47.9 95.8% 53.1%","primary-foreground":"26 83.3% 14.1%",secondary:"12 6.5% 15.1%","secondary-foreground":"60 9.1% 97.8%",muted:"12 6.5% 15.1%","muted-foreground":"24 5.4% 63.9%",accent:"12 6.5% 15.1%","accent-foreground":"60 9.1% 97.8%",destructive:"0 62.8% 30.6%","destructive-foreground":"60 9.1% 97.8%",border:"12 6.5% 15.1%",input:"12 6.5% 15.1%",ring:"35.5 91.7% 32.9%"}}},{name:"violet",label:"Violet",activeColor:{light:"262.1 83.3% 57.8%",dark:"263.4 70% 50.4%"},cssVars:{light:{background:"0 0% 100%",foreground:"224 71.4% 4.1%",card:"0 0% 100%","card-foreground":"224 71.4% 4.1%",popover:"0 0% 100%","popover-foreground":"224 71.4% 4.1%",primary:"262.1 83.3% 57.8%","primary-foreground":"210 20% 98%",secondary:"220 14.3% 95.9%","secondary-foreground":"220.9 39.3% 11%",muted:"220 14.3% 95.9%","muted-foreground":"220 8.9% 46.1%",accent:"220 14.3% 95.9%","accent-foreground":"220.9 39.3% 11%",destructive:"0 84.2% 60.2%","destructive-foreground":"210 20% 98%",border:"220 13% 91%",input:"220 13% 91%",ring:"262.1 83.3% 57.8%"},dark:{background:"224 71.4% 4.1%",foreground:"210 20% 98%",card:"224 71.4% 4.1%","card-foreground":"210 20% 98%",popover:"224 71.4% 4.1%","popover-foreground":"210 20% 98%",primary:"263.4 70% 50.4%","primary-foreground":"210 20% 98%",secondary:"215 27.9% 16.9%","secondary-foreground":"210 20% 98%",muted:"215 27.9% 16.9%","muted-foreground":"217.9 10.6% 64.9%",accent:"215 27.9% 16.9%","accent-foreground":"210 20% 98%",destructive:"0 62.8% 30.6%","destructive-foreground":"210 20% 98%",border:"215 27.9% 16.9%",input:"215 27.9% 16.9%",ring:"263.4 70% 50.4%"}}}];/** + * @license lucide-react v0.378.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const ml=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),na=(...e)=>e.filter((t,o,r)=>!!t&&r.indexOf(t)===o).join(" ");/** + * @license lucide-react v0.378.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */var gl={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** + * @license lucide-react v0.378.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const vl=n.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:o=2,absoluteStrokeWidth:r,className:a="",children:c,iconNode:l,...i},d)=>n.createElement("svg",{ref:d,...gl,width:t,height:t,stroke:e,strokeWidth:r?Number(o)*24/Number(t):o,className:na("lucide",a),...i},[...l.map(([u,h])=>n.createElement(u,h)),...Array.isArray(c)?c:[c]]));/** + * @license lucide-react v0.378.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const ye=(e,t)=>{const o=n.forwardRef(({className:r,...a},c)=>n.createElement(vl,{ref:c,iconNode:t,className:na(`lucide-${ml(e)}`,r),...a}));return o.displayName=`${e}`,o};/** + * @license lucide-react v0.378.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const bl=ye("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);/** + * @license lucide-react v0.378.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const yo=ye("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/** + * @license lucide-react v0.378.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const ra=ye("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** + * @license lucide-react v0.378.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const xl=ye("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** + * @license lucide-react v0.378.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const wl=ye("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/** + * @license lucide-react v0.378.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const $l=ye("CircleUser",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662",key:"154egf"}]]);/** + * @license lucide-react v0.378.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Cl=ye("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** + * @license lucide-react v0.378.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const co=ye("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/** + * @license lucide-react v0.378.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const yl=ye("Paintbrush",[["path",{d:"M18.37 2.63 14 7l-1.59-1.59a2 2 0 0 0-2.82 0L8 7l9 9 1.59-1.59a2 2 0 0 0 0-2.82L17 10l4.37-4.37a2.12 2.12 0 1 0-3-3Z",key:"m6k5sh"}],["path",{d:"M9 8c-2 3-4 3.5-7 4l8 10c2-1 6-5 6-7",key:"arzq70"}],["path",{d:"M14.5 17.5 4.5 15",key:"s7fvrz"}]]);/** + * @license lucide-react v0.378.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const El=ye("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/** + * @license lucide-react v0.378.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Sl=ye("ThumbsDown",[["path",{d:"M17 14V2",key:"8ymqnk"}],["path",{d:"M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22h0a3.13 3.13 0 0 1-3-3.88Z",key:"s6e0r"}]]);/** + * @license lucide-react v0.378.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const jl=ye("ThumbsUp",[["path",{d:"M7 10v12",key:"1qc93n"}],["path",{d:"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2h0a3.13 3.13 0 0 1 3 3.88Z",key:"y3tblf"}]]);/** + * @license lucide-react v0.378.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const kl=ye("WandSparkles",[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]]);/** + * @license lucide-react v0.378.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Rl=ye("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),Ml="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let Mn=(e=21)=>{let t="",o=crypto.getRandomValues(new Uint8Array(e));for(;e--;)t+=Ml[o[e]&63];return t};function aa(e,t){if(typeof document>"u")return;const o=document.createElement("textarea");o.value=e,o.setAttribute("readonly",""),o.style={position:"absolute",left:"-9999px"},document.body.appendChild(o);const r=document.getSelection().rangeCount>0?document.getSelection().getRangeAt(0):!1;o.select();let a=!1;try{a=!!document.execCommand("copy")}catch{a=!1}document.body.removeChild(o),r&&document.getSelection&&(document.getSelection().removeAllRanges(),document.getSelection().addRange(r))}function Eo(e){const t=e+"CollectionProvider",[o,r]=Ne(t),[a,c]=o(t,{collectionRef:{current:null},itemMap:new Map}),l=b=>{const{scope:g,children:p}=b,x=Le.useRef(null),w=Le.useRef(new Map).current;return Le.createElement(a,{scope:g,itemMap:w,collectionRef:x},p)},i=e+"CollectionSlot",d=Le.forwardRef((b,g)=>{const{scope:p,children:x}=b,w=c(i,p),v=Z(g,w.collectionRef);return Le.createElement(rt,{ref:v},x)}),u=e+"CollectionItemSlot",h="data-radix-collection-item",f=Le.forwardRef((b,g)=>{const{scope:p,children:x,...w}=b,v=Le.useRef(null),$=Z(g,v),E=c(u,p);return Le.useEffect(()=>(E.itemMap.set(v,{ref:v,...w}),()=>void E.itemMap.delete(v))),Le.createElement(rt,{[h]:"",ref:$},x)});function m(b){const g=c(e+"CollectionConsumer",b);return Le.useCallback(()=>{const x=g.collectionRef.current;if(!x)return[];const w=Array.from(x.querySelectorAll(`[${h}]`));return Array.from(g.itemMap.values()).sort((E,k)=>w.indexOf(E.ref.current)-w.indexOf(k.ref.current))},[g.collectionRef,g.itemMap])}return[{Provider:l,Slot:d,ItemSlot:f},m,r]}const Nl=n.createContext(void 0);function So(e){const t=n.useContext(Nl);return e||t||"ltr"}let Wo=0;function jo(){n.useEffect(()=>{var e,t;const o=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",(e=o[0])!==null&&e!==void 0?e:nr()),document.body.insertAdjacentElement("beforeend",(t=o[1])!==null&&t!==void 0?t:nr()),Wo++,()=>{Wo===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(r=>r.remove()),Wo--}},[])}function nr(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.cssText="outline: none; opacity: 0; position: fixed; pointer-events: none",e}const Go="focusScope.autoFocusOnMount",Zo="focusScope.autoFocusOnUnmount",rr={bubbles:!1,cancelable:!0},ko=n.forwardRef((e,t)=>{const{loop:o=!1,trapped:r=!1,onMountAutoFocus:a,onUnmountAutoFocus:c,...l}=e,[i,d]=n.useState(null),u=bt(a),h=bt(c),f=n.useRef(null),m=Z(t,p=>d(p)),b=n.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;n.useEffect(()=>{if(r){let p=function($){if(b.paused||!i)return;const E=$.target;i.contains(E)?f.current=E:We(f.current,{select:!0})},x=function($){if(b.paused||!i)return;const E=$.relatedTarget;E!==null&&(i.contains(E)||We(f.current,{select:!0}))},w=function($){if(document.activeElement===document.body)for(const k of $)k.removedNodes.length>0&&We(i)};document.addEventListener("focusin",p),document.addEventListener("focusout",x);const v=new MutationObserver(w);return i&&v.observe(i,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",p),document.removeEventListener("focusout",x),v.disconnect()}}},[r,i,b.paused]),n.useEffect(()=>{if(i){sr.add(b);const p=document.activeElement;if(!i.contains(p)){const w=new CustomEvent(Go,rr);i.addEventListener(Go,u),i.dispatchEvent(w),w.defaultPrevented||(Tl(Ll(sa(i)),{select:!0}),document.activeElement===p&&We(i))}return()=>{i.removeEventListener(Go,u),setTimeout(()=>{const w=new CustomEvent(Zo,rr);i.addEventListener(Zo,h),i.dispatchEvent(w),w.defaultPrevented||We(p??document.body,{select:!0}),i.removeEventListener(Zo,h),sr.remove(b)},0)}}},[i,u,h,b]);const g=n.useCallback(p=>{if(!o&&!r||b.paused)return;const x=p.key==="Tab"&&!p.altKey&&!p.ctrlKey&&!p.metaKey,w=document.activeElement;if(x&&w){const v=p.currentTarget,[$,E]=_l(v);$&&E?!p.shiftKey&&w===E?(p.preventDefault(),o&&We($,{select:!0})):p.shiftKey&&w===$&&(p.preventDefault(),o&&We(E,{select:!0})):w===v&&p.preventDefault()}},[o,r,b.paused]);return n.createElement(z.div,C({tabIndex:-1},l,{ref:m,onKeyDown:g}))});function Tl(e,{select:t=!1}={}){const o=document.activeElement;for(const r of e)if(We(r,{select:t}),document.activeElement!==o)return}function _l(e){const t=sa(e),o=ar(t,e),r=ar(t.reverse(),e);return[o,r]}function sa(e){const t=[],o=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const a=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||a?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;o.nextNode();)t.push(o.currentNode);return t}function ar(e,t){for(const o of e)if(!Pl(o,{upTo:t}))return o}function Pl(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function Il(e){return e instanceof HTMLInputElement&&"select"in e}function We(e,{select:t=!1}={}){if(e&&e.focus){const o=document.activeElement;e.focus({preventScroll:!0}),e!==o&&Il(e)&&t&&e.select()}}const sr=Al();function Al(){let e=[];return{add(t){const o=e[0];t!==o&&(o==null||o.pause()),e=cr(e,t),e.unshift(t)},remove(t){var o;e=cr(e,t),(o=e[0])===null||o===void 0||o.resume()}}}function cr(e,t){const o=[...e],r=o.indexOf(t);return r!==-1&&o.splice(r,1),o}function Ll(e){return e.filter(t=>t.tagName!=="A")}const qo="rovingFocusGroup.onEntryFocus",Dl={bubbles:!1,cancelable:!0},Nn="RovingFocusGroup",[un,ca,Ol]=Eo(Nn),[Fl,ia]=Ne(Nn,[Ol]),[Hl,Vl]=Fl(Nn),zl=n.forwardRef((e,t)=>n.createElement(un.Provider,{scope:e.__scopeRovingFocusGroup},n.createElement(un.Slot,{scope:e.__scopeRovingFocusGroup},n.createElement(Bl,C({},e,{ref:t}))))),Bl=n.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:o,orientation:r,loop:a=!1,dir:c,currentTabStopId:l,defaultCurrentTabStopId:i,onCurrentTabStopIdChange:d,onEntryFocus:u,...h}=e,f=n.useRef(null),m=Z(t,f),b=So(c),[g=null,p]=ze({prop:l,defaultProp:i,onChange:d}),[x,w]=n.useState(!1),v=bt(u),$=ca(o),E=n.useRef(!1),[k,D]=n.useState(0);return n.useEffect(()=>{const y=f.current;if(y)return y.addEventListener(qo,v),()=>y.removeEventListener(qo,v)},[v]),n.createElement(Hl,{scope:o,orientation:r,dir:b,loop:a,currentTabStopId:g,onItemFocus:n.useCallback(y=>p(y),[p]),onItemShiftTab:n.useCallback(()=>w(!0),[]),onFocusableItemAdd:n.useCallback(()=>D(y=>y+1),[]),onFocusableItemRemove:n.useCallback(()=>D(y=>y-1),[])},n.createElement(z.div,C({tabIndex:x||k===0?-1:0,"data-orientation":r},h,{ref:m,style:{outline:"none",...e.style},onMouseDown:j(e.onMouseDown,()=>{E.current=!0}),onFocus:j(e.onFocus,y=>{const I=!E.current;if(y.target===y.currentTarget&&I&&!x){const O=new CustomEvent(qo,Dl);if(y.currentTarget.dispatchEvent(O),!O.defaultPrevented){const H=$().filter(S=>S.focusable),re=H.find(S=>S.active),q=H.find(S=>S.id===g),R=[re,q,...H].filter(Boolean).map(S=>S.ref.current);la(R)}}E.current=!1}),onBlur:j(e.onBlur,()=>w(!1))})))}),Ul="RovingFocusGroupItem",Kl=n.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:o,focusable:r=!0,active:a=!1,tabStopId:c,...l}=e,i=He(),d=c||i,u=Vl(Ul,o),h=u.currentTabStopId===d,f=ca(o),{onFocusableItemAdd:m,onFocusableItemRemove:b}=u;return n.useEffect(()=>{if(r)return m(),()=>b()},[r,m,b]),n.createElement(un.ItemSlot,{scope:o,id:d,focusable:r,active:a},n.createElement(z.span,C({tabIndex:h?0:-1,"data-orientation":u.orientation},l,{ref:t,onMouseDown:j(e.onMouseDown,g=>{r?u.onItemFocus(d):g.preventDefault()}),onFocus:j(e.onFocus,()=>u.onItemFocus(d)),onKeyDown:j(e.onKeyDown,g=>{if(g.key==="Tab"&&g.shiftKey){u.onItemShiftTab();return}if(g.target!==g.currentTarget)return;const p=Zl(g,u.orientation,u.dir);if(p!==void 0){g.preventDefault();let w=f().filter(v=>v.focusable).map(v=>v.ref.current);if(p==="last")w.reverse();else if(p==="prev"||p==="next"){p==="prev"&&w.reverse();const v=w.indexOf(g.currentTarget);w=u.loop?ql(w,v+1):w.slice(v+1)}setTimeout(()=>la(w))}})})))}),Wl={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Gl(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function Zl(e,t,o){const r=Gl(e.key,o);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return Wl[r]}function la(e){const t=document.activeElement;for(const o of e)if(o===t||(o.focus(),document.activeElement!==t))return}function ql(e,t){return e.map((o,r)=>e[(t+r)%e.length])}const Yl=zl,Xl=Kl;var Ql=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},lt=new WeakMap,Xt=new WeakMap,Qt={},Yo=0,da=function(e){return e&&(e.host||da(e.parentNode))},Jl=function(e,t){return t.map(function(o){if(e.contains(o))return o;var r=da(o);return r&&e.contains(r)?r:(console.error("aria-hidden",o,"in not contained inside",e,". Doing nothing"),null)}).filter(function(o){return!!o})},ed=function(e,t,o,r){var a=Jl(t,Array.isArray(e)?e:[e]);Qt[o]||(Qt[o]=new WeakMap);var c=Qt[o],l=[],i=new Set,d=new Set(a),u=function(f){!f||i.has(f)||(i.add(f),u(f.parentNode))};a.forEach(u);var h=function(f){!f||d.has(f)||Array.prototype.forEach.call(f.children,function(m){if(i.has(m))h(m);else try{var b=m.getAttribute(r),g=b!==null&&b!=="false",p=(lt.get(m)||0)+1,x=(c.get(m)||0)+1;lt.set(m,p),c.set(m,x),l.push(m),p===1&&g&&Xt.set(m,!0),x===1&&m.setAttribute(o,"true"),g||m.setAttribute(r,"true")}catch(w){console.error("aria-hidden: cannot operate on ",m,w)}})};return h(t),i.clear(),Yo++,function(){l.forEach(function(f){var m=lt.get(f)-1,b=c.get(f)-1;lt.set(f,m),c.set(f,b),m||(Xt.has(f)||f.removeAttribute(r),Xt.delete(f)),b||f.removeAttribute(o)}),Yo--,Yo||(lt=new WeakMap,lt=new WeakMap,Xt=new WeakMap,Qt={})}},Ro=function(e,t,o){o===void 0&&(o="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),a=Ql(e);return a?(r.push.apply(r,Array.from(a.querySelectorAll("[aria-live]"))),ed(r,a,o,"aria-hidden")):function(){return null}},ua=Qc(),Xo=function(){},Mo=n.forwardRef(function(e,t){var o=n.useRef(null),r=n.useState({onScrollCapture:Xo,onWheelCapture:Xo,onTouchMoveCapture:Xo}),a=r[0],c=r[1],l=e.forwardProps,i=e.children,d=e.className,u=e.removeScrollBar,h=e.enabled,f=e.shards,m=e.sideCar,b=e.noIsolation,g=e.inert,p=e.allowPinchZoom,x=e.as,w=x===void 0?"div":x,v=Br(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as"]),$=m,E=qc([o,t]),k=Fe(Fe({},v),a);return n.createElement(n.Fragment,null,h&&n.createElement($,{sideCar:ua,removeScrollBar:u,shards:f,noIsolation:b,inert:g,setCallbacks:c,allowPinchZoom:!!p,lockRef:o}),l?n.cloneElement(n.Children.only(i),Fe(Fe({},k),{ref:E})):n.createElement(w,Fe({},k,{className:d,ref:E}),i))});Mo.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Mo.classNames={fullWidth:ao,zeroRight:ro};var fn=!1;if(typeof window<"u")try{var Jt=Object.defineProperty({},"passive",{get:function(){return fn=!0,!0}});window.addEventListener("test",Jt,Jt),window.removeEventListener("test",Jt,Jt)}catch{fn=!1}var dt=fn?{passive:!1}:!1,td=function(e){return e.tagName==="TEXTAREA"},fa=function(e,t){var o=window.getComputedStyle(e);return o[t]!=="hidden"&&!(o.overflowY===o.overflowX&&!td(e)&&o[t]==="visible")},od=function(e){return fa(e,"overflowY")},nd=function(e){return fa(e,"overflowX")},ir=function(e,t){var o=t;do{typeof ShadowRoot<"u"&&o instanceof ShadowRoot&&(o=o.host);var r=ha(e,o);if(r){var a=pa(e,o),c=a[1],l=a[2];if(c>l)return!0}o=o.parentNode}while(o&&o!==document.body);return!1},rd=function(e){var t=e.scrollTop,o=e.scrollHeight,r=e.clientHeight;return[t,o,r]},ad=function(e){var t=e.scrollLeft,o=e.scrollWidth,r=e.clientWidth;return[t,o,r]},ha=function(e,t){return e==="v"?od(t):nd(t)},pa=function(e,t){return e==="v"?rd(t):ad(t)},sd=function(e,t){return e==="h"&&t==="rtl"?-1:1},cd=function(e,t,o,r,a){var c=sd(e,window.getComputedStyle(t).direction),l=c*r,i=o.target,d=t.contains(i),u=!1,h=l>0,f=0,m=0;do{var b=pa(e,i),g=b[0],p=b[1],x=b[2],w=p-x-c*g;(g||w)&&ha(e,i)&&(f+=w,m+=g),i=i.parentNode}while(!d&&i!==document.body||d&&(t.contains(i)||t===i));return(h&&(f===0||!a)||!h&&(m===0||!a))&&(u=!0),u},eo=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},lr=function(e){return[e.deltaX,e.deltaY]},dr=function(e){return e&&"current"in e?e.current:e},id=function(e,t){return e[0]===t[0]&&e[1]===t[1]},ld=function(e){return` + .block-interactivity-`.concat(e,` {pointer-events: none;} + .allow-interactivity-`).concat(e,` {pointer-events: all;} +`)},dd=0,ut=[];function ud(e){var t=n.useRef([]),o=n.useRef([0,0]),r=n.useRef(),a=n.useState(dd++)[0],c=n.useState(function(){return Kr()})[0],l=n.useRef(e);n.useEffect(function(){l.current=e},[e]),n.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(a));var p=Uc([e.lockRef.current],(e.shards||[]).map(dr),!0).filter(Boolean);return p.forEach(function(x){return x.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),p.forEach(function(x){return x.classList.remove("allow-interactivity-".concat(a))})}}},[e.inert,e.lockRef.current,e.shards]);var i=n.useCallback(function(p,x){if("touches"in p&&p.touches.length===2)return!l.current.allowPinchZoom;var w=eo(p),v=o.current,$="deltaX"in p?p.deltaX:v[0]-w[0],E="deltaY"in p?p.deltaY:v[1]-w[1],k,D=p.target,y=Math.abs($)>Math.abs(E)?"h":"v";if("touches"in p&&y==="h"&&D.type==="range")return!1;var I=ir(y,D);if(!I)return!0;if(I?k=y:(k=y==="v"?"h":"v",I=ir(y,D)),!I)return!1;if(!r.current&&"changedTouches"in p&&($||E)&&(r.current=k),!k)return!0;var O=r.current||k;return cd(O,x,p,O==="h"?$:E,!0)},[]),d=n.useCallback(function(p){var x=p;if(!(!ut.length||ut[ut.length-1]!==c)){var w="deltaY"in x?lr(x):eo(x),v=t.current.filter(function(k){return k.name===x.type&&k.target===x.target&&id(k.delta,w)})[0];if(v&&v.should){x.cancelable&&x.preventDefault();return}if(!v){var $=(l.current.shards||[]).map(dr).filter(Boolean).filter(function(k){return k.contains(x.target)}),E=$.length>0?i(x,$[0]):!l.current.noIsolation;E&&x.cancelable&&x.preventDefault()}}},[]),u=n.useCallback(function(p,x,w,v){var $={name:p,delta:x,target:w,should:v};t.current.push($),setTimeout(function(){t.current=t.current.filter(function(E){return E!==$})},1)},[]),h=n.useCallback(function(p){o.current=eo(p),r.current=void 0},[]),f=n.useCallback(function(p){u(p.type,lr(p),p.target,i(p,e.lockRef.current))},[]),m=n.useCallback(function(p){u(p.type,eo(p),p.target,i(p,e.lockRef.current))},[]);n.useEffect(function(){return ut.push(c),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:m}),document.addEventListener("wheel",d,dt),document.addEventListener("touchmove",d,dt),document.addEventListener("touchstart",h,dt),function(){ut=ut.filter(function(p){return p!==c}),document.removeEventListener("wheel",d,dt),document.removeEventListener("touchmove",d,dt),document.removeEventListener("touchstart",h,dt)}},[]);var b=e.removeScrollBar,g=e.inert;return n.createElement(n.Fragment,null,g?n.createElement(c,{styles:ld(a)}):null,b?n.createElement(fi,{gapMode:"margin"}):null)}const fd=Jc(ua,ud);var Zt=n.forwardRef(function(e,t){return n.createElement(Mo,Fe({},e,{ref:t,sideCar:fd}))});Zt.classNames=Mo.classNames;const hn=["Enter"," "],hd=["ArrowDown","PageUp","Home"],ma=["ArrowUp","PageDown","End"],pd=[...hd,...ma],md={ltr:[...hn,"ArrowRight"],rtl:[...hn,"ArrowLeft"]},gd={ltr:["ArrowLeft"],rtl:["ArrowRight"]},No="Menu",[Pt,vd,bd]=Eo(No),[at,ga]=Ne(No,[bd,qe,ia]),Tn=qe(),va=ia(),[xd,st]=at(No),[wd,qt]=at(No),$d=e=>{const{__scopeMenu:t,open:o=!1,children:r,dir:a,onOpenChange:c,modal:l=!0}=e,i=Tn(t),[d,u]=n.useState(null),h=n.useRef(!1),f=bt(c),m=So(a);return n.useEffect(()=>{const b=()=>{h.current=!0,document.addEventListener("pointerdown",g,{capture:!0,once:!0}),document.addEventListener("pointermove",g,{capture:!0,once:!0})},g=()=>h.current=!1;return document.addEventListener("keydown",b,{capture:!0}),()=>{document.removeEventListener("keydown",b,{capture:!0}),document.removeEventListener("pointerdown",g,{capture:!0}),document.removeEventListener("pointermove",g,{capture:!0})}},[]),n.createElement(ho,i,n.createElement(xd,{scope:t,open:o,onOpenChange:f,content:d,onContentChange:u},n.createElement(wd,{scope:t,onClose:n.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:h,dir:m,modal:l},r)))},ba=n.forwardRef((e,t)=>{const{__scopeMenu:o,...r}=e,a=Tn(o);return n.createElement(po,C({},a,r,{ref:t}))}),xa="MenuPortal",[Cd,wa]=at(xa,{forceMount:void 0}),yd=e=>{const{__scopeMenu:t,forceMount:o,children:r,container:a}=e,c=st(xa,t);return n.createElement(Cd,{scope:t,forceMount:o},n.createElement(Ie,{present:o||c.open},n.createElement(xo,{asChild:!0,container:a},r)))},Pe="MenuContent",[Ed,_n]=at(Pe),Sd=n.forwardRef((e,t)=>{const o=wa(Pe,e.__scopeMenu),{forceMount:r=o.forceMount,...a}=e,c=st(Pe,e.__scopeMenu),l=qt(Pe,e.__scopeMenu);return n.createElement(Pt.Provider,{scope:e.__scopeMenu},n.createElement(Ie,{present:r||c.open},n.createElement(Pt.Slot,{scope:e.__scopeMenu},l.modal?n.createElement(jd,C({},a,{ref:t})):n.createElement(kd,C({},a,{ref:t})))))}),jd=n.forwardRef((e,t)=>{const o=st(Pe,e.__scopeMenu),r=n.useRef(null),a=Z(t,r);return n.useEffect(()=>{const c=r.current;if(c)return Ro(c)},[]),n.createElement(Pn,C({},e,{ref:a,trapFocus:o.open,disableOutsidePointerEvents:o.open,disableOutsideScroll:!0,onFocusOutside:j(e.onFocusOutside,c=>c.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>o.onOpenChange(!1)}))}),kd=n.forwardRef((e,t)=>{const o=st(Pe,e.__scopeMenu);return n.createElement(Pn,C({},e,{ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>o.onOpenChange(!1)}))}),Pn=n.forwardRef((e,t)=>{const{__scopeMenu:o,loop:r=!1,trapFocus:a,onOpenAutoFocus:c,onCloseAutoFocus:l,disableOutsidePointerEvents:i,onEntryFocus:d,onEscapeKeyDown:u,onPointerDownOutside:h,onFocusOutside:f,onInteractOutside:m,onDismiss:b,disableOutsideScroll:g,...p}=e,x=st(Pe,o),w=qt(Pe,o),v=Tn(o),$=va(o),E=vd(o),[k,D]=n.useState(null),y=n.useRef(null),I=Z(t,y,x.onContentChange),O=n.useRef(0),H=n.useRef(""),re=n.useRef(0),q=n.useRef(null),ae=n.useRef("right"),R=n.useRef(0),S=g?Zt:n.Fragment,X=g?{as:rt,allowPinchZoom:!0}:void 0,Y=M=>{var V,B;const fe=H.current+M,be=E().filter(te=>!te.disabled),ge=document.activeElement,we=(V=be.find(te=>te.ref.current===ge))===null||V===void 0?void 0:V.textValue,pe=be.map(te=>te.textValue),P=Bd(pe,fe,we),U=(B=be.find(te=>te.textValue===P))===null||B===void 0?void 0:B.ref.current;(function te(Q){H.current=Q,window.clearTimeout(O.current),Q!==""&&(O.current=window.setTimeout(()=>te(""),1e3))})(fe),U&&setTimeout(()=>U.focus())};n.useEffect(()=>()=>window.clearTimeout(O.current),[]),jo();const K=n.useCallback(M=>{var V,B;return ae.current===((V=q.current)===null||V===void 0?void 0:V.side)&&Kd(M,(B=q.current)===null||B===void 0?void 0:B.area)},[]);return n.createElement(Ed,{scope:o,searchRef:H,onItemEnter:n.useCallback(M=>{K(M)&&M.preventDefault()},[K]),onItemLeave:n.useCallback(M=>{var V;K(M)||((V=y.current)===null||V===void 0||V.focus(),D(null))},[K]),onTriggerLeave:n.useCallback(M=>{K(M)&&M.preventDefault()},[K]),pointerGraceTimerRef:re,onPointerGraceIntentChange:n.useCallback(M=>{q.current=M},[])},n.createElement(S,X,n.createElement(ko,{asChild:!0,trapped:a,onMountAutoFocus:j(c,M=>{var V;M.preventDefault(),(V=y.current)===null||V===void 0||V.focus()}),onUnmountAutoFocus:l},n.createElement(Wt,{asChild:!0,disableOutsidePointerEvents:i,onEscapeKeyDown:u,onPointerDownOutside:h,onFocusOutside:f,onInteractOutside:m,onDismiss:b},n.createElement(Yl,C({asChild:!0},$,{dir:w.dir,orientation:"vertical",loop:r,currentTabStopId:k,onCurrentTabStopIdChange:D,onEntryFocus:j(d,M=>{w.isUsingKeyboardRef.current||M.preventDefault()})}),n.createElement(mo,C({role:"menu","aria-orientation":"vertical","data-state":Sa(x.open),"data-radix-menu-content":"",dir:w.dir},v,p,{ref:I,style:{outline:"none",...p.style},onKeyDown:j(p.onKeyDown,M=>{const B=M.target.closest("[data-radix-menu-content]")===M.currentTarget,fe=M.ctrlKey||M.altKey||M.metaKey,be=M.key.length===1;B&&(M.key==="Tab"&&M.preventDefault(),!fe&&be&&Y(M.key));const ge=y.current;if(M.target!==ge||!pd.includes(M.key))return;M.preventDefault();const pe=E().filter(P=>!P.disabled).map(P=>P.ref.current);ma.includes(M.key)&&pe.reverse(),Vd(pe)}),onBlur:j(e.onBlur,M=>{M.currentTarget.contains(M.target)||(window.clearTimeout(O.current),H.current="")}),onPointerMove:j(e.onPointerMove,It(M=>{const V=M.target,B=R.current!==M.clientX;if(M.currentTarget.contains(V)&&B){const fe=M.clientX>R.current?"right":"left";ae.current=fe,R.current=M.clientX}}))})))))))}),Rd=n.forwardRef((e,t)=>{const{__scopeMenu:o,...r}=e;return n.createElement(z.div,C({},r,{ref:t}))}),pn="MenuItem",ur="menu.itemSelect",In=n.forwardRef((e,t)=>{const{disabled:o=!1,onSelect:r,...a}=e,c=n.useRef(null),l=qt(pn,e.__scopeMenu),i=_n(pn,e.__scopeMenu),d=Z(t,c),u=n.useRef(!1),h=()=>{const f=c.current;if(!o&&f){const m=new CustomEvent(ur,{bubbles:!0,cancelable:!0});f.addEventListener(ur,b=>r==null?void 0:r(b),{once:!0}),ic(f,m),m.defaultPrevented?u.current=!1:l.onClose()}};return n.createElement($a,C({},a,{ref:d,disabled:o,onClick:j(e.onClick,h),onPointerDown:f=>{var m;(m=e.onPointerDown)===null||m===void 0||m.call(e,f),u.current=!0},onPointerUp:j(e.onPointerUp,f=>{var m;u.current||(m=f.currentTarget)===null||m===void 0||m.click()}),onKeyDown:j(e.onKeyDown,f=>{const m=i.searchRef.current!=="";o||m&&f.key===" "||hn.includes(f.key)&&(f.currentTarget.click(),f.preventDefault())})}))}),$a=n.forwardRef((e,t)=>{const{__scopeMenu:o,disabled:r=!1,textValue:a,...c}=e,l=_n(pn,o),i=va(o),d=n.useRef(null),u=Z(t,d),[h,f]=n.useState(!1),[m,b]=n.useState("");return n.useEffect(()=>{const g=d.current;if(g){var p;b(((p=g.textContent)!==null&&p!==void 0?p:"").trim())}},[c.children]),n.createElement(Pt.ItemSlot,{scope:o,disabled:r,textValue:a??m},n.createElement(Xl,C({asChild:!0},i,{focusable:!r}),n.createElement(z.div,C({role:"menuitem","data-highlighted":h?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0},c,{ref:u,onPointerMove:j(e.onPointerMove,It(g=>{r?l.onItemLeave(g):(l.onItemEnter(g),g.defaultPrevented||g.currentTarget.focus())})),onPointerLeave:j(e.onPointerLeave,It(g=>l.onItemLeave(g))),onFocus:j(e.onFocus,()=>f(!0)),onBlur:j(e.onBlur,()=>f(!1))}))))}),Md=n.forwardRef((e,t)=>{const{checked:o=!1,onCheckedChange:r,...a}=e;return n.createElement(ya,{scope:e.__scopeMenu,checked:o},n.createElement(In,C({role:"menuitemcheckbox","aria-checked":io(o)?"mixed":o},a,{ref:t,"data-state":An(o),onSelect:j(a.onSelect,()=>r==null?void 0:r(io(o)?!0:!o),{checkForDefaultPrevented:!1})})))}),Nd="MenuRadioGroup",[C1,Td]=at(Nd,{value:void 0,onValueChange:()=>{}}),_d="MenuRadioItem",Pd=n.forwardRef((e,t)=>{const{value:o,...r}=e,a=Td(_d,e.__scopeMenu),c=o===a.value;return n.createElement(ya,{scope:e.__scopeMenu,checked:c},n.createElement(In,C({role:"menuitemradio","aria-checked":c},r,{ref:t,"data-state":An(c),onSelect:j(r.onSelect,()=>{var l;return(l=a.onValueChange)===null||l===void 0?void 0:l.call(a,o)},{checkForDefaultPrevented:!1})})))}),Ca="MenuItemIndicator",[ya,Id]=at(Ca,{checked:!1}),Ad=n.forwardRef((e,t)=>{const{__scopeMenu:o,forceMount:r,...a}=e,c=Id(Ca,o);return n.createElement(Ie,{present:r||io(c.checked)||c.checked===!0},n.createElement(z.span,C({},a,{ref:t,"data-state":An(c.checked)})))}),Ld=n.forwardRef((e,t)=>{const{__scopeMenu:o,...r}=e;return n.createElement(z.div,C({role:"separator","aria-orientation":"horizontal"},r,{ref:t}))}),Dd="MenuSub",[y1,Ea]=at(Dd),to="MenuSubTrigger",Od=n.forwardRef((e,t)=>{const o=st(to,e.__scopeMenu),r=qt(to,e.__scopeMenu),a=Ea(to,e.__scopeMenu),c=_n(to,e.__scopeMenu),l=n.useRef(null),{pointerGraceTimerRef:i,onPointerGraceIntentChange:d}=c,u={__scopeMenu:e.__scopeMenu},h=n.useCallback(()=>{l.current&&window.clearTimeout(l.current),l.current=null},[]);return n.useEffect(()=>h,[h]),n.useEffect(()=>{const f=i.current;return()=>{window.clearTimeout(f),d(null)}},[i,d]),n.createElement(ba,C({asChild:!0},u),n.createElement($a,C({id:a.triggerId,"aria-haspopup":"menu","aria-expanded":o.open,"aria-controls":a.contentId,"data-state":Sa(o.open)},e,{ref:jr(t,a.onTriggerChange),onClick:f=>{var m;(m=e.onClick)===null||m===void 0||m.call(e,f),!(e.disabled||f.defaultPrevented)&&(f.currentTarget.focus(),o.open||o.onOpenChange(!0))},onPointerMove:j(e.onPointerMove,It(f=>{c.onItemEnter(f),!f.defaultPrevented&&!e.disabled&&!o.open&&!l.current&&(c.onPointerGraceIntentChange(null),l.current=window.setTimeout(()=>{o.onOpenChange(!0),h()},100))})),onPointerLeave:j(e.onPointerLeave,It(f=>{var m;h();const b=(m=o.content)===null||m===void 0?void 0:m.getBoundingClientRect();if(b){var g;const p=(g=o.content)===null||g===void 0?void 0:g.dataset.side,x=p==="right",w=x?-5:5,v=b[x?"left":"right"],$=b[x?"right":"left"];c.onPointerGraceIntentChange({area:[{x:f.clientX+w,y:f.clientY},{x:v,y:b.top},{x:$,y:b.top},{x:$,y:b.bottom},{x:v,y:b.bottom}],side:p}),window.clearTimeout(i.current),i.current=window.setTimeout(()=>c.onPointerGraceIntentChange(null),300)}else{if(c.onTriggerLeave(f),f.defaultPrevented)return;c.onPointerGraceIntentChange(null)}})),onKeyDown:j(e.onKeyDown,f=>{const m=c.searchRef.current!=="";if(!(e.disabled||m&&f.key===" ")&&md[r.dir].includes(f.key)){var b;o.onOpenChange(!0),(b=o.content)===null||b===void 0||b.focus(),f.preventDefault()}})})))}),Fd="MenuSubContent",Hd=n.forwardRef((e,t)=>{const o=wa(Pe,e.__scopeMenu),{forceMount:r=o.forceMount,...a}=e,c=st(Pe,e.__scopeMenu),l=qt(Pe,e.__scopeMenu),i=Ea(Fd,e.__scopeMenu),d=n.useRef(null),u=Z(t,d);return n.createElement(Pt.Provider,{scope:e.__scopeMenu},n.createElement(Ie,{present:r||c.open},n.createElement(Pt.Slot,{scope:e.__scopeMenu},n.createElement(Pn,C({id:i.contentId,"aria-labelledby":i.triggerId},a,{ref:u,align:"start",side:l.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:h=>{var f;l.isUsingKeyboardRef.current&&((f=d.current)===null||f===void 0||f.focus()),h.preventDefault()},onCloseAutoFocus:h=>h.preventDefault(),onFocusOutside:j(e.onFocusOutside,h=>{h.target!==i.trigger&&c.onOpenChange(!1)}),onEscapeKeyDown:j(e.onEscapeKeyDown,h=>{l.onClose(),h.preventDefault()}),onKeyDown:j(e.onKeyDown,h=>{const f=h.currentTarget.contains(h.target),m=gd[l.dir].includes(h.key);if(f&&m){var b;c.onOpenChange(!1),(b=i.trigger)===null||b===void 0||b.focus(),h.preventDefault()}})})))))});function Sa(e){return e?"open":"closed"}function io(e){return e==="indeterminate"}function An(e){return io(e)?"indeterminate":e?"checked":"unchecked"}function Vd(e){const t=document.activeElement;for(const o of e)if(o===t||(o.focus(),document.activeElement!==t))return}function zd(e,t){return e.map((o,r)=>e[(t+r)%e.length])}function Bd(e,t,o){const a=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,c=o?e.indexOf(o):-1;let l=zd(e,Math.max(c,0));a.length===1&&(l=l.filter(u=>u!==o));const d=l.find(u=>u.toLowerCase().startsWith(a.toLowerCase()));return d!==o?d:void 0}function Ud(e,t){const{x:o,y:r}=e;let a=!1;for(let c=0,l=t.length-1;cr!=h>r&&o<(u-i)*(r-d)/(h-d)+i&&(a=!a)}return a}function Kd(e,t){if(!t)return!1;const o={x:e.clientX,y:e.clientY};return Ud(o,t)}function It(e){return t=>t.pointerType==="mouse"?e(t):void 0}const Wd=$d,Gd=ba,Zd=yd,qd=Sd,Yd=Rd,Xd=In,Qd=Md,Jd=Pd,eu=Ad,tu=Ld,ou=Od,nu=Hd,ja="DropdownMenu",[ru,E1]=Ne(ja,[ga]),Te=ga(),[au,ka]=ru(ja),su=e=>{const{__scopeDropdownMenu:t,children:o,dir:r,open:a,defaultOpen:c,onOpenChange:l,modal:i=!0}=e,d=Te(t),u=n.useRef(null),[h=!1,f]=ze({prop:a,defaultProp:c,onChange:l});return n.createElement(au,{scope:t,triggerId:He(),triggerRef:u,contentId:He(),open:h,onOpenChange:f,onOpenToggle:n.useCallback(()=>f(m=>!m),[f]),modal:i},n.createElement(Wd,C({},d,{open:h,onOpenChange:f,dir:r,modal:i}),o))},cu="DropdownMenuTrigger",iu=n.forwardRef((e,t)=>{const{__scopeDropdownMenu:o,disabled:r=!1,...a}=e,c=ka(cu,o),l=Te(o);return n.createElement(Gd,C({asChild:!0},l),n.createElement(z.button,C({type:"button",id:c.triggerId,"aria-haspopup":"menu","aria-expanded":c.open,"aria-controls":c.open?c.contentId:void 0,"data-state":c.open?"open":"closed","data-disabled":r?"":void 0,disabled:r},a,{ref:jr(t,c.triggerRef),onPointerDown:j(e.onPointerDown,i=>{!r&&i.button===0&&i.ctrlKey===!1&&(c.onOpenToggle(),c.open||i.preventDefault())}),onKeyDown:j(e.onKeyDown,i=>{r||(["Enter"," "].includes(i.key)&&c.onOpenToggle(),i.key==="ArrowDown"&&c.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(i.key)&&i.preventDefault())})})))}),lu=e=>{const{__scopeDropdownMenu:t,...o}=e,r=Te(t);return n.createElement(Zd,C({},r,o))},du="DropdownMenuContent",uu=n.forwardRef((e,t)=>{const{__scopeDropdownMenu:o,...r}=e,a=ka(du,o),c=Te(o),l=n.useRef(!1);return n.createElement(qd,C({id:a.contentId,"aria-labelledby":a.triggerId},c,r,{ref:t,onCloseAutoFocus:j(e.onCloseAutoFocus,i=>{var d;l.current||(d=a.triggerRef.current)===null||d===void 0||d.focus(),l.current=!1,i.preventDefault()}),onInteractOutside:j(e.onInteractOutside,i=>{const d=i.detail.originalEvent,u=d.button===0&&d.ctrlKey===!0,h=d.button===2||u;(!a.modal||h)&&(l.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}}))}),fu=n.forwardRef((e,t)=>{const{__scopeDropdownMenu:o,...r}=e,a=Te(o);return n.createElement(Yd,C({},a,r,{ref:t}))}),hu=n.forwardRef((e,t)=>{const{__scopeDropdownMenu:o,...r}=e,a=Te(o);return n.createElement(Xd,C({},a,r,{ref:t}))}),pu=n.forwardRef((e,t)=>{const{__scopeDropdownMenu:o,...r}=e,a=Te(o);return n.createElement(Qd,C({},a,r,{ref:t}))}),mu=n.forwardRef((e,t)=>{const{__scopeDropdownMenu:o,...r}=e,a=Te(o);return n.createElement(Jd,C({},a,r,{ref:t}))}),gu=n.forwardRef((e,t)=>{const{__scopeDropdownMenu:o,...r}=e,a=Te(o);return n.createElement(eu,C({},a,r,{ref:t}))}),vu=n.forwardRef((e,t)=>{const{__scopeDropdownMenu:o,...r}=e,a=Te(o);return n.createElement(tu,C({},a,r,{ref:t}))}),bu=n.forwardRef((e,t)=>{const{__scopeDropdownMenu:o,...r}=e,a=Te(o);return n.createElement(ou,C({},a,r,{ref:t}))}),xu=n.forwardRef((e,t)=>{const{__scopeDropdownMenu:o,...r}=e,a=Te(o);return n.createElement(nu,C({},a,r,{ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}}))}),wu=su,$u=iu,Cu=lu,Ra=uu,Ma=fu,Na=hu,Ta=pu,_a=mu,Pa=gu,Ia=vu,Aa=bu,La=xu;globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};const Da=wu,Oa=$u,yu=n.forwardRef(({className:e,inset:t,children:o,...r},a)=>s.jsxs(Aa,{ref:a,className:T("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",t&&"pl-8",e),...r,children:[o,s.jsx(xl,{className:"ml-auto h-4 w-4"})]}));yu.displayName=Aa.displayName;const Eu=n.forwardRef(({className:e,...t},o)=>s.jsx(La,{ref:o,className:T("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 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",e),...t}));Eu.displayName=La.displayName;const Ln=n.forwardRef(({className:e,sideOffset:t=4,...o},r)=>s.jsx(Cu,{children:s.jsx(Ra,{ref:r,sideOffset:t,className:T("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 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",e),...o})}));Ln.displayName=Ra.displayName;const lo=n.forwardRef(({className:e,inset:t,...o},r)=>s.jsx(Na,{ref:r,className:T("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t&&"pl-8",e),...o}));lo.displayName=Na.displayName;const Su=n.forwardRef(({className:e,children:t,checked:o,...r},a)=>s.jsxs(Ta,{ref:a,className:T("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:o,...r,children:[s.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:s.jsx(Pa,{children:s.jsx(yo,{className:"h-4 w-4"})})}),t]}));Su.displayName=Ta.displayName;const ju=n.forwardRef(({className:e,children:t,...o},r)=>s.jsxs(_a,{ref:r,className:T("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...o,children:[s.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:s.jsx(Pa,{children:s.jsx(Cl,{className:"h-2 w-2 fill-current"})})}),t]}));ju.displayName=_a.displayName;const Fa=n.forwardRef(({className:e,inset:t,...o},r)=>s.jsx(Ma,{ref:r,className:T("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...o}));Fa.displayName=Ma.displayName;const Ha=n.forwardRef(({className:e,...t},o)=>s.jsx(Ia,{ref:o,className:T("-mx-1 my-1 h-px bg-muted",e),...t}));Ha.displayName=Ia.displayName;globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};const ku=n.lazy(async()=>dc(()=>import("./CodeEditor-BNtUY-yF.js").then(e=>e.C),__vite__mapDeps([0,1,2,3])));function Ru(e,t){const o=new RegExp(Object.keys(t).join("|"),"g");return e.replace(o,r=>t[r.toLowerCase()])}function Mu(e){return`export default function Widget() { + return ( +${Ru(e,{"class=":"className=","for=":"htmlFor=","-rule":"Rule","stroke-l":"strokeL","stroke-w":"strokeW","":"*/}",tabindex:"tabIndex",colspan:"colSpan:",rowspan:"rowSpan:","aria-*":"aria-*","data-*":"data-*",onclick:"onClick",onchange:"onChange",onblur:"onBlur"}).split(` +`).map(r=>` ${r}`).join(` +`)} + ) +}`}function Nu(e){return e.replaceAll(/```(.*)\n?/g,"")}function Tu({id:e,code:t}){const o=ne(Me({id:e})),r=ne(go),a=_e.find(m=>m.name===r),[c,l]=ee(Rr),[i,d]=ee(Mr),[u,h]=n.useState(t);n.useEffect(()=>{var m;h(c==="jsx"?Mu(t):c==="html"?t:Nu(((m=o.components)==null?void 0:m[c])??"Loading..."))},[c,t,o.components]),n.useEffect(()=>{i&&l(i)},[i,l]);const f=["html"];return o.components?f.push(...Object.keys(o.components)):f.push("jsx"),s.jsx("div",{className:"code-syntax-wrapper",children:s.jsxs("div",{className:"code-syntax relative rounded-lg border",children:[s.jsxs("div",{className:"grid w-full grid-cols-4 rounded-t-md border-b",children:[s.jsxs("ul",{className:"z-10 col-span-3 flex max-h-9 w-full overflow-y-hidden overflow-x-scroll rounded-tl-lg bg-background text-center text-sm font-medium text-gray-500 dark:text-gray-400",children:[f.map((m,b)=>s.jsx("li",{children:s.jsx("button",{type:"button",onClick:()=>l(m),className:T("inline-block w-full whitespace-nowrap border-r p-2 px-3 text-secondary-foreground",m===c?"bg-background":"bg-secondary hover:bg-background",b===0&&"rounded-tl-lg"),children:m.toUpperCase()})},m)),s.jsx("li",{children:s.jsxs(Da,{children:[s.jsx(Oa,{asChild:!0,children:s.jsx("button",{type:"button","aria-label":"Convert HTML to a framework",className:"inline-block w-full border-r bg-secondary p-[10px] text-secondary-foreground hover:bg-background",children:s.jsxs(je,{children:[s.jsx(ke,{asChild:!0,children:s.jsx(zi,{})}),s.jsx(Re,{side:"bottom",children:"Convert HTML to a framework"})]})})}),s.jsxs(Ln,{side:"top",children:[s.jsx(Fa,{children:"Convert to"}),s.jsx(Ha,{}),lc.map(m=>s.jsx(lo,{onClick:()=>{d(m)},children:m.toLocaleUpperCase()},m))]})]})},"new")]}),s.jsx("div",{className:"flex justify-end",children:s.jsxs("button",{type:"button",onClick:()=>aa(kr(u,c,a??_e[0])),className:"flex items-center border-l px-3 text-sm text-secondary-foreground hover:bg-background",children:[s.jsxs("svg",{className:"mr-2 h-3.5 w-3.5","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 18 20",children:[s.jsx("path",{d:"M5 9V4.13a2.96 2.96 0 0 0-1.293.749L.879 7.707A2.96 2.96 0 0 0 .13 9H5Zm11.066-9H9.829a2.98 2.98 0 0 0-2.122.879L7 1.584A.987.987 0 0 0 6.766 2h4.3A3.972 3.972 0 0 1 15 6v10h1.066A1.97 1.97 0 0 0 18 14V2a1.97 1.97 0 0 0-1.934-2Z"}),s.jsx("path",{d:"M11.066 4H7v5a2 2 0 0 1-2 2H0v7a1.969 1.969 0 0 0 1.933 2h9.133A1.97 1.97 0 0 0 13 18V6a1.97 1.97 0 0 0-1.934-2Z"})]})," ",s.jsx("span",{className:"copy-text",children:"Copy"})]})})]}),s.jsx("div",{className:"relative rounded-b-lg bg-zinc-900",children:s.jsx("div",{className:"h-[calc(100vh-354px)] max-w-[78vw] pb-8 text-sm",tabIndex:-1,children:s.jsx(n.Suspense,{fallback:s.jsx(Yr,{isLoading:!0}),children:t?s.jsx(ku,{code:u,framework:c}):void 0})})})]})})}globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};class _u{constructor(){Ho(this,"events");Ho(this,"buffers");this.events={},this.buffers={}}on(t,o){var r;if(this.events[t]||(this.events[t]=[]),this.buffers[t]){for(const a of this.buffers[t]??[])o(a);this.buffers[t]=void 0}(r=this.events[t])==null||r.push(o)}off(t,o){var r;this.events[t]&&(this.events[t]=(r=this.events[t])==null?void 0:r.filter(a=>a!==o))}emit(t,o){var r;if(!this.events[t]){this.buffers[t]||(this.buffers[t]=[]),(r=this.buffers[t])==null||r.push(o);return}for(const a of this.events[t]??[])a(o)}}const Tt=new _u;globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};const Va=n.createContext(Tt),Pu=({children:e})=>{const{id:t}=Ye(),[o,r]=ee(Me({id:t??"new"})),a=n.useMemo(()=>new $t(o,r),[o,r]),[c]=Ct(a),[l,i]=ee(yt),d=Nr(l.editedHTML||l.pureHTML||"",1e3);return n.useEffect(()=>{if(a.markdown){const h={pureHTML:a.pureHTML(c)??"",error:void 0,prompt:a.prompt(c)??""};h.pureHTML===""&&(h.error=`No HTML in LLM response, received: +${a.markdown}`),i({...Jo,...h})}else t==="new"&&i(Jo)},[t,c,i]),n.useEffect(()=>{d&&Wn(d,!l.rendering).then(u=>{i(h=>({...h,renderedHTML:u})),Tt.emit(`html-updated:${t}`,u)}).catch(u=>{console.error("HTML Parse error",u)})},[d,l.rendering,i]),n.useEffect(()=>{const u=h=>{const f=h;f.annotatedHTML?Wn(f.annotatedHTML,!1).then(m=>{i(b=>({...b,annotatedHTML:m.html}))}).catch(m=>{console.error("HTML Parse error",m)}):i(m=>({...m,...f}))};return Tt.on("ui-state",u),()=>{Tt.off("ui-state",u)}},[i]),s.jsx(Va.Provider,{value:Tt,children:e})},za=Va;function To(e){const 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])}const Ba="Checkbox",[Iu,S1]=Ne(Ba),[Au,Lu]=Iu(Ba),Du=n.forwardRef((e,t)=>{const{__scopeCheckbox:o,name:r,checked:a,defaultChecked:c,required:l,disabled:i,value:d="on",onCheckedChange:u,...h}=e,[f,m]=n.useState(null),b=Z(t,$=>m($)),g=n.useRef(!1),p=f?!!f.closest("form"):!0,[x=!1,w]=ze({prop:a,defaultProp:c,onChange:u}),v=n.useRef(x);return n.useEffect(()=>{const $=f==null?void 0:f.form;if($){const E=()=>w(v.current);return $.addEventListener("reset",E),()=>$.removeEventListener("reset",E)}},[f,w]),n.createElement(Au,{scope:o,state:x,disabled:i},n.createElement(z.button,C({type:"button",role:"checkbox","aria-checked":nt(x)?"mixed":x,"aria-required":l,"data-state":Ua(x),"data-disabled":i?"":void 0,disabled:i,value:d},h,{ref:b,onKeyDown:j(e.onKeyDown,$=>{$.key==="Enter"&&$.preventDefault()}),onClick:j(e.onClick,$=>{w(E=>nt(E)?!0:!E),p&&(g.current=$.isPropagationStopped(),g.current||$.stopPropagation())})})),p&&n.createElement(Hu,{control:f,bubbles:!g.current,name:r,value:d,checked:x,required:l,disabled:i,style:{transform:"translateX(-100%)"}}))}),Ou="CheckboxIndicator",Fu=n.forwardRef((e,t)=>{const{__scopeCheckbox:o,forceMount:r,...a}=e,c=Lu(Ou,o);return n.createElement(Ie,{present:r||nt(c.state)||c.state===!0},n.createElement(z.span,C({"data-state":Ua(c.state),"data-disabled":c.disabled?"":void 0},a,{ref:t,style:{pointerEvents:"none",...e.style}})))}),Hu=e=>{const{control:t,checked:o,bubbles:r=!0,...a}=e,c=n.useRef(null),l=To(o),i=$n(t);return n.useEffect(()=>{const d=c.current,u=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(u,"checked").set;if(l!==o&&f){const m=new Event("click",{bubbles:r});d.indeterminate=nt(o),f.call(d,nt(o)?!1:o),d.dispatchEvent(m)}},[l,o,r]),n.createElement("input",C({type:"checkbox","aria-hidden":!0,defaultChecked:nt(o)?!1:o},a,{tabIndex:-1,ref:c,style:{...e.style,...i,position:"absolute",pointerEvents:"none",opacity:0,margin:0}}))};function nt(e){return e==="indeterminate"}function Ua(e){return nt(e)?"indeterminate":e?"checked":"unchecked"}const Ka=Du,Vu=Fu;globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};const Wa=n.forwardRef(({className:e,...t},o)=>s.jsx(Ka,{ref:o,className:T("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),...t,children:s.jsx(Vu,{className:T("flex items-center justify-center text-current"),children:s.jsx(yo,{className:"h-4 w-4"})})}));Wa.displayName=Ka.displayName;const zu=n.forwardRef((e,t)=>n.createElement(z.label,C({},e,{ref:t,onMouseDown:o=>{var r;(r=e.onMouseDown)===null||r===void 0||r.call(e,o),!o.defaultPrevented&&o.detail>1&&o.preventDefault()}}))),Ga=zu;globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};const Bu=qr("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Qe=n.forwardRef(({className:e,...t},o)=>s.jsx(Ga,{ref:o,className:T(Bu(),e),...t}));Qe.displayName=Ga.displayName;const Za="Popover",[qa,j1]=Ne(Za,[qe]),_o=qe(),[Uu,Et]=qa(Za),Ku=e=>{const{__scopePopover:t,children:o,open:r,defaultOpen:a,onOpenChange:c,modal:l=!1}=e,i=_o(t),d=n.useRef(null),[u,h]=n.useState(!1),[f=!1,m]=ze({prop:r,defaultProp:a,onChange:c});return n.createElement(ho,i,n.createElement(Uu,{scope:t,contentId:He(),triggerRef:d,open:f,onOpenChange:m,onOpenToggle:n.useCallback(()=>m(b=>!b),[m]),hasCustomAnchor:u,onCustomAnchorAdd:n.useCallback(()=>h(!0),[]),onCustomAnchorRemove:n.useCallback(()=>h(!1),[]),modal:l},o))},Wu="PopoverTrigger",Gu=n.forwardRef((e,t)=>{const{__scopePopover:o,...r}=e,a=Et(Wu,o),c=_o(o),l=Z(t,a.triggerRef),i=n.createElement(z.button,C({type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":Qa(a.open)},r,{ref:l,onClick:j(e.onClick,a.onOpenToggle)}));return a.hasCustomAnchor?i:n.createElement(po,C({asChild:!0},c),i)}),Ya="PopoverPortal",[Zu,qu]=qa(Ya,{forceMount:void 0}),Yu=e=>{const{__scopePopover:t,forceMount:o,children:r,container:a}=e,c=Et(Ya,t);return n.createElement(Zu,{scope:t,forceMount:o},n.createElement(Ie,{present:o||c.open},n.createElement(xo,{asChild:!0,container:a},r)))},At="PopoverContent",Xu=n.forwardRef((e,t)=>{const o=qu(At,e.__scopePopover),{forceMount:r=o.forceMount,...a}=e,c=Et(At,e.__scopePopover);return n.createElement(Ie,{present:r||c.open},c.modal?n.createElement(Qu,C({},a,{ref:t})):n.createElement(Ju,C({},a,{ref:t})))}),Qu=n.forwardRef((e,t)=>{const o=Et(At,e.__scopePopover),r=n.useRef(null),a=Z(t,r),c=n.useRef(!1);return n.useEffect(()=>{const l=r.current;if(l)return Ro(l)},[]),n.createElement(Zt,{as:rt,allowPinchZoom:!0},n.createElement(Xa,C({},e,{ref:a,trapFocus:o.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:j(e.onCloseAutoFocus,l=>{var i;l.preventDefault(),c.current||(i=o.triggerRef.current)===null||i===void 0||i.focus()}),onPointerDownOutside:j(e.onPointerDownOutside,l=>{const i=l.detail.originalEvent,d=i.button===0&&i.ctrlKey===!0,u=i.button===2||d;c.current=u},{checkForDefaultPrevented:!1}),onFocusOutside:j(e.onFocusOutside,l=>l.preventDefault(),{checkForDefaultPrevented:!1})})))}),Ju=n.forwardRef((e,t)=>{const o=Et(At,e.__scopePopover),r=n.useRef(!1),a=n.useRef(!1);return n.createElement(Xa,C({},e,{ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:c=>{var l;if((l=e.onCloseAutoFocus)===null||l===void 0||l.call(e,c),!c.defaultPrevented){var i;r.current||(i=o.triggerRef.current)===null||i===void 0||i.focus(),c.preventDefault()}r.current=!1,a.current=!1},onInteractOutside:c=>{var l,i;(l=e.onInteractOutside)===null||l===void 0||l.call(e,c),c.defaultPrevented||(r.current=!0,c.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const d=c.target;((i=o.triggerRef.current)===null||i===void 0?void 0:i.contains(d))&&c.preventDefault(),c.detail.originalEvent.type==="focusin"&&a.current&&c.preventDefault()}}))}),Xa=n.forwardRef((e,t)=>{const{__scopePopover:o,trapFocus:r,onOpenAutoFocus:a,onCloseAutoFocus:c,disableOutsidePointerEvents:l,onEscapeKeyDown:i,onPointerDownOutside:d,onFocusOutside:u,onInteractOutside:h,...f}=e,m=Et(At,o),b=_o(o);return jo(),n.createElement(ko,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:a,onUnmountAutoFocus:c},n.createElement(Wt,{asChild:!0,disableOutsidePointerEvents:l,onInteractOutside:h,onEscapeKeyDown:i,onPointerDownOutside:d,onFocusOutside:u,onDismiss:()=>m.onOpenChange(!1)},n.createElement(mo,C({"data-state":Qa(m.open),role:"dialog",id:m.contentId},b,f,{ref:t,style:{...f.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}}))))}),ef=n.forwardRef((e,t)=>{const{__scopePopover:o,...r}=e,a=_o(o);return n.createElement(Sr,C({},a,r,{ref:t}))});function Qa(e){return e?"open":"closed"}const tf=Ku,of=Gu,nf=Yu,Ja=Xu,es=ef;globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};const fr=tf,hr=of,rf=n.forwardRef(({className:e,...t},o)=>s.jsx(es,{ref:o,className:T("fill-background",e),style:{clipPath:"inset(0 -10px -10px -10px)",filter:"drop-shadow(0 0 3px gray)",bottom:"1px"},...t}));rf.displayName=es.displayName;const mn=n.forwardRef(({className:e,align:t="center",sideOffset:o=4,...r},a)=>s.jsx(nf,{children:s.jsx(Ja,{ref:a,align:t,sideOffset:o,className:T("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 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",e),...r})}));mn.displayName=Ja.displayName;globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};function af(e){const t=" ";let o="",r="";for(const a of e.split(/>\s* +`,/^]*[^/]$/.test(a)&&!a.startsWith("input")&&(r+=t);return o.slice(1,-2)}function sf({error:e,id:t}){const o=n.useContext(za),r=/127\.0\.0\.1|localhost/.test(document.location.hostname)?`http://${document.location.hostname}:${document.location.port==="5173"?"7878":document.location.port}`:"https://wandb.github.io",a=n.useRef(null),c=n.useRef(null),l=n.useMemo(()=>Mn(8),[]),i=Cn(),[d,u]=ee(Me({id:t})),h=n.useMemo(()=>new $t(d,u,i),[d,u,i]),[f]=Ct(h),m=Gt(),[b,g]=ee(Tr),[p,x]=ee(_r),w=ne(En),[v,$]=ee(Pr),E=Ve(Ke),k=ne(yt),[D,y]=ee(go),I=ne(vo),[O,H]=ee(Ze.item(`screenshot-${t}-${f}`)),re=k.rendering,[q,ae]=n.useState(!1),[R,S]=n.useState(!1),[X,Y]=n.useState(!1),[K,M]=n.useState(w),[V,B]=n.useState(""),[fe,be]=n.useState(!1),[ge,we]=n.useState(),[pe,P]=n.useState(),U=ge??pe??"desktop",[te,Q]=n.useState(!1),[W,G]=n.useState(1);n.useLayoutEffect(()=>{w==="system"&&(window.matchMedia("(prefers-color-scheme: dark)").matches?M("dark"):M("light"))},[w]),n.useEffect(()=>{var _,L;if(q){const de=_e.find(ie=>ie.name===D)??_e[0];(L=(_=a.current)==null?void 0:_.contentWindow)==null||L.postMessage({action:"theme",theme:de},"*")}},[D,q,K]);const ve=n.useCallback(_=>{x(L=>{const de=L.filter(ie=>or.includes(ie));return de.includes(_)?de.filter(ie=>ie!==_):[...de,_]})},[x]);n.useEffect(()=>{function _(){var L,de;(de=(L=a.current)==null?void 0:L.contentWindow)==null||de.postMessage({action:"reset"},"*")}return o.on("iframe-reset",_),()=>{o.off("iframe-reset",_)}},[o]),n.useEffect(()=>{var _,L;(L=(_=a.current)==null?void 0:_.contentWindow)==null||L.postMessage({action:"reset"},"*")},[t]),n.useEffect(()=>{if(a.current){const _=new ResizeObserver(de=>{var jt;const ie=((jt=c.current)==null?void 0:jt.clientWidth)??768;switch(U){case"desktop":{ie>768?G(1):G(ie/768);break}case"tablet":{G(1);break}case"mobile":{G(1);break}default:G(1)}for(const A of de)A.contentRect.width<=480?P("mobile"):A.contentRect.width<=768?P("tablet"):P(void 0)}),L=c.current;return L?(_.observe(L),()=>_.unobserve(L)):()=>{}}return()=>{}},[pe,U]),n.useEffect(()=>{var _,L;v&&!te&&Q(v),te&&((L=(_=a.current)==null?void 0:_.contentWindow)==null||L.postMessage({action:"toggle-inspector"},"*"))},[v,te]),n.useEffect(()=>{var _;k.renderedHTML&&(a.current&&q?k.renderedHTML.html.length>30&&((_=a.current.contentWindow)==null||_.postMessage({html:k.renderedHTML.html,js:k.renderedHTML.js,darkMode:K==="dark",action:"hydrate",rendering:re},"*")):q||console.warn("Iframe not ready, not hydrating"))},[k.renderedHTML,K,q,re]),n.useEffect(()=>{const _=L=>{L.origin===r&&(L.data.id&&L.data.id!==l||(L.data.action==="ready"?ae(!0):L.data.screenshot?(console.log("Saving screenshot"),yn(L.data.screenshot,1024).then(H).catch(de=>console.error("Screenshot failure",de))):L.data.comment&&(g([...b,L.data.comment]),o.emit("ui-state",{annotatedHTML:af(L.data.html.trim())}),$(!1))))};return window.addEventListener("message",_),()=>window.removeEventListener("message",_)},[k.renderedHTML,b,re,w,g,r,l,$,o,H,O]);const me=n.useCallback(_=>{Xi(_,h,f).then(()=>B(_?"yep":"nope"),L=>{console.error("Error creating vote",L)})},[t,f]),Ee=n.useMemo(()=>(_e.find(_=>_.name===D)??_e[0]).activeColor[K==="dark"?"dark":"light"],[D,K]);return s.jsxs("div",{className:"flex flex-col",children:[s.jsxs("div",{className:"relative flex w-full flex-row",children:[s.jsx("div",{ref:c,className:T("code-preview-wrapper flex-grow",fe&&"hidden w-1/2 lg:block"),children:s.jsxs("div",{className:"code-responsive-wrapper relative h-[calc(100vh-315px)] w-full flex-none overflow-auto rounded-lg bg-background",children:[s.jsx("iframe",{title:"HTML preview",id:`version-${f}`,sandbox:"allow-same-origin allow-scripts allow-forms allow-popups allow-modals",ref:a,style:{transform:`scale(${W.toFixed(2)})`,width:W<1?"768px":void 0},className:T("iframe-code left-0 top-0 mx-auto h-full w-full origin-top-left",U==="tablet"&&"max-w-3xl",U==="mobile"&&"max-w-sm",U==="desktop"&&"absolute",e&&"hidden"),src:`${r}/openui/index.html?id=${l}`}),e?s.jsx(Yr,{isLoading:!0,error:e}):void 0]})}),s.jsx("div",{className:`flex-shrink-0 py-0 pl-4 transition-all duration-500 ease-in-out ${fe?"sm:w-full md:w-full lg:w-1/2":"hidden w-0"}`,children:s.jsx(Tu,{id:t,code:k.editedHTML||k.pureHTML})})]}),s.jsx("div",{className:"w-full p-1",children:s.jsxs("div",{className:"grid grid-cols-3",children:[s.jsxs("div",{className:"col-span-1 items-center justify-center",children:[s.jsxs(je,{children:[s.jsx(ke,{asChild:!0,children:s.jsx(J,{onClick:()=>{me(!0)},size:"icon",variant:"ghost",className:`hover:animate-wiggle-zoom hover:bg-transparent ${V==="yep"&&"text-green-600"}`,children:s.jsx(jl,{className:"h-4 w-4"})})}),s.jsx(Re,{children:"Click me if you like the UI"})]}),s.jsxs(je,{children:[s.jsx(ke,{asChild:!0,children:s.jsx(J,{onClick:()=>{me(!1)},size:"icon",variant:"ghost",className:`hover:animate-wiggle-zoom hover:bg-transparent ${V==="nope"&&"text-red-800"}`,children:s.jsx(Sl,{className:"h-4 w-4"})})}),s.jsx(Re,{children:"Click me if you dislike the UI"})]}),s.jsxs(fr,{open:R,children:[s.jsx(hr,{asChild:!0,children:s.jsx(J,{className:"-mr-2 border-none text-muted-foreground hover:animate-wiggle-zoom hover:bg-transparent",variant:"ghost",size:"icon",type:"button",onClick:()=>S(!0),children:s.jsx(kl,{className:"h-4 w-4"})})}),s.jsx(mn,{side:"top",className:"w-80",onOpenAutoFocus:()=>{var _,L;I&&(console.log("Taking screenshot"),(L=(_=a.current)==null?void 0:_.contentWindow)==null||L.postMessage({action:"take-screenshot"},"*"))},onEscapeKeyDown:()=>S(!1),onInteractOutside:()=>S(!1),children:s.jsxs("div",{className:"grid gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx("h4",{className:"font-medium leading-none",children:"Iterate on this UI"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Select one or more dimensions to guide the LLM."})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx("div",{className:"grid grid-cols-2 items-center gap-4",children:or.map(_=>s.jsxs("div",{children:[s.jsx(Wa,{id:_,checked:p.includes(_),onCheckedChange:()=>ve(_),className:"mr-1"}),s.jsxs(Qe,{htmlFor:_,children:[!_.endsWith("er")&&"More ",_.endsWith("er")?_.charAt(0).toUpperCase()+_.slice(1):_]})]},_))}),s.jsx(J,{type:"button",className:"mt-2",onClick:()=>{S(!1),m(`/ai/${t}?regen=1`,{replace:!0})},children:"Make Magic"})]})]})})]})]}),s.jsxs("div",{className:"col-span-1 flex items-center justify-center",children:[s.jsxs(je,{children:[s.jsx(ke,{asChild:!0,children:s.jsxs(J,{onClick:()=>we(ge==="desktop"?void 0:"desktop"),size:"icon",variant:"ghost",className:T("hover:bg-transparent",U==="desktop"&&"text-primary"),children:[s.jsx("span",{className:"sr-only",children:"Toggle desktop view"}),s.jsx("svg",{className:"inline-block h-3.5 w-3.5","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 20 20",children:s.jsx("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M10 14v4m-4 1h8M1 10h18M2 1h16a1 1 0 0 1 1 1v11a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1Z"})})]})}),s.jsx(Re,{children:"Toggle desktop view"})]}),s.jsxs(je,{children:[s.jsx(ke,{asChild:!0,children:s.jsxs(J,{onClick:()=>we("tablet"),size:"icon",variant:"ghost",className:T("hidden hover:bg-transparent sm:flex",U==="tablet"&&"text-primary"),children:[s.jsx("span",{className:"sr-only",children:"Toggle tablet view"}),s.jsx("svg",{className:"inline-block h-3.5 w-3.5","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 18 20",children:s.jsx("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M7.5 16.5h3M2 1h14a1 1 0 0 1 1 1v16a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1Z"})})]})}),s.jsx(Re,{children:"Toggle tablet view"})]}),s.jsxs(je,{children:[s.jsx(ke,{asChild:!0,children:s.jsxs(J,{onClick:()=>we("mobile"),size:"icon",variant:"ghost",className:T("hidden hover:bg-transparent sm:flex",U==="mobile"&&"text-primary"),children:[s.jsx("span",{className:"sr-only",children:"Toggle mobile view"}),s.jsx("svg",{className:"inline-block h-3.5 w-3.5","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 14 20",children:s.jsx("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M1 14h12M1 4h12M6.5 16.5h1M2 1h10a1 1 0 0 1 1 1v16a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1Z"})})]})}),s.jsx(Re,{children:"Toggle mobile view"})]})]}),s.jsxs("div",{className:"col-span-1 flex justify-end",children:[s.jsxs(fr,{open:X,onOpenChange:Y,children:[s.jsx(hr,{asChild:!0,children:s.jsxs(J,{size:"icon",variant:"ghost",className:T("ml-2 rounded-full text-primary-foreground hover:bg-transparent hover:text-primary-foreground"),children:[s.jsx("span",{className:"flex h-6 w-6 items-center justify-center rounded-full opacity-40 hover:opacity-100",style:{backgroundColor:`hsl(${Ee})`},children:s.jsx(yl,{strokeWidth:1,className:"h-4 w-4"})}),s.jsx("span",{className:"sr-only",children:"Change theme"})]})}),s.jsx(mn,{side:"top",className:"w-96",children:s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsxs("h2",{className:"flex text-sm font-medium",children:["UI Theme"," ",s.jsxs(kn,{children:[s.jsx(Rn,{asChild:!0,children:s.jsx(Ui,{className:"ml-1 h-3 w-3"})}),s.jsxs(Co,{side:"top",className:"w-96",children:[s.jsxs("p",{children:["We use CSS variables to define custom tailwind colors and instruct the LLM to prefer them over hard-coded colors. The approach is modelled after"," ",s.jsx("a",{href:"https://ui.shadcn.com/themes",rel:"noreferrer",target:"_blank",className:"underline",children:"ShadCN"}),"."]}),s.jsx("p",{className:"mt-2",children:`If changing the color isn't working for your UI, try editing the code and adding the class "bg-primary" to a button or "text-primary" to a link.`}),s.jsx(ta,{})]})]})]}),s.jsx("div",{className:"grid grid-cols-3 gap-2",children:_e.map(_=>{const L=D===_.name;return s.jsxs(J,{variant:"outline",size:"sm",onClick:()=>{y(_.name),Y(!1)},className:T("justify-start",L&&"border-2 border-primary"),style:{"--theme-primary":`hsl(${_.activeColor[w==="dark"?"dark":"light"]})`},children:[s.jsx("span",{className:T("flex h-5 w-5 shrink-0 -translate-x-1 items-center justify-center rounded-full bg-[--theme-primary]"),children:L?s.jsx(yo,{className:"h-4 w-4 text-white"}):void 0}),_.label]},_.name)})})]})})]}),s.jsxs(je,{children:[s.jsx(ke,{asChild:!0,children:s.jsxs(J,{onClick:_=>{var de;if(_.shiftKey&&O){const ie=window.open();ie==null||ie.document.write(`Image`),ie==null||ie.document.close();return}const L=K==="dark"?"light":"dark";M(L),a.current&&((de=a.current.contentWindow)==null||de.postMessage({action:"toggle-dark-mode",mode:L},"*"))},size:"icon",variant:"ghost",className:"hover:bg-transparent",children:[s.jsx("svg",{"data-toggle-icon":"moon",className:`${K==="light"&&"hidden"} inline-block h-3.5 w-3.5`,"aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 18 20",children:s.jsx("path",{d:"M17.8 13.75a1 1 0 0 0-.859-.5A7.488 7.488 0 0 1 10.52 2a1 1 0 0 0 0-.969A1.035 1.035 0 0 0 9.687.5h-.113a9.5 9.5 0 1 0 8.222 14.247 1 1 0 0 0 .004-.997Z"})}),s.jsx("svg",{"data-toggle-icon":"sun",className:`${K==="dark"&&"hidden"} inline-block h-3.5 w-3.5`,"aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 20 20",children:s.jsx("path",{d:"M10 15a5 5 0 1 0 0-10 5 5 0 0 0 0 10Zm0-11a1 1 0 0 0 1-1V1a1 1 0 0 0-2 0v2a1 1 0 0 0 1 1Zm0 12a1 1 0 0 0-1 1v2a1 1 0 1 0 2 0v-2a1 1 0 0 0-1-1ZM4.343 5.757a1 1 0 0 0 1.414-1.414L4.343 2.929a1 1 0 0 0-1.414 1.414l1.414 1.414Zm11.314 8.486a1 1 0 0 0-1.414 1.414l1.414 1.414a1 1 0 0 0 1.414-1.414l-1.414-1.414ZM4 10a1 1 0 0 0-1-1H1a1 1 0 0 0 0 2h2a1 1 0 0 0 1-1Zm15-1h-2a1 1 0 1 0 0 2h2a1 1 0 0 0 0-2ZM4.343 14.243l-1.414 1.414a1 1 0 1 0 1.414 1.414l1.414-1.414a1 1 0 0 0-1.414-1.414ZM14.95 6.05a1 1 0 0 0 .707-.293l1.414-1.414a1 1 0 1 0-1.414-1.414l-1.414 1.414a1 1 0 0 0 .707 1.707Z"})}),s.jsx("span",{className:"sr-only",children:"Toggle dark/light mode"})]})}),s.jsx(Re,{children:"Toggle dark/light mode"})]}),s.jsxs(je,{children:[s.jsx(ke,{asChild:!0,children:s.jsxs(J,{size:"icon",variant:"ghost",className:T("hover:bg-transparent",fe&&"text-primary"),onClick:()=>{E("closed"),be(!fe)},children:[s.jsx(ji,{strokeWidth:4,className:"h-5 w-5"}),s.jsx("span",{className:"sr-only",children:"Edit HTML"})]})}),s.jsx(Re,{children:"Edit HTML"})]})]})]})})]})}globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};const Dn=n.forwardRef(({className:e,...t},o)=>s.jsx("textarea",{className:T("flex w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:o,...t}));Dn.displayName="Textarea";globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};function cf({isEditing:e,imageUploadRef:t}){const o=n.useContext(za),r=Ye(),[a,c]=Ir(),l=Gt(),i=r.id??"new",[d,u]=ee(Me({id:i})),h=n.useMemo(()=>new $t(d,u),[d,u]),[f,m]=Ct(h),b=h.pureHTML(f),g=n.useRef(null),p=n.useRef(),[x,w]=ee(Ar),[v,$]=ee(Pr),[E,k]=ee(Mr),[D,y]=ee(Ke),I=ne(vo),[O,H]=ee(Tr),re=ne(Ze.item(`screenshot-${i}-${f}`)),q=Ve(Ze.item(`image-${i}-${f}`)),ae=ne(yt),R=ne(Lr),{rendering:S,annotatedHTML:X}=ae,Y=ne(_r),K=ne(Dr),M=ne(Or),V=Cn(),[B,fe]=n.useState(kt[0]),[be,ge]=n.useState(""),we=Ve(bo),[pe,P]=n.useState(d.markdown??""),U=Nr(pe),te=n.useCallback((A,F=!0)=>{const oe=Mn();Me({id:oe,prompt:A,createdAt:new Date}),we(ue=>[oe,...ue]),l(`/ai/${oe}?gen=1&clear=${F}`)},[l,we]),[Q,W]=n.useState(!1),[G,ve]=n.useState(!1),[me,Ee]=n.useState(),_=e?"refine":"create",L=n.useCallback(A=>{A.trim()!==""&&(u(F=>({...F,markdown:(F.markdown??"")+A})),V())},[V,u]),de=n.useCallback((A,F,oe=!1)=>{console.log("STREAMING RESPONSE:",A),c(new URLSearchParams,{preventScrollReset:!0,replace:!0}),m(-1),o.emit("ui-state",{...Jo,rendering:!0,prompt:A}),o.emit("iframe-reset",{});let ue=x;I?re&&(ue=re.url):ue=void 0,uc({query:A,model:K,action:_,systemPrompt:mc,html:oe?void 0:F,image:oe?void 0:ue,temperature:M},Se=>{P(Xe=>(Xe||"")+Se)}).then(Se=>{w(""),P(Se),o.emit("ui-state",{rendering:!1}),console.log("Rendering complete, saving markdown"),L(Se),g.current&&(g.current.value="")}).catch(Se=>{w(""),P(""),console.error(Se);let{message:Xe}=Se;Xe.includes("Object of type bytes is not JSON serializable")&&(Xe="OpenUI currently only supports llava or moondream vision models from Ollama"),o.emit("ui-state",{rendering:!1,error:Xe})})},[c,m,o,x,I,re,K,_,M,w,L]),ie=n.useCallback(A=>{let F=kt[Math.floor(Math.random()*kt.length)];for(;F===A;)F=kt[Math.floor(Math.random()*kt.length)];fe(F),ge(F.slice(0,1))},[]);n.useEffect(()=>{const A=a.get("clear")==="true",F=a.get("gen")==="1";i!=="new"&&F&&!S?de(d.prompt,void 0,A):i==="new"&&ie(B)},[d.prompt,i]),n.useEffect(()=>{if(a.get("regen")==="1"){P("");let{prompt:A}=d;A=`Let's make this ${(Y.length!==1||!Y.some(oe=>oe.endsWith("er")))&&"more"} ${Y.length>0?Y.sort().join(" and "):"interesting"}.`,u(oe=>({...oe,markdown:oe.markdown+zo(A)})),V(),de(A,h.pureHTML(f))}},[a.get("regen")]),n.useEffect(()=>{W(R)},[R]),n.useEffect(()=>{try{if(!pe||r.id==="new")return;let A=pe;S&&(A=pe.split(` +`).slice(0,-1).join(` +`));const F=fc(A,void 0,S);F.html?(u(oe=>({...oe,...F})),o.emit("ui-state",{pureHTML:F.html,rendering:S,error:void 0})):S||o.emit("ui-state",{rendering:!1,error:`No HTML in LLM response, received: +${pe}`})}catch(A){u(F=>({...F,name:"Error"})),o.emit("ui-state",{rendering:!1,error:"Error parsing response, see console."}),console.error(A)}},[U]);const jt=n.useCallback(A=>{var oe;D==="history"&&y("closed"),P(""),A.preventDefault();let F=((oe=g.current)==null?void 0:oe.value.trim())??"";if(x===""&&F===""&&(F=B),!(x===""&&F==="")){if(_==="create"){te(F,x==="");return}u(ue=>({...ue,markdown:ue.markdown+zo(F),prompts:[...ue.prompts??[ue.prompt],F]})),V(),de(F,b)}},[_,B,b,te,x,u,V,de,y,D]);return n.useEffect(()=>{if(!E)return;const A=E;k(void 0),o.emit("ui-state",{rendering:!0,error:void 0});const F=d.components??{};hc({model:K,framework:A,html:b??"",temperature:M},oe=>{u(ue=>(F[A]===void 0&&(F[A]=""),F[A]+=oe,{...ue,components:{...F}}))}).then(()=>{V(),o.emit("ui-state",{rendering:!1})}).catch(oe=>{console.error(oe),o.emit("ui-state",{rendering:!1,error:oe.message})})},[E,u,V,k,d.components,b,K,M,o]),n.useEffect(()=>{X!==""&&(u(A=>({...A,markdown:A.markdown+zo(O.at(-1)??"Edit from comment")})),H([]),de("",X))},[X,O,H,u,de]),n.useEffect(()=>{ie(""),document.activeElement===g.current&&W(!0)},[ie]),n.useEffect(()=>{var A;return e?clearTimeout(p.current):((A=g.current)==null?void 0:A.value)===""&&(p.current=setTimeout(()=>{Ee(void 0),ie(B)},1e4),ve(!0),setTimeout(()=>ve(!1),1e3)),()=>clearTimeout(p.current)},[ie,B,e]),n.useEffect(()=>{if(e){Ee(void 0);return}if(be.lengthge(Xe=>B.slice(0,Xe.length+1)),oe);const{scrollHeight:ue,clientHeight:Se}=g.current??{scrollHeight:0,clientHeight:0};ue>Se?Ee(ue):ue!==Se&&Ee(void 0)}},[B,be,e]),s.jsx("div",{id:"llm-input",className:T("z-0 mx-auto my-4 flex w-full max-w-full justify-center rounded-full bg-muted px-4 py-3 align-middle transition-all md:w-full lg:w-10/12",Q?"border-2 border-primary bg-white":""),children:s.jsxs(pc,{onSubmit:jt,className:T("flex min-h-16 w-full items-center justify-center",e?"min-h-8":""),children:[s.jsx("input",{ref:t,id:"file-input",type:"file",className:"hidden",accept:"image/*",onChange:A=>{var ue;const F=((ue=A.target.files)==null?void 0:ue[0])??void 0;if(F===void 0)return;const oe=new FileReader;oe.addEventListener("load",()=>{yn(oe.result,1024).then(Se=>{w(Se.url),q(Se).catch(()=>{console.error("Failed to set image")})},()=>console.error("Resize failed"))}),oe.readAsDataURL(F)}}),!e&&s.jsx(J,{className:"mx-4 h-6 w-6 flex-none rounded-full border-none bg-transparent",variant:"outline",size:"icon",type:"button",onClick:()=>{clearTimeout(p.current),ie(B)},children:s.jsx(El,{strokeWidth:"1",className:`${G?"animate-rotate-180":""} h-5 w-5`})}),s.jsx(Dn,{name:"query",rows:Math.floor(me?me/33:1),className:T("my-auto max-h-[130px] flex-1 resize-none items-center justify-center overflow-y-hidden rounded-none align-middle text-lg placeholder:text-lg","border-none bg-muted outline-none ring-0 transition-all focus-visible:bg-white focus-visible:ring-0 focus-visible:ring-offset-0"),style:{height:me?`${me}px`:void 0},onChange:A=>{const{scrollHeight:F,clientHeight:oe,value:ue}=A.target;F>oe?Ee(F):F!==oe&&Ee(void 0),ue===""?ie(B):(clearTimeout(p.current),ue.length===1&&Ee(void 0))},onFocus:()=>{W(!0)},onBlur:()=>{W(!1)},placeholder:e?"Ask for changes to the current UI":x?"Describe the screenshot you uploaded (Optional)":be,ref:g,onKeyDown:A=>{A.key==="Enter"&&(jt(A),A.preventDefault())}}),s.jsxs("div",{className:"flex items-center",children:[e?s.jsxs(je,{children:[s.jsx(ke,{asChild:!0,children:s.jsx(J,{onClick:()=>{$(!v)},size:"icon",variant:"ghost",type:"button",className:T("h-8 w-8 flex-none bg-transparent",v?"border-1 rounded-full border-primary text-white":""),children:s.jsx("svg",{className:"h-5 w-5",width:"24",height:"24",viewBox:"0 0 24 24",strokeWidth:1,fill:"none",xmlns:"http://www.w3.org/2000/svg",children:s.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2.89661 3.15265C2.83907 2.99331 2.99331 2.83907 3.15265 2.89661L21.5721 9.5481C22.0611 9.72467 22.1094 10.3972 21.6507 10.6418L14.7396 14.3278C14.5645 14.4212 14.4212 14.5645 14.3278 14.7396L10.6418 21.6507C10.3972 22.1094 9.72467 22.0611 9.5481 21.5722L2.89661 3.15265ZM5.24811 5.24811L10.2712 19.1582L13.2191 13.6309C13.3125 13.4558 13.4558 13.3125 13.6309 13.2191L19.1582 10.2712L5.24811 5.24811Z",fill:"currentColor"})})})}),s.jsx(Re,{children:"Select elements in the HTML"})]}):I?s.jsxs(je,{children:[s.jsx(ke,{asChild:!0,children:s.jsx(J,{className:"mr-2 h-8 w-8 flex-none rounded-full border-none bg-transparent",variant:"outline",size:"icon",type:"button",onClick:()=>{var A;return(A=t.current)==null?void 0:A.click()},children:s.jsx(co,{strokeWidth:1,className:"h-5 w-5"})})}),s.jsx(Re,{children:"Upload a screenshot of a web page you want to replicate"})]}):void 0,S?s.jsx("div",{className:"rendering h-8 w-8 flex-none animate-spin rounded-full bg-gradient-to-r from-purple-500 via-pink-500 to-red-500"}):s.jsx(J,{className:T("mr-4 h-8 w-8 flex-none rounded-full border-none bg-muted hover:bg-primary hover:text-white",Q?"border-1 border-primary bg-primary/20 text-primary":""),variant:"outline",size:"icon",type:"submit",children:s.jsx(bl,{strokeWidth:2,className:"h-5 w-5"})})]})]})})}const ts="Dialog",[os,k1]=Ne(ts),[lf,Ae]=os(ts),df=e=>{const{__scopeDialog:t,children:o,open:r,defaultOpen:a,onOpenChange:c,modal:l=!0}=e,i=n.useRef(null),d=n.useRef(null),[u=!1,h]=ze({prop:r,defaultProp:a,onChange:c});return n.createElement(lf,{scope:t,triggerRef:i,contentRef:d,contentId:He(),titleId:He(),descriptionId:He(),open:u,onOpenChange:h,onOpenToggle:n.useCallback(()=>h(f=>!f),[h]),modal:l},o)},uf="DialogTrigger",ff=n.forwardRef((e,t)=>{const{__scopeDialog:o,...r}=e,a=Ae(uf,o),c=Z(t,a.triggerRef);return n.createElement(z.button,C({type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":On(a.open)},r,{ref:c,onClick:j(e.onClick,a.onOpenToggle)}))}),ns="DialogPortal",[hf,rs]=os(ns,{forceMount:void 0}),pf=e=>{const{__scopeDialog:t,forceMount:o,children:r,container:a}=e,c=Ae(ns,t);return n.createElement(hf,{scope:t,forceMount:o},n.Children.map(r,l=>n.createElement(Ie,{present:o||c.open},n.createElement(xo,{asChild:!0,container:a},l))))},gn="DialogOverlay",mf=n.forwardRef((e,t)=>{const o=rs(gn,e.__scopeDialog),{forceMount:r=o.forceMount,...a}=e,c=Ae(gn,e.__scopeDialog);return c.modal?n.createElement(Ie,{present:r||c.open},n.createElement(gf,C({},a,{ref:t}))):null}),gf=n.forwardRef((e,t)=>{const{__scopeDialog:o,...r}=e,a=Ae(gn,o);return n.createElement(Zt,{as:rt,allowPinchZoom:!0,shards:[a.contentRef]},n.createElement(z.div,C({"data-state":On(a.open)},r,{ref:t,style:{pointerEvents:"auto",...r.style}})))}),Lt="DialogContent",vf=n.forwardRef((e,t)=>{const o=rs(Lt,e.__scopeDialog),{forceMount:r=o.forceMount,...a}=e,c=Ae(Lt,e.__scopeDialog);return n.createElement(Ie,{present:r||c.open},c.modal?n.createElement(bf,C({},a,{ref:t})):n.createElement(xf,C({},a,{ref:t})))}),bf=n.forwardRef((e,t)=>{const o=Ae(Lt,e.__scopeDialog),r=n.useRef(null),a=Z(t,o.contentRef,r);return n.useEffect(()=>{const c=r.current;if(c)return Ro(c)},[]),n.createElement(as,C({},e,{ref:a,trapFocus:o.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:j(e.onCloseAutoFocus,c=>{var l;c.preventDefault(),(l=o.triggerRef.current)===null||l===void 0||l.focus()}),onPointerDownOutside:j(e.onPointerDownOutside,c=>{const l=c.detail.originalEvent,i=l.button===0&&l.ctrlKey===!0;(l.button===2||i)&&c.preventDefault()}),onFocusOutside:j(e.onFocusOutside,c=>c.preventDefault())}))}),xf=n.forwardRef((e,t)=>{const o=Ae(Lt,e.__scopeDialog),r=n.useRef(!1),a=n.useRef(!1);return n.createElement(as,C({},e,{ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:c=>{var l;if((l=e.onCloseAutoFocus)===null||l===void 0||l.call(e,c),!c.defaultPrevented){var i;r.current||(i=o.triggerRef.current)===null||i===void 0||i.focus(),c.preventDefault()}r.current=!1,a.current=!1},onInteractOutside:c=>{var l,i;(l=e.onInteractOutside)===null||l===void 0||l.call(e,c),c.defaultPrevented||(r.current=!0,c.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const d=c.target;((i=o.triggerRef.current)===null||i===void 0?void 0:i.contains(d))&&c.preventDefault(),c.detail.originalEvent.type==="focusin"&&a.current&&c.preventDefault()}}))}),as=n.forwardRef((e,t)=>{const{__scopeDialog:o,trapFocus:r,onOpenAutoFocus:a,onCloseAutoFocus:c,...l}=e,i=Ae(Lt,o),d=n.useRef(null),u=Z(t,d);return jo(),n.createElement(n.Fragment,null,n.createElement(ko,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:a,onUnmountAutoFocus:c},n.createElement(Wt,C({role:"dialog",id:i.contentId,"aria-describedby":i.descriptionId,"aria-labelledby":i.titleId,"data-state":On(i.open)},l,{ref:u,onDismiss:()=>i.onOpenChange(!1)}))),!1)}),wf="DialogTitle",$f=n.forwardRef((e,t)=>{const{__scopeDialog:o,...r}=e,a=Ae(wf,o);return n.createElement(z.h2,C({id:a.titleId},r,{ref:t}))}),Cf="DialogDescription",yf=n.forwardRef((e,t)=>{const{__scopeDialog:o,...r}=e,a=Ae(Cf,o);return n.createElement(z.p,C({id:a.descriptionId},r,{ref:t}))}),Ef="DialogClose",Sf=n.forwardRef((e,t)=>{const{__scopeDialog:o,...r}=e,a=Ae(Ef,o);return n.createElement(z.button,C({type:"button"},r,{ref:t,onClick:j(e.onClick,()=>a.onOpenChange(!1))}))});function On(e){return e?"open":"closed"}const jf=df,kf=ff,Rf=pf,ss=mf,cs=vf,is=$f,ls=yf,ds=Sf;globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};const Fn=jf,us=kf,Mf=Rf,Nf=ds,fs=n.forwardRef(({className:e,...t},o)=>s.jsx(ss,{ref:o,className:T("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));fs.displayName=ss.displayName;const Po=n.forwardRef(({className:e,children:t,noClose:o,...r},a)=>s.jsxs(Mf,{children:[s.jsx(fs,{}),s.jsxs(cs,{ref:a,className:T("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...r,children:[t,o!==!0&&s.jsxs(ds,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[s.jsx(Rl,{className:"h-4 w-4"}),s.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Po.displayName=cs.displayName;const Io=({className:e,...t})=>s.jsx("div",{className:T("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});Io.displayName="DialogHeader";const Ao=n.forwardRef(({className:e,...t},o)=>s.jsx(is,{ref:o,className:T("text-lg font-semibold leading-none tracking-tight",e),...t}));Ao.displayName=is.displayName;const xt=n.forwardRef(({className:e,...t},o)=>s.jsx(ls,{ref:o,className:T("text-sm text-muted-foreground",e),...t}));xt.displayName=ls.displayName;globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};function Tf(){const t=Ye().id??"new",[o,r]=ee(Me({id:t})),a=n.useMemo(()=>new $t(o,r),[o,r]),[c,l]=n.useState(!1),[i,d]=n.useState(),[u]=Ct(a);return n.useEffect(()=>{c&&Yi(t,a,u).then(()=>{aa(document.location.href.replace("/ai","/ai/shared"))}).catch(h=>{console.error("Share error",h),d(h.toString())})},[t,c]),s.jsxs(Fn,{onOpenChange:h=>l(h),children:[s.jsxs(je,{children:[s.jsx(ke,{asChild:!0,children:s.jsx(us,{asChild:!0,children:s.jsx(J,{variant:"ghost",className:"-mr-4 hover:bg-transparent",children:s.jsx(Wi,{})})})}),s.jsx(Re,{side:"bottom",children:"Share this version"})]}),s.jsxs(Po,{className:"sm:max-w-[425px]",children:[s.jsxs(Io,{children:[s.jsx(Ao,{children:"Share"}),i?s.jsx(xt,{className:"mb-2 text-red-500 dark:text-red-400",children:i}):s.jsx(xt,{children:"Copy the link below to share your creation"})]}),s.jsx("div",{className:"items-center",children:s.jsx("input",{type:"text",value:document.location.href.replace("/ai","/ai/shared"),className:"w-full p-3"})})]})]})}globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};function _f({isShared:e=!1}){const o=Ye().id??"new",[r,a]=n.useState(!1),c=n.useRef(null),l=n.useRef(null),[i,d]=ee(Ke),[u,h]=ee(Me({id:o})),[f,m]=ee(bo),b=ne(Rr),g=ne(vo),p=Ve(Ar),x=Ve(Lr),w=n.useMemo(()=>new $t(u,h),[u,h]),{t:v}=wi(),[$,E]=ee(yt),k=ne(go),D=_e.find(R=>R.name===k),[y]=Ct(w),I=Ve(Ze.delete),O=ne(Ze.item("image-new-0")),[H,re]=ee(Ze.item(`image-${o}-${y}`)),q=ne(Ze.item(`screenshot-${o}-${y-1}`));n.useEffect(()=>{e&&(async()=>{const R=await Qi(o);E(S=>({...S,pureHTML:R.html??"",error:void 0})),R.markdown=`--- +name: ${R.name} +emoji: ${R.emoji} +--- + +${R.html}`,h(R),f.includes(o)||m([o,...f])})().catch(R=>{console.error(R),E(S=>({...S,error:R.toString()}))})},[e,o,E,h,m,f]),n.useEffect(()=>{a(o!=="new"),o!=="new"&&O&&!H&&(re(O).catch(R=>{console.error("Error setting image",R)}),I("image-new-0").catch(R=>{console.error("Error deleting image",R)}))},[o,a,O,H,re,I]);const ae=n.useCallback(R=>{const S=new FileReader;S.addEventListener("load",()=>{p(S.result),yn(S.result,1024).then(re,()=>console.error("Resize failed"))}),S.readAsDataURL(R)},[p,re]);return n.useEffect(()=>{const R=S=>{var K;const X=(K=S.clipboardData)==null?void 0:K.items;let Y;if(X){for(const M of X)if(M.type.startsWith("image/")){Y=M.getAsFile();break}Y?(console.log("Pasted file type",Y.type),ae(Y)):console.error("File type not supported",X[0].type)}};return window.addEventListener("paste",R),()=>{window.removeEventListener("paste",R)}},[ae]),s.jsx(Pu,{children:s.jsxs("div",{ref:l,role:"button",tabIndex:0,onDragEnter:()=>x(!0),onDragExit:()=>x(!1),onDrop:R=>{if(R.preventDefault(),x(!1),!g){console.warn("Model does not have vision capabilities");return}let S,X;if(R.dataTransfer.items.length>0){for(const Y of R.dataTransfer.items)if(Y.kind==="file"){if(S=Y.getAsFile(),X=S==null?void 0:S.type,S!=null&&S.type.startsWith("image/"))break;S=void 0}}else for(const Y of R.dataTransfer.files){if(X=S==null?void 0:S.type,Y.type.startsWith("image/"))break;S=void 0}R.dataTransfer.clearData(),S?ae(S):console.warn("File type not supported",X)},onDragOver:R=>{R.preventDefault()},className:T("overflow-y-none relative flex h-[calc(100vh-12em)] max-h-[calc(100vh-6em)] w-full flex-col gap-3 px-[3%] pb-4 align-middle md:px-[10%]",i==="closed"?"":"md:px-[3%]"),children:[o==="new"?s.jsxs("div",{className:i==="history"?"mt-[25%]":"mt-[20%]",children:[H?s.jsx("img",{src:H.url,alt:"Screenshot",className:"mx-auto mb-4 max-h-72 max-w-72"}):void 0,s.jsx("h1",{className:"mb-1 flex-row text-center text-2xl font-medium text-zinc-800 dark:text-zinc-300 md:text-3xl",children:v("Chat Header")}),g?s.jsx("h2",{className:"mb-4 text-center text-lg font-normal text-muted-foreground md:text-xl",children:v("Pro Tip")}):void 0]}):s.jsxs("div",{children:[s.jsxs("div",{className:"flex w-full items-center justify-between p-4",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx($l,{strokeWidth:1,className:"flex w-4"}),s.jsxs(kn,{children:[s.jsxs(Rn,{className:"flex",children:[s.jsx("div",{className:"flex cursor-help items-center justify-start gap-2.5 rounded-full bg-muted p-2 brightness-[.95]",children:s.jsxs("span",{className:T("text-md max-w-[calc(100vw-200px)] truncate px-4 text-left font-sans font-normal leading-[20px] md:max-w-[calc(100vw-450px)]",i!=="closed"&&"md:max-w-[calc(100vw-750px)]"),children:[q&&$.prompt.startsWith("Let's make")?s.jsx(co,{strokeWidth:1,className:"float-left mr-2 h-4 w-4"}):void 0,$.prompt===""?s.jsx(co,{strokeWidth:1,className:"h-4 w-4"}):$.prompt]})}),s.jsxs("span",{className:"my-auto ml-2 hidden h-4 flex-shrink-0 rounded-sm bg-muted px-2 text-xs text-zinc-500 brightness-[.95] md:block",children:["Version ",w.version(y)]})]}),s.jsx(Co,{className:"ml-36 w-[1000px] max-w-[calc(70vw)] rounded-[20px]",children:s.jsxs("div",{className:"flex",children:[H??q?s.jsx("div",{className:"mr-2 flex-shrink-0",children:s.jsx("img",{src:(H==null?void 0:H.url)??(q==null?void 0:q.url),alt:"Screenshot",className:"flex max-h-56 max-w-56"})}):void 0,s.jsx("div",{className:"flex-grow",children:s.jsx("p",{children:$.prompt})})]})})]})]}),s.jsxs("div",{className:"flex justify-end",children:[!e&&s.jsx(Tf,{}),s.jsxs(je,{children:[s.jsx(ke,{asChild:!0,children:s.jsx(J,{variant:"ghost",className:"-mr-4 justify-end hover:bg-transparent",onClick:()=>{const[R,S]=vc(b);gc(kr(w.pureHTML(y)??"

Error

",b,D??_e[0]),S,`${w.name}${R}`)},children:s.jsx(Ii,{})})}),s.jsx(Re,{side:"bottom",children:"Download the HTML"})]}),s.jsxs(je,{children:[s.jsx(ke,{asChild:!0,children:s.jsx(J,{variant:"ghost",className:"-mr-4 hover:bg-transparent",onClick:()=>{d(i==="closed"?"versions":"closed")},children:s.jsx(Ri,{})})}),s.jsx(Re,{side:"bottom",children:"Toggle version history"})]})]})]}),s.jsx(sf,{id:o,error:$.error})]}),s.jsx(cf,{isEditing:r,imageUploadRef:c})]})})}globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};function Pf({title:e}){return n.useEffect(()=>{document.title=e},[e]),null}globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};function If({id:e,label:t,isActive:o=!1,isCollapsed:r=!1}){const a=ne(Me({id:e})),c=Gt(),l=Ve(bo),i=Ve(Ke);return s.jsxs(s.Fragment,{children:[!!t&&s.jsx("div",{className:"mb-2 w-full text-xs",children:s.jsx("h3",{children:t})}),s.jsxs("div",{className:`${o&&"bg-secondary"} group relative mb-2 w-full rounded-md p-2 text-sm hover:bg-secondary`,children:[s.jsx(bc,{to:`/ai/${e}`,onClick:()=>i("closed"),className:"flex items-center active:text-black",children:s.jsxs("div",{className:"relative grow overflow-hidden whitespace-nowrap",children:[`${a.emoji??"🤔"} `,s.jsxs("span",{children:["  ",a.name??a.prompt]}),s.jsx("div",{className:T("absolute bottom-0 right-0 top-0 w-8 bg-gradient-to-l from-background from-0% to-transparent group-hover:right-5 group-hover:from-secondary dark:from-zinc-900",{"from-secondary":o,"dark:from-secondary":o})})]})}),s.jsx("div",{className:"absolute bottom-0 right-0 top-0 flex items-center bg-secondary pr-2 opacity-0 group-hover:opacity-100",children:s.jsxs(Da,{modal:!1,children:[s.jsx(Oa,{asChild:!0,children:s.jsx(J,{className:"h-5 w-5 text-sm hover:ring-transparent focus-visible:ring-0",variant:"ghost",size:"icon",children:s.jsx(_i,{className:"inline-block h-4 w-4"})})}),s.jsxs(Ln,{children:[s.jsx(lo,{children:"Copy"}),s.jsx(lo,{onClick:()=>{l(d=>d.filter(u=>u!==e)),Me.remove({id:e}),localStorage.removeItem(`${e}.html`),localStorage.removeItem(`${e}.md`),c("/ai/new")},children:"Delete"})]})]})}),s.jsx(J,{onClick:()=>{i("closed"),c(`/ai/${e}`)},className:T("absolute -right-[65px] top-0 z-50 ml-auto inline-flex h-8 w-8 p-2 hover:scale-110 hover:bg-inherit",r&&"ml-10",o&&"bg-zinc-900"),variant:"ghost",size:"icon",children:a.emoji??"🤔"})]})]})}globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};function Af(){const e=Ye(),t=xc(`(min-width: ${$c}px)`),o=ne(Ke)!=="closed",[r,a]=n.useState(!o),[c]=ee(bo),l=wc(),i=new Date,d=new Date(i.getTime()-24*60*60*1e3),u=new Date(i.getTime()-7*24*60*60*1e3);let h="Today";return n.useEffect(()=>{},[t,a]),s.jsx("div",{className:"relative flex h-screen max-h-[calc(100vh-4em)] flex-none flex-col overflow-y-auto border-r border-input transition-all duration-500 ease-in-out dark:bg-zinc-900",children:s.jsx("div",{className:"flex h-screen max-h-full flex-col items-start justify-start overflow-x-hidden py-2 pl-2",children:c.map((f,m)=>{let b;const g=l.get(Me({id:f}));return m===0&&g.createdAt&&g.createdAt>=d&&(h=""),g.createdAt&&g.createdAt>=d&&(h===""||h==="Today")?(b=h==="Today"?void 0:"Today",h="Today"):g.createdAt&&g.createdAt>=u&&h==="Today"?(b="Previous 7 days",h=b):h==="Previous 7 days"&&g.createdAt&&g.createdAt<=u?(b="Previous 30 days",h=b):b=void 0,s.jsx(If,{id:f,label:b,isActive:e.id===f,isCollapsed:r},f)})})})}const hs="Avatar",[Lf,R1]=Ne(hs),[Df,ps]=Lf(hs),Of=n.forwardRef((e,t)=>{const{__scopeAvatar:o,...r}=e,[a,c]=n.useState("idle");return n.createElement(Df,{scope:o,imageLoadingStatus:a,onImageLoadingStatusChange:c},n.createElement(z.span,C({},r,{ref:t})))}),Ff="AvatarImage",Hf=n.forwardRef((e,t)=>{const{__scopeAvatar:o,src:r,onLoadingStatusChange:a=()=>{},...c}=e,l=ps(Ff,o),i=Bf(r),d=bt(u=>{a(u),l.onImageLoadingStatusChange(u)});return Be(()=>{i!=="idle"&&d(i)},[i,d]),i==="loaded"?n.createElement(z.img,C({},c,{ref:t,src:r})):null}),Vf="AvatarFallback",zf=n.forwardRef((e,t)=>{const{__scopeAvatar:o,delayMs:r,...a}=e,c=ps(Vf,o),[l,i]=n.useState(r===void 0);return n.useEffect(()=>{if(r!==void 0){const d=window.setTimeout(()=>i(!0),r);return()=>window.clearTimeout(d)}},[r]),l&&c.imageLoadingStatus!=="loaded"?n.createElement(z.span,C({},a,{ref:t})):null});function Bf(e){const[t,o]=n.useState("idle");return Be(()=>{if(!e){o("error");return}let r=!0;const a=new window.Image,c=l=>()=>{r&&o(l)};return o("loading"),a.onload=c("loaded"),a.onerror=c("error"),a.src=e,()=>{r=!1}},[e]),t}const ms=Of,gs=Hf,vs=zf;globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};const bs=n.forwardRef(({className:e,...t},o)=>s.jsx(ms,{ref:o,className:T("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",e),...t}));bs.displayName=ms.displayName;const xs=n.forwardRef(({className:e,...t},o)=>s.jsx(gs,{ref:o,className:T("aspect-square h-full w-full",e),...t}));xs.displayName=gs.displayName;const ws=n.forwardRef(({className:e,...t},o)=>s.jsx(vs,{ref:o,className:T("flex h-full w-full items-center justify-center rounded-full bg-muted",e),...t}));ws.displayName=vs.displayName;globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};function Uf({className:e=""}){return s.jsxs("svg",{className:T("w-16",e),viewBox:"0 0 750 400",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[s.jsx("path",{d:"M334.462 65.6873C338.978 63.08 339.833 56.9138 336.011 53.3666C300.323 20.2489 252.526 0 200 0C89.5431 0 0 89.5431 0 200C0 310.457 89.5431 400 200 400C234.733 400 267.398 391.146 295.862 375.572C300.592 372.984 301.111 366.513 297.252 362.748C285.202 350.996 274.544 337.415 265.714 322.12L188.447 188.291L188.446 188.29C179.288 172.425 184.723 152.139 200.588 142.98L334.462 65.6873Z",fill:"url(#paint0_linear_12_2877)"}),s.jsx("path",{d:"M740 0H560C554.477 0 550 4.47715 550 10V390C550 395.523 554.477 400 560 400H740C745.523 400 750 395.523 750 390V10C750 4.47715 745.523 0 740 0Z",fill:"url(#paint1_linear_12_2877)"}),s.jsx("path",{d:"M534 74.426C534 70.2131 532.891 66.0744 530.785 62.4259L499.701 8.58801C494.96 0.375585 484.459 -2.43819 476.246 2.30325L208.588 156.836C200.376 161.577 197.562 172.078 202.303 180.291L279.57 314.12C326.984 396.244 431.996 424.382 514.12 376.968C517.687 374.908 521.153 372.74 524.515 370.469C530.646 366.329 534 359.258 534 351.86V74.426Z",fill:"url(#paint2_linear_12_2877)"}),s.jsxs("defs",{children:[s.jsxs("linearGradient",{id:"paint0_linear_12_2877",x1:"46",y1:"20",x2:"265",y2:"400",gradientUnits:"userSpaceOnUse",children:[s.jsx("stop",{stopColor:"#FFCF4D"}),s.jsx("stop",{offset:"1",stopColor:"#FCBA48"})]}),s.jsxs("linearGradient",{id:"paint1_linear_12_2877",x1:"525",y1:"8.40053e-07",x2:"750.5",y2:"400",gradientUnits:"userSpaceOnUse",children:[s.jsx("stop",{stopColor:"#E180FF"}),s.jsx("stop",{offset:"1",stopColor:"#C264F2"})]}),s.jsxs("linearGradient",{id:"paint2_linear_12_2877",x1:"331.5",y1:"-7.71612e-06",x2:"555",y2:"400",gradientUnits:"userSpaceOnUse",children:[s.jsx("stop",{stopColor:"#11C1D5"}),s.jsx("stop",{offset:"1",stopColor:"#13A9BA"})]})]})]})}globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};async function Kf(){try{return(await(await fetch("/v1/models")).json()).models}catch(e){return console.error(e),{openai:[],groq:[],ollama:[],litellm:[]}}}function uo(e,[t,o]){return Math.min(o,Math.max(t,e))}const Wf=[" ","Enter","ArrowUp","ArrowDown"],Gf=[" ","Enter"],Lo="Select",[Do,Oo,Zf]=Eo(Lo),[St,M1]=Ne(Lo,[Zf,qe]),Hn=qe(),[qf,ct]=St(Lo),[Yf,Xf]=St(Lo),Qf=e=>{const{__scopeSelect:t,children:o,open:r,defaultOpen:a,onOpenChange:c,value:l,defaultValue:i,onValueChange:d,dir:u,name:h,autoComplete:f,disabled:m,required:b}=e,g=Hn(t),[p,x]=n.useState(null),[w,v]=n.useState(null),[$,E]=n.useState(!1),k=So(u),[D=!1,y]=ze({prop:r,defaultProp:a,onChange:c}),[I,O]=ze({prop:l,defaultProp:i,onChange:d}),H=n.useRef(null),re=p?!!p.closest("form"):!0,[q,ae]=n.useState(new Set),R=Array.from(q).map(S=>S.props.value).join(";");return n.createElement(ho,g,n.createElement(qf,{required:b,scope:t,trigger:p,onTriggerChange:x,valueNode:w,onValueNodeChange:v,valueNodeHasChildren:$,onValueNodeHasChildrenChange:E,contentId:He(),value:I,onValueChange:O,open:D,onOpenChange:y,dir:k,triggerPointerDownPosRef:H,disabled:m},n.createElement(Do.Provider,{scope:t},n.createElement(Yf,{scope:e.__scopeSelect,onNativeOptionAdd:n.useCallback(S=>{ae(X=>new Set(X).add(S))},[]),onNativeOptionRemove:n.useCallback(S=>{ae(X=>{const Y=new Set(X);return Y.delete(S),Y})},[])},o)),re?n.createElement(Ss,{key:R,"aria-hidden":!0,required:b,tabIndex:-1,name:h,autoComplete:f,value:I,onChange:S=>O(S.target.value),disabled:m},I===void 0?n.createElement("option",{value:""}):null,Array.from(q)):null))},Jf="SelectTrigger",e0=n.forwardRef((e,t)=>{const{__scopeSelect:o,disabled:r=!1,...a}=e,c=Hn(o),l=ct(Jf,o),i=l.disabled||r,d=Z(t,l.onTriggerChange),u=Oo(o),[h,f,m]=js(g=>{const p=u().filter(v=>!v.disabled),x=p.find(v=>v.value===l.value),w=ks(p,g,x);w!==void 0&&l.onValueChange(w.value)}),b=()=>{i||(l.onOpenChange(!0),m())};return n.createElement(po,C({asChild:!0},c),n.createElement(z.button,C({type:"button",role:"combobox","aria-controls":l.contentId,"aria-expanded":l.open,"aria-required":l.required,"aria-autocomplete":"none",dir:l.dir,"data-state":l.open?"open":"closed",disabled:i,"data-disabled":i?"":void 0,"data-placeholder":Es(l.value)?"":void 0},a,{ref:d,onClick:j(a.onClick,g=>{g.currentTarget.focus()}),onPointerDown:j(a.onPointerDown,g=>{const p=g.target;p.hasPointerCapture(g.pointerId)&&p.releasePointerCapture(g.pointerId),g.button===0&&g.ctrlKey===!1&&(b(),l.triggerPointerDownPosRef.current={x:Math.round(g.pageX),y:Math.round(g.pageY)},g.preventDefault())}),onKeyDown:j(a.onKeyDown,g=>{const p=h.current!=="";!(g.ctrlKey||g.altKey||g.metaKey)&&g.key.length===1&&f(g.key),!(p&&g.key===" ")&&Wf.includes(g.key)&&(b(),g.preventDefault())})})))}),t0="SelectValue",o0=n.forwardRef((e,t)=>{const{__scopeSelect:o,className:r,style:a,children:c,placeholder:l="",...i}=e,d=ct(t0,o),{onValueNodeHasChildrenChange:u}=d,h=c!==void 0,f=Z(t,d.onValueNodeChange);return Be(()=>{u(h)},[u,h]),n.createElement(z.span,C({},i,{ref:f,style:{pointerEvents:"none"}}),Es(d.value)?n.createElement(n.Fragment,null,l):c)}),n0=n.forwardRef((e,t)=>{const{__scopeSelect:o,children:r,...a}=e;return n.createElement(z.span,C({"aria-hidden":!0},a,{ref:t}),r||"▼")}),r0=e=>n.createElement(xo,C({asChild:!0},e)),wt="SelectContent",a0=n.forwardRef((e,t)=>{const o=ct(wt,e.__scopeSelect),[r,a]=n.useState();if(Be(()=>{a(new DocumentFragment)},[]),!o.open){const c=r;return c?Fr.createPortal(n.createElement($s,{scope:e.__scopeSelect},n.createElement(Do.Slot,{scope:e.__scopeSelect},n.createElement("div",null,e.children))),c):null}return n.createElement(s0,C({},e,{ref:t}))}),Ue=10,[$s,it]=St(wt),s0=n.forwardRef((e,t)=>{const{__scopeSelect:o,position:r="item-aligned",onCloseAutoFocus:a,onEscapeKeyDown:c,onPointerDownOutside:l,side:i,sideOffset:d,align:u,alignOffset:h,arrowPadding:f,collisionBoundary:m,collisionPadding:b,sticky:g,hideWhenDetached:p,avoidCollisions:x,...w}=e,v=ct(wt,o),[$,E]=n.useState(null),[k,D]=n.useState(null),y=Z(t,P=>E(P)),[I,O]=n.useState(null),[H,re]=n.useState(null),q=Oo(o),[ae,R]=n.useState(!1),S=n.useRef(!1);n.useEffect(()=>{if($)return Ro($)},[$]),jo();const X=n.useCallback(P=>{const[U,...te]=q().map(G=>G.ref.current),[Q]=te.slice(-1),W=document.activeElement;for(const G of P)if(G===W||(G==null||G.scrollIntoView({block:"nearest"}),G===U&&k&&(k.scrollTop=0),G===Q&&k&&(k.scrollTop=k.scrollHeight),G==null||G.focus(),document.activeElement!==W))return},[q,k]),Y=n.useCallback(()=>X([I,$]),[X,I,$]);n.useEffect(()=>{ae&&Y()},[ae,Y]);const{onOpenChange:K,triggerPointerDownPosRef:M}=v;n.useEffect(()=>{if($){let P={x:0,y:0};const U=Q=>{var W,G,ve,me;P={x:Math.abs(Math.round(Q.pageX)-((W=(G=M.current)===null||G===void 0?void 0:G.x)!==null&&W!==void 0?W:0)),y:Math.abs(Math.round(Q.pageY)-((ve=(me=M.current)===null||me===void 0?void 0:me.y)!==null&&ve!==void 0?ve:0))}},te=Q=>{P.x<=10&&P.y<=10?Q.preventDefault():$.contains(Q.target)||K(!1),document.removeEventListener("pointermove",U),M.current=null};return M.current!==null&&(document.addEventListener("pointermove",U),document.addEventListener("pointerup",te,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",U),document.removeEventListener("pointerup",te,{capture:!0})}}},[$,K,M]),n.useEffect(()=>{const P=()=>K(!1);return window.addEventListener("blur",P),window.addEventListener("resize",P),()=>{window.removeEventListener("blur",P),window.removeEventListener("resize",P)}},[K]);const[V,B]=js(P=>{const U=q().filter(W=>!W.disabled),te=U.find(W=>W.ref.current===document.activeElement),Q=ks(U,P,te);Q&&setTimeout(()=>Q.ref.current.focus())}),fe=n.useCallback((P,U,te)=>{const Q=!S.current&&!te;(v.value!==void 0&&v.value===U||Q)&&(O(P),Q&&(S.current=!0))},[v.value]),be=n.useCallback(()=>$==null?void 0:$.focus(),[$]),ge=n.useCallback((P,U,te)=>{const Q=!S.current&&!te;(v.value!==void 0&&v.value===U||Q)&&re(P)},[v.value]),we=r==="popper"?pr:c0,pe=we===pr?{side:i,sideOffset:d,align:u,alignOffset:h,arrowPadding:f,collisionBoundary:m,collisionPadding:b,sticky:g,hideWhenDetached:p,avoidCollisions:x}:{};return n.createElement($s,{scope:o,content:$,viewport:k,onViewportChange:D,itemRefCallback:fe,selectedItem:I,onItemLeave:be,itemTextRefCallback:ge,focusSelectedItem:Y,selectedItemText:H,position:r,isPositioned:ae,searchRef:V},n.createElement(Zt,{as:rt,allowPinchZoom:!0},n.createElement(ko,{asChild:!0,trapped:v.open,onMountAutoFocus:P=>{P.preventDefault()},onUnmountAutoFocus:j(a,P=>{var U;(U=v.trigger)===null||U===void 0||U.focus({preventScroll:!0}),P.preventDefault()})},n.createElement(Wt,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:c,onPointerDownOutside:l,onFocusOutside:P=>P.preventDefault(),onDismiss:()=>v.onOpenChange(!1)},n.createElement(we,C({role:"listbox",id:v.contentId,"data-state":v.open?"open":"closed",dir:v.dir,onContextMenu:P=>P.preventDefault()},w,pe,{onPlaced:()=>R(!0),ref:y,style:{display:"flex",flexDirection:"column",outline:"none",...w.style},onKeyDown:j(w.onKeyDown,P=>{const U=P.ctrlKey||P.altKey||P.metaKey;if(P.key==="Tab"&&P.preventDefault(),!U&&P.key.length===1&&B(P.key),["ArrowUp","ArrowDown","Home","End"].includes(P.key)){let Q=q().filter(W=>!W.disabled).map(W=>W.ref.current);if(["ArrowUp","End"].includes(P.key)&&(Q=Q.slice().reverse()),["ArrowUp","ArrowDown"].includes(P.key)){const W=P.target,G=Q.indexOf(W);Q=Q.slice(G+1)}setTimeout(()=>X(Q)),P.preventDefault()}})}))))))}),c0=n.forwardRef((e,t)=>{const{__scopeSelect:o,onPlaced:r,...a}=e,c=ct(wt,o),l=it(wt,o),[i,d]=n.useState(null),[u,h]=n.useState(null),f=Z(t,y=>h(y)),m=Oo(o),b=n.useRef(!1),g=n.useRef(!0),{viewport:p,selectedItem:x,selectedItemText:w,focusSelectedItem:v}=l,$=n.useCallback(()=>{if(c.trigger&&c.valueNode&&i&&u&&p&&x&&w){const y=c.trigger.getBoundingClientRect(),I=u.getBoundingClientRect(),O=c.valueNode.getBoundingClientRect(),H=w.getBoundingClientRect();if(c.dir!=="rtl"){const W=H.left-I.left,G=O.left-W,ve=y.left-G,me=y.width+ve,Ee=Math.max(me,I.width),_=window.innerWidth-Ue,L=uo(G,[Ue,_-Ee]);i.style.minWidth=me+"px",i.style.left=L+"px"}else{const W=I.right-H.right,G=window.innerWidth-O.right-W,ve=window.innerWidth-y.right-G,me=y.width+ve,Ee=Math.max(me,I.width),_=window.innerWidth-Ue,L=uo(G,[Ue,_-Ee]);i.style.minWidth=me+"px",i.style.right=L+"px"}const re=m(),q=window.innerHeight-Ue*2,ae=p.scrollHeight,R=window.getComputedStyle(u),S=parseInt(R.borderTopWidth,10),X=parseInt(R.paddingTop,10),Y=parseInt(R.borderBottomWidth,10),K=parseInt(R.paddingBottom,10),M=S+X+ae+K+Y,V=Math.min(x.offsetHeight*5,M),B=window.getComputedStyle(p),fe=parseInt(B.paddingTop,10),be=parseInt(B.paddingBottom,10),ge=y.top+y.height/2-Ue,we=q-ge,pe=x.offsetHeight/2,P=x.offsetTop+pe,U=S+X+P,te=M-U;if(U<=ge){const W=x===re[re.length-1].ref.current;i.style.bottom="0px";const G=u.clientHeight-p.offsetTop-p.offsetHeight,ve=Math.max(we,pe+(W?be:0)+G+Y),me=U+ve;i.style.height=me+"px"}else{const W=x===re[0].ref.current;i.style.top="0px";const ve=Math.max(ge,S+p.offsetTop+(W?fe:0)+pe)+te;i.style.height=ve+"px",p.scrollTop=U-ge+p.offsetTop}i.style.margin=`${Ue}px 0`,i.style.minHeight=V+"px",i.style.maxHeight=q+"px",r==null||r(),requestAnimationFrame(()=>b.current=!0)}},[m,c.trigger,c.valueNode,i,u,p,x,w,c.dir,r]);Be(()=>$(),[$]);const[E,k]=n.useState();Be(()=>{u&&k(window.getComputedStyle(u).zIndex)},[u]);const D=n.useCallback(y=>{y&&g.current===!0&&($(),v==null||v(),g.current=!1)},[$,v]);return n.createElement(i0,{scope:o,contentWrapper:i,shouldExpandOnScrollRef:b,onScrollButtonChange:D},n.createElement("div",{ref:d,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:E}},n.createElement(z.div,C({},a,{ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...a.style}}))))}),pr=n.forwardRef((e,t)=>{const{__scopeSelect:o,align:r="start",collisionPadding:a=Ue,...c}=e,l=Hn(o);return n.createElement(mo,C({},l,c,{ref:t,align:r,collisionPadding:a,style:{boxSizing:"border-box",...c.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)"}}))}),[i0,Vn]=St(wt,{}),mr="SelectViewport",l0=n.forwardRef((e,t)=>{const{__scopeSelect:o,...r}=e,a=it(mr,o),c=Vn(mr,o),l=Z(t,a.onViewportChange),i=n.useRef(0);return n.createElement(n.Fragment,null,n.createElement("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}"}}),n.createElement(Do.Slot,{scope:o},n.createElement(z.div,C({"data-radix-select-viewport":"",role:"presentation"},r,{ref:l,style:{position:"relative",flex:1,overflow:"auto",...r.style},onScroll:j(r.onScroll,d=>{const u=d.currentTarget,{contentWrapper:h,shouldExpandOnScrollRef:f}=c;if(f!=null&&f.current&&h){const m=Math.abs(i.current-u.scrollTop);if(m>0){const b=window.innerHeight-Ue*2,g=parseFloat(h.style.minHeight),p=parseFloat(h.style.height),x=Math.max(g,p);if(x0?$:0,h.style.justifyContent="flex-end")}}}i.current=u.scrollTop})}))))}),d0="SelectGroup",[u0,f0]=St(d0),h0=n.forwardRef((e,t)=>{const{__scopeSelect:o,...r}=e,a=He();return n.createElement(u0,{scope:o,id:a},n.createElement(z.div,C({role:"group","aria-labelledby":a},r,{ref:t})))}),p0="SelectLabel",m0=n.forwardRef((e,t)=>{const{__scopeSelect:o,...r}=e,a=f0(p0,o);return n.createElement(z.div,C({id:a.id},r,{ref:t}))}),vn="SelectItem",[g0,Cs]=St(vn),v0=n.forwardRef((e,t)=>{const{__scopeSelect:o,value:r,disabled:a=!1,textValue:c,...l}=e,i=ct(vn,o),d=it(vn,o),u=i.value===r,[h,f]=n.useState(c??""),[m,b]=n.useState(!1),g=Z(t,w=>{var v;return(v=d.itemRefCallback)===null||v===void 0?void 0:v.call(d,w,r,a)}),p=He(),x=()=>{a||(i.onValueChange(r),i.onOpenChange(!1))};if(r==="")throw new Error("A 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 n.createElement(g0,{scope:o,value:r,disabled:a,textId:p,isSelected:u,onItemTextChange:n.useCallback(w=>{f(v=>{var $;return v||(($=w==null?void 0:w.textContent)!==null&&$!==void 0?$:"").trim()})},[])},n.createElement(Do.ItemSlot,{scope:o,value:r,disabled:a,textValue:h},n.createElement(z.div,C({role:"option","aria-labelledby":p,"data-highlighted":m?"":void 0,"aria-selected":u&&m,"data-state":u?"checked":"unchecked","aria-disabled":a||void 0,"data-disabled":a?"":void 0,tabIndex:a?void 0:-1},l,{ref:g,onFocus:j(l.onFocus,()=>b(!0)),onBlur:j(l.onBlur,()=>b(!1)),onPointerUp:j(l.onPointerUp,x),onPointerMove:j(l.onPointerMove,w=>{if(a){var v;(v=d.onItemLeave)===null||v===void 0||v.call(d)}else w.currentTarget.focus({preventScroll:!0})}),onPointerLeave:j(l.onPointerLeave,w=>{if(w.currentTarget===document.activeElement){var v;(v=d.onItemLeave)===null||v===void 0||v.call(d)}}),onKeyDown:j(l.onKeyDown,w=>{var v;((v=d.searchRef)===null||v===void 0?void 0:v.current)!==""&&w.key===" "||(Gf.includes(w.key)&&x(),w.key===" "&&w.preventDefault())})}))))}),oo="SelectItemText",b0=n.forwardRef((e,t)=>{const{__scopeSelect:o,className:r,style:a,...c}=e,l=ct(oo,o),i=it(oo,o),d=Cs(oo,o),u=Xf(oo,o),[h,f]=n.useState(null),m=Z(t,w=>f(w),d.onItemTextChange,w=>{var v;return(v=i.itemTextRefCallback)===null||v===void 0?void 0:v.call(i,w,d.value,d.disabled)}),b=h==null?void 0:h.textContent,g=n.useMemo(()=>n.createElement("option",{key:d.value,value:d.value,disabled:d.disabled},b),[d.disabled,d.value,b]),{onNativeOptionAdd:p,onNativeOptionRemove:x}=u;return Be(()=>(p(g),()=>x(g)),[p,x,g]),n.createElement(n.Fragment,null,n.createElement(z.span,C({id:d.textId},c,{ref:m})),d.isSelected&&l.valueNode&&!l.valueNodeHasChildren?Fr.createPortal(c.children,l.valueNode):null)}),x0="SelectItemIndicator",w0=n.forwardRef((e,t)=>{const{__scopeSelect:o,...r}=e;return Cs(x0,o).isSelected?n.createElement(z.span,C({"aria-hidden":!0},r,{ref:t})):null}),gr="SelectScrollUpButton",$0=n.forwardRef((e,t)=>{const o=it(gr,e.__scopeSelect),r=Vn(gr,e.__scopeSelect),[a,c]=n.useState(!1),l=Z(t,r.onScrollButtonChange);return Be(()=>{if(o.viewport&&o.isPositioned){let d=function(){const u=i.scrollTop>0;c(u)};const i=o.viewport;return d(),i.addEventListener("scroll",d),()=>i.removeEventListener("scroll",d)}},[o.viewport,o.isPositioned]),a?n.createElement(ys,C({},e,{ref:l,onAutoScroll:()=>{const{viewport:i,selectedItem:d}=o;i&&d&&(i.scrollTop=i.scrollTop-d.offsetHeight)}})):null}),vr="SelectScrollDownButton",C0=n.forwardRef((e,t)=>{const o=it(vr,e.__scopeSelect),r=Vn(vr,e.__scopeSelect),[a,c]=n.useState(!1),l=Z(t,r.onScrollButtonChange);return Be(()=>{if(o.viewport&&o.isPositioned){let d=function(){const u=i.scrollHeight-i.clientHeight,h=Math.ceil(i.scrollTop)i.removeEventListener("scroll",d)}},[o.viewport,o.isPositioned]),a?n.createElement(ys,C({},e,{ref:l,onAutoScroll:()=>{const{viewport:i,selectedItem:d}=o;i&&d&&(i.scrollTop=i.scrollTop+d.offsetHeight)}})):null}),ys=n.forwardRef((e,t)=>{const{__scopeSelect:o,onAutoScroll:r,...a}=e,c=it("SelectScrollButton",o),l=n.useRef(null),i=Oo(o),d=n.useCallback(()=>{l.current!==null&&(window.clearInterval(l.current),l.current=null)},[]);return n.useEffect(()=>()=>d(),[d]),Be(()=>{var u;const h=i().find(f=>f.ref.current===document.activeElement);h==null||(u=h.ref.current)===null||u===void 0||u.scrollIntoView({block:"nearest"})},[i]),n.createElement(z.div,C({"aria-hidden":!0},a,{ref:t,style:{flexShrink:0,...a.style},onPointerDown:j(a.onPointerDown,()=>{l.current===null&&(l.current=window.setInterval(r,50))}),onPointerMove:j(a.onPointerMove,()=>{var u;(u=c.onItemLeave)===null||u===void 0||u.call(c),l.current===null&&(l.current=window.setInterval(r,50))}),onPointerLeave:j(a.onPointerLeave,()=>{d()})}))}),y0=n.forwardRef((e,t)=>{const{__scopeSelect:o,...r}=e;return n.createElement(z.div,C({"aria-hidden":!0},r,{ref:t}))});function Es(e){return e===""||e===void 0}const Ss=n.forwardRef((e,t)=>{const{value:o,...r}=e,a=n.useRef(null),c=Z(t,a),l=To(o);return n.useEffect(()=>{const i=a.current,d=window.HTMLSelectElement.prototype,h=Object.getOwnPropertyDescriptor(d,"value").set;if(l!==o&&h){const f=new Event("change",{bubbles:!0});h.call(i,o),i.dispatchEvent(f)}},[l,o]),n.createElement(Cc,{asChild:!0},n.createElement("select",C({},r,{ref:c,defaultValue:o})))});Ss.displayName="BubbleSelect";function js(e){const t=bt(e),o=n.useRef(""),r=n.useRef(0),a=n.useCallback(l=>{const i=o.current+l;t(i),function d(u){o.current=u,window.clearTimeout(r.current),u!==""&&(r.current=window.setTimeout(()=>d(""),1e3))}(i)},[t]),c=n.useCallback(()=>{o.current="",window.clearTimeout(r.current)},[]);return n.useEffect(()=>()=>window.clearTimeout(r.current),[]),[o,a,c]}function ks(e,t,o){const a=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,c=o?e.indexOf(o):-1;let l=E0(e,Math.max(c,0));a.length===1&&(l=l.filter(u=>u!==o));const d=l.find(u=>u.textValue.toLowerCase().startsWith(a.toLowerCase()));return d!==o?d:void 0}function E0(e,t){return e.map((o,r)=>e[(t+r)%e.length])}const S0=Qf,Rs=e0,j0=o0,k0=n0,R0=r0,Ms=a0,M0=l0,N0=h0,Ns=m0,Ts=v0,T0=b0,_0=w0,_s=$0,Ps=C0,Is=y0;globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};const br=S0,Rt=N0,xr=j0,bn=n.forwardRef(({className:e,children:t,...o},r)=>s.jsxs(Rs,{ref:r,className:T("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...o,children:[t,s.jsx(k0,{asChild:!0,children:s.jsx(ra,{className:"h-4 w-4 opacity-50"})})]}));bn.displayName=Rs.displayName;const As=n.forwardRef(({className:e,...t},o)=>s.jsx(_s,{ref:o,className:T("flex cursor-default items-center justify-center py-1",e),...t,children:s.jsx(wl,{className:"h-4 w-4"})}));As.displayName=_s.displayName;const Ls=n.forwardRef(({className:e,...t},o)=>s.jsx(Ps,{ref:o,className:T("flex cursor-default items-center justify-center py-1",e),...t,children:s.jsx(ra,{className:"h-4 w-4"})}));Ls.displayName=Ps.displayName;const _t=n.forwardRef(({className:e,children:t,position:o="popper",...r},a)=>s.jsx(R0,{children:s.jsxs(Ms,{ref:a,className:T("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 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",o==="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:o,...r,children:[s.jsx(As,{}),s.jsx(M0,{className:T("p-1",o==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),s.jsx(Ls,{})]})}));_t.displayName=Ms.displayName;const ft=n.forwardRef(({className:e,...t},o)=>s.jsx(Ns,{ref:o,className:T("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));ft.displayName=Ns.displayName;const De=n.forwardRef(({className:e,children:t,...o},r)=>s.jsxs(Ts,{ref:r,className:T("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...o,children:[s.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:s.jsx(_0,{children:s.jsx(yo,{className:"h-4 w-4"})})}),s.jsx(T0,{children:t})]}));De.displayName=Ts.displayName;const P0=n.forwardRef(({className:e,...t},o)=>s.jsx(Is,{ref:o,className:T("-mx-1 my-1 h-px bg-muted",e),...t}));P0.displayName=Is.displayName;const Ds=["PageUp","PageDown"],Os=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],Fs={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},Yt="Slider",[xn,I0,A0]=Eo(Yt),[Hs,N1]=Ne(Yt,[A0]),[L0,Fo]=Hs(Yt),D0=n.forwardRef((e,t)=>{const{name:o,min:r=0,max:a=100,step:c=1,orientation:l="horizontal",disabled:i=!1,minStepsBetweenThumbs:d=0,defaultValue:u=[r],value:h,onValueChange:f=()=>{},onValueCommit:m=()=>{},inverted:b=!1,...g}=e,[p,x]=n.useState(null),w=Z(t,R=>x(R)),v=n.useRef(new Set),$=n.useRef(0),E=l==="horizontal",k=p?!!p.closest("form"):!0,D=E?O0:F0,[y=[],I]=ze({prop:h,defaultProp:u,onChange:R=>{var S;(S=[...v.current][$.current])===null||S===void 0||S.focus(),f(R)}}),O=n.useRef(y);function H(R){const S=Z0(y,R);ae(R,S)}function re(R){ae(R,$.current)}function q(){const R=O.current[$.current];y[$.current]!==R&&m(y)}function ae(R,S,{commit:X}={commit:!1}){const Y=Q0(c),K=J0(Math.round((R-r)/c)*c+r,Y),M=uo(K,[r,a]);I((V=[])=>{const B=W0(V,M,S);if(X0(B,d*c)){$.current=B.indexOf(M);const fe=String(B)!==String(V);return fe&&X&&m(B),fe?B:V}else return V})}return n.createElement(L0,{scope:e.__scopeSlider,disabled:i,min:r,max:a,valueIndexToChangeRef:$,thumbs:v.current,values:y,orientation:l},n.createElement(xn.Provider,{scope:e.__scopeSlider},n.createElement(xn.Slot,{scope:e.__scopeSlider},n.createElement(D,C({"aria-disabled":i,"data-disabled":i?"":void 0},g,{ref:w,onPointerDown:j(g.onPointerDown,()=>{i||(O.current=y)}),min:r,max:a,inverted:b,onSlideStart:i?void 0:H,onSlideMove:i?void 0:re,onSlideEnd:i?void 0:q,onHomeKeyDown:()=>!i&&ae(r,0,{commit:!0}),onEndKeyDown:()=>!i&&ae(a,y.length-1,{commit:!0}),onStepKeyDown:({event:R,direction:S})=>{if(!i){const K=Ds.includes(R.key)||R.shiftKey&&Os.includes(R.key)?10:1,M=$.current,V=y[M],B=c*K*S;ae(V+B,M,{commit:!0})}}})))),k&&y.map((R,S)=>n.createElement(K0,{key:S,name:o?o+(y.length>1?"[]":""):void 0,value:R})))}),[Vs,zs]=Hs(Yt,{startEdge:"left",endEdge:"right",size:"width",direction:1}),O0=n.forwardRef((e,t)=>{const{min:o,max:r,dir:a,inverted:c,onSlideStart:l,onSlideMove:i,onSlideEnd:d,onStepKeyDown:u,...h}=e,[f,m]=n.useState(null),b=Z(t,$=>m($)),g=n.useRef(),p=So(a),x=p==="ltr",w=x&&!c||!x&&c;function v($){const E=g.current||f.getBoundingClientRect(),k=[0,E.width],y=zn(k,w?[o,r]:[r,o]);return g.current=E,y($-E.left)}return n.createElement(Vs,{scope:e.__scopeSlider,startEdge:w?"left":"right",endEdge:w?"right":"left",direction:w?1:-1,size:"width"},n.createElement(Bs,C({dir:p,"data-orientation":"horizontal"},h,{ref:b,style:{...h.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:$=>{const E=v($.clientX);l==null||l(E)},onSlideMove:$=>{const E=v($.clientX);i==null||i(E)},onSlideEnd:()=>{g.current=void 0,d==null||d()},onStepKeyDown:$=>{const k=Fs[w?"from-left":"from-right"].includes($.key);u==null||u({event:$,direction:k?-1:1})}})))}),F0=n.forwardRef((e,t)=>{const{min:o,max:r,inverted:a,onSlideStart:c,onSlideMove:l,onSlideEnd:i,onStepKeyDown:d,...u}=e,h=n.useRef(null),f=Z(t,h),m=n.useRef(),b=!a;function g(p){const x=m.current||h.current.getBoundingClientRect(),w=[0,x.height],$=zn(w,b?[r,o]:[o,r]);return m.current=x,$(p-x.top)}return n.createElement(Vs,{scope:e.__scopeSlider,startEdge:b?"bottom":"top",endEdge:b?"top":"bottom",size:"height",direction:b?1:-1},n.createElement(Bs,C({"data-orientation":"vertical"},u,{ref:f,style:{...u.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:p=>{const x=g(p.clientY);c==null||c(x)},onSlideMove:p=>{const x=g(p.clientY);l==null||l(x)},onSlideEnd:()=>{m.current=void 0,i==null||i()},onStepKeyDown:p=>{const w=Fs[b?"from-bottom":"from-top"].includes(p.key);d==null||d({event:p,direction:w?-1:1})}})))}),Bs=n.forwardRef((e,t)=>{const{__scopeSlider:o,onSlideStart:r,onSlideMove:a,onSlideEnd:c,onHomeKeyDown:l,onEndKeyDown:i,onStepKeyDown:d,...u}=e,h=Fo(Yt,o);return n.createElement(z.span,C({},u,{ref:t,onKeyDown:j(e.onKeyDown,f=>{f.key==="Home"?(l(f),f.preventDefault()):f.key==="End"?(i(f),f.preventDefault()):Ds.concat(Os).includes(f.key)&&(d(f),f.preventDefault())}),onPointerDown:j(e.onPointerDown,f=>{const m=f.target;m.setPointerCapture(f.pointerId),f.preventDefault(),h.thumbs.has(m)?m.focus():r(f)}),onPointerMove:j(e.onPointerMove,f=>{f.target.hasPointerCapture(f.pointerId)&&a(f)}),onPointerUp:j(e.onPointerUp,f=>{const m=f.target;m.hasPointerCapture(f.pointerId)&&(m.releasePointerCapture(f.pointerId),c(f))})}))}),H0="SliderTrack",V0=n.forwardRef((e,t)=>{const{__scopeSlider:o,...r}=e,a=Fo(H0,o);return n.createElement(z.span,C({"data-disabled":a.disabled?"":void 0,"data-orientation":a.orientation},r,{ref:t}))}),wr="SliderRange",z0=n.forwardRef((e,t)=>{const{__scopeSlider:o,...r}=e,a=Fo(wr,o),c=zs(wr,o),l=n.useRef(null),i=Z(t,l),d=a.values.length,u=a.values.map(m=>Us(m,a.min,a.max)),h=d>1?Math.min(...u):0,f=100-Math.max(...u);return n.createElement(z.span,C({"data-orientation":a.orientation,"data-disabled":a.disabled?"":void 0},r,{ref:i,style:{...e.style,[c.startEdge]:h+"%",[c.endEdge]:f+"%"}}))}),$r="SliderThumb",B0=n.forwardRef((e,t)=>{const o=I0(e.__scopeSlider),[r,a]=n.useState(null),c=Z(t,i=>a(i)),l=n.useMemo(()=>r?o().findIndex(i=>i.ref.current===r):-1,[o,r]);return n.createElement(U0,C({},e,{ref:c,index:l}))}),U0=n.forwardRef((e,t)=>{const{__scopeSlider:o,index:r,...a}=e,c=Fo($r,o),l=zs($r,o),[i,d]=n.useState(null),u=Z(t,x=>d(x)),h=$n(i),f=c.values[r],m=f===void 0?0:Us(f,c.min,c.max),b=G0(r,c.values.length),g=h==null?void 0:h[l.size],p=g?q0(g,m,l.direction):0;return n.useEffect(()=>{if(i)return c.thumbs.add(i),()=>{c.thumbs.delete(i)}},[i,c.thumbs]),n.createElement("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[l.startEdge]:`calc(${m}% + ${p}px)`}},n.createElement(xn.ItemSlot,{scope:e.__scopeSlider},n.createElement(z.span,C({role:"slider","aria-label":e["aria-label"]||b,"aria-valuemin":c.min,"aria-valuenow":f,"aria-valuemax":c.max,"aria-orientation":c.orientation,"data-orientation":c.orientation,"data-disabled":c.disabled?"":void 0,tabIndex:c.disabled?void 0:0},a,{ref:u,style:f===void 0?{display:"none"}:e.style,onFocus:j(e.onFocus,()=>{c.valueIndexToChangeRef.current=r})}))))}),K0=e=>{const{value:t,...o}=e,r=n.useRef(null),a=To(t);return n.useEffect(()=>{const c=r.current,l=window.HTMLInputElement.prototype,d=Object.getOwnPropertyDescriptor(l,"value").set;if(a!==t&&d){const u=new Event("input",{bubbles:!0});d.call(c,t),c.dispatchEvent(u)}},[a,t]),n.createElement("input",C({style:{display:"none"}},o,{ref:r,defaultValue:t}))};function W0(e=[],t,o){const r=[...e];return r[o]=t,r.sort((a,c)=>a-c)}function Us(e,t,o){const c=100/(o-t)*(e-t);return uo(c,[0,100])}function G0(e,t){return t>2?`Value ${e+1} of ${t}`:t===2?["Minimum","Maximum"][e]:void 0}function Z0(e,t){if(e.length===1)return 0;const o=e.map(a=>Math.abs(a-t)),r=Math.min(...o);return o.indexOf(r)}function q0(e,t,o){const r=e/2,c=zn([0,50],[0,r]);return(r-c(t)*o)*o}function Y0(e){return e.slice(0,-1).map((t,o)=>e[o+1]-t)}function X0(e,t){if(t>0){const o=Y0(e);return Math.min(...o)>=t}return!0}function zn(e,t){return o=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(o-e[0])}}function Q0(e){return(String(e).split(".")[1]||"").length}function J0(e,t){const o=Math.pow(10,t);return Math.round(e*o)/o}const Ks=D0,e1=V0,t1=z0,o1=B0;globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};const Ws=n.forwardRef(({className:e,...t},o)=>s.jsxs(Ks,{ref:o,className:T("relative flex w-full touch-none select-none items-center",e),...t,children:[s.jsx(e1,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:s.jsx(t1,{className:"absolute h-full bg-primary"})}),s.jsx(o1,{className:"block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"})]}));Ws.displayName=Ks.displayName;const Gs="Switch",[n1,T1]=Ne(Gs),[r1,a1]=n1(Gs),s1=n.forwardRef((e,t)=>{const{__scopeSwitch:o,name:r,checked:a,defaultChecked:c,required:l,disabled:i,value:d="on",onCheckedChange:u,...h}=e,[f,m]=n.useState(null),b=Z(t,v=>m(v)),g=n.useRef(!1),p=f?!!f.closest("form"):!0,[x=!1,w]=ze({prop:a,defaultProp:c,onChange:u});return n.createElement(r1,{scope:o,checked:x,disabled:i},n.createElement(z.button,C({type:"button",role:"switch","aria-checked":x,"aria-required":l,"data-state":Zs(x),"data-disabled":i?"":void 0,disabled:i,value:d},h,{ref:b,onClick:j(e.onClick,v=>{w($=>!$),p&&(g.current=v.isPropagationStopped(),g.current||v.stopPropagation())})})),p&&n.createElement(l1,{control:f,bubbles:!g.current,name:r,value:d,checked:x,required:l,disabled:i,style:{transform:"translateX(-100%)"}}))}),c1="SwitchThumb",i1=n.forwardRef((e,t)=>{const{__scopeSwitch:o,...r}=e,a=a1(c1,o);return n.createElement(z.span,C({"data-state":Zs(a.checked),"data-disabled":a.disabled?"":void 0},r,{ref:t}))}),l1=e=>{const{control:t,checked:o,bubbles:r=!0,...a}=e,c=n.useRef(null),l=To(o),i=$n(t);return n.useEffect(()=>{const d=c.current,u=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(u,"checked").set;if(l!==o&&f){const m=new Event("click",{bubbles:r});f.call(d,o),d.dispatchEvent(m)}},[l,o,r]),n.createElement("input",C({type:"checkbox","aria-hidden":!0,defaultChecked:o},a,{tabIndex:-1,ref:c,style:{...e.style,...i,position:"absolute",pointerEvents:"none",opacity:0,margin:0}}))};function Zs(e){return e?"checked":"unchecked"}const qs=s1,d1=i1;globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};const Ys=n.forwardRef(({className:e,...t},o)=>s.jsx(qs,{className:T("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent 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:o,children:s.jsx(d1,{className:T("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));Ys.displayName=qs.displayName;globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};function Mt(e,t=!0){if(e){const o=e.split("/").slice(1,-1).join("");let r;return oa.some(a=>a.test(o))&&(r=s.jsx(co,{className:T("mx-1 mt-1 h-3 w-3",t&&"float-left ml-0")})),s.jsxs(s.Fragment,{children:[r,e.replace(":latest","").replace("gpt","GPT").replaceAll(/[:-]/g," ").replaceAll(/\b\w/g,a=>a.toUpperCase())]})}}function u1({trigger:e}){const{isPending:t,isError:o,error:r,data:a}=Bc({queryKey:["models"],queryFn:Kf}),[c]=Ir(),[l,i]=ee(Dr),[d,u]=ee(yc),[h,f]=ee(Or),[m,b]=ee(En),[g,p]=ee(vo),[x,w]=ee(Ec);return n.useEffect(()=>{r&&console.error("Error fetching models",r)},[r]),n.useEffect(()=>{c.get("dummy")?i(`dummy/${["bad"].includes(c.get("dummy")??"")?c.get("dummy"):"good"}`):a&&a.openai.length===0&&l.startsWith("gpt")&&(a.groq.length>0?i(`groq/${a.groq[2].id}`):a.ollama.length>0?i(`ollama/${a.ollama[0].name}`):a.litellm.length>0&&i(`litellm/${a.litellm[0].id}`));const v=x[l];p(v===void 0?oa.some($=>{let E=l;return E.includes("/")&&(E=l.split("/").slice(1).join("/")),$.test(E)}):v)},[a,i,l,c,p,x]),s.jsxs(Fn,{children:[s.jsxs(kn,{children:[s.jsx(us,{asChild:!0,children:s.jsx(Rn,{children:e})}),s.jsxs(Co,{className:"border text-sm",children:[s.jsx("h2",{className:"font-bold",children:"Settings"}),s.jsxs("p",{className:"flex",children:[s.jsx("span",{className:"font-semibold",children:"Model:"})," ",Mt(l.split("/").at(-1),!1)]}),s.jsxs("p",{children:[s.jsx("span",{className:"font-semibold",children:"Temperature:"})," ",h]})]})]}),s.jsxs(Po,{className:"max-w-3xl",children:[s.jsxs(Io,{children:[s.jsx(Ao,{children:"Settings"}),s.jsx(xt,{children:"Choose a different model, adjust settings, or logout"})]}),s.jsxs("div",{className:"grid gap-4 py-4",children:[s.jsxs("div",{className:"grid grid-cols-8 items-center gap-4",children:[s.jsx(Qe,{className:"col-span-2 text-right",htmlFor:"model",children:"Model"}),s.jsxs(br,{value:l,name:"model",onValueChange:v=>{i(v)},children:[s.jsx(bn,{className:"min-w-[200px]",children:s.jsx(xr,{placeholder:"Switch models"})}),t?s.jsx(_t,{children:"Loading..."}):void 0,o?s.jsx(_t,{children:"Error, see console..."}):void 0,a?s.jsxs(_t,{children:[c.get("dummy")?s.jsxs(Rt,{children:[s.jsx(ft,{children:"Dummy"}),s.jsx(De,{value:"dummy/good",children:"Good dummy"}),s.jsx(De,{value:"dummy/bad",children:"Bad dummy"})]}):void 0,a.openai.length>0&&s.jsxs(Rt,{children:[s.jsx(ft,{children:"OpenAI"}),a.openai.filter(v=>v!=="gpt-4-turbo"||!0).map(v=>s.jsx(De,{value:v,children:Mt(v)},v))]}),a.groq.length>0&&s.jsxs(Rt,{children:[s.jsx(ft,{children:"Groq"}),a.groq.map(v=>s.jsx(De,{value:`groq/${v.id}`,children:Mt(v.id)},v.id))]}),a.litellm.length>0&&s.jsxs(Rt,{children:[s.jsx(ft,{children:"LiteLLM"}),a.litellm.map(v=>s.jsx(De,{value:`litellm/${v.id}`,children:Mt(v.id)},v.id))]}),a.ollama.length>0&&s.jsxs(Rt,{children:[s.jsx(ft,{children:"Ollama"}),a.ollama.map(v=>s.jsx(De,{value:`ollama/${v.name}`,children:Mt(v.name)},v.digest))]})]}):void 0]})]}),s.jsxs("div",{className:"grid grid-cols-8 items-center gap-4",children:[s.jsx(Qe,{className:"col-span-2 text-right",htmlFor:"vision",children:"Supports Vision"}),s.jsx(Ys,{className:"-zoom-1 col-span-1",name:"vision",checked:g,onClick:()=>{w({...x,[l]:!g})},onCheckedChange:v=>p(v)}),s.jsxs("div",{className:"-ml-15 col-span-5 text-xs",children:["We attempt to detect if the model has vision capabilities. You can override this if you're sure it does.",l==="gpt-3.5-turbo"&&s.jsxs("span",{className:"italic",children:[" ","We'll automatically use gpt-4o for any requests with images."]})]})]}),s.jsxs("div",{className:"grid grid-cols-8 items-center gap-4",children:[s.jsx(Qe,{className:"col-span-2 text-right",htmlFor:"prompt",children:"System Prompt"}),s.jsx(Dn,{className:"col-span-6 whitespace-nowrap",rows:5,id:"prompt",onChange:v=>u(v.target.value),value:d})]}),s.jsxs("div",{className:"grid grid-cols-8 items-center gap-4",children:[s.jsx(Qe,{className:"col-span-2 text-right",htmlFor:"temperature",children:"Temperature"}),s.jsx(Ws,{min:0,max:1,step:.05,onValueChange:v=>f(v[0]),value:[h],className:"col-span-2",id:"temperature"}),s.jsx("div",{className:"col-span-1",children:h.toFixed(2)})]}),s.jsxs("div",{className:"grid grid-cols-8 items-center gap-4",children:[s.jsx(Qe,{className:"col-span-2 text-right",htmlFor:"dark-mode",children:"UI Mode"}),s.jsxs(br,{value:m,name:"dark-mode",onValueChange:v=>{b(v)},children:[s.jsx(bn,{className:"min-w-[200px]",children:s.jsx(xr,{placeholder:"Change mode"})}),s.jsxs(_t,{children:[s.jsx(De,{value:"system",children:"System"}),s.jsx(De,{value:"dark",children:"Dark"}),s.jsx(De,{value:"light",children:"Light"})]})]})]}),s.jsx("div",{className:"mt-3 grid grid-cols-4 items-center gap-4",children:s.jsxs("div",{className:"col-start-4 flex justify-end",children:[s.jsx(J,{variant:"secondary",onClick:()=>{fetch("/v1/session",{method:"DELETE"}).then(()=>document.location.reload()).catch(v=>console.error(v))},children:"Logout"}),s.jsx(Nf,{asChild:!0,children:s.jsx(J,{type:"button",className:"ml-2",children:"Update"})})]})})]})]})]})}globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};function f1(){const e=Gt(),[t,o]=n.useState(),[r,a]=ee(Ke),l=Ye().id??"new",i=ne(Me({id:l})),d=ne(Hr),u=ne(yt);n.useEffect(()=>{d!=null&&d.email&&Sc(d.email).then(m=>{o(`https://www.gravatar.com/avatar/${m}`)},()=>console.error("Email hash failure"))},[d==null?void 0:d.email]);let h=`${i.emoji} ${i.name}`;i.name||(u.rendering?h="⏳ Rendering...":u.error?h="⚠️ Error":h="⚠️ Unknown Error");const f=l==="new"?"OpenUI":h;return s.jsxs("header",{style:{zIndex:1e4},className:"flex h-14 items-center gap-4 border-b bg-background px-4 py-2 md:px-6",children:[s.jsx("nav",{className:"flex flex-col gap-6 text-lg font-medium lg:gap-6",children:s.jsx(J,{className:"px-0 hover:bg-transparent",variant:"ghost",onClick:()=>{a(r==="history"?"closed":"history"),e("/ai/new")},children:s.jsx(Uf,{className:"w-12"})})}),s.jsx("div",{className:"mx-auto hidden w-full items-center md:flex",children:s.jsxs("div",{className:T("absolute left-1/2 -translate-x-1/2 transform font-semibold",l==="new"&&"hidden"),children:[f,s.jsx(J,{variant:"ghost",size:"icon",className:"-ml-2 hover:bg-transparent",onClick:()=>a(r==="versions"?"closed":"versions"),children:s.jsx(Ei,{className:"h-3 w-3"})})]})}),s.jsxs("div",{className:"flex w-full items-center justify-end",children:[s.jsx(J,{asChild:!0,size:"icon",variant:"secondary",className:"mr-2 h-8 w-8 rounded-sm hover:bg-muted/80",children:s.jsx("a",{"aria-label":"GitHub",rel:"noreferrer",target:"_blank",href:"https://github.com/wandb/openui",children:s.jsx("svg",{className:"h-4 w-4",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:s.jsx("path",{d:"M16.8973 4.8424C17.0202 4.80019 17.437 4.64594 17.5258 4.80553C17.5838 4.90971 17.647 5.07393 17.6942 5.28761C17.7899 5.72079 17.7932 6.23147 17.6707 6.63977C17.5882 6.91481 17.6246 7.27653 17.8069 7.50094C18.397 8.22732 18.7502 9.15206 18.7502 10.1613C18.7502 12.3205 17.1213 14.1319 14.9742 14.3603L14.1986 14.4428C13.9261 14.4718 13.6912 14.6471 13.5857 14.9C13.4803 15.1529 13.5211 15.4432 13.6923 15.6571C14.0986 16.1651 14.2827 16.7103 14.3049 17.3771C14.342 18.4924 14.2994 19.6249 14.3002 20.7447C14.3005 21.1589 14.636 21.4945 15.0502 21.4942C15.4644 21.4939 15.8005 21.1579 15.8002 20.7437L15.8079 17.4015C15.8075 17.3342 15.8012 16.9439 15.7056 16.4643C15.705 16.4616 15.7034 16.4591 15.7007 16.4569C15.6612 16.261 15.6034 16.0331 15.5166 15.798C18.2346 15.3231 20.2502 12.9574 20.2502 10.1613C20.2502 8.91427 19.8505 7.75888 19.1728 6.81849C19.3117 6.18619 19.281 5.51695 19.1589 4.96398C19.0889 4.64745 18.9824 4.33824 18.8366 4.07618C18.7038 3.8376 18.477 3.52707 18.1121 3.38113C17.6131 3.18156 17.0005 3.22098 16.4101 3.4237C15.884 3.60434 15.3267 3.92921 14.7827 4.41877C14.6605 4.39541 14.4941 4.36706 14.2853 4.33908C13.8208 4.27683 13.1462 4.21637 12.2779 4.21637C11.4097 4.21637 10.7351 4.27683 10.2706 4.33908C10.0632 4.36686 9.89783 4.395 9.77581 4.41826C9.23206 3.92899 8.67488 3.60428 8.14896 3.4237C7.55857 3.22098 6.94595 3.18156 6.447 3.38113C6.08213 3.52707 5.85526 3.8376 5.72251 4.07618C5.57669 4.33824 5.47017 4.64745 5.40023 4.96398C5.27827 5.51596 5.24748 6.18379 5.38556 6.81508C4.70636 7.75609 4.30573 8.91276 4.30573 10.1613C4.30573 12.9576 6.32152 15.3234 9.03964 15.7981C8.95174 16.0369 8.89394 16.2677 8.85477 16.4643C8.75916 16.9438 8.75285 17.3341 8.75241 17.4014L8.75216 17.7675C8.27674 17.7451 7.97788 17.6398 7.76777 17.5177C7.5219 17.3747 7.33306 17.1728 7.10608 16.8809C7.05933 16.8208 7.01116 16.7566 6.96075 16.6894C6.53264 16.1185 5.94254 15.3317 4.68208 15.0166C4.28023 14.9161 3.87303 15.1604 3.77257 15.5623C3.67211 15.9641 3.91643 16.3713 4.31828 16.4718C5.04387 16.6532 5.33065 17.0287 5.7593 17.5901C5.81114 17.658 5.86504 17.7285 5.92205 17.8018C6.18119 18.135 6.51318 18.5233 7.01384 18.8144C7.48137 19.0862 8.0438 19.2445 8.75116 19.2687L8.75017 20.7437C8.7499 21.1579 9.08546 21.4939 9.49967 21.4942C9.91389 21.4944 10.2499 21.1589 10.2502 20.7447L10.2524 17.4114L10.2524 17.4102C10.2589 16.7326 10.4514 16.1724 10.8636 15.6571C11.0348 15.4432 11.0756 15.1529 10.9702 14.9C10.8647 14.6471 10.6298 14.4718 10.3573 14.4428L9.58172 14.3603C7.43462 14.1319 5.80573 12.3205 5.80573 10.1613C5.80573 9.15207 6.15885 8.22732 6.74895 7.50094C6.93002 7.27806 6.97051 6.91358 6.88837 6.63977C6.76588 6.23147 6.76919 5.72079 6.8649 5.28761C6.91212 5.07393 6.97528 4.90971 7.03325 4.80553C7.12205 4.64594 7.5389 4.80019 7.66184 4.8424C8.02462 4.96696 8.4831 5.23218 8.96612 5.71763C9.18958 5.94221 9.59673 6.00276 9.90003 5.92467C10.6726 5.7444 11.4895 5.71637 12.2779 5.71637C13.066 5.71637 13.8835 5.74365 14.6557 5.92464L14.657 5.92495L14.6582 5.92526C14.9617 6.00264 15.3694 5.94228 15.593 5.71763C16.076 5.23218 16.5345 4.96696 16.8973 4.8424Z",fill:"currentColor"})})})}),s.jsx(u1,{trigger:s.jsx(J,{className:"mr-2 h-8 w-8 rounded-sm hover:bg-muted/80",variant:"secondary",size:"icon",children:s.jsx(Li,{className:"h-4 w-4"})})}),s.jsxs(J,{onClick:()=>e("/ai/new"),className:"h-8 pl-[0.35rem] pr-3 dark:text-white",children:[s.jsx(Hi,{className:"mr-1 h-5 w-5"}),"New UI"]}),s.jsxs(bs,{className:"ml-6 mr-0 hidden rounded-full sm:flex",children:[s.jsx(xs,{src:t}),s.jsx(ws,{children:s.jsx(Ci,{className:"h-5 w-5"})})]})]})]})}/*! js-cookie v3.0.5 | MIT */function no(e){for(var t=1;t"u")){l=no({},t,l),typeof l.expires=="number"&&(l.expires=new Date(Date.now()+l.expires*864e5)),l.expires&&(l.expires=l.expires.toUTCString()),a=encodeURIComponent(a).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var i="";for(var d in l)l[d]&&(i+="; "+d,l[d]!==!0&&(i+="="+l[d].split(";")[0]));return document.cookie=a+"="+e.write(c,a)+i}}function r(a){if(!(typeof document>"u"||arguments.length&&!a)){for(var c=document.cookie?document.cookie.split("; "):[],l={},i=0;i{const l=async()=>{const d=await Ji();d===void 0?(a(void 0),r(!0)):(a(d),r(!1))},i=Cr.get("error");i&&(t(i),Cr.remove("error")),l().catch(d=>console.error(d))},[a]),s.jsx(Fn,{open:o,onOpenChange:l=>{console.log(l)},children:s.jsxs(Po,{noClose:!0,className:"sm:max-w-[425px]",children:[s.jsxs(Io,{children:[s.jsx(Ao,{children:"Login"}),e?s.jsx(xt,{className:"mb-2 text-red-500 dark:text-red-400",children:e}):s.jsx(xt,{children:"To enforce usage quotas an account is required."})]}),s.jsx("div",{className:"items-center",children:s.jsx(J,{asChild:!0,children:s.jsxs("a",{href:"/v1/login",children:[s.jsx(Oi,{className:"mr-2"})," Login with GitHub"]})})})]})})}globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};function m1({item:e,versionIdx:t}){const o=/127.0.0.1|localhost/.test(document.location.hostname)?"http://localhost:7878":"https://wandb.github.io",r=n.useRef(null),[a,c]=n.useState(!1),l=ne(Ke)==="versions",d=ne(yt).rendering,u=ne(go),h=_e.find(y=>y.name===u)??_e[0],[f,m]=n.useState(),b=n.useMemo(()=>Mn(8),[]),g=Cn(),[p]=Ct(e),x=ne(Ze.item(`image-${e.id}-${t}`)),w=ne(En),[v,$]=n.useState(w);n.useEffect(()=>{var y,I,O,H;w==="system"&&(window.matchMedia("(prefers-color-scheme: dark)").matches?$("dark"):$("light")),["light","dark"].includes(v)&&((I=(y=r.current)==null?void 0:y.contentWindow)==null||I.postMessage({action:"toggle-dark-mode",mode:v},"*")),(H=(O=r.current)==null?void 0:O.contentWindow)==null||H.postMessage({action:"theme",theme:h},"*")},[w,v,h]),n.useEffect(()=>{e.html(t).then(y=>m(y==null?void 0:y.html)).catch(y=>console.error("HTML parse error",y))},[e,t,m]),n.useEffect(()=>{const y=I=>{I.origin===o&&I.data.id===b&&I.data.action==="ready"&&c(!0)};return window.addEventListener("message",y),()=>window.removeEventListener("message",y)},[o,c,b]),n.useEffect(()=>{var y,I,O,H;f&&a&&l&&((I=(y=r.current)==null?void 0:y.contentWindow)==null||I.postMessage({html:f,js:[],darkMode:v==="dark",action:"hydrate",rendering:d},"*"),(H=(O=r.current)==null?void 0:O.contentWindow)==null||H.postMessage({action:"theme",theme:h},"*"))},[a,f,l,v,b,d,h]);const E=1524,k=960,D=200;return s.jsx("a",{id:`v${t}`,className:T("flex h-[163px] justify-start whitespace-normal text-left",p===t&&"bg-zinc-200 dark:bg-zinc-800"),href:`#v${t}`,children:s.jsxs("div",{className:"group relative grid h-[163px] cursor-pointer grid-cols-2 overflow-hidden border-b py-2",children:[s.jsxs("div",{className:"flex h-[143px] w-[210px] flex-col gap-2",children:[s.jsxs("div",{className:"text-md m-2 max-h-[105px] overflow-hidden rounded-lg bg-muted p-2 text-sm text-zinc-700 dark:text-zinc-400",children:[e.prompt(t),x?s.jsx("img",{src:x.url,alt:"Screenshot",className:"max-w-42 flex"}):void 0]}),s.jsxs("div",{className:"align-left mt-auto px-4 text-xs font-thin text-zinc-400",children:["Version ",e.version(t)]})]}),s.jsx("div",{className:`relative w-full max-w-[${D}px] overflow-hidden`,children:s.jsx("iframe",{src:`${o}/openui/index.html?preview=1&id=${b}`,className:T("pointer-events-none absolute left-0 top-2 origin-top-left rounded-[32px] border"),style:{width:`${E}px`,height:`${k}px`,transform:`scale(${(D/E).toFixed(2)})`},title:"Version Preview",sandbox:"allow-same-origin allow-scripts",ref:r})}),s.jsx(J,{variant:"ghost",className:"absolute right-2 top-2 hidden rounded-full hover:bg-red-500/30 group-hover:block",onClick:()=>{e.deleteChapter(t),g()},children:s.jsx(Zi,{className:"h-4 w-4"})})]})})}globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};function g1(){const t=Ye().id??"new",o=Ve(Ke),[r,a]=ee(Me({id:t})),c=n.useMemo(()=>new $t(r,a),[r,a]);return c.id=t,s.jsxs("div",{className:"flex h-[calc(100vh-4em)] flex-none flex-col border-l",children:[s.jsxs("div",{className:"flex items-center justify-between border-b p-4",children:[s.jsx("h2",{className:"text-xl font-semibold",children:"Version History"}),s.jsx(J,{variant:"ghost",className:"hover:bg-transparent",onClick:()=>{o("closed")},children:s.jsx(Ni,{className:"h-4 w-4"})})]}),s.jsx("div",{className:"h-screen max-h-screen overflow-y-scroll",children:c.chapters.map((l,i)=>s.jsx(m1,{versionIdx:i,item:c},`version-${t}-${i}`))})]})}globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};function v1({isShared:e=!1}){const t=Gt(),o=Ye(),r=ne(Me({id:o.id??"new"})),a=ne(Ke);return n.useEffect(()=>{o.id===void 0&&t("/ai/new")},[o.id,t]),s.jsxs("div",{className:"mobile-safe-container flex h-screen w-full flex-col",children:[s.jsx(Pf,{title:r.name?`${r.emoji} ${r.name}`:"Create a new UI"}),s.jsx(f1,{}),s.jsx(p1,{}),s.jsx("main",{className:"flex h-full flex-1 flex-col overflow-hidden bg-muted/40 md:gap-8",children:s.jsxs("div",{className:T("grid grid-cols-[280px_auto]",a==="versions"&&"grid-cols-[auto_420px]"),children:[s.jsx("div",{className:T("flex animate-slide-in flex-col border-r-[1px] border-secondary transition-all",a!=="history"&&"animate-slideout hidden md:hidden lg:hidden"),children:s.jsx(Af,{})}),s.jsx("div",{className:T("relative col-span-2 flex-1 transition-all md:col-span-2",a==="closed"?"lg:col-span-2":"sm:col-span-1 md:col-span-1","animate-slide-in"),children:s.jsx(jc,{renderError:c=>s.jsx(kc,{error:c}),children:s.jsx(_f,{isShared:e})})}),s.jsx("div",{className:T("flex animate-slide-in-right flex-col gap-4 border-r-[1px] border-secondary bg-background transition-all",a!=="versions"&&"hidden animate-slide-out","absolute right-0 md:relative"),children:s.jsx(g1,{})})]})}),s.jsx("canvas",{id:"resizer",className:"hidden"})]})}const _1=Object.freeze(Object.defineProperty({__proto__:null,default:v1},Symbol.toStringTag,{value:"Module"}));export{za as C,_1 as i}; diff --git a/backend/openui/dist/assets/index-BJTdd6TP.js b/backend/openui/dist/assets/index-BJTdd6TP.js deleted file mode 100644 index 4fcb4b4..0000000 --- a/backend/openui/dist/assets/index-BJTdd6TP.js +++ /dev/null @@ -1,253 +0,0 @@ -var px=Object.defineProperty;var mx=(e,t,n)=>t in e?px(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var tn=(e,t,n)=>(mx(e,typeof t!="symbol"?t+"":t,n),n),Lc=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)};var j=(e,t,n)=>(Lc(e,t,"read from private field"),n?n.call(e):t.get(e)),we=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},ue=(e,t,n,r)=>(Lc(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);var Ka=(e,t,n,r)=>({set _(i){ue(e,t,i,n)},get _(){return j(e,t,r)}}),ft=(e,t,n)=>(Lc(e,t,"access private method"),n);function Jy(e,t){for(var n=0;nr[i]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const s of o.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).observe(document,{childList:!0,subtree:!0});function n(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerPolicy&&(o.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?o.credentials="include":i.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(i){if(i.ep)return;i.ep=!0;const o=n(i);fetch(i.href,o)}})();function fh(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Zy={exports:{}},oc={},ev={exports:{}},de={};/** - * @license React - * react.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var $a=Symbol.for("react.element"),gx=Symbol.for("react.portal"),yx=Symbol.for("react.fragment"),vx=Symbol.for("react.strict_mode"),wx=Symbol.for("react.profiler"),xx=Symbol.for("react.provider"),Sx=Symbol.for("react.context"),bx=Symbol.for("react.forward_ref"),Ex=Symbol.for("react.suspense"),kx=Symbol.for("react.memo"),Cx=Symbol.for("react.lazy"),Yp=Symbol.iterator;function _x(e){return e===null||typeof e!="object"?null:(e=Yp&&e[Yp]||e["@@iterator"],typeof e=="function"?e:null)}var tv={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},nv=Object.assign,rv={};function Xo(e,t,n){this.props=e,this.context=t,this.refs=rv,this.updater=n||tv}Xo.prototype.isReactComponent={};Xo.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Xo.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function iv(){}iv.prototype=Xo.prototype;function dh(e,t,n){this.props=e,this.context=t,this.refs=rv,this.updater=n||tv}var hh=dh.prototype=new iv;hh.constructor=dh;nv(hh,Xo.prototype);hh.isPureReactComponent=!0;var Jp=Array.isArray,ov=Object.prototype.hasOwnProperty,ph={current:null},sv={key:!0,ref:!0,__self:!0,__source:!0};function av(e,t,n){var r,i={},o=null,s=null;if(t!=null)for(r in t.ref!==void 0&&(s=t.ref),t.key!==void 0&&(o=""+t.key),t)ov.call(t,r)&&!sv.hasOwnProperty(r)&&(i[r]=t[r]);var a=arguments.length-2;if(a===1)i.children=n;else if(1{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},ac=typeof window>"u"||"Deno"in globalThis;function xn(){}function Lx(e,t){return typeof e=="function"?e(t):e}function Nx(e){return typeof e=="number"&&e>=0&&e!==1/0}function zx(e,t){return Math.max(e+(t||0)-Date.now(),0)}function em(e,t){const{type:n="all",exact:r,fetchStatus:i,predicate:o,queryKey:s,stale:a}=e;if(s){if(r){if(t.queryHash!==gh(s,t.options))return!1}else if(!ia(t.queryKey,s))return!1}if(n!=="all"){const l=t.isActive();if(n==="active"&&!l||n==="inactive"&&l)return!1}return!(typeof a=="boolean"&&t.isStale()!==a||i&&i!==t.state.fetchStatus||o&&!o(t))}function tm(e,t){const{exact:n,status:r,predicate:i,mutationKey:o}=e;if(o){if(!t.options.mutationKey)return!1;if(n){if(ra(t.options.mutationKey)!==ra(o))return!1}else if(!ia(t.options.mutationKey,o))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function gh(e,t){return((t==null?void 0:t.queryKeyHashFn)||ra)(e)}function ra(e){return JSON.stringify(e,(t,n)=>zf(n)?Object.keys(n).sort().reduce((r,i)=>(r[i]=n[i],r),{}):n)}function ia(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?!Object.keys(t).some(n=>!ia(e[n],t[n])):!1}function fv(e,t){if(e===t)return e;const n=nm(e)&&nm(t);if(n||zf(e)&&zf(t)){const r=n?e:Object.keys(e),i=r.length,o=n?t:Object.keys(t),s=o.length,a=n?[]:{};let l=0;for(let u=0;u{setTimeout(t,e)})}function Bx(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?fv(e,t):t}function Ux(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function Hx(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var yh=Symbol(),Ai,jr,Oo,Vy,Vx=(Vy=class extends sc{constructor(){super();we(this,Ai,void 0);we(this,jr,void 0);we(this,Oo,void 0);ue(this,Oo,t=>{if(!ac&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){j(this,jr)||this.setEventListener(j(this,Oo))}onUnsubscribe(){var t;this.hasListeners()||((t=j(this,jr))==null||t.call(this),ue(this,jr,void 0))}setEventListener(t){var n;ue(this,Oo,t),(n=j(this,jr))==null||n.call(this),ue(this,jr,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){j(this,Ai)!==t&&(ue(this,Ai,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof j(this,Ai)=="boolean"?j(this,Ai):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Ai=new WeakMap,jr=new WeakMap,Oo=new WeakMap,Vy),dv=new Vx,Io,Br,Mo,Wy,Wx=(Wy=class extends sc{constructor(){super();we(this,Io,!0);we(this,Br,void 0);we(this,Mo,void 0);ue(this,Mo,t=>{if(!ac&&window.addEventListener){const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){j(this,Br)||this.setEventListener(j(this,Mo))}onUnsubscribe(){var t;this.hasListeners()||((t=j(this,Br))==null||t.call(this),ue(this,Br,void 0))}setEventListener(t){var n;ue(this,Mo,t),(n=j(this,Br))==null||n.call(this),ue(this,Br,t(this.setOnline.bind(this)))}setOnline(t){j(this,Io)!==t&&(ue(this,Io,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return j(this,Io)}},Io=new WeakMap,Br=new WeakMap,Mo=new WeakMap,Wy),Jl=new Wx;function qx(e){return Math.min(1e3*2**e,3e4)}function hv(e){return(e??"online")==="online"?Jl.isOnline():!0}var pv=class{constructor(e){this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function zc(e){return e instanceof pv}function mv(e){let t=!1,n=0,r=!1,i,o,s;const a=new Promise((p,m)=>{o=p,s=m}),l=p=>{var m;r||(y(new pv(p)),(m=e.abort)==null||m.call(e))},u=()=>{t=!0},c=()=>{t=!1},f=()=>dv.isFocused()&&(e.networkMode==="always"||Jl.isOnline())&&e.canRun(),d=()=>hv(e.networkMode)&&e.canRun(),h=p=>{var m;r||(r=!0,(m=e.onSuccess)==null||m.call(e,p),i==null||i(),o(p))},y=p=>{var m;r||(r=!0,(m=e.onError)==null||m.call(e,p),i==null||i(),s(p))},v=()=>new Promise(p=>{var m;i=g=>{(r||f())&&p(g)},(m=e.onPause)==null||m.call(e)}).then(()=>{var p;i=void 0,r||(p=e.onContinue)==null||p.call(e)}),k=()=>{if(r)return;let p;try{p=e.fn()}catch(m){p=Promise.reject(m)}Promise.resolve(p).then(h).catch(m=>{var w;if(r)return;const g=e.retry??(ac?0:3),C=e.retryDelay??qx,P=typeof C=="function"?C(n,m):C,E=g===!0||typeof g=="number"&&nf()?void 0:v()).then(()=>{t?y(m):k()})})};return{promise:a,cancel:l,continue:()=>(i==null||i(),a),cancelRetry:u,continueRetry:c,canStart:d,start:()=>(d()?k():v().then(k),a)}}function Qx(){let e=[],t=0,n=d=>{d()},r=d=>{d()},i=d=>setTimeout(d,0);const o=d=>{i=d},s=d=>{let h;t++;try{h=d()}finally{t--,t||u()}return h},a=d=>{t?e.push(d):i(()=>{n(d)})},l=d=>(...h)=>{a(()=>{d(...h)})},u=()=>{const d=e;e=[],d.length&&i(()=>{r(()=>{d.forEach(h=>{n(h)})})})};return{batch:s,batchCalls:l,schedule:a,setNotifyFunction:d=>{n=d},setBatchNotifyFunction:d=>{r=d},setScheduler:o}}var Et=Qx(),Ri,qy,gv=(qy=class{constructor(){we(this,Ri,void 0)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Nx(this.gcTime)&&ue(this,Ri,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(ac?1/0:5*60*1e3))}clearGcTimeout(){j(this,Ri)&&(clearTimeout(j(this,Ri)),ue(this,Ri,void 0))}},Ri=new WeakMap,qy),$o,Fo,nn,xt,Ia,Ti,En,sr,Qy,Kx=(Qy=class extends gv{constructor(t){super();we(this,En);we(this,$o,void 0);we(this,Fo,void 0);we(this,nn,void 0);we(this,xt,void 0);we(this,Ia,void 0);we(this,Ti,void 0);ue(this,Ti,!1),ue(this,Ia,t.defaultOptions),this.setOptions(t.options),this.observers=[],ue(this,nn,t.cache),this.queryKey=t.queryKey,this.queryHash=t.queryHash,ue(this,$o,t.state||Xx(this.options)),this.state=j(this,$o),this.scheduleGc()}get meta(){return this.options.meta}setOptions(t){this.options={...j(this,Ia),...t},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&j(this,nn).remove(this)}setData(t,n){const r=Bx(this.state.data,t,this.options);return ft(this,En,sr).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){ft(this,En,sr).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,i;const n=(r=j(this,xt))==null?void 0:r.promise;return(i=j(this,xt))==null||i.cancel(t),n?n.then(xn).catch(xn):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(j(this,$o))}isActive(){return this.observers.some(t=>t.options.enabled!==!1)}isDisabled(){return this.getObserversCount()>0&&!this.isActive()}isStale(){return this.state.isInvalidated?!0:this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0}isStaleByTime(t=0){return this.state.isInvalidated||this.state.data===void 0||!zx(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=j(this,xt))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=j(this,xt))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),j(this,nn).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(j(this,xt)&&(j(this,Ti)?j(this,xt).cancel({revert:!0}):j(this,xt).cancelRetry()),this.scheduleGc()),j(this,nn).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||ft(this,En,sr).call(this,{type:"invalidate"})}fetch(t,n){var u,c,f;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(j(this,xt))return j(this,xt).continueRetry(),j(this,xt).promise}if(t&&this.setOptions(t),!this.options.queryFn){const d=this.observers.find(h=>h.options.queryFn);d&&this.setOptions(d.options)}const r=new AbortController,i={queryKey:this.queryKey,meta:this.meta},o=d=>{Object.defineProperty(d,"signal",{enumerable:!0,get:()=>(ue(this,Ti,!0),r.signal)})};o(i);const s=()=>!this.options.queryFn||this.options.queryFn===yh?Promise.reject(new Error(`Missing queryFn: '${this.options.queryHash}'`)):(ue(this,Ti,!1),this.options.persister?this.options.persister(this.options.queryFn,i,this):this.options.queryFn(i)),a={fetchOptions:n,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:s};o(a),(u=this.options.behavior)==null||u.onFetch(a,this),ue(this,Fo,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((c=a.fetchOptions)==null?void 0:c.meta))&&ft(this,En,sr).call(this,{type:"fetch",meta:(f=a.fetchOptions)==null?void 0:f.meta});const l=d=>{var h,y,v,k;zc(d)&&d.silent||ft(this,En,sr).call(this,{type:"error",error:d}),zc(d)||((y=(h=j(this,nn).config).onError)==null||y.call(h,d,this),(k=(v=j(this,nn).config).onSettled)==null||k.call(v,this.state.data,d,this)),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1};return ue(this,xt,mv({fn:a.fetchFn,abort:r.abort.bind(r),onSuccess:d=>{var h,y,v,k;if(d===void 0){l(new Error(`${this.queryHash} data is undefined`));return}this.setData(d),(y=(h=j(this,nn).config).onSuccess)==null||y.call(h,d,this),(k=(v=j(this,nn).config).onSettled)==null||k.call(v,d,this.state.error,this),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1},onError:l,onFail:(d,h)=>{ft(this,En,sr).call(this,{type:"failed",failureCount:d,error:h})},onPause:()=>{ft(this,En,sr).call(this,{type:"pause"})},onContinue:()=>{ft(this,En,sr).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0})),j(this,xt).start()}},$o=new WeakMap,Fo=new WeakMap,nn=new WeakMap,xt=new WeakMap,Ia=new WeakMap,Ti=new WeakMap,En=new WeakSet,sr=function(t){const n=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...Gx(r.data,this.options),fetchMeta:t.meta??null};case"success":return{...r,data:t.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:t.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const i=t.error;return zc(i)&&i.revert&&j(this,Fo)?{...j(this,Fo),fetchStatus:"idle"}:{...r,error:i,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),Et.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),j(this,nn).notify({query:this,type:"updated",action:t})})},Qy);function Gx(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:hv(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Xx(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var Hn,Ky,Yx=(Ky=class extends sc{constructor(t={}){super();we(this,Hn,void 0);this.config=t,ue(this,Hn,new Map)}build(t,n,r){const i=n.queryKey,o=n.queryHash??gh(i,n);let s=this.get(o);return s||(s=new Kx({cache:this,queryKey:i,queryHash:o,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(i)}),this.add(s)),s}add(t){j(this,Hn).has(t.queryHash)||(j(this,Hn).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=j(this,Hn).get(t.queryHash);n&&(t.destroy(),n===t&&j(this,Hn).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Et.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return j(this,Hn).get(t)}getAll(){return[...j(this,Hn).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>em(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>em(t,r)):n}notify(t){Et.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){Et.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Et.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Hn=new WeakMap,Ky),Vn,St,Oi,Wn,$r,Gy,Jx=(Gy=class extends gv{constructor(t){super();we(this,Wn);we(this,Vn,void 0);we(this,St,void 0);we(this,Oi,void 0);this.mutationId=t.mutationId,ue(this,St,t.mutationCache),ue(this,Vn,[]),this.state=t.state||Zx(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){j(this,Vn).includes(t)||(j(this,Vn).push(t),this.clearGcTimeout(),j(this,St).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){ue(this,Vn,j(this,Vn).filter(n=>n!==t)),this.scheduleGc(),j(this,St).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){j(this,Vn).length||(this.state.status==="pending"?this.scheduleGc():j(this,St).remove(this))}continue(){var t;return((t=j(this,Oi))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var i,o,s,a,l,u,c,f,d,h,y,v,k,p,m,g,C,P,E,w;ue(this,Oi,mv({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(S,A)=>{ft(this,Wn,$r).call(this,{type:"failed",failureCount:S,error:A})},onPause:()=>{ft(this,Wn,$r).call(this,{type:"pause"})},onContinue:()=>{ft(this,Wn,$r).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>j(this,St).canRun(this)}));const n=this.state.status==="pending",r=!j(this,Oi).canStart();try{if(!n){ft(this,Wn,$r).call(this,{type:"pending",variables:t,isPaused:r}),await((o=(i=j(this,St).config).onMutate)==null?void 0:o.call(i,t,this));const A=await((a=(s=this.options).onMutate)==null?void 0:a.call(s,t));A!==this.state.context&&ft(this,Wn,$r).call(this,{type:"pending",context:A,variables:t,isPaused:r})}const S=await j(this,Oi).start();return await((u=(l=j(this,St).config).onSuccess)==null?void 0:u.call(l,S,t,this.state.context,this)),await((f=(c=this.options).onSuccess)==null?void 0:f.call(c,S,t,this.state.context)),await((h=(d=j(this,St).config).onSettled)==null?void 0:h.call(d,S,null,this.state.variables,this.state.context,this)),await((v=(y=this.options).onSettled)==null?void 0:v.call(y,S,null,t,this.state.context)),ft(this,Wn,$r).call(this,{type:"success",data:S}),S}catch(S){try{throw await((p=(k=j(this,St).config).onError)==null?void 0:p.call(k,S,t,this.state.context,this)),await((g=(m=this.options).onError)==null?void 0:g.call(m,S,t,this.state.context)),await((P=(C=j(this,St).config).onSettled)==null?void 0:P.call(C,void 0,S,this.state.variables,this.state.context,this)),await((w=(E=this.options).onSettled)==null?void 0:w.call(E,void 0,S,t,this.state.context)),S}finally{ft(this,Wn,$r).call(this,{type:"error",error:S})}}finally{j(this,St).runNext(this)}}},Vn=new WeakMap,St=new WeakMap,Oi=new WeakMap,Wn=new WeakSet,$r=function(t){const n=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),Et.batch(()=>{j(this,Vn).forEach(r=>{r.onMutationUpdate(t)}),j(this,St).notify({mutation:this,type:"updated",action:t})})},Gy);function Zx(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Ut,Ma,Xy,eS=(Xy=class extends sc{constructor(t={}){super();we(this,Ut,void 0);we(this,Ma,void 0);this.config=t,ue(this,Ut,new Map),ue(this,Ma,Date.now())}build(t,n,r){const i=new Jx({mutationCache:this,mutationId:++Ka(this,Ma)._,options:t.defaultMutationOptions(n),state:r});return this.add(i),i}add(t){const n=Xa(t),r=j(this,Ut).get(n)??[];r.push(t),j(this,Ut).set(n,r),this.notify({type:"added",mutation:t})}remove(t){var r;const n=Xa(t);if(j(this,Ut).has(n)){const i=(r=j(this,Ut).get(n))==null?void 0:r.filter(o=>o!==t);i&&(i.length===0?j(this,Ut).delete(n):j(this,Ut).set(n,i))}this.notify({type:"removed",mutation:t})}canRun(t){var r;const n=(r=j(this,Ut).get(Xa(t)))==null?void 0:r.find(i=>i.state.status==="pending");return!n||n===t}runNext(t){var r;const n=(r=j(this,Ut).get(Xa(t)))==null?void 0:r.find(i=>i!==t&&i.state.isPaused);return(n==null?void 0:n.continue())??Promise.resolve()}clear(){Et.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}getAll(){return[...j(this,Ut).values()].flat()}find(t){const n={exact:!0,...t};return this.getAll().find(r=>tm(n,r))}findAll(t={}){return this.getAll().filter(n=>tm(t,n))}notify(t){Et.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return Et.batch(()=>Promise.all(t.map(n=>n.continue().catch(xn))))}},Ut=new WeakMap,Ma=new WeakMap,Xy);function Xa(e){var t;return((t=e.options.scope)==null?void 0:t.id)??String(e.mutationId)}function tS(e){return{onFetch:(t,n)=>{const r=async()=>{var y,v,k,p,m;const i=t.options,o=(k=(v=(y=t.fetchOptions)==null?void 0:y.meta)==null?void 0:v.fetchMore)==null?void 0:k.direction,s=((p=t.state.data)==null?void 0:p.pages)||[],a=((m=t.state.data)==null?void 0:m.pageParams)||[],l={pages:[],pageParams:[]};let u=!1;const c=g=>{Object.defineProperty(g,"signal",{enumerable:!0,get:()=>(t.signal.aborted?u=!0:t.signal.addEventListener("abort",()=>{u=!0}),t.signal)})},f=t.options.queryFn&&t.options.queryFn!==yh?t.options.queryFn:()=>Promise.reject(new Error(`Missing queryFn: '${t.options.queryHash}'`)),d=async(g,C,P)=>{if(u)return Promise.reject();if(C==null&&g.pages.length)return Promise.resolve(g);const E={queryKey:t.queryKey,pageParam:C,direction:P?"backward":"forward",meta:t.options.meta};c(E);const w=await f(E),{maxPages:S}=t.options,A=P?Hx:Ux;return{pages:A(g.pages,w,S),pageParams:A(g.pageParams,C,S)}};let h;if(o&&s.length){const g=o==="backward",C=g?nS:im,P={pages:s,pageParams:a},E=C(i,P);h=await d(P,E,g)}else{h=await d(l,a[0]??i.initialPageParam);const g=e??s.length;for(let C=1;C{var i,o;return(o=(i=t.options).persister)==null?void 0:o.call(i,r,{queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=r}}}function im(e,{pages:t,pageParams:n}){const r=t.length-1;return e.getNextPageParam(t[r],t,n[r],n)}function nS(e,{pages:t,pageParams:n}){var r;return(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n)}var Ne,Ur,Hr,Do,Lo,Vr,No,zo,Yy,rS=(Yy=class{constructor(e={}){we(this,Ne,void 0);we(this,Ur,void 0);we(this,Hr,void 0);we(this,Do,void 0);we(this,Lo,void 0);we(this,Vr,void 0);we(this,No,void 0);we(this,zo,void 0);ue(this,Ne,e.queryCache||new Yx),ue(this,Ur,e.mutationCache||new eS),ue(this,Hr,e.defaultOptions||{}),ue(this,Do,new Map),ue(this,Lo,new Map),ue(this,Vr,0)}mount(){Ka(this,Vr)._++,j(this,Vr)===1&&(ue(this,No,dv.subscribe(async e=>{e&&(await this.resumePausedMutations(),j(this,Ne).onFocus())})),ue(this,zo,Jl.subscribe(async e=>{e&&(await this.resumePausedMutations(),j(this,Ne).onOnline())})))}unmount(){var e,t;Ka(this,Vr)._--,j(this,Vr)===0&&((e=j(this,No))==null||e.call(this),ue(this,No,void 0),(t=j(this,zo))==null||t.call(this),ue(this,zo,void 0))}isFetching(e){return j(this,Ne).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return j(this,Ur).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=j(this,Ne).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.getQueryData(e.queryKey);if(t===void 0)return this.fetchQuery(e);{const n=this.defaultQueryOptions(e),r=j(this,Ne).build(this,n);return e.revalidateIfStale&&r.isStaleByTime(n.staleTime)&&this.prefetchQuery(n),Promise.resolve(t)}}getQueriesData(e){return j(this,Ne).findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),i=j(this,Ne).get(r.queryHash),o=i==null?void 0:i.state.data,s=Lx(t,o);if(s!==void 0)return j(this,Ne).build(this,r).setData(s,{...n,manual:!0})}setQueriesData(e,t,n){return Et.batch(()=>j(this,Ne).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=j(this,Ne).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=j(this,Ne);Et.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=j(this,Ne),r={type:"active",...e};return Et.batch(()=>(n.findAll(e).forEach(i=>{i.reset()}),this.refetchQueries(r,t)))}cancelQueries(e={},t={}){const n={revert:!0,...t},r=Et.batch(()=>j(this,Ne).findAll(e).map(i=>i.cancel(n)));return Promise.all(r).then(xn).catch(xn)}invalidateQueries(e={},t={}){return Et.batch(()=>{if(j(this,Ne).findAll(e).forEach(r=>{r.invalidate()}),e.refetchType==="none")return Promise.resolve();const n={...e,type:e.refetchType??e.type??"active"};return this.refetchQueries(n,t)})}refetchQueries(e={},t){const n={...t,cancelRefetch:(t==null?void 0:t.cancelRefetch)??!0},r=Et.batch(()=>j(this,Ne).findAll(e).filter(i=>!i.isDisabled()).map(i=>{let o=i.fetch(void 0,n);return n.throwOnError||(o=o.catch(xn)),i.state.fetchStatus==="paused"?Promise.resolve():o}));return Promise.all(r).then(xn)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=j(this,Ne).build(this,t);return n.isStaleByTime(t.staleTime)?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(xn).catch(xn)}fetchInfiniteQuery(e){return e.behavior=tS(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(xn).catch(xn)}resumePausedMutations(){return Jl.isOnline()?j(this,Ur).resumePausedMutations():Promise.resolve()}getQueryCache(){return j(this,Ne)}getMutationCache(){return j(this,Ur)}getDefaultOptions(){return j(this,Hr)}setDefaultOptions(e){ue(this,Hr,e)}setQueryDefaults(e,t){j(this,Do).set(ra(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...j(this,Do).values()];let n={};return t.forEach(r=>{ia(e,r.queryKey)&&(n={...n,...r.defaultOptions})}),n}setMutationDefaults(e,t){j(this,Lo).set(ra(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...j(this,Lo).values()];let n={};return t.forEach(r=>{ia(e,r.mutationKey)&&(n={...n,...r.defaultOptions})}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...j(this,Hr).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=gh(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.enabled!==!0&&t.queryFn===yh&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...j(this,Hr).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){j(this,Ne).clear(),j(this,Ur).clear()}},Ne=new WeakMap,Ur=new WeakMap,Hr=new WeakMap,Do=new WeakMap,Lo=new WeakMap,Vr=new WeakMap,No=new WeakMap,zo=new WeakMap,Yy),yv=x.createContext(void 0),eM=e=>{const t=x.useContext(yv);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},iS=({client:e,children:t})=>(x.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),ke.jsx(yv.Provider,{value:e,children:t}));const oS="modulepreload",sS=function(e){return"/"+e},om={},aS=function(t,n,r){let i=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),s=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));i=Promise.all(n.map(a=>{if(a=sS(a),a in om)return;om[a]=!0;const l=a.endsWith(".css"),u=l?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${a}"]${u}`))return;const c=document.createElement("link");if(c.rel=l?"stylesheet":oS,l||(c.as="script",c.crossOrigin=""),c.href=a,s&&c.setAttribute("nonce",s),document.head.appendChild(c),l)return new Promise((f,d)=>{c.addEventListener("load",f),c.addEventListener("error",()=>d(new Error(`Unable to preload CSS for ${a}`)))})}))}return i.then(()=>t()).catch(o=>{const s=new Event("vite:preloadError",{cancelable:!0});if(s.payload=o,window.dispatchEvent(s),!s.defaultPrevented)throw o})};globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};class vv extends vo.Component{constructor(){super(...arguments);tn(this,"state",{error:void 0})}static getDerivedStateFromError(n){return{error:n}}componentDidCatch(n,r){console.error("Encountered ErrorBoundary:",n,r);const{onError:i}=this.props;i==null||i(n)}render(){const{error:n}=this.state;if(n!==void 0){const{renderError:i}=this.props;return i(n)}const{children:r}=this.props;return r}}tn(vv,"defaultProps",{children:void 0,onError:void 0});globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};function sm({error:e}){return ke.jsxs("div",{className:"flex min-h-screen flex-col items-center justify-center",children:[ke.jsx("h1",{className:"text-xl","data-testid":"LoadingOrError",children:e?e.message:ke.jsx("div",{className:"h-16 w-16 animate-spin rounded-full bg-gradient-to-r from-purple-500 via-pink-500 to-red-500"})}),e?ke.jsx("a",{href:"/",className:"mt-5 text-lg text-blue-500 underline",onClick:t=>{t.preventDefault(),document.location.reload()},children:"Reload"}):void 0]})}function st(){return st=Object.assign?Object.assign.bind():function(e){for(var t=1;te.forEach(n=>lS(n,t))}function Yo(...e){return x.useCallback(wv(...e),e)}function xv(e,t=[]){let n=[];function r(o,s){const a=x.createContext(s),l=n.length;n=[...n,s];function u(f){const{scope:d,children:h,...y}=f,v=(d==null?void 0:d[e][l])||a,k=x.useMemo(()=>y,Object.values(y));return x.createElement(v.Provider,{value:k},h)}function c(f,d){const h=(d==null?void 0:d[e][l])||a,y=x.useContext(h);if(y)return y;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${o}\``)}return u.displayName=o+"Provider",[u,c]}const i=()=>{const o=n.map(s=>x.createContext(s));return function(a){const l=(a==null?void 0:a[e])||o;return x.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return i.scopeName=e,[r,uS(i,...t)]}function uS(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const s=r.reduce((a,{useScope:l,scopeName:u})=>{const f=l(o)[`__scope${u}`];return{...a,...f}},{});return x.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}var Sv={exports:{}},Yt={},bv={exports:{}},Ev={};/** - * @license React - * scheduler.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */(function(e){function t($,W){var b=$.length;$.push(W);e:for(;0>>1,ne=$[J];if(0>>1;J<_;){var Se=2*(J+1)-1,Ee=$[Se],le=Se+1,je=$[le];if(0>i(Ee,b))lei(je,Ee)?($[J]=je,$[le]=b,J=le):($[J]=Ee,$[Se]=b,J=Se);else if(lei(je,b))$[J]=je,$[le]=b,J=le;else break e}}return W}function i($,W){var b=$.sortIndex-W.sortIndex;return b!==0?b:$.id-W.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var s=Date,a=s.now();e.unstable_now=function(){return s.now()-a}}var l=[],u=[],c=1,f=null,d=3,h=!1,y=!1,v=!1,k=typeof setTimeout=="function"?setTimeout:null,p=typeof clearTimeout=="function"?clearTimeout:null,m=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function g($){for(var W=n(u);W!==null;){if(W.callback===null)r(u);else if(W.startTime<=$)r(u),W.sortIndex=W.expirationTime,t(l,W);else break;W=n(u)}}function C($){if(v=!1,g($),!y)if(n(l)!==null)y=!0,q(P);else{var W=n(u);W!==null&&B(C,W.startTime-$)}}function P($,W){y=!1,v&&(v=!1,p(S),S=-1),h=!0;var b=d;try{for(g(W),f=n(l);f!==null&&(!(f.expirationTime>W)||$&&!I());){var J=f.callback;if(typeof J=="function"){f.callback=null,d=f.priorityLevel;var ne=J(f.expirationTime<=W);W=e.unstable_now(),typeof ne=="function"?f.callback=ne:f===n(l)&&r(l),g(W)}else r(l);f=n(l)}if(f!==null)var _=!0;else{var Se=n(u);Se!==null&&B(C,Se.startTime-W),_=!1}return _}finally{f=null,d=b,h=!1}}var E=!1,w=null,S=-1,A=5,O=-1;function I(){return!(e.unstable_now()-O$||125<$?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):A=0<$?Math.floor(1e3/$):5},e.unstable_getCurrentPriorityLevel=function(){return d},e.unstable_getFirstCallbackNode=function(){return n(l)},e.unstable_next=function($){switch(d){case 1:case 2:case 3:var W=3;break;default:W=d}var b=d;d=W;try{return $()}finally{d=b}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function($,W){switch($){case 1:case 2:case 3:case 4:case 5:break;default:$=3}var b=d;d=$;try{return W()}finally{d=b}},e.unstable_scheduleCallback=function($,W,b){var J=e.unstable_now();switch(typeof b=="object"&&b!==null?(b=b.delay,b=typeof b=="number"&&0J?($.sortIndex=b,t(u,$),n(l)===null&&$===n(u)&&(v?(p(S),S=-1):v=!0,B(C,b-J))):($.sortIndex=ne,t(l,$),y||h||(y=!0,q(P))),$},e.unstable_shouldYield=I,e.unstable_wrapCallback=function($){var W=d;return function(){var b=d;d=W;try{return $.apply(this,arguments)}finally{d=b}}}})(Ev);bv.exports=Ev;var cS=bv.exports;/** - * @license React - * react-dom.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var fS=x,Gt=cS;function U(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),jf=Object.prototype.hasOwnProperty,dS=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,am={},lm={};function hS(e){return jf.call(lm,e)?!0:jf.call(am,e)?!1:dS.test(e)?lm[e]=!0:(am[e]=!0,!1)}function pS(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function mS(e,t,n,r){if(t===null||typeof t>"u"||pS(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function _t(e,t,n,r,i,o,s){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=o,this.removeEmptyString=s}var at={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){at[e]=new _t(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];at[t]=new _t(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){at[e]=new _t(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){at[e]=new _t(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){at[e]=new _t(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){at[e]=new _t(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){at[e]=new _t(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){at[e]=new _t(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){at[e]=new _t(e,5,!1,e.toLowerCase(),null,!1,!1)});var vh=/[\-:]([a-z])/g;function wh(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(vh,wh);at[t]=new _t(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(vh,wh);at[t]=new _t(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(vh,wh);at[t]=new _t(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){at[e]=new _t(e,1,!1,e.toLowerCase(),null,!1,!1)});at.xlinkHref=new _t("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){at[e]=new _t(e,1,!1,e.toLowerCase(),null,!0,!0)});function xh(e,t,n,r){var i=at.hasOwnProperty(t)?at[t]:null;(i!==null?i.type!==0:r||!(2a||i[s]!==o[a]){var l=` -`+i[s].replace(" at new "," at ");return e.displayName&&l.includes("")&&(l=l.replace("",e.displayName)),l}while(1<=s&&0<=a);break}}}finally{Bc=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?As(e):""}function gS(e){switch(e.tag){case 5:return As(e.type);case 16:return As("Lazy");case 13:return As("Suspense");case 19:return As("SuspenseList");case 0:case 2:case 15:return e=Uc(e.type,!1),e;case 11:return e=Uc(e.type.render,!1),e;case 1:return e=Uc(e.type,!0),e;default:return""}}function Vf(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case io:return"Fragment";case ro:return"Portal";case Bf:return"Profiler";case Sh:return"StrictMode";case Uf:return"Suspense";case Hf:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case _v:return(e.displayName||"Context")+".Consumer";case Cv:return(e._context.displayName||"Context")+".Provider";case bh:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Eh:return t=e.displayName||null,t!==null?t:Vf(e.type)||"Memo";case Dr:t=e._payload,e=e._init;try{return Vf(e(t))}catch{}}return null}function yS(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Vf(t);case 8:return t===Sh?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function ti(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Av(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function vS(e){var t=Av(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var i=n.get,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(s){r=""+s,o.call(this,s)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(s){r=""+s},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Ja(e){e._valueTracker||(e._valueTracker=vS(e))}function Rv(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=Av(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Zl(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Wf(e,t){var n=t.checked;return Le({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function cm(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=ti(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function Tv(e,t){t=t.checked,t!=null&&xh(e,"checked",t,!1)}function qf(e,t){Tv(e,t);var n=ti(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Qf(e,t.type,n):t.hasOwnProperty("defaultValue")&&Qf(e,t.type,ti(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function fm(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function Qf(e,t,n){(t!=="number"||Zl(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Rs=Array.isArray;function wo(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i"+t.valueOf().toString()+"",t=Za.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function sa(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Hs={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},wS=["Webkit","ms","Moz","O"];Object.keys(Hs).forEach(function(e){wS.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Hs[t]=Hs[e]})});function $v(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Hs.hasOwnProperty(e)&&Hs[e]?(""+t).trim():t+"px"}function Fv(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=$v(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,i):e[n]=i}}var xS=Le({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Xf(e,t){if(t){if(xS[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(U(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(U(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(U(61))}if(t.style!=null&&typeof t.style!="object")throw Error(U(62))}}function Yf(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Jf=null;function kh(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Zf=null,xo=null,So=null;function pm(e){if(e=La(e)){if(typeof Zf!="function")throw Error(U(280));var t=e.stateNode;t&&(t=dc(t),Zf(e.stateNode,e.type,t))}}function Dv(e){xo?So?So.push(e):So=[e]:xo=e}function Lv(){if(xo){var e=xo,t=So;if(So=xo=null,pm(e),t)for(e=0;e>>=0,e===0?32:31-(OS(e)/IS|0)|0}var el=64,tl=4194304;function Ts(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function ru(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,o=e.pingedLanes,s=n&268435455;if(s!==0){var a=s&~i;a!==0?r=Ts(a):(o&=s,o!==0&&(r=Ts(o)))}else s=n&~i,s!==0?r=Ts(s):o!==0&&(r=Ts(o));if(r===0)return 0;if(t!==0&&t!==r&&!(t&i)&&(i=r&-r,o=t&-t,i>=o||i===16&&(o&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function Fa(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Rn(t),e[t]=n}function DS(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=Ws),Em=" ",km=!1;function rw(e,t){switch(e){case"keyup":return cb.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function iw(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var oo=!1;function db(e,t){switch(e){case"compositionend":return iw(t);case"keypress":return t.which!==32?null:(km=!0,Em);case"textInput":return e=t.data,e===Em&&km?null:e;default:return null}}function hb(e,t){if(oo)return e==="compositionend"||!Ih&&rw(e,t)?(e=tw(),_l=Rh=Wr=null,oo=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Am(n)}}function lw(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?lw(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function uw(){for(var e=window,t=Zl();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Zl(e.document)}return t}function Mh(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function bb(e){var t=uw(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&lw(n.ownerDocument.documentElement,n)){if(r!==null&&Mh(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=n.textContent.length,o=Math.min(r.start,i);r=r.end===void 0?o:Math.min(r.end,i),!e.extend&&o>r&&(i=r,r=o,o=i),i=Rm(n,o);var s=Rm(n,r);i&&s&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==s.node||e.focusOffset!==s.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),o>r?(e.addRange(t),e.extend(s.node,s.offset)):(t.setEnd(s.node,s.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,so=null,od=null,Qs=null,sd=!1;function Tm(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;sd||so==null||so!==Zl(r)||(r=so,"selectionStart"in r&&Mh(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Qs&&da(Qs,r)||(Qs=r,r=su(od,"onSelect"),0uo||(e.current=dd[uo],dd[uo]=null,uo--)}function Ce(e,t){uo++,dd[uo]=e.current,e.current=t}var ni={},gt=ui(ni),It=ui(!1),$i=ni;function Bo(e,t){var n=e.type.contextTypes;if(!n)return ni;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},o;for(o in n)i[o]=t[o];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function Mt(e){return e=e.childContextTypes,e!=null}function lu(){Re(It),Re(gt)}function Lm(e,t,n){if(gt.current!==ni)throw Error(U(168));Ce(gt,t),Ce(It,n)}function vw(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in t))throw Error(U(108,yS(e)||"Unknown",i));return Le({},n,r)}function uu(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||ni,$i=gt.current,Ce(gt,e),Ce(It,It.current),!0}function Nm(e,t,n){var r=e.stateNode;if(!r)throw Error(U(169));n?(e=vw(e,t,$i),r.__reactInternalMemoizedMergedChildContext=e,Re(It),Re(gt),Ce(gt,e)):Re(It),Ce(It,n)}var fr=null,hc=!1,nf=!1;function ww(e){fr===null?fr=[e]:fr.push(e)}function $b(e){hc=!0,ww(e)}function ci(){if(!nf&&fr!==null){nf=!0;var e=0,t=xe;try{var n=fr;for(xe=1;e>=s,i-=s,dr=1<<32-Rn(t)+i|n<S?(A=w,w=null):A=w.sibling;var O=d(p,w,g[S],C);if(O===null){w===null&&(w=A);break}e&&w&&O.alternate===null&&t(p,w),m=o(O,m,S),E===null?P=O:E.sibling=O,E=O,w=A}if(S===g.length)return n(p,w),Ie&&vi(p,S),P;if(w===null){for(;SS?(A=w,w=null):A=w.sibling;var I=d(p,w,O.value,C);if(I===null){w===null&&(w=A);break}e&&w&&I.alternate===null&&t(p,w),m=o(I,m,S),E===null?P=I:E.sibling=I,E=I,w=A}if(O.done)return n(p,w),Ie&&vi(p,S),P;if(w===null){for(;!O.done;S++,O=g.next())O=f(p,O.value,C),O!==null&&(m=o(O,m,S),E===null?P=O:E.sibling=O,E=O);return Ie&&vi(p,S),P}for(w=r(p,w);!O.done;S++,O=g.next())O=h(w,p,S,O.value,C),O!==null&&(e&&O.alternate!==null&&w.delete(O.key===null?S:O.key),m=o(O,m,S),E===null?P=O:E.sibling=O,E=O);return e&&w.forEach(function(R){return t(p,R)}),Ie&&vi(p,S),P}function k(p,m,g,C){if(typeof g=="object"&&g!==null&&g.type===io&&g.key===null&&(g=g.props.children),typeof g=="object"&&g!==null){switch(g.$$typeof){case Ya:e:{for(var P=g.key,E=m;E!==null;){if(E.key===P){if(P=g.type,P===io){if(E.tag===7){n(p,E.sibling),m=i(E,g.props.children),m.return=p,p=m;break e}}else if(E.elementType===P||typeof P=="object"&&P!==null&&P.$$typeof===Dr&&Bm(P)===E.type){n(p,E.sibling),m=i(E,g.props),m.ref=ys(p,E,g),m.return=p,p=m;break e}n(p,E);break}else t(p,E);E=E.sibling}g.type===io?(m=Mi(g.props.children,p.mode,C,g.key),m.return=p,p=m):(C=$l(g.type,g.key,g.props,null,p.mode,C),C.ref=ys(p,m,g),C.return=p,p=C)}return s(p);case ro:e:{for(E=g.key;m!==null;){if(m.key===E)if(m.tag===4&&m.stateNode.containerInfo===g.containerInfo&&m.stateNode.implementation===g.implementation){n(p,m.sibling),m=i(m,g.children||[]),m.return=p,p=m;break e}else{n(p,m);break}else t(p,m);m=m.sibling}m=ff(g,p.mode,C),m.return=p,p=m}return s(p);case Dr:return E=g._init,k(p,m,E(g._payload),C)}if(Rs(g))return y(p,m,g,C);if(ds(g))return v(p,m,g,C);ll(p,g)}return typeof g=="string"&&g!==""||typeof g=="number"?(g=""+g,m!==null&&m.tag===6?(n(p,m.sibling),m=i(m,g),m.return=p,p=m):(n(p,m),m=cf(g,p.mode,C),m.return=p,p=m),s(p)):n(p,m)}return k}var Ho=Ew(!0),kw=Ew(!1),du=ui(null),hu=null,ho=null,Lh=null;function Nh(){Lh=ho=hu=null}function zh(e){var t=du.current;Re(du),e._currentValue=t}function md(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function Eo(e,t){hu=e,Lh=ho=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Ot=!0),e.firstContext=null)}function fn(e){var t=e._currentValue;if(Lh!==e)if(e={context:e,memoizedValue:t,next:null},ho===null){if(hu===null)throw Error(U(308));ho=e,hu.dependencies={lanes:0,firstContext:e}}else ho=ho.next=e;return t}var bi=null;function jh(e){bi===null?bi=[e]:bi.push(e)}function Cw(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,jh(t)):(n.next=i.next,i.next=n),t.interleaved=n,yr(e,r)}function yr(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Lr=!1;function Bh(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function _w(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function pr(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Yr(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,ge&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,yr(e,n)}return i=r.interleaved,i===null?(t.next=t,jh(r)):(t.next=i.next,i.next=t),r.interleaved=t,yr(e,n)}function Al(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,_h(e,n)}}function Um(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,o=null;if(n=n.firstBaseUpdate,n!==null){do{var s={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};o===null?i=o=s:o=o.next=s,n=n.next}while(n!==null);o===null?i=o=t:o=o.next=t}else i=o=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:o,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function pu(e,t,n,r){var i=e.updateQueue;Lr=!1;var o=i.firstBaseUpdate,s=i.lastBaseUpdate,a=i.shared.pending;if(a!==null){i.shared.pending=null;var l=a,u=l.next;l.next=null,s===null?o=u:s.next=u,s=l;var c=e.alternate;c!==null&&(c=c.updateQueue,a=c.lastBaseUpdate,a!==s&&(a===null?c.firstBaseUpdate=u:a.next=u,c.lastBaseUpdate=l))}if(o!==null){var f=i.baseState;s=0,c=u=l=null,a=o;do{var d=a.lane,h=a.eventTime;if((r&d)===d){c!==null&&(c=c.next={eventTime:h,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var y=e,v=a;switch(d=t,h=n,v.tag){case 1:if(y=v.payload,typeof y=="function"){f=y.call(h,f,d);break e}f=y;break e;case 3:y.flags=y.flags&-65537|128;case 0:if(y=v.payload,d=typeof y=="function"?y.call(h,f,d):y,d==null)break e;f=Le({},f,d);break e;case 2:Lr=!0}}a.callback!==null&&a.lane!==0&&(e.flags|=64,d=i.effects,d===null?i.effects=[a]:d.push(a))}else h={eventTime:h,lane:d,tag:a.tag,payload:a.payload,callback:a.callback,next:null},c===null?(u=c=h,l=f):c=c.next=h,s|=d;if(a=a.next,a===null){if(a=i.shared.pending,a===null)break;d=a,a=d.next,d.next=null,i.lastBaseUpdate=d,i.shared.pending=null}}while(!0);if(c===null&&(l=f),i.baseState=l,i.firstBaseUpdate=u,i.lastBaseUpdate=c,t=i.shared.interleaved,t!==null){i=t;do s|=i.lane,i=i.next;while(i!==t)}else o===null&&(i.shared.lanes=0);Li|=s,e.lanes=s,e.memoizedState=f}}function Hm(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=of.transition;of.transition={};try{e(!1),t()}finally{xe=n,of.transition=r}}function Hw(){return dn().memoizedState}function Nb(e,t,n){var r=Zr(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Vw(e))Ww(t,n);else if(n=Cw(e,t,n,r),n!==null){var i=kt();Tn(n,e,r,i),qw(n,t,r)}}function zb(e,t,n){var r=Zr(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Vw(e))Ww(t,i);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var s=t.lastRenderedState,a=o(s,n);if(i.hasEagerState=!0,i.eagerState=a,On(a,s)){var l=t.interleaved;l===null?(i.next=i,jh(t)):(i.next=l.next,l.next=i),t.interleaved=i;return}}catch{}finally{}n=Cw(e,t,i,r),n!==null&&(i=kt(),Tn(n,e,r,i),qw(n,t,r))}}function Vw(e){var t=e.alternate;return e===De||t!==null&&t===De}function Ww(e,t){Ks=gu=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function qw(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,_h(e,n)}}var yu={readContext:fn,useCallback:dt,useContext:dt,useEffect:dt,useImperativeHandle:dt,useInsertionEffect:dt,useLayoutEffect:dt,useMemo:dt,useReducer:dt,useRef:dt,useState:dt,useDebugValue:dt,useDeferredValue:dt,useTransition:dt,useMutableSource:dt,useSyncExternalStore:dt,useId:dt,unstable_isNewReconciler:!1},jb={readContext:fn,useCallback:function(e,t){return jn().memoizedState=[e,t===void 0?null:t],e},useContext:fn,useEffect:Wm,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Tl(4194308,4,Nw.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Tl(4194308,4,e,t)},useInsertionEffect:function(e,t){return Tl(4,2,e,t)},useMemo:function(e,t){var n=jn();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=jn();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=Nb.bind(null,De,e),[r.memoizedState,e]},useRef:function(e){var t=jn();return e={current:e},t.memoizedState=e},useState:Vm,useDebugValue:Gh,useDeferredValue:function(e){return jn().memoizedState=e},useTransition:function(){var e=Vm(!1),t=e[0];return e=Lb.bind(null,e[1]),jn().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=De,i=jn();if(Ie){if(n===void 0)throw Error(U(407));n=n()}else{if(n=t(),Ye===null)throw Error(U(349));Di&30||Tw(r,t,n)}i.memoizedState=n;var o={value:n,getSnapshot:t};return i.queue=o,Wm(Iw.bind(null,r,o,e),[e]),r.flags|=2048,xa(9,Ow.bind(null,r,o,n,t),void 0,null),n},useId:function(){var e=jn(),t=Ye.identifierPrefix;if(Ie){var n=hr,r=dr;n=(r&~(1<<32-Rn(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=va++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=s.createElement(n,{is:r.is}):(e=s.createElement(n),n==="select"&&(s=e,r.multiple?s.multiple=!0:r.size&&(s.size=r.size))):e=s.createElementNS(e,n),e[qn]=t,e[ma]=r,n0(e,t,!1,!1),t.stateNode=e;e:{switch(s=Yf(n,r),n){case"dialog":Ae("cancel",e),Ae("close",e),i=r;break;case"iframe":case"object":case"embed":Ae("load",e),i=r;break;case"video":case"audio":for(i=0;iqo&&(t.flags|=128,r=!0,vs(o,!1),t.lanes=4194304)}else{if(!r)if(e=mu(s),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),vs(o,!0),o.tail===null&&o.tailMode==="hidden"&&!s.alternate&&!Ie)return ht(t),null}else 2*Be()-o.renderingStartTime>qo&&n!==1073741824&&(t.flags|=128,r=!0,vs(o,!1),t.lanes=4194304);o.isBackwards?(s.sibling=t.child,t.child=s):(n=o.last,n!==null?n.sibling=s:t.child=s,o.last=s)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=Be(),t.sibling=null,n=Fe.current,Ce(Fe,r?n&1|2:n&1),t):(ht(t),null);case 22:case 23:return tp(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Ht&1073741824&&(ht(t),t.subtreeFlags&6&&(t.flags|=8192)):ht(t),null;case 24:return null;case 25:return null}throw Error(U(156,t.tag))}function Kb(e,t){switch(Fh(t),t.tag){case 1:return Mt(t.type)&&lu(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Vo(),Re(It),Re(gt),Vh(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Hh(t),null;case 13:if(Re(Fe),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(U(340));Uo()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Re(Fe),null;case 4:return Vo(),null;case 10:return zh(t.type._context),null;case 22:case 23:return tp(),null;case 24:return null;default:return null}}var cl=!1,mt=!1,Gb=typeof WeakSet=="function"?WeakSet:Set,Q=null;function po(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){ze(e,t,r)}else n.current=null}function kd(e,t,n){try{n()}catch(r){ze(e,t,r)}}var ng=!1;function Xb(e,t){if(ad=iu,e=uw(),Mh(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break e}var s=0,a=-1,l=-1,u=0,c=0,f=e,d=null;t:for(;;){for(var h;f!==n||i!==0&&f.nodeType!==3||(a=s+i),f!==o||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(h=f.firstChild)!==null;)d=f,f=h;for(;;){if(f===e)break t;if(d===n&&++u===i&&(a=s),d===o&&++c===r&&(l=s),(h=f.nextSibling)!==null)break;f=d,d=f.parentNode}f=h}n=a===-1||l===-1?null:{start:a,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(ld={focusedElem:e,selectionRange:n},iu=!1,Q=t;Q!==null;)if(t=Q,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Q=e;else for(;Q!==null;){t=Q;try{var y=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(y!==null){var v=y.memoizedProps,k=y.memoizedState,p=t.stateNode,m=p.getSnapshotBeforeUpdate(t.elementType===t.type?v:Sn(t.type,v),k);p.__reactInternalSnapshotBeforeUpdate=m}break;case 3:var g=t.stateNode.containerInfo;g.nodeType===1?g.textContent="":g.nodeType===9&&g.documentElement&&g.removeChild(g.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(U(163))}}catch(C){ze(t,t.return,C)}if(e=t.sibling,e!==null){e.return=t.return,Q=e;break}Q=t.return}return y=ng,ng=!1,y}function Gs(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var o=i.destroy;i.destroy=void 0,o!==void 0&&kd(t,n,o)}i=i.next}while(i!==r)}}function gc(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Cd(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function o0(e){var t=e.alternate;t!==null&&(e.alternate=null,o0(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[qn],delete t[ma],delete t[fd],delete t[Ib],delete t[Mb])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function s0(e){return e.tag===5||e.tag===3||e.tag===4}function rg(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||s0(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function _d(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=au));else if(r!==4&&(e=e.child,e!==null))for(_d(e,t,n),e=e.sibling;e!==null;)_d(e,t,n),e=e.sibling}function Pd(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Pd(e,t,n),e=e.sibling;e!==null;)Pd(e,t,n),e=e.sibling}var rt=null,kn=!1;function Rr(e,t,n){for(n=n.child;n!==null;)a0(e,t,n),n=n.sibling}function a0(e,t,n){if(Gn&&typeof Gn.onCommitFiberUnmount=="function")try{Gn.onCommitFiberUnmount(lc,n)}catch{}switch(n.tag){case 5:mt||po(n,t);case 6:var r=rt,i=kn;rt=null,Rr(e,t,n),rt=r,kn=i,rt!==null&&(kn?(e=rt,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):rt.removeChild(n.stateNode));break;case 18:rt!==null&&(kn?(e=rt,n=n.stateNode,e.nodeType===8?tf(e.parentNode,n):e.nodeType===1&&tf(e,n),ca(e)):tf(rt,n.stateNode));break;case 4:r=rt,i=kn,rt=n.stateNode.containerInfo,kn=!0,Rr(e,t,n),rt=r,kn=i;break;case 0:case 11:case 14:case 15:if(!mt&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var o=i,s=o.destroy;o=o.tag,s!==void 0&&(o&2||o&4)&&kd(n,t,s),i=i.next}while(i!==r)}Rr(e,t,n);break;case 1:if(!mt&&(po(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){ze(n,t,a)}Rr(e,t,n);break;case 21:Rr(e,t,n);break;case 22:n.mode&1?(mt=(r=mt)||n.memoizedState!==null,Rr(e,t,n),mt=r):Rr(e,t,n);break;default:Rr(e,t,n)}}function ig(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new Gb),t.forEach(function(r){var i=oE.bind(null,e,r);n.has(r)||(n.add(r),r.then(i,i))})}}function gn(e,t){var n=t.deletions;if(n!==null)for(var r=0;ri&&(i=s),r&=~o}if(r=i,r=Be()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Jb(r/1960))-r,10e?16:e,qr===null)var r=!1;else{if(e=qr,qr=null,xu=0,ge&6)throw Error(U(331));var i=ge;for(ge|=4,Q=e.current;Q!==null;){var o=Q,s=o.child;if(Q.flags&16){var a=o.deletions;if(a!==null){for(var l=0;lBe()-Zh?Ii(e,0):Jh|=n),$t(e,t)}function m0(e,t){t===0&&(e.mode&1?(t=tl,tl<<=1,!(tl&130023424)&&(tl=4194304)):t=1);var n=kt();e=yr(e,t),e!==null&&(Fa(e,t,n),$t(e,n))}function iE(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),m0(e,n)}function oE(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(U(314))}r!==null&&r.delete(t),m0(e,n)}var g0;g0=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||It.current)Ot=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Ot=!1,qb(e,t,n);Ot=!!(e.flags&131072)}else Ot=!1,Ie&&t.flags&1048576&&xw(t,fu,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Ol(e,t),e=t.pendingProps;var i=Bo(t,gt.current);Eo(t,n),i=qh(null,t,r,e,i,n);var o=Qh();return t.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Mt(r)?(o=!0,uu(t)):o=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,Bh(t),i.updater=mc,t.stateNode=i,i._reactInternals=t,yd(t,r,e,n),t=xd(null,t,r,!0,o,n)):(t.tag=0,Ie&&o&&$h(t),bt(null,t,i,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Ol(e,t),e=t.pendingProps,i=r._init,r=i(r._payload),t.type=r,i=t.tag=aE(r),e=Sn(r,e),i){case 0:t=wd(null,t,r,e,n);break e;case 1:t=Zm(null,t,r,e,n);break e;case 11:t=Ym(null,t,r,e,n);break e;case 14:t=Jm(null,t,r,Sn(r.type,e),n);break e}throw Error(U(306,r,""))}return t;case 0:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Sn(r,i),wd(e,t,r,i,n);case 1:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Sn(r,i),Zm(e,t,r,i,n);case 3:e:{if(Zw(t),e===null)throw Error(U(387));r=t.pendingProps,o=t.memoizedState,i=o.element,_w(e,t),pu(t,r,null,n);var s=t.memoizedState;if(r=s.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){i=Wo(Error(U(423)),t),t=eg(e,t,r,n,i);break e}else if(r!==i){i=Wo(Error(U(424)),t),t=eg(e,t,r,n,i);break e}else for(Wt=Xr(t.stateNode.containerInfo.firstChild),Qt=t,Ie=!0,_n=null,n=kw(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Uo(),r===i){t=vr(e,t,n);break e}bt(e,t,r,n)}t=t.child}return t;case 5:return Pw(t),e===null&&pd(t),r=t.type,i=t.pendingProps,o=e!==null?e.memoizedProps:null,s=i.children,ud(r,i)?s=null:o!==null&&ud(r,o)&&(t.flags|=32),Jw(e,t),bt(e,t,s,n),t.child;case 6:return e===null&&pd(t),null;case 13:return e0(e,t,n);case 4:return Uh(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Ho(t,null,r,n):bt(e,t,r,n),t.child;case 11:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Sn(r,i),Ym(e,t,r,i,n);case 7:return bt(e,t,t.pendingProps,n),t.child;case 8:return bt(e,t,t.pendingProps.children,n),t.child;case 12:return bt(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,i=t.pendingProps,o=t.memoizedProps,s=i.value,Ce(du,r._currentValue),r._currentValue=s,o!==null)if(On(o.value,s)){if(o.children===i.children&&!It.current){t=vr(e,t,n);break e}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var a=o.dependencies;if(a!==null){s=o.child;for(var l=a.firstContext;l!==null;){if(l.context===r){if(o.tag===1){l=pr(-1,n&-n),l.tag=2;var u=o.updateQueue;if(u!==null){u=u.shared;var c=u.pending;c===null?l.next=l:(l.next=c.next,c.next=l),u.pending=l}}o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),md(o.return,n,t),a.lanes|=n;break}l=l.next}}else if(o.tag===10)s=o.type===t.type?null:o.child;else if(o.tag===18){if(s=o.return,s===null)throw Error(U(341));s.lanes|=n,a=s.alternate,a!==null&&(a.lanes|=n),md(s,n,t),s=o.sibling}else s=o.child;if(s!==null)s.return=o;else for(s=o;s!==null;){if(s===t){s=null;break}if(o=s.sibling,o!==null){o.return=s.return,s=o;break}s=s.return}o=s}bt(e,t,i.children,n),t=t.child}return t;case 9:return i=t.type,r=t.pendingProps.children,Eo(t,n),i=fn(i),r=r(i),t.flags|=1,bt(e,t,r,n),t.child;case 14:return r=t.type,i=Sn(r,t.pendingProps),i=Sn(r.type,i),Jm(e,t,r,i,n);case 15:return Xw(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Sn(r,i),Ol(e,t),t.tag=1,Mt(r)?(e=!0,uu(t)):e=!1,Eo(t,n),Qw(t,r,i),yd(t,r,i,n),xd(null,t,r,!0,e,n);case 19:return t0(e,t,n);case 22:return Yw(e,t,n)}throw Error(U(156,t.tag))};function y0(e,t){return Vv(e,t)}function sE(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function un(e,t,n,r){return new sE(e,t,n,r)}function rp(e){return e=e.prototype,!(!e||!e.isReactComponent)}function aE(e){if(typeof e=="function")return rp(e)?1:0;if(e!=null){if(e=e.$$typeof,e===bh)return 11;if(e===Eh)return 14}return 2}function ei(e,t){var n=e.alternate;return n===null?(n=un(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function $l(e,t,n,r,i,o){var s=2;if(r=e,typeof e=="function")rp(e)&&(s=1);else if(typeof e=="string")s=5;else e:switch(e){case io:return Mi(n.children,i,o,t);case Sh:s=8,i|=8;break;case Bf:return e=un(12,n,t,i|2),e.elementType=Bf,e.lanes=o,e;case Uf:return e=un(13,n,t,i),e.elementType=Uf,e.lanes=o,e;case Hf:return e=un(19,n,t,i),e.elementType=Hf,e.lanes=o,e;case Pv:return vc(n,i,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Cv:s=10;break e;case _v:s=9;break e;case bh:s=11;break e;case Eh:s=14;break e;case Dr:s=16,r=null;break e}throw Error(U(130,e==null?e:typeof e,""))}return t=un(s,n,t,i),t.elementType=e,t.type=r,t.lanes=o,t}function Mi(e,t,n,r){return e=un(7,e,r,t),e.lanes=n,e}function vc(e,t,n,r){return e=un(22,e,r,t),e.elementType=Pv,e.lanes=n,e.stateNode={isHidden:!1},e}function cf(e,t,n){return e=un(6,e,null,t),e.lanes=n,e}function ff(e,t,n){return t=un(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function lE(e,t,n,r,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Vc(0),this.expirationTimes=Vc(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Vc(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function ip(e,t,n,r,i,o,s,a,l){return e=new lE(e,t,n,a,l),t===1?(t=1,o===!0&&(t|=8)):t=0,o=un(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Bh(o),e}function uE(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(S0)}catch(e){console.error(e)}}S0(),Sv.exports=Yt;var es=Sv.exports;const pE=fh(es),mE=Jy({__proto__:null,default:pE},[es]),b0=x.forwardRef((e,t)=>{const{children:n,...r}=e,i=x.Children.toArray(n),o=i.find(gE);if(o){const s=o.props.children,a=i.map(l=>l===o?x.Children.count(s)>1?x.Children.only(null):x.isValidElement(s)?s.props.children:null:l);return x.createElement(Id,st({},r,{ref:t}),x.isValidElement(s)?x.cloneElement(s,void 0,a):null)}return x.createElement(Id,st({},r,{ref:t}),n)});b0.displayName="Slot";const Id=x.forwardRef((e,t)=>{const{children:n,...r}=e;return x.isValidElement(n)?x.cloneElement(n,{...yE(r,n.props),ref:t?wv(t,n.ref):n.ref}):x.Children.count(n)>1?x.Children.only(null):null});Id.displayName="SlotClone";const E0=({children:e})=>x.createElement(x.Fragment,null,e);function gE(e){return x.isValidElement(e)&&e.type===E0}function yE(e,t){const n={...t};for(const r in t){const i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...a)=>{o(...a),i(...a)}:i&&(n[r]=i):r==="style"?n[r]={...i,...o}:r==="className"&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}const vE=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],ts=vE.reduce((e,t)=>{const n=x.forwardRef((r,i)=>{const{asChild:o,...s}=r,a=o?b0:t;return x.useEffect(()=>{window[Symbol.for("radix-ui")]=!0},[]),x.createElement(a,st({},s,{ref:i}))});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function wE(e,t){e&&es.flushSync(()=>e.dispatchEvent(t))}function ns(e){const t=x.useRef(e);return x.useEffect(()=>{t.current=e}),x.useMemo(()=>(...n)=>{var r;return(r=t.current)===null||r===void 0?void 0:r.call(t,...n)},[])}function xE(e,t=globalThis==null?void 0:globalThis.document){const n=ns(e);x.useEffect(()=>{const r=i=>{i.key==="Escape"&&n(i)};return t.addEventListener("keydown",r),()=>t.removeEventListener("keydown",r)},[n,t])}const Md="dismissableLayer.update",SE="dismissableLayer.pointerDownOutside",bE="dismissableLayer.focusOutside";let dg;const EE=x.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),kE=x.forwardRef((e,t)=>{var n;const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:s,onInteractOutside:a,onDismiss:l,...u}=e,c=x.useContext(EE),[f,d]=x.useState(null),h=(n=f==null?void 0:f.ownerDocument)!==null&&n!==void 0?n:globalThis==null?void 0:globalThis.document,[,y]=x.useState({}),v=Yo(t,S=>d(S)),k=Array.from(c.layers),[p]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),m=k.indexOf(p),g=f?k.indexOf(f):-1,C=c.layersWithOutsidePointerEventsDisabled.size>0,P=g>=m,E=CE(S=>{const A=S.target,O=[...c.branches].some(I=>I.contains(A));!P||O||(o==null||o(S),a==null||a(S),S.defaultPrevented||l==null||l())},h),w=_E(S=>{const A=S.target;[...c.branches].some(I=>I.contains(A))||(s==null||s(S),a==null||a(S),S.defaultPrevented||l==null||l())},h);return xE(S=>{g===c.layers.size-1&&(i==null||i(S),!S.defaultPrevented&&l&&(S.preventDefault(),l()))},h),x.useEffect(()=>{if(f)return r&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(dg=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(f)),c.layers.add(f),hg(),()=>{r&&c.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=dg)}},[f,h,r,c]),x.useEffect(()=>()=>{f&&(c.layers.delete(f),c.layersWithOutsidePointerEventsDisabled.delete(f),hg())},[f,c]),x.useEffect(()=>{const S=()=>y({});return document.addEventListener(Md,S),()=>document.removeEventListener(Md,S)},[]),x.createElement(ts.div,st({},u,{ref:v,style:{pointerEvents:C?P?"auto":"none":void 0,...e.style},onFocusCapture:cr(e.onFocusCapture,w.onFocusCapture),onBlurCapture:cr(e.onBlurCapture,w.onBlurCapture),onPointerDownCapture:cr(e.onPointerDownCapture,E.onPointerDownCapture)}))});function CE(e,t=globalThis==null?void 0:globalThis.document){const n=ns(e),r=x.useRef(!1),i=x.useRef(()=>{});return x.useEffect(()=>{const o=a=>{if(a.target&&!r.current){let u=function(){k0(SE,n,l,{discrete:!0})};const l={originalEvent:a};a.pointerType==="touch"?(t.removeEventListener("click",i.current),i.current=u,t.addEventListener("click",i.current,{once:!0})):u()}else t.removeEventListener("click",i.current);r.current=!1},s=window.setTimeout(()=>{t.addEventListener("pointerdown",o)},0);return()=>{window.clearTimeout(s),t.removeEventListener("pointerdown",o),t.removeEventListener("click",i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function _E(e,t=globalThis==null?void 0:globalThis.document){const n=ns(e),r=x.useRef(!1);return x.useEffect(()=>{const i=o=>{o.target&&!r.current&&k0(bE,n,{originalEvent:o},{discrete:!1})};return t.addEventListener("focusin",i),()=>t.removeEventListener("focusin",i)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function hg(){const e=new CustomEvent(Md);document.dispatchEvent(e)}function k0(e,t,n,{discrete:r}){const i=n.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?wE(i,o):i.dispatchEvent(o)}const Qo=globalThis!=null&&globalThis.document?x.useLayoutEffect:()=>{},PE=uv.useId||(()=>{});let AE=0;function RE(e){const[t,n]=x.useState(PE());return Qo(()=>{e||n(r=>r??String(AE++))},[e]),e||(t?`radix-${t}`:"")}const TE=["top","right","bottom","left"],ri=Math.min,Vt=Math.max,Eu=Math.round,hl=Math.floor,ii=e=>({x:e,y:e}),OE={left:"right",right:"left",bottom:"top",top:"bottom"},IE={start:"end",end:"start"};function $d(e,t,n){return Vt(e,ri(t,n))}function wr(e,t){return typeof e=="function"?e(t):e}function xr(e){return e.split("-")[0]}function rs(e){return e.split("-")[1]}function lp(e){return e==="x"?"y":"x"}function up(e){return e==="y"?"height":"width"}function is(e){return["top","bottom"].includes(xr(e))?"y":"x"}function cp(e){return lp(is(e))}function ME(e,t,n){n===void 0&&(n=!1);const r=rs(e),i=cp(e),o=up(i);let s=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(s=ku(s)),[s,ku(s)]}function $E(e){const t=ku(e);return[Fd(e),t,Fd(t)]}function Fd(e){return e.replace(/start|end/g,t=>IE[t])}function FE(e,t,n){const r=["left","right"],i=["right","left"],o=["top","bottom"],s=["bottom","top"];switch(e){case"top":case"bottom":return n?t?i:r:t?r:i;case"left":case"right":return t?o:s;default:return[]}}function DE(e,t,n,r){const i=rs(e);let o=FE(xr(e),n==="start",r);return i&&(o=o.map(s=>s+"-"+i),t&&(o=o.concat(o.map(Fd)))),o}function ku(e){return e.replace(/left|right|bottom|top/g,t=>OE[t])}function LE(e){return{top:0,right:0,bottom:0,left:0,...e}}function C0(e){return typeof e!="number"?LE(e):{top:e,right:e,bottom:e,left:e}}function Cu(e){const{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function pg(e,t,n){let{reference:r,floating:i}=e;const o=is(t),s=cp(t),a=up(s),l=xr(t),u=o==="y",c=r.x+r.width/2-i.width/2,f=r.y+r.height/2-i.height/2,d=r[a]/2-i[a]/2;let h;switch(l){case"top":h={x:c,y:r.y-i.height};break;case"bottom":h={x:c,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:f};break;case"left":h={x:r.x-i.width,y:f};break;default:h={x:r.x,y:r.y}}switch(rs(t)){case"start":h[s]-=d*(n&&u?-1:1);break;case"end":h[s]+=d*(n&&u?-1:1);break}return h}const NE=async(e,t,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:o=[],platform:s}=n,a=o.filter(Boolean),l=await(s.isRTL==null?void 0:s.isRTL(t));let u=await s.getElementRects({reference:e,floating:t,strategy:i}),{x:c,y:f}=pg(u,r,l),d=r,h={},y=0;for(let v=0;v({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:i,rects:o,platform:s,elements:a,middlewareData:l}=t,{element:u,padding:c=0}=wr(e,t)||{};if(u==null)return{};const f=C0(c),d={x:n,y:r},h=cp(i),y=up(h),v=await s.getDimensions(u),k=h==="y",p=k?"top":"left",m=k?"bottom":"right",g=k?"clientHeight":"clientWidth",C=o.reference[y]+o.reference[h]-d[h]-o.floating[y],P=d[h]-o.reference[h],E=await(s.getOffsetParent==null?void 0:s.getOffsetParent(u));let w=E?E[g]:0;(!w||!await(s.isElement==null?void 0:s.isElement(E)))&&(w=a.floating[g]||o.floating[y]);const S=C/2-P/2,A=w/2-v[y]/2-1,O=ri(f[p],A),I=ri(f[m],A),R=O,D=w-v[y]-I,F=w/2-v[y]/2+S,z=$d(R,F,D),q=!l.arrow&&rs(i)!=null&&F!==z&&o.reference[y]/2-(FR<=0)){var A,O;const R=(((A=o.flip)==null?void 0:A.index)||0)+1,D=P[R];if(D)return{data:{index:R,overflows:S},reset:{placement:D}};let F=(O=S.filter(z=>z.overflows[0]<=0).sort((z,q)=>z.overflows[1]-q.overflows[1])[0])==null?void 0:O.placement;if(!F)switch(h){case"bestFit":{var I;const z=(I=S.map(q=>[q.placement,q.overflows.filter(B=>B>0).reduce((B,$)=>B+$,0)]).sort((q,B)=>q[1]-B[1])[0])==null?void 0:I[0];z&&(F=z);break}case"initialPlacement":F=a;break}if(i!==F)return{reset:{placement:F}}}return{}}}};function mg(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function gg(e){return TE.some(t=>e[t]>=0)}const BE=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...i}=wr(e,t);switch(r){case"referenceHidden":{const o=await ba(t,{...i,elementContext:"reference"}),s=mg(o,n.reference);return{data:{referenceHiddenOffsets:s,referenceHidden:gg(s)}}}case"escaped":{const o=await ba(t,{...i,altBoundary:!0}),s=mg(o,n.floating);return{data:{escapedOffsets:s,escaped:gg(s)}}}default:return{}}}}};async function UE(e,t){const{placement:n,platform:r,elements:i}=e,o=await(r.isRTL==null?void 0:r.isRTL(i.floating)),s=xr(n),a=rs(n),l=is(n)==="y",u=["left","top"].includes(s)?-1:1,c=o&&l?-1:1,f=wr(t,e);let{mainAxis:d,crossAxis:h,alignmentAxis:y}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...f};return a&&typeof y=="number"&&(h=a==="end"?y*-1:y),l?{x:h*c,y:d*u}:{x:d*u,y:h*c}}const HE=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:i,y:o,placement:s,middlewareData:a}=t,l=await UE(t,e);return s===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:i+l.x,y:o+l.y,data:{...l,placement:s}}}}},VE=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:i}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:a={fn:k=>{let{x:p,y:m}=k;return{x:p,y:m}}},...l}=wr(e,t),u={x:n,y:r},c=await ba(t,l),f=is(xr(i)),d=lp(f);let h=u[d],y=u[f];if(o){const k=d==="y"?"top":"left",p=d==="y"?"bottom":"right",m=h+c[k],g=h-c[p];h=$d(m,h,g)}if(s){const k=f==="y"?"top":"left",p=f==="y"?"bottom":"right",m=y+c[k],g=y-c[p];y=$d(m,y,g)}const v=a.fn({...t,[d]:h,[f]:y});return{...v,data:{x:v.x-n,y:v.y-r}}}}},WE=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:i,rects:o,middlewareData:s}=t,{offset:a=0,mainAxis:l=!0,crossAxis:u=!0}=wr(e,t),c={x:n,y:r},f=is(i),d=lp(f);let h=c[d],y=c[f];const v=wr(a,t),k=typeof v=="number"?{mainAxis:v,crossAxis:0}:{mainAxis:0,crossAxis:0,...v};if(l){const g=d==="y"?"height":"width",C=o.reference[d]-o.floating[g]+k.mainAxis,P=o.reference[d]+o.reference[g]-k.mainAxis;hP&&(h=P)}if(u){var p,m;const g=d==="y"?"width":"height",C=["top","left"].includes(xr(i)),P=o.reference[f]-o.floating[g]+(C&&((p=s.offset)==null?void 0:p[f])||0)+(C?0:k.crossAxis),E=o.reference[f]+o.reference[g]+(C?0:((m=s.offset)==null?void 0:m[f])||0)-(C?k.crossAxis:0);yE&&(y=E)}return{[d]:h,[f]:y}}}},qE=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:r,platform:i,elements:o}=t,{apply:s=()=>{},...a}=wr(e,t),l=await ba(t,a),u=xr(n),c=rs(n),f=is(n)==="y",{width:d,height:h}=r.floating;let y,v;u==="top"||u==="bottom"?(y=u,v=c===(await(i.isRTL==null?void 0:i.isRTL(o.floating))?"start":"end")?"left":"right"):(v=u,y=c==="end"?"top":"bottom");const k=h-l[y],p=d-l[v],m=!t.middlewareData.shift;let g=k,C=p;if(f){const E=d-l.left-l.right;C=c||m?ri(p,E):E}else{const E=h-l.top-l.bottom;g=c||m?ri(k,E):E}if(m&&!c){const E=Vt(l.left,0),w=Vt(l.right,0),S=Vt(l.top,0),A=Vt(l.bottom,0);f?C=d-2*(E!==0||w!==0?E+w:Vt(l.left,l.right)):g=h-2*(S!==0||A!==0?S+A:Vt(l.top,l.bottom))}await s({...t,availableWidth:C,availableHeight:g});const P=await i.getDimensions(o.floating);return d!==P.width||h!==P.height?{reset:{rects:!0}}:{}}}};function os(e){return _0(e)?(e.nodeName||"").toLowerCase():"#document"}function Kt(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Er(e){var t;return(t=(_0(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function _0(e){return e instanceof Node||e instanceof Kt(e).Node}function Jn(e){return e instanceof Element||e instanceof Kt(e).Element}function Zn(e){return e instanceof HTMLElement||e instanceof Kt(e).HTMLElement}function yg(e){return typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Kt(e).ShadowRoot}function za(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=In(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(i)}function QE(e){return["table","td","th"].includes(os(e))}function fp(e){const t=dp(),n=In(e);return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function KE(e){let t=oi(e);for(;Zn(t)&&!Ko(t);){if(fp(t))return t;t=oi(t)}return null}function dp(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Ko(e){return["html","body","#document"].includes(os(e))}function In(e){return Kt(e).getComputedStyle(e)}function Ec(e){return Jn(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function oi(e){if(os(e)==="html")return e;const t=e.assignedSlot||e.parentNode||yg(e)&&e.host||Er(e);return yg(t)?t.host:t}function P0(e){const t=oi(e);return Ko(t)?e.ownerDocument?e.ownerDocument.body:e.body:Zn(t)&&za(t)?t:P0(t)}function Ea(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=P0(e),o=i===((r=e.ownerDocument)==null?void 0:r.body),s=Kt(i);return o?t.concat(s,s.visualViewport||[],za(i)?i:[],s.frameElement&&n?Ea(s.frameElement):[]):t.concat(i,Ea(i,[],n))}function A0(e){const t=In(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=Zn(e),o=i?e.offsetWidth:n,s=i?e.offsetHeight:r,a=Eu(n)!==o||Eu(r)!==s;return a&&(n=o,r=s),{width:n,height:r,$:a}}function hp(e){return Jn(e)?e:e.contextElement}function Co(e){const t=hp(e);if(!Zn(t))return ii(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:o}=A0(t);let s=(o?Eu(n.width):n.width)/r,a=(o?Eu(n.height):n.height)/i;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const GE=ii(0);function R0(e){const t=Kt(e);return!dp()||!t.visualViewport?GE:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function XE(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Kt(e)?!1:t}function zi(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),o=hp(e);let s=ii(1);t&&(r?Jn(r)&&(s=Co(r)):s=Co(e));const a=XE(o,n,r)?R0(o):ii(0);let l=(i.left+a.x)/s.x,u=(i.top+a.y)/s.y,c=i.width/s.x,f=i.height/s.y;if(o){const d=Kt(o),h=r&&Jn(r)?Kt(r):r;let y=d,v=y.frameElement;for(;v&&r&&h!==y;){const k=Co(v),p=v.getBoundingClientRect(),m=In(v),g=p.left+(v.clientLeft+parseFloat(m.paddingLeft))*k.x,C=p.top+(v.clientTop+parseFloat(m.paddingTop))*k.y;l*=k.x,u*=k.y,c*=k.x,f*=k.y,l+=g,u+=C,y=Kt(v),v=y.frameElement}}return Cu({width:c,height:f,x:l,y:u})}const YE=[":popover-open",":modal"];function pp(e){return YE.some(t=>{try{return e.matches(t)}catch{return!1}})}function JE(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const o=i==="fixed",s=Er(r),a=t?pp(t.floating):!1;if(r===s||a&&o)return n;let l={scrollLeft:0,scrollTop:0},u=ii(1);const c=ii(0),f=Zn(r);if((f||!f&&!o)&&((os(r)!=="body"||za(s))&&(l=Ec(r)),Zn(r))){const d=zi(r);u=Co(r),c.x=d.x+r.clientLeft,c.y=d.y+r.clientTop}return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-l.scrollLeft*u.x+c.x,y:n.y*u.y-l.scrollTop*u.y+c.y}}function ZE(e){return Array.from(e.getClientRects())}function T0(e){return zi(Er(e)).left+Ec(e).scrollLeft}function ek(e){const t=Er(e),n=Ec(e),r=e.ownerDocument.body,i=Vt(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),o=Vt(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+T0(e);const a=-n.scrollTop;return In(r).direction==="rtl"&&(s+=Vt(t.clientWidth,r.clientWidth)-i),{width:i,height:o,x:s,y:a}}function tk(e,t){const n=Kt(e),r=Er(e),i=n.visualViewport;let o=r.clientWidth,s=r.clientHeight,a=0,l=0;if(i){o=i.width,s=i.height;const u=dp();(!u||u&&t==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}return{width:o,height:s,x:a,y:l}}function nk(e,t){const n=zi(e,!0,t==="fixed"),r=n.top+e.clientTop,i=n.left+e.clientLeft,o=Zn(e)?Co(e):ii(1),s=e.clientWidth*o.x,a=e.clientHeight*o.y,l=i*o.x,u=r*o.y;return{width:s,height:a,x:l,y:u}}function vg(e,t,n){let r;if(t==="viewport")r=tk(e,n);else if(t==="document")r=ek(Er(e));else if(Jn(t))r=nk(t,n);else{const i=R0(e);r={...t,x:t.x-i.x,y:t.y-i.y}}return Cu(r)}function O0(e,t){const n=oi(e);return n===t||!Jn(n)||Ko(n)?!1:In(n).position==="fixed"||O0(n,t)}function rk(e,t){const n=t.get(e);if(n)return n;let r=Ea(e,[],!1).filter(a=>Jn(a)&&os(a)!=="body"),i=null;const o=In(e).position==="fixed";let s=o?oi(e):e;for(;Jn(s)&&!Ko(s);){const a=In(s),l=fp(s);!l&&a.position==="fixed"&&(i=null),(o?!l&&!i:!l&&a.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||za(s)&&!l&&O0(e,s))?r=r.filter(c=>c!==s):i=a,s=oi(s)}return t.set(e,r),r}function ik(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const s=[...n==="clippingAncestors"?pp(t)?[]:rk(t,this._c):[].concat(n),r],a=s[0],l=s.reduce((u,c)=>{const f=vg(t,c,i);return u.top=Vt(f.top,u.top),u.right=ri(f.right,u.right),u.bottom=ri(f.bottom,u.bottom),u.left=Vt(f.left,u.left),u},vg(t,a,i));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function ok(e){const{width:t,height:n}=A0(e);return{width:t,height:n}}function sk(e,t,n){const r=Zn(t),i=Er(t),o=n==="fixed",s=zi(e,!0,o,t);let a={scrollLeft:0,scrollTop:0};const l=ii(0);if(r||!r&&!o)if((os(t)!=="body"||za(i))&&(a=Ec(t)),r){const f=zi(t,!0,o,t);l.x=f.x+t.clientLeft,l.y=f.y+t.clientTop}else i&&(l.x=T0(i));const u=s.left+a.scrollLeft-l.x,c=s.top+a.scrollTop-l.y;return{x:u,y:c,width:s.width,height:s.height}}function df(e){return In(e).position==="static"}function wg(e,t){return!Zn(e)||In(e).position==="fixed"?null:t?t(e):e.offsetParent}function I0(e,t){const n=Kt(e);if(pp(e))return n;if(!Zn(e)){let i=oi(e);for(;i&&!Ko(i);){if(Jn(i)&&!df(i))return i;i=oi(i)}return n}let r=wg(e,t);for(;r&&QE(r)&&df(r);)r=wg(r,t);return r&&Ko(r)&&df(r)&&!fp(r)?n:r||KE(e)||n}const ak=async function(e){const t=this.getOffsetParent||I0,n=this.getDimensions,r=await n(e.floating);return{reference:sk(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function lk(e){return In(e).direction==="rtl"}const uk={convertOffsetParentRelativeRectToViewportRelativeRect:JE,getDocumentElement:Er,getClippingRect:ik,getOffsetParent:I0,getElementRects:ak,getClientRects:ZE,getDimensions:ok,getScale:Co,isElement:Jn,isRTL:lk};function ck(e,t){let n=null,r;const i=Er(e);function o(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function s(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),o();const{left:u,top:c,width:f,height:d}=e.getBoundingClientRect();if(a||t(),!f||!d)return;const h=hl(c),y=hl(i.clientWidth-(u+f)),v=hl(i.clientHeight-(c+d)),k=hl(u),m={rootMargin:-h+"px "+-y+"px "+-v+"px "+-k+"px",threshold:Vt(0,ri(1,l))||1};let g=!0;function C(P){const E=P[0].intersectionRatio;if(E!==l){if(!g)return s();E?s(!1,E):r=setTimeout(()=>{s(!1,1e-7)},1e3)}g=!1}try{n=new IntersectionObserver(C,{...m,root:i.ownerDocument})}catch{n=new IntersectionObserver(C,m)}n.observe(e)}return s(!0),o}function fk(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:o=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,u=hp(e),c=i||o?[...u?Ea(u):[],...Ea(t)]:[];c.forEach(p=>{i&&p.addEventListener("scroll",n,{passive:!0}),o&&p.addEventListener("resize",n)});const f=u&&a?ck(u,n):null;let d=-1,h=null;s&&(h=new ResizeObserver(p=>{let[m]=p;m&&m.target===u&&h&&(h.unobserve(t),cancelAnimationFrame(d),d=requestAnimationFrame(()=>{var g;(g=h)==null||g.observe(t)})),n()}),u&&!l&&h.observe(u),h.observe(t));let y,v=l?zi(e):null;l&&k();function k(){const p=zi(e);v&&(p.x!==v.x||p.y!==v.y||p.width!==v.width||p.height!==v.height)&&n(),v=p,y=requestAnimationFrame(k)}return n(),()=>{var p;c.forEach(m=>{i&&m.removeEventListener("scroll",n),o&&m.removeEventListener("resize",n)}),f==null||f(),(p=h)==null||p.disconnect(),h=null,l&&cancelAnimationFrame(y)}}const dk=HE,hk=VE,pk=jE,mk=qE,gk=BE,xg=zE,yk=WE,vk=(e,t,n)=>{const r=new Map,i={platform:uk,...n},o={...i.platform,_c:r};return NE(e,t,{...i,platform:o})};var Fl=typeof document<"u"?x.useLayoutEffect:x.useEffect;function _u(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!_u(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){const o=i[r];if(!(o==="_owner"&&e.$$typeof)&&!_u(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function M0(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Sg(e,t){const n=M0(e);return Math.round(t*n)/n}function bg(e){const t=x.useRef(e);return Fl(()=>{t.current=e}),t}function wk(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:o,floating:s}={},transform:a=!0,whileElementsMounted:l,open:u}=e,[c,f]=x.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[d,h]=x.useState(r);_u(d,r)||h(r);const[y,v]=x.useState(null),[k,p]=x.useState(null),m=x.useCallback(B=>{B!==E.current&&(E.current=B,v(B))},[]),g=x.useCallback(B=>{B!==w.current&&(w.current=B,p(B))},[]),C=o||y,P=s||k,E=x.useRef(null),w=x.useRef(null),S=x.useRef(c),A=l!=null,O=bg(l),I=bg(i),R=x.useCallback(()=>{if(!E.current||!w.current)return;const B={placement:t,strategy:n,middleware:d};I.current&&(B.platform=I.current),vk(E.current,w.current,B).then($=>{const W={...$,isPositioned:!0};D.current&&!_u(S.current,W)&&(S.current=W,es.flushSync(()=>{f(W)}))})},[d,t,n,I]);Fl(()=>{u===!1&&S.current.isPositioned&&(S.current.isPositioned=!1,f(B=>({...B,isPositioned:!1})))},[u]);const D=x.useRef(!1);Fl(()=>(D.current=!0,()=>{D.current=!1}),[]),Fl(()=>{if(C&&(E.current=C),P&&(w.current=P),C&&P){if(O.current)return O.current(C,P,R);R()}},[C,P,R,O,A]);const F=x.useMemo(()=>({reference:E,floating:w,setReference:m,setFloating:g}),[m,g]),z=x.useMemo(()=>({reference:C,floating:P}),[C,P]),q=x.useMemo(()=>{const B={position:n,left:0,top:0};if(!z.floating)return B;const $=Sg(z.floating,c.x),W=Sg(z.floating,c.y);return a?{...B,transform:"translate("+$+"px, "+W+"px)",...M0(z.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:$,top:W}},[n,a,z.floating,c.x,c.y]);return x.useMemo(()=>({...c,update:R,refs:F,elements:z,floatingStyles:q}),[c,R,F,z,q])}const xk=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:i}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?xg({element:r.current,padding:i}).fn(n):{}:r?xg({element:r,padding:i}).fn(n):{}}}},Sk=(e,t)=>({...dk(e),options:[e,t]}),bk=(e,t)=>({...hk(e),options:[e,t]}),Ek=(e,t)=>({...yk(e),options:[e,t]}),kk=(e,t)=>({...pk(e),options:[e,t]}),Ck=(e,t)=>({...mk(e),options:[e,t]}),_k=(e,t)=>({...gk(e),options:[e,t]}),Pk=(e,t)=>({...xk(e),options:[e,t]}),Ak=x.forwardRef((e,t)=>{const{children:n,width:r=10,height:i=5,...o}=e;return x.createElement(ts.svg,st({},o,{ref:t,width:r,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none"}),e.asChild?n:x.createElement("polygon",{points:"0,0 30,0 15,10"}))}),Rk=Ak;function Tk(e){const[t,n]=x.useState(void 0);return Qo(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const o=i[0];let s,a;if("borderBoxSize"in o){const l=o.borderBoxSize,u=Array.isArray(l)?l[0]:l;s=u.inlineSize,a=u.blockSize}else s=e.offsetWidth,a=e.offsetHeight;n({width:s,height:a})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}const $0="Popper",[F0,D0]=xv($0),[Ok,L0]=F0($0),Ik=e=>{const{__scopePopper:t,children:n}=e,[r,i]=x.useState(null);return x.createElement(Ok,{scope:t,anchor:r,onAnchorChange:i},n)},Mk="PopperAnchor",$k=x.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...i}=e,o=L0(Mk,n),s=x.useRef(null),a=Yo(t,s);return x.useEffect(()=>{o.onAnchorChange((r==null?void 0:r.current)||s.current)}),r?null:x.createElement(ts.div,st({},i,{ref:a}))}),N0="PopperContent",[Fk,Dk]=F0(N0),Lk=x.forwardRef((e,t)=>{var n,r,i,o,s,a,l,u;const{__scopePopper:c,side:f="bottom",sideOffset:d=0,align:h="center",alignOffset:y=0,arrowPadding:v=0,avoidCollisions:k=!0,collisionBoundary:p=[],collisionPadding:m=0,sticky:g="partial",hideWhenDetached:C=!1,updatePositionStrategy:P="optimized",onPlaced:E,...w}=e,S=L0(N0,c),[A,O]=x.useState(null),I=Yo(t,Dn=>O(Dn)),[R,D]=x.useState(null),F=Tk(R),z=(n=F==null?void 0:F.width)!==null&&n!==void 0?n:0,q=(r=F==null?void 0:F.height)!==null&&r!==void 0?r:0,B=f+(h!=="center"?"-"+h:""),$=typeof m=="number"?m:{top:0,right:0,bottom:0,left:0,...m},W=Array.isArray(p)?p:[p],b=W.length>0,J={padding:$,boundary:W.filter(Bk),altBoundary:b},{refs:ne,floatingStyles:_,placement:Se,isPositioned:Ee,middlewareData:le}=wk({strategy:"fixed",placement:B,whileElementsMounted:(...Dn)=>fk(...Dn,{animationFrame:P==="always"}),elements:{reference:S.anchor},middleware:[Sk({mainAxis:d+q,alignmentAxis:y}),k&&bk({mainAxis:!0,crossAxis:!1,limiter:g==="partial"?Ek():void 0,...J}),k&&kk({...J}),Ck({...J,apply:({elements:Dn,rects:Nt,availableWidth:ls,availableHeight:qi})=>{const{width:Qi,height:us}=Nt.reference,Cr=Dn.floating.style;Cr.setProperty("--radix-popper-available-width",`${ls}px`),Cr.setProperty("--radix-popper-available-height",`${qi}px`),Cr.setProperty("--radix-popper-anchor-width",`${Qi}px`),Cr.setProperty("--radix-popper-anchor-height",`${us}px`)}}),R&&Pk({element:R,padding:v}),Uk({arrowWidth:z,arrowHeight:q}),C&&_k({strategy:"referenceHidden",...J})]}),[je,Pt]=z0(Se),Lt=ns(E);Qo(()=>{Ee&&(Lt==null||Lt())},[Ee,Lt]);const mn=(i=le.arrow)===null||i===void 0?void 0:i.x,pi=(o=le.arrow)===null||o===void 0?void 0:o.y,Ze=((s=le.arrow)===null||s===void 0?void 0:s.centerOffset)!==0,[rr,mi]=x.useState();return Qo(()=>{A&&mi(window.getComputedStyle(A).zIndex)},[A]),x.createElement("div",{ref:ne.setFloating,"data-radix-popper-content-wrapper":"",style:{..._,transform:Ee?_.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:rr,"--radix-popper-transform-origin":[(a=le.transformOrigin)===null||a===void 0?void 0:a.x,(l=le.transformOrigin)===null||l===void 0?void 0:l.y].join(" ")},dir:e.dir},x.createElement(Fk,{scope:c,placedSide:je,onArrowChange:D,arrowX:mn,arrowY:pi,shouldHideArrow:Ze},x.createElement(ts.div,st({"data-side":je,"data-align":Pt},w,{ref:I,style:{...w.style,animation:Ee?void 0:"none",opacity:(u=le.hide)!==null&&u!==void 0&&u.referenceHidden?0:void 0}}))))}),Nk="PopperArrow",zk={top:"bottom",right:"left",bottom:"top",left:"right"},jk=x.forwardRef(function(t,n){const{__scopePopper:r,...i}=t,o=Dk(Nk,r),s=zk[o.placedSide];return x.createElement("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[s]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[o.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[o.placedSide],visibility:o.shouldHideArrow?"hidden":void 0}},x.createElement(Rk,st({},i,{ref:n,style:{...i.style,display:"block"}})))});function Bk(e){return e!==null}const Uk=e=>({name:"transformOrigin",options:e,fn(t){var n,r,i,o,s;const{placement:a,rects:l,middlewareData:u}=t,f=((n=u.arrow)===null||n===void 0?void 0:n.centerOffset)!==0,d=f?0:e.arrowWidth,h=f?0:e.arrowHeight,[y,v]=z0(a),k={start:"0%",center:"50%",end:"100%"}[v],p=((r=(i=u.arrow)===null||i===void 0?void 0:i.x)!==null&&r!==void 0?r:0)+d/2,m=((o=(s=u.arrow)===null||s===void 0?void 0:s.y)!==null&&o!==void 0?o:0)+h/2;let g="",C="";return y==="bottom"?(g=f?k:`${p}px`,C=`${-h}px`):y==="top"?(g=f?k:`${p}px`,C=`${l.floating.height+h}px`):y==="right"?(g=`${-h}px`,C=f?k:`${m}px`):y==="left"&&(g=`${l.floating.width+h}px`,C=f?k:`${m}px`),{data:{x:g,y:C}}}});function z0(e){const[t,n="center"]=e.split("-");return[t,n]}const Hk=Ik,Vk=$k,Wk=Lk,tM=jk;function qk(e,t){return x.useReducer((n,r)=>{const i=t[n][r];return i??n},e)}const j0=e=>{const{present:t,children:n}=e,r=Qk(t),i=typeof n=="function"?n({present:r.isPresent}):x.Children.only(n),o=Yo(r.ref,i.ref);return typeof n=="function"||r.isPresent?x.cloneElement(i,{ref:o}):null};j0.displayName="Presence";function Qk(e){const[t,n]=x.useState(),r=x.useRef({}),i=x.useRef(e),o=x.useRef("none"),s=e?"mounted":"unmounted",[a,l]=qk(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return x.useEffect(()=>{const u=pl(r.current);o.current=a==="mounted"?u:"none"},[a]),Qo(()=>{const u=r.current,c=i.current;if(c!==e){const d=o.current,h=pl(u);e?l("MOUNT"):h==="none"||(u==null?void 0:u.display)==="none"?l("UNMOUNT"):l(c&&d!==h?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,l]),Qo(()=>{if(t){const u=f=>{const h=pl(r.current).includes(f.animationName);f.target===t&&h&&es.flushSync(()=>l("ANIMATION_END"))},c=f=>{f.target===t&&(o.current=pl(r.current))};return t.addEventListener("animationstart",c),t.addEventListener("animationcancel",u),t.addEventListener("animationend",u),()=>{t.removeEventListener("animationstart",c),t.removeEventListener("animationcancel",u),t.removeEventListener("animationend",u)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:x.useCallback(u=>{u&&(r.current=getComputedStyle(u)),n(u)},[])}}function pl(e){return(e==null?void 0:e.animationName)||"none"}function Kk({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,i]=Gk({defaultProp:t,onChange:n}),o=e!==void 0,s=o?e:r,a=ns(n),l=x.useCallback(u=>{if(o){const f=typeof u=="function"?u(e):u;f!==e&&a(f)}else i(u)},[o,e,i,a]);return[s,l]}function Gk({defaultProp:e,onChange:t}){const n=x.useState(e),[r]=n,i=x.useRef(r),o=ns(t);return x.useEffect(()=>{i.current!==r&&(o(r),i.current=r)},[r,i,o]),n}const Xk=x.forwardRef((e,t)=>x.createElement(ts.span,st({},e,{ref:t,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...e.style}}))),Yk=Xk,[kc,nM]=xv("Tooltip",[D0]),mp=D0(),Jk="TooltipProvider",Zk=700,Dd="tooltip.open",[eC,gp]=kc(Jk),tC=e=>{const{__scopeTooltip:t,delayDuration:n=Zk,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:o}=e,[s,a]=x.useState(!0),l=x.useRef(!1),u=x.useRef(0);return x.useEffect(()=>{const c=u.current;return()=>window.clearTimeout(c)},[]),x.createElement(eC,{scope:t,isOpenDelayed:s,delayDuration:n,onOpen:x.useCallback(()=>{window.clearTimeout(u.current),a(!1)},[]),onClose:x.useCallback(()=>{window.clearTimeout(u.current),u.current=window.setTimeout(()=>a(!0),r)},[r]),isPointerInTransitRef:l,onPointerInTransitChange:x.useCallback(c=>{l.current=c},[]),disableHoverableContent:i},o)},yp="Tooltip",[nC,Cc]=kc(yp),rC=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:i=!1,onOpenChange:o,disableHoverableContent:s,delayDuration:a}=e,l=gp(yp,e.__scopeTooltip),u=mp(t),[c,f]=x.useState(null),d=RE(),h=x.useRef(0),y=s??l.disableHoverableContent,v=a??l.delayDuration,k=x.useRef(!1),[p=!1,m]=Kk({prop:r,defaultProp:i,onChange:w=>{w?(l.onOpen(),document.dispatchEvent(new CustomEvent(Dd))):l.onClose(),o==null||o(w)}}),g=x.useMemo(()=>p?k.current?"delayed-open":"instant-open":"closed",[p]),C=x.useCallback(()=>{window.clearTimeout(h.current),k.current=!1,m(!0)},[m]),P=x.useCallback(()=>{window.clearTimeout(h.current),m(!1)},[m]),E=x.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>{k.current=!0,m(!0)},v)},[v,m]);return x.useEffect(()=>()=>window.clearTimeout(h.current),[]),x.createElement(Hk,u,x.createElement(nC,{scope:t,contentId:d,open:p,stateAttribute:g,trigger:c,onTriggerChange:f,onTriggerEnter:x.useCallback(()=>{l.isOpenDelayed?E():C()},[l.isOpenDelayed,E,C]),onTriggerLeave:x.useCallback(()=>{y?P():window.clearTimeout(h.current)},[P,y]),onOpen:C,onClose:P,disableHoverableContent:y},n))},Eg="TooltipTrigger",iC=x.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,i=Cc(Eg,n),o=gp(Eg,n),s=mp(n),a=x.useRef(null),l=Yo(t,a,i.onTriggerChange),u=x.useRef(!1),c=x.useRef(!1),f=x.useCallback(()=>u.current=!1,[]);return x.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),x.createElement(Vk,st({asChild:!0},s),x.createElement(ts.button,st({"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute},r,{ref:l,onPointerMove:cr(e.onPointerMove,d=>{d.pointerType!=="touch"&&!c.current&&!o.isPointerInTransitRef.current&&(i.onTriggerEnter(),c.current=!0)}),onPointerLeave:cr(e.onPointerLeave,()=>{i.onTriggerLeave(),c.current=!1}),onPointerDown:cr(e.onPointerDown,()=>{u.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:cr(e.onFocus,()=>{u.current||i.onOpen()}),onBlur:cr(e.onBlur,i.onClose),onClick:cr(e.onClick,i.onClose)})))}),oC="TooltipPortal",[rM,sC]=kc(oC,{forceMount:void 0}),ka="TooltipContent",aC=x.forwardRef((e,t)=>{const n=sC(ka,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i="top",...o}=e,s=Cc(ka,e.__scopeTooltip);return x.createElement(j0,{present:r||s.open},s.disableHoverableContent?x.createElement(B0,st({side:i},o,{ref:t})):x.createElement(lC,st({side:i},o,{ref:t})))}),lC=x.forwardRef((e,t)=>{const n=Cc(ka,e.__scopeTooltip),r=gp(ka,e.__scopeTooltip),i=x.useRef(null),o=Yo(t,i),[s,a]=x.useState(null),{trigger:l,onClose:u}=n,c=i.current,{onPointerInTransitChange:f}=r,d=x.useCallback(()=>{a(null),f(!1)},[f]),h=x.useCallback((y,v)=>{const k=y.currentTarget,p={x:y.clientX,y:y.clientY},m=cC(p,k.getBoundingClientRect()),g=fC(p,m),C=dC(v.getBoundingClientRect()),P=pC([...g,...C]);a(P),f(!0)},[f]);return x.useEffect(()=>()=>d(),[d]),x.useEffect(()=>{if(l&&c){const y=k=>h(k,c),v=k=>h(k,l);return l.addEventListener("pointerleave",y),c.addEventListener("pointerleave",v),()=>{l.removeEventListener("pointerleave",y),c.removeEventListener("pointerleave",v)}}},[l,c,h,d]),x.useEffect(()=>{if(s){const y=v=>{const k=v.target,p={x:v.clientX,y:v.clientY},m=(l==null?void 0:l.contains(k))||(c==null?void 0:c.contains(k)),g=!hC(p,s);m?d():g&&(d(),u())};return document.addEventListener("pointermove",y),()=>document.removeEventListener("pointermove",y)}},[l,c,s,u,d]),x.createElement(B0,st({},e,{ref:o}))}),[uC,iM]=kc(yp,{isInside:!1}),B0=x.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:o,onPointerDownOutside:s,...a}=e,l=Cc(ka,n),u=mp(n),{onClose:c}=l;return x.useEffect(()=>(document.addEventListener(Dd,c),()=>document.removeEventListener(Dd,c)),[c]),x.useEffect(()=>{if(l.trigger){const f=d=>{const h=d.target;h!=null&&h.contains(l.trigger)&&c()};return window.addEventListener("scroll",f,{capture:!0}),()=>window.removeEventListener("scroll",f,{capture:!0})}},[l.trigger,c]),x.createElement(kE,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:f=>f.preventDefault(),onDismiss:c},x.createElement(Wk,st({"data-state":l.stateAttribute},u,a,{ref:t,style:{...a.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"}}),x.createElement(E0,null,r),x.createElement(uC,{scope:n,isInside:!0},x.createElement(Yk,{id:l.contentId,role:"tooltip"},i||r))))});function cC(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),o=Math.abs(t.left-e.x);switch(Math.min(n,r,i,o)){case o:return"left";case i:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function fC(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function dC(e){const{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function hC(e,t){const{x:n,y:r}=e;let i=!1;for(let o=0,s=t.length-1;or!=c>r&&n<(u-a)*(r-l)/(c-l)+a&&(i=!i)}return i}function pC(e){const t=e.slice();return t.sort((n,r)=>n.xr.x?1:n.yr.y?1:0),mC(t)}function mC(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r=2;){const o=t[t.length-1],s=t[t.length-2];if((o.x-s.x)*(i.y-s.y)>=(o.y-s.y)*(i.x-s.x))t.pop();else break}t.push(i)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const i=e[r];for(;n.length>=2;){const o=n[n.length-1],s=n[n.length-2];if((o.x-s.x)*(i.y-s.y)>=(o.y-s.y)*(i.x-s.x))n.pop();else break}n.push(i)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}const gC=tC,yC=rC,vC=iC,U0=aC;function H0(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;ta(o)))==null?void 0:s.classGroupId}const kg=/^\[(.+)\]$/;function SC(e){if(kg.test(e)){const t=kg.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}}function bC(e){const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return kC(Object.entries(e.classGroups),n).forEach(([o,s])=>{Ld(s,r,o,t)}),r}function Ld(e,t,n,r){e.forEach(i=>{if(typeof i=="string"){const o=i===""?t:Cg(t,i);o.classGroupId=n;return}if(typeof i=="function"){if(EC(i)){Ld(i(r),t,n,r);return}t.validators.push({validator:i,classGroupId:n});return}Object.entries(i).forEach(([o,s])=>{Ld(s,Cg(t,o),n,r)})})}function Cg(e,t){let n=e;return t.split(vp).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n}function EC(e){return e.isThemeGetter}function kC(e,t){return t?e.map(([n,r])=>{const i=r.map(o=>typeof o=="string"?t+o:typeof o=="object"?Object.fromEntries(Object.entries(o).map(([s,a])=>[t+s,a])):o);return[n,i]}):e}function CC(e){if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;function i(o,s){n.set(o,s),t++,t>e&&(t=0,r=n,n=new Map)}return{get(o){let s=n.get(o);if(s!==void 0)return s;if((s=r.get(o))!==void 0)return i(o,s),s},set(o,s){n.has(o)?n.set(o,s):i(o,s)}}}const W0="!";function _C(e){const t=e.separator,n=t.length===1,r=t[0],i=t.length;return function(s){const a=[];let l=0,u=0,c;for(let v=0;vu?c-u:void 0;return{modifiers:a,hasImportantModifier:d,baseClassName:h,maybePostfixModifierPosition:y}}}function PC(e){if(e.length<=1)return e;const t=[];let n=[];return e.forEach(r=>{r[0]==="["?(t.push(...n.sort(),r),n=[]):n.push(r)}),t.push(...n.sort()),t}function AC(e){return{cache:CC(e.cacheSize),splitModifiers:_C(e),...xC(e)}}const RC=/\s+/;function TC(e,t){const{splitModifiers:n,getClassGroupId:r,getConflictingClassGroupIds:i}=t,o=new Set;return e.trim().split(RC).map(s=>{const{modifiers:a,hasImportantModifier:l,baseClassName:u,maybePostfixModifierPosition:c}=n(s);let f=r(c?u.substring(0,c):u),d=!!c;if(!f){if(!c)return{isTailwindClass:!1,originalClassName:s};if(f=r(u),!f)return{isTailwindClass:!1,originalClassName:s};d=!1}const h=PC(a).join(":");return{isTailwindClass:!0,modifierId:l?h+W0:h,classGroupId:f,originalClassName:s,hasPostfixModifier:d}}).reverse().filter(s=>{if(!s.isTailwindClass)return!0;const{modifierId:a,classGroupId:l,hasPostfixModifier:u}=s,c=a+l;return o.has(c)?!1:(o.add(c),i(l,u).forEach(f=>o.add(a+f)),!0)}).reverse().map(s=>s.originalClassName).join(" ")}function OC(){let e=0,t,n,r="";for(;ef(c),e());return n=AC(u),r=n.cache.get,i=n.cache.set,o=a,a(l)}function a(l){const u=r(l);if(u)return u;const c=TC(l,n);return i(l,c),c}return function(){return o(OC.apply(null,arguments))}}function Pe(e){const t=n=>n[e]||[];return t.isThemeGetter=!0,t}const Q0=/^\[(?:([a-z-]+):)?(.+)\]$/i,MC=/^\d+\/\d+$/,$C=new Set(["px","full","screen"]),FC=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,DC=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,LC=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,NC=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,zC=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/;function or(e){return ki(e)||$C.has(e)||MC.test(e)}function Tr(e){return ss(e,"length",QC)}function ki(e){return!!e&&!Number.isNaN(Number(e))}function ml(e){return ss(e,"number",ki)}function xs(e){return!!e&&Number.isInteger(Number(e))}function jC(e){return e.endsWith("%")&&ki(e.slice(0,-1))}function ae(e){return Q0.test(e)}function Or(e){return FC.test(e)}const BC=new Set(["length","size","percentage"]);function UC(e){return ss(e,BC,K0)}function HC(e){return ss(e,"position",K0)}const VC=new Set(["image","url"]);function WC(e){return ss(e,VC,GC)}function qC(e){return ss(e,"",KC)}function Ss(){return!0}function ss(e,t,n){const r=Q0.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):n(r[2]):!1}function QC(e){return DC.test(e)&&!LC.test(e)}function K0(){return!1}function KC(e){return NC.test(e)}function GC(e){return zC.test(e)}function XC(){const e=Pe("colors"),t=Pe("spacing"),n=Pe("blur"),r=Pe("brightness"),i=Pe("borderColor"),o=Pe("borderRadius"),s=Pe("borderSpacing"),a=Pe("borderWidth"),l=Pe("contrast"),u=Pe("grayscale"),c=Pe("hueRotate"),f=Pe("invert"),d=Pe("gap"),h=Pe("gradientColorStops"),y=Pe("gradientColorStopPositions"),v=Pe("inset"),k=Pe("margin"),p=Pe("opacity"),m=Pe("padding"),g=Pe("saturate"),C=Pe("scale"),P=Pe("sepia"),E=Pe("skew"),w=Pe("space"),S=Pe("translate"),A=()=>["auto","contain","none"],O=()=>["auto","hidden","clip","visible","scroll"],I=()=>["auto",ae,t],R=()=>[ae,t],D=()=>["",or,Tr],F=()=>["auto",ki,ae],z=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],q=()=>["solid","dashed","dotted","double","none"],B=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],$=()=>["start","end","center","between","around","evenly","stretch"],W=()=>["","0",ae],b=()=>["auto","avoid","all","avoid-page","page","left","right","column"],J=()=>[ki,ml],ne=()=>[ki,ae];return{cacheSize:500,separator:":",theme:{colors:[Ss],spacing:[or,Tr],blur:["none","",Or,ae],brightness:J(),borderColor:[e],borderRadius:["none","","full",Or,ae],borderSpacing:R(),borderWidth:D(),contrast:J(),grayscale:W(),hueRotate:ne(),invert:W(),gap:R(),gradientColorStops:[e],gradientColorStopPositions:[jC,Tr],inset:I(),margin:I(),opacity:J(),padding:R(),saturate:J(),scale:J(),sepia:W(),skew:ne(),space:R(),translate:R()},classGroups:{aspect:[{aspect:["auto","square","video",ae]}],container:["container"],columns:[{columns:[Or]}],"break-after":[{"break-after":b()}],"break-before":[{"break-before":b()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...z(),ae]}],overflow:[{overflow:O()}],"overflow-x":[{"overflow-x":O()}],"overflow-y":[{"overflow-y":O()}],overscroll:[{overscroll:A()}],"overscroll-x":[{"overscroll-x":A()}],"overscroll-y":[{"overscroll-y":A()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[v]}],"inset-x":[{"inset-x":[v]}],"inset-y":[{"inset-y":[v]}],start:[{start:[v]}],end:[{end:[v]}],top:[{top:[v]}],right:[{right:[v]}],bottom:[{bottom:[v]}],left:[{left:[v]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",xs,ae]}],basis:[{basis:I()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",ae]}],grow:[{grow:W()}],shrink:[{shrink:W()}],order:[{order:["first","last","none",xs,ae]}],"grid-cols":[{"grid-cols":[Ss]}],"col-start-end":[{col:["auto",{span:["full",xs,ae]},ae]}],"col-start":[{"col-start":F()}],"col-end":[{"col-end":F()}],"grid-rows":[{"grid-rows":[Ss]}],"row-start-end":[{row:["auto",{span:[xs,ae]},ae]}],"row-start":[{"row-start":F()}],"row-end":[{"row-end":F()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",ae]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",ae]}],gap:[{gap:[d]}],"gap-x":[{"gap-x":[d]}],"gap-y":[{"gap-y":[d]}],"justify-content":[{justify:["normal",...$()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...$(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...$(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[m]}],px:[{px:[m]}],py:[{py:[m]}],ps:[{ps:[m]}],pe:[{pe:[m]}],pt:[{pt:[m]}],pr:[{pr:[m]}],pb:[{pb:[m]}],pl:[{pl:[m]}],m:[{m:[k]}],mx:[{mx:[k]}],my:[{my:[k]}],ms:[{ms:[k]}],me:[{me:[k]}],mt:[{mt:[k]}],mr:[{mr:[k]}],mb:[{mb:[k]}],ml:[{ml:[k]}],"space-x":[{"space-x":[w]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[w]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",ae,t]}],"min-w":[{"min-w":[ae,t,"min","max","fit"]}],"max-w":[{"max-w":[ae,t,"none","full","min","max","fit","prose",{screen:[Or]},Or]}],h:[{h:[ae,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[ae,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[ae,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[ae,t,"auto","min","max","fit"]}],"font-size":[{text:["base",Or,Tr]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",ml]}],"font-family":[{font:[Ss]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractons"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",ae]}],"line-clamp":[{"line-clamp":["none",ki,ml]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",or,ae]}],"list-image":[{"list-image":["none",ae]}],"list-style-type":[{list:["none","disc","decimal",ae]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[p]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[p]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...q(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",or,Tr]}],"underline-offset":[{"underline-offset":["auto",or,ae]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:R()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ae]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",ae]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[p]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...z(),HC]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",UC]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},WC]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[y]}],"gradient-via-pos":[{via:[y]}],"gradient-to-pos":[{to:[y]}],"gradient-from":[{from:[h]}],"gradient-via":[{via:[h]}],"gradient-to":[{to:[h]}],rounded:[{rounded:[o]}],"rounded-s":[{"rounded-s":[o]}],"rounded-e":[{"rounded-e":[o]}],"rounded-t":[{"rounded-t":[o]}],"rounded-r":[{"rounded-r":[o]}],"rounded-b":[{"rounded-b":[o]}],"rounded-l":[{"rounded-l":[o]}],"rounded-ss":[{"rounded-ss":[o]}],"rounded-se":[{"rounded-se":[o]}],"rounded-ee":[{"rounded-ee":[o]}],"rounded-es":[{"rounded-es":[o]}],"rounded-tl":[{"rounded-tl":[o]}],"rounded-tr":[{"rounded-tr":[o]}],"rounded-br":[{"rounded-br":[o]}],"rounded-bl":[{"rounded-bl":[o]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[p]}],"border-style":[{border:[...q(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[p]}],"divide-style":[{divide:q()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...q()]}],"outline-offset":[{"outline-offset":[or,ae]}],"outline-w":[{outline:[or,Tr]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:D()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[p]}],"ring-offset-w":[{"ring-offset":[or,Tr]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",Or,qC]}],"shadow-color":[{shadow:[Ss]}],opacity:[{opacity:[p]}],"mix-blend":[{"mix-blend":[...B(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":B()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",Or,ae]}],grayscale:[{grayscale:[u]}],"hue-rotate":[{"hue-rotate":[c]}],invert:[{invert:[f]}],saturate:[{saturate:[g]}],sepia:[{sepia:[P]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[u]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[c]}],"backdrop-invert":[{"backdrop-invert":[f]}],"backdrop-opacity":[{"backdrop-opacity":[p]}],"backdrop-saturate":[{"backdrop-saturate":[g]}],"backdrop-sepia":[{"backdrop-sepia":[P]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[s]}],"border-spacing-x":[{"border-spacing-x":[s]}],"border-spacing-y":[{"border-spacing-y":[s]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",ae]}],duration:[{duration:ne()}],ease:[{ease:["linear","in","out","in-out",ae]}],delay:[{delay:ne()}],animate:[{animate:["none","spin","ping","pulse","bounce",ae]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[C]}],"scale-x":[{"scale-x":[C]}],"scale-y":[{"scale-y":[C]}],rotate:[{rotate:[xs,ae]}],"translate-x":[{"translate-x":[S]}],"translate-y":[{"translate-y":[S]}],"skew-x":[{"skew-x":[E]}],"skew-y":[{"skew-y":[E]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",ae]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",ae]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":R()}],"scroll-mx":[{"scroll-mx":R()}],"scroll-my":[{"scroll-my":R()}],"scroll-ms":[{"scroll-ms":R()}],"scroll-me":[{"scroll-me":R()}],"scroll-mt":[{"scroll-mt":R()}],"scroll-mr":[{"scroll-mr":R()}],"scroll-mb":[{"scroll-mb":R()}],"scroll-ml":[{"scroll-ml":R()}],"scroll-p":[{"scroll-p":R()}],"scroll-px":[{"scroll-px":R()}],"scroll-py":[{"scroll-py":R()}],"scroll-ps":[{"scroll-ps":R()}],"scroll-pe":[{"scroll-pe":R()}],"scroll-pt":[{"scroll-pt":R()}],"scroll-pr":[{"scroll-pr":R()}],"scroll-pb":[{"scroll-pb":R()}],"scroll-pl":[{"scroll-pl":R()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",ae]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[or,Tr,ml]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}}const YC=IC(XC);globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};function JC(...e){return YC(wC(e))}async function oM(e){const t=new TextEncoder().encode(e),n=await crypto.subtle.digest("SHA-256",t);return[...new Uint8Array(n)].map(o=>o.toString(16).padStart(2,"0")).join("")}function sM(e){let t=e==="html"?".html":".js",n=e==="html"?"text/html":"application/javascript";return e==="streamlit"&&(t=".py",n="text/python"),[t,n]}function aM(e,t,n){const r=new Blob([e],{type:t}),i=URL.createObjectURL(r),o=document.createElement("a");o.href=i,o.download=n,document.body.append(o),o.click(),o.remove(),URL.revokeObjectURL(i)}async function lM(e,t){const n=new Image,r=new Promise((i,o)=>{n.addEventListener("load",()=>{let{width:s,height:a}=n;(s>t||a>t)&&(s>a?(a*=t/s,s=t):(s*=t/a,a=t));const l=document.querySelector("#resizer"),u=l.getContext("2d");l.width=s,l.height=a,u.drawImage(n,0,0,s,a);const c=l.toDataURL("image/jpeg");i({url:c,width:s,height:a,createdAt:new Date})}),n.addEventListener("error",s=>{o(new Error(`Failed to resize image: ${s.message}`))})});return n.src=e,r}const uM=580;globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};const ZC=gC,cM=yC,fM=vC,e_=x.forwardRef(({className:e,sideOffset:t=4,...n},r)=>ke.jsx(U0,{ref:r,sideOffset:t,className:JC("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 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",e),...n}));e_.displayName=U0.displayName;globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};const t_=500;function dM(e,t=t_){const[n,r]=vo.useState(e),i=vo.useRef(null);return vo.useEffect(()=>{const o=Date.now();if(i.current&&o>=i.current+t)i.current=o,r(e);else{const s=window.setTimeout(()=>{i.current=o,r(e)},t);return()=>window.clearTimeout(s)}return()=>{}},[e,t]),n}function n_(e){const[t,n]=x.useState(()=>matchMedia(e).matches);return x.useLayoutEffect(()=>{const r=matchMedia(e);function i(){n(r.matches)}return r.addEventListener("change",i),()=>{r.removeEventListener("change",i)}},[e]),t}function r_(){const[e,t]=x.useState(()=>window.location.hash),n=x.useCallback(()=>{t(window.location.hash)},[]);x.useEffect(()=>(window.addEventListener("hashchange",n),()=>{window.removeEventListener("hashchange",n)}),[n]);const r=x.useCallback(i=>{i!==e&&(window.location.hash=i)},[e]);return[e,r]}function hM(e){const[t,n]=r_(),r=x.useCallback(o=>o<0?n(""):n(`#v${o}`),[n]),i=x.useMemo(()=>t.includes("#v")?Math.min(Number.parseInt(t.replace("#v",""),10),e.latestVersion):e.latestVersion,[t,e.latestVersion]);return x.useEffect(()=>{i>e.latestVersion&&r(e.latestVersion)},[i,e.latestVersion,r]),[i,r]}/** - * @remix-run/router v1.16.1 - * - * Copyright (c) Remix Software Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */function $e(){return $e=Object.assign?Object.assign.bind():function(e){for(var t=1;t"u")throw new Error(t)}function Go(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function o_(){return Math.random().toString(36).substr(2,8)}function Pg(e,t){return{usr:e.state,key:e.key,idx:t}}function Ca(e,t,n,r){return n===void 0&&(n=null),$e({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?fi(t):t,{state:n,key:t&&t.key||r||o_()})}function si(e){let{pathname:t="/",search:n="",hash:r=""}=e;return n&&n!=="?"&&(t+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(t+=r.charAt(0)==="#"?r:"#"+r),t}function fi(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}function s_(e,t,n,r){r===void 0&&(r={});let{window:i=document.defaultView,v5Compat:o=!1}=r,s=i.history,a=Ue.Pop,l=null,u=c();u==null&&(u=0,s.replaceState($e({},s.state,{idx:u}),""));function c(){return(s.state||{idx:null}).idx}function f(){a=Ue.Pop;let k=c(),p=k==null?null:k-u;u=k,l&&l({action:a,location:v.location,delta:p})}function d(k,p){a=Ue.Push;let m=Ca(v.location,k,p);u=c()+1;let g=Pg(m,u),C=v.createHref(m);try{s.pushState(g,"",C)}catch(P){if(P instanceof DOMException&&P.name==="DataCloneError")throw P;i.location.assign(C)}o&&l&&l({action:a,location:v.location,delta:1})}function h(k,p){a=Ue.Replace;let m=Ca(v.location,k,p);u=c();let g=Pg(m,u),C=v.createHref(m);s.replaceState(g,"",C),o&&l&&l({action:a,location:v.location,delta:0})}function y(k){let p=i.location.origin!=="null"?i.location.origin:i.location.href,m=typeof k=="string"?k:si(k);return m=m.replace(/ $/,"%20"),ie(p,"No window.location.(origin|href) available to create URL for href: "+m),new URL(m,p)}let v={get action(){return a},get location(){return e(i,s)},listen(k){if(l)throw new Error("A history only accepts one active listener");return i.addEventListener(_g,f),l=k,()=>{i.removeEventListener(_g,f),l=null}},createHref(k){return t(i,k)},createURL:y,encodeLocation(k){let p=y(k);return{pathname:p.pathname,search:p.search,hash:p.hash}},push:d,replace:h,go(k){return s.go(k)}};return v}var Oe;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(Oe||(Oe={}));const a_=new Set(["lazy","caseSensitive","path","id","index","children"]);function l_(e){return e.index===!0}function Nd(e,t,n,r){return n===void 0&&(n=[]),r===void 0&&(r={}),e.map((i,o)=>{let s=[...n,o],a=typeof i.id=="string"?i.id:s.join("-");if(ie(i.index!==!0||!i.children,"Cannot specify children on an index route"),ie(!r[a],'Found a route id collision on id "'+a+`". Route id's must be globally unique within Data Router usages`),l_(i)){let l=$e({},i,t(i),{id:a});return r[a]=l,l}else{let l=$e({},i,t(i),{id:a,children:void 0});return r[a]=l,i.children&&(l.children=Nd(i.children,t,s,r)),l}})}function go(e,t,n){n===void 0&&(n="/");let r=typeof t=="string"?fi(t):t,i=ai(r.pathname||"/",n);if(i==null)return null;let o=G0(e);c_(o);let s=null;for(let a=0;s==null&&a{let l={relativePath:a===void 0?o.path||"":a,caseSensitive:o.caseSensitive===!0,childrenIndex:s,route:o};l.relativePath.startsWith("/")&&(ie(l.relativePath.startsWith(r),'Absolute route path "'+l.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),l.relativePath=l.relativePath.slice(r.length));let u=Yn([r,l.relativePath]),c=n.concat(l);o.children&&o.children.length>0&&(ie(o.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),G0(o.children,t,c,u)),!(o.path==null&&!o.index)&&t.push({path:u,score:y_(u,o.index),routesMeta:c})};return e.forEach((o,s)=>{var a;if(o.path===""||!((a=o.path)!=null&&a.includes("?")))i(o,s);else for(let l of X0(o.path))i(o,s,l)}),t}function X0(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,i=n.endsWith("?"),o=n.replace(/\?$/,"");if(r.length===0)return i?[o,""]:[o];let s=X0(r.join("/")),a=[];return a.push(...s.map(l=>l===""?o:[o,l].join("/"))),i&&a.push(...s),a.map(l=>e.startsWith("/")&&l===""?"/":l)}function c_(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:v_(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const f_=/^:[\w-]+$/,d_=3,h_=2,p_=1,m_=10,g_=-2,Ag=e=>e==="*";function y_(e,t){let n=e.split("/"),r=n.length;return n.some(Ag)&&(r+=g_),t&&(r+=h_),n.filter(i=>!Ag(i)).reduce((i,o)=>i+(f_.test(o)?d_:o===""?p_:m_),r)}function v_(e,t){return e.length===t.length&&e.slice(0,-1).every((r,i)=>r===t[i])?e[e.length-1]-t[t.length-1]:0}function w_(e,t){let{routesMeta:n}=e,r={},i="/",o=[];for(let s=0;s{let{paramName:d,isOptional:h}=c;if(d==="*"){let v=a[f]||"";s=o.slice(0,o.length-v.length).replace(/(.)\/+$/,"$1")}const y=a[f];return h&&!y?u[d]=void 0:u[d]=(y||"").replace(/%2F/g,"/"),u},{}),pathname:o,pathnameBase:s,pattern:e}}function S_(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),Go(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let r=[],i="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(s,a,l)=>(r.push({paramName:a,isOptional:l!=null}),l?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(r.push({paramName:"*"}),i+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?i+="\\/*$":e!==""&&e!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,t?void 0:"i"),r]}function b_(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Go(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function ai(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}function E_(e,t){t===void 0&&(t="/");let{pathname:n,search:r="",hash:i=""}=typeof e=="string"?fi(e):e;return{pathname:n?n.startsWith("/")?n:k_(n,t):t,search:__(r),hash:P_(i)}}function k_(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(i=>{i===".."?n.length>1&&n.pop():i!=="."&&n.push(i)}),n.length>1?n.join("/"):"/"}function hf(e,t,n,r){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(r)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function Y0(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function _c(e,t){let n=Y0(e);return t?n.map((r,i)=>i===e.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function Pc(e,t,n,r){r===void 0&&(r=!1);let i;typeof e=="string"?i=fi(e):(i=$e({},e),ie(!i.pathname||!i.pathname.includes("?"),hf("?","pathname","search",i)),ie(!i.pathname||!i.pathname.includes("#"),hf("#","pathname","hash",i)),ie(!i.search||!i.search.includes("#"),hf("#","search","hash",i)));let o=e===""||i.pathname==="",s=o?"/":i.pathname,a;if(s==null)a=n;else{let f=t.length-1;if(!r&&s.startsWith("..")){let d=s.split("/");for(;d[0]==="..";)d.shift(),f-=1;i.pathname=d.join("/")}a=f>=0?t[f]:"/"}let l=E_(i,a),u=s&&s!=="/"&&s.endsWith("/"),c=(o||s===".")&&n.endsWith("/");return!l.pathname.endsWith("/")&&(u||c)&&(l.pathname+="/"),l}const Yn=e=>e.join("/").replace(/\/\/+/g,"/"),C_=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),__=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,P_=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;class wp{constructor(t,n,r,i){i===void 0&&(i=!1),this.status=t,this.statusText=n||"",this.internal=i,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}}function xp(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const J0=["post","put","patch","delete"],A_=new Set(J0),R_=["get",...J0],T_=new Set(R_),O_=new Set([301,302,303,307,308]),I_=new Set([307,308]),pf={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},M_={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},bs={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},Sp=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,$_=e=>({hasErrorBoundary:!!e.hasErrorBoundary}),Z0="remix-router-transitions";function F_(e){const t=e.window?e.window:typeof window<"u"?window:void 0,n=typeof t<"u"&&typeof t.document<"u"&&typeof t.document.createElement<"u",r=!n;ie(e.routes.length>0,"You must provide a non-empty routes array to createRouter");let i;if(e.mapRouteProperties)i=e.mapRouteProperties;else if(e.detectErrorBoundary){let T=e.detectErrorBoundary;i=M=>({hasErrorBoundary:T(M)})}else i=$_;let o={},s=Nd(e.routes,i,void 0,o),a,l=e.basename||"/",u=e.unstable_dataStrategy||z_,c=$e({v7_fetcherPersist:!1,v7_normalizeFormMethod:!1,v7_partialHydration:!1,v7_prependBasename:!1,v7_relativeSplatPath:!1,unstable_skipActionErrorRevalidation:!1},e.future),f=null,d=new Set,h=null,y=null,v=null,k=e.hydrationData!=null,p=go(s,e.history.location,l),m=null;if(p==null){let T=rn(404,{pathname:e.history.location.pathname}),{matches:M,route:N}=Ng(s);p=M,m={[N.id]:T}}let g,C=p.some(T=>T.route.lazy),P=p.some(T=>T.route.loader);if(C)g=!1;else if(!P)g=!0;else if(c.v7_partialHydration){let T=e.hydrationData?e.hydrationData.loaderData:null,M=e.hydrationData?e.hydrationData.errors:null,N=V=>V.route.loader?typeof V.route.loader=="function"&&V.route.loader.hydrate===!0?!1:T&&T[V.route.id]!==void 0||M&&M[V.route.id]!==void 0:!0;if(M){let V=p.findIndex(K=>M[K.route.id]!==void 0);g=p.slice(0,V+1).every(N)}else g=p.every(N)}else g=e.hydrationData!=null;let E,w={historyAction:e.history.action,location:e.history.location,matches:p,initialized:g,navigation:pf,restoreScrollPosition:e.hydrationData!=null?!1:null,preventScrollReset:!1,revalidation:"idle",loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||m,fetchers:new Map,blockers:new Map},S=Ue.Pop,A=!1,O,I=!1,R=new Map,D=null,F=!1,z=!1,q=[],B=[],$=new Map,W=0,b=-1,J=new Map,ne=new Set,_=new Map,Se=new Map,Ee=new Set,le=new Map,je=new Map,Pt=!1;function Lt(){if(f=e.history.listen(T=>{let{action:M,location:N,delta:V}=T;if(Pt){Pt=!1;return}Go(je.size===0||V!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let K=Qp({currentLocation:w.location,nextLocation:N,historyAction:M});if(K&&V!=null){Pt=!0,e.history.go(V*-1),At(K,{state:"blocked",location:N,proceed(){At(K,{state:"proceeding",proceed:void 0,reset:void 0,location:N}),e.history.go(V)},reset(){let oe=new Map(w.blockers);oe.set(K,bs),Ze({blockers:oe})}});return}return Nt(M,N)}),n){Y_(t,R);let T=()=>J_(t,R);t.addEventListener("pagehide",T),D=()=>t.removeEventListener("pagehide",T)}return w.initialized||Nt(Ue.Pop,w.location,{initialHydration:!0}),E}function mn(){f&&f(),D&&D(),d.clear(),O&&O.abort(),w.fetchers.forEach((T,M)=>me(M)),w.blockers.forEach((T,M)=>ir(M))}function pi(T){return d.add(T),()=>d.delete(T)}function Ze(T,M){M===void 0&&(M={}),w=$e({},w,T);let N=[],V=[];c.v7_fetcherPersist&&w.fetchers.forEach((K,oe)=>{K.state==="idle"&&(Ee.has(oe)?V.push(oe):N.push(oe))}),[...d].forEach(K=>K(w,{deletedFetchers:V,unstable_viewTransitionOpts:M.viewTransitionOpts,unstable_flushSync:M.flushSync===!0})),c.v7_fetcherPersist&&(N.forEach(K=>w.fetchers.delete(K)),V.forEach(K=>me(K)))}function rr(T,M,N){var V,K;let{flushSync:oe}=N===void 0?{}:N,Y=w.actionData!=null&&w.navigation.formMethod!=null&&Cn(w.navigation.formMethod)&&w.navigation.state==="loading"&&((V=T.state)==null?void 0:V._isRedirect)!==!0,G;M.actionData?Object.keys(M.actionData).length>0?G=M.actionData:G=null:Y?G=w.actionData:G=null;let se=M.loaderData?Dg(w.loaderData,M.loaderData,M.matches||[],M.errors):w.loaderData,re=w.blockers;re.size>0&&(re=new Map(re),re.forEach((te,Te)=>re.set(Te,bs)));let et=A===!0||w.navigation.formMethod!=null&&Cn(w.navigation.formMethod)&&((K=T.state)==null?void 0:K._isRedirect)!==!0;a&&(s=a,a=void 0),F||S===Ue.Pop||(S===Ue.Push?e.history.push(T,T.state):S===Ue.Replace&&e.history.replace(T,T.state));let tt;if(S===Ue.Pop){let te=R.get(w.location.pathname);te&&te.has(T.pathname)?tt={currentLocation:w.location,nextLocation:T}:R.has(T.pathname)&&(tt={currentLocation:T,nextLocation:w.location})}else if(I){let te=R.get(w.location.pathname);te?te.add(T.pathname):(te=new Set([T.pathname]),R.set(w.location.pathname,te)),tt={currentLocation:w.location,nextLocation:T}}Ze($e({},M,{actionData:G,loaderData:se,historyAction:S,location:T,initialized:!0,navigation:pf,revalidation:"idle",restoreScrollPosition:Gp(T,M.matches||w.matches),preventScrollReset:et,blockers:re}),{viewTransitionOpts:tt,flushSync:oe===!0}),S=Ue.Pop,A=!1,I=!1,F=!1,z=!1,q=[],B=[]}async function mi(T,M){if(typeof T=="number"){e.history.go(T);return}let N=zd(w.location,w.matches,l,c.v7_prependBasename,T,c.v7_relativeSplatPath,M==null?void 0:M.fromRouteId,M==null?void 0:M.relative),{path:V,submission:K,error:oe}=Rg(c.v7_normalizeFormMethod,!1,N,M),Y=w.location,G=Ca(w.location,V,M&&M.state);G=$e({},G,e.history.encodeLocation(G));let se=M&&M.replace!=null?M.replace:void 0,re=Ue.Push;se===!0?re=Ue.Replace:se===!1||K!=null&&Cn(K.formMethod)&&K.formAction===w.location.pathname+w.location.search&&(re=Ue.Replace);let et=M&&"preventScrollReset"in M?M.preventScrollReset===!0:void 0,tt=(M&&M.unstable_flushSync)===!0,te=Qp({currentLocation:Y,nextLocation:G,historyAction:re});if(te){At(te,{state:"blocked",location:G,proceed(){At(te,{state:"proceeding",proceed:void 0,reset:void 0,location:G}),mi(T,M)},reset(){let Te=new Map(w.blockers);Te.set(te,bs),Ze({blockers:Te})}});return}return await Nt(re,G,{submission:K,pendingError:oe,preventScrollReset:et,replace:M&&M.replace,enableViewTransition:M&&M.unstable_viewTransition,flushSync:tt})}function Dn(){if(L(),Ze({revalidation:"loading"}),w.navigation.state!=="submitting"){if(w.navigation.state==="idle"){Nt(w.historyAction,w.location,{startUninterruptedRevalidation:!0});return}Nt(S||w.historyAction,w.navigation.location,{overrideNavigation:w.navigation})}}async function Nt(T,M,N){O&&O.abort(),O=null,S=T,F=(N&&N.startUninterruptedRevalidation)===!0,fx(w.location,w.matches),A=(N&&N.preventScrollReset)===!0,I=(N&&N.enableViewTransition)===!0;let V=a||s,K=N&&N.overrideNavigation,oe=go(V,M,l),Y=(N&&N.flushSync)===!0;if(!oe){let te=rn(404,{pathname:M.pathname}),{matches:Te,route:Qe}=Ng(V);Dc(),rr(M,{matches:Te,loaderData:{},errors:{[Qe.id]:te}},{flushSync:Y});return}if(w.initialized&&!z&&W_(w.location,M)&&!(N&&N.submission&&Cn(N.submission.formMethod))){rr(M,{matches:oe},{flushSync:Y});return}O=new AbortController;let G=Ji(e.history,M,O.signal,N&&N.submission),se;if(N&&N.pendingError)se=[Js(oe).route.id,{type:Oe.error,error:N.pendingError}];else if(N&&N.submission&&Cn(N.submission.formMethod)){let te=await ls(G,M,N.submission,oe,{replace:N.replace,flushSync:Y});if(te.shortCircuited)return;se=te.pendingActionResult,K=mf(M,N.submission),Y=!1,G=Ji(e.history,G.url,G.signal)}let{shortCircuited:re,loaderData:et,errors:tt}=await qi(G,M,oe,K,N&&N.submission,N&&N.fetcherSubmission,N&&N.replace,N&&N.initialHydration===!0,Y,se);re||(O=null,rr(M,$e({matches:oe},Lg(se),{loaderData:et,errors:tt})))}async function ls(T,M,N,V,K){K===void 0&&(K={}),L();let oe=G_(M,N);Ze({navigation:oe},{flushSync:K.flushSync===!0});let Y,G=Bd(V,M);if(!G.route.action&&!G.route.lazy)Y={type:Oe.error,error:rn(405,{method:T.method,pathname:M.pathname,routeId:G.route.id})};else if(Y=(await yi("action",T,[G],V))[0],T.signal.aborted)return{shortCircuited:!0};if(_i(Y)){let se;return K&&K.replace!=null?se=K.replace:se=Mg(Y.response.headers.get("Location"),new URL(T.url),l)===w.location.pathname+w.location.search,await gi(T,Y,{submission:N,replace:se}),{shortCircuited:!0}}if(Ci(Y))throw rn(400,{type:"defer-action"});if(an(Y)){let se=Js(V,G.route.id);return(K&&K.replace)!==!0&&(S=Ue.Push),{pendingActionResult:[se.route.id,Y]}}return{pendingActionResult:[G.route.id,Y]}}async function qi(T,M,N,V,K,oe,Y,G,se,re){let et=V||mf(M,K),tt=K||oe||Bg(et),te=a||s,[Te,Qe]=Tg(e.history,w,N,tt,M,c.v7_partialHydration&&G===!0,c.unstable_skipActionErrorRevalidation,z,q,B,Ee,_,ne,te,l,re);if(Dc(he=>!(N&&N.some(wt=>wt.route.id===he))||Te&&Te.some(wt=>wt.route.id===he)),b=++W,Te.length===0&&Qe.length===0){let he=_r();return rr(M,$e({matches:N,loaderData:{},errors:re&&an(re[1])?{[re[0]]:re[1].error}:null},Lg(re),he?{fetchers:new Map(w.fetchers)}:{}),{flushSync:se}),{shortCircuited:!0}}if(!F&&(!c.v7_partialHydration||!G)){Qe.forEach(wt=>{let en=w.fetchers.get(wt.key),nt=Es(void 0,en?en.data:void 0);w.fetchers.set(wt.key,nt)});let he;re&&!an(re[1])?he={[re[0]]:re[1].data}:w.actionData&&(Object.keys(w.actionData).length===0?he=null:he=w.actionData),Ze($e({navigation:et},he!==void 0?{actionData:he}:{},Qe.length>0?{fetchers:new Map(w.fetchers)}:{}),{flushSync:se})}Qe.forEach(he=>{$.has(he.key)&&ct(he.key),he.controller&&$.set(he.key,he.controller)});let cs=()=>Qe.forEach(he=>ct(he.key));O&&O.signal.addEventListener("abort",cs);let{loaderResults:Ar,fetcherResults:Ki}=await Va(w.matches,N,Te,Qe,T);if(T.signal.aborted)return{shortCircuited:!0};O&&O.signal.removeEventListener("abort",cs),Qe.forEach(he=>$.delete(he.key));let Gi=zg([...Ar,...Ki]);if(Gi){if(Gi.idx>=Te.length){let he=Qe[Gi.idx-Te.length].key;ne.add(he)}return await gi(T,Gi.result,{replace:Y}),{shortCircuited:!0}}let{loaderData:Xi,errors:Ln}=Fg(w,N,Te,Ar,re,Qe,Ki,le);le.forEach((he,wt)=>{he.subscribe(en=>{(en||he.done)&&le.delete(wt)})}),c.v7_partialHydration&&G&&w.errors&&Object.entries(w.errors).filter(he=>{let[wt]=he;return!Te.some(en=>en.route.id===wt)}).forEach(he=>{let[wt,en]=he;Ln=Object.assign(Ln||{},{[wt]:en})});let Wa=_r(),qa=Pr(b),Qa=Wa||qa||Qe.length>0;return $e({loaderData:Xi,errors:Ln},Qa?{fetchers:new Map(w.fetchers)}:{})}function Qi(T,M,N,V){if(r)throw new Error("router.fetch() was called during the server render, but it shouldn't be. You are likely calling a useFetcher() method in the body of your component. Try moving it to a useEffect or a callback.");$.has(T)&&ct(T);let K=(V&&V.unstable_flushSync)===!0,oe=a||s,Y=zd(w.location,w.matches,l,c.v7_prependBasename,N,c.v7_relativeSplatPath,M,V==null?void 0:V.relative),G=go(oe,Y,l);if(!G){Z(T,M,rn(404,{pathname:Y}),{flushSync:K});return}let{path:se,submission:re,error:et}=Rg(c.v7_normalizeFormMethod,!0,Y,V);if(et){Z(T,M,et,{flushSync:K});return}let tt=Bd(G,se);if(A=(V&&V.preventScrollReset)===!0,re&&Cn(re.formMethod)){us(T,M,se,tt,G,K,re);return}_.set(T,{routeId:M,path:se}),Cr(T,M,se,tt,G,K,re)}async function us(T,M,N,V,K,oe,Y){if(L(),_.delete(T),!V.route.action&&!V.route.lazy){let nt=rn(405,{method:Y.formMethod,pathname:N,routeId:M});Z(T,M,nt,{flushSync:oe});return}let G=w.fetchers.get(T);H(T,X_(Y,G),{flushSync:oe});let se=new AbortController,re=Ji(e.history,N,se.signal,Y);$.set(T,se);let et=W,te=(await yi("action",re,[V],K))[0];if(re.signal.aborted){$.get(T)===se&&$.delete(T);return}if(c.v7_fetcherPersist&&Ee.has(T)){if(_i(te)||an(te)){H(T,Fr(void 0));return}}else{if(_i(te))if($.delete(T),b>et){H(T,Fr(void 0));return}else return ne.add(T),H(T,Es(Y)),gi(re,te,{fetcherSubmission:Y});if(an(te)){Z(T,M,te.error);return}}if(Ci(te))throw rn(400,{type:"defer-action"});let Te=w.navigation.location||w.location,Qe=Ji(e.history,Te,se.signal),cs=a||s,Ar=w.navigation.state!=="idle"?go(cs,w.navigation.location,l):w.matches;ie(Ar,"Didn't find any matches after fetcher action");let Ki=++W;J.set(T,Ki);let Gi=Es(Y,te.data);w.fetchers.set(T,Gi);let[Xi,Ln]=Tg(e.history,w,Ar,Y,Te,!1,c.unstable_skipActionErrorRevalidation,z,q,B,Ee,_,ne,cs,l,[V.route.id,te]);Ln.filter(nt=>nt.key!==T).forEach(nt=>{let fs=nt.key,Xp=w.fetchers.get(fs),hx=Es(void 0,Xp?Xp.data:void 0);w.fetchers.set(fs,hx),$.has(fs)&&ct(fs),nt.controller&&$.set(fs,nt.controller)}),Ze({fetchers:new Map(w.fetchers)});let Wa=()=>Ln.forEach(nt=>ct(nt.key));se.signal.addEventListener("abort",Wa);let{loaderResults:qa,fetcherResults:Qa}=await Va(w.matches,Ar,Xi,Ln,Qe);if(se.signal.aborted)return;se.signal.removeEventListener("abort",Wa),J.delete(T),$.delete(T),Ln.forEach(nt=>$.delete(nt.key));let he=zg([...qa,...Qa]);if(he){if(he.idx>=Xi.length){let nt=Ln[he.idx-Xi.length].key;ne.add(nt)}return gi(Qe,he.result)}let{loaderData:wt,errors:en}=Fg(w,w.matches,Xi,qa,void 0,Ln,Qa,le);if(w.fetchers.has(T)){let nt=Fr(te.data);w.fetchers.set(T,nt)}Pr(Ki),w.navigation.state==="loading"&&Ki>b?(ie(S,"Expected pending action"),O&&O.abort(),rr(w.navigation.location,{matches:Ar,loaderData:wt,errors:en,fetchers:new Map(w.fetchers)})):(Ze({errors:en,loaderData:Dg(w.loaderData,wt,Ar,en),fetchers:new Map(w.fetchers)}),z=!1)}async function Cr(T,M,N,V,K,oe,Y){let G=w.fetchers.get(T);H(T,Es(Y,G?G.data:void 0),{flushSync:oe});let se=new AbortController,re=Ji(e.history,N,se.signal);$.set(T,se);let et=W,te=(await yi("loader",re,[V],K))[0];if(Ci(te)&&(te=await r1(te,re.signal,!0)||te),$.get(T)===se&&$.delete(T),!re.signal.aborted){if(Ee.has(T)){H(T,Fr(void 0));return}if(_i(te))if(b>et){H(T,Fr(void 0));return}else{ne.add(T),await gi(re,te);return}if(an(te)){Z(T,M,te.error);return}ie(!Ci(te),"Unhandled fetcher deferred data"),H(T,Fr(te.data))}}async function gi(T,M,N){let{submission:V,fetcherSubmission:K,replace:oe}=N===void 0?{}:N;M.response.headers.has("X-Remix-Revalidate")&&(z=!0);let Y=M.response.headers.get("Location");ie(Y,"Expected a Location header on the redirect Response"),Y=Mg(Y,new URL(T.url),l);let G=Ca(w.location,Y,{_isRedirect:!0});if(n){let Te=!1;if(M.response.headers.has("X-Remix-Reload-Document"))Te=!0;else if(Sp.test(Y)){const Qe=e.history.createURL(Y);Te=Qe.origin!==t.location.origin||ai(Qe.pathname,l)==null}if(Te){oe?t.location.replace(Y):t.location.assign(Y);return}}O=null;let se=oe===!0?Ue.Replace:Ue.Push,{formMethod:re,formAction:et,formEncType:tt}=w.navigation;!V&&!K&&re&&et&&tt&&(V=Bg(w.navigation));let te=V||K;if(I_.has(M.response.status)&&te&&Cn(te.formMethod))await Nt(se,G,{submission:$e({},te,{formAction:Y}),preventScrollReset:A});else{let Te=mf(G,V);await Nt(se,G,{overrideNavigation:Te,fetcherSubmission:K,preventScrollReset:A})}}async function yi(T,M,N,V){try{let K=await j_(u,T,M,N,V,o,i);return await Promise.all(K.map((oe,Y)=>{if(q_(oe)){let G=oe.result;return{type:Oe.redirect,response:H_(G,M,N[Y].route.id,V,l,c.v7_relativeSplatPath)}}return U_(oe)}))}catch(K){return N.map(()=>({type:Oe.error,error:K}))}}async function Va(T,M,N,V,K){let[oe,...Y]=await Promise.all([N.length?yi("loader",K,N,M):[],...V.map(G=>{if(G.matches&&G.match&&G.controller){let se=Ji(e.history,G.path,G.controller.signal);return yi("loader",se,[G.match],G.matches).then(re=>re[0])}else return Promise.resolve({type:Oe.error,error:rn(404,{pathname:G.path})})})]);return await Promise.all([jg(T,N,oe,oe.map(()=>K.signal),!1,w.loaderData),jg(T,V.map(G=>G.match),Y,V.map(G=>G.controller?G.controller.signal:null),!0)]),{loaderResults:oe,fetcherResults:Y}}function L(){z=!0,q.push(...Dc()),_.forEach((T,M)=>{$.has(M)&&(B.push(M),ct(M))})}function H(T,M,N){N===void 0&&(N={}),w.fetchers.set(T,M),Ze({fetchers:new Map(w.fetchers)},{flushSync:(N&&N.flushSync)===!0})}function Z(T,M,N,V){V===void 0&&(V={});let K=Js(w.matches,M);me(T),Ze({errors:{[K.route.id]:N},fetchers:new Map(w.fetchers)},{flushSync:(V&&V.flushSync)===!0})}function ce(T){return c.v7_fetcherPersist&&(Se.set(T,(Se.get(T)||0)+1),Ee.has(T)&&Ee.delete(T)),w.fetchers.get(T)||M_}function me(T){let M=w.fetchers.get(T);$.has(T)&&!(M&&M.state==="loading"&&J.has(T))&&ct(T),_.delete(T),J.delete(T),ne.delete(T),Ee.delete(T),w.fetchers.delete(T)}function zt(T){if(c.v7_fetcherPersist){let M=(Se.get(T)||0)-1;M<=0?(Se.delete(T),Ee.add(T)):Se.set(T,M)}else me(T);Ze({fetchers:new Map(w.fetchers)})}function ct(T){let M=$.get(T);ie(M,"Expected fetch controller: "+T),M.abort(),$.delete(T)}function Zt(T){for(let M of T){let N=ce(M),V=Fr(N.data);w.fetchers.set(M,V)}}function _r(){let T=[],M=!1;for(let N of ne){let V=w.fetchers.get(N);ie(V,"Expected fetcher: "+N),V.state==="loading"&&(ne.delete(N),T.push(N),M=!0)}return Zt(T),M}function Pr(T){let M=[];for(let[N,V]of J)if(V0}function vt(T,M){let N=w.blockers.get(T)||bs;return je.get(T)!==M&&je.set(T,M),N}function ir(T){w.blockers.delete(T),je.delete(T)}function At(T,M){let N=w.blockers.get(T)||bs;ie(N.state==="unblocked"&&M.state==="blocked"||N.state==="blocked"&&M.state==="blocked"||N.state==="blocked"&&M.state==="proceeding"||N.state==="blocked"&&M.state==="unblocked"||N.state==="proceeding"&&M.state==="unblocked","Invalid blocker state transition: "+N.state+" -> "+M.state);let V=new Map(w.blockers);V.set(T,M),Ze({blockers:V})}function Qp(T){let{currentLocation:M,nextLocation:N,historyAction:V}=T;if(je.size===0)return;je.size>1&&Go(!1,"A router only supports one blocker at a time");let K=Array.from(je.entries()),[oe,Y]=K[K.length-1],G=w.blockers.get(oe);if(!(G&&G.state==="proceeding")&&Y({currentLocation:M,nextLocation:N,historyAction:V}))return oe}function Dc(T){let M=[];return le.forEach((N,V)=>{(!T||T(V))&&(N.cancel(),M.push(V),le.delete(V))}),M}function cx(T,M,N){if(h=T,v=M,y=N||null,!k&&w.navigation===pf){k=!0;let V=Gp(w.location,w.matches);V!=null&&Ze({restoreScrollPosition:V})}return()=>{h=null,v=null,y=null}}function Kp(T,M){return y&&y(T,M.map(V=>u_(V,w.loaderData)))||T.key}function fx(T,M){if(h&&v){let N=Kp(T,M);h[N]=v()}}function Gp(T,M){if(h){let N=Kp(T,M),V=h[N];if(typeof V=="number")return V}return null}function dx(T){o={},a=Nd(T,i,void 0,o)}return E={get basename(){return l},get future(){return c},get state(){return w},get routes(){return s},get window(){return t},initialize:Lt,subscribe:pi,enableScrollRestoration:cx,navigate:mi,fetch:Qi,revalidate:Dn,createHref:T=>e.history.createHref(T),encodeLocation:T=>e.history.encodeLocation(T),getFetcher:ce,deleteFetcher:zt,dispose:mn,getBlocker:vt,deleteBlocker:ir,_internalFetchControllers:$,_internalActiveDeferreds:le,_internalSetRoutes:dx},E}function D_(e){return e!=null&&("formData"in e&&e.formData!=null||"body"in e&&e.body!==void 0)}function zd(e,t,n,r,i,o,s,a){let l,u;if(s){l=[];for(let f of t)if(l.push(f),f.route.id===s){u=f;break}}else l=t,u=t[t.length-1];let c=Pc(i||".",_c(l,o),ai(e.pathname,n)||e.pathname,a==="path");return i==null&&(c.search=e.search,c.hash=e.hash),(i==null||i===""||i===".")&&u&&u.route.index&&!bp(c.search)&&(c.search=c.search?c.search.replace(/^\?/,"?index&"):"?index"),r&&n!=="/"&&(c.pathname=c.pathname==="/"?n:Yn([n,c.pathname])),si(c)}function Rg(e,t,n,r){if(!r||!D_(r))return{path:n};if(r.formMethod&&!K_(r.formMethod))return{path:n,error:rn(405,{method:r.formMethod})};let i=()=>({path:n,error:rn(400,{type:"invalid-body"})}),o=r.formMethod||"get",s=e?o.toUpperCase():o.toLowerCase(),a=t1(n);if(r.body!==void 0){if(r.formEncType==="text/plain"){if(!Cn(s))return i();let d=typeof r.body=="string"?r.body:r.body instanceof FormData||r.body instanceof URLSearchParams?Array.from(r.body.entries()).reduce((h,y)=>{let[v,k]=y;return""+h+v+"="+k+` -`},""):String(r.body);return{path:n,submission:{formMethod:s,formAction:a,formEncType:r.formEncType,formData:void 0,json:void 0,text:d}}}else if(r.formEncType==="application/json"){if(!Cn(s))return i();try{let d=typeof r.body=="string"?JSON.parse(r.body):r.body;return{path:n,submission:{formMethod:s,formAction:a,formEncType:r.formEncType,formData:void 0,json:d,text:void 0}}}catch{return i()}}}ie(typeof FormData=="function","FormData is not available in this environment");let l,u;if(r.formData)l=jd(r.formData),u=r.formData;else if(r.body instanceof FormData)l=jd(r.body),u=r.body;else if(r.body instanceof URLSearchParams)l=r.body,u=$g(l);else if(r.body==null)l=new URLSearchParams,u=new FormData;else try{l=new URLSearchParams(r.body),u=$g(l)}catch{return i()}let c={formMethod:s,formAction:a,formEncType:r&&r.formEncType||"application/x-www-form-urlencoded",formData:u,json:void 0,text:void 0};if(Cn(c.formMethod))return{path:n,submission:c};let f=fi(n);return t&&f.search&&bp(f.search)&&l.append("index",""),f.search="?"+l,{path:si(f),submission:c}}function L_(e,t){let n=e;if(t){let r=e.findIndex(i=>i.route.id===t);r>=0&&(n=e.slice(0,r))}return n}function Tg(e,t,n,r,i,o,s,a,l,u,c,f,d,h,y,v){let k=v?an(v[1])?v[1].error:v[1].data:void 0,p=e.createURL(t.location),m=e.createURL(i),g=v&&an(v[1])?v[0]:void 0,C=g?L_(n,g):n,P=v?v[1].statusCode:void 0,E=s&&P&&P>=400,w=C.filter((A,O)=>{let{route:I}=A;if(I.lazy)return!0;if(I.loader==null)return!1;if(o)return typeof I.loader!="function"||I.loader.hydrate?!0:t.loaderData[I.id]===void 0&&(!t.errors||t.errors[I.id]===void 0);if(N_(t.loaderData,t.matches[O],A)||l.some(F=>F===A.route.id))return!0;let R=t.matches[O],D=A;return Og(A,$e({currentUrl:p,currentParams:R.params,nextUrl:m,nextParams:D.params},r,{actionResult:k,unstable_actionStatus:P,defaultShouldRevalidate:E?!1:a||p.pathname+p.search===m.pathname+m.search||p.search!==m.search||e1(R,D)}))}),S=[];return f.forEach((A,O)=>{if(o||!n.some(z=>z.route.id===A.routeId)||c.has(O))return;let I=go(h,A.path,y);if(!I){S.push({key:O,routeId:A.routeId,path:A.path,matches:null,match:null,controller:null});return}let R=t.fetchers.get(O),D=Bd(I,A.path),F=!1;d.has(O)?F=!1:u.includes(O)?F=!0:R&&R.state!=="idle"&&R.data===void 0?F=a:F=Og(D,$e({currentUrl:p,currentParams:t.matches[t.matches.length-1].params,nextUrl:m,nextParams:n[n.length-1].params},r,{actionResult:k,unstable_actionStatus:P,defaultShouldRevalidate:E?!1:a})),F&&S.push({key:O,routeId:A.routeId,path:A.path,matches:I,match:D,controller:new AbortController})}),[w,S]}function N_(e,t,n){let r=!t||n.route.id!==t.route.id,i=e[n.route.id]===void 0;return r||i}function e1(e,t){let n=e.route.path;return e.pathname!==t.pathname||n!=null&&n.endsWith("*")&&e.params["*"]!==t.params["*"]}function Og(e,t){if(e.route.shouldRevalidate){let n=e.route.shouldRevalidate(t);if(typeof n=="boolean")return n}return t.defaultShouldRevalidate}async function Ig(e,t,n){if(!e.lazy)return;let r=await e.lazy();if(!e.lazy)return;let i=n[e.id];ie(i,"No route found in manifest");let o={};for(let s in r){let l=i[s]!==void 0&&s!=="hasErrorBoundary";Go(!l,'Route "'+i.id+'" has a static property "'+s+'" defined but its lazy function is also returning a value for this property. '+('The lazy route property "'+s+'" will be ignored.')),!l&&!a_.has(s)&&(o[s]=r[s])}Object.assign(i,o),Object.assign(i,$e({},t(i),{lazy:void 0}))}function z_(e){return Promise.all(e.matches.map(t=>t.resolve()))}async function j_(e,t,n,r,i,o,s,a){let l=r.reduce((f,d)=>f.add(d.route.id),new Set),u=new Set,c=await e({matches:i.map(f=>{let d=l.has(f.route.id);return $e({},f,{shouldLoad:d,resolve:y=>(u.add(f.route.id),d?B_(t,n,f,o,s,y,a):Promise.resolve({type:Oe.data,result:void 0}))})}),request:n,params:i[0].params,context:a});return i.forEach(f=>ie(u.has(f.route.id),'`match.resolve()` was not called for route id "'+f.route.id+'". You must call `match.resolve()` on every match passed to `dataStrategy` to ensure all routes are properly loaded.')),c.filter((f,d)=>l.has(i[d].route.id))}async function B_(e,t,n,r,i,o,s){let a,l,u=c=>{let f,d=new Promise((v,k)=>f=k);l=()=>f(),t.signal.addEventListener("abort",l);let h=v=>typeof c!="function"?Promise.reject(new Error("You cannot call the handler for a route which defines a boolean "+('"'+e+'" [routeId: '+n.route.id+"]"))):c({request:t,params:n.params,context:s},...v!==void 0?[v]:[]),y;return o?y=o(v=>h(v)):y=(async()=>{try{return{type:"data",result:await h()}}catch(v){return{type:"error",result:v}}})(),Promise.race([y,d])};try{let c=n.route[e];if(n.route.lazy)if(c){let f,[d]=await Promise.all([u(c).catch(h=>{f=h}),Ig(n.route,i,r)]);if(f!==void 0)throw f;a=d}else if(await Ig(n.route,i,r),c=n.route[e],c)a=await u(c);else if(e==="action"){let f=new URL(t.url),d=f.pathname+f.search;throw rn(405,{method:t.method,pathname:d,routeId:n.route.id})}else return{type:Oe.data,result:void 0};else if(c)a=await u(c);else{let f=new URL(t.url),d=f.pathname+f.search;throw rn(404,{pathname:d})}ie(a.result!==void 0,"You defined "+(e==="action"?"an action":"a loader")+" for route "+('"'+n.route.id+"\" but didn't return anything from your `"+e+"` ")+"function. Please return a value or `null`.")}catch(c){return{type:Oe.error,result:c}}finally{l&&t.signal.removeEventListener("abort",l)}return a}async function U_(e){let{result:t,type:n,status:r}=e;if(n1(t)){let s;try{let a=t.headers.get("Content-Type");a&&/\bapplication\/json\b/.test(a)?t.body==null?s=null:s=await t.json():s=await t.text()}catch(a){return{type:Oe.error,error:a}}return n===Oe.error?{type:Oe.error,error:new wp(t.status,t.statusText,s),statusCode:t.status,headers:t.headers}:{type:Oe.data,data:s,statusCode:t.status,headers:t.headers}}if(n===Oe.error)return{type:Oe.error,error:t,statusCode:xp(t)?t.status:r};if(Q_(t)){var i,o;return{type:Oe.deferred,deferredData:t,statusCode:(i=t.init)==null?void 0:i.status,headers:((o=t.init)==null?void 0:o.headers)&&new Headers(t.init.headers)}}return{type:Oe.data,data:t,statusCode:r}}function H_(e,t,n,r,i,o){let s=e.headers.get("Location");if(ie(s,"Redirects returned/thrown from loaders/actions must have a Location header"),!Sp.test(s)){let a=r.slice(0,r.findIndex(l=>l.route.id===n)+1);s=zd(new URL(t.url),a,i,!0,s,o),e.headers.set("Location",s)}return e}function Mg(e,t,n){if(Sp.test(e)){let r=e,i=r.startsWith("//")?new URL(t.protocol+r):new URL(r),o=ai(i.pathname,n)!=null;if(i.origin===t.origin&&o)return i.pathname+i.search+i.hash}return e}function Ji(e,t,n,r){let i=e.createURL(t1(t)).toString(),o={signal:n};if(r&&Cn(r.formMethod)){let{formMethod:s,formEncType:a}=r;o.method=s.toUpperCase(),a==="application/json"?(o.headers=new Headers({"Content-Type":a}),o.body=JSON.stringify(r.json)):a==="text/plain"?o.body=r.text:a==="application/x-www-form-urlencoded"&&r.formData?o.body=jd(r.formData):o.body=r.formData}return new Request(i,o)}function jd(e){let t=new URLSearchParams;for(let[n,r]of e.entries())t.append(n,typeof r=="string"?r:r.name);return t}function $g(e){let t=new FormData;for(let[n,r]of e.entries())t.append(n,r);return t}function V_(e,t,n,r,i,o){let s={},a=null,l,u=!1,c={},f=r&&an(r[1])?r[1].error:void 0;return n.forEach((d,h)=>{let y=t[h].route.id;if(ie(!_i(d),"Cannot handle redirect results in processLoaderData"),an(d)){let v=d.error;f!==void 0&&(v=f,f=void 0),a=a||{};{let k=Js(e,y);a[k.route.id]==null&&(a[k.route.id]=v)}s[y]=void 0,u||(u=!0,l=xp(d.error)?d.error.status:500),d.headers&&(c[y]=d.headers)}else Ci(d)?(i.set(y,d.deferredData),s[y]=d.deferredData.data,d.statusCode!=null&&d.statusCode!==200&&!u&&(l=d.statusCode),d.headers&&(c[y]=d.headers)):(s[y]=d.data,d.statusCode&&d.statusCode!==200&&!u&&(l=d.statusCode),d.headers&&(c[y]=d.headers))}),f!==void 0&&r&&(a={[r[0]]:f},s[r[0]]=void 0),{loaderData:s,errors:a,statusCode:l||200,loaderHeaders:c}}function Fg(e,t,n,r,i,o,s,a){let{loaderData:l,errors:u}=V_(t,n,r,i,a);for(let c=0;cr.route.id===t)+1):[...e]).reverse().find(r=>r.route.hasErrorBoundary===!0)||e[0]}function Ng(e){let t=e.length===1?e[0]:e.find(n=>n.index||!n.path||n.path==="/")||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:t}],route:t}}function rn(e,t){let{pathname:n,routeId:r,method:i,type:o}=t===void 0?{}:t,s="Unknown Server Error",a="Unknown @remix-run/router error";return e===400?(s="Bad Request",i&&n&&r?a="You made a "+i+' request to "'+n+'" but '+('did not provide a `loader` for route "'+r+'", ')+"so there is no way to handle the request.":o==="defer-action"?a="defer() is not supported in actions":o==="invalid-body"&&(a="Unable to encode submission body")):e===403?(s="Forbidden",a='Route "'+r+'" does not match URL "'+n+'"'):e===404?(s="Not Found",a='No route matches URL "'+n+'"'):e===405&&(s="Method Not Allowed",i&&n&&r?a="You made a "+i.toUpperCase()+' request to "'+n+'" but '+('did not provide an `action` for route "'+r+'", ')+"so there is no way to handle the request.":i&&(a='Invalid request method "'+i.toUpperCase()+'"')),new wp(e||500,s,new Error(a),!0)}function zg(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(_i(n))return{result:n,idx:t}}}function t1(e){let t=typeof e=="string"?fi(e):e;return si($e({},t,{hash:""}))}function W_(e,t){return e.pathname!==t.pathname||e.search!==t.search?!1:e.hash===""?t.hash!=="":e.hash===t.hash?!0:t.hash!==""}function q_(e){return n1(e.result)&&O_.has(e.result.status)}function Ci(e){return e.type===Oe.deferred}function an(e){return e.type===Oe.error}function _i(e){return(e&&e.type)===Oe.redirect}function Q_(e){let t=e;return t&&typeof t=="object"&&typeof t.data=="object"&&typeof t.subscribe=="function"&&typeof t.cancel=="function"&&typeof t.resolveData=="function"}function n1(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.headers=="object"&&typeof e.body<"u"}function K_(e){return T_.has(e.toLowerCase())}function Cn(e){return A_.has(e.toLowerCase())}async function jg(e,t,n,r,i,o){for(let s=0;sf.route.id===l.route.id),c=u!=null&&!e1(u,l)&&(o&&o[l.route.id])!==void 0;if(Ci(a)&&(i||c)){let f=r[s];ie(f,"Expected an AbortSignal for revalidating fetcher deferred result"),await r1(a,f,i).then(d=>{d&&(n[s]=d||n[s])})}}}async function r1(e,t,n){if(n===void 0&&(n=!1),!await e.deferredData.resolveData(t)){if(n)try{return{type:Oe.data,data:e.deferredData.unwrappedData}}catch(i){return{type:Oe.error,error:i}}return{type:Oe.data,data:e.deferredData.data}}}function bp(e){return new URLSearchParams(e).getAll("index").some(t=>t==="")}function Bd(e,t){let n=typeof t=="string"?fi(t).search:t.search;if(e[e.length-1].route.index&&bp(n||""))return e[e.length-1];let r=Y0(e);return r[r.length-1]}function Bg(e){let{formMethod:t,formAction:n,formEncType:r,text:i,formData:o,json:s}=e;if(!(!t||!n||!r)){if(i!=null)return{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:void 0,text:i};if(o!=null)return{formMethod:t,formAction:n,formEncType:r,formData:o,json:void 0,text:void 0};if(s!==void 0)return{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:s,text:void 0}}}function mf(e,t){return t?{state:"loading",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}:{state:"loading",location:e,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function G_(e,t){return{state:"submitting",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}}function Es(e,t){return e?{state:"loading",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t}:{state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t}}function X_(e,t){return{state:"submitting",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t?t.data:void 0}}function Fr(e){return{state:"idle",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}function Y_(e,t){try{let n=e.sessionStorage.getItem(Z0);if(n){let r=JSON.parse(n);for(let[i,o]of Object.entries(r||{}))o&&Array.isArray(o)&&t.set(i,new Set(o||[]))}}catch{}}function J_(e,t){if(t.size>0){let n={};for(let[r,i]of t)n[r]=[...i];try{e.sessionStorage.setItem(Z0,JSON.stringify(n))}catch(r){Go(!1,"Failed to save applied view transitions in sessionStorage ("+r+").")}}}/** - * React Router v6.23.1 - * - * Copyright (c) Remix Software Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */function Pu(){return Pu=Object.assign?Object.assign.bind():function(e){for(var t=1;t{a.current=!0}),x.useCallback(function(u,c){if(c===void 0&&(c={}),!a.current)return;if(typeof u=="number"){r.go(u);return}let f=Pc(u,JSON.parse(s),o,c.relative==="path");e==null&&t!=="/"&&(f.pathname=f.pathname==="/"?t:Yn([t,f.pathname])),(c.replace?r.replace:r.push)(f,c.state,c)},[t,r,s,o,e])}function pM(){let{matches:e}=x.useContext(tr),t=e[e.length-1];return t?t.params:{}}function Cp(e,t){let{relative:n}=t===void 0?{}:t,{future:r}=x.useContext(er),{matches:i}=x.useContext(tr),{pathname:o}=Vi(),s=JSON.stringify(_c(i,r.v7_relativeSplatPath));return x.useMemo(()=>Pc(e,JSON.parse(s),o,n==="path"),[e,s,o,n])}function tP(e,t,n,r){as()||ie(!1);let{navigator:i}=x.useContext(er),{matches:o}=x.useContext(tr),s=o[o.length-1],a=s?s.params:{};s&&s.pathname;let l=s?s.pathnameBase:"/";s&&s.route;let u=Vi(),c;c=u;let f=c.pathname||"/",d=f;if(l!=="/"){let v=l.replace(/^\//,"").split("/");d="/"+f.replace(/^\//,"").split("/").slice(v.length).join("/")}let h=go(e,{pathname:d});return sP(h&&h.map(v=>Object.assign({},v,{params:Object.assign({},a,v.params),pathname:Yn([l,i.encodeLocation?i.encodeLocation(v.pathname).pathname:v.pathname]),pathnameBase:v.pathnameBase==="/"?l:Yn([l,i.encodeLocation?i.encodeLocation(v.pathnameBase).pathname:v.pathnameBase])})),o,n,r)}function nP(){let e=fP(),t=xp(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,i={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return x.createElement(x.Fragment,null,x.createElement("h2",null,"Unexpected Application Error!"),x.createElement("h3",{style:{fontStyle:"italic"}},t),n?x.createElement("pre",{style:i},n):null,null)}const rP=x.createElement(nP,null);class iP extends x.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,n){return n.location!==t.location||n.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:n.error,location:n.location,revalidation:t.revalidation||n.revalidation}}componentDidCatch(t,n){console.error("React Router caught the following error during render",t,n)}render(){return this.state.error!==void 0?x.createElement(tr.Provider,{value:this.props.routeContext},x.createElement(o1.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function oP(e){let{routeContext:t,match:n,children:r}=e,i=x.useContext(ja);return i&&i.static&&i.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=n.route.id),x.createElement(tr.Provider,{value:t},r)}function sP(e,t,n,r){var i;if(t===void 0&&(t=[]),n===void 0&&(n=null),r===void 0&&(r=null),e==null){var o;if((o=n)!=null&&o.errors)e=n.matches;else return null}let s=e,a=(i=n)==null?void 0:i.errors;if(a!=null){let c=s.findIndex(f=>f.route.id&&(a==null?void 0:a[f.route.id])!==void 0);c>=0||ie(!1),s=s.slice(0,Math.min(s.length,c+1))}let l=!1,u=-1;if(n&&r&&r.v7_partialHydration)for(let c=0;c=0?s=s.slice(0,u+1):s=[s[0]];break}}}return s.reduceRight((c,f,d)=>{let h,y=!1,v=null,k=null;n&&(h=a&&f.route.id?a[f.route.id]:void 0,v=f.route.errorElement||rP,l&&(u<0&&d===0?(y=!0,k=null):u===d&&(y=!0,k=f.route.hydrateFallbackElement||null)));let p=t.concat(s.slice(0,d+1)),m=()=>{let g;return h?g=v:y?g=k:f.route.Component?g=x.createElement(f.route.Component,null):f.route.element?g=f.route.element:g=c,x.createElement(oP,{match:f,routeContext:{outlet:c,matches:p,isDataRoute:n!=null},children:g})};return n&&(f.route.ErrorBoundary||f.route.errorElement||d===0)?x.createElement(iP,{location:n.location,revalidation:n.revalidation,component:v,error:h,children:m(),routeContext:{outlet:null,matches:p,isDataRoute:!0}}):m()},null)}var a1=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(a1||{}),_a=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(_a||{});function aP(e){let t=x.useContext(ja);return t||ie(!1),t}function lP(e){let t=x.useContext(i1);return t||ie(!1),t}function uP(e){let t=x.useContext(tr);return t||ie(!1),t}function _p(e){let t=uP(),n=t.matches[t.matches.length-1];return n.route.id||ie(!1),n.route.id}function cP(){return _p(_a.UseRouteId)}function fP(){var e;let t=x.useContext(o1),n=lP(_a.UseRouteError),r=_p(_a.UseRouteError);return t!==void 0?t:(e=n.errors)==null?void 0:e[r]}function dP(){let{router:e}=aP(a1.UseNavigateStable),t=_p(_a.UseNavigateStable),n=x.useRef(!1);return s1(()=>{n.current=!0}),x.useCallback(function(i,o){o===void 0&&(o={}),n.current&&(typeof i=="number"?e.navigate(i):e.navigate(i,Pu({fromRouteId:t},o)))},[e,t])}function hP(e){let{to:t,replace:n,state:r,relative:i}=e;as()||ie(!1);let{future:o,static:s}=x.useContext(er),{matches:a}=x.useContext(tr),{pathname:l}=Vi(),u=kp(),c=Pc(t,_c(a,o.v7_relativeSplatPath),l,i==="path"),f=JSON.stringify(c);return x.useEffect(()=>u(JSON.parse(f),{replace:n,state:r,relative:i}),[u,f,i,n,r]),null}function Is(e){ie(!1)}function pP(e){let{basename:t="/",children:n=null,location:r,navigationType:i=Ue.Pop,navigator:o,static:s=!1,future:a}=e;as()&&ie(!1);let l=t.replace(/^\/*/,"/"),u=x.useMemo(()=>({basename:l,navigator:o,static:s,future:Pu({v7_relativeSplatPath:!1},a)}),[l,a,o,s]);typeof r=="string"&&(r=fi(r));let{pathname:c="/",search:f="",hash:d="",state:h=null,key:y="default"}=r,v=x.useMemo(()=>{let k=ai(c,l);return k==null?null:{location:{pathname:k,search:f,hash:d,state:h,key:y},navigationType:i}},[l,c,f,d,h,y,i]);return v==null?null:x.createElement(er.Provider,{value:u},x.createElement(Ep.Provider,{children:n,value:v}))}new Promise(()=>{});function Ud(e,t){t===void 0&&(t=[]);let n=[];return x.Children.forEach(e,(r,i)=>{if(!x.isValidElement(r))return;let o=[...t,i];if(r.type===x.Fragment){n.push.apply(n,Ud(r.props.children,o));return}r.type!==Is&&ie(!1),!r.props.index||!r.props.children||ie(!1);let s={id:r.props.id||o.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(s.children=Ud(r.props.children,o)),n.push(s)}),n}function mP(e){let t={hasErrorBoundary:e.ErrorBoundary!=null||e.errorElement!=null};return e.Component&&Object.assign(t,{element:x.createElement(e.Component),Component:void 0}),e.HydrateFallback&&Object.assign(t,{hydrateFallbackElement:x.createElement(e.HydrateFallback),HydrateFallback:void 0}),e.ErrorBoundary&&Object.assign(t,{errorElement:x.createElement(e.ErrorBoundary),ErrorBoundary:void 0}),t}/** - * React Router DOM v6.23.1 - * - * Copyright (c) Remix Software Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */function ji(){return ji=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&(n[i]=e[i]);return n}const Dl="get",gf="application/x-www-form-urlencoded";function Ac(e){return e!=null&&typeof e.tagName=="string"}function gP(e){return Ac(e)&&e.tagName.toLowerCase()==="button"}function yP(e){return Ac(e)&&e.tagName.toLowerCase()==="form"}function vP(e){return Ac(e)&&e.tagName.toLowerCase()==="input"}function wP(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function xP(e,t){return e.button===0&&(!t||t==="_self")&&!wP(e)}function Hd(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(i=>[n,i]):[[n,r]])},[]))}function SP(e,t){let n=Hd(e);return t&&t.forEach((r,i)=>{n.has(i)||t.getAll(i).forEach(o=>{n.append(i,o)})}),n}let gl=null;function bP(){if(gl===null)try{new FormData(document.createElement("form"),0),gl=!1}catch{gl=!0}return gl}const EP=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function yf(e){return e!=null&&!EP.has(e)?null:e}function kP(e,t){let n,r,i,o,s;if(yP(e)){let a=e.getAttribute("action");r=a?ai(a,t):null,n=e.getAttribute("method")||Dl,i=yf(e.getAttribute("enctype"))||gf,o=new FormData(e)}else if(gP(e)||vP(e)&&(e.type==="submit"||e.type==="image")){let a=e.form;if(a==null)throw new Error('Cannot submit a