|
|
*/var su=/["'&<>]/,ru=function(e){var t,i=""+e,n=su.exec(i);if(!n)return i;var o="",s=0,r=0;for(s=n.index;s<i.length;s++){switch(i.charCodeAt(s)){case 34:t=""";break;case 38:t="&";break;case 39:t="'";break;case 60:t="<";break;case 62:t=">";break;default:continue}r!==s&&(o+=i.substring(r,s)),r=s+1,o+=t}return r!==s?o+i.substring(r,s):o};const au=function(e){let t=e.target;for(;t&&"HTML"!==t.tagName.toUpperCase();){if("TD"===t.tagName.toUpperCase())return t;t=t.parentNode}return null},lu=function(e){return null!==e&&"object"==typeof e},du=function(e,t,i,n,o){if(!t&&!n&&(!o||Array.isArray(o)&&!o.length))return e;i="string"==typeof i?"descending"===i?-1:1:i&&i<0?-1:1;const s=n?null:function(i,n){return o?(Array.isArray(o)||(o=[o]),o.map((t=>"string"==typeof t?le(i,t):t(i,n,e)))):("$key"!==t&&lu(i)&&"$value"in i&&(i=i.$value),[lu(i)?le(i,t):i])};return e.map(((e,t)=>({value:e,index:t,key:s?s(e,t):null}))).sort(((e,t)=>{let o=function(e,t){if(n)return n(e.value,t.value);for(let i=0,n=e.key.length;i<n;i++){if(e.key[i]<t.key[i])return-1;if(e.key[i]>t.key[i])return 1}return 0}(e,t);return o||(o=e.index-t.index),o*+i})).map((e=>e.value))},cu=function(e,t){let i=null;return e.columns.forEach((e=>{e.id===t&&(i=e)})),i},hu=function(e,t,i){const n=(t.className||"").match(new RegExp(`${i}-table_[^\\s]+`,"gm"));return n?cu(e,n[0]):null},uu=(e,t)=>{if(!e)throw new Error("Row is required when get row identity");if("string"==typeof t){if(!t.includes("."))return`${e[t]}`;const i=t.split(".");let n=e;for(const e of i)n=n[e];return`${n}`}if("function"==typeof t)return t.call(null,e)},gu=function(e,t){const i={};return(e||[]).forEach(((e,n)=>{i[uu(e,t)]={row:e,index:n}})),i};function pu(e){return""===e||void 0!==e&&(e=Number.parseInt(e,10),Number.isNaN(e)&&(e="")),e}function mu(e){return""===e||void 0!==e&&(e=pu(e),Number.isNaN(e)&&(e=80)),e}function fu(e){return"number"==typeof e?e:"string"==typeof e?/^\d+(?:px)?$/.test(e)?Number.parseInt(e,10):e:null}function _u(e,t,i){let n=!1;const o=e.indexOf(t),s=-1!==o,r=()=>{e.push(t),n=!0},a=()=>{e.splice(o,1),n=!0};return"boolean"==typeof i?i&&!s?r():!i&&s&&a():s?a():r(),n}function vu(e,t,i="children",n="hasChildren"){const o=e=>!(Array.isArray(e)&&e.length);function s(e,r,a){t(e,r,a),r.forEach((e=>{if(e[n])return void t(e,null,a+1);const r=e[i];o(r)||s(e,r,a+1)}))}e.forEach((e=>{if(e[n])return void t(e,null,0);const r=e[i];o(r)||s(e,r,0)}))}let bu;const wu=(e,t,i,n)=>{let o,s=0,r=e;if(n){if(n[e].colSpan>1)return{};for(let t=0;t<e;t++)s+=n[t].colSpan;r=s+n[e].colSpan-1}else s=e;const a=i.states.columns;switch(t){case"left":r<i.states.fixedLeafColumnsLength.value&&(o="left");break;case"right":s>=a.value.length-i.states.rightFixedLeafColumnsLength.value&&(o="right");break;default:r<i.states.fixedLeafColumnsLength.value?o="left":s>=a.value.length-i.states.rightFixedLeafColumnsLength.value&&(o="right")}return o?{direction:o,start:s,after:r}:{}},Cu=(e,t,i,n,o)=>{const s=[],{direction:r,start:a}=wu(t,i,n,o);if(r){const t="left"===r;s.push(`${e}-fixed-column--${r}`),t&&a===n.states.fixedLeafColumnsLength.value-1?s.push("is-last-column"):t||a!==n.states.columns.value.length-n.states.rightFixedLeafColumnsLength.value||s.push("is-first-column")}return s};function yu(e,t){return e+(null===t.realWidth||Number.isNaN(t.realWidth)?Number(t.width):t.realWidth)}const xu=(e,t,i,n)=>{const{direction:o,start:s=0}=wu(e,t,i,n);if(!o)return;const r={},a="left"===o,l=i.states.columns.value;return a?r.left=l.slice(0,e).reduce(yu,0):r.right=l.slice(s+1).reverse().reduce(yu,0),r},Su=(e,t)=>{e&&(Number.isNaN(e[t])||(e[t]=`${e[t]}px`))};const ku=e=>{const t=[];return e.forEach((e=>{e.children?t.push.apply(t,ku(e.children)):t.push(e)})),t};function Du(){var e;const t=en(),{size:i}=pi(null==(e=t.proxy)?void 0:e.$props),n=ai(null),o=ai([]),s=ai([]),r=ai(!1),a=ai([]),l=ai([]),d=ai([]),c=ai([]),h=ai([]),u=ai([]),g=ai([]),p=ai([]),m=ai(0),f=ai(0),_=ai(0),v=ai(!1),b=ai([]),w=ai(!1),C=ai(!1),y=ai(null),x=ai({}),S=ai(null),k=ai(null),D=ai(null),L=ai(null),N=ai(null);Qn(o,(()=>t.state&&I(!1)),{deep:!0});const E=()=>{c.value=a.value.filter((e=>!0===e.fixed||"left"===e.fixed)),h.value=a.value.filter((e=>"right"===e.fixed)),c.value.length>0&&a.value[0]&&"selection"===a.value[0].type&&!a.value[0].fixed&&(a.value[0].fixed=!0,c.value.unshift(a.value[0]));const e=a.value.filter((e=>!e.fixed));l.value=[].concat(c.value).concat(e).concat(h.value);const t=ku(e),i=ku(c.value),n=ku(h.value);m.value=t.length,f.value=i.length,_.value=n.length,d.value=[].concat(i).concat(t).concat(n),r.value=c.value.length>0||h.value.length>0},I=(e,i=!1)=>{e&&E(),i?t.state.doLayout():t.state.debouncedUpdateLayout()},T=e=>{var i;if(!t||!t.store)return 0;const{treeData:n}=t.store.states;let o=0;const s=null==(i=n.value[e])?void 0:i.children;return s&&(o+=s.length,s.forEach((e=>{o+=T(e)}))),o},M=(e,t,i)=>{k.value&&k.value!==e&&(k.value.order=null),k.value=e,D.value=t,L.value=i},A=()=>{let e=fi(s);Object.keys(x.value).forEach((t=>{const i=x.value[t];if(!i||0===i.length)return;const n=cu({columns:d.value},t);n&&n.filterMethod&&(e=e.filter((e=>i.some((t=>n.filterMethod.call(null,t,e,n))))))})),S.value=e},O=()=>{o.value=((e,t)=>{const i=t.sortingColumn;return i&&"string"!=typeof i.sortable?du(e,t.sortProp,t.sortOrder,i.sortMethod,i.sortBy):e})(S.value,{sortingColumn:k.value,sortProp:D.value,sortOrder:L.value})},{setExpandRowKeys:R,toggleRowExpansion:P,updateExpandRows:F,states:B,isRowExpanded:V}=function(e){const t=en(),i=ai(!1),n=ai([]);return{updateExpandRows:()=>{const t=e.data.value||[],o=e.rowKey.value;if(i.value)n.value=t.slice();else if(o){const e=gu(n.value,o);n.value=t.reduce(((t,i)=>{const n=uu(i,o);return e[n]&&t.push(i),t}),[])}else n.value=[]},toggleRowExpansion:(e,i)=>{_u(n.value,e,i)&&t.emit("expand-change",e,n.value.slice())},setExpandRowKeys:i=>{t.store.assertRowKey();const o=e.data.value||[],s=e.rowKey.value,r=gu(o,s);n.value=i.reduce(((e,t)=>{const i=r[t];return i&&e.push(i.row),e}),[])},isRowExpanded:t=>{const i=e.rowKey.value;return i?!!gu(n.value,i)[uu(t,i)]:n.value.includes(t)},states:{expandRows:n,defaultExpandAll:i}}}({data:o,rowKey:n}),{updateTreeExpandKeys:W,toggleTreeExpansion:z,updateTreeData:H,loadOrToggle:j,states:U}=function(e){const t=ai([]),i=ai({}),n=ai(16),o=ai(!1),s=ai({}),r=ai("hasChildren"),a=ai("children"),l=en(),d=Pi((()=>{if(!e.rowKey.value)return{};const t=e.data.value||[];return h(t)})),c=Pi((()=>{const t=e.rowKey.value,i=Object.keys(s.value),n={};return i.length?(i.forEach((e=>{if(s.value[e].length){const i={children:[]};s.value[e].forEach((e=>{const o=uu(e,t);i.children.push(o),e[r.value]&&!n[o]&&(n[o]={children:[]})})),n[e]=i}})),n):n})),h=t=>{const i=e.rowKey.value,n={};return vu(t,((e,t,s)=>{const r=uu(e,i);Array.isArray(t)?n[r]={children:t.map((e=>uu(e,i))),level:s}:o.value&&(n[r]={children:[],lazy:!0,level:s})}),a.value,r.value),n},u=(e=!1,n=(e=>null==(e=l.store)?void 0:e.states.defaultExpandAll.value)())=>{var s;const r=d.value,a=c.value,h=Object.keys(r),u={};if(h.length){const s=fi(i),l=[],d=(i,o)=>{if(e)return t.value?n||t.value.includes(o):!(!n&&!(null==i?void 0:i.expanded));{const e=n||t.value&&t.value.includes(o);return!(!(null==i?void 0:i.expanded)&&!e)}};h.forEach((e=>{const t=s[e],i={...r[e]};if(i.expanded=d(t,e),i.lazy){const{loaded:n=!1,loading:o=!1}=t||{};i.loaded=!!n,i.loading=!!o,l.push(e)}u[e]=i}));const c=Object.keys(a);o.value&&c.length&&l.length&&c.forEach((e=>{const t=s[e],i=a[e].children;if(l.includes(e)){if(0!==u[e].children.length)throw new Error("[ElTable]children must be an empty array.");u[e].children=i}else{const{loaded:n=!1,loading:o=!1}=t||{};u[e]={lazy:!0,loaded:!!n,loading:!!o,expanded:d(t,e),children:i,level:""}}}))}i.value=u,null==(s=l.store)||s.updateTableScrollY()};Qn((()=>t.value),(()=>{u(!0)})),Qn((()=>d.value),(()=>{u()})),Qn((()=>c.value),(()=>{u()}));const g=(t,n)=>{l.store.assertRowKey();const o=e.rowKey.value,s=uu(t,o),r=s&&i.value[s];if(s&&r&&"expanded"in r){const e=r.expanded;n=void 0===n?!r.expanded:n,i.value[s].expanded=n,e!==n&&l.emit("expand-change",t,n),l.store.updateTableScrollY()}},p=(e,t,n)=>{const{load:o}=l.props;o&&!i.value[t].loaded&&(i.value[t].loading=!0,o(e,n,(n=>{if(!Array.isArray(n))throw new TypeError("[ElTable] data must be an array");i.value[t].loading=!1,i.value[t].loaded=!0,i.value[t].expanded=!0,n.length&&(s.value[t]=n),l.emit("expand-change",e,!0)})))};return{loadData:p,loadOrToggle:t=>{l.store.assertRowKey();const n=e.rowKey.value,s=uu(t,n),r=i.value[s];o.value&&r&&"loaded"in r&&!r.loaded?p(t,s,r):g(t,void 0)},toggleTreeExpansion:g,updateTreeExpandKeys:e=>{t.value=e,u()},updateTreeData:u,normalize:h,states:{expandRowKeys:t,treeData:i,indent:n,lazy:o,lazyTreeNodeMap:s,lazyColumnIdentifier:r,childrenColumnName:a}}}({data:o,rowKey:n}),{updateCurrentRowData:$,updateCurrentRow:K,setCurrentRowKey:q,states:G}=function(e){const t=en(),i=ai(null),n=ai(null),o=()=>{i.value=null},s=i=>{const{data:o,rowKey:s}=e;let r=null;s.value&&(r=(fi(o)||[]).find((e=>uu(e,s.value)===i))),n.value=r,t.emit("current-change",n.value,null)};return{setCurrentRowKey:e=>{t.store.assertRowKey(),i.value=e,s(e)},restoreCurrentRowKey:o,setCurrentRowByKey:s,updateCurrentRow:e=>{const i=n.value;if(e&&e!==i)return n.value=e,void t.emit("current-change",n.value,i);!e&&i&&(n.value=null,t.emit("current-change",null,i))},updateCurrentRowData:()=>{const r=e.rowKey.value,a=e.data.value||[],l=n.value;if(!a.includes(l)&&l){if(r){const e=uu(l,r);s(e)}else n.value=null;null===n.value&&t.emit("current-change",null,l)}else i.value&&(s(i.value),o())},states:{_currentRowKey:i,currentRow:n}}}({data:o,rowKey:n});return{assertRowKey:()=>{if(!n.value)throw new Error("[ElTable] prop row-key is required")},updateColumns:E,scheduleLayout:I,isSelected:e=>b.value.includes(e),clearSelection:()=>{v.value=!1;b.value.length&&(b.value=[],t.emit("selection-change",[]))},cleanSelection:()=>{let e;if(n.value){e=[];const t=gu(b.value,n.value),i=gu(o.value,n.value);for(const n in t)Ro(t,n)&&!i[n]&&e.push(t[n].row)}else e=b.value.filter((e=>!o.value.includes(e)));if(e.length){const i=b.value.filter((t=>!e.includes(t)));b.value=i,t.emit("selection-change",i.slice())}},getSelectionRows:()=>(b.value||[]).slice(),toggleRowSelection:(e,i,n=!0)=>{if(_u(b.value,e,i)){const i=(b.value||[]).slice();n&&t.emit("select",i,e),t.emit("selection-change",i)}},_toggleAllSelection:()=>{var e,i;const n=C.value?!v.value:!(v.value||b.value.length);v.value=n;let s=!1,r=0;const a=null==(i=null==(e=null==t?void 0:t.store)?void 0:e.states)?void 0:i.rowKey.value;o.value.forEach(((e,t)=>{const i=t+r;y.value?y.value.call(null,e,i)&&_u(b.value,e,n)&&(s=!0):_u(b.value,e,n)&&(s=!0),r+=T(uu(e,a))})),s&&t.emit("selection-change",b.value?b.value.slice():[]),t.emit("select-all",b.value)},toggleAllSelection:null,updateSelectionByRowKey:()=>{const e=gu(b.value,n.value);o.value.forEach((t=>{const i=uu(t,n.value),o=e[i];o&&(b.value[o.index]=t)}))},updateAllSelected:()=>{var e,i,s;if(0===(null==(e=o.value)?void 0:e.length))return void(v.value=!1);let r;n.value&&(r=gu(b.value,n.value));let a=!0,l=0,d=0;for(let h=0,u=(o.value||[]).length;h<u;h++){const e=null==(s=null==(i=null==t?void 0:t.store)?void 0:i.states)?void 0:s.rowKey.value,u=h+d,g=o.value[h],p=y.value&&y.value.call(null,g,u);if(c=g,r?r[uu(c,n.value)]:b.value.includes(c))l++;else if(!y.value||p){a=!1;break}d+=T(uu(g,e))}var c;0===l&&(a=!1),v.value=a},updateFilters:(e,t)=>{Array.isArray(e)||(e=[e]);const i={};return e.forEach((e=>{x.value[e.id]=t,i[e.columnKey||e.id]=t})),i},updateCurrentRow:K,updateSort:M,execFilter:A,execSort:O,execQuery:e=>{e&&e.filter||A(),O()},clearFilter:e=>{const{tableHeaderRef:i}=t.refs;if(!i)return;const n=Object.assign({},i.filterPanels),o=Object.keys(n);if(o.length)if("string"==typeof e&&(e=[e]),Array.isArray(e)){const i=e.map((e=>function(e,t){let i=null;for(let n=0;n<e.columns.length;n++){const o=e.columns[n];if(o.columnKey===t){i=o;break}}return i}({columns:d.value},e)));o.forEach((e=>{const t=i.find((t=>t.id===e));t&&(t.filteredValue=[])})),t.store.commit("filterChange",{column:i,values:[],silent:!0,multi:!0})}else o.forEach((e=>{const t=d.value.find((t=>t.id===e));t&&(t.filteredValue=[])})),x.value={},t.store.commit("filterChange",{column:{},values:[],silent:!0})},clearSort:()=>{k.value&&(M(null,null,null),t.store.commit("changeSortCondition",{silent:!0}))},toggleRowExpansion:P,setExpandRowKeysAdapter:e=>{R(e),W(e)},setCurrentRowKey:q,toggleRowExpansionAdapter:(e,t)=>{d.value.some((({type:e})=>"expand"===e))?P(e,t):z(e,t)},isRowExpanded:V,updateExpandRows:F,updateCurrentRowData:$,loadOrToggle:j,updateTreeData:H,states:{tableSize:i,rowKey:n,data:o,_data:s,isComplex:r,_columns:a,originColumns:l,columns:d,fixedColumns:c,rightFixedColumns:h,leafColumns:u,fixedLeafColumns:g,rightFixedLeafColumns:p,leafColumnsLength:m,fixedLeafColumnsLength:f,rightFixedLeafColumnsLength:_,isAllSelected:v,selection:b,reserveSelection:w,selectOnIndeterminate:C,selectable:y,filters:x,filteredData:S,sortingColumn:k,sortProp:D,sortOrder:L,hoverRow:N,...B,...U,...G}}}function Lu(e,t){return e.map((e=>{var i;return e.id===t.id?t:((null==(i=e.children)?void 0:i.length)&&(e.children=Lu(e.children,t)),e)}))}function Nu(e){e.forEach((e=>{var t,i;e.no=null==(t=e.getColumnIndex)?void 0:t.call(e),(null==(i=e.children)?void 0:i.length)&&Nu(e.children)})),e.sort(((e,t)=>e.no-t.no))}function Eu(){const e=en(),t=Du(),i={setData(t,i){const n=fi(t._data)!==i;t.data.value=i,t._data.value=i,e.store.execQuery(),e.store.updateCurrentRowData(),e.store.updateExpandRows(),e.store.updateTreeData(e.store.states.defaultExpandAll.value),fi(t.reserveSelection)?(e.store.assertRowKey(),e.store.updateSelectionByRowKey()):n?e.store.clearSelection():e.store.cleanSelection(),e.store.updateAllSelected(),e.$ready&&e.store.scheduleLayout()},insertColumn(t,i,n){const o=fi(t._columns);let s=[];n?(n&&!n.children&&(n.children=[]),n.children.push(i),s=Lu(o,n)):(o.push(i),s=o),Nu(s),t._columns.value=s,"selection"===i.type&&(t.selectable.value=i.selectable,t.reserveSelection.value=i.reserveSelection),e.$ready&&(e.store.updateColumns(),e.store.scheduleLayout())},removeColumn(t,i,n){const o=fi(t._columns)||[];if(n)n.children.splice(n.children.findIndex((e=>e.id===i.id)),1),0===n.children.length&&delete n.children,t._columns.value=Lu(o,n);else{const e=o.indexOf(i);e>-1&&(o.splice(e,1),t._columns.value=o)}e.$ready&&(e.store.updateColumns(),e.store.scheduleLayout())},sort(t,i){const{prop:n,order:o,init:s}=i;if(n){const i=fi(t.columns).find((e=>e.property===n));i&&(i.order=o,e.store.updateSort(i,n,o),e.store.commit("changeSortCondition",{init:s}))}},changeSortCondition(t,i){const{sortingColumn:n,sortProp:o,sortOrder:s}=t;null===fi(s)&&(t.sortingColumn.value=null,t.sortProp.value=null);e.store.execQuery({filter:!0}),i&&(i.silent||i.init)||e.emit("sort-change",{column:fi(n),prop:fi(o),order:fi(s)}),e.store.updateTableScrollY()},filterChange(t,i){const{column:n,values:o,silent:s}=i,r=e.store.updateFilters(n,o);e.store.execQuery(),s||e.emit("filter-change",r),e.store.updateTableScrollY()},toggleAllSelection(){e.store.toggleAllSelection()},rowSelectedChanged(t,i){e.store.toggleRowSelection(i),e.store.updateAllSelected()},setHoverRow(e,t){e.hoverRow.value=t},setCurrentRow(t,i){e.store.updateCurrentRow(i)}};return{ns:o("table"),...t,mutations:i,commit:function(t,...i){const n=e.store.mutations;if(!n[t])throw new Error(`Action not found: ${t}`);n[t].apply(e,[e.store.states].concat(i))},updateTableScrollY:function(){gn((()=>e.layout.updateScrollY.apply(e.layout)))}}}const Iu={rowKey:"rowKey",defaultExpandAll:"defaultExpandAll",selectOnIndeterminate:"selectOnIndeterminate",indent:"indent",lazy:"lazy",data:"data","treeProps.hasChildren":{key:"lazyColumnIdentifier",default:"hasChildren"},"treeProps.children":{key:"childrenColumnName",default:"children"}};function Tu(e,t){if(!e)throw new Error("Table is required.");const i=Eu();return i.toggleAllSelection=z(i._toggleAllSelection,10),Object.keys(Iu).forEach((e=>{Mu(Au(t,e),e,i)})),function(e,t){Object.keys(Iu).forEach((i=>{Qn((()=>Au(t,i)),(t=>{Mu(t,i,e)}))}))}(i,t),i}function Mu(e,t,i){let n=e,o=Iu[t];"object"==typeof Iu[t]&&(o=o.key,n=n||Iu[t].default),i.states[o].value=n}function Au(e,t){if(t.includes(".")){const i=t.split(".");let n=e;return i.forEach((e=>{n=n[e]})),n}return e[t]}class Ou{constructor(e){this.observers=[],this.table=null,this.store=null,this.columns=[],this.fit=!0,this.showHeader=!0,this.height=ai(null),this.scrollX=ai(!1),this.scrollY=ai(!1),this.bodyWidth=ai(null),this.fixedWidth=ai(null),this.rightFixedWidth=ai(null),this.tableHeight=ai(null),this.headerHeight=ai(44),this.appendHeight=ai(0),this.footerHeight=ai(44),this.viewportHeight=ai(null),this.bodyHeight=ai(null),this.bodyScrollHeight=ai(0),this.fixedBodyHeight=ai(null),this.gutterWidth=0;for(const t in e)Ro(e,t)&&(ei(this[t])?this[t].value=e[t]:this[t]=e[t]);if(!this.table)throw new Error("Table is required for Table Layout");if(!this.store)throw new Error("Store is required for Table Layout")}updateScrollY(){if(null===this.height.value)return!1;const e=this.table.refs.bodyWrapper;if(this.table.vnode.el&&e){let t=!0;const i=this.scrollY.value;return t=null!==this.bodyHeight.value&&e.scrollHeight>this.bodyHeight.value,this.scrollY.value=t,i!==t}return!1}setHeight(e,t="height"){if(!E)return;const i=this.table.vnode.el;if(e=fu(e),this.height.value=Number(e),!i&&(e||0===e))return gn((()=>this.setHeight(e,t)));"number"==typeof e?(i.style[t]=`${e}px`,this.updateElsHeight()):"string"==typeof e&&(i.style[t]=e,this.updateElsHeight())}setMaxHeight(e){this.setHeight(e,"max-height")}getFlattenColumns(){const e=[];return this.table.store.states.columns.value.forEach((t=>{t.isColumnGroup?e.push.apply(e,t.columns):e.push(t)})),e}updateElsHeight(){var e,t;if(!this.table.$ready)return gn((()=>this.updateElsHeight()));const{tableWrapper:i,headerWrapper:n,appendWrapper:o,footerWrapper:s,tableHeader:r,tableBody:a}=this.table.refs;if(i&&"none"===i.style.display)return;const{tableLayout:l}=this.table.props;if(this.appendHeight.value=o?o.offsetHeight:0,this.showHeader&&!n&&"fixed"===l)return;const d=r||null,c=this.headerDisplayNone(d),h=(null==n?void 0:n.offsetHeight)||0,u=this.headerHeight.value=this.showHeader?h:0;if(this.showHeader&&!c&&h>0&&(this.table.store.states.columns.value||[]).length>0&&u<2)return gn((()=>this.updateElsHeight()));const g=this.tableHeight.value=null==(t=null==(e=this.table)?void 0:e.vnode.el)?void 0:t.clientHeight,p=this.footerHeight.value=s?s.offsetHeight:0;null!==this.height.value&&(null===this.bodyHeight.value&&requestAnimationFrame((()=>this.updateElsHeight())),this.bodyHeight.value=g-u-p+(s?1:0),this.bodyScrollHeight.value=null==a?void 0:a.scrollHeight),this.fixedBodyHeight.value=this.scrollX.value?this.bodyHeight.value-this.gutterWidth:this.bodyHeight.value,this.viewportHeight.value=this.scrollX.value?g-this.gutterWidth:g,this.updateScrollY(),this.notifyObservers("scrollable")}headerDisplayNone(e){if(!e)return!0;let t=e;for(;"DIV"!==t.tagName;){if("none"===getComputedStyle(t).display)return!0;t=t.parentElement}return!1}updateColumnsWidth(){if(!E)return;const e=this.fit,t=this.table.vnode.el.clientWidth;let i=0;const n=this.getFlattenColumns(),o=n.filter((e=>"number"!=typeof e.width));if(n.forEach((e=>{"number"==typeof e.width&&e.realWidth&&(e.realWidth=null)})),o.length>0&&e){if(n.forEach((e=>{i+=Number(e.width||e.minWidth||80)})),i<=t){this.scrollX.value=!1;const e=t-i;if(1===o.length)o[0].realWidth=Number(o[0].minWidth||80)+e;else{const t=e/o.reduce(((e,t)=>e+Number(t.minWidth||80)),0);let i=0;o.forEach(((e,n)=>{if(0===n)return;const o=Math.floor(Number(e.minWidth||80)*t);i+=o,e.realWidth=Number(e.minWidth||80)+o})),o[0].realWidth=Number(o[0].minWidth||80)+e-i}}else this.scrollX.value=!0,o.forEach((e=>{e.realWidth=Number(e.minWidth)}));this.bodyWidth.value=Math.max(i,t),this.table.state.resizeState.value.width=this.bodyWidth.value}else n.forEach((e=>{e.width||e.minWidth?e.realWidth=Number(e.width||e.minWidth):e.realWidth=80,i+=e.realWidth})),this.scrollX.value=i>t,this.bodyWidth.value=i;const s=this.store.states.fixedColumns.value;if(s.length>0){let e=0;s.forEach((t=>{e+=Number(t.realWidth||t.width)})),this.fixedWidth.value=e}const r=this.store.states.rightFixedColumns.value;if(r.length>0){let e=0;r.forEach((t=>{e+=Number(t.realWidth||t.width)})),this.rightFixedWidth.value=e}this.notifyObservers("columns")}addObserver(e){this.observers.push(e)}removeObserver(e){const t=this.observers.indexOf(e);-1!==t&&this.observers.splice(t,1)}notifyObservers(e){this.observers.forEach((t=>{var i,n;switch(e){case"columns":null==(i=t.state)||i.onColumnsChange(this);break;case"scrollable":null==(n=t.state)||n.onScrollableChange(this);break;default:throw new Error(`Table Layout don't have event ${e}.`)}}))}}const{CheckboxGroup:Ru}=dc,Pu=Zi({name:"ElTableFilterPanel",components:{ElCheckbox:dc,ElCheckboxGroup:Ru,ElScrollbar:C,ElTooltip:R,ElIcon:w,ArrowDown:et,ArrowUp:nt},directives:{ClickOutside:F},props:{placement:{type:String,default:"bottom-start"},store:{type:Object},column:{type:Object},upDataColumn:{type:Function}},setup(e){const t=en(),{t:i}=y(),n=o("table-filter"),s=null==t?void 0:t.parent;s.filterPanels.value[e.column.id]||(s.filterPanels.value[e.column.id]=t);const r=ai(!1),a=ai(null),l=Pi((()=>e.column&&e.column.filters)),d=Pi({get:()=>{var t;return((null==(t=e.column)?void 0:t.filteredValue)||[])[0]},set:e=>{c.value&&(null!=e?c.value.splice(0,1,e):c.value.splice(0,1))}}),c=Pi({get:()=>e.column&&e.column.filteredValue||[],set(t){e.column&&e.upDataColumn("filteredValue",t)}}),h=Pi((()=>!e.column||e.column.filterMultiple)),u=()=>{r.value=!1},g=t=>{e.store.commit("filterChange",{column:e.column,values:t}),e.store.updateAllSelected()};Qn(r,(t=>{e.column&&e.upDataColumn("filterOpened",t)}),{immediate:!0});const p=Pi((()=>{var e,t;return null==(t=null==(e=a.value)?void 0:e.popperRef)?void 0:t.contentRef}));return{tooltipVisible:r,multiple:h,filteredValue:c,filterValue:d,filters:l,handleConfirm:()=>{g(c.value),u()},handleReset:()=>{c.value=[],g(c.value),u()},handleSelect:e=>{d.value=e,g(null!=e?c.value:[]),u()},isActive:e=>e.value===d.value,t:i,ns:n,showFilterPanel:e=>{e.stopPropagation(),r.value=!r.value},hideFilterPanel:()=>{r.value=!1},popperPaneRef:p,tooltip:a}}}),Fu={key:0},Bu=["disabled"],Vu=["label","onClick"];var Wu=r(Pu,[["render",function(e,t,i,n,o,s){const r=On("el-checkbox"),a=On("el-checkbox-group"),l=On("el-scrollbar"),d=On("arrow-up"),c=On("arrow-down"),h=On("el-icon"),u=On("el-tooltip"),g=Rn("click-outside");return Dn(),Fi(u,{ref:"tooltip",visible:e.tooltipVisible,"onUpdate:visible":t[5]||(t[5]=t=>e.tooltipVisible=t),offset:0,placement:e.placement,"show-arrow":!1,"stop-popper-mouse-event":!1,teleported:"",effect:"light",pure:"","popper-class":e.ns.b(),persistent:""},{content:no((()=>[e.multiple?(Dn(),Vi("div",Fu,[Wi("div",{class:bi(e.ns.e("content"))},[qi(l,{"wrap-class":e.ns.e("wrap")},{default:no((()=>[qi(a,{modelValue:e.filteredValue,"onUpdate:modelValue":t[0]||(t[0]=t=>e.filteredValue=t),class:bi(e.ns.e("checkbox-group"))},{default:no((()=>[(Dn(!0),Vi(Di,null,Mn(e.filters,(e=>(Dn(),Fi(r,{key:e.value,label:e.value},{default:no((()=>[Ki(yi(e.text),1)])),_:2},1032,["label"])))),128))])),_:1},8,["modelValue","class"])])),_:1},8,["wrap-class"])],2),Wi("div",{class:bi(e.ns.e("bottom"))},[Wi("button",{class:bi({[e.ns.is("disabled")]:0===e.filteredValue.length}),disabled:0===e.filteredValue.length,type:"button",onClick:t[1]||(t[1]=(...t)=>e.handleConfirm&&e.handleConfirm(...t))},yi(e.t("el.table.confirmFilter")),11,Bu),Wi("button",{type:"button",onClick:t[2]||(t[2]=(...t)=>e.handleReset&&e.handleReset(...t))},yi(e.t("el.table.resetFilter")),1)],2)])):(Dn(),Vi("ul",{key:1,class:bi(e.ns.e("list"))},[Wi("li",{class:bi([e.ns.e("list-item"),{[e.ns.is("active")]:void 0===e.filterValue||null===e.filterValue}]),onClick:t[3]||(t[3]=t=>e.handleSelect(null))},yi(e.t("el.table.clearFilter")),3),(Dn(!0),Vi(Di,null,Mn(e.filters,(t=>(Dn(),Vi("li",{key:t.value,class:bi([e.ns.e("list-item"),e.ns.is("active",e.isActive(t))]),label:t.value,onClick:i=>e.handleSelect(t.value)},yi(t.text),11,Vu)))),128))],2))])),default:no((()=>[so((Dn(),Vi("span",{class:bi([`${e.ns.namespace.value}-table__column-filter-trigger`,`${e.ns.namespace.value}-none-outline`]),onClick:t[4]||(t[4]=(...t)=>e.showFilterPanel&&e.showFilterPanel(...t))},[qi(h,null,{default:no((()=>[e.column.filterOpened?(Dn(),Fi(d,{key:0})):(Dn(),Fi(c,{key:1}))])),_:1})],2)),[[g,e.hideFilterPanel,e.popperPaneRef]])])),_:1},8,["visible","placement","popper-class"])}],["__file","/home/runner/work/element-plus/element-plus/packages/components/table/src/filter-panel.vue"]]);function zu(e){const t=en();mn((()=>{i.value.addObserver(t)})),wn((()=>{n(i.value),o(i.value)})),kn((()=>{n(i.value),o(i.value)})),Sn((()=>{i.value.removeObserver(t)}));const i=Pi((()=>{const t=e.layout;if(!t)throw new Error("Can not find table layout.");return t})),n=t=>{var i;const n=(null==(i=e.vnode.el)?void 0:i.querySelectorAll("colgroup > col"))||[];if(!n.length)return;const o=t.getFlattenColumns(),s={};o.forEach((e=>{s[e.id]=e}));for(let e=0,r=n.length;e<r;e++){const t=n[e],i=t.getAttribute("name"),o=s[i];o&&t.setAttribute("width",o.realWidth||o.width)}},o=t=>{var i,n;const o=(null==(i=e.vnode.el)?void 0:i.querySelectorAll("colgroup > col[name=gutter]"))||[];for(let e=0,r=o.length;e<r;e++){o[e].setAttribute("width",t.scrollY.value?t.gutterWidth:"0")}const s=(null==(n=e.vnode.el)?void 0:n.querySelectorAll("th.gutter"))||[];for(let e=0,r=s.length;e<r;e++){const i=s[e];i.style.width=t.scrollY.value?`${t.gutterWidth}px`:"0",i.style.display=t.scrollY.value?"":"none"}};return{tableLayout:i.value,onColumnsChange:n,onScrollableChange:o}}const Hu=Symbol("ElTable");const ju=e=>{const t=[];return e.forEach((e=>{e.children?(t.push(e),t.push.apply(t,ju(e.children))):t.push(e)})),t};function Uu(e){const t=an(Hu),i=Pi((()=>(e=>{let t=1;const i=(e,n)=>{if(n&&(e.level=n.level+1,t<e.level&&(t=e.level)),e.children){let t=0;e.children.forEach((n=>{i(n,e),t+=n.colSpan})),e.colSpan=t}else e.colSpan=1};e.forEach((e=>{e.level=1,i(e,void 0)}));const n=[];for(let o=0;o<t;o++)n.push([]);return ju(e).forEach((e=>{e.children?(e.rowSpan=1,e.children.forEach((e=>e.isSubColumn=!0))):e.rowSpan=t-e.level+1,n[e.level-1].push(e)})),n})(e.store.states.originColumns.value)));return{isGroup:Pi((()=>{const e=i.value.length>1;return e&&t&&(t.state.isGroup.value=!0),e})),toggleAllSelection:e=>{e.stopPropagation(),null==t||t.store.commit("toggleAllSelection")},columnRows:i}}var $u=Zi({name:"ElTableHeader",components:{ElCheckbox:dc},props:{fixed:{type:String,default:""},store:{required:!0,type:Object},border:Boolean,defaultSort:{type:Object,default:()=>({prop:"",order:""})}},setup(e,{emit:t}){const i=en(),n=an(Hu),s=o("table"),r=ai({}),{onColumnsChange:a,onScrollableChange:l}=zu(n);wn((async()=>{await gn(),await gn();const{prop:t,order:i}=e.defaultSort;null==n||n.store.commit("sort",{prop:t,order:i,init:!0})}));const{handleHeaderClick:d,handleHeaderContextMenu:c,handleMouseDown:h,handleMouseMove:u,handleMouseOut:g,handleSortClick:p,handleFilterClick:m}=function(e,t){const i=en(),n=an(Hu),o=e=>{e.stopPropagation()},s=ai(null),r=ai(!1),a=ai({}),l=(t,i,o)=>{t.stopPropagation();const s=i.order===o?null:o||(({order:e,sortOrders:t})=>{if(""===e)return t[0];const i=t.indexOf(e||null);return t[i>t.length-2?0:i+1]})(i);let r=t.target;for(;r&&"TH"!==r.tagName;)r=r.parentNode;if(r&&"TH"===r.tagName&&ce(r,"noclick"))return void he(r,"noclick");if(!i.sortable)return;const a=e.store.states;let l,d=a.sortProp.value;const c=a.sortingColumn.value;(c!==i||c===i&&null===c.order)&&(c&&(c.order=null),a.sortingColumn.value=i,d=i.property),l=i.order=s||null,a.sortProp.value=d,a.sortOrder.value=l,null==n||n.store.commit("changeSortCondition")};return{handleHeaderClick:(e,t)=>{!t.filters&&t.sortable?l(e,t,!1):t.filterable&&!t.sortable&&o(e),null==n||n.emit("header-click",t,e)},handleHeaderContextMenu:(e,t)=>{null==n||n.emit("header-contextmenu",t,e)},handleMouseDown:(o,l)=>{if(E&&!(l.children&&l.children.length>0)&&s.value&&e.border){r.value=!0;const d=n;t("set-drag-visible",!0);const c=(null==d?void 0:d.vnode.el).getBoundingClientRect().left,h=i.vnode.el.querySelector(`th.${l.id}`),u=h.getBoundingClientRect(),g=u.left-c+30;de(h,"noclick"),a.value={startMouseLeft:o.clientX,startLeft:u.right-c,startColumnLeft:u.left-c,tableLeft:c};const p=null==d?void 0:d.refs.resizeProxy;p.style.left=`${a.value.startLeft}px`,document.onselectstart=function(){return!1},document.ondragstart=function(){return!1};const m=e=>{const t=e.clientX-a.value.startMouseLeft,i=a.value.startLeft+t;p.style.left=`${Math.max(g,i)}px`},f=()=>{if(r.value){const{startColumnLeft:i,startLeft:n}=a.value,c=Number.parseInt(p.style.left,10)-i;l.width=l.realWidth=c,null==d||d.emit("header-dragend",l.width,n-i,l,o),requestAnimationFrame((()=>{e.store.scheduleLayout(!1,!0)})),document.body.style.cursor="",r.value=!1,s.value=null,a.value={},t("set-drag-visible",!1)}document.removeEventListener("mousemove",m),document.removeEventListener("mouseup",f),document.onselectstart=null,document.ondragstart=null,setTimeout((()=>{he(h,"noclick")}),0)};document.addEventListener("mousemove",m),document.addEventListener("mouseup",f)}},handleMouseMove:(t,i)=>{if(i.children&&i.children.length>0)return;let n=t.target;for(;n&&"TH"!==n.tagName;)n=n.parentNode;if(i&&i.resizable&&!r.value&&e.border){const e=n.getBoundingClientRect(),o=document.body.style;e.width>12&&e.right-t.pageX<8?(o.cursor="col-resize",ce(n,"is-sortable")&&(n.style.cursor="col-resize"),s.value=i):r.value||(o.cursor="",ce(n,"is-sortable")&&(n.style.cursor="pointer"),s.value=null)}},handleMouseOut:()=>{E&&(document.body.style.cursor="")},handleSortClick:l,handleFilterClick:o}}(e,t),{getHeaderRowStyle:f,getHeaderRowClass:_,getHeaderCellStyle:v,getHeaderCellClass:b}=function(e){const t=an(Hu),i=o("table");return{getHeaderRowStyle:e=>{const i=null==t?void 0:t.props.headerRowStyle;return"function"==typeof i?i.call(null,{rowIndex:e}):i},getHeaderRowClass:e=>{const i=[],n=null==t?void 0:t.props.headerRowClassName;return"string"==typeof n?i.push(n):"function"==typeof n&&i.push(n.call(null,{rowIndex:e})),i.join(" ")},getHeaderCellStyle:(i,n,o,s)=>{var r;let a=null!=(r=null==t?void 0:t.props.headerCellStyle)?r:{};"function"==typeof a&&(a=a.call(null,{rowIndex:i,columnIndex:n,row:o,column:s}));const l=s.isSubColumn?null:xu(n,s.fixed,e.store,o);return Su(l,"left"),Su(l,"right"),Object.assign({},a,l)},getHeaderCellClass:(n,o,s,r)=>{const a=r.isSubColumn?[]:Cu(i.b(),o,r.fixed,e.store,s),l=[r.id,r.order,r.headerAlign,r.className,r.labelClassName,...a];r.children||l.push("is-leaf"),r.sortable&&l.push("is-sortable");const d=null==t?void 0:t.props.headerCellClassName;return"string"==typeof d?l.push(d):"function"==typeof d&&l.push(d.call(null,{rowIndex:n,columnIndex:o,row:s,column:r})),l.push(i.e("cell")),l.filter((e=>Boolean(e))).join(" ")}}}(e),{isGroup:w,toggleAllSelection:C,columnRows:y}=Uu(e);return i.state={onColumnsChange:a,onScrollableChange:l},i.filterPanels=r,{ns:s,filterPanels:r,onColumnsChange:a,onScrollableChange:l,columnRows:y,getHeaderRowClass:_,getHeaderRowStyle:f,getHeaderCellClass:b,getHeaderCellStyle:v,handleHeaderClick:d,handleHeaderContextMenu:c,handleMouseDown:h,handleMouseMove:u,handleMouseOut:g,handleSortClick:p,handleFilterClick:m,isGroup:w,toggleAllSelection:C}},render(){const{ns:e,isGroup:t,columnRows:i,getHeaderCellStyle:n,getHeaderCellClass:o,getHeaderRowClass:s,getHeaderRowStyle:r,handleHeaderClick:a,handleHeaderContextMenu:l,handleMouseDown:d,handleMouseMove:c,handleSortClick:h,handleMouseOut:u,store:g,$parent:p}=this;let m=1;return on("thead",{class:{[e.is("group")]:t}},i.map(((e,t)=>on("tr",{class:s(t),key:t,style:r(t)},e.map(((i,s)=>(i.rowSpan>m&&(m=i.rowSpan),on("th",{class:o(t,s,e,i),colspan:i.colSpan,key:`${i.id}-thead`,rowspan:i.rowSpan,style:n(t,s,e,i),onClick:e=>a(e,i),onContextmenu:e=>l(e,i),onMousedown:e=>d(e,i),onMousemove:e=>c(e,i),onMouseout:u},[on("div",{class:["cell",i.filteredValue&&i.filteredValue.length>0?"highlight":"",i.labelClassName]},[i.renderHeader?i.renderHeader({column:i,$index:s,store:g,_self:p}):i.label,i.sortable&&on("span",{onClick:e=>h(e,i),class:"caret-wrapper"},[on("i",{onClick:e=>h(e,i,"ascending"),class:"sort-caret ascending"}),on("i",{onClick:e=>h(e,i,"descending"),class:"sort-caret descending"})]),i.filterable&&on(Wu,{store:g,placement:i.filterPlacement||"bottom-start",column:i,upDataColumn:(e,t)=>{i[e]=t}})])]))))))))}});function Ku(e){const t=an(Hu),i=ai(""),n=ai(on("div")),o=(i,n,o)=>{var s;const r=t,a=au(i);let l;const d=null==(s=null==r?void 0:r.vnode.el)?void 0:s.dataset.prefix;a&&(l=hu({columns:e.store.states.columns.value},a,d),l&&(null==r||r.emit(`cell-${o}`,n,l,a,i))),null==r||r.emit(`row-${o}`,n,l,i)},s=z((t=>{e.store.commit("setHoverRow",t)}),30);return{handleDoubleClick:(e,t)=>{o(e,t,"dblclick")},handleClick:(t,i)=>{e.store.commit("setCurrentRow",i),o(t,i,"click")},handleContextMenu:(e,t)=>{o(e,t,"contextmenu")},handleMouseEnter:s,handleMouseLeave:z((()=>{e.store.commit("setHoverRow",null)}),30),handleCellMouseEnter:(i,n)=>{var o;const s=t,r=au(i),a=null==(o=null==s?void 0:s.vnode.el)?void 0:o.dataset.prefix;if(r){const t=hu({columns:e.store.states.columns.value},r,a),o=s.hoverState={cell:r,column:t,row:n};null==s||s.emit("cell-mouse-enter",o.row,o.column,o.cell,i)}const d=i.target.querySelector(".cell");if(!ce(d,`${a}-tooltip`)||!d.childNodes.length)return;const c=document.createRange();c.setStart(d,0),c.setEnd(d,d.childNodes.length);(c.getBoundingClientRect().width+((Number.parseInt(ue(d,"paddingLeft"),10)||0)+(Number.parseInt(ue(d,"paddingRight"),10)||0))>d.offsetWidth||d.scrollWidth>d.offsetWidth)&&function(e,t,i,n,o){const{nextZIndex:s}=re(),r=null==e?void 0:e.dataset.prefix,a=null==e?void 0:e.querySelector(`.${r}-scrollbar__wrap`);function d(){c&&c.update()}bu=()=>{try{c&&c.destroy(),h&&(null==e||e.removeChild(h)),G(t,"mouseenter",d),G(t,"mouseleave",bu),a&&G(a,"scroll",bu),bu=void 0}catch(i){}};let c=null;const h=function(){const t="light"===o,n=document.createElement("div");return n.className=`${r}-popper ${t?"is-light":"is-dark"}`,i=ru(i),n.innerHTML=i,n.style.zIndex=String(s()),null==e||e.appendChild(n),n}(),u=function(){const e=document.createElement("div");return e.className=`${r}-popper__arrow`,e}();h.appendChild(u),c=ae(t,h,{strategy:"absolute",modifiers:[{name:"offset",options:{offset:[0,8]}},{name:"arrow",options:{element:u,padding:10}}],...n}),l(t,"mouseenter",d),l(t,"mouseleave",bu),a&&l(a,"scroll",bu)}(null==t?void 0:t.refs.tableWrapper,r,r.innerText||r.textContent,{placement:"top",strategy:"fixed"},n.tooltipEffect)},handleCellMouseLeave:e=>{if(!au(e))return;const i=null==t?void 0:t.hoverState;null==t||t.emit("cell-mouse-leave",null==i?void 0:i.row,null==i?void 0:i.column,null==i?void 0:i.cell,e)},tooltipContent:i,tooltipTrigger:n}}function qu(e){const t=an(Hu),i=o("table"),{handleDoubleClick:n,handleClick:s,handleContextMenu:r,handleMouseEnter:a,handleMouseLeave:l,handleCellMouseEnter:d,handleCellMouseLeave:c,tooltipContent:h,tooltipTrigger:u}=Ku(e),{getRowStyle:g,getRowClass:p,getCellStyle:m,getCellClass:f,getSpan:_,getColspanRealWidth:v}=function(e){const t=an(Hu),i=o("table");return{getRowStyle:(e,i)=>{const n=null==t?void 0:t.props.rowStyle;return"function"==typeof n?n.call(null,{row:e,rowIndex:i}):n||null},getRowClass:(n,o)=>{const s=[i.e("row")];(null==t?void 0:t.props.highlightCurrentRow)&&n===e.store.states.currentRow.value&&s.push("current-row"),e.stripe&&o%2==1&&s.push(i.em("row","striped"));const r=null==t?void 0:t.props.rowClassName;return"string"==typeof r?s.push(r):"function"==typeof r&&s.push(r.call(null,{row:n,rowIndex:o})),s},getCellStyle:(i,n,o,s)=>{const r=null==t?void 0:t.props.cellStyle;let a=null!=r?r:{};"function"==typeof r&&(a=r.call(null,{rowIndex:i,columnIndex:n,row:o,column:s}));const l=s.isSubColumn?null:xu(n,null==e?void 0:e.fixed,e.store);return Su(l,"left"),Su(l,"right"),Object.assign({},a,l)},getCellClass:(n,o,s,r)=>{const a=r.isSubColumn?[]:Cu(i.b(),o,null==e?void 0:e.fixed,e.store),l=[r.id,r.align,r.className,...a],d=null==t?void 0:t.props.cellClassName;return"string"==typeof d?l.push(d):"function"==typeof d&&l.push(d.call(null,{rowIndex:n,columnIndex:o,row:s,column:r})),l.push(i.e("cell")),l.filter((e=>Boolean(e))).join(" ")},getSpan:(e,i,n,o)=>{let s=1,r=1;const a=null==t?void 0:t.props.spanMethod;if("function"==typeof a){const t=a({row:e,column:i,rowIndex:n,columnIndex:o});Array.isArray(t)?(s=t[0],r=t[1]):"object"==typeof t&&(s=t.rowspan,r=t.colspan)}return{rowspan:s,colspan:r}},getColspanRealWidth:(e,t,i)=>{if(t<1)return e[i].realWidth;const n=e.map((({realWidth:e,width:t})=>e||t)).slice(i,i+t);return Number(n.reduce(((e,t)=>Number(e)+Number(t)),-1))}}}(e),b=Pi((()=>e.store.states.columns.value.findIndex((({type:e})=>"default"===e)))),w=(e,i)=>{const n=t.props.rowKey;return n?uu(e,n):i},C=(o,h,u,C=!1)=>{const{tooltipEffect:x,store:S}=e,{indent:k,columns:D}=S.states,L=p(o,h);let N=!0;u&&(L.push(i.em("row",`level-${u.level}`)),N=u.display);return on("tr",{style:[N?null:{display:"none"},g(o,h)],class:L,key:w(o,h),onDblclick:e=>n(e,o),onClick:e=>s(e,o),onContextmenu:e=>r(e,o),onMouseenter:()=>a(h),onMouseleave:l},D.value.map(((i,n)=>{const{rowspan:s,colspan:r}=_(o,i,h,n);if(!s||!r)return null;const a={...i};a.realWidth=v(D.value,r,n);const l={store:e.store,_self:e.context||t,column:a,row:o,$index:h,cellIndex:n,expanded:C};n===b.value&&u&&(l.treeNode={indent:u.level*k.value,level:u.level},"boolean"==typeof u.expanded&&(l.treeNode.expanded=u.expanded,"loading"in u&&(l.treeNode.loading=u.loading),"noLazyChildren"in u&&(l.treeNode.noLazyChildren=u.noLazyChildren)));const g=`${h},${n}`,p=a.columnKey||a.rawColumnKey||"",w=y(n,i,l);return on("td",{style:m(h,n,o,i),class:f(h,n,o,i),key:`${p}${g}`,rowspan:s,colspan:r,onMouseenter:e=>d(e,{...o,tooltipEffect:x}),onMouseleave:c},[w])})))},y=(e,t,i)=>t.renderCell(i);return{wrappedRowRender:(i,n)=>{const o=e.store,{isRowExpanded:s,assertRowKey:r}=o,{treeData:a,lazyTreeNodeMap:l,childrenColumnName:d,rowKey:c}=o.states,h=o.states.columns.value;if(h.some((({type:e})=>"expand"===e))){const e=s(i),r=C(i,n,void 0,e),a=t.renderExpanded;return e?a?[[r,on("tr",{key:`expanded-row__${r.key}`},[on("td",{colspan:h.length,class:"el-table__cell el-table__expanded-cell"},[a({row:i,$index:n,store:o,expanded:e})])])]]:r:[[r]]}if(Object.keys(a.value).length){r();const e=uu(i,c.value);let t=a.value[e],o=null;t&&(o={expanded:t.expanded,level:t.level,display:!0},"boolean"==typeof t.lazy&&("boolean"==typeof t.loaded&&t.loaded&&(o.noLazyChildren=!(t.children&&t.children.length)),o.loading=t.loading));const s=[C(i,n,o)];if(t){let o=0;const r=(e,i)=>{e&&e.length&&i&&e.forEach((e=>{const h={display:i.display&&i.expanded,level:i.level+1,expanded:!1,noLazyChildren:!1,loading:!1},u=uu(e,c.value);if(null==u)throw new Error("For nested data item, row-key is required.");if(t={...a.value[u]},t&&(h.expanded=t.expanded,t.level=t.level||h.level,t.display=!(!t.expanded||!h.display),"boolean"==typeof t.lazy&&("boolean"==typeof t.loaded&&t.loaded&&(h.noLazyChildren=!(t.children&&t.children.length)),h.loading=t.loading)),o++,s.push(C(e,n+o,h)),t){const i=l.value[u]||e[d.value];r(i,t)}}))};t.display=!0;const h=l.value[e]||i[d.value];r(h,t)}return s}return C(i,n,void 0)},tooltipContent:h,tooltipTrigger:u}}const Gu={store:{required:!0,type:Object},stripe:Boolean,tooltipEffect:String,context:{default:()=>({}),type:Object},rowClassName:[String,Function],rowStyle:[Object,Function],fixed:{type:String,default:""},highlight:Boolean};var Zu=Zi({name:"ElTableBody",props:Gu,setup(e){const t=en(),i=an(Hu),n=o("table"),{wrappedRowRender:s,tooltipContent:r,tooltipTrigger:a}=qu(e),{onColumnsChange:l,onScrollableChange:d}=zu(i);return Qn(e.store.states.hoverRow,((i,o)=>{if(!e.store.states.isComplex.value||!E)return;let s=window.requestAnimationFrame;s||(s=e=>window.setTimeout(e,16)),s((()=>{var e;const s=null==(e=null==t?void 0:t.vnode.el)?void 0:e.querySelectorAll(`.${n.e("row")}`),r=s[o],a=s[i];r&&he(r,"hover-row"),a&&de(a,"hover-row")}))})),Sn((()=>{var e;null==(e=bu)||e()})),kn((()=>{var e;null==(e=bu)||e()})),{ns:n,onColumnsChange:l,onScrollableChange:d,wrappedRowRender:s,tooltipContent:r,tooltipTrigger:a}},render(){const{wrappedRowRender:e,store:t}=this,i=t.states.data.value||[];return on("tbody",{},[i.reduce(((t,i)=>t.concat(e(i,t.length))),[])])}});function Yu(e){const t="auto"===e.tableLayout;let i=e.columns||[];t&&i.every((e=>void 0===e.width))&&(i=[]);return on("colgroup",{},i.map((i=>on("col",(i=>{const n={key:`${e.tableLayout}_${i.id}`,style:{},name:void 0};return t?n.style={width:`${i.width}px`}:n.name=i.id,n})(i)))))}function Xu(e){const{columns:t}=function(){const e=an(Hu),t=null==e?void 0:e.store;return{leftFixedLeafCount:Pi((()=>t.states.fixedLeafColumnsLength.value)),rightFixedLeafCount:Pi((()=>t.states.rightFixedColumns.value.length)),columnsCount:Pi((()=>t.states.columns.value.length)),leftFixedCount:Pi((()=>t.states.fixedColumns.value.length)),rightFixedCount:Pi((()=>t.states.rightFixedColumns.value.length)),columns:t.states.columns}}(),i=o("table");return{getCellClasses:(t,n)=>{const o=t[n],s=[i.e("cell"),o.id,o.align,o.labelClassName,...Cu(i.b(),n,o.fixed,e.store)];return o.className&&s.push(o.className),o.children||s.push(i.is("leaf")),s},getCellStyles:(t,i)=>{const n=xu(i,t.fixed,e.store);return Su(n,"left"),Su(n,"right"),n},columns:t}}Yu.props=["columns","tableLayout"];var Qu=Zi({name:"ElTableFooter",props:{fixed:{type:String,default:""},store:{required:!0,type:Object},summaryMethod:Function,sumText:String,border:Boolean,defaultSort:{type:Object,default:()=>({prop:"",order:""})}},setup(e){const{getCellClasses:t,getCellStyles:i,columns:n}=Xu(e);return{ns:o("table"),getCellClasses:t,getCellStyles:i,columns:n}},render(){const{columns:e,getCellStyles:t,getCellClasses:i,summaryMethod:n,sumText:o,ns:s}=this,r=this.store.states.data.value;let a=[];return n?a=n({columns:e,data:r}):e.forEach(((e,t)=>{if(0===t)return void(a[t]=o);const i=r.map((t=>Number(t[e.property]))),n=[];let s=!0;i.forEach((e=>{if(!Number.isNaN(+e)){s=!1;const t=`${e}`.split(".")[1];n.push(t?t.length:0)}}));const l=Math.max.apply(null,n);a[t]=s?"":i.reduce(((e,t)=>{const i=Number(t);return Number.isNaN(+i)?e:Number.parseFloat((e+t).toFixed(Math.min(l,20)))}),0)})),on("table",{class:s.e("footer"),cellspacing:"0",cellpadding:"0",border:"0"},[Yu({columns:e}),on("tbody",[on("tr",{},[...e.map(((n,o)=>on("td",{key:o,colspan:n.colSpan,rowspan:n.rowSpan,class:i(e,o),style:t(n,o)},[on("div",{class:["cell",n.labelClassName]},[a[o]])])))])])])}});function Ju(e,t,i,n){const o=ai(!1),r=ai(null),a=ai(!1),l=ai({width:null,height:null}),d=ai(!1),c=ai();Jn((()=>{t.setHeight(e.height)})),Jn((()=>{t.setMaxHeight(e.maxHeight)})),Qn((()=>[e.currentRowKey,i.states.rowKey]),(([e,t])=>{fi(t)&&i.setCurrentRowKey(`${e}`)}),{immediate:!0}),Qn((()=>e.data),(e=>{n.store.commit("setData",e)}),{immediate:!0,deep:!0}),Jn((()=>{e.expandRowKeys&&i.setExpandRowKeysAdapter(e.expandRowKeys)}));const h=Pi((()=>e.height||e.maxHeight||i.states.fixedColumns.value.length>0||i.states.rightFixedColumns.value.length>0)),u=Pi((()=>({width:t.bodyWidth.value?`${t.bodyWidth.value}px`:""}))),g=()=>{h.value&&t.updateElsHeight(),t.updateColumnsWidth(),requestAnimationFrame(m)};wn((async()=>{await gn(),i.updateColumns(),_(),requestAnimationFrame(g);const t=n.vnode.el;e.flexible&&t&&t.parentElement&&(t.parentElement.style.minWidth="0"),l.value={width:c.value=t.offsetWidth,height:t.offsetHeight},i.states.columns.value.forEach((e=>{e.filteredValue&&e.filteredValue.length&&n.store.commit("filterChange",{column:e,values:e.filteredValue,silent:!0})})),n.$ready=!0}));const p=e=>{const{tableWrapper:i}=n.refs;((e,i)=>{if(!e)return;const n=Array.from(e.classList).filter((e=>!e.startsWith("is-scrolling-")));n.push(t.scrollX.value?i:"is-scrolling-none"),e.className=n.join(" ")})(i,e)},m=function(){if(!n.refs.scrollBarRef)return;if(!t.scrollX.value){const e="is-scrolling-none";return void((e=>{const{tableWrapper:t}=n.refs;return!(!t||!t.classList.contains(e))})(e)||p(e))}const e=n.refs.scrollBarRef.wrap$;if(!e)return;const{scrollLeft:i,offsetWidth:o,scrollWidth:s}=e,{headerWrapper:r,footerWrapper:a}=n.refs;r&&(r.scrollLeft=i),a&&(a.scrollLeft=i);p(i>=s-o-1?"is-scrolling-right":0===i?"is-scrolling-left":"is-scrolling-middle")},_=()=>{n.refs.scrollBarRef&&(n.refs.scrollBarRef.wrap$&&ge(n.refs.scrollBarRef.wrap$,"scroll",m,{passive:!0}),e.fit?H(n.vnode.el,v):ge(window,"resize",v))},v=()=>{if(!n.$ready)return;let t=!1;const i=n.vnode.el,{width:o,height:s}=l.value,r=c.value=i.offsetWidth;o!==r&&(t=!0);const a=i.offsetHeight;(e.height||h.value)&&s!==a&&(t=!0),t&&(l.value={width:r,height:a},g())},b=f(),w=Pi((()=>{const{bodyWidth:e,scrollY:i,gutterWidth:n}=t;return e.value?e.value-(i.value?n:0)+"px":""})),C=Pi((()=>e.maxHeight?"fixed":e.tableLayout));function y(t,i,n){const o=fu(t),s=e.showHeader?n:0;if(null!==o)return Eo(o)?`calc(${o} - ${i}px - ${s}px)`:o-i-s}const x=Pi((()=>{const i=t.headerHeight.value||0,n=t.bodyHeight.value,o=t.footerHeight.value||0;return e.height?n||void 0:e.maxHeight?y(e.maxHeight,o,i):void 0}));return{isHidden:o,renderExpanded:r,setDragVisible:e=>{a.value=e},isGroup:d,handleMouseLeave:()=>{n.store.commit("setHoverRow",null),n.hoverState&&(n.hoverState=null)},handleHeaderFooterMousewheel:(e,t)=>{const{pixelX:i,pixelY:o}=t;Math.abs(i)>=Math.abs(o)&&(n.refs.bodyWrapper.scrollLeft+=t.pixelX/5)},tableSize:b,bodyHeight:Pi((()=>{const i=t.headerHeight.value||0,n=t.bodyHeight.value,o=t.footerHeight.value||0;if(e.height)return{height:n?`${n}px`:""};if(e.maxHeight){const t=y(e.maxHeight,o,i);if(null!==t)return{"max-height":`${t}${s(t)?"px":""}`}}return{}})),height:x,emptyBlockStyle:Pi((()=>{if(e.data&&e.data.length)return null;let i="100%";return t.appendHeight.value&&(i=`calc(100% - ${t.appendHeight.value}px)`),{width:c.value?`${c.value}px`:"",height:i}})),handleFixedMousewheel:(e,t)=>{const i=n.refs.bodyWrapper;if(Math.abs(t.spinY)>0){const n=i.scrollTop;t.pixelY<0&&0!==n&&e.preventDefault(),t.pixelY>0&&i.scrollHeight-i.clientHeight>n&&e.preventDefault(),i.scrollTop+=Math.ceil(t.pixelY/5)}else i.scrollLeft+=Math.ceil(t.pixelX/5)},fixedHeight:Pi((()=>e.maxHeight?e.showSummary?{bottom:0}:{bottom:t.scrollX.value&&e.data.length?`${t.gutterWidth}px`:""}:e.showSummary?{height:t.tableHeight.value?`${t.tableHeight.value}px`:""}:{height:t.viewportHeight.value?`${t.viewportHeight.value}px`:""})),fixedBodyHeight:Pi((()=>{if(e.height)return{height:t.fixedBodyHeight.value?`${t.fixedBodyHeight.value}px`:""};if(e.maxHeight){let i=fu(e.maxHeight);if("number"==typeof i)return i=t.scrollX.value?i-t.gutterWidth:i,e.showHeader&&(i-=t.headerHeight.value),i-=t.footerHeight.value,{"max-height":`${i}px`}}return{}})),resizeProxyVisible:a,bodyWidth:w,resizeState:l,doLayout:g,tableBodyStyles:u,tableLayout:C,scrollbarViewStyle:{display:"block",verticalAlign:"middle"}}}var eg={data:{type:Array,default:()=>[]},size:String,width:[String,Number],height:[String,Number],maxHeight:[String,Number],fit:{type:Boolean,default:!0},stripe:Boolean,border:Boolean,rowKey:[String,Function],showHeader:{type:Boolean,default:!0},showSummary:Boolean,sumText:String,summaryMethod:Function,rowClassName:[String,Function],rowStyle:[Object,Function],cellClassName:[String,Function],cellStyle:[Object,Function],headerRowClassName:[String,Function],headerRowStyle:[Object,Function],headerCellClassName:[String,Function],headerCellStyle:[Object,Function],highlightCurrentRow:Boolean,currentRowKey:[String,Number],emptyText:String,expandRowKeys:Array,defaultExpandAll:Boolean,defaultSort:Object,tooltipEffect:String,spanMethod:Function,selectOnIndeterminate:{type:Boolean,default:!0},indent:{type:Number,default:16},treeProps:{type:Object,default:()=>({hasChildren:"hasChildren",children:"children"})},lazy:Boolean,load:Function,style:{type:Object,default:()=>({})},className:{type:String,default:""},tableLayout:{type:String,default:"fixed"},scrollbarAlwaysOn:{type:Boolean,default:!1},flexible:Boolean};let tg=1;const ig=Zi({name:"ElTable",directives:{Mousewheel:$d},components:{TableHeader:$u,TableBody:Zu,TableFooter:Qu,ElScrollbar:C,hColgroup:Yu},props:eg,emits:["select","select-all","selection-change","cell-mouse-enter","cell-mouse-leave","cell-contextmenu","cell-click","cell-dblclick","row-click","row-contextmenu","row-dblclick","header-click","header-contextmenu","sort-change","filter-change","current-change","header-dragend","expand-change"],setup(e){const{t:t}=y(),i=o("table"),n=en();Nn(Hu,n);const r=Tu(n,e);n.store=r;const a=new Ou({store:n.store,table:n,fit:e.fit,showHeader:e.showHeader});n.layout=a;const l=Pi((()=>0===(r.states.data.value||[]).length)),{setCurrentRow:d,getSelectionRows:c,toggleRowSelection:h,clearSelection:u,clearFilter:g,toggleAllSelection:p,toggleRowExpansion:m,clearSort:f,sort:_}=function(e){return{setCurrentRow:t=>{e.commit("setCurrentRow",t)},getSelectionRows:()=>e.getSelectionRows(),toggleRowSelection:(t,i)=>{e.toggleRowSelection(t,i,!1),e.updateAllSelected()},clearSelection:()=>{e.clearSelection()},clearFilter:t=>{e.clearFilter(t)},toggleAllSelection:()=>{e.commit("toggleAllSelection")},toggleRowExpansion:(t,i)=>{e.toggleRowExpansionAdapter(t,i)},clearSort:()=>{e.clearSort()},sort:(t,i)=>{e.commit("sort",{prop:t,order:i})}}}(r),{isHidden:v,renderExpanded:b,setDragVisible:w,isGroup:C,handleMouseLeave:x,handleHeaderFooterMousewheel:S,tableSize:k,bodyHeight:D,height:L,emptyBlockStyle:N,handleFixedMousewheel:E,fixedHeight:I,fixedBodyHeight:T,resizeProxyVisible:M,bodyWidth:A,resizeState:O,doLayout:R,tableBodyStyles:P,tableLayout:F,scrollbarViewStyle:B}=Ju(e,a,r,n),{scrollBarRef:V,scrollTo:W,setScrollLeft:H,setScrollTop:j}=(()=>{const e=ai(),t=(t,i)=>{const n=e.value;n&&s(i)&&["Top","Left"].includes(t)&&n[`setScroll${t}`](i)};return{scrollBarRef:e,scrollTo:(t,i)=>{const n=e.value;n&&n.scrollTo(t,i)},setScrollTop:e=>t("Top",e),setScrollLeft:e=>t("Left",e)}})(),U=z(R,50),$="el-table_"+tg++;n.tableId=$,n.state={isGroup:C,resizeState:O,doLayout:R,debouncedUpdateLayout:U};const K=Pi((()=>e.sumText||t("el.table.sumText"))),q=Pi((()=>e.emptyText||t("el.table.emptyText")));return{ns:i,layout:a,store:r,handleHeaderFooterMousewheel:S,handleMouseLeave:x,tableId:$,tableSize:k,isHidden:v,isEmpty:l,renderExpanded:b,resizeProxyVisible:M,resizeState:O,isGroup:C,bodyWidth:A,bodyHeight:D,height:L,tableBodyStyles:P,emptyBlockStyle:N,debouncedUpdateLayout:U,handleFixedMousewheel:E,fixedHeight:I,fixedBodyHeight:T,setCurrentRow:d,getSelectionRows:c,toggleRowSelection:h,clearSelection:u,clearFilter:g,toggleAllSelection:p,toggleRowExpansion:m,clearSort:f,doLayout:R,sort:_,t:t,setDragVisible:w,context:n,computedSumText:K,computedEmptyText:q,tableLayout:F,scrollbarViewStyle:B,scrollBarRef:V,scrollTo:W,setScrollLeft:H,setScrollTop:j}}}),ng=["data-prefix"],og={ref:"hiddenColumns",class:"hidden-columns"};var sg=r(ig,[["render",function(e,t,i,n,o,s){const r=On("hColgroup"),a=On("table-header"),l=On("table-body"),d=On("el-scrollbar"),c=On("table-footer"),h=Rn("mousewheel");return Dn(),Vi("div",{ref:"tableWrapper",class:bi([{[e.ns.m("fit")]:e.fit,[e.ns.m("striped")]:e.stripe,[e.ns.m("border")]:e.border||e.isGroup,[e.ns.m("hidden")]:e.isHidden,[e.ns.m("group")]:e.isGroup,[e.ns.m("fluid-height")]:e.maxHeight,[e.ns.m("scrollable-x")]:e.layout.scrollX.value,[e.ns.m("scrollable-y")]:e.layout.scrollY.value,[e.ns.m("enable-row-hover")]:!e.store.states.isComplex.value,[e.ns.m("enable-row-transition")]:0!==(e.store.states.data.value||[]).length&&(e.store.states.data.value||[]).length<100,"has-footer":e.showSummary},e.ns.m(e.tableSize),e.className,e.ns.b(),e.ns.m(`layout-${e.tableLayout}`)]),style:Ci(e.style),"data-prefix":e.ns.namespace.value,onMouseleave:t[0]||(t[0]=t=>e.handleMouseLeave())},[Wi("div",{class:bi(e.ns.e("inner-wrapper"))},[Wi("div",og,[An(e.$slots,"default")],512),e.showHeader&&"fixed"===e.tableLayout?so((Dn(),Vi("div",{key:0,ref:"headerWrapper",class:bi(e.ns.e("header-wrapper"))},[Wi("table",{ref:"tableHeader",class:bi(e.ns.e("header")),style:Ci(e.tableBodyStyles),border:"0",cellpadding:"0",cellspacing:"0"},[qi(r,{columns:e.store.states.columns.value,"table-layout":e.tableLayout},null,8,["columns","table-layout"]),qi(a,{ref:"tableHeaderRef",border:e.border,"default-sort":e.defaultSort,store:e.store,onSetDragVisible:e.setDragVisible},null,8,["border","default-sort","store","onSetDragVisible"])],6)],2)),[[h,e.handleHeaderFooterMousewheel]]):Bi("v-if",!0),Wi("div",{ref:"bodyWrapper",style:Ci(e.bodyHeight),class:bi(e.ns.e("body-wrapper"))},[qi(d,{ref:"scrollBarRef",height:e.maxHeight?void 0:e.height,"max-height":e.maxHeight?e.height:void 0,"view-style":e.scrollbarViewStyle,always:e.scrollbarAlwaysOn},{default:no((()=>[Wi("table",{ref:"tableBody",class:bi(e.ns.e("body")),cellspacing:"0",cellpadding:"0",border:"0",style:Ci({width:e.bodyWidth,tableLayout:e.tableLayout})},[qi(r,{columns:e.store.states.columns.value,"table-layout":e.tableLayout},null,8,["columns","table-layout"]),e.showHeader&&"auto"===e.tableLayout?(Dn(),Fi(a,{key:0,border:e.border,"default-sort":e.defaultSort,store:e.store,onSetDragVisible:e.setDragVisible},null,8,["border","default-sort","store","onSetDragVisible"])):Bi("v-if",!0),qi(l,{context:e.context,highlight:e.highlightCurrentRow,"row-class-name":e.rowClassName,"tooltip-effect":e.tooltipEffect,"row-style":e.rowStyle,store:e.store,stripe:e.stripe},null,8,["context","highlight","row-class-name","tooltip-effect","row-style","store","stripe"])],6),e.isEmpty?(Dn(),Vi("div",{key:0,ref:"emptyBlock",style:Ci(e.emptyBlockStyle),class:bi(e.ns.e("empty-block"))},[Wi("span",{class:bi(e.ns.e("empty-text"))},[An(e.$slots,"empty",{},(()=>[Ki(yi(e.computedEmptyText),1)]))],2)],6)):Bi("v-if",!0),e.$slots.append?(Dn(),Vi("div",{key:1,ref:"appendWrapper",class:bi(e.ns.e("append-wrapper"))},[An(e.$slots,"append")],2)):Bi("v-if",!0)])),_:3},8,["height","max-height","view-style","always"])],6),e.border||e.isGroup?(Dn(),Vi("div",{key:1,class:bi(e.ns.e("border-left-patch"))},null,2)):Bi("v-if",!0)],2),e.showSummary?so((Dn(),Vi("div",{key:0,ref:"footerWrapper",class:bi(e.ns.e("footer-wrapper"))},[qi(c,{border:e.border,"default-sort":e.defaultSort,store:e.store,style:Ci(e.tableBodyStyles),"sum-text":e.computedSumText,"summary-method":e.summaryMethod},null,8,["border","default-sort","store","style","sum-text","summary-method"])],2)),[[Do,!e.isEmpty],[h,e.handleHeaderFooterMousewheel]]):Bi("v-if",!0),so(Wi("div",{ref:"resizeProxy",class:bi(e.ns.e("column-resize-proxy"))},null,2),[[Do,e.resizeProxyVisible]])],46,ng)}],["__file","/home/runner/work/element-plus/element-plus/packages/components/table/src/table.vue"]]);const rg={selection:"table-column--selection",expand:"table__expand-column"},ag={default:{order:""},selection:{width:48,minWidth:48,realWidth:48,order:""},expand:{width:48,minWidth:48,realWidth:48,order:""},index:{width:48,minWidth:48,realWidth:48,order:""}},lg={selection:{renderHeader:({store:e})=>on(dc,{disabled:e.states.data.value&&0===e.states.data.value.length,size:e.states.tableSize.value,indeterminate:e.states.selection.value.length>0&&!e.states.isAllSelected.value,"onUpdate:modelValue":e.toggleAllSelection,modelValue:e.states.isAllSelected.value}),renderCell:({row:e,column:t,store:i,$index:n})=>on(dc,{disabled:!!t.selectable&&!t.selectable.call(null,e,n),size:i.states.tableSize.value,onChange:()=>{i.commit("rowSelectedChanged",e)},onClick:e=>e.stopPropagation(),modelValue:i.isSelected(e)}),sortable:!1,resizable:!1},index:{renderHeader:({column:e})=>e.label||"#",renderCell({column:e,$index:t}){let i=t+1;const n=e.index;return"number"==typeof n?i=t+n:"function"==typeof n&&(i=n(t)),on("div",{},[i])},sortable:!1},expand:{renderHeader:({column:e})=>e.label||"",renderCell({row:e,store:t,expanded:i}){const{ns:n}=t,o=[n.e("expand-icon")];i&&o.push(n.em("expand-icon","expanded"));return on("div",{class:o,onClick:function(i){i.stopPropagation(),t.toggleRowExpansion(e)}},{default:()=>[on(w,null,{default:()=>[on(Qe)]})]})},sortable:!1,resizable:!1}};function dg({row:e,column:t,$index:i}){var n;const o=t.property,s=o&&pe(e,o).value;return t&&t.formatter?t.formatter(e,t,s,i):(null==(n=null==s?void 0:s.toString)?void 0:n.call(s))||""}function cg(e,t){return e.reduce(((e,t)=>(e[t]=t,e)),t)}function hg(e,t,i){const n=en(),s=ai(""),r=ai(!1),a=ai(),l=ai(),d=o("table");Jn((()=>{a.value=e.align?`is-${e.align}`:null,a.value})),Jn((()=>{l.value=e.headerAlign?`is-${e.headerAlign}`:a.value,l.value}));const c=Pi((()=>{let e=n.vnode.vParent||n.parent;for(;e&&!e.tableId&&!e.columnId;)e=e.vnode.vParent||e.parent;return e})),h=Pi((()=>{const{store:e}=n.parent;if(!e)return!1;const{treeData:t}=e.states,i=t.value;return i&&Object.keys(i).length>0})),u=ai(pu(e.width)),g=ai(mu(e.minWidth));return{columnId:s,realAlign:a,isSubColumn:r,realHeaderAlign:l,columnOrTableParent:c,setColumnWidth:e=>(u.value&&(e.width=u.value),g.value&&(e.minWidth=g.value),e.minWidth||(e.minWidth=80),e.realWidth=Number(void 0===e.width?e.minWidth:e.width),e),setColumnForcedProps:e=>{const t=e.type,i=lg[t]||{};Object.keys(i).forEach((t=>{const n=i[t];"className"!==t&&void 0!==n&&(e[t]=n)}));const n=(e=>rg[e]||"")(t);if(n){const t=`${fi(d.namespace)}-${n}`;e.className=e.className?`${e.className} ${t}`:t}return e},setColumnRenders:o=>{e.renderHeader||"selection"!==o.type&&(o.renderHeader=e=>{n.columnConfig.value.label;const i=t.header;return i?i(e):o.label});let s=o.renderCell;const r=h.value;return"expand"===o.type?(o.renderCell=e=>on("div",{class:"cell"},[s(e)]),i.value.renderExpanded=e=>t.default?t.default(e):t.default):(s=s||dg,o.renderCell=e=>{let i=null;if(t.default){const n=t.default(e);i=n.some((e=>e.type!==ki))?n:s(e)}else i=s(e);const a=function({row:e,treeNode:t,store:i},n=!1){const{ns:o}=i;if(!t)return n?[on("span",{class:o.e("placeholder")})]:null;const s=[],r=function(t){t.stopPropagation(),i.loadOrToggle(e)};if(t.indent&&s.push(on("span",{class:o.e("indent"),style:{"padding-left":`${t.indent}px`}})),"boolean"!=typeof t.expanded||t.noLazyChildren)s.push(on("span",{class:o.e("placeholder")}));else{const e=[o.e("expand-icon"),t.expanded?o.em("expand-icon","expanded"):""];let i=Qe;t.loading&&(i=Xe),s.push(on("div",{class:e,onClick:r},{default:()=>[on(w,{class:{[o.is("loading")]:t.loading}},{default:()=>[on(i)]})]}))}return s}(e,r&&0===e.cellIndex),l={class:"cell",style:{}};return o.showOverflowTooltip&&(l.class=`${l.class} ${fi(d.namespace)}-tooltip`,l.style={width:(e.column.realWidth||Number(e.column.width))-1+"px"}),(e=>{function t(e){var t;"ElTableColumn"===(null==(t=null==e?void 0:e.type)?void 0:t.name)&&(e.vParent=n)}Array.isArray(e)?e.forEach((e=>t(e))):t(e)})(i),on("div",l,[a,i])}),o},getPropsData:(...t)=>t.reduce(((t,i)=>(Array.isArray(i)&&i.forEach((i=>{t[i]=e[i]})),t)),{}),getColumnElIndex:(e,t)=>Array.prototype.indexOf.call(e,t)}}var ug={type:{type:String,default:"default"},label:String,className:String,labelClassName:String,property:String,prop:String,width:{type:[String,Number],default:""},minWidth:{type:[String,Number],default:""},renderHeader:Function,sortable:{type:[Boolean,String],default:!1},sortMethod:Function,sortBy:[String,Function,Array],resizable:{type:Boolean,default:!0},columnKey:String,align:String,headerAlign:String,showTooltipWhenOverflow:Boolean,showOverflowTooltip:Boolean,fixed:[Boolean,String],formatter:Function,selectable:Function,reserveSelection:Boolean,filterMethod:Function,filteredValue:Array,filters:Array,filterPlacement:String,filterMultiple:{type:Boolean,default:!0},index:[Number,Function],sortOrders:{type:Array,default:()=>["ascending","descending",null],validator:e=>e.every((e=>["ascending","descending",null].includes(e)))}};let gg=1;var pg=Zi({name:"ElTableColumn",components:{ElCheckbox:dc},props:ug,setup(e,{slots:t}){const i=en(),n=ai({}),o=Pi((()=>{let e=i.parent;for(;e&&!e.tableId;)e=e.parent;return e})),{registerNormalWatchers:s,registerComplexWatchers:r}=function(e,t){const i=en();return{registerComplexWatchers:()=>{const n={realWidth:"width",realMinWidth:"minWidth"},o=cg(["fixed"],n);Object.keys(o).forEach((o=>{const s=n[o];Ro(t,s)&&Qn((()=>t[s]),(t=>{let n=t;"width"===s&&"realWidth"===o&&(n=pu(t)),"minWidth"===s&&"realMinWidth"===o&&(n=mu(t)),i.columnConfig.value[s]=n,i.columnConfig.value[o]=n;const r="fixed"===s;e.value.store.scheduleLayout(r)}))}))},registerNormalWatchers:()=>{const e={property:"prop",align:"realAlign",headerAlign:"realHeaderAlign"},n=cg(["label","filters","filterMultiple","sortable","index","formatter","className","labelClassName","showOverflowTooltip"],e);Object.keys(n).forEach((n=>{const o=e[n];Ro(t,o)&&Qn((()=>t[o]),(e=>{i.columnConfig.value[n]=e}))}))}}}(o,e),{columnId:a,isSubColumn:l,realHeaderAlign:d,columnOrTableParent:c,setColumnWidth:h,setColumnForcedProps:u,setColumnRenders:g,getPropsData:p,getColumnElIndex:m,realAlign:f}=hg(e,t,o),_=c.value;a.value=`${_.tableId||_.columnId}_column_${gg++}`,mn((()=>{l.value=o.value!==_;const t=e.type||"default",c=""===e.sortable||e.sortable,m={...ag[t],id:a.value,type:t,property:e.prop||e.property,align:f,headerAlign:d,showOverflowTooltip:e.showOverflowTooltip||e.showTooltipWhenOverflow,filterable:e.filters||e.filterMethod,filteredValue:[],filterPlacement:"",isColumnGroup:!1,isSubColumn:!1,filterOpened:!1,sortable:c,index:e.index,rawColumnKey:i.vnode.key};let v=p(["columnKey","label","className","labelClassName","type","renderHeader","formatter","fixed","resizable"],["sortMethod","sortBy","sortOrders"],["selectable","reserveSelection"],["filterMethod","filters","filterMultiple","filterOpened","filteredValue","filterPlacement"]);v=function(e,t){const i={};let n;for(n in e)i[n]=e[n];for(n in t)if(Ro(t,n)){const e=t[n];void 0!==e&&(i[n]=e)}return i}(m,v);const b=function(...e){return 0===e.length?e=>e:1===e.length?e[0]:e.reduce(((e,t)=>(...i)=>e(t(...i))))}(g,h,u);v=b(v),n.value=v,s(),r()})),wn((()=>{var e;const t=c.value,s=l.value?t.vnode.el.children:null==(e=t.refs.hiddenColumns)?void 0:e.children,r=()=>m(s||[],i.vnode.el);n.value.getColumnIndex=r;r()>-1&&o.value.store.commit("insertColumn",n.value,l.value?t.columnConfig.value:null)})),fn((()=>{o.value.store.commit("removeColumn",n.value,l.value?_.columnConfig.value:null)})),i.columnId=a.value,i.columnConfig=n},render(){var e,t,i;try{const n=null==(t=(e=this.$slots).default)?void 0:t.call(e,{row:{},column:{},$index:-1}),o=[];if(Array.isArray(n))for(const e of n)"ElTableColumn"===(null==(i=e.type)?void 0:i.name)||2&e.shapeFlag?o.push(e):e.type===Di&&Array.isArray(e.children)&&e.children.forEach((e=>{1024===(null==e?void 0:e.patchFlag)||Eo(null==e?void 0:e.children)||o.push(e)}));return on("div",o)}catch(n){return on("div",[])}}});const mg=a(sg,{TableColumn:pg}),fg=v(pg),_g=n({tabs:{type:U(Array),default:()=>$([])}}),vg=Zi({name:"ElTabBar",props:_g,setup(e,{expose:t}){const i=e,n=en(),s=an(pd);s||se("ElTabBar","<el-tabs><el-tab-bar /></el-tabs>");const r=o("tabs"),a=ai(),l=ai(),d=()=>l.value=(()=>{let e=0,t=0;const o=["top","bottom"].includes(s.props.tabPosition)?"width":"height",r="width"===o?"x":"y";return i.tabs.every((s=>{var a,l,d,c;const h=null==(l=null==(a=n.parent)?void 0:a.refs)?void 0:l[`tab-${s.paneName}`];if(!h)return!1;if(!s.active)return!0;t=h[`client${vi(o)}`];const u="x"===r?"left":"top";e=h.getBoundingClientRect()[u]-(null!=(c=null==(d=h.parentElement)?void 0:d.getBoundingClientRect()[u])?c:0);const g=window.getComputedStyle(h);return"width"===o&&(i.tabs.length>1&&(t-=Number.parseFloat(g.paddingLeft)+Number.parseFloat(g.paddingRight)),e+=Number.parseFloat(g.paddingLeft)),!1})),{[o]:`${t}px`,transform:`translate${vi(r)}(${e}px)`}})();return Qn((()=>i.tabs),(async()=>{await gn(),d()}),{immediate:!0}),H(a,(()=>d())),t({ref:a,update:d}),(e,t)=>(Dn(),Vi("div",{ref_key:"barRef",ref:a,class:bi([fi(r).e("active-bar"),fi(r).is(fi(s).props.tabPosition)]),style:Ci(l.value)},null,6))}});var bg=r(vg,[["__file","/home/runner/work/element-plus/element-plus/packages/components/tabs/src/tab-bar.vue"]]);const wg=n({panes:{type:U(Array),default:()=>$([])},currentName:{type:[String,Number],default:""},editable:Boolean,onTabClick:{type:U(Function),default:Ao},onTabRemove:{type:U(Function),default:Ao},type:{type:String,values:["card","border-card",""],default:""},stretch:Boolean}),Cg="ElTabNav",yg=Zi({name:Cg,props:wg,setup(e,{expose:t}){const i=en(),n=an(pd);n||se(Cg,"<el-tabs><tab-nav /></el-tabs>");const s=o("tabs"),r=me(),a=fe(),l=ai(),d=ai(),c=ai(),h=ai(!1),u=ai(0),g=ai(!1),p=ai(!0),m=Pi((()=>["top","bottom"].includes(n.props.tabPosition)?"width":"height")),f=Pi((()=>({transform:`translate${"width"===m.value?"X":"Y"}(-${u.value}px)`}))),_=()=>{if(!l.value)return;const e=l.value[`offset${vi(m.value)}`],t=u.value;if(!t)return;const i=t>e?t-e:0;u.value=i},v=()=>{if(!l.value||!d.value)return;const e=d.value[`offset${vi(m.value)}`],t=l.value[`offset${vi(m.value)}`],i=u.value;if(e-i<=t)return;const n=e-i>2*t?i+t:e-t;u.value=n},b=async()=>{const e=d.value;if(!(h.value&&c.value&&l.value&&e))return;await gn();const t=c.value.querySelector(".is-active");if(!t)return;const i=l.value,o=["top","bottom"].includes(n.props.tabPosition),s=t.getBoundingClientRect(),r=i.getBoundingClientRect(),a=o?e.offsetWidth-r.width:e.offsetHeight-r.height,g=u.value;let p=g;o?(s.left<r.left&&(p=g-(r.left-s.left)),s.right>r.right&&(p=g+s.right-r.right)):(s.top<r.top&&(p=g-(r.top-s.top)),s.bottom>r.bottom&&(p=g+(s.bottom-r.bottom))),p=Math.max(p,0),u.value=Math.min(p,a)},C=()=>{if(!d.value||!l.value)return;const e=d.value[`offset${vi(m.value)}`],t=l.value[`offset${vi(m.value)}`],i=u.value;if(t<e){const i=u.value;h.value=h.value||{},h.value.prev=i,h.value.next=i+t<e,e-i<t&&(u.value=e-t)}else h.value=!1,i>0&&(u.value=0)},y=e=>{const t=e.code,{up:i,down:n,left:o,right:s}=T;if(![i,n,o,s].includes(t))return;const r=Array.from(e.currentTarget.querySelectorAll("[role=tab]")),a=r.indexOf(e.target);let l;l=t===o||t===i?0===a?r.length-1:a-1:a<r.length-1?a+1:0,r[l].focus(),r[l].click(),x()},x=()=>{p.value&&(g.value=!0)},S=()=>g.value=!1;return Qn(r,(e=>{"hidden"===e?p.value=!1:"visible"===e&&setTimeout((()=>p.value=!0),50)})),Qn(a,(e=>{e?setTimeout((()=>p.value=!0),50):p.value=!1})),H(c,C),wn((()=>setTimeout((()=>b()),0))),kn((()=>C())),t({scrollToActiveTab:b,removeFocus:S}),Qn((()=>e.panes),(()=>i.update()),{flush:"post"}),()=>{const t=h.value?[qi("span",{class:[s.e("nav-prev"),s.is("disabled",!h.value.prev)],onClick:_},[qi(w,null,{default:()=>[qi(lt,null,null)]})]),qi("span",{class:[s.e("nav-next"),s.is("disabled",!h.value.next)],onClick:v},[qi(w,null,{default:()=>[qi(Qe,null,null)]})])]:null,i=e.panes.map(((t,i)=>{var o,r,a,l;const d=null!=(r=null!=(o=t.props.name)?o:t.index)?r:`${i}`,c=t.isClosable||e.editable;t.index=`${i}`;const h=c?qi(w,{class:"is-icon-close",onClick:i=>e.onTabRemove(t,i)},{default:()=>[qi(tt,null,null)]}):null,u=(null==(l=(a=t.slots).label)?void 0:l.call(a))||t.props.label,p=t.active?0:-1;return qi("div",{ref:`tab-${d}`,class:[s.e("item"),s.is(n.props.tabPosition),s.is("active",t.active),s.is("disabled",t.props.disabled),s.is("closable",c),s.is("focus",g.value)],id:`tab-${d}`,key:`tab-${d}`,"aria-controls":`pane-${d}`,role:"tab","aria-selected":t.active,tabindex:p,onFocus:()=>x(),onBlur:()=>S(),onClick:i=>{S(),e.onTabClick(t,d,i)},onKeydown:i=>{!c||i.code!==T.delete&&i.code!==T.backspace||e.onTabRemove(t,i)}},[u,h])}));return qi("div",{ref:c,class:[s.e("nav-wrap"),s.is("scrollable",!!h.value),s.is(n.props.tabPosition)]},[t,qi("div",{class:s.e("nav-scroll"),ref:l},[qi("div",{class:[s.e("nav"),s.is(n.props.tabPosition),s.is("stretch",e.stretch&&["top","bottom"].includes(n.props.tabPosition))],ref:d,style:f.value,role:"tablist",onKeydown:y},[e.type?null:qi(bg,{tabs:[...e.panes]},null),i])])])}}}),xg=n({type:{type:String,values:["card","border-card",""],default:""},activeName:{type:[String,Number]},closable:Boolean,addable:Boolean,modelValue:{type:[String,Number]},editable:Boolean,tabPosition:{type:String,values:["top","right","bottom","left"],default:"top"},beforeLeave:{type:U(Function),default:()=>!0},stretch:Boolean}),Sg=e=>Eo(e)||s(e);var kg=Zi({name:"ElTabs",props:xg,emits:{[p]:e=>Sg(e),"tab-click":(e,t)=>t instanceof Event,"tab-change":e=>Sg(e),edit:(e,t)=>["remove","add"].includes(t),"tab-remove":e=>Sg(e),"tab-add":()=>!0},setup(e,{emit:t,slots:i,expose:n}){var s,r;const a=o("tabs"),l=ai(),d=si({}),c=ai(null!=(r=null!=(s=e.modelValue)?s:e.activeName)?r:"0"),h=async i=>{var n,o,s;if(c.value!==i&&!k(i))try{!1!==await(null==(n=e.beforeLeave)?void 0:n.call(e,i,c.value))&&((e=>{c.value=e,t(p,e),t("tab-change",e)})(i),null==(s=null==(o=l.value)?void 0:o.removeFocus)||s.call(o))}catch(r){}},u=(e,i,n)=>{e.props.disabled||(h(i),t("tab-click",e,n))},g=(e,i)=>{e.props.disabled||k(e.props.name)||(i.stopPropagation(),t("edit",e.props.name,"remove"),t("tab-remove",e.props.name))},m=()=>{t("edit",void 0,"add"),t("tab-add")};ne({from:'"activeName"',replacement:'"model-value" or "v-model"',scope:"ElTabs",version:"2.3.0",ref:"https://element-plus.org/en-US/component/tabs.html#attributes",type:"Attribute"},Pi((()=>!!e.activeName))),Qn((()=>e.activeName),(e=>h(e))),Qn((()=>e.modelValue),(e=>h(e))),Qn(c,(async()=>{var e;await gn(),null==(e=l.value)||e.scrollToActiveTab()}));{const t=e=>delete d[e];Nn(pd,{props:e,currentName:c,registerPane:e=>d[e.uid]=e,unregisterPane:t})}return n({currentName:c}),()=>{const t=e.editable||e.addable?qi("span",{class:a.e("new-tab"),tabindex:"0",onClick:m,onKeydown:e=>{e.code===T.enter&&m()}},[qi(w,{class:a.is("icon-plus")},{default:()=>[qi(ot,null,null)]})]):null,n=qi("div",{class:[a.e("header"),a.is(e.tabPosition)]},[t,qi(yg,{ref:l,currentName:c.value,editable:e.editable,type:e.type,panes:Object.values(d),stretch:e.stretch,onTabClick:u,onTabRemove:g},null)]),o=qi("div",{class:a.e("content")},[An(i,"default")]);return qi("div",{class:[a.b(),a.m(e.tabPosition),{[a.m("card")]:"card"===e.type,[a.m("border-card")]:"border-card"===e.type}]},[..."bottom"!==e.tabPosition?[n,o]:[o,n]])}}});const Dg=n({label:{type:String,default:""},name:{type:[String,Number]},closable:Boolean,disabled:Boolean,lazy:Boolean}),Lg=["id","aria-hidden","aria-labelledby"],Ng=Zi({name:"ElTabPane",props:Dg,setup(e){const t=e,i=en(),n=Gn(),s=an(pd);s||se("ElTabPane","usage: <el-tabs><el-tab-pane /></el-tabs/>");const r=o("tab-pane"),a=ai(),l=Pi((()=>t.closable||s.props.closable)),d=_e((()=>{var e;return s.currentName.value===(null!=(e=t.name)?e:a.value)})),c=ai(d.value),h=Pi((()=>{var e;return null!=(e=t.name)?e:a.value})),u=_e((()=>!t.lazy||c.value||d.value));Qn(d,(e=>{e&&(c.value=!0)}));const g=si({uid:i.uid,slots:n,props:t,paneName:h,active:d,index:a,isClosable:l});return wn((()=>{s.registerPane(g)})),Sn((()=>{s.unregisterPane(g.uid)})),(e,t)=>fi(u)?so((Dn(),Vi("div",{key:0,id:`pane-${fi(h)}`,class:bi(fi(r).b()),role:"tabpanel","aria-hidden":!fi(d),"aria-labelledby":`tab-${fi(h)}`},[An(e.$slots,"default")],10,Lg)),[[Do,fi(d)]]):Bi("v-if",!0)}});var Eg=r(Ng,[["__file","/home/runner/work/element-plus/element-plus/packages/components/tabs/src/tab-pane.vue"]]);const Ig=a(kg,{TabPane:Eg}),Tg=v(Eg),Mg="$treeNodeId",Ag=function(e,t){t&&!t[Mg]&&Object.defineProperty(t,Mg,{value:e.id,enumerable:!1,configurable:!1,writable:!1})},Og=function(e,t){return e?t[e]:t[Mg]},Rg=e=>{let t=!0,i=!0,n=!0;for(let o=0,s=e.length;o<s;o++){const s=e[o];(!0!==s.checked||s.indeterminate)&&(t=!1,s.disabled||(n=!1)),(!1!==s.checked||s.indeterminate)&&(i=!1)}return{all:t,none:i,allWithoutDisable:n,half:!t&&!i}},Pg=function(e){if(0===e.childNodes.length)return;const{all:t,none:i,half:n}=Rg(e.childNodes);t?(e.checked=!0,e.indeterminate=!1):n?(e.checked=!1,e.indeterminate=!0):i&&(e.checked=!1,e.indeterminate=!1);const o=e.parent;o&&0!==o.level&&(e.store.checkStrictly||Pg(o))},Fg=function(e,t){const i=e.store.props,n=e.data||{},o=i[t];if("function"==typeof o)return o(n,e);if("string"==typeof o)return n[o];if(void 0===o){const e=n[t];return void 0===e?"":e}};let Bg=0;class Vg{constructor(e){this.id=Bg++,this.text=null,this.checked=!1,this.indeterminate=!1,this.data=null,this.expanded=!1,this.parent=null,this.visible=!0,this.isCurrent=!1,this.canFocus=!1;for(const t in e)Ro(e,t)&&(this[t]=e[t]);this.level=0,this.loaded=!1,this.childNodes=[],this.loading=!1,this.parent&&(this.level=this.parent.level+1)}initialize(){const e=this.store;if(!e)throw new Error("[Node]store is required!");e.registerNode(this);const t=e.props;if(t&&void 0!==t.isLeaf){const e=Fg(this,"isLeaf");"boolean"==typeof e&&(this.isLeafByUser=e)}if(!0!==e.lazy&&this.data?(this.setData(this.data),e.defaultExpandAll&&(this.expanded=!0,this.canFocus=!0)):this.level>0&&e.lazy&&e.defaultExpandAll&&this.expand(),Array.isArray(this.data)||Ag(this,this.data),!this.data)return;const i=e.defaultExpandedKeys,n=e.key;n&&i&&i.includes(this.key)&&this.expand(null,e.autoExpandParent),n&&void 0!==e.currentNodeKey&&this.key===e.currentNodeKey&&(e.currentNode=this,e.currentNode.isCurrent=!0),e.lazy&&e._initDefaultCheckedNode(this),this.updateLeafState(),!this.parent||1!==this.level&&!0!==this.parent.expanded||(this.canFocus=!0)}setData(e){let t;Array.isArray(e)||Ag(this,e),this.data=e,this.childNodes=[],t=0===this.level&&Array.isArray(this.data)?this.data:Fg(this,"children")||[];for(let i=0,n=t.length;i<n;i++)this.insertChild({data:t[i]})}get label(){return Fg(this,"label")}get key(){const e=this.store.key;return this.data?this.data[e]:null}get disabled(){return Fg(this,"disabled")}get nextSibling(){const e=this.parent;if(e){const t=e.childNodes.indexOf(this);if(t>-1)return e.childNodes[t+1]}return null}get previousSibling(){const e=this.parent;if(e){const t=e.childNodes.indexOf(this);if(t>-1)return t>0?e.childNodes[t-1]:null}return null}contains(e,t=!0){return(this.childNodes||[]).some((i=>i===e||t&&i.contains(e)))}remove(){const e=this.parent;e&&e.removeChild(this)}insertChild(e,t,i){if(!e)throw new Error("InsertChild error: child is required.");if(!(e instanceof Vg)){if(!i){const i=this.getChildren(!0);i.includes(e.data)||(void 0===t||t<0?i.push(e.data):i.splice(t,0,e.data))}Object.assign(e,{parent:this,store:this.store}),(e=si(new Vg(e)))instanceof Vg&&e.initialize()}e.level=this.level+1,void 0===t||t<0?this.childNodes.push(e):this.childNodes.splice(t,0,e),this.updateLeafState()}insertBefore(e,t){let i;t&&(i=this.childNodes.indexOf(t)),this.insertChild(e,i)}insertAfter(e,t){let i;t&&(i=this.childNodes.indexOf(t),-1!==i&&(i+=1)),this.insertChild(e,i)}removeChild(e){const t=this.getChildren()||[],i=t.indexOf(e.data);i>-1&&t.splice(i,1);const n=this.childNodes.indexOf(e);n>-1&&(this.store&&this.store.deregisterNode(e),e.parent=null,this.childNodes.splice(n,1)),this.updateLeafState()}removeChildByData(e){let t=null;for(let i=0;i<this.childNodes.length;i++)if(this.childNodes[i].data===e){t=this.childNodes[i];break}t&&this.removeChild(t)}expand(e,t){const i=()=>{if(t){let e=this.parent;for(;e.level>0;)e.expanded=!0,e=e.parent}this.expanded=!0,e&&e(),this.childNodes.forEach((e=>{e.canFocus=!0}))};this.shouldLoadData()?this.loadData((e=>{Array.isArray(e)&&(this.checked?this.setChecked(!0,!0):this.store.checkStrictly||Pg(this),i())})):i()}doCreateChildren(e,t={}){e.forEach((e=>{this.insertChild(Object.assign({data:e},t),void 0,!0)}))}collapse(){this.expanded=!1,this.childNodes.forEach((e=>{e.canFocus=!1}))}shouldLoadData(){return!0===this.store.lazy&&this.store.load&&!this.loaded}updateLeafState(){if(!0===this.store.lazy&&!0!==this.loaded&&void 0!==this.isLeafByUser)return void(this.isLeaf=this.isLeafByUser);const e=this.childNodes;!this.store.lazy||!0===this.store.lazy&&!0===this.loaded?this.isLeaf=!e||0===e.length:this.isLeaf=!1}setChecked(e,t,i,n){if(this.indeterminate="half"===e,this.checked=!0===e,this.store.checkStrictly)return;if(!this.shouldLoadData()||this.store.checkDescendants){const{all:i,allWithoutDisable:o}=Rg(this.childNodes);this.isLeaf||i||!o||(this.checked=!1,e=!1);const s=()=>{if(t){const i=this.childNodes;for(let r=0,a=i.length;r<a;r++){const o=i[r];n=n||!1!==e;const s=o.disabled?o.checked:n;o.setChecked(s,t,!0,n)}const{half:o,all:s}=Rg(i);s||(this.checked=s,this.indeterminate=o)}};if(this.shouldLoadData())return void this.loadData((()=>{s(),Pg(this)}),{checked:!1!==e});s()}const o=this.parent;o&&0!==o.level&&(i||Pg(o))}getChildren(e=!1){if(0===this.level)return this.data;const t=this.data;if(!t)return null;const i=this.store.props;let n="children";return i&&(n=i.children||"children"),void 0===t[n]&&(t[n]=null),e&&!t[n]&&(t[n]=[]),t[n]}updateChildren(){const e=this.getChildren()||[],t=this.childNodes.map((e=>e.data)),i={},n=[];e.forEach(((e,o)=>{const s=e[Mg];!!s&&t.findIndex((e=>e[Mg]===s))>=0?i[s]={index:o,data:e}:n.push({index:o,data:e})})),this.store.lazy||t.forEach((e=>{i[e[Mg]]||this.removeChildByData(e)})),n.forEach((({index:e,data:t})=>{this.insertChild({data:t},e)})),this.updateLeafState()}loadData(e,t={}){if(!0!==this.store.lazy||!this.store.load||this.loaded||this.loading&&!Object.keys(t).length)e&&e.call(this);else{this.loading=!0;const i=i=>{this.loaded=!0,this.loading=!1,this.childNodes=[],this.doCreateChildren(i,t),this.updateLeafState(),e&&e.call(this,i)};this.store.load(this,i)}}}class Wg{constructor(e){this.currentNode=null,this.currentNodeKey=null;for(const t in e)Ro(e,t)&&(this[t]=e[t]);this.nodesMap={}}initialize(){if(this.root=new Vg({data:this.data,store:this}),this.root.initialize(),this.lazy&&this.load){(0,this.load)(this.root,(e=>{this.root.doCreateChildren(e),this._initDefaultCheckedNodes()}))}else this._initDefaultCheckedNodes()}filter(e){const t=this.filterNodeMethod,i=this.lazy,n=function(o){const s=o.root?o.root.childNodes:o.childNodes;if(s.forEach((i=>{i.visible=t.call(i,e,i.data,i),n(i)})),!o.visible&&s.length){let e=!0;e=!s.some((e=>e.visible)),o.root?o.root.visible=!1===e:o.visible=!1===e}e&&(!o.visible||o.isLeaf||i||o.expand())};n(this)}setData(e){e!==this.root.data?(this.root.setData(e),this._initDefaultCheckedNodes()):this.root.updateChildren()}getNode(e){if(e instanceof Vg)return e;const t="object"!=typeof e?e:Og(this.key,e);return this.nodesMap[t]||null}insertBefore(e,t){const i=this.getNode(t);i.parent.insertBefore({data:e},i)}insertAfter(e,t){const i=this.getNode(t);i.parent.insertAfter({data:e},i)}remove(e){const t=this.getNode(e);t&&t.parent&&(t===this.currentNode&&(this.currentNode=null),t.parent.removeChild(t))}append(e,t){const i=t?this.getNode(t):this.root;i&&i.insertChild({data:e})}_initDefaultCheckedNodes(){const e=this.defaultCheckedKeys||[],t=this.nodesMap;e.forEach((e=>{const i=t[e];i&&i.setChecked(!0,!this.checkStrictly)}))}_initDefaultCheckedNode(e){(this.defaultCheckedKeys||[]).includes(e.key)&&e.setChecked(!0,!this.checkStrictly)}setDefaultCheckedKey(e){e!==this.defaultCheckedKeys&&(this.defaultCheckedKeys=e,this._initDefaultCheckedNodes())}registerNode(e){const t=this.key;if(e&&e.data)if(t){void 0!==e.key&&(this.nodesMap[e.key]=e)}else this.nodesMap[e.id]=e}deregisterNode(e){this.key&&e&&e.data&&(e.childNodes.forEach((e=>{this.deregisterNode(e)})),delete this.nodesMap[e.key])}getCheckedNodes(e=!1,t=!1){const i=[],n=function(o){(o.root?o.root.childNodes:o.childNodes).forEach((o=>{(o.checked||t&&o.indeterminate)&&(!e||e&&o.isLeaf)&&i.push(o.data),n(o)}))};return n(this),i}getCheckedKeys(e=!1){return this.getCheckedNodes(e).map((e=>(e||{})[this.key]))}getHalfCheckedNodes(){const e=[],t=function(i){(i.root?i.root.childNodes:i.childNodes).forEach((i=>{i.indeterminate&&e.push(i.data),t(i)}))};return t(this),e}getHalfCheckedKeys(){return this.getHalfCheckedNodes().map((e=>(e||{})[this.key]))}_getAllNodes(){const e=[],t=this.nodesMap;for(const i in t)Ro(t,i)&&e.push(t[i]);return e}updateChildren(e,t){const i=this.nodesMap[e];if(!i)return;const n=i.childNodes;for(let o=n.length-1;o>=0;o--){const e=n[o];this.remove(e.data)}for(let o=0,s=t.length;o<s;o++){const e=t[o];this.append(e,i.data)}}_setCheckedKeys(e,t=!1,i){const n=this._getAllNodes().sort(((e,t)=>t.level-e.level)),o=Object.create(null),s=Object.keys(i);n.forEach((e=>e.setChecked(!1,!1)));for(let r=0,a=n.length;r<a;r++){const i=n[r],a=i.data[e].toString();if(!s.includes(a)){i.checked&&!o[a]&&i.setChecked(!1,!1);continue}let l=i.parent;for(;l&&l.level>0;)o[l.data[e]]=!0,l=l.parent;if(i.isLeaf||this.checkStrictly)i.setChecked(!0,!1);else if(i.setChecked(!0,!0),t){i.setChecked(!1,!1);const e=function(t){t.childNodes.forEach((t=>{t.isLeaf||t.setChecked(!1,!1),e(t)}))};e(i)}}}setCheckedNodes(e,t=!1){const i=this.key,n={};e.forEach((e=>{n[(e||{})[i]]=!0})),this._setCheckedKeys(i,t,n)}setCheckedKeys(e,t=!1){this.defaultCheckedKeys=e;const i=this.key,n={};e.forEach((e=>{n[e]=!0})),this._setCheckedKeys(i,t,n)}setDefaultExpandedKeys(e){e=e||[],this.defaultExpandedKeys=e,e.forEach((e=>{const t=this.getNode(e);t&&t.expand(null,this.autoExpandParent)}))}setChecked(e,t,i){const n=this.getNode(e);n&&n.setChecked(!!t,i)}getCurrentNode(){return this.currentNode}setCurrentNode(e){const t=this.currentNode;t&&(t.isCurrent=!1),this.currentNode=e,this.currentNode.isCurrent=!0}setUserCurrentNode(e,t=!0){const i=e[this.key],n=this.nodesMap[i];this.setCurrentNode(n),t&&this.currentNode.level>1&&this.currentNode.parent.expand(null,!0)}setCurrentNodeKey(e,t=!0){if(null==e)return this.currentNode&&(this.currentNode.isCurrent=!1),void(this.currentNode=null);const i=this.getNode(e);i&&(this.setCurrentNode(i),t&&this.currentNode.level>1&&this.currentNode.parent.expand(null,!0))}}const zg=Zi({name:"ElTreeNodeContent",props:{node:{type:Object,required:!0},renderContent:Function},setup(e){const t=o("tree"),i=an("NodeInstance"),n=an("RootTree");return()=>{const o=e.node,{data:s,store:r}=o;return e.renderContent?e.renderContent(on,{_self:i,node:o,data:s,store:r}):n.ctx.slots.default?n.ctx.slots.default({node:o,data:s}):on("span",{class:t.be("node","label")},[o.label])}}});var Hg=r(zg,[["__file","/home/runner/work/element-plus/element-plus/packages/components/tree/src/tree-node-content.vue"]]);function jg(e){const t=an("TreeNodeMap",null),i={treeNodeExpand:t=>{e.node!==t&&e.node.collapse()},children:[]};return t&&t.children.push(i),Nn("TreeNodeMap",i),{broadcastExpanded:t=>{if(e.accordion)for(const e of i.children)e.treeNodeExpand(t)}}}const Ug=Symbol("dragEvents");const $g=Zi({name:"ElTreeNode",components:{ElCollapseTransition:q,ElCheckbox:dc,NodeContent:Hg,ElIcon:w,Loading:Xe},props:{node:{type:Vg,default:()=>({})},props:{type:Object,default:()=>({})},accordion:Boolean,renderContent:Function,renderAfterExpand:Boolean,showCheckbox:{type:Boolean,default:!1}},emits:["node-expand"],setup(e,t){const i=o("tree"),{broadcastExpanded:n}=jg(e),s=an("RootTree"),r=ai(!1),a=ai(!1),l=ai(null),d=ai(null),c=ai(null),h=an(Ug),u=en();Nn("NodeInstance",u),e.node.expanded&&(r.value=!0,a.value=!0);const g=s.props.children||"children";Qn((()=>{const t=e.node.data[g];return t&&[...t]}),(()=>{e.node.updateChildren()})),Qn((()=>e.node.indeterminate),(t=>{p(e.node.checked,t)})),Qn((()=>e.node.checked),(t=>{p(t,e.node.indeterminate)})),Qn((()=>e.node.expanded),(e=>{gn((()=>r.value=e)),e&&(a.value=!0)}));const p=(t,i)=>{l.value===t&&d.value===i||s.ctx.emit("check-change",e.node.data,t,i),l.value=t,d.value=i},m=()=>{e.node.isLeaf||(r.value?(s.ctx.emit("node-collapse",e.node.data,e.node,u),e.node.collapse()):(e.node.expand(),t.emit("node-expand",e.node.data,e.node,u)))},f=(t,i)=>{e.node.setChecked(i.target.checked,!s.props.checkStrictly),gn((()=>{const t=s.store.value;s.ctx.emit("check",e.node.data,{checkedNodes:t.getCheckedNodes(),checkedKeys:t.getCheckedKeys(),halfCheckedNodes:t.getHalfCheckedNodes(),halfCheckedKeys:t.getHalfCheckedKeys()})}))};return{ns:i,node$:c,tree:s,expanded:r,childNodeRendered:a,oldChecked:l,oldIndeterminate:d,getNodeKey:e=>Og(s.props.nodeKey,e.data),getNodeClass:t=>{const i=e.props.class;if(!i)return{};let n;if(Mo(i)){const{data:e}=t;n=i(e,t)}else n=i;return Eo(n)?{[n]:!0}:n},handleSelectChange:p,handleClick:t=>{const i=s.store.value;i.setCurrentNode(e.node),s.ctx.emit("current-change",i.currentNode?i.currentNode.data:null,i.currentNode),s.currentNode.value=e.node,s.props.expandOnClickNode&&m(),s.props.checkOnClickNode&&!e.node.disabled&&f(null,{target:{checked:!e.node.checked}}),s.ctx.emit("node-click",e.node.data,e.node,u,t)},handleContextMenu:t=>{s.instance.vnode.props.onNodeContextmenu&&(t.stopPropagation(),t.preventDefault()),s.ctx.emit("node-contextmenu",t,e.node.data,e.node,u)},handleExpandIconClick:m,handleCheckChange:f,handleChildNodeExpand:(e,t,i)=>{n(t),s.ctx.emit("node-expand",e,t,i)},handleDragStart:t=>{s.props.draggable&&h.treeNodeDragStart({event:t,treeNode:e})},handleDragOver:t=>{t.preventDefault(),s.props.draggable&&h.treeNodeDragOver({event:t,treeNode:{$el:c.value,node:e.node}})},handleDrop:e=>{e.preventDefault()},handleDragEnd:e=>{s.props.draggable&&h.treeNodeDragEnd(e)},CaretRight:dt}}}),Kg=["aria-expanded","aria-disabled","aria-checked","draggable","data-key"],qg=["aria-expanded"];const Gg=Zi({name:"ElTree",components:{ElTreeNode:r($g,[["render",function(e,t,i,n,o,s){const r=On("el-icon"),a=On("el-checkbox"),l=On("loading"),d=On("node-content"),c=On("el-tree-node"),h=On("el-collapse-transition");return so((Dn(),Vi("div",{ref:"node$",class:bi([e.ns.b("node"),e.ns.is("expanded",e.expanded),e.ns.is("current",e.node.isCurrent),e.ns.is("hidden",!e.node.visible),e.ns.is("focusable",!e.node.disabled),e.ns.is("checked",!e.node.disabled&&e.node.checked),e.getNodeClass(e.node)]),role:"treeitem",tabindex:"-1","aria-expanded":e.expanded,"aria-disabled":e.node.disabled,"aria-checked":e.node.checked,draggable:e.tree.props.draggable,"data-key":e.getNodeKey(e.node),onClick:t[1]||(t[1]=No(((...t)=>e.handleClick&&e.handleClick(...t)),["stop"])),onContextmenu:t[2]||(t[2]=(...t)=>e.handleContextMenu&&e.handleContextMenu(...t)),onDragstart:t[3]||(t[3]=No(((...t)=>e.handleDragStart&&e.handleDragStart(...t)),["stop"])),onDragover:t[4]||(t[4]=No(((...t)=>e.handleDragOver&&e.handleDragOver(...t)),["stop"])),onDragend:t[5]||(t[5]=No(((...t)=>e.handleDragEnd&&e.handleDragEnd(...t)),["stop"])),onDrop:t[6]||(t[6]=No(((...t)=>e.handleDrop&&e.handleDrop(...t)),["stop"]))},[Wi("div",{class:bi(e.ns.be("node","content")),style:Ci({paddingLeft:(e.node.level-1)*e.tree.props.indent+"px"})},[e.tree.props.icon||e.CaretRight?(Dn(),Fi(r,{key:0,class:bi([e.ns.be("node","expand-icon"),e.ns.is("leaf",e.node.isLeaf),{expanded:!e.node.isLeaf&&e.expanded}]),onClick:No(e.handleExpandIconClick,["stop"])},{default:no((()=>[(Dn(),Fi(Pn(e.tree.props.icon||e.CaretRight)))])),_:1},8,["class","onClick"])):Bi("v-if",!0),e.showCheckbox?(Dn(),Fi(a,{key:1,"model-value":e.node.checked,indeterminate:e.node.indeterminate,disabled:!!e.node.disabled,onClick:t[0]||(t[0]=No((()=>{}),["stop"])),onChange:e.handleCheckChange},null,8,["model-value","indeterminate","disabled","onChange"])):Bi("v-if",!0),e.node.loading?(Dn(),Fi(r,{key:2,class:bi([e.ns.be("node","loading-icon"),e.ns.is("loading")])},{default:no((()=>[qi(l)])),_:1},8,["class"])):Bi("v-if",!0),qi(d,{node:e.node,"render-content":e.renderContent},null,8,["node","render-content"])],6),qi(h,null,{default:no((()=>[!e.renderAfterExpand||e.childNodeRendered?so((Dn(),Vi("div",{key:0,class:bi(e.ns.be("node","children")),role:"group","aria-expanded":e.expanded},[(Dn(!0),Vi(Di,null,Mn(e.node.childNodes,(t=>(Dn(),Fi(c,{key:e.getNodeKey(t),"render-content":e.renderContent,"render-after-expand":e.renderAfterExpand,"show-checkbox":e.showCheckbox,node:t,accordion:e.accordion,props:e.props,onNodeExpand:e.handleChildNodeExpand},null,8,["render-content","render-after-expand","show-checkbox","node","accordion","props","onNodeExpand"])))),128))],10,qg)),[[Do,e.expanded]]):Bi("v-if",!0)])),_:1})],42,Kg)),[[Do,e.node.visible]])}],["__file","/home/runner/work/element-plus/element-plus/packages/components/tree/src/tree-node.vue"]])},props:{data:{type:Array,default:()=>[]},emptyText:{type:String},renderAfterExpand:{type:Boolean,default:!0},nodeKey:String,checkStrictly:Boolean,defaultExpandAll:Boolean,expandOnClickNode:{type:Boolean,default:!0},checkOnClickNode:Boolean,checkDescendants:{type:Boolean,default:!1},autoExpandParent:{type:Boolean,default:!0},defaultCheckedKeys:Array,defaultExpandedKeys:Array,currentNodeKey:[String,Number],renderContent:Function,showCheckbox:{type:Boolean,default:!1},draggable:{type:Boolean,default:!1},allowDrag:Function,allowDrop:Function,props:{type:Object,default:()=>({children:"children",label:"label",disabled:"disabled"})},lazy:{type:Boolean,default:!1},highlightCurrent:Boolean,load:Function,filterNodeMethod:Function,accordion:Boolean,indent:{type:Number,default:18},icon:[String,Object]},emits:["check-change","current-change","node-click","node-contextmenu","node-collapse","node-expand","check","node-drag-start","node-drag-end","node-drop","node-drag-leave","node-drag-enter","node-drag-over"],setup(e,t){const{t:i}=y(),n=o("tree"),s=ai(new Wg({key:e.nodeKey,data:e.data,lazy:e.lazy,props:e.props,load:e.load,currentNodeKey:e.currentNodeKey,checkStrictly:e.checkStrictly,checkDescendants:e.checkDescendants,defaultCheckedKeys:e.defaultCheckedKeys,defaultExpandedKeys:e.defaultExpandedKeys,autoExpandParent:e.autoExpandParent,defaultExpandAll:e.defaultExpandAll,filterNodeMethod:e.filterNodeMethod}));s.value.initialize();const r=ai(s.value.root),a=ai(null),d=ai(null),c=ai(null),{broadcastExpanded:h}=jg(e),{dragState:g}=function({props:e,ctx:t,el$:i,dropIndicator$:n,store:s}){const r=o("tree"),a=ai({showDropIndicator:!1,draggingNode:null,dropNode:null,allowDrop:!0,dropType:null});return Nn(Ug,{treeNodeDragStart:({event:i,treeNode:n})=>{if("function"==typeof e.allowDrag&&!e.allowDrag(n.node))return i.preventDefault(),!1;i.dataTransfer.effectAllowed="move";try{i.dataTransfer.setData("text/plain","")}catch(o){}a.value.draggingNode=n,t.emit("node-drag-start",n.node,i)},treeNodeDragOver:({event:o,treeNode:s})=>{const l=s,d=a.value.dropNode;d&&d!==l&&he(d.$el,r.is("drop-inner"));const c=a.value.draggingNode;if(!c||!l)return;let h=!0,u=!0,g=!0,p=!0;"function"==typeof e.allowDrop&&(h=e.allowDrop(c.node,l.node,"prev"),p=u=e.allowDrop(c.node,l.node,"inner"),g=e.allowDrop(c.node,l.node,"next")),o.dataTransfer.dropEffect=u||h||g?"move":"none",(h||u||g)&&d!==l&&(d&&t.emit("node-drag-leave",c.node,d.node,o),t.emit("node-drag-enter",c.node,l.node,o)),(h||u||g)&&(a.value.dropNode=l),l.node.nextSibling===c.node&&(g=!1),l.node.previousSibling===c.node&&(h=!1),l.node.contains(c.node,!1)&&(u=!1),(c.node===l.node||c.node.contains(l.node))&&(h=!1,u=!1,g=!1);const m=l.$el.getBoundingClientRect(),f=i.value.getBoundingClientRect();let _;const v=h?u?.25:g?.45:1:-1,b=g?u?.75:h?.55:0:1;let w=-9999;const C=o.clientY-m.top;_=C<m.height*v?"before":C>m.height*b?"after":u?"inner":"none";const y=l.$el.querySelector(`.${r.be("node","expand-icon")}`).getBoundingClientRect(),x=n.value;"before"===_?w=y.top-f.top:"after"===_&&(w=y.bottom-f.top),x.style.top=`${w}px`,x.style.left=y.right-f.left+"px","inner"===_?de(l.$el,r.is("drop-inner")):he(l.$el,r.is("drop-inner")),a.value.showDropIndicator="before"===_||"after"===_,a.value.allowDrop=a.value.showDropIndicator||p,a.value.dropType=_,t.emit("node-drag-over",c.node,l.node,o)},treeNodeDragEnd:e=>{const{draggingNode:i,dropType:n,dropNode:o}=a.value;if(e.preventDefault(),e.dataTransfer.dropEffect="move",i&&o){const a={data:i.node.data};"none"!==n&&i.node.remove(),"before"===n?o.node.parent.insertBefore(a,o.node):"after"===n?o.node.parent.insertAfter(a,o.node):"inner"===n&&o.node.insertChild(a),"none"!==n&&s.value.registerNode(a),he(o.$el,r.is("drop-inner")),t.emit("node-drag-end",i.node,o.node,n,e),"none"!==n&&t.emit("node-drop",i.node,o.node,n,e)}i&&!o&&t.emit("node-drag-end",i.node,null,n,e),a.value.showDropIndicator=!1,a.value.draggingNode=null,a.value.dropNode=null,a.value.allowDrop=!0}}),{dragState:a}}({props:e,ctx:t,el$:d,dropIndicator$:c,store:s});!function({el$:e},t){const i=o("tree"),n=ci([]),s=ci([]);wn((()=>{a(),l(e.value,"keydown",r)})),fn((()=>{G(e.value,"keydown",r)})),kn((()=>{n.value=Array.from(e.value.querySelectorAll("[role=treeitem]")),s.value=Array.from(e.value.querySelectorAll("input[type=checkbox]"))})),Qn(s,(e=>{e.forEach((e=>{e.setAttribute("tabindex","-1")}))}));const r=o=>{const s=o.target;if(!s.className.includes(i.b("node")))return;const r=o.code;n.value=Array.from(e.value.querySelectorAll(`.${i.is("focusable")}[role=treeitem]`));const a=n.value.indexOf(s);let l;if([T.up,T.down].includes(r)){if(o.preventDefault(),r===T.up){l=-1===a?0:0!==a?a-1:n.value.length-1;const e=l;for(;!t.value.getNode(n.value[l].dataset.key).canFocus;){if(l--,l===e){l=-1;break}l<0&&(l=n.value.length-1)}}else{l=-1===a?0:a<n.value.length-1?a+1:0;const e=l;for(;!t.value.getNode(n.value[l].dataset.key).canFocus;){if(l++,l===e){l=-1;break}l>=n.value.length&&(l=0)}}-1!==l&&n.value[l].focus()}[T.left,T.right].includes(r)&&(o.preventDefault(),s.click());const d=s.querySelector('[type="checkbox"]');[T.enter,T.space].includes(r)&&d&&(o.preventDefault(),d.click())},a=()=>{var t;n.value=Array.from(e.value.querySelectorAll(`.${i.is("focusable")}[role=treeitem]`)),s.value=Array.from(e.value.querySelectorAll("input[type=checkbox]"));const o=e.value.querySelectorAll(`.${i.is("checked")}[role=treeitem]`);o.length?o[0].setAttribute("tabindex","0"):null==(t=n.value[0])||t.setAttribute("tabindex","0")}}({el$:d},s);const p=Pi((()=>{const{childNodes:e}=r.value;return!e||0===e.length||e.every((({visible:e})=>!e))}));Qn((()=>e.defaultCheckedKeys),(e=>{s.value.setDefaultCheckedKey(e)})),Qn((()=>e.defaultExpandedKeys),(e=>{s.value.setDefaultExpandedKeys(e)})),Qn((()=>e.data),(e=>{s.value.setData(e)}),{deep:!0}),Qn((()=>e.checkStrictly),(e=>{s.value.checkStrictly=e}));const m=()=>{const e=s.value.getCurrentNode();return e?e.data:null};return Nn("RootTree",{ctx:t,props:e,store:s,root:r,currentNode:a,instance:en()}),Nn(u,void 0),{ns:n,store:s,root:r,currentNode:a,dragState:g,el$:d,dropIndicator$:c,isEmpty:p,filter:t=>{if(!e.filterNodeMethod)throw new Error("[Tree] filterNodeMethod is required when filter");s.value.filter(t)},getNodeKey:t=>Og(e.nodeKey,t.data),getNodePath:t=>{if(!e.nodeKey)throw new Error("[Tree] nodeKey is required in getNodePath");const i=s.value.getNode(t);if(!i)return[];const n=[i.data];let o=i.parent;for(;o&&o!==r.value;)n.push(o.data),o=o.parent;return n.reverse()},getCheckedNodes:(e,t)=>s.value.getCheckedNodes(e,t),getCheckedKeys:e=>s.value.getCheckedKeys(e),getCurrentNode:m,getCurrentKey:()=>{if(!e.nodeKey)throw new Error("[Tree] nodeKey is required in getCurrentKey");const t=m();return t?t[e.nodeKey]:null},setCheckedNodes:(t,i)=>{if(!e.nodeKey)throw new Error("[Tree] nodeKey is required in setCheckedNodes");s.value.setCheckedNodes(t,i)},setCheckedKeys:(t,i)=>{if(!e.nodeKey)throw new Error("[Tree] nodeKey is required in setCheckedKeys");s.value.setCheckedKeys(t,i)},setChecked:(e,t,i)=>{s.value.setChecked(e,t,i)},getHalfCheckedNodes:()=>s.value.getHalfCheckedNodes(),getHalfCheckedKeys:()=>s.value.getHalfCheckedKeys(),setCurrentNode:(t,i=!0)=>{if(!e.nodeKey)throw new Error("[Tree] nodeKey is required in setCurrentNode");s.value.setUserCurrentNode(t,i)},setCurrentKey:(t,i=!0)=>{if(!e.nodeKey)throw new Error("[Tree] nodeKey is required in setCurrentKey");s.value.setCurrentNodeKey(t,i)},t:i,getNode:e=>s.value.getNode(e),remove:e=>{s.value.remove(e)},append:(e,t)=>{s.value.append(e,t)},insertBefore:(e,t)=>{s.value.insertBefore(e,t)},insertAfter:(e,t)=>{s.value.insertAfter(e,t)},handleNodeExpand:(e,i,n)=>{h(i),t.emit("node-expand",e,i,n)},updateKeyChildren:(t,i)=>{if(!e.nodeKey)throw new Error("[Tree] nodeKey is required in updateKeyChild");s.value.updateChildren(t,i)}}}});var Zg=r(Gg,[["render",function(e,t,i,n,o,s){var r;const a=On("el-tree-node");return Dn(),Vi("div",{ref:"el$",class:bi([e.ns.b(),e.ns.is("dragging",!!e.dragState.draggingNode),e.ns.is("drop-not-allow",!e.dragState.allowDrop),e.ns.is("drop-inner","inner"===e.dragState.dropType),{[e.ns.m("highlight-current")]:e.highlightCurrent}]),role:"tree"},[(Dn(!0),Vi(Di,null,Mn(e.root.childNodes,(t=>(Dn(),Fi(a,{key:e.getNodeKey(t),node:t,props:e.props,accordion:e.accordion,"render-after-expand":e.renderAfterExpand,"show-checkbox":e.showCheckbox,"render-content":e.renderContent,onNodeExpand:e.handleNodeExpand},null,8,["node","props","accordion","render-after-expand","show-checkbox","render-content","onNodeExpand"])))),128)),e.isEmpty?(Dn(),Vi("div",{key:0,class:bi(e.ns.e("empty-block"))},[Wi("span",{class:bi(e.ns.e("empty-text"))},yi(null!=(r=e.emptyText)?r:e.t("el.tree.emptyText")),3)],2)):Bi("v-if",!0),so(Wi("div",{ref:"dropIndicator$",class:bi(e.ns.e("drop-indicator"))},null,2),[[Do,e.dragState.showDropIndicator]])],2)}],["__file","/home/runner/work/element-plus/element-plus/packages/components/tree/src/tree.vue"]]);Zg.install=e=>{e.component(Zg.name,Zg)};const Yg=Zg;class Xg extends Error{constructor(e,t,i,n){super(e),this.name="UploadAjaxError",this.status=t,this.method=i,this.url=n}}function Qg(e,t,i){let n;return n=i.response?`${i.response.error||i.response}`:i.responseText?`${i.responseText}`:`fail to ${t.method} ${e} ${i.status}`,new Xg(n,i.status,t.method,e)}const Jg=["text","picture","picture-card"];let ep=1;const tp=()=>Date.now()+ep++,ip=n({action:{type:String,default:"#"},headers:{type:U(Object)},method:{type:String,default:"post"},data:{type:Object,default:()=>$({})},multiple:{type:Boolean,default:!1},name:{type:String,default:"file"},drag:{type:Boolean,default:!1},withCredentials:Boolean,showFileList:{type:Boolean,default:!0},accept:{type:String,default:""},type:{type:String,default:"select"},fileList:{type:U(Array),default:()=>$([])},autoUpload:{type:Boolean,default:!0},listType:{type:String,values:Jg,default:"text"},httpRequest:{type:U(Function),default:e=>{"undefined"==typeof XMLHttpRequest&&se("ElUpload","XMLHttpRequest is undefined");const t=new XMLHttpRequest,i=e.action;t.upload&&t.upload.addEventListener("progress",(t=>{const i=t;i.percent=t.total>0?t.loaded/t.total*100:0,e.onProgress(i)}));const n=new FormData;if(e.data)for(const[s,r]of Object.entries(e.data))Array.isArray(r)?n.append(s,...r):n.append(s,r);n.append(e.filename,e.file,e.file.name),t.addEventListener("error",(()=>{e.onError(Qg(i,e,t))})),t.addEventListener("load",(()=>{if(t.status<200||t.status>=300)return e.onError(Qg(i,e,t));e.onSuccess(function(e){const t=e.responseText||e.response;if(!t)return t;try{return JSON.parse(t)}catch(i){return t}}(t))})),t.open(e.method,i,!0),e.withCredentials&&"withCredentials"in t&&(t.withCredentials=!0);const o=e.headers||{};if(o instanceof Headers)o.forEach(((e,i)=>t.setRequestHeader(i,e)));else for(const[s,r]of Object.entries(o))Q(r)||t.setRequestHeader(s,String(r));return t.send(n),t}},disabled:Boolean,limit:Number}),np=n({...ip,beforeUpload:{type:U(Function),default:Ao},beforeRemove:{type:U(Function)},onRemove:{type:U(Function),default:Ao},onChange:{type:U(Function),default:Ao},onPreview:{type:U(Function),default:Ao},onSuccess:{type:U(Function),default:Ao},onProgress:{type:U(Function),default:Ao},onError:{type:U(Function),default:Ao},onExceed:{type:U(Function),default:Ao}}),op=n({files:{type:U(Array),default:()=>$([])},disabled:{type:Boolean,default:!1},handlePreview:{type:U(Function),default:Ao},listType:{type:String,values:Jg,default:"text"}}),sp=["onKeydown"],rp=["src"],ap=["onClick"],lp=["onClick"],dp=["onClick"];var cp=r(Zi({name:"ElUploadList",props:op,emits:{remove:e=>!!e},setup(e,{emit:t}){const i=e,{t:n}=y(),s=o("upload"),r=o("icon"),a=o("list"),l=ai(!1),d=e=>{t("remove",e)};return(e,t)=>(Dn(),Fi(co,{tag:"ul",class:bi([fi(s).b("list"),fi(s).bm("list",e.listType),fi(s).is("disabled",e.disabled)]),name:fi(a).b()},{default:no((()=>[(Dn(!0),Vi(Di,null,Mn(e.files,(o=>(Dn(),Vi("li",{key:o.uid||o.name,class:bi([fi(s).be("list","item"),fi(s).is(o.status),{focusing:l.value}]),tabindex:"0",onKeydown:Lo((t=>!e.disabled&&d(o)),["delete"]),onFocus:t[0]||(t[0]=e=>l.value=!0),onBlur:t[1]||(t[1]=e=>l.value=!1),onClick:t[2]||(t[2]=e=>l.value=!1)},[An(e.$slots,"default",{file:o},(()=>["picture"===e.listType||"uploading"!==o.status&&"picture-card"===e.listType?(Dn(),Vi("img",{key:0,class:bi(fi(s).be("list","item-thumbnail")),src:o.url,alt:""},null,10,rp)):Bi("v-if",!0),"picture"===e.listType||"uploading"!==o.status&&"picture-card"===e.listType?Bi("v-if",!0):(Dn(),Vi("div",{key:1,class:bi(fi(s).be("list","item-info"))},[Wi("a",{class:bi(fi(s).be("list","item-name")),onClick:No((e=>(e=>{i.handlePreview(e)})(o)),["prevent"])},[qi(fi(w),{class:bi(fi(r).m("document"))},{default:no((()=>[qi(fi(ct))])),_:1},8,["class"]),Wi("span",{class:bi(fi(s).be("list","item-file-name"))},yi(o.name),3)],10,ap),"uploading"===o.status?(Dn(),Fi(fi(Zh),{key:0,type:"picture-card"===e.listType?"circle":"line","stroke-width":"picture-card"===e.listType?6:2,percentage:Number(o.percentage),style:Ci("picture-card"===e.listType?"":"margin-top: 0.5rem")},null,8,["type","stroke-width","percentage","style"])):Bi("v-if",!0)],2)),Wi("label",{class:bi(fi(s).be("list","item-status-label"))},["text"===e.listType?(Dn(),Fi(fi(w),{key:0,class:bi([fi(r).m("upload-success"),fi(r).m("circle-check")])},{default:no((()=>[qi(fi(at))])),_:1},8,["class"])):["picture-card","picture"].includes(e.listType)?(Dn(),Fi(fi(w),{key:1,class:bi([fi(r).m("upload-success"),fi(r).m("check")])},{default:no((()=>[qi(fi(Ye))])),_:1},8,["class"])):Bi("v-if",!0)],2),e.disabled?Bi("v-if",!0):(Dn(),Fi(fi(w),{key:2,class:bi(fi(r).m("close")),onClick:e=>d(o)},{default:no((()=>[qi(fi(tt))])),_:2},1032,["class","onClick"])),Bi(" Due to close btn only appears when li gets focused disappears after li gets blurred, thus keyboard navigation can never reach close btn"),Bi(" This is a bug which needs to be fixed "),Bi(" TODO: Fix the incorrect navigation interaction "),e.disabled?Bi("v-if",!0):(Dn(),Vi("i",{key:3,class:bi(fi(r).m("close-tip"))},yi(fi(n)("el.upload.deleteTip")),3)),"picture-card"===e.listType?(Dn(),Vi("span",{key:4,class:bi(fi(s).be("list","item-actions"))},[Wi("span",{class:bi(fi(s).be("list","item-preview")),onClick:t=>e.handlePreview(o)},[qi(fi(w),{class:bi(fi(r).m("zoom-in"))},{default:no((()=>[qi(fi(ht))])),_:1},8,["class"])],10,lp),e.disabled?Bi("v-if",!0):(Dn(),Vi("span",{key:0,class:bi(fi(s).be("list","item-delete")),onClick:e=>d(o)},[qi(fi(w),{class:bi(fi(r).m("delete"))},{default:no((()=>[qi(fi(ut))])),_:1},8,["class"])],10,dp))],2)):Bi("v-if",!0)]))],42,sp)))),128)),An(e.$slots,"append")])),_:3},8,["class","name"]))}}),[["__file","/home/runner/work/element-plus/element-plus/packages/components/upload/src/upload-list.vue"]]);const hp=n({disabled:{type:Boolean,default:!1}}),up=["onDrop","onDragover"];var gp=r(Zi({name:"ElUploadDrag",props:hp,emits:{file:e=>Io(e)},setup(e,{emit:t}){const i=e,n=an(md);n||se("ElUploadDrag","usage: <el-upload><el-upload-dragger /></el-upload>");const s=o("upload"),r=ai(!1),a=e=>{if(i.disabled)return;r.value=!1;const o=Array.from(e.dataTransfer.files),s=n.accept.value;if(!s)return void t("file",o);const a=o.filter((e=>{const{type:t,name:i}=e,n=i.includes(".")?`.${i.split(".").pop()}`:"",o=t.replace(/\/.*$/,"");return s.split(",").map((e=>e.trim())).filter((e=>e)).some((e=>e.startsWith(".")?n===e:/\/\*$/.test(e)?o===e.replace(/\/\*$/,""):!!/^[^/]+\/[^/]+$/.test(e)&&t===e))}));t("file",a)},l=()=>{i.disabled||(r.value=!0)};return(e,t)=>(Dn(),Vi("div",{class:bi([fi(s).b("dragger"),fi(s).is("dragover",r.value)]),onDrop:No(a,["prevent"]),onDragover:No(l,["prevent"]),onDragleave:t[0]||(t[0]=No((e=>r.value=!1),["prevent"]))},[An(e.$slots,"default")],42,up))}}),[["__file","/home/runner/work/element-plus/element-plus/packages/components/upload/src/upload-dragger.vue"]]);const pp=n({...ip,beforeUpload:{type:U(Function),default:Ao},onRemove:{type:U(Function),default:Ao},onStart:{type:U(Function),default:Ao},onSuccess:{type:U(Function),default:Ao},onProgress:{type:U(Function),default:Ao},onError:{type:U(Function),default:Ao},onExceed:{type:U(Function),default:Ao}}),mp=["onKeydown"],fp=["name","multiple","accept"],_p=Zi({name:"ElUploadContent",inheritAttrs:!1,props:pp,setup(e,{expose:t}){const i=e,n=o("upload"),s=ci({}),r=ci(),a=e=>{if(0===e.length)return;const{autoUpload:t,limit:n,fileList:o,multiple:s,onStart:r,onExceed:a}=i;if(n&&o.length+e.length>n)a(e,o);else{s||(e=e.slice(0,1));for(const i of e){const e=i;e.uid=tp(),r(e),t&&l(e)}}},l=async e=>{if(r.value.value="",!i.beforeUpload)return d(e);let t;try{t=await i.beforeUpload(e)}catch(o){t=!1}if(!1===t)return void i.onRemove(e);let n=e;t instanceof Blob&&(n=t instanceof File?t:new File([t],e.name,{type:e.type})),d(Object.assign(n,{uid:e.uid}))},d=e=>{const{headers:t,data:n,method:o,withCredentials:r,name:a,action:l,onProgress:d,onSuccess:c,onError:h,httpRequest:u}=i,{uid:g}=e,p={headers:t||{},withCredentials:r,file:e,data:n,method:o,filename:a,action:l,onProgress:t=>{d(t,e)},onSuccess:t=>{c(t,e),delete s.value[g]},onError:t=>{h(t,e),delete s.value[g]}},m=u(p);s.value[g]=m,m instanceof Promise&&m.then(p.onSuccess,p.onError)},c=e=>{const t=e.target.files;t&&a(Array.from(t))},h=()=>{i.disabled||(r.value.value="",r.value.click())},u=()=>{h()};return t({abort:e=>{const t=ve(s.value).filter(e?([t])=>String(e.uid)===t:()=>!0);t.forEach((([e,t])=>{t instanceof XMLHttpRequest&&t.abort(),delete s.value[e]}))},upload:l}),(e,t)=>(Dn(),Vi("div",{class:bi([fi(n).b(),fi(n).m(e.listType),fi(n).is("drag",e.drag)]),tabindex:"0",onClick:h,onKeydown:Lo(No(u,["self"]),["enter","space"])},[e.drag?(Dn(),Fi(gp,{key:0,disabled:e.disabled,onFile:a},{default:no((()=>[An(e.$slots,"default")])),_:3},8,["disabled"])):An(e.$slots,"default",{key:1}),Wi("input",{ref_key:"inputRef",ref:r,class:bi(fi(n).e("input")),name:e.name,multiple:e.multiple,accept:e.accept,type:"file",onChange:c,onClick:t[0]||(t[0]=No((()=>{}),["stop"]))},null,42,fp)],42,mp))}});var vp=r(_p,[["__file","/home/runner/work/element-plus/element-plus/packages/components/upload/src/upload-content.vue"]]);const bp="ElUpload",wp=(e,t)=>{const i=be(e,"fileList",void 0,{passive:!0}),n=e=>i.value.find((t=>t.uid===e.uid));function o(e){var i;null==(i=t.value)||i.abort(e)}return Qn((()=>e.listType),(t=>{"picture-card"!==t&&"picture"!==t||(i.value=i.value.map((t=>{const{raw:n,url:o}=t;if(!o&&n)try{t.url=URL.createObjectURL(n)}catch(s){e.onError(s,t,i.value)}return t})))})),Qn(i,(e=>{for(const t of e)t.uid||(t.uid=tp()),t.status||(t.status="success")}),{immediate:!0,deep:!0}),{uploadFiles:i,abort:o,clearFiles:function(e=["ready","uploading","success","fail"]){i.value=i.value.filter((t=>!e.includes(t.status)))},handleError:(t,o)=>{const s=n(o);s&&(s.status="fail",i.value.splice(i.value.indexOf(s),1),e.onError(t,s,i.value),e.onChange(s,i.value))},handleProgress:(t,o)=>{const s=n(o);s&&(e.onProgress(t,s,i.value),s.status="uploading",s.percentage=Math.round(t.percent))},handleStart:t=>{const n={name:t.name,percentage:0,status:"ready",size:t.size,raw:t,uid:t.uid};if("picture-card"===e.listType||"picture"===e.listType)try{n.url=URL.createObjectURL(t)}catch(o){_(bp,o.message),e.onError(o,n,i.value)}i.value.push(n),e.onChange(n,i.value)},handleSuccess:(t,o)=>{const s=n(o);s&&(s.status="success",s.response=t,e.onSuccess(t,s,i.value),e.onChange(s,i.value))},handleRemove:async t=>{const s=t instanceof File?n(t):t;s||se(bp,"file to be removed not found");const r=t=>{o(t);const n=i.value;n.splice(n.indexOf(t),1),e.onRemove(t,n),(e=>{var t;(null==(t=e.url)?void 0:t.startsWith("blob:"))&&URL.revokeObjectURL(e.url)})(t)};if(e.beforeRemove){!1!==await e.beforeRemove(s,i.value)&&r(s)}else r(s)},submit:function(){i.value.filter((({status:e})=>"ready"===e)).forEach((({raw:e})=>{var i;return e&&(null==(i=t.value)?void 0:i.upload(e))}))}}},Cp=Zi({name:"ElUpload",props:np,setup(e,{expose:t}){const i=e,n=Gn(),o=ee(),s=ci(),{abort:r,submit:a,clearFiles:l,uploadFiles:d,handleStart:c,handleError:h,handleRemove:u,handleSuccess:g,handleProgress:p}=wp(i,s),m=Pi((()=>"picture-card"===i.listType)),f=Pi((()=>({...i,onStart:c,onProgress:p,onSuccess:g,onError:h,onRemove:u})));return fn((()=>{d.value.forEach((({url:e})=>{(null==e?void 0:e.startsWith("blob:"))&&URL.revokeObjectURL(e)}))})),Nn(md,{accept:gi(i,"accept")}),t({abort:r,submit:a,clearFiles:l,handleStart:c,handleRemove:u}),(e,t)=>(Dn(),Vi("div",null,[fi(m)&&e.showFileList?(Dn(),Fi(cp,{key:0,disabled:fi(o),"list-type":e.listType,files:fi(d),"handle-preview":e.onPreview,onRemove:fi(u)},Ui({append:no((()=>["picture-card"===e.listType?(Dn(),Fi(vp,un({key:0,ref_key:"uploadRef",ref:s},fi(f)),{default:no((()=>[fi(n).trigger?An(e.$slots,"trigger",{key:0}):Bi("v-if",!0),!fi(n).trigger&&fi(n).default?An(e.$slots,"default",{key:1}):Bi("v-if",!0)])),_:3},16)):Bi("v-if",!0)])),_:2},[e.$slots.file?{name:"default",fn:no((({file:t})=>[An(e.$slots,"file",{file:t})]))}:void 0]),1032,["disabled","list-type","files","handle-preview","onRemove"])):Bi("v-if",!0),"picture-card"!==e.listType?(Dn(),Fi(vp,un({key:1,ref_key:"uploadRef",ref:s},fi(f)),{default:no((()=>[fi(n).trigger?An(e.$slots,"trigger",{key:0}):Bi("v-if",!0),!fi(n).trigger&&fi(n).default?An(e.$slots,"default",{key:1}):Bi("v-if",!0)])),_:3},16)):Bi("v-if",!0),e.$slots.trigger?An(e.$slots,"default",{key:2}):Bi("v-if",!0),An(e.$slots,"tip"),!fi(m)&&e.showFileList?(Dn(),Fi(cp,{key:3,disabled:fi(o),"list-type":e.listType,files:fi(d),"handle-preview":e.onPreview,onRemove:fi(u)},Ui({_:2},[e.$slots.file?{name:"default",fn:no((({file:t})=>[An(e.$slots,"file",{file:t})]))}:void 0]),1032,["disabled","list-type","files","handle-preview","onRemove"])):Bi("v-if",!0)]))}});const yp=a(r(Cp,[["__file","/home/runner/work/element-plus/element-plus/packages/components/upload/src/upload.vue"]])),xp=["success","info","warning","error"],Sp=$({customClass:"",center:!1,dangerouslyUseHTMLString:!1,duration:3e3,icon:"",id:"",message:"",onClose:void 0,showClose:!1,type:"info",offset:16,zIndex:0,grouping:!1,repeatNum:1,appendTo:E?document.body:void 0}),kp=n({customClass:{type:String,default:Sp.customClass},center:{type:Boolean,default:Sp.center},dangerouslyUseHTMLString:{type:Boolean,default:Sp.dangerouslyUseHTMLString},duration:{type:Number,default:Sp.duration},icon:{type:ie,default:Sp.icon},id:{type:String,default:Sp.id},message:{type:U([String,Object,Function]),default:Sp.message},onClose:{type:U(Function),required:!1},showClose:{type:Boolean,default:Sp.showClose},type:{type:String,values:xp,default:Sp.type},offset:{type:Number,default:Sp.offset},zIndex:{type:Number,default:Sp.zIndex},grouping:{type:Boolean,default:Sp.grouping},repeatNum:{type:Number,default:Sp.repeatNum}}),Dp=li([]),Lp=e=>{const{prev:t}=(e=>{const t=Dp.findIndex((t=>t.id===e)),i=Dp[t];let n;return t>0&&(n=Dp[t-1]),{current:i,prev:n}})(e);return t?t.vm.exposeProxy.bottom:0},Np=["id"],Ep=["innerHTML"],Ip=Zi({name:"ElMessage",props:kp,emits:{destroy:()=>!0},setup(e,{expose:t}){const i=e,{Close:n}=Ce,s=o("message"),r=ai(),a=ai(!1),l=ai(0);let d;const c=Pi((()=>i.type?"error"===i.type?"danger":i.type:"info")),h=Pi((()=>{const e=i.type;return{[s.bm("icon",e)]:e&&we[e]}})),u=Pi((()=>i.icon||we[i.type]||"")),g=Pi((()=>Lp(i.id))),p=Pi((()=>i.offset+g.value)),m=Pi((()=>l.value+p.value)),f=Pi((()=>({top:`${p.value}px`,zIndex:i.zIndex})));function _(){0!==i.duration&&({stop:d}=ye((()=>{b()}),i.duration))}function v(){null==d||d()}function b(){a.value=!1}return wn((()=>{_(),a.value=!0})),Qn((()=>i.repeatNum),(()=>{v(),_()})),ge(document,"keydown",(function({code:e}){e===T.esc&&b()})),H(r,(()=>{l.value=r.value.getBoundingClientRect().height})),t({visible:a,bottom:m,close:b}),(e,t)=>(Dn(),Fi(lo,{name:fi(s).b("fade"),onBeforeLeave:e.onClose,onAfterLeave:t[0]||(t[0]=t=>e.$emit("destroy")),persisted:""},{default:no((()=>[so(Wi("div",{id:e.id,ref_key:"messageRef",ref:r,class:bi([fi(s).b(),{[fi(s).m(e.type)]:e.type&&!e.icon},fi(s).is("center",e.center),fi(s).is("closable",e.showClose),e.customClass]),style:Ci(fi(f)),role:"alert",onMouseenter:v,onMouseleave:_},[e.repeatNum>1?(Dn(),Fi(fi(vd),{key:0,value:e.repeatNum,type:fi(c),class:bi(fi(s).e("badge"))},null,8,["value","type","class"])):Bi("v-if",!0),fi(u)?(Dn(),Fi(fi(w),{key:1,class:bi([fi(s).e("icon"),fi(h)])},{default:no((()=>[(Dn(),Fi(Pn(fi(u))))])),_:1},8,["class"])):Bi("v-if",!0),An(e.$slots,"default",{},(()=>[e.dangerouslyUseHTMLString?(Dn(),Vi(Di,{key:1},[Bi(" Caution here, message could've been compromised, never use user's input as message "),Wi("p",{class:bi(fi(s).e("content")),innerHTML:e.message},null,10,Ep)],2112)):(Dn(),Vi("p",{key:0,class:bi(fi(s).e("content"))},yi(e.message),3))])),e.showClose?(Dn(),Fi(fi(w),{key:2,class:bi(fi(s).e("closeBtn")),onClick:No(b,["stop"])},{default:no((()=>[qi(fi(n))])),_:1},8,["class","onClick"])):Bi("v-if",!0)],46,Np),[[Do,a.value]])])),_:3},8,["name","onBeforeLeave"]))}});var Tp=r(Ip,[["__file","/home/runner/work/element-plus/element-plus/packages/components/message/src/message.vue"]]);let Mp=1;const Ap=e=>{const t=!e||Eo(e)||cn(e)||Mo(e)?{message:e}:e,i={...Sp,...t};if(Eo(i.appendTo)){let e=document.querySelector(i.appendTo);Se(e)||(e=document.body),i.appendTo=e}return i},Op=({appendTo:e,...t},i)=>{const{nextZIndex:n}=re(),o="message_"+Mp++,s=t.onClose,r=document.createElement("div"),a={...t,zIndex:n()+t.zIndex,id:o,onClose:()=>{null==s||s(),(e=>{const t=Dp.indexOf(e);if(-1===t)return;Dp.splice(t,1);const{handler:i}=e;i.close()})(h)},onDestroy:()=>{vo(null,r)}},l=qi(Tp,a,Mo(a.message)||cn(a.message)?{default:a.message}:null);l.appContext=i||Rp._context,vo(l,r),e.appendChild(r.firstElementChild);const d=l.component,c={close:()=>{d.exposeProxy.visible=!1}},h={id:o,vnode:l,vm:d,handler:c,props:l.component.props};return h},Rp=(e={},t)=>{if(!E)return{close:()=>{}};if(s(xe.max)&&Dp.length>=xe.max)return{close:()=>{}};const i=Ap(e);if(i.grouping&&Dp.length){const e=Dp.find((({vnode:e})=>{var t;return(null==(t=e.props)?void 0:t.message)===i.message}));if(e)return e.props.repeatNum+=1,e.props.type=i.type,e.handler}const n=Op(i,t);return Dp.push(n),n.handler};xp.forEach((e=>{Rp[e]=(t={},i)=>{const n=Ap(t);return Rp({...n,type:e},i)}})),Rp.closeAll=function(e){for(const t of Dp)e&&e!==t.props.type||t.handler.close()},Rp._context=null;const Pp=ke(Rp,"$message");const Fp=Zi({name:"Preview",props:{visible:{type:Boolean,default:!1}},emits:["update:visible"],setup(e,{emit:t}){const i=be(e,"visible",t),n=`${gt}preview/${location.hash}`;return(e,t)=>{const o=De;return Dn(),Fi(o,{modelValue:fi(i),"onUpdate:modelValue":t[0]||(t[0]=e=>ei(i)?i.value=e:null),"custom-class":"h5-preview","show-close":!1,width:"360px"},{default:no((()=>[fi(i)?(Dn(),Vi("iframe",{key:0,style:{width:"100%",height:"100%"},src:n,frameborder:"0",scrolling:"auto"})):Bi("",!0)])),_:1},8,["modelValue"])}}});var Bp={},Vp={},Wp={};let zp;const Hp=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];Wp.getSymbolSize=function(e){if(!e)throw new Error('"version" cannot be null or undefined');if(e<1||e>40)throw new Error('"version" should be in range from 1 to 40');return 4*e+17},Wp.getSymbolTotalCodewords=function(e){return Hp[e]},Wp.getBCHDigit=function(e){let t=0;for(;0!==e;)t++,e>>>=1;return t},Wp.setToSJISFunction=function(e){if("function"!=typeof e)throw new Error('"toSJISFunc" is not a valid function.');zp=e},Wp.isKanjiModeEnabled=function(){return void 0!==zp},Wp.toSJIS=function(e){return zp(e)};var jp={};function Up(){this.buffer=[],this.length=0}!function(e){e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2},e.isValid=function(e){return e&&void 0!==e.bit&&e.bit>=0&&e.bit<4},e.from=function(t,i){if(e.isValid(t))return t;try{return function(t){if("string"!=typeof t)throw new Error("Param is not a string");switch(t.toLowerCase()){case"l":case"low":return e.L;case"m":case"medium":return e.M;case"q":case"quartile":return e.Q;case"h":case"high":return e.H;default:throw new Error("Unknown EC Level: "+t)}}(t)}catch(n){return i}}}(jp),Up.prototype={get:function(e){const t=Math.floor(e/8);return 1==(this.buffer[t]>>>7-e%8&1)},put:function(e,t){for(let i=0;i<t;i++)this.putBit(1==(e>>>t-i-1&1))},getLengthInBits:function(){return this.length},putBit:function(e){const t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}};var $p=Up;function Kp(e){if(!e||e<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}Kp.prototype.set=function(e,t,i,n){const o=e*this.size+t;this.data[o]=i,n&&(this.reservedBit[o]=!0)},Kp.prototype.get=function(e,t){return this.data[e*this.size+t]},Kp.prototype.xor=function(e,t,i){this.data[e*this.size+t]^=i},Kp.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]};var qp=Kp,Gp={};!function(e){const t=Wp.getSymbolSize;e.getRowColCoords=function(e){if(1===e)return[];const i=Math.floor(e/7)+2,n=t(e),o=145===n?26:2*Math.ceil((n-13)/(2*i-2)),s=[n-7];for(let t=1;t<i-1;t++)s[t]=s[t-1]-o;return s.push(6),s.reverse()},e.getPositions=function(t){const i=[],n=e.getRowColCoords(t),o=n.length;for(let e=0;e<o;e++)for(let t=0;t<o;t++)0===e&&0===t||0===e&&t===o-1||e===o-1&&0===t||i.push([n[e],n[t]]);return i}}(Gp);var Zp={};const Yp=Wp.getSymbolSize;Zp.getPositions=function(e){const t=Yp(e);return[[0,0],[t-7,0],[0,t-7]]};var Xp={};!function(e){e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const t=3,i=3,n=40,o=10;function s(t,i,n){switch(t){case e.Patterns.PATTERN000:return(i+n)%2==0;case e.Patterns.PATTERN001:return i%2==0;case e.Patterns.PATTERN010:return n%3==0;case e.Patterns.PATTERN011:return(i+n)%3==0;case e.Patterns.PATTERN100:return(Math.floor(i/2)+Math.floor(n/3))%2==0;case e.Patterns.PATTERN101:return i*n%2+i*n%3==0;case e.Patterns.PATTERN110:return(i*n%2+i*n%3)%2==0;case e.Patterns.PATTERN111:return(i*n%3+(i+n)%2)%2==0;default:throw new Error("bad maskPattern:"+t)}}e.isValid=function(e){return null!=e&&""!==e&&!isNaN(e)&&e>=0&&e<=7},e.from=function(t){return e.isValid(t)?parseInt(t,10):void 0},e.getPenaltyN1=function(e){const i=e.size;let n=0,o=0,s=0,r=null,a=null;for(let l=0;l<i;l++){o=s=0,r=a=null;for(let d=0;d<i;d++){let i=e.get(l,d);i===r?o++:(o>=5&&(n+=t+(o-5)),r=i,o=1),i=e.get(d,l),i===a?s++:(s>=5&&(n+=t+(s-5)),a=i,s=1)}o>=5&&(n+=t+(o-5)),s>=5&&(n+=t+(s-5))}return n},e.getPenaltyN2=function(e){const t=e.size;let n=0;for(let i=0;i<t-1;i++)for(let o=0;o<t-1;o++){const t=e.get(i,o)+e.get(i,o+1)+e.get(i+1,o)+e.get(i+1,o+1);4!==t&&0!==t||n++}return n*i},e.getPenaltyN3=function(e){const t=e.size;let i=0,o=0,s=0;for(let n=0;n<t;n++){o=s=0;for(let r=0;r<t;r++)o=o<<1&2047|e.get(n,r),r>=10&&(1488===o||93===o)&&i++,s=s<<1&2047|e.get(r,n),r>=10&&(1488===s||93===s)&&i++}return i*n},e.getPenaltyN4=function(e){let t=0;const i=e.data.length;for(let n=0;n<i;n++)t+=e.data[n];return Math.abs(Math.ceil(100*t/i/5)-10)*o},e.applyMask=function(e,t){const i=t.size;for(let n=0;n<i;n++)for(let o=0;o<i;o++)t.isReserved(o,n)||t.xor(o,n,s(e,o,n))},e.getBestMask=function(t,i){const n=Object.keys(e.Patterns).length;let o=0,s=1/0;for(let r=0;r<n;r++){i(r),e.applyMask(r,t);const n=e.getPenaltyN1(t)+e.getPenaltyN2(t)+e.getPenaltyN3(t)+e.getPenaltyN4(t);e.applyMask(r,t),n<s&&(s=n,o=r)}return o}}(Xp);var Qp={};const Jp=jp,em=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],tm=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];Qp.getBlocksCount=function(e,t){switch(t){case Jp.L:return em[4*(e-1)+0];case Jp.M:return em[4*(e-1)+1];case Jp.Q:return em[4*(e-1)+2];case Jp.H:return em[4*(e-1)+3];default:return}},Qp.getTotalCodewordsCount=function(e,t){switch(t){case Jp.L:return tm[4*(e-1)+0];case Jp.M:return tm[4*(e-1)+1];case Jp.Q:return tm[4*(e-1)+2];case Jp.H:return tm[4*(e-1)+3];default:return}};var im={},nm={};const om=new Uint8Array(512),sm=new Uint8Array(256);!function(){let e=1;for(let t=0;t<255;t++)om[t]=e,sm[e]=t,e<<=1,256&e&&(e^=285);for(let t=255;t<512;t++)om[t]=om[t-255]}(),nm.log=function(e){if(e<1)throw new Error("log("+e+")");return sm[e]},nm.exp=function(e){return om[e]},nm.mul=function(e,t){return 0===e||0===t?0:om[sm[e]+sm[t]]},function(e){const t=nm;e.mul=function(e,i){const n=new Uint8Array(e.length+i.length-1);for(let o=0;o<e.length;o++)for(let s=0;s<i.length;s++)n[o+s]^=t.mul(e[o],i[s]);return n},e.mod=function(e,i){let n=new Uint8Array(e);for(;n.length-i.length>=0;){const e=n[0];for(let s=0;s<i.length;s++)n[s]^=t.mul(i[s],e);let o=0;for(;o<n.length&&0===n[o];)o++;n=n.slice(o)}return n},e.generateECPolynomial=function(i){let n=new Uint8Array([1]);for(let o=0;o<i;o++)n=e.mul(n,new Uint8Array([1,t.exp(o)]));return n}}(im);const rm=im;function am(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}am.prototype.initialize=function(e){this.degree=e,this.genPoly=rm.generateECPolynomial(this.degree)},am.prototype.encode=function(e){if(!this.genPoly)throw new Error("Encoder not initialized");const t=new Uint8Array(e.length+this.degree);t.set(e);const i=rm.mod(t,this.genPoly),n=this.degree-i.length;if(n>0){const e=new Uint8Array(this.degree);return e.set(i,n),e}return i};var lm=am,dm={},cm={},hm={isValid:function(e){return!isNaN(e)&&e>=1&&e<=40}},um={};const gm="[0-9]+";let pm="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";pm=pm.replace(/u/g,"\\u");const mm="(?:(?![A-Z0-9 $%*+\\-./:]|"+pm+")(?:.|[\r\n]))+";um.KANJI=new RegExp(pm,"g"),um.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),um.BYTE=new RegExp(mm,"g"),um.NUMERIC=new RegExp(gm,"g"),um.ALPHANUMERIC=new RegExp("[A-Z $%*+\\-./:]+","g");const fm=new RegExp("^"+pm+"$"),_m=new RegExp("^[0-9]+$"),vm=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");um.testKanji=function(e){return fm.test(e)},um.testNumeric=function(e){return _m.test(e)},um.testAlphanumeric=function(e){return vm.test(e)},function(e){const t=hm,i=um;e.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},e.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},e.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(e,i){if(!e.ccBits)throw new Error("Invalid mode: "+e);if(!t.isValid(i))throw new Error("Invalid version: "+i);return i>=1&&i<10?e.ccBits[0]:i<27?e.ccBits[1]:e.ccBits[2]},e.getBestModeForData=function(t){return i.testNumeric(t)?e.NUMERIC:i.testAlphanumeric(t)?e.ALPHANUMERIC:i.testKanji(t)?e.KANJI:e.BYTE},e.toString=function(e){if(e&&e.id)return e.id;throw new Error("Invalid mode")},e.isValid=function(e){return e&&e.bit&&e.ccBits},e.from=function(t,i){if(e.isValid(t))return t;try{return function(t){if("string"!=typeof t)throw new Error("Param is not a string");switch(t.toLowerCase()){case"numeric":return e.NUMERIC;case"alphanumeric":return e.ALPHANUMERIC;case"kanji":return e.KANJI;case"byte":return e.BYTE;default:throw new Error("Unknown mode: "+t)}}(t)}catch(n){return i}}}(cm),function(e){const t=Wp,i=Qp,n=jp,o=cm,s=hm,r=t.getBCHDigit(7973);function a(e,t){return o.getCharCountIndicator(e,t)+4}function l(e,t){let i=0;return e.forEach((function(e){const n=a(e.mode,t);i+=n+e.getBitsLength()})),i}e.from=function(e,t){return s.isValid(e)?parseInt(e,10):t},e.getCapacity=function(e,n,r){if(!s.isValid(e))throw new Error("Invalid QR Code version");void 0===r&&(r=o.BYTE);const l=8*(t.getSymbolTotalCodewords(e)-i.getTotalCodewordsCount(e,n));if(r===o.MIXED)return l;const d=l-a(r,e);switch(r){case o.NUMERIC:return Math.floor(d/10*3);case o.ALPHANUMERIC:return Math.floor(d/11*2);case o.KANJI:return Math.floor(d/13);case o.BYTE:default:return Math.floor(d/8)}},e.getBestVersionForData=function(t,i){let s;const r=n.from(i,n.M);if(Array.isArray(t)){if(t.length>1)return function(t,i){for(let n=1;n<=40;n++)if(l(t,n)<=e.getCapacity(n,i,o.MIXED))return n}(t,r);if(0===t.length)return 1;s=t[0]}else s=t;return function(t,i,n){for(let o=1;o<=40;o++)if(i<=e.getCapacity(o,n,t))return o}(s.mode,s.getLength(),r)},e.getEncodedBits=function(e){if(!s.isValid(e)||e<7)throw new Error("Invalid QR Code version");let i=e<<12;for(;t.getBCHDigit(i)-r>=0;)i^=7973<<t.getBCHDigit(i)-r;return e<<12|i}}(dm);var bm={};const wm=Wp,Cm=wm.getBCHDigit(1335);bm.getEncodedBits=function(e,t){const i=e.bit<<3|t;let n=i<<10;for(;wm.getBCHDigit(n)-Cm>=0;)n^=1335<<wm.getBCHDigit(n)-Cm;return 21522^(i<<10|n)};var ym={};const xm=cm;function Sm(e){this.mode=xm.NUMERIC,this.data=e.toString()}Sm.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)},Sm.prototype.getLength=function(){return this.data.length},Sm.prototype.getBitsLength=function(){return Sm.getBitsLength(this.data.length)},Sm.prototype.write=function(e){let t,i,n;for(t=0;t+3<=this.data.length;t+=3)i=this.data.substr(t,3),n=parseInt(i,10),e.put(n,10);const o=this.data.length-t;o>0&&(i=this.data.substr(t),n=parseInt(i,10),e.put(n,3*o+1))};var km=Sm;const Dm=cm,Lm=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function Nm(e){this.mode=Dm.ALPHANUMERIC,this.data=e}Nm.getBitsLength=function(e){return 11*Math.floor(e/2)+e%2*6},Nm.prototype.getLength=function(){return this.data.length},Nm.prototype.getBitsLength=function(){return Nm.getBitsLength(this.data.length)},Nm.prototype.write=function(e){let t;for(t=0;t+2<=this.data.length;t+=2){let i=45*Lm.indexOf(this.data[t]);i+=Lm.indexOf(this.data[t+1]),e.put(i,11)}this.data.length%2&&e.put(Lm.indexOf(this.data[t]),6)};var Em=Nm;const Im=function(e){for(var t=[],i=e.length,n=0;n<i;n++){var o=e.charCodeAt(n);if(o>=55296&&o<=56319&&i>n+1){var s=e.charCodeAt(n+1);s>=56320&&s<=57343&&(o=1024*(o-55296)+s-56320+65536,n+=1)}o<128?t.push(o):o<2048?(t.push(o>>6|192),t.push(63&o|128)):o<55296||o>=57344&&o<65536?(t.push(o>>12|224),t.push(o>>6&63|128),t.push(63&o|128)):o>=65536&&o<=1114111?(t.push(o>>18|240),t.push(o>>12&63|128),t.push(o>>6&63|128),t.push(63&o|128)):t.push(239,191,189)}return new Uint8Array(t).buffer},Tm=cm;function Mm(e){this.mode=Tm.BYTE,this.data=new Uint8Array(Im(e))}Mm.getBitsLength=function(e){return 8*e},Mm.prototype.getLength=function(){return this.data.length},Mm.prototype.getBitsLength=function(){return Mm.getBitsLength(this.data.length)},Mm.prototype.write=function(e){for(let t=0,i=this.data.length;t<i;t++)e.put(this.data[t],8)};var Am=Mm;const Om=cm,Rm=Wp;function Pm(e){this.mode=Om.KANJI,this.data=e}Pm.getBitsLength=function(e){return 13*e},Pm.prototype.getLength=function(){return this.data.length},Pm.prototype.getBitsLength=function(){return Pm.getBitsLength(this.data.length)},Pm.prototype.write=function(e){let t;for(t=0;t<this.data.length;t++){let i=Rm.toSJIS(this.data[t]);if(i>=33088&&i<=40956)i-=33088;else{if(!(i>=57408&&i<=60351))throw new Error("Invalid SJIS character: "+this.data[t]+"\nMake sure your charset is UTF-8");i-=49472}i=192*(i>>>8&255)+(255&i),e.put(i,13)}};var Fm=Pm,Bm={exports:{}};!function(e){var t={single_source_shortest_paths:function(e,i,n){var o={},s={};s[i]=0;var r,a,l,d,c,h,u,g=t.PriorityQueue.make();for(g.push(i,0);!g.empty();)for(l in a=(r=g.pop()).value,d=r.cost,c=e[a]||{})c.hasOwnProperty(l)&&(h=d+c[l],u=s[l],(void 0===s[l]||u>h)&&(s[l]=h,g.push(l,h),o[l]=a));if(void 0!==n&&void 0===s[n]){var p=["Could not find a path from ",i," to ",n,"."].join("");throw new Error(p)}return o},extract_shortest_path_from_predecessor_list:function(e,t){for(var i=[],n=t;n;)i.push(n),n=e[n];return i.reverse(),i},find_path:function(e,i,n){var o=t.single_source_shortest_paths(e,i,n);return t.extract_shortest_path_from_predecessor_list(o,n)},PriorityQueue:{make:function(e){var i,n=t.PriorityQueue,o={};for(i in e=e||{},n)n.hasOwnProperty(i)&&(o[i]=n[i]);return o.queue=[],o.sorter=e.sorter||n.default_sorter,o},default_sorter:function(e,t){return e.cost-t.cost},push:function(e,t){var i={value:e,cost:t};this.queue.push(i),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return 0===this.queue.length}}};e.exports=t}(Bm),function(e){const t=cm,i=km,n=Em,o=Am,s=Fm,r=um,a=Wp,l=Bm.exports;function d(e){return unescape(encodeURIComponent(e)).length}function c(e,t,i){const n=[];let o;for(;null!==(o=e.exec(i));)n.push({data:o[0],index:o.index,mode:t,length:o[0].length});return n}function h(e){const i=c(r.NUMERIC,t.NUMERIC,e),n=c(r.ALPHANUMERIC,t.ALPHANUMERIC,e);let o,s;a.isKanjiModeEnabled()?(o=c(r.BYTE,t.BYTE,e),s=c(r.KANJI,t.KANJI,e)):(o=c(r.BYTE_KANJI,t.BYTE,e),s=[]);return i.concat(n,o,s).sort((function(e,t){return e.index-t.index})).map((function(e){return{data:e.data,mode:e.mode,length:e.length}}))}function u(e,r){switch(r){case t.NUMERIC:return i.getBitsLength(e);case t.ALPHANUMERIC:return n.getBitsLength(e);case t.KANJI:return s.getBitsLength(e);case t.BYTE:return o.getBitsLength(e)}}function g(e,r){let l;const d=t.getBestModeForData(e);if(l=t.from(r,d),l!==t.BYTE&&l.bit<d.bit)throw new Error('"'+e+'" cannot be encoded with mode '+t.toString(l)+".\n Suggested mode is: "+t.toString(d));switch(l!==t.KANJI||a.isKanjiModeEnabled()||(l=t.BYTE),l){case t.NUMERIC:return new i(e);case t.ALPHANUMERIC:return new n(e);case t.KANJI:return new s(e);case t.BYTE:return new o(e)}}e.fromArray=function(e){return e.reduce((function(e,t){return"string"==typeof t?e.push(g(t,null)):t.data&&e.push(g(t.data,t.mode)),e}),[])},e.fromString=function(i,n){const o=function(e){const i=[];for(let n=0;n<e.length;n++){const o=e[n];switch(o.mode){case t.NUMERIC:i.push([o,{data:o.data,mode:t.ALPHANUMERIC,length:o.length},{data:o.data,mode:t.BYTE,length:o.length}]);break;case t.ALPHANUMERIC:i.push([o,{data:o.data,mode:t.BYTE,length:o.length}]);break;case t.KANJI:i.push([o,{data:o.data,mode:t.BYTE,length:d(o.data)}]);break;case t.BYTE:i.push([{data:o.data,mode:t.BYTE,length:d(o.data)}])}}return i}(h(i,a.isKanjiModeEnabled())),s=function(e,i){const n={},o={start:{}};let s=["start"];for(let r=0;r<e.length;r++){const a=e[r],l=[];for(let e=0;e<a.length;e++){const d=a[e],c=""+r+e;l.push(c),n[c]={node:d,lastCount:0},o[c]={};for(let e=0;e<s.length;e++){const r=s[e];n[r]&&n[r].node.mode===d.mode?(o[r][c]=u(n[r].lastCount+d.length,d.mode)-u(n[r].lastCount,d.mode),n[r].lastCount+=d.length):(n[r]&&(n[r].lastCount=d.length),o[r][c]=u(d.length,d.mode)+4+t.getCharCountIndicator(d.mode,i))}}s=l}for(let t=0;t<s.length;t++)o[s[t]].end=0;return{map:o,table:n}}(o,n),r=l.find_path(s.map,"start","end"),c=[];for(let e=1;e<r.length-1;e++)c.push(s.table[r[e]].node);return e.fromArray(function(e){return e.reduce((function(e,t){const i=e.length-1>=0?e[e.length-1]:null;return i&&i.mode===t.mode?(e[e.length-1].data+=t.data,e):(e.push(t),e)}),[])}(c))},e.rawSplit=function(t){return e.fromArray(h(t,a.isKanjiModeEnabled()))}}(ym);const Vm=Wp,Wm=jp,zm=$p,Hm=qp,jm=Gp,Um=Zp,$m=Xp,Km=Qp,qm=lm,Gm=dm,Zm=bm,Ym=cm,Xm=ym;function Qm(e,t,i){const n=e.size,o=Zm.getEncodedBits(t,i);let s,r;for(s=0;s<15;s++)r=1==(o>>s&1),s<6?e.set(s,8,r,!0):s<8?e.set(s+1,8,r,!0):e.set(n-15+s,8,r,!0),s<8?e.set(8,n-s-1,r,!0):s<9?e.set(8,15-s-1+1,r,!0):e.set(8,15-s-1,r,!0);e.set(n-8,8,1,!0)}function Jm(e,t,i){const n=new zm;i.forEach((function(t){n.put(t.mode.bit,4),n.put(t.getLength(),Ym.getCharCountIndicator(t.mode,e)),t.write(n)}));const o=8*(Vm.getSymbolTotalCodewords(e)-Km.getTotalCodewordsCount(e,t));for(n.getLengthInBits()+4<=o&&n.put(0,4);n.getLengthInBits()%8!=0;)n.putBit(0);const s=(o-n.getLengthInBits())/8;for(let r=0;r<s;r++)n.put(r%2?17:236,8);return function(e,t,i){const n=Vm.getSymbolTotalCodewords(t),o=Km.getTotalCodewordsCount(t,i),s=n-o,r=Km.getBlocksCount(t,i),a=r-n%r,l=Math.floor(n/r),d=Math.floor(s/r),c=d+1,h=l-d,u=new qm(h);let g=0;const p=new Array(r),m=new Array(r);let f=0;const _=new Uint8Array(e.buffer);for(let y=0;y<r;y++){const e=y<a?d:c;p[y]=_.slice(g,g+e),m[y]=u.encode(p[y]),g+=e,f=Math.max(f,e)}const v=new Uint8Array(n);let b,w,C=0;for(b=0;b<f;b++)for(w=0;w<r;w++)b<p[w].length&&(v[C++]=p[w][b]);for(b=0;b<h;b++)for(w=0;w<r;w++)v[C++]=m[w][b];return v}(n,e,t)}function ef(e,t,i,n){let o;if(Array.isArray(e))o=Xm.fromArray(e);else{if("string"!=typeof e)throw new Error("Invalid data");{let n=t;if(!n){const t=Xm.rawSplit(e);n=Gm.getBestVersionForData(t,i)}o=Xm.fromString(e,n||40)}}const s=Gm.getBestVersionForData(o,i);if(!s)throw new Error("The amount of data is too big to be stored in a QR Code");if(t){if(t<s)throw new Error("\nThe chosen QR Code version cannot contain this amount of data.\nMinimum version required to store current data is: "+s+".\n")}else t=s;const r=Jm(t,i,o),a=Vm.getSymbolSize(t),l=new Hm(a);return function(e,t){const i=e.size,n=Um.getPositions(t);for(let o=0;o<n.length;o++){const t=n[o][0],s=n[o][1];for(let n=-1;n<=7;n++)if(!(t+n<=-1||i<=t+n))for(let o=-1;o<=7;o++)s+o<=-1||i<=s+o||(n>=0&&n<=6&&(0===o||6===o)||o>=0&&o<=6&&(0===n||6===n)||n>=2&&n<=4&&o>=2&&o<=4?e.set(t+n,s+o,!0,!0):e.set(t+n,s+o,!1,!0))}}(l,t),function(e){const t=e.size;for(let i=8;i<t-8;i++){const t=i%2==0;e.set(i,6,t,!0),e.set(6,i,t,!0)}}(l),function(e,t){const i=jm.getPositions(t);for(let n=0;n<i.length;n++){const t=i[n][0],o=i[n][1];for(let i=-2;i<=2;i++)for(let n=-2;n<=2;n++)-2===i||2===i||-2===n||2===n||0===i&&0===n?e.set(t+i,o+n,!0,!0):e.set(t+i,o+n,!1,!0)}}(l,t),Qm(l,i,0),t>=7&&function(e,t){const i=e.size,n=Gm.getEncodedBits(t);let o,s,r;for(let a=0;a<18;a++)o=Math.floor(a/3),s=a%3+i-8-3,r=1==(n>>a&1),e.set(o,s,r,!0),e.set(s,o,r,!0)}(l,t),function(e,t){const i=e.size;let n=-1,o=i-1,s=7,r=0;for(let a=i-1;a>0;a-=2)for(6===a&&a--;;){for(let i=0;i<2;i++)if(!e.isReserved(o,a-i)){let n=!1;r<t.length&&(n=1==(t[r]>>>s&1)),e.set(o,a-i,n),s--,-1===s&&(r++,s=7)}if(o+=n,o<0||i<=o){o-=n,n=-n;break}}}(l,r),isNaN(n)&&(n=$m.getBestMask(l,Qm.bind(null,l,i))),$m.applyMask(n,l),Qm(l,i,n),{modules:l,version:t,errorCorrectionLevel:i,maskPattern:n,segments:o}}Vp.create=function(e,t){if(void 0===e||""===e)throw new Error("No input text");let i,n,o=Wm.M;return void 0!==t&&(o=Wm.from(t.errorCorrectionLevel,Wm.M),i=Gm.from(t.version),n=$m.from(t.maskPattern),t.toSJISFunc&&Vm.setToSJISFunction(t.toSJISFunc)),ef(e,i,o,n)};var tf={},nf={};!function(e){function t(e){if("number"==typeof e&&(e=e.toString()),"string"!=typeof e)throw new Error("Color should be defined as hex string");let t=e.slice().replace("#","").split("");if(t.length<3||5===t.length||t.length>8)throw new Error("Invalid hex color: "+e);3!==t.length&&4!==t.length||(t=Array.prototype.concat.apply([],t.map((function(e){return[e,e]})))),6===t.length&&t.push("F","F");const i=parseInt(t.join(""),16);return{r:i>>24&255,g:i>>16&255,b:i>>8&255,a:255&i,hex:"#"+t.slice(0,6).join("")}}e.getOptions=function(e){e||(e={}),e.color||(e.color={});const i=void 0===e.margin||null===e.margin||e.margin<0?4:e.margin,n=e.width&&e.width>=21?e.width:void 0,o=e.scale||4;return{width:n,scale:n?4:o,margin:i,color:{dark:t(e.color.dark||"#000000ff"),light:t(e.color.light||"#ffffffff")},type:e.type,rendererOpts:e.rendererOpts||{}}},e.getScale=function(e,t){return t.width&&t.width>=e+2*t.margin?t.width/(e+2*t.margin):t.scale},e.getImageWidth=function(t,i){const n=e.getScale(t,i);return Math.floor((t+2*i.margin)*n)},e.qrToImageData=function(t,i,n){const o=i.modules.size,s=i.modules.data,r=e.getScale(o,n),a=Math.floor((o+2*n.margin)*r),l=n.margin*r,d=[n.color.light,n.color.dark];for(let e=0;e<a;e++)for(let i=0;i<a;i++){let c=4*(e*a+i),h=n.color.light;if(e>=l&&i>=l&&e<a-l&&i<a-l){h=d[s[Math.floor((e-l)/r)*o+Math.floor((i-l)/r)]?1:0]}t[c++]=h.r,t[c++]=h.g,t[c++]=h.b,t[c]=h.a}}}(nf),function(e){const t=nf;e.render=function(e,i,n){let o=n,s=i;void 0!==o||i&&i.getContext||(o=i,i=void 0),i||(s=function(){try{return document.createElement("canvas")}catch(e){throw new Error("You need to specify a canvas element")}}()),o=t.getOptions(o);const r=t.getImageWidth(e.modules.size,o),a=s.getContext("2d"),l=a.createImageData(r,r);return t.qrToImageData(l.data,e,o),function(e,t,i){e.clearRect(0,0,t.width,t.height),t.style||(t.style={}),t.height=i,t.width=i,t.style.height=i+"px",t.style.width=i+"px"}(a,s,r),a.putImageData(l,0,0),s},e.renderToDataURL=function(t,i,n){let o=n;void 0!==o||i&&i.getContext||(o=i,i=void 0),o||(o={});const s=e.render(t,i,o),r=o.type||"image/png",a=o.rendererOpts||{};return s.toDataURL(r,a.quality)}}(tf);var of={};const sf=nf;function rf(e,t){const i=e.a/255,n=t+'="'+e.hex+'"';return i<1?n+" "+t+'-opacity="'+i.toFixed(2).slice(1)+'"':n}function af(e,t,i){let n=e+t;return void 0!==i&&(n+=" "+i),n}of.render=function(e,t,i){const n=sf.getOptions(t),o=e.modules.size,s=e.modules.data,r=o+2*n.margin,a=n.color.light.a?"<path "+rf(n.color.light,"fill")+' d="M0 0h'+r+"v"+r+'H0z"/>':"",l="<path "+rf(n.color.dark,"stroke")+' d="'+function(e,t,i){let n="",o=0,s=!1,r=0;for(let a=0;a<e.length;a++){const l=Math.floor(a%t),d=Math.floor(a/t);l||s||(s=!0),e[a]?(r++,a>0&&l>0&&e[a-1]||(n+=s?af("M",l+i,.5+d+i):af("m",o,0),o=0,s=!1),l+1<t&&e[a+1]||(n+=af("h",r),r=0)):o++}return n}(s,o,n.margin)+'"/>',d='viewBox="0 0 '+r+" "+r+'"',c='<svg xmlns="http://www.w3.org/2000/svg" '+(n.width?'width="'+n.width+'" height="'+n.width+'" ':"")+d+' shape-rendering="crispEdges">'+a+l+"</svg>\n";return"function"==typeof i&&i(null,c),c};const lf=function(){return"function"==typeof Promise&&Promise.prototype&&Promise.prototype.then},df=Vp,cf=tf,hf=of;function uf(e,t,i,n,o){const s=[].slice.call(arguments,1),r=s.length,a="function"==typeof s[r-1];if(!a&&!lf())throw new Error("Callback required as last argument");if(!a){if(r<1)throw new Error("Too few arguments provided");return 1===r?(i=t,t=n=void 0):2!==r||t.getContext||(n=i,i=t,t=void 0),new Promise((function(o,s){try{const s=df.create(i,n);o(e(s,t,n))}catch(r){s(r)}}))}if(r<2)throw new Error("Too few arguments provided");2===r?(o=i,i=t,t=n=void 0):3===r&&(t.getContext&&void 0===o?(o=n,n=void 0):(o=n,n=i,i=t,t=void 0));try{const s=df.create(i,n);o(null,e(s,t,n))}catch(l){o(l)}}Bp.create=df.create,Bp.toCanvas=uf.bind(null,cf.render),Bp.toDataURL=uf.bind(null,cf.renderToDataURL),Bp.toString=uf.bind(null,(function(e,t,i){return hf.render(e,i)}));const gf=Zi({props:{options:{type:Object,default:()=>({})}},setup(e){const t=en(),i=si({options:e.options,visible:!0}),n={service:e=>{i.options=e,n.show()},show:()=>i.visible=!0,hide:()=>i.visible=!1},o={onConfirm:async()=>{var e,t;await(null===(e=(t=i.options).onConfirm)||void 0===e?void 0:e.call(t)),n.hide()},onCancel:()=>{var e,t;null===(e=(t=i.options).onCancel)||void 0===e||e.call(t),n.hide()}};return Object.assign(t.proxy,n),()=>qi(De,un({modelValue:i.visible,"onUpdate:modelValue":e=>i.visible=e,title:i.options.title,destroyOnClose:!0},i.options.props,{onClose:o.onCancel}),{default:()=>cn(i.options.content)?qi(On("content"),null,null):pt(i.options.content)?i.options.content():null,footer:()=>null===i.options.footer?null:qi("div",null,[qi(Y,{onClick:o.onCancel},{default:()=>[Ki("取消")]}),qi(Y,un({type:"primary"},{onClick:o.onConfirm}),{default:()=>[Ki("确定")]})])})}}),pf=(()=>{let e;return t=>{if(e)return e.service(t),e;const i=document.createElement("div");document.body.appendChild(i);const n=uo(gf,{options:t});return e=n.mount(i),e}})();function mf(e,t,...i){return function(e,t){let i;return i=0===t.length?e:e.replace(/\{(\d+)\}/g,(function(e,i){const n=i[0];return void 0!==t[n]?t[n]:e})),i}(t,i)}const ff={tabSize:4,indentSize:4,insertSpaces:!0,detectIndentation:!0,trimAutoWhitespace:!0,largeFileOptimizations:!0,bracketPairColorizationOptions:{enabled:!1}};class _f{constructor(e){this._values=e}hasChanged(e){return this._values[e]}}class vf{constructor(){this.stableMinimapLayoutInput=null,this.stableFitMaxMinimapScale=0,this.stableFitRemainingWidth=0}}class bf{constructor(e,t,i,n){this.id=e,this.name=t,this.defaultValue=i,this.schema=n}applyUpdate(e,t){return Cf(e,t)}compute(e,t,i){return i}}class wf{constructor(e,t){this.newValue=e,this.didChange=t}}function Cf(e,t){if("object"!=typeof e||"object"!=typeof t||!e||!t)return new wf(t,e!==t);if(Array.isArray(e)||Array.isArray(t)){const i=Array.isArray(e)&&Array.isArray(t)&&jo(e,t);return new wf(t,i)}let i=!1;for(const n in t)if(t.hasOwnProperty(n)){const o=Cf(e[n],t[n]);o.didChange&&(e[n]=o.newValue,i=!0)}return new wf(e,i)}class yf{constructor(e){this.schema=void 0,this.id=e,this.name="_never_",this.defaultValue=void 0}applyUpdate(e,t){return Cf(e,t)}validate(e){return this.defaultValue}}class xf{constructor(e,t,i,n){this.id=e,this.name=t,this.defaultValue=i,this.schema=n}applyUpdate(e,t){return Cf(e,t)}validate(e){return void 0===e?this.defaultValue:e}compute(e,t,i){return i}}function Sf(e,t){return void 0===e?t:"false"!==e&&Boolean(e)}class kf extends xf{constructor(e,t,i,n){void 0!==n&&(n.type="boolean",n.default=i),super(e,t,i,n)}validate(e){return Sf(e,this.defaultValue)}}function Df(e,t,i,n){if(void 0===e)return t;let o=parseInt(e,10);return isNaN(o)?t:(o=Math.max(i,o),o=Math.min(n,o),0|o)}class Lf extends xf{constructor(e,t,i,n,o,s){void 0!==s&&(s.type="integer",s.default=i,s.minimum=n,s.maximum=o),super(e,t,i,s),this.minimum=n,this.maximum=o}static clampedInt(e,t,i,n){return Df(e,t,i,n)}validate(e){return Lf.clampedInt(e,this.defaultValue,this.minimum,this.maximum)}}class Nf extends xf{constructor(e,t,i,n,o){void 0!==o&&(o.type="number",o.default=i),super(e,t,i,o),this.validationFn=n}static clamp(e,t,i){return e<t?t:e>i?i:e}static float(e,t){if("number"==typeof e)return e;if(void 0===e)return t;const i=parseFloat(e);return isNaN(i)?t:i}validate(e){return this.validationFn(Nf.float(e,this.defaultValue))}}class Ef extends xf{static string(e,t){return"string"!=typeof e?t:e}constructor(e,t,i,n){void 0!==n&&(n.type="string",n.default=i),super(e,t,i,n)}validate(e){return Ef.string(e,this.defaultValue)}}function If(e,t,i){return"string"!=typeof e||-1===i.indexOf(e)?t:e}class Tf extends xf{constructor(e,t,i,n,o){void 0!==o&&(o.type="string",o.enum=n,o.default=i),super(e,t,i,o),this._allowedValues=n}validate(e){return If(e,this.defaultValue,this._allowedValues)}}class Mf extends bf{constructor(e,t,i,n,o,s,r){void 0!==r&&(r.type="string",r.enum=o,r.default=n),super(e,t,i,r),this._allowedValues=o,this._convert=s}validate(e){return"string"!=typeof e||-1===this._allowedValues.indexOf(e)?this.defaultValue:this._convert(e)}}var Af;!function(e){e[e.Line=1]="Line",e[e.Block=2]="Block",e[e.Underline=3]="Underline",e[e.LineThin=4]="LineThin",e[e.BlockOutline=5]="BlockOutline",e[e.UnderlineThin=6]="UnderlineThin"}(Af||(Af={}));class Of extends bf{constructor(){super(45,"fontLigatures",Of.OFF,{anyOf:[{type:"boolean",description:mf(0,"Enables/Disables font ligatures ('calt' and 'liga' font features). Change this to a string for fine-grained control of the 'font-feature-settings' CSS property.")},{type:"string",description:mf(0,"Explicit 'font-feature-settings' CSS property. A boolean can be passed instead if one only needs to turn on/off ligatures.")}],description:mf(0,"Configures font ligatures or font features. Can be either a boolean to enable/disable ligatures or a string for the value of the CSS 'font-feature-settings' property."),default:!1})}validate(e){return void 0===e?this.defaultValue:"string"==typeof e?"false"===e?Of.OFF:"true"===e?Of.ON:e:Boolean(e)?Of.ON:Of.OFF}}Of.OFF='"liga" off, "calt" off',Of.ON='"liga" on, "calt" on';class Rf extends bf{constructor(){super(47,"fontWeight",Gf.fontWeight,{anyOf:[{type:"number",minimum:Rf.MINIMUM_VALUE,maximum:Rf.MAXIMUM_VALUE,errorMessage:mf(0,'Only "normal" and "bold" keywords or numbers between 1 and 1000 are allowed.')},{type:"string",pattern:"^(normal|bold|1000|[1-9][0-9]{0,2})$"},{enum:Rf.SUGGESTION_VALUES}],default:Gf.fontWeight,description:mf(0,'Controls the font weight. Accepts "normal" and "bold" keywords or numbers between 1 and 1000.')})}validate(e){return"normal"===e||"bold"===e?e:String(Lf.clampedInt(e,Gf.fontWeight,Rf.MINIMUM_VALUE,Rf.MAXIMUM_VALUE))}}Rf.SUGGESTION_VALUES=["normal","bold","100","200","300","400","500","600","700","800","900"],Rf.MINIMUM_VALUE=1,Rf.MAXIMUM_VALUE=1e3;class Pf extends yf{constructor(){super(131)}compute(e,t,i){return Pf.computeLayout(t,{memory:e.memory,outerWidth:e.outerWidth,outerHeight:e.outerHeight,isDominatedByLongLines:e.isDominatedByLongLines,lineHeight:e.fontInfo.lineHeight,viewLineCount:e.viewLineCount,lineNumbersDigitCount:e.lineNumbersDigitCount,typicalHalfwidthCharacterWidth:e.fontInfo.typicalHalfwidthCharacterWidth,maxDigitWidth:e.fontInfo.maxDigitWidth,pixelRatio:e.pixelRatio})}static computeContainedMinimapLineCount(e){const t=e.height/e.lineHeight,i=e.scrollBeyondLastLine?t-1:0,n=(e.viewLineCount+i)/(e.pixelRatio*e.height);return{typicalViewportLineCount:t,extraLinesBeyondLastLine:i,desiredRatio:n,minimapLineCount:Math.floor(e.viewLineCount/n)}}static _computeMinimapLayout(e,t){const i=e.outerWidth,n=e.outerHeight,o=e.pixelRatio;if(!e.minimap.enabled)return{renderMinimap:0,minimapLeft:0,minimapWidth:0,minimapHeightIsEditorHeight:!1,minimapIsSampling:!1,minimapScale:1,minimapLineHeight:1,minimapCanvasInnerWidth:0,minimapCanvasInnerHeight:Math.floor(o*n),minimapCanvasOuterWidth:0,minimapCanvasOuterHeight:n};const s=t.stableMinimapLayoutInput,r=s&&e.outerHeight===s.outerHeight&&e.lineHeight===s.lineHeight&&e.typicalHalfwidthCharacterWidth===s.typicalHalfwidthCharacterWidth&&e.pixelRatio===s.pixelRatio&&e.scrollBeyondLastLine===s.scrollBeyondLastLine&&e.minimap.enabled===s.minimap.enabled&&e.minimap.side===s.minimap.side&&e.minimap.size===s.minimap.size&&e.minimap.showSlider===s.minimap.showSlider&&e.minimap.renderCharacters===s.minimap.renderCharacters&&e.minimap.maxColumn===s.minimap.maxColumn&&e.minimap.scale===s.minimap.scale&&e.verticalScrollbarWidth===s.verticalScrollbarWidth&&e.isViewportWrapping===s.isViewportWrapping,a=e.lineHeight,l=e.typicalHalfwidthCharacterWidth,d=e.scrollBeyondLastLine,c=e.minimap.renderCharacters;let h=o>=2?Math.round(2*e.minimap.scale):e.minimap.scale;const u=e.minimap.maxColumn,g=e.minimap.size,p=e.minimap.side,m=e.verticalScrollbarWidth,f=e.viewLineCount,_=e.remainingWidth,v=e.isViewportWrapping,b=c?2:3;let w=Math.floor(o*n);const C=w/o;let y=!1,x=!1,S=b*h,k=h/o,D=1;if("fill"===g||"fit"===g){const{typicalViewportLineCount:i,extraLinesBeyondLastLine:s,desiredRatio:l,minimapLineCount:c}=Pf.computeContainedMinimapLineCount({viewLineCount:f,scrollBeyondLastLine:d,height:n,lineHeight:a,pixelRatio:o});if(f/c>1)y=!0,x=!0,h=1,S=1,k=h/o;else{let n=!1,d=h+1;if("fit"===g){const e=Math.ceil((f+s)*S);v&&r&&_<=t.stableFitRemainingWidth?(n=!0,d=t.stableFitMaxMinimapScale):n=e>w}if("fill"===g||n){y=!0;const n=h;S=Math.min(a*o,Math.max(1,Math.floor(1/l))),v&&r&&_<=t.stableFitRemainingWidth&&(d=t.stableFitMaxMinimapScale),h=Math.min(d,Math.max(1,Math.floor(S/b))),h>n&&(D=Math.min(2,h/n)),k=h/o/D,w=Math.ceil(Math.max(i,f+s)*S),v?(t.stableMinimapLayoutInput=e,t.stableFitRemainingWidth=_,t.stableFitMaxMinimapScale=h):(t.stableMinimapLayoutInput=null,t.stableFitRemainingWidth=0)}}}const L=Math.floor(u*k),N=Math.min(L,Math.max(0,Math.floor((_-m-2)*k/(l+k)))+8);let E=Math.floor(o*N);const I=E/o;E=Math.floor(E*D);return{renderMinimap:c?1:2,minimapLeft:"left"===p?0:i-N-m,minimapWidth:N,minimapHeightIsEditorHeight:y,minimapIsSampling:x,minimapScale:h,minimapLineHeight:S,minimapCanvasInnerWidth:E,minimapCanvasInnerHeight:w,minimapCanvasOuterWidth:I,minimapCanvasOuterHeight:C}}static computeLayout(e,t){const i=0|t.outerWidth,n=0|t.outerHeight,o=0|t.lineHeight,s=0|t.lineNumbersDigitCount,r=t.typicalHalfwidthCharacterWidth,a=t.maxDigitWidth,l=t.pixelRatio,d=t.viewLineCount,c=e.get(123),h="inherit"===c?e.get(122):c,u="inherit"===h?e.get(118):h,g=e.get(121),p=e.get(2),m=t.isDominatedByLongLines,f=e.get(50),_=0!==e.get(60).renderType,v=e.get(61),b=e.get(94),w=e.get(65),C=e.get(92),y=C.verticalScrollbarSize,x=C.verticalHasArrows,S=C.arrowSize,k=C.horizontalScrollbarSize,D=e.get(58),L=e.get(37);let N;if("string"==typeof D&&/^\d+(\.\d+)?ch$/.test(D)){const e=parseFloat(D.substr(0,D.length-2));N=Lf.clampedInt(e*r,0,0,1e3)}else N=Lf.clampedInt(D,0,0,1e3);L&&(N+=16);let E=0;if(_){const e=Math.max(s,v);E=Math.round(e*a)}let I=0;f&&(I=o);let T=0,M=T+I,A=M+E,O=A+N;const R=i-I-E-N;let P=!1,F=!1,B=-1;2!==p&&("inherit"===h&&m?(P=!0,F=!0):"on"===u||"bounded"===u?F=!0:"wordWrapColumn"===u&&(B=g));const V=Pf._computeMinimapLayout({outerWidth:i,outerHeight:n,lineHeight:o,typicalHalfwidthCharacterWidth:r,pixelRatio:l,scrollBeyondLastLine:b,minimap:w,verticalScrollbarWidth:y,viewLineCount:d,remainingWidth:R,isViewportWrapping:F},t.memory||new vf);0!==V.renderMinimap&&0===V.minimapLeft&&(T+=V.minimapWidth,M+=V.minimapWidth,A+=V.minimapWidth,O+=V.minimapWidth);const W=R-V.minimapWidth,z=Math.max(1,Math.floor((W-y-2)/r)),H=x?S:0;return F&&(B=Math.max(1,z),"bounded"===u&&(B=Math.min(B,g))),{width:i,height:n,glyphMarginLeft:T,glyphMarginWidth:I,lineNumbersLeft:M,lineNumbersWidth:E,decorationsLeft:A,decorationsWidth:N,contentLeft:O,contentWidth:W,minimap:V,viewportColumn:z,isWordWrapMinified:P,isViewportWrapping:F,wrappingColumn:B,verticalScrollbarWidth:y,horizontalScrollbarHeight:k,overviewRuler:{top:H,width:y,height:n-2*H,right:0}}}}function Ff(e){const t=e.get(87);return"editable"===t?e.get(81):"on"!==t}function Bf(e,t){if("string"!=typeof e)return t;switch(e){case"hidden":return 2;case"visible":return 3;default:return 1}}const Vf="inUntrustedWorkspace",Wf="editor.unicodeHighlight.allowedCharacters",zf="editor.unicodeHighlight.invisibleCharacters",Hf="editor.unicodeHighlight.nonBasicASCII",jf="editor.unicodeHighlight.ambiguousCharacters",Uf="editor.unicodeHighlight.includeComments",$f="editor.unicodeHighlight.includeStrings",Kf="editor.unicodeHighlight.allowedLocales";function qf(e,t,i){const n=i.indexOf(e);return-1===n?t:i[n]}const Gf={fontFamily:zo?"Menlo, Monaco, 'Courier New', monospace":Vo?"'Droid Sans Mono', 'monospace', monospace":"Consolas, 'Courier New', monospace",fontWeight:"normal",fontSize:zo?12:14,lineHeight:0,letterSpacing:0},Zf=[];function Yf(e){return Zf[e.id]=e,e}const Xf={acceptSuggestionOnCommitCharacter:Yf(new kf(0,"acceptSuggestionOnCommitCharacter",!0,{markdownDescription:mf(0,"Controls whether suggestions should be accepted on commit characters. For example, in JavaScript, the semi-colon (`;`) can be a commit character that accepts a suggestion and types that character.")})),acceptSuggestionOnEnter:Yf(new Tf(1,"acceptSuggestionOnEnter","on",["on","smart","off"],{markdownEnumDescriptions:["",mf(0,"Only accept a suggestion with `Enter` when it makes a textual change."),""],markdownDescription:mf(0,"Controls whether suggestions should be accepted on `Enter`, in addition to `Tab`. Helps to avoid ambiguity between inserting new lines or accepting suggestions.")})),accessibilitySupport:Yf(new class extends bf{constructor(){super(2,"accessibilitySupport",0,{type:"string",enum:["auto","on","off"],enumDescriptions:[mf(0,"The editor will use platform APIs to detect when a Screen Reader is attached."),mf(0,"The editor will be permanently optimized for usage with a Screen Reader. Word wrapping will be disabled."),mf(0,"The editor will never be optimized for usage with a Screen Reader.")],default:"auto",description:mf(0,"Controls whether the editor should run in a mode where it is optimized for screen readers. Setting to on will disable word wrapping.")})}validate(e){switch(e){case"auto":return 0;case"off":return 1;case"on":return 2}return this.defaultValue}compute(e,t,i){return 0===i?e.accessibilitySupport:i}}),accessibilityPageSize:Yf(new Lf(3,"accessibilityPageSize",10,1,1073741824,{description:mf(0,"Controls the number of lines in the editor that can be read out by a screen reader at once. When we detect a screen reader we automatically set the default to be 500. Warning: this has a performance implication for numbers larger than the default.")})),ariaLabel:Yf(new Ef(4,"ariaLabel",mf(0,"Editor content"))),autoClosingBrackets:Yf(new Tf(5,"autoClosingBrackets","languageDefined",["always","languageDefined","beforeWhitespace","never"],{enumDescriptions:["",mf(0,"Use language configurations to determine when to autoclose brackets."),mf(0,"Autoclose brackets only when the cursor is to the left of whitespace."),""],description:mf(0,"Controls whether the editor should automatically close brackets after the user adds an opening bracket.")})),autoClosingDelete:Yf(new Tf(6,"autoClosingDelete","auto",["always","auto","never"],{enumDescriptions:["",mf(0,"Remove adjacent closing quotes or brackets only if they were automatically inserted."),""],description:mf(0,"Controls whether the editor should remove adjacent closing quotes or brackets when deleting.")})),autoClosingOvertype:Yf(new Tf(7,"autoClosingOvertype","auto",["always","auto","never"],{enumDescriptions:["",mf(0,"Type over closing quotes or brackets only if they were automatically inserted."),""],description:mf(0,"Controls whether the editor should type over closing quotes or brackets.")})),autoClosingQuotes:Yf(new Tf(8,"autoClosingQuotes","languageDefined",["always","languageDefined","beforeWhitespace","never"],{enumDescriptions:["",mf(0,"Use language configurations to determine when to autoclose quotes."),mf(0,"Autoclose quotes only when the cursor is to the left of whitespace."),""],description:mf(0,"Controls whether the editor should automatically close quotes after the user adds an opening quote.")})),autoIndent:Yf(new Mf(9,"autoIndent",4,"full",["none","keep","brackets","advanced","full"],(function(e){switch(e){case"none":return 0;case"keep":return 1;case"brackets":return 2;case"advanced":return 3;case"full":return 4}}),{enumDescriptions:[mf(0,"The editor will not insert indentation automatically."),mf(0,"The editor will keep the current line's indentation."),mf(0,"The editor will keep the current line's indentation and honor language defined brackets."),mf(0,"The editor will keep the current line's indentation, honor language defined brackets and invoke special onEnterRules defined by languages."),mf(0,"The editor will keep the current line's indentation, honor language defined brackets, invoke special onEnterRules defined by languages, and honor indentationRules defined by languages.")],description:mf(0,"Controls whether the editor should automatically adjust the indentation when users type, paste, move or indent lines.")})),automaticLayout:Yf(new kf(10,"automaticLayout",!1)),autoSurround:Yf(new Tf(11,"autoSurround","languageDefined",["languageDefined","quotes","brackets","never"],{enumDescriptions:[mf(0,"Use language configurations to determine when to automatically surround selections."),mf(0,"Surround with quotes but not brackets."),mf(0,"Surround with brackets but not quotes."),""],description:mf(0,"Controls whether the editor should automatically surround selections when typing quotes or brackets.")})),bracketPairColorization:Yf(new class extends bf{constructor(){const e={enabled:ff.bracketPairColorizationOptions.enabled};super(12,"bracketPairColorization",e,{"editor.bracketPairColorization.enabled":{type:"boolean",default:e.enabled,description:mf(0,"Controls whether bracket pair colorization is enabled or not. Use 'workbench.colorCustomizations' to override the bracket highlight colors.")}})}validate(e){if(!e||"object"!=typeof e)return this.defaultValue;return{enabled:Sf(e.enabled,this.defaultValue.enabled)}}}),bracketPairGuides:Yf(new class extends bf{constructor(){const e={bracketPairs:!1,bracketPairsHorizontal:"active",highlightActiveBracketPair:!0,indentation:!0,highlightActiveIndentation:!0};super(13,"guides",e,{"editor.guides.bracketPairs":{type:["boolean","string"],enum:[!0,"active",!1],enumDescriptions:[mf(0,"Enables bracket pair guides."),mf(0,"Enables bracket pair guides only for the active bracket pair."),mf(0,"Disables bracket pair guides.")],default:e.bracketPairs,description:mf(0,"Controls whether bracket pair guides are enabled or not.")},"editor.guides.bracketPairsHorizontal":{type:["boolean","string"],enum:[!0,"active",!1],enumDescriptions:[mf(0,"Enables horizontal guides as addition to vertical bracket pair guides."),mf(0,"Enables horizontal guides only for the active bracket pair."),mf(0,"Disables horizontal bracket pair guides.")],default:e.bracketPairsHorizontal,description:mf(0,"Controls whether horizontal bracket pair guides are enabled or not.")},"editor.guides.highlightActiveBracketPair":{type:"boolean",default:e.highlightActiveBracketPair,description:mf(0,"Controls whether the editor should highlight the active bracket pair.")},"editor.guides.indentation":{type:"boolean",default:e.indentation,description:mf(0,"Controls whether the editor should render indent guides.")},"editor.guides.highlightActiveIndentation":{type:"boolean",default:e.highlightActiveIndentation,description:mf(0,"Controls whether the editor should highlight the active indent guide.")}})}validate(e){if(!e||"object"!=typeof e)return this.defaultValue;const t=e;return{bracketPairs:qf(t.bracketPairs,this.defaultValue.bracketPairs,[!0,!1,"active"]),bracketPairsHorizontal:qf(t.bracketPairsHorizontal,this.defaultValue.bracketPairsHorizontal,[!0,!1,"active"]),highlightActiveBracketPair:Sf(t.highlightActiveBracketPair,this.defaultValue.highlightActiveBracketPair),indentation:Sf(t.indentation,this.defaultValue.indentation),highlightActiveIndentation:Sf(t.highlightActiveIndentation,this.defaultValue.highlightActiveIndentation)}}}),stickyTabStops:Yf(new kf(104,"stickyTabStops",!1,{description:mf(0,"Emulate selection behavior of tab characters when using spaces for indentation. Selection will stick to tab stops.")})),codeLens:Yf(new kf(14,"codeLens",!0,{description:mf(0,"Controls whether the editor shows CodeLens.")})),codeLensFontFamily:Yf(new Ef(15,"codeLensFontFamily","",{description:mf(0,"Controls the font family for CodeLens.")})),codeLensFontSize:Yf(new Lf(16,"codeLensFontSize",0,0,100,{type:"number",default:0,minimum:0,maximum:100,markdownDescription:mf(0,"Controls the font size in pixels for CodeLens. When set to `0`, 90% of `#editor.fontSize#` is used.")})),colorDecorators:Yf(new kf(17,"colorDecorators",!0,{description:mf(0,"Controls whether the editor should render the inline color decorators and color picker.")})),columnSelection:Yf(new kf(18,"columnSelection",!1,{description:mf(0,"Enable that the selection with the mouse and keys is doing column selection.")})),comments:Yf(new class extends bf{constructor(){const e={insertSpace:!0,ignoreEmptyLines:!0};super(19,"comments",e,{"editor.comments.insertSpace":{type:"boolean",default:e.insertSpace,description:mf(0,"Controls whether a space character is inserted when commenting.")},"editor.comments.ignoreEmptyLines":{type:"boolean",default:e.ignoreEmptyLines,description:mf(0,"Controls if empty lines should be ignored with toggle, add or remove actions for line comments.")}})}validate(e){if(!e||"object"!=typeof e)return this.defaultValue;const t=e;return{insertSpace:Sf(t.insertSpace,this.defaultValue.insertSpace),ignoreEmptyLines:Sf(t.ignoreEmptyLines,this.defaultValue.ignoreEmptyLines)}}}),contextmenu:Yf(new kf(20,"contextmenu",!0)),copyWithSyntaxHighlighting:Yf(new kf(21,"copyWithSyntaxHighlighting",!0,{description:mf(0,"Controls whether syntax highlighting should be copied into the clipboard.")})),cursorBlinking:Yf(new Mf(22,"cursorBlinking",1,"blink",["blink","smooth","phase","expand","solid"],(function(e){switch(e){case"blink":return 1;case"smooth":return 2;case"phase":return 3;case"expand":return 4;case"solid":return 5}}),{description:mf(0,"Control the cursor animation style.")})),cursorSmoothCaretAnimation:Yf(new kf(23,"cursorSmoothCaretAnimation",!1,{description:mf(0,"Controls whether the smooth caret animation should be enabled.")})),cursorStyle:Yf(new Mf(24,"cursorStyle",Af.Line,"line",["line","block","underline","line-thin","block-outline","underline-thin"],(function(e){switch(e){case"line":return Af.Line;case"block":return Af.Block;case"underline":return Af.Underline;case"line-thin":return Af.LineThin;case"block-outline":return Af.BlockOutline;case"underline-thin":return Af.UnderlineThin}}),{description:mf(0,"Controls the cursor style.")})),cursorSurroundingLines:Yf(new Lf(25,"cursorSurroundingLines",0,0,1073741824,{description:mf(0,"Controls the minimal number of visible leading and trailing lines surrounding the cursor. Known as 'scrollOff' or 'scrollOffset' in some other editors.")})),cursorSurroundingLinesStyle:Yf(new Tf(26,"cursorSurroundingLinesStyle","default",["default","all"],{enumDescriptions:[mf(0,"`cursorSurroundingLines` is enforced only when triggered via the keyboard or API."),mf(0,"`cursorSurroundingLines` is enforced always.")],description:mf(0,"Controls when `cursorSurroundingLines` should be enforced.")})),cursorWidth:Yf(new Lf(27,"cursorWidth",0,0,1073741824,{markdownDescription:mf(0,"Controls the width of the cursor when `#editor.cursorStyle#` is set to `line`.")})),disableLayerHinting:Yf(new kf(28,"disableLayerHinting",!1)),disableMonospaceOptimizations:Yf(new kf(29,"disableMonospaceOptimizations",!1)),domReadOnly:Yf(new kf(30,"domReadOnly",!1)),dragAndDrop:Yf(new kf(31,"dragAndDrop",!0,{description:mf(0,"Controls whether the editor should allow moving selections via drag and drop.")})),emptySelectionClipboard:Yf(new class extends kf{constructor(){super(32,"emptySelectionClipboard",!0,{description:mf(0,"Controls whether copying without a selection copies the current line.")})}compute(e,t,i){return i&&e.emptySelectionClipboard}}),extraEditorClassName:Yf(new Ef(33,"extraEditorClassName","")),fastScrollSensitivity:Yf(new Nf(34,"fastScrollSensitivity",5,(e=>e<=0?5:e),{markdownDescription:mf(0,"Scrolling speed multiplier when pressing `Alt`.")})),find:Yf(new class extends bf{constructor(){const e={cursorMoveOnType:!0,seedSearchStringFromSelection:"always",autoFindInSelection:"never",globalFindClipboard:!1,addExtraSpaceOnTop:!0,loop:!0};super(35,"find",e,{"editor.find.cursorMoveOnType":{type:"boolean",default:e.cursorMoveOnType,description:mf(0,"Controls whether the cursor should jump to find matches while typing.")},"editor.find.seedSearchStringFromSelection":{type:"string",enum:["never","always","selection"],default:e.seedSearchStringFromSelection,enumDescriptions:[mf(0,"Never seed search string from the editor selection."),mf(0,"Always seed search string from the editor selection, including word at cursor position."),mf(0,"Only seed search string from the editor selection.")],description:mf(0,"Controls whether the search string in the Find Widget is seeded from the editor selection.")},"editor.find.autoFindInSelection":{type:"string",enum:["never","always","multiline"],default:e.autoFindInSelection,enumDescriptions:[mf(0,"Never turn on Find in Selection automatically (default)."),mf(0,"Always turn on Find in Selection automatically."),mf(0,"Turn on Find in Selection automatically when multiple lines of content are selected.")],description:mf(0,"Controls the condition for turning on Find in Selection automatically.")},"editor.find.globalFindClipboard":{type:"boolean",default:e.globalFindClipboard,description:mf(0,"Controls whether the Find Widget should read or modify the shared find clipboard on macOS."),included:zo},"editor.find.addExtraSpaceOnTop":{type:"boolean",default:e.addExtraSpaceOnTop,description:mf(0,"Controls whether the Find Widget should add extra lines on top of the editor. When true, you can scroll beyond the first line when the Find Widget is visible.")},"editor.find.loop":{type:"boolean",default:e.loop,description:mf(0,"Controls whether the search automatically restarts from the beginning (or the end) when no further matches can be found.")}})}validate(e){if(!e||"object"!=typeof e)return this.defaultValue;const t=e;return{cursorMoveOnType:Sf(t.cursorMoveOnType,this.defaultValue.cursorMoveOnType),seedSearchStringFromSelection:"boolean"==typeof e.seedSearchStringFromSelection?e.seedSearchStringFromSelection?"always":"never":If(t.seedSearchStringFromSelection,this.defaultValue.seedSearchStringFromSelection,["never","always","selection"]),autoFindInSelection:"boolean"==typeof e.autoFindInSelection?e.autoFindInSelection?"always":"never":If(t.autoFindInSelection,this.defaultValue.autoFindInSelection,["never","always","multiline"]),globalFindClipboard:Sf(t.globalFindClipboard,this.defaultValue.globalFindClipboard),addExtraSpaceOnTop:Sf(t.addExtraSpaceOnTop,this.defaultValue.addExtraSpaceOnTop),loop:Sf(t.loop,this.defaultValue.loop)}}}),fixedOverflowWidgets:Yf(new kf(36,"fixedOverflowWidgets",!1)),folding:Yf(new kf(37,"folding",!0,{description:mf(0,"Controls whether the editor has code folding enabled.")})),foldingStrategy:Yf(new Tf(38,"foldingStrategy","auto",["auto","indentation"],{enumDescriptions:[mf(0,"Use a language-specific folding strategy if available, else the indentation-based one."),mf(0,"Use the indentation-based folding strategy.")],description:mf(0,"Controls the strategy for computing folding ranges.")})),foldingHighlight:Yf(new kf(39,"foldingHighlight",!0,{description:mf(0,"Controls whether the editor should highlight folded ranges.")})),foldingImportsByDefault:Yf(new kf(40,"foldingImportsByDefault",!1,{description:mf(0,"Controls whether the editor automatically collapses import ranges.")})),foldingMaximumRegions:Yf(new Lf(41,"foldingMaximumRegions",5e3,10,65e3,{description:mf(0,"The maximum number of foldable regions. Increasing this value may result in the editor becoming less responsive when the current source has a large number of foldable regions.")})),unfoldOnClickAfterEndOfLine:Yf(new kf(42,"unfoldOnClickAfterEndOfLine",!1,{description:mf(0,"Controls whether clicking on the empty content after a folded line will unfold the line.")})),fontFamily:Yf(new Ef(43,"fontFamily",Gf.fontFamily,{description:mf(0,"Controls the font family.")})),fontInfo:Yf(new class extends yf{constructor(){super(44)}compute(e,t,i){return e.fontInfo}}),fontLigatures2:Yf(new Of),fontSize:Yf(new class extends xf{constructor(){super(46,"fontSize",Gf.fontSize,{type:"number",minimum:6,maximum:100,default:Gf.fontSize,description:mf(0,"Controls the font size in pixels.")})}validate(e){const t=Nf.float(e,this.defaultValue);return 0===t?Gf.fontSize:Nf.clamp(t,6,100)}compute(e,t,i){return e.fontInfo.fontSize}}),fontWeight:Yf(new Rf),formatOnPaste:Yf(new kf(48,"formatOnPaste",!1,{description:mf(0,"Controls whether the editor should automatically format the pasted content. A formatter must be available and the formatter should be able to format a range in a document.")})),formatOnType:Yf(new kf(49,"formatOnType",!1,{description:mf(0,"Controls whether the editor should automatically format the line after typing.")})),glyphMargin:Yf(new kf(50,"glyphMargin",!0,{description:mf(0,"Controls whether the editor should render the vertical glyph margin. Glyph margin is mostly used for debugging.")})),gotoLocation:Yf(new class extends bf{constructor(){const e={multiple:"peek",multipleDefinitions:"peek",multipleTypeDefinitions:"peek",multipleDeclarations:"peek",multipleImplementations:"peek",multipleReferences:"peek",alternativeDefinitionCommand:"editor.action.goToReferences",alternativeTypeDefinitionCommand:"editor.action.goToReferences",alternativeDeclarationCommand:"editor.action.goToReferences",alternativeImplementationCommand:"",alternativeReferenceCommand:""},t={type:"string",enum:["peek","gotoAndPeek","goto"],default:e.multiple,enumDescriptions:[mf(0,"Show peek view of the results (default)"),mf(0,"Go to the primary result and show a peek view"),mf(0,"Go to the primary result and enable peek-less navigation to others")]},i=["","editor.action.referenceSearch.trigger","editor.action.goToReferences","editor.action.peekImplementation","editor.action.goToImplementation","editor.action.peekTypeDefinition","editor.action.goToTypeDefinition","editor.action.peekDeclaration","editor.action.revealDeclaration","editor.action.peekDefinition","editor.action.revealDefinitionAside","editor.action.revealDefinition"];super(51,"gotoLocation",e,{"editor.gotoLocation.multiple":{deprecationMessage:mf(0,"This setting is deprecated, please use separate settings like 'editor.editor.gotoLocation.multipleDefinitions' or 'editor.editor.gotoLocation.multipleImplementations' instead.")},"editor.gotoLocation.multipleDefinitions":Object.assign({description:mf(0,"Controls the behavior the 'Go to Definition'-command when multiple target locations exist.")},t),"editor.gotoLocation.multipleTypeDefinitions":Object.assign({description:mf(0,"Controls the behavior the 'Go to Type Definition'-command when multiple target locations exist.")},t),"editor.gotoLocation.multipleDeclarations":Object.assign({description:mf(0,"Controls the behavior the 'Go to Declaration'-command when multiple target locations exist.")},t),"editor.gotoLocation.multipleImplementations":Object.assign({description:mf(0,"Controls the behavior the 'Go to Implementations'-command when multiple target locations exist.")},t),"editor.gotoLocation.multipleReferences":Object.assign({description:mf(0,"Controls the behavior the 'Go to References'-command when multiple target locations exist.")},t),"editor.gotoLocation.alternativeDefinitionCommand":{type:"string",default:e.alternativeDefinitionCommand,enum:i,description:mf(0,"Alternative command id that is being executed when the result of 'Go to Definition' is the current location.")},"editor.gotoLocation.alternativeTypeDefinitionCommand":{type:"string",default:e.alternativeTypeDefinitionCommand,enum:i,description:mf(0,"Alternative command id that is being executed when the result of 'Go to Type Definition' is the current location.")},"editor.gotoLocation.alternativeDeclarationCommand":{type:"string",default:e.alternativeDeclarationCommand,enum:i,description:mf(0,"Alternative command id that is being executed when the result of 'Go to Declaration' is the current location.")},"editor.gotoLocation.alternativeImplementationCommand":{type:"string",default:e.alternativeImplementationCommand,enum:i,description:mf(0,"Alternative command id that is being executed when the result of 'Go to Implementation' is the current location.")},"editor.gotoLocation.alternativeReferenceCommand":{type:"string",default:e.alternativeReferenceCommand,enum:i,description:mf(0,"Alternative command id that is being executed when the result of 'Go to Reference' is the current location.")}})}validate(e){var t,i,n,o,s;if(!e||"object"!=typeof e)return this.defaultValue;const r=e;return{multiple:If(r.multiple,this.defaultValue.multiple,["peek","gotoAndPeek","goto"]),multipleDefinitions:null!==(t=r.multipleDefinitions)&&void 0!==t?t:If(r.multipleDefinitions,"peek",["peek","gotoAndPeek","goto"]),multipleTypeDefinitions:null!==(i=r.multipleTypeDefinitions)&&void 0!==i?i:If(r.multipleTypeDefinitions,"peek",["peek","gotoAndPeek","goto"]),multipleDeclarations:null!==(n=r.multipleDeclarations)&&void 0!==n?n:If(r.multipleDeclarations,"peek",["peek","gotoAndPeek","goto"]),multipleImplementations:null!==(o=r.multipleImplementations)&&void 0!==o?o:If(r.multipleImplementations,"peek",["peek","gotoAndPeek","goto"]),multipleReferences:null!==(s=r.multipleReferences)&&void 0!==s?s:If(r.multipleReferences,"peek",["peek","gotoAndPeek","goto"]),alternativeDefinitionCommand:Ef.string(r.alternativeDefinitionCommand,this.defaultValue.alternativeDefinitionCommand),alternativeTypeDefinitionCommand:Ef.string(r.alternativeTypeDefinitionCommand,this.defaultValue.alternativeTypeDefinitionCommand),alternativeDeclarationCommand:Ef.string(r.alternativeDeclarationCommand,this.defaultValue.alternativeDeclarationCommand),alternativeImplementationCommand:Ef.string(r.alternativeImplementationCommand,this.defaultValue.alternativeImplementationCommand),alternativeReferenceCommand:Ef.string(r.alternativeReferenceCommand,this.defaultValue.alternativeReferenceCommand)}}}),hideCursorInOverviewRuler:Yf(new kf(52,"hideCursorInOverviewRuler",!1,{description:mf(0,"Controls whether the cursor should be hidden in the overview ruler.")})),hover:Yf(new class extends bf{constructor(){const e={enabled:!0,delay:300,sticky:!0,above:!0};super(53,"hover",e,{"editor.hover.enabled":{type:"boolean",default:e.enabled,description:mf(0,"Controls whether the hover is shown.")},"editor.hover.delay":{type:"number",default:e.delay,minimum:0,maximum:1e4,description:mf(0,"Controls the delay in milliseconds after which the hover is shown.")},"editor.hover.sticky":{type:"boolean",default:e.sticky,description:mf(0,"Controls whether the hover should remain visible when mouse is moved over it.")},"editor.hover.above":{type:"boolean",default:e.above,description:mf(0,"Prefer showing hovers above the line, if there's space.")}})}validate(e){if(!e||"object"!=typeof e)return this.defaultValue;const t=e;return{enabled:Sf(t.enabled,this.defaultValue.enabled),delay:Lf.clampedInt(t.delay,this.defaultValue.delay,0,1e4),sticky:Sf(t.sticky,this.defaultValue.sticky),above:Sf(t.above,this.defaultValue.above)}}}),inDiffEditor:Yf(new kf(54,"inDiffEditor",!1)),letterSpacing:Yf(new Nf(56,"letterSpacing",Gf.letterSpacing,(e=>Nf.clamp(e,-5,20)),{description:mf(0,"Controls the letter spacing in pixels.")})),lightbulb:Yf(new class extends bf{constructor(){const e={enabled:!0};super(57,"lightbulb",e,{"editor.lightbulb.enabled":{type:"boolean",default:e.enabled,description:mf(0,"Enables the code action lightbulb in the editor.")}})}validate(e){if(!e||"object"!=typeof e)return this.defaultValue;return{enabled:Sf(e.enabled,this.defaultValue.enabled)}}}),lineDecorationsWidth:Yf(new xf(58,"lineDecorationsWidth",10)),lineHeight:Yf(new class extends Nf{constructor(){super(59,"lineHeight",Gf.lineHeight,(e=>Nf.clamp(e,0,150)),{markdownDescription:mf(0,"Controls the line height. \n - Use 0 to automatically compute the line height from the font size.\n - Values between 0 and 8 will be used as a multiplier with the font size.\n - Values greater than or equal to 8 will be used as effective values.")})}compute(e,t,i){return e.fontInfo.lineHeight}}),lineNumbers:Yf(new class extends bf{constructor(){super(60,"lineNumbers",{renderType:1,renderFn:null},{type:"string",enum:["off","on","relative","interval"],enumDescriptions:[mf(0,"Line numbers are not rendered."),mf(0,"Line numbers are rendered as absolute number."),mf(0,"Line numbers are rendered as distance in lines to cursor position."),mf(0,"Line numbers are rendered every 10 lines.")],default:"on",description:mf(0,"Controls the display of line numbers.")})}validate(e){let t=this.defaultValue.renderType,i=this.defaultValue.renderFn;return void 0!==e&&("function"==typeof e?(t=4,i=e):t="interval"===e?3:"relative"===e?2:"on"===e?1:0),{renderType:t,renderFn:i}}}),lineNumbersMinChars:Yf(new Lf(61,"lineNumbersMinChars",5,1,300)),linkedEditing:Yf(new kf(62,"linkedEditing",!1,{description:mf(0,"Controls whether the editor has linked editing enabled. Depending on the language, related symbols, e.g. HTML tags, are updated while editing.")})),links:Yf(new kf(63,"links",!0,{description:mf(0,"Controls whether the editor should detect links and make them clickable.")})),matchBrackets:Yf(new Tf(64,"matchBrackets","always",["always","near","never"],{description:mf(0,"Highlight matching brackets.")})),minimap:Yf(new class extends bf{constructor(){const e={enabled:!0,size:"proportional",side:"right",showSlider:"mouseover",renderCharacters:!0,maxColumn:120,scale:1};super(65,"minimap",e,{"editor.minimap.enabled":{type:"boolean",default:e.enabled,description:mf(0,"Controls whether the minimap is shown.")},"editor.minimap.size":{type:"string",enum:["proportional","fill","fit"],enumDescriptions:[mf(0,"The minimap has the same size as the editor contents (and might scroll)."),mf(0,"The minimap will stretch or shrink as necessary to fill the height of the editor (no scrolling)."),mf(0,"The minimap will shrink as necessary to never be larger than the editor (no scrolling).")],default:e.size,description:mf(0,"Controls the size of the minimap.")},"editor.minimap.side":{type:"string",enum:["left","right"],default:e.side,description:mf(0,"Controls the side where to render the minimap.")},"editor.minimap.showSlider":{type:"string",enum:["always","mouseover"],default:e.showSlider,description:mf(0,"Controls when the minimap slider is shown.")},"editor.minimap.scale":{type:"number",default:e.scale,minimum:1,maximum:3,enum:[1,2,3],description:mf(0,"Scale of content drawn in the minimap: 1, 2 or 3.")},"editor.minimap.renderCharacters":{type:"boolean",default:e.renderCharacters,description:mf(0,"Render the actual characters on a line as opposed to color blocks.")},"editor.minimap.maxColumn":{type:"number",default:e.maxColumn,description:mf(0,"Limit the width of the minimap to render at most a certain number of columns.")}})}validate(e){if(!e||"object"!=typeof e)return this.defaultValue;const t=e;return{enabled:Sf(t.enabled,this.defaultValue.enabled),size:If(t.size,this.defaultValue.size,["proportional","fill","fit"]),side:If(t.side,this.defaultValue.side,["right","left"]),showSlider:If(t.showSlider,this.defaultValue.showSlider,["always","mouseover"]),renderCharacters:Sf(t.renderCharacters,this.defaultValue.renderCharacters),scale:Lf.clampedInt(t.scale,1,1,3),maxColumn:Lf.clampedInt(t.maxColumn,this.defaultValue.maxColumn,1,1e4)}}}),mouseStyle:Yf(new Tf(66,"mouseStyle","text",["text","default","copy"])),mouseWheelScrollSensitivity:Yf(new Nf(67,"mouseWheelScrollSensitivity",1,(e=>0===e?1:e),{markdownDescription:mf(0,"A multiplier to be used on the `deltaX` and `deltaY` of mouse wheel scroll events.")})),mouseWheelZoom:Yf(new kf(68,"mouseWheelZoom",!1,{markdownDescription:mf(0,"Zoom the font of the editor when using mouse wheel and holding `Ctrl`.")})),multiCursorMergeOverlapping:Yf(new kf(69,"multiCursorMergeOverlapping",!0,{description:mf(0,"Merge multiple cursors when they are overlapping.")})),multiCursorModifier:Yf(new Mf(70,"multiCursorModifier","altKey","alt",["ctrlCmd","alt"],(function(e){return"ctrlCmd"===e?zo?"metaKey":"ctrlKey":"altKey"}),{markdownEnumDescriptions:[mf(0,"Maps to `Control` on Windows and Linux and to `Command` on macOS."),mf(0,"Maps to `Alt` on Windows and Linux and to `Option` on macOS.")],markdownDescription:mf(0,"The modifier to be used to add multiple cursors with the mouse. The Go to Definition and Open Link mouse gestures will adapt such that they do not conflict with the multicursor modifier. [Read more](https://code.visualstudio.com/docs/editor/codebasics#_multicursor-modifier).")})),multiCursorPaste:Yf(new Tf(71,"multiCursorPaste","spread",["spread","full"],{markdownEnumDescriptions:[mf(0,"Each cursor pastes a single line of the text."),mf(0,"Each cursor pastes the full text.")],markdownDescription:mf(0,"Controls pasting when the line count of the pasted text matches the cursor count.")})),occurrencesHighlight:Yf(new kf(72,"occurrencesHighlight",!0,{description:mf(0,"Controls whether the editor should highlight semantic symbol occurrences.")})),overviewRulerBorder:Yf(new kf(73,"overviewRulerBorder",!0,{description:mf(0,"Controls whether a border should be drawn around the overview ruler.")})),overviewRulerLanes:Yf(new Lf(74,"overviewRulerLanes",3,0,3)),padding:Yf(new class extends bf{constructor(){super(75,"padding",{top:0,bottom:0},{"editor.padding.top":{type:"number",default:0,minimum:0,maximum:1e3,description:mf(0,"Controls the amount of space between the top edge of the editor and the first line.")},"editor.padding.bottom":{type:"number",default:0,minimum:0,maximum:1e3,description:mf(0,"Controls the amount of space between the bottom edge of the editor and the last line.")}})}validate(e){if(!e||"object"!=typeof e)return this.defaultValue;const t=e;return{top:Lf.clampedInt(t.top,0,0,1e3),bottom:Lf.clampedInt(t.bottom,0,0,1e3)}}}),parameterHints:Yf(new class extends bf{constructor(){const e={enabled:!0,cycle:!1};super(76,"parameterHints",e,{"editor.parameterHints.enabled":{type:"boolean",default:e.enabled,description:mf(0,"Enables a pop-up that shows parameter documentation and type information as you type.")},"editor.parameterHints.cycle":{type:"boolean",default:e.cycle,description:mf(0,"Controls whether the parameter hints menu cycles or closes when reaching the end of the list.")}})}validate(e){if(!e||"object"!=typeof e)return this.defaultValue;const t=e;return{enabled:Sf(t.enabled,this.defaultValue.enabled),cycle:Sf(t.cycle,this.defaultValue.cycle)}}}),peekWidgetDefaultFocus:Yf(new Tf(77,"peekWidgetDefaultFocus","tree",["tree","editor"],{enumDescriptions:[mf(0,"Focus the tree when opening peek"),mf(0,"Focus the editor when opening peek")],description:mf(0,"Controls whether to focus the inline editor or the tree in the peek widget.")})),definitionLinkOpensInPeek:Yf(new kf(78,"definitionLinkOpensInPeek",!1,{description:mf(0,"Controls whether the Go to Definition mouse gesture always opens the peek widget.")})),quickSuggestions:Yf(new class extends bf{constructor(){const e={other:!0,comments:!1,strings:!1};super(79,"quickSuggestions",e,{anyOf:[{type:"boolean"},{type:"object",properties:{strings:{type:"boolean",default:e.strings,description:mf(0,"Enable quick suggestions inside strings.")},comments:{type:"boolean",default:e.comments,description:mf(0,"Enable quick suggestions inside comments.")},other:{type:"boolean",default:e.other,description:mf(0,"Enable quick suggestions outside of strings and comments.")}}}],default:e,description:mf(0,"Controls whether suggestions should automatically show up while typing.")}),this.defaultValue=e}validate(e){if("boolean"==typeof e)return e;if(e&&"object"==typeof e){const t=e,i={other:Sf(t.other,this.defaultValue.other),comments:Sf(t.comments,this.defaultValue.comments),strings:Sf(t.strings,this.defaultValue.strings)};return!!(i.other&&i.comments&&i.strings)||!!(i.other||i.comments||i.strings)&&i}return this.defaultValue}}),quickSuggestionsDelay:Yf(new Lf(80,"quickSuggestionsDelay",10,0,1073741824,{description:mf(0,"Controls the delay in milliseconds after which quick suggestions will show up.")})),readOnly:Yf(new kf(81,"readOnly",!1)),renameOnType:Yf(new kf(82,"renameOnType",!1,{description:mf(0,"Controls whether the editor auto renames on type."),markdownDeprecationMessage:mf(0,"Deprecated, use `editor.linkedEditing` instead.")})),renderControlCharacters:Yf(new kf(83,"renderControlCharacters",!0,{description:mf(0,"Controls whether the editor should render control characters."),restricted:!0})),renderFinalNewline:Yf(new kf(84,"renderFinalNewline",!0,{description:mf(0,"Render last line number when the file ends with a newline.")})),renderLineHighlight:Yf(new Tf(85,"renderLineHighlight","line",["none","gutter","line","all"],{enumDescriptions:["","","",mf(0,"Highlights both the gutter and the current line.")],description:mf(0,"Controls how the editor should render the current line highlight.")})),renderLineHighlightOnlyWhenFocus:Yf(new kf(86,"renderLineHighlightOnlyWhenFocus",!1,{description:mf(0,"Controls if the editor should render the current line highlight only when the editor is focused.")})),renderValidationDecorations:Yf(new Tf(87,"renderValidationDecorations","editable",["editable","on","off"])),renderWhitespace:Yf(new Tf(88,"renderWhitespace","selection",["none","boundary","selection","trailing","all"],{enumDescriptions:["",mf(0,"Render whitespace characters except for single spaces between words."),mf(0,"Render whitespace characters only on selected text."),mf(0,"Render only trailing whitespace characters."),""],description:mf(0,"Controls how the editor should render whitespace characters.")})),revealHorizontalRightPadding:Yf(new Lf(89,"revealHorizontalRightPadding",30,0,1e3)),roundedSelection:Yf(new kf(90,"roundedSelection",!0,{description:mf(0,"Controls whether selections should have rounded corners.")})),rulers:Yf(new class extends bf{constructor(){const e=[],t={type:"number",description:mf(0,"Number of monospace characters at which this editor ruler will render.")};super(91,"rulers",e,{type:"array",items:{anyOf:[t,{type:["object"],properties:{column:t,color:{type:"string",description:mf(0,"Color of this editor ruler."),format:"color-hex"}}}]},default:e,description:mf(0,"Render vertical rulers after a certain number of monospace characters. Use multiple values for multiple rulers. No rulers are drawn if array is empty.")})}validate(e){if(Array.isArray(e)){const t=[];for(let i of e)if("number"==typeof i)t.push({column:Lf.clampedInt(i,0,0,1e4),color:null});else if(i&&"object"==typeof i){const e=i;t.push({column:Lf.clampedInt(e.column,0,0,1e4),color:e.color})}return t.sort(((e,t)=>e.column-t.column)),t}return this.defaultValue}}),scrollbar:Yf(new class extends bf{constructor(){const e={vertical:1,horizontal:1,arrowSize:11,useShadows:!0,verticalHasArrows:!1,horizontalHasArrows:!1,horizontalScrollbarSize:12,horizontalSliderSize:12,verticalScrollbarSize:14,verticalSliderSize:14,handleMouseWheel:!0,alwaysConsumeMouseWheel:!0,scrollByPage:!1};super(92,"scrollbar",e,{"editor.scrollbar.vertical":{type:"string",enum:["auto","visible","hidden"],enumDescriptions:[mf(0,"The vertical scrollbar will be visible only when necessary."),mf(0,"The vertical scrollbar will always be visible."),mf(0,"The vertical scrollbar will always be hidden.")],default:"auto",description:mf(0,"Controls the visibility of the vertical scrollbar.")},"editor.scrollbar.horizontal":{type:"string",enum:["auto","visible","hidden"],enumDescriptions:[mf(0,"The horizontal scrollbar will be visible only when necessary."),mf(0,"The horizontal scrollbar will always be visible."),mf(0,"The horizontal scrollbar will always be hidden.")],default:"auto",description:mf(0,"Controls the visibility of the horizontal scrollbar.")},"editor.scrollbar.verticalScrollbarSize":{type:"number",default:e.verticalScrollbarSize,description:mf(0,"The width of the vertical scrollbar.")},"editor.scrollbar.horizontalScrollbarSize":{type:"number",default:e.horizontalScrollbarSize,description:mf(0,"The height of the horizontal scrollbar.")},"editor.scrollbar.scrollByPage":{type:"boolean",default:e.scrollByPage,description:mf(0,"Controls whether clicks scroll by page or jump to click position.")}})}validate(e){if(!e||"object"!=typeof e)return this.defaultValue;const t=e,i=Lf.clampedInt(t.horizontalScrollbarSize,this.defaultValue.horizontalScrollbarSize,0,1e3),n=Lf.clampedInt(t.verticalScrollbarSize,this.defaultValue.verticalScrollbarSize,0,1e3);return{arrowSize:Lf.clampedInt(t.arrowSize,this.defaultValue.arrowSize,0,1e3),vertical:Bf(t.vertical,this.defaultValue.vertical),horizontal:Bf(t.horizontal,this.defaultValue.horizontal),useShadows:Sf(t.useShadows,this.defaultValue.useShadows),verticalHasArrows:Sf(t.verticalHasArrows,this.defaultValue.verticalHasArrows),horizontalHasArrows:Sf(t.horizontalHasArrows,this.defaultValue.horizontalHasArrows),handleMouseWheel:Sf(t.handleMouseWheel,this.defaultValue.handleMouseWheel),alwaysConsumeMouseWheel:Sf(t.alwaysConsumeMouseWheel,this.defaultValue.alwaysConsumeMouseWheel),horizontalScrollbarSize:i,horizontalSliderSize:Lf.clampedInt(t.horizontalSliderSize,i,0,1e3),verticalScrollbarSize:n,verticalSliderSize:Lf.clampedInt(t.verticalSliderSize,n,0,1e3),scrollByPage:Sf(t.scrollByPage,this.defaultValue.scrollByPage)}}}),scrollBeyondLastColumn:Yf(new Lf(93,"scrollBeyondLastColumn",5,0,1073741824,{description:mf(0,"Controls the number of extra characters beyond which the editor will scroll horizontally.")})),scrollBeyondLastLine:Yf(new kf(94,"scrollBeyondLastLine",!0,{description:mf(0,"Controls whether the editor will scroll beyond the last line.")})),scrollPredominantAxis:Yf(new kf(95,"scrollPredominantAxis",!0,{description:mf(0,"Scroll only along the predominant axis when scrolling both vertically and horizontally at the same time. Prevents horizontal drift when scrolling vertically on a trackpad.")})),selectionClipboard:Yf(new kf(96,"selectionClipboard",!0,{description:mf(0,"Controls whether the Linux primary clipboard should be supported."),included:Vo})),selectionHighlight:Yf(new kf(97,"selectionHighlight",!0,{description:mf(0,"Controls whether the editor should highlight matches similar to the selection.")})),selectOnLineNumbers:Yf(new kf(98,"selectOnLineNumbers",!0)),showFoldingControls:Yf(new Tf(99,"showFoldingControls","mouseover",["always","mouseover"],{enumDescriptions:[mf(0,"Always show the folding controls."),mf(0,"Only show the folding controls when the mouse is over the gutter.")],description:mf(0,"Controls when the folding controls on the gutter are shown.")})),showUnused:Yf(new kf(100,"showUnused",!0,{description:mf(0,"Controls fading out of unused code.")})),showDeprecated:Yf(new kf(126,"showDeprecated",!0,{description:mf(0,"Controls strikethrough deprecated variables.")})),inlayHints:Yf(new class extends bf{constructor(){const e={enabled:!0,fontSize:0,fontFamily:""};super(127,"inlayHints",e,{"editor.inlayHints.enabled":{type:"boolean",default:e.enabled,description:mf(0,"Enables the inlay hints in the editor.")},"editor.inlayHints.fontSize":{type:"number",default:e.fontSize,markdownDescription:mf(0,"Controls font size of inlay hints in the editor. A default of 90% of `#editor.fontSize#` is used when the configured value is less than `5` or greater than the editor font size.")},"editor.inlayHints.fontFamily":{type:"string",default:e.fontFamily,markdownDescription:mf(0,"Controls font family of inlay hints in the editor. When set to empty, the `#editor.fontFamily#` is used.")}})}validate(e){if(!e||"object"!=typeof e)return this.defaultValue;const t=e;return{enabled:Sf(t.enabled,this.defaultValue.enabled),fontSize:Lf.clampedInt(t.fontSize,this.defaultValue.fontSize,0,100),fontFamily:Ef.string(t.fontFamily,this.defaultValue.fontFamily)}}}),snippetSuggestions:Yf(new Tf(101,"snippetSuggestions","inline",["top","bottom","inline","none"],{enumDescriptions:[mf(0,"Show snippet suggestions on top of other suggestions."),mf(0,"Show snippet suggestions below other suggestions."),mf(0,"Show snippets suggestions with other suggestions."),mf(0,"Do not show snippet suggestions.")],description:mf(0,"Controls whether snippets are shown with other suggestions and how they are sorted.")})),smartSelect:Yf(new class extends bf{constructor(){super(102,"smartSelect",{selectLeadingAndTrailingWhitespace:!0},{"editor.smartSelect.selectLeadingAndTrailingWhitespace":{description:mf(0,"Whether leading and trailing whitespace should always be selected."),default:!0,type:"boolean"}})}validate(e){return e&&"object"==typeof e?{selectLeadingAndTrailingWhitespace:Sf(e.selectLeadingAndTrailingWhitespace,this.defaultValue.selectLeadingAndTrailingWhitespace)}:this.defaultValue}}),smoothScrolling:Yf(new kf(103,"smoothScrolling",!1,{description:mf(0,"Controls whether the editor will scroll using an animation.")})),stopRenderingLineAfter:Yf(new Lf(105,"stopRenderingLineAfter",1e4,-1,1073741824)),suggest:Yf(new class extends bf{constructor(){const e={insertMode:"insert",filterGraceful:!0,snippetsPreventQuickSuggestions:!0,localityBonus:!1,shareSuggestSelections:!1,showIcons:!0,showStatusBar:!1,preview:!1,previewMode:"subwordSmart",showInlineDetails:!0,showMethods:!0,showFunctions:!0,showConstructors:!0,showDeprecated:!0,showFields:!0,showVariables:!0,showClasses:!0,showStructs:!0,showInterfaces:!0,showModules:!0,showProperties:!0,showEvents:!0,showOperators:!0,showUnits:!0,showValues:!0,showConstants:!0,showEnums:!0,showEnumMembers:!0,showKeywords:!0,showWords:!0,showColors:!0,showFiles:!0,showReferences:!0,showFolders:!0,showTypeParameters:!0,showSnippets:!0,showUsers:!0,showIssues:!0};super(106,"suggest",e,{"editor.suggest.insertMode":{type:"string",enum:["insert","replace"],enumDescriptions:[mf(0,"Insert suggestion without overwriting text right of the cursor."),mf(0,"Insert suggestion and overwrite text right of the cursor.")],default:e.insertMode,description:mf(0,"Controls whether words are overwritten when accepting completions. Note that this depends on extensions opting into this feature.")},"editor.suggest.filterGraceful":{type:"boolean",default:e.filterGraceful,description:mf(0,"Controls whether filtering and sorting suggestions accounts for small typos.")},"editor.suggest.localityBonus":{type:"boolean",default:e.localityBonus,description:mf(0,"Controls whether sorting favors words that appear close to the cursor.")},"editor.suggest.shareSuggestSelections":{type:"boolean",default:e.shareSuggestSelections,markdownDescription:mf(0,"Controls whether remembered suggestion selections are shared between multiple workspaces and windows (needs `#editor.suggestSelection#`).")},"editor.suggest.snippetsPreventQuickSuggestions":{type:"boolean",default:e.snippetsPreventQuickSuggestions,description:mf(0,"Controls whether an active snippet prevents quick suggestions.")},"editor.suggest.showIcons":{type:"boolean",default:e.showIcons,description:mf(0,"Controls whether to show or hide icons in suggestions.")},"editor.suggest.showStatusBar":{type:"boolean",default:e.showStatusBar,description:mf(0,"Controls the visibility of the status bar at the bottom of the suggest widget.")},"editor.suggest.preview":{type:"boolean",default:e.preview,description:mf(0,"Controls whether to preview the suggestion outcome in the editor.")},"editor.suggest.showInlineDetails":{type:"boolean",default:e.showInlineDetails,description:mf(0,"Controls whether suggest details show inline with the label or only in the details widget")},"editor.suggest.maxVisibleSuggestions":{type:"number",deprecationMessage:mf(0,"This setting is deprecated. The suggest widget can now be resized.")},"editor.suggest.filteredTypes":{type:"object",deprecationMessage:mf(0,"This setting is deprecated, please use separate settings like 'editor.suggest.showKeywords' or 'editor.suggest.showSnippets' instead.")},"editor.suggest.showMethods":{type:"boolean",default:!0,markdownDescription:mf(0,"When enabled IntelliSense shows `method`-suggestions.")},"editor.suggest.showFunctions":{type:"boolean",default:!0,markdownDescription:mf(0,"When enabled IntelliSense shows `function`-suggestions.")},"editor.suggest.showConstructors":{type:"boolean",default:!0,markdownDescription:mf(0,"When enabled IntelliSense shows `constructor`-suggestions.")},"editor.suggest.showDeprecated":{type:"boolean",default:!0,markdownDescription:mf(0,"When enabled IntelliSense shows `deprecated`-suggestions.")},"editor.suggest.showFields":{type:"boolean",default:!0,markdownDescription:mf(0,"When enabled IntelliSense shows `field`-suggestions.")},"editor.suggest.showVariables":{type:"boolean",default:!0,markdownDescription:mf(0,"When enabled IntelliSense shows `variable`-suggestions.")},"editor.suggest.showClasses":{type:"boolean",default:!0,markdownDescription:mf(0,"When enabled IntelliSense shows `class`-suggestions.")},"editor.suggest.showStructs":{type:"boolean",default:!0,markdownDescription:mf(0,"When enabled IntelliSense shows `struct`-suggestions.")},"editor.suggest.showInterfaces":{type:"boolean",default:!0,markdownDescription:mf(0,"When enabled IntelliSense shows `interface`-suggestions.")},"editor.suggest.showModules":{type:"boolean",default:!0,markdownDescription:mf(0,"When enabled IntelliSense shows `module`-suggestions.")},"editor.suggest.showProperties":{type:"boolean",default:!0,markdownDescription:mf(0,"When enabled IntelliSense shows `property`-suggestions.")},"editor.suggest.showEvents":{type:"boolean",default:!0,markdownDescription:mf(0,"When enabled IntelliSense shows `event`-suggestions.")},"editor.suggest.showOperators":{type:"boolean",default:!0,markdownDescription:mf(0,"When enabled IntelliSense shows `operator`-suggestions.")},"editor.suggest.showUnits":{type:"boolean",default:!0,markdownDescription:mf(0,"When enabled IntelliSense shows `unit`-suggestions.")},"editor.suggest.showValues":{type:"boolean",default:!0,markdownDescription:mf(0,"When enabled IntelliSense shows `value`-suggestions.")},"editor.suggest.showConstants":{type:"boolean",default:!0,markdownDescription:mf(0,"When enabled IntelliSense shows `constant`-suggestions.")},"editor.suggest.showEnums":{type:"boolean",default:!0,markdownDescription:mf(0,"When enabled IntelliSense shows `enum`-suggestions.")},"editor.suggest.showEnumMembers":{type:"boolean",default:!0,markdownDescription:mf(0,"When enabled IntelliSense shows `enumMember`-suggestions.")},"editor.suggest.showKeywords":{type:"boolean",default:!0,markdownDescription:mf(0,"When enabled IntelliSense shows `keyword`-suggestions.")},"editor.suggest.showWords":{type:"boolean",default:!0,markdownDescription:mf(0,"When enabled IntelliSense shows `text`-suggestions.")},"editor.suggest.showColors":{type:"boolean",default:!0,markdownDescription:mf(0,"When enabled IntelliSense shows `color`-suggestions.")},"editor.suggest.showFiles":{type:"boolean",default:!0,markdownDescription:mf(0,"When enabled IntelliSense shows `file`-suggestions.")},"editor.suggest.showReferences":{type:"boolean",default:!0,markdownDescription:mf(0,"When enabled IntelliSense shows `reference`-suggestions.")},"editor.suggest.showCustomcolors":{type:"boolean",default:!0,markdownDescription:mf(0,"When enabled IntelliSense shows `customcolor`-suggestions.")},"editor.suggest.showFolders":{type:"boolean",default:!0,markdownDescription:mf(0,"When enabled IntelliSense shows `folder`-suggestions.")},"editor.suggest.showTypeParameters":{type:"boolean",default:!0,markdownDescription:mf(0,"When enabled IntelliSense shows `typeParameter`-suggestions.")},"editor.suggest.showSnippets":{type:"boolean",default:!0,markdownDescription:mf(0,"When enabled IntelliSense shows `snippet`-suggestions.")},"editor.suggest.showUsers":{type:"boolean",default:!0,markdownDescription:mf(0,"When enabled IntelliSense shows `user`-suggestions.")},"editor.suggest.showIssues":{type:"boolean",default:!0,markdownDescription:mf(0,"When enabled IntelliSense shows `issues`-suggestions.")}})}validate(e){if(!e||"object"!=typeof e)return this.defaultValue;const t=e;return{insertMode:If(t.insertMode,this.defaultValue.insertMode,["insert","replace"]),filterGraceful:Sf(t.filterGraceful,this.defaultValue.filterGraceful),snippetsPreventQuickSuggestions:Sf(t.snippetsPreventQuickSuggestions,this.defaultValue.filterGraceful),localityBonus:Sf(t.localityBonus,this.defaultValue.localityBonus),shareSuggestSelections:Sf(t.shareSuggestSelections,this.defaultValue.shareSuggestSelections),showIcons:Sf(t.showIcons,this.defaultValue.showIcons),showStatusBar:Sf(t.showStatusBar,this.defaultValue.showStatusBar),preview:Sf(t.preview,this.defaultValue.preview),previewMode:If(t.previewMode,this.defaultValue.previewMode,["prefix","subword","subwordSmart"]),showInlineDetails:Sf(t.showInlineDetails,this.defaultValue.showInlineDetails),showMethods:Sf(t.showMethods,this.defaultValue.showMethods),showFunctions:Sf(t.showFunctions,this.defaultValue.showFunctions),showConstructors:Sf(t.showConstructors,this.defaultValue.showConstructors),showDeprecated:Sf(t.showDeprecated,this.defaultValue.showDeprecated),showFields:Sf(t.showFields,this.defaultValue.showFields),showVariables:Sf(t.showVariables,this.defaultValue.showVariables),showClasses:Sf(t.showClasses,this.defaultValue.showClasses),showStructs:Sf(t.showStructs,this.defaultValue.showStructs),showInterfaces:Sf(t.showInterfaces,this.defaultValue.showInterfaces),showModules:Sf(t.showModules,this.defaultValue.showModules),showProperties:Sf(t.showProperties,this.defaultValue.showProperties),showEvents:Sf(t.showEvents,this.defaultValue.showEvents),showOperators:Sf(t.showOperators,this.defaultValue.showOperators),showUnits:Sf(t.showUnits,this.defaultValue.showUnits),showValues:Sf(t.showValues,this.defaultValue.showValues),showConstants:Sf(t.showConstants,this.defaultValue.showConstants),showEnums:Sf(t.showEnums,this.defaultValue.showEnums),showEnumMembers:Sf(t.showEnumMembers,this.defaultValue.showEnumMembers),showKeywords:Sf(t.showKeywords,this.defaultValue.showKeywords),showWords:Sf(t.showWords,this.defaultValue.showWords),showColors:Sf(t.showColors,this.defaultValue.showColors),showFiles:Sf(t.showFiles,this.defaultValue.showFiles),showReferences:Sf(t.showReferences,this.defaultValue.showReferences),showFolders:Sf(t.showFolders,this.defaultValue.showFolders),showTypeParameters:Sf(t.showTypeParameters,this.defaultValue.showTypeParameters),showSnippets:Sf(t.showSnippets,this.defaultValue.showSnippets),showUsers:Sf(t.showUsers,this.defaultValue.showUsers),showIssues:Sf(t.showIssues,this.defaultValue.showIssues)}}}),inlineSuggest:Yf(new class extends bf{constructor(){const e={enabled:!0,mode:"subwordSmart"};super(55,"inlineSuggest",e,{"editor.inlineSuggest.enabled":{type:"boolean",default:e.enabled,description:mf(0,"Controls whether to automatically show inline suggestions in the editor.")}})}validate(e){if(!e||"object"!=typeof e)return this.defaultValue;const t=e;return{enabled:Sf(t.enabled,this.defaultValue.enabled),mode:If(t.mode,this.defaultValue.mode,["prefix","subword","subwordSmart"])}}}),suggestFontSize:Yf(new Lf(107,"suggestFontSize",0,0,1e3,{markdownDescription:mf(0,"Font size for the suggest widget. When set to `0`, the value of `#editor.fontSize#` is used.")})),suggestLineHeight:Yf(new Lf(108,"suggestLineHeight",0,0,1e3,{markdownDescription:mf(0,"Line height for the suggest widget. When set to `0`, the value of `#editor.lineHeight#` is used. The minimum value is 8.")})),suggestOnTriggerCharacters:Yf(new kf(109,"suggestOnTriggerCharacters",!0,{description:mf(0,"Controls whether suggestions should automatically show up when typing trigger characters.")})),suggestSelection:Yf(new Tf(110,"suggestSelection","first",["first","recentlyUsed","recentlyUsedByPrefix"],{markdownEnumDescriptions:[mf(0,"Always select the first suggestion."),mf(0,"Select recent suggestions unless further typing selects one, e.g. `console.| -> console.log` because `log` has been completed recently."),mf(0,"Select suggestions based on previous prefixes that have completed those suggestions, e.g. `co -> console` and `con -> const`.")],description:mf(0,"Controls how suggestions are pre-selected when showing the suggest list.")})),tabCompletion:Yf(new Tf(111,"tabCompletion","off",["on","off","onlySnippets"],{enumDescriptions:[mf(0,"Tab complete will insert the best matching suggestion when pressing tab."),mf(0,"Disable tab completions."),mf(0,"Tab complete snippets when their prefix match. Works best when 'quickSuggestions' aren't enabled.")],description:mf(0,"Enables tab completions.")})),tabIndex:Yf(new Lf(112,"tabIndex",0,-1,1073741824)),unicodeHighlight:Yf(new class extends bf{constructor(){const e={nonBasicASCII:Vf,invisibleCharacters:!0,ambiguousCharacters:!0,includeComments:Vf,includeStrings:!0,allowedCharacters:{},allowedLocales:{_os:!0,_vscode:!0}};super(113,"unicodeHighlight",e,{[Hf]:{restricted:!0,type:["boolean","string"],enum:[!0,!1,Vf],default:e.nonBasicASCII,description:mf(0,"Controls whether all non-basic ASCII characters are highlighted. Only characters between U+0020 and U+007E, tab, line-feed and carriage-return are considered basic ASCII.")},[zf]:{restricted:!0,type:"boolean",default:e.invisibleCharacters,description:mf(0,"Controls whether characters that just reserve space or have no width at all are highlighted.")},[jf]:{restricted:!0,type:"boolean",default:e.ambiguousCharacters,description:mf(0,"Controls whether characters are highlighted that can be confused with basic ASCII characters, except those that are common in the current user locale.")},[Uf]:{restricted:!0,type:["boolean","string"],enum:[!0,!1,Vf],default:e.includeComments,description:mf(0,"Controls whether characters in comments should also be subject to unicode highlighting.")},[$f]:{restricted:!0,type:["boolean","string"],enum:[!0,!1,Vf],default:e.includeStrings,description:mf(0,"Controls whether characters in strings should also be subject to unicode highlighting.")},[Wf]:{restricted:!0,type:"object",default:e.allowedCharacters,description:mf(0,"Defines allowed characters that are not being highlighted."),additionalProperties:{type:"boolean"}},[Kf]:{restricted:!0,type:"object",additionalProperties:{type:"boolean"},default:e.allowedLocales,description:mf(0,"Unicode characters that are common in allowed locales are not being highlighted.")}})}applyUpdate(e,t){let i=!1;t.allowedCharacters&&(Ho(e.allowedCharacters,t.allowedCharacters)||(e=Object.assign(Object.assign({},e),{allowedCharacters:t.allowedCharacters}),i=!0)),t.allowedLocales&&(Ho(e.allowedLocales,t.allowedLocales)||(e=Object.assign(Object.assign({},e),{allowedLocales:t.allowedLocales}),i=!0));const n=super.applyUpdate(e,t);return i?new wf(n.newValue,!0):n}validate(e){if(!e||"object"!=typeof e)return this.defaultValue;const t=e;return{nonBasicASCII:qf(t.nonBasicASCII,Vf,[!0,!1,Vf]),invisibleCharacters:Sf(t.invisibleCharacters,this.defaultValue.invisibleCharacters),ambiguousCharacters:Sf(t.ambiguousCharacters,this.defaultValue.ambiguousCharacters),includeComments:qf(t.includeComments,Vf,[!0,!1,Vf]),includeStrings:qf(t.includeStrings,Vf,[!0,!1,Vf]),allowedCharacters:this.validateBooleanMap(e.allowedCharacters,this.defaultValue.allowedCharacters),allowedLocales:this.validateBooleanMap(e.allowedLocales,this.defaultValue.allowedLocales)}}validateBooleanMap(e,t){if("object"!=typeof e||!e)return t;const i={};for(const[n,o]of Object.entries(e))!0===o&&(i[n]=!0);return i}}),unusualLineTerminators:Yf(new Tf(114,"unusualLineTerminators","prompt",["auto","off","prompt"],{enumDescriptions:[mf(0,"Unusual line terminators are automatically removed."),mf(0,"Unusual line terminators are ignored."),mf(0,"Unusual line terminators prompt to be removed.")],description:mf(0,"Remove unusual line terminators that might cause problems.")})),useShadowDOM:Yf(new kf(115,"useShadowDOM",!0)),useTabStops:Yf(new kf(116,"useTabStops",!0,{description:mf(0,"Inserting and deleting whitespace follows tab stops.")})),wordSeparators:Yf(new Ef(117,"wordSeparators",Wo,{description:mf(0,"Characters that will be used as word separators when doing word related navigations or operations.")})),wordWrap:Yf(new Tf(118,"wordWrap","off",["off","on","wordWrapColumn","bounded"],{markdownEnumDescriptions:[mf(0,"Lines will never wrap."),mf(0,"Lines will wrap at the viewport width."),mf(0,"Lines will wrap at `#editor.wordWrapColumn#`."),mf(0,"Lines will wrap at the minimum of viewport and `#editor.wordWrapColumn#`.")],description:mf(0,"Controls how lines should wrap.")})),wordWrapBreakAfterCharacters:Yf(new Ef(119,"wordWrapBreakAfterCharacters"," \t})]?|/&.,;¢°′″‰℃、。。、¢,.:;?!%・・ゝゞヽヾーァィゥェォッャュョヮヵヶぁぃぅぇぉっゃゅょゎゕゖㇰㇱㇲㇳㇴㇵㇶㇷㇸㇹㇺㇻㇼㇽㇾㇿ々〻ァィゥェォャュョッー”〉》」』】〕)]}」")),wordWrapBreakBeforeCharacters:Yf(new Ef(120,"wordWrapBreakBeforeCharacters","([{‘“〈《「『【〔([{「£¥$£¥++")),wordWrapColumn:Yf(new Lf(121,"wordWrapColumn",80,1,1073741824,{markdownDescription:mf(0,"Controls the wrapping column of the editor when `#editor.wordWrap#` is `wordWrapColumn` or `bounded`.")})),wordWrapOverride1:Yf(new Tf(122,"wordWrapOverride1","inherit",["off","on","inherit"])),wordWrapOverride2:Yf(new Tf(123,"wordWrapOverride2","inherit",["off","on","inherit"])),wrappingIndent:Yf(new Mf(124,"wrappingIndent",1,"same",["none","same","indent","deepIndent"],(function(e){switch(e){case"none":return 0;case"same":return 1;case"indent":return 2;case"deepIndent":return 3}}),{enumDescriptions:[mf(0,"No indentation. Wrapped lines begin at column 1."),mf(0,"Wrapped lines get the same indentation as the parent."),mf(0,"Wrapped lines get +1 indentation toward the parent."),mf(0,"Wrapped lines get +2 indentation toward the parent.")],description:mf(0,"Controls the indentation of wrapped lines.")})),wrappingStrategy:Yf(new Tf(125,"wrappingStrategy","simple",["simple","advanced"],{enumDescriptions:[mf(0,"Assumes that all characters are of the same width. This is a fast algorithm that works correctly for monospace fonts and certain scripts (like Latin characters) where glyphs are of equal width."),mf(0,"Delegates wrapping points computation to the browser. This is a slow algorithm, that might cause freezes for large files, but it works correctly in all cases.")],description:mf(0,"Controls the algorithm that computes wrapping points.")})),editorClassName:Yf(new class extends yf{constructor(){super(128)}compute(e,t,i){const n=["monaco-editor"];return t.get(33)&&n.push(t.get(33)),e.extraEditorClassName&&n.push(e.extraEditorClassName),"default"===t.get(66)?n.push("mouse-default"):"copy"===t.get(66)&&n.push("mouse-copy"),t.get(100)&&n.push("showUnused"),t.get(126)&&n.push("showDeprecated"),n.join(" ")}}),pixelRatio:Yf(new class extends yf{constructor(){super(129)}compute(e,t,i){return e.pixelRatio}}),tabFocusMode:Yf(new class extends yf{constructor(){super(130)}compute(e,t,i){return!!t.get(81)||e.tabFocusMode}}),layoutInfo:Yf(new Pf),wrappingInfo:Yf(new class extends yf{constructor(){super(132)}compute(e,t,i){const n=t.get(131);return{isDominatedByLongLines:e.isDominatedByLongLines,isWordWrapMinified:n.isWordWrapMinified,isViewportWrapping:n.isViewportWrapping,wrappingColumn:n.wrappingColumn}}})};class Qf{constructor(){this._zoomFactor=1}getZoomFactor(){return this._zoomFactor}}Qf.INSTANCE=new Qf;class Jf extends Uo{constructor(){super(),this._onDidChange=this._register(new $o),this.onDidChange=this._onDidChange.event,this._listener=()=>this._handleChange(!0),this._mediaQueryList=null,this._handleChange(!1)}_handleChange(e){this._mediaQueryList&&this._mediaQueryList.removeEventListener("change",this._listener),this._mediaQueryList=matchMedia(`(resolution: ${window.devicePixelRatio}dppx)`),this._mediaQueryList.addEventListener("change",this._listener),e&&this._onDidChange.fire()}}class e_ extends Uo{constructor(){super(),this._onDidChange=this._register(new $o),this.onDidChange=this._onDidChange.event,this._value=this._getPixelRatio();const e=this._register(new Jf);this._register(e.onDidChange((()=>{this._value=this._getPixelRatio(),this._onDidChange.fire(this._value)})))}get value(){return this._value}_getPixelRatio(){const e=document.createElement("canvas").getContext("2d");return(window.devicePixelRatio||1)/(e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1)}}const t_=new class{constructor(){this._pixelRatioMonitor=null}_getOrCreatePixelRatioMonitor(){return this._pixelRatioMonitor||(this._pixelRatioMonitor=new e_),this._pixelRatioMonitor}get value(){return this._getOrCreatePixelRatioMonitor().value}get onDidChange(){return this._getOrCreatePixelRatioMonitor().onDidChange}};function i_(){return Qf.INSTANCE.getZoomFactor()}const n_=navigator.userAgent,o_=n_.indexOf("Firefox")>=0,s_=n_.indexOf("AppleWebKit")>=0,r_=n_.indexOf("Chrome")>=0,a_=!r_&&n_.indexOf("Safari")>=0,l_=!r_&&!a_&&s_,d_=n_.indexOf("Electron/")>=0,c_=n_.indexOf("Android")>=0,h_=window.matchMedia&&window.matchMedia("(display-mode: standalone)").matches;var u_=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",PixelRatio:t_,getZoomFactor:i_,isFirefox:o_,isWebKit:s_,isChrome:r_,isSafari:a_,isWebkitWebView:l_,isElectron:d_,isAndroid:c_,isStandalone:h_});class g_{constructor(e){this.domNode=e,this._maxWidth=-1,this._width=-1,this._height=-1,this._top=-1,this._left=-1,this._bottom=-1,this._right=-1,this._fontFamily="",this._fontWeight="",this._fontSize=-1,this._fontStyle="",this._fontFeatureSettings="",this._textDecoration="",this._lineHeight=-1,this._letterSpacing=-100,this._className="",this._display="",this._position="",this._visibility="",this._color="",this._backgroundColor="",this._layerHint=!1,this._contain="none",this._boxShadow=""}setMaxWidth(e){this._maxWidth!==e&&(this._maxWidth=e,this.domNode.style.maxWidth=this._maxWidth+"px")}setWidth(e){this._width!==e&&(this._width=e,this.domNode.style.width=this._width+"px")}setHeight(e){this._height!==e&&(this._height=e,this.domNode.style.height=this._height+"px")}setTop(e){this._top!==e&&(this._top=e,this.domNode.style.top=this._top+"px")}unsetTop(){-1!==this._top&&(this._top=-1,this.domNode.style.top="")}setLeft(e){this._left!==e&&(this._left=e,this.domNode.style.left=this._left+"px")}setBottom(e){this._bottom!==e&&(this._bottom=e,this.domNode.style.bottom=this._bottom+"px")}setRight(e){this._right!==e&&(this._right=e,this.domNode.style.right=this._right+"px")}setFontFamily(e){this._fontFamily!==e&&(this._fontFamily=e,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(e){this._fontSize!==e&&(this._fontSize=e,this.domNode.style.fontSize=this._fontSize+"px")}setFontStyle(e){this._fontStyle!==e&&(this._fontStyle=e,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(e){this._fontFeatureSettings!==e&&(this._fontFeatureSettings=e,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setTextDecoration(e){this._textDecoration!==e&&(this._textDecoration=e,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(e){this._lineHeight!==e&&(this._lineHeight=e,this.domNode.style.lineHeight=this._lineHeight+"px")}setLetterSpacing(e){this._letterSpacing!==e&&(this._letterSpacing=e,this.domNode.style.letterSpacing=this._letterSpacing+"px")}setClassName(e){this._className!==e&&(this._className=e,this.domNode.className=this._className)}toggleClassName(e,t){this.domNode.classList.toggle(e,t),this._className=this.domNode.className}setDisplay(e){this._display!==e&&(this._display=e,this.domNode.style.display=this._display)}setPosition(e){this._position!==e&&(this._position=e,this.domNode.style.position=this._position)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this.domNode.style.visibility=this._visibility)}setColor(e){this._color!==e&&(this._color=e,this.domNode.style.color=this._color)}setBackgroundColor(e){this._backgroundColor!==e&&(this._backgroundColor=e,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(e){this._layerHint!==e&&(this._layerHint=e,this.domNode.style.transform=this._layerHint?"translate3d(0px, 0px, 0px)":"")}setBoxShadow(e){this._boxShadow!==e&&(this._boxShadow=e,this.domNode.style.boxShadow=e)}setContain(e){this._contain!==e&&(this._contain=e,this.domNode.style.contain=this._contain)}setAttribute(e,t){this.domNode.setAttribute(e,t)}removeAttribute(e){this.domNode.removeAttribute(e)}appendChild(e){this.domNode.appendChild(e.domNode)}removeChild(e){this.domNode.removeChild(e.domNode)}}function p_(e){return new g_(e)}function m_(e,t){e instanceof g_?(e.setFontFamily(t.getMassagedFontFamily(a_?Gf.fontFamily:null)),e.setFontWeight(t.fontWeight),e.setFontSize(t.fontSize),e.setFontFeatureSettings(t.fontFeatureSettings),e.setLineHeight(t.lineHeight),e.setLetterSpacing(t.letterSpacing)):(e.style.fontFamily=t.getMassagedFontFamily(a_?Gf.fontFamily:null),e.style.fontWeight=t.fontWeight,e.style.fontSize=t.fontSize+"px",e.style.fontFeatureSettings=t.fontFeatureSettings,e.style.lineHeight=t.lineHeight+"px",e.style.letterSpacing=t.letterSpacing+"px")}class f_{constructor(e,t){this.chr=e,this.type=t,this.width=0}fulfill(e){this.width=e}}class __{constructor(e,t){this._bareFontInfo=e,this._requests=t,this._container=null,this._testElements=null}read(){this._createDomElements(),document.body.appendChild(this._container),this._readFromDomElements(),document.body.removeChild(this._container),this._container=null,this._testElements=null}_createDomElements(){const e=document.createElement("div");e.style.position="absolute",e.style.top="-50000px",e.style.width="50000px";const t=document.createElement("div");m_(t,this._bareFontInfo),e.appendChild(t);const i=document.createElement("div");m_(i,this._bareFontInfo),i.style.fontWeight="bold",e.appendChild(i);const n=document.createElement("div");m_(n,this._bareFontInfo),n.style.fontStyle="italic",e.appendChild(n);const o=[];for(const s of this._requests){let e;0===s.type&&(e=t),2===s.type&&(e=i),1===s.type&&(e=n),e.appendChild(document.createElement("br"));const r=document.createElement("span");__._render(r,s),e.appendChild(r),o.push(r)}this._container=e,this._testElements=o}static _render(e,t){if(" "===t.chr){let t=" ";for(let e=0;e<8;e++)t+=t;e.innerText=t}else{let i=t.chr;for(let e=0;e<8;e++)i+=i;e.textContent=i}}_readFromDomElements(){for(let e=0,t=this._requests.length;e<t;e++){const t=this._requests[e],i=this._testElements[e];t.fulfill(i.offsetWidth/256)}}}const v_=new class{constructor(){this._zoomLevel=0,this._onDidChangeZoomLevel=new $o,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event}getZoomLevel(){return this._zoomLevel}setZoomLevel(e){e=Math.min(Math.max(-5,e),20),this._zoomLevel!==e&&(this._zoomLevel=e,this._onDidChangeZoomLevel.fire(this._zoomLevel))}},b_=zo?1.5:1.35;class w_{constructor(e){this._bareFontInfoBrand=void 0,this.pixelRatio=e.pixelRatio,this.fontFamily=String(e.fontFamily),this.fontWeight=String(e.fontWeight),this.fontSize=e.fontSize,this.fontFeatureSettings=e.fontFeatureSettings,this.lineHeight=0|e.lineHeight,this.letterSpacing=e.letterSpacing}static createFromValidatedSettings(e,t,i){const n=e.get(43),o=e.get(47),s=e.get(46),r=e.get(45),a=e.get(59),l=e.get(56);return w_._create(n,o,s,r,a,l,t,i)}static _create(e,t,i,n,o,s,r,a){0===o?o=b_*i:o<8&&(o*=i),(o=Math.round(o))<8&&(o=8);const l=1+(a?0:.1*v_.getZoomLevel());return new w_({pixelRatio:r,fontFamily:e,fontWeight:t,fontSize:i*=l,fontFeatureSettings:n,lineHeight:o*=l,letterSpacing:s})}getId(){return`${this.pixelRatio}-${this.fontFamily}-${this.fontWeight}-${this.fontSize}-${this.fontFeatureSettings}-${this.lineHeight}-${this.letterSpacing}`}getMassagedFontFamily(e){const t=w_._wrapInQuotes(this.fontFamily);return e&&this.fontFamily!==e?`${t}, ${e}`:t}static _wrapInQuotes(e){return/[,"']/.test(e)?e:/[+ ]/.test(e)?`"${e}"`:e}}class C_ extends w_{constructor(e,t){super(e),this._editorStylingBrand=void 0,this.version=1,this.isTrusted=t,this.isMonospace=e.isMonospace,this.typicalHalfwidthCharacterWidth=e.typicalHalfwidthCharacterWidth,this.typicalFullwidthCharacterWidth=e.typicalFullwidthCharacterWidth,this.canUseHalfwidthRightwardsArrow=e.canUseHalfwidthRightwardsArrow,this.spaceWidth=e.spaceWidth,this.middotWidth=e.middotWidth,this.wsmiddotWidth=e.wsmiddotWidth,this.maxDigitWidth=e.maxDigitWidth}equals(e){return this.fontFamily===e.fontFamily&&this.fontWeight===e.fontWeight&&this.fontSize===e.fontSize&&this.fontFeatureSettings===e.fontFeatureSettings&&this.lineHeight===e.lineHeight&&this.letterSpacing===e.letterSpacing&&this.typicalHalfwidthCharacterWidth===e.typicalHalfwidthCharacterWidth&&this.typicalFullwidthCharacterWidth===e.typicalFullwidthCharacterWidth&&this.canUseHalfwidthRightwardsArrow===e.canUseHalfwidthRightwardsArrow&&this.spaceWidth===e.spaceWidth&&this.middotWidth===e.middotWidth&&this.wsmiddotWidth===e.wsmiddotWidth&&this.maxDigitWidth===e.maxDigitWidth}}class y_{constructor(){this._keys=Object.create(null),this._values=Object.create(null)}has(e){const t=e.getId();return!!this._values[t]}get(e){const t=e.getId();return this._values[t]}put(e,t){const i=e.getId();this._keys[i]=e,this._values[i]=t}remove(e){const t=e.getId();delete this._keys[t],delete this._values[t]}getValues(){return Object.keys(this._keys).map((e=>this._values[e]))}}const x_=new class extends Uo{constructor(){super(),this._onDidChange=this._register(new $o),this.onDidChange=this._onDidChange.event,this._cache=new y_,this._evictUntrustedReadingsTimeout=-1}dispose(){-1!==this._evictUntrustedReadingsTimeout&&(window.clearTimeout(this._evictUntrustedReadingsTimeout),this._evictUntrustedReadingsTimeout=-1),super.dispose()}clearAllFontInfos(){this._cache=new y_,this._onDidChange.fire()}_writeToCache(e,t){this._cache.put(e,t),t.isTrusted||-1!==this._evictUntrustedReadingsTimeout||(this._evictUntrustedReadingsTimeout=window.setTimeout((()=>{this._evictUntrustedReadingsTimeout=-1,this._evictUntrustedReadings()}),5e3))}_evictUntrustedReadings(){const e=this._cache.getValues();let t=!1;for(const i of e)i.isTrusted||(t=!0,this._cache.remove(i));t&&this._onDidChange.fire()}readFontInfo(e){if(!this._cache.has(e)){let t=this._actualReadFontInfo(e);(t.typicalHalfwidthCharacterWidth<=2||t.typicalFullwidthCharacterWidth<=2||t.spaceWidth<=2||t.maxDigitWidth<=2)&&(t=new C_({pixelRatio:t_.value,fontFamily:t.fontFamily,fontWeight:t.fontWeight,fontSize:t.fontSize,fontFeatureSettings:t.fontFeatureSettings,lineHeight:t.lineHeight,letterSpacing:t.letterSpacing,isMonospace:t.isMonospace,typicalHalfwidthCharacterWidth:Math.max(t.typicalHalfwidthCharacterWidth,5),typicalFullwidthCharacterWidth:Math.max(t.typicalFullwidthCharacterWidth,5),canUseHalfwidthRightwardsArrow:t.canUseHalfwidthRightwardsArrow,spaceWidth:Math.max(t.spaceWidth,5),middotWidth:Math.max(t.middotWidth,5),wsmiddotWidth:Math.max(t.wsmiddotWidth,5),maxDigitWidth:Math.max(t.maxDigitWidth,5)},!1)),this._writeToCache(e,t)}return this._cache.get(e)}_createRequest(e,t,i,n){const o=new f_(e,t);return i.push(o),n&&n.push(o),o}_actualReadFontInfo(e){const t=[],i=[],n=this._createRequest("n",0,t,i),o=this._createRequest("m",0,t,null),s=this._createRequest(" ",0,t,i),r=this._createRequest("0",0,t,i),a=this._createRequest("1",0,t,i),l=this._createRequest("2",0,t,i),d=this._createRequest("3",0,t,i),c=this._createRequest("4",0,t,i),h=this._createRequest("5",0,t,i),u=this._createRequest("6",0,t,i),g=this._createRequest("7",0,t,i),p=this._createRequest("8",0,t,i),m=this._createRequest("9",0,t,i),f=this._createRequest("→",0,t,i),_=this._createRequest("→",0,t,null),v=this._createRequest("·",0,t,i),b=this._createRequest(String.fromCharCode(11825),0,t,null),w="|/-_ilm%";for(let k=0,D=w.length;k<D;k++)this._createRequest(w.charAt(k),0,t,i),this._createRequest(w.charAt(k),1,t,i),this._createRequest(w.charAt(k),2,t,i);!function(e,t){new __(e,t).read()}(e,t);const C=Math.max(r.width,a.width,l.width,d.width,c.width,h.width,u.width,g.width,p.width,m.width);let y=e.fontFeatureSettings===Of.OFF;const x=i[0].width;for(let k=1,D=i.length;y&&k<D;k++){const e=x-i[k].width;if(e<-.001||e>.001){y=!1;break}}let S=!0;return y&&_.width!==x&&(S=!1),_.width>f.width&&(S=!1),new C_({pixelRatio:t_.value,fontFamily:e.fontFamily,fontWeight:e.fontWeight,fontSize:e.fontSize,fontFeatureSettings:e.fontFeatureSettings,lineHeight:e.lineHeight,letterSpacing:e.letterSpacing,isMonospace:y,typicalHalfwidthCharacterWidth:n.width,typicalFullwidthCharacterWidth:o.width,canUseHalfwidthRightwardsArrow:S,spaceWidth:s.width,middotWidth:v.width,wsmiddotWidth:b.width,maxDigitWidth:C},!0)}};var S_;!function(e){e.serviceIds=new Map,e.DI_TARGET="$di$target",e.DI_DEPENDENCIES="$di$dependencies",e.getServiceDependencies=function(t){return t[e.DI_DEPENDENCIES]||[]}}(S_||(S_={}));const k_=L_("instantiationService");function D_(e,t,i){t[S_.DI_TARGET]===t?t[S_.DI_DEPENDENCIES].push({id:e,index:i}):(t[S_.DI_DEPENDENCIES]=[{id:e,index:i}],t[S_.DI_TARGET]=t)}function L_(e){if(S_.serviceIds.has(e))return S_.serviceIds.get(e);const t=function(e,i,n){if(3!==arguments.length)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");D_(t,e,n)};return t.toString=()=>e,S_.serviceIds.set(e,t),t}const N_=L_("codeEditorService");function E_(e,t){if(!e)throw new Error(t?`Assertion failed (${t})`:"Assertion Failed")}const I_={followsCaret:!0,ignoreCharChanges:!0,alwaysRevealFirst:!0};class T_ extends Uo{constructor(e,t={}){super(),this._onDidUpdate=this._register(new $o),this._editor=e,this._options=Ko(t,I_,!1),this.disposed=!1,this.nextIdx=-1,this.ranges=[],this.ignoreSelectionChange=!1,this.revealFirst=Boolean(this._options.alwaysRevealFirst),this._register(this._editor.onDidDispose((()=>this.dispose()))),this._register(this._editor.onDidUpdateDiff((()=>this._onDiffUpdated()))),this._options.followsCaret&&this._register(this._editor.getModifiedEditor().onDidChangeCursorPosition((e=>{this.ignoreSelectionChange||(this.nextIdx=-1)}))),this._options.alwaysRevealFirst&&this._register(this._editor.getModifiedEditor().onDidChangeModel((e=>{this.revealFirst=!0}))),this._init()}_init(){this._editor.getLineChanges()}_onDiffUpdated(){this._init(),this._compute(this._editor.getLineChanges()),this.revealFirst&&null!==this._editor.getLineChanges()&&(this.revealFirst=!1,this.nextIdx=-1,this.next(1))}_compute(e){this.ranges=[],e&&e.forEach((e=>{!this._options.ignoreCharChanges&&e.charChanges?e.charChanges.forEach((e=>{this.ranges.push({rhs:!0,range:new qo(e.modifiedStartLineNumber,e.modifiedStartColumn,e.modifiedEndLineNumber,e.modifiedEndColumn)})})):0===e.modifiedEndLineNumber?this.ranges.push({rhs:!0,range:new qo(e.modifiedStartLineNumber,1,e.modifiedStartLineNumber+1,1)}):this.ranges.push({rhs:!0,range:new qo(e.modifiedStartLineNumber,1,e.modifiedEndLineNumber+1,1)})})),this.ranges.sort(((e,t)=>qo.compareRangesUsingStarts(e.range,t.range))),this._onDidUpdate.fire(this)}_initIdx(e){let t=!1;const i=this._editor.getPosition();if(i){for(let n=0,o=this.ranges.length;n<o&&!t;n++){const o=this.ranges[n].range;i.isBeforeOrEqual(o.getStartPosition())&&(this.nextIdx=n+(e?0:-1),t=!0)}t||(this.nextIdx=e?0:this.ranges.length-1),this.nextIdx<0&&(this.nextIdx=this.ranges.length-1)}else this.nextIdx=0}_move(e,t){if(E_(!this.disposed,"Illegal State - diff navigator has been disposed"),!this.canNavigate())return;-1===this.nextIdx?this._initIdx(e):e?(this.nextIdx+=1,this.nextIdx>=this.ranges.length&&(this.nextIdx=0)):(this.nextIdx-=1,this.nextIdx<0&&(this.nextIdx=this.ranges.length-1));const i=this.ranges[this.nextIdx];this.ignoreSelectionChange=!0;try{const e=i.range.getStartPosition();this._editor.setPosition(e),this._editor.revealRangeInCenter(i.range,t)}finally{this.ignoreSelectionChange=!1}}canNavigate(){return this.ranges&&this.ranges.length>0}next(e=0){this._move(!0,e)}previous(e=0){this._move(!1,e)}dispose(){super.dispose(),this.ranges=[],this.disposed=!0}}const M_={ICodeEditor:"vs.editor.ICodeEditor",IDiffEditor:"vs.editor.IDiffEditor"};var A_;!function(e){e[e.None=0]="None",e[e.Indent=1]="Indent",e[e.IndentOutdent=2]="IndentOutdent",e[e.Outdent=3]="Outdent"}(A_||(A_={}));class O_{constructor(e){if(this._neutralCharacter=null,this._neutralCharacterSearched=!1,this.open=e.open,this.close=e.close,this._inString=!0,this._inComment=!0,this._inRegEx=!0,Array.isArray(e.notIn))for(let t=0,i=e.notIn.length;t<i;t++){switch(e.notIn[t]){case"string":this._inString=!1;break;case"comment":this._inComment=!1;break;case"regex":this._inRegEx=!1}}}isOK(e){switch(e){case 0:return!0;case 1:return this._inComment;case 2:return this._inString;case 3:return this._inRegEx}}shouldAutoClose(e,t){if(0===e.getTokenCount())return!0;const i=e.findTokenIndexAtOffset(t-2),n=e.getStandardTokenType(i);return this.isOK(n)}_findNeutralCharacterInRange(e,t){for(let i=e;i<=t;i++){const e=String.fromCharCode(i);if(!this.open.includes(e)&&!this.close.includes(e))return e}return null}findNeutralCharacter(){return this._neutralCharacterSearched||(this._neutralCharacterSearched=!0,this._neutralCharacter||(this._neutralCharacter=this._findNeutralCharacterInRange(48,57)),this._neutralCharacter||(this._neutralCharacter=this._findNeutralCharacterInRange(97,122)),this._neutralCharacter||(this._neutralCharacter=this._findNeutralCharacterInRange(65,90))),this._neutralCharacter}}class R_{constructor(e){this.autoClosingPairsOpenByStart=new Map,this.autoClosingPairsOpenByEnd=new Map,this.autoClosingPairsCloseByStart=new Map,this.autoClosingPairsCloseByEnd=new Map,this.autoClosingPairsCloseSingleChar=new Map;for(const t of e)P_(this.autoClosingPairsOpenByStart,t.open.charAt(0),t),P_(this.autoClosingPairsOpenByEnd,t.open.charAt(t.open.length-1),t),P_(this.autoClosingPairsCloseByStart,t.close.charAt(0),t),P_(this.autoClosingPairsCloseByEnd,t.close.charAt(t.close.length-1),t),1===t.close.length&&1===t.open.length&&P_(this.autoClosingPairsCloseSingleChar,t.close,t)}}function P_(e,t,i){e.has(t)?e.get(t).push(i):e.set(t,[i])}function F_(e,t){const i=e.getCount(),n=e.findTokenIndexAtOffset(t),o=e.getLanguageId(n);let s=n;for(;s+1<i&&e.getLanguageId(s+1)===o;)s++;let r=n;for(;r>0&&e.getLanguageId(r-1)===o;)r--;return new B_(e,o,r,s+1,e.getStartOffset(r),e.getEndOffset(s))}class B_{constructor(e,t,i,n,o,s){this._scopedLineTokensBrand=void 0,this._actual=e,this.languageId=t,this._firstTokenIndex=i,this._lastTokenIndex=n,this.firstCharOffset=o,this._lastCharOffset=s}getLineContent(){return this._actual.getLineContent().substring(this.firstCharOffset,this._lastCharOffset)}getActualLineContentBefore(e){return this._actual.getLineContent().substring(0,this.firstCharOffset+e)}getTokenCount(){return this._lastTokenIndex-this._firstTokenIndex}findTokenIndexAtOffset(e){return this._actual.findTokenIndexAtOffset(e+this.firstCharOffset)-this._firstTokenIndex}getStandardTokenType(e){return this._actual.getStandardTokenType(e+this._firstTokenIndex)}}function V_(e){return 0!=(3&e)}class W_{constructor(e){if(e.autoClosingPairs?this._autoClosingPairs=e.autoClosingPairs.map((e=>new O_(e))):e.brackets?this._autoClosingPairs=e.brackets.map((e=>new O_({open:e[0],close:e[1]}))):this._autoClosingPairs=[],e.colorizedBracketPairs?this._colorizedBracketPairs=z_(e.colorizedBracketPairs.map((e=>[e[0],e[1]]))):e.brackets?this._colorizedBracketPairs=z_(e.brackets.map((e=>[e[0],e[1]])).filter((e=>!("<"===e[0]&&">"===e[1])))):this._colorizedBracketPairs=[],e.__electricCharacterSupport&&e.__electricCharacterSupport.docComment){const t=e.__electricCharacterSupport.docComment;this._autoClosingPairs.push(new O_({open:t.open,close:t.close||""}))}this._autoCloseBefore="string"==typeof e.autoCloseBefore?e.autoCloseBefore:W_.DEFAULT_AUTOCLOSE_BEFORE_LANGUAGE_DEFINED,this._surroundingPairs=e.surroundingPairs||this._autoClosingPairs}getAutoClosingPairs(){return this._autoClosingPairs}getAutoCloseBeforeSet(){return this._autoCloseBefore}getSurroundingPairs(){return this._surroundingPairs}getColorizedBrackets(){return this._colorizedBracketPairs}}function z_(e){return e.filter((([e,t])=>""!==e&&""!==t))}W_.DEFAULT_AUTOCLOSE_BEFORE_LANGUAGE_DEFINED=";:.,=}])> \n\t";const H_="undefined"!=typeof Buffer;let j_,U_,$_,K_;class q_{constructor(e){this.buffer=e,this.byteLength=this.buffer.byteLength}static wrap(e){return H_&&!Buffer.isBuffer(e)&&(e=Buffer.from(e.buffer,e.byteOffset,e.byteLength)),new q_(e)}toString(){return H_?this.buffer.toString():(j_||(j_=new TextDecoder),j_.decode(this.buffer))}}function G_(e,t){return e[t+0]<<0>>>0|e[t+1]<<8>>>0}function Z_(e,t,i){e[i+0]=255&t,t>>>=8,e[i+1]=255&t}function Y_(e,t){return e[t]*Math.pow(2,24)+e[t+1]*Math.pow(2,16)+e[t+2]*Math.pow(2,8)+e[t+3]}function X_(e,t,i){e[i+3]=t,t>>>=8,e[i+2]=t,t>>>=8,e[i+1]=t,t>>>=8,e[i]=t}function Q_(e,t){return e[t]}function J_(e,t,i){e[i]=t}function ev(){return U_||(U_=new TextDecoder("UTF-16LE")),U_}function tv(){return K_||(K_=Zo()?ev():($_||($_=new TextDecoder("UTF-16BE")),$_)),K_}const iv="undefined"!=typeof TextDecoder;let nv,ov;function sv(e,t,i){const n=[];let o=0;for(let s=0;s<i;s++){const i=G_(e,t);t+=2,n[o++]=String.fromCharCode(i)}return n.join("")}iv?(nv=e=>new rv(e),ov=function(e,t,i){const n=new Uint16Array(e.buffer,t,i);if(i>0&&(65279===n[0]||65534===n[0]))return sv(e,t,i);return ev().decode(n)}):(nv=e=>new av,ov=sv);class rv{constructor(e){this._capacity=0|e,this._buffer=new Uint16Array(this._capacity),this._completedStrings=null,this._bufferLength=0}reset(){this._completedStrings=null,this._bufferLength=0}build(){return null!==this._completedStrings?(this._flushBuffer(),this._completedStrings.join("")):this._buildBuffer()}_buildBuffer(){if(0===this._bufferLength)return"";const e=new Uint16Array(this._buffer.buffer,0,this._bufferLength);return tv().decode(e)}_flushBuffer(){const e=this._buildBuffer();this._bufferLength=0,null===this._completedStrings?this._completedStrings=[e]:this._completedStrings[this._completedStrings.length]=e}write1(e){const t=this._capacity-this._bufferLength;t<=1&&(0===t||Go(e))&&this._flushBuffer(),this._buffer[this._bufferLength++]=e}appendASCII(e){this._bufferLength===this._capacity&&this._flushBuffer(),this._buffer[this._bufferLength++]=e}appendASCIIString(e){const t=e.length;if(this._bufferLength+t>=this._capacity)return this._flushBuffer(),void(this._completedStrings[this._completedStrings.length]=e);for(let i=0;i<t;i++)this._buffer[this._bufferLength++]=e.charCodeAt(i)}}class av{constructor(){this._pieces=[],this._piecesLen=0}reset(){this._pieces=[],this._piecesLen=0}build(){return this._pieces.join("")}write1(e){this._pieces[this._piecesLen++]=String.fromCharCode(e)}appendASCII(e){this._pieces[this._piecesLen++]=String.fromCharCode(e)}appendASCIIString(e){this._pieces[this._piecesLen++]=e}}class lv{constructor(e,t,i,n,o,s){this._richEditBracketBrand=void 0,this.languageId=e,this.index=t,this.open=i,this.close=n,this.forwardRegex=o,this.reversedRegex=s,this._openSet=lv._toSet(this.open),this._closeSet=lv._toSet(this.close)}isOpen(e){return this._openSet.has(e)}isClose(e){return this._closeSet.has(e)}static _toSet(e){const t=new Set;for(const i of e)t.add(i);return t}}class dv{constructor(e,t){this._richEditBracketsBrand=void 0;const i=function(e){const t=e.length;e=e.map((e=>[e[0].toLowerCase(),e[1].toLowerCase()]));const i=[];for(let r=0;r<t;r++)i[r]=r;const n=(e,t)=>{const[i,n]=e,[o,s]=t;return i===o||i===s||n===o||n===s},o=(e,n)=>{const o=Math.min(e,n),s=Math.max(e,n);for(let r=0;r<t;r++)i[r]===s&&(i[r]=o)};for(let r=0;r<t;r++){const s=e[r];for(let a=r+1;a<t;a++)n(s,e[a])&&o(i[r],i[a])}const s=[];for(let r=0;r<t;r++){const n=[],o=[];for(let s=0;s<t;s++)if(i[s]===r){const[t,i]=e[s];n.push(t),o.push(i)}n.length>0&&s.push({open:n,close:o})}return s}(t);this.brackets=i.map(((t,n)=>new lv(e,n,t.open,t.close,function(e,t,i,n){let o=[];o=o.concat(e),o=o.concat(t);for(let s=0,r=o.length;s<r;s++)cv(o[s],i,n,o);return o=uv(o),o.sort(hv),o.reverse(),pv(o)}(t.open,t.close,i,n),function(e,t,i,n){let o=[];o=o.concat(e),o=o.concat(t);for(let s=0,r=o.length;s<r;s++)cv(o[s],i,n,o);return o=uv(o),o.sort(hv),o.reverse(),pv(o.map(mv))}(t.open,t.close,i,n)))),this.forwardRegex=function(e){let t=[];for(const i of e){for(const e of i.open)t.push(e);for(const e of i.close)t.push(e)}return t=uv(t),pv(t)}(this.brackets),this.reversedRegex=function(e){let t=[];for(const i of e){for(const e of i.open)t.push(e);for(const e of i.close)t.push(e)}return t=uv(t),pv(t.map(mv))}(this.brackets),this.textIsBracket={},this.textIsOpenBracket={},this.maxBracketLength=0;for(const n of this.brackets){for(const e of n.open)this.textIsBracket[e]=n,this.textIsOpenBracket[e]=!0,this.maxBracketLength=Math.max(this.maxBracketLength,e.length);for(const e of n.close)this.textIsBracket[e]=n,this.textIsOpenBracket[e]=!1,this.maxBracketLength=Math.max(this.maxBracketLength,e.length)}}}function cv(e,t,i,n){for(let o=0,s=t.length;o<s;o++){if(o===i)continue;const s=t[o];for(const t of s.open)t.indexOf(e)>=0&&n.push(t);for(const t of s.close)t.indexOf(e)>=0&&n.push(t)}}function hv(e,t){return e.length-t.length}function uv(e){if(e.length<=1)return e;const t=[],i=new Set;for(const n of e)i.has(n)||(t.push(n),i.add(n));return t}function gv(e){const t=/^[\w ]+$/.test(e);return e=Xo(e),t?`\\b${e}\\b`:e}function pv(e){const t=`(${e.map(gv).join(")|(")})`;return Yo(t,!0)}const mv=function(){let e=null,t=null;return function(i){return e!==i&&(e=i,t=function(e){if(iv){const t=new Uint16Array(e.length);let i=0;for(let n=e.length-1;n>=0;n--)t[i++]=e.charCodeAt(n);return tv().decode(t)}{const t=[];let i=0;for(let n=e.length-1;n>=0;n--)t[i++]=e.charAt(n);return t.join("")}}(e)),t}}();class fv{static _findPrevBracketInText(e,t,i,n){const o=i.match(e);if(!o)return null;const s=i.length-(o.index||0),r=o[0].length,a=n+s;return new qo(t,a-r+1,t,a+1)}static findPrevBracketInRange(e,t,i,n,o){const s=mv(i).substring(i.length-o,i.length-n);return this._findPrevBracketInText(e,t,s,n)}static findNextBracketInText(e,t,i,n){const o=i.match(e);if(!o)return null;const s=o.index||0,r=o[0].length;if(0===r)return null;const a=n+s;return new qo(t,a+1,t,a+1+r)}static findNextBracketInRange(e,t,i,n,o){const s=i.substring(n,o);return this.findNextBracketInText(e,t,s,n)}}class _v{constructor(e){this._richEditBrackets=e}getElectricCharacters(){const e=[];if(this._richEditBrackets)for(const t of this._richEditBrackets.brackets)for(const i of t.close){const t=i.charAt(i.length-1);e.push(t)}return Qo(e)}onElectricCharacter(e,t,i){if(!this._richEditBrackets||0===this._richEditBrackets.brackets.length)return null;const n=t.findTokenIndexAtOffset(i-1);if(V_(t.getStandardTokenType(n)))return null;const o=this._richEditBrackets.reversedRegex,s=t.getLineContent().substring(0,i-1)+e,r=fv.findPrevBracketInRange(o,1,s,0,s.length);if(!r)return null;const a=s.substring(r.startColumn-1,r.endColumn-1).toLowerCase();if(this._richEditBrackets.textIsOpenBracket[a])return null;const l=t.getActualLineContentBefore(r.startColumn-1);return/^\s*$/.test(l)?{matchOpenBracket:a}:null}}function vv(e){return e.global&&(e.lastIndex=0),!0}class bv{constructor(e){this._indentationRules=e}shouldIncrease(e){return!!(this._indentationRules&&this._indentationRules.increaseIndentPattern&&vv(this._indentationRules.increaseIndentPattern)&&this._indentationRules.increaseIndentPattern.test(e))}shouldDecrease(e){return!!(this._indentationRules&&this._indentationRules.decreaseIndentPattern&&vv(this._indentationRules.decreaseIndentPattern)&&this._indentationRules.decreaseIndentPattern.test(e))}shouldIndentNextLine(e){return!!(this._indentationRules&&this._indentationRules.indentNextLinePattern&&vv(this._indentationRules.indentNextLinePattern)&&this._indentationRules.indentNextLinePattern.test(e))}shouldIgnore(e){return!!(this._indentationRules&&this._indentationRules.unIndentedLinePattern&&vv(this._indentationRules.unIndentedLinePattern)&&this._indentationRules.unIndentedLinePattern.test(e))}getIndentMetadata(e){let t=0;return this.shouldIncrease(e)&&(t+=1),this.shouldDecrease(e)&&(t+=2),this.shouldIndentNextLine(e)&&(t+=4),this.shouldIgnore(e)&&(t+=8),t}}class wv{constructor(e){(e=e||{}).brackets=e.brackets||[["(",")"],["{","}"],["[","]"]],this._brackets=[],e.brackets.forEach((e=>{const t=wv._createOpenBracketRegExp(e[0]),i=wv._createCloseBracketRegExp(e[1]);t&&i&&this._brackets.push({open:e[0],openRegExp:t,close:e[1],closeRegExp:i})})),this._regExpRules=e.onEnterRules||[]}onEnter(e,t,i,n){if(e>=3)for(let o=0,s=this._regExpRules.length;o<s;o++){const e=this._regExpRules[o];if([{reg:e.beforeText,text:i},{reg:e.afterText,text:n},{reg:e.previousLineText,text:t}].every((e=>!e.reg||(e.reg.lastIndex=0,e.reg.test(e.text)))))return e.action}if(e>=2&&i.length>0&&n.length>0)for(let o=0,s=this._brackets.length;o<s;o++){const e=this._brackets[o];if(e.openRegExp.test(i)&&e.closeRegExp.test(n))return{indentAction:A_.IndentOutdent}}if(e>=2&&i.length>0)for(let o=0,s=this._brackets.length;o<s;o++){if(this._brackets[o].openRegExp.test(i))return{indentAction:A_.Indent}}return null}static _createOpenBracketRegExp(e){let t=Xo(e);return/\B/.test(t.charAt(0))||(t="\\b"+t),t+="\\s*$",wv._safeRegExp(t)}static _createCloseBracketRegExp(e){let t=Xo(e);return/\B/.test(t.charAt(t.length-1))||(t+="\\b"),t="^\\s*"+t,wv._safeRegExp(t)}static _safeRegExp(e){try{return new RegExp(e)}catch(t){return Jo(t),null}}}const Cv=L_("configurationService");function yv(e,t){const i=Object.create(null);for(let n in e)xv(i,n,e[n],t);return i}function xv(e,t,i,n){const o=t.split("."),s=o.pop();let r=e;for(let l=0;l<o.length;l++){let e=o[l],i=r[e];switch(typeof i){case"undefined":i=r[e]=Object.create(null);break;case"object":break;default:return void n(`Ignoring ${t} as ${o.slice(0,l+1).join(".")} is ${JSON.stringify(i)}`)}r=i}if("object"==typeof r&&null!==r)try{r[s]=i}catch(a){n(`Ignoring ${t} as ${o.join(".")} is ${JSON.stringify(r)}`)}else n(`Ignoring ${t} as ${o.join(".")} is ${JSON.stringify(r)}`)}function Sv(e,t){kv(e,t.split("."))}function kv(e,t){const i=t.shift();if(0!==t.length){if(-1!==Object.keys(e).indexOf(i)){const n=e[i];"object"!=typeof n||Array.isArray(n)||(kv(n,t),0===Object.keys(n).length&&delete e[i])}}else delete e[i]}function Dv(e,t,i){const n=function(e,t){let i=e;for(const n of t){if("object"!=typeof i||null===i)return;i=i[n]}return i}(e,t.split("."));return void 0===n?i:n}const Lv=L_("languageService");class Nv{constructor(e,t=[],i=!1){this.ctor=e,this.staticArguments=t,this.supportsDelayedInstantiation=i}}const Ev=[];function Iv(e,t,i){t instanceof Nv||(t=new Nv(t,[],i)),Ev.push([e,t])}function Tv(){return Ev}var Mv=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},Av=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};class Ov{constructor(e){this.languageId=e}affects(e){return!this.languageId||this.languageId===e}}const Rv=L_("languageConfigurationService");let Pv=class extends Uo{constructor(e,t){super(),this.configurationService=e,this.languageService=t,this.onDidChangeEmitter=this._register(new $o),this.onDidChange=this.onDidChangeEmitter.event,this.configurations=new Map;const i=new Set(Object.values(Fv));this._register(this.configurationService.onDidChangeConfiguration((e=>{const t=e.change.keys.some((e=>i.has(e))),n=e.change.overrides.filter((([e,t])=>t.some((e=>i.has(e))))).map((([e])=>e));if(t)this.configurations.clear(),this.onDidChangeEmitter.fire(new Ov(void 0));else for(const i of n)this.languageService.isRegisteredLanguageId(i)&&(this.configurations.delete(i),this.onDidChangeEmitter.fire(new Ov(i)))}))),this._register(Wv.onDidChange((e=>{this.configurations.delete(e.languageId),this.onDidChangeEmitter.fire(new Ov(e.languageId))})))}getLanguageConfiguration(e){let t=this.configurations.get(e);return t||(t=function(e,t,i){let n=Wv.getLanguageConfiguration(e);if(!n){if(!i.isRegisteredLanguageId(e))throw new Error(`Language id "${e}" is not configured nor known`);n=new Uv(e,{})}const o=function(e,t){const i=t.getValue(Fv.brackets,{overrideIdentifier:e}),n=t.getValue(Fv.colorizedBracketPairs,{overrideIdentifier:e});return{brackets:Bv(i),colorizedBracketPairs:Bv(n)}}(n.languageId,t),s=Hv([n.underlyingConfig,o]);return new Uv(n.languageId,s)}(e,this.configurationService,this.languageService),this.configurations.set(e,t)),t}};Pv=Mv([Av(0,Cv),Av(1,Lv)],Pv);const Fv={brackets:"editor.language.brackets",colorizedBracketPairs:"editor.language.colorizedBracketPairs"};function Bv(e){if(Array.isArray(e))return e.map((e=>{if(Array.isArray(e)&&2===e.length)return[e[0],e[1]]})).filter((e=>!!e))}class Vv{constructor(e){this.languageId=e}}const Wv=new class{constructor(){this._entries=new Map,this._onDidChange=new $o,this.onDidChange=this._onDidChange.event}register(e,t,i=0){let n=this._entries.get(e);n||(n=new zv(e),this._entries.set(e,n));const o=n.register(t,i);return this._onDidChange.fire(new Vv(e)),es((()=>{o.dispose(),this._onDidChange.fire(new Vv(e))}))}getLanguageConfiguration(e){const t=this._entries.get(e);return(null==t?void 0:t.getResolvedConfiguration())||null}getComments(e){const t=this.getLanguageConfiguration(e);return t&&t.comments||null}getIndentRulesSupport(e){const t=this.getLanguageConfiguration(e);return t&&t.indentRulesSupport||null}getPrecedingValidLine(e,t,i){const n=e.getLanguageIdAtPosition(t,0);if(t>1){let o,s=-1;for(o=t-1;o>=1;o--){if(e.getLanguageIdAtPosition(o,0)!==n)return s;const t=e.getLineContent(o);if(!i.shouldIgnore(t)&&!/^\s+$/.test(t)&&""!==t)return o;s=o}}return-1}getInheritIndentForLine(e,t,i,n=!0){if(e<4)return null;const o=this.getIndentRulesSupport(t.getLanguageId());if(!o)return null;if(i<=1)return{indentation:"",action:null};const s=this.getPrecedingValidLine(t,i,o);if(s<0)return null;if(s<1)return{indentation:"",action:null};const r=t.getLineContent(s);if(o.shouldIncrease(r)||o.shouldIndentNextLine(r))return{indentation:ts(r),action:A_.Indent,line:s};if(o.shouldDecrease(r))return{indentation:ts(r),action:null,line:s};{if(1===s)return{indentation:ts(t.getLineContent(s)),action:null,line:s};const e=s-1,i=o.getIndentMetadata(t.getLineContent(e));if(!(3&i)&&4&i){let i=0;for(let n=e-1;n>0;n--)if(!o.shouldIndentNextLine(t.getLineContent(n))){i=n;break}return{indentation:ts(t.getLineContent(i+1)),action:null,line:i+1}}if(n)return{indentation:ts(t.getLineContent(s)),action:null,line:s};for(let n=s;n>0;n--){const e=t.getLineContent(n);if(o.shouldIncrease(e))return{indentation:ts(e),action:A_.Indent,line:n};if(o.shouldIndentNextLine(e)){let e=0;for(let i=n-1;i>0;i--)if(!o.shouldIndentNextLine(t.getLineContent(n))){e=i;break}return{indentation:ts(t.getLineContent(e+1)),action:null,line:e+1}}if(o.shouldDecrease(e))return{indentation:ts(e),action:null,line:n}}return{indentation:ts(t.getLineContent(1)),action:null,line:1}}}getGoodIndentForLine(e,t,i,n,o){if(e<4)return null;const s=this.getLanguageConfiguration(i);if(!s)return null;const r=this.getIndentRulesSupport(i);if(!r)return null;const a=this.getInheritIndentForLine(e,t,n),l=t.getLineContent(n);if(a){const i=a.line;if(void 0!==i){const n=s.onEnter(e,"",t.getLineContent(i),"");if(n){let e=ts(t.getLineContent(i));return n.removeText&&(e=e.substring(0,e.length-n.removeText)),n.indentAction===A_.Indent||n.indentAction===A_.IndentOutdent?e=o.shiftIndent(e):n.indentAction===A_.Outdent&&(e=o.unshiftIndent(e)),r.shouldDecrease(l)&&(e=o.unshiftIndent(e)),n.appendText&&(e+=n.appendText),ts(e)}}return r.shouldDecrease(l)?a.action===A_.Indent?a.indentation:o.unshiftIndent(a.indentation):a.action===A_.Indent?o.shiftIndent(a.indentation):a.indentation}return null}getIndentForEnter(e,t,i,n){if(e<4)return null;t.forceTokenization(i.startLineNumber);const o=t.getLineTokens(i.startLineNumber),s=F_(o,i.startColumn-1),r=s.getLineContent();let a,l,d=!1;if(s.firstCharOffset>0&&o.getLanguageId(0)!==s.languageId?(d=!0,a=r.substr(0,i.startColumn-1-s.firstCharOffset)):a=o.getLineContent().substring(0,i.startColumn-1),i.isEmpty())l=r.substr(i.startColumn-1-s.firstCharOffset);else{l=this.getScopedLineTokens(t,i.endLineNumber,i.endColumn).getLineContent().substr(i.endColumn-1-s.firstCharOffset)}const c=this.getIndentRulesSupport(s.languageId);if(!c)return null;const h=a,u=ts(a),g={getLineTokens:e=>t.getLineTokens(e),getLanguageId:()=>t.getLanguageId(),getLanguageIdAtPosition:(e,i)=>t.getLanguageIdAtPosition(e,i),getLineContent:e=>e===i.startLineNumber?h:t.getLineContent(e)},p=ts(o.getLineContent()),m=this.getInheritIndentForLine(e,g,i.startLineNumber+1);if(!m){const e=d?p:u;return{beforeEnter:e,afterEnter:e}}let f=d?p:m.indentation;return m.action===A_.Indent&&(f=n.shiftIndent(f)),c.shouldDecrease(l)&&(f=n.unshiftIndent(f)),{beforeEnter:d?p:u,afterEnter:f}}getIndentActionForType(e,t,i,n,o){if(e<4)return null;const s=this.getScopedLineTokens(t,i.startLineNumber,i.startColumn);if(s.firstCharOffset)return null;const r=this.getIndentRulesSupport(s.languageId);if(!r)return null;const a=s.getLineContent(),l=a.substr(0,i.startColumn-1-s.firstCharOffset);let d;if(i.isEmpty())d=a.substr(i.startColumn-1-s.firstCharOffset);else{d=this.getScopedLineTokens(t,i.endLineNumber,i.endColumn).getLineContent().substr(i.endColumn-1-s.firstCharOffset)}if(!r.shouldDecrease(l+d)&&r.shouldDecrease(l+n+d)){const n=this.getInheritIndentForLine(e,t,i.startLineNumber,!1);if(!n)return null;let s=n.indentation;return n.action!==A_.Indent&&(s=o.unshiftIndent(s)),s}return null}getIndentMetadata(e,t){const i=this.getIndentRulesSupport(e.getLanguageId());return i?t<1||t>e.getLineCount()?null:i.getIndentMetadata(e.getLineContent(t)):null}getEnterAction(e,t,i){const n=this.getScopedLineTokens(t,i.startLineNumber,i.startColumn),o=this.getLanguageConfiguration(n.languageId);if(!o)return null;const s=n.getLineContent(),r=s.substr(0,i.startColumn-1-n.firstCharOffset);let a;if(i.isEmpty())a=s.substr(i.startColumn-1-n.firstCharOffset);else{a=this.getScopedLineTokens(t,i.endLineNumber,i.endColumn).getLineContent().substr(i.endColumn-1-n.firstCharOffset)}let l="";if(i.startLineNumber>1&&0===n.firstCharOffset){const e=this.getScopedLineTokens(t,i.startLineNumber-1);e.languageId===n.languageId&&(l=e.getLineContent())}const d=o.onEnter(e,l,r,a);if(!d)return null;const c=d.indentAction;let h=d.appendText;const u=d.removeText||0;h?c===A_.Indent&&(h="\t"+h):h=c===A_.Indent||c===A_.IndentOutdent?"\t":"";let g=this.getIndentationAtPosition(t,i.startLineNumber,i.startColumn);return u&&(g=g.substring(0,g.length-u)),{indentAction:c,appendText:h,removeText:u,indentation:g}}getIndentationAtPosition(e,t,i){const n=e.getLineContent(t);let o=ts(n);return o.length>i-1&&(o=o.substring(0,i-1)),o}getScopedLineTokens(e,t,i){e.forceTokenization(t);return F_(e.getLineTokens(t),void 0===i?e.getLineMaxColumn(t)-1:i-1)}};class zv{constructor(e){this.languageId=e,this._resolved=null,this._entries=[],this._order=0,this._resolved=null}register(e,t){const i=new jv(e,t,++this._order);return this._entries.push(i),this._resolved=null,es((()=>{for(let e=0;e<this._entries.length;e++)if(this._entries[e]===i){this._entries.splice(e,1),this._resolved=null;break}}))}getResolvedConfiguration(){if(!this._resolved){const e=this._resolve();e&&(this._resolved=new Uv(this.languageId,e))}return this._resolved}_resolve(){return 0===this._entries.length?null:(this._entries.sort(jv.cmp),Hv(this._entries.map((e=>e.configuration))))}}function Hv(e){let t={comments:void 0,brackets:void 0,wordPattern:void 0,indentationRules:void 0,onEnterRules:void 0,autoClosingPairs:void 0,surroundingPairs:void 0,autoCloseBefore:void 0,folding:void 0,colorizedBracketPairs:void 0,__electricCharacterSupport:void 0};for(const i of e)t={comments:i.comments||t.comments,brackets:i.brackets||t.brackets,wordPattern:i.wordPattern||t.wordPattern,indentationRules:i.indentationRules||t.indentationRules,onEnterRules:i.onEnterRules||t.onEnterRules,autoClosingPairs:i.autoClosingPairs||t.autoClosingPairs,surroundingPairs:i.surroundingPairs||t.surroundingPairs,autoCloseBefore:i.autoCloseBefore||t.autoCloseBefore,folding:i.folding||t.folding,colorizedBracketPairs:i.colorizedBracketPairs||t.colorizedBracketPairs,__electricCharacterSupport:i.__electricCharacterSupport||t.__electricCharacterSupport};return t}class jv{constructor(e,t,i){this.configuration=e,this.priority=t,this.order=i}static cmp(e,t){return e.priority===t.priority?e.order-t.order:e.priority-t.priority}}class Uv{constructor(e,t){this.languageId=e,this.underlyingConfig=t,this._brackets=null,this._electricCharacter=null,this._onEnterSupport=this.underlyingConfig.brackets||this.underlyingConfig.indentationRules||this.underlyingConfig.onEnterRules?new wv(this.underlyingConfig):null,this.comments=Uv._handleComments(this.underlyingConfig),this.characterPair=new W_(this.underlyingConfig),this.wordDefinition=this.underlyingConfig.wordPattern||is,this.indentationRules=this.underlyingConfig.indentationRules,this.underlyingConfig.indentationRules?this.indentRulesSupport=new bv(this.underlyingConfig.indentationRules):this.indentRulesSupport=null,this.foldingRules=this.underlyingConfig.folding||{}}getWordDefinition(){return ns(this.wordDefinition)}get brackets(){return!this._brackets&&this.underlyingConfig.brackets&&(this._brackets=new dv(this.languageId,this.underlyingConfig.brackets)),this._brackets}get electricCharacter(){return this._electricCharacter||(this._electricCharacter=new _v(this.brackets)),this._electricCharacter}onEnter(e,t,i,n){return this._onEnterSupport?this._onEnterSupport.onEnter(e,t,i,n):null}getAutoClosingPairs(){return new R_(this.characterPair.getAutoClosingPairs())}getAutoCloseBeforeSet(){return this.characterPair.getAutoCloseBeforeSet()}getSurroundingPairs(){return this.characterPair.getSurroundingPairs()}static _handleComments(e){const t=e.comments;if(!t)return null;const i={};if(t.lineComment&&(i.lineCommentToken=t.lineComment),t.blockComment){const[e,n]=t.blockComment;i.blockCommentStartToken=e,i.blockCommentEndToken=n}return i}}Iv(Rv,Pv);const $v=new class{clone(){return this}equals(e){return this===e}};function Kv(e,t){return new ss([new rs(0,"",e)],t)}function qv(e,t){const i=new Uint32Array(2);return i[0]=0,i[1]=(16384|e<<0|2<<23)>>>0,new os(i,null===t?$v:t)}const Gv=L_("modelService");var Zv=globalThis&&globalThis.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{l(n.next(e))}catch(t){s(t)}}function a(e){try{l(n.throw(e))}catch(t){s(t)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}l((n=n.apply(e,t||[])).next())}))},Yv=globalThis&&globalThis.__asyncValues||function(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,i=e[Symbol.asyncIterator];return i?i.call(e):(e="function"==typeof __values?__values(e):e[Symbol.iterator](),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(i){t[i]=e[i]&&function(t){return new Promise((function(n,o){(function(e,t,i,n){Promise.resolve(n).then((function(t){e({value:t,done:i})}),t)})(n,o,(t=e[i](t)).done,t.value)}))}}};function Xv(e){const t=new as,i=e(t.token),n=new Promise(((e,n)=>{const o=t.token.onCancellationRequested((()=>{o.dispose(),t.dispose(),n(new ls)}));Promise.resolve(i).then((i=>{o.dispose(),t.dispose(),e(i)}),(e=>{o.dispose(),t.dispose(),n(e)}))}));return new class{cancel(){t.cancel()}then(e,t){return n.then(e,t)}catch(e){return this.then(void 0,e)}finally(e){return n.finally(e)}}}function Qv(e,t,i){return new Promise(((n,o)=>{const s=t.onCancellationRequested((()=>{s.dispose(),n(i)}));e.then(n,o).finally((()=>s.dispose()))}))}class Jv{constructor(){this.activePromise=null,this.queuedPromise=null,this.queuedPromiseFactory=null}queue(e){if(this.activePromise){if(this.queuedPromiseFactory=e,!this.queuedPromise){const e=()=>{this.queuedPromise=null;const e=this.queue(this.queuedPromiseFactory);return this.queuedPromiseFactory=null,e};this.queuedPromise=new Promise((t=>{this.activePromise.then(e,e).then(t)}))}return new Promise(((e,t)=>{this.queuedPromise.then(e,t)}))}return this.activePromise=e(),new Promise(((e,t)=>{this.activePromise.then((t=>{this.activePromise=null,e(t)}),(e=>{this.activePromise=null,t(e)}))}))}}const eb=Symbol("MicrotaskDelay");class tb{constructor(e){this.defaultDelay=e,this.deferred=null,this.completionPromise=null,this.doResolve=null,this.doReject=null,this.task=null}trigger(e,t=this.defaultDelay){this.task=e,this.cancelTimeout(),this.completionPromise||(this.completionPromise=new Promise(((e,t)=>{this.doResolve=e,this.doReject=t})).then((()=>{if(this.completionPromise=null,this.doResolve=null,this.task){const e=this.task;return this.task=null,e()}})));const i=()=>{var e;this.deferred=null,null===(e=this.doResolve)||void 0===e||e.call(this,null)};return this.deferred=t===eb?(e=>{let t=!0;return queueMicrotask((()=>{t&&(t=!1,e())})),{isTriggered:()=>t,dispose:()=>{t=!1}}})(i):((e,t)=>{let i=!0;const n=setTimeout((()=>{i=!1,t()}),e);return{isTriggered:()=>i,dispose:()=>{clearTimeout(n),i=!1}}})(t,i),this.completionPromise}isTriggered(){var e;return!!(null===(e=this.deferred)||void 0===e?void 0:e.isTriggered())}cancel(){this.cancelTimeout(),this.completionPromise&&(this.doReject&&this.doReject(new ls),this.completionPromise=null)}cancelTimeout(){var e;null===(e=this.deferred)||void 0===e||e.dispose(),this.deferred=null}dispose(){this.cancel()}}class ib{constructor(e){this.delayer=new tb(e),this.throttler=new Jv}trigger(e,t){return this.delayer.trigger((()=>this.throttler.queue(e)),t)}dispose(){this.delayer.dispose()}}function nb(e,t){return t?new Promise(((i,n)=>{const o=setTimeout((()=>{s.dispose(),i()}),e),s=t.onCancellationRequested((()=>{clearTimeout(o),s.dispose(),n(new ls)}))})):Xv((t=>nb(e,t)))}function ob(e,t=0){const i=setTimeout(e,t);return es((()=>clearTimeout(i)))}function sb(e,t=(e=>!!e),i=null){let n=0;const o=e.length,s=()=>{if(n>=o)return Promise.resolve(i);const r=e[n++];return Promise.resolve(r()).then((e=>t(e)?Promise.resolve(e):s()))};return s()}class rb{constructor(e,t){this._token=-1,"function"==typeof e&&"number"==typeof t&&this.setIfNotSet(e,t)}dispose(){this.cancel()}cancel(){-1!==this._token&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,t){this.cancel(),this._token=setTimeout((()=>{this._token=-1,e()}),t)}setIfNotSet(e,t){-1===this._token&&(this._token=setTimeout((()=>{this._token=-1,e()}),t))}}class ab{constructor(){this._token=-1}dispose(){this.cancel()}cancel(){-1!==this._token&&(clearInterval(this._token),this._token=-1)}cancelAndSet(e,t){this.cancel(),this._token=setInterval((()=>{e()}),t)}}class lb{constructor(e,t){this.timeoutToken=-1,this.runner=e,this.timeout=t,this.timeoutHandler=this.onTimeout.bind(this)}dispose(){this.cancel(),this.runner=null}cancel(){this.isScheduled()&&(clearTimeout(this.timeoutToken),this.timeoutToken=-1)}schedule(e=this.timeout){this.cancel(),this.timeoutToken=setTimeout(this.timeoutHandler,e)}get delay(){return this.timeout}set delay(e){this.timeout=e}isScheduled(){return-1!==this.timeoutToken}onTimeout(){this.timeoutToken=-1,this.runner&&this.doRun()}doRun(){this.runner&&this.runner()}}let db;db="function"!=typeof requestIdleCallback||"function"!=typeof cancelIdleCallback?e=>{cs((()=>{if(t)return;const i=Date.now()+15;e(Object.freeze({didTimeout:!0,timeRemaining:()=>Math.max(0,i-Date.now())}))}));let t=!1;return{dispose(){t||(t=!0)}}}:(e,t)=>{const i=requestIdleCallback(e,"number"==typeof t?{timeout:t}:void 0);let n=!1;return{dispose(){n||(n=!0,cancelIdleCallback(i))}}};class cb{constructor(e){this._didRun=!1,this._executor=()=>{try{this._value=e()}catch(t){this._error=t}finally{this._didRun=!0}},this._handle=db((()=>this._executor()))}dispose(){this._handle.dispose()}get value(){if(this._didRun||(this._handle.dispose(),this._executor()),this._error)throw this._error;return this._value}get isInitialized(){return this._didRun}}class hb{constructor(){this.rejected=!1,this.resolved=!1,this.p=new Promise(((e,t)=>{this.completeCallback=e,this.errorCallback=t}))}get isRejected(){return this.rejected}get isSettled(){return this.rejected||this.resolved}complete(e){return new Promise((t=>{this.completeCallback(e),this.resolved=!0,t()}))}cancel(){new Promise((e=>{this.errorCallback(new ls),this.rejected=!0,e()}))}}var ub,gb;!function(e){e.settled=function(e){return Zv(this,void 0,void 0,(function*(){let t;const i=yield Promise.all(e.map((e=>e.then((e=>e),(e=>{t||(t=e)})))));if(void 0!==t)throw t;return i}))},e.withAsyncBody=function(e){return new Promise(((t,i)=>Zv(this,void 0,void 0,(function*(){try{yield e(t,i)}catch(n){i(n)}}))))}}(ub||(ub={}));class pb{constructor(e){this._state=0,this._results=[],this._error=null,this._onStateChanged=new $o,queueMicrotask((()=>Zv(this,void 0,void 0,(function*(){const t={emitOne:e=>this.emitOne(e),emitMany:e=>this.emitMany(e),reject:e=>this.reject(e)};try{yield Promise.resolve(e(t)),this.resolve()}catch(i){this.reject(i)}finally{t.emitOne=void 0,t.emitMany=void 0,t.reject=void 0}}))))}static fromArray(e){return new pb((t=>{t.emitMany(e)}))}static fromPromise(e){return new pb((t=>Zv(this,void 0,void 0,(function*(){t.emitMany(yield e)}))))}static fromPromises(e){return new pb((t=>Zv(this,void 0,void 0,(function*(){yield Promise.all(e.map((e=>Zv(this,void 0,void 0,(function*(){return t.emitOne(yield e)})))))}))))}static merge(e){return new pb((t=>Zv(this,void 0,void 0,(function*(){yield Promise.all(e.map((e=>{var i,n;return Zv(this,void 0,void 0,(function*(){var o,s;try{for(i=Yv(e);!(n=yield i.next()).done;){const e=n.value;t.emitOne(e)}}catch(r){o={error:r}}finally{try{n&&!n.done&&(s=i.return)&&(yield s.call(i))}finally{if(o)throw o.error}}}))})))}))))}[Symbol.asyncIterator](){let e=0;return{next:()=>Zv(this,void 0,void 0,(function*(){for(;;){if(2===this._state)throw this._error;if(e<this._results.length)return{done:!1,value:this._results[e++]};if(1===this._state)return{done:!0,value:void 0};yield ds.toPromise(this._onStateChanged.event)}}))}}static map(e,t){return new pb((i=>Zv(this,void 0,void 0,(function*(){var n,o;try{for(var s,r=Yv(e);!(s=yield r.next()).done;){const e=s.value;i.emitOne(t(e))}}catch(a){n={error:a}}finally{try{s&&!s.done&&(o=r.return)&&(yield o.call(r))}finally{if(n)throw n.error}}}))))}map(e){return pb.map(this,e)}static filter(e,t){return new pb((i=>Zv(this,void 0,void 0,(function*(){var n,o;try{for(var s,r=Yv(e);!(s=yield r.next()).done;){const e=s.value;t(e)&&i.emitOne(e)}}catch(a){n={error:a}}finally{try{s&&!s.done&&(o=r.return)&&(yield o.call(r))}finally{if(n)throw n.error}}}))))}filter(e){return pb.filter(this,e)}static coalesce(e){return pb.filter(e,(e=>!!e))}coalesce(){return pb.coalesce(this)}static toPromise(e){var t,i,n,o;return Zv(this,void 0,void 0,(function*(){const s=[];try{for(t=Yv(e);!(i=yield t.next()).done;){const e=i.value;s.push(e)}}catch(r){n={error:r}}finally{try{i&&!i.done&&(o=t.return)&&(yield o.call(t))}finally{if(n)throw n.error}}return s}))}toPromise(){return pb.toPromise(this)}emitOne(e){0===this._state&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){0===this._state&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){0===this._state&&(this._state=1,this._onStateChanged.fire())}reject(e){0===this._state&&(this._state=2,this._error=e,this._onStateChanged.fire())}}pb.EMPTY=pb.fromArray([]);class mb extends pb{constructor(e,t){super(t),this._source=e}cancel(){this._source.cancel()}}const fb=null===(gb=window.trustedTypes)||void 0===gb?void 0:gb.createPolicy("defaultWorkerFactory",{createScriptURL:e=>e});class _b{constructor(e,t,i,n,o){this.id=t;const s=function(e){if(us.MonacoEnvironment){if("function"==typeof us.MonacoEnvironment.getWorker)return us.MonacoEnvironment.getWorker("workerMain.js",e);if("function"==typeof us.MonacoEnvironment.getWorkerUrl){const t=us.MonacoEnvironment.getWorkerUrl("workerMain.js",e);return new Worker(fb?fb.createScriptURL(t):t,{name:e})}}throw new Error("You must define a function MonacoEnvironment.getWorkerUrl or MonacoEnvironment.getWorker")}(i);"function"==typeof s.then?this.worker=s:this.worker=Promise.resolve(s),this.postMessage(e,[]),this.worker.then((e=>{e.onmessage=function(e){n(e.data)},e.onmessageerror=o,"function"==typeof e.addEventListener&&e.addEventListener("error",o)}))}getId(){return this.id}postMessage(e,t){this.worker&&this.worker.then((i=>i.postMessage(e,t)))}dispose(){this.worker&&this.worker.then((e=>e.terminate())),this.worker=null}}class vb{constructor(e){this._label=e,this._webWorkerFailedBeforeError=!1}create(e,t,i){let n=++vb.LAST_WORKER_ID;if(this._webWorkerFailedBeforeError)throw this._webWorkerFailedBeforeError;return new _b(e,n,this._label||"anonymous"+n,t,(e=>{hs(e),this._webWorkerFailedBeforeError=e,i(e)}))}}vb.LAST_WORKER_ID=0;const bb=L_("textResourceConfigurationService"),wb=L_("textResourcePropertiesService"),Cb=L_("logService");var yb;!function(e){e[e.Trace=0]="Trace",e[e.Debug=1]="Debug",e[e.Info=2]="Info",e[e.Warning=3]="Warning",e[e.Error=4]="Error",e[e.Critical=5]="Critical",e[e.Off=6]="Off"}(yb||(yb={}));const xb=yb.Info;class Sb extends Uo{constructor(){super(...arguments),this.level=xb,this._onDidChangeLogLevel=this._register(new $o)}setLevel(e){this.level!==e&&(this.level=e,this._onDidChangeLogLevel.fire(this.level))}getLevel(){return this.level}}class kb extends Sb{constructor(e=xb){super(),this.setLevel(e)}trace(e,...t){this.getLevel(),yb.Trace}debug(e,...t){this.getLevel(),yb.Debug}info(e,...t){this.getLevel(),yb.Info}error(e,...t){this.getLevel(),yb.Error}dispose(){}}class Db extends Uo{constructor(e){super(),this.logger=e,this._register(e)}getLevel(){return this.logger.getLevel()}trace(e,...t){this.logger.trace(e,...t)}debug(e,...t){this.logger.debug(e,...t)}info(e,...t){this.logger.info(e,...t)}error(e,...t){this.logger.error(e,...t)}}const Lb=L_("ILanguageFeaturesService");var Nb=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},Eb=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}},Ib=globalThis&&globalThis.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{l(n.next(e))}catch(t){s(t)}}function a(e){try{l(n.throw(e))}catch(t){s(t)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}l((n=n.apply(e,t||[])).next())}))};const Tb=3e5;function Mb(e,t){const i=e.getModel(t);return!!i&&!i.isTooLargeForSyncing()}let Ab=class extends Uo{constructor(e,t,i,n,o){super(),this._modelService=e,this._workerManager=this._register(new Rb(this._modelService,n)),this._logService=i,this._register(o.linkProvider.register({language:"*",hasAccessToAllModels:!0},{provideLinks:(e,t)=>Mb(this._modelService,e.uri)?this._workerManager.withWorker().then((t=>t.computeLinks(e.uri))).then((e=>e&&{links:e})):Promise.resolve({links:[]})})),this._register(o.completionProvider.register("*",new Ob(this._workerManager,t,this._modelService,n)))}dispose(){super.dispose()}canComputeUnicodeHighlights(e){return Mb(this._modelService,e)}computedUnicodeHighlights(e,t,i){return this._workerManager.withWorker().then((n=>n.computedUnicodeHighlights(e,t,i)))}computeDiff(e,t,i,n){return this._workerManager.withWorker().then((o=>o.computeDiff(e,t,i,n)))}computeMoreMinimalEdits(e,t){if(gs(t)){if(!Mb(this._modelService,e))return Promise.resolve(t);const i=ps.create(!0),n=this._workerManager.withWorker().then((i=>i.computeMoreMinimalEdits(e,t)));return n.finally((()=>this._logService.trace("FORMAT#computeMoreMinimalEdits",e.toString(!0),i.elapsed()))),Promise.race([n,nb(1e3).then((()=>t))])}return Promise.resolve(void 0)}canNavigateValueSet(e){return Mb(this._modelService,e)}navigateValueSet(e,t,i){return this._workerManager.withWorker().then((n=>n.navigateValueSet(e,t,i)))}canComputeWordRanges(e){return Mb(this._modelService,e)}computeWordRanges(e,t){return this._workerManager.withWorker().then((i=>i.computeWordRanges(e,t)))}};Ab=Nb([Eb(0,Gv),Eb(1,bb),Eb(2,Cb),Eb(3,Rv),Eb(4,Lb)],Ab);class Ob{constructor(e,t,i,n){this.languageConfigurationService=n,this._debugDisplayName="wordbasedCompletions",this._workerManager=e,this._configurationService=t,this._modelService=i}provideCompletionItems(e,t){return Ib(this,void 0,void 0,(function*(){const i=this._configurationService.getValue(e.uri,t,"editor");if(!i.wordBasedSuggestions)return;const n=[];if("currentDocument"===i.wordBasedSuggestionsMode)Mb(this._modelService,e.uri)&&n.push(e.uri);else for(const t of this._modelService.getModels())Mb(this._modelService,t.uri)&&(t===e?n.unshift(t.uri):"allDocuments"!==i.wordBasedSuggestionsMode&&t.getLanguageId()!==e.getLanguageId()||n.push(t.uri));if(0===n.length)return;const o=this.languageConfigurationService.getLanguageConfiguration(e.getLanguageId()).getWordDefinition(),s=e.getWordAtPosition(t),r=s?new qo(t.lineNumber,s.startColumn,t.lineNumber,s.endColumn):qo.fromPositions(t),a=r.setEndPosition(t.lineNumber,t.column),l=yield this._workerManager.withWorker(),d=yield l.textualSuggest(n,null==s?void 0:s.word,o);return d?{duration:d.duration,suggestions:d.words.map((e=>({kind:18,label:e,insertText:e,range:{insert:a,replace:r}})))}:void 0}))}}class Rb extends Uo{constructor(e,t){super(),this.languageConfigurationService=t,this._modelService=e,this._editorWorkerClient=null,this._lastWorkerUsedTime=(new Date).getTime();this._register(new ab).cancelAndSet((()=>this._checkStopIdleWorker()),Math.round(15e4)),this._register(this._modelService.onModelRemoved((e=>this._checkStopEmptyWorker())))}dispose(){this._editorWorkerClient&&(this._editorWorkerClient.dispose(),this._editorWorkerClient=null),super.dispose()}_checkStopEmptyWorker(){if(!this._editorWorkerClient)return;0===this._modelService.getModels().length&&(this._editorWorkerClient.dispose(),this._editorWorkerClient=null)}_checkStopIdleWorker(){if(!this._editorWorkerClient)return;(new Date).getTime()-this._lastWorkerUsedTime>Tb&&(this._editorWorkerClient.dispose(),this._editorWorkerClient=null)}withWorker(){return this._lastWorkerUsedTime=(new Date).getTime(),this._editorWorkerClient||(this._editorWorkerClient=new Vb(this._modelService,!1,"editorWorkerService",this.languageConfigurationService)),Promise.resolve(this._editorWorkerClient)}}class Pb extends Uo{constructor(e,t,i){if(super(),this._syncedModels=Object.create(null),this._syncedModelsLastUsedTime=Object.create(null),this._proxy=e,this._modelService=t,!i){const e=new ab;e.cancelAndSet((()=>this._checkStopModelSync()),Math.round(3e4)),this._register(e)}}dispose(){for(let e in this._syncedModels)bs(this._syncedModels[e]);this._syncedModels=Object.create(null),this._syncedModelsLastUsedTime=Object.create(null),super.dispose()}ensureSyncedResources(e,t){for(const i of e){const e=i.toString();this._syncedModels[e]||this._beginModelSync(i,t),this._syncedModels[e]&&(this._syncedModelsLastUsedTime[e]=(new Date).getTime())}}_checkStopModelSync(){const e=(new Date).getTime(),t=[];for(let i in this._syncedModelsLastUsedTime){e-this._syncedModelsLastUsedTime[i]>6e4&&t.push(i)}for(const i of t)this._stopModelSync(i)}_beginModelSync(e,t){const i=this._modelService.getModel(e);if(!i)return;if(!t&&i.isTooLargeForSyncing())return;const n=e.toString();this._proxy.acceptNewModel({url:i.uri.toString(),lines:i.getLinesContent(),EOL:i.getEOL(),versionId:i.getVersionId()});const o=new ws;o.add(i.onDidChangeContent((e=>{this._proxy.acceptModelChanged(n.toString(),e)}))),o.add(i.onWillDispose((()=>{this._stopModelSync(n)}))),o.add(es((()=>{this._proxy.acceptRemovedModel(n)}))),this._syncedModels[n]=o}_stopModelSync(e){const t=this._syncedModels[e];delete this._syncedModels[e],delete this._syncedModelsLastUsedTime[e],bs(t)}}class Fb{constructor(e){this._instance=e,this._proxyObj=Promise.resolve(this._instance)}dispose(){this._instance.dispose()}getProxyObject(){return this._proxyObj}}class Bb{constructor(e){this._workerClient=e}fhr(e,t){return this._workerClient.fhr(e,t)}}class Vb extends Uo{constructor(e,t,i,n){super(),this.languageConfigurationService=n,this._disposed=!1,this._modelService=e,this._keepIdleModels=t,this._workerFactory=new vb(i),this._worker=null,this._modelManager=null}fhr(e,t){throw new Error("Not implemented!")}_getOrCreateWorker(){if(!this._worker)try{this._worker=this._register(new ms(this._workerFactory,"vs/editor/common/services/editorSimpleWorker",new Bb(this)))}catch(e){hs(e),this._worker=new Fb(new fs(new Bb(this),null))}return this._worker}_getProxy(){return this._getOrCreateWorker().getProxyObject().then(void 0,(e=>(hs(e),this._worker=new Fb(new fs(new Bb(this),null)),this._getOrCreateWorker().getProxyObject())))}_getOrCreateModelManager(e){return this._modelManager||(this._modelManager=this._register(new Pb(e,this._modelService,this._keepIdleModels))),this._modelManager}_withSyncedResources(e,t=!1){return Ib(this,void 0,void 0,(function*(){return this._disposed?Promise.reject(_s()):this._getProxy().then((i=>(this._getOrCreateModelManager(i).ensureSyncedResources(e,t),i)))}))}computedUnicodeHighlights(e,t,i){return this._withSyncedResources([e]).then((n=>n.computeUnicodeHighlights(e.toString(),t,i)))}computeDiff(e,t,i,n){return this._withSyncedResources([e,t],!0).then((o=>o.computeDiff(e.toString(),t.toString(),i,n)))}computeMoreMinimalEdits(e,t){return this._withSyncedResources([e]).then((i=>i.computeMoreMinimalEdits(e.toString(),t)))}computeLinks(e){return this._withSyncedResources([e]).then((t=>t.computeLinks(e.toString())))}textualSuggest(e,t,i){return Ib(this,void 0,void 0,(function*(){const n=yield this._withSyncedResources(e),o=i.source,s=vs(i);return n.textualSuggest(e.map((e=>e.toString())),t,o,s)}))}computeWordRanges(e,t){return this._withSyncedResources([e]).then((i=>{const n=this._modelService.getModel(e);if(!n)return Promise.resolve(null);const o=this.languageConfigurationService.getLanguageConfiguration(n.getLanguageId()).getWordDefinition(),s=o.source,r=vs(o);return i.computeWordRanges(e.toString(),t,s,r)}))}navigateValueSet(e,t,i){return this._withSyncedResources([e]).then((n=>{const o=this._modelService.getModel(e);if(!o)return null;const s=this.languageConfigurationService.getLanguageConfiguration(o.getLanguageId()).getWordDefinition(),r=s.source,a=vs(s);return n.navigateValueSet(e.toString(),t,i,r,a)}))}dispose(){super.dispose(),this._disposed=!0}}class Wb extends Vb{constructor(e,t,i){super(e,i.keepIdleModels||!1,i.label,t),this._foreignModuleId=i.moduleId,this._foreignModuleCreateData=i.createData||null,this._foreignModuleHost=i.host||null,this._foreignProxy=null}fhr(e,t){if(!this._foreignModuleHost||"function"!=typeof this._foreignModuleHost[e])return Promise.reject(new Error("Missing method "+e+" or missing main thread foreign host."));try{return Promise.resolve(this._foreignModuleHost[e].apply(this._foreignModuleHost,t))}catch(i){return Promise.reject(i)}}_getForeignProxy(){return this._foreignProxy||(this._foreignProxy=this._getProxy().then((e=>{const t=this._foreignModuleHost?Cs(this._foreignModuleHost):[];return e.loadForeignModule(this._foreignModuleId,this._foreignModuleCreateData,t).then((t=>{this._foreignModuleCreateData=null;const i=(t,i)=>e.fmr(t,i),n=(e,t)=>function(){const i=Array.prototype.slice.call(arguments,0);return t(e,i)},o={};for(const e of t)o[e]=n(e,i);return o}))}))),this._foreignProxy}getProxy(){return this._getForeignProxy()}withSyncedResources(e){return this._withSyncedResources(e).then((e=>this.getProxy()))}}class zb{constructor(e,t,i){this._lineTokensBrand=void 0,this._tokens=e,this._tokensCount=this._tokens.length>>>1,this._text=t,this._languageIdCodec=i}static createEmpty(e,t){const i=zb.defaultTokenMetadata,n=new Uint32Array(2);return n[0]=e.length,n[1]=i,new zb(n,e,t)}equals(e){return e instanceof zb&&this.slicedEquals(e,0,this._tokensCount)}slicedEquals(e,t,i){if(this._text!==e._text)return!1;if(this._tokensCount!==e._tokensCount)return!1;const n=t<<1,o=n+(i<<1);for(let s=n;s<o;s++)if(this._tokens[s]!==e._tokens[s])return!1;return!0}getLineContent(){return this._text}getCount(){return this._tokensCount}getStartOffset(e){return e>0?this._tokens[e-1<<1]:0}getMetadata(e){return this._tokens[1+(e<<1)]}getLanguageId(e){const t=this._tokens[1+(e<<1)],i=ys.getLanguageId(t);return this._languageIdCodec.decodeLanguageId(i)}getStandardTokenType(e){const t=this._tokens[1+(e<<1)];return ys.getTokenType(t)}getForeground(e){const t=this._tokens[1+(e<<1)];return ys.getForeground(t)}getClassName(e){const t=this._tokens[1+(e<<1)];return ys.getClassNameFromMetadata(t)}getInlineStyle(e,t){const i=this._tokens[1+(e<<1)];return ys.getInlineStyleFromMetadata(i,t)}getPresentation(e){const t=this._tokens[1+(e<<1)];return ys.getPresentationFromMetadata(t)}getEndOffset(e){return this._tokens[e<<1]}findTokenIndexAtOffset(e){return zb.findIndexInTokensArray(this._tokens,e)}inflate(){return this}sliceAndInflate(e,t,i){return new Hb(this,e,t,i)}static convertToEndOffset(e,t){const i=(e.length>>>1)-1;for(let n=0;n<i;n++)e[n<<1]=e[n+1<<1];e[i<<1]=t}static findIndexInTokensArray(e,t){if(e.length<=2)return 0;let i=0,n=(e.length>>>1)-1;for(;i<n;){const o=i+Math.floor((n-i)/2),s=e[o<<1];if(s===t)return o+1;s<t?i=o+1:s>t&&(n=o)}return i}withInserted(e){if(0===e.length)return this;let t=0,i=0,n="";const o=new Array;let s=0;for(;;){const r=t<this._tokensCount?this._tokens[t<<1]:-1,a=i<e.length?e[i]:null;if(-1!==r&&(null===a||r<=a.offset)){n+=this._text.substring(s,r);const e=this._tokens[1+(t<<1)];o.push(n.length,e),t++,s=r}else{if(!a)break;if(a.offset>s){n+=this._text.substring(s,a.offset);const e=this._tokens[1+(t<<1)];o.push(n.length,e),s=a.offset}n+=a.text,o.push(n.length,a.tokenMetadata),i++}}return new zb(new Uint32Array(o),n,this._languageIdCodec)}}zb.defaultTokenMetadata=16793600;class Hb{constructor(e,t,i,n){this._source=e,this._startOffset=t,this._endOffset=i,this._deltaOffset=n,this._firstTokenIndex=e.findTokenIndexAtOffset(t),this._tokensCount=0;for(let o=this._firstTokenIndex,s=e.getCount();o<s;o++){if(e.getStartOffset(o)>=i)break;this._tokensCount++}}getMetadata(e){return this._source.getMetadata(this._firstTokenIndex+e)}getLanguageId(e){return this._source.getLanguageId(this._firstTokenIndex+e)}getLineContent(){return this._source.getLineContent().substring(this._startOffset,this._endOffset)}equals(e){return e instanceof Hb&&(this._startOffset===e._startOffset&&this._endOffset===e._endOffset&&this._deltaOffset===e._deltaOffset&&this._source.slicedEquals(e._source,this._firstTokenIndex,this._tokensCount))}getCount(){return this._tokensCount}getForeground(e){return this._source.getForeground(this._firstTokenIndex+e)}getEndOffset(e){const t=this._source.getEndOffset(this._firstTokenIndex+e);return Math.min(this._endOffset,t)-this._startOffset+this._deltaOffset}getClassName(e){return this._source.getClassName(this._firstTokenIndex+e)}getInlineStyle(e,t){return this._source.getInlineStyle(this._firstTokenIndex+e,t)}getPresentation(e){return this._source.getPresentation(this._firstTokenIndex+e)}findTokenIndexAtOffset(e){return this._source.findTokenIndexAtOffset(e+this._startOffset-this._deltaOffset)-this._firstTokenIndex}}class jb{constructor(e,t,i,n){this.startColumn=e,this.endColumn=t,this.className=i,this.type=n,this._lineDecorationBrand=void 0}static _equals(e,t){return e.startColumn===t.startColumn&&e.endColumn===t.endColumn&&e.className===t.className&&e.type===t.type}static equalsArr(e,t){const i=e.length;if(i!==t.length)return!1;for(let n=0;n<i;n++)if(!jb._equals(e[n],t[n]))return!1;return!0}static extractWrapped(e,t,i){if(0===e.length)return e;const n=t+1,o=i+1,s=i-t,r=[];let a=0;for(const l of e)l.endColumn<=n||l.startColumn>=o||(r[a++]=new jb(Math.max(1,l.startColumn-n+1),Math.min(s+1,l.endColumn-n+1),l.className,l.type));return r}static filter(e,t,i,n){if(0===e.length)return[];const o=[];let s=0;for(let r=0,a=e.length;r<a;r++){const a=e[r],l=a.range;if(l.endLineNumber<t||l.startLineNumber>t)continue;if(l.isEmpty()&&(0===a.type||3===a.type))continue;const d=l.startLineNumber===t?l.startColumn:i,c=l.endLineNumber===t?l.endColumn:n;o[s++]=new jb(d,c,a.inlineClassName,a.type)}return o}static _typeCompare(e,t){const i=[2,0,1,3];return i[e]-i[t]}static compare(e,t){if(e.startColumn!==t.startColumn)return e.startColumn-t.startColumn;if(e.endColumn!==t.endColumn)return e.endColumn-t.endColumn;const i=jb._typeCompare(e.type,t.type);return 0!==i?i:e.className!==t.className?e.className<t.className?-1:1:0}}class Ub{constructor(e,t,i,n){this.startOffset=e,this.endOffset=t,this.className=i,this.metadata=n}}class $b{constructor(){this.stopOffsets=[],this.classNames=[],this.metadata=[],this.count=0}static _metadata(e){let t=0;for(let i=0,n=e.length;i<n;i++)t|=e[i];return t}consumeLowerThan(e,t,i){for(;this.count>0&&this.stopOffsets[0]<e;){let e=0;for(;e+1<this.count&&this.stopOffsets[e]===this.stopOffsets[e+1];)e++;i.push(new Ub(t,this.stopOffsets[e],this.classNames.join(" "),$b._metadata(this.metadata))),t=this.stopOffsets[e]+1,this.stopOffsets.splice(0,e+1),this.classNames.splice(0,e+1),this.metadata.splice(0,e+1),this.count-=e+1}return this.count>0&&t<e&&(i.push(new Ub(t,e-1,this.classNames.join(" "),$b._metadata(this.metadata))),t=e),t}insert(e,t,i){if(0===this.count||this.stopOffsets[this.count-1]<=e)this.stopOffsets.push(e),this.classNames.push(t),this.metadata.push(i);else for(let n=0;n<this.count;n++)if(this.stopOffsets[n]>=e){this.stopOffsets.splice(n,0,e),this.classNames.splice(n,0,t),this.metadata.splice(n,0,i);break}this.count++}}class Kb{constructor(e,t,i){this._linePartBrand=void 0,this.endIndex=e,this.type=t,this.metadata=i}isWhitespace(){return!!(1&this.metadata)}isPseudoAfter(){return!!(4&this.metadata)}}class qb{constructor(e,t){this.startOffset=e,this.endOffset=t}equals(e){return this.startOffset===e.startOffset&&this.endOffset===e.endOffset}}class Gb{constructor(e,t,i,n,o,s,r,a,l,d,c,h,u,g,p,m,f,_,v){this.useMonospaceOptimizations=e,this.canUseHalfwidthRightwardsArrow=t,this.lineContent=i,this.continuesWithWrappedLine=n,this.isBasicASCII=o,this.containsRTL=s,this.fauxIndentLength=r,this.lineTokens=a,this.lineDecorations=l.sort(jb.compare),this.tabSize=d,this.startVisibleColumn=c,this.spaceWidth=h,this.stopRenderingLineAfter=p,this.renderWhitespace="all"===m?4:"boundary"===m?1:"selection"===m?2:"trailing"===m?3:0,this.renderControlCharacters=f,this.fontLigatures=_,this.selectionsOnLine=v&&v.sort(((e,t)=>e.startOffset<t.startOffset?-1:1));Math.abs(g-h)<Math.abs(u-h)?(this.renderSpaceWidth=g,this.renderSpaceCharCode=11825):(this.renderSpaceWidth=u,this.renderSpaceCharCode=183)}sameSelection(e){if(null===this.selectionsOnLine)return null===e;if(null===e)return!1;if(e.length!==this.selectionsOnLine.length)return!1;for(let t=0;t<this.selectionsOnLine.length;t++)if(!this.selectionsOnLine[t].equals(e[t]))return!1;return!0}equals(e){return this.useMonospaceOptimizations===e.useMonospaceOptimizations&&this.canUseHalfwidthRightwardsArrow===e.canUseHalfwidthRightwardsArrow&&this.lineContent===e.lineContent&&this.continuesWithWrappedLine===e.continuesWithWrappedLine&&this.isBasicASCII===e.isBasicASCII&&this.containsRTL===e.containsRTL&&this.fauxIndentLength===e.fauxIndentLength&&this.tabSize===e.tabSize&&this.startVisibleColumn===e.startVisibleColumn&&this.spaceWidth===e.spaceWidth&&this.renderSpaceWidth===e.renderSpaceWidth&&this.renderSpaceCharCode===e.renderSpaceCharCode&&this.stopRenderingLineAfter===e.stopRenderingLineAfter&&this.renderWhitespace===e.renderWhitespace&&this.renderControlCharacters===e.renderControlCharacters&&this.fontLigatures===e.fontLigatures&&jb.equalsArr(this.lineDecorations,e.lineDecorations)&&this.lineTokens.equals(e.lineTokens)&&this.sameSelection(e.selectionsOnLine)}}class Zb{constructor(e,t){this.partIndex=e,this.charIndex=t}}class Yb{constructor(e,t){this.length=e,this._data=new Uint32Array(this.length),this._absoluteOffsets=new Uint32Array(this.length)}static getPartIndex(e){return(4294901760&e)>>>16}static getCharIndex(e){return(65535&e)>>>0}setColumnInfo(e,t,i,n){const o=(t<<16|i<<0)>>>0;this._data[e-1]=o,this._absoluteOffsets[e-1]=n+i}getAbsoluteOffset(e){return 0===this._absoluteOffsets.length?0:this._absoluteOffsets[e-1]}charOffsetToPartData(e){return 0===this.length?0:e<0?this._data[0]:e>=this.length?this._data[this.length-1]:this._data[e]}getDomPosition(e){const t=this.charOffsetToPartData(e-1),i=Yb.getPartIndex(t),n=Yb.getCharIndex(t);return new Zb(i,n)}getColumn(e,t){return this.partDataToCharOffset(e.partIndex,t,e.charIndex)+1}partDataToCharOffset(e,t,i){if(0===this.length)return 0;const n=(e<<16|i<<0)>>>0;let o=0,s=this.length-1;for(;o+1<s;){const e=o+s>>>1,t=this._data[e];if(t===n)return e;t>n?s=e:o=e}if(o===s)return o;const r=this._data[o],a=this._data[s];if(r===n)return o;if(a===n)return s;const l=Yb.getPartIndex(r),d=Yb.getCharIndex(r);let c;c=l!==Yb.getPartIndex(a)?t:Yb.getCharIndex(a);return i-d<=c-i?o:s}}class Xb{constructor(e,t,i){this._renderLineOutputBrand=void 0,this.characterMapping=e,this.containsRTL=t,this.containsForeignElements=i}}function Qb(e,t){if(0===e.lineContent.length){if(e.lineDecorations.length>0){t.appendASCIIString("<span>");let i=0,n=0,o=0;for(const r of e.lineDecorations)1!==r.type&&2!==r.type||(t.appendASCIIString('<span class="'),t.appendASCIIString(r.className),t.appendASCIIString('"></span>'),1===r.type&&(o|=1,i++),2===r.type&&(o|=2,n++));t.appendASCIIString("</span>");const s=new Yb(1,i+n);return s.setColumnInfo(1,i,0,0),new Xb(s,!1,o)}return t.appendASCIIString("<span><span></span></span>"),new Xb(new Yb(0,0),!1,0)}return function(e,t){const i=e.fontIsMonospace,n=e.canUseHalfwidthRightwardsArrow,o=e.containsForeignElements,s=e.lineContent,r=e.len,a=e.isOverflowing,l=e.parts,d=e.fauxIndentLength,c=e.tabSize,h=e.startVisibleColumn,u=e.containsRTL,g=e.spaceWidth,p=e.renderSpaceCharCode,m=e.renderWhitespace,f=e.renderControlCharacters,_=new Yb(r+1,l.length);let v=!1,b=0,w=h,C=0,y=0,x=0,S=0;u?t.appendASCIIString('<span dir="ltr">'):t.appendASCIIString("<span>");for(let k=0,D=l.length;k<D;k++){S+=x;const e=l[k],a=e.endIndex,h=e.type,u=0!==m&&e.isWhitespace(),D=u&&!i&&("mtkw"===h||!o),L=b===a&&e.isPseudoAfter();if(C=0,t.appendASCIIString('<span class="'),t.appendASCIIString(D?"mtkz":h),t.appendASCII(34),u){let e=0;{let t=b,i=w;for(;t<a;t++){const n=0|(9===s.charCodeAt(t)?c-i%c:1);e+=n,t>=d&&(i+=n)}}for(D&&(t.appendASCIIString(' style="width:'),t.appendASCIIString(String(g*e)),t.appendASCIIString('px"')),t.appendASCII(62);b<a;b++){_.setColumnInfo(b+1,k-y,C,S),y=0;let e;if(9===s.charCodeAt(b)){e=c-w%c|0,!n||e>1?t.write1(8594):t.write1(65515);for(let i=2;i<=e;i++)t.write1(160)}else e=1,t.write1(p);C+=e,b>=d&&(w+=e)}x=e}else{let e=0;for(t.appendASCII(62);b<a;b++){_.setColumnInfo(b+1,k-y,C,S),y=0;const i=s.charCodeAt(b);let n=1,o=1;switch(i){case 9:n=c-w%c,o=n;for(let e=1;e<=n;e++)t.write1(160);break;case 32:t.write1(160);break;case 60:t.appendASCIIString("<");break;case 62:t.appendASCIIString(">");break;case 38:t.appendASCIIString("&");break;case 0:f?t.write1(9216):t.appendASCIIString("�");break;case 65279:case 8232:case 8233:case 133:t.write1(65533);break;default:ks(i)&&o++,f&&i<32?t.write1(9216+i):f&&127===i?t.write1(9249):f&&iw(i)?(t.appendASCIIString("[U+"),t.appendASCIIString(nw(i)),t.appendASCIIString("]"),n=8):t.write1(i)}C+=n,e+=n,b>=d&&(w+=o)}x=e}L?y++:y=0,b>=r&&!v&&e.isPseudoAfter()&&(v=!0,_.setColumnInfo(b+1,k,C,S)),t.appendASCIIString("</span>")}v||_.setColumnInfo(r+1,l.length-1,C,S);a&&t.appendASCIIString("<span>…</span>");return t.appendASCIIString("</span>"),new Xb(_,u,o)}(function(e){const t=e.lineContent;let i,n;-1!==e.stopRenderingLineAfter&&e.stopRenderingLineAfter<t.length?(i=!0,n=e.stopRenderingLineAfter):(i=!1,n=t.length);let o=function(e,t,i){const n=[];let o=0;t>0&&(n[o++]=new Kb(t,"",0));for(let s=0,r=e.getCount();s<r;s++){const r=e.getEndOffset(s);if(r<=t)continue;const a=e.getClassName(s);if(r>=i){n[o++]=new Kb(i,a,0);break}n[o++]=new Kb(r,a,0)}return n}(e.lineTokens,e.fauxIndentLength,n);e.renderControlCharacters&&!e.isBasicASCII&&(o=function(e,t){const i=[];let n=new Kb(0,"",0),o=0;for(const s of t){const t=s.endIndex;for(;o<t;o++){iw(e.charCodeAt(o))&&(o>n.endIndex&&(n=new Kb(o,s.type,s.metadata),i.push(n)),n=new Kb(o+1,"mtkcontrol",s.metadata),i.push(n))}o>n.endIndex&&(n=new Kb(t,s.type,s.metadata),i.push(n))}return i}(t,o));(4===e.renderWhitespace||1===e.renderWhitespace||2===e.renderWhitespace&&e.selectionsOnLine||3===e.renderWhitespace)&&(o=function(e,t,i,n){const o=e.continuesWithWrappedLine,s=e.fauxIndentLength,r=e.tabSize,a=e.startVisibleColumn,l=e.useMonospaceOptimizations,d=e.selectionsOnLine,c=1===e.renderWhitespace,h=3===e.renderWhitespace,u=e.renderSpaceWidth!==e.spaceWidth,g=[];let p=0,m=0,f=n[m].type,_=n[m].endIndex;const v=n.length;let b,w=!1,C=xs(t);-1===C?(w=!0,C=i,b=i):b=Ss(t);let y=!1,x=0,S=d&&d[x],k=a%r;for(let L=s;L<i;L++){const e=t.charCodeAt(L);let o;if(S&&L>=S.endOffset&&(x++,S=d&&d[x]),L<C||L>b)o=!0;else if(9===e)o=!0;else if(32===e)if(c)if(y)o=!0;else{const e=L+1<i?t.charCodeAt(L+1):0;o=32===e||9===e}else o=!0;else o=!1;if(o&&d&&(o=!!S&&S.startOffset<=L&&S.endOffset>L),o&&h&&(o=w||L>b),y){if(!o||!l&&k>=r){if(u){for(let e=(p>0?g[p-1].endIndex:s)+1;e<=L;e++)g[p++]=new Kb(e,"mtkw",1)}else g[p++]=new Kb(L,"mtkw",1);k%=r}}else(L===_||o&&L>s)&&(g[p++]=new Kb(L,f,0),k%=r);for(9===e?k=r:ks(e)?k+=2:k++,y=o;L===_&&(m++,m<v);)f=n[m].type,_=n[m].endIndex}let D=!1;if(y)if(o&&c){const e=i>0?t.charCodeAt(i-1):0,n=i>1?t.charCodeAt(i-2):0;32===e&&32!==n&&9!==n||(D=!0)}else D=!0;if(D)if(u){for(let e=(p>0?g[p-1].endIndex:s)+1;e<=i;e++)g[p++]=new Kb(e,"mtkw",1)}else g[p++]=new Kb(i,"mtkw",1);else g[p++]=new Kb(i,f,0);return g}(e,t,n,o));let s=0;if(e.lineDecorations.length>0){for(let t=0,i=e.lineDecorations.length;t<i;t++){const i=e.lineDecorations[t];3===i.type||1===i.type?s|=1:2===i.type&&(s|=2)}o=function(e,t,i,n){n.sort(jb.compare);const o=class{static normalize(e,t){if(0===t.length)return[];const i=[],n=new $b;let o=0;for(let s=0,r=t.length;s<r;s++){const r=t[s];let a=r.startColumn,l=r.endColumn;const d=r.className,c=1===r.type?2:2===r.type?4:0;if(a>1){const t=e.charCodeAt(a-2);Go(t)&&a--}if(l>1){const t=e.charCodeAt(l-2);Go(t)&&l--}const h=a-1,u=l-2;o=n.consumeLowerThan(h,o,i),0===n.count&&(o=h),n.insert(u,d,c)}return n.consumeLowerThan(1073741824,o,i),i}}.normalize(e,n),s=o.length;let r=0;const a=[];let l=0,d=0;for(let h=0,u=i.length;h<u;h++){const e=i[h],t=e.endIndex,n=e.type,c=e.metadata;for(;r<s&&o[r].startOffset<t;){const e=o[r];if(e.startOffset>d&&(d=e.startOffset,a[l++]=new Kb(d,n,c)),!(e.endOffset+1<=t)){d=t,a[l++]=new Kb(d,n+" "+e.className,c|e.metadata);break}d=e.endOffset+1,a[l++]=new Kb(d,n+" "+e.className,c|e.metadata),r++}t>d&&(d=t,a[l++]=new Kb(d,n,c))}const c=i[i.length-1].endIndex;if(r<s&&o[r].startOffset===c)for(;r<s&&o[r].startOffset===c;){const e=o[r];a[l++]=new Kb(d,e.className,e.metadata),r++}return a}(t,0,o,e.lineDecorations)}e.containsRTL||(o=function(e,t,i){let n=0;const o=[];let s=0;if(i)for(let r=0,a=t.length;r<a;r++){const i=t[r],a=i.endIndex;if(n+50<a){const t=i.type,r=i.metadata;let l=-1,d=n;for(let i=n;i<a;i++)32===e.charCodeAt(i)&&(l=i),-1!==l&&i-d>=50&&(o[s++]=new Kb(l+1,t,r),d=l+1,l=-1);d!==a&&(o[s++]=new Kb(a,t,r))}else o[s++]=i;n=a}else for(let r=0,a=t.length;r<a;r++){const e=t[r],i=e.endIndex,a=i-n;if(a>50){const t=e.type,r=e.metadata,l=Math.ceil(a/50);for(let e=1;e<l;e++){const i=n+50*e;o[s++]=new Kb(i,t,r)}o[s++]=new Kb(i,t,r)}else o[s++]=e;n=i}return o}(t,o,!e.isBasicASCII||e.fontLigatures));return new tw(e.useMonospaceOptimizations,e.canUseHalfwidthRightwardsArrow,t,n,i,o,s,e.fauxIndentLength,e.tabSize,e.startVisibleColumn,e.containsRTL,e.spaceWidth,e.renderSpaceCharCode,e.renderWhitespace,e.renderControlCharacters)}(e),t)}class Jb{constructor(e,t,i,n){this.characterMapping=e,this.html=t,this.containsRTL=i,this.containsForeignElements=n}}function ew(e){const t=nv(1e4),i=Qb(e,t);return new Jb(i.characterMapping,t.build(),i.containsRTL,i.containsForeignElements)}class tw{constructor(e,t,i,n,o,s,r,a,l,d,c,h,u,g,p){this.fontIsMonospace=e,this.canUseHalfwidthRightwardsArrow=t,this.lineContent=i,this.len=n,this.isOverflowing=o,this.parts=s,this.containsForeignElements=r,this.fauxIndentLength=a,this.tabSize=l,this.startVisibleColumn=d,this.containsRTL=c,this.spaceWidth=h,this.renderSpaceCharCode=u,this.renderWhitespace=g,this.renderControlCharacters=p}}function iw(e){return e<32?9!==e:127===e||(e>=8234&&e<=8238||e>=8294&&e<=8297||e>=8206&&e<=8207||1564===e)}function nw(e){return e.toString(16).toUpperCase().padStart(4,"0")}class ow{constructor(e,t,i,n){this._viewportBrand=void 0,this.top=0|e,this.left=0|t,this.width=0|i,this.height=0|n}}class sw{constructor(e,t){this.tabSize=e,this.data=t}}class rw{constructor(e,t,i,n,o,s,r){this._viewLineDataBrand=void 0,this.content=e,this.continuesWithWrappedLine=t,this.minColumn=i,this.maxColumn=n,this.startVisibleColumn=o,this.tokens=s,this.inlineDecorations=r}}class aw{constructor(e,t,i,n,o,s,r,a,l,d){this.minColumn=e,this.maxColumn=t,this.content=i,this.continuesWithWrappedLine=n,this.isBasicASCII=aw.isBasicASCII(i,s),this.containsRTL=aw.containsRTL(i,this.isBasicASCII,o),this.tokens=r,this.inlineDecorations=a,this.tabSize=l,this.startVisibleColumn=d}static isBasicASCII(e,t){return!t||Ds(e)}static containsRTL(e,t,i){return!(t||!i)&&Ls(e)}}class lw{constructor(e,t,i){this.range=e,this.inlineClassName=t,this.type=i}}class dw{constructor(e,t,i,n){this.startOffset=e,this.endOffset=t,this.inlineClassName=i,this.inlineClassNameAffectsLetterSpacing=n}toInlineDecoration(e){return new lw(new qo(e,this.startOffset+1,e,this.endOffset+1),this.inlineClassName,this.inlineClassNameAffectsLetterSpacing?3:0)}}class cw{constructor(e,t){this._viewModelDecorationBrand=void 0,this.range=e,this.options=t}}class hw{constructor(e,t,i){this.color=e,this.zIndex=t,this.data=i}static cmp(e,t){return e.zIndex===t.zIndex?e.color<t.color?-1:e.color>t.color?1:0:e.zIndex-t.zIndex}}function uw(e){return!function(e){return Array.isArray(e)}(e)}function gw(e){return"string"==typeof e}function pw(e){return!gw(e)}function mw(e){return!e}function fw(e,t){return e.ignoreCase&&t?t.toLowerCase():t}function _w(e){return e.replace(/[&<>'"_]/g,"-")}function vw(e,t){return new Error(`${e.languageId}: ${t}`)}function bw(e,t,i,n,o){let s=null;return t.replace(/\$((\$)|(#)|(\d\d?)|[sS](\d\d?)|@(\w+))/g,(function(t,r,a,l,d,c,h,u,g){return mw(a)?mw(l)?!mw(d)&&d<n.length?fw(e,n[d]):!mw(h)&&e&&"string"==typeof e[h]?e[h]:(null===s&&(s=o.split("."),s.unshift(o)),!mw(c)&&c<s.length?fw(e,s[c]):""):fw(e,i):"$"}))}function ww(e,t){let i=t;for(;i&&i.length>0;){const t=e.tokenizer[i];if(t)return t;const n=i.lastIndexOf(".");i=n<0?null:i.substr(0,n)}return null}class Cw{constructor(e){this._maxCacheDepth=e,this._entries=Object.create(null)}static create(e,t){return this._INSTANCE.create(e,t)}create(e,t){if(null!==e&&e.depth>=this._maxCacheDepth)return new yw(e,t);let i=yw.getStackElementId(e);i.length>0&&(i+="|"),i+=t;let n=this._entries[i];return n||(n=new yw(e,t),this._entries[i]=n,n)}}Cw._INSTANCE=new Cw(5);class yw{constructor(e,t){this.parent=e,this.state=t,this.depth=(this.parent?this.parent.depth:0)+1}static getStackElementId(e){let t="";for(;null!==e;)t.length>0&&(t+="|"),t+=e.state,e=e.parent;return t}static _equals(e,t){for(;null!==e&&null!==t;){if(e===t)return!0;if(e.state!==t.state)return!1;e=e.parent,t=t.parent}return null===e&&null===t}equals(e){return yw._equals(this,e)}push(e){return Cw.create(this,e)}pop(){return this.parent}popall(){let e=this;for(;e.parent;)e=e.parent;return e}switchTo(e){return Cw.create(this.parent,e)}}class xw{constructor(e,t){this.languageId=e,this.state=t}equals(e){return this.languageId===e.languageId&&this.state.equals(e.state)}clone(){return this.state.clone()===this.state?this:new xw(this.languageId,this.state)}}class Sw{constructor(e){this._maxCacheDepth=e,this._entries=Object.create(null)}static create(e,t){return this._INSTANCE.create(e,t)}create(e,t){if(null!==t)return new kw(e,t);if(null!==e&&e.depth>=this._maxCacheDepth)return new kw(e,t);const i=yw.getStackElementId(e);let n=this._entries[i];return n||(n=new kw(e,null),this._entries[i]=n,n)}}Sw._INSTANCE=new Sw(5);class kw{constructor(e,t){this.stack=e,this.embeddedLanguageData=t}clone(){return(this.embeddedLanguageData?this.embeddedLanguageData.clone():null)===this.embeddedLanguageData?this:Sw.create(this.stack,this.embeddedLanguageData)}equals(e){return e instanceof kw&&(!!this.stack.equals(e.stack)&&(null===this.embeddedLanguageData&&null===e.embeddedLanguageData||null!==this.embeddedLanguageData&&null!==e.embeddedLanguageData&&this.embeddedLanguageData.equals(e.embeddedLanguageData)))}}class Dw{constructor(){this._tokens=[],this._languageId=null,this._lastTokenType=null,this._lastTokenLanguage=null}enterLanguage(e){this._languageId=e}emit(e,t){this._lastTokenType===t&&this._lastTokenLanguage===this._languageId||(this._lastTokenType=t,this._lastTokenLanguage=this._languageId,this._tokens.push(new rs(e,t,this._languageId)))}nestedLanguageTokenize(e,t,i,n){const o=i.languageId,s=i.state,r=Ns.get(o);if(!r)return this.enterLanguage(o),this.emit(n,""),s;const a=r.tokenize(e,t,s);if(0!==n)for(const l of a.tokens)this._tokens.push(new rs(l.offset+n,l.type,l.language));else this._tokens=this._tokens.concat(a.tokens);return this._lastTokenType=null,this._lastTokenLanguage=null,this._languageId=null,a.endState}finalize(e){return new ss(this._tokens,e)}}class Lw{constructor(e,t){this._languageService=e,this._theme=t,this._prependTokens=null,this._tokens=[],this._currentLanguageId=0,this._lastTokenMetadata=0}enterLanguage(e){this._currentLanguageId=this._languageService.languageIdCodec.encodeLanguageId(e)}emit(e,t){const i=this._theme.match(this._currentLanguageId,t);this._lastTokenMetadata!==i&&(this._lastTokenMetadata=i,this._tokens.push(e),this._tokens.push(i))}static _merge(e,t,i){const n=null!==e?e.length:0,o=t.length,s=null!==i?i.length:0;if(0===n&&0===o&&0===s)return new Uint32Array(0);if(0===n&&0===o)return i;if(0===o&&0===s)return e;const r=new Uint32Array(n+o+s);null!==e&&r.set(e);for(let a=0;a<o;a++)r[n+a]=t[a];return null!==i&&r.set(i,n+o),r}nestedLanguageTokenize(e,t,i,n){const o=i.languageId,s=i.state,r=Ns.get(o);if(!r)return this.enterLanguage(o),this.emit(n,""),s;const a=r.tokenizeEncoded(e,t,s);if(0!==n)for(let l=0,d=a.tokens.length;l<d;l+=2)a.tokens[l]+=n;return this._prependTokens=Lw._merge(this._prependTokens,this._tokens,a.tokens),this._tokens=[],this._currentLanguageId=0,this._lastTokenMetadata=0,a.endState}finalize(e){return new os(Lw._merge(this._prependTokens,this._tokens,null),e)}}class Nw{constructor(e,t,i,n){this._languageService=e,this._standaloneThemeService=t,this._languageId=i,this._lexer=n,this._embeddedLanguages=Object.create(null),this.embeddedLoaded=Promise.resolve(void 0);let o=!1;this._tokenizationRegistryListener=Ns.onDidChange((e=>{if(o)return;let t=!1;for(let i=0,n=e.changedLanguages.length;i<n;i++){const n=e.changedLanguages[i];if(this._embeddedLanguages[n]){t=!0;break}}t&&(o=!0,Ns.fire([this._languageId]),o=!1)}))}dispose(){this._tokenizationRegistryListener.dispose()}getLoadStatus(){const e=[];for(let t in this._embeddedLanguages){const i=Ns.get(t);if(i){if(i instanceof Nw){const t=i.getLoadStatus();!1===t.loaded&&e.push(t.promise)}}else Ns.isResolved(t)||e.push(Ns.getOrCreate(t))}return 0===e.length?{loaded:!0}:{loaded:!1,promise:Promise.all(e).then((e=>{}))}}getInitialState(){const e=Cw.create(null,this._lexer.start);return Sw.create(e,null)}tokenize(e,t,i){const n=new Dw,o=this._tokenize(e,t,i,n);return n.finalize(o)}tokenizeEncoded(e,t,i){const n=new Lw(this._languageService,this._standaloneThemeService.getColorTheme().tokenTheme),o=this._tokenize(e,t,i,n);return n.finalize(o)}_tokenize(e,t,i,n){return i.embeddedLanguageData?this._nestedTokenize(e,t,i,0,n):this._myTokenize(e,t,i,0,n)}_findLeavingNestedLanguageOffset(e,t){let i=this._lexer.tokenizer[t.stack.state];if(!i&&(i=ww(this._lexer,t.stack.state),!i))throw vw(this._lexer,"tokenizer state is not defined: "+t.stack.state);let n=-1,o=!1;for(const s of i){if(!pw(s.action)||"@pop"!==s.action.nextEmbedded)continue;o=!0;let t=s.regex;const i=s.regex.source;if("^(?:"===i.substr(0,4)&&")"===i.substr(i.length-1,1)){const e=(t.ignoreCase?"i":"")+(t.unicode?"u":"");t=new RegExp(i.substr(4,i.length-5),e)}const r=e.search(t);-1===r||0!==r&&s.matchOnlyAtLineStart||(-1===n||r<n)&&(n=r)}if(!o)throw vw(this._lexer,'no rule containing nextEmbedded: "@pop" in tokenizer embedded state: '+t.stack.state);return n}_nestedTokenize(e,t,i,n,o){const s=this._findLeavingNestedLanguageOffset(e,i);if(-1===s){const s=o.nestedLanguageTokenize(e,t,i.embeddedLanguageData,n);return Sw.create(i.stack,new xw(i.embeddedLanguageData.languageId,s))}const r=e.substring(0,s);r.length>0&&o.nestedLanguageTokenize(r,!1,i.embeddedLanguageData,n);const a=e.substring(s);return this._myTokenize(a,t,i,n+s,o)}_safeRuleName(e){return e?e.name:"(unknown)"}_myTokenize(e,t,i,n,o){o.enterLanguage(this._languageId);const s=e.length,r=t&&this._lexer.includeLF?e+"\n":e,a=r.length;let l=i.embeddedLanguageData,d=i.stack,c=0,h=null,u=!0;for(;u||c<a;){const i=c,g=d.depth,p=h?h.groups.length:0,m=d.state;let f=null,_=null,v=null,b=null,w=null;if(h){f=h.matches;const e=h.groups.shift();_=e.matched,v=e.action,b=h.rule,0===h.groups.length&&(h=null)}else{if(!u&&c>=a)break;u=!1;let e=this._lexer.tokenizer[m];if(!e&&(e=ww(this._lexer,m),!e))throw vw(this._lexer,"tokenizer state is not defined: "+m);let t=r.substr(c);for(const i of e)if((0===c||!i.matchOnlyAtLineStart)&&(f=t.match(i.regex),f)){_=f[0],v=i.action;break}}if(f||(f=[""],_=""),v||(c<a&&(f=[r.charAt(c)],_=f[0]),v=this._lexer.defaultToken),null===_)break;for(c+=_.length;uw(v)&&pw(v)&&v.test;)v=v.test(_,f,m,c===a);let C=null;if("string"==typeof v||Array.isArray(v))C=v;else if(v.group)C=v.group;else if(null!==v.token&&void 0!==v.token){if(C=v.tokenSubst?bw(this._lexer,v.token,_,f,m):v.token,v.nextEmbedded)if("@pop"===v.nextEmbedded){if(!l)throw vw(this._lexer,"cannot pop embedded language if not inside one");l=null}else{if(l)throw vw(this._lexer,"cannot enter embedded language from within an embedded language");w=bw(this._lexer,v.nextEmbedded,_,f,m)}if(v.goBack&&(c=Math.max(0,c-v.goBack)),v.switchTo&&"string"==typeof v.switchTo){let e=bw(this._lexer,v.switchTo,_,f,m);if("@"===e[0]&&(e=e.substr(1)),!ww(this._lexer,e))throw vw(this._lexer,"trying to switch to a state '"+e+"' that is undefined in rule: "+this._safeRuleName(b));d=d.switchTo(e)}else{if(v.transform&&"function"==typeof v.transform)throw vw(this._lexer,"action.transform not supported");if(v.next)if("@push"===v.next){if(d.depth>=this._lexer.maxStack)throw vw(this._lexer,"maximum tokenizer stack size reached: ["+d.state+","+d.parent.state+",...]");d=d.push(m)}else if("@pop"===v.next){if(d.depth<=1)throw vw(this._lexer,"trying to pop an empty stack in rule: "+this._safeRuleName(b));d=d.pop()}else if("@popall"===v.next)d=d.popall();else{let e=bw(this._lexer,v.next,_,f,m);if("@"===e[0]&&(e=e.substr(1)),!ww(this._lexer,e))throw vw(this._lexer,"trying to set a next state '"+e+"' that is undefined in rule: "+this._safeRuleName(b));d=d.push(e)}}v.log&&"string"==typeof v.log&&(this._lexer,this._lexer.languageId,bw(this._lexer,v.log,_,f,m))}if(null===C)throw vw(this._lexer,"lexer rule has no well-defined action in rule: "+this._safeRuleName(b));const y=i=>{const s=this._languageService.getLanguageIdByLanguageName(i)||this._languageService.getLanguageIdByMimeType(i)||i,r=this._getNestedEmbeddedLanguageData(s);if(c<a){const i=e.substr(c);return this._nestedTokenize(i,t,Sw.create(d,r),n+c,o)}return Sw.create(d,r)};if(Array.isArray(C)){if(h&&h.groups.length>0)throw vw(this._lexer,"groups cannot be nested: "+this._safeRuleName(b));if(f.length!==C.length+1)throw vw(this._lexer,"matched number of groups does not match the number of actions in rule: "+this._safeRuleName(b));let e=0;for(let t=1;t<f.length;t++)e+=f[t].length;if(e!==_.length)throw vw(this._lexer,"with groups, all characters should be matched in consecutive groups in rule: "+this._safeRuleName(b));h={rule:b,matches:f,groups:[]};for(let t=0;t<C.length;t++)h.groups[t]={action:C[t],matched:f[t+1]};c-=_.length}else{{if("@rematch"===C&&(c-=_.length,_="",f=null,C="",null!==w))return y(w);if(0===_.length){if(0===a||g!==d.depth||m!==d.state||(h?h.groups.length:0)!==p)continue;throw vw(this._lexer,"no progress in tokenizer in rule: "+this._safeRuleName(b))}let e=null;if(gw(C)&&0===C.indexOf("@brackets")){const t=C.substr("@brackets".length),i=Ew(this._lexer,_);if(!i)throw vw(this._lexer,"@brackets token returned but no bracket defined as: "+_);e=_w(i.token+t)}else{e=_w(""===C?"":C+this._lexer.tokenPostfix)}i<s&&o.emit(i+n,e)}if(null!==w)return y(w)}}return Sw.create(d,l)}_getNestedEmbeddedLanguageData(e){if(!this._languageService.isRegisteredLanguageId(e))return new xw(e,$v);e!==this._languageId&&(Ns.getOrCreate(e),this._embeddedLanguages[e]=!0);const t=Ns.get(e);return new xw(e,t?t.getInitialState():$v)}}function Ew(e,t){if(!t)return null;t=fw(e,t);const i=e.brackets;for(const n of i){if(n.open===t)return{token:n.token,bracketType:1};if(n.close===t)return{token:n.token,bracketType:-1}}return null}var Iw,Tw=globalThis&&globalThis.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{l(n.next(e))}catch(t){s(t)}}function a(e){try{l(n.throw(e))}catch(t){s(t)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}l((n=n.apply(e,t||[])).next())}))};const Mw=null===(Iw=window.trustedTypes)||void 0===Iw?void 0:Iw.createPolicy("standaloneColorizer",{createHTML:e=>e});class Aw{static colorizeElement(e,t,i,n){const o=(n=n||{}).theme||"vs",s=n.mimeType||i.getAttribute("lang")||i.getAttribute("data-lang");if(!s)return Promise.resolve();const r=t.getLanguageIdByMimeType(s)||s;e.setTheme(o);const a=i.firstChild?i.firstChild.nodeValue:"";i.className+=" "+o;return this.colorize(t,a||"",r,n).then((e=>{var t;const n=null!==(t=null==Mw?void 0:Mw.createHTML(e))&&void 0!==t?t:e;i.innerHTML=n}),(e=>{}))}static colorize(e,t,i,n){return Tw(this,void 0,void 0,(function*(){const o=e.languageIdCodec;let s=4;n&&"number"==typeof n.tabSize&&(s=n.tabSize),Es(t)&&(t=t.substr(1));const r=Is(t);if(!e.isRegisteredLanguageId(i))return Ow(r,s,o);const a=yield Ns.getOrCreate(i);return a?function(e,t,i,n){return new Promise(((o,s)=>{const r=()=>{const a=function(e,t,i,n){let o=[],s=i.getInitialState();for(let r=0,a=e.length;r<a;r++){const a=e[r],l=i.tokenizeEncoded(a,!0,s);zb.convertToEndOffset(l.tokens,a.length);const d=new zb(l.tokens,a,n),c=aw.isBasicASCII(a,!0),h=aw.containsRTL(a,c,!0),u=ew(new Gb(!1,!0,a,!1,c,h,0,d.inflate(),[],t,0,0,0,0,-1,"none",!1,!1,null));o=o.concat(u.html),o.push("<br/>"),s=l.endState}return o.join("")}(e,t,i,n);if(i instanceof Nw){const e=i.getLoadStatus();if(!1===e.loaded)return void e.promise.then(r,s)}o(a)};r()}))}(r,s,a,o):Ow(r,s,o)}))}static colorizeLine(e,t,i,n,o=4){const s=aw.isBasicASCII(e,t),r=aw.containsRTL(e,s,i);return ew(new Gb(!1,!0,e,!1,s,r,0,n,[],o,0,0,0,0,-1,"none",!1,!1,null)).html}static colorizeModelLine(e,t,i=4){const n=e.getLineContent(t);e.forceTokenization(t);const o=e.getLineTokens(t).inflate();return this.colorizeLine(n,e.mightContainNonBasicASCII(),e.mightContainRTL(),o,i)}}function Ow(e,t,i){let n=[];const o=new Uint32Array(2);o[0]=0,o[1]=16793600;for(let s=0,r=e.length;s<r;s++){const r=e[s];o[0]=r.length;const a=new zb(o,r,i),l=aw.isBasicASCII(r,!0),d=aw.containsRTL(r,l,!0),c=ew(new Gb(!1,!0,r,!1,l,d,0,a,[],t,0,0,0,0,-1,"none",!1,!1,null));n=n.concat(c.html),n.push("<br/>")}return n.join("")}Ts||document.queryCommandSupported&&document.queryCommandSupported("copy")||navigator&&navigator.clipboard&&navigator.clipboard.writeText,Ts||navigator&&navigator.clipboard&&navigator.clipboard.readText,Ts||h_||navigator.keyboard,"ontouchstart"in window||navigator.maxTouchPoints;const Rw=window.PointerEvent&&("ontouchstart"in window||window.navigator.maxTouchPoints>0||navigator.maxTouchPoints>0);function Pw(e,t){if(0===e)return null;const i=(65535&e)>>>0,n=(4294901760&e)>>>16;return new Vw(0!==n?[Fw(i,t),Fw(n,t)]:[Fw(i,t)])}function Fw(e,t){const i=!!(2048&e),n=!!(256&e);return new Bw(2===t?n:i,!!(1024&e),!!(512&e),2===t?i:n,255&e)}class Bw{constructor(e,t,i,n,o){this.ctrlKey=e,this.shiftKey=t,this.altKey=i,this.metaKey=n,this.keyCode=o}equals(e){return this.ctrlKey===e.ctrlKey&&this.shiftKey===e.shiftKey&&this.altKey===e.altKey&&this.metaKey===e.metaKey&&this.keyCode===e.keyCode}isModifierKey(){return 0===this.keyCode||5===this.keyCode||57===this.keyCode||6===this.keyCode||4===this.keyCode}toChord(){return new Vw([this])}isDuplicateModifierCase(){return this.ctrlKey&&5===this.keyCode||this.shiftKey&&4===this.keyCode||this.altKey&&6===this.keyCode||this.metaKey&&57===this.keyCode}}class Vw{constructor(e){if(0===e.length)throw Ms("parts");this.parts=e}}class Ww{constructor(e,t,i,n,o,s){this.ctrlKey=e,this.shiftKey=t,this.altKey=i,this.metaKey=n,this.keyLabel=o,this.keyAriaLabel=s}}const zw=zo?256:2048,Hw=zo?2048:256;class jw{constructor(e){this._standardKeyboardEventBrand=!0;let t=e;this.browserEvent=t,this.target=t.target,this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,this.keyCode=function(e){if(e.charCode){let t=String.fromCharCode(e.charCode).toUpperCase();return As.fromString(t)}const t=e.keyCode;if(3===t)return 7;if(o_){if(59===t)return 80;if(107===t)return 81;if(109===t)return 83;if(zo&&224===t)return 57}else if(s_){if(91===t)return 57;if(zo&&93===t)return 57;if(!zo&&92===t)return 57}return Os[t]||0}(t),this.code=t.code,this.ctrlKey=this.ctrlKey||5===this.keyCode,this.altKey=this.altKey||6===this.keyCode,this.shiftKey=this.shiftKey||4===this.keyCode,this.metaKey=this.metaKey||57===this.keyCode,this._asKeybinding=this._computeKeybinding(),this._asRuntimeKeybinding=this._computeRuntimeKeybinding()}preventDefault(){this.browserEvent&&this.browserEvent.preventDefault&&this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent&&this.browserEvent.stopPropagation&&this.browserEvent.stopPropagation()}toKeybinding(){return this._asRuntimeKeybinding}equals(e){return this._asKeybinding===e}_computeKeybinding(){let e=0;5!==this.keyCode&&4!==this.keyCode&&6!==this.keyCode&&57!==this.keyCode&&(e=this.keyCode);let t=0;return this.ctrlKey&&(t|=zw),this.altKey&&(t|=512),this.shiftKey&&(t|=1024),this.metaKey&&(t|=Hw),t|=e,t}_computeRuntimeKeybinding(){let e=0;return 5!==this.keyCode&&4!==this.keyCode&&6!==this.keyCode&&57!==this.keyCode&&(e=this.keyCode),new Bw(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}}let Uw=!1,$w=null;function Kw(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,i=e.parent.location;if("null"!==t.origin&&"null"!==i.origin&&t.origin!==i.origin)return Uw=!0,null}catch(t){return Uw=!0,null}return e.parent}class qw{static getSameOriginWindowChain(){if(!$w){$w=[];let e,t=window;do{e=Kw(t),e?$w.push({window:t,iframeElement:t.frameElement||null}):$w.push({window:t,iframeElement:null}),t=e}while(t)}return $w.slice(0)}static hasDifferentOriginAncestor(){return $w||this.getSameOriginWindowChain(),Uw}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let i=0,n=0,o=this.getSameOriginWindowChain();for(const s of o){if(i+=s.window.scrollY,n+=s.window.scrollX,s.window===t)break;if(!s.iframeElement)break;let e=s.iframeElement.getBoundingClientRect();i+=e.top,n+=e.left}return{top:i,left:n}}}class Gw{constructor(e){this.timestamp=Date.now(),this.browserEvent=e,this.leftButton=0===e.button,this.middleButton=1===e.button,this.rightButton=2===e.button,this.buttons=e.buttons,this.target=e.target,this.detail=e.detail||1,"dblclick"===e.type&&(this.detail=2),this.ctrlKey=e.ctrlKey,this.shiftKey=e.shiftKey,this.altKey=e.altKey,this.metaKey=e.metaKey,"number"==typeof e.pageX?(this.posx=e.pageX,this.posy=e.pageY):(this.posx=e.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,this.posy=e.clientY+document.body.scrollTop+document.documentElement.scrollTop);let t=qw.getPositionOfChildWindowRelativeToAncestorWindow(self,e.view);this.posx-=t.left,this.posy-=t.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}}class Zw{constructor(e,t=0,i=0){if(this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=i,this.deltaX=t,e){let t=e,i=e;if(void 0!==t.wheelDeltaY)this.deltaY=t.wheelDeltaY/120;else if(void 0!==i.VERTICAL_AXIS&&i.axis===i.VERTICAL_AXIS)this.deltaY=-i.detail/3;else if("wheel"===e.type){const t=e;t.deltaMode===t.DOM_DELTA_LINE?this.deltaY=o_&&!zo?-e.deltaY/3:-e.deltaY:this.deltaY=-e.deltaY/40}if(void 0!==t.wheelDeltaX)this.deltaX=a_&&Rs?-t.wheelDeltaX/120:t.wheelDeltaX/120;else if(void 0!==i.HORIZONTAL_AXIS&&i.axis===i.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if("wheel"===e.type){const t=e;t.deltaMode===t.DOM_DELTA_LINE?this.deltaX=o_&&!zo?-e.deltaX/3:-e.deltaX:this.deltaX=-e.deltaX/40}0===this.deltaY&&0===this.deltaX&&e.wheelDelta&&(this.deltaY=e.wheelDelta/120)}}preventDefault(){this.browserEvent&&this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent&&this.browserEvent.stopPropagation()}}var Yw;!function(e){e.inMemory="inmemory",e.vscode="vscode",e.internal="private",e.walkThrough="walkThrough",e.walkThroughSnippet="walkThroughSnippet",e.http="http",e.https="https",e.file="file",e.mailto="mailto",e.untitled="untitled",e.data="data",e.command="command",e.vscodeRemote="vscode-remote",e.vscodeRemoteResource="vscode-remote-resource",e.userData="vscode-userdata",e.vscodeCustomEditor="vscode-custom-editor",e.vscodeNotebook="vscode-notebook",e.vscodeNotebookCell="vscode-notebook-cell",e.vscodeNotebookCellMetadata="vscode-notebook-cell-metadata",e.vscodeNotebookCellOutput="vscode-notebook-cell-output",e.vscodeInteractive="vscode-interactive",e.vscodeInteractiveInput="vscode-interactive-input",e.vscodeSettings="vscode-settings",e.vscodeWorkspaceTrust="vscode-workspace-trust",e.vscodeTerminal="vscode-terminal",e.webviewPanel="webview-panel",e.vscodeWebview="vscode-webview",e.extension="extension",e.vscodeFileResource="vscode-file",e.tmp="tmp",e.vsls="vsls"}(Yw||(Yw={}));const Xw=new class{constructor(){this._hosts=Object.create(null),this._ports=Object.create(null),this._connectionTokens=Object.create(null),this._preferredWebSchema="http",this._delegate=null}setPreferredWebSchema(e){this._preferredWebSchema=e}rewrite(e){if(this._delegate)return this._delegate(e);const t=e.authority;let i=this._hosts[t];i&&-1!==i.indexOf(":")&&(i=`[${i}]`);const n=this._ports[t],o=this._connectionTokens[t];let s=`path=${encodeURIComponent(e.path)}`;return"string"==typeof o&&(s+=`&tkn=${encodeURIComponent(o)}`),Ps.from({scheme:Fs?this._preferredWebSchema:Yw.vscodeRemoteResource,authority:`${i}:${n}`,path:"/vscode-remote-resource",query:s})}};class Qw{asBrowserUri(e,t){const i=this.toUri(e,t);return i.scheme===Yw.vscodeRemote?Xw.rewrite(i):i.scheme===Yw.file&&(Ts||Bs&&us.origin===`${Yw.vscodeFileResource}://${Qw.FALLBACK_AUTHORITY}`)?i.with({scheme:Yw.vscodeFileResource,authority:i.authority||Qw.FALLBACK_AUTHORITY,query:null,fragment:null}):i}toUri(e,t){return Ps.isUri(e)?e:Ps.parse(t.toUrl(e))}}Qw.FALLBACK_AUTHORITY="vscode-app";const Jw=new Qw;function eC(e){for(;e.firstChild;)e.firstChild.remove()}function tC(e){var t;return null!==(t=null==e?void 0:e.isConnected)&&void 0!==t&&t}class iC{constructor(e,t,i,n){this._node=e,this._type=t,this._handler=i,this._options=n||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}}function nC(e,t,i,n){return new iC(e,t,i,n)}function oC(e){return function(t){return e(new Gw(t))}}let sC=function(e,t,i,n){let o=i;return"click"===t||"mousedown"===t?o=oC(i):"keydown"!==t&&"keypress"!==t&&"keyup"!==t||(o=function(e){return function(t){return e(new jw(t))}}(i)),nC(e,t,o,n)};function rC(e,t,i){return nC(e,Vs&&Rw?zC.POINTER_DOWN:zC.MOUSE_DOWN,t,i)}function aC(e,t,i){return nC(e,Vs&&Rw?zC.POINTER_UP:zC.MOUSE_UP,t,i)}function lC(e,t){return nC(e,"mouseout",(i=>{let n=i.relatedTarget;for(;n&&n!==e;)n=n.parentNode;n!==e&&t(i)}))}function dC(e,t,i){let n=null;const o=e=>s.fire(e),s=new $o({onFirstListenerAdd:()=>{n||(n=new iC(e,t,o,i))},onLastListenerRemove:()=>{n&&(n.dispose(),n=null)}});return s}let cC,hC,uC=null;class gC{constructor(e,t=0){this._runner=e,this.priority=t,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){Jo(e)}}static sort(e,t){return t.priority-e.priority}}!function(){let e=[],t=null,i=!1,n=!1,o=()=>{for(i=!1,t=e,e=[],n=!0;t.length>0;){t.sort(gC.sort),t.shift().execute()}n=!1};hC=(t,n=0)=>{let s=new gC(t,n);return e.push(s),i||(i=!0,function(e){if(!uC){const e=e=>setTimeout((()=>e((new Date).getTime())),0);uC=self.requestAnimationFrame||self.msRequestAnimationFrame||self.webkitRequestAnimationFrame||self.mozRequestAnimationFrame||self.oRequestAnimationFrame||e}uC.call(self,e)}(o)),s},cC=(e,i)=>{if(n){let n=new gC(e,i);return t.push(n),n}return hC(e,i)}}();const pC=function(e,t){return t};class mC extends Uo{constructor(e,t,i,n=pC,o=8){super();let s=null,r=0,a=this._register(new rb),l=()=>{r=(new Date).getTime(),i(s),s=null};this._register(nC(e,t,(e=>{s=n(s,e);let t=(new Date).getTime()-r;t>=o?(a.cancel(),l()):a.setIfNotSet(l,o-t)})))}}function fC(e,t,i,n,o){return new mC(e,t,i,n,o)}function _C(e){return document.defaultView.getComputedStyle(e,null)}function vC(e){if(e!==document.body)return new wC(e.clientWidth,e.clientHeight);if(Vs&&window.visualViewport)return new wC(window.visualViewport.width,window.visualViewport.height);if(window.innerWidth&&window.innerHeight)return new wC(window.innerWidth,window.innerHeight);if(document.body&&document.body.clientWidth&&document.body.clientHeight)return new wC(document.body.clientWidth,document.body.clientHeight);if(document.documentElement&&document.documentElement.clientWidth&&document.documentElement.clientHeight)return new wC(document.documentElement.clientWidth,document.documentElement.clientHeight);throw new Error("Unable to figure out browser width and height")}class bC{static convertToPixels(e,t){return parseFloat(t)||0}static getDimension(e,t,i){let n=_C(e),o="0";return n&&(o=n.getPropertyValue?n.getPropertyValue(t):n.getAttribute(i)),bC.convertToPixels(e,o)}static getBorderLeftWidth(e){return bC.getDimension(e,"border-left-width","borderLeftWidth")}static getBorderRightWidth(e){return bC.getDimension(e,"border-right-width","borderRightWidth")}static getBorderTopWidth(e){return bC.getDimension(e,"border-top-width","borderTopWidth")}static getBorderBottomWidth(e){return bC.getDimension(e,"border-bottom-width","borderBottomWidth")}static getPaddingLeft(e){return bC.getDimension(e,"padding-left","paddingLeft")}static getPaddingRight(e){return bC.getDimension(e,"padding-right","paddingRight")}static getPaddingTop(e){return bC.getDimension(e,"padding-top","paddingTop")}static getPaddingBottom(e){return bC.getDimension(e,"padding-bottom","paddingBottom")}static getMarginLeft(e){return bC.getDimension(e,"margin-left","marginLeft")}static getMarginTop(e){return bC.getDimension(e,"margin-top","marginTop")}static getMarginRight(e){return bC.getDimension(e,"margin-right","marginRight")}static getMarginBottom(e){return bC.getDimension(e,"margin-bottom","marginBottom")}}class wC{constructor(e,t){this.width=e,this.height=t}with(e=this.width,t=this.height){return e!==this.width||t!==this.height?new wC(e,t):this}static is(e){return"object"==typeof e&&"number"==typeof e.height&&"number"==typeof e.width}static lift(e){return e instanceof wC?e:new wC(e.width,e.height)}static equals(e,t){return e===t||!(!e||!t)&&(e.width===t.width&&e.height===t.height)}}function CC(e){let t=e.offsetParent,i=e.offsetTop,n=e.offsetLeft;for(;null!==(e=e.parentNode)&&e!==document.body&&e!==document.documentElement;){i-=e.scrollTop;const o=TC(e)?null:_C(e);o&&(n-="rtl"!==o.direction?e.scrollLeft:-e.scrollLeft),e===t&&(n+=bC.getBorderLeftWidth(e),i+=bC.getBorderTopWidth(e),i+=e.offsetTop,n+=e.offsetLeft,t=e.offsetParent)}return{left:n,top:i}}function yC(e){let t=e.getBoundingClientRect();return{left:t.left+xC.scrollX,top:t.top+xC.scrollY,width:t.width,height:t.height}}wC.None=new wC(0,0);const xC=new class{get scrollX(){return"number"==typeof window.scrollX?window.scrollX:document.body.scrollLeft+document.documentElement.scrollLeft}get scrollY(){return"number"==typeof window.scrollY?window.scrollY:document.body.scrollTop+document.documentElement.scrollTop}};function SC(e){let t=bC.getMarginLeft(e)+bC.getMarginRight(e);return e.offsetWidth+t}function kC(e){let t=bC.getBorderLeftWidth(e)+bC.getBorderRightWidth(e),i=bC.getPaddingLeft(e)+bC.getPaddingRight(e);return e.offsetWidth-t-i}function DC(e){let t=bC.getBorderTopWidth(e)+bC.getBorderBottomWidth(e),i=bC.getPaddingTop(e)+bC.getPaddingBottom(e);return e.offsetHeight-t-i}function LC(e){let t=bC.getMarginTop(e)+bC.getMarginBottom(e);return e.offsetHeight+t}function NC(e,t){for(;e;){if(e===t)return!0;e=e.parentNode}return!1}function EC(e,t,i){for(;e&&e.nodeType===e.ELEMENT_NODE;){if(e.classList.contains(t))return e;if(i)if("string"==typeof i){if(e.classList.contains(i))return null}else if(e===i)return null;e=e.parentNode}return null}function IC(e,t,i){return!!EC(e,t,i)}function TC(e){return e&&!!e.host&&!!e.mode}function MC(e){return!!AC(e)}function AC(e){for(;e.parentNode;){if(e===document.body)return null;e=e.parentNode}return TC(e)?e:null}function OC(){let e=document.activeElement;for(;null==e?void 0:e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function RC(e=document.getElementsByTagName("head")[0]){let t=document.createElement("style");return t.type="text/css",t.media="screen",e.appendChild(t),t}let PC=null;function FC(){return PC||(PC=RC()),PC}function BC(e,t,i=FC()){i&&t&&i.sheet.insertRule(e+"{"+t+"}",0)}function VC(e,t=FC()){if(!t)return;let i=function(e){var t,i;return(null===(t=null==e?void 0:e.sheet)||void 0===t?void 0:t.rules)?e.sheet.rules:(null===(i=null==e?void 0:e.sheet)||void 0===i?void 0:i.cssRules)?e.sheet.cssRules:[]}(t),n=[];for(let o=0;o<i.length;o++){-1!==i[o].selectorText.indexOf(e)&&n.push(o)}for(let o=n.length-1;o>=0;o--)t.sheet.deleteRule(n[o])}function WC(e){return"object"==typeof HTMLElement?e instanceof HTMLElement:e&&"object"==typeof e&&1===e.nodeType&&"string"==typeof e.nodeName}const zC={CLICK:"click",AUXCLICK:"auxclick",DBLCLICK:"dblclick",MOUSE_UP:"mouseup",MOUSE_DOWN:"mousedown",MOUSE_OVER:"mouseover",MOUSE_MOVE:"mousemove",MOUSE_OUT:"mouseout",MOUSE_ENTER:"mouseenter",MOUSE_LEAVE:"mouseleave",MOUSE_WHEEL:"wheel",POINTER_UP:"pointerup",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",CONTEXT_MENU:"contextmenu",WHEEL:"wheel",KEY_DOWN:"keydown",KEY_PRESS:"keypress",KEY_UP:"keyup",LOAD:"load",BEFORE_UNLOAD:"beforeunload",UNLOAD:"unload",PAGE_SHOW:"pageshow",PAGE_HIDE:"pagehide",ABORT:"abort",ERROR:"error",RESIZE:"resize",SCROLL:"scroll",FULLSCREEN_CHANGE:"fullscreenchange",WK_FULLSCREEN_CHANGE:"webkitfullscreenchange",SELECT:"select",CHANGE:"change",SUBMIT:"submit",RESET:"reset",FOCUS:"focus",FOCUS_IN:"focusin",FOCUS_OUT:"focusout",BLUR:"blur",INPUT:"input",STORAGE:"storage",DRAG_START:"dragstart",DRAG:"drag",DRAG_ENTER:"dragenter",DRAG_LEAVE:"dragleave",DRAG_OVER:"dragover",DROP:"drop",DRAG_END:"dragend",ANIMATION_START:s_?"webkitAnimationStart":"animationstart",ANIMATION_END:s_?"webkitAnimationEnd":"animationend",ANIMATION_ITERATION:s_?"webkitAnimationIteration":"animationiteration"},HC=function(e,t){e.preventDefault?e.preventDefault():e.returnValue=!1,t&&(e.stopPropagation?e.stopPropagation():e.cancelBubble=!0)};class jC extends Uo{constructor(e){super(),this._onDidFocus=this._register(new $o),this.onDidFocus=this._onDidFocus.event,this._onDidBlur=this._register(new $o),this.onDidBlur=this._onDidBlur.event;let t=jC.hasFocusWithin(e),i=!1;const n=()=>{i=!1,t||(t=!0,this._onDidFocus.fire())},o=()=>{t&&(i=!0,window.setTimeout((()=>{i&&(i=!1,t=!1,this._onDidBlur.fire())}),0))};this._refreshStateHandler=()=>{jC.hasFocusWithin(e)!==t&&(t?o():n())},this._register(nC(e,zC.FOCUS,n,!0)),this._register(nC(e,zC.BLUR,o,!0)),this._register(nC(e,zC.FOCUS_IN,(()=>this._refreshStateHandler()))),this._register(nC(e,zC.FOCUS_OUT,(()=>this._refreshStateHandler())))}static hasFocusWithin(e){const t=AC(e);return NC(t?t.activeElement:document.activeElement,e)}}function UC(e){return new jC(e)}function $C(e,...t){if(e.append(...t),1===t.length&&"string"!=typeof t[0])return t[0]}function KC(e,...t){e.innerText="",$C(e,...t)}const qC=/([\w\-]+)?(#([\w\-]+))?((\.([\w\-]+))*)/;var GC;function ZC(e,t,i,...n){let o=qC.exec(t);if(!o)throw new Error("Bad use of emmet");i=Object.assign({},i||{});let s,r=o[1]||"div";return s=e!==GC.HTML?document.createElementNS(e,r):document.createElement(r),o[3]&&(s.id=o[3]),o[4]&&(s.className=o[4].replace(/\./g," ").trim()),Object.keys(i).forEach((e=>{const t=i[e];void 0!==t&&(/^on\w+$/.test(e)?s[e]=t:"selected"===e?t&&s.setAttribute(e,"true"):s.setAttribute(e,t))})),s.append(...n),s}function YC(e,t,...i){return ZC(GC.HTML,e,t,...i)}function XC(...e){for(let t of e)t.style.display="",t.removeAttribute("aria-hidden")}function QC(...e){for(let t of e)t.style.display="none",t.setAttribute("aria-hidden","true")}function JC(e){const t=window.devicePixelRatio*e;return Math.max(1,Math.floor(t))/window.devicePixelRatio}function ey(e){window.open(e,"_blank","noopener")}function ty(e){return e?`url('${Jw.asBrowserUri(e).toString(!0).replace(/'/g,"%27")}')`:"url('')"}function iy(e){return`'${e.replace(/'/g,"%27")}'`}!function(e){e.HTML="http://www.w3.org/1999/xhtml",e.SVG="http://www.w3.org/2000/svg"}(GC||(GC={})),YC.SVG=function(e,t,...i){return ZC(GC.SVG,e,t,...i)},Xw.setPreferredWebSchema(/^https:/.test(window.location.href)?"https":"http");class ny extends $o{constructor(){super(),this._subscriptions=new ws,this._keyStatus={altKey:!1,shiftKey:!1,ctrlKey:!1,metaKey:!1},this._subscriptions.add(nC(window,"keydown",(e=>{if(e.defaultPrevented)return;const t=new jw(e);if(6!==t.keyCode||!e.repeat){if(e.altKey&&!this._keyStatus.altKey)this._keyStatus.lastKeyPressed="alt";else if(e.ctrlKey&&!this._keyStatus.ctrlKey)this._keyStatus.lastKeyPressed="ctrl";else if(e.metaKey&&!this._keyStatus.metaKey)this._keyStatus.lastKeyPressed="meta";else if(e.shiftKey&&!this._keyStatus.shiftKey)this._keyStatus.lastKeyPressed="shift";else{if(6===t.keyCode)return;this._keyStatus.lastKeyPressed=void 0}this._keyStatus.altKey=e.altKey,this._keyStatus.ctrlKey=e.ctrlKey,this._keyStatus.metaKey=e.metaKey,this._keyStatus.shiftKey=e.shiftKey,this._keyStatus.lastKeyPressed&&(this._keyStatus.event=e,this.fire(this._keyStatus))}}),!0)),this._subscriptions.add(nC(window,"keyup",(e=>{e.defaultPrevented||(!e.altKey&&this._keyStatus.altKey?this._keyStatus.lastKeyReleased="alt":!e.ctrlKey&&this._keyStatus.ctrlKey?this._keyStatus.lastKeyReleased="ctrl":!e.metaKey&&this._keyStatus.metaKey?this._keyStatus.lastKeyReleased="meta":!e.shiftKey&&this._keyStatus.shiftKey?this._keyStatus.lastKeyReleased="shift":this._keyStatus.lastKeyReleased=void 0,this._keyStatus.lastKeyPressed!==this._keyStatus.lastKeyReleased&&(this._keyStatus.lastKeyPressed=void 0),this._keyStatus.altKey=e.altKey,this._keyStatus.ctrlKey=e.ctrlKey,this._keyStatus.metaKey=e.metaKey,this._keyStatus.shiftKey=e.shiftKey,this._keyStatus.lastKeyReleased&&(this._keyStatus.event=e,this.fire(this._keyStatus)))}),!0)),this._subscriptions.add(nC(document.body,"mousedown",(()=>{this._keyStatus.lastKeyPressed=void 0}),!0)),this._subscriptions.add(nC(document.body,"mouseup",(()=>{this._keyStatus.lastKeyPressed=void 0}),!0)),this._subscriptions.add(nC(document.body,"mousemove",(e=>{e.buttons&&(this._keyStatus.lastKeyPressed=void 0)}),!0)),this._subscriptions.add(nC(window,"blur",(()=>{this.resetKeyStatus()})))}get keyStatus(){return this._keyStatus}resetKeyStatus(){this.doResetKeyStatus(),this.fire(this._keyStatus)}doResetKeyStatus(){this._keyStatus={altKey:!1,shiftKey:!1,ctrlKey:!1,metaKey:!1}}static getInstance(){return ny.instance||(ny.instance=new ny),ny.instance}dispose(){super.dispose(),this._subscriptions.dispose()}}let oy,sy,ry,ay,ly;function dy(e){oy&&(sy.textContent!==e?(eC(ry),hy(sy,e)):(eC(sy),hy(ry,e)))}function cy(e){oy&&(zo?dy(e):ay.textContent!==e?(eC(ly),hy(ay,e)):(eC(ay),hy(ly,e)))}function hy(e,t){eC(e),t.length>2e4&&(t=t.substr(0,2e4)),e.textContent=t,e.style.visibility="hidden",e.style.visibility="visible"}const uy=L_("markerDecorationsService"),gy=L_("textModelService");var py=globalThis&&globalThis.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{l(n.next(e))}catch(t){s(t)}}function a(e){try{l(n.throw(e))}catch(t){s(t)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}l((n=n.apply(e,t||[])).next())}))};class my extends Uo{constructor(e,t="",i="",n=!0,o){super(),this._onDidChange=this._register(new $o),this.onDidChange=this._onDidChange.event,this._enabled=!0,this._id=e,this._label=t,this._cssClass=i,this._enabled=n,this._actionCallback=o}get id(){return this._id}get label(){return this._label}set label(e){this._setLabel(e)}_setLabel(e){this._label!==e&&(this._label=e,this._onDidChange.fire({label:e}))}get tooltip(){return this._tooltip||""}set tooltip(e){this._setTooltip(e)}_setTooltip(e){this._tooltip!==e&&(this._tooltip=e,this._onDidChange.fire({tooltip:e}))}get class(){return this._cssClass}set class(e){this._setClass(e)}_setClass(e){this._cssClass!==e&&(this._cssClass=e,this._onDidChange.fire({class:e}))}get enabled(){return this._enabled}set enabled(e){this._setEnabled(e)}_setEnabled(e){this._enabled!==e&&(this._enabled=e,this._onDidChange.fire({enabled:e}))}get checked(){return this._checked}set checked(e){this._setChecked(e)}_setChecked(e){this._checked!==e&&(this._checked=e,this._onDidChange.fire({checked:e}))}run(e,t){return py(this,void 0,void 0,(function*(){this._actionCallback&&(yield this._actionCallback(e))}))}}class fy extends Uo{constructor(){super(...arguments),this._onBeforeRun=this._register(new $o),this.onBeforeRun=this._onBeforeRun.event,this._onDidRun=this._register(new $o),this.onDidRun=this._onDidRun.event}run(e,t){return py(this,void 0,void 0,(function*(){if(!e.enabled)return;let i;this._onBeforeRun.fire({action:e});try{yield this.runAction(e,t)}catch(n){i=n}this._onDidRun.fire({action:e,error:i})}))}runAction(e,t){return py(this,void 0,void 0,(function*(){yield e.run(t)}))}}class _y extends my{constructor(e){super(_y.ID,e,e?"separator text":"separator"),this.checked=!1,this.enabled=!1}}_y.ID="vs.actions.separator";class vy{constructor(e,t,i,n){this.tooltip="",this.enabled=!0,this.checked=void 0,this.id=e,this.label=t,this.class=n,this._actions=i}get actions(){return this._actions}dispose(){}run(){return py(this,void 0,void 0,(function*(){}))}}class by extends my{constructor(){super(by.ID,mf(0,"(empty)"),void 0,!1)}}by.ID="vs.actions.empty";const wy=L_("commandService"),Cy=new class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new $o,this.onDidRegisterCommand=this._onDidRegisterCommand.event}registerCommand(e,t){if(!e)throw new Error("invalid command");if("string"==typeof e){if(!t)throw new Error("invalid command");return this.registerCommand({id:e,handler:t})}if(e.description){const t=[];for(let n of e.description.args)t.push(n.constraint);const i=e.handler;e.handler=function(e,...n){return Ws(n,t),i(e,...n)}}const{id:i}=e;let n=this._commands.get(i);n||(n=new zs,this._commands.set(i,n));let o=n.unshift(e),s=es((()=>{o();const e=this._commands.get(i);(null==e?void 0:e.isEmpty())&&this._commands.delete(i)}));return this._onDidRegisterCommand.fire(i),s}registerCommandAlias(e,t){return Cy.registerCommand(e,((e,...i)=>e.get(wy).executeCommand(t,...i)))}getCommand(e){const t=this._commands.get(e);if(t&&!t.isEmpty())return Hs.first(t)}getCommands(){const e=new Map;for(const t of this._commands.keys()){const i=this.getCommand(t);i&&e.set(t,i)}return e}};Cy.registerCommand("noop",(()=>{}));const yy=new Map;yy.set("false",!1),yy.set("true",!0),yy.set("isMac",zo),yy.set("isLinux",Vo),yy.set("isWindows",Rs),yy.set("isWeb",Fs),yy.set("isMacNative",zo&&!Fs),yy.set("isEdge",js),yy.set("isFirefox",Us),yy.set("isChrome",$s),yy.set("isSafari",Ks);const xy=Object.prototype.hasOwnProperty;class Sy{static has(e){return Ny.create(e)}static equals(e,t){return Ey.create(e,t)}static regex(e,t){return Vy.create(e,t)}static not(e){return Ay.create(e)}static and(...e){return Hy.create(e,null)}static or(...e){return jy.create(e,null,!0)}static deserialize(e,t=!1){if(e)return this._deserializeOrExpression(e,t)}static _deserializeOrExpression(e,t){let i=e.split("||");return jy.create(i.map((e=>this._deserializeAndExpression(e,t))),null,!0)}static _deserializeAndExpression(e,t){let i=e.split("&&");return Hy.create(i.map((e=>this._deserializeOne(e,t))),null)}static _deserializeOne(e,t){if((e=e.trim()).indexOf("!=")>=0){let i=e.split("!=");return My.create(i[0].trim(),this._deserializeValue(i[1],t))}if(e.indexOf("==")>=0){let i=e.split("==");return Ey.create(i[0].trim(),this._deserializeValue(i[1],t))}if(e.indexOf("=~")>=0){let i=e.split("=~");return Vy.create(i[0].trim(),this._deserializeRegexValue(i[1],t))}if(e.indexOf(" in ")>=0){let t=e.split(" in ");return Iy.create(t[0].trim(),t[1].trim())}if(/^[^<=>]+>=[^<=>]+$/.test(e)){const t=e.split(">=");return Py.create(t[0].trim(),t[1].trim())}if(/^[^<=>]+>[^<=>]+$/.test(e)){const t=e.split(">");return Ry.create(t[0].trim(),t[1].trim())}if(/^[^<=>]+<=[^<=>]+$/.test(e)){const t=e.split("<=");return By.create(t[0].trim(),t[1].trim())}if(/^[^<=>]+<[^<=>]+$/.test(e)){const t=e.split("<");return Fy.create(t[0].trim(),t[1].trim())}return/^\!\s*/.test(e)?Ay.create(e.substr(1).trim()):Ny.create(e)}static _deserializeValue(e,t){if("true"===(e=e.trim()))return!0;if("false"===e)return!1;let i=/^'([^']*)'$/.exec(e);return i?i[1].trim():e}static _deserializeRegexValue(e,t){if(qs(e)){if(t)throw new Error("missing regexp-value for =~-expression");return null}let i=e.indexOf("/"),n=e.lastIndexOf("/");if(i===n||i<0){if(t)throw new Error(`bad regexp-value '${e}', missing /-enclosure`);return null}let o=e.slice(i+1,n),s="i"===e[n+1]?"i":"";try{return new RegExp(o,s)}catch(r){if(t)throw new Error(`bad regexp-value '${e}', parse error: ${r}`);return null}}}function ky(e,t){return e.cmp(t)}class Dy{constructor(){this.type=0}cmp(e){return this.type-e.type}equals(e){return e.type===this.type}substituteConstants(){return this}evaluate(e){return!1}serialize(){return"false"}keys(){return[]}negate(){return Ly.INSTANCE}}Dy.INSTANCE=new Dy;class Ly{constructor(){this.type=1}cmp(e){return this.type-e.type}equals(e){return e.type===this.type}substituteConstants(){return this}evaluate(e){return!0}serialize(){return"true"}keys(){return[]}negate(){return Dy.INSTANCE}}Ly.INSTANCE=new Ly;class Ny{constructor(e,t){this.key=e,this.negated=t,this.type=2}static create(e,t=null){const i=yy.get(e);return"boolean"==typeof i?i?Ly.INSTANCE:Dy.INSTANCE:new Ny(e,t)}cmp(e){return e.type!==this.type?this.type-e.type:Ky(this.key,e.key)}equals(e){return e.type===this.type&&this.key===e.key}substituteConstants(){const e=yy.get(this.key);return"boolean"==typeof e?e?Ly.INSTANCE:Dy.INSTANCE:this}evaluate(e){return!!e.getValue(this.key)}serialize(){return this.key}keys(){return[this.key]}negate(){return this.negated||(this.negated=Ay.create(this.key,this)),this.negated}}class Ey{constructor(e,t,i){this.key=e,this.value=t,this.negated=i,this.type=4}static create(e,t,i=null){if("boolean"==typeof t)return t?Ny.create(e,i):Ay.create(e,i);const n=yy.get(e);if("boolean"==typeof n){return t===(n?"true":"false")?Ly.INSTANCE:Dy.INSTANCE}return new Ey(e,t,i)}cmp(e){return e.type!==this.type?this.type-e.type:qy(this.key,this.value,e.key,e.value)}equals(e){return e.type===this.type&&(this.key===e.key&&this.value===e.value)}substituteConstants(){const e=yy.get(this.key);if("boolean"==typeof e){const t=e?"true":"false";return this.value===t?Ly.INSTANCE:Dy.INSTANCE}return this}evaluate(e){return e.getValue(this.key)==this.value}serialize(){return`${this.key} == '${this.value}'`}keys(){return[this.key]}negate(){return this.negated||(this.negated=My.create(this.key,this.value,this)),this.negated}}class Iy{constructor(e,t){this.key=e,this.valueKey=t,this.type=10,this.negated=null}static create(e,t){return new Iy(e,t)}cmp(e){return e.type!==this.type?this.type-e.type:qy(this.key,this.valueKey,e.key,e.valueKey)}equals(e){return e.type===this.type&&(this.key===e.key&&this.valueKey===e.valueKey)}substituteConstants(){return this}evaluate(e){const t=e.getValue(this.valueKey),i=e.getValue(this.key);return Array.isArray(t)?t.indexOf(i)>=0:"string"==typeof i&&"object"==typeof t&&null!==t&&xy.call(t,i)}serialize(){return`${this.key} in '${this.valueKey}'`}keys(){return[this.key,this.valueKey]}negate(){return this.negated||(this.negated=Ty.create(this)),this.negated}}class Ty{constructor(e){this._actual=e,this.type=11}static create(e){return new Ty(e)}cmp(e){return e.type!==this.type?this.type-e.type:this._actual.cmp(e._actual)}equals(e){return e.type===this.type&&this._actual.equals(e._actual)}substituteConstants(){return this}evaluate(e){return!this._actual.evaluate(e)}serialize(){throw new Error("Method not implemented.")}keys(){return this._actual.keys()}negate(){return this._actual}}class My{constructor(e,t,i){this.key=e,this.value=t,this.negated=i,this.type=5}static create(e,t,i=null){if("boolean"==typeof t)return t?Ay.create(e,i):Ny.create(e,i);const n=yy.get(e);if("boolean"==typeof n){return t===(n?"true":"false")?Dy.INSTANCE:Ly.INSTANCE}return new My(e,t,i)}cmp(e){return e.type!==this.type?this.type-e.type:qy(this.key,this.value,e.key,e.value)}equals(e){return e.type===this.type&&(this.key===e.key&&this.value===e.value)}substituteConstants(){const e=yy.get(this.key);if("boolean"==typeof e){const t=e?"true":"false";return this.value===t?Dy.INSTANCE:Ly.INSTANCE}return this}evaluate(e){return e.getValue(this.key)!=this.value}serialize(){return`${this.key} != '${this.value}'`}keys(){return[this.key]}negate(){return this.negated||(this.negated=Ey.create(this.key,this.value,this)),this.negated}}class Ay{constructor(e,t){this.key=e,this.negated=t,this.type=3}static create(e,t=null){const i=yy.get(e);return"boolean"==typeof i?i?Dy.INSTANCE:Ly.INSTANCE:new Ay(e,t)}cmp(e){return e.type!==this.type?this.type-e.type:Ky(this.key,e.key)}equals(e){return e.type===this.type&&this.key===e.key}substituteConstants(){const e=yy.get(this.key);return"boolean"==typeof e?e?Dy.INSTANCE:Ly.INSTANCE:this}evaluate(e){return!e.getValue(this.key)}serialize(){return`!${this.key}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=Ny.create(this.key,this)),this.negated}}function Oy(e,t){if("string"==typeof e){const t=parseFloat(e);isNaN(t)||(e=t)}return"string"==typeof e||"number"==typeof e?t(e):Dy.INSTANCE}class Ry{constructor(e,t,i){this.key=e,this.value=t,this.negated=i,this.type=12}static create(e,t,i=null){return Oy(t,(t=>new Ry(e,t,i)))}cmp(e){return e.type!==this.type?this.type-e.type:qy(this.key,this.value,e.key,e.value)}equals(e){return e.type===this.type&&(this.key===e.key&&this.value===e.value)}substituteConstants(){return this}evaluate(e){return"string"!=typeof this.value&&parseFloat(e.getValue(this.key))>this.value}serialize(){return`${this.key} > ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=By.create(this.key,this.value,this)),this.negated}}class Py{constructor(e,t,i){this.key=e,this.value=t,this.negated=i,this.type=13}static create(e,t,i=null){return Oy(t,(t=>new Py(e,t,i)))}cmp(e){return e.type!==this.type?this.type-e.type:qy(this.key,this.value,e.key,e.value)}equals(e){return e.type===this.type&&(this.key===e.key&&this.value===e.value)}substituteConstants(){return this}evaluate(e){return"string"!=typeof this.value&&parseFloat(e.getValue(this.key))>=this.value}serialize(){return`${this.key} >= ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=Fy.create(this.key,this.value,this)),this.negated}}class Fy{constructor(e,t,i){this.key=e,this.value=t,this.negated=i,this.type=14}static create(e,t,i=null){return Oy(t,(t=>new Fy(e,t,i)))}cmp(e){return e.type!==this.type?this.type-e.type:qy(this.key,this.value,e.key,e.value)}equals(e){return e.type===this.type&&(this.key===e.key&&this.value===e.value)}substituteConstants(){return this}evaluate(e){return"string"!=typeof this.value&&parseFloat(e.getValue(this.key))<this.value}serialize(){return`${this.key} < ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=Py.create(this.key,this.value,this)),this.negated}}class By{constructor(e,t,i){this.key=e,this.value=t,this.negated=i,this.type=15}static create(e,t,i=null){return Oy(t,(t=>new By(e,t,i)))}cmp(e){return e.type!==this.type?this.type-e.type:qy(this.key,this.value,e.key,e.value)}equals(e){return e.type===this.type&&(this.key===e.key&&this.value===e.value)}substituteConstants(){return this}evaluate(e){return"string"!=typeof this.value&&parseFloat(e.getValue(this.key))<=this.value}serialize(){return`${this.key} <= ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=Ry.create(this.key,this.value,this)),this.negated}}class Vy{constructor(e,t){this.key=e,this.regexp=t,this.type=7,this.negated=null}static create(e,t){return new Vy(e,t)}cmp(e){if(e.type!==this.type)return this.type-e.type;if(this.key<e.key)return-1;if(this.key>e.key)return 1;const t=this.regexp?this.regexp.source:"",i=e.regexp?e.regexp.source:"";return t<i?-1:t>i?1:0}equals(e){if(e.type===this.type){const t=this.regexp?this.regexp.source:"",i=e.regexp?e.regexp.source:"";return this.key===e.key&&t===i}return!1}substituteConstants(){return this}evaluate(e){let t=e.getValue(this.key);return!!this.regexp&&this.regexp.test(t)}serialize(){const e=this.regexp?`/${this.regexp.source}/${this.regexp.ignoreCase?"i":""}`:"/invalid/";return`${this.key} =~ ${e}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=Wy.create(this)),this.negated}}class Wy{constructor(e){this._actual=e,this.type=8}static create(e){return new Wy(e)}cmp(e){return e.type!==this.type?this.type-e.type:this._actual.cmp(e._actual)}equals(e){return e.type===this.type&&this._actual.equals(e._actual)}substituteConstants(){return this}evaluate(e){return!this._actual.evaluate(e)}serialize(){throw new Error("Method not implemented.")}keys(){return this._actual.keys()}negate(){return this._actual}}function zy(e){let t=null;for(let i=0,n=e.length;i<n;i++){const n=e[i].substituteConstants();if(e[i]!==n&&null===t){t=[];for(let n=0;n<i;n++)t[n]=e[n]}null!==t&&(t[i]=n)}return null===t?e:t}class Hy{constructor(e,t){this.expr=e,this.negated=t,this.type=6}static create(e,t){return Hy._normalizeArr(e,t)}cmp(e){if(e.type!==this.type)return this.type-e.type;if(this.expr.length<e.expr.length)return-1;if(this.expr.length>e.expr.length)return 1;for(let t=0,i=this.expr.length;t<i;t++){const i=ky(this.expr[t],e.expr[t]);if(0!==i)return i}return 0}equals(e){if(e.type===this.type){if(this.expr.length!==e.expr.length)return!1;for(let t=0,i=this.expr.length;t<i;t++)if(!this.expr[t].equals(e.expr[t]))return!1;return!0}return!1}substituteConstants(){const e=zy(this.expr);return e===this.expr?this:Hy.create(e,this.negated)}evaluate(e){for(let t=0,i=this.expr.length;t<i;t++)if(!this.expr[t].evaluate(e))return!1;return!0}static _normalizeArr(e,t){const i=[];let n=!1;for(const o of e)if(o)if(1!==o.type){if(0===o.type)return Dy.INSTANCE;6!==o.type?i.push(o):i.push(...o.expr)}else n=!0;if(0===i.length&&n)return Ly.INSTANCE;if(0!==i.length){if(1===i.length)return i[0];i.sort(ky);for(let e=1;e<i.length;e++)i[e-1].equals(i[e])&&(i.splice(e,1),e--);if(1===i.length)return i[0];for(;i.length>1;){const e=i[i.length-1];if(9!==e.type)break;i.pop();const t=i.pop(),n=0===i.length,o=jy.create(e.expr.map((e=>Hy.create([e,t],null))),null,n);o&&(i.push(o),i.sort(ky))}return 1===i.length?i[0]:new Hy(i,t)}}serialize(){return this.expr.map((e=>e.serialize())).join(" && ")}keys(){const e=[];for(let t of this.expr)e.push(...t.keys());return e}negate(){if(!this.negated){const e=[];for(let t of this.expr)e.push(t.negate());this.negated=jy.create(e,this,!0)}return this.negated}}class jy{constructor(e,t){this.expr=e,this.negated=t,this.type=9}static create(e,t,i){return jy._normalizeArr(e,t,i)}cmp(e){if(e.type!==this.type)return this.type-e.type;if(this.expr.length<e.expr.length)return-1;if(this.expr.length>e.expr.length)return 1;for(let t=0,i=this.expr.length;t<i;t++){const i=ky(this.expr[t],e.expr[t]);if(0!==i)return i}return 0}equals(e){if(e.type===this.type){if(this.expr.length!==e.expr.length)return!1;for(let t=0,i=this.expr.length;t<i;t++)if(!this.expr[t].equals(e.expr[t]))return!1;return!0}return!1}substituteConstants(){const e=zy(this.expr);return e===this.expr?this:jy.create(e,this.negated,!1)}evaluate(e){for(let t=0,i=this.expr.length;t<i;t++)if(this.expr[t].evaluate(e))return!0;return!1}static _normalizeArr(e,t,i){let n=[],o=!1;if(e){for(let t=0,i=e.length;t<i;t++){const i=e[t];if(i)if(0!==i.type){if(1===i.type)return Ly.INSTANCE;9!==i.type?n.push(i):n=n.concat(i.expr)}else o=!0}if(0===n.length&&o)return Dy.INSTANCE;n.sort(ky)}if(0!==n.length){if(1===n.length)return n[0];for(let e=1;e<n.length;e++)n[e-1].equals(n[e])&&(n.splice(e,1),e--);if(1===n.length)return n[0];if(i){for(let e=0;e<n.length;e++)for(let t=e+1;t<n.length;t++)Gy(n[e],n[t])&&(n.splice(t,1),t--);if(1===n.length)return n[0]}return new jy(n,t)}}serialize(){return this.expr.map((e=>e.serialize())).join(" || ")}keys(){const e=[];for(let t of this.expr)e.push(...t.keys());return e}negate(){if(!this.negated){let e=[];for(let t of this.expr)e.push(t.negate());for(;e.length>1;){const t=e.shift(),i=e.shift(),n=[];for(const e of Zy(t))for(const t of Zy(i))n.push(Hy.create([e,t],null));const o=0===e.length;e.unshift(jy.create(n,null,o))}this.negated=e[0]}return this.negated}}class Uy extends Ny{constructor(e,t,i){super(e,null),this._defaultValue=t,"object"==typeof i?Uy._info.push(Object.assign(Object.assign({},i),{key:e})):!0!==i&&Uy._info.push({key:e,description:i,type:null!=t?typeof t:void 0})}static all(){return Uy._info.values()}bindTo(e){return e.createKey(this.key,this._defaultValue)}getValue(e){return e.getContextKeyValue(this.key)}toNegated(){return this.negate()}isEqualTo(e){return Ey.create(this.key,e)}}Uy._info=[];const $y=L_("contextKeyService");function Ky(e,t){return e<t?-1:e>t?1:0}function qy(e,t,i,n){return e<i?-1:e>i?1:t<n?-1:t>n?1:0}function Gy(e,t){if(6===t.type&&9!==e.type&&6!==e.type)for(const n of t.expr)if(e.equals(n))return!0;const i=Zy(e.negate()).concat(Zy(t));i.sort(ky);for(let n=0;n<i.length;n++){const e=i[n].negate();for(let t=n+1;t<i.length;t++){const n=i[t];if(e.equals(n))return!0}}return!1}function Zy(e){return 9===e.type?e.expr:[e]}const Yy=new class{constructor(){this.data=new Map}add(e,t){E_(Gs(e)),E_(Zs(t)),E_(!this.data.has(e),"There is already an extension with this id"),this.data.set(e,t)}as(e){return this.data.get(e)||null}};var Xy;!function(e){e.DARK="dark",e.LIGHT="light",e.HIGH_CONTRAST="hc"}(Xy||(Xy={}));const Qy=L_("themeService");var Jy,ex;function tx(e){return{id:e}}function ix(e){switch(e){case Xy.DARK:return"vs-dark";case Xy.HIGH_CONTRAST:return"hc-black";default:return"vs"}}!function(e){e.isThemeColor=function(e){return e&&"object"==typeof e&&"string"==typeof e.id}}(Jy||(Jy={})),function(e){e.isThemeIcon=function(e){return e&&"object"==typeof e&&"string"==typeof e.id&&(void 0===e.color||Jy.isThemeColor(e.color))};const t=new RegExp(`^\\$\\((${Ys.iconNameExpression}(?:${Ys.iconModifierExpression})?)\\)$`);e.fromString=function(e){const i=t.exec(e);if(!i)return;let[,n]=i;return{id:n}},e.fromId=function(e){return{id:e}},e.modify=function(e,t){let i=e.id;const n=i.lastIndexOf("~");return-1!==n&&(i=i.substring(0,n)),t&&(i=`${i}~${t}`),{id:i}},e.getModifier=function(e){const t=e.id.lastIndexOf("~");if(-1!==t)return e.id.substring(t+1)},e.isEqual=function(e,t){var i,n;return e.id===t.id&&(null===(i=e.color)||void 0===i?void 0:i.id)===(null===(n=t.color)||void 0===n?void 0:n.id)},e.asThemeIcon=function(e,t){return{id:e.id,color:t?tx(t):void 0}},e.asClassNameArray=Ys.asClassNameArray,e.asClassName=Ys.asClassName,e.asCSSSelector=Ys.asCSSSelector}(ex||(ex={}));const nx="base.contributions.theming";let ox=new class{constructor(){this.themingParticipants=[],this.themingParticipants=[],this.onThemingParticipantAddedEmitter=new $o}onColorThemeChange(e){return this.themingParticipants.push(e),this.onThemingParticipantAddedEmitter.fire(e),es((()=>{const t=this.themingParticipants.indexOf(e);this.themingParticipants.splice(t,1)}))}getThemingParticipants(){return this.themingParticipants}};function sx(e){return ox.onColorThemeChange(e)}Yy.add(nx,ox);class rx extends Uo{constructor(e){super(),this.themeService=e,this.theme=e.getColorTheme(),this._register(this.themeService.onDidColorThemeChange((e=>this.onThemeChange(e))))}onThemeChange(e){this.theme=e,this.updateStyles()}updateStyles(){}}var ax=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},lx=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};function dx(e){return void 0!==e.command}class cx{constructor(e){this.id=cx._idPool++,this._debugName=e}}cx._idPool=0,cx.CommandPalette=new cx("CommandPalette"),cx.DebugBreakpointsContext=new cx("DebugBreakpointsContext"),cx.DebugCallStackContext=new cx("DebugCallStackContext"),cx.DebugConsoleContext=new cx("DebugConsoleContext"),cx.DebugVariablesContext=new cx("DebugVariablesContext"),cx.DebugWatchContext=new cx("DebugWatchContext"),cx.DebugToolBar=new cx("DebugToolBar"),cx.EditorContext=new cx("EditorContext"),cx.SimpleEditorContext=new cx("SimpleEditorContext"),cx.EditorContextCopy=new cx("EditorContextCopy"),cx.EditorContextPeek=new cx("EditorContextPeek"),cx.EditorTitle=new cx("EditorTitle"),cx.EditorTitleRun=new cx("EditorTitleRun"),cx.EditorTitleContext=new cx("EditorTitleContext"),cx.EmptyEditorGroup=new cx("EmptyEditorGroup"),cx.EmptyEditorGroupContext=new cx("EmptyEditorGroupContext"),cx.ExplorerContext=new cx("ExplorerContext"),cx.ExtensionContext=new cx("ExtensionContext"),cx.GlobalActivity=new cx("GlobalActivity"),cx.LayoutControlMenuSubmenu=new cx("LayoutControlMenuSubmenu"),cx.LayoutControlMenu=new cx("LayoutControlMenu"),cx.MenubarMainMenu=new cx("MenubarMainMenu"),cx.MenubarAppearanceMenu=new cx("MenubarAppearanceMenu"),cx.MenubarDebugMenu=new cx("MenubarDebugMenu"),cx.MenubarEditMenu=new cx("MenubarEditMenu"),cx.MenubarCopy=new cx("MenubarCopy"),cx.MenubarFileMenu=new cx("MenubarFileMenu"),cx.MenubarGoMenu=new cx("MenubarGoMenu"),cx.MenubarHelpMenu=new cx("MenubarHelpMenu"),cx.MenubarLayoutMenu=new cx("MenubarLayoutMenu"),cx.MenubarNewBreakpointMenu=new cx("MenubarNewBreakpointMenu"),cx.MenubarPanelAlignmentMenu=new cx("MenubarPanelAlignmentMenu"),cx.MenubarPanelPositionMenu=new cx("MenubarPanelPositionMenu"),cx.MenubarPreferencesMenu=new cx("MenubarPreferencesMenu"),cx.MenubarRecentMenu=new cx("MenubarRecentMenu"),cx.MenubarSelectionMenu=new cx("MenubarSelectionMenu"),cx.MenubarSwitchEditorMenu=new cx("MenubarSwitchEditorMenu"),cx.MenubarSwitchGroupMenu=new cx("MenubarSwitchGroupMenu"),cx.MenubarTerminalMenu=new cx("MenubarTerminalMenu"),cx.MenubarViewMenu=new cx("MenubarViewMenu"),cx.MenubarHomeMenu=new cx("MenubarHomeMenu"),cx.OpenEditorsContext=new cx("OpenEditorsContext"),cx.ProblemsPanelContext=new cx("ProblemsPanelContext"),cx.SCMChangeContext=new cx("SCMChangeContext"),cx.SCMResourceContext=new cx("SCMResourceContext"),cx.SCMResourceFolderContext=new cx("SCMResourceFolderContext"),cx.SCMResourceGroupContext=new cx("SCMResourceGroupContext"),cx.SCMSourceControl=new cx("SCMSourceControl"),cx.SCMTitle=new cx("SCMTitle"),cx.SearchContext=new cx("SearchContext"),cx.StatusBarWindowIndicatorMenu=new cx("StatusBarWindowIndicatorMenu"),cx.StatusBarRemoteIndicatorMenu=new cx("StatusBarRemoteIndicatorMenu"),cx.TestItem=new cx("TestItem"),cx.TestItemGutter=new cx("TestItemGutter"),cx.TestPeekElement=new cx("TestPeekElement"),cx.TestPeekTitle=new cx("TestPeekTitle"),cx.TouchBarContext=new cx("TouchBarContext"),cx.TitleBarContext=new cx("TitleBarContext"),cx.TunnelContext=new cx("TunnelContext"),cx.TunnelPrivacy=new cx("TunnelPrivacy"),cx.TunnelProtocol=new cx("TunnelProtocol"),cx.TunnelPortInline=new cx("TunnelInline"),cx.TunnelTitle=new cx("TunnelTitle"),cx.TunnelLocalAddressInline=new cx("TunnelLocalAddressInline"),cx.TunnelOriginInline=new cx("TunnelOriginInline"),cx.ViewItemContext=new cx("ViewItemContext"),cx.ViewContainerTitle=new cx("ViewContainerTitle"),cx.ViewContainerTitleContext=new cx("ViewContainerTitleContext"),cx.ViewTitle=new cx("ViewTitle"),cx.ViewTitleContext=new cx("ViewTitleContext"),cx.CommentThreadTitle=new cx("CommentThreadTitle"),cx.CommentThreadActions=new cx("CommentThreadActions"),cx.CommentTitle=new cx("CommentTitle"),cx.CommentActions=new cx("CommentActions"),cx.InteractiveToolbar=new cx("InteractiveToolbar"),cx.InteractiveCellTitle=new cx("InteractiveCellTitle"),cx.InteractiveCellExecute=new cx("InteractiveCellExecute"),cx.InteractiveInputExecute=new cx("InteractiveInputExecute"),cx.NotebookToolbar=new cx("NotebookToolbar"),cx.NotebookCellTitle=new cx("NotebookCellTitle"),cx.NotebookCellInsert=new cx("NotebookCellInsert"),cx.NotebookCellBetween=new cx("NotebookCellBetween"),cx.NotebookCellListTop=new cx("NotebookCellTop"),cx.NotebookCellExecute=new cx("NotebookCellExecute"),cx.NotebookCellExecutePrimary=new cx("NotebookCellExecutePrimary"),cx.NotebookDiffCellInputTitle=new cx("NotebookDiffCellInputTitle"),cx.NotebookDiffCellMetadataTitle=new cx("NotebookDiffCellMetadataTitle"),cx.NotebookDiffCellOutputsTitle=new cx("NotebookDiffCellOutputsTitle"),cx.NotebookOutputToolbar=new cx("NotebookOutputToolbar"),cx.NotebookEditorLayoutConfigure=new cx("NotebookEditorLayoutConfigure"),cx.BulkEditTitle=new cx("BulkEditTitle"),cx.BulkEditContext=new cx("BulkEditContext"),cx.TimelineItemContext=new cx("TimelineItemContext"),cx.TimelineTitle=new cx("TimelineTitle"),cx.TimelineTitleContext=new cx("TimelineTitleContext"),cx.AccountsContext=new cx("AccountsContext"),cx.PanelTitle=new cx("PanelTitle"),cx.AuxiliaryBarTitle=new cx("AuxiliaryBarTitle"),cx.TerminalInstanceContext=new cx("TerminalInstanceContext"),cx.TerminalEditorInstanceContext=new cx("TerminalEditorInstanceContext"),cx.TerminalNewDropdownContext=new cx("TerminalNewDropdownContext"),cx.TerminalTabContext=new cx("TerminalTabContext"),cx.TerminalTabEmptyAreaContext=new cx("TerminalTabEmptyAreaContext"),cx.TerminalInlineTabContext=new cx("TerminalInlineTabContext"),cx.WebviewContext=new cx("WebviewContext"),cx.InlineCompletionsActions=new cx("InlineCompletionsActions"),cx.NewFile=new cx("NewFile");const hx=L_("menuService"),ux=new class{constructor(){this._commands=new Map,this._menuItems=new Map,this._onDidChangeMenu=new $o,this.onDidChangeMenu=this._onDidChangeMenu.event,this._commandPaletteChangeEvent={has:e=>e===cx.CommandPalette}}addCommand(e){return this.addCommands(Hs.single(e))}addCommands(e){for(const t of e)this._commands.set(t.id,t);return this._onDidChangeMenu.fire(this._commandPaletteChangeEvent),es((()=>{let t=!1;for(const i of e)t=this._commands.delete(i.id)||t;t&&this._onDidChangeMenu.fire(this._commandPaletteChangeEvent)}))}getCommand(e){return this._commands.get(e)}getCommands(){const e=new Map;return this._commands.forEach(((t,i)=>e.set(i,t))),e}appendMenuItem(e,t){return this.appendMenuItems(Hs.single({id:e,item:t}))}appendMenuItems(e){const t=new Set,i=new zs;for(const{id:n,item:o}of e){let e=this._menuItems.get(n);e||(e=new zs,this._menuItems.set(n,e)),i.push(e.push(o)),t.add(n)}return this._onDidChangeMenu.fire(t),es((()=>{if(i.size>0){for(let e of i)e();this._onDidChangeMenu.fire(t),i.clear()}}))}getMenuItems(e){let t;return t=this._menuItems.has(e)?[...this._menuItems.get(e)]:[],e===cx.CommandPalette&&this._appendImplicitItems(t),t}_appendImplicitItems(e){const t=new Set;for(const i of e)dx(i)&&(t.add(i.command.id),i.alt&&t.add(i.alt.id));this._commands.forEach(((i,n)=>{t.has(n)||e.push({command:i})}))}};class gx extends vy{constructor(e,t,i,n){super(`submenuitem.${e.submenu.id}`,"string"==typeof e.title?e.title:e.title.value,[],"submenu"),this.item=e,this._menuService=t,this._contextKeyService=i,this._options=n}get actions(){const e=[],t=this._menuService.createMenu(this.item.submenu,this._contextKeyService),i=t.getActions(this._options);t.dispose();for(const[,n]of i)n.length>0&&(e.push(...n),e.push(new _y));return e.length&&e.pop(),e}}let px=class e{constructor(t,i,n,o,s){var r,a;if(this._commandService=s,this.id=t.id,this.label=(null==n?void 0:n.renderShortTitle)&&t.shortTitle?"string"==typeof t.shortTitle?t.shortTitle:t.shortTitle.value:"string"==typeof t.title?t.title:t.title.value,this.tooltip=null!==(a="string"==typeof t.tooltip?t.tooltip:null===(r=t.tooltip)||void 0===r?void 0:r.value)&&void 0!==a?a:"",this.enabled=!t.precondition||o.contextMatchesRules(t.precondition),this.checked=void 0,t.toggled){const e=t.toggled.condition?t.toggled:{condition:t.toggled};this.checked=o.contextMatchesRules(e.condition),this.checked&&e.tooltip&&(this.tooltip="string"==typeof e.tooltip?e.tooltip:e.tooltip.value),e.title&&(this.label="string"==typeof e.title?e.title:e.title.value)}this.item=t,this.alt=i?new e(i,void 0,n,o,s):void 0,this._options=n,ex.isThemeIcon(t.icon)&&(this.class=Ys.asClassName(t.icon))}dispose(){}run(...e){var t,i;let n=[];return(null===(t=this._options)||void 0===t?void 0:t.arg)&&(n=[...n,this._options.arg]),(null===(i=this._options)||void 0===i?void 0:i.shouldForwardArgs)&&(n=[...n,...e]),this._commandService.executeCommand(this.id,...n)}};px=ax([lx(3,$y),lx(4,wy)],px);class mx{constructor(){this._coreKeybindings=[],this._extensionKeybindings=[],this._cachedMergedKeybindings=null}static bindToCurrentPlatform(e){if(1===Xs){if(e&&e.win)return e.win}else if(2===Xs){if(e&&e.mac)return e.mac}else if(e&&e.linux)return e.linux;return e}registerKeybindingRule(e){const t=mx.bindToCurrentPlatform(e);if(t&&t.primary){const i=Pw(t.primary,Xs);i&&this._registerDefaultKeybinding(i,e.id,e.args,e.weight,0,e.when)}if(t&&Array.isArray(t.secondary))for(let i=0,n=t.secondary.length;i<n;i++){const n=Pw(t.secondary[i],Xs);n&&this._registerDefaultKeybinding(n,e.id,e.args,e.weight,-i-1,e.when)}}registerCommandAndKeybindingRule(e){this.registerKeybindingRule(e),Cy.registerCommand(e)}static _mightProduceChar(e){return e>=21&&e<=30||(e>=31&&e<=56||(80===e||81===e||82===e||83===e||84===e||85===e||86===e||110===e||111===e||87===e||88===e||89===e||90===e||91===e||92===e))}_assertNoCtrlAlt(e,t){e.ctrlKey&&e.altKey&&!e.metaKey&&mx._mightProduceChar(e.keyCode)}_registerDefaultKeybinding(e,t,i,n,o,s){1===Xs&&this._assertNoCtrlAlt(e.parts[0],t),this._coreKeybindings.push({keybinding:e.parts,command:t,commandArgs:i,when:s,weight1:n,weight2:o,extensionId:null,isBuiltinExtension:!1}),this._cachedMergedKeybindings=null}getDefaultKeybindings(){return this._cachedMergedKeybindings||(this._cachedMergedKeybindings=[].concat(this._coreKeybindings).concat(this._extensionKeybindings),this._cachedMergedKeybindings.sort(_x)),this._cachedMergedKeybindings.slice(0)}}const fx=new mx;function _x(e,t){return e.weight1!==t.weight1?e.weight1-t.weight1:e.command<t.command?-1:e.command>t.command?1:e.weight2-t.weight2}Yy.add("platform.keybindingsRegistry",fx);const vx=L_("telemetryService");class bx{constructor(e){this.id=e.id,this.precondition=e.precondition,this._kbOpts=e.kbOpts,this._menuOpts=e.menuOpts,this._description=e.description}register(){if(Array.isArray(this._menuOpts)?this._menuOpts.forEach(this._registerMenuItem,this):this._menuOpts&&this._registerMenuItem(this._menuOpts),this._kbOpts){const e=Array.isArray(this._kbOpts)?this._kbOpts:[this._kbOpts];for(const t of e){let e=t.kbExpr;this.precondition&&(e=e?Sy.and(e,this.precondition):this.precondition);const i={id:this.id,weight:t.weight,args:t.args,when:e,primary:t.primary,secondary:t.secondary,win:t.win,linux:t.linux,mac:t.mac};fx.registerKeybindingRule(i)}}Cy.registerCommand({id:this.id,handler:(e,t)=>this.runCommand(e,t),description:this._description})}_registerMenuItem(e){ux.appendMenuItem(e.menuId,{group:e.group,command:{id:this.id,title:e.title,icon:e.icon,precondition:this.precondition},when:e.when,order:e.order})}}class wx extends bx{constructor(){super(...arguments),this._implementations=[]}addImplementation(e,t,i){return this._implementations.push({priority:e,name:t,implementation:i}),this._implementations.sort(((e,t)=>t.priority-e.priority)),{dispose:()=>{for(let e=0;e<this._implementations.length;e++)if(this._implementations[e].implementation===i)return void this._implementations.splice(e,1)}}}runCommand(e,t){const i=e.get(Cb);i.trace(`Executing Command '${this.id}' which has ${this._implementations.length} bound.`);for(const n of this._implementations){const o=n.implementation(e,t);if(o){if(i.trace(`Command '${this.id}' was handled by '${n.name}'.`),"boolean"==typeof o)return;return o}}i.trace(`The Command '${this.id}' was not handled by any implementation.`)}}class Cx extends bx{constructor(e,t){super(t),this.command=e}runCommand(e,t){return this.command.runCommand(e,t)}}class yx extends bx{static bindToContribution(e){return class extends yx{constructor(e){super(e),this._callback=e.handler}runEditorCommand(t,i,n){const o=e(i);o&&this._callback(o,n)}}}runCommand(e,t){const i=e.get(N_),n=i.getFocusedCodeEditor()||i.getActiveCodeEditor();if(n)return n.invokeWithinContext((e=>{if(e.get($y).contextMatchesRules(Qs(this.precondition)))return this.runEditorCommand(e,n,t)}))}}class xx extends yx{constructor(e){super(xx.convertOptions(e)),this.label=e.label,this.alias=e.alias}static convertOptions(e){let t;function i(t){return t.menuId||(t.menuId=cx.EditorContext),t.title||(t.title=e.label),t.when=Sy.and(e.precondition,t.when),t}return t=Array.isArray(e.menuOpts)?e.menuOpts:e.menuOpts?[e.menuOpts]:[],Array.isArray(e.contextMenuOpts)?t.push(...e.contextMenuOpts.map(i)):e.contextMenuOpts&&t.push(i(e.contextMenuOpts)),e.menuOpts=t,e}runEditorCommand(e,t,i){return this.reportTelemetry(e,t),this.run(e,t,i||{})}reportTelemetry(e,t){e.get(vx).publicLog2("editorActionInvoked",{name:this.label,id:this.id})}}class Sx extends xx{constructor(){super(...arguments),this._implementations=[]}addImplementation(e,t){return this._implementations.push([e,t]),this._implementations.sort(((e,t)=>t[0]-e[0])),{dispose:()=>{for(let e=0;e<this._implementations.length;e++)if(this._implementations[e][1]===t)return void this._implementations.splice(e,1)}}}run(e,t,i){for(const n of this._implementations){const o=n[1](e,t,i);if(o){if("boolean"==typeof o)return;return o}}}}function kx(e,t){Cy.registerCommand(e,(function(e,...i){const n=e.get(k_),[o,s]=i;Js(Ps.isUri(o)),Js(er.isIPosition(s));const r=e.get(Gv).getModel(o);if(r){const e=er.lift(s);return n.invokeFunction(t,r,e,...i.slice(2))}return e.get(gy).createModelReference(o).then((e=>new Promise(((o,r)=>{try{o(n.invokeFunction(t,e.object.textEditorModel,er.lift(s),i.slice(2)))}catch(a){r(a)}})).finally((()=>{e.dispose()}))))}))}function Dx(e){return Mx.INSTANCE.registerEditorCommand(e),e}function Lx(e){const t=new e;return Mx.INSTANCE.registerEditorAction(t),t}function Nx(e){return Mx.INSTANCE.registerEditorAction(e),e}function Ex(e){Mx.INSTANCE.registerEditorAction(e)}function Ix(e,t){Mx.INSTANCE.registerEditorContribution(e,t)}var Tx;!function(e){e.getEditorCommand=function(e){return Mx.INSTANCE.getEditorCommand(e)},e.getEditorActions=function(){return Mx.INSTANCE.getEditorActions()},e.getEditorContributions=function(){return Mx.INSTANCE.getEditorContributions()},e.getSomeEditorContributions=function(e){return Mx.INSTANCE.getEditorContributions().filter((t=>e.indexOf(t.id)>=0))},e.getDiffEditorContributions=function(){return Mx.INSTANCE.getDiffEditorContributions()}}(Tx||(Tx={}));class Mx{constructor(){this.editorContributions=[],this.diffEditorContributions=[],this.editorActions=[],this.editorCommands=Object.create(null)}registerEditorContribution(e,t){this.editorContributions.push({id:e,ctor:t})}getEditorContributions(){return this.editorContributions.slice(0)}getDiffEditorContributions(){return this.diffEditorContributions.slice(0)}registerEditorAction(e){e.register(),this.editorActions.push(e)}getEditorActions(){return this.editorActions.slice(0)}registerEditorCommand(e){e.register(),this.editorCommands[e.id]=e}getEditorCommand(e){return this.editorCommands[e]||null}}function Ax(e){return e.register(),e}Mx.INSTANCE=new Mx,Yy.add("editor.contributions",Mx.INSTANCE);const Ox=Ax(new wx({id:"undo",precondition:void 0,kbOpts:{weight:0,primary:2104},menuOpts:[{menuId:cx.MenubarEditMenu,group:"1_do",title:mf(0,"&&Undo"),order:1},{menuId:cx.CommandPalette,group:"",title:mf(0,"Undo"),order:1}]}));Ax(new Cx(Ox,{id:"default:undo",precondition:void 0}));const Rx=Ax(new wx({id:"redo",precondition:void 0,kbOpts:{weight:0,primary:2103,secondary:[3128],mac:{primary:3128}},menuOpts:[{menuId:cx.MenubarEditMenu,group:"1_do",title:mf(0,"&&Redo"),order:2},{menuId:cx.CommandPalette,group:"",title:mf(0,"Redo"),order:1}]}));Ax(new Cx(Rx,{id:"default:redo",precondition:void 0}));const Px=Ax(new wx({id:"editor.action.selectAll",precondition:void 0,kbOpts:{weight:0,kbExpr:null,primary:2079},menuOpts:[{menuId:cx.MenubarSelectionMenu,group:"1_basic",title:mf(0,"&&Select All"),order:1},{menuId:cx.CommandPalette,group:"",title:mf(0,"Select All"),order:1}]}));var Fx=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},Bx=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};let Vx=class{constructor(e,t){}dispose(){}};Vx.ID="editor.contrib.markerDecorations",Vx=Fx([Bx(1,uy)],Vx),Ix(Vx.ID,Vx);class Wx extends Uo{constructor(e,t){super(),this._onDidChange=this._register(new $o),this.onDidChange=this._onDidChange.event,this._referenceDomElement=e,this._width=-1,this._height=-1,this._resizeObserver=null,this.measureReferenceDomElement(!1,t)}dispose(){this.stopObserving(),super.dispose()}getWidth(){return this._width}getHeight(){return this._height}startObserving(){!this._resizeObserver&&this._referenceDomElement&&(this._resizeObserver=new ResizeObserver((e=>{e&&e[0]&&e[0].contentRect?this.observe({width:e[0].contentRect.width,height:e[0].contentRect.height}):this.observe()})),this._resizeObserver.observe(this._referenceDomElement))}stopObserving(){this._resizeObserver&&(this._resizeObserver.disconnect(),this._resizeObserver=null)}observe(e){this.measureReferenceDomElement(!0,e)}measureReferenceDomElement(e,t){let i=0,n=0;t?(i=t.width,n=t.height):this._referenceDomElement&&(i=this._referenceDomElement.clientWidth,n=this._referenceDomElement.clientHeight),i=Math.max(5,i),n=Math.max(5,n),this._width===i&&this._height===n||(this._width=i,this._height=n,e&&this._onDidChange.fire())}}const zx=Object.prototype.hasOwnProperty;class Hx{constructor(){this.map=new Map}add(e,t){let i=this.map.get(e);i||(i=new Set,this.map.set(e,i)),i.add(t)}delete(e,t){const i=this.map.get(e);i&&(i.delete(t),0===i.size&&this.map.delete(e))}forEach(e,t){const i=this.map.get(e);i&&i.forEach(t)}}function jx(e){const t=e.wordWrap;!0===t?e.wordWrap="on":!1===t&&(e.wordWrap="off");const i=e.lineNumbers;!0===i?e.lineNumbers="on":!1===i&&(e.lineNumbers="off");!1===e.autoClosingBrackets&&(e.autoClosingBrackets="never",e.autoClosingQuotes="never",e.autoSurround="never");"visible"===e.cursorBlinking&&(e.cursorBlinking="solid");const n=e.renderWhitespace;!0===n?e.renderWhitespace="boundary":!1===n&&(e.renderWhitespace="none");const o=e.renderLineHighlight;!0===o?e.renderLineHighlight="line":!1===o&&(e.renderLineHighlight="none");const s=e.acceptSuggestionOnEnter;!0===s?e.acceptSuggestionOnEnter="on":!1===s&&(e.acceptSuggestionOnEnter="off");const r=e.tabCompletion;!1===r?e.tabCompletion="off":!0===r&&(e.tabCompletion="onlySnippets");const a=e.suggest;if(a&&"object"==typeof a.filteredTypes&&a.filteredTypes){const e={method:"showMethods",function:"showFunctions",constructor:"showConstructors",deprecated:"showDeprecated",field:"showFields",variable:"showVariables",class:"showClasses",struct:"showStructs",interface:"showInterfaces",module:"showModules",property:"showProperties",event:"showEvents",operator:"showOperators",unit:"showUnits",value:"showValues",constant:"showConstants",enum:"showEnums",enumMember:"showEnumMembers",keyword:"showKeywords",text:"showWords",color:"showColors",file:"showFiles",reference:"showReferences",folder:"showFolders",typeParameter:"showTypeParameters",snippet:"showSnippets"};(function(e,t){for(let i in e)if(zx.call(e,i)&&!1===t({key:i,value:e[i]},(function(){delete e[i]})))return})(e,(e=>{const t=a.filteredTypes[e.key];!1===t&&(a[e.value]=t)}))}const l=e.hover;!0===l?e.hover={enabled:!0}:!1===l&&(e.hover={enabled:!1});const d=e.parameterHints;!0===d?e.parameterHints={enabled:!0}:!1===d&&(e.parameterHints={enabled:!1});const c=e.autoIndent;!0===c?e.autoIndent="full":!1===c&&(e.autoIndent="advanced");const h=e.matchBrackets;!0===h?e.matchBrackets="always":!1===h&&(e.matchBrackets="never");const{renderIndentGuides:u,highlightActiveIndentGuide:g}=e;e.guides||(e.guides={}),void 0!==u&&(e.guides.indentation=!!u),void 0!==g&&(e.guides.highlightActiveIndentation=!!g)}const Ux=new class{constructor(){this._tabFocus=!1,this._onDidChangeTabFocus=new $o,this.onDidChangeTabFocus=this._onDidChangeTabFocus.event}getTabFocusMode(){return this._tabFocus}setTabFocusMode(e){this._tabFocus!==e&&(this._tabFocus=e,this._onDidChangeTabFocus.fire(this._tabFocus))}},$x=L_("accessibilityService"),Kx=new Uy("accessibilityModeEnabled",!1);var qx=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},Gx=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};let Zx=class extends Uo{constructor(e,t,i,n){super(),this._accessibilityService=n,this._onDidChange=this._register(new $o),this.onDidChange=this._onDidChange.event,this._onDidChangeFast=this._register(new $o),this.onDidChangeFast=this._onDidChangeFast.event,this._isDominatedByLongLines=!1,this._viewLineCount=1,this._lineNumbersDigitCount=1,this._reservedHeight=0,this._computeOptionsMemory=new vf,this.isSimpleWidget=e,this._containerObserver=this._register(new Wx(i,t.dimension)),this._rawOptions=eS(t),this._validatedOptions=Jx.validateOptions(this._rawOptions),this.options=this._computeOptions(),this.options.get(10)&&this._containerObserver.startObserving(),this._register(v_.onDidChangeZoomLevel((()=>this._recomputeOptions()))),this._register(Ux.onDidChangeTabFocus((()=>this._recomputeOptions()))),this._register(this._containerObserver.onDidChange((()=>this._recomputeOptions()))),this._register(x_.onDidChange((()=>this._recomputeOptions()))),this._register(t_.onDidChange((()=>this._recomputeOptions()))),this._register(this._accessibilityService.onDidChangeScreenReaderOptimized((()=>this._recomputeOptions())))}_recomputeOptions(){const e=this._computeOptions(),t=Jx.checkEquals(this.options,e);null!==t&&(this.options=e,this._onDidChangeFast.fire(t),this._onDidChange.fire(t))}_computeOptions(){const e=this._readEnvConfiguration(),t=w_.createFromValidatedSettings(this._validatedOptions,e.pixelRatio,this.isSimpleWidget),i=this._readFontInfo(t),n={memory:this._computeOptionsMemory,outerWidth:e.outerWidth,outerHeight:e.outerHeight-this._reservedHeight,fontInfo:i,extraEditorClassName:e.extraEditorClassName,isDominatedByLongLines:this._isDominatedByLongLines,viewLineCount:this._viewLineCount,lineNumbersDigitCount:this._lineNumbersDigitCount,emptySelectionClipboard:e.emptySelectionClipboard,pixelRatio:e.pixelRatio,tabFocusMode:Ux.getTabFocusMode(),accessibilitySupport:e.accessibilitySupport};return Jx.computeOptions(this._validatedOptions,n)}_readEnvConfiguration(){return{extraEditorClassName:Yx(),outerWidth:this._containerObserver.getWidth(),outerHeight:this._containerObserver.getHeight(),emptySelectionClipboard:s_||o_,pixelRatio:t_.value,accessibilitySupport:this._accessibilityService.isScreenReaderOptimized()?2:this._accessibilityService.getAccessibilitySupport()}}_readFontInfo(e){return x_.readFontInfo(e)}getRawOptions(){return this._rawOptions}updateOptions(e){const t=eS(e);Jx.applyUpdate(this._rawOptions,t)&&(this._validatedOptions=Jx.validateOptions(this._rawOptions),this._recomputeOptions())}observeContainer(e){this._containerObserver.observe(e)}setIsDominatedByLongLines(e){this._isDominatedByLongLines!==e&&(this._isDominatedByLongLines=e,this._recomputeOptions())}setModelLineCount(e){const t=function(e){let t=0;for(;e;)e=Math.floor(e/10),t++;return t||1}(e);this._lineNumbersDigitCount!==t&&(this._lineNumbersDigitCount=t,this._recomputeOptions())}setViewLineCount(e){this._viewLineCount!==e&&(this._viewLineCount=e,this._recomputeOptions())}setReservedHeight(e){this._reservedHeight!==e&&(this._reservedHeight=e,this._recomputeOptions())}};function Yx(){let e="";return a_||l_||(e+="no-user-select "),a_&&(e+="no-minimap-shadow "),zo&&(e+="mac "),e}Zx=qx([Gx(3,$x)],Zx);class Xx{constructor(){this._values=[]}_read(e){return this._values[e]}get(e){return this._values[e]}_write(e,t){this._values[e]=t}}class Qx{constructor(){this._values=[]}_read(e){if(e>=this._values.length)throw new Error("Cannot read uninitialized value");return this._values[e]}get(e){return this._read(e)}_write(e,t){this._values[e]=t}}class Jx{static validateOptions(e){const t=new Xx;for(const i of Zf){const n="_never_"===i.name?void 0:e[i.name];t._write(i.id,i.validate(n))}return t}static computeOptions(e,t){const i=new Qx;for(const n of Zf)i._write(n.id,n.compute(t,i,e._read(n.id)));return i}static _deepEquals(e,t){if("object"!=typeof e||"object"!=typeof t||!e||!t)return e===t;if(Array.isArray(e)||Array.isArray(t))return!(!Array.isArray(e)||!Array.isArray(t))&&jo(e,t);if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const i in e)if(!Jx._deepEquals(e[i],t[i]))return!1;return!0}static checkEquals(e,t){const i=[];let n=!1;for(const o of Zf){const s=!Jx._deepEquals(e._read(o.id),t._read(o.id));i[o.id]=s,s&&(n=!0)}return n?new _f(i):null}static applyUpdate(e,t){let i=!1;for(const n of Zf)if(t.hasOwnProperty(n.name)){const o=n.applyUpdate(e[n.name],t[n.name]);e[n.name]=o.newValue,i=i||o.didChange}return i}}function eS(e){const t=tr(e);return jx(t),t}function tS(e,t,i){let n=null,o=null;if("function"==typeof i.value?(n="value",o=i.value,o.length):"function"==typeof i.get&&(n="get",o=i.get),!o)throw new Error("not supported");const s=`$memoize$${t}`;i[n]=function(...e){return this.hasOwnProperty(s)||Object.defineProperty(this,s,{configurable:!1,enumerable:!1,writable:!1,value:o.apply(this,e)}),this[s]}}var iS,nS=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r};!function(e){e.Tap="-monaco-gesturetap",e.Change="-monaco-gesturechange",e.Start="-monaco-gesturestart",e.End="-monaco-gesturesend",e.Contextmenu="-monaco-gesturecontextmenu"}(iS||(iS={}));class oS extends Uo{constructor(){super(),this.dispatched=!1,this.activeTouches={},this.handle=null,this.targets=[],this.ignoreTargets=[],this._lastSetTapCountTime=0,this._register(nC(document,"touchstart",(e=>this.onTouchStart(e)),{passive:!1})),this._register(nC(document,"touchend",(e=>this.onTouchEnd(e)))),this._register(nC(document,"touchmove",(e=>this.onTouchMove(e)),{passive:!1}))}static addTarget(e){return oS.isTouchDevice()?(oS.INSTANCE||(oS.INSTANCE=new oS),oS.INSTANCE.targets.push(e),{dispose:()=>{oS.INSTANCE.targets=oS.INSTANCE.targets.filter((t=>t!==e))}}):Uo.None}static ignoreTarget(e){return oS.isTouchDevice()?(oS.INSTANCE||(oS.INSTANCE=new oS),oS.INSTANCE.ignoreTargets.push(e),{dispose:()=>{oS.INSTANCE.ignoreTargets=oS.INSTANCE.ignoreTargets.filter((t=>t!==e))}}):Uo.None}static isTouchDevice(){return"ontouchstart"in window||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(e){let t=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let i=0,n=e.targetTouches.length;i<n;i++){let n=e.targetTouches.item(i);this.activeTouches[n.identifier]={id:n.identifier,initialTarget:n.target,initialTimeStamp:t,initialPageX:n.pageX,initialPageY:n.pageY,rollingTimestamps:[t],rollingPageX:[n.pageX],rollingPageY:[n.pageY]};let o=this.newGestureEvent(iS.Start,n.target);o.pageX=n.pageX,o.pageY=n.pageY,this.dispatchEvent(o)}this.dispatched&&(e.preventDefault(),e.stopPropagation(),this.dispatched=!1)}onTouchEnd(e){let t=Date.now(),i=Object.keys(this.activeTouches).length;for(let n=0,o=e.changedTouches.length;n<o;n++){let o=e.changedTouches.item(n);if(!this.activeTouches.hasOwnProperty(String(o.identifier)))continue;let s=this.activeTouches[o.identifier],r=Date.now()-s.initialTimeStamp;if(r<oS.HOLD_DELAY&&Math.abs(s.initialPageX-ir(s.rollingPageX))<30&&Math.abs(s.initialPageY-ir(s.rollingPageY))<30){let e=this.newGestureEvent(iS.Tap,s.initialTarget);e.pageX=ir(s.rollingPageX),e.pageY=ir(s.rollingPageY),this.dispatchEvent(e)}else if(r>=oS.HOLD_DELAY&&Math.abs(s.initialPageX-ir(s.rollingPageX))<30&&Math.abs(s.initialPageY-ir(s.rollingPageY))<30){let e=this.newGestureEvent(iS.Contextmenu,s.initialTarget);e.pageX=ir(s.rollingPageX),e.pageY=ir(s.rollingPageY),this.dispatchEvent(e)}else if(1===i){let e=ir(s.rollingPageX),i=ir(s.rollingPageY),n=ir(s.rollingTimestamps)-s.rollingTimestamps[0],o=e-s.rollingPageX[0],r=i-s.rollingPageY[0];const a=this.targets.filter((e=>s.initialTarget instanceof Node&&e.contains(s.initialTarget)));this.inertia(a,t,Math.abs(o)/n,o>0?1:-1,e,Math.abs(r)/n,r>0?1:-1,i)}this.dispatchEvent(this.newGestureEvent(iS.End,s.initialTarget)),delete this.activeTouches[o.identifier]}this.dispatched&&(e.preventDefault(),e.stopPropagation(),this.dispatched=!1)}newGestureEvent(e,t){let i=document.createEvent("CustomEvent");return i.initEvent(e,!1,!0),i.initialTarget=t,i.tapCount=0,i}dispatchEvent(e){if(e.type===iS.Tap){const t=(new Date).getTime();let i=0;i=t-this._lastSetTapCountTime>oS.CLEAR_TAP_COUNT_TIME?1:2,this._lastSetTapCountTime=t,e.tapCount=i}else e.type!==iS.Change&&e.type!==iS.Contextmenu||(this._lastSetTapCountTime=0);for(let t=0;t<this.ignoreTargets.length;t++)if(e.initialTarget instanceof Node&&this.ignoreTargets[t].contains(e.initialTarget))return;this.targets.forEach((t=>{e.initialTarget instanceof Node&&t.contains(e.initialTarget)&&(t.dispatchEvent(e),this.dispatched=!0)}))}inertia(e,t,i,n,o,s,r,a){this.handle=hC((()=>{let l=Date.now(),d=l-t,c=0,h=0,u=!0;i+=oS.SCROLL_FRICTION*d,s+=oS.SCROLL_FRICTION*d,i>0&&(u=!1,c=n*i*d),s>0&&(u=!1,h=r*s*d);let g=this.newGestureEvent(iS.Change);g.translationX=c,g.translationY=h,e.forEach((e=>e.dispatchEvent(g))),u||this.inertia(e,l,i,n,o+c,s,r,a+h)}))}onTouchMove(e){let t=Date.now();for(let i=0,n=e.changedTouches.length;i<n;i++){let n=e.changedTouches.item(i);if(!this.activeTouches.hasOwnProperty(String(n.identifier)))continue;let o=this.activeTouches[n.identifier],s=this.newGestureEvent(iS.Change,o.initialTarget);s.translationX=n.pageX-ir(o.rollingPageX),s.translationY=n.pageY-ir(o.rollingPageY),s.pageX=n.pageX,s.pageY=n.pageY,this.dispatchEvent(s),o.rollingPageX.length>3&&(o.rollingPageX.shift(),o.rollingPageY.shift(),o.rollingTimestamps.shift()),o.rollingPageX.push(n.pageX),o.rollingPageY.push(n.pageY),o.rollingTimestamps.push(t)}this.dispatched&&(e.preventDefault(),e.stopPropagation(),this.dispatched=!1)}}function sS(e,t){let i=new Gw(t);return i.preventDefault(),{leftButton:i.leftButton,buttons:i.buttons,posx:i.posx,posy:i.posy}}oS.SCROLL_FRICTION=-.005,oS.HOLD_DELAY=700,oS.CLEAR_TAP_COUNT_TIME=400,nS([tS],oS,"isTouchDevice",null);class rS{constructor(){this._hooks=new ws,this._mouseMoveEventMerger=null,this._mouseMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,t){if(!this.isMonitoring())return;this._hooks.clear(),this._mouseMoveEventMerger=null,this._mouseMoveCallback=null;const i=this._onStopCallback;this._onStopCallback=null,e&&i&&i(t)}isMonitoring(){return!!this._mouseMoveEventMerger}startMonitoring(e,t,i,n,o){if(this.isMonitoring())return;this._mouseMoveEventMerger=i,this._mouseMoveCallback=n,this._onStopCallback=o;const s=qw.getSameOriginWindowChain(),r=Vs?"pointermove":"mousemove",a=s.map((e=>e.window.document)),l=AC(e);l&&a.unshift(l);for(const d of a)this._hooks.add(fC(d,r,(e=>{e.buttons===t?this._mouseMoveCallback(e):this.stopMonitoring(!0)}),((e,t)=>this._mouseMoveEventMerger(e,t)))),this._hooks.add(nC(d,"mouseup",(e=>this.stopMonitoring(!0))));if(qw.hasDifferentOriginAncestor()){let e=s[s.length-1];this._hooks.add(nC(e.window.document,"mouseout",(e=>{"html"===new Gw(e).target.tagName.toLowerCase()&&this.stopMonitoring(!0)}))),this._hooks.add(nC(e.window.document,"mouseover",(e=>{"html"===new Gw(e).target.tagName.toLowerCase()&&this.stopMonitoring(!0)}))),this._hooks.add(nC(e.window.document.body,"mouseleave",(e=>{this.stopMonitoring(!0)})))}}}function aS(e,t){const i=Math.pow(10,t);return Math.round(e*i)/i}class lS{constructor(e,t,i,n=1){this._rgbaBrand=void 0,this.r=0|Math.min(255,Math.max(0,e)),this.g=0|Math.min(255,Math.max(0,t)),this.b=0|Math.min(255,Math.max(0,i)),this.a=aS(Math.max(Math.min(1,n),0),3)}static equals(e,t){return e.r===t.r&&e.g===t.g&&e.b===t.b&&e.a===t.a}}class dS{constructor(e,t,i,n){this._hslaBrand=void 0,this.h=0|Math.max(Math.min(360,e),0),this.s=aS(Math.max(Math.min(1,t),0),3),this.l=aS(Math.max(Math.min(1,i),0),3),this.a=aS(Math.max(Math.min(1,n),0),3)}static equals(e,t){return e.h===t.h&&e.s===t.s&&e.l===t.l&&e.a===t.a}static fromRGBA(e){const t=e.r/255,i=e.g/255,n=e.b/255,o=e.a,s=Math.max(t,i,n),r=Math.min(t,i,n);let a=0,l=0;const d=(r+s)/2,c=s-r;if(c>0){switch(l=Math.min(d<=.5?c/(2*d):c/(2-2*d),1),s){case t:a=(i-n)/c+(i<n?6:0);break;case i:a=(n-t)/c+2;break;case n:a=(t-i)/c+4}a*=60,a=Math.round(a)}return new dS(a,l,d,o)}static _hue2rgb(e,t,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?e+6*(t-e)*i:i<.5?t:i<2/3?e+(t-e)*(2/3-i)*6:e}static toRGBA(e){const t=e.h/360,{s:i,l:n,a:o}=e;let s,r,a;if(0===i)s=r=a=n;else{const e=n<.5?n*(1+i):n+i-n*i,o=2*n-e;s=dS._hue2rgb(o,e,t+1/3),r=dS._hue2rgb(o,e,t),a=dS._hue2rgb(o,e,t-1/3)}return new lS(Math.round(255*s),Math.round(255*r),Math.round(255*a),o)}}class cS{constructor(e,t,i,n){this._hsvaBrand=void 0,this.h=0|Math.max(Math.min(360,e),0),this.s=aS(Math.max(Math.min(1,t),0),3),this.v=aS(Math.max(Math.min(1,i),0),3),this.a=aS(Math.max(Math.min(1,n),0),3)}static equals(e,t){return e.h===t.h&&e.s===t.s&&e.v===t.v&&e.a===t.a}static fromRGBA(e){const t=e.r/255,i=e.g/255,n=e.b/255,o=Math.max(t,i,n),s=o-Math.min(t,i,n),r=0===o?0:s/o;let a;return a=0===s?0:o===t?((i-n)/s%6+6)%6:o===i?(n-t)/s+2:(t-i)/s+4,new cS(Math.round(60*a),r,o,e.a)}static toRGBA(e){const{h:t,s:i,v:n,a:o}=e,s=n*i,r=s*(1-Math.abs(t/60%2-1)),a=n-s;let[l,d,c]=[0,0,0];return t<60?(l=s,d=r):t<120?(l=r,d=s):t<180?(d=s,c=r):t<240?(d=r,c=s):t<300?(l=r,c=s):t<=360&&(l=s,c=r),l=Math.round(255*(l+a)),d=Math.round(255*(d+a)),c=Math.round(255*(c+a)),new lS(l,d,c,o)}}class hS{constructor(e){if(!e)throw new Error("Color needs a value");if(e instanceof lS)this.rgba=e;else if(e instanceof dS)this._hsla=e,this.rgba=dS.toRGBA(e);else{if(!(e instanceof cS))throw new Error("Invalid color ctor argument");this._hsva=e,this.rgba=cS.toRGBA(e)}}static fromHex(e){return hS.Format.CSS.parseHex(e)||hS.red}get hsla(){return this._hsla?this._hsla:dS.fromRGBA(this.rgba)}get hsva(){return this._hsva?this._hsva:cS.fromRGBA(this.rgba)}equals(e){return!!e&&lS.equals(this.rgba,e.rgba)&&dS.equals(this.hsla,e.hsla)&&cS.equals(this.hsva,e.hsva)}getRelativeLuminance(){return aS(.2126*hS._relativeLuminanceForComponent(this.rgba.r)+.7152*hS._relativeLuminanceForComponent(this.rgba.g)+.0722*hS._relativeLuminanceForComponent(this.rgba.b),4)}static _relativeLuminanceForComponent(e){const t=e/255;return t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4)}isLighter(){return(299*this.rgba.r+587*this.rgba.g+114*this.rgba.b)/1e3>=128}isLighterThan(e){return this.getRelativeLuminance()>e.getRelativeLuminance()}isDarkerThan(e){return this.getRelativeLuminance()<e.getRelativeLuminance()}lighten(e){return new hS(new dS(this.hsla.h,this.hsla.s,this.hsla.l+this.hsla.l*e,this.hsla.a))}darken(e){return new hS(new dS(this.hsla.h,this.hsla.s,this.hsla.l-this.hsla.l*e,this.hsla.a))}transparent(e){const{r:t,g:i,b:n,a:o}=this.rgba;return new hS(new lS(t,i,n,o*e))}isTransparent(){return 0===this.rgba.a}isOpaque(){return 1===this.rgba.a}opposite(){return new hS(new lS(255-this.rgba.r,255-this.rgba.g,255-this.rgba.b,this.rgba.a))}toString(){return this._toString||(this._toString=hS.Format.CSS.format(this)),this._toString}static getLighterColor(e,t,i){if(e.isLighterThan(t))return e;i=i||.5;const n=e.getRelativeLuminance(),o=t.getRelativeLuminance();return i=i*(o-n)/o,e.lighten(i)}static getDarkerColor(e,t,i){if(e.isDarkerThan(t))return e;i=i||.5;const n=e.getRelativeLuminance();return i=i*(n-t.getRelativeLuminance())/n,e.darken(i)}}hS.white=new hS(new lS(255,255,255,1)),hS.black=new hS(new lS(0,0,0,1)),hS.red=new hS(new lS(255,0,0,1)),hS.blue=new hS(new lS(0,0,255,1)),hS.green=new hS(new lS(0,255,0,1)),hS.cyan=new hS(new lS(0,255,255,1)),hS.lightgrey=new hS(new lS(211,211,211,1)),hS.transparent=new hS(new lS(0,0,0,0)),function(e){var t;(function(t){function i(e){const t=e.toString(16);return 2!==t.length?"0"+t:t}function n(e){switch(e){case 48:return 0;case 49:return 1;case 50:return 2;case 51:return 3;case 52:return 4;case 53:return 5;case 54:return 6;case 55:return 7;case 56:return 8;case 57:return 9;case 97:case 65:return 10;case 98:case 66:return 11;case 99:case 67:return 12;case 100:case 68:return 13;case 101:case 69:return 14;case 102:case 70:return 15}return 0}t.formatRGB=function(t){return 1===t.rgba.a?`rgb(${t.rgba.r}, ${t.rgba.g}, ${t.rgba.b})`:e.Format.CSS.formatRGBA(t)},t.formatRGBA=function(e){return`rgba(${e.rgba.r}, ${e.rgba.g}, ${e.rgba.b}, ${+e.rgba.a.toFixed(2)})`},t.formatHSL=function(t){return 1===t.hsla.a?`hsl(${t.hsla.h}, ${(100*t.hsla.s).toFixed(2)}%, ${(100*t.hsla.l).toFixed(2)}%)`:e.Format.CSS.formatHSLA(t)},t.formatHSLA=function(e){return`hsla(${e.hsla.h}, ${(100*e.hsla.s).toFixed(2)}%, ${(100*e.hsla.l).toFixed(2)}%, ${e.hsla.a.toFixed(2)})`},t.formatHex=function(e){return`#${i(e.rgba.r)}${i(e.rgba.g)}${i(e.rgba.b)}`},t.formatHexA=function(t,n=!1){return n&&1===t.rgba.a?e.Format.CSS.formatHex(t):`#${i(t.rgba.r)}${i(t.rgba.g)}${i(t.rgba.b)}${i(Math.round(255*t.rgba.a))}`},t.format=function(t){return t.isOpaque()?e.Format.CSS.formatHex(t):e.Format.CSS.formatRGBA(t)},t.parseHex=function(t){const i=t.length;if(0===i)return null;if(35!==t.charCodeAt(0))return null;if(7===i){const i=16*n(t.charCodeAt(1))+n(t.charCodeAt(2)),o=16*n(t.charCodeAt(3))+n(t.charCodeAt(4)),s=16*n(t.charCodeAt(5))+n(t.charCodeAt(6));return new e(new lS(i,o,s,1))}if(9===i){const i=16*n(t.charCodeAt(1))+n(t.charCodeAt(2)),o=16*n(t.charCodeAt(3))+n(t.charCodeAt(4)),s=16*n(t.charCodeAt(5))+n(t.charCodeAt(6)),r=16*n(t.charCodeAt(7))+n(t.charCodeAt(8));return new e(new lS(i,o,s,r/255))}if(4===i){const i=n(t.charCodeAt(1)),o=n(t.charCodeAt(2)),s=n(t.charCodeAt(3));return new e(new lS(16*i+i,16*o+o,16*s+s))}if(5===i){const i=n(t.charCodeAt(1)),o=n(t.charCodeAt(2)),s=n(t.charCodeAt(3)),r=n(t.charCodeAt(4));return new e(new lS(16*i+i,16*o+o,16*s+s,(16*r+r)/255))}return null}})((t=e.Format||(e.Format={})).CSS||(t.CSS={}))}(hS||(hS={}));const uS="base.contributions.json";const gS=new class{constructor(){this._onDidChangeSchema=new $o,this.schemasById={}}registerSchema(e,t){var i;this.schemasById[(i=e,i.length>0&&"#"===i.charAt(i.length-1)?i.substring(0,i.length-1):i)]=t,this._onDidChangeSchema.fire(e)}notifySchemaChanged(e){this._onDidChangeSchema.fire(e)}};function pS(e){return`--vscode-${e.replace(/\./g,"-")}`}Yy.add(uS,gS);const mS="base.contributions.colors";const fS=new class{constructor(){this._onDidChangeSchema=new $o,this.onDidChangeSchema=this._onDidChangeSchema.event,this.colorSchema={type:"object",properties:{}},this.colorReferenceSchema={type:"string",enum:[],enumDescriptions:[]},this.colorsById={}}registerColor(e,t,i,n=!1,o){let s={id:e,description:i,defaults:t,needsTransparency:n,deprecationMessage:o};this.colorsById[e]=s;let r={type:"string",description:i,format:"color-hex",defaultSnippets:[{body:"${1:#ff0000}"}]};return o&&(r.deprecationMessage=o),this.colorSchema.properties[e]=r,this.colorReferenceSchema.enum.push(e),this.colorReferenceSchema.enumDescriptions.push(i),this._onDidChangeSchema.fire(),e}getColors(){return Object.keys(this.colorsById).map((e=>this.colorsById[e]))}resolveDefaultColor(e,t){const i=this.colorsById[e];if(i&&i.defaults){return kL(i.defaults[t.type],t)}}getColorSchema(){return this.colorSchema}toString(){return Object.keys(this.colorsById).sort(((e,t)=>{let i=-1===e.indexOf(".")?0:1,n=-1===t.indexOf(".")?0:1;return i!==n?i-n:e.localeCompare(t)})).map((e=>`- \`${e}\`: ${this.colorsById[e].description}`)).join("\n")}};function _S(e,t,i,n,o){return fS.registerColor(e,t,i,n,o)}Yy.add(mS,fS);const vS=_S("foreground",{dark:"#CCCCCC",light:"#616161",hc:"#FFFFFF"},mf(0,"Overall foreground color. This color is only used if not overridden by a component.")),bS=_S("errorForeground",{dark:"#F48771",light:"#A1260D",hc:"#F48771"},mf(0,"Overall foreground color for error messages. This color is only used if not overridden by a component."));_S("descriptionForeground",{light:"#717171",dark:yL(vS,.7),hc:yL(vS,.7)},mf(0,"Foreground color for description text providing additional information, for example for a label."));const wS=_S("icon.foreground",{dark:"#C5C5C5",light:"#424242",hc:"#FFFFFF"},mf(0,"The default color for icons in the workbench.")),CS=_S("focusBorder",{dark:"#007FD4",light:"#0090F1",hc:"#F38518"},mf(0,"Overall border color for focused elements. This color is only used if not overridden by a component.")),yS=_S("contrastBorder",{light:null,dark:null,hc:"#6FC3DF"},mf(0,"An extra border around elements to separate them from others for greater contrast.")),xS=_S("contrastActiveBorder",{light:null,dark:null,hc:CS},mf(0,"An extra border around active elements to separate them from others for greater contrast."));_S("selection.background",{light:null,dark:null,hc:null},mf(0,"The background color of text selections in the workbench (e.g. for input fields or text areas). Note that this does not apply to selections within the editor.")),_S("textSeparator.foreground",{light:"#0000002e",dark:"#ffffff2e",hc:hS.black},mf(0,"Color for text separators."));const SS=_S("textLink.foreground",{light:"#006AB1",dark:"#3794FF",hc:"#3794FF"},mf(0,"Foreground color for links in text.")),kS=_S("textLink.activeForeground",{light:"#006AB1",dark:"#3794FF",hc:"#3794FF"},mf(0,"Foreground color for links in text when clicked on and on mouse hover."));_S("textPreformat.foreground",{light:"#A31515",dark:"#D7BA7D",hc:"#D7BA7D"},mf(0,"Foreground color for preformatted text segments.")),_S("textBlockQuote.background",{light:"#7f7f7f1a",dark:"#7f7f7f1a",hc:null},mf(0,"Background color for block quotes in text.")),_S("textBlockQuote.border",{light:"#007acc80",dark:"#007acc80",hc:hS.white},mf(0,"Border color for block quotes in text."));const DS=_S("textCodeBlock.background",{light:"#dcdcdc66",dark:"#0a0a0a66",hc:hS.black},mf(0,"Background color for code blocks in text.")),LS=_S("widget.shadow",{dark:yL(hS.black,.36),light:yL(hS.black,.16),hc:null},mf(0,"Shadow color of widgets such as find/replace inside the editor.")),NS=_S("input.background",{dark:"#3C3C3C",light:hS.white,hc:hS.black},mf(0,"Input box background.")),ES=_S("input.foreground",{dark:vS,light:vS,hc:vS},mf(0,"Input box foreground.")),IS=_S("input.border",{dark:null,light:null,hc:yS},mf(0,"Input box border.")),TS=_S("inputOption.activeBorder",{dark:"#007ACC00",light:"#007ACC00",hc:yS},mf(0,"Border color of activated options in input fields."));_S("inputOption.hoverBackground",{dark:"#5a5d5e80",light:"#b8b8b850",hc:null},mf(0,"Background color of activated options in input fields."));const MS=_S("inputOption.activeBackground",{dark:yL(CS,.4),light:yL(CS,.2),hc:hS.transparent},mf(0,"Background hover color of options in input fields.")),AS=_S("inputOption.activeForeground",{dark:hS.white,light:hS.black,hc:null},mf(0,"Foreground color of activated options in input fields."));_S("input.placeholderForeground",{light:yL(vS,.5),dark:yL(vS,.5),hc:yL(vS,.7)},mf(0,"Input box foreground color for placeholder text."));const OS=_S("inputValidation.infoBackground",{dark:"#063B49",light:"#D6ECF2",hc:hS.black},mf(0,"Input validation background color for information severity.")),RS=_S("inputValidation.infoForeground",{dark:null,light:null,hc:null},mf(0,"Input validation foreground color for information severity.")),PS=_S("inputValidation.infoBorder",{dark:"#007acc",light:"#007acc",hc:yS},mf(0,"Input validation border color for information severity.")),FS=_S("inputValidation.warningBackground",{dark:"#352A05",light:"#F6F5D2",hc:hS.black},mf(0,"Input validation background color for warning severity.")),BS=_S("inputValidation.warningForeground",{dark:null,light:null,hc:null},mf(0,"Input validation foreground color for warning severity.")),VS=_S("inputValidation.warningBorder",{dark:"#B89500",light:"#B89500",hc:yS},mf(0,"Input validation border color for warning severity.")),WS=_S("inputValidation.errorBackground",{dark:"#5A1D1D",light:"#F2DEDE",hc:hS.black},mf(0,"Input validation background color for error severity.")),zS=_S("inputValidation.errorForeground",{dark:null,light:null,hc:null},mf(0,"Input validation foreground color for error severity.")),HS=_S("inputValidation.errorBorder",{dark:"#BE1100",light:"#BE1100",hc:yS},mf(0,"Input validation border color for error severity.")),jS=_S("dropdown.background",{dark:"#3C3C3C",light:hS.white,hc:hS.black},mf(0,"Dropdown background."));_S("dropdown.listBackground",{dark:null,light:null,hc:hS.black},mf(0,"Dropdown list background."));const US=_S("dropdown.foreground",{dark:"#F0F0F0",light:null,hc:hS.white},mf(0,"Dropdown foreground.")),$S=_S("dropdown.border",{dark:jS,light:"#CECECE",hc:yS},mf(0,"Dropdown border."));_S("checkbox.background",{dark:jS,light:jS,hc:jS},mf(0,"Background color of checkbox widget.")),_S("checkbox.foreground",{dark:US,light:US,hc:US},mf(0,"Foreground color of checkbox widget.")),_S("checkbox.border",{dark:$S,light:$S,hc:$S},mf(0,"Border color of checkbox widget."));const KS=_S("button.foreground",{dark:hS.white,light:hS.white,hc:hS.white},mf(0,"Button foreground color.")),qS=_S("button.background",{dark:"#0E639C",light:"#007ACC",hc:null},mf(0,"Button background color.")),GS=_S("button.hoverBackground",{dark:CL(qS,.2),light:wL(qS,.2),hc:null},mf(0,"Button background color when hovering."));_S("button.border",{dark:yS,light:yS,hc:yS},mf(0,"Button border color.")),_S("button.secondaryForeground",{dark:hS.white,light:hS.white,hc:hS.white},mf(0,"Secondary button foreground color."));const ZS=_S("button.secondaryBackground",{dark:"#3A3D41",light:"#5F6A79",hc:null},mf(0,"Secondary button background color."));_S("button.secondaryHoverBackground",{dark:CL(ZS,.2),light:wL(ZS,.2),hc:null},mf(0,"Secondary button background color when hovering."));const YS=_S("badge.background",{dark:"#4D4D4D",light:"#C4C4C4",hc:hS.black},mf(0,"Badge background color. Badges are small information labels, e.g. for search results count.")),XS=_S("badge.foreground",{dark:hS.white,light:"#333",hc:hS.white},mf(0,"Badge foreground color. Badges are small information labels, e.g. for search results count.")),QS=_S("scrollbar.shadow",{dark:"#000000",light:"#DDDDDD",hc:null},mf(0,"Scrollbar shadow to indicate that the view is scrolled.")),JS=_S("scrollbarSlider.background",{dark:hS.fromHex("#797979").transparent(.4),light:hS.fromHex("#646464").transparent(.4),hc:yL(yS,.6)},mf(0,"Scrollbar slider background color.")),ek=_S("scrollbarSlider.hoverBackground",{dark:hS.fromHex("#646464").transparent(.7),light:hS.fromHex("#646464").transparent(.7),hc:yL(yS,.8)},mf(0,"Scrollbar slider background color when hovering.")),tk=_S("scrollbarSlider.activeBackground",{dark:hS.fromHex("#BFBFBF").transparent(.4),light:hS.fromHex("#000000").transparent(.6),hc:yS},mf(0,"Scrollbar slider background color when clicked on.")),ik=_S("progressBar.background",{dark:hS.fromHex("#0E70C0"),light:hS.fromHex("#0E70C0"),hc:yS},mf(0,"Background color of the progress bar that can show for long running operations.")),nk=_S("editorError.background",{dark:null,light:null,hc:null},mf(0,"Background color of error text in the editor. The color must not be opaque so as not to hide underlying decorations."),!0),ok=_S("editorError.foreground",{dark:"#F14C4C",light:"#E51400",hc:null},mf(0,"Foreground color of error squigglies in the editor.")),sk=_S("editorError.border",{dark:null,light:null,hc:hS.fromHex("#E47777").transparent(.8)},mf(0,"Border color of error boxes in the editor.")),rk=_S("editorWarning.background",{dark:null,light:null,hc:null},mf(0,"Background color of warning text in the editor. The color must not be opaque so as not to hide underlying decorations."),!0),ak=_S("editorWarning.foreground",{dark:"#CCA700",light:"#BF8803",hc:null},mf(0,"Foreground color of warning squigglies in the editor.")),lk=_S("editorWarning.border",{dark:null,light:null,hc:hS.fromHex("#FFCC00").transparent(.8)},mf(0,"Border color of warning boxes in the editor.")),dk=_S("editorInfo.background",{dark:null,light:null,hc:null},mf(0,"Background color of info text in the editor. The color must not be opaque so as not to hide underlying decorations."),!0),ck=_S("editorInfo.foreground",{dark:"#3794FF",light:"#1a85ff",hc:"#3794FF"},mf(0,"Foreground color of info squigglies in the editor.")),hk=_S("editorInfo.border",{dark:null,light:null,hc:hS.fromHex("#3794FF").transparent(.8)},mf(0,"Border color of info boxes in the editor.")),uk=_S("editorHint.foreground",{dark:hS.fromHex("#eeeeee").transparent(.7),light:"#6c6c6c",hc:null},mf(0,"Foreground color of hint squigglies in the editor.")),gk=_S("editorHint.border",{dark:null,light:null,hc:hS.fromHex("#eeeeee").transparent(.8)},mf(0,"Border color of hint boxes in the editor."));_S("sash.hoverBorder",{dark:CS,light:CS,hc:CS},mf(0,"Border color of active sashes."));const pk=_S("editor.background",{light:"#fffffe",dark:"#1E1E1E",hc:hS.black},mf(0,"Editor background color.")),mk=_S("editor.foreground",{light:"#333333",dark:"#BBBBBB",hc:hS.white},mf(0,"Editor default foreground color.")),fk=_S("editorWidget.background",{dark:"#252526",light:"#F3F3F3",hc:"#0C141F"},mf(0,"Background color of editor widgets, such as find/replace.")),_k=_S("editorWidget.foreground",{dark:vS,light:vS,hc:vS},mf(0,"Foreground color of editor widgets, such as find/replace.")),vk=_S("editorWidget.border",{dark:"#454545",light:"#C8C8C8",hc:yS},mf(0,"Border color of editor widgets. The color is only used if the widget chooses to have a border and if the color is not overridden by a widget.")),bk=_S("editorWidget.resizeBorder",{light:null,dark:null,hc:null},mf(0,"Border color of the resize bar of editor widgets. The color is only used if the widget chooses to have a resize border and if the color is not overridden by a widget.")),wk=_S("quickInput.background",{dark:fk,light:fk,hc:fk},mf(0,"Quick picker background color. The quick picker widget is the container for pickers like the command palette.")),Ck=_S("quickInput.foreground",{dark:_k,light:_k,hc:_k},mf(0,"Quick picker foreground color. The quick picker widget is the container for pickers like the command palette.")),yk=_S("quickInputTitle.background",{dark:new hS(new lS(255,255,255,.105)),light:new hS(new lS(0,0,0,.06)),hc:"#000000"},mf(0,"Quick picker title background color. The quick picker widget is the container for pickers like the command palette.")),xk=_S("pickerGroup.foreground",{dark:"#3794FF",light:"#0066BF",hc:hS.white},mf(0,"Quick picker color for grouping labels.")),Sk=_S("pickerGroup.border",{dark:"#3F3F46",light:"#CCCEDB",hc:hS.white},mf(0,"Quick picker color for grouping borders.")),kk=_S("keybindingLabel.background",{dark:new hS(new lS(128,128,128,.17)),light:new hS(new lS(221,221,221,.4)),hc:hS.transparent},mf(0,"Keybinding label background color. The keybinding label is used to represent a keyboard shortcut.")),Dk=_S("keybindingLabel.foreground",{dark:hS.fromHex("#CCCCCC"),light:hS.fromHex("#555555"),hc:hS.white},mf(0,"Keybinding label foreground color. The keybinding label is used to represent a keyboard shortcut.")),Lk=_S("keybindingLabel.border",{dark:new hS(new lS(51,51,51,.6)),light:new hS(new lS(204,204,204,.4)),hc:new hS(new lS(111,195,223))},mf(0,"Keybinding label border color. The keybinding label is used to represent a keyboard shortcut.")),Nk=_S("keybindingLabel.bottomBorder",{dark:new hS(new lS(68,68,68,.6)),light:new hS(new lS(187,187,187,.4)),hc:new hS(new lS(111,195,223))},mf(0,"Keybinding label border bottom color. The keybinding label is used to represent a keyboard shortcut.")),Ek=_S("editor.selectionBackground",{light:"#ADD6FF",dark:"#264F78",hc:"#f3f518"},mf(0,"Color of the editor selection.")),Ik=_S("editor.selectionForeground",{light:null,dark:null,hc:"#000000"},mf(0,"Color of the selected text for high contrast.")),Tk=_S("editor.inactiveSelectionBackground",{light:yL(Ek,.5),dark:yL(Ek,.5),hc:yL(Ek,.5)},mf(0,"Color of the selection in an inactive editor. The color must not be opaque so as not to hide underlying decorations."),!0),Mk=_S("editor.selectionHighlightBackground",{light:SL(Ek,pk,.3,.6),dark:SL(Ek,pk,.3,.6),hc:null},mf(0,"Color for regions with the same content as the selection. The color must not be opaque so as not to hide underlying decorations."),!0),Ak=_S("editor.selectionHighlightBorder",{light:null,dark:null,hc:xS},mf(0,"Border color for regions with the same content as the selection.")),Ok=_S("editor.findMatchBackground",{light:"#A8AC94",dark:"#515C6A",hc:null},mf(0,"Color of the current search match.")),Rk=_S("editor.findMatchHighlightBackground",{light:"#EA5C0055",dark:"#EA5C0055",hc:null},mf(0,"Color of the other search matches. The color must not be opaque so as not to hide underlying decorations."),!0),Pk=_S("editor.findRangeHighlightBackground",{dark:"#3a3d4166",light:"#b4b4b44d",hc:null},mf(0,"Color of the range limiting the search. The color must not be opaque so as not to hide underlying decorations."),!0),Fk=_S("editor.findMatchBorder",{light:null,dark:null,hc:xS},mf(0,"Border color of the current search match.")),Bk=_S("editor.findMatchHighlightBorder",{light:null,dark:null,hc:xS},mf(0,"Border color of the other search matches.")),Vk=_S("editor.findRangeHighlightBorder",{dark:null,light:null,hc:yL(xS,.4)},mf(0,"Border color of the range limiting the search. The color must not be opaque so as not to hide underlying decorations."),!0);_S("searchEditor.findMatchBackground",{light:yL(Rk,.66),dark:yL(Rk,.66),hc:Rk},mf(0,"Color of the Search Editor query matches.")),_S("searchEditor.findMatchBorder",{light:yL(Bk,.66),dark:yL(Bk,.66),hc:Bk},mf(0,"Border color of the Search Editor query matches."));const Wk=_S("editor.hoverHighlightBackground",{light:"#ADD6FF26",dark:"#264f7840",hc:"#ADD6FF26"},mf(0,"Highlight below the word for which a hover is shown. The color must not be opaque so as not to hide underlying decorations."),!0),zk=_S("editorHoverWidget.background",{light:fk,dark:fk,hc:fk},mf(0,"Background color of the editor hover.")),Hk=_S("editorHoverWidget.foreground",{light:_k,dark:_k,hc:_k},mf(0,"Foreground color of the editor hover.")),jk=_S("editorHoverWidget.border",{light:vk,dark:vk,hc:vk},mf(0,"Border color of the editor hover.")),Uk=_S("editorHoverWidget.statusBarBackground",{dark:CL(zk,.2),light:wL(zk,.05),hc:fk},mf(0,"Background color of the editor hover status bar.")),$k=_S("editorLink.activeForeground",{dark:"#4E94CE",light:hS.blue,hc:hS.cyan},mf(0,"Color of active links.")),Kk=_S("editorInlayHint.foreground",{dark:yL(XS,.8),light:yL(XS,.8),hc:XS},mf(0,"Foreground color of inline hints")),qk=_S("editorInlayHint.background",{dark:yL(YS,.6),light:yL(YS,.3),hc:YS},mf(0,"Background color of inline hints")),Gk=_S("editorInlayHint.typeForeground",{dark:Kk,light:Kk,hc:Kk},mf(0,"Foreground color of inline hints for types")),Zk=_S("editorInlayHint.typeBackground",{dark:qk,light:qk,hc:qk},mf(0,"Background color of inline hints for types")),Yk=_S("editorInlayHint.parameterForeground",{dark:Kk,light:Kk,hc:Kk},mf(0,"Foreground color of inline hints for parameters")),Xk=_S("editorInlayHint.parameterBackground",{dark:qk,light:qk,hc:qk},mf(0,"Background color of inline hints for parameters")),Qk=_S("editorLightBulb.foreground",{dark:"#FFCC00",light:"#DDB100",hc:"#FFCC00"},mf(0,"The color used for the lightbulb actions icon.")),Jk=_S("editorLightBulbAutoFix.foreground",{dark:"#75BEFF",light:"#007ACC",hc:"#75BEFF"},mf(0,"The color used for the lightbulb auto fix actions icon.")),eD=new hS(new lS(155,185,85,.2)),tD=new hS(new lS(255,0,0,.2)),iD=_S("diffEditor.insertedTextBackground",{dark:eD,light:eD,hc:null},mf(0,"Background color for text that got inserted. The color must not be opaque so as not to hide underlying decorations."),!0),nD=_S("diffEditor.removedTextBackground",{dark:tD,light:tD,hc:null},mf(0,"Background color for text that got removed. The color must not be opaque so as not to hide underlying decorations."),!0),oD=_S("diffEditor.insertedLineBackground",{dark:null,light:null,hc:null},mf(0,"Background color for lines that got inserted. The color must not be opaque so as not to hide underlying decorations."),!0),sD=_S("diffEditor.removedLineBackground",{dark:null,light:null,hc:null},mf(0,"Background color for lines that got removed. The color must not be opaque so as not to hide underlying decorations."),!0),rD=_S("diffEditorGutter.insertedLineBackground",{dark:null,light:null,hc:null},mf(0,"Background color for the margin where lines got inserted.")),aD=_S("diffEditorGutter.removedLineBackground",{dark:null,light:null,hc:null},mf(0,"Background color for the margin where lines got removed.")),lD=_S("diffEditorOverview.insertedForeground",{dark:null,light:null,hc:null},mf(0,"Diff overview ruler foreground for inserted content.")),dD=_S("diffEditorOverview.removedForeground",{dark:null,light:null,hc:null},mf(0,"Diff overview ruler foreground for removed content.")),cD=_S("diffEditor.insertedTextBorder",{dark:null,light:null,hc:"#33ff2eff"},mf(0,"Outline color for the text that got inserted.")),hD=_S("diffEditor.removedTextBorder",{dark:null,light:null,hc:"#FF008F"},mf(0,"Outline color for text that got removed.")),uD=_S("diffEditor.border",{dark:null,light:null,hc:yS},mf(0,"Border color between the two text editors.")),gD=_S("diffEditor.diagonalFill",{dark:"#cccccc33",light:"#22222233",hc:null},mf(0,"Color of the diff editor's diagonal fill. The diagonal fill is used in side-by-side diff views.")),pD=_S("list.focusBackground",{dark:null,light:null,hc:null},mf(0,"List/Tree background color for the focused item when the list/tree is active. An active list/tree has keyboard focus, an inactive does not.")),mD=_S("list.focusForeground",{dark:null,light:null,hc:null},mf(0,"List/Tree foreground color for the focused item when the list/tree is active. An active list/tree has keyboard focus, an inactive does not.")),fD=_S("list.focusOutline",{dark:CS,light:CS,hc:xS},mf(0,"List/Tree outline color for the focused item when the list/tree is active. An active list/tree has keyboard focus, an inactive does not.")),_D=_S("list.activeSelectionBackground",{dark:"#094771",light:"#0060C0",hc:null},mf(0,"List/Tree background color for the selected item when the list/tree is active. An active list/tree has keyboard focus, an inactive does not.")),vD=_S("list.activeSelectionForeground",{dark:hS.white,light:hS.white,hc:null},mf(0,"List/Tree foreground color for the selected item when the list/tree is active. An active list/tree has keyboard focus, an inactive does not.")),bD=_S("list.activeSelectionIconForeground",{dark:null,light:null,hc:null},mf(0,"List/Tree icon foreground color for the selected item when the list/tree is active. An active list/tree has keyboard focus, an inactive does not.")),wD=_S("list.inactiveSelectionBackground",{dark:"#37373D",light:"#E4E6F1",hc:null},mf(0,"List/Tree background color for the selected item when the list/tree is inactive. An active list/tree has keyboard focus, an inactive does not.")),CD=_S("list.inactiveSelectionForeground",{dark:null,light:null,hc:null},mf(0,"List/Tree foreground color for the selected item when the list/tree is inactive. An active list/tree has keyboard focus, an inactive does not.")),yD=_S("list.inactiveSelectionIconForeground",{dark:null,light:null,hc:null},mf(0,"List/Tree icon foreground color for the selected item when the list/tree is inactive. An active list/tree has keyboard focus, an inactive does not.")),xD=_S("list.inactiveFocusBackground",{dark:null,light:null,hc:null},mf(0,"List/Tree background color for the focused item when the list/tree is inactive. An active list/tree has keyboard focus, an inactive does not.")),SD=_S("list.inactiveFocusOutline",{dark:null,light:null,hc:null},mf(0,"List/Tree outline color for the focused item when the list/tree is inactive. An active list/tree has keyboard focus, an inactive does not.")),kD=_S("list.hoverBackground",{dark:"#2A2D2E",light:"#F0F0F0",hc:null},mf(0,"List/Tree background when hovering over items using the mouse.")),DD=_S("list.hoverForeground",{dark:null,light:null,hc:null},mf(0,"List/Tree foreground when hovering over items using the mouse.")),LD=_S("list.dropBackground",{dark:"#062F4A",light:"#D6EBFF",hc:null},mf(0,"List/Tree drag and drop background when moving items around using the mouse.")),ND=_S("list.highlightForeground",{dark:"#18A3FF",light:"#0066BF",hc:CS},mf(0,"List/Tree foreground color of the match highlights when searching inside the list/tree.")),ED=_S("list.focusHighlightForeground",{dark:ND,light:(ID=_D,TD=ND,MD="#9DDDFF",{op:5,if:ID,then:TD,else:MD}),hc:ND},mf(0,"List/Tree foreground color of the match highlights on actively focused items when searching inside the list/tree."));var ID,TD,MD;_S("list.invalidItemForeground",{dark:"#B89500",light:"#B89500",hc:"#B89500"},mf(0,"List/Tree foreground color for invalid items, for example an unresolved root in explorer.")),_S("list.errorForeground",{dark:"#F88070",light:"#B01011",hc:null},mf(0,"Foreground color of list items containing errors.")),_S("list.warningForeground",{dark:"#CCA700",light:"#855F00",hc:null},mf(0,"Foreground color of list items containing warnings."));const AD=_S("listFilterWidget.background",{light:"#efc1ad",dark:"#653723",hc:hS.black},mf(0,"Background color of the type filter widget in lists and trees.")),OD=_S("listFilterWidget.outline",{dark:hS.transparent,light:hS.transparent,hc:"#f38518"},mf(0,"Outline color of the type filter widget in lists and trees.")),RD=_S("listFilterWidget.noMatchesOutline",{dark:"#BE1100",light:"#BE1100",hc:yS},mf(0,"Outline color of the type filter widget in lists and trees, when there are no matches."));_S("list.filterMatchBackground",{dark:Rk,light:Rk,hc:null},mf(0,"Background color of the filtered match.")),_S("list.filterMatchBorder",{dark:Bk,light:Bk,hc:yS},mf(0,"Border color of the filtered match."));const PD=_S("tree.indentGuidesStroke",{dark:"#585858",light:"#a9a9a9",hc:"#a9a9a9"},mf(0,"Tree stroke color for the indentation guides.")),FD=_S("tree.tableColumnsBorder",{dark:"#CCCCCC20",light:"#61616120",hc:null},mf(0,"Table border color between columns.")),BD=_S("tree.tableOddRowsBackground",{dark:yL(vS,.04),light:yL(vS,.04),hc:null},mf(0,"Background color for odd table rows."));_S("list.deemphasizedForeground",{dark:"#8C8C8C",light:"#8E8E90",hc:"#A7A8A9"},mf(0,"List/Tree foreground color for items that are deemphasized. "));const VD=_S("quickInput.list.focusBackground",{dark:null,light:null,hc:null},"",void 0,mf(0,"Please use quickInputList.focusBackground instead")),WD=_S("quickInputList.focusForeground",{dark:vD,light:vD,hc:vD},mf(0,"Quick picker foreground color for the focused item.")),zD=_S("quickInputList.focusIconForeground",{dark:bD,light:bD,hc:bD},mf(0,"Quick picker icon foreground color for the focused item.")),HD=_S("quickInputList.focusBackground",{dark:xL(VD,_D),light:xL(VD,_D),hc:null},mf(0,"Quick picker background color for the focused item.")),jD=_S("menu.border",{dark:null,light:null,hc:yS},mf(0,"Border color of menus.")),UD=_S("menu.foreground",{dark:US,light:vS,hc:US},mf(0,"Foreground color of menu items.")),$D=_S("menu.background",{dark:jS,light:jS,hc:jS},mf(0,"Background color of menu items.")),KD=_S("menu.selectionForeground",{dark:vD,light:vD,hc:vD},mf(0,"Foreground color of the selected menu item in menus.")),qD=_S("menu.selectionBackground",{dark:_D,light:_D,hc:_D},mf(0,"Background color of the selected menu item in menus.")),GD=_S("menu.selectionBorder",{dark:null,light:null,hc:xS},mf(0,"Border color of the selected menu item in menus.")),ZD=_S("menu.separatorBackground",{dark:"#BBBBBB",light:"#888888",hc:yS},mf(0,"Color of a separator menu item in menus.")),YD=_S("toolbar.hoverBackground",{dark:"#5a5d5e50",light:"#b8b8b850",hc:null},mf(0,"Toolbar background when hovering over actions using the mouse"));_S("toolbar.hoverOutline",{dark:null,light:null,hc:xS},mf(0,"Toolbar outline when hovering over actions using the mouse")),_S("toolbar.activeBackground",{dark:CL(YD,.1),light:wL(YD,.1),hc:null},mf(0,"Toolbar background when holding the mouse over actions")),_S("editor.snippetTabstopHighlightBackground",{dark:new hS(new lS(124,124,124,.3)),light:new hS(new lS(10,50,100,.2)),hc:new hS(new lS(124,124,124,.3))},mf(0,"Highlight background color of a snippet tabstop.")),_S("editor.snippetTabstopHighlightBorder",{dark:null,light:null,hc:null},mf(0,"Highlight border color of a snippet tabstop.")),_S("editor.snippetFinalTabstopHighlightBackground",{dark:null,light:null,hc:null},mf(0,"Highlight background color of the final tabstop of a snippet.")),_S("editor.snippetFinalTabstopHighlightBorder",{dark:"#525252",light:new hS(new lS(10,50,100,.5)),hc:"#525252"},mf(0,"Highlight border color of the final tabstop of a snippet.")),_S("breadcrumb.foreground",{light:yL(vS,.8),dark:yL(vS,.8),hc:yL(vS,.8)},mf(0,"Color of focused breadcrumb items.")),_S("breadcrumb.background",{light:pk,dark:pk,hc:pk},mf(0,"Background color of breadcrumb items.")),_S("breadcrumb.focusForeground",{light:wL(vS,.2),dark:CL(vS,.1),hc:CL(vS,.1)},mf(0,"Color of focused breadcrumb items.")),_S("breadcrumb.activeSelectionForeground",{light:wL(vS,.2),dark:CL(vS,.1),hc:CL(vS,.1)},mf(0,"Color of selected breadcrumb items.")),_S("breadcrumbPicker.background",{light:fk,dark:fk,hc:fk},mf(0,"Background color of breadcrumb item picker."));const XD=hS.fromHex("#40C8AE").transparent(.5),QD=hS.fromHex("#40A6FF").transparent(.5),JD=hS.fromHex("#606060").transparent(.4),eL=.4,tL=_S("merge.currentHeaderBackground",{dark:XD,light:XD,hc:null},mf(0,"Current header background in inline merge-conflicts. The color must not be opaque so as not to hide underlying decorations."),!0);_S("merge.currentContentBackground",{dark:yL(tL,eL),light:yL(tL,eL),hc:yL(tL,eL)},mf(0,"Current content background in inline merge-conflicts. The color must not be opaque so as not to hide underlying decorations."),!0);const iL=_S("merge.incomingHeaderBackground",{dark:QD,light:QD,hc:null},mf(0,"Incoming header background in inline merge-conflicts. The color must not be opaque so as not to hide underlying decorations."),!0);_S("merge.incomingContentBackground",{dark:yL(iL,eL),light:yL(iL,eL),hc:yL(iL,eL)},mf(0,"Incoming content background in inline merge-conflicts. The color must not be opaque so as not to hide underlying decorations."),!0);const nL=_S("merge.commonHeaderBackground",{dark:JD,light:JD,hc:null},mf(0,"Common ancestor header background in inline merge-conflicts. The color must not be opaque so as not to hide underlying decorations."),!0);_S("merge.commonContentBackground",{dark:yL(nL,eL),light:yL(nL,eL),hc:yL(nL,eL)},mf(0,"Common ancestor content background in inline merge-conflicts. The color must not be opaque so as not to hide underlying decorations."),!0);const oL=_S("merge.border",{dark:null,light:null,hc:"#C3DF6F"},mf(0,"Border color on headers and the splitter in inline merge-conflicts."));_S("editorOverviewRuler.currentContentForeground",{dark:yL(tL,1),light:yL(tL,1),hc:oL},mf(0,"Current overview ruler foreground for inline merge-conflicts.")),_S("editorOverviewRuler.incomingContentForeground",{dark:yL(iL,1),light:yL(iL,1),hc:oL},mf(0,"Incoming overview ruler foreground for inline merge-conflicts.")),_S("editorOverviewRuler.commonContentForeground",{dark:yL(nL,1),light:yL(nL,1),hc:oL},mf(0,"Common ancestor overview ruler foreground for inline merge-conflicts."));const sL=_S("editorOverviewRuler.findMatchForeground",{dark:"#d186167e",light:"#d186167e",hc:"#AB5A00"},mf(0,"Overview ruler marker color for find matches. The color must not be opaque so as not to hide underlying decorations."),!0),rL=_S("editorOverviewRuler.selectionHighlightForeground",{dark:"#A0A0A0CC",light:"#A0A0A0CC",hc:"#A0A0A0CC"},mf(0,"Overview ruler marker color for selection highlights. The color must not be opaque so as not to hide underlying decorations."),!0),aL=_S("minimap.findMatchHighlight",{light:"#d18616",dark:"#d18616",hc:"#AB5A00"},mf(0,"Minimap marker color for find matches."),!0),lL=_S("minimap.selectionOccurrenceHighlight",{light:"#c9c9c9",dark:"#676767",hc:"#ffffff"},mf(0,"Minimap marker color for repeating editor selections."),!0),dL=_S("minimap.selectionHighlight",{light:"#ADD6FF",dark:"#264F78",hc:"#ffffff"},mf(0,"Minimap marker color for the editor selection."),!0),cL=_S("minimap.errorHighlight",{dark:new hS(new lS(255,18,18,.7)),light:new hS(new lS(255,18,18,.7)),hc:new hS(new lS(255,50,50,1))},mf(0,"Minimap marker color for errors.")),hL=_S("minimap.warningHighlight",{dark:ak,light:ak,hc:lk},mf(0,"Minimap marker color for warnings.")),uL=_S("minimap.background",{dark:null,light:null,hc:null},mf(0,"Minimap background color.")),gL=_S("minimap.foregroundOpacity",{dark:hS.fromHex("#000f"),light:hS.fromHex("#000f"),hc:hS.fromHex("#000f")},mf(0,'Opacity of foreground elements rendered in the minimap. For example, "#000000c0" will render the elements with 75% opacity.')),pL=_S("minimapSlider.background",{light:yL(JS,.5),dark:yL(JS,.5),hc:yL(JS,.5)},mf(0,"Minimap slider background color.")),mL=_S("minimapSlider.hoverBackground",{light:yL(ek,.5),dark:yL(ek,.5),hc:yL(ek,.5)},mf(0,"Minimap slider background color when hovering.")),fL=_S("minimapSlider.activeBackground",{light:yL(tk,.5),dark:yL(tk,.5),hc:yL(tk,.5)},mf(0,"Minimap slider background color when clicked on.")),_L=_S("problemsErrorIcon.foreground",{dark:ok,light:ok,hc:ok},mf(0,"The color used for the problems error icon.")),vL=_S("problemsWarningIcon.foreground",{dark:ak,light:ak,hc:ak},mf(0,"The color used for the problems warning icon.")),bL=_S("problemsInfoIcon.foreground",{dark:ck,light:ck,hc:ck},mf(0,"The color used for the problems info icon."));function wL(e,t){return{op:0,value:e,factor:t}}function CL(e,t){return{op:1,value:e,factor:t}}function yL(e,t){return{op:2,value:e,factor:t}}function xL(...e){return{op:3,values:e}}function SL(e,t,i,n){return{op:4,value:e,background:t,factor:i,transparency:n}}function kL(e,t){if(null!==e)return"string"==typeof e?"#"===e[0]?hS.fromHex(e):t.getColor(e):e instanceof hS?e:"object"==typeof e?function(e,t){var i,n,o;switch(e.op){case 0:return null===(i=kL(e.value,t))||void 0===i?void 0:i.darken(e.factor);case 1:return null===(n=kL(e.value,t))||void 0===n?void 0:n.lighten(e.factor);case 2:return null===(o=kL(e.value,t))||void 0===o?void 0:o.transparent(e.factor);case 3:for(const i of e.values){const e=kL(i,t);if(e)return e}return;case 5:return kL(t.defines(e.if)?e.then:e.else,t);case 4:{const i=kL(e.value,t);if(!i)return;const n=kL(e.background,t);return n?i.isDarkerThan(n)?hS.getLighterColor(i,n,e.factor).transparent(e.transparency):hS.getDarkerColor(i,n,e.factor).transparent(e.transparency):i.transparent(e.factor*e.transparency)}default:throw nr()}}(e,t):void 0}_S("charts.foreground",{dark:vS,light:vS,hc:vS},mf(0,"The foreground color used in charts.")),_S("charts.lines",{dark:yL(vS,.5),light:yL(vS,.5),hc:yL(vS,.5)},mf(0,"The color used for horizontal lines in charts.")),_S("charts.red",{dark:ok,light:ok,hc:ok},mf(0,"The red color used in chart visualizations.")),_S("charts.blue",{dark:ck,light:ck,hc:ck},mf(0,"The blue color used in chart visualizations.")),_S("charts.yellow",{dark:ak,light:ak,hc:ak},mf(0,"The yellow color used in chart visualizations.")),_S("charts.orange",{dark:aL,light:aL,hc:aL},mf(0,"The orange color used in chart visualizations.")),_S("charts.green",{dark:"#89D185",light:"#388A34",hc:"#89D185"},mf(0,"The green color used in chart visualizations.")),_S("charts.purple",{dark:"#B180D7",light:"#652D90",hc:"#B180D7"},mf(0,"The purple color used in chart visualizations."));const DL="vscode://schemas/workbench-colors";let LL=Yy.as(uS);LL.registerSchema(DL,fS.getColorSchema());const NL=new lb((()=>LL.notifySchemaChanged(DL)),200);fS.onDidChangeSchema((()=>{NL.isScheduled()||NL.schedule()}));class EL{constructor(e,t){this.x=e,this.y=t,this._pageCoordinatesBrand=void 0}toClientCoordinates(){return new IL(this.x-xC.scrollX,this.y-xC.scrollY)}}class IL{constructor(e,t){this.clientX=e,this.clientY=t,this._clientCoordinatesBrand=void 0}toPageCoordinates(){return new EL(this.clientX+xC.scrollX,this.clientY+xC.scrollY)}}class TL{constructor(e,t,i,n){this.x=e,this.y=t,this.width=i,this.height=n,this._editorPagePositionBrand=void 0}}class ML{constructor(e,t){this.x=e,this.y=t,this._positionRelativeToEditorBrand=void 0}}function AL(e){const t=yC(e);return new TL(t.left,t.top,t.width,t.height)}function OL(e,t,i){const n=t.width/e.offsetWidth,o=t.height/e.offsetHeight,s=(i.x-t.x)/n,r=(i.y-t.y)/o;return new ML(s,r)}class RL extends Gw{constructor(e,t){super(e),this._editorMouseEventBrand=void 0,this.pos=new EL(this.posx,this.posy),this.editorPos=AL(t),this.relativePos=OL(t,this.editorPos,this.pos)}}class PL{constructor(e){this._editorViewDomNode=e}_create(e){return new RL(e,this._editorViewDomNode)}onContextMenu(e,t){return nC(e,"contextmenu",(e=>{t(this._create(e))}))}onMouseUp(e,t){return nC(e,"mouseup",(e=>{t(this._create(e))}))}onMouseDown(e,t){return nC(e,"mousedown",(e=>{t(this._create(e))}))}onMouseLeave(e,t){return lC(e,(e=>{t(this._create(e))}))}onMouseMoveThrottled(e,t,i,n){return fC(e,"mousemove",t,((e,t)=>i(e,this._create(t))),n)}}class FL{constructor(e){this._editorViewDomNode=e}_create(e){return new RL(e,this._editorViewDomNode)}onPointerUp(e,t){return nC(e,"pointerup",(e=>{t(this._create(e))}))}onPointerDown(e,t){return nC(e,"pointerdown",(e=>{t(this._create(e))}))}onPointerLeave(e,t){return n=e=>{t(this._create(e))},nC(i=e,"pointerout",(e=>{let t=e.relatedTarget;for(;t&&t!==i;)t=t.parentNode;t!==i&&n(e)}));var i,n}onPointerMoveThrottled(e,t,i,n){return fC(e,"pointermove",t,((e,t)=>i(e,this._create(t))),n)}}class BL extends Uo{constructor(e){super(),this._editorViewDomNode=e,this._globalMouseMoveMonitor=this._register(new rS),this._keydownListener=null}startMonitoring(e,t,i,n,o){this._keydownListener=sC(document,"keydown",(e=>{e.toKeybinding().isModifierKey()||this._globalMouseMoveMonitor.stopMonitoring(!0,e.browserEvent)}),!0);this._globalMouseMoveMonitor.startMonitoring(e,t,((e,t)=>i(e,new RL(t,this._editorViewDomNode))),n,(e=>{this._keydownListener.dispose(),o(e)}))}stopMonitoring(){this._globalMouseMoveMonitor.stopMonitoring(!0)}}class VL{constructor(e){this._editor=e,this._instanceId=++VL._idPool,this._counter=0,this._rules=new Map,this._garbageCollectionScheduler=new lb((()=>this.garbageCollect()),1e3)}createClassNameRef(e){const t=this.getOrCreateRule(e);return t.increaseRefCount(),{className:t.className,dispose:()=>{t.decreaseRefCount(),this._garbageCollectionScheduler.schedule()}}}getOrCreateRule(e){const t=this.computeUniqueKey(e);let i=this._rules.get(t);if(!i){const n=this._counter++;i=new WL(t,`dyn-rule-${this._instanceId}-${n}`,MC(this._editor.getContainerDomNode())?this._editor.getContainerDomNode():void 0,e),this._rules.set(t,i)}return i}computeUniqueKey(e){return JSON.stringify(e)}garbageCollect(){for(const e of this._rules.values())e.hasReferences()||(this._rules.delete(e.key),e.dispose())}}VL._idPool=0;class WL{constructor(e,t,i,n){this.key=e,this.className=t,this.properties=n,this._referenceCount=0,this._styleElement=RC(i),this._styleElement.textContent=this.getCssText(this.className,this.properties)}getCssText(e,t){let i=`.${e} {`;for(const n in t){const e=t[n];let o;o="object"==typeof e?`var(${pS(e.id)})`:e;i+=`\n\t${zL(n)}: ${o};`}return i+="\n}",i}dispose(){this._styleElement.remove()}increaseRefCount(){this._referenceCount++}decreaseRefCount(){this._referenceCount--}hasReferences(){return this._referenceCount>0}}function zL(e){return e.replace(/(^[A-Z])/,(([e])=>e.toLowerCase())).replace(/([A-Z])/g,(([e])=>`-${e.toLowerCase()}`))}class HL extends Uo{constructor(){super(),this._shouldRender=!0}shouldRender(){return this._shouldRender}forceShouldRender(){this._shouldRender=!0}setShouldRender(){this._shouldRender=!0}onDidRender(){this._shouldRender=!1}onCompositionStart(e){return!1}onCompositionEnd(e){return!1}onConfigurationChanged(e){return!1}onCursorStateChanged(e){return!1}onDecorationsChanged(e){return!1}onFlushed(e){return!1}onFocusChanged(e){return!1}onLanguageConfigurationChanged(e){return!1}onLineMappingChanged(e){return!1}onLinesChanged(e){return!1}onLinesDeleted(e){return!1}onLinesInserted(e){return!1}onRevealRangeRequest(e){return!1}onScrollChanged(e){return!1}onThemeChanged(e){return!1}onTokensChanged(e){return!1}onTokensColorsChanged(e){return!1}onZonesChanged(e){return!1}handleEvents(e){let t=!1;for(let i=0,n=e.length;i<n;i++){const n=e[i];switch(n.type){case 0:this.onCompositionStart(n)&&(t=!0);break;case 1:this.onCompositionEnd(n)&&(t=!0);break;case 2:this.onConfigurationChanged(n)&&(t=!0);break;case 3:this.onCursorStateChanged(n)&&(t=!0);break;case 4:this.onDecorationsChanged(n)&&(t=!0);break;case 5:this.onFlushed(n)&&(t=!0);break;case 6:this.onFocusChanged(n)&&(t=!0);break;case 7:this.onLanguageConfigurationChanged(n)&&(t=!0);break;case 8:this.onLineMappingChanged(n)&&(t=!0);break;case 9:this.onLinesChanged(n)&&(t=!0);break;case 10:this.onLinesDeleted(n)&&(t=!0);break;case 11:this.onLinesInserted(n)&&(t=!0);break;case 12:this.onRevealRangeRequest(n)&&(t=!0);break;case 13:this.onScrollChanged(n)&&(t=!0);break;case 15:this.onTokensChanged(n)&&(t=!0);break;case 14:this.onThemeChanged(n)&&(t=!0);break;case 16:this.onTokensColorsChanged(n)&&(t=!0);break;case 17:this.onZonesChanged(n)&&(t=!0)}}t&&(this._shouldRender=!0)}}class jL extends HL{constructor(e){super(),this._context=e,this._context.addEventHandler(this)}dispose(){this._context.removeEventHandler(this),super.dispose()}}class UL{static write(e,t){e.setAttribute("data-mprt",String(t))}static read(e){const t=e.getAttribute("data-mprt");return null===t?0:parseInt(t,10)}static collect(e,t){const i=[];let n=0;for(;e&&e!==document.body&&e!==t;)e.nodeType===e.ELEMENT_NODE&&(i[n++]=this.read(e)),e=e.parentElement;const o=new Uint8Array(n);for(let s=0;s<n;s++)o[s]=i[n-s-1];return o}}class $L extends class{constructor(e,t){this._restrictedRenderingContextBrand=void 0,this._viewLayout=e,this.viewportData=t,this.scrollWidth=this._viewLayout.getScrollWidth(),this.scrollHeight=this._viewLayout.getScrollHeight(),this.visibleRange=this.viewportData.visibleRange,this.bigNumbersDelta=this.viewportData.bigNumbersDelta;const i=this._viewLayout.getCurrentViewport();this.scrollTop=i.top,this.scrollLeft=i.left,this.viewportWidth=i.width,this.viewportHeight=i.height}getScrolledTopFromAbsoluteTop(e){return e-this.scrollTop}getVerticalOffsetForLineNumber(e){return this._viewLayout.getVerticalOffsetForLineNumber(e)}getDecorationsInViewport(){return this.viewportData.getDecorationsInViewport()}}{constructor(e,t,i){super(e,t),this._renderingContextBrand=void 0,this._viewLines=i}linesVisibleRangesForRange(e,t){return this._viewLines.linesVisibleRangesForRange(e,t)}visibleRangeForPosition(e){return this._viewLines.visibleRangeForPosition(e)}}class KL{constructor(e,t,i){this.outsideRenderedLine=e,this.lineNumber=t,this.ranges=i}}class qL{constructor(e,t){this._horizontalRangeBrand=void 0,this.left=Math.round(e),this.width=Math.round(t)}static from(e){const t=new Array(e.length);for(let i=0,n=e.length;i<n;i++){const n=e[i];t[i]=new qL(n.left,n.width)}return t}toString(){return`[${this.left},${this.width}]`}}class GL{constructor(e,t){this._floatHorizontalRangeBrand=void 0,this.left=e,this.width=t}toString(){return`[${this.left},${this.width}]`}static compare(e,t){return e.left-t.left}}class ZL{constructor(e,t){this.outsideRenderedLine=e,this.originalLeft=t,this.left=Math.round(this.originalLeft)}}class YL{constructor(e,t){this.outsideRenderedLine=e,this.ranges=t}}class XL{static _createRange(){return this._handyReadyRange||(this._handyReadyRange=document.createRange()),this._handyReadyRange}static _detachRange(e,t){e.selectNodeContents(t)}static _readClientRects(e,t,i,n,o){const s=this._createRange();try{return s.setStart(e,t),s.setEnd(i,n),s.getClientRects()}catch(r){return null}finally{this._detachRange(s,o)}}static _mergeAdjacentRanges(e){if(1===e.length)return e;e.sort(GL.compare);const t=[];let i=0,n=e[0];for(let o=1,s=e.length;o<s;o++){const s=e[o];n.left+n.width+.9>=s.left?n.width=Math.max(n.width,s.left+s.width-n.left):(t[i++]=n,n=s)}return t[i++]=n,t}static _createHorizontalRangesFromClientRects(e,t,i){if(!e||0===e.length)return null;const n=[];for(let o=0,s=e.length;o<s;o++){const s=e[o];n[o]=new GL(Math.max(0,(s.left-t)/i),s.width/i)}return this._mergeAdjacentRanges(n)}static readHorizontalRanges(e,t,i,n,o,s,r,a){const l=e.children.length-1;if(0>l)return null;if((t=Math.min(l,Math.max(0,t)))===(n=Math.min(l,Math.max(0,n)))&&i===o&&0===i&&!e.children[t].firstChild){const i=e.children[t].getClientRects();return this._createHorizontalRangesFromClientRects(i,s,r)}t!==n&&n>0&&0===o&&(n--,o=1073741824);let d=e.children[t].firstChild,c=e.children[n].firstChild;if(d&&c||(!d&&0===i&&t>0&&(d=e.children[t-1].firstChild,i=1073741824),!c&&0===o&&n>0&&(c=e.children[n-1].firstChild,o=1073741824)),!d||!c)return null;i=Math.min(d.textContent.length,Math.max(0,i)),o=Math.min(c.textContent.length,Math.max(0,o));const h=this._readClientRects(d,i,c,o,a);return this._createHorizontalRangesFromClientRects(h,s,r)}}const QL=!!Ts||!(Vo||o_||a_);let JL=!0;class eN{constructor(e,t){this._domNode=e,this._clientRectDeltaLeft=0,this._clientRectScale=1,this._clientRectRead=!1,this.endNode=t}readClientRect(){if(!this._clientRectRead){this._clientRectRead=!0;const e=this._domNode.getBoundingClientRect();this._clientRectDeltaLeft=e.left,this._clientRectScale=e.width/this._domNode.offsetWidth}}get clientRectDeltaLeft(){return this._clientRectRead||this.readClientRect(),this._clientRectDeltaLeft}get clientRectScale(){return this._clientRectRead||this.readClientRect(),this._clientRectScale}}class tN{constructor(e,t){this.themeType=t;const i=e.options,n=i.get(44);this.renderWhitespace=i.get(88),this.renderControlCharacters=i.get(83),this.spaceWidth=n.spaceWidth,this.middotWidth=n.middotWidth,this.wsmiddotWidth=n.wsmiddotWidth,this.useMonospaceOptimizations=n.isMonospace&&!i.get(29),this.canUseHalfwidthRightwardsArrow=n.canUseHalfwidthRightwardsArrow,this.lineHeight=i.get(59),this.stopRenderingLineAfter=i.get(105),this.fontLigatures=i.get(45)}equals(e){return this.themeType===e.themeType&&this.renderWhitespace===e.renderWhitespace&&this.renderControlCharacters===e.renderControlCharacters&&this.spaceWidth===e.spaceWidth&&this.middotWidth===e.middotWidth&&this.wsmiddotWidth===e.wsmiddotWidth&&this.useMonospaceOptimizations===e.useMonospaceOptimizations&&this.canUseHalfwidthRightwardsArrow===e.canUseHalfwidthRightwardsArrow&&this.lineHeight===e.lineHeight&&this.stopRenderingLineAfter===e.stopRenderingLineAfter&&this.fontLigatures===e.fontLigatures}}class iN{constructor(e){this._options=e,this._isMaybeInvalid=!0,this._renderedViewLine=null}getDomNode(){return this._renderedViewLine&&this._renderedViewLine.domNode?this._renderedViewLine.domNode.domNode:null}setDomNode(e){if(!this._renderedViewLine)throw new Error("I have no rendered view line to set the dom node to...");this._renderedViewLine.domNode=p_(e)}onContentChanged(){this._isMaybeInvalid=!0}onTokensChanged(){this._isMaybeInvalid=!0}onDecorationsChanged(){this._isMaybeInvalid=!0}onOptionsChanged(e){this._isMaybeInvalid=!0,this._options=e}onSelectionChanged(){return(this._options.themeType===Xy.HIGH_CONTRAST||"selection"===this._options.renderWhitespace)&&(this._isMaybeInvalid=!0,!0)}renderLine(e,t,i,n){if(!1===this._isMaybeInvalid)return!1;this._isMaybeInvalid=!1;const o=i.getViewLineRenderingData(e),s=this._options,r=jb.filter(o.inlineDecorations,e,o.minColumn,o.maxColumn);let a=null;if(s.themeType===Xy.HIGH_CONTRAST||"selection"===this._options.renderWhitespace){const t=i.selections;for(const i of t){if(i.endLineNumber<e||i.startLineNumber>e)continue;const t=i.startLineNumber===e?i.startColumn:o.minColumn,n=i.endLineNumber===e?i.endColumn:o.maxColumn;t<n&&(s.themeType===Xy.HIGH_CONTRAST||"selection"!==this._options.renderWhitespace?r.push(new jb(t,n,"inline-selected-text",0)):(a||(a=[]),a.push(new qb(t-1,n-1))))}}const l=new Gb(s.useMonospaceOptimizations,s.canUseHalfwidthRightwardsArrow,o.content,o.continuesWithWrappedLine,o.isBasicASCII,o.containsRTL,o.minColumn-1,o.tokens,r,o.tabSize,o.startVisibleColumn,s.spaceWidth,s.middotWidth,s.wsmiddotWidth,s.stopRenderingLineAfter,s.renderWhitespace,s.renderControlCharacters,s.fontLigatures!==Of.OFF,a);if(this._renderedViewLine&&this._renderedViewLine.input.equals(l))return!1;n.appendASCIIString('<div style="top:'),n.appendASCIIString(String(t)),n.appendASCIIString("px;height:"),n.appendASCIIString(String(this._options.lineHeight)),n.appendASCIIString('px;" class="'),n.appendASCIIString(iN.CLASS_NAME),n.appendASCIIString('">');const d=Qb(l,n);n.appendASCIIString("</div>");let c=null;return JL&&QL&&o.isBasicASCII&&s.useMonospaceOptimizations&&0===d.containsForeignElements&&o.content.length<300&&l.lineTokens.getCount()<100&&(c=new nN(this._renderedViewLine?this._renderedViewLine.domNode:null,l,d.characterMapping)),c||(c=rN(this._renderedViewLine?this._renderedViewLine.domNode:null,l,d.characterMapping,d.containsRTL,d.containsForeignElements)),this._renderedViewLine=c,!0}layoutLine(e,t){this._renderedViewLine&&this._renderedViewLine.domNode&&(this._renderedViewLine.domNode.setTop(t),this._renderedViewLine.domNode.setHeight(this._options.lineHeight))}getWidth(){return this._renderedViewLine?this._renderedViewLine.getWidth():0}getWidthIsFast(){return!this._renderedViewLine||this._renderedViewLine.getWidthIsFast()}needsMonospaceFontCheck(){return!!this._renderedViewLine&&this._renderedViewLine instanceof nN}monospaceAssumptionsAreValid(){return this._renderedViewLine&&this._renderedViewLine instanceof nN?this._renderedViewLine.monospaceAssumptionsAreValid():JL}onMonospaceAssumptionsInvalidated(){this._renderedViewLine&&this._renderedViewLine instanceof nN&&(this._renderedViewLine=this._renderedViewLine.toSlowRenderedLine())}getVisibleRangesForRange(e,t,i,n){if(!this._renderedViewLine)return null;t=Math.min(this._renderedViewLine.input.lineContent.length+1,Math.max(1,t)),i=Math.min(this._renderedViewLine.input.lineContent.length+1,Math.max(1,i));const o=this._renderedViewLine.input.stopRenderingLineAfter;let s=!1;-1!==o&&t>o+1&&i>o+1&&(s=!0),-1!==o&&t>o+1&&(t=o+1),-1!==o&&i>o+1&&(i=o+1);const r=this._renderedViewLine.getVisibleRangesForRange(e,t,i,n);return r&&r.length>0?new YL(s,r):null}getColumnOfNodeOffset(e,t,i){return this._renderedViewLine?this._renderedViewLine.getColumnOfNodeOffset(e,t,i):1}}iN.CLASS_NAME="view-line";class nN{constructor(e,t,i){this.domNode=e,this.input=t,this._characterMapping=i,this._charWidth=t.spaceWidth}getWidth(){return Math.round(this._getCharPosition(this._characterMapping.length))}getWidthIsFast(){return!0}monospaceAssumptionsAreValid(){if(!this.domNode)return JL;const e=this.getWidth(),t=this.domNode.domNode.firstChild.offsetWidth;return Math.abs(e-t)>=2&&(JL=!1),JL}toSlowRenderedLine(){return rN(this.domNode,this.input,this._characterMapping,!1,0)}getVisibleRangesForRange(e,t,i,n){const o=this._getCharPosition(t),s=this._getCharPosition(i);return[new GL(o,s-o)]}_getCharPosition(e){const t=this._characterMapping.getAbsoluteOffset(e);return this._charWidth*t}getColumnOfNodeOffset(e,t,i){const n=t.textContent.length;let o=-1;for(;t;)t=t.previousSibling,o++;return this._characterMapping.getColumn(new Zb(o,i),n)}}class oN{constructor(e,t,i,n,o){if(this.domNode=e,this.input=t,this._characterMapping=i,this._isWhitespaceOnly=/^\s*$/.test(t.lineContent),this._containsForeignElements=o,this._cachedWidth=-1,this._pixelOffsetCache=null,!n||0===this._characterMapping.length){this._pixelOffsetCache=new Float32Array(Math.max(2,this._characterMapping.length+1));for(let e=0,t=this._characterMapping.length;e<=t;e++)this._pixelOffsetCache[e]=-1}}_getReadingTarget(e){return e.domNode.firstChild}getWidth(){return this.domNode?(-1===this._cachedWidth&&(this._cachedWidth=this._getReadingTarget(this.domNode).offsetWidth),this._cachedWidth):0}getWidthIsFast(){return-1!==this._cachedWidth}getVisibleRangesForRange(e,t,i,n){if(!this.domNode)return null;if(null!==this._pixelOffsetCache){const o=this._readPixelOffset(this.domNode,e,t,n);if(-1===o)return null;const s=this._readPixelOffset(this.domNode,e,i,n);return-1===s?null:[new GL(o,s-o)]}return this._readVisibleRangesForRange(this.domNode,e,t,i,n)}_readVisibleRangesForRange(e,t,i,n,o){if(i===n){const n=this._readPixelOffset(e,t,i,o);return-1===n?null:[new GL(n,0)]}return this._readRawVisibleRangesForRange(e,i,n,o)}_readPixelOffset(e,t,i,n){if(0===this._characterMapping.length){if(0===this._containsForeignElements)return 0;if(2===this._containsForeignElements)return 0;if(1===this._containsForeignElements)return this.getWidth();const t=this._getReadingTarget(e);return t.firstChild?t.firstChild.offsetWidth:0}if(null!==this._pixelOffsetCache){const o=this._pixelOffsetCache[i];if(-1!==o)return o;const s=this._actualReadPixelOffset(e,t,i,n);return this._pixelOffsetCache[i]=s,s}return this._actualReadPixelOffset(e,t,i,n)}_actualReadPixelOffset(e,t,i,n){if(0===this._characterMapping.length){const t=XL.readHorizontalRanges(this._getReadingTarget(e),0,0,0,0,n.clientRectDeltaLeft,n.clientRectScale,n.endNode);return t&&0!==t.length?t[0].left:-1}if(i===this._characterMapping.length&&this._isWhitespaceOnly&&0===this._containsForeignElements)return this.getWidth();const o=this._characterMapping.getDomPosition(i),s=XL.readHorizontalRanges(this._getReadingTarget(e),o.partIndex,o.charIndex,o.partIndex,o.charIndex,n.clientRectDeltaLeft,n.clientRectScale,n.endNode);if(!s||0===s.length)return-1;const r=s[0].left;if(this.input.isBasicASCII){const e=this._characterMapping.getAbsoluteOffset(i),t=Math.round(this.input.spaceWidth*e);if(Math.abs(t-r)<=1)return t}return r}_readRawVisibleRangesForRange(e,t,i,n){if(1===t&&i===this._characterMapping.length)return[new GL(0,this.getWidth())];const o=this._characterMapping.getDomPosition(t),s=this._characterMapping.getDomPosition(i);return XL.readHorizontalRanges(this._getReadingTarget(e),o.partIndex,o.charIndex,s.partIndex,s.charIndex,n.clientRectDeltaLeft,n.clientRectScale,n.endNode)}getColumnOfNodeOffset(e,t,i){const n=t.textContent.length;let o=-1;for(;t;)t=t.previousSibling,o++;return this._characterMapping.getColumn(new Zb(o,i),n)}}class sN extends oN{_readVisibleRangesForRange(e,t,i,n,o){const s=super._readVisibleRangesForRange(e,t,i,n,o);if(!s||0===s.length||i===n||1===i&&n===this._characterMapping.length)return s;if(!this.input.containsRTL){const i=this._readPixelOffset(e,t,n,o);if(-1!==i){const e=s[s.length-1];e.left<i&&(e.width=i-e.left)}}return s}}const rN=s_?aN:lN;function aN(e,t,i,n,o){return new sN(e,t,i,n,o)}function lN(e,t,i,n,o){return new oN(e,t,i,n,o)}class dN{static _nextVisibleColumn(e,t,i){return 9===e?dN.nextRenderTabStop(t,i):ks(e)||or(e)?t+2:t+1}static visibleColumnFromColumn(e,t,i){const n=Math.min(t-1,e.length),o=e.substring(0,n),s=new rr(o);let r=0;for(;!s.eol();){const e=sr(o,n,s.offset);s.nextGraphemeLength(),r=this._nextVisibleColumn(e,r,i)}return r}static columnFromVisibleColumn(e,t,i){if(t<=0)return 1;const n=e.length,o=new rr(e);let s=0,r=1;for(;!o.eol();){const a=sr(e,n,o.offset);o.nextGraphemeLength();const l=this._nextVisibleColumn(a,s,i),d=o.offset+1;if(l>=t){return l-t<t-s?d:r}s=l,r=d}return n+1}static nextRenderTabStop(e,t){return e+t-e%t}static nextIndentTabStop(e,t){return e+t-e%t}static prevRenderTabStop(e,t){return Math.max(0,e-1-(e-1)%t)}static prevIndentTabStop(e,t){return Math.max(0,e-1-(e-1)%t)}}class cN{static whitespaceVisibleColumn(e,t,i){const n=e.length;let o=0,s=-1,r=-1;for(let a=0;a<n;a++){if(a===t)return[s,r,o];o%i==0&&(s=a,r=o);switch(e.charCodeAt(a)){case 32:o+=1;break;case 9:o=dN.nextRenderTabStop(o,i);break;default:return[-1,-1,-1]}}return t===n?[s,r,o]:[-1,-1,-1]}static atomicPosition(e,t,i,n){const o=e.length,[s,r,a]=cN.whitespaceVisibleColumn(e,t,i);if(-1===a)return-1;let l;switch(n){case 0:l=!0;break;case 1:l=!1;break;case 2:if(a%i==0)return t;l=a%i<=i/2}if(l){if(-1===s)return-1;let t=r;for(let n=s;n<o;++n){if(t===r+i)return s;switch(e.charCodeAt(n)){case 32:t+=1;break;case 9:t=dN.nextRenderTabStop(t,i);break;default:return-1}}return t===r+i?s:-1}const d=dN.nextRenderTabStop(a,i);let c=a;for(let h=t;h<o;h++){if(c===d)return h;switch(e.charCodeAt(h)){case 32:c+=1;break;case 9:c=dN.nextRenderTabStop(c,i);break;default:return-1}}return c===d?o:-1}}class hN{constructor(e=null){this.hitTarget=e,this.type=0}}class uN{constructor(e,t,i){this.position=e,this.spanNode=t,this.injectedText=i,this.type=1}}var gN;!function(e){e.createFromDOMInfo=function(e,t,i){const n=e.getPositionFromDOMInfo(t,i);return n?new uN(n,t,null):new hN(t)}}(gN||(gN={}));class pN{constructor(e,t){this.lastViewCursorsRenderData=e,this.lastTextareaPosition=t}}class mN{static _deduceRage(e,t=null){return!t&&e?new qo(e.lineNumber,e.column,e.lineNumber,e.column):null!=t?t:null}static createUnknown(e,t,i){return{type:0,element:e,mouseColumn:t,position:i,range:this._deduceRage(i)}}static createTextarea(e,t){return{type:1,element:e,mouseColumn:t,position:null,range:null}}static createMargin(e,t,i,n,o,s){return{type:e,element:t,mouseColumn:i,position:n,range:o,detail:s}}static createViewZone(e,t,i,n,o){return{type:e,element:t,mouseColumn:i,position:n,range:this._deduceRage(n),detail:o}}static createContentText(e,t,i,n,o){return{type:6,element:e,mouseColumn:t,position:i,range:this._deduceRage(i,n),detail:o}}static createContentEmpty(e,t,i,n){return{type:7,element:e,mouseColumn:t,position:i,range:this._deduceRage(i),detail:n}}static createContentWidget(e,t,i){return{type:9,element:e,mouseColumn:t,position:null,range:null,detail:i}}static createScrollbar(e,t,i){return{type:11,element:e,mouseColumn:t,position:i,range:this._deduceRage(i)}}static createOverlayWidget(e,t,i){return{type:12,element:e,mouseColumn:t,position:null,range:null,detail:i}}static createOutsideEditor(e,t){return{type:13,element:null,mouseColumn:e,position:t,range:this._deduceRage(t)}}static _typeToString(e){return 1===e?"TEXTAREA":2===e?"GUTTER_GLYPH_MARGIN":3===e?"GUTTER_LINE_NUMBERS":4===e?"GUTTER_LINE_DECORATIONS":5===e?"GUTTER_VIEW_ZONE":6===e?"CONTENT_TEXT":7===e?"CONTENT_EMPTY":8===e?"CONTENT_VIEW_ZONE":9===e?"CONTENT_WIDGET":10===e?"OVERVIEW_RULER":11===e?"SCROLLBAR":12===e?"OVERLAY_WIDGET":"UNKNOWN"}static toString(e){return this._typeToString(e.type)+": "+e.position+" - "+e.range+" - "+JSON.stringify(e.detail)}}class fN{static isTextArea(e){return 2===e.length&&3===e[0]&&6===e[1]}static isChildOfViewLines(e){return e.length>=4&&3===e[0]&&7===e[3]}static isStrictChildOfViewLines(e){return e.length>4&&3===e[0]&&7===e[3]}static isChildOfScrollableElement(e){return e.length>=2&&3===e[0]&&5===e[1]}static isChildOfMinimap(e){return e.length>=2&&3===e[0]&&8===e[1]}static isChildOfContentWidgets(e){return e.length>=4&&3===e[0]&&1===e[3]}static isChildOfOverflowingContentWidgets(e){return e.length>=1&&2===e[0]}static isChildOfOverlayWidgets(e){return e.length>=2&&3===e[0]&&4===e[1]}}class _N{constructor(e,t,i){this.viewModel=e.viewModel;const n=e.configuration.options;this.layoutInfo=n.get(131),this.viewDomNode=t.viewDomNode,this.lineHeight=n.get(59),this.stickyTabStops=n.get(104),this.typicalHalfwidthCharacterWidth=n.get(44).typicalHalfwidthCharacterWidth,this.lastRenderData=i,this._context=e,this._viewHelper=t}getZoneAtCoord(e){return _N.getZoneAtCoord(this._context,e)}static getZoneAtCoord(e,t){const i=e.viewLayout.getWhitespaceAtVerticalOffset(t);if(i){const n=i.verticalOffset+i.height/2,o=e.viewModel.getLineCount();let s,r=null,a=null;return i.afterLineNumber!==o&&(a=new er(i.afterLineNumber+1,1)),i.afterLineNumber>0&&(r=new er(i.afterLineNumber,e.viewModel.getLineMaxColumn(i.afterLineNumber))),s=null===a?r:null===r?a:t<n?r:a,{viewZoneId:i.id,afterLineNumber:i.afterLineNumber,positionBefore:r,positionAfter:a,position:s}}return null}getFullLineRangeAtCoord(e){if(this._context.viewLayout.isAfterLines(e)){const e=this._context.viewModel.getLineCount(),t=this._context.viewModel.getLineMaxColumn(e);return{range:new qo(e,t,e,t),isAfterLines:!0}}const t=this._context.viewLayout.getLineNumberAtVerticalOffset(e),i=this._context.viewModel.getLineMaxColumn(t);return{range:new qo(t,1,t,i),isAfterLines:!1}}getLineNumberAtVerticalOffset(e){return this._context.viewLayout.getLineNumberAtVerticalOffset(e)}isAfterLines(e){return this._context.viewLayout.isAfterLines(e)}isInTopPadding(e){return this._context.viewLayout.isInTopPadding(e)}isInBottomPadding(e){return this._context.viewLayout.isInBottomPadding(e)}getVerticalOffsetForLineNumber(e){return this._context.viewLayout.getVerticalOffsetForLineNumber(e)}findAttribute(e,t){return _N._findAttribute(e,t,this._viewHelper.viewDomNode)}static _findAttribute(e,t,i){for(;e&&e!==document.body;){if(e.hasAttribute&&e.hasAttribute(t))return e.getAttribute(t);if(e===i)return null;e=e.parentNode}return null}getLineWidth(e){return this._viewHelper.getLineWidth(e)}visibleRangeForPosition(e,t){return this._viewHelper.visibleRangeForPosition(e,t)}getPositionFromDOMInfo(e,t){return this._viewHelper.getPositionFromDOMInfo(e,t)}getCurrentScrollTop(){return this._context.viewLayout.getCurrentScrollTop()}getCurrentScrollLeft(){return this._context.viewLayout.getCurrentScrollLeft()}}class vN extends class{constructor(e,t,i,n){this.editorPos=t,this.pos=i,this.relativePos=n,this.mouseVerticalOffset=Math.max(0,e.getCurrentScrollTop()+this.relativePos.y),this.mouseContentHorizontalOffset=e.getCurrentScrollLeft()+this.relativePos.x-e.layoutInfo.contentLeft,this.isInMarginArea=this.relativePos.x<e.layoutInfo.contentLeft&&this.relativePos.x>=e.layoutInfo.glyphMarginLeft,this.isInContentArea=!this.isInMarginArea,this.mouseColumn=Math.max(0,CN._getMouseColumn(this.mouseContentHorizontalOffset,e.typicalHalfwidthCharacterWidth))}}{constructor(e,t,i,n,o){super(e,t,i,n),this._ctx=e,o?(this.target=o,this.targetPath=UL.collect(o,e.viewDomNode)):(this.target=null,this.targetPath=new Uint8Array(0))}toString(){return`pos(${this.pos.x},${this.pos.y}), editorPos(${this.editorPos.x},${this.editorPos.y}), relativePos(${this.relativePos.x},${this.relativePos.y}), mouseVerticalOffset: ${this.mouseVerticalOffset}, mouseContentHorizontalOffset: ${this.mouseContentHorizontalOffset}\n\ttarget: ${this.target?this.target.outerHTML:null}`}_getMouseColumn(e=null){return e&&e.column<this._ctx.viewModel.getLineMaxColumn(e.lineNumber)?dN.visibleColumnFromColumn(this._ctx.viewModel.getLineContent(e.lineNumber),e.column,this._ctx.viewModel.model.getOptions().tabSize)+1:this.mouseColumn}fulfillUnknown(e=null){return mN.createUnknown(this.target,this._getMouseColumn(e),e)}fulfillTextarea(){return mN.createTextarea(this.target,this._getMouseColumn())}fulfillMargin(e,t,i,n){return mN.createMargin(e,this.target,this._getMouseColumn(t),t,i,n)}fulfillViewZone(e,t,i){return mN.createViewZone(e,this.target,this._getMouseColumn(t),t,i)}fulfillContentText(e,t,i){return mN.createContentText(this.target,this._getMouseColumn(e),e,t,i)}fulfillContentEmpty(e,t){return mN.createContentEmpty(this.target,this._getMouseColumn(e),e,t)}fulfillContentWidget(e){return mN.createContentWidget(this.target,this._getMouseColumn(),e)}fulfillScrollbar(e){return mN.createScrollbar(this.target,this._getMouseColumn(e),e)}fulfillOverlayWidget(e){return mN.createOverlayWidget(this.target,this._getMouseColumn(),e)}withTarget(e){return new vN(this._ctx,this.editorPos,this.pos,this.relativePos,e)}}const bN={isAfterLines:!0};function wN(e){return{isAfterLines:!1,horizontalDistanceToText:e}}class CN{constructor(e,t){this._context=e,this._viewHelper=t}mouseTargetIsWidget(e){const t=e.target,i=UL.collect(t,this._viewHelper.viewDomNode);return!(!fN.isChildOfContentWidgets(i)&&!fN.isChildOfOverflowingContentWidgets(i))||!!fN.isChildOfOverlayWidgets(i)}createMouseTarget(e,t,i,n,o){const s=new _N(this._context,this._viewHelper,e),r=new vN(s,t,i,n,o);try{return CN._createMouseTarget(s,r,!1)}catch(a){return r.fulfillUnknown()}}static _createMouseTarget(e,t,i){if(null===t.target){if(i)return t.fulfillUnknown();const n=CN._doHitTest(e,t);return 1===n.type?CN.createMouseTargetFromHitTestPosition(e,t,n.spanNode,n.position,n.injectedText):this._createMouseTarget(e,t.withTarget(n.hitTarget),!0)}const n=t;let o=null;return o=o||CN._hitTestContentWidget(e,n),o=o||CN._hitTestOverlayWidget(e,n),o=o||CN._hitTestMinimap(e,n),o=o||CN._hitTestScrollbarSlider(e,n),o=o||CN._hitTestViewZone(e,n),o=o||CN._hitTestMargin(e,n),o=o||CN._hitTestViewCursor(e,n),o=o||CN._hitTestTextArea(e,n),o=o||CN._hitTestViewLines(e,n,i),o=o||CN._hitTestScrollbar(e,n),o||t.fulfillUnknown()}static _hitTestContentWidget(e,t){if(fN.isChildOfContentWidgets(t.targetPath)||fN.isChildOfOverflowingContentWidgets(t.targetPath)){const i=e.findAttribute(t.target,"widgetId");return i?t.fulfillContentWidget(i):t.fulfillUnknown()}return null}static _hitTestOverlayWidget(e,t){if(fN.isChildOfOverlayWidgets(t.targetPath)){const i=e.findAttribute(t.target,"widgetId");return i?t.fulfillOverlayWidget(i):t.fulfillUnknown()}return null}static _hitTestViewCursor(e,t){if(t.target){const i=e.lastRenderData.lastViewCursorsRenderData;for(const e of i)if(t.target===e.domNode)return t.fulfillContentText(e.position,null,{mightBeForeignElement:!1,injectedText:null})}if(t.isInContentArea){const i=e.lastRenderData.lastViewCursorsRenderData,n=t.mouseContentHorizontalOffset,o=t.mouseVerticalOffset;for(const s of i){if(n<s.contentLeft)continue;if(n>s.contentLeft+s.width)continue;const i=e.getVerticalOffsetForLineNumber(s.position.lineNumber);if(i<=o&&o<=i+s.height)return t.fulfillContentText(s.position,null,{mightBeForeignElement:!1,injectedText:null})}}return null}static _hitTestViewZone(e,t){const i=e.getZoneAtCoord(t.mouseVerticalOffset);if(i){const e=t.isInContentArea?8:5;return t.fulfillViewZone(e,i.position,i)}return null}static _hitTestTextArea(e,t){return fN.isTextArea(t.targetPath)?e.lastRenderData.lastTextareaPosition?t.fulfillContentText(e.lastRenderData.lastTextareaPosition,null,{mightBeForeignElement:!1,injectedText:null}):t.fulfillTextarea():null}static _hitTestMargin(e,t){if(t.isInMarginArea){const i=e.getFullLineRangeAtCoord(t.mouseVerticalOffset),n=i.range.getStartPosition();let o=Math.abs(t.relativePos.x);const s={isAfterLines:i.isAfterLines,glyphMarginLeft:e.layoutInfo.glyphMarginLeft,glyphMarginWidth:e.layoutInfo.glyphMarginWidth,lineNumbersWidth:e.layoutInfo.lineNumbersWidth,offsetX:o};return o-=e.layoutInfo.glyphMarginLeft,o<=e.layoutInfo.glyphMarginWidth?t.fulfillMargin(2,n,i.range,s):(o-=e.layoutInfo.glyphMarginWidth,o<=e.layoutInfo.lineNumbersWidth?t.fulfillMargin(3,n,i.range,s):(o-=e.layoutInfo.lineNumbersWidth,t.fulfillMargin(4,n,i.range,s)))}return null}static _hitTestViewLines(e,t,i){if(!fN.isChildOfViewLines(t.targetPath))return null;if(e.isInTopPadding(t.mouseVerticalOffset))return t.fulfillContentEmpty(new er(1,1),bN);if(e.isAfterLines(t.mouseVerticalOffset)||e.isInBottomPadding(t.mouseVerticalOffset)){const i=e.viewModel.getLineCount(),n=e.viewModel.getLineMaxColumn(i);return t.fulfillContentEmpty(new er(i,n),bN)}if(i){if(fN.isStrictChildOfViewLines(t.targetPath)){const i=e.getLineNumberAtVerticalOffset(t.mouseVerticalOffset);if(0===e.viewModel.getLineLength(i)){const n=e.getLineWidth(i),o=wN(t.mouseContentHorizontalOffset-n);return t.fulfillContentEmpty(new er(i,1),o)}const n=e.getLineWidth(i);if(t.mouseContentHorizontalOffset>=n){const o=wN(t.mouseContentHorizontalOffset-n),s=new er(i,e.viewModel.getLineMaxColumn(i));return t.fulfillContentEmpty(s,o)}}return t.fulfillUnknown()}const n=CN._doHitTest(e,t);return 1===n.type?CN.createMouseTargetFromHitTestPosition(e,t,n.spanNode,n.position,n.injectedText):this._createMouseTarget(e,t.withTarget(n.hitTarget),!0)}static _hitTestMinimap(e,t){if(fN.isChildOfMinimap(t.targetPath)){const i=e.getLineNumberAtVerticalOffset(t.mouseVerticalOffset),n=e.viewModel.getLineMaxColumn(i);return t.fulfillScrollbar(new er(i,n))}return null}static _hitTestScrollbarSlider(e,t){if(fN.isChildOfScrollableElement(t.targetPath)&&t.target&&1===t.target.nodeType){const i=t.target.className;if(i&&/\b(slider|scrollbar)\b/.test(i)){const i=e.getLineNumberAtVerticalOffset(t.mouseVerticalOffset),n=e.viewModel.getLineMaxColumn(i);return t.fulfillScrollbar(new er(i,n))}}return null}static _hitTestScrollbar(e,t){if(fN.isChildOfScrollableElement(t.targetPath)){const i=e.getLineNumberAtVerticalOffset(t.mouseVerticalOffset),n=e.viewModel.getLineMaxColumn(i);return t.fulfillScrollbar(new er(i,n))}return null}getMouseColumn(e){const t=this._context.configuration.options,i=t.get(131),n=this._context.viewLayout.getCurrentScrollLeft()+e.x-i.contentLeft;return CN._getMouseColumn(n,t.get(44).typicalHalfwidthCharacterWidth)}static _getMouseColumn(e,t){if(e<0)return 1;return Math.round(e/t)+1}static createMouseTargetFromHitTestPosition(e,t,i,n,o){const s=n.lineNumber,r=n.column,a=e.getLineWidth(s);if(t.mouseContentHorizontalOffset>a){const e=wN(t.mouseContentHorizontalOffset-a);return t.fulfillContentEmpty(n,e)}const l=e.visibleRangeForPosition(s,r);if(!l)return t.fulfillUnknown(n);const d=l.left;if(t.mouseContentHorizontalOffset===d)return t.fulfillContentText(n,null,{mightBeForeignElement:!!o,injectedText:o});const c=[];if(c.push({offset:l.left,column:r}),r>1){const t=e.visibleRangeForPosition(s,r-1);t&&c.push({offset:t.left,column:r-1})}if(r<e.viewModel.getLineMaxColumn(s)){const t=e.visibleRangeForPosition(s,r+1);t&&c.push({offset:t.left,column:r+1})}c.sort(((e,t)=>e.offset-t.offset));const h=t.pos.toClientCoordinates(),u=i.getBoundingClientRect(),g=u.left<=h.clientX&&h.clientX<=u.right;for(let p=1;p<c.length;p++){const e=c[p-1],i=c[p];if(e.offset<=t.mouseContentHorizontalOffset&&t.mouseContentHorizontalOffset<=i.offset){const r=new qo(s,e.column,s,i.column);return t.fulfillContentText(n,r,{mightBeForeignElement:!g||!!o,injectedText:o})}}return t.fulfillContentText(n,null,{mightBeForeignElement:!g||!!o,injectedText:o})}static _doHitTestWithCaretRangeFromPoint(e,t){const i=e.getLineNumberAtVerticalOffset(t.mouseVerticalOffset),n=e.getVerticalOffsetForLineNumber(i)+Math.floor(e.lineHeight/2);let o=t.pos.y+(n-t.mouseVerticalOffset);o<=t.editorPos.y&&(o=t.editorPos.y+1),o>=t.editorPos.y+t.editorPos.height&&(o=t.editorPos.y+t.editorPos.height-1);const s=new EL(t.pos.x,o),r=this._actualDoHitTestWithCaretRangeFromPoint(e,s.toClientCoordinates());return 1===r.type?r:this._actualDoHitTestWithCaretRangeFromPoint(e,t.pos.toClientCoordinates())}static _actualDoHitTestWithCaretRangeFromPoint(e,t){const i=AC(e.viewDomNode);let n;if(n=i?void 0===i.caretRangeFromPoint?function(e,t,i){const n=document.createRange();let o=e.elementFromPoint(t,i);if(null!==o){for(;o&&o.firstChild&&o.firstChild.nodeType!==o.firstChild.TEXT_NODE&&o.lastChild&&o.lastChild.firstChild;)o=o.lastChild;const e=o.getBoundingClientRect(),i=window.getComputedStyle(o,null).getPropertyValue("font"),s=o.innerText;let r,a=e.left,l=0;if(t>e.left+e.width)l=s.length;else{const e=yN.getInstance();for(let n=0;n<s.length+1;n++){if(r=e.getCharWidth(s.charAt(n),i)/2,a+=r,t<a){l=n;break}a+=r}}n.setStart(o.firstChild,l),n.setEnd(o.firstChild,l)}return n}(i,t.clientX,t.clientY):i.caretRangeFromPoint(t.clientX,t.clientY):document.caretRangeFromPoint(t.clientX,t.clientY),!n||!n.startContainer)return new hN;const o=n.startContainer;if(o.nodeType===o.TEXT_NODE){const t=o.parentNode,i=t?t.parentNode:null,s=i?i.parentNode:null;return(s&&s.nodeType===s.ELEMENT_NODE?s.className:null)===iN.CLASS_NAME?gN.createFromDOMInfo(e,t,n.startOffset):new hN(o.parentNode)}if(o.nodeType===o.ELEMENT_NODE){const t=o.parentNode,i=t?t.parentNode:null;return(i&&i.nodeType===i.ELEMENT_NODE?i.className:null)===iN.CLASS_NAME?gN.createFromDOMInfo(e,o,o.textContent.length):new hN(o)}return new hN}static _doHitTestWithCaretPositionFromPoint(e,t){const i=document.caretPositionFromPoint(t.clientX,t.clientY);if(i.offsetNode.nodeType===i.offsetNode.TEXT_NODE){const t=i.offsetNode.parentNode,n=t?t.parentNode:null,o=n?n.parentNode:null;return(o&&o.nodeType===o.ELEMENT_NODE?o.className:null)===iN.CLASS_NAME?gN.createFromDOMInfo(e,i.offsetNode.parentNode,i.offset):new hN(i.offsetNode.parentNode)}if(i.offsetNode.nodeType===i.offsetNode.ELEMENT_NODE){const t=i.offsetNode.parentNode,n=t&&t.nodeType===t.ELEMENT_NODE?t.className:null,o=t?t.parentNode:null,s=o&&o.nodeType===o.ELEMENT_NODE?o.className:null;if(n===iN.CLASS_NAME){const t=i.offsetNode.childNodes[Math.min(i.offset,i.offsetNode.childNodes.length-1)];if(t)return gN.createFromDOMInfo(e,t,0)}else if(s===iN.CLASS_NAME)return gN.createFromDOMInfo(e,i.offsetNode,0)}return new hN(i.offsetNode)}static _snapToSoftTabBoundary(e,t){const i=t.getLineContent(e.lineNumber),{tabSize:n}=t.model.getOptions(),o=cN.atomicPosition(i,e.column-1,n,2);return-1!==o?new er(e.lineNumber,o+1):e}static _doHitTest(e,t){let i=new hN;if("function"==typeof document.caretRangeFromPoint?i=this._doHitTestWithCaretRangeFromPoint(e,t):document.caretPositionFromPoint&&(i=this._doHitTestWithCaretPositionFromPoint(e,t.pos.toClientCoordinates())),1===i.type){const t=e.viewModel.getInjectedTextAt(i.position),n=e.viewModel.normalizePosition(i.position,2);!t&&n.equals(i.position)||(i=new uN(n,i.spanNode,t))}return 1===i.type&&e.stickyTabStops&&(i=new uN(this._snapToSoftTabBoundary(i.position,e.viewModel),i.spanNode,i.injectedText)),i}}class yN{constructor(){this._cache={},this._canvas=document.createElement("canvas")}static getInstance(){return yN._INSTANCE||(yN._INSTANCE=new yN),yN._INSTANCE}getCharWidth(e,t){const i=e+t;if(this._cache[i])return this._cache[i];const n=this._canvas.getContext("2d");n.font=t;const o=n.measureText(e).width;return this._cache[i]=o,o}}function xN(e){return function(t,i){let n=!1;return e&&(n=e.mouseTargetIsWidget(i)),n||i.preventDefault(),i}}yN._INSTANCE=null;class SN extends HL{constructor(e,t,i){super(),this._context=e,this.viewController=t,this.viewHelper=i,this.mouseTargetFactory=new CN(this._context,i),this._mouseDownOperation=this._register(new kN(this._context,this.viewController,this.viewHelper,((e,t)=>this._createMouseTarget(e,t)),(e=>this._getMouseColumn(e)))),this.lastMouseLeaveTime=-1,this._height=this._context.configuration.options.get(131).height;const n=new PL(this.viewHelper.viewDomNode);this._register(n.onContextMenu(this.viewHelper.viewDomNode,(e=>this._onContextMenu(e,!0)))),this._register(n.onMouseMoveThrottled(this.viewHelper.viewDomNode,(e=>this._onMouseMove(e)),xN(this.mouseTargetFactory),SN.MOUSE_MOVE_MINIMUM_TIME)),this._register(n.onMouseUp(this.viewHelper.viewDomNode,(e=>this._onMouseUp(e)))),this._register(n.onMouseLeave(this.viewHelper.viewDomNode,(e=>this._onMouseLeave(e)))),this._register(n.onMouseDown(this.viewHelper.viewDomNode,(e=>this._onMouseDown(e))));this._register(nC(this.viewHelper.viewDomNode,zC.MOUSE_WHEEL,(e=>{if(this.viewController.emitMouseWheel(e),!this._context.configuration.options.get(68))return;const t=new Zw(e);if(zo?(e.metaKey||e.ctrlKey)&&!e.shiftKey&&!e.altKey:e.ctrlKey&&!e.metaKey&&!e.shiftKey&&!e.altKey){const e=v_.getZoomLevel(),i=t.deltaY>0?1:-1;v_.setZoomLevel(e+i),t.preventDefault(),t.stopPropagation()}}),{capture:!0,passive:!1})),this._context.addEventHandler(this)}dispose(){this._context.removeEventHandler(this),super.dispose()}onConfigurationChanged(e){if(e.hasChanged(131)){const e=this._context.configuration.options.get(131).height;this._height!==e&&(this._height=e,this._mouseDownOperation.onHeightChanged())}return!1}onCursorStateChanged(e){return this._mouseDownOperation.onCursorStateChanged(e),!1}onFocusChanged(e){return!1}onScrollChanged(e){return this._mouseDownOperation.onScrollChanged(),!1}getTargetAtClientPoint(e,t){const i=new IL(e,t).toPageCoordinates(),n=AL(this.viewHelper.viewDomNode);if(i.y<n.y||i.y>n.y+n.height||i.x<n.x||i.x>n.x+n.width)return null;const o=OL(this.viewHelper.viewDomNode,n,i);return this.mouseTargetFactory.createMouseTarget(this.viewHelper.getLastRenderData(),n,i,o,null)}_createMouseTarget(e,t){let i=e.target;if(!this.viewHelper.viewDomNode.contains(i)){const t=AC(this.viewHelper.viewDomNode);t&&(i=t.elementsFromPoint(e.posx,e.posy).find((e=>this.viewHelper.viewDomNode.contains(e))))}return this.mouseTargetFactory.createMouseTarget(this.viewHelper.getLastRenderData(),e.editorPos,e.pos,e.relativePos,t?i:null)}_getMouseColumn(e){return this.mouseTargetFactory.getMouseColumn(e.relativePos)}_onContextMenu(e,t){this.viewController.emitContextMenu({event:e,target:this._createMouseTarget(e,t)})}_onMouseMove(e){if(this._mouseDownOperation.isActive())return;e.timestamp<this.lastMouseLeaveTime||this.viewController.emitMouseMove({event:e,target:this._createMouseTarget(e,!0)})}_onMouseLeave(e){this.lastMouseLeaveTime=(new Date).getTime(),this.viewController.emitMouseLeave({event:e,target:null})}_onMouseUp(e){this.viewController.emitMouseUp({event:e,target:this._createMouseTarget(e,!0)})}_onMouseDown(e){const t=this._createMouseTarget(e,!0),i=6===t.type||7===t.type,n=2===t.type||3===t.type||4===t.type,o=3===t.type,s=this._context.configuration.options.get(98),r=8===t.type||5===t.type,a=9===t.type;let l=e.leftButton||e.middleButton;zo&&e.leftButton&&e.ctrlKey&&(l=!1);const d=()=>{e.preventDefault(),this.viewHelper.focusTextArea()};if(l&&(i||o&&s))d(),this._mouseDownOperation.start(t.type,e);else if(n)e.preventDefault();else if(r){const i=t.detail;this.viewHelper.shouldSuppressMouseDownOnViewZone(i.viewZoneId)&&(d(),this._mouseDownOperation.start(t.type,e),e.preventDefault())}else a&&this.viewHelper.shouldSuppressMouseDownOnWidget(t.detail)&&(d(),e.preventDefault());this.viewController.emitMouseDown({event:e,target:t})}}SN.MOUSE_MOVE_MINIMUM_TIME=100;class kN extends Uo{constructor(e,t,i,n,o){super(),this._context=e,this._viewController=t,this._viewHelper=i,this._createMouseTarget=n,this._getMouseColumn=o,this._mouseMoveMonitor=this._register(new BL(this._viewHelper.viewDomNode)),this._onScrollTimeout=this._register(new rb),this._mouseState=new DN,this._currentSelection=new ar(1,1,1,1),this._isActive=!1,this._lastMouseEvent=null}dispose(){super.dispose()}isActive(){return this._isActive}_onMouseDownThenMove(e){this._lastMouseEvent=e,this._mouseState.setModifiers(e);const t=this._findMousePosition(e,!0);t&&(this._mouseState.isDragAndDrop?this._viewController.emitMouseDrag({event:e,target:t}):this._dispatchMouse(t,!0))}start(e,t){this._lastMouseEvent=t,this._mouseState.setStartedOnLineNumbers(3===e),this._mouseState.setStartButtons(t),this._mouseState.setModifiers(t);const i=this._findMousePosition(t,!0);if(!i||!i.position)return;this._mouseState.trySetCount(t.detail,i.position),t.detail=this._mouseState.count;const n=this._context.configuration.options;if(!n.get(81)&&n.get(31)&&!n.get(18)&&!this._mouseState.altKey&&t.detail<2&&!this._isActive&&!this._currentSelection.isEmpty()&&6===i.type&&i.position&&this._currentSelection.containsPosition(i.position))return this._mouseState.isDragAndDrop=!0,this._isActive=!0,void this._mouseMoveMonitor.startMonitoring(t.target,t.buttons,xN(null),(e=>this._onMouseDownThenMove(e)),(e=>{const t=this._findMousePosition(this._lastMouseEvent,!0);e&&e instanceof KeyboardEvent?this._viewController.emitMouseDropCanceled():this._viewController.emitMouseDrop({event:this._lastMouseEvent,target:t?this._createMouseTarget(this._lastMouseEvent,!0):null}),this._stop()}));this._mouseState.isDragAndDrop=!1,this._dispatchMouse(i,t.shiftKey),this._isActive||(this._isActive=!0,this._mouseMoveMonitor.startMonitoring(t.target,t.buttons,xN(null),(e=>this._onMouseDownThenMove(e)),(()=>this._stop())))}_stop(){this._isActive=!1,this._onScrollTimeout.cancel()}onHeightChanged(){this._mouseMoveMonitor.stopMonitoring()}onScrollChanged(){this._isActive&&this._onScrollTimeout.setIfNotSet((()=>{if(!this._lastMouseEvent)return;const e=this._findMousePosition(this._lastMouseEvent,!1);e&&(this._mouseState.isDragAndDrop||this._dispatchMouse(e,!0))}),10)}onCursorStateChanged(e){this._currentSelection=e.selections[0]}_getPositionOutsideEditor(e){const t=e.editorPos,i=this._context.viewModel,n=this._context.viewLayout,o=this._getMouseColumn(e);if(e.posy<t.y){const i=Math.max(n.getCurrentScrollTop()-(t.y-e.posy),0),s=_N.getZoneAtCoord(this._context,i);if(s){const e=this._helpPositionJumpOverViewZone(s);if(e)return mN.createOutsideEditor(o,e)}const r=n.getLineNumberAtVerticalOffset(i);return mN.createOutsideEditor(o,new er(r,1))}if(e.posy>t.y+t.height){const t=n.getCurrentScrollTop()+e.relativePos.y,s=_N.getZoneAtCoord(this._context,t);if(s){const e=this._helpPositionJumpOverViewZone(s);if(e)return mN.createOutsideEditor(o,e)}const r=n.getLineNumberAtVerticalOffset(t);return mN.createOutsideEditor(o,new er(r,i.getLineMaxColumn(r)))}const s=n.getLineNumberAtVerticalOffset(n.getCurrentScrollTop()+e.relativePos.y);return e.posx<t.x?mN.createOutsideEditor(o,new er(s,1)):e.posx>t.x+t.width?mN.createOutsideEditor(o,new er(s,i.getLineMaxColumn(s))):null}_findMousePosition(e,t){const i=this._getPositionOutsideEditor(e);if(i)return i;const n=this._createMouseTarget(e,t);if(!n.position)return null;if(8===n.type||5===n.type){const e=this._helpPositionJumpOverViewZone(n.detail);if(e)return mN.createViewZone(n.type,n.element,n.mouseColumn,e,n.detail)}return n}_helpPositionJumpOverViewZone(e){const t=new er(this._currentSelection.selectionStartLineNumber,this._currentSelection.selectionStartColumn),i=e.positionBefore,n=e.positionAfter;return i&&n?i.isBefore(t)?i:n:null}_dispatchMouse(e,t){e.position&&this._viewController.dispatchMouse({position:e.position,mouseColumn:e.mouseColumn,startedOnLineNumbers:this._mouseState.startedOnLineNumbers,inSelectionMode:t,mouseDownCount:this._mouseState.count,altKey:this._mouseState.altKey,ctrlKey:this._mouseState.ctrlKey,metaKey:this._mouseState.metaKey,shiftKey:this._mouseState.shiftKey,leftButton:this._mouseState.leftButton,middleButton:this._mouseState.middleButton,onInjectedText:6===e.type&&null!==e.detail.injectedText})}}class DN{constructor(){this._altKey=!1,this._ctrlKey=!1,this._metaKey=!1,this._shiftKey=!1,this._leftButton=!1,this._middleButton=!1,this._startedOnLineNumbers=!1,this._lastMouseDownPosition=null,this._lastMouseDownPositionEqualCount=0,this._lastMouseDownCount=0,this._lastSetMouseDownCountTime=0,this.isDragAndDrop=!1}get altKey(){return this._altKey}get ctrlKey(){return this._ctrlKey}get metaKey(){return this._metaKey}get shiftKey(){return this._shiftKey}get leftButton(){return this._leftButton}get middleButton(){return this._middleButton}get startedOnLineNumbers(){return this._startedOnLineNumbers}get count(){return this._lastMouseDownCount}setModifiers(e){this._altKey=e.altKey,this._ctrlKey=e.ctrlKey,this._metaKey=e.metaKey,this._shiftKey=e.shiftKey}setStartButtons(e){this._leftButton=e.leftButton,this._middleButton=e.middleButton}setStartedOnLineNumbers(e){this._startedOnLineNumbers=e}trySetCount(e,t){const i=(new Date).getTime();i-this._lastSetMouseDownCountTime>DN.CLEAR_MOUSE_DOWN_COUNT_TIME&&(e=1),this._lastSetMouseDownCountTime=i,e>this._lastMouseDownCount+1&&(e=this._lastMouseDownCount+1),this._lastMouseDownPosition&&this._lastMouseDownPosition.equals(t)?this._lastMouseDownPositionEqualCount++:this._lastMouseDownPositionEqualCount=1,this._lastMouseDownPosition=t,this._lastMouseDownCount=Math.min(e,this._lastMouseDownPositionEqualCount)}}var LN,NN;DN.CLEAR_MOUSE_DOWN_COUNT_TIME=400,function(e){e.text="text/plain",e.binary="application/octet-stream",e.unknown="application/unknown",e.markdown="text/markdown",e.latex="text/latex",e.uriList="text/uri-list"}(LN||(LN={}));class EN{constructor(e,t,i,n,o){this.value=e,this.selectionStart=t,this.selectionEnd=i,this.selectionStartPosition=n,this.selectionEndPosition=o}toString(){return`[ <${this.value}>, selectionStart: ${this.selectionStart}, selectionEnd: ${this.selectionEnd}]`}static readFromTextArea(e){return new EN(e.getValue(),e.getSelectionStart(),e.getSelectionEnd(),null,null)}collapseSelection(){return new EN(this.value,this.value.length,this.value.length,null,null)}writeToTextArea(e,t,i){t.setValue(e,this.value),i&&t.setSelectionRange(e,this.selectionStart,this.selectionEnd)}deduceEditorPosition(e){if(e<=this.selectionStart){const t=this.value.substring(e,this.selectionStart);return this._finishDeduceEditorPosition(this.selectionStartPosition,t,-1)}if(e>=this.selectionEnd){const t=this.value.substring(this.selectionEnd,e);return this._finishDeduceEditorPosition(this.selectionEndPosition,t,1)}const t=this.value.substring(this.selectionStart,e);if(-1===t.indexOf(String.fromCharCode(8230)))return this._finishDeduceEditorPosition(this.selectionStartPosition,t,1);const i=this.value.substring(e,this.selectionEnd);return this._finishDeduceEditorPosition(this.selectionEndPosition,i,-1)}_finishDeduceEditorPosition(e,t,i){let n=0,o=-1;for(;-1!==(o=t.indexOf("\n",o+1));)n++;return[e,i*t.length,n]}static deduceInput(e,t,i){if(!e)return{text:"",replacePrevCharCnt:0,replaceNextCharCnt:0,positionDelta:0};const n=Math.min(lr(e.value,t.value),e.selectionStart,t.selectionStart),o=Math.min(dr(e.value,t.value),e.value.length-e.selectionEnd,t.value.length-t.selectionEnd);e.value.substring(n,e.value.length-o);const s=t.value.substring(n,t.value.length-o),r=e.selectionStart-n,a=e.selectionEnd-n;if(t.selectionStart-n===t.selectionEnd-n){return{text:s,replacePrevCharCnt:e.selectionStart-n,replaceNextCharCnt:0,positionDelta:0}}return{text:s,replacePrevCharCnt:a-r,replaceNextCharCnt:0,positionDelta:0}}static deduceAndroidCompositionInput(e,t){if(!e)return{text:"",replacePrevCharCnt:0,replaceNextCharCnt:0,positionDelta:0};if(e.value===t.value)return{text:"",replacePrevCharCnt:0,replaceNextCharCnt:0,positionDelta:t.selectionEnd-e.selectionEnd};const i=Math.min(lr(e.value,t.value),e.selectionEnd),n=Math.min(dr(e.value,t.value),e.value.length-e.selectionEnd),o=e.value.substring(i,e.value.length-n),s=t.value.substring(i,t.value.length-n);e.selectionStart;const r=e.selectionEnd-i;t.selectionStart;const a=t.selectionEnd-i;return{text:s,replacePrevCharCnt:r,replaceNextCharCnt:o.length-r,positionDelta:a-s.length}}}EN.EMPTY=new EN("",0,0,null,null);class IN{static _getPageOfLine(e,t){return Math.floor((e-1)/t)}static _getRangeForPage(e,t){const i=e*t;return new qo(i+1,1,i+t+1,1)}static fromEditorSelection(e,t,i,n,o){const s=IN._getPageOfLine(i.startLineNumber,n),r=IN._getRangeForPage(s,n),a=IN._getPageOfLine(i.endLineNumber,n),l=IN._getRangeForPage(a,n),d=r.intersectRanges(new qo(1,1,i.startLineNumber,i.startColumn));let c=t.getValueInRange(d,1);const h=t.getLineCount(),u=t.getLineMaxColumn(h),g=l.intersectRanges(new qo(i.endLineNumber,i.endColumn,h,u));let p,m=t.getValueInRange(g,1);if(s===a||s+1===a)p=t.getValueInRange(i,1);else{const e=r.intersectRanges(i),n=l.intersectRanges(i);p=t.getValueInRange(e,1)+String.fromCharCode(8230)+t.getValueInRange(n,1)}if(o){const e=500;c.length>e&&(c=c.substring(c.length-e,c.length)),m.length>e&&(m=m.substring(0,e)),p.length>2*e&&(p=p.substring(0,e)+String.fromCharCode(8230)+p.substring(p.length-e,p.length))}return new EN(c+p+m,c.length,c.length+p.length,new er(i.startLineNumber,i.startColumn),new er(i.endLineNumber,i.endColumn))}}!function(e){e.Tap="-monaco-textarea-synthetic-tap"}(NN||(NN={}));const TN={forceCopyWithSyntaxHighlighting:!1};class MN{constructor(){this._lastState=null}set(e,t){this._lastState={lastCopiedValue:e,data:t}}get(e){return this._lastState&&this._lastState.lastCopiedValue===e?this._lastState.data:(this._lastState=null,null)}}MN.INSTANCE=new MN;class AN{constructor(){this._lastTypeTextLength=0}handleCompositionUpdate(e){const t={text:e=e||"",replacePrevCharCnt:this._lastTypeTextLength,replaceNextCharCnt:0,positionDelta:0};return this._lastTypeTextLength=e.length,t}}class ON extends Uo{constructor(e,t,i,n){super(),this._host=e,this._textArea=t,this._OS=i,this._browser=n,this._onFocus=this._register(new $o),this.onFocus=this._onFocus.event,this._onBlur=this._register(new $o),this.onBlur=this._onBlur.event,this._onKeyDown=this._register(new $o),this.onKeyDown=this._onKeyDown.event,this._onKeyUp=this._register(new $o),this.onKeyUp=this._onKeyUp.event,this._onCut=this._register(new $o),this.onCut=this._onCut.event,this._onPaste=this._register(new $o),this.onPaste=this._onPaste.event,this._onType=this._register(new $o),this.onType=this._onType.event,this._onCompositionStart=this._register(new $o),this.onCompositionStart=this._onCompositionStart.event,this._onCompositionUpdate=this._register(new $o),this.onCompositionUpdate=this._onCompositionUpdate.event,this._onCompositionEnd=this._register(new $o),this.onCompositionEnd=this._onCompositionEnd.event,this._onSelectionChangeRequest=this._register(new $o),this.onSelectionChangeRequest=this._onSelectionChangeRequest.event,this._asyncTriggerCut=this._register(new lb((()=>this._onCut.fire()),0)),this._asyncFocusGainWriteScreenReaderContent=this._register(new lb((()=>this.writeScreenReaderContent("asyncFocusGain")),0)),this._textAreaState=EN.EMPTY,this._selectionChangeListener=null,this.writeScreenReaderContent("ctor"),this._hasFocus=!1,this._currentComposition=null;let o=null;this._register(this._textArea.onKeyDown((e=>{const t=new jw(e);(109===t.keyCode||this._currentComposition&&1===t.keyCode)&&t.stopPropagation(),t.equals(9)&&t.preventDefault(),o=t,this._onKeyDown.fire(t)}))),this._register(this._textArea.onKeyUp((e=>{const t=new jw(e);this._onKeyUp.fire(t)}))),this._register(this._textArea.onCompositionStart((e=>{const t=new AN;if(this._currentComposition)this._currentComposition=t;else{if(this._currentComposition=t,2===this._OS&&o&&o.equals(109)&&this._textAreaState.selectionStart===this._textAreaState.selectionEnd&&this._textAreaState.selectionStart>0&&this._textAreaState.value.substr(this._textAreaState.selectionStart-1,1)===e.data&&("ArrowRight"===o.code||"ArrowLeft"===o.code))return t.handleCompositionUpdate("x"),void this._onCompositionStart.fire({data:e.data});this._browser.isAndroid,this._onCompositionStart.fire({data:e.data})}}))),this._register(this._textArea.onCompositionUpdate((e=>{const t=this._currentComposition;if(!t)return;if(this._browser.isAndroid){const t=EN.readFromTextArea(this._textArea),i=EN.deduceAndroidCompositionInput(this._textAreaState,t);return this._textAreaState=t,this._onType.fire(i),void this._onCompositionUpdate.fire(e)}const i=t.handleCompositionUpdate(e.data);this._textAreaState=EN.readFromTextArea(this._textArea),this._onType.fire(i),this._onCompositionUpdate.fire(e)}))),this._register(this._textArea.onCompositionEnd((e=>{const t=this._currentComposition;if(!t)return;if(this._currentComposition=null,this._browser.isAndroid){const e=EN.readFromTextArea(this._textArea),t=EN.deduceAndroidCompositionInput(this._textAreaState,e);return this._textAreaState=e,this._onType.fire(t),void this._onCompositionEnd.fire()}const i=t.handleCompositionUpdate(e.data);this._textAreaState=EN.readFromTextArea(this._textArea),this._onType.fire(i),this._onCompositionEnd.fire()}))),this._register(this._textArea.onInput((e=>{if(this._textArea.setIgnoreSelectionChangeTime("received input event"),this._currentComposition)return;const t=EN.readFromTextArea(this._textArea),i=EN.deduceInput(this._textAreaState,t,2===this._OS);0===i.replacePrevCharCnt&&1===i.text.length&&Go(i.text.charCodeAt(0))||(this._textAreaState=t,""===i.text&&0===i.replacePrevCharCnt&&0===i.replaceNextCharCnt&&0===i.positionDelta||this._onType.fire(i))}))),this._register(this._textArea.onCut((e=>{this._textArea.setIgnoreSelectionChangeTime("received cut event"),this._ensureClipboardGetsEditorSelection(e),this._asyncTriggerCut.schedule()}))),this._register(this._textArea.onCopy((e=>{this._ensureClipboardGetsEditorSelection(e)}))),this._register(this._textArea.onPaste((e=>{if(this._textArea.setIgnoreSelectionChangeTime("received paste event"),e.preventDefault(),!e.clipboardData)return;let[t,i]=RN.getTextData(e.clipboardData);t&&(i=i||MN.INSTANCE.get(t),this._onPaste.fire({text:t,metadata:i}))}))),this._register(this._textArea.onFocus((()=>{const e=this._hasFocus;this._setHasFocus(!0),this._browser.isSafari&&!e&&this._hasFocus&&this._asyncFocusGainWriteScreenReaderContent.schedule()}))),this._register(this._textArea.onBlur((()=>{this._currentComposition&&(this._currentComposition=null,this.writeScreenReaderContent("blurWithoutCompositionEnd"),this._onCompositionEnd.fire()),this._setHasFocus(!1)}))),this._register(this._textArea.onSyntheticTap((()=>{this._browser.isAndroid&&this._currentComposition&&(this._currentComposition=null,this.writeScreenReaderContent("tapWithoutCompositionEnd"),this._onCompositionEnd.fire())})))}_installSelectionChangeListener(){let e=0;return nC(document,"selectionchange",(t=>{if(!this._hasFocus)return;if(this._currentComposition)return;if(!this._browser.isChrome)return;const i=Date.now(),n=i-e;if(e=i,n<5)return;const o=i-this._textArea.getIgnoreSelectionChangeTime();if(this._textArea.resetSelectionChangeTime(),o<100)return;if(!this._textAreaState.selectionStartPosition||!this._textAreaState.selectionEndPosition)return;const s=this._textArea.getValue();if(this._textAreaState.value!==s)return;const r=this._textArea.getSelectionStart(),a=this._textArea.getSelectionEnd();if(this._textAreaState.selectionStart===r&&this._textAreaState.selectionEnd===a)return;const l=this._textAreaState.deduceEditorPosition(r),d=this._host.deduceModelPosition(l[0],l[1],l[2]),c=this._textAreaState.deduceEditorPosition(a),h=this._host.deduceModelPosition(c[0],c[1],c[2]),u=new ar(d.lineNumber,d.column,h.lineNumber,h.column);this._onSelectionChangeRequest.fire(u)}))}dispose(){super.dispose(),this._selectionChangeListener&&(this._selectionChangeListener.dispose(),this._selectionChangeListener=null)}focusTextArea(){this._setHasFocus(!0),this.refreshFocusState()}isFocused(){return this._hasFocus}refreshFocusState(){this._setHasFocus(this._textArea.hasFocus())}_setHasFocus(e){this._hasFocus!==e&&(this._hasFocus=e,this._selectionChangeListener&&(this._selectionChangeListener.dispose(),this._selectionChangeListener=null),this._hasFocus&&(this._selectionChangeListener=this._installSelectionChangeListener()),this._hasFocus&&this.writeScreenReaderContent("focusgain"),this._hasFocus?this._onFocus.fire():this._onBlur.fire())}_setAndWriteTextAreaState(e,t){this._hasFocus||(t=t.collapseSelection()),t.writeToTextArea(e,this._textArea,this._hasFocus),this._textAreaState=t}writeScreenReaderContent(e){this._currentComposition||this._setAndWriteTextAreaState(e,this._host.getScreenReaderContent(this._textAreaState))}_ensureClipboardGetsEditorSelection(e){const t=this._host.getDataToCopy(),i={version:1,isFromEmptySelection:t.isFromEmptySelection,multicursorText:t.multicursorText,mode:t.mode};MN.INSTANCE.set(this._browser.isFirefox?t.text.replace(/\r\n/g,"\n"):t.text,i),e.preventDefault(),e.clipboardData&&RN.setTextData(e.clipboardData,t.text,t.html,i)}}class RN{static getTextData(e){const t=e.getData(LN.text);let i=null;const n=e.getData("vscode-editor-data");if("string"==typeof n)try{i=JSON.parse(n),1!==i.version&&(i=null)}catch(o){}return[t,i]}static setTextData(e,t,i,n){e.setData(LN.text,t),"string"==typeof i&&e.setData("text/html",i),e.setData("vscode-editor-data",JSON.stringify(n))}}class PN extends Uo{constructor(e){super(),this._actual=e,this.onKeyDown=this._register(dC(this._actual,"keydown")).event,this.onKeyUp=this._register(dC(this._actual,"keyup")).event,this.onCompositionStart=this._register(dC(this._actual,"compositionstart")).event,this.onCompositionUpdate=this._register(dC(this._actual,"compositionupdate")).event,this.onCompositionEnd=this._register(dC(this._actual,"compositionend")).event,this.onInput=this._register(dC(this._actual,"input")).event,this.onCut=this._register(dC(this._actual,"cut")).event,this.onCopy=this._register(dC(this._actual,"copy")).event,this.onPaste=this._register(dC(this._actual,"paste")).event,this.onFocus=this._register(dC(this._actual,"focus")).event,this.onBlur=this._register(dC(this._actual,"blur")).event,this._onSyntheticTap=this._register(new $o),this.onSyntheticTap=this._onSyntheticTap.event,this._ignoreSelectionChangeTime=0,this._register(nC(this._actual,NN.Tap,(()=>this._onSyntheticTap.fire())))}hasFocus(){const e=AC(this._actual);return e?e.activeElement===this._actual:!!tC(this._actual)&&document.activeElement===this._actual}setIgnoreSelectionChangeTime(e){this._ignoreSelectionChangeTime=Date.now()}getIgnoreSelectionChangeTime(){return this._ignoreSelectionChangeTime}resetSelectionChangeTime(){this._ignoreSelectionChangeTime=0}getValue(){return this._actual.value}setValue(e,t){const i=this._actual;i.value!==t&&(this.setIgnoreSelectionChangeTime("setValue"),i.value=t)}getSelectionStart(){return"backward"===this._actual.selectionDirection?this._actual.selectionEnd:this._actual.selectionStart}getSelectionEnd(){return"backward"===this._actual.selectionDirection?this._actual.selectionStart:this._actual.selectionEnd}setSelectionRange(e,t,i){const n=this._actual;let o=null;const s=AC(n);o=s?s.activeElement:document.activeElement;const r=o===n,a=n.selectionStart,l=n.selectionEnd;if(r&&a===t&&l===i)o_&&window.parent!==window&&n.focus();else{if(r)return this.setIgnoreSelectionChangeTime("setSelectionRange"),n.setSelectionRange(t,i),void(o_&&window.parent!==window&&n.focus());try{const e=function(e){let t=[];for(let i=0;e&&e.nodeType===e.ELEMENT_NODE;i++)t[i]=e.scrollTop,e=e.parentNode;return t}(n);this.setIgnoreSelectionChangeTime("setSelectionRange"),n.focus(),n.setSelectionRange(t,i),function(e,t){for(let i=0;e&&e.nodeType===e.ELEMENT_NODE;i++)e.scrollTop!==t[i]&&(e.scrollTop=t[i]),e=e.parentNode}(n,e)}catch(d){}}}}class FN extends SN{constructor(e,t,i){super(e,t,i),this._register(oS.addTarget(this.viewHelper.linesContentDomNode)),this._register(nC(this.viewHelper.linesContentDomNode,iS.Tap,(e=>this.onTap(e)))),this._register(nC(this.viewHelper.linesContentDomNode,iS.Change,(e=>this.onChange(e)))),this._register(nC(this.viewHelper.linesContentDomNode,iS.Contextmenu,(e=>this._onContextMenu(new RL(e,this.viewHelper.viewDomNode),!1)))),this._lastPointerType="mouse",this._register(nC(this.viewHelper.linesContentDomNode,"pointerdown",(e=>{const t=e.pointerType;this._lastPointerType="mouse"!==t?"touch"===t?"touch":"pen":"mouse"})));const n=new FL(this.viewHelper.viewDomNode);this._register(n.onPointerMoveThrottled(this.viewHelper.viewDomNode,(e=>this._onMouseMove(e)),xN(this.mouseTargetFactory),SN.MOUSE_MOVE_MINIMUM_TIME)),this._register(n.onPointerUp(this.viewHelper.viewDomNode,(e=>this._onMouseUp(e)))),this._register(n.onPointerLeave(this.viewHelper.viewDomNode,(e=>this._onMouseLeave(e)))),this._register(n.onPointerDown(this.viewHelper.viewDomNode,(e=>this._onMouseDown(e))))}onTap(e){if(!e.initialTarget||!this.viewHelper.linesContentDomNode.contains(e.initialTarget))return;e.preventDefault(),this.viewHelper.focusTextArea();const t=this._createMouseTarget(new RL(e,this.viewHelper.viewDomNode),!1);t.position&&this.viewController.dispatchMouse({position:t.position,mouseColumn:t.position.column,startedOnLineNumbers:!1,mouseDownCount:e.tapCount,inSelectionMode:!1,altKey:!1,ctrlKey:!1,metaKey:!1,shiftKey:!1,leftButton:!1,middleButton:!1,onInjectedText:6===t.type&&null!==t.detail.injectedText})}onChange(e){"touch"===this._lastPointerType&&this._context.viewModel.viewLayout.deltaScrollNow(-e.translationX,-e.translationY)}_onMouseDown(e){"touch"!==e.browserEvent.pointerType&&super._onMouseDown(e)}}class BN extends SN{constructor(e,t,i){super(e,t,i),this._register(oS.addTarget(this.viewHelper.linesContentDomNode)),this._register(nC(this.viewHelper.linesContentDomNode,iS.Tap,(e=>this.onTap(e)))),this._register(nC(this.viewHelper.linesContentDomNode,iS.Change,(e=>this.onChange(e)))),this._register(nC(this.viewHelper.linesContentDomNode,iS.Contextmenu,(e=>this._onContextMenu(new RL(e,this.viewHelper.viewDomNode),!1))))}onTap(e){e.preventDefault(),this.viewHelper.focusTextArea();const t=this._createMouseTarget(new RL(e,this.viewHelper.viewDomNode),!1);if(t.position){const e=document.createEvent("CustomEvent");e.initEvent(NN.Tap,!1,!0),this.viewHelper.dispatchTextAreaEvent(e),this.viewController.moveTo(t.position)}}onChange(e){this._context.viewModel.viewLayout.deltaScrollNow(-e.translationX,-e.translationY)}}class VN extends Uo{constructor(e,t,i){super(),Vs&&Rw?this.handler=this._register(new FN(e,t,i)):window.TouchEvent?this.handler=this._register(new BN(e,t,i)):this.handler=this._register(new SN(e,t,i))}getTargetAtClientPoint(e,t){return this.handler.getTargetAtClientPoint(e,t)}}class WN extends HL{}const zN=_S("editor.lineHighlightBackground",{dark:null,light:null,hc:null},mf(0,"Background color for the highlight of line at the cursor position.")),HN=_S("editor.lineHighlightBorder",{dark:"#282828",light:"#eeeeee",hc:"#f38518"},mf(0,"Background color for the border around the line at the cursor position.")),jN=_S("editor.rangeHighlightBackground",{dark:"#ffffff0b",light:"#fdff0033",hc:null},mf(0,"Background color of highlighted ranges, like by quick open and find features. The color must not be opaque so as not to hide underlying decorations."),!0),UN=_S("editor.rangeHighlightBorder",{dark:null,light:null,hc:xS},mf(0,"Background color of the border around highlighted ranges."),!0),$N=_S("editor.symbolHighlightBackground",{dark:Rk,light:Rk,hc:null},mf(0,"Background color of highlighted symbol, like for go to definition or go next/previous symbol. The color must not be opaque so as not to hide underlying decorations."),!0),KN=_S("editor.symbolHighlightBorder",{dark:null,light:null,hc:xS},mf(0,"Background color of the border around highlighted symbols."),!0),qN=_S("editorCursor.foreground",{dark:"#AEAFAD",light:hS.black,hc:hS.white},mf(0,"Color of the editor cursor.")),GN=_S("editorCursor.background",null,mf(0,"The background color of the editor cursor. Allows customizing the color of a character overlapped by a block cursor.")),ZN=_S("editorWhitespace.foreground",{dark:"#e3e4e229",light:"#33333333",hc:"#e3e4e229"},mf(0,"Color of whitespace characters in the editor.")),YN=_S("editorIndentGuide.background",{dark:ZN,light:ZN,hc:ZN},mf(0,"Color of the editor indentation guides.")),XN=_S("editorIndentGuide.activeBackground",{dark:ZN,light:ZN,hc:ZN},mf(0,"Color of the active editor indentation guides.")),QN=_S("editorLineNumber.foreground",{dark:"#858585",light:"#237893",hc:hS.white},mf(0,"Color of editor line numbers.")),JN=_S("editorActiveLineNumber.foreground",{dark:"#c6c6c6",light:"#0B216F",hc:xS},mf(0,"Color of editor active line number"),!1,mf(0,"Id is deprecated. Use 'editorLineNumber.activeForeground' instead.")),eE=_S("editorLineNumber.activeForeground",{dark:JN,light:JN,hc:JN},mf(0,"Color of editor active line number")),tE=_S("editorRuler.foreground",{dark:"#5A5A5A",light:hS.lightgrey,hc:hS.white},mf(0,"Color of the editor rulers."));_S("editorCodeLens.foreground",{dark:"#999999",light:"#919191",hc:"#999999"},mf(0,"Foreground color of editor CodeLens"));const iE=_S("editorBracketMatch.background",{dark:"#0064001a",light:"#0064001a",hc:"#0064001a"},mf(0,"Background color behind matching brackets")),nE=_S("editorBracketMatch.border",{dark:"#888",light:"#B9B9B9",hc:yS},mf(0,"Color for matching brackets boxes")),oE=_S("editorOverviewRuler.border",{dark:"#7f7f7f4d",light:"#7f7f7f4d",hc:"#7f7f7f4d"},mf(0,"Color of the overview ruler border.")),sE=_S("editorOverviewRuler.background",null,mf(0,"Background color of the editor overview ruler. Only used when the minimap is enabled and placed on the right side of the editor.")),rE=_S("editorGutter.background",{dark:pk,light:pk,hc:pk},mf(0,"Background color of the editor gutter. The gutter contains the glyph margins and the line numbers.")),aE=_S("editorUnnecessaryCode.border",{dark:null,light:null,hc:hS.fromHex("#fff").transparent(.8)},mf(0,"Border color of unnecessary (unused) source code in the editor.")),lE=_S("editorUnnecessaryCode.opacity",{dark:hS.fromHex("#000a"),light:hS.fromHex("#0007"),hc:null},mf(0,"Opacity of unnecessary (unused) source code in the editor. For example, \"#000000c0\" will render the code with 75% opacity. For high contrast themes, use the 'editorUnnecessaryCode.border' theme color to underline unnecessary code instead of fading it out.")),dE=_S("editorGhostText.border",{dark:null,light:null,hc:hS.fromHex("#fff").transparent(.8)},mf(0,"Border color of ghost text in the editor.")),cE=_S("editorGhostText.foreground",{dark:hS.fromHex("#ffffff56"),light:hS.fromHex("#0007"),hc:null},mf(0,"Foreground color of the ghost text in the editor.")),hE=_S("editorGhostText.background",{dark:null,light:null,hc:null},mf(0,"Background color of the ghost text in the editor.")),uE=new hS(new lS(0,122,204,.6)),gE=_S("editorOverviewRuler.rangeHighlightForeground",{dark:uE,light:uE,hc:uE},mf(0,"Overview ruler marker color for range highlights. The color must not be opaque so as not to hide underlying decorations."),!0),pE=_S("editorOverviewRuler.errorForeground",{dark:new hS(new lS(255,18,18,.7)),light:new hS(new lS(255,18,18,.7)),hc:new hS(new lS(255,50,50,1))},mf(0,"Overview ruler marker color for errors.")),mE=_S("editorOverviewRuler.warningForeground",{dark:ak,light:ak,hc:lk},mf(0,"Overview ruler marker color for warnings.")),fE=_S("editorOverviewRuler.infoForeground",{dark:ck,light:ck,hc:hk},mf(0,"Overview ruler marker color for infos.")),_E=_S("editorBracketHighlight.foreground1",{dark:"#FFD700",light:"#0431FAFF",hc:"#FFD700"},mf(0,"Foreground color of brackets (1). Requires enabling bracket pair colorization.")),vE=_S("editorBracketHighlight.foreground2",{dark:"#DA70D6",light:"#319331FF",hc:"#DA70D6"},mf(0,"Foreground color of brackets (2). Requires enabling bracket pair colorization.")),bE=_S("editorBracketHighlight.foreground3",{dark:"#179FFF",light:"#7B3814FF",hc:"#87CEFA"},mf(0,"Foreground color of brackets (3). Requires enabling bracket pair colorization.")),wE=_S("editorBracketHighlight.foreground4",{dark:"#00000000",light:"#00000000",hc:"#00000000"},mf(0,"Foreground color of brackets (4). Requires enabling bracket pair colorization.")),CE=_S("editorBracketHighlight.foreground5",{dark:"#00000000",light:"#00000000",hc:"#00000000"},mf(0,"Foreground color of brackets (5). Requires enabling bracket pair colorization.")),yE=_S("editorBracketHighlight.foreground6",{dark:"#00000000",light:"#00000000",hc:"#00000000"},mf(0,"Foreground color of brackets (6). Requires enabling bracket pair colorization.")),xE=_S("editorBracketHighlight.unexpectedBracket.foreground",{dark:new hS(new lS(255,18,18,.8)),light:new hS(new lS(255,18,18,.8)),hc:new hS(new lS(255,50,50,1))},mf(0,"Foreground color of unexpected brackets.")),SE=_S("editorBracketPairGuide.background1",{dark:"#00000000",light:"#00000000",hc:"#00000000"},mf(0,"Background color of inactive bracket pair guides (1). Requires enabling bracket pair guides.")),kE=_S("editorBracketPairGuide.background2",{dark:"#00000000",light:"#00000000",hc:"#00000000"},mf(0,"Background color of inactive bracket pair guides (2). Requires enabling bracket pair guides.")),DE=_S("editorBracketPairGuide.background3",{dark:"#00000000",light:"#00000000",hc:"#00000000"},mf(0,"Background color of inactive bracket pair guides (3). Requires enabling bracket pair guides.")),LE=_S("editorBracketPairGuide.background4",{dark:"#00000000",light:"#00000000",hc:"#00000000"},mf(0,"Background color of inactive bracket pair guides (4). Requires enabling bracket pair guides.")),NE=_S("editorBracketPairGuide.background5",{dark:"#00000000",light:"#00000000",hc:"#00000000"},mf(0,"Background color of inactive bracket pair guides (5). Requires enabling bracket pair guides.")),EE=_S("editorBracketPairGuide.background6",{dark:"#00000000",light:"#00000000",hc:"#00000000"},mf(0,"Background color of inactive bracket pair guides (6). Requires enabling bracket pair guides.")),IE=_S("editorBracketPairGuide.activeBackground1",{dark:"#00000000",light:"#00000000",hc:"#00000000"},mf(0,"Background color of active bracket pair guides (1). Requires enabling bracket pair guides.")),TE=_S("editorBracketPairGuide.activeBackground2",{dark:"#00000000",light:"#00000000",hc:"#00000000"},mf(0,"Background color of active bracket pair guides (2). Requires enabling bracket pair guides.")),ME=_S("editorBracketPairGuide.activeBackground3",{dark:"#00000000",light:"#00000000",hc:"#00000000"},mf(0,"Background color of active bracket pair guides (3). Requires enabling bracket pair guides.")),AE=_S("editorBracketPairGuide.activeBackground4",{dark:"#00000000",light:"#00000000",hc:"#00000000"},mf(0,"Background color of active bracket pair guides (4). Requires enabling bracket pair guides.")),OE=_S("editorBracketPairGuide.activeBackground5",{dark:"#00000000",light:"#00000000",hc:"#00000000"},mf(0,"Background color of active bracket pair guides (5). Requires enabling bracket pair guides.")),RE=_S("editorBracketPairGuide.activeBackground6",{dark:"#00000000",light:"#00000000",hc:"#00000000"},mf(0,"Background color of active bracket pair guides (6). Requires enabling bracket pair guides."));_S("editorUnicodeHighlight.border",{dark:"#BD9B03",light:"#CEA33D",hc:"#ff0000"},mf(0,"Border color used to highlight unicode characters.")),sx(((e,t)=>{const i=e.getColor(pk);i&&t.addRule(`.monaco-editor, .monaco-editor-background, .monaco-editor .inputarea.ime-input { background-color: ${i}; }`);const n=e.getColor(mk);n&&t.addRule(`.monaco-editor, .monaco-editor .inputarea.ime-input { color: ${n}; }`);const o=e.getColor(rE);o&&t.addRule(`.monaco-editor .margin { background-color: ${o}; }`);const s=e.getColor(jN);s&&t.addRule(`.monaco-editor .rangeHighlight { background-color: ${s}; }`);const r=e.getColor(UN);r&&t.addRule(`.monaco-editor .rangeHighlight { border: 1px ${"hc"===e.type?"dotted":"solid"} ${r}; }`);const a=e.getColor($N);a&&t.addRule(`.monaco-editor .symbolHighlight { background-color: ${a}; }`);const l=e.getColor(KN);l&&t.addRule(`.monaco-editor .symbolHighlight { border: 1px ${"hc"===e.type?"dotted":"solid"} ${l}; }`);const d=e.getColor(ZN);d&&(t.addRule(`.monaco-editor .mtkw { color: ${d} !important; }`),t.addRule(`.monaco-editor .mtkz { color: ${d} !important; }`))}));class PE extends WN{constructor(e){super(),this._context=e,this._readConfig(),this._lastCursorModelPosition=new er(1,1),this._renderResult=null,this._activeLineNumber=1,this._context.addEventHandler(this)}_readConfig(){const e=this._context.configuration.options;this._lineHeight=e.get(59);const t=e.get(60);this._renderLineNumbers=t.renderType,this._renderCustomLineNumbers=t.renderFn,this._renderFinalNewline=e.get(84);const i=e.get(131);this._lineNumbersLeft=i.lineNumbersLeft,this._lineNumbersWidth=i.lineNumbersWidth}dispose(){this._context.removeEventHandler(this),this._renderResult=null,super.dispose()}onConfigurationChanged(e){return this._readConfig(),!0}onCursorStateChanged(e){const t=e.selections[0].getPosition();this._lastCursorModelPosition=this._context.viewModel.coordinatesConverter.convertViewPositionToModelPosition(t);let i=!1;return this._activeLineNumber!==t.lineNumber&&(this._activeLineNumber=t.lineNumber,i=!0),2!==this._renderLineNumbers&&3!==this._renderLineNumbers||(i=!0),i}onFlushed(e){return!0}onLinesChanged(e){return!0}onLinesDeleted(e){return!0}onLinesInserted(e){return!0}onScrollChanged(e){return e.scrollTopChanged}onZonesChanged(e){return!0}_getLineRenderLineNumber(e){const t=this._context.viewModel.coordinatesConverter.convertViewPositionToModelPosition(new er(e,1));if(1!==t.column)return"";const i=t.lineNumber;if(this._renderCustomLineNumbers)return this._renderCustomLineNumbers(i);if(2===this._renderLineNumbers){const e=Math.abs(this._lastCursorModelPosition.lineNumber-i);return 0===e?'<span class="relative-current-line-number">'+i+"</span>":String(e)}return 3===this._renderLineNumbers?this._lastCursorModelPosition.lineNumber===i||i%10==0?String(i):"":String(i)}prepareRender(e){if(0===this._renderLineNumbers)return void(this._renderResult=null);const t=Vo?this._lineHeight%2==0?" lh-even":" lh-odd":"",i=e.visibleRange.startLineNumber,n=e.visibleRange.endLineNumber,o='<div class="'+PE.CLASS_NAME+t+'" style="left:'+this._lineNumbersLeft+"px;width:"+this._lineNumbersWidth+'px;">',s=this._context.viewModel.getLineCount(),r=[];for(let a=i;a<=n;a++){const e=a-i;if(!this._renderFinalNewline&&a===s&&0===this._context.viewModel.getLineLength(a)){r[e]="";continue}const n=this._getLineRenderLineNumber(a);n?a===this._activeLineNumber?r[e]='<div class="active-line-number '+PE.CLASS_NAME+t+'" style="left:'+this._lineNumbersLeft+"px;width:"+this._lineNumbersWidth+'px;">'+n+"</div>":r[e]=o+n+"</div>":r[e]=""}this._renderResult=r}render(e,t){if(!this._renderResult)return"";const i=t-e;return i<0||i>=this._renderResult.length?"":this._renderResult[i]}}PE.CLASS_NAME="line-numbers",sx(((e,t)=>{const i=e.getColor(QN);i&&t.addRule(`.monaco-editor .line-numbers { color: ${i}; }`);const n=e.getColor(eE);n&&t.addRule(`.monaco-editor .line-numbers.active-line-number { color: ${n}; }`)}));class FE extends jL{constructor(e){super(e);const t=this._context.configuration.options,i=t.get(131);this._canUseLayerHinting=!t.get(28),this._contentLeft=i.contentLeft,this._glyphMarginLeft=i.glyphMarginLeft,this._glyphMarginWidth=i.glyphMarginWidth,this._domNode=p_(document.createElement("div")),this._domNode.setClassName(FE.OUTER_CLASS_NAME),this._domNode.setPosition("absolute"),this._domNode.setAttribute("role","presentation"),this._domNode.setAttribute("aria-hidden","true"),this._glyphMarginBackgroundDomNode=p_(document.createElement("div")),this._glyphMarginBackgroundDomNode.setClassName(FE.CLASS_NAME),this._domNode.appendChild(this._glyphMarginBackgroundDomNode)}dispose(){super.dispose()}getDomNode(){return this._domNode}onConfigurationChanged(e){const t=this._context.configuration.options,i=t.get(131);return this._canUseLayerHinting=!t.get(28),this._contentLeft=i.contentLeft,this._glyphMarginLeft=i.glyphMarginLeft,this._glyphMarginWidth=i.glyphMarginWidth,!0}onScrollChanged(e){return super.onScrollChanged(e)||e.scrollTopChanged}prepareRender(e){}render(e){this._domNode.setLayerHinting(this._canUseLayerHinting),this._domNode.setContain("strict");const t=e.scrollTop-e.bigNumbersDelta;this._domNode.setTop(-t);const i=Math.min(e.scrollHeight,1e6);this._domNode.setHeight(i),this._domNode.setWidth(this._contentLeft),this._glyphMarginBackgroundDomNode.setLeft(this._glyphMarginLeft),this._glyphMarginBackgroundDomNode.setWidth(this._glyphMarginWidth),this._glyphMarginBackgroundDomNode.setHeight(i)}}FE.CLASS_NAME="glyph-margin",FE.OUTER_CLASS_NAME="margin";class BE{constructor(e,t,i,n,o){this._context=e,this.modelLineNumber=t,this.distanceToModelLineStart=i,this.widthOfHiddenLineTextBefore=n,this.distanceToModelLineEnd=o,this._visibleTextAreaBrand=void 0,this.startPosition=null,this.endPosition=null,this.visibleTextareaStart=null,this.visibleTextareaEnd=null,this._previousPresentation=null}prepareRender(e){const t=new er(this.modelLineNumber,this.distanceToModelLineStart+1),i=new er(this.modelLineNumber,this._context.viewModel.model.getLineMaxColumn(this.modelLineNumber)-this.distanceToModelLineEnd);this.startPosition=this._context.viewModel.coordinatesConverter.convertModelPositionToViewPosition(t),this.endPosition=this._context.viewModel.coordinatesConverter.convertModelPositionToViewPosition(i),this.startPosition.lineNumber===this.endPosition.lineNumber?(this.visibleTextareaStart=e.visibleRangeForPosition(this.startPosition),this.visibleTextareaEnd=e.visibleRangeForPosition(this.endPosition)):(this.visibleTextareaStart=null,this.visibleTextareaEnd=null)}definePresentation(e){return this._previousPresentation||(this._previousPresentation=e||{foreground:1,italic:!1,bold:!1,underline:!1,strikethrough:!1}),this._previousPresentation}}const VE=o_;class WE extends jL{constructor(e,t,i){super(e),this._primaryCursorPosition=new er(1,1),this._primaryCursorVisibleRange=null,this._viewController=t,this._visibleRangeProvider=i,this._scrollLeft=0,this._scrollTop=0;const n=this._context.configuration.options,o=n.get(131);this._setAccessibilityOptions(n),this._contentLeft=o.contentLeft,this._contentWidth=o.contentWidth,this._contentHeight=o.height,this._fontInfo=n.get(44),this._lineHeight=n.get(59),this._emptySelectionClipboard=n.get(32),this._copyWithSyntaxHighlighting=n.get(21),this._visibleTextArea=null,this._selections=[new ar(1,1,1,1)],this._modelSelections=[new ar(1,1,1,1)],this._lastRenderPosition=null,this.textArea=p_(document.createElement("textarea")),UL.write(this.textArea,6),this.textArea.setClassName("inputarea monaco-mouse-cursor-text"),this.textArea.setAttribute("wrap","off"),this.textArea.setAttribute("autocorrect","off"),this.textArea.setAttribute("autocapitalize","off"),this.textArea.setAttribute("autocomplete","off"),this.textArea.setAttribute("spellcheck","false"),this.textArea.setAttribute("aria-label",this._getAriaLabel(n)),this.textArea.setAttribute("tabindex",String(n.get(112))),this.textArea.setAttribute("role","textbox"),this.textArea.setAttribute("aria-roledescription",mf(0,"editor")),this.textArea.setAttribute("aria-multiline","true"),this.textArea.setAttribute("aria-haspopup","false"),this.textArea.setAttribute("aria-autocomplete","both"),n.get(30)&&n.get(81)&&this.textArea.setAttribute("readonly","true"),this.textAreaCover=p_(document.createElement("div")),this.textAreaCover.setPosition("absolute");const s={getLineCount:()=>this._context.viewModel.getLineCount(),getLineMaxColumn:e=>this._context.viewModel.getLineMaxColumn(e),getValueInRange:(e,t)=>this._context.viewModel.getValueInRange(e,t)},r={getDataToCopy:()=>{const e=this._context.viewModel.getPlainTextToCopy(this._modelSelections,this._emptySelectionClipboard,Rs),t=this._context.viewModel.model.getEOL(),i=this._emptySelectionClipboard&&1===this._modelSelections.length&&this._modelSelections[0].isEmpty(),n=Array.isArray(e)?e:null,o=Array.isArray(e)?e.join(t):e;let s,r=null;if(TN.forceCopyWithSyntaxHighlighting||this._copyWithSyntaxHighlighting&&o.length<65536){const e=this._context.viewModel.getRichTextToCopy(this._modelSelections,this._emptySelectionClipboard);e&&(s=e.html,r=e.mode)}return{isFromEmptySelection:i,multicursorText:n,text:o,html:s,mode:r}},getScreenReaderContent:e=>{if(1===this._accessibilitySupport){if(zo){const e=this._selections[0];if(e.isEmpty()){const t=e.getStartPosition();let i=this._getWordBeforePosition(t);if(0===i.length&&(i=this._getCharacterBeforePosition(t)),i.length>0)return new EN(i,i.length,i.length,t,t)}}return EN.EMPTY}if(c_){const e=this._selections[0];if(e.isEmpty()){const t=e.getStartPosition(),[i,n]=this._getAndroidWordAtPosition(t);if(i.length>0)return new EN(i,n,n,t,t)}return EN.EMPTY}return IN.fromEditorSelection(e,s,this._selections[0],this._accessibilityPageSize,0===this._accessibilitySupport)},deduceModelPosition:(e,t,i)=>this._context.viewModel.deduceModelPositionRelativeToViewPosition(e,t,i)},a=this._register(new PN(this.textArea.domNode));this._textAreaInput=this._register(new ON(r,a,Xs,u_)),this._register(this._textAreaInput.onKeyDown((e=>{this._viewController.emitKeyDown(e)}))),this._register(this._textAreaInput.onKeyUp((e=>{this._viewController.emitKeyUp(e)}))),this._register(this._textAreaInput.onPaste((e=>{let t=!1,i=null,n=null;e.metadata&&(t=this._emptySelectionClipboard&&!!e.metadata.isFromEmptySelection,i=void 0!==e.metadata.multicursorText?e.metadata.multicursorText:null,n=e.metadata.mode),this._viewController.paste(e.text,t,i,n)}))),this._register(this._textAreaInput.onCut((()=>{this._viewController.cut()}))),this._register(this._textAreaInput.onType((e=>{e.replacePrevCharCnt||e.replaceNextCharCnt||e.positionDelta?this._viewController.compositionType(e.text,e.replacePrevCharCnt,e.replaceNextCharCnt,e.positionDelta):this._viewController.type(e.text)}))),this._register(this._textAreaInput.onSelectionChangeRequest((e=>{this._viewController.setSelection(e)}))),this._register(this._textAreaInput.onCompositionStart((e=>{const t=this.textArea.domNode,i=this._modelSelections[0],{distanceToModelLineStart:n,widthOfHiddenTextBefore:o}=(()=>{const e=t.value.substring(0,Math.min(t.selectionStart,t.selectionEnd)),n=e.lastIndexOf("\n"),o=e.substring(n+1),s=o.lastIndexOf("\t"),r=o.length-s-1,a=i.getStartPosition(),l=Math.min(a.column-1,r),d=a.column-1-l,c=function(e,t){if(0===e.length)return 0;const i=document.createElement("div");i.style.position="absolute",i.style.top="-50000px",i.style.width="50000px";const n=document.createElement("span");m_(n,t),n.style.whiteSpace="pre",n.append(e),i.appendChild(n),document.body.appendChild(i);const o=n.offsetWidth;return document.body.removeChild(i),o}(o.substring(0,o.length-l),this._fontInfo);return{distanceToModelLineStart:d,widthOfHiddenTextBefore:c}})(),{distanceToModelLineEnd:s}=(()=>{const e=t.value.substring(Math.max(t.selectionStart,t.selectionEnd)),n=e.indexOf("\n"),o=-1===n?e:e.substring(0,n),s=o.indexOf("\t"),r=-1===s?o.length:o.length-s-1,a=i.getEndPosition(),l=Math.min(this._context.viewModel.model.getLineMaxColumn(a.lineNumber)-a.column,r);return{distanceToModelLineEnd:this._context.viewModel.model.getLineMaxColumn(a.lineNumber)-a.column-l}})();this._context.viewModel.revealRange("keyboard",!0,qo.fromPositions(this._selections[0].getStartPosition()),0,1),this._visibleTextArea=new BE(this._context,i.startLineNumber,n,o,s),this._visibleTextArea.prepareRender(this._visibleRangeProvider),this._render(),this.textArea.setClassName("inputarea monaco-mouse-cursor-text ime-input"),this._viewController.compositionStart(),this._context.viewModel.onCompositionStart()}))),this._register(this._textAreaInput.onCompositionUpdate((e=>{this._visibleTextArea&&(this._visibleTextArea.prepareRender(this._visibleRangeProvider),this._render())}))),this._register(this._textAreaInput.onCompositionEnd((()=>{this._visibleTextArea=null,this._render(),this.textArea.setClassName("inputarea monaco-mouse-cursor-text"),this._viewController.compositionEnd(),this._context.viewModel.onCompositionEnd()}))),this._register(this._textAreaInput.onFocus((()=>{this._context.viewModel.setHasFocus(!0)}))),this._register(this._textAreaInput.onBlur((()=>{this._context.viewModel.setHasFocus(!1)})))}dispose(){super.dispose()}_getAndroidWordAtPosition(e){const t=this._context.viewModel.getLineContent(e.lineNumber),i=cr('`~!@#$%^&*()-=+[{]}\\|;:",.<>/?');let n=!0,o=e.column,s=!0,r=e.column,a=0;for(;a<50&&(n||s);){if(n&&o<=1&&(n=!1),n){const e=t.charCodeAt(o-2);0!==i.get(e)?n=!1:o--}if(s&&r>t.length&&(s=!1),s){const e=t.charCodeAt(r-1);0!==i.get(e)?s=!1:r++}a++}return[t.substring(o-1,r-1),e.column-o]}_getWordBeforePosition(e){const t=this._context.viewModel.getLineContent(e.lineNumber),i=cr(this._context.configuration.options.get(117));let n=e.column,o=0;for(;n>1;){const s=t.charCodeAt(n-2);if(0!==i.get(s)||o>50)return t.substring(n-1,e.column-1);o++,n--}return t.substring(0,e.column-1)}_getCharacterBeforePosition(e){if(e.column>1){const t=this._context.viewModel.getLineContent(e.lineNumber).charAt(e.column-2);if(!Go(t.charCodeAt(0)))return t}return""}_getAriaLabel(e){return 1===e.get(2)?mf(0,"The editor is not accessible at this time. Press {0} for options.",Vo?"Shift+Alt+F1":"Alt+F1"):e.get(4)}_setAccessibilityOptions(e){this._accessibilitySupport=e.get(2);const t=e.get(3);2===this._accessibilitySupport&&t===Xf.accessibilityPageSize.defaultValue?this._accessibilityPageSize=500:this._accessibilityPageSize=t}onConfigurationChanged(e){const t=this._context.configuration.options,i=t.get(131);return this._setAccessibilityOptions(t),this._contentLeft=i.contentLeft,this._contentWidth=i.contentWidth,this._contentHeight=i.height,this._fontInfo=t.get(44),this._lineHeight=t.get(59),this._emptySelectionClipboard=t.get(32),this._copyWithSyntaxHighlighting=t.get(21),this.textArea.setAttribute("aria-label",this._getAriaLabel(t)),this.textArea.setAttribute("tabindex",String(t.get(112))),(e.hasChanged(30)||e.hasChanged(81))&&(t.get(30)&&t.get(81)?this.textArea.setAttribute("readonly","true"):this.textArea.removeAttribute("readonly")),e.hasChanged(2)&&this._textAreaInput.writeScreenReaderContent("strategy changed"),!0}onCursorStateChanged(e){return this._selections=e.selections.slice(0),this._modelSelections=e.modelSelections.slice(0),this._textAreaInput.writeScreenReaderContent("selection changed"),!0}onDecorationsChanged(e){return!0}onFlushed(e){return!0}onLinesChanged(e){return!0}onLinesDeleted(e){return!0}onLinesInserted(e){return!0}onScrollChanged(e){return this._scrollLeft=e.scrollLeft,this._scrollTop=e.scrollTop,!0}onZonesChanged(e){return!0}isFocused(){return this._textAreaInput.isFocused()}focusTextArea(){this._textAreaInput.focusTextArea()}getLastRenderData(){return this._lastRenderPosition}setAriaOptions(e){e.activeDescendant?(this.textArea.setAttribute("aria-haspopup","true"),this.textArea.setAttribute("aria-autocomplete","list"),this.textArea.setAttribute("aria-activedescendant",e.activeDescendant)):(this.textArea.setAttribute("aria-haspopup","false"),this.textArea.setAttribute("aria-autocomplete","both"),this.textArea.removeAttribute("aria-activedescendant")),e.role&&this.textArea.setAttribute("role",e.role)}prepareRender(e){this._primaryCursorPosition=new er(this._selections[0].positionLineNumber,this._selections[0].positionColumn),this._primaryCursorVisibleRange=e.visibleRangeForPosition(this._primaryCursorPosition),this._visibleTextArea&&this._visibleTextArea.prepareRender(e)}render(e){this._textAreaInput.writeScreenReaderContent("render"),this._render()}_render(){if(this._visibleTextArea){const e=this._visibleTextArea.visibleTextareaStart,t=this._visibleTextArea.visibleTextareaEnd,i=this._visibleTextArea.startPosition,n=this._visibleTextArea.endPosition;if(i&&n&&e&&t&&t.left>=this._scrollLeft&&e.left<=this._scrollLeft+this._contentWidth){const o=this._context.viewLayout.getVerticalOffsetForLineNumber(this._primaryCursorPosition.lineNumber)-this._scrollTop,s=this._newlinecount(this.textArea.domNode.value.substr(0,this.textArea.domNode.selectionStart));let r=this._visibleTextArea.widthOfHiddenLineTextBefore,a=this._contentLeft+e.left-this._scrollLeft,l=t.left-e.left+1;if(a<this._contentLeft){const e=this._contentLeft-a;a+=e,r+=e,l-=e}l>this._contentWidth&&(l=this._contentWidth);const d=this._context.viewModel.getViewLineData(i.lineNumber),c=d.tokens.findTokenIndexAtOffset(i.column-1),h=c===d.tokens.findTokenIndexAtOffset(n.column-1),u=this._visibleTextArea.definePresentation(h?d.tokens.getPresentation(c):null);this.textArea.domNode.scrollTop=s*this._lineHeight,this.textArea.domNode.scrollLeft=r,this._doRender({lastRenderPosition:null,top:o,left:a,width:l,height:this._lineHeight,useCover:!1,color:(Ns.getColorMap()||[])[u.foreground],italic:u.italic,bold:u.bold,underline:u.underline,strikethrough:u.strikethrough})}return}if(!this._primaryCursorVisibleRange)return void this._renderAtTopLeft();const e=this._contentLeft+this._primaryCursorVisibleRange.left-this._scrollLeft;if(e<this._contentLeft||e>this._contentLeft+this._contentWidth)return void this._renderAtTopLeft();const t=this._context.viewLayout.getVerticalOffsetForLineNumber(this._selections[0].positionLineNumber)-this._scrollTop;if(t<0||t>this._contentHeight)this._renderAtTopLeft();else if(zo){this._doRender({lastRenderPosition:this._primaryCursorPosition,top:t,left:e,width:VE?0:1,height:this._lineHeight,useCover:!1}),this.textArea.domNode.scrollLeft=this._primaryCursorVisibleRange.left;const i=this._newlinecount(this.textArea.domNode.value.substr(0,this.textArea.domNode.selectionStart));this.textArea.domNode.scrollTop=i*this._lineHeight}else this._doRender({lastRenderPosition:this._primaryCursorPosition,top:t,left:e,width:VE?0:1,height:VE?0:1,useCover:!1})}_newlinecount(e){let t=0,i=-1;for(;;){if(i=e.indexOf("\n",i+1),-1===i)break;t++}return t}_renderAtTopLeft(){this._doRender({lastRenderPosition:null,top:0,left:0,width:VE?0:1,height:VE?0:1,useCover:!0})}_doRender(e){this._lastRenderPosition=e.lastRenderPosition;const t=this.textArea,i=this.textAreaCover;m_(t,this._fontInfo),t.setTop(e.top),t.setLeft(e.left),t.setWidth(e.width),t.setHeight(e.height),t.setColor(e.color?hS.Format.CSS.formatHex(e.color):""),t.setFontStyle(e.italic?"italic":""),e.bold&&t.setFontWeight("bold"),t.setTextDecoration(`${e.underline?" underline":""}${e.strikethrough?" line-through":""}`),i.setTop(e.useCover?e.top:0),i.setLeft(e.useCover?e.left:0),i.setWidth(e.useCover?e.width:0),i.setHeight(e.useCover?e.height:0);const n=this._context.configuration.options;n.get(50)?i.setClassName("monaco-editor-background textAreaCover "+FE.OUTER_CLASS_NAME):0!==n.get(60).renderType?i.setClassName("monaco-editor-background textAreaCover "+PE.CLASS_NAME):i.setClassName("monaco-editor-background textAreaCover")}}function zE(e,t,i){let n=xs(e);return-1===n&&(n=e.length),function(e,t,i){let n=0;for(let s=0;s<e.length;s++)"\t"===e.charAt(s)?n+=t:n++;let o="";if(!i){const e=Math.floor(n/t);n%=t;for(let t=0;t<e;t++)o+="\t"}for(let s=0;s<n;s++)o+=" ";return o}(e.substring(0,n),t,i)+e.substring(n)}const HE=()=>!0,jE=()=>!1,UE=e=>" "===e||"\t"===e;class $E{constructor(e,t,i,n){this.languageConfigurationService=n,this._cursorMoveConfigurationBrand=void 0,this._languageId=e;const o=i.options,s=o.get(131);this.readOnly=o.get(81),this.tabSize=t.tabSize,this.indentSize=t.indentSize,this.insertSpaces=t.insertSpaces,this.stickyTabStops=o.get(104),this.lineHeight=o.get(59),this.pageSize=Math.max(1,Math.floor(s.height/this.lineHeight)-2),this.useTabStops=o.get(116),this.wordSeparators=o.get(117),this.emptySelectionClipboard=o.get(32),this.copyWithSyntaxHighlighting=o.get(21),this.multiCursorMergeOverlapping=o.get(69),this.multiCursorPaste=o.get(71),this.autoClosingBrackets=o.get(5),this.autoClosingQuotes=o.get(8),this.autoClosingDelete=o.get(6),this.autoClosingOvertype=o.get(7),this.autoSurround=o.get(11),this.autoIndent=o.get(9),this.surroundingPairs={},this._electricChars=null,this.shouldAutoCloseBefore={quote:this._getShouldAutoClose(e,this.autoClosingQuotes),bracket:this._getShouldAutoClose(e,this.autoClosingBrackets)},this.autoClosingPairs=this.languageConfigurationService.getLanguageConfiguration(e).getAutoClosingPairs();const r=this.languageConfigurationService.getLanguageConfiguration(e).getSurroundingPairs();if(r)for(const a of r)this.surroundingPairs[a.open]=a.close}static shouldRecreate(e){return e.hasChanged(131)||e.hasChanged(117)||e.hasChanged(32)||e.hasChanged(69)||e.hasChanged(71)||e.hasChanged(5)||e.hasChanged(8)||e.hasChanged(6)||e.hasChanged(7)||e.hasChanged(11)||e.hasChanged(116)||e.hasChanged(59)||e.hasChanged(81)}get electricChars(){var e;if(!this._electricChars){this._electricChars={};const t=null===(e=this.languageConfigurationService.getLanguageConfiguration(this._languageId).electricCharacter)||void 0===e?void 0:e.getElectricCharacters();if(t)for(const e of t)this._electricChars[e]=!0}return this._electricChars}onElectricCharacter(e,t,i){const n=F_(t,i-1),o=this.languageConfigurationService.getLanguageConfiguration(n.languageId).electricCharacter;return o?o.onElectricCharacter(e,n,i-n.firstCharOffset):null}normalizeIndentation(e){return zE(e,this.indentSize,this.insertSpaces)}_getShouldAutoClose(e,t){switch(t){case"beforeWhitespace":return UE;case"languageDefined":return this._getLanguageDefinedShouldAutoClose(e);case"always":return HE;case"never":return jE}}_getLanguageDefinedShouldAutoClose(e){const t=this.languageConfigurationService.getLanguageConfiguration(e).getAutoCloseBeforeSet();return e=>-1!==t.indexOf(e)}visibleColumnFromColumn(e,t){return dN.visibleColumnFromColumn(e.getLineContent(t.lineNumber),t.column,this.tabSize)}columnFromVisibleColumn(e,t,i){const n=dN.columnFromVisibleColumn(e.getLineContent(t),i,this.tabSize),o=e.getLineMinColumn(t);if(n<o)return o;const s=e.getLineMaxColumn(t);return n>s?s:n}}class KE{constructor(e,t){this._cursorStateBrand=void 0,this.modelState=e,this.viewState=t}static fromModelState(e){return new qE(e)}static fromViewState(e){return new GE(e)}static fromModelSelection(e){const t=ar.liftSelection(e),i=new ZE(qo.fromPositions(t.getSelectionStart()),0,t.getPosition(),0);return KE.fromModelState(i)}static fromModelSelections(e){const t=[];for(let i=0,n=e.length;i<n;i++)t[i]=this.fromModelSelection(e[i]);return t}equals(e){return this.viewState.equals(e.viewState)&&this.modelState.equals(e.modelState)}}class qE{constructor(e){this.modelState=e,this.viewState=null}}class GE{constructor(e){this.modelState=null,this.viewState=e}}class ZE{constructor(e,t,i,n){this._singleCursorStateBrand=void 0,this.selectionStart=e,this.selectionStartLeftoverVisibleColumns=t,this.position=i,this.leftoverVisibleColumns=n,this.selection=ZE._computeSelection(this.selectionStart,this.position)}equals(e){return this.selectionStartLeftoverVisibleColumns===e.selectionStartLeftoverVisibleColumns&&this.leftoverVisibleColumns===e.leftoverVisibleColumns&&this.position.equals(e.position)&&this.selectionStart.equalsRange(e.selectionStart)}hasSelection(){return!this.selection.isEmpty()||!this.selectionStart.isEmpty()}move(e,t,i,n){return e?new ZE(this.selectionStart,this.selectionStartLeftoverVisibleColumns,new er(t,i),n):new ZE(new qo(t,i,t,i),n,new er(t,i),n)}static _computeSelection(e,t){return e.isEmpty()||!t.isBeforeOrEqual(e.getStartPosition())?ar.fromPositions(e.getStartPosition(),t):ar.fromPositions(e.getEndPosition(),t)}}class YE{constructor(e,t,i){this._editOperationResultBrand=void 0,this.type=e,this.commands=t,this.shouldPushStackElementBefore=i.shouldPushStackElementBefore,this.shouldPushStackElementAfter=i.shouldPushStackElementAfter}}function XE(e){return"'"===e||'"'===e||"`"===e}class QE{static columnSelect(e,t,i,n,o,s){const r=Math.abs(o-i)+1,a=i>o,l=n>s,d=n<s,c=[];for(let h=0;h<r;h++){const o=i+(a?-h:h),r=e.columnFromVisibleColumn(t,o,n),u=e.columnFromVisibleColumn(t,o,s),g=e.visibleColumnFromColumn(t,new er(o,r)),p=e.visibleColumnFromColumn(t,new er(o,u));if(d){if(g>s)continue;if(p<n)continue}if(l){if(p>n)continue;if(g<s)continue}c.push(new ZE(new qo(o,r,o,r),0,new er(o,u),0))}if(0===c.length)for(let h=0;h<r;h++){const e=i+(a?-h:h),n=t.getLineMaxColumn(e);c.push(new ZE(new qo(e,n,e,n),0,new er(e,n),0))}return{viewStates:c,reversed:a,fromLineNumber:i,fromVisualColumn:n,toLineNumber:o,toVisualColumn:s}}static columnSelectLeft(e,t,i){let n=i.toViewVisualColumn;return n>0&&n--,QE.columnSelect(e,t,i.fromViewLineNumber,i.fromViewVisualColumn,i.toViewLineNumber,n)}static columnSelectRight(e,t,i){let n=0;const o=Math.min(i.fromViewLineNumber,i.toViewLineNumber),s=Math.max(i.fromViewLineNumber,i.toViewLineNumber);for(let a=o;a<=s;a++){const i=t.getLineMaxColumn(a),o=e.visibleColumnFromColumn(t,new er(a,i));n=Math.max(n,o)}let r=i.toViewVisualColumn;return r<n&&r++,this.columnSelect(e,t,i.fromViewLineNumber,i.fromViewVisualColumn,i.toViewLineNumber,r)}static columnSelectUp(e,t,i,n){const o=n?e.pageSize:1,s=Math.max(1,i.toViewLineNumber-o);return this.columnSelect(e,t,i.fromViewLineNumber,i.fromViewVisualColumn,s,i.toViewVisualColumn)}static columnSelectDown(e,t,i,n){const o=n?e.pageSize:1,s=Math.min(t.getLineCount(),i.toViewLineNumber+o);return this.columnSelect(e,t,i.fromViewLineNumber,i.fromViewVisualColumn,s,i.toViewVisualColumn)}}class JE{constructor(e,t,i=!1){this._range=e,this._text=t,this.insertsAutoWhitespace=i}getEditOperations(e,t){t.addTrackedEditOperation(this._range,this._text)}computeCursorState(e,t){const i=t.getInverseEditOperations()[0].range;return ar.fromPositions(i.getEndPosition())}}class eI{constructor(e,t){this._range=e,this._text=t}getEditOperations(e,t){t.addTrackedEditOperation(this._range,this._text)}computeCursorState(e,t){const i=t.getInverseEditOperations()[0].range;return ar.fromRange(i,0)}}class tI{constructor(e,t,i=!1){this._range=e,this._text=t,this.insertsAutoWhitespace=i}getEditOperations(e,t){t.addTrackedEditOperation(this._range,this._text)}computeCursorState(e,t){const i=t.getInverseEditOperations()[0].range;return ar.fromPositions(i.getStartPosition())}}class iI{constructor(e,t,i,n,o=!1){this._range=e,this._text=t,this._columnDeltaOffset=n,this._lineNumberDeltaOffset=i,this.insertsAutoWhitespace=o}getEditOperations(e,t){t.addTrackedEditOperation(this._range,this._text)}computeCursorState(e,t){const i=t.getInverseEditOperations()[0].range;return ar.fromPositions(i.getEndPosition().delta(this._lineNumberDeltaOffset,this._columnDeltaOffset))}}class nI{constructor(e,t,i,n=!1){this._range=e,this._text=t,this._initialSelection=i,this._forceMoveMarkers=n,this._selectionId=null}getEditOperations(e,t){t.addTrackedEditOperation(this._range,this._text,this._forceMoveMarkers),this._selectionId=t.trackSelection(this._initialSelection)}computeCursorState(e,t){return t.getTrackedSelection(this._selectionId)}}class oI{constructor(e,t,i){this._cursorPositionBrand=void 0,this.lineNumber=e,this.column=t,this.leftoverVisibleColumns=i}}class sI{static leftPosition(e,t){if(t.column>e.getLineMinColumn(t.lineNumber))return t.delta(void 0,-hr(e.getLineContent(t.lineNumber),t.column-1));if(t.lineNumber>1){const i=t.lineNumber-1;return new er(i,e.getLineMaxColumn(i))}return t}static leftPositionAtomicSoftTabs(e,t,i){if(t.column<=e.getLineIndentColumn(t.lineNumber)){const n=e.getLineMinColumn(t.lineNumber),o=e.getLineContent(t.lineNumber),s=cN.atomicPosition(o,t.column-1,i,0);if(-1!==s&&s+1>=n)return new er(t.lineNumber,s+1)}return this.leftPosition(e,t)}static left(e,t,i){const n=e.stickyTabStops?sI.leftPositionAtomicSoftTabs(t,i,e.tabSize):sI.leftPosition(t,i);return new oI(n.lineNumber,n.column,0)}static moveLeft(e,t,i,n,o){let s,r;if(i.hasSelection()&&!n)s=i.selection.startLineNumber,r=i.selection.startColumn;else{const n=i.position.delta(void 0,-(o-1)),a=t.normalizePosition(sI.clipPositionColumn(n,t),0),l=sI.left(e,t,a);s=l.lineNumber,r=l.column}return i.move(n,s,r,0)}static clipPositionColumn(e,t){return new er(e.lineNumber,sI.clipRange(e.column,t.getLineMinColumn(e.lineNumber),t.getLineMaxColumn(e.lineNumber)))}static clipRange(e,t,i){return e<t?t:e>i?i:e}static rightPosition(e,t,i){return i<e.getLineMaxColumn(t)?i+=ur(e.getLineContent(t),i-1):t<e.getLineCount()&&(t+=1,i=e.getLineMinColumn(t)),new er(t,i)}static rightPositionAtomicSoftTabs(e,t,i,n,o){if(i<e.getLineIndentColumn(t)){const o=e.getLineContent(t),s=cN.atomicPosition(o,i-1,n,1);if(-1!==s)return new er(t,s+1)}return this.rightPosition(e,t,i)}static right(e,t,i){const n=e.stickyTabStops?sI.rightPositionAtomicSoftTabs(t,i.lineNumber,i.column,e.tabSize,e.indentSize):sI.rightPosition(t,i.lineNumber,i.column);return new oI(n.lineNumber,n.column,0)}static moveRight(e,t,i,n,o){let s,r;if(i.hasSelection()&&!n)s=i.selection.endLineNumber,r=i.selection.endColumn;else{const n=i.position.delta(void 0,o-1),a=t.normalizePosition(sI.clipPositionColumn(n,t),1),l=sI.right(e,t,a);s=l.lineNumber,r=l.column}return i.move(n,s,r,0)}static vertical(e,t,i,n,o,s,r,a){const l=dN.visibleColumnFromColumn(t.getLineContent(i),n,e.tabSize)+o,d=t.getLineCount(),c=1===i&&1===n,h=i===d&&n===t.getLineMaxColumn(i),u=s<i?c:h;if((i=s)<1?(i=1,n=r?t.getLineMinColumn(i):Math.min(t.getLineMaxColumn(i),n)):i>d?(i=d,n=r?t.getLineMaxColumn(i):Math.min(t.getLineMaxColumn(i),n)):n=e.columnFromVisibleColumn(t,i,l),o=u?0:l-dN.visibleColumnFromColumn(t.getLineContent(i),n,e.tabSize),void 0!==a){const e=new er(i,n),s=t.normalizePosition(e,a);o+=n-s.column,i=s.lineNumber,n=s.column}return new oI(i,n,o)}static down(e,t,i,n,o,s,r){return this.vertical(e,t,i,n,o,i+s,r,1)}static moveDown(e,t,i,n,o){let s,r;i.hasSelection()&&!n?(s=i.selection.endLineNumber,r=i.selection.endColumn):(s=i.position.lineNumber,r=i.position.column);const a=sI.down(e,t,s,r,i.leftoverVisibleColumns,o,!0);return i.move(n,a.lineNumber,a.column,a.leftoverVisibleColumns)}static translateDown(e,t,i){const n=i.selection,o=sI.down(e,t,n.selectionStartLineNumber,n.selectionStartColumn,i.selectionStartLeftoverVisibleColumns,1,!1),s=sI.down(e,t,n.positionLineNumber,n.positionColumn,i.leftoverVisibleColumns,1,!1);return new ZE(new qo(o.lineNumber,o.column,o.lineNumber,o.column),o.leftoverVisibleColumns,new er(s.lineNumber,s.column),s.leftoverVisibleColumns)}static up(e,t,i,n,o,s,r){return this.vertical(e,t,i,n,o,i-s,r,0)}static moveUp(e,t,i,n,o){let s,r;i.hasSelection()&&!n?(s=i.selection.startLineNumber,r=i.selection.startColumn):(s=i.position.lineNumber,r=i.position.column);const a=sI.up(e,t,s,r,i.leftoverVisibleColumns,o,!0);return i.move(n,a.lineNumber,a.column,a.leftoverVisibleColumns)}static translateUp(e,t,i){const n=i.selection,o=sI.up(e,t,n.selectionStartLineNumber,n.selectionStartColumn,i.selectionStartLeftoverVisibleColumns,1,!1),s=sI.up(e,t,n.positionLineNumber,n.positionColumn,i.leftoverVisibleColumns,1,!1);return new ZE(new qo(o.lineNumber,o.column,o.lineNumber,o.column),o.leftoverVisibleColumns,new er(s.lineNumber,s.column),s.leftoverVisibleColumns)}static _isBlankLine(e,t){return 0===e.getLineFirstNonWhitespaceColumn(t)}static moveToPrevBlankLine(e,t,i,n){let o=i.position.lineNumber;for(;o>1&&this._isBlankLine(t,o);)o--;for(;o>1&&!this._isBlankLine(t,o);)o--;return i.move(n,o,t.getLineMinColumn(o),0)}static moveToNextBlankLine(e,t,i,n){const o=t.getLineCount();let s=i.position.lineNumber;for(;s<o&&this._isBlankLine(t,s);)s++;for(;s<o&&!this._isBlankLine(t,s);)s++;return i.move(n,s,t.getLineMinColumn(s),0)}static moveToBeginningOfLine(e,t,i,n){const o=i.position.lineNumber,s=t.getLineMinColumn(o),r=t.getLineFirstNonWhitespaceColumn(o)||s;let a;return a=i.position.column===r?s:r,i.move(n,o,a,0)}static moveToEndOfLine(e,t,i,n,o){const s=i.position.lineNumber,r=t.getLineMaxColumn(s);return i.move(n,s,r,o?1073741824-r:0)}static moveToBeginningOfBuffer(e,t,i,n){return i.move(n,1,1,0)}static moveToEndOfBuffer(e,t,i,n){const o=t.getLineCount(),s=t.getLineMaxColumn(o);return i.move(n,o,s,0)}}class rI{static deleteRight(e,t,i,n){const o=[];let s=3!==e;for(let r=0,a=n.length;r<a;r++){const e=n[r];let a=e;if(a.isEmpty()){const n=e.getPosition(),o=sI.right(t,i,n);a=new qo(o.lineNumber,o.column,n.lineNumber,n.column)}a.isEmpty()?o[r]=null:(a.startLineNumber!==a.endLineNumber&&(s=!0),o[r]=new JE(a,""))}return[s,o]}static isAutoClosingPairDelete(e,t,i,n,o,s,r){if("never"===t&&"never"===i)return!1;if("never"===e)return!1;for(let a=0,l=s.length;a<l;a++){const l=s[a],d=l.getPosition();if(!l.isEmpty())return!1;const c=o.getLineContent(d.lineNumber);if(d.column<2||d.column>=c.length+1)return!1;const h=c.charAt(d.column-2),u=n.get(h);if(!u)return!1;if(XE(h)){if("never"===i)return!1}else if("never"===t)return!1;const g=c.charAt(d.column-1);let p=!1;for(const e of u)e.open===h&&e.close===g&&(p=!0);if(!p)return!1;if("auto"===e){let e=!1;for(let t=0,i=r.length;t<i;t++){const i=r[t];if(d.lineNumber===i.startLineNumber&&d.column===i.startColumn){e=!0;break}}if(!e)return!1}}return!0}static _runAutoClosingPairDelete(e,t,i){const n=[];for(let o=0,s=i.length;o<s;o++){const e=i[o].getPosition(),t=new qo(e.lineNumber,e.column-1,e.lineNumber,e.column+1);n[o]=new JE(t,"")}return[!0,n]}static deleteLeft(e,t,i,n,o){if(this.isAutoClosingPairDelete(t.autoClosingDelete,t.autoClosingBrackets,t.autoClosingQuotes,t.autoClosingPairs.autoClosingPairsOpenByEnd,i,n,o))return this._runAutoClosingPairDelete(t,i,n);const s=[];let r=2!==e;for(let a=0,l=n.length;a<l;a++){const e=rI.getDeleteRange(n[a],i,t);e.isEmpty()?s[a]=null:(e.startLineNumber!==e.endLineNumber&&(r=!0),s[a]=new JE(e,""))}return[r,s]}static getDeleteRange(e,t,i){if(!e.isEmpty())return e;const n=e.getPosition();if(i.useTabStops&&n.column>1){const e=t.getLineContent(n.lineNumber),o=xs(e),s=-1===o?e.length+1:o+1;if(n.column<=s){const e=i.visibleColumnFromColumn(t,n),o=dN.prevIndentTabStop(e,i.indentSize),s=i.columnFromVisibleColumn(t,n.lineNumber,o);return new qo(n.lineNumber,s,n.lineNumber,n.column)}}return qo.fromPositions(rI.getPositionAfterDeleteLeft(n,t),n)}static getPositionAfterDeleteLeft(e,t){if(e.column>1){const i=gr(e.column-1,t.getLineContent(e.lineNumber));return e.with(void 0,i+1)}if(e.lineNumber>1){const i=e.lineNumber-1;return new er(i,t.getLineMaxColumn(i))}return e}static cut(e,t,i){const n=[];let o=null;i.sort(((e,t)=>er.compare(e.getStartPosition(),t.getEndPosition())));for(let s=0,r=i.length;s<r;s++){const r=i[s];if(r.isEmpty())if(e.emptySelectionClipboard){const e=r.getPosition();let i,a,l,d;e.lineNumber<t.getLineCount()?(i=e.lineNumber,a=1,l=e.lineNumber+1,d=1):e.lineNumber>1&&(null==o?void 0:o.endLineNumber)!==e.lineNumber?(i=e.lineNumber-1,a=t.getLineMaxColumn(e.lineNumber-1),l=e.lineNumber,d=t.getLineMaxColumn(e.lineNumber)):(i=e.lineNumber,a=1,l=e.lineNumber,d=t.getLineMaxColumn(e.lineNumber));const c=new qo(i,a,l,d);o=c,c.isEmpty()?n[s]=null:n[s]=new JE(c,"")}else n[s]=null;else n[s]=new JE(r,"")}return new YE(0,n,{shouldPushStackElementBefore:!0,shouldPushStackElementAfter:!0})}}class aI{static _createWord(e,t,i,n,o){return{start:n,end:o,wordType:t,nextCharClass:i}}static _findPreviousWordOnLine(e,t,i){const n=t.getLineContent(i.lineNumber);return this._doFindPreviousWordOnLine(n,e,i)}static _doFindPreviousWordOnLine(e,t,i){let n=0;for(let o=i.column-2;o>=0;o--){const i=e.charCodeAt(o),s=t.get(i);if(0===s){if(2===n)return this._createWord(e,n,s,o+1,this._findEndOfWord(e,t,n,o+1));n=1}else if(2===s){if(1===n)return this._createWord(e,n,s,o+1,this._findEndOfWord(e,t,n,o+1));n=2}else if(1===s&&0!==n)return this._createWord(e,n,s,o+1,this._findEndOfWord(e,t,n,o+1))}return 0!==n?this._createWord(e,n,1,0,this._findEndOfWord(e,t,n,0)):null}static _findEndOfWord(e,t,i,n){const o=e.length;for(let s=n;s<o;s++){const n=e.charCodeAt(s),o=t.get(n);if(1===o)return s;if(1===i&&2===o)return s;if(2===i&&0===o)return s}return o}static _findNextWordOnLine(e,t,i){const n=t.getLineContent(i.lineNumber);return this._doFindNextWordOnLine(n,e,i)}static _doFindNextWordOnLine(e,t,i){let n=0;const o=e.length;for(let s=i.column-1;s<o;s++){const i=e.charCodeAt(s),o=t.get(i);if(0===o){if(2===n)return this._createWord(e,n,o,this._findStartOfWord(e,t,n,s-1),s);n=1}else if(2===o){if(1===n)return this._createWord(e,n,o,this._findStartOfWord(e,t,n,s-1),s);n=2}else if(1===o&&0!==n)return this._createWord(e,n,o,this._findStartOfWord(e,t,n,s-1),s)}return 0!==n?this._createWord(e,n,1,this._findStartOfWord(e,t,n,o-1),o):null}static _findStartOfWord(e,t,i,n){for(let o=n;o>=0;o--){const n=e.charCodeAt(o),s=t.get(n);if(1===s)return o+1;if(1===i&&2===s)return o+1;if(2===i&&0===s)return o+1}return 0}static moveWordLeft(e,t,i,n){let o=i.lineNumber,s=i.column;1===s&&o>1&&(o-=1,s=t.getLineMaxColumn(o));let r=aI._findPreviousWordOnLine(e,t,new er(o,s));if(0===n)return new er(o,r?r.start+1:1);if(1===n)return r&&2===r.wordType&&r.end-r.start==1&&0===r.nextCharClass&&(r=aI._findPreviousWordOnLine(e,t,new er(o,r.start+1))),new er(o,r?r.start+1:1);if(3===n){for(;r&&2===r.wordType;)r=aI._findPreviousWordOnLine(e,t,new er(o,r.start+1));return new er(o,r?r.start+1:1)}return r&&s<=r.end+1&&(r=aI._findPreviousWordOnLine(e,t,new er(o,r.start+1))),new er(o,r?r.end+1:1)}static _moveWordPartLeft(e,t){const i=t.lineNumber,n=e.getLineMaxColumn(i);if(1===t.column)return i>1?new er(i-1,e.getLineMaxColumn(i-1)):t;const o=e.getLineContent(i);for(let s=t.column-1;s>1;s--){const e=o.charCodeAt(s-2),t=o.charCodeAt(s-1);if(95===e&&95!==t)return new er(i,s);if(pr(e)&&mr(t))return new er(i,s);if(mr(e)&&mr(t)&&s+1<n){const e=o.charCodeAt(s);if(pr(e))return new er(i,s)}}return new er(i,1)}static moveWordRight(e,t,i,n){let o=i.lineNumber,s=i.column,r=!1;s===t.getLineMaxColumn(o)&&o<t.getLineCount()&&(r=!0,o+=1,s=1);let a=aI._findNextWordOnLine(e,t,new er(o,s));if(2===n)a&&2===a.wordType&&a.end-a.start==1&&0===a.nextCharClass&&(a=aI._findNextWordOnLine(e,t,new er(o,a.end+1))),s=a?a.end+1:t.getLineMaxColumn(o);else if(3===n){for(r&&(s=0);a&&(2===a.wordType||a.start+1<=s);)a=aI._findNextWordOnLine(e,t,new er(o,a.end+1));s=a?a.start+1:t.getLineMaxColumn(o)}else a&&!r&&s>=a.start+1&&(a=aI._findNextWordOnLine(e,t,new er(o,a.end+1))),s=a?a.start+1:t.getLineMaxColumn(o);return new er(o,s)}static _moveWordPartRight(e,t){const i=t.lineNumber,n=e.getLineMaxColumn(i);if(t.column===n)return i<e.getLineCount()?new er(i+1,1):t;const o=e.getLineContent(i);for(let s=t.column+1;s<n;s++){const e=o.charCodeAt(s-2),t=o.charCodeAt(s-1);if(95!==e&&95===t)return new er(i,s);if(pr(e)&&mr(t))return new er(i,s);if(mr(e)&&mr(t)&&s+1<n){const e=o.charCodeAt(s);if(pr(e))return new er(i,s)}}return new er(i,n)}static _deleteWordLeftWhitespace(e,t){const i=e.getLineContent(t.lineNumber),n=t.column-2,o=Ss(i,n);return o+1<n?new qo(t.lineNumber,o+2,t.lineNumber,t.column):null}static deleteWordLeft(e,t){const i=e.wordSeparators,n=e.model,o=e.selection,s=e.whitespaceHeuristics;if(!o.isEmpty())return o;if(rI.isAutoClosingPairDelete(e.autoClosingDelete,e.autoClosingBrackets,e.autoClosingQuotes,e.autoClosingPairs.autoClosingPairsOpenByEnd,e.model,[e.selection],e.autoClosedCharacters)){const t=e.selection.getPosition();return new qo(t.lineNumber,t.column-1,t.lineNumber,t.column+1)}const r=new er(o.positionLineNumber,o.positionColumn);let a=r.lineNumber,l=r.column;if(1===a&&1===l)return null;if(s){const e=this._deleteWordLeftWhitespace(n,r);if(e)return e}let d=aI._findPreviousWordOnLine(i,n,r);return 0===t?d?l=d.start+1:l>1?l=1:(a--,l=n.getLineMaxColumn(a)):(d&&l<=d.end+1&&(d=aI._findPreviousWordOnLine(i,n,new er(a,d.start+1))),d?l=d.end+1:l>1?l=1:(a--,l=n.getLineMaxColumn(a))),new qo(a,l,r.lineNumber,r.column)}static deleteInsideWord(e,t,i){if(!i.isEmpty())return i;const n=new er(i.positionLineNumber,i.positionColumn),o=this._deleteInsideWordWhitespace(t,n);return o||this._deleteInsideWordDetermineDeleteRange(e,t,n)}static _charAtIsWhitespace(e,t){const i=e.charCodeAt(t);return 32===i||9===i}static _deleteInsideWordWhitespace(e,t){const i=e.getLineContent(t.lineNumber),n=i.length;if(0===n)return null;let o=Math.max(t.column-2,0);if(!this._charAtIsWhitespace(i,o))return null;let s=Math.min(t.column-1,n-1);if(!this._charAtIsWhitespace(i,s))return null;for(;o>0&&this._charAtIsWhitespace(i,o-1);)o--;for(;s+1<n&&this._charAtIsWhitespace(i,s+1);)s++;return new qo(t.lineNumber,o+1,t.lineNumber,s+2)}static _deleteInsideWordDetermineDeleteRange(e,t,i){const n=t.getLineContent(i.lineNumber),o=n.length;if(0===o)return i.lineNumber>1?new qo(i.lineNumber-1,t.getLineMaxColumn(i.lineNumber-1),i.lineNumber,1):i.lineNumber<t.getLineCount()?new qo(i.lineNumber,1,i.lineNumber+1,1):new qo(i.lineNumber,1,i.lineNumber,1);const s=e=>e.start+1<=i.column&&i.column<=e.end+1,r=(e,t)=>(e=Math.min(e,i.column),t=Math.max(t,i.column),new qo(i.lineNumber,e,i.lineNumber,t)),a=e=>{let t=e.start+1,i=e.end+1,s=!1;for(;i-1<o&&this._charAtIsWhitespace(n,i-1);)s=!0,i++;if(!s)for(;t>1&&this._charAtIsWhitespace(n,t-2);)t--;return r(t,i)},l=aI._findPreviousWordOnLine(e,t,i);if(l&&s(l))return a(l);const d=aI._findNextWordOnLine(e,t,i);return d&&s(d)?a(d):l&&d?r(l.end+1,d.start+1):l?r(l.start+1,l.end+1):d?r(d.start+1,d.end+1):r(1,o+1)}static _deleteWordPartLeft(e,t){if(!t.isEmpty())return t;const i=t.getPosition(),n=aI._moveWordPartLeft(e,i);return new qo(i.lineNumber,i.column,n.lineNumber,n.column)}static _findFirstNonWhitespaceChar(e,t){const i=e.length;for(let n=t;n<i;n++){const t=e.charAt(n);if(" "!==t&&"\t"!==t)return n}return i}static _deleteWordRightWhitespace(e,t){const i=e.getLineContent(t.lineNumber),n=t.column-1,o=this._findFirstNonWhitespaceChar(i,n);return n+1<o?new qo(t.lineNumber,t.column,t.lineNumber,o+1):null}static deleteWordRight(e,t){const i=e.wordSeparators,n=e.model,o=e.selection,s=e.whitespaceHeuristics;if(!o.isEmpty())return o;const r=new er(o.positionLineNumber,o.positionColumn);let a=r.lineNumber,l=r.column;const d=n.getLineCount(),c=n.getLineMaxColumn(a);if(a===d&&l===c)return null;if(s){const e=this._deleteWordRightWhitespace(n,r);if(e)return e}let h=aI._findNextWordOnLine(i,n,r);return 2===t?h?l=h.end+1:l<c||a===d?l=c:(a++,h=aI._findNextWordOnLine(i,n,new er(a,1)),l=h?h.start+1:n.getLineMaxColumn(a)):(h&&l>=h.start+1&&(h=aI._findNextWordOnLine(i,n,new er(a,h.end+1))),h?l=h.start+1:l<c||a===d?l=c:(a++,h=aI._findNextWordOnLine(i,n,new er(a,1)),l=h?h.start+1:n.getLineMaxColumn(a))),new qo(a,l,r.lineNumber,r.column)}static _deleteWordPartRight(e,t){if(!t.isEmpty())return t;const i=t.getPosition(),n=aI._moveWordPartRight(e,i);return new qo(i.lineNumber,i.column,n.lineNumber,n.column)}static _createWordAtPosition(e,t,i){const n=new qo(t,i.start+1,t,i.end+1);return{word:e.getValueInRange(n),startColumn:n.startColumn,endColumn:n.endColumn}}static getWordAtPosition(e,t,i){const n=cr(t),o=aI._findPreviousWordOnLine(n,e,i);if(o&&1===o.wordType&&o.start<=i.column-1&&i.column-1<=o.end)return aI._createWordAtPosition(e,i.lineNumber,o);const s=aI._findNextWordOnLine(n,e,i);return s&&1===s.wordType&&s.start<=i.column-1&&i.column-1<=s.end?aI._createWordAtPosition(e,i.lineNumber,s):null}static word(e,t,i,n,o){const s=cr(e.wordSeparators),r=aI._findPreviousWordOnLine(s,t,o),a=aI._findNextWordOnLine(s,t,o);if(!n){let e,i;return r&&1===r.wordType&&r.start<=o.column-1&&o.column-1<=r.end?(e=r.start+1,i=r.end+1):a&&1===a.wordType&&a.start<=o.column-1&&o.column-1<=a.end?(e=a.start+1,i=a.end+1):(e=r?r.end+1:1,i=a?a.start+1:t.getLineMaxColumn(o.lineNumber)),new ZE(new qo(o.lineNumber,e,o.lineNumber,i),0,new er(o.lineNumber,i),0)}let l,d;r&&1===r.wordType&&r.start<o.column-1&&o.column-1<r.end?(l=r.start+1,d=r.end+1):a&&1===a.wordType&&a.start<o.column-1&&o.column-1<a.end?(l=a.start+1,d=a.end+1):(l=o.column,d=o.column);const c=o.lineNumber;let h;if(i.selectionStart.containsPosition(o))h=i.selectionStart.endColumn;else if(o.isBeforeOrEqual(i.selectionStart.getStartPosition())){h=l;const e=new er(c,h);i.selectionStart.containsPosition(e)&&(h=i.selectionStart.endColumn)}else{h=d;const e=new er(c,h);i.selectionStart.containsPosition(e)&&(h=i.selectionStart.startColumn)}return i.move(!0,c,h,0)}}class lI extends aI{static deleteWordPartLeft(e){const t=dI([aI.deleteWordLeft(e,0),aI.deleteWordLeft(e,2),aI._deleteWordPartLeft(e.model,e.selection)]);return t.sort(qo.compareRangesUsingEnds),t[2]}static deleteWordPartRight(e){const t=dI([aI.deleteWordRight(e,0),aI.deleteWordRight(e,2),aI._deleteWordPartRight(e.model,e.selection)]);return t.sort(qo.compareRangesUsingStarts),t[0]}static moveWordPartLeft(e,t,i){const n=dI([aI.moveWordLeft(e,t,i,0),aI.moveWordLeft(e,t,i,2),aI._moveWordPartLeft(t,i)]);return n.sort(er.compare),n[2]}static moveWordPartRight(e,t,i){const n=dI([aI.moveWordRight(e,t,i,0),aI.moveWordRight(e,t,i,2),aI._moveWordPartRight(t,i)]);return n.sort(er.compare),n[0]}}function dI(e){return e.filter((e=>Boolean(e)))}class cI{static addCursorDown(e,t,i){const n=[];let o=0;for(let s=0,r=t.length;s<r;s++){const r=t[s];n[o++]=new KE(r.modelState,r.viewState),n[o++]=i?KE.fromModelState(sI.translateDown(e.cursorConfig,e.model,r.modelState)):KE.fromViewState(sI.translateDown(e.cursorConfig,e,r.viewState))}return n}static addCursorUp(e,t,i){const n=[];let o=0;for(let s=0,r=t.length;s<r;s++){const r=t[s];n[o++]=new KE(r.modelState,r.viewState),n[o++]=i?KE.fromModelState(sI.translateUp(e.cursorConfig,e.model,r.modelState)):KE.fromViewState(sI.translateUp(e.cursorConfig,e,r.viewState))}return n}static moveToBeginningOfLine(e,t,i){let n=[];for(let o=0,s=t.length;o<s;o++){const s=t[o];n[o]=this._moveToLineStart(e,s,i)}return n}static _moveToLineStart(e,t,i){const n=t.viewState.position.column,o=n===t.modelState.position.column,s=t.viewState.position.lineNumber,r=e.getLineFirstNonWhitespaceColumn(s);return o||n===r?this._moveToLineStartByModel(e,t,i):this._moveToLineStartByView(e,t,i)}static _moveToLineStartByView(e,t,i){return KE.fromViewState(sI.moveToBeginningOfLine(e.cursorConfig,e,t.viewState,i))}static _moveToLineStartByModel(e,t,i){return KE.fromModelState(sI.moveToBeginningOfLine(e.cursorConfig,e.model,t.modelState,i))}static moveToEndOfLine(e,t,i,n){const o=[];for(let s=0,r=t.length;s<r;s++){const r=t[s];o[s]=this._moveToLineEnd(e,r,i,n)}return o}static _moveToLineEnd(e,t,i,n){const o=t.viewState.position,s=e.getLineMaxColumn(o.lineNumber),r=o.column===s,a=t.modelState.position,l=e.model.getLineMaxColumn(a.lineNumber),d=s-o.column==l-a.column;return r||d?this._moveToLineEndByModel(e,t,i,n):this._moveToLineEndByView(e,t,i,n)}static _moveToLineEndByView(e,t,i,n){return KE.fromViewState(sI.moveToEndOfLine(e.cursorConfig,e,t.viewState,i,n))}static _moveToLineEndByModel(e,t,i,n){return KE.fromModelState(sI.moveToEndOfLine(e.cursorConfig,e.model,t.modelState,i,n))}static expandLineSelection(e,t){const i=[];for(let n=0,o=t.length;n<o;n++){const o=t[n],s=o.modelState.selection.startLineNumber,r=e.model.getLineCount();let a,l=o.modelState.selection.endLineNumber;l===r?a=e.model.getLineMaxColumn(r):(l++,a=1),i[n]=KE.fromModelState(new ZE(new qo(s,1,s,1),0,new er(l,a),0))}return i}static moveToBeginningOfBuffer(e,t,i){const n=[];for(let o=0,s=t.length;o<s;o++){const s=t[o];n[o]=KE.fromModelState(sI.moveToBeginningOfBuffer(e.cursorConfig,e.model,s.modelState,i))}return n}static moveToEndOfBuffer(e,t,i){const n=[];for(let o=0,s=t.length;o<s;o++){const s=t[o];n[o]=KE.fromModelState(sI.moveToEndOfBuffer(e.cursorConfig,e.model,s.modelState,i))}return n}static selectAll(e,t){const i=e.model.getLineCount(),n=e.model.getLineMaxColumn(i);return KE.fromModelState(new ZE(new qo(1,1,1,1),0,new er(i,n),0))}static line(e,t,i,n,o){const s=e.model.validatePosition(n),r=o?e.coordinatesConverter.validateViewPosition(new er(o.lineNumber,o.column),s):e.coordinatesConverter.convertModelPositionToViewPosition(s);if(!i||!t.modelState.hasSelection()){const t=e.model.getLineCount();let i=s.lineNumber+1,n=1;return i>t&&(i=t,n=e.model.getLineMaxColumn(i)),KE.fromModelState(new ZE(new qo(s.lineNumber,1,i,n),0,new er(i,n),0))}const a=t.modelState.selectionStart.getStartPosition().lineNumber;if(s.lineNumber<a)return KE.fromViewState(t.viewState.move(t.modelState.hasSelection(),r.lineNumber,1,0));if(s.lineNumber>a){const i=e.getLineCount();let n=r.lineNumber+1,o=1;return n>i&&(n=i,o=e.getLineMaxColumn(n)),KE.fromViewState(t.viewState.move(t.modelState.hasSelection(),n,o,0))}{const e=t.modelState.selectionStart.getEndPosition();return KE.fromModelState(t.modelState.move(t.modelState.hasSelection(),e.lineNumber,e.column,0))}}static word(e,t,i,n){const o=e.model.validatePosition(n);return KE.fromModelState(aI.word(e.cursorConfig,e.model,t.modelState,i,o))}static cancelSelection(e,t){if(!t.modelState.hasSelection())return new KE(t.modelState,t.viewState);const i=t.viewState.position.lineNumber,n=t.viewState.position.column;return KE.fromViewState(new ZE(new qo(i,n,i,n),0,new er(i,n),0))}static moveTo(e,t,i,n,o){const s=e.model.validatePosition(n),r=o?e.coordinatesConverter.validateViewPosition(new er(o.lineNumber,o.column),s):e.coordinatesConverter.convertModelPositionToViewPosition(s);return KE.fromViewState(t.viewState.move(i,r.lineNumber,r.column,0))}static simpleMove(e,t,i,n,o,s){switch(i){case 0:return 4===s?this._moveHalfLineLeft(e,t,n):this._moveLeft(e,t,n,o);case 1:return 4===s?this._moveHalfLineRight(e,t,n):this._moveRight(e,t,n,o);case 2:return 2===s?this._moveUpByViewLines(e,t,n,o):this._moveUpByModelLines(e,t,n,o);case 3:return 2===s?this._moveDownByViewLines(e,t,n,o):this._moveDownByModelLines(e,t,n,o);case 4:return 2===s?t.map((t=>KE.fromViewState(sI.moveToPrevBlankLine(e.cursorConfig,e,t.viewState,n)))):t.map((t=>KE.fromModelState(sI.moveToPrevBlankLine(e.cursorConfig,e.model,t.modelState,n))));case 5:return 2===s?t.map((t=>KE.fromViewState(sI.moveToNextBlankLine(e.cursorConfig,e,t.viewState,n)))):t.map((t=>KE.fromModelState(sI.moveToNextBlankLine(e.cursorConfig,e.model,t.modelState,n))));case 6:return this._moveToViewMinColumn(e,t,n);case 7:return this._moveToViewFirstNonWhitespaceColumn(e,t,n);case 8:return this._moveToViewCenterColumn(e,t,n);case 9:return this._moveToViewMaxColumn(e,t,n);case 10:return this._moveToViewLastNonWhitespaceColumn(e,t,n);default:return null}}static viewportMove(e,t,i,n,o){const s=e.getCompletelyVisibleViewRange(),r=e.coordinatesConverter.convertViewRangeToModelRange(s);switch(i){case 11:{const i=this._firstLineNumberInRange(e.model,r,o),s=e.model.getLineFirstNonWhitespaceColumn(i);return[this._moveToModelPosition(e,t[0],n,i,s)]}case 13:{const i=this._lastLineNumberInRange(e.model,r,o),s=e.model.getLineFirstNonWhitespaceColumn(i);return[this._moveToModelPosition(e,t[0],n,i,s)]}case 12:{const i=Math.round((r.startLineNumber+r.endLineNumber)/2),o=e.model.getLineFirstNonWhitespaceColumn(i);return[this._moveToModelPosition(e,t[0],n,i,o)]}case 14:{const i=[];for(let o=0,r=t.length;o<r;o++){const r=t[o];i[o]=this.findPositionInViewportIfOutside(e,r,s,n)}return i}default:return null}}static findPositionInViewportIfOutside(e,t,i,n){const o=t.viewState.position.lineNumber;if(i.startLineNumber<=o&&o<=i.endLineNumber-1)return new KE(t.modelState,t.viewState);{let s;s=o>i.endLineNumber-1?i.endLineNumber-1:o<i.startLineNumber?i.startLineNumber:o;const r=sI.vertical(e.cursorConfig,e,o,t.viewState.position.column,t.viewState.leftoverVisibleColumns,s,!1);return KE.fromViewState(t.viewState.move(n,r.lineNumber,r.column,r.leftoverVisibleColumns))}}static _firstLineNumberInRange(e,t,i){let n=t.startLineNumber;return t.startColumn!==e.getLineMinColumn(n)&&n++,Math.min(t.endLineNumber,n+i-1)}static _lastLineNumberInRange(e,t,i){let n=t.startLineNumber;return t.startColumn!==e.getLineMinColumn(n)&&n++,Math.max(n,t.endLineNumber-i+1)}static _moveLeft(e,t,i,n){return t.map((t=>KE.fromViewState(sI.moveLeft(e.cursorConfig,e,t.viewState,i,n))))}static _moveHalfLineLeft(e,t,i){const n=[];for(let o=0,s=t.length;o<s;o++){const s=t[o],r=s.viewState.position.lineNumber,a=Math.round(e.getLineContent(r).length/2);n[o]=KE.fromViewState(sI.moveLeft(e.cursorConfig,e,s.viewState,i,a))}return n}static _moveRight(e,t,i,n){return t.map((t=>KE.fromViewState(sI.moveRight(e.cursorConfig,e,t.viewState,i,n))))}static _moveHalfLineRight(e,t,i){const n=[];for(let o=0,s=t.length;o<s;o++){const s=t[o],r=s.viewState.position.lineNumber,a=Math.round(e.getLineContent(r).length/2);n[o]=KE.fromViewState(sI.moveRight(e.cursorConfig,e,s.viewState,i,a))}return n}static _moveDownByViewLines(e,t,i,n){const o=[];for(let s=0,r=t.length;s<r;s++){const r=t[s];o[s]=KE.fromViewState(sI.moveDown(e.cursorConfig,e,r.viewState,i,n))}return o}static _moveDownByModelLines(e,t,i,n){const o=[];for(let s=0,r=t.length;s<r;s++){const r=t[s];o[s]=KE.fromModelState(sI.moveDown(e.cursorConfig,e.model,r.modelState,i,n))}return o}static _moveUpByViewLines(e,t,i,n){const o=[];for(let s=0,r=t.length;s<r;s++){const r=t[s];o[s]=KE.fromViewState(sI.moveUp(e.cursorConfig,e,r.viewState,i,n))}return o}static _moveUpByModelLines(e,t,i,n){const o=[];for(let s=0,r=t.length;s<r;s++){const r=t[s];o[s]=KE.fromModelState(sI.moveUp(e.cursorConfig,e.model,r.modelState,i,n))}return o}static _moveToViewPosition(e,t,i,n,o){return KE.fromViewState(t.viewState.move(i,n,o,0))}static _moveToModelPosition(e,t,i,n,o){return KE.fromModelState(t.modelState.move(i,n,o,0))}static _moveToViewMinColumn(e,t,i){const n=[];for(let o=0,s=t.length;o<s;o++){const s=t[o],r=s.viewState.position.lineNumber,a=e.getLineMinColumn(r);n[o]=this._moveToViewPosition(e,s,i,r,a)}return n}static _moveToViewFirstNonWhitespaceColumn(e,t,i){const n=[];for(let o=0,s=t.length;o<s;o++){const s=t[o],r=s.viewState.position.lineNumber,a=e.getLineFirstNonWhitespaceColumn(r);n[o]=this._moveToViewPosition(e,s,i,r,a)}return n}static _moveToViewCenterColumn(e,t,i){const n=[];for(let o=0,s=t.length;o<s;o++){const s=t[o],r=s.viewState.position.lineNumber,a=Math.round((e.getLineMaxColumn(r)+e.getLineMinColumn(r))/2);n[o]=this._moveToViewPosition(e,s,i,r,a)}return n}static _moveToViewMaxColumn(e,t,i){const n=[];for(let o=0,s=t.length;o<s;o++){const s=t[o],r=s.viewState.position.lineNumber,a=e.getLineMaxColumn(r);n[o]=this._moveToViewPosition(e,s,i,r,a)}return n}static _moveToViewLastNonWhitespaceColumn(e,t,i){const n=[];for(let o=0,s=t.length;o<s;o++){const s=t[o],r=s.viewState.position.lineNumber,a=e.getLineLastNonWhitespaceColumn(r);n[o]=this._moveToViewPosition(e,s,i,r,a)}return n}}var hI;!function(e){e.description={description:"Move cursor to a logical position in the view",args:[{name:"Cursor move argument object",description:"Property-value pairs that can be passed through this argument:\n\t\t\t\t\t* 'to': A mandatory logical position value providing where to move the cursor.\n\t\t\t\t\t\t```\n\t\t\t\t\t\t'left', 'right', 'up', 'down', 'prevBlankLine', 'nextBlankLine',\n\t\t\t\t\t\t'wrappedLineStart', 'wrappedLineEnd', 'wrappedLineColumnCenter'\n\t\t\t\t\t\t'wrappedLineFirstNonWhitespaceCharacter', 'wrappedLineLastNonWhitespaceCharacter'\n\t\t\t\t\t\t'viewPortTop', 'viewPortCenter', 'viewPortBottom', 'viewPortIfOutside'\n\t\t\t\t\t\t```\n\t\t\t\t\t* 'by': Unit to move. Default is computed based on 'to' value.\n\t\t\t\t\t\t```\n\t\t\t\t\t\t'line', 'wrappedLine', 'character', 'halfLine'\n\t\t\t\t\t\t```\n\t\t\t\t\t* 'value': Number of units to move. Default is '1'.\n\t\t\t\t\t* 'select': If 'true' makes the selection. Default is 'false'.\n\t\t\t\t",constraint:function(e){if(!Zs(e))return!1;const t=e;return!!Gs(t.to)&&(!(!fr(t.select)&&!_r(t.select))&&(!(!fr(t.by)&&!Gs(t.by))&&!(!fr(t.value)&&!vr(t.value))))},schema:{type:"object",required:["to"],properties:{to:{type:"string",enum:["left","right","up","down","prevBlankLine","nextBlankLine","wrappedLineStart","wrappedLineEnd","wrappedLineColumnCenter","wrappedLineFirstNonWhitespaceCharacter","wrappedLineLastNonWhitespaceCharacter","viewPortTop","viewPortCenter","viewPortBottom","viewPortIfOutside"]},by:{type:"string",enum:["line","wrappedLine","character","halfLine"]},value:{type:"number",default:1},select:{type:"boolean",default:!1}}}}]},e.RawDirection={Left:"left",Right:"right",Up:"up",Down:"down",PrevBlankLine:"prevBlankLine",NextBlankLine:"nextBlankLine",WrappedLineStart:"wrappedLineStart",WrappedLineFirstNonWhitespaceCharacter:"wrappedLineFirstNonWhitespaceCharacter",WrappedLineColumnCenter:"wrappedLineColumnCenter",WrappedLineEnd:"wrappedLineEnd",WrappedLineLastNonWhitespaceCharacter:"wrappedLineLastNonWhitespaceCharacter",ViewPortTop:"viewPortTop",ViewPortCenter:"viewPortCenter",ViewPortBottom:"viewPortBottom",ViewPortIfOutside:"viewPortIfOutside"},e.RawUnit={Line:"line",WrappedLine:"wrappedLine",Character:"character",HalfLine:"halfLine"},e.parse=function(t){if(!t.to)return null;let i;switch(t.to){case e.RawDirection.Left:i=0;break;case e.RawDirection.Right:i=1;break;case e.RawDirection.Up:i=2;break;case e.RawDirection.Down:i=3;break;case e.RawDirection.PrevBlankLine:i=4;break;case e.RawDirection.NextBlankLine:i=5;break;case e.RawDirection.WrappedLineStart:i=6;break;case e.RawDirection.WrappedLineFirstNonWhitespaceCharacter:i=7;break;case e.RawDirection.WrappedLineColumnCenter:i=8;break;case e.RawDirection.WrappedLineEnd:i=9;break;case e.RawDirection.WrappedLineLastNonWhitespaceCharacter:i=10;break;case e.RawDirection.ViewPortTop:i=11;break;case e.RawDirection.ViewPortBottom:i=13;break;case e.RawDirection.ViewPortCenter:i=12;break;case e.RawDirection.ViewPortIfOutside:i=14;break;default:return null}let n=0;switch(t.by){case e.RawUnit.Line:n=1;break;case e.RawUnit.WrappedLine:n=2;break;case e.RawUnit.Character:n=3;break;case e.RawUnit.HalfLine:n=4}return{direction:i,unit:n,select:!!t.select,value:t.value||1}}}(hI||(hI={}));const uI=Object.create(null);function gI(e,t){if(t<=0)return"";uI[e]||(uI[e]=["",e]);const i=uI[e];for(let n=i.length;n<=t;n++)i[n]=i[n-1]+e;return i[t]}class pI{constructor(e,t){this._opts=t,this._selection=e,this._selectionId=null,this._useLastEditRangeForCursorEndPosition=!1,this._selectionStartColumnStaysPut=!1}static unshiftIndent(e,t,i,n,o){const s=dN.visibleColumnFromColumn(e,t,i);if(o){const e=gI(" ",n);return gI(e,dN.prevIndentTabStop(s,n)/n)}return gI("\t",dN.prevRenderTabStop(s,i)/i)}static shiftIndent(e,t,i,n,o){const s=dN.visibleColumnFromColumn(e,t,i);if(o){const e=gI(" ",n);return gI(e,dN.nextIndentTabStop(s,n)/n)}return gI("\t",dN.nextRenderTabStop(s,i)/i)}_addEditOperation(e,t,i){this._useLastEditRangeForCursorEndPosition?e.addTrackedEditOperation(t,i):e.addEditOperation(t,i)}getEditOperations(e,t){const i=this._selection.startLineNumber;let n=this._selection.endLineNumber;1===this._selection.endColumn&&i!==n&&(n-=1);const{tabSize:o,indentSize:s,insertSpaces:r}=this._opts,a=i===n;if(this._opts.useTabStops){this._selection.isEmpty()&&/^\s*$/.test(e.getLineContent(i))&&(this._useLastEditRangeForCursorEndPosition=!0);let l=0,d=0;for(let c=i;c<=n;c++,l=d){d=0;const n=e.getLineContent(c);let h,u=xs(n);if((!this._opts.isUnshift||0!==n.length&&0!==u)&&(a||this._opts.isUnshift||0!==n.length)){if(-1===u&&(u=n.length),c>1){if(dN.visibleColumnFromColumn(n,u+1,o)%s!=0&&e.isCheapToTokenize(c-1)){const t=Wv.getEnterAction(this._opts.autoIndent,e,new qo(c-1,e.getLineMaxColumn(c-1),c-1,e.getLineMaxColumn(c-1)));if(t){if(d=l,t.appendText)for(let e=0,i=t.appendText.length;e<i&&d<s&&32===t.appendText.charCodeAt(e);e++)d++;t.removeText&&(d=Math.max(0,d-t.removeText));for(let e=0;e<d&&(0!==u&&32===n.charCodeAt(u-1));e++)u--}}}this._opts.isUnshift&&0===u||(h=this._opts.isUnshift?pI.unshiftIndent(n,u+1,o,s,r):pI.shiftIndent(n,u+1,o,s,r),this._addEditOperation(t,new qo(c,1,c,u+1),h),c!==i||this._selection.isEmpty()||(this._selectionStartColumnStaysPut=this._selection.startColumn<=u+1))}}}else{!this._opts.isUnshift&&this._selection.isEmpty()&&0===e.getLineLength(i)&&(this._useLastEditRangeForCursorEndPosition=!0);const o=r?gI(" ",s):"\t";for(let r=i;r<=n;r++){const n=e.getLineContent(r);let l=xs(n);if((!this._opts.isUnshift||0!==n.length&&0!==l)&&((a||this._opts.isUnshift||0!==n.length)&&(-1===l&&(l=n.length),!this._opts.isUnshift||0!==l)))if(this._opts.isUnshift){l=Math.min(l,s);for(let e=0;e<l;e++){if(9===n.charCodeAt(e)){l=e+1;break}}this._addEditOperation(t,new qo(r,1,r,l+1),"")}else this._addEditOperation(t,new qo(r,1,r,1),o),r!==i||this._selection.isEmpty()||(this._selectionStartColumnStaysPut=1===this._selection.startColumn)}}this._selectionId=t.trackSelection(this._selection)}computeCursorState(e,t){if(this._useLastEditRangeForCursorEndPosition){const e=t.getInverseEditOperations()[0];return new ar(e.range.endLineNumber,e.range.endColumn,e.range.endLineNumber,e.range.endColumn)}const i=t.getTrackedSelection(this._selectionId);if(this._selectionStartColumnStaysPut){const e=this._selection.startColumn;return i.startColumn<=e?i:0===i.getDirection()?new ar(i.startLineNumber,e,i.endLineNumber,i.endColumn):new ar(i.endLineNumber,i.endColumn,i.startLineNumber,e)}return i}}class mI{constructor(e,t,i){this._range=e,this._charBeforeSelection=t,this._charAfterSelection=i}getEditOperations(e,t){t.addTrackedEditOperation(new qo(this._range.startLineNumber,this._range.startColumn,this._range.startLineNumber,this._range.startColumn),this._charBeforeSelection),t.addTrackedEditOperation(new qo(this._range.endLineNumber,this._range.endColumn,this._range.endLineNumber,this._range.endColumn),this._charAfterSelection)}computeCursorState(e,t){const i=t.getInverseEditOperations(),n=i[0].range,o=i[1].range;return new ar(n.endLineNumber,n.endColumn,o.endLineNumber,o.endColumn-this._charAfterSelection.length)}}class fI{static indent(e,t,i){if(null===t||null===i)return[];const n=[];for(let o=0,s=i.length;o<s;o++)n[o]=new pI(i[o],{isUnshift:!1,tabSize:e.tabSize,indentSize:e.indentSize,insertSpaces:e.insertSpaces,useTabStops:e.useTabStops,autoIndent:e.autoIndent});return n}static outdent(e,t,i){const n=[];for(let o=0,s=i.length;o<s;o++)n[o]=new pI(i[o],{isUnshift:!0,tabSize:e.tabSize,indentSize:e.indentSize,insertSpaces:e.insertSpaces,useTabStops:e.useTabStops,autoIndent:e.autoIndent});return n}static shiftIndent(e,t,i){return i=i||1,pI.shiftIndent(t,t.length+i,e.tabSize,e.indentSize,e.insertSpaces)}static unshiftIndent(e,t,i){return i=i||1,pI.unshiftIndent(t,t.length+i,e.tabSize,e.indentSize,e.insertSpaces)}static _distributedPaste(e,t,i,n){const o=[];for(let s=0,r=i.length;s<r;s++)o[s]=new JE(i[s],n[s]);return new YE(0,o,{shouldPushStackElementBefore:!0,shouldPushStackElementAfter:!0})}static _simplePaste(e,t,i,n,o){const s=[];for(let r=0,a=i.length;r<a;r++){const e=i[r],t=e.getPosition();if(o&&!e.isEmpty()&&(o=!1),o&&n.indexOf("\n")!==n.length-1&&(o=!1),o){const i=new qo(t.lineNumber,1,t.lineNumber,1);s[r]=new nI(i,n,e,!0)}else s[r]=new JE(e,n)}return new YE(0,s,{shouldPushStackElementBefore:!0,shouldPushStackElementAfter:!0})}static _distributePasteToCursors(e,t,i,n,o){if(n)return null;if(1===t.length)return null;if(o&&o.length===t.length)return o;if("spread"===e.multiCursorPaste){10===i.charCodeAt(i.length-1)&&(i=i.substr(0,i.length-1)),13===i.charCodeAt(i.length-1)&&(i=i.substr(0,i.length-1));const e=Is(i);if(e.length===t.length)return e}return null}static paste(e,t,i,n,o,s){const r=this._distributePasteToCursors(e,i,n,o,s);return r?(i=i.sort(qo.compareRangesUsingStarts),this._distributedPaste(e,t,i,r)):this._simplePaste(e,t,i,n,o)}static _goodIndentForLine(e,t,i){let n=null,o="";const s=Wv.getInheritIndentForLine(e.autoIndent,t,i,!1);if(s)n=s.action,o=s.indentation;else if(i>1){let n;for(n=i-1;n>=1;n--){const e=t.getLineContent(n);if(Ss(e)>=0)break}if(n<1)return null;const s=t.getLineMaxColumn(n),r=Wv.getEnterAction(e.autoIndent,t,new qo(n,s,n,s));r&&(o=r.indentation+r.appendText)}return n&&(n===A_.Indent&&(o=fI.shiftIndent(e,o)),n===A_.Outdent&&(o=fI.unshiftIndent(e,o)),o=e.normalizeIndentation(o)),o||null}static _replaceJumpToNextIndent(e,t,i,n){let o="";const s=i.getStartPosition();if(e.insertSpaces){const i=e.visibleColumnFromColumn(t,s),n=e.indentSize,r=n-i%n;for(let e=0;e<r;e++)o+=" "}else o="\t";return new JE(i,o,n)}static tab(e,t,i){const n=[];for(let o=0,s=i.length;o<s;o++){const s=i[o];if(s.isEmpty()){const i=t.getLineContent(s.startLineNumber);if(/^\s*$/.test(i)&&t.isCheapToTokenize(s.startLineNumber)){let r=this._goodIndentForLine(e,t,s.startLineNumber);r=r||"\t";const a=e.normalizeIndentation(r);if(!i.startsWith(a)){n[o]=new JE(new qo(s.startLineNumber,1,s.startLineNumber,i.length+1),a,!0);continue}}n[o]=this._replaceJumpToNextIndent(e,t,s,!0)}else{if(s.startLineNumber===s.endLineNumber){const i=t.getLineMaxColumn(s.startLineNumber);if(1!==s.startColumn||s.endColumn!==i){n[o]=this._replaceJumpToNextIndent(e,t,s,!1);continue}}n[o]=new pI(s,{isUnshift:!1,tabSize:e.tabSize,indentSize:e.indentSize,insertSpaces:e.insertSpaces,useTabStops:e.useTabStops,autoIndent:e.autoIndent})}}return n}static compositionType(e,t,i,n,o,s,r,a){const l=n.map((e=>this._compositionType(i,e,o,s,r,a)));return new YE(4,l,{shouldPushStackElementBefore:bI(e,4),shouldPushStackElementAfter:!1})}static _compositionType(e,t,i,n,o,s){if(!t.isEmpty())return null;const r=t.getPosition(),a=Math.max(1,r.column-n),l=Math.min(e.getLineMaxColumn(r.lineNumber),r.column+o),d=new qo(r.lineNumber,a,r.lineNumber,l);return e.getValueInRange(d)===i&&0===s?null:new iI(d,i,0,s)}static _typeCommand(e,t,i){return i?new tI(e,t,!0):new JE(e,t,!0)}static _enter(e,t,i,n){if(0===e.autoIndent)return fI._typeCommand(n,"\n",i);if(!t.isCheapToTokenize(n.getStartPosition().lineNumber)||1===e.autoIndent){const o=t.getLineContent(n.startLineNumber),s=ts(o).substring(0,n.startColumn-1);return fI._typeCommand(n,"\n"+e.normalizeIndentation(s),i)}const o=Wv.getEnterAction(e.autoIndent,t,n);if(o){if(o.indentAction===A_.None)return fI._typeCommand(n,"\n"+e.normalizeIndentation(o.indentation+o.appendText),i);if(o.indentAction===A_.Indent)return fI._typeCommand(n,"\n"+e.normalizeIndentation(o.indentation+o.appendText),i);if(o.indentAction===A_.IndentOutdent){const t=e.normalizeIndentation(o.indentation),s=e.normalizeIndentation(o.indentation+o.appendText),r="\n"+s+"\n"+t;return i?new tI(n,r,!0):new iI(n,r,-1,s.length-t.length,!0)}if(o.indentAction===A_.Outdent){const t=fI.unshiftIndent(e,o.indentation);return fI._typeCommand(n,"\n"+e.normalizeIndentation(t+o.appendText),i)}}const s=t.getLineContent(n.startLineNumber),r=ts(s).substring(0,n.startColumn-1);if(e.autoIndent>=4){const o=Wv.getIndentForEnter(e.autoIndent,t,n,{unshiftIndent:t=>fI.unshiftIndent(e,t),shiftIndent:t=>fI.shiftIndent(e,t),normalizeIndentation:t=>e.normalizeIndentation(t)});if(o){let s=e.visibleColumnFromColumn(t,n.getEndPosition());const r=n.endColumn,a=t.getLineContent(n.endLineNumber),l=xs(a);if(n=l>=0?n.setEndPosition(n.endLineNumber,Math.max(n.endColumn,l+1)):n.setEndPosition(n.endLineNumber,t.getLineMaxColumn(n.endLineNumber)),i)return new tI(n,"\n"+e.normalizeIndentation(o.afterEnter),!0);{let t=0;return r<=l+1&&(e.insertSpaces||(s=Math.ceil(s/e.indentSize)),t=Math.min(s+1-e.normalizeIndentation(o.afterEnter).length-1,0)),new iI(n,"\n"+e.normalizeIndentation(o.afterEnter),0,t,!0)}}}return fI._typeCommand(n,"\n"+e.normalizeIndentation(r),i)}static _isAutoIndentType(e,t,i){if(e.autoIndent<4)return!1;for(let n=0,o=i.length;n<o;n++)if(!t.isCheapToTokenize(i[n].getEndPosition().lineNumber))return!1;return!0}static _runAutoIndentType(e,t,i,n){const o=Wv.getIndentationAtPosition(t,i.startLineNumber,i.startColumn),s=Wv.getIndentActionForType(e.autoIndent,t,i,n,{shiftIndent:t=>fI.shiftIndent(e,t),unshiftIndent:t=>fI.unshiftIndent(e,t)});if(null===s)return null;if(s!==e.normalizeIndentation(o)){const o=t.getLineFirstNonWhitespaceColumn(i.startLineNumber);return 0===o?fI._typeCommand(new qo(i.startLineNumber,1,i.endLineNumber,i.endColumn),e.normalizeIndentation(s)+n,!1):fI._typeCommand(new qo(i.startLineNumber,1,i.endLineNumber,i.endColumn),e.normalizeIndentation(s)+t.getLineContent(i.startLineNumber).substring(o-1,i.startColumn-1)+n,!1)}return null}static _isAutoClosingOvertype(e,t,i,n,o){if("never"===e.autoClosingOvertype)return!1;if(!e.autoClosingPairs.autoClosingPairsCloseSingleChar.has(o))return!1;for(let s=0,r=i.length;s<r;s++){const r=i[s];if(!r.isEmpty())return!1;const a=r.getPosition(),l=t.getLineContent(a.lineNumber);if(l.charAt(a.column-1)!==o)return!1;const d=XE(o);if(92===(a.column>2?l.charCodeAt(a.column-2):0)&&d)return!1;if("auto"===e.autoClosingOvertype){let e=!1;for(let t=0,i=n.length;t<i;t++){const i=n[t];if(a.lineNumber===i.startLineNumber&&a.column===i.startColumn){e=!0;break}}if(!e)return!1}}return!0}static _runAutoClosingOvertype(e,t,i,n,o){const s=[];for(let r=0,a=n.length;r<a;r++){const e=n[r].getPosition(),t=new qo(e.lineNumber,e.column,e.lineNumber,e.column+1);s[r]=new JE(t,o)}return new YE(4,s,{shouldPushStackElementBefore:bI(e,4),shouldPushStackElementAfter:!1})}static _isBeforeClosingBrace(e,t){const i=t.charAt(0),n=e.autoClosingPairs.autoClosingPairsOpenByStart.get(i)||[],o=e.autoClosingPairs.autoClosingPairsCloseByStart.get(i)||[],s=n.some((e=>t.startsWith(e.open))),r=o.some((e=>t.startsWith(e.close)));return!s&&r}static _findAutoClosingPairOpen(e,t,i,n){const o=e.autoClosingPairs.autoClosingPairsOpenByEnd.get(n);if(!o)return null;let s=null;for(const r of o)if(null===s||r.open.length>s.open.length){let e=!0;for(const o of i){if(t.getValueInRange(new qo(o.lineNumber,o.column-r.open.length+1,o.lineNumber,o.column))+n!==r.open){e=!1;break}}e&&(s=r)}return s}static _findContainedAutoClosingPair(e,t){if(t.open.length<=1)return null;const i=t.close.charAt(t.close.length-1),n=e.autoClosingPairs.autoClosingPairsCloseByEnd.get(i)||[];let o=null;for(const s of n)s.open!==t.open&&t.open.includes(s.open)&&t.close.endsWith(s.close)&&(!o||s.open.length>o.open.length)&&(o=s);return o}static _getAutoClosingPairClose(e,t,i,n,o){const s=XE(n),r=s?e.autoClosingQuotes:e.autoClosingBrackets,a=s?e.shouldAutoCloseBefore.quote:e.shouldAutoCloseBefore.bracket;if("never"===r)return null;for(const g of i)if(!g.isEmpty())return null;const l=i.map((e=>{const t=e.getPosition();return o?{lineNumber:t.lineNumber,beforeColumn:t.column-n.length,afterColumn:t.column}:{lineNumber:t.lineNumber,beforeColumn:t.column,afterColumn:t.column}})),d=this._findAutoClosingPairOpen(e,t,l.map((e=>new er(e.lineNumber,e.beforeColumn))),n);if(!d)return null;const c=this._findContainedAutoClosingPair(e,d),h=c?c.close:"";let u=!0;for(const g of l){const{lineNumber:i,beforeColumn:o,afterColumn:s}=g,l=t.getLineContent(i),c=l.substring(0,o-1),p=l.substring(s-1);if(p.startsWith(h)||(u=!1),p.length>0){const t=p.charAt(0);if(!fI._isBeforeClosingBrace(e,p)&&!a(t))return null}if(1===d.open.length&&("'"===n||'"'===n)&&"always"!==r){const t=cr(e.wordSeparators);if(c.length>0){const e=c.charCodeAt(c.length-1);if(0===t.get(e))return null}}if(!t.isCheapToTokenize(i))return null;t.forceTokenization(i);const m=F_(t.getLineTokens(i),o-1);if(!d.shouldAutoClose(m,o-m.firstCharOffset))return null;const f=d.findNeutralCharacter();if(f){const e=t.getTokenTypeIfInsertingCharacter(i,o,f);if(!d.isOK(e))return null}}return u?d.close.substring(0,d.close.length-h.length):d.close}static _runAutoClosingOpenCharType(e,t,i,n,o,s,r){const a=[];for(let l=0,d=n.length;l<d;l++){const e=n[l];a[l]=new _I(e,o,!s,r)}return new YE(4,a,{shouldPushStackElementBefore:!0,shouldPushStackElementAfter:!1})}static _shouldSurroundChar(e,t){return XE(t)?"quotes"===e.autoSurround||"languageDefined"===e.autoSurround:"brackets"===e.autoSurround||"languageDefined"===e.autoSurround}static _isSurroundSelectionType(e,t,i,n){if(!fI._shouldSurroundChar(e,n)||!e.surroundingPairs.hasOwnProperty(n))return!1;const o=XE(n);for(let s=0,r=i.length;s<r;s++){const e=i[s];if(e.isEmpty())return!1;let n=!0;for(let i=e.startLineNumber;i<=e.endLineNumber;i++){const o=t.getLineContent(i),s=i===e.startLineNumber?e.startColumn-1:0,r=i===e.endLineNumber?e.endColumn-1:o.length,a=o.substring(s,r);if(/[^ \t]/.test(a)){n=!1;break}}if(n)return!1;if(o&&e.startLineNumber===e.endLineNumber&&e.startColumn+1===e.endColumn){if(XE(t.getValueInRange(e)))return!1}}return!0}static _runSurroundSelectionType(e,t,i,n,o){const s=[];for(let r=0,a=n.length;r<a;r++){const e=n[r],i=t.surroundingPairs[o];s[r]=new mI(e,o,i)}return new YE(0,s,{shouldPushStackElementBefore:!0,shouldPushStackElementAfter:!0})}static _isTypeInterceptorElectricChar(e,t,i){return!(1!==i.length||!t.isCheapToTokenize(i[0].getEndPosition().lineNumber))}static _typeInterceptorElectricChar(e,t,i,n,o){if(!t.electricChars.hasOwnProperty(o)||!n.isEmpty())return null;const s=n.getPosition();i.forceTokenization(s.lineNumber);const r=i.getLineTokens(s.lineNumber);let a;try{a=t.onElectricCharacter(o,r,s.column)}catch(l){return Jo(l),null}if(!a)return null;if(a.matchOpenBracket){const n=(r.getLineContent()+o).lastIndexOf(a.matchOpenBracket)+1,l=i.bracketPairs.findMatchingBracketUp(a.matchOpenBracket,{lineNumber:s.lineNumber,column:n},500);if(l){if(l.startLineNumber===s.lineNumber)return null;const n=i.getLineContent(l.startLineNumber),r=ts(n),a=t.normalizeIndentation(r),d=i.getLineContent(s.lineNumber),c=i.getLineFirstNonWhitespaceColumn(s.lineNumber)||s.column,h=a+d.substring(c-1,s.column-1)+o,u=new qo(s.lineNumber,1,s.lineNumber,s.column),g=new JE(u,h);return new YE(vI(h,e),[g],{shouldPushStackElementBefore:!1,shouldPushStackElementAfter:!0})}}return null}static compositionEndWithInterceptors(e,t,i,n,o,s){if(!n||ar.selectionsArrEqual(n,o))return null;let r=null;for(const l of o){if(!l.isEmpty())return null;const e=l.getPosition(),t=i.getValueInRange(new qo(e.lineNumber,e.column-1,e.lineNumber,e.column));if(null===r)r=t;else if(r!==t)return null}if(!r)return null;if(this._isAutoClosingOvertype(t,i,o,s,r)){const e=o.map((e=>new JE(new qo(e.positionLineNumber,e.positionColumn,e.positionLineNumber,e.positionColumn+1),"",!1)));return new YE(4,e,{shouldPushStackElementBefore:!0,shouldPushStackElementAfter:!1})}const a=this._getAutoClosingPairClose(t,i,o,r,!0);return null!==a?this._runAutoClosingOpenCharType(e,t,i,o,r,!0,a):null}static typeWithInterceptors(e,t,i,n,o,s,r){if(!e&&"\n"===r){const e=[];for(let t=0,s=o.length;t<s;t++)e[t]=fI._enter(i,n,!1,o[t]);return new YE(4,e,{shouldPushStackElementBefore:!0,shouldPushStackElementAfter:!1})}if(!e&&this._isAutoIndentType(i,n,o)){const e=[];let t=!1;for(let s=0,a=o.length;s<a;s++)if(e[s]=this._runAutoIndentType(i,n,o[s],r),!e[s]){t=!0;break}if(!t)return new YE(4,e,{shouldPushStackElementBefore:!0,shouldPushStackElementAfter:!1})}if(!e&&this._isAutoClosingOvertype(i,n,o,s,r))return this._runAutoClosingOvertype(t,i,n,o,r);if(!e){const e=this._getAutoClosingPairClose(i,n,o,r,!1);if(e)return this._runAutoClosingOpenCharType(t,i,n,o,r,!1,e)}if(this._isSurroundSelectionType(i,n,o,r))return this._runSurroundSelectionType(t,i,n,o,r);if(!e&&this._isTypeInterceptorElectricChar(i,n,o)){const e=this._typeInterceptorElectricChar(t,i,n,o[0],r);if(e)return e}const a=[];for(let d=0,c=o.length;d<c;d++)a[d]=new JE(o[d],r);const l=vI(r,t);return new YE(l,a,{shouldPushStackElementBefore:bI(t,l),shouldPushStackElementAfter:!1})}static typeWithoutInterceptors(e,t,i,n,o){const s=[];for(let a=0,l=n.length;a<l;a++)s[a]=new JE(n[a],o);const r=vI(o,e);return new YE(r,s,{shouldPushStackElementBefore:bI(e,r),shouldPushStackElementAfter:!1})}static lineInsertBefore(e,t,i){if(null===t||null===i)return[];const n=[];for(let o=0,s=i.length;o<s;o++){let s=i[o].positionLineNumber;if(1===s)n[o]=new tI(new qo(1,1,1,1),"\n");else{s--;const i=t.getLineMaxColumn(s);n[o]=this._enter(e,t,!1,new qo(s,i,s,i))}}return n}static lineInsertAfter(e,t,i){if(null===t||null===i)return[];const n=[];for(let o=0,s=i.length;o<s;o++){const s=i[o].positionLineNumber,r=t.getLineMaxColumn(s);n[o]=this._enter(e,t,!1,new qo(s,r,s,r))}return n}static lineBreakInsert(e,t,i){const n=[];for(let o=0,s=i.length;o<s;o++)n[o]=this._enter(e,t,!0,i[o]);return n}}class _I extends iI{constructor(e,t,i,n){super(e,(i?t:"")+n,0,-n.length),this._openCharacter=t,this._closeCharacter=n,this.closeCharacterRange=null,this.enclosingRange=null}computeCursorState(e,t){const i=t.getInverseEditOperations()[0].range;return this.closeCharacterRange=new qo(i.startLineNumber,i.endColumn-this._closeCharacter.length,i.endLineNumber,i.endColumn),this.enclosingRange=new qo(i.startLineNumber,i.endColumn-this._openCharacter.length-this._closeCharacter.length,i.endLineNumber,i.endColumn),super.computeCursorState(e,t)}}function vI(e,t){return" "===e?5===t||6===t?6:5:4}function bI(e,t){return!(!CI(e)||CI(t))||5!==e&&wI(e)!==wI(t)}function wI(e){return 6===e||5===e?"space":e}function CI(e){return 4===e||5===e||6===e}var yI;!function(e){e.editorSimpleInput=new Uy("editorSimpleInput",!1,!0),e.editorTextFocus=new Uy("editorTextFocus",!1,mf(0,"Whether the editor text has focus (cursor is blinking)")),e.focus=new Uy("editorFocus",!1,mf(0,"Whether the editor or an editor widget has focus (e.g. focus is in the find widget)")),e.textInputFocus=new Uy("textInputFocus",!1,mf(0,"Whether an editor or a rich text input has focus (cursor is blinking)")),e.readOnly=new Uy("editorReadonly",!1,mf(0,"Whether the editor is read only")),e.inDiffEditor=new Uy("inDiffEditor",!1,mf(0,"Whether the context is a diff editor")),e.columnSelection=new Uy("editorColumnSelection",!1,mf(0,"Whether `editor.columnSelection` is enabled")),e.writable=e.readOnly.toNegated(),e.hasNonEmptySelection=new Uy("editorHasSelection",!1,mf(0,"Whether the editor has text selected")),e.hasOnlyEmptySelection=e.hasNonEmptySelection.toNegated(),e.hasMultipleSelections=new Uy("editorHasMultipleSelections",!1,mf(0,"Whether the editor has multiple selections")),e.hasSingleSelection=e.hasMultipleSelections.toNegated(),e.tabMovesFocus=new Uy("editorTabMovesFocus",!1,mf(0,"Whether `Tab` will move focus out of the editor")),e.tabDoesNotMoveFocus=e.tabMovesFocus.toNegated(),e.isInWalkThroughSnippet=new Uy("isInEmbeddedEditor",!1,!0),e.canUndo=new Uy("canUndo",!1,!0),e.canRedo=new Uy("canRedo",!1,!0),e.hoverVisible=new Uy("editorHoverVisible",!1,mf(0,"Whether the editor hover is visible")),e.inCompositeEditor=new Uy("inCompositeEditor",void 0,mf(0,"Whether the editor is part of a larger editor (e.g. notebooks)")),e.notInCompositeEditor=e.inCompositeEditor.toNegated(),e.languageId=new Uy("editorLangId","",mf(0,"The language identifier of the editor")),e.hasCompletionItemProvider=new Uy("editorHasCompletionItemProvider",!1,mf(0,"Whether the editor has a completion item provider")),e.hasCodeActionsProvider=new Uy("editorHasCodeActionsProvider",!1,mf(0,"Whether the editor has a code actions provider")),e.hasCodeLensProvider=new Uy("editorHasCodeLensProvider",!1,mf(0,"Whether the editor has a code lens provider")),e.hasDefinitionProvider=new Uy("editorHasDefinitionProvider",!1,mf(0,"Whether the editor has a definition provider")),e.hasDeclarationProvider=new Uy("editorHasDeclarationProvider",!1,mf(0,"Whether the editor has a declaration provider")),e.hasImplementationProvider=new Uy("editorHasImplementationProvider",!1,mf(0,"Whether the editor has an implementation provider")),e.hasTypeDefinitionProvider=new Uy("editorHasTypeDefinitionProvider",!1,mf(0,"Whether the editor has a type definition provider")),e.hasHoverProvider=new Uy("editorHasHoverProvider",!1,mf(0,"Whether the editor has a hover provider")),e.hasDocumentHighlightProvider=new Uy("editorHasDocumentHighlightProvider",!1,mf(0,"Whether the editor has a document highlight provider")),e.hasDocumentSymbolProvider=new Uy("editorHasDocumentSymbolProvider",!1,mf(0,"Whether the editor has a document symbol provider")),e.hasReferenceProvider=new Uy("editorHasReferenceProvider",!1,mf(0,"Whether the editor has a reference provider")),e.hasRenameProvider=new Uy("editorHasRenameProvider",!1,mf(0,"Whether the editor has a rename provider")),e.hasSignatureHelpProvider=new Uy("editorHasSignatureHelpProvider",!1,mf(0,"Whether the editor has a signature help provider")),e.hasInlayHintsProvider=new Uy("editorHasInlayHintsProvider",!1,mf(0,"Whether the editor has an inline hints provider")),e.hasDocumentFormattingProvider=new Uy("editorHasDocumentFormattingProvider",!1,mf(0,"Whether the editor has a document formatting provider")),e.hasDocumentSelectionFormattingProvider=new Uy("editorHasDocumentSelectionFormattingProvider",!1,mf(0,"Whether the editor has a document selection formatting provider")),e.hasMultipleDocumentFormattingProvider=new Uy("editorHasMultipleDocumentFormattingProvider",!1,mf(0,"Whether the editor has multiple document formatting providers")),e.hasMultipleDocumentSelectionFormattingProvider=new Uy("editorHasMultipleDocumentSelectionFormattingProvider",!1,mf(0,"Whether the editor has multiple document selection formatting providers"))}(yI||(yI={}));class xI extends yx{runEditorCommand(e,t,i){const n=t._getViewModel();n&&this.runCoreEditorCommand(n,i||{})}}var SI,kI,DI;!function(e){e.description={description:"Scroll editor in the given direction",args:[{name:"Editor scroll argument object",description:"Property-value pairs that can be passed through this argument:\n\t\t\t\t\t* 'to': A mandatory direction value.\n\t\t\t\t\t\t```\n\t\t\t\t\t\t'up', 'down'\n\t\t\t\t\t\t```\n\t\t\t\t\t* 'by': Unit to move. Default is computed based on 'to' value.\n\t\t\t\t\t\t```\n\t\t\t\t\t\t'line', 'wrappedLine', 'page', 'halfPage'\n\t\t\t\t\t\t```\n\t\t\t\t\t* 'value': Number of units to move. Default is '1'.\n\t\t\t\t\t* 'revealCursor': If 'true' reveals the cursor if it is outside view port.\n\t\t\t\t",constraint:function(e){if(!Zs(e))return!1;const t=e;return!!Gs(t.to)&&(!(!fr(t.by)&&!Gs(t.by))&&(!(!fr(t.value)&&!vr(t.value))&&!(!fr(t.revealCursor)&&!_r(t.revealCursor))))},schema:{type:"object",required:["to"],properties:{to:{type:"string",enum:["up","down"]},by:{type:"string",enum:["line","wrappedLine","page","halfPage"]},value:{type:"number",default:1},revealCursor:{type:"boolean"}}}}]},e.RawDirection={Up:"up",Down:"down"},e.RawUnit={Line:"line",WrappedLine:"wrappedLine",Page:"page",HalfPage:"halfPage"},e.parse=function(t){let i,n;switch(t.to){case e.RawDirection.Up:i=1;break;case e.RawDirection.Down:i=2;break;default:return null}switch(t.by){case e.RawUnit.Line:n=1;break;case e.RawUnit.WrappedLine:n=2;break;case e.RawUnit.Page:n=3;break;case e.RawUnit.HalfPage:n=4;break;default:n=2}return{direction:i,unit:n,value:Math.floor(t.value||1),revealCursor:!!t.revealCursor,select:!!t.select}}}(SI||(SI={})),function(e){e.description={description:"Reveal the given line at the given logical position",args:[{name:"Reveal line argument object",description:"Property-value pairs that can be passed through this argument:\n\t\t\t\t\t* 'lineNumber': A mandatory line number value.\n\t\t\t\t\t* 'at': Logical position at which line has to be revealed.\n\t\t\t\t\t\t```\n\t\t\t\t\t\t'top', 'center', 'bottom'\n\t\t\t\t\t\t```\n\t\t\t\t",constraint:function(e){if(!Zs(e))return!1;const t=e;return!(!vr(t.lineNumber)&&!Gs(t.lineNumber))&&!(!fr(t.at)&&!Gs(t.at))},schema:{type:"object",required:["lineNumber"],properties:{lineNumber:{type:["number","string"]},at:{type:"string",enum:["top","center","bottom"]}}}}]},e.RawAtArgument={Top:"top",Center:"center",Bottom:"bottom"}}(kI||(kI={}));class LI{constructor(e){e.addImplementation(1e4,"code-editor",((e,t)=>{const i=e.get(N_).getFocusedCodeEditor();return!(!i||!i.hasTextFocus())&&this._runEditorCommand(e,i,t)})),e.addImplementation(1e3,"generic-dom-input-textarea",((e,t)=>{const i=document.activeElement;return!!(i&&["input","textarea"].indexOf(i.tagName.toLowerCase())>=0)&&(this.runDOMCommand(),!0)})),e.addImplementation(0,"generic-dom",((e,t)=>{const i=e.get(N_).getActiveCodeEditor();return!!i&&(i.focus(),this._runEditorCommand(e,i,t))}))}_runEditorCommand(e,t,i){const n=this.runEditorCommand(e,t,i);return n||!0}}!function(e){class t extends xI{constructor(e){super(e),this._minimalReveal=e.minimalReveal,this._inSelectionMode=e.inSelectionMode}runCoreEditorCommand(e,t){e.model.pushStackElement();e.setCursorStates(t.source,3,[cI.moveTo(e,e.getPrimaryCursorState(),this._inSelectionMode,t.position,t.viewPosition)])&&e.revealPrimaryCursor(t.source,!0,this._minimalReveal)}}e.MoveTo=Dx(new t({id:"_moveTo",minimalReveal:!0,inSelectionMode:!1,precondition:void 0})),e.MoveToSelect=Dx(new t({id:"_moveToSelect",minimalReveal:!1,inSelectionMode:!0,precondition:void 0}));class i extends xI{runCoreEditorCommand(e,t){e.model.pushStackElement();const i=this._getColumnSelectResult(e,e.getPrimaryCursorState(),e.getCursorColumnSelectData(),t);e.setCursorStates(t.source,3,i.viewStates.map((e=>KE.fromViewState(e)))),e.setCursorColumnSelectData({isReal:!0,fromViewLineNumber:i.fromLineNumber,fromViewVisualColumn:i.fromVisualColumn,toViewLineNumber:i.toLineNumber,toViewVisualColumn:i.toVisualColumn}),i.reversed?e.revealTopMostCursor(t.source):e.revealBottomMostCursor(t.source)}}e.ColumnSelect=Dx(new class extends i{constructor(){super({id:"columnSelect",precondition:void 0})}_getColumnSelectResult(e,t,i,n){const o=e.model.validatePosition(n.position),s=e.coordinatesConverter.validateViewPosition(new er(n.viewPosition.lineNumber,n.viewPosition.column),o),r=n.doColumnSelect?i.fromViewLineNumber:s.lineNumber,a=n.doColumnSelect?i.fromViewVisualColumn:n.mouseColumn-1;return QE.columnSelect(e.cursorConfig,e,r,a,s.lineNumber,n.mouseColumn-1)}}),e.CursorColumnSelectLeft=Dx(new class extends i{constructor(){super({id:"cursorColumnSelectLeft",precondition:void 0,kbOpts:{weight:0,kbExpr:yI.textInputFocus,primary:3599,linux:{primary:0}}})}_getColumnSelectResult(e,t,i,n){return QE.columnSelectLeft(e.cursorConfig,e,i)}}),e.CursorColumnSelectRight=Dx(new class extends i{constructor(){super({id:"cursorColumnSelectRight",precondition:void 0,kbOpts:{weight:0,kbExpr:yI.textInputFocus,primary:3601,linux:{primary:0}}})}_getColumnSelectResult(e,t,i,n){return QE.columnSelectRight(e.cursorConfig,e,i)}});class n extends i{constructor(e){super(e),this._isPaged=e.isPaged}_getColumnSelectResult(e,t,i,n){return QE.columnSelectUp(e.cursorConfig,e,i,this._isPaged)}}e.CursorColumnSelectUp=Dx(new n({isPaged:!1,id:"cursorColumnSelectUp",precondition:void 0,kbOpts:{weight:0,kbExpr:yI.textInputFocus,primary:3600,linux:{primary:0}}})),e.CursorColumnSelectPageUp=Dx(new n({isPaged:!0,id:"cursorColumnSelectPageUp",precondition:void 0,kbOpts:{weight:0,kbExpr:yI.textInputFocus,primary:3595,linux:{primary:0}}}));class o extends i{constructor(e){super(e),this._isPaged=e.isPaged}_getColumnSelectResult(e,t,i,n){return QE.columnSelectDown(e.cursorConfig,e,i,this._isPaged)}}e.CursorColumnSelectDown=Dx(new o({isPaged:!1,id:"cursorColumnSelectDown",precondition:void 0,kbOpts:{weight:0,kbExpr:yI.textInputFocus,primary:3602,linux:{primary:0}}})),e.CursorColumnSelectPageDown=Dx(new o({isPaged:!0,id:"cursorColumnSelectPageDown",precondition:void 0,kbOpts:{weight:0,kbExpr:yI.textInputFocus,primary:3596,linux:{primary:0}}}));class s extends xI{constructor(){super({id:"cursorMove",precondition:void 0,description:hI.description})}runCoreEditorCommand(e,t){const i=hI.parse(t);i&&this._runCursorMove(e,t.source,i)}_runCursorMove(e,t,i){e.model.pushStackElement(),e.setCursorStates(t,3,s._move(e,e.getCursorStates(),i)),e.revealPrimaryCursor(t,!0)}static _move(e,t,i){const n=i.select,o=i.value;switch(i.direction){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:case 10:return cI.simpleMove(e,t,i.direction,n,o,i.unit);case 11:case 13:case 12:case 14:return cI.viewportMove(e,t,i.direction,n,o);default:return null}}}e.CursorMoveImpl=s,e.CursorMove=Dx(new s);class r extends xI{constructor(e){super(e),this._staticArgs=e.args}runCoreEditorCommand(e,t){let i=this._staticArgs;-1===this._staticArgs.value&&(i={direction:this._staticArgs.direction,unit:this._staticArgs.unit,select:this._staticArgs.select,value:t.pageSize||e.cursorConfig.pageSize}),e.model.pushStackElement(),e.setCursorStates(t.source,3,cI.simpleMove(e,e.getCursorStates(),i.direction,i.select,i.value,i.unit)),e.revealPrimaryCursor(t.source,!0)}}e.CursorLeft=Dx(new r({args:{direction:0,unit:0,select:!1,value:1},id:"cursorLeft",precondition:void 0,kbOpts:{weight:0,kbExpr:yI.textInputFocus,primary:15,mac:{primary:15,secondary:[288]}}})),e.CursorLeftSelect=Dx(new r({args:{direction:0,unit:0,select:!0,value:1},id:"cursorLeftSelect",precondition:void 0,kbOpts:{weight:0,kbExpr:yI.textInputFocus,primary:1039}})),e.CursorRight=Dx(new r({args:{direction:1,unit:0,select:!1,value:1},id:"cursorRight",precondition:void 0,kbOpts:{weight:0,kbExpr:yI.textInputFocus,primary:17,mac:{primary:17,secondary:[292]}}})),e.CursorRightSelect=Dx(new r({args:{direction:1,unit:0,select:!0,value:1},id:"cursorRightSelect",precondition:void 0,kbOpts:{weight:0,kbExpr:yI.textInputFocus,primary:1041}})),e.CursorUp=Dx(new r({args:{direction:2,unit:2,select:!1,value:1},id:"cursorUp",precondition:void 0,kbOpts:{weight:0,kbExpr:yI.textInputFocus,primary:16,mac:{primary:16,secondary:[302]}}})),e.CursorUpSelect=Dx(new r({args:{direction:2,unit:2,select:!0,value:1},id:"cursorUpSelect",precondition:void 0,kbOpts:{weight:0,kbExpr:yI.textInputFocus,primary:1040,secondary:[3088],mac:{primary:1040},linux:{primary:1040}}})),e.CursorPageUp=Dx(new r({args:{direction:2,unit:2,select:!1,value:-1},id:"cursorPageUp",precondition:void 0,kbOpts:{weight:0,kbExpr:yI.textInputFocus,primary:11}})),e.CursorPageUpSelect=Dx(new r({args:{direction:2,unit:2,select:!0,value:-1},id:"cursorPageUpSelect",precondition:void 0,kbOpts:{weight:0,kbExpr:yI.textInputFocus,primary:1035}})),e.CursorDown=Dx(new r({args:{direction:3,unit:2,select:!1,value:1},id:"cursorDown",precondition:void 0,kbOpts:{weight:0,kbExpr:yI.textInputFocus,primary:18,mac:{primary:18,secondary:[300]}}})),e.CursorDownSelect=Dx(new r({args:{direction:3,unit:2,select:!0,value:1},id:"cursorDownSelect",precondition:void 0,kbOpts:{weight:0,kbExpr:yI.textInputFocus,primary:1042,secondary:[3090],mac:{primary:1042},linux:{primary:1042}}})),e.CursorPageDown=Dx(new r({args:{direction:3,unit:2,select:!1,value:-1},id:"cursorPageDown",precondition:void 0,kbOpts:{weight:0,kbExpr:yI.textInputFocus,primary:12}})),e.CursorPageDownSelect=Dx(new r({args:{direction:3,unit:2,select:!0,value:-1},id:"cursorPageDownSelect",precondition:void 0,kbOpts:{weight:0,kbExpr:yI.textInputFocus,primary:1036}})),e.CreateCursor=Dx(new class extends xI{constructor(){super({id:"createCursor",precondition:void 0})}runCoreEditorCommand(e,t){let i;i=t.wholeLine?cI.line(e,e.getPrimaryCursorState(),!1,t.position,t.viewPosition):cI.moveTo(e,e.getPrimaryCursorState(),!1,t.position,t.viewPosition);const n=e.getCursorStates();if(n.length>1){const o=i.modelState?i.modelState.position:null,s=i.viewState?i.viewState.position:null;for(let i=0,r=n.length;i<r;i++){const r=n[i];if((!o||r.modelState.selection.containsPosition(o))&&(!s||r.viewState.selection.containsPosition(s)))return n.splice(i,1),e.model.pushStackElement(),void e.setCursorStates(t.source,3,n)}}n.push(i),e.model.pushStackElement(),e.setCursorStates(t.source,3,n)}}),e.LastCursorMoveToSelect=Dx(new class extends xI{constructor(){super({id:"_lastCursorMoveToSelect",precondition:void 0})}runCoreEditorCommand(e,t){const i=e.getLastAddedCursorIndex(),n=e.getCursorStates(),o=n.slice(0);o[i]=cI.moveTo(e,n[i],!0,t.position,t.viewPosition),e.model.pushStackElement(),e.setCursorStates(t.source,3,o)}});class a extends xI{constructor(e){super(e),this._inSelectionMode=e.inSelectionMode}runCoreEditorCommand(e,t){e.model.pushStackElement(),e.setCursorStates(t.source,3,cI.moveToBeginningOfLine(e,e.getCursorStates(),this._inSelectionMode)),e.revealPrimaryCursor(t.source,!0)}}e.CursorHome=Dx(new a({inSelectionMode:!1,id:"cursorHome",precondition:void 0,kbOpts:{weight:0,kbExpr:yI.textInputFocus,primary:14,mac:{primary:14,secondary:[2063]}}})),e.CursorHomeSelect=Dx(new a({inSelectionMode:!0,id:"cursorHomeSelect",precondition:void 0,kbOpts:{weight:0,kbExpr:yI.textInputFocus,primary:1038,mac:{primary:1038,secondary:[3087]}}}));class l extends xI{constructor(e){super(e),this._inSelectionMode=e.inSelectionMode}runCoreEditorCommand(e,t){e.model.pushStackElement(),e.setCursorStates(t.source,3,this._exec(e.getCursorStates())),e.revealPrimaryCursor(t.source,!0)}_exec(e){const t=[];for(let i=0,n=e.length;i<n;i++){const n=e[i],o=n.modelState.position.lineNumber;t[i]=KE.fromModelState(n.modelState.move(this._inSelectionMode,o,1,0))}return t}}e.CursorLineStart=Dx(new l({inSelectionMode:!1,id:"cursorLineStart",precondition:void 0,kbOpts:{weight:0,kbExpr:yI.textInputFocus,primary:0,mac:{primary:287}}})),e.CursorLineStartSelect=Dx(new l({inSelectionMode:!0,id:"cursorLineStartSelect",precondition:void 0,kbOpts:{weight:0,kbExpr:yI.textInputFocus,primary:0,mac:{primary:1311}}}));class d extends xI{constructor(e){super(e),this._inSelectionMode=e.inSelectionMode}runCoreEditorCommand(e,t){e.model.pushStackElement(),e.setCursorStates(t.source,3,cI.moveToEndOfLine(e,e.getCursorStates(),this._inSelectionMode,t.sticky||!1)),e.revealPrimaryCursor(t.source,!0)}}e.CursorEnd=Dx(new d({inSelectionMode:!1,id:"cursorEnd",precondition:void 0,kbOpts:{args:{sticky:!1},weight:0,kbExpr:yI.textInputFocus,primary:13,mac:{primary:13,secondary:[2065]}},description:{description:"Go to End",args:[{name:"args",schema:{type:"object",properties:{sticky:{description:mf(0,"Stick to the end even when going to longer lines"),type:"boolean",default:!1}}}}]}})),e.CursorEndSelect=Dx(new d({inSelectionMode:!0,id:"cursorEndSelect",precondition:void 0,kbOpts:{args:{sticky:!1},weight:0,kbExpr:yI.textInputFocus,primary:1037,mac:{primary:1037,secondary:[3089]}},description:{description:"Select to End",args:[{name:"args",schema:{type:"object",properties:{sticky:{description:mf(0,"Stick to the end even when going to longer lines"),type:"boolean",default:!1}}}}]}}));class c extends xI{constructor(e){super(e),this._inSelectionMode=e.inSelectionMode}runCoreEditorCommand(e,t){e.model.pushStackElement(),e.setCursorStates(t.source,3,this._exec(e,e.getCursorStates())),e.revealPrimaryCursor(t.source,!0)}_exec(e,t){const i=[];for(let n=0,o=t.length;n<o;n++){const o=t[n],s=o.modelState.position.lineNumber,r=e.model.getLineMaxColumn(s);i[n]=KE.fromModelState(o.modelState.move(this._inSelectionMode,s,r,0))}return i}}e.CursorLineEnd=Dx(new c({inSelectionMode:!1,id:"cursorLineEnd",precondition:void 0,kbOpts:{weight:0,kbExpr:yI.textInputFocus,primary:0,mac:{primary:291}}})),e.CursorLineEndSelect=Dx(new c({inSelectionMode:!0,id:"cursorLineEndSelect",precondition:void 0,kbOpts:{weight:0,kbExpr:yI.textInputFocus,primary:0,mac:{primary:1315}}}));class h extends xI{constructor(e){super(e),this._inSelectionMode=e.inSelectionMode}runCoreEditorCommand(e,t){e.model.pushStackElement(),e.setCursorStates(t.source,3,cI.moveToBeginningOfBuffer(e,e.getCursorStates(),this._inSelectionMode)),e.revealPrimaryCursor(t.source,!0)}}e.CursorTop=Dx(new h({inSelectionMode:!1,id:"cursorTop",precondition:void 0,kbOpts:{weight:0,kbExpr:yI.textInputFocus,primary:2062,mac:{primary:2064}}})),e.CursorTopSelect=Dx(new h({inSelectionMode:!0,id:"cursorTopSelect",precondition:void 0,kbOpts:{weight:0,kbExpr:yI.textInputFocus,primary:3086,mac:{primary:3088}}}));class u extends xI{constructor(e){super(e),this._inSelectionMode=e.inSelectionMode}runCoreEditorCommand(e,t){e.model.pushStackElement(),e.setCursorStates(t.source,3,cI.moveToEndOfBuffer(e,e.getCursorStates(),this._inSelectionMode)),e.revealPrimaryCursor(t.source,!0)}}e.CursorBottom=Dx(new u({inSelectionMode:!1,id:"cursorBottom",precondition:void 0,kbOpts:{weight:0,kbExpr:yI.textInputFocus,primary:2061,mac:{primary:2066}}})),e.CursorBottomSelect=Dx(new u({inSelectionMode:!0,id:"cursorBottomSelect",precondition:void 0,kbOpts:{weight:0,kbExpr:yI.textInputFocus,primary:3085,mac:{primary:3090}}}));class g extends xI{constructor(){super({id:"editorScroll",precondition:void 0,description:SI.description})}runCoreEditorCommand(e,t){const i=SI.parse(t);i&&this._runEditorScroll(e,t.source,i)}_runEditorScroll(e,t,i){const n=this._computeDesiredScrollTop(e,i);if(i.revealCursor){const o=e.getCompletelyVisibleViewRangeAtScrollTop(n);e.setCursorStates(t,3,[cI.findPositionInViewportIfOutside(e,e.getPrimaryCursorState(),o,i.select)])}e.viewLayout.setScrollPosition({scrollTop:n},0)}_computeDesiredScrollTop(e,t){if(1===t.unit){const i=e.getCompletelyVisibleViewRange(),n=e.coordinatesConverter.convertViewRangeToModelRange(i);let o;o=1===t.direction?Math.max(1,n.startLineNumber-t.value):Math.min(e.model.getLineCount(),n.startLineNumber+t.value);const s=e.coordinatesConverter.convertModelPositionToViewPosition(new er(o,1));return e.viewLayout.getVerticalOffsetForLineNumber(s.lineNumber)}let i;i=3===t.unit?e.cursorConfig.pageSize*t.value:4===t.unit?Math.round(e.cursorConfig.pageSize/2)*t.value:t.value;const n=(1===t.direction?-1:1)*i;return e.viewLayout.getCurrentScrollTop()+n*e.cursorConfig.lineHeight}}e.EditorScrollImpl=g,e.EditorScroll=Dx(new g),e.ScrollLineUp=Dx(new class extends xI{constructor(){super({id:"scrollLineUp",precondition:void 0,kbOpts:{weight:0,kbExpr:yI.textInputFocus,primary:2064,mac:{primary:267}}})}runCoreEditorCommand(t,i){e.EditorScroll._runEditorScroll(t,i.source,{direction:1,unit:2,value:1,revealCursor:!1,select:!1})}}),e.ScrollPageUp=Dx(new class extends xI{constructor(){super({id:"scrollPageUp",precondition:void 0,kbOpts:{weight:0,kbExpr:yI.textInputFocus,primary:2059,win:{primary:523},linux:{primary:523}}})}runCoreEditorCommand(t,i){e.EditorScroll._runEditorScroll(t,i.source,{direction:1,unit:3,value:1,revealCursor:!1,select:!1})}}),e.ScrollLineDown=Dx(new class extends xI{constructor(){super({id:"scrollLineDown",precondition:void 0,kbOpts:{weight:0,kbExpr:yI.textInputFocus,primary:2066,mac:{primary:268}}})}runCoreEditorCommand(t,i){e.EditorScroll._runEditorScroll(t,i.source,{direction:2,unit:2,value:1,revealCursor:!1,select:!1})}}),e.ScrollPageDown=Dx(new class extends xI{constructor(){super({id:"scrollPageDown",precondition:void 0,kbOpts:{weight:0,kbExpr:yI.textInputFocus,primary:2060,win:{primary:524},linux:{primary:524}}})}runCoreEditorCommand(t,i){e.EditorScroll._runEditorScroll(t,i.source,{direction:2,unit:3,value:1,revealCursor:!1,select:!1})}});class p extends xI{constructor(e){super(e),this._inSelectionMode=e.inSelectionMode}runCoreEditorCommand(e,t){e.model.pushStackElement(),e.setCursorStates(t.source,3,[cI.word(e,e.getPrimaryCursorState(),this._inSelectionMode,t.position)]),e.revealPrimaryCursor(t.source,!0)}}e.WordSelect=Dx(new p({inSelectionMode:!1,id:"_wordSelect",precondition:void 0})),e.WordSelectDrag=Dx(new p({inSelectionMode:!0,id:"_wordSelectDrag",precondition:void 0})),e.LastCursorWordSelect=Dx(new class extends xI{constructor(){super({id:"lastCursorWordSelect",precondition:void 0})}runCoreEditorCommand(e,t){const i=e.getLastAddedCursorIndex(),n=e.getCursorStates(),o=n.slice(0),s=n[i];o[i]=cI.word(e,s,s.modelState.hasSelection(),t.position),e.model.pushStackElement(),e.setCursorStates(t.source,3,o)}});class m extends xI{constructor(e){super(e),this._inSelectionMode=e.inSelectionMode}runCoreEditorCommand(e,t){e.model.pushStackElement(),e.setCursorStates(t.source,3,[cI.line(e,e.getPrimaryCursorState(),this._inSelectionMode,t.position,t.viewPosition)]),e.revealPrimaryCursor(t.source,!1)}}e.LineSelect=Dx(new m({inSelectionMode:!1,id:"_lineSelect",precondition:void 0})),e.LineSelectDrag=Dx(new m({inSelectionMode:!0,id:"_lineSelectDrag",precondition:void 0}));class f extends xI{constructor(e){super(e),this._inSelectionMode=e.inSelectionMode}runCoreEditorCommand(e,t){const i=e.getLastAddedCursorIndex(),n=e.getCursorStates(),o=n.slice(0);o[i]=cI.line(e,n[i],this._inSelectionMode,t.position,t.viewPosition),e.model.pushStackElement(),e.setCursorStates(t.source,3,o)}}e.LastCursorLineSelect=Dx(new f({inSelectionMode:!1,id:"lastCursorLineSelect",precondition:void 0})),e.LastCursorLineSelectDrag=Dx(new f({inSelectionMode:!0,id:"lastCursorLineSelectDrag",precondition:void 0})),e.CancelSelection=Dx(new class extends xI{constructor(){super({id:"cancelSelection",precondition:yI.hasNonEmptySelection,kbOpts:{weight:0,kbExpr:yI.textInputFocus,primary:9,secondary:[1033]}})}runCoreEditorCommand(e,t){e.model.pushStackElement(),e.setCursorStates(t.source,3,[cI.cancelSelection(e,e.getPrimaryCursorState())]),e.revealPrimaryCursor(t.source,!0)}}),e.RemoveSecondaryCursors=Dx(new class extends xI{constructor(){super({id:"removeSecondaryCursors",precondition:yI.hasMultipleSelections,kbOpts:{weight:1,kbExpr:yI.textInputFocus,primary:9,secondary:[1033]}})}runCoreEditorCommand(e,t){e.model.pushStackElement(),e.setCursorStates(t.source,3,[e.getPrimaryCursorState()]),e.revealPrimaryCursor(t.source,!0),cy(mf(0,"Removed secondary cursors"))}}),e.RevealLine=Dx(new class extends xI{constructor(){super({id:"revealLine",precondition:void 0,description:kI.description})}runCoreEditorCommand(e,t){const i=t,n=i.lineNumber||0;let o="number"==typeof n?n+1:parseInt(n)+1;o<1&&(o=1);const s=e.model.getLineCount();o>s&&(o=s);const r=new qo(o,1,o,e.model.getLineMaxColumn(o));let a=0;if(i.at)switch(i.at){case kI.RawAtArgument.Top:a=3;break;case kI.RawAtArgument.Center:a=1;break;case kI.RawAtArgument.Bottom:a=4}const l=e.coordinatesConverter.convertModelRangeToViewRange(r);e.revealRange(t.source,!1,l,a,0)}}),e.SelectAll=new class extends LI{constructor(){super(Px)}runDOMCommand(){o_&&(document.activeElement.focus(),document.activeElement.select()),document.execCommand("selectAll")}runEditorCommand(e,t,i){const n=t._getViewModel();n&&this.runCoreEditorCommand(n,i)}runCoreEditorCommand(e,t){e.model.pushStackElement(),e.setCursorStates("keyboard",3,[cI.selectAll(e,e.getPrimaryCursorState())])}},e.SetSelection=Dx(new class extends xI{constructor(){super({id:"setSelection",precondition:void 0})}runCoreEditorCommand(e,t){e.model.pushStackElement(),e.setCursorStates(t.source,3,[KE.fromModelSelection(t.selection)])}})}(DI||(DI={}));const NI=Sy.and(yI.textInputFocus,yI.columnSelection);function EI(e,t){fx.registerKeybindingRule({id:e,primary:t,when:NI,weight:1})}function II(e){return e.register(),e}var TI,MI;EI(DI.CursorColumnSelectLeft.id,1039),EI(DI.CursorColumnSelectRight.id,1041),EI(DI.CursorColumnSelectUp.id,1040),EI(DI.CursorColumnSelectPageUp.id,1035),EI(DI.CursorColumnSelectDown.id,1042),EI(DI.CursorColumnSelectPageDown.id,1036),function(e){class t extends yx{runEditorCommand(e,t,i){const n=t._getViewModel();n&&this.runCoreEditingCommand(t,n,i||{})}}e.CoreEditingCommand=t,e.LineBreakInsert=Dx(new class extends t{constructor(){super({id:"lineBreakInsert",precondition:yI.writable,kbOpts:{weight:0,kbExpr:yI.textInputFocus,primary:0,mac:{primary:301}}})}runCoreEditingCommand(e,t,i){e.pushUndoStop(),e.executeCommands(this.id,fI.lineBreakInsert(t.cursorConfig,t.model,t.getCursorStates().map((e=>e.modelState.selection))))}}),e.Outdent=Dx(new class extends t{constructor(){super({id:"outdent",precondition:yI.writable,kbOpts:{weight:0,kbExpr:Sy.and(yI.editorTextFocus,yI.tabDoesNotMoveFocus),primary:1026}})}runCoreEditingCommand(e,t,i){e.pushUndoStop(),e.executeCommands(this.id,fI.outdent(t.cursorConfig,t.model,t.getCursorStates().map((e=>e.modelState.selection)))),e.pushUndoStop()}}),e.Tab=Dx(new class extends t{constructor(){super({id:"tab",precondition:yI.writable,kbOpts:{weight:0,kbExpr:Sy.and(yI.editorTextFocus,yI.tabDoesNotMoveFocus),primary:2}})}runCoreEditingCommand(e,t,i){e.pushUndoStop(),e.executeCommands(this.id,fI.tab(t.cursorConfig,t.model,t.getCursorStates().map((e=>e.modelState.selection)))),e.pushUndoStop()}}),e.DeleteLeft=Dx(new class extends t{constructor(){super({id:"deleteLeft",precondition:void 0,kbOpts:{weight:0,kbExpr:yI.textInputFocus,primary:1,secondary:[1025],mac:{primary:1,secondary:[1025,294,257]}}})}runCoreEditingCommand(e,t,i){const[n,o]=rI.deleteLeft(t.getPrevEditOperationType(),t.cursorConfig,t.model,t.getCursorStates().map((e=>e.modelState.selection)),t.getCursorAutoClosedCharacters());n&&e.pushUndoStop(),e.executeCommands(this.id,o),t.setPrevEditOperationType(2)}}),e.DeleteRight=Dx(new class extends t{constructor(){super({id:"deleteRight",precondition:void 0,kbOpts:{weight:0,kbExpr:yI.textInputFocus,primary:20,mac:{primary:20,secondary:[290,276]}}})}runCoreEditingCommand(e,t,i){const[n,o]=rI.deleteRight(t.getPrevEditOperationType(),t.cursorConfig,t.model,t.getCursorStates().map((e=>e.modelState.selection)));n&&e.pushUndoStop(),e.executeCommands(this.id,o),t.setPrevEditOperationType(3)}}),e.Undo=new class extends LI{constructor(){super(Ox)}runDOMCommand(){document.execCommand("undo")}runEditorCommand(e,t,i){if(t.hasModel()&&!0!==t.getOption(81))return t.getModel().undo()}},e.Redo=new class extends LI{constructor(){super(Rx)}runDOMCommand(){document.execCommand("redo")}runEditorCommand(e,t,i){if(t.hasModel()&&!0!==t.getOption(81))return t.getModel().redo()}}}(TI||(TI={}));class AI extends bx{constructor(e,t,i){super({id:e,precondition:void 0,description:i}),this._handlerId=t}runCommand(e,t){const i=e.get(N_).getFocusedCodeEditor();i&&i.trigger("keyboard",this._handlerId,t)}}function OI(e,t){II(new AI("default:"+e,e)),II(new AI(e,e,t))}OI("type",{description:"Type",args:[{name:"args",schema:{type:"object",required:["text"],properties:{text:{type:"string"}}}}]}),OI("replacePreviousChar"),OI("compositionType"),OI("compositionStart"),OI("compositionEnd"),OI("paste"),OI("cut");class RI{constructor(e,t,i,n){this.configuration=e,this.viewModel=t,this.userInputEvents=i,this.commandDelegate=n}paste(e,t,i,n){this.commandDelegate.paste(e,t,i,n)}type(e){this.commandDelegate.type(e)}compositionType(e,t,i,n){this.commandDelegate.compositionType(e,t,i,n)}compositionStart(){this.commandDelegate.startComposition()}compositionEnd(){this.commandDelegate.endComposition()}cut(){this.commandDelegate.cut()}setSelection(e){DI.SetSelection.runCoreEditorCommand(this.viewModel,{source:"keyboard",selection:e})}_validateViewColumn(e){const t=this.viewModel.getLineMinColumn(e.lineNumber);return e.column<t?new er(e.lineNumber,t):e}_hasMulticursorModifier(e){switch(this.configuration.options.get(70)){case"altKey":return e.altKey;case"ctrlKey":return e.ctrlKey;case"metaKey":return e.metaKey;default:return!1}}_hasNonMulticursorModifier(e){switch(this.configuration.options.get(70)){case"altKey":return e.ctrlKey||e.metaKey;case"ctrlKey":return e.altKey||e.metaKey;case"metaKey":return e.ctrlKey||e.altKey;default:return!1}}dispatchMouse(e){const t=this.configuration.options,i=Vo&&t.get(96),n=t.get(18);e.middleButton&&!i?this._columnSelect(e.position,e.mouseColumn,e.inSelectionMode):e.startedOnLineNumbers?this._hasMulticursorModifier(e)?e.inSelectionMode?this._lastCursorLineSelect(e.position):this._createCursor(e.position,!0):e.inSelectionMode?this._lineSelectDrag(e.position):this._lineSelect(e.position):e.mouseDownCount>=4?this._selectAll():3===e.mouseDownCount?this._hasMulticursorModifier(e)?e.inSelectionMode?this._lastCursorLineSelectDrag(e.position):this._lastCursorLineSelect(e.position):e.inSelectionMode?this._lineSelectDrag(e.position):this._lineSelect(e.position):2===e.mouseDownCount?e.onInjectedText||(this._hasMulticursorModifier(e)?this._lastCursorWordSelect(e.position):e.inSelectionMode?this._wordSelectDrag(e.position):this._wordSelect(e.position)):this._hasMulticursorModifier(e)?this._hasNonMulticursorModifier(e)||(e.shiftKey?this._columnSelect(e.position,e.mouseColumn,!0):e.inSelectionMode?this._lastCursorMoveToSelect(e.position):this._createCursor(e.position,!1)):e.inSelectionMode?e.altKey||n?this._columnSelect(e.position,e.mouseColumn,!0):this._moveToSelect(e.position):this.moveTo(e.position)}_usualArgs(e){return e=this._validateViewColumn(e),{source:"mouse",position:this._convertViewToModelPosition(e),viewPosition:e}}moveTo(e){DI.MoveTo.runCoreEditorCommand(this.viewModel,this._usualArgs(e))}_moveToSelect(e){DI.MoveToSelect.runCoreEditorCommand(this.viewModel,this._usualArgs(e))}_columnSelect(e,t,i){e=this._validateViewColumn(e),DI.ColumnSelect.runCoreEditorCommand(this.viewModel,{source:"mouse",position:this._convertViewToModelPosition(e),viewPosition:e,mouseColumn:t,doColumnSelect:i})}_createCursor(e,t){e=this._validateViewColumn(e),DI.CreateCursor.runCoreEditorCommand(this.viewModel,{source:"mouse",position:this._convertViewToModelPosition(e),viewPosition:e,wholeLine:t})}_lastCursorMoveToSelect(e){DI.LastCursorMoveToSelect.runCoreEditorCommand(this.viewModel,this._usualArgs(e))}_wordSelect(e){DI.WordSelect.runCoreEditorCommand(this.viewModel,this._usualArgs(e))}_wordSelectDrag(e){DI.WordSelectDrag.runCoreEditorCommand(this.viewModel,this._usualArgs(e))}_lastCursorWordSelect(e){DI.LastCursorWordSelect.runCoreEditorCommand(this.viewModel,this._usualArgs(e))}_lineSelect(e){DI.LineSelect.runCoreEditorCommand(this.viewModel,this._usualArgs(e))}_lineSelectDrag(e){DI.LineSelectDrag.runCoreEditorCommand(this.viewModel,this._usualArgs(e))}_lastCursorLineSelect(e){DI.LastCursorLineSelect.runCoreEditorCommand(this.viewModel,this._usualArgs(e))}_lastCursorLineSelectDrag(e){DI.LastCursorLineSelectDrag.runCoreEditorCommand(this.viewModel,this._usualArgs(e))}_selectAll(){DI.SelectAll.runCoreEditorCommand(this.viewModel,{source:"mouse"})}_convertViewToModelPosition(e){return this.viewModel.coordinatesConverter.convertViewPositionToModelPosition(e)}emitKeyDown(e){this.userInputEvents.emitKeyDown(e)}emitKeyUp(e){this.userInputEvents.emitKeyUp(e)}emitContextMenu(e){this.userInputEvents.emitContextMenu(e)}emitMouseMove(e){this.userInputEvents.emitMouseMove(e)}emitMouseLeave(e){this.userInputEvents.emitMouseLeave(e)}emitMouseUp(e){this.userInputEvents.emitMouseUp(e)}emitMouseDown(e){this.userInputEvents.emitMouseDown(e)}emitMouseDrag(e){this.userInputEvents.emitMouseDrag(e)}emitMouseDrop(e){this.userInputEvents.emitMouseDrop(e)}emitMouseDropCanceled(){this.userInputEvents.emitMouseDropCanceled()}emitMouseWheel(e){this.userInputEvents.emitMouseWheel(e)}}class PI{constructor(e){this.onKeyDown=null,this.onKeyUp=null,this.onContextMenu=null,this.onMouseMove=null,this.onMouseLeave=null,this.onMouseDown=null,this.onMouseUp=null,this.onMouseDrag=null,this.onMouseDrop=null,this.onMouseDropCanceled=null,this.onMouseWheel=null,this._coordinatesConverter=e}emitKeyDown(e){this.onKeyDown&&this.onKeyDown(e)}emitKeyUp(e){this.onKeyUp&&this.onKeyUp(e)}emitContextMenu(e){this.onContextMenu&&this.onContextMenu(this._convertViewToModelMouseEvent(e))}emitMouseMove(e){this.onMouseMove&&this.onMouseMove(this._convertViewToModelMouseEvent(e))}emitMouseLeave(e){this.onMouseLeave&&this.onMouseLeave(this._convertViewToModelMouseEvent(e))}emitMouseDown(e){this.onMouseDown&&this.onMouseDown(this._convertViewToModelMouseEvent(e))}emitMouseUp(e){this.onMouseUp&&this.onMouseUp(this._convertViewToModelMouseEvent(e))}emitMouseDrag(e){this.onMouseDrag&&this.onMouseDrag(this._convertViewToModelMouseEvent(e))}emitMouseDrop(e){this.onMouseDrop&&this.onMouseDrop(this._convertViewToModelMouseEvent(e))}emitMouseDropCanceled(){this.onMouseDropCanceled&&this.onMouseDropCanceled()}emitMouseWheel(e){this.onMouseWheel&&this.onMouseWheel(e)}_convertViewToModelMouseEvent(e){return e.target?{event:e.event,target:this._convertViewToModelMouseTarget(e.target)}:e}_convertViewToModelMouseTarget(e){return PI.convertViewToModelMouseTarget(e,this._coordinatesConverter)}static convertViewToModelMouseTarget(e,t){const i=Object.assign({},e);return i.position&&(i.position=t.convertViewPositionToModelPosition(i.position)),i.range&&(i.range=t.convertViewRangeToModelRange(i.range)),i}}class FI{constructor(e){this._createLine=e,this._set(1,[])}flush(){this._set(1,[])}_set(e,t){this._lines=t,this._rendLineNumberStart=e}_get(){return{rendLineNumberStart:this._rendLineNumberStart,lines:this._lines}}getStartLineNumber(){return this._rendLineNumberStart}getEndLineNumber(){return this._rendLineNumberStart+this._lines.length-1}getCount(){return this._lines.length}getLine(e){const t=e-this._rendLineNumberStart;if(t<0||t>=this._lines.length)throw new Error("Illegal value for lineNumber");return this._lines[t]}onLinesDeleted(e,t){if(0===this.getCount())return null;const i=this.getStartLineNumber(),n=this.getEndLineNumber();if(t<i){const i=t-e+1;return this._rendLineNumberStart-=i,null}if(e>n)return null;let o=0,s=0;for(let r=i;r<=n;r++){const i=r-this._rendLineNumberStart;e<=r&&r<=t&&(0===s?(o=i,s=1):s++)}if(e<i){let n=0;n=t<i?t-e+1:i-e,this._rendLineNumberStart-=n}return this._lines.splice(o,s)}onLinesChanged(e,t){if(0===this.getCount())return!1;const i=this.getStartLineNumber(),n=this.getEndLineNumber();let o=!1;for(let s=e;s<=t;s++)s>=i&&s<=n&&(this._lines[s-this._rendLineNumberStart].onContentChanged(),o=!0);return o}onLinesInserted(e,t){if(0===this.getCount())return null;const i=t-e+1,n=this.getStartLineNumber(),o=this.getEndLineNumber();if(e<=n)return this._rendLineNumberStart+=i,null;if(e>o)return null;if(i+e>o){return this._lines.splice(e-this._rendLineNumberStart,o-e+1)}const s=[];for(let c=0;c<i;c++)s[c]=this._createLine();const r=e-this._rendLineNumberStart,a=this._lines.slice(0,r),l=this._lines.slice(r,this._lines.length-i),d=this._lines.slice(this._lines.length-i,this._lines.length);return this._lines=a.concat(s).concat(l),d}onTokensChanged(e){if(0===this.getCount())return!1;const t=this.getStartLineNumber(),i=this.getEndLineNumber();let n=!1;for(let o=0,s=e.length;o<s;o++){const s=e[o];if(s.toLineNumber<t||s.fromLineNumber>i)continue;const r=Math.max(t,s.fromLineNumber),a=Math.min(i,s.toLineNumber);for(let e=r;e<=a;e++){const t=e-this._rendLineNumberStart;this._lines[t].onTokensChanged(),n=!0}}return n}}class BI{constructor(e){this._host=e,this.domNode=this._createDomNode(),this._linesCollection=new FI((()=>this._host.createVisibleLine()))}_createDomNode(){const e=p_(document.createElement("div"));return e.setClassName("view-layer"),e.setPosition("absolute"),e.domNode.setAttribute("role","presentation"),e.domNode.setAttribute("aria-hidden","true"),e}onConfigurationChanged(e){return!!e.hasChanged(131)}onFlushed(e){return this._linesCollection.flush(),!0}onLinesChanged(e){return this._linesCollection.onLinesChanged(e.fromLineNumber,e.toLineNumber)}onLinesDeleted(e){const t=this._linesCollection.onLinesDeleted(e.fromLineNumber,e.toLineNumber);if(t)for(let i=0,n=t.length;i<n;i++){const e=t[i].getDomNode();e&&this.domNode.domNode.removeChild(e)}return!0}onLinesInserted(e){const t=this._linesCollection.onLinesInserted(e.fromLineNumber,e.toLineNumber);if(t)for(let i=0,n=t.length;i<n;i++){const e=t[i].getDomNode();e&&this.domNode.domNode.removeChild(e)}return!0}onScrollChanged(e){return e.scrollTopChanged}onTokensChanged(e){return this._linesCollection.onTokensChanged(e.ranges)}onZonesChanged(e){return!0}getStartLineNumber(){return this._linesCollection.getStartLineNumber()}getEndLineNumber(){return this._linesCollection.getEndLineNumber()}getVisibleLine(e){return this._linesCollection.getLine(e)}renderLines(e){const t=this._linesCollection._get(),i=new VI(this.domNode.domNode,this._host,e),n={rendLineNumberStart:t.rendLineNumberStart,lines:t.lines,linesLength:t.lines.length},o=i.render(n,e.startLineNumber,e.endLineNumber,e.relativeVerticalOffset);this._linesCollection._set(o.rendLineNumberStart,o.lines)}}class VI{constructor(e,t,i){this.domNode=e,this.host=t,this.viewportData=i}render(e,t,i,n){const o={rendLineNumberStart:e.rendLineNumberStart,lines:e.lines.slice(0),linesLength:e.linesLength};if(o.rendLineNumberStart+o.linesLength-1<t||i<o.rendLineNumberStart){o.rendLineNumberStart=t,o.linesLength=i-t+1,o.lines=[];for(let e=t;e<=i;e++)o.lines[e-t]=this.host.createVisibleLine();return this._finishRendering(o,!0,n),o}if(this._renderUntouchedLines(o,Math.max(t-o.rendLineNumberStart,0),Math.min(i-o.rendLineNumberStart,o.linesLength-1),n,t),o.rendLineNumberStart>t){const e=t,s=Math.min(i,o.rendLineNumberStart-1);e<=s&&(this._insertLinesBefore(o,e,s,n,t),o.linesLength+=s-e+1)}else if(o.rendLineNumberStart<t){const e=Math.min(o.linesLength,t-o.rendLineNumberStart);e>0&&(this._removeLinesBefore(o,e),o.linesLength-=e)}if(o.rendLineNumberStart=t,o.rendLineNumberStart+o.linesLength-1<i){const e=o.rendLineNumberStart+o.linesLength,s=i;e<=s&&(this._insertLinesAfter(o,e,s,n,t),o.linesLength+=s-e+1)}else if(o.rendLineNumberStart+o.linesLength-1>i){const e=Math.max(0,i-o.rendLineNumberStart+1),t=o.linesLength-1-e+1;t>0&&(this._removeLinesAfter(o,t),o.linesLength-=t)}return this._finishRendering(o,!1,n),o}_renderUntouchedLines(e,t,i,n,o){const s=e.rendLineNumberStart,r=e.lines;for(let a=t;a<=i;a++){const e=s+a;r[a].layoutLine(e,n[e-o])}}_insertLinesBefore(e,t,i,n,o){const s=[];let r=0;for(let a=t;a<=i;a++)s[r++]=this.host.createVisibleLine();e.lines=s.concat(e.lines)}_removeLinesBefore(e,t){for(let i=0;i<t;i++){const t=e.lines[i].getDomNode();t&&this.domNode.removeChild(t)}e.lines.splice(0,t)}_insertLinesAfter(e,t,i,n,o){const s=[];let r=0;for(let a=t;a<=i;a++)s[r++]=this.host.createVisibleLine();e.lines=e.lines.concat(s)}_removeLinesAfter(e,t){const i=e.linesLength-t;for(let n=0;n<t;n++){const t=e.lines[i+n].getDomNode();t&&this.domNode.removeChild(t)}e.lines.splice(i,t)}_finishRenderingNewLines(e,t,i,n){VI._ttPolicy&&(i=VI._ttPolicy.createHTML(i));const o=this.domNode.lastChild;t||!o?this.domNode.innerHTML=i:o.insertAdjacentHTML("afterend",i);let s=this.domNode.lastChild;for(let r=e.linesLength-1;r>=0;r--){const t=e.lines[r];n[r]&&(t.setDomNode(s),s=s.previousSibling)}}_finishRenderingInvalidLines(e,t,i){const n=document.createElement("div");VI._ttPolicy&&(t=VI._ttPolicy.createHTML(t)),n.innerHTML=t;for(let o=0;o<e.linesLength;o++){const t=e.lines[o];if(i[o]){const e=n.firstChild,i=t.getDomNode();i.parentNode.replaceChild(e,i),t.setDomNode(e)}}}_finishRendering(e,t,i){const n=VI._sb,o=e.linesLength,s=e.lines,r=e.rendLineNumberStart,a=[];{n.reset();let l=!1;for(let e=0;e<o;e++){const t=s[e];a[e]=!1;if(t.getDomNode())continue;t.renderLine(e+r,i[e],this.viewportData,n)&&(a[e]=!0,l=!0)}l&&this._finishRenderingNewLines(e,t,n.build(),a)}{n.reset();let t=!1;const l=[];for(let e=0;e<o;e++){const o=s[e];if(l[e]=!1,a[e])continue;o.renderLine(e+r,i[e],this.viewportData,n)&&(l[e]=!0,t=!0)}t&&this._finishRenderingInvalidLines(e,n.build(),l)}}}VI._ttPolicy=null===(MI=window.trustedTypes)||void 0===MI?void 0:MI.createPolicy("editorViewLayer",{createHTML:e=>e}),VI._sb=nv(1e5);class WI extends jL{constructor(e){super(e),this._visibleLines=new BI(this),this.domNode=this._visibleLines.domNode,this._dynamicOverlays=[],this._isFocused=!1,this.domNode.setClassName("view-overlays")}shouldRender(){if(super.shouldRender())return!0;for(let e=0,t=this._dynamicOverlays.length;e<t;e++){if(this._dynamicOverlays[e].shouldRender())return!0}return!1}dispose(){super.dispose();for(let e=0,t=this._dynamicOverlays.length;e<t;e++){this._dynamicOverlays[e].dispose()}this._dynamicOverlays=[]}getDomNode(){return this.domNode}createVisibleLine(){return new zI(this._context.configuration,this._dynamicOverlays)}addDynamicOverlay(e){this._dynamicOverlays.push(e)}onConfigurationChanged(e){this._visibleLines.onConfigurationChanged(e);const t=this._visibleLines.getStartLineNumber(),i=this._visibleLines.getEndLineNumber();for(let n=t;n<=i;n++){this._visibleLines.getVisibleLine(n).onConfigurationChanged(e)}return!0}onFlushed(e){return this._visibleLines.onFlushed(e)}onFocusChanged(e){return this._isFocused=e.isFocused,!0}onLinesChanged(e){return this._visibleLines.onLinesChanged(e)}onLinesDeleted(e){return this._visibleLines.onLinesDeleted(e)}onLinesInserted(e){return this._visibleLines.onLinesInserted(e)}onScrollChanged(e){return this._visibleLines.onScrollChanged(e)||!0}onTokensChanged(e){return this._visibleLines.onTokensChanged(e)}onZonesChanged(e){return this._visibleLines.onZonesChanged(e)}prepareRender(e){const t=this._dynamicOverlays.filter((e=>e.shouldRender()));for(let i=0,n=t.length;i<n;i++){const n=t[i];n.prepareRender(e),n.onDidRender()}}render(e){this._viewOverlaysRender(e),this.domNode.toggleClassName("focused",this._isFocused)}_viewOverlaysRender(e){this._visibleLines.renderLines(e.viewportData)}}class zI{constructor(e,t){this._configuration=e,this._lineHeight=this._configuration.options.get(59),this._dynamicOverlays=t,this._domNode=null,this._renderedContent=null}getDomNode(){return this._domNode?this._domNode.domNode:null}setDomNode(e){this._domNode=p_(e)}onContentChanged(){}onTokensChanged(){}onConfigurationChanged(e){this._lineHeight=this._configuration.options.get(59)}renderLine(e,t,i,n){let o="";for(let s=0,r=this._dynamicOverlays.length;s<r;s++){o+=this._dynamicOverlays[s].render(i.startLineNumber,e)}return this._renderedContent!==o&&(this._renderedContent=o,n.appendASCIIString('<div style="position:absolute;top:'),n.appendASCIIString(String(t)),n.appendASCIIString("px;width:100%;height:"),n.appendASCIIString(String(this._lineHeight)),n.appendASCIIString('px;">'),n.appendASCIIString(o),n.appendASCIIString("</div>"),!0)}layoutLine(e,t){this._domNode&&(this._domNode.setTop(t),this._domNode.setHeight(this._lineHeight))}}class HI extends WI{constructor(e){super(e);const t=this._context.configuration.options.get(131);this._contentWidth=t.contentWidth,this.domNode.setHeight(0)}onConfigurationChanged(e){const t=this._context.configuration.options.get(131);return this._contentWidth=t.contentWidth,super.onConfigurationChanged(e)||!0}onScrollChanged(e){return super.onScrollChanged(e)||e.scrollWidthChanged}_viewOverlaysRender(e){super._viewOverlaysRender(e),this.domNode.setWidth(Math.max(e.scrollWidth,this._contentWidth))}}class jI extends WI{constructor(e){super(e);const t=this._context.configuration.options,i=t.get(131);this._contentLeft=i.contentLeft,this.domNode.setClassName("margin-view-overlays"),this.domNode.setWidth(1),m_(this.domNode,t.get(44))}onConfigurationChanged(e){const t=this._context.configuration.options;m_(this.domNode,t.get(44));const i=t.get(131);return this._contentLeft=i.contentLeft,super.onConfigurationChanged(e)||!0}onScrollChanged(e){return super.onScrollChanged(e)||e.scrollHeightChanged}_viewOverlaysRender(e){super._viewOverlaysRender(e);const t=Math.min(e.scrollHeight,1e6);this.domNode.setHeight(t),this.domNode.setWidth(this._contentLeft)}}class UI{constructor(e,t){this._coordinateBrand=void 0,this.top=e,this.left=t}}class $I extends jL{constructor(e,t){super(e),this._viewDomNode=t,this._widgets={},this.domNode=p_(document.createElement("div")),UL.write(this.domNode,1),this.domNode.setClassName("contentWidgets"),this.domNode.setPosition("absolute"),this.domNode.setTop(0),this.overflowingContentWidgetsDomNode=p_(document.createElement("div")),UL.write(this.overflowingContentWidgetsDomNode,2),this.overflowingContentWidgetsDomNode.setClassName("overflowingContentWidgets")}dispose(){super.dispose(),this._widgets={}}onConfigurationChanged(e){const t=Object.keys(this._widgets);for(const i of t)this._widgets[i].onConfigurationChanged(e);return!0}onDecorationsChanged(e){return!0}onFlushed(e){return!0}onLineMappingChanged(e){const t=Object.keys(this._widgets);for(const i of t)this._widgets[i].onLineMappingChanged(e);return!0}onLinesChanged(e){return!0}onLinesDeleted(e){return!0}onLinesInserted(e){return!0}onScrollChanged(e){return!0}onZonesChanged(e){return!0}addWidget(e){const t=new KI(this._context,this._viewDomNode,e);this._widgets[t.id]=t,t.allowEditorOverflow?this.overflowingContentWidgetsDomNode.appendChild(t.domNode):this.domNode.appendChild(t.domNode),this.setShouldRender()}setWidgetPosition(e,t,i){this._widgets[e.getId()].setPosition(t,i),this.setShouldRender()}removeWidget(e){const t=e.getId();if(this._widgets.hasOwnProperty(t)){const e=this._widgets[t];delete this._widgets[t];const i=e.domNode.domNode;i.parentNode.removeChild(i),i.removeAttribute("monaco-visible-content-widget"),this.setShouldRender()}}shouldSuppressMouseDownOnWidget(e){return!!this._widgets.hasOwnProperty(e)&&this._widgets[e].suppressMouseDown}onBeforeRender(e){const t=Object.keys(this._widgets);for(const i of t)this._widgets[i].onBeforeRender(e)}prepareRender(e){const t=Object.keys(this._widgets);for(const i of t)this._widgets[i].prepareRender(e)}render(e){const t=Object.keys(this._widgets);for(const i of t)this._widgets[i].render(e)}}class KI{constructor(e,t,i){this._context=e,this._viewDomNode=t,this._actual=i,this.domNode=p_(this._actual.getDomNode()),this.id=this._actual.getId(),this.allowEditorOverflow=this._actual.allowEditorOverflow||!1,this.suppressMouseDown=this._actual.suppressMouseDown||!1;const n=this._context.configuration.options,o=n.get(131);this._fixedOverflowWidgets=n.get(36),this._contentWidth=o.contentWidth,this._contentLeft=o.contentLeft,this._lineHeight=n.get(59),this._range=null,this._viewRange=null,this._preference=[],this._cachedDomNodeOffsetWidth=-1,this._cachedDomNodeOffsetHeight=-1,this._maxWidth=this._getMaxWidth(),this._isVisible=!1,this._renderData=null,this.domNode.setPosition(this._fixedOverflowWidgets&&this.allowEditorOverflow?"fixed":"absolute"),this.domNode.setDisplay("none"),this.domNode.setVisibility("hidden"),this.domNode.setAttribute("widgetId",this.id),this.domNode.setMaxWidth(this._maxWidth)}onConfigurationChanged(e){const t=this._context.configuration.options;if(this._lineHeight=t.get(59),e.hasChanged(131)){const e=t.get(131);this._contentLeft=e.contentLeft,this._contentWidth=e.contentWidth,this._maxWidth=this._getMaxWidth()}}onLineMappingChanged(e){this._setPosition(this._range)}_setPosition(e){if(this._range=e,this._viewRange=null,this._range){const e=this._context.viewModel.model.validateRange(this._range);(this._context.viewModel.coordinatesConverter.modelPositionIsVisible(e.getStartPosition())||this._context.viewModel.coordinatesConverter.modelPositionIsVisible(e.getEndPosition()))&&(this._viewRange=this._context.viewModel.coordinatesConverter.convertModelRangeToViewRange(e))}}_getMaxWidth(){return this.allowEditorOverflow?window.innerWidth||document.documentElement.offsetWidth||document.body.offsetWidth:this._contentWidth}setPosition(e,t){this._setPosition(e),this._preference=t,this._viewRange&&this._preference&&this._preference.length>0?this.domNode.setDisplay("block"):this.domNode.setDisplay("none"),this._cachedDomNodeOffsetWidth=-1,this._cachedDomNodeOffsetHeight=-1}_layoutBoxInViewport(e,t,i,n,o){const s=e.top,r=s,a=t.top+this._lineHeight,l=s-n,d=r>=n,c=a,h=o.viewportHeight-a>=n;let u=e.left,g=t.left;return u+i>o.scrollLeft+o.viewportWidth&&(u=o.scrollLeft+o.viewportWidth-i),g+i>o.scrollLeft+o.viewportWidth&&(g=o.scrollLeft+o.viewportWidth-i),u<o.scrollLeft&&(u=o.scrollLeft),g<o.scrollLeft&&(g=o.scrollLeft),{fitsAbove:d,aboveTop:l,aboveLeft:u,fitsBelow:h,belowTop:c,belowLeft:g}}_layoutHorizontalSegmentInPage(e,t,i,n){const o=Math.max(0,t.left-n),s=Math.min(t.left+t.width+n,e.width);let r=t.left+i-xC.scrollX;if(r+n>s){const e=r-(s-n);r-=e,i-=e}if(r<o){const e=r-o;r-=e,i-=e}return[i,r]}_layoutBoxInPage(e,t,i,n,o){const s=e.top-n,r=t.top+this._lineHeight,a=yC(this._viewDomNode.domNode),l=a.top+s-xC.scrollY,d=a.top+r-xC.scrollY,c=vC(document.body),[h,u]=this._layoutHorizontalSegmentInPage(c,a,e.left-o.scrollLeft+this._contentLeft,i),[g,p]=this._layoutHorizontalSegmentInPage(c,a,t.left-o.scrollLeft+this._contentLeft,i),m=l>=22,f=d+n<=c.height-22;return this._fixedOverflowWidgets?{fitsAbove:m,aboveTop:Math.max(l,22),aboveLeft:u,fitsBelow:f,belowTop:d,belowLeft:p}:{fitsAbove:m,aboveTop:s,aboveLeft:h,fitsBelow:f,belowTop:r,belowLeft:g}}_prepareRenderWidgetAtExactPositionOverflowing(e){return new UI(e.top,e.left+this._contentLeft)}_getTopAndBottomLeft(e){if(!this._viewRange)return[null,null];const t=e.linesVisibleRangesForRange(this._viewRange,!1);if(!t||0===t.length)return[null,null];let i=t[0],n=t[0];for(const d of t)d.lineNumber<i.lineNumber&&(i=d),d.lineNumber>n.lineNumber&&(n=d);let o=1073741824;for(const d of i.ranges)d.left<o&&(o=d.left);let s=1073741824;for(const d of n.ranges)d.left<s&&(s=d.left);const r=e.getVerticalOffsetForLineNumber(i.lineNumber)-e.scrollTop,a=new UI(r,o),l=e.getVerticalOffsetForLineNumber(n.lineNumber)-e.scrollTop;return[a,new UI(l,s)]}_prepareRenderWidget(e){if(!this._preference||0===this._preference.length)return null;const[t,i]=this._getTopAndBottomLeft(e);if(!t||!i)return null;if(-1===this._cachedDomNodeOffsetWidth||-1===this._cachedDomNodeOffsetHeight){let e=null;if("function"==typeof this._actual.beforeRender&&(e=qI(this._actual.beforeRender,this._actual)),e)this._cachedDomNodeOffsetWidth=e.width,this._cachedDomNodeOffsetHeight=e.height;else{const e=this.domNode.domNode;this._cachedDomNodeOffsetWidth=e.offsetWidth,this._cachedDomNodeOffsetHeight=e.offsetHeight}}let n;n=this.allowEditorOverflow?this._layoutBoxInPage(t,i,this._cachedDomNodeOffsetWidth,this._cachedDomNodeOffsetHeight,e):this._layoutBoxInViewport(t,i,this._cachedDomNodeOffsetWidth,this._cachedDomNodeOffsetHeight,e);for(let o=1;o<=2;o++)for(const e of this._preference)if(1===e){if(!n)return null;if(2===o||n.fitsAbove)return{coordinate:new UI(n.aboveTop,n.aboveLeft),position:1}}else{if(2!==e)return this.allowEditorOverflow?{coordinate:this._prepareRenderWidgetAtExactPositionOverflowing(t),position:0}:{coordinate:t,position:0};if(!n)return null;if(2===o||n.fitsBelow)return{coordinate:new UI(n.belowTop,n.belowLeft),position:2}}return null}onBeforeRender(e){this._viewRange&&this._preference&&(this._viewRange.endLineNumber<e.startLineNumber||this._viewRange.startLineNumber>e.endLineNumber||this.domNode.setMaxWidth(this._maxWidth))}prepareRender(e){this._renderData=this._prepareRenderWidget(e)}render(e){if(!this._renderData)return this._isVisible&&(this.domNode.removeAttribute("monaco-visible-content-widget"),this._isVisible=!1,this.domNode.setVisibility("hidden")),void("function"==typeof this._actual.afterRender&&qI(this._actual.afterRender,this._actual,null));this.allowEditorOverflow?(this.domNode.setTop(this._renderData.coordinate.top),this.domNode.setLeft(this._renderData.coordinate.left)):(this.domNode.setTop(this._renderData.coordinate.top+e.scrollTop-e.bigNumbersDelta),this.domNode.setLeft(this._renderData.coordinate.left)),this._isVisible||(this.domNode.setVisibility("inherit"),this.domNode.setAttribute("monaco-visible-content-widget","true"),this._isVisible=!0),"function"==typeof this._actual.afterRender&&qI(this._actual.afterRender,this._actual,this._renderData.position)}}function qI(e,t,...i){try{return e.call(t,...i)}catch(Bte){return null}}class GI extends WN{constructor(e){super(),this._context=e;const t=this._context.configuration.options,i=t.get(131);this._lineHeight=t.get(59),this._renderLineHighlight=t.get(85),this._renderLineHighlightOnlyWhenFocus=t.get(86),this._contentLeft=i.contentLeft,this._contentWidth=i.contentWidth,this._selectionIsEmpty=!0,this._focused=!1,this._cursorLineNumbers=[1],this._selections=[new ar(1,1,1,1)],this._renderData=null,this._context.addEventHandler(this)}dispose(){this._context.removeEventHandler(this),super.dispose()}_readFromSelections(){let e=!1;const t=this._selections.map((e=>e.positionLineNumber));t.sort(((e,t)=>e-t)),jo(this._cursorLineNumbers,t)||(this._cursorLineNumbers=t,e=!0);const i=this._selections.every((e=>e.isEmpty()));return this._selectionIsEmpty!==i&&(this._selectionIsEmpty=i,e=!0),e}onThemeChanged(e){return this._readFromSelections()}onConfigurationChanged(e){const t=this._context.configuration.options,i=t.get(131);return this._lineHeight=t.get(59),this._renderLineHighlight=t.get(85),this._renderLineHighlightOnlyWhenFocus=t.get(86),this._contentLeft=i.contentLeft,this._contentWidth=i.contentWidth,!0}onCursorStateChanged(e){return this._selections=e.selections,this._readFromSelections()}onFlushed(e){return!0}onLinesDeleted(e){return!0}onLinesInserted(e){return!0}onScrollChanged(e){return e.scrollWidthChanged||e.scrollTopChanged}onZonesChanged(e){return!0}onFocusChanged(e){return!!this._renderLineHighlightOnlyWhenFocus&&(this._focused=e.isFocused,!0)}prepareRender(e){if(!this._shouldRenderThis())return void(this._renderData=null);const t=this._renderOne(e),i=e.visibleRange.startLineNumber,n=e.visibleRange.endLineNumber,o=this._cursorLineNumbers.length;let s=0;const r=[];for(let a=i;a<=n;a++){const e=a-i;for(;s<o&&this._cursorLineNumbers[s]<a;)s++;s<o&&this._cursorLineNumbers[s]===a?r[e]=t:r[e]=""}this._renderData=r}render(e,t){if(!this._renderData)return"";const i=t-e;return i>=this._renderData.length?"":this._renderData[i]}_shouldRenderInMargin(){return("gutter"===this._renderLineHighlight||"all"===this._renderLineHighlight)&&(!this._renderLineHighlightOnlyWhenFocus||this._focused)}_shouldRenderInContent(){return("line"===this._renderLineHighlight||"all"===this._renderLineHighlight)&&this._selectionIsEmpty&&(!this._renderLineHighlightOnlyWhenFocus||this._focused)}}class ZI extends GI{_renderOne(e){return`<div class="${"current-line"+(this._shouldRenderOther()?" current-line-both":"")}" style="width:${Math.max(e.scrollWidth,this._contentWidth)}px; height:${this._lineHeight}px;"></div>`}_shouldRenderThis(){return this._shouldRenderInContent()}_shouldRenderOther(){return this._shouldRenderInMargin()}}class YI extends GI{_renderOne(e){return`<div class="${"current-line"+(this._shouldRenderInMargin()?" current-line-margin":"")+(this._shouldRenderOther()?" current-line-margin-both":"")}" style="width:${this._contentLeft}px; height:${this._lineHeight}px;"></div>`}_shouldRenderThis(){return!0}_shouldRenderOther(){return this._shouldRenderInContent()}}sx(((e,t)=>{const i=e.getColor(zN);if(i&&(t.addRule(`.monaco-editor .view-overlays .current-line { background-color: ${i}; }`),t.addRule(`.monaco-editor .margin-view-overlays .current-line-margin { background-color: ${i}; border: none; }`)),!i||i.isTransparent()||e.defines(HN)){const i=e.getColor(HN);i&&(t.addRule(`.monaco-editor .view-overlays .current-line { border: 2px solid ${i}; }`),t.addRule(`.monaco-editor .margin-view-overlays .current-line-margin { border: 2px solid ${i}; }`),"hc"===e.type&&(t.addRule(".monaco-editor .view-overlays .current-line { border-width: 1px; }"),t.addRule(".monaco-editor .margin-view-overlays .current-line-margin { border-width: 1px; }")))}}));class XI extends WN{constructor(e){super(),this._context=e;const t=this._context.configuration.options;this._lineHeight=t.get(59),this._typicalHalfwidthCharacterWidth=t.get(44).typicalHalfwidthCharacterWidth,this._renderResult=null,this._context.addEventHandler(this)}dispose(){this._context.removeEventHandler(this),this._renderResult=null,super.dispose()}onConfigurationChanged(e){const t=this._context.configuration.options;return this._lineHeight=t.get(59),this._typicalHalfwidthCharacterWidth=t.get(44).typicalHalfwidthCharacterWidth,!0}onDecorationsChanged(e){return!0}onFlushed(e){return!0}onLinesChanged(e){return!0}onLinesDeleted(e){return!0}onLinesInserted(e){return!0}onScrollChanged(e){return e.scrollTopChanged||e.scrollWidthChanged}onZonesChanged(e){return!0}prepareRender(e){const t=e.getDecorationsInViewport();let i=[],n=0;for(let a=0,l=t.length;a<l;a++){const e=t[a];e.options.className&&(i[n++]=e)}i=i.sort(((e,t)=>{if(e.options.zIndex<t.options.zIndex)return-1;if(e.options.zIndex>t.options.zIndex)return 1;const i=e.options.className,n=t.options.className;return i<n?-1:i>n?1:qo.compareRangesUsingStarts(e.range,t.range)}));const o=e.visibleRange.startLineNumber,s=e.visibleRange.endLineNumber,r=[];for(let a=o;a<=s;a++){r[a-o]=""}this._renderWholeLineDecorations(e,i,r),this._renderNormalDecorations(e,i,r),this._renderResult=r}_renderWholeLineDecorations(e,t,i){const n=String(this._lineHeight),o=e.visibleRange.startLineNumber,s=e.visibleRange.endLineNumber;for(let r=0,a=t.length;r<a;r++){const e=t[r];if(!e.options.isWholeLine)continue;const a='<div class="cdr '+e.options.className+'" style="left:0;width:100%;height:'+n+'px;"></div>',l=Math.max(e.range.startLineNumber,o),d=Math.min(e.range.endLineNumber,s);for(let t=l;t<=d;t++){i[t-o]+=a}}}_renderNormalDecorations(e,t,i){const n=String(this._lineHeight),o=e.visibleRange.startLineNumber;let s=null,r=!1,a=null;for(let l=0,d=t.length;l<d;l++){const d=t[l];if(d.options.isWholeLine)continue;const c=d.options.className,h=Boolean(d.options.showIfCollapsed);let u=d.range;h&&1===u.endColumn&&u.endLineNumber!==u.startLineNumber&&(u=new qo(u.startLineNumber,u.startColumn,u.endLineNumber-1,this._context.viewModel.getLineMaxColumn(u.endLineNumber-1))),s===c&&r===h&&qo.areIntersectingOrTouching(a,u)?a=qo.plusRange(a,u):(null!==s&&this._renderNormalDecoration(e,a,s,r,n,o,i),s=c,r=h,a=u)}null!==s&&this._renderNormalDecoration(e,a,s,r,n,o,i)}_renderNormalDecoration(e,t,i,n,o,s,r){const a=e.linesVisibleRangesForRange(t,"findMatch"===i);if(a)for(let l=0,d=a.length;l<d;l++){const e=a[l];if(e.outsideRenderedLine)continue;const t=e.lineNumber-s;if(n&&1===e.ranges.length){const t=e.ranges[0];if(t.width<this._typicalHalfwidthCharacterWidth){const i=Math.round(t.left+t.width/2),n=Math.max(0,Math.round(i-this._typicalHalfwidthCharacterWidth/2));e.ranges[0]=new qL(n,this._typicalHalfwidthCharacterWidth)}}for(let n=0,s=e.ranges.length;n<s;n++){const s=e.ranges[n],a='<div class="cdr '+i+'" style="left:'+String(s.left)+"px;width:"+String(s.width)+"px;height:"+o+'px;"></div>';r[t]+=a}}}render(e,t){if(!this._renderResult)return"";const i=t-e;return i<0||i>=this._renderResult.length?"":this._renderResult[i]}}class QI extends Uo{onclick(e,t){this._register(nC(e,zC.CLICK,(e=>t(new Gw(e)))))}onmousedown(e,t){this._register(nC(e,zC.MOUSE_DOWN,(e=>t(new Gw(e)))))}onmouseover(e,t){this._register(nC(e,zC.MOUSE_OVER,(e=>t(new Gw(e)))))}onnonbubblingmouseout(e,t){this._register(lC(e,(e=>t(new Gw(e)))))}onkeydown(e,t){this._register(nC(e,zC.KEY_DOWN,(e=>t(new jw(e)))))}onkeyup(e,t){this._register(nC(e,zC.KEY_UP,(e=>t(new jw(e)))))}oninput(e,t){this._register(nC(e,zC.INPUT,t))}onblur(e,t){this._register(nC(e,zC.BLUR,t))}onfocus(e,t){this._register(nC(e,zC.FOCUS,t))}ignoreGesture(e){oS.ignoreTarget(e)}}const JI=11;class eT extends QI{constructor(e){super(),this._onActivate=e.onActivate,this.bgDomNode=document.createElement("div"),this.bgDomNode.className="arrow-background",this.bgDomNode.style.position="absolute",this.bgDomNode.style.width=e.bgWidth+"px",this.bgDomNode.style.height=e.bgHeight+"px",void 0!==e.top&&(this.bgDomNode.style.top="0px"),void 0!==e.left&&(this.bgDomNode.style.left="0px"),void 0!==e.bottom&&(this.bgDomNode.style.bottom="0px"),void 0!==e.right&&(this.bgDomNode.style.right="0px"),this.domNode=document.createElement("div"),this.domNode.className=e.className,this.domNode.classList.add(...e.icon.classNamesArray),this.domNode.style.position="absolute",this.domNode.style.width="11px",this.domNode.style.height="11px",void 0!==e.top&&(this.domNode.style.top=e.top+"px"),void 0!==e.left&&(this.domNode.style.left=e.left+"px"),void 0!==e.bottom&&(this.domNode.style.bottom=e.bottom+"px"),void 0!==e.right&&(this.domNode.style.right=e.right+"px"),this._mouseMoveMonitor=this._register(new rS),this.onmousedown(this.bgDomNode,(e=>this._arrowMouseDown(e))),this.onmousedown(this.domNode,(e=>this._arrowMouseDown(e))),this._mousedownRepeatTimer=this._register(new ab),this._mousedownScheduleRepeatTimer=this._register(new rb)}_arrowMouseDown(e){this._onActivate(),this._mousedownRepeatTimer.cancel(),this._mousedownScheduleRepeatTimer.cancelAndSet((()=>{this._mousedownRepeatTimer.cancelAndSet((()=>this._onActivate()),1e3/24)}),200),this._mouseMoveMonitor.startMonitoring(e.target,e.buttons,sS,(e=>{}),(()=>{this._mousedownRepeatTimer.cancel(),this._mousedownScheduleRepeatTimer.cancel()})),e.preventDefault()}}class tT extends Uo{constructor(e,t,i){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=i,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new rb)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this._updateShouldBeVisible())}setShouldBeVisible(e){this._rawShouldBeVisible=e,this._updateShouldBeVisible()}_applyVisibilitySetting(){return 2!==this._visibility&&(3===this._visibility||this._rawShouldBeVisible)}_updateShouldBeVisible(){const e=this._applyVisibilitySetting();this._shouldBeVisible!==e&&(this._shouldBeVisible=e,this.ensureVisibility())}setIsNeeded(e){this._isNeeded!==e&&(this._isNeeded=e,this.ensureVisibility())}setDomNode(e){this._domNode=e,this._domNode.setClassName(this._invisibleClassName),this.setShouldBeVisible(!1)}ensureVisibility(){this._isNeeded?this._shouldBeVisible?this._reveal():this._hide(!0):this._hide(!1)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet((()=>{this._domNode&&this._domNode.setClassName(this._visibleClassName)}),0))}_hide(e){this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,this._domNode&&this._domNode.setClassName(this._invisibleClassName+(e?" fade":"")))}}class iT extends QI{constructor(e){super(),this._lazyRender=e.lazyRender,this._host=e.host,this._scrollable=e.scrollable,this._scrollByPage=e.scrollByPage,this._scrollbarState=e.scrollbarState,this._visibilityController=this._register(new tT(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._mouseMoveMonitor=this._register(new rS),this._shouldRender=!0,this.domNode=p_(document.createElement("div")),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this._visibilityController.setDomNode(this.domNode),this.domNode.setPosition("absolute"),this.onmousedown(this.domNode.domNode,(e=>this._domNodeMouseDown(e)))}_createArrow(e){const t=this._register(new eT(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,i,n){this.slider=p_(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),"number"==typeof i&&this.slider.setWidth(i),"number"==typeof n&&this.slider.setHeight(n),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this.onmousedown(this.slider.domNode,(e=>{e.leftButton&&(e.preventDefault(),this._sliderMouseDown(e,(()=>{})))})),this.onclick(this.slider.domNode,(e=>{e.leftButton&&e.stopPropagation()}))}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodeMouseDown(e){e.target===this.domNode.domNode&&this._onMouseDown(e)}delegateMouseDown(e){const t=this.domNode.domNode.getClientRects()[0].top,i=t+this._scrollbarState.getSliderPosition(),n=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),o=this._sliderMousePosition(e);i<=o&&o<=n?e.leftButton&&(e.preventDefault(),this._sliderMouseDown(e,(()=>{}))):this._onMouseDown(e)}_onMouseDown(e){let t,i;if(e.target===this.domNode.domNode&&"number"==typeof e.browserEvent.offsetX&&"number"==typeof e.browserEvent.offsetY)t=e.browserEvent.offsetX,i=e.browserEvent.offsetY;else{const n=yC(this.domNode.domNode);t=e.posx-n.left,i=e.posy-n.top}const n=this._mouseDownRelativePosition(t,i);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(n):this._scrollbarState.getDesiredScrollPositionFromOffset(n)),e.leftButton&&(e.preventDefault(),this._sliderMouseDown(e,(()=>{})))}_sliderMouseDown(e,t){const i=this._sliderMousePosition(e),n=this._sliderOrthogonalMousePosition(e),o=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._mouseMoveMonitor.startMonitoring(e.target,e.buttons,sS,(e=>{const t=this._sliderOrthogonalMousePosition(e),s=Math.abs(t-n);if(Rs&&s>140)return void this._setDesiredScrollPositionNow(o.getScrollPosition());const r=this._sliderMousePosition(e)-i;this._setDesiredScrollPositionNow(o.getDesiredScrollPositionFromDelta(r))}),(()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd(),t()})),this._host.onDragStart()}_setDesiredScrollPositionNow(e){const t={};this.writeScrollPosition(t,e),this._scrollable.setScrollPositionNow(t)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}}class nT{constructor(e,t,i,n,o,s){this._scrollbarSize=Math.round(t),this._oppositeScrollbarSize=Math.round(i),this._arrowSize=Math.round(e),this._visibleSize=n,this._scrollSize=o,this._scrollPosition=s,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new nT(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(e){const t=Math.round(e);return this._visibleSize!==t&&(this._visibleSize=t,this._refreshComputedValues(),!0)}setScrollSize(e){const t=Math.round(e);return this._scrollSize!==t&&(this._scrollSize=t,this._refreshComputedValues(),!0)}setScrollPosition(e){const t=Math.round(e);return this._scrollPosition!==t&&(this._scrollPosition=t,this._refreshComputedValues(),!0)}setScrollbarSize(e){this._scrollbarSize=Math.round(e)}setOppositeScrollbarSize(e){this._oppositeScrollbarSize=Math.round(e)}static _computeValues(e,t,i,n,o){const s=Math.max(0,i-e),r=Math.max(0,s-2*t),a=n>0&&n>i;if(!a)return{computedAvailableSize:Math.round(s),computedIsNeeded:a,computedSliderSize:Math.round(r),computedSliderRatio:0,computedSliderPosition:0};const l=Math.round(Math.max(20,Math.floor(i*r/n))),d=(r-l)/(n-i),c=o*d;return{computedAvailableSize:Math.round(s),computedIsNeeded:a,computedSliderSize:Math.round(l),computedSliderRatio:d,computedSliderPosition:Math.round(c)}}_refreshComputedValues(){const e=nT._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=e.computedAvailableSize,this._computedIsNeeded=e.computedIsNeeded,this._computedSliderSize=e.computedSliderSize,this._computedSliderRatio=e.computedSliderRatio,this._computedSliderPosition=e.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(e){if(!this._computedIsNeeded)return 0;const t=e-this._arrowSize-this._computedSliderSize/2;return Math.round(t/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(e){if(!this._computedIsNeeded)return 0;const t=e-this._arrowSize;let i=this._scrollPosition;return t<this._computedSliderPosition?i-=this._visibleSize:i+=this._visibleSize,i}getDesiredScrollPositionFromDelta(e){if(!this._computedIsNeeded)return 0;const t=this._computedSliderPosition+e;return Math.round(t/this._computedSliderRatio)}}class oT extends iT{constructor(e,t,i){const n=e.getScrollDimensions(),o=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:i,scrollbarState:new nT(t.horizontalHasArrows?t.arrowSize:0,2===t.horizontal?0:t.horizontalScrollbarSize,2===t.vertical?0:t.verticalScrollbarSize,n.width,n.scrollWidth,o.scrollLeft),visibility:t.horizontal,extraScrollbarClassName:"horizontal",scrollable:e,scrollByPage:t.scrollByPage}),t.horizontalHasArrows){const e=(t.arrowSize-JI)/2,i=(t.horizontalScrollbarSize-JI)/2;this._createArrow({className:"scra",icon:br.scrollbarButtonLeft,top:i,left:e,bottom:void 0,right:void 0,bgWidth:t.arrowSize,bgHeight:t.horizontalScrollbarSize,onActivate:()=>this._host.onMouseWheel(new Zw(null,1,0))}),this._createArrow({className:"scra",icon:br.scrollbarButtonRight,top:i,left:void 0,bottom:void 0,right:e,bgWidth:t.arrowSize,bgHeight:t.horizontalScrollbarSize,onActivate:()=>this._host.onMouseWheel(new Zw(null,-1,0))})}this._createSlider(Math.floor((t.horizontalScrollbarSize-t.horizontalSliderSize)/2),0,void 0,t.horizontalSliderSize)}_updateSlider(e,t){this.slider.setWidth(e),this.slider.setLeft(t)}_renderDomNode(e,t){this.domNode.setWidth(e),this.domNode.setHeight(t),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(e.width)||this._shouldRender,this._shouldRender}_mouseDownRelativePosition(e,t){return e}_sliderMousePosition(e){return e.posx}_sliderOrthogonalMousePosition(e){return e.posy}_updateScrollbarSize(e){this.slider.setHeight(e)}writeScrollPosition(e,t){e.scrollLeft=t}updateOptions(e){this.updateScrollbarSize(2===e.horizontal?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(2===e.vertical?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}}class sT extends iT{constructor(e,t,i){const n=e.getScrollDimensions(),o=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:i,scrollbarState:new nT(t.verticalHasArrows?t.arrowSize:0,2===t.vertical?0:t.verticalScrollbarSize,0,n.height,n.scrollHeight,o.scrollTop),visibility:t.vertical,extraScrollbarClassName:"vertical",scrollable:e,scrollByPage:t.scrollByPage}),t.verticalHasArrows){const e=(t.arrowSize-JI)/2,i=(t.verticalScrollbarSize-JI)/2;this._createArrow({className:"scra",icon:br.scrollbarButtonUp,top:e,left:i,bottom:void 0,right:void 0,bgWidth:t.verticalScrollbarSize,bgHeight:t.arrowSize,onActivate:()=>this._host.onMouseWheel(new Zw(null,0,1))}),this._createArrow({className:"scra",icon:br.scrollbarButtonDown,top:void 0,left:i,bottom:e,right:void 0,bgWidth:t.verticalScrollbarSize,bgHeight:t.arrowSize,onActivate:()=>this._host.onMouseWheel(new Zw(null,0,-1))})}this._createSlider(0,Math.floor((t.verticalScrollbarSize-t.verticalSliderSize)/2),t.verticalSliderSize,void 0)}_updateSlider(e,t){this.slider.setHeight(e),this.slider.setTop(t)}_renderDomNode(e,t){this.domNode.setWidth(t),this.domNode.setHeight(e),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(e.height)||this._shouldRender,this._shouldRender}_mouseDownRelativePosition(e,t){return t}_sliderMousePosition(e){return e.posy}_sliderOrthogonalMousePosition(e){return e.posx}_updateScrollbarSize(e){this.slider.setWidth(e)}writeScrollPosition(e,t){e.scrollTop=t}updateOptions(e){this.updateScrollbarSize(2===e.vertical?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}}class rT{constructor(e,t,i,n,o,s,r){this._forceIntegerValues=e,this._scrollStateBrand=void 0,this._forceIntegerValues&&(t|=0,i|=0,n|=0,o|=0,s|=0,r|=0),this.rawScrollLeft=n,this.rawScrollTop=r,t<0&&(t=0),n+t>i&&(n=i-t),n<0&&(n=0),o<0&&(o=0),r+o>s&&(r=s-o),r<0&&(r=0),this.width=t,this.scrollWidth=i,this.scrollLeft=n,this.height=o,this.scrollHeight=s,this.scrollTop=r}equals(e){return this.rawScrollLeft===e.rawScrollLeft&&this.rawScrollTop===e.rawScrollTop&&this.width===e.width&&this.scrollWidth===e.scrollWidth&&this.scrollLeft===e.scrollLeft&&this.height===e.height&&this.scrollHeight===e.scrollHeight&&this.scrollTop===e.scrollTop}withScrollDimensions(e,t){return new rT(this._forceIntegerValues,void 0!==e.width?e.width:this.width,void 0!==e.scrollWidth?e.scrollWidth:this.scrollWidth,t?this.rawScrollLeft:this.scrollLeft,void 0!==e.height?e.height:this.height,void 0!==e.scrollHeight?e.scrollHeight:this.scrollHeight,t?this.rawScrollTop:this.scrollTop)}withScrollPosition(e){return new rT(this._forceIntegerValues,this.width,this.scrollWidth,void 0!==e.scrollLeft?e.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,void 0!==e.scrollTop?e.scrollTop:this.rawScrollTop)}createScrollEvent(e,t){const i=this.width!==e.width,n=this.scrollWidth!==e.scrollWidth,o=this.scrollLeft!==e.scrollLeft,s=this.height!==e.height,r=this.scrollHeight!==e.scrollHeight,a=this.scrollTop!==e.scrollTop;return{inSmoothScrolling:t,oldWidth:e.width,oldScrollWidth:e.scrollWidth,oldScrollLeft:e.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:e.height,oldScrollHeight:e.scrollHeight,oldScrollTop:e.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:i,scrollWidthChanged:n,scrollLeftChanged:o,heightChanged:s,scrollHeightChanged:r,scrollTopChanged:a}}}class aT extends Uo{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new $o),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new rT(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,t){const i=this._state.withScrollDimensions(e,t);this._setState(i,Boolean(this._smoothScrolling)),this._smoothScrolling&&this._smoothScrolling.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){const t=this._state.withScrollPosition(e);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(t,!1)}setScrollPositionSmooth(e,t){if(0===this._smoothScrollDuration)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:void 0===e.scrollLeft?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:void 0===e.scrollTop?this._smoothScrolling.to.scrollTop:e.scrollTop};const i=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===i.scrollLeft&&this._smoothScrolling.to.scrollTop===i.scrollTop)return;let n;n=t?new cT(this._smoothScrolling.from,i,this._smoothScrolling.startTime,this._smoothScrolling.duration):this._smoothScrolling.combine(this._state,i,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=n}else{const t=this._state.withScrollPosition(e);this._smoothScrolling=cT.start(this._state,t,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame((()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())}))}_performSmoothScrolling(){if(!this._smoothScrolling)return;const e=this._smoothScrolling.tick(),t=this._state.withScrollPosition(e);return this._setState(t,!0),this._smoothScrolling?e.isDone?(this._smoothScrolling.dispose(),void(this._smoothScrolling=null)):void(this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame((()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())}))):void 0}_setState(e,t){const i=this._state;i.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(i,t)))}}class lT{constructor(e,t,i){this.scrollLeft=e,this.scrollTop=t,this.isDone=i}}function dT(e,t){const i=t-e;return function(t){return e+i*(1-function(e){return Math.pow(e,3)}(1-t))}}class cT{constructor(e,t,i,n){this.from=e,this.to=t,this.duration=n,this.startTime=i,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(e,t,i){if(Math.abs(e-t)>2.5*i){let n,o;return e<t?(n=e+.75*i,o=t-.75*i):(n=e-.75*i,o=t+.75*i),function(e,t,i){return function(n){return n<i?e(n/i):t((n-i)/(1-i))}}(dT(e,n),dT(o,t),.33)}return dT(e,t)}dispose(){null!==this.animationFrameDisposable&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(e){this.to=e.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(e){const t=(e-this.startTime)/this.duration;if(t<1){const e=this.scrollLeft(t),i=this.scrollTop(t);return new lT(e,i,!1)}return new lT(this.to.scrollLeft,this.to.scrollTop,!0)}combine(e,t,i){return cT.start(e,t,i)}static start(e,t,i){i+=10;const n=Date.now()-10;return new cT(e,t,n,i)}}class hT{constructor(e,t,i){this.timestamp=e,this.deltaX=t,this.deltaY=i,this.score=0}}class uT{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(-1===this._front&&-1===this._rear)return!1;let e=1,t=0,i=1,n=this._rear;for(;;){const o=n===this._front?e:Math.pow(2,-i);if(e-=o,t+=this._memory[n].score*o,n===this._front)break;n=(this._capacity+n-1)%this._capacity,i++}return t<=.5}accept(e,t,i){const n=new hT(e,t,i);n.score=this._computeScore(n),-1===this._front&&-1===this._rear?(this._memory[0]=n,this._front=0,this._rear=0):(this._rear=(this._rear+1)%this._capacity,this._rear===this._front&&(this._front=(this._front+1)%this._capacity),this._memory[this._rear]=n)}_computeScore(e){if(Math.abs(e.deltaX)>0&&Math.abs(e.deltaY)>0)return 1;let t=.5;return(-1!==this._front||-1!==this._rear)&&this._memory[this._rear],this._isAlmostInt(e.deltaX)&&this._isAlmostInt(e.deltaY)||(t+=.25),Math.min(Math.max(t,0),1)}_isAlmostInt(e){return Math.abs(Math.round(e)-e)<.01}}uT.INSTANCE=new uT;class gT extends QI{constructor(e,t,i){super(),this._onScroll=this._register(new $o),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new $o),e.style.overflow="hidden",this._options=function(e){const t={lazyRender:void 0!==e.lazyRender&&e.lazyRender,className:void 0!==e.className?e.className:"",useShadows:void 0===e.useShadows||e.useShadows,handleMouseWheel:void 0===e.handleMouseWheel||e.handleMouseWheel,flipAxes:void 0!==e.flipAxes&&e.flipAxes,consumeMouseWheelIfScrollbarIsNeeded:void 0!==e.consumeMouseWheelIfScrollbarIsNeeded&&e.consumeMouseWheelIfScrollbarIsNeeded,alwaysConsumeMouseWheel:void 0!==e.alwaysConsumeMouseWheel&&e.alwaysConsumeMouseWheel,scrollYToX:void 0!==e.scrollYToX&&e.scrollYToX,mouseWheelScrollSensitivity:void 0!==e.mouseWheelScrollSensitivity?e.mouseWheelScrollSensitivity:1,fastScrollSensitivity:void 0!==e.fastScrollSensitivity?e.fastScrollSensitivity:5,scrollPredominantAxis:void 0===e.scrollPredominantAxis||e.scrollPredominantAxis,mouseWheelSmoothScroll:void 0===e.mouseWheelSmoothScroll||e.mouseWheelSmoothScroll,arrowSize:void 0!==e.arrowSize?e.arrowSize:11,listenOnDomNode:void 0!==e.listenOnDomNode?e.listenOnDomNode:null,horizontal:void 0!==e.horizontal?e.horizontal:1,horizontalScrollbarSize:void 0!==e.horizontalScrollbarSize?e.horizontalScrollbarSize:10,horizontalSliderSize:void 0!==e.horizontalSliderSize?e.horizontalSliderSize:0,horizontalHasArrows:void 0!==e.horizontalHasArrows&&e.horizontalHasArrows,vertical:void 0!==e.vertical?e.vertical:1,verticalScrollbarSize:void 0!==e.verticalScrollbarSize?e.verticalScrollbarSize:10,verticalHasArrows:void 0!==e.verticalHasArrows&&e.verticalHasArrows,verticalSliderSize:void 0!==e.verticalSliderSize?e.verticalSliderSize:0,scrollByPage:void 0!==e.scrollByPage&&e.scrollByPage};t.horizontalSliderSize=void 0!==e.horizontalSliderSize?e.horizontalSliderSize:t.horizontalScrollbarSize,t.verticalSliderSize=void 0!==e.verticalSliderSize?e.verticalSliderSize:t.verticalScrollbarSize,zo&&(t.className+=" mac");return t}(t),this._scrollable=i,this._register(this._scrollable.onScroll((e=>{this._onWillScroll.fire(e),this._onDidScroll(e),this._onScroll.fire(e)})));const n={onMouseWheel:e=>this._onMouseWheel(e),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new sT(this._scrollable,this._options,n)),this._horizontalScrollbar=this._register(new oT(this._scrollable,this._options,n)),this._domNode=document.createElement("div"),this._domNode.className="monaco-scrollable-element "+this._options.className,this._domNode.setAttribute("role","presentation"),this._domNode.style.position="relative",this._domNode.style.overflow="hidden",this._domNode.appendChild(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=p_(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=p_(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=p_(document.createElement("div")),this._topLeftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode||this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this.onmouseover(this._listenOnDomNode,(e=>this._onMouseOver(e))),this.onnonbubblingmouseout(this._listenOnDomNode,(e=>this._onMouseOut(e))),this._hideTimeout=this._register(new rb),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=bs(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarMouseDown(e){this._verticalScrollbar.delegateMouseDown(e)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}updateClassName(e){this._options.className=e,zo&&(this._options.className+=" mac"),this._domNode.className="monaco-scrollable-element "+this._options.className}updateOptions(e){void 0!==e.handleMouseWheel&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),void 0!==e.mouseWheelScrollSensitivity&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),void 0!==e.fastScrollSensitivity&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),void 0!==e.scrollPredominantAxis&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),void 0!==e.horizontal&&(this._options.horizontal=e.horizontal),void 0!==e.vertical&&(this._options.vertical=e.vertical),void 0!==e.horizontalScrollbarSize&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),void 0!==e.verticalScrollbarSize&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),void 0!==e.scrollByPage&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=bs(this._mouseWheelToDispose),e)){const e=e=>{this._onMouseWheel(new Zw(e))};this._mouseWheelToDispose.push(nC(this._listenOnDomNode,zC.MOUSE_WHEEL,e,{passive:!1}))}}_onMouseWheel(e){const t=uT.INSTANCE;{const i=window.devicePixelRatio/i_();Rs||Vo?t.accept(Date.now(),e.deltaX/i,e.deltaY/i):t.accept(Date.now(),e.deltaX,e.deltaY)}let i=!1;if(e.deltaY||e.deltaX){let n=e.deltaY*this._options.mouseWheelScrollSensitivity,o=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(Math.abs(n)>=Math.abs(o)?o=0:n=0),this._options.flipAxes&&([n,o]=[o,n]);const s=!zo&&e.browserEvent&&e.browserEvent.shiftKey;!this._options.scrollYToX&&!s||o||(o=n,n=0),e.browserEvent&&e.browserEvent.altKey&&(o*=this._options.fastScrollSensitivity,n*=this._options.fastScrollSensitivity);const r=this._scrollable.getFutureScrollPosition();let a={};if(n){const e=50*n,t=r.scrollTop-(e<0?Math.floor(e):Math.ceil(e));this._verticalScrollbar.writeScrollPosition(a,t)}if(o){const e=50*o,t=r.scrollLeft-(e<0?Math.floor(e):Math.ceil(e));this._horizontalScrollbar.writeScrollPosition(a,t)}if(a=this._scrollable.validateScrollPosition(a),r.scrollLeft!==a.scrollLeft||r.scrollTop!==a.scrollTop){this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(a):this._scrollable.setScrollPositionNow(a),i=!0}}let n=i;!n&&this._options.alwaysConsumeMouseWheel&&(n=!0),!n&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(n=!0),n&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw new Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){const e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,i=e.scrollLeft>0,n=i?" left":"",o=t?" top":"",s=i||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${n}`),this._topShadowDomNode.setClassName(`shadow${o}`),this._topLeftShadowDomNode.setClassName(`shadow${s}${o}${n}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseOut(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){this._mouseIsOver||this._isDragging||(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){this._mouseIsOver||this._isDragging||this._hideTimeout.cancelAndSet((()=>this._hide()),500)}}class pT extends gT{constructor(e,t){(t=t||{}).mouseWheelSmoothScroll=!1;const i=new aT({forceIntegerValues:!0,smoothScrollDuration:0,scheduleAtNextAnimationFrame:e=>hC(e)});super(e,t,i),this._register(i)}setScrollPosition(e){this._scrollable.setScrollPositionNow(e)}}class mT extends gT{constructor(e,t,i){super(e,t,i)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}}class fT extends gT{constructor(e,t){(t=t||{}).mouseWheelSmoothScroll=!1;const i=new aT({forceIntegerValues:!1,smoothScrollDuration:0,scheduleAtNextAnimationFrame:e=>hC(e)});super(e,t,i),this._register(i),this._element=e,this.onScroll((e=>{e.scrollTopChanged&&(this._element.scrollTop=e.scrollTop),e.scrollLeftChanged&&(this._element.scrollLeft=e.scrollLeft)})),this.scanDomNode()}setScrollPosition(e){this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}scanDomNode(){this.setScrollDimensions({width:this._element.clientWidth,scrollWidth:this._element.scrollWidth,height:this._element.clientHeight,scrollHeight:this._element.scrollHeight}),this.setScrollPosition({scrollLeft:this._element.scrollLeft,scrollTop:this._element.scrollTop})}}class _T extends jL{constructor(e,t,i,n){super(e);const o=this._context.configuration.options,s=o.get(92),r=o.get(67),a=o.get(34),l=o.get(95),d={listenOnDomNode:i.domNode,className:"editor-scrollable "+ix(e.theme.type),useShadows:!1,lazyRender:!0,vertical:s.vertical,horizontal:s.horizontal,verticalHasArrows:s.verticalHasArrows,horizontalHasArrows:s.horizontalHasArrows,verticalScrollbarSize:s.verticalScrollbarSize,verticalSliderSize:s.verticalSliderSize,horizontalScrollbarSize:s.horizontalScrollbarSize,horizontalSliderSize:s.horizontalSliderSize,handleMouseWheel:s.handleMouseWheel,alwaysConsumeMouseWheel:s.alwaysConsumeMouseWheel,arrowSize:s.arrowSize,mouseWheelScrollSensitivity:r,fastScrollSensitivity:a,scrollPredominantAxis:l,scrollByPage:s.scrollByPage};this.scrollbar=this._register(new mT(t.domNode,d,this._context.viewLayout.getScrollable())),UL.write(this.scrollbar.getDomNode(),5),this.scrollbarDomNode=p_(this.scrollbar.getDomNode()),this.scrollbarDomNode.setPosition("absolute"),this._setLayout();const c=(e,t,i)=>{const n={};if(t){const t=e.scrollTop;t&&(n.scrollTop=this._context.viewLayout.getCurrentScrollTop()+t,e.scrollTop=0)}if(i){const t=e.scrollLeft;t&&(n.scrollLeft=this._context.viewLayout.getCurrentScrollLeft()+t,e.scrollLeft=0)}this._context.viewModel.viewLayout.setScrollPosition(n,1)};this._register(nC(i.domNode,"scroll",(e=>c(i.domNode,!0,!0)))),this._register(nC(t.domNode,"scroll",(e=>c(t.domNode,!0,!1)))),this._register(nC(n.domNode,"scroll",(e=>c(n.domNode,!0,!1)))),this._register(nC(this.scrollbarDomNode.domNode,"scroll",(e=>c(this.scrollbarDomNode.domNode,!0,!1))))}dispose(){super.dispose()}_setLayout(){const e=this._context.configuration.options,t=e.get(131);this.scrollbarDomNode.setLeft(t.contentLeft);"right"===e.get(65).side?this.scrollbarDomNode.setWidth(t.contentWidth+t.minimap.minimapWidth):this.scrollbarDomNode.setWidth(t.contentWidth),this.scrollbarDomNode.setHeight(t.height)}getOverviewRulerLayoutInfo(){return this.scrollbar.getOverviewRulerLayoutInfo()}getDomNode(){return this.scrollbarDomNode}delegateVerticalScrollbarMouseDown(e){this.scrollbar.delegateVerticalScrollbarMouseDown(e)}onConfigurationChanged(e){if(e.hasChanged(92)||e.hasChanged(67)||e.hasChanged(34)){const e=this._context.configuration.options,t=e.get(92),i=e.get(67),n=e.get(34),o=e.get(95),s={vertical:t.vertical,horizontal:t.horizontal,verticalScrollbarSize:t.verticalScrollbarSize,horizontalScrollbarSize:t.horizontalScrollbarSize,scrollByPage:t.scrollByPage,handleMouseWheel:t.handleMouseWheel,mouseWheelScrollSensitivity:i,fastScrollSensitivity:n,scrollPredominantAxis:o};this.scrollbar.updateOptions(s)}return e.hasChanged(131)&&this._setLayout(),!0}onScrollChanged(e){return!0}onThemeChanged(e){return this.scrollbar.updateClassName("editor-scrollable "+ix(this._context.theme.type)),!0}prepareRender(e){}render(e){this.scrollbar.renderNow()}}sx(((e,t)=>{const i=e.getColor(QS);i&&t.addRule(`\n\t\t\t.monaco-scrollable-element > .shadow.top {\n\t\t\t\tbox-shadow: ${i} 0 6px 6px -6px inset;\n\t\t\t}\n\n\t\t\t.monaco-scrollable-element > .shadow.left {\n\t\t\t\tbox-shadow: ${i} 6px 0 6px -6px inset;\n\t\t\t}\n\n\t\t\t.monaco-scrollable-element > .shadow.top.left {\n\t\t\t\tbox-shadow: ${i} 6px 6px 6px -6px inset;\n\t\t\t}\n\t\t`);const n=e.getColor(JS);n&&t.addRule(`\n\t\t\t.monaco-scrollable-element > .scrollbar > .slider {\n\t\t\t\tbackground: ${n};\n\t\t\t}\n\t\t`);const o=e.getColor(ek);o&&t.addRule(`\n\t\t\t.monaco-scrollable-element > .scrollbar > .slider:hover {\n\t\t\t\tbackground: ${o};\n\t\t\t}\n\t\t`);const s=e.getColor(tk);s&&t.addRule(`\n\t\t\t.monaco-scrollable-element > .scrollbar > .slider.active {\n\t\t\t\tbackground: ${s};\n\t\t\t}\n\t\t`)}));class vT{constructor(e,t,i){this._decorationToRenderBrand=void 0,this.startLineNumber=+e,this.endLineNumber=+t,this.className=String(i)}}class bT extends WN{_render(e,t,i){const n=[];for(let r=e;r<=t;r++){n[r-e]=[]}if(0===i.length)return n;i.sort(((e,t)=>e.className===t.className?e.startLineNumber===t.startLineNumber?e.endLineNumber-t.endLineNumber:e.startLineNumber-t.startLineNumber:e.className<t.className?-1:1));let o=null,s=0;for(let r=0,a=i.length;r<a;r++){const a=i[r],l=a.className;let d=Math.max(a.startLineNumber,e)-e;const c=Math.min(a.endLineNumber,t)-e;o===l?(d=Math.max(s+1,d),s=Math.max(s,c)):(o=l,s=c);for(let e=d;e<=s;e++)n[e].push(o)}return n}}class wT extends bT{constructor(e){super(),this._context=e;const t=this._context.configuration.options,i=t.get(131);this._lineHeight=t.get(59),this._glyphMargin=t.get(50),this._glyphMarginLeft=i.glyphMarginLeft,this._glyphMarginWidth=i.glyphMarginWidth,this._renderResult=null,this._context.addEventHandler(this)}dispose(){this._context.removeEventHandler(this),this._renderResult=null,super.dispose()}onConfigurationChanged(e){const t=this._context.configuration.options,i=t.get(131);return this._lineHeight=t.get(59),this._glyphMargin=t.get(50),this._glyphMarginLeft=i.glyphMarginLeft,this._glyphMarginWidth=i.glyphMarginWidth,!0}onDecorationsChanged(e){return!0}onFlushed(e){return!0}onLinesChanged(e){return!0}onLinesDeleted(e){return!0}onLinesInserted(e){return!0}onScrollChanged(e){return e.scrollTopChanged}onZonesChanged(e){return!0}_getDecorations(e){const t=e.getDecorationsInViewport(),i=[];let n=0;for(let o=0,s=t.length;o<s;o++){const e=t[o],s=e.options.glyphMarginClassName;s&&(i[n++]=new vT(e.range.startLineNumber,e.range.endLineNumber,s))}return i}prepareRender(e){if(!this._glyphMargin)return void(this._renderResult=null);const t=e.visibleRange.startLineNumber,i=e.visibleRange.endLineNumber,n=this._render(t,i,this._getDecorations(e)),o=this._lineHeight.toString(),s='" style="left:'+this._glyphMarginLeft.toString()+"px;width:"+this._glyphMarginWidth.toString()+"px;height:"+o+'px;"></div>',r=[];for(let a=t;a<=i;a++){const e=a-t,i=n[e];0===i.length?r[e]="":r[e]='<div class="cgmr codicon '+i.join(" ")+s}this._renderResult=r}render(e,t){if(!this._renderResult)return"";const i=t-e;return i<0||i>=this._renderResult.length?"":this._renderResult[i]}}var CT;function yT(e,t){let i=0,n=0;const o=e.length;for(;n<o;){const o=e.charCodeAt(n);if(32===o)i++;else{if(9!==o)break;i=i-i%t+t}n++}return n===o?-1:i}!function(e){e[e.Disabled=0]="Disabled",e[e.EnabledForActive=1]="EnabledForActive",e[e.Enabled=2]="Enabled"}(CT||(CT={}));class xT{constructor(e,t,i){this.visibleColumn=e,this.className=t,this.horizontalLine=i}}class ST{constructor(e,t){this.top=e,this.endColumn=t}}class kT extends class{constructor(){this._isDisposed=!1}dispose(){this._isDisposed=!0}assertNotDisposed(){if(this._isDisposed)throw new Error("TextModelPart is disposed!")}}{constructor(e,t){super(),this.textModel=e,this.languageConfigurationService=t}getLanguageConfiguration(e){return this.languageConfigurationService.getLanguageConfiguration(e)}_computeIndentLevel(e){return yT(this.textModel.getLineContent(e+1),this.textModel.getOptions().tabSize)}getActiveIndentGuide(e,t,i){this.assertNotDisposed();const n=this.textModel.getLineCount();if(e<1||e>n)throw new Error("Illegal value for lineNumber");const o=this.getLanguageConfiguration(this.textModel.getLanguageId()).foldingRules,s=Boolean(o&&o.offSide);let r=-2,a=-1,l=-2,d=-1;const c=e=>{if(-1!==r&&(-2===r||r>e-1)){r=-1,a=-1;for(let t=e-2;t>=0;t--){const e=this._computeIndentLevel(t);if(e>=0){r=t,a=e;break}}}if(-2===l){l=-1,d=-1;for(let t=e;t<n;t++){const e=this._computeIndentLevel(t);if(e>=0){l=t,d=e;break}}}};let h=-2,u=-1,g=-2,p=-1;const m=e=>{if(-2===h){h=-1,u=-1;for(let t=e-2;t>=0;t--){const e=this._computeIndentLevel(t);if(e>=0){h=t,u=e;break}}}if(-1!==g&&(-2===g||g<e-1)){g=-1,p=-1;for(let t=e;t<n;t++){const e=this._computeIndentLevel(t);if(e>=0){g=t,p=e;break}}}};let f=0,_=!0,v=0,b=!0,w=0,C=0;for(let y=0;_||b;y++){const o=e-y,r=e+y;y>1&&(o<1||o<t)&&(_=!1),y>1&&(r>n||r>i)&&(b=!1),y>5e4&&(_=!1,b=!1);let g=-1;if(_&&o>=1){const e=this._computeIndentLevel(o-1);e>=0?(l=o-1,d=e,g=Math.ceil(e/this.textModel.getOptions().indentSize)):(c(o),g=this._getIndentLevelForWhitespaceLine(s,a,d))}let x=-1;if(b&&r<=n){const e=this._computeIndentLevel(r-1);e>=0?(h=r-1,u=e,x=Math.ceil(e/this.textModel.getOptions().indentSize)):(m(r),x=this._getIndentLevelForWhitespaceLine(s,u,p))}if(0!==y){if(1===y){if(r<=n&&x>=0&&C+1===x){_=!1,f=r,v=r,w=x;continue}if(o>=1&&g>=0&&g-1===C){b=!1,f=o,v=o,w=g;continue}if(f=e,v=e,w=C,0===w)return{startLineNumber:f,endLineNumber:v,indent:w}}_&&(g>=w?f=o:_=!1),b&&(x>=w?v=r:b=!1)}else C=g}return{startLineNumber:f,endLineNumber:v,indent:w}}getLinesBracketGuides(e,t,i,n){var o,s,r,a,l;const d=[],c=this.textModel.bracketPairs.getBracketPairsInRangeWithMinIndentation(new qo(e,1,t,this.textModel.getLineMaxColumn(t)));let h;if(i&&c.length>0){const n=e<=i.lineNumber&&i.lineNumber<=t?c.filter((e=>qo.strictContainsPosition(e.range,i))):this.textModel.bracketPairs.getBracketPairsInRange(qo.fromPositions(i));h=null===(o=wr(n,(e=>e.range.startLineNumber!==e.range.endLineNumber)))||void 0===o?void 0:o.range}const u=new Cr(c),g=new Array,p=new Array,m=new DT;for(let f=e;f<=t;f++){let e=new Array;p.length>0&&(e=e.concat(p),p.length=0),d.push(e);for(const i of u.takeWhile((e=>e.openingBracketRange.startLineNumber<=f))||[]){if(i.range.startLineNumber===i.range.endLineNumber)continue;const e=Math.min(this.getVisibleColumnFromPosition(i.openingBracketRange.getStartPosition()),this.getVisibleColumnFromPosition(null!==(r=null===(s=i.closingBracketRange)||void 0===s?void 0:s.getStartPosition())&&void 0!==r?r:i.range.getEndPosition()),i.minVisibleColumnIndentation+1);let t=!1;if(i.closingBracketRange){xs(this.textModel.getLineContent(i.closingBracketRange.startLineNumber))<i.closingBracketRange.startColumn-1&&(t=!0)}const n=i.openingBracketRange.getStartPosition(),o=null!==(l=null===(a=i.closingBracketRange)||void 0===a?void 0:a.getStartPosition())&&void 0!==l?l:i.range.getEndPosition();void 0===i.closingBracketRange?g[i.nestingLevel]=null:g[i.nestingLevel]={nestingLevel:i.nestingLevel,guideVisibleColumn:e,start:n,visibleStartColumn:this.getVisibleColumnFromPosition(n),end:o,visibleEndColumn:this.getVisibleColumnFromPosition(o),bracketPair:i,renderHorizontalEndLineAtTheBottom:t}}for(const i of g){if(!i)continue;const t=h&&i.bracketPair.range.equalsRange(h),o=m.getInlineClassNameOfLevel(i.nestingLevel)+(n.highlightActive&&t?" "+m.activeClassName:"");(t&&n.horizontalGuides!==CT.Disabled||n.includeInactive&&n.horizontalGuides===CT.Enabled)&&(i.start.lineNumber===f&&i.guideVisibleColumn<i.visibleStartColumn&&e.push(new xT(i.guideVisibleColumn,o,new ST(!1,i.start.column))),i.end.lineNumber===f+1&&i.guideVisibleColumn<i.visibleEndColumn&&p.push(new xT(i.guideVisibleColumn,o,new ST(!i.renderHorizontalEndLineAtTheBottom,i.end.column))))}let t=Number.MAX_SAFE_INTEGER;for(let i=g.length-1;i>=0;i--){const o=g[i];if(!o)continue;const s=n.highlightActive&&h&&o.bracketPair.range.equalsRange(h),r=m.getInlineClassNameOfLevel(o.nestingLevel)+(s?" "+m.activeClassName:"");(s||n.includeInactive)&&o.renderHorizontalEndLineAtTheBottom&&o.end.lineNumber===f+1&&p.push(new xT(o.guideVisibleColumn,r,null)),o.end.lineNumber<=f||o.start.lineNumber>=f||(o.guideVisibleColumn>=t&&!s||(t=o.guideVisibleColumn,(s||n.includeInactive)&&e.push(new xT(o.guideVisibleColumn,r,null))))}e.sort(((e,t)=>e.visibleColumn-t.visibleColumn))}return d}getVisibleColumnFromPosition(e){return dN.visibleColumnFromColumn(this.textModel.getLineContent(e.lineNumber),e.column,this.textModel.getOptions().tabSize)+1}getLinesIndentGuides(e,t){this.assertNotDisposed();const i=this.textModel.getLineCount();if(e<1||e>i)throw new Error("Illegal value for startLineNumber");if(t<1||t>i)throw new Error("Illegal value for endLineNumber");const n=this.textModel.getOptions(),o=this.getLanguageConfiguration(this.textModel.getLanguageId()).foldingRules,s=Boolean(o&&o.offSide),r=new Array(t-e+1);let a=-2,l=-1,d=-2,c=-1;for(let h=e;h<=t;h++){const t=h-e,o=this._computeIndentLevel(h-1);if(o>=0)a=h-1,l=o,r[t]=Math.ceil(o/n.indentSize);else{if(-2===a){a=-1,l=-1;for(let e=h-2;e>=0;e--){const t=this._computeIndentLevel(e);if(t>=0){a=e,l=t;break}}}if(-1!==d&&(-2===d||d<h-1)){d=-1,c=-1;for(let e=h;e<i;e++){const t=this._computeIndentLevel(e);if(t>=0){d=e,c=t;break}}}r[t]=this._getIndentLevelForWhitespaceLine(s,l,c)}}return r}_getIndentLevelForWhitespaceLine(e,t,i){const n=this.textModel.getOptions();return-1===t||-1===i?0:t<i?1+Math.floor(t/n.indentSize):t===i||e?Math.ceil(i/n.indentSize):1+Math.floor(i/n.indentSize)}}class DT{constructor(){this.activeClassName="indent-active"}getInlineClassNameOfLevel(e){return"bracket-indent-guide lvl-"+e%30}}class LT extends WN{constructor(e){super(),this._context=e,this._primaryPosition=null;const t=this._context.configuration.options,i=t.get(132),n=t.get(44);this._lineHeight=t.get(59),this._spaceWidth=n.spaceWidth,this._maxIndentLeft=-1===i.wrappingColumn?-1:i.wrappingColumn*n.typicalHalfwidthCharacterWidth,this._bracketPairGuideOptions=t.get(13),this._renderResult=null,this._context.addEventHandler(this)}dispose(){this._context.removeEventHandler(this),this._renderResult=null,super.dispose()}onConfigurationChanged(e){const t=this._context.configuration.options,i=t.get(132),n=t.get(44);return this._lineHeight=t.get(59),this._spaceWidth=n.spaceWidth,this._maxIndentLeft=-1===i.wrappingColumn?-1:i.wrappingColumn*n.typicalHalfwidthCharacterWidth,this._bracketPairGuideOptions=t.get(13),!0}onCursorStateChanged(e){var t;const i=e.selections[0].getPosition();return!(null===(t=this._primaryPosition)||void 0===t?void 0:t.equals(i))&&(this._primaryPosition=i,!0)}onDecorationsChanged(e){return!0}onFlushed(e){return!0}onLinesChanged(e){return!0}onLinesDeleted(e){return!0}onLinesInserted(e){return!0}onScrollChanged(e){return e.scrollTopChanged}onZonesChanged(e){return!0}onLanguageConfigurationChanged(e){return!0}prepareRender(e){var t,i,n,o;if(!this._bracketPairGuideOptions.indentation&&!1===this._bracketPairGuideOptions.bracketPairs)return void(this._renderResult=null);const s=e.visibleRange.startLineNumber,r=e.visibleRange.endLineNumber,a=e.scrollWidth,l=this._lineHeight,d=this._primaryPosition,c=this.getGuidesByLine(s,r,d),h=[];for(let u=s;u<=r;u++){const r=u-s,d=c[r];let g="";const p=null!==(i=null===(t=e.visibleRangeForPosition(new er(u,1)))||void 0===t?void 0:t.left)&&void 0!==i?i:0;for(const t of d){const i=p+(t.visibleColumn-1)*this._spaceWidth;if(i>a||this._maxIndentLeft>0&&i>this._maxIndentLeft)break;const s=t.horizontalLine?t.horizontalLine.top?"horizontal-top":"horizontal-bottom":"vertical",r=t.horizontalLine?(null!==(o=null===(n=e.visibleRangeForPosition(new er(u,t.horizontalLine.endColumn)))||void 0===n?void 0:n.left)&&void 0!==o?o:i+this._spaceWidth)-i:this._spaceWidth;g+=`<div class="core-guide ${t.className} ${s}" style="left:${i}px;height:${l}px;width:${r}px"></div>`}h[r]=g}this._renderResult=h}getGuidesByLine(e,t,i){const n=!1!==this._bracketPairGuideOptions.bracketPairs?this._context.viewModel.getBracketGuidesInRangeByLine(e,t,i,{highlightActive:this._bracketPairGuideOptions.highlightActiveBracketPair,horizontalGuides:!0===this._bracketPairGuideOptions.bracketPairsHorizontal?CT.Enabled:"active"===this._bracketPairGuideOptions.bracketPairsHorizontal?CT.EnabledForActive:CT.Disabled,includeInactive:!0===this._bracketPairGuideOptions.bracketPairs}):null,o=this._bracketPairGuideOptions.indentation?this._context.viewModel.getLinesIndentGuides(e,t):null;let s=0,r=0,a=0;if(this._bracketPairGuideOptions.highlightActiveIndentation&&i){const n=this._context.viewModel.getActiveIndentGuide(i.lineNumber,e,t);s=n.startLineNumber,r=n.endLineNumber,a=n.indent}const{indentSize:l}=this._context.viewModel.model.getOptions(),d=[];for(let c=e;c<=t;c++){const t=new Array;d.push(t);const i=n?n[c-e]:[],h=new Cr(i),u=o?o[c-e]:[];for(let e=1;e<=u;e++){const n=(e-1)*l+1,o=0===i.length&&s<=c&&c<=r&&e===a;t.push(...h.takeWhile((e=>e.visibleColumn<n))||[]);const d=h.peek();d&&d.visibleColumn===n&&!d.horizontalLine||t.push(new xT(n,o?"core-guide-indent-active":"core-guide-indent",null))}t.push(...h.takeWhile((e=>!0))||[])}return d}render(e,t){if(!this._renderResult)return"";const i=t-e;return i<0||i>=this._renderResult.length?"":this._renderResult[i]}}function NT(e){if(!e||!e.isTransparent())return e}sx(((e,t)=>{const i=e.getColor(YN);i&&t.addRule(`.monaco-editor .lines-content .core-guide-indent { box-shadow: 1px 0 0 0 ${i} inset; }`);const n=e.getColor(XN)||i;n&&t.addRule(`.monaco-editor .lines-content .core-guide-indent-active { box-shadow: 1px 0 0 0 ${n} inset; }`);const o=[{bracketColor:_E,guideColor:SE,guideColorActive:IE},{bracketColor:vE,guideColor:kE,guideColorActive:TE},{bracketColor:bE,guideColor:DE,guideColorActive:ME},{bracketColor:wE,guideColor:LE,guideColorActive:AE},{bracketColor:CE,guideColor:NE,guideColorActive:OE},{bracketColor:yE,guideColor:EE,guideColorActive:RE}],s=new DT,r=o.map((t=>{var i,n;const o=e.getColor(t.bracketColor),s=e.getColor(t.guideColor),r=e.getColor(t.guideColorActive),a=NT(null!==(i=NT(s))&&void 0!==i?i:null==o?void 0:o.transparent(.3)),l=NT(null!==(n=NT(r))&&void 0!==n?n:o);if(a&&l)return{guideColor:a,guideColorActive:l}})).filter(yr);if(r.length>0){for(let e=0;e<30;e++){const i=r[e%r.length];t.addRule(`.monaco-editor .${s.getInlineClassNameOfLevel(e).replace(/ /g,".")} { --guide-color: ${i.guideColor}; --guide-color-active: ${i.guideColorActive}; }`)}t.addRule(".monaco-editor .vertical { box-shadow: 1px 0 0 0 var(--guide-color) inset; }"),t.addRule(".monaco-editor .horizontal-top { border-top: 1px solid var(--guide-color); }"),t.addRule(".monaco-editor .horizontal-bottom { border-bottom: 1px solid var(--guide-color); }"),t.addRule(`.monaco-editor .vertical.${s.activeClassName} { box-shadow: 1px 0 0 0 var(--guide-color-active) inset; }`),t.addRule(`.monaco-editor .horizontal-top.${s.activeClassName} { border-top: 1px solid var(--guide-color-active); }`),t.addRule(`.monaco-editor .horizontal-bottom.${s.activeClassName} { border-bottom: 1px solid var(--guide-color-active); }`)}}));class ET{constructor(){this._currentVisibleRange=new qo(1,1,1,1)}getCurrentVisibleRange(){return this._currentVisibleRange}setCurrentVisibleRange(e){this._currentVisibleRange=e}}class IT{constructor(e,t,i,n,o,s,r){this.minimalReveal=e,this.lineNumber=t,this.startColumn=i,this.endColumn=n,this.startScrollTop=o,this.stopScrollTop=s,this.scrollType=r,this.type="range",this.minLineNumber=t,this.maxLineNumber=t}}class TT{constructor(e,t,i,n,o){this.minimalReveal=e,this.selections=t,this.startScrollTop=i,this.stopScrollTop=n,this.scrollType=o,this.type="selections";let s=t[0].startLineNumber,r=t[0].endLineNumber;for(let a=1,l=t.length;a<l;a++){const e=t[a];s=Math.min(s,e.startLineNumber),r=Math.max(r,e.endLineNumber)}this.minLineNumber=s,this.maxLineNumber=r}}class MT extends jL{constructor(e,t){super(e),this._linesContent=t,this._textRangeRestingSpot=document.createElement("div"),this._visibleLines=new BI(this),this.domNode=this._visibleLines.domNode;const i=this._context.configuration,n=this._context.configuration.options,o=n.get(44),s=n.get(132),r=n.get(131);this._lineHeight=n.get(59),this._typicalHalfwidthCharacterWidth=o.typicalHalfwidthCharacterWidth,this._isViewportWrapping=s.isViewportWrapping,this._revealHorizontalRightPadding=n.get(89),this._horizontalScrollbarHeight=r.horizontalScrollbarHeight,this._cursorSurroundingLines=n.get(25),this._cursorSurroundingLinesStyle=n.get(26),this._canUseLayerHinting=!n.get(28),this._viewLineOptions=new tN(i,this._context.theme.type),UL.write(this.domNode,7),this.domNode.setClassName("view-lines monaco-mouse-cursor-text"),m_(this.domNode,o),this._maxLineWidth=0,this._asyncUpdateLineWidths=new lb((()=>{this._updateLineWidthsSlow()}),200),this._asyncCheckMonospaceFontAssumptions=new lb((()=>{this._checkMonospaceFontAssumptions()}),2e3),this._lastRenderedData=new ET,this._horizontalRevealRequest=null}dispose(){this._asyncUpdateLineWidths.dispose(),this._asyncCheckMonospaceFontAssumptions.dispose(),super.dispose()}getDomNode(){return this.domNode}createVisibleLine(){return new iN(this._viewLineOptions)}onConfigurationChanged(e){this._visibleLines.onConfigurationChanged(e),e.hasChanged(132)&&(this._maxLineWidth=0);const t=this._context.configuration.options,i=t.get(44),n=t.get(132),o=t.get(131);return this._lineHeight=t.get(59),this._typicalHalfwidthCharacterWidth=i.typicalHalfwidthCharacterWidth,this._isViewportWrapping=n.isViewportWrapping,this._revealHorizontalRightPadding=t.get(89),this._horizontalScrollbarHeight=o.horizontalScrollbarHeight,this._cursorSurroundingLines=t.get(25),this._cursorSurroundingLinesStyle=t.get(26),this._canUseLayerHinting=!t.get(28),m_(this.domNode,i),this._onOptionsMaybeChanged(),e.hasChanged(131)&&(this._maxLineWidth=0),!0}_onOptionsMaybeChanged(){const e=this._context.configuration,t=new tN(e,this._context.theme.type);if(!this._viewLineOptions.equals(t)){this._viewLineOptions=t;const e=this._visibleLines.getStartLineNumber(),i=this._visibleLines.getEndLineNumber();for(let t=e;t<=i;t++){this._visibleLines.getVisibleLine(t).onOptionsChanged(this._viewLineOptions)}return!0}return!1}onCursorStateChanged(e){const t=this._visibleLines.getStartLineNumber(),i=this._visibleLines.getEndLineNumber();let n=!1;for(let o=t;o<=i;o++)n=this._visibleLines.getVisibleLine(o).onSelectionChanged()||n;return n}onDecorationsChanged(e){{const e=this._visibleLines.getStartLineNumber(),t=this._visibleLines.getEndLineNumber();for(let i=e;i<=t;i++)this._visibleLines.getVisibleLine(i).onDecorationsChanged()}return!0}onFlushed(e){const t=this._visibleLines.onFlushed(e);return this._maxLineWidth=0,t}onLinesChanged(e){return this._visibleLines.onLinesChanged(e)}onLinesDeleted(e){return this._visibleLines.onLinesDeleted(e)}onLinesInserted(e){return this._visibleLines.onLinesInserted(e)}onRevealRangeRequest(e){const t=this._computeScrollTopToRevealRange(this._context.viewLayout.getFutureViewport(),e.source,e.minimalReveal,e.range,e.selections,e.verticalType);if(-1===t)return!1;let i=this._context.viewLayout.validateScrollPosition({scrollTop:t});e.revealHorizontal?e.range&&e.range.startLineNumber!==e.range.endLineNumber?i={scrollTop:i.scrollTop,scrollLeft:0}:e.range?this._horizontalRevealRequest=new IT(e.minimalReveal,e.range.startLineNumber,e.range.startColumn,e.range.endColumn,this._context.viewLayout.getCurrentScrollTop(),i.scrollTop,e.scrollType):e.selections&&e.selections.length>0&&(this._horizontalRevealRequest=new TT(e.minimalReveal,e.selections,this._context.viewLayout.getCurrentScrollTop(),i.scrollTop,e.scrollType)):this._horizontalRevealRequest=null;const n=Math.abs(this._context.viewLayout.getCurrentScrollTop()-i.scrollTop)<=this._lineHeight?1:e.scrollType;return this._context.viewModel.viewLayout.setScrollPosition(i,n),!0}onScrollChanged(e){if(this._horizontalRevealRequest&&e.scrollLeftChanged&&(this._horizontalRevealRequest=null),this._horizontalRevealRequest&&e.scrollTopChanged){const t=Math.min(this._horizontalRevealRequest.startScrollTop,this._horizontalRevealRequest.stopScrollTop),i=Math.max(this._horizontalRevealRequest.startScrollTop,this._horizontalRevealRequest.stopScrollTop);(e.scrollTop<t||e.scrollTop>i)&&(this._horizontalRevealRequest=null)}return this.domNode.setWidth(e.scrollWidth),this._visibleLines.onScrollChanged(e)||!0}onTokensChanged(e){return this._visibleLines.onTokensChanged(e)}onZonesChanged(e){return this._context.viewModel.viewLayout.setMaxLineWidth(this._maxLineWidth),this._visibleLines.onZonesChanged(e)}onThemeChanged(e){return this._onOptionsMaybeChanged()}getPositionFromDOMInfo(e,t){const i=this._getViewLineDomNode(e);if(null===i)return null;const n=this._getLineNumberFor(i);if(-1===n)return null;if(n<1||n>this._context.viewModel.getLineCount())return null;if(1===this._context.viewModel.getLineMaxColumn(n))return new er(n,1);const o=this._visibleLines.getStartLineNumber(),s=this._visibleLines.getEndLineNumber();if(n<o||n>s)return null;let r=this._visibleLines.getVisibleLine(n).getColumnOfNodeOffset(n,e,t);const a=this._context.viewModel.getLineMinColumn(n);return r<a&&(r=a),new er(n,r)}_getViewLineDomNode(e){for(;e&&1===e.nodeType;){if(e.className===iN.CLASS_NAME)return e;e=e.parentElement}return null}_getLineNumberFor(e){const t=this._visibleLines.getStartLineNumber(),i=this._visibleLines.getEndLineNumber();for(let n=t;n<=i;n++){if(e===this._visibleLines.getVisibleLine(n).getDomNode())return n}return-1}getLineWidth(e){const t=this._visibleLines.getStartLineNumber(),i=this._visibleLines.getEndLineNumber();return e<t||e>i?-1:this._visibleLines.getVisibleLine(e).getWidth()}linesVisibleRangesForRange(e,t){if(this.shouldRender())return null;const i=e.endLineNumber,n=qo.intersectRanges(e,this._lastRenderedData.getCurrentVisibleRange());if(!n)return null;let o=[],s=0;const r=new eN(this.domNode.domNode,this._textRangeRestingSpot);let a=0;t&&(a=this._context.viewModel.coordinatesConverter.convertViewPositionToModelPosition(new er(n.startLineNumber,1)).lineNumber);const l=this._visibleLines.getStartLineNumber(),d=this._visibleLines.getEndLineNumber();for(let c=n.startLineNumber;c<=n.endLineNumber;c++){if(c<l||c>d)continue;const e=c===n.startLineNumber?n.startColumn:1,h=c===n.endLineNumber?n.endColumn:this._context.viewModel.getLineMaxColumn(c),u=this._visibleLines.getVisibleLine(c).getVisibleRangesForRange(c,e,h,r);if(u){if(t&&c<i){const e=a;a=this._context.viewModel.coordinatesConverter.convertViewPositionToModelPosition(new er(c+1,1)).lineNumber,e!==a&&(u.ranges[u.ranges.length-1].width+=this._typicalHalfwidthCharacterWidth)}o[s++]=new KL(u.outsideRenderedLine,c,qL.from(u.ranges))}}return 0===s?null:o}_visibleRangesForLineRange(e,t,i){return this.shouldRender()||e<this._visibleLines.getStartLineNumber()||e>this._visibleLines.getEndLineNumber()?null:this._visibleLines.getVisibleLine(e).getVisibleRangesForRange(e,t,i,new eN(this.domNode.domNode,this._textRangeRestingSpot))}visibleRangeForPosition(e){const t=this._visibleRangesForLineRange(e.lineNumber,e.column,e.column);return t?new ZL(t.outsideRenderedLine,t.ranges[0].left):null}updateLineWidths(){this._updateLineWidths(!1)}_updateLineWidthsFast(){return this._updateLineWidths(!0)}_updateLineWidthsSlow(){this._updateLineWidths(!1)}_updateLineWidths(e){const t=this._visibleLines.getStartLineNumber(),i=this._visibleLines.getEndLineNumber();let n=1,o=!0;for(let s=t;s<=i;s++){const t=this._visibleLines.getVisibleLine(s);!e||t.getWidthIsFast()?n=Math.max(n,t.getWidth()):o=!1}return o&&1===t&&i===this._context.viewModel.getLineCount()&&(this._maxLineWidth=0),this._ensureMaxLineWidth(n),o}_checkMonospaceFontAssumptions(){let e=-1,t=-1;const i=this._visibleLines.getStartLineNumber(),n=this._visibleLines.getEndLineNumber();for(let o=i;o<=n;o++){const i=this._visibleLines.getVisibleLine(o);if(i.needsMonospaceFontCheck()){const n=i.getWidth();n>t&&(t=n,e=o)}}if(-1!==e&&!this._visibleLines.getVisibleLine(e).monospaceAssumptionsAreValid())for(let o=i;o<=n;o++){this._visibleLines.getVisibleLine(o).onMonospaceAssumptionsInvalidated()}}prepareRender(){throw new Error("Not supported")}render(){throw new Error("Not supported")}renderText(e){if(this._visibleLines.renderLines(e),this._lastRenderedData.setCurrentVisibleRange(e.visibleRange),this.domNode.setWidth(this._context.viewLayout.getScrollWidth()),this.domNode.setHeight(Math.min(this._context.viewLayout.getScrollHeight(),1e6)),this._horizontalRevealRequest){const t=this._horizontalRevealRequest;if(e.startLineNumber<=t.minLineNumber&&t.maxLineNumber<=e.endLineNumber){this._horizontalRevealRequest=null,this.onDidRender();const e=this._computeScrollLeftToReveal(t);e&&(this._isViewportWrapping||this._ensureMaxLineWidth(e.maxHorizontalOffset),this._context.viewModel.viewLayout.setScrollPosition({scrollLeft:e.scrollLeft},t.scrollType))}}if(this._updateLineWidthsFast()||this._asyncUpdateLineWidths.schedule(),Vo&&!this._asyncCheckMonospaceFontAssumptions.isScheduled()){const e=this._visibleLines.getStartLineNumber(),t=this._visibleLines.getEndLineNumber();for(let i=e;i<=t;i++){if(this._visibleLines.getVisibleLine(i).needsMonospaceFontCheck()){this._asyncCheckMonospaceFontAssumptions.schedule();break}}}this._linesContent.setLayerHinting(this._canUseLayerHinting),this._linesContent.setContain("strict");const t=this._context.viewLayout.getCurrentScrollTop()-e.bigNumbersDelta;this._linesContent.setTop(-t),this._linesContent.setLeft(-this._context.viewLayout.getCurrentScrollLeft())}_ensureMaxLineWidth(e){const t=Math.ceil(e);this._maxLineWidth<t&&(this._maxLineWidth=t,this._context.viewModel.viewLayout.setMaxLineWidth(this._maxLineWidth))}_computeScrollTopToRevealRange(e,t,i,n,o,s){const r=e.top,a=e.height,l=r+a;let d,c,h;if(o&&o.length>0){let e=o[0].startLineNumber,t=o[0].endLineNumber;for(let i=1,n=o.length;i<n;i++){const n=o[i];e=Math.min(e,n.startLineNumber),t=Math.max(t,n.endLineNumber)}d=!1,c=this._context.viewLayout.getVerticalOffsetForLineNumber(e),h=this._context.viewLayout.getVerticalOffsetForLineNumber(t)+this._lineHeight}else{if(!n)return-1;d=!0,c=this._context.viewLayout.getVerticalOffsetForLineNumber(n.startLineNumber),h=this._context.viewLayout.getVerticalOffsetForLineNumber(n.endLineNumber)+this._lineHeight}if(("mouse"===t||i)&&"default"===this._cursorSurroundingLinesStyle)i||(c-=this._lineHeight);else{const e=Math.min(a/this._lineHeight/2,this._cursorSurroundingLines);c-=e*this._lineHeight,h+=Math.max(0,e-1)*this._lineHeight}let u;if(0!==s&&4!==s||(h+=i?this._horizontalScrollbarHeight:this._lineHeight),h-c>a){if(!d)return-1;u=c}else if(5===s||6===s)if(6===s&&r<=c&&h<=l)u=r;else{const e=c-Math.max(5*this._lineHeight,.2*a),t=h-a;u=Math.max(t,e)}else if(1===s||2===s)if(2===s&&r<=c&&h<=l)u=r;else{const e=(c+h)/2;u=Math.max(0,e-a/2)}else u=this._computeMinimumScrolling(r,l,c,h,3===s,4===s);return u}_computeScrollLeftToReveal(e){const t=this._context.viewLayout.getCurrentViewport(),i=t.left,n=i+t.width;let o=1073741824,s=0;if("range"===e.type){const t=this._visibleRangesForLineRange(e.lineNumber,e.startColumn,e.endColumn);if(!t)return null;for(const e of t.ranges)o=Math.min(o,Math.round(e.left)),s=Math.max(s,Math.round(e.left+e.width))}else for(const r of e.selections){if(r.startLineNumber!==r.endLineNumber)return null;const e=this._visibleRangesForLineRange(r.startLineNumber,r.startColumn,r.endColumn);if(!e)return null;for(const t of e.ranges)o=Math.min(o,Math.round(t.left)),s=Math.max(s,Math.round(t.left+t.width))}if(e.minimalReveal||(o=Math.max(0,o-MT.HORIZONTAL_EXTRA_PX),s+=this._revealHorizontalRightPadding),"selections"===e.type&&s-o>t.width)return null;return{scrollLeft:this._computeMinimumScrolling(i,n,o,s),maxHorizontalOffset:s}}_computeMinimumScrolling(e,t,i,n,o,s){o=!!o,s=!!s;const r=(t|=0)-(e|=0);return(n|=0)-(i|=0)<r?o?i:s?Math.max(0,n-r):i<e?i:n>t?Math.max(0,n-r):e:i}}MT.HORIZONTAL_EXTRA_PX=30;class AT extends bT{constructor(e){super(),this._context=e;const t=this._context.configuration.options.get(131);this._decorationsLeft=t.decorationsLeft,this._decorationsWidth=t.decorationsWidth,this._renderResult=null,this._context.addEventHandler(this)}dispose(){this._context.removeEventHandler(this),this._renderResult=null,super.dispose()}onConfigurationChanged(e){const t=this._context.configuration.options.get(131);return this._decorationsLeft=t.decorationsLeft,this._decorationsWidth=t.decorationsWidth,!0}onDecorationsChanged(e){return!0}onFlushed(e){return!0}onLinesChanged(e){return!0}onLinesDeleted(e){return!0}onLinesInserted(e){return!0}onScrollChanged(e){return e.scrollTopChanged}onZonesChanged(e){return!0}_getDecorations(e){const t=e.getDecorationsInViewport(),i=[];let n=0;for(let o=0,s=t.length;o<s;o++){const e=t[o],s=e.options.linesDecorationsClassName;s&&(i[n++]=new vT(e.range.startLineNumber,e.range.endLineNumber,s));const r=e.options.firstLineDecorationClassName;r&&(i[n++]=new vT(e.range.startLineNumber,e.range.startLineNumber,r))}return i}prepareRender(e){const t=e.visibleRange.startLineNumber,i=e.visibleRange.endLineNumber,n=this._render(t,i,this._getDecorations(e)),o='" style="left:'+this._decorationsLeft.toString()+"px;width:"+this._decorationsWidth.toString()+'px;"></div>',s=[];for(let r=t;r<=i;r++){const e=r-t,i=n[e];let a="";for(let t=0,n=i.length;t<n;t++)a+='<div class="cldr '+i[t]+o;s[e]=a}this._renderResult=s}render(e,t){return this._renderResult?this._renderResult[t-e]:""}}class OT extends bT{constructor(e){super(),this._context=e,this._renderResult=null,this._context.addEventHandler(this)}dispose(){this._context.removeEventHandler(this),this._renderResult=null,super.dispose()}onConfigurationChanged(e){return!0}onDecorationsChanged(e){return!0}onFlushed(e){return!0}onLinesChanged(e){return!0}onLinesDeleted(e){return!0}onLinesInserted(e){return!0}onScrollChanged(e){return e.scrollTopChanged}onZonesChanged(e){return!0}_getDecorations(e){const t=e.getDecorationsInViewport(),i=[];let n=0;for(let o=0,s=t.length;o<s;o++){const e=t[o],s=e.options.marginClassName;s&&(i[n++]=new vT(e.range.startLineNumber,e.range.endLineNumber,s))}return i}prepareRender(e){const t=e.visibleRange.startLineNumber,i=e.visibleRange.endLineNumber,n=this._render(t,i,this._getDecorations(e)),o=[];for(let s=t;s<=i;s++){const e=s-t,i=n[e];let r="";for(let t=0,n=i.length;t<n;t++)r+='<div class="cmdr '+i[t]+'" style=""></div>';o[e]=r}this._renderResult=o}render(e,t){return this._renderResult?this._renderResult[t-e]:""}}class RT{constructor(e,t,i,n){this._rgba8Brand=void 0,this.r=RT._clamp(e),this.g=RT._clamp(t),this.b=RT._clamp(i),this.a=RT._clamp(n)}equals(e){return this.r===e.r&&this.g===e.g&&this.b===e.b&&this.a===e.a}static _clamp(e){return e<0?0:e>255?255:0|e}}RT.Empty=new RT(0,0,0,0);class PT extends Uo{constructor(){super(),this._onDidChange=new $o,this.onDidChange=this._onDidChange.event,this._updateColorMap(),this._register(Ns.onDidChange((e=>{e.changedColorMap&&this._updateColorMap()})))}static getInstance(){return this._INSTANCE||(this._INSTANCE=xr(new PT)),this._INSTANCE}_updateColorMap(){const e=Ns.getColorMap();if(!e)return this._colors=[RT.Empty],void(this._backgroundIsLight=!0);this._colors=[RT.Empty];for(let i=1;i<e.length;i++){const t=e[i].rgba;this._colors[i]=new RT(t.r,t.g,t.b,Math.round(255*t.a))}const t=e[2].getRelativeLuminance();this._backgroundIsLight=t>=.5,this._onDidChange.fire(void 0)}getColor(e){return(e<1||e>=this._colors.length)&&(e=2),this._colors[e]}backgroundIsLight(){return this._backgroundIsLight}}PT._INSTANCE=null;const FT=(()=>{const e=[];for(let t=32;t<=126;t++)e.push(t);return e.push(65533),e})();class BT{constructor(e,t){this.scale=t,this._minimapCharRendererBrand=void 0,this.charDataNormal=BT.soften(e,.8),this.charDataLight=BT.soften(e,50/60)}static soften(e,t){const i=new Uint8ClampedArray(e.length);for(let n=0,o=e.length;n<o;n++)i[n]=Sr(e[n]*t);return i}renderChar(e,t,i,n,o,s,r,a,l,d,c){const h=1*this.scale,u=2*this.scale,g=c?1:u;if(t+h>e.width||i+g>e.height)return;const p=d?this.charDataLight:this.charDataNormal,m=((e,t)=>(e-=32)<0||e>96?t<=2?(e+96)%96:95:e)(n,l),f=4*e.width,_=r.r,v=r.g,b=r.b,w=o.r-_,C=o.g-v,y=o.b-b,x=Math.max(s,a),S=e.data;let k=m*h*u,D=i*f+4*t;for(let L=0;L<g;L++){let e=D;for(let t=0;t<h;t++){const t=p[k++]/255*(s/255);S[e++]=_+w*t,S[e++]=v+C*t,S[e++]=b+y*t,S[e++]=x}D+=f}}blockRenderChar(e,t,i,n,o,s,r,a){const l=1*this.scale,d=2*this.scale,c=a?1:d;if(t+l>e.width||i+c>e.height)return;const h=4*e.width,u=o/255*.5,g=s.r,p=s.g,m=s.b,f=g+(n.r-g)*u,_=p+(n.g-p)*u,v=m+(n.b-m)*u,b=Math.max(o,r),w=e.data;let C=i*h+4*t;for(let y=0;y<c;y++){let e=C;for(let t=0;t<l;t++)w[e++]=f,w[e++]=_,w[e++]=v,w[e++]=b;C+=h}}}const VT={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15},WT=e=>{const t=new Uint8ClampedArray(e.length/2);for(let i=0;i<e.length;i+=2)t[i>>1]=VT[e[i]]<<4|15&VT[e[i+1]];return t},zT={1:kr((()=>WT("0000511D6300CF609C709645A78432005642574171487021003C451900274D35D762755E8B629C5BA856AF57BA649530C167D1512A272A3F6038604460398526BCA2A968DB6F8957C768BE5FBE2FB467CF5D8D5B795DC7625B5DFF50DE64C466DB2FC47CD860A65E9A2EB96CB54CE06DA763AB2EA26860524D3763536601005116008177A8705E53AB738E6A982F88BAA35B5F5B626D9C636B449B737E5B7B678598869A662F6B5B8542706C704C80736A607578685B70594A49715A4522E792"))),2:kr((()=>WT("000000000000000055394F383D2800008B8B1F210002000081B1CBCBCC820000847AAF6B9AAF2119BE08B8881AD60000A44FD07DCCF107015338130C00000000385972265F390B406E2437634B4B48031B12B8A0847000001E15B29A402F0000000000004B33460B00007A752C2A0000000000004D3900000084394B82013400ABA5CFC7AD9C0302A45A3E5A98AB000089A43382D97900008BA54AA087A70A0248A6A7AE6DBE0000BF6F94987EA40A01A06DCFA7A7A9030496C32F77891D0000A99FB1A0AFA80603B29AB9CA75930D010C0948354D3900000C0948354F37460D0028BE673D8400000000AF9D7B6E00002B007AA8933400007AA642675C2700007984CFB9C3985B768772A8A6B7B20000CAAECAAFC4B700009F94A6009F840009D09F9BA4CA9C0000CC8FC76DC87F0000C991C472A2000000A894A48CA7B501079BA2C9C69BA20000B19A5D3FA89000005CA6009DA2960901B0A7F0669FB200009D009E00B7890000DAD0F5D092820000D294D4C48BD10000B5A7A4A3B1A50402CAB6CBA6A2000000B5A7A4A3B1A8044FCDADD19D9CB00000B7778F7B8AAE0803C9AB5D3F5D3F00009EA09EA0BAB006039EA0989A8C7900009B9EF4D6B7C00000A9A7816CACA80000ABAC84705D3F000096DA635CDC8C00006F486F266F263D4784006124097B00374F6D2D6D2D6D4A3A95872322000000030000000000008D8939130000000000002E22A5C9CBC70600AB25C0B5C9B400061A2DB04CA67001082AA6BEBEBFC606002321DACBC19E03087AA08B6768380000282FBAC0B8CA7A88AD25BBA5A29900004C396C5894A6000040485A6E356E9442A32CD17EADA70000B4237923628600003E2DE9C1D7B500002F25BBA5A2990000231DB6AFB4A804023025C0B5CAB588062B2CBDBEC0C706882435A75CA20000002326BD6A82A908048B4B9A5A668000002423A09CB4BB060025259C9D8A7900001C1FCAB2C7C700002A2A9387ABA200002626A4A47D6E9D14333163A0C87500004B6F9C2D643A257049364936493647358A34438355497F1A0000A24C1D590000D38DFFBDD4CD3126")))};class HT{static create(e,t){if(this.lastCreated&&e===this.lastCreated.scale&&t===this.lastFontFamily)return this.lastCreated;let i;return i=zT[e]?new BT(zT[e](),e):HT.createFromSampleData(HT.createSampleData(t).data,e),this.lastFontFamily=t,this.lastCreated=i,i}static createSampleData(e){const t=document.createElement("canvas"),i=t.getContext("2d");t.style.height="16px",t.height=16,t.width=960,t.style.width="960px",i.fillStyle="#ffffff",i.font=`bold 16px ${e}`,i.textBaseline="middle";let n=0;for(const o of FT)i.fillText(String.fromCharCode(o),n,8),n+=10;return i.getImageData(0,0,960,16)}static createFromSampleData(e,t){if(61440!==e.length)throw new Error("Unexpected source in MinimapCharRenderer");const i=HT._downsample(e,t);return new BT(i,t)}static _downsampleChar(e,t,i,n,o){const s=1*o,r=2*o;let a=n,l=0;for(let d=0;d<r;d++){const n=d/r*16,o=(d+1)/r*16;for(let r=0;r<s;r++){const d=r/s*10,c=(r+1)/s*10;let h=0,u=0;for(let i=n;i<o;i++){const n=t+3840*Math.floor(i),o=1-(i-Math.floor(i));for(let t=d;t<c;t++){const i=1-(t-Math.floor(t)),s=n+4*Math.floor(t),r=i*o;u+=r,h+=e[s]*e[s+3]/255*r}}const g=h/u;l=Math.max(l,g),i[a++]=Sr(g)}}return l}static _downsample(e,t){const i=2*t*1*t,n=96*i,o=new Uint8ClampedArray(n);let s=0,r=0,a=0;for(let l=0;l<96;l++)a=Math.max(a,this._downsampleChar(e,r,o,s,t)),s+=i,r+=40;if(a>0){const e=255/a;for(let t=0;t<n;t++)o[t]*=e}return o}}class jT{constructor(e,t,i){const n=e.options,o=n.get(129),s=n.get(131),r=s.minimap,a=n.get(44),l=n.get(65);this.renderMinimap=r.renderMinimap,this.size=l.size,this.minimapHeightIsEditorHeight=r.minimapHeightIsEditorHeight,this.scrollBeyondLastLine=n.get(94),this.showSlider=l.showSlider,this.pixelRatio=o,this.typicalHalfwidthCharacterWidth=a.typicalHalfwidthCharacterWidth,this.lineHeight=n.get(59),this.minimapLeft=r.minimapLeft,this.minimapWidth=r.minimapWidth,this.minimapHeight=s.height,this.canvasInnerWidth=r.minimapCanvasInnerWidth,this.canvasInnerHeight=r.minimapCanvasInnerHeight,this.canvasOuterWidth=r.minimapCanvasOuterWidth,this.canvasOuterHeight=r.minimapCanvasOuterHeight,this.isSampling=r.minimapIsSampling,this.editorHeight=s.height,this.fontScale=r.minimapScale,this.minimapLineHeight=r.minimapLineHeight,this.minimapCharWidth=1*this.fontScale,this.charRenderer=kr((()=>HT.create(this.fontScale,a.fontFamily))),this.defaultBackgroundColor=i.getColor(2),this.backgroundColor=jT._getMinimapBackground(t,this.defaultBackgroundColor),this.foregroundAlpha=jT._getMinimapForegroundOpacity(t)}static _getMinimapBackground(e,t){const i=e.getColor(uL);return i?new RT(i.rgba.r,i.rgba.g,i.rgba.b,Math.round(255*i.rgba.a)):t}static _getMinimapForegroundOpacity(e){const t=e.getColor(gL);return t?RT._clamp(Math.round(255*t.rgba.a)):255}equals(e){return this.renderMinimap===e.renderMinimap&&this.size===e.size&&this.minimapHeightIsEditorHeight===e.minimapHeightIsEditorHeight&&this.scrollBeyondLastLine===e.scrollBeyondLastLine&&this.showSlider===e.showSlider&&this.pixelRatio===e.pixelRatio&&this.typicalHalfwidthCharacterWidth===e.typicalHalfwidthCharacterWidth&&this.lineHeight===e.lineHeight&&this.minimapLeft===e.minimapLeft&&this.minimapWidth===e.minimapWidth&&this.minimapHeight===e.minimapHeight&&this.canvasInnerWidth===e.canvasInnerWidth&&this.canvasInnerHeight===e.canvasInnerHeight&&this.canvasOuterWidth===e.canvasOuterWidth&&this.canvasOuterHeight===e.canvasOuterHeight&&this.isSampling===e.isSampling&&this.editorHeight===e.editorHeight&&this.fontScale===e.fontScale&&this.minimapLineHeight===e.minimapLineHeight&&this.minimapCharWidth===e.minimapCharWidth&&this.defaultBackgroundColor&&this.defaultBackgroundColor.equals(e.defaultBackgroundColor)&&this.backgroundColor&&this.backgroundColor.equals(e.backgroundColor)&&this.foregroundAlpha===e.foregroundAlpha}}class UT{constructor(e,t,i,n,o,s,r,a){this.scrollTop=e,this.scrollHeight=t,this.sliderNeeded=i,this._computedSliderRatio=n,this.sliderTop=o,this.sliderHeight=s,this.startLineNumber=r,this.endLineNumber=a}getDesiredScrollTopFromDelta(e){return Math.round(this.scrollTop+e/this._computedSliderRatio)}getDesiredScrollTopFromTouchLocation(e){return Math.round((e-this.sliderHeight/2)/this._computedSliderRatio)}static create(e,t,i,n,o,s,r,a,l,d,c){const h=e.pixelRatio,u=e.minimapLineHeight,g=Math.floor(e.canvasInnerHeight/u),p=e.lineHeight;if(e.minimapHeightIsEditorHeight){const t=a*e.lineHeight+(e.scrollBeyondLastLine?o-e.lineHeight:0),i=Math.max(1,Math.floor(o*o/t)),n=Math.max(0,e.minimapHeight-i),s=n/(d-o),c=l*s,h=n>0,u=Math.floor(e.canvasInnerHeight/e.minimapLineHeight);return new UT(l,d,h,s,c,i,1,Math.min(r,u))}let m,f;if(s&&i!==r){const e=i-t+1;m=Math.floor(e*u/h)}else{const e=o/p;m=Math.floor(e*u/h)}f=e.scrollBeyondLastLine?(r-1)*u/h:Math.max(0,r*u/h-m),f=Math.min(e.minimapHeight-m,f);const _=f/(d-o),v=l*_;let b=0;if(e.scrollBeyondLastLine){b=o/p-1}if(g>=r+b){return new UT(l,d,f>0,_,v,m,1,r)}{let e=Math.max(1,Math.floor(t-v*h/u));c&&c.scrollHeight===d&&(c.scrollTop>l&&(e=Math.min(e,c.startLineNumber)),c.scrollTop<l&&(e=Math.max(e,c.startLineNumber)));const i=Math.min(r,e+g-1);return new UT(l,d,!0,_,(t-e+(l-n)/p)*u/h,m,e,i)}}}class $T{constructor(e){this.dy=e}onContentChanged(){this.dy=-1}onTokensChanged(){this.dy=-1}}$T.INVALID=new $T(-1);class KT{constructor(e,t,i){this.renderedLayout=e,this._imageData=t,this._renderedLines=new FI((()=>$T.INVALID)),this._renderedLines._set(e.startLineNumber,i)}linesEquals(e){if(!this.scrollEquals(e))return!1;const t=this._renderedLines._get().lines;for(let i=0,n=t.length;i<n;i++)if(-1===t[i].dy)return!1;return!0}scrollEquals(e){return this.renderedLayout.startLineNumber===e.startLineNumber&&this.renderedLayout.endLineNumber===e.endLineNumber}_get(){const e=this._renderedLines._get();return{imageData:this._imageData,rendLineNumberStart:e.rendLineNumberStart,lines:e.lines}}onLinesChanged(e,t){return this._renderedLines.onLinesChanged(e,t)}onLinesDeleted(e,t){this._renderedLines.onLinesDeleted(e,t)}onLinesInserted(e,t){this._renderedLines.onLinesInserted(e,t)}onTokensChanged(e){return this._renderedLines.onTokensChanged(e)}}class qT{constructor(e,t,i,n){this._backgroundFillData=qT._createBackgroundFillData(t,i,n),this._buffers=[e.createImageData(t,i),e.createImageData(t,i)],this._lastUsedBuffer=0}getBuffer(){this._lastUsedBuffer=1-this._lastUsedBuffer;const e=this._buffers[this._lastUsedBuffer];return e.data.set(this._backgroundFillData),e}static _createBackgroundFillData(e,t,i){const n=i.r,o=i.g,s=i.b,r=i.a,a=new Uint8ClampedArray(e*t*4);let l=0;for(let d=0;d<t;d++)for(let t=0;t<e;t++)a[l]=n,a[l+1]=o,a[l+2]=s,a[l+3]=r,l+=4;return a}}class GT{constructor(e,t){this.samplingRatio=e,this.minimapLines=t}static compute(e,t,i){if(0===e.renderMinimap||!e.isSampling)return[null,[]];const n=e.pixelRatio,o=e.lineHeight,s=e.scrollBeyondLastLine,{minimapLineCount:r}=Pf.computeContainedMinimapLineCount({viewLineCount:t,scrollBeyondLastLine:s,height:e.editorHeight,lineHeight:o,pixelRatio:n}),a=t/r,l=a/2;if(!i||0===i.minimapLines.length){const e=[];if(e[0]=1,r>1){for(let t=0,i=r-1;t<i;t++)e[t]=Math.round(t*a+l);e[r-1]=t}return[new GT(a,e),[]]}const d=i.minimapLines,c=d.length,h=[];let u=0,g=0,p=1;let m=[],f=null;for(let _=0;_<r;_++){const e=Math.max(p,Math.round(_*a)),i=Math.max(e,Math.round((_+1)*a));for(;u<c&&d[u]<e;){if(m.length<10){const e=u+1+g;f&&"deleted"===f.type&&f._oldIndex===u-1?f.deleteToLineNumber++:(f={type:"deleted",_oldIndex:u,deleteFromLineNumber:e,deleteToLineNumber:e},m.push(f)),g--}u++}let n;if(u<c&&d[u]<=i)n=d[u],u++;else if(n=0===_?1:_+1===r?t:Math.round(_*a+l),m.length<10){const e=u+1+g;f&&"inserted"===f.type&&f._i===_-1?f.insertToLineNumber++:(f={type:"inserted",_i:_,insertFromLineNumber:e,insertToLineNumber:e},m.push(f)),g++}h[_]=n,p=n}if(m.length<10)for(;u<c;){const e=u+1+g;f&&"deleted"===f.type&&f._oldIndex===u-1?f.deleteToLineNumber++:(f={type:"deleted",_oldIndex:u,deleteFromLineNumber:e,deleteToLineNumber:e},m.push(f)),g--,u++}else m=[{type:"flush"}];return[new GT(a,h),m]}modelLineToMinimapLine(e){return Math.min(this.minimapLines.length,Math.max(1,Math.round(e/this.samplingRatio)))}modelLineRangeToMinimapLineRange(e,t){let i=this.modelLineToMinimapLine(e)-1;for(;i>0&&this.minimapLines[i-1]>=e;)i--;let n=this.modelLineToMinimapLine(t)-1;for(;n+1<this.minimapLines.length&&this.minimapLines[n+1]<=t;)n++;if(i===n){const n=this.minimapLines[i];if(n<e||n>t)return null}return[i+1,n+1]}decorationLineRangeToMinimapLineRange(e,t){let i=this.modelLineToMinimapLine(e),n=this.modelLineToMinimapLine(t);return e!==t&&n===i&&(n===this.minimapLines.length?i>1&&i--:n++),[i,n]}onLinesDeleted(e){const t=e.toLineNumber-e.fromLineNumber+1;let i=this.minimapLines.length,n=0;for(let o=this.minimapLines.length-1;o>=0&&!(this.minimapLines[o]<e.fromLineNumber);o--)this.minimapLines[o]<=e.toLineNumber?(this.minimapLines[o]=Math.max(1,e.fromLineNumber-1),i=Math.min(i,o),n=Math.max(n,o)):this.minimapLines[o]-=t;return[i,n]}onLinesInserted(e){const t=e.toLineNumber-e.fromLineNumber+1;for(let i=this.minimapLines.length-1;i>=0&&!(this.minimapLines[i]<e.fromLineNumber);i--)this.minimapLines[i]+=t}}class ZT extends jL{constructor(e){super(e),this.tokensColorTracker=PT.getInstance(),this._selections=[],this._minimapSelections=null,this.options=new jT(this._context.configuration,this._context.theme,this.tokensColorTracker);const[t]=GT.compute(this.options,this._context.viewModel.getLineCount(),null);this._samplingState=t,this._shouldCheckSampling=!1,this._actual=new YT(e.theme,this)}dispose(){this._actual.dispose(),super.dispose()}getDomNode(){return this._actual.getDomNode()}_onOptionsMaybeChanged(){const e=new jT(this._context.configuration,this._context.theme,this.tokensColorTracker);return!this.options.equals(e)&&(this.options=e,this._recreateLineSampling(),this._actual.onDidChangeOptions(),!0)}onConfigurationChanged(e){return this._onOptionsMaybeChanged()}onCursorStateChanged(e){return this._selections=e.selections,this._minimapSelections=null,this._actual.onSelectionChanged()}onDecorationsChanged(e){return!!e.affectsMinimap&&this._actual.onDecorationsChanged()}onFlushed(e){return this._samplingState&&(this._shouldCheckSampling=!0),this._actual.onFlushed()}onLinesChanged(e){if(this._samplingState){const t=this._samplingState.modelLineRangeToMinimapLineRange(e.fromLineNumber,e.toLineNumber);return!!t&&this._actual.onLinesChanged(t[0],t[1])}return this._actual.onLinesChanged(e.fromLineNumber,e.toLineNumber)}onLinesDeleted(e){if(this._samplingState){const[t,i]=this._samplingState.onLinesDeleted(e);return t<=i&&this._actual.onLinesChanged(t+1,i+1),this._shouldCheckSampling=!0,!0}return this._actual.onLinesDeleted(e.fromLineNumber,e.toLineNumber)}onLinesInserted(e){return this._samplingState?(this._samplingState.onLinesInserted(e),this._shouldCheckSampling=!0,!0):this._actual.onLinesInserted(e.fromLineNumber,e.toLineNumber)}onScrollChanged(e){return this._actual.onScrollChanged()}onThemeChanged(e){return this._actual.onThemeChanged(),this._onOptionsMaybeChanged(),!0}onTokensChanged(e){if(this._samplingState){const t=[];for(const i of e.ranges){const e=this._samplingState.modelLineRangeToMinimapLineRange(i.fromLineNumber,i.toLineNumber);e&&t.push({fromLineNumber:e[0],toLineNumber:e[1]})}return!!t.length&&this._actual.onTokensChanged(t)}return this._actual.onTokensChanged(e.ranges)}onTokensColorsChanged(e){return this._onOptionsMaybeChanged(),this._actual.onTokensColorsChanged()}onZonesChanged(e){return this._actual.onZonesChanged()}prepareRender(e){this._shouldCheckSampling&&(this._shouldCheckSampling=!1,this._recreateLineSampling())}render(e){let t=e.visibleRange.startLineNumber,i=e.visibleRange.endLineNumber;this._samplingState&&(t=this._samplingState.modelLineToMinimapLine(t),i=this._samplingState.modelLineToMinimapLine(i));const n={viewportContainsWhitespaceGaps:e.viewportData.whitespaceViewportData.length>0,scrollWidth:e.scrollWidth,scrollHeight:e.scrollHeight,viewportStartLineNumber:t,viewportEndLineNumber:i,viewportStartLineNumberVerticalOffset:e.getVerticalOffsetForLineNumber(t),scrollTop:e.scrollTop,scrollLeft:e.scrollLeft,viewportWidth:e.viewportWidth,viewportHeight:e.viewportHeight};this._actual.render(n)}_recreateLineSampling(){this._minimapSelections=null;const e=Boolean(this._samplingState),[t,i]=GT.compute(this.options,this._context.viewModel.getLineCount(),this._samplingState);if(this._samplingState=t,e&&this._samplingState)for(const n of i)switch(n.type){case"deleted":this._actual.onLinesDeleted(n.deleteFromLineNumber,n.deleteToLineNumber);break;case"inserted":this._actual.onLinesInserted(n.insertFromLineNumber,n.insertToLineNumber);break;case"flush":this._actual.onFlushed()}}getLineCount(){return this._samplingState?this._samplingState.minimapLines.length:this._context.viewModel.getLineCount()}getRealLineCount(){return this._context.viewModel.getLineCount()}getLineContent(e){return this._samplingState?this._context.viewModel.getLineContent(this._samplingState.minimapLines[e-1]):this._context.viewModel.getLineContent(e)}getLineMaxColumn(e){return this._samplingState?this._context.viewModel.getLineMaxColumn(this._samplingState.minimapLines[e-1]):this._context.viewModel.getLineMaxColumn(e)}getMinimapLinesRenderingData(e,t,i){if(this._samplingState){const n=[];for(let o=0,s=t-e+1;o<s;o++)i[o]?n[o]=this._context.viewModel.getViewLineData(this._samplingState.minimapLines[e+o-1]):n[o]=null;return n}return this._context.viewModel.getMinimapLinesRenderingData(e,t,i).data}getSelections(){if(null===this._minimapSelections)if(this._samplingState){this._minimapSelections=[];for(const e of this._selections){const[t,i]=this._samplingState.decorationLineRangeToMinimapLineRange(e.startLineNumber,e.endLineNumber);this._minimapSelections.push(new ar(t,e.startColumn,i,e.endColumn))}}else this._minimapSelections=this._selections;return this._minimapSelections}getMinimapDecorationsInViewport(e,t){let i;if(this._samplingState){const n=this._samplingState.minimapLines[e-1],o=this._samplingState.minimapLines[t-1];i=new qo(n,1,o,this._context.viewModel.getLineMaxColumn(o))}else i=new qo(e,1,t,this._context.viewModel.getLineMaxColumn(t));const n=this._context.viewModel.getDecorationsInViewport(i);if(this._samplingState){const e=[];for(const t of n){if(!t.options.minimap)continue;const i=t.range,n=this._samplingState.modelLineToMinimapLine(i.startLineNumber),o=this._samplingState.modelLineToMinimapLine(i.endLineNumber);e.push(new cw(new qo(n,i.startColumn,o,i.endColumn),t.options))}return e}return n}getOptions(){return this._context.viewModel.model.getOptions()}revealLineNumber(e){this._samplingState&&(e=this._samplingState.minimapLines[e-1]),this._context.viewModel.revealRange("mouse",!1,new qo(e,1,e,1),1,0)}setScrollTop(e){this._context.viewModel.viewLayout.setScrollPosition({scrollTop:e},1)}}class YT extends Uo{constructor(e,t){super(),this._renderDecorations=!1,this._gestureInProgress=!1,this._theme=e,this._model=t,this._lastRenderData=null,this._buffers=null,this._selectionColor=this._theme.getColor(dL),this._domNode=p_(document.createElement("div")),UL.write(this._domNode,8),this._domNode.setClassName(this._getMinimapDomNodeClassName()),this._domNode.setPosition("absolute"),this._domNode.setAttribute("role","presentation"),this._domNode.setAttribute("aria-hidden","true"),this._shadow=p_(document.createElement("div")),this._shadow.setClassName("minimap-shadow-hidden"),this._domNode.appendChild(this._shadow),this._canvas=p_(document.createElement("canvas")),this._canvas.setPosition("absolute"),this._canvas.setLeft(0),this._domNode.appendChild(this._canvas),this._decorationsCanvas=p_(document.createElement("canvas")),this._decorationsCanvas.setPosition("absolute"),this._decorationsCanvas.setClassName("minimap-decorations-layer"),this._decorationsCanvas.setLeft(0),this._domNode.appendChild(this._decorationsCanvas),this._slider=p_(document.createElement("div")),this._slider.setPosition("absolute"),this._slider.setClassName("minimap-slider"),this._slider.setLayerHinting(!0),this._slider.setContain("strict"),this._domNode.appendChild(this._slider),this._sliderHorizontal=p_(document.createElement("div")),this._sliderHorizontal.setPosition("absolute"),this._sliderHorizontal.setClassName("minimap-slider-horizontal"),this._slider.appendChild(this._sliderHorizontal),this._applyLayout(),this._mouseDownListener=sC(this._domNode.domNode,"mousedown",(e=>{e.preventDefault();if(0===this._model.options.renderMinimap)return;if(!this._lastRenderData)return;if("proportional"!==this._model.options.size){if(e.leftButton&&this._lastRenderData){const t=yC(this._slider.domNode),i=t.top+t.height/2;this._startSliderDragging(e.buttons,e.posx,i,e.posy,this._lastRenderData.renderedLayout)}return}const t=this._model.options.minimapLineHeight,i=this._model.options.canvasInnerHeight/this._model.options.canvasOuterHeight*e.browserEvent.offsetY;let n=Math.floor(i/t)+this._lastRenderData.renderedLayout.startLineNumber;n=Math.min(n,this._model.getLineCount()),this._model.revealLineNumber(n)})),this._sliderMouseMoveMonitor=new rS,this._sliderMouseDownListener=sC(this._slider.domNode,"mousedown",(e=>{e.preventDefault(),e.stopPropagation(),e.leftButton&&this._lastRenderData&&this._startSliderDragging(e.buttons,e.posx,e.posy,e.posy,this._lastRenderData.renderedLayout)})),this._gestureDisposable=oS.addTarget(this._domNode.domNode),this._sliderTouchStartListener=nC(this._domNode.domNode,iS.Start,(e=>{e.preventDefault(),e.stopPropagation(),this._lastRenderData&&(this._slider.toggleClassName("active",!0),this._gestureInProgress=!0,this.scrollDueToTouchEvent(e))}),{passive:!1}),this._sliderTouchMoveListener=nC(this._domNode.domNode,iS.Change,(e=>{e.preventDefault(),e.stopPropagation(),this._lastRenderData&&this._gestureInProgress&&this.scrollDueToTouchEvent(e)}),{passive:!1}),this._sliderTouchEndListener=sC(this._domNode.domNode,iS.End,(e=>{e.preventDefault(),e.stopPropagation(),this._gestureInProgress=!1,this._slider.toggleClassName("active",!1)}))}_startSliderDragging(e,t,i,n,o){this._slider.toggleClassName("active",!0);const s=(e,n)=>{const s=Math.abs(n-t);if(Rs&&s>140)return void this._model.setScrollTop(o.scrollTop);const r=e-i;this._model.setScrollTop(o.getDesiredScrollTopFromDelta(r))};n!==i&&s(n,t),this._sliderMouseMoveMonitor.startMonitoring(this._slider.domNode,e,sS,(e=>s(e.posy,e.posx)),(()=>{this._slider.toggleClassName("active",!1)}))}scrollDueToTouchEvent(e){const t=this._domNode.domNode.getBoundingClientRect().top,i=this._lastRenderData.renderedLayout.getDesiredScrollTopFromTouchLocation(e.pageY-t);this._model.setScrollTop(i)}dispose(){this._mouseDownListener.dispose(),this._sliderMouseMoveMonitor.dispose(),this._sliderMouseDownListener.dispose(),this._gestureDisposable.dispose(),this._sliderTouchStartListener.dispose(),this._sliderTouchMoveListener.dispose(),this._sliderTouchEndListener.dispose(),super.dispose()}_getMinimapDomNodeClassName(){return"always"===this._model.options.showSlider?"minimap slider-always":"minimap slider-mouseover"}getDomNode(){return this._domNode}_applyLayout(){this._domNode.setLeft(this._model.options.minimapLeft),this._domNode.setWidth(this._model.options.minimapWidth),this._domNode.setHeight(this._model.options.minimapHeight),this._shadow.setHeight(this._model.options.minimapHeight),this._canvas.setWidth(this._model.options.canvasOuterWidth),this._canvas.setHeight(this._model.options.canvasOuterHeight),this._canvas.domNode.width=this._model.options.canvasInnerWidth,this._canvas.domNode.height=this._model.options.canvasInnerHeight,this._decorationsCanvas.setWidth(this._model.options.canvasOuterWidth),this._decorationsCanvas.setHeight(this._model.options.canvasOuterHeight),this._decorationsCanvas.domNode.width=this._model.options.canvasInnerWidth,this._decorationsCanvas.domNode.height=this._model.options.canvasInnerHeight,this._slider.setWidth(this._model.options.minimapWidth)}_getBuffer(){return this._buffers||this._model.options.canvasInnerWidth>0&&this._model.options.canvasInnerHeight>0&&(this._buffers=new qT(this._canvas.domNode.getContext("2d"),this._model.options.canvasInnerWidth,this._model.options.canvasInnerHeight,this._model.options.backgroundColor)),this._buffers?this._buffers.getBuffer():null}onDidChangeOptions(){this._lastRenderData=null,this._buffers=null,this._applyLayout(),this._domNode.setClassName(this._getMinimapDomNodeClassName())}onSelectionChanged(){return this._renderDecorations=!0,!0}onDecorationsChanged(){return this._renderDecorations=!0,!0}onFlushed(){return this._lastRenderData=null,!0}onLinesChanged(e,t){return!!this._lastRenderData&&this._lastRenderData.onLinesChanged(e,t)}onLinesDeleted(e,t){return this._lastRenderData&&this._lastRenderData.onLinesDeleted(e,t),!0}onLinesInserted(e,t){return this._lastRenderData&&this._lastRenderData.onLinesInserted(e,t),!0}onScrollChanged(){return this._renderDecorations=!0,!0}onThemeChanged(){return this._selectionColor=this._theme.getColor(dL),this._renderDecorations=!0,!0}onTokensChanged(e){return!!this._lastRenderData&&this._lastRenderData.onTokensChanged(e)}onTokensColorsChanged(){return this._lastRenderData=null,this._buffers=null,!0}onZonesChanged(){return this._lastRenderData=null,!0}render(e){if(0===this._model.options.renderMinimap)return this._shadow.setClassName("minimap-shadow-hidden"),this._sliderHorizontal.setWidth(0),void this._sliderHorizontal.setHeight(0);e.scrollLeft+e.viewportWidth>=e.scrollWidth?this._shadow.setClassName("minimap-shadow-hidden"):this._shadow.setClassName("minimap-shadow-visible");const t=UT.create(this._model.options,e.viewportStartLineNumber,e.viewportEndLineNumber,e.viewportStartLineNumberVerticalOffset,e.viewportHeight,e.viewportContainsWhitespaceGaps,this._model.getLineCount(),this._model.getRealLineCount(),e.scrollTop,e.scrollHeight,this._lastRenderData?this._lastRenderData.renderedLayout:null);this._slider.setDisplay(t.sliderNeeded?"block":"none"),this._slider.setTop(t.sliderTop),this._slider.setHeight(t.sliderHeight),this._sliderHorizontal.setLeft(0),this._sliderHorizontal.setWidth(this._model.options.minimapWidth),this._sliderHorizontal.setTop(0),this._sliderHorizontal.setHeight(t.sliderHeight),this.renderDecorations(t),this._lastRenderData=this.renderLines(t)}renderDecorations(e){if(this._renderDecorations){this._renderDecorations=!1;const t=this._model.getSelections();t.sort(qo.compareRangesUsingStarts);const i=this._model.getMinimapDecorationsInViewport(e.startLineNumber,e.endLineNumber);i.sort(((e,t)=>(e.options.zIndex||0)-(t.options.zIndex||0)));const{canvasInnerWidth:n,canvasInnerHeight:o}=this._model.options,s=this._model.options.minimapLineHeight,r=this._model.options.minimapCharWidth,a=this._model.getOptions().tabSize,l=this._decorationsCanvas.domNode.getContext("2d");l.clearRect(0,0,n,o);const d=new XT(e.startLineNumber,e.endLineNumber,!1);this._renderSelectionLineHighlights(l,t,d,e,s),this._renderDecorationsLineHighlights(l,i,d,e,s);const c=new XT(e.startLineNumber,e.endLineNumber,null);this._renderSelectionsHighlights(l,t,c,e,s,a,r,n),this._renderDecorationsHighlights(l,i,c,e,s,a,r,n)}}_renderSelectionLineHighlights(e,t,i,n,o){if(!this._selectionColor||this._selectionColor.isTransparent())return;e.fillStyle=this._selectionColor.transparent(.5).toString();let s=0,r=0;for(const a of t){const t=Math.max(n.startLineNumber,a.startLineNumber),l=Math.min(n.endLineNumber,a.endLineNumber);if(t>l)continue;for(let e=t;e<=l;e++)i.set(e,!0);const d=(t-n.startLineNumber)*o,c=(l-n.startLineNumber)*o+o;r>=d||(r>s&&e.fillRect(8,s,e.canvas.width,r-s),s=d),r=c}r>s&&e.fillRect(8,s,e.canvas.width,r-s)}_renderDecorationsLineHighlights(e,t,i,n,o){const s=new Map;for(let r=t.length-1;r>=0;r--){const a=t[r],l=a.options.minimap;if(!l||l.position!==Dr.Inline)continue;const d=Math.max(n.startLineNumber,a.range.startLineNumber),c=Math.min(n.endLineNumber,a.range.endLineNumber);if(d>c)continue;const h=l.getColor(this._theme.value);if(!h||h.isTransparent())continue;let u=s.get(h.toString());u||(u=h.transparent(.5).toString(),s.set(h.toString(),u)),e.fillStyle=u;for(let t=d;t<=c;t++){if(i.has(t))continue;i.set(t,!0);const s=(d-n.startLineNumber)*o;e.fillRect(8,s,e.canvas.width,o)}}}_renderSelectionsHighlights(e,t,i,n,o,s,r,a){if(this._selectionColor&&!this._selectionColor.isTransparent())for(const l of t){const t=Math.max(n.startLineNumber,l.startLineNumber),d=Math.min(n.endLineNumber,l.endLineNumber);if(!(t>d))for(let c=t;c<=d;c++)this.renderDecorationOnLine(e,i,l,this._selectionColor,n,c,o,o,s,r,a)}}_renderDecorationsHighlights(e,t,i,n,o,s,r,a){for(const l of t){const t=l.options.minimap;if(!t)continue;const d=Math.max(n.startLineNumber,l.range.startLineNumber),c=Math.min(n.endLineNumber,l.range.endLineNumber);if(d>c)continue;const h=t.getColor(this._theme.value);if(h&&!h.isTransparent())for(let u=d;u<=c;u++)switch(t.position){case Dr.Inline:this.renderDecorationOnLine(e,i,l.range,h,n,u,o,o,s,r,a);continue;case Dr.Gutter:{const t=(u-n.startLineNumber)*o,i=2;this.renderDecoration(e,h,i,t,2,o);continue}}}}renderDecorationOnLine(e,t,i,n,o,s,r,a,l,d,c){const h=(s-o.startLineNumber)*a;if(h+r<0||h>this._model.options.canvasInnerHeight)return;const{startLineNumber:u,endLineNumber:g}=i,p=u===s?i.startColumn:1,m=g===s?i.endColumn:this._model.getLineMaxColumn(s),f=this.getXOffsetForPosition(t,s,p,l,d,c),_=this.getXOffsetForPosition(t,s,m,l,d,c);this.renderDecoration(e,n,f,h,_-f,r)}getXOffsetForPosition(e,t,i,n,o,s){if(1===i)return 8;if((i-1)*o>=s)return s;let r=e.get(t);if(!r){const i=this._model.getLineContent(t);r=[8];let a=8;for(let e=1;e<i.length+1;e++){const t=i.charCodeAt(e-1),l=a+(9===t?n*o:ks(t)?2*o:o);if(l>=s){r[e]=s;break}r[e]=l,a=l}e.set(t,r)}return i-1<r.length?r[i-1]:s}renderDecoration(e,t,i,n,o,s){e.fillStyle=t&&t.toString()||"",e.fillRect(i,n,o,s)}renderLines(e){const t=e.startLineNumber,i=e.endLineNumber,n=this._model.options.minimapLineHeight;if(this._lastRenderData&&this._lastRenderData.linesEquals(e)){const t=this._lastRenderData._get();return new KT(e,t.imageData,t.lines)}const o=this._getBuffer();if(!o)return null;const[s,r,a]=YT._renderUntouchedLines(o,t,i,n,this._lastRenderData),l=this._model.getMinimapLinesRenderingData(t,i,a),d=this._model.getOptions().tabSize,c=this._model.options.defaultBackgroundColor,h=this._model.options.backgroundColor,u=this._model.options.foregroundAlpha,g=this._model.tokensColorTracker,p=g.backgroundIsLight(),m=this._model.options.renderMinimap,f=this._model.options.charRenderer(),_=this._model.options.fontScale,v=this._model.options.minimapCharWidth,b=(1===m?2:3)*_,w=n>b?Math.floor((n-b)/2):0,C=h.a/255,y=new RT(Math.round((h.r-c.r)*C+c.r),Math.round((h.g-c.g)*C+c.g),Math.round((h.b-c.b)*C+c.b),255);let x=0;const S=[];for(let L=0,N=i-t+1;L<N;L++)a[L]&&YT._renderLine(o,y,h.a,p,m,v,g,u,f,x,w,d,l[L],_,n),S[L]=new $T(x),x+=n;const k=-1===s?0:s,D=(-1===r?o.height:r)-k;return this._canvas.domNode.getContext("2d").putImageData(o,0,0,0,k,o.width,D),new KT(e,o,S)}static _renderUntouchedLines(e,t,i,n,o){const s=[];if(!o){for(let e=0,n=i-t+1;e<n;e++)s[e]=!0;return[-1,-1,s]}const r=o._get(),a=r.imageData.data,l=r.rendLineNumberStart,d=r.lines,c=d.length,h=e.width,u=e.data,g=(i-t+1)*n*h*4;let p=-1,m=-1,f=-1,_=-1,v=-1,b=-1,w=0;for(let C=t;C<=i;C++){const e=C-t,i=C-l,o=i>=0&&i<c?d[i].dy:-1;if(-1===o){s[e]=!0,w+=n;continue}const r=o*h*4,y=(o+n)*h*4,x=w*h*4,S=(w+n)*h*4;_===r&&b===x?(_=y,b=S):(-1!==f&&(u.set(a.subarray(f,_),v),-1===p&&0===f&&f===v&&(p=_),-1===m&&_===g&&f===v&&(m=f)),f=r,_=y,v=x,b=S),s[e]=!1,w+=n}-1!==f&&(u.set(a.subarray(f,_),v),-1===p&&0===f&&f===v&&(p=_),-1===m&&_===g&&f===v&&(m=f));return[-1===p?-1:p/(4*h),-1===m?-1:m/(4*h),s]}static _renderLine(e,t,i,n,o,s,r,a,l,d,c,h,u,g,p){const m=u.content,f=u.tokens,_=e.width-s,v=1===p;let b=8,w=0,C=0;for(let y=0,x=f.getCount();y<x;y++){const u=f.getEndOffset(y),p=f.getForeground(y),x=r.getColor(p);for(;w<u;w++){if(b>_)return;const r=m.charCodeAt(w);if(9===r){const e=h-(w+C)%h;C+=e-1,b+=e*s}else if(32===r)b+=s;else{const h=ks(r)?2:1;for(let u=0;u<h;u++)if(2===o?l.blockRenderChar(e,b,d+c,x,a,t,i,v):l.renderChar(e,b,d+c,r,x,a,t,i,g,n,v),b+=s,b>_)return}}}}}class XT{constructor(e,t,i){this._startLineNumber=e,this._endLineNumber=t,this._defaultValue=i,this._values=[];for(let n=0,o=this._endLineNumber-this._startLineNumber+1;n<o;n++)this._values[n]=i}has(e){return this.get(e)!==this._defaultValue}set(e,t){e<this._startLineNumber||e>this._endLineNumber||(this._values[e-this._startLineNumber]=t)}get(e){return e<this._startLineNumber||e>this._endLineNumber?this._defaultValue:this._values[e-this._startLineNumber]}}sx(((e,t)=>{const i=e.getColor(pL);i&&t.addRule(`.monaco-editor .minimap-slider .minimap-slider-horizontal { background: ${i}; }`);const n=e.getColor(mL);n&&t.addRule(`.monaco-editor .minimap-slider:hover .minimap-slider-horizontal { background: ${n}; }`);const o=e.getColor(fL);o&&t.addRule(`.monaco-editor .minimap-slider.active .minimap-slider-horizontal { background: ${o}; }`);const s=e.getColor(QS);s&&t.addRule(`.monaco-editor .minimap-shadow-visible { box-shadow: ${s} -6px 0 6px -6px inset; }`)}));class QT extends jL{constructor(e){super(e);const t=this._context.configuration.options.get(131);this._widgets={},this._verticalScrollbarWidth=t.verticalScrollbarWidth,this._minimapWidth=t.minimap.minimapWidth,this._horizontalScrollbarHeight=t.horizontalScrollbarHeight,this._editorHeight=t.height,this._editorWidth=t.width,this._domNode=p_(document.createElement("div")),UL.write(this._domNode,4),this._domNode.setClassName("overlayWidgets")}dispose(){super.dispose(),this._widgets={}}getDomNode(){return this._domNode}onConfigurationChanged(e){const t=this._context.configuration.options.get(131);return this._verticalScrollbarWidth=t.verticalScrollbarWidth,this._minimapWidth=t.minimap.minimapWidth,this._horizontalScrollbarHeight=t.horizontalScrollbarHeight,this._editorHeight=t.height,this._editorWidth=t.width,!0}addWidget(e){const t=p_(e.getDomNode());this._widgets[e.getId()]={widget:e,preference:null,domNode:t},t.setPosition("absolute"),t.setAttribute("widgetId",e.getId()),this._domNode.appendChild(t),this.setShouldRender()}setWidgetPosition(e,t){const i=this._widgets[e.getId()];return i.preference!==t&&(i.preference=t,this.setShouldRender(),!0)}removeWidget(e){const t=e.getId();if(this._widgets.hasOwnProperty(t)){const e=this._widgets[t].domNode.domNode;delete this._widgets[t],e.parentNode.removeChild(e),this.setShouldRender()}}_renderWidget(e){const t=e.domNode;if(null!==e.preference)if(0===e.preference)t.setTop(0),t.setRight(2*this._verticalScrollbarWidth+this._minimapWidth);else if(1===e.preference){const e=t.domNode.clientHeight;t.setTop(this._editorHeight-e-2*this._horizontalScrollbarHeight),t.setRight(2*this._verticalScrollbarWidth+this._minimapWidth)}else 2===e.preference&&(t.setTop(0),t.domNode.style.right="50%");else t.unsetTop()}prepareRender(e){}render(e){this._domNode.setWidth(this._editorWidth);const t=Object.keys(this._widgets);for(let i=0,n=t.length;i<n;i++){const e=t[i];this._renderWidget(this._widgets[e])}}}class JT{constructor(e,t){const i=e.options;this.lineHeight=i.get(59),this.pixelRatio=i.get(129),this.overviewRulerLanes=i.get(74),this.renderBorder=i.get(73);const n=t.getColor(oE);this.borderColor=n?n.toString():null,this.hideCursor=i.get(52);const o=t.getColor(qN);this.cursorColor=o?o.transparent(.7).toString():null,this.themeType=t.type;const s=i.get(65),r=s.enabled,a=s.side,l=r?t.getColor(sE)||Ns.getDefaultBackground():null;this.backgroundColor=null===l||"left"===a?null:hS.Format.CSS.formatHex(l);const d=i.get(131).overviewRuler;this.top=d.top,this.right=d.right,this.domWidth=d.width,this.domHeight=d.height,0===this.overviewRulerLanes?(this.canvasWidth=0,this.canvasHeight=0):(this.canvasWidth=this.domWidth*this.pixelRatio|0,this.canvasHeight=this.domHeight*this.pixelRatio|0);const[c,h]=this._initLanes(1,this.canvasWidth,this.overviewRulerLanes);this.x=c,this.w=h}_initLanes(e,t,i){const n=t-e;if(i>=3){const t=Math.floor(n/3),i=Math.floor(n/3),o=n-t-i,s=e+t;return[[0,e,s,e,e+t+o,e,s,e],[0,t,o,t+o,i,t+o+i,o+i,t+o+i]]}if(2===i){const t=Math.floor(n/2),i=n-t;return[[0,e,e,e,e+t,e,e,e],[0,t,t,t,i,t+i,t+i,t+i]]}return[[0,e,e,e,e,e,e,e],[0,n,n,n,n,n,n,n]]}equals(e){return this.lineHeight===e.lineHeight&&this.pixelRatio===e.pixelRatio&&this.overviewRulerLanes===e.overviewRulerLanes&&this.renderBorder===e.renderBorder&&this.borderColor===e.borderColor&&this.hideCursor===e.hideCursor&&this.cursorColor===e.cursorColor&&this.themeType===e.themeType&&this.backgroundColor===e.backgroundColor&&this.top===e.top&&this.right===e.right&&this.domWidth===e.domWidth&&this.domHeight===e.domHeight&&this.canvasWidth===e.canvasWidth&&this.canvasHeight===e.canvasHeight}}class eM extends jL{constructor(e){super(e),this._domNode=p_(document.createElement("canvas")),this._domNode.setClassName("decorationsOverviewRuler"),this._domNode.setPosition("absolute"),this._domNode.setLayerHinting(!0),this._domNode.setContain("strict"),this._domNode.setAttribute("aria-hidden","true"),this._updateSettings(!1),this._tokensColorTrackerListener=Ns.onDidChange((e=>{e.changedColorMap&&this._updateSettings(!0)})),this._cursorPositions=[]}dispose(){super.dispose(),this._tokensColorTrackerListener.dispose()}_updateSettings(e){const t=new JT(this._context.configuration,this._context.theme);return(!this._settings||!this._settings.equals(t))&&(this._settings=t,this._domNode.setTop(this._settings.top),this._domNode.setRight(this._settings.right),this._domNode.setWidth(this._settings.domWidth),this._domNode.setHeight(this._settings.domHeight),this._domNode.domNode.width=this._settings.canvasWidth,this._domNode.domNode.height=this._settings.canvasHeight,e&&this._render(),!0)}onConfigurationChanged(e){return this._updateSettings(!1)}onCursorStateChanged(e){this._cursorPositions=[];for(let t=0,i=e.selections.length;t<i;t++)this._cursorPositions[t]=e.selections[t].getPosition();return this._cursorPositions.sort(er.compare),!0}onDecorationsChanged(e){return!!e.affectsOverviewRuler}onFlushed(e){return!0}onScrollChanged(e){return e.scrollHeightChanged}onZonesChanged(e){return!0}onThemeChanged(e){return this._updateSettings(!1)}getDomNode(){return this._domNode.domNode}prepareRender(e){}render(e){this._render()}_render(){if(0===this._settings.overviewRulerLanes)return this._domNode.setBackgroundColor(this._settings.backgroundColor?this._settings.backgroundColor:""),void this._domNode.setDisplay("none");this._domNode.setDisplay("block");const e=this._settings.canvasWidth,t=this._settings.canvasHeight,i=this._settings.lineHeight,n=this._context.viewLayout,o=t/this._context.viewLayout.getScrollHeight(),s=this._context.viewModel.getAllOverviewRulerDecorations(this._context.theme),r=6*this._settings.pixelRatio|0,a=r/2|0,l=this._domNode.domNode.getContext("2d");null===this._settings.backgroundColor?l.clearRect(0,0,e,t):(l.fillStyle=this._settings.backgroundColor,l.fillRect(0,0,e,t));const d=this._settings.x,c=this._settings.w;s.sort(hw.cmp);for(const h of s){const e=h.color,s=h.data;l.fillStyle=e;let u=0,g=0,p=0;for(let h=0,m=s.length/3;h<m;h++){const e=s[3*h],m=s[3*h+1],f=s[3*h+2];let _=n.getVerticalOffsetForLineNumber(m)*o|0,v=(n.getVerticalOffsetForLineNumber(f)+i)*o|0;if(v-_<r){let e=(_+v)/2|0;e<a?e=a:e+a>t&&(e=t-a),_=e-a,v=e+a}_>p+1||e!==u?(0!==h&&l.fillRect(d[u],g,c[u],p-g),u=e,g=_,p=v):v>p&&(p=v)}l.fillRect(d[u],g,c[u],p-g)}if(!this._settings.hideCursor&&this._settings.cursorColor){const e=2*this._settings.pixelRatio|0,i=e/2|0,s=this._settings.x[7],r=this._settings.w[7];l.fillStyle=this._settings.cursorColor;let a=-100,d=-100;for(let c=0,h=this._cursorPositions.length;c<h;c++){const h=this._cursorPositions[c];let u=n.getVerticalOffsetForLineNumber(h.lineNumber)*o|0;u<i?u=i:u+i>t&&(u=t-i);const g=u-i,p=g+e;g>d+1?(0!==c&&l.fillRect(s,a,r,d-a),a=g,d=p):p>d&&(d=p)}l.fillRect(s,a,r,d-a)}this._settings.renderBorder&&this._settings.borderColor&&this._settings.overviewRulerLanes>0&&(l.beginPath(),l.lineWidth=1,l.strokeStyle=this._settings.borderColor,l.moveTo(0,0),l.lineTo(0,t),l.stroke(),l.moveTo(0,0),l.lineTo(e,0),l.stroke())}}class tM{constructor(e,t,i){this._colorZoneBrand=void 0,this.from=0|e,this.to=0|t,this.colorId=0|i}static compare(e,t){return e.colorId===t.colorId?e.from===t.from?e.to-t.to:e.from-t.from:e.colorId-t.colorId}}class iM{constructor(e,t,i,n){this._overviewRulerZoneBrand=void 0,this.startLineNumber=e,this.endLineNumber=t,this.heightInLines=i,this.color=n,this._colorZone=null}static compare(e,t){return e.color===t.color?e.startLineNumber===t.startLineNumber?e.heightInLines===t.heightInLines?e.endLineNumber-t.endLineNumber:e.heightInLines-t.heightInLines:e.startLineNumber-t.startLineNumber:e.color<t.color?-1:1}setColorZone(e){this._colorZone=e}getColorZones(){return this._colorZone}}class nM{constructor(e){this._getVerticalOffsetForLine=e,this._zones=[],this._colorZonesInvalid=!1,this._lineHeight=0,this._domWidth=0,this._domHeight=0,this._outerHeight=0,this._pixelRatio=1,this._lastAssignedId=0,this._color2Id=Object.create(null),this._id2Color=[]}getId2Color(){return this._id2Color}setZones(e){this._zones=e,this._zones.sort(iM.compare)}setLineHeight(e){return this._lineHeight!==e&&(this._lineHeight=e,this._colorZonesInvalid=!0,!0)}setPixelRatio(e){this._pixelRatio=e,this._colorZonesInvalid=!0}getDOMWidth(){return this._domWidth}getCanvasWidth(){return this._domWidth*this._pixelRatio}setDOMWidth(e){return this._domWidth!==e&&(this._domWidth=e,this._colorZonesInvalid=!0,!0)}getDOMHeight(){return this._domHeight}getCanvasHeight(){return this._domHeight*this._pixelRatio}setDOMHeight(e){return this._domHeight!==e&&(this._domHeight=e,this._colorZonesInvalid=!0,!0)}getOuterHeight(){return this._outerHeight}setOuterHeight(e){return this._outerHeight!==e&&(this._outerHeight=e,this._colorZonesInvalid=!0,!0)}resolveColorZones(){const e=this._colorZonesInvalid,t=Math.floor(this._lineHeight),i=Math.floor(this.getCanvasHeight()),n=i/Math.floor(this._outerHeight),o=Math.floor(4*this._pixelRatio/2),s=[];for(let r=0,a=this._zones.length;r<a;r++){const a=this._zones[r];if(!e){const e=a.getColorZones();if(e){s.push(e);continue}}const l=this._getVerticalOffsetForLine(a.startLineNumber),d=0===a.heightInLines?this._getVerticalOffsetForLine(a.endLineNumber)+t:l+a.heightInLines*t,c=Math.floor(n*l),h=Math.floor(n*d);let u=Math.floor((c+h)/2),g=h-u;g<o&&(g=o),u-g<0&&(u=g),u+g>i&&(u=i-g);const p=a.color;let m=this._color2Id[p];m||(m=++this._lastAssignedId,this._color2Id[p]=m,this._id2Color[m]=p);const f=new tM(u-g,u+g,m);a.setColorZone(f),s.push(f)}return this._colorZonesInvalid=!1,s.sort(tM.compare),s}}class oM extends HL{constructor(e,t){super(),this._context=e;const i=this._context.configuration.options;this._domNode=p_(document.createElement("canvas")),this._domNode.setClassName(t),this._domNode.setPosition("absolute"),this._domNode.setLayerHinting(!0),this._domNode.setContain("strict"),this._zoneManager=new nM((e=>this._context.viewLayout.getVerticalOffsetForLineNumber(e))),this._zoneManager.setDOMWidth(0),this._zoneManager.setDOMHeight(0),this._zoneManager.setOuterHeight(this._context.viewLayout.getScrollHeight()),this._zoneManager.setLineHeight(i.get(59)),this._zoneManager.setPixelRatio(i.get(129)),this._context.addEventHandler(this)}dispose(){this._context.removeEventHandler(this),super.dispose()}onConfigurationChanged(e){const t=this._context.configuration.options;return e.hasChanged(59)&&(this._zoneManager.setLineHeight(t.get(59)),this._render()),e.hasChanged(129)&&(this._zoneManager.setPixelRatio(t.get(129)),this._domNode.setWidth(this._zoneManager.getDOMWidth()),this._domNode.setHeight(this._zoneManager.getDOMHeight()),this._domNode.domNode.width=this._zoneManager.getCanvasWidth(),this._domNode.domNode.height=this._zoneManager.getCanvasHeight(),this._render()),!0}onFlushed(e){return this._render(),!0}onScrollChanged(e){return e.scrollHeightChanged&&(this._zoneManager.setOuterHeight(e.scrollHeight),this._render()),!0}onZonesChanged(e){return this._render(),!0}getDomNode(){return this._domNode.domNode}setLayout(e){this._domNode.setTop(e.top),this._domNode.setRight(e.right);let t=!1;t=this._zoneManager.setDOMWidth(e.width)||t,t=this._zoneManager.setDOMHeight(e.height)||t,t&&(this._domNode.setWidth(this._zoneManager.getDOMWidth()),this._domNode.setHeight(this._zoneManager.getDOMHeight()),this._domNode.domNode.width=this._zoneManager.getCanvasWidth(),this._domNode.domNode.height=this._zoneManager.getCanvasHeight(),this._render())}setZones(e){this._zoneManager.setZones(e),this._render()}_render(){if(0===this._zoneManager.getOuterHeight())return!1;const e=this._zoneManager.getCanvasWidth(),t=this._zoneManager.getCanvasHeight(),i=this._zoneManager.resolveColorZones(),n=this._zoneManager.getId2Color(),o=this._domNode.domNode.getContext("2d");return o.clearRect(0,0,e,t),i.length>0&&this._renderOneLane(o,i,n,e),!0}_renderOneLane(e,t,i,n){let o=0,s=0,r=0;for(const a of t){const t=a.colorId,l=a.from,d=a.to;t!==o?(e.fillRect(0,s,n,r-s),o=t,e.fillStyle=i[o],s=l,r=d):r>=l?r=Math.max(r,d):(e.fillRect(0,s,n,r-s),s=l,r=d)}e.fillRect(0,s,n,r-s)}}class sM extends jL{constructor(e){super(e),this.domNode=p_(document.createElement("div")),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this.domNode.setClassName("view-rulers"),this._renderedRulers=[];const t=this._context.configuration.options;this._rulers=t.get(91),this._typicalHalfwidthCharacterWidth=t.get(44).typicalHalfwidthCharacterWidth}dispose(){super.dispose()}onConfigurationChanged(e){const t=this._context.configuration.options;return this._rulers=t.get(91),this._typicalHalfwidthCharacterWidth=t.get(44).typicalHalfwidthCharacterWidth,!0}onScrollChanged(e){return e.scrollHeightChanged}prepareRender(e){}_ensureRulersCount(){const e=this._renderedRulers.length,t=this._rulers.length;if(e===t)return;if(e<t){const{tabSize:i}=this._context.viewModel.model.getOptions(),n=i;let o=t-e;for(;o>0;){const e=p_(document.createElement("div"));e.setClassName("view-ruler"),e.setWidth(n),this.domNode.appendChild(e),this._renderedRulers.push(e),o--}return}let i=e-t;for(;i>0;){const e=this._renderedRulers.pop();this.domNode.removeChild(e),i--}}render(e){this._ensureRulersCount();for(let t=0,i=this._rulers.length;t<i;t++){const i=this._renderedRulers[t],n=this._rulers[t];i.setBoxShadow(n.color?`1px 0 0 0 ${n.color} inset`:""),i.setHeight(Math.min(e.scrollHeight,1e6)),i.setLeft(n.column*this._typicalHalfwidthCharacterWidth)}}}sx(((e,t)=>{const i=e.getColor(tE);i&&t.addRule(`.monaco-editor .view-ruler { box-shadow: 1px 0 0 0 ${i} inset; }`)}));class rM extends jL{constructor(e){super(e),this._scrollTop=0,this._width=0,this._updateWidth(),this._shouldShow=!1;const t=this._context.configuration.options.get(92);this._useShadows=t.useShadows,this._domNode=p_(document.createElement("div")),this._domNode.setAttribute("role","presentation"),this._domNode.setAttribute("aria-hidden","true")}dispose(){super.dispose()}_updateShouldShow(){const e=this._useShadows&&this._scrollTop>0;return this._shouldShow!==e&&(this._shouldShow=e,!0)}getDomNode(){return this._domNode}_updateWidth(){const e=this._context.configuration.options.get(131);0===e.minimap.renderMinimap||e.minimap.minimapWidth>0&&0===e.minimap.minimapLeft?this._width=e.width:this._width=e.width-e.minimap.minimapWidth-e.verticalScrollbarWidth}onConfigurationChanged(e){const t=this._context.configuration.options.get(92);return this._useShadows=t.useShadows,this._updateWidth(),this._updateShouldShow(),!0}onScrollChanged(e){return this._scrollTop=e.scrollTop,this._updateShouldShow()}prepareRender(e){}render(e){this._domNode.setWidth(this._width),this._domNode.setClassName(this._shouldShow?"scroll-decoration":"")}}sx(((e,t)=>{const i=e.getColor(QS);i&&t.addRule(`.monaco-editor .scroll-decoration { box-shadow: ${i} 0 6px 6px -6px inset; }`)}));class aM{constructor(e){this.left=e.left,this.width=e.width,this.startStyle=null,this.endStyle=null}}class lM{constructor(e,t){this.lineNumber=e,this.ranges=t}}function dM(e){return new aM(e)}function cM(e){return new lM(e.lineNumber,e.ranges.map(dM))}class hM extends WN{constructor(e){super(),this._previousFrameVisibleRangesWithStyle=[],this._context=e;const t=this._context.configuration.options;this._lineHeight=t.get(59),this._roundedSelection=t.get(90),this._typicalHalfwidthCharacterWidth=t.get(44).typicalHalfwidthCharacterWidth,this._selections=[],this._renderResult=null,this._context.addEventHandler(this)}dispose(){this._context.removeEventHandler(this),this._renderResult=null,super.dispose()}onConfigurationChanged(e){const t=this._context.configuration.options;return this._lineHeight=t.get(59),this._roundedSelection=t.get(90),this._typicalHalfwidthCharacterWidth=t.get(44).typicalHalfwidthCharacterWidth,!0}onCursorStateChanged(e){return this._selections=e.selections.slice(0),!0}onDecorationsChanged(e){return!0}onFlushed(e){return!0}onLinesChanged(e){return!0}onLinesDeleted(e){return!0}onLinesInserted(e){return!0}onScrollChanged(e){return e.scrollTopChanged}onZonesChanged(e){return!0}_visibleRangesHaveGaps(e){for(let t=0,i=e.length;t<i;t++){if(e[t].ranges.length>1)return!0}return!1}_enrichVisibleRangesWithStyle(e,t,i){const n=this._typicalHalfwidthCharacterWidth/4;let o=null,s=null;if(i&&i.length>0&&t.length>0){const n=t[0].lineNumber;if(n===e.startLineNumber)for(let e=0;!o&&e<i.length;e++)i[e].lineNumber===n&&(o=i[e].ranges[0]);const r=t[t.length-1].lineNumber;if(r===e.endLineNumber)for(let e=i.length-1;!s&&e>=0;e--)i[e].lineNumber===r&&(s=i[e].ranges[0]);o&&!o.startStyle&&(o=null),s&&!s.startStyle&&(s=null)}for(let r=0,a=t.length;r<a;r++){const e=t[r].ranges[0],i=e.left,l=e.left+e.width,d={top:0,bottom:0},c={top:0,bottom:0};if(r>0){const e=t[r-1].ranges[0].left,o=t[r-1].ranges[0].left+t[r-1].ranges[0].width;uM(i-e)<n?d.top=2:i>e&&(d.top=1),uM(l-o)<n?c.top=2:e<l&&l<o&&(c.top=1)}else o&&(d.top=o.startStyle.top,c.top=o.endStyle.top);if(r+1<a){const e=t[r+1].ranges[0].left,o=t[r+1].ranges[0].left+t[r+1].ranges[0].width;uM(i-e)<n?d.bottom=2:e<i&&i<o&&(d.bottom=1),uM(l-o)<n?c.bottom=2:l<o&&(c.bottom=1)}else s&&(d.bottom=s.startStyle.bottom,c.bottom=s.endStyle.bottom);e.startStyle=d,e.endStyle=c}}_getVisibleRangesWithStyle(e,t,i){const n=(t.linesVisibleRangesForRange(e,!0)||[]).map(cM);return!this._visibleRangesHaveGaps(n)&&this._roundedSelection&&this._enrichVisibleRangesWithStyle(t.visibleRange,n,i),n}_createSelectionPiece(e,t,i,n,o){return'<div class="cslr '+i+'" style="top:'+e.toString()+"px;left:"+n.toString()+"px;width:"+o.toString()+"px;height:"+t+'px;"></div>'}_actualRenderOneSelection(e,t,i,n){if(0===n.length)return;const o=!!n[0].ranges[0].startStyle,s=this._lineHeight.toString(),r=(this._lineHeight-1).toString(),a=n[0].lineNumber,l=n[n.length-1].lineNumber;for(let d=0,c=n.length;d<c;d++){const c=n[d],h=c.lineNumber,u=h-t,g=i&&(h===l||h===a)?r:s,p=i&&h===a?1:0;let m="",f="";for(let e=0,t=c.ranges.length;e<t;e++){const t=c.ranges[e];if(o){const e=t.startStyle,i=t.endStyle;if(1===e.top||1===e.bottom){m+=this._createSelectionPiece(p,g,hM.SELECTION_CLASS_NAME,t.left-hM.ROUNDED_PIECE_WIDTH,hM.ROUNDED_PIECE_WIDTH);let i=hM.EDITOR_BACKGROUND_CLASS_NAME;1===e.top&&(i+=" "+hM.SELECTION_TOP_RIGHT),1===e.bottom&&(i+=" "+hM.SELECTION_BOTTOM_RIGHT),m+=this._createSelectionPiece(p,g,i,t.left-hM.ROUNDED_PIECE_WIDTH,hM.ROUNDED_PIECE_WIDTH)}if(1===i.top||1===i.bottom){m+=this._createSelectionPiece(p,g,hM.SELECTION_CLASS_NAME,t.left+t.width,hM.ROUNDED_PIECE_WIDTH);let e=hM.EDITOR_BACKGROUND_CLASS_NAME;1===i.top&&(e+=" "+hM.SELECTION_TOP_LEFT),1===i.bottom&&(e+=" "+hM.SELECTION_BOTTOM_LEFT),m+=this._createSelectionPiece(p,g,e,t.left+t.width,hM.ROUNDED_PIECE_WIDTH)}}let i=hM.SELECTION_CLASS_NAME;if(o){const e=t.startStyle,n=t.endStyle;0===e.top&&(i+=" "+hM.SELECTION_TOP_LEFT),0===e.bottom&&(i+=" "+hM.SELECTION_BOTTOM_LEFT),0===n.top&&(i+=" "+hM.SELECTION_TOP_RIGHT),0===n.bottom&&(i+=" "+hM.SELECTION_BOTTOM_RIGHT)}f+=this._createSelectionPiece(p,g,i,t.left,t.width)}e[u][0]+=m,e[u][1]+=f}}prepareRender(e){const t=[],i=e.visibleRange.startLineNumber,n=e.visibleRange.endLineNumber;for(let s=i;s<=n;s++){t[s-i]=["",""]}const o=[];for(let s=0,r=this._selections.length;s<r;s++){const n=this._selections[s];if(n.isEmpty()){o[s]=null;continue}const r=this._getVisibleRangesWithStyle(n,e,this._previousFrameVisibleRangesWithStyle[s]);o[s]=r,this._actualRenderOneSelection(t,i,this._selections.length>1,r)}this._previousFrameVisibleRangesWithStyle=o,this._renderResult=t.map((([e,t])=>e+t))}render(e,t){if(!this._renderResult)return"";const i=t-e;return i<0||i>=this._renderResult.length?"":this._renderResult[i]}}function uM(e){return e<0?-e:e}hM.SELECTION_CLASS_NAME="selected-text",hM.SELECTION_TOP_LEFT="top-left-radius",hM.SELECTION_BOTTOM_LEFT="bottom-left-radius",hM.SELECTION_TOP_RIGHT="top-right-radius",hM.SELECTION_BOTTOM_RIGHT="bottom-right-radius",hM.EDITOR_BACKGROUND_CLASS_NAME="monaco-editor-background",hM.ROUNDED_PIECE_WIDTH=10,sx(((e,t)=>{const i=e.getColor(Ek);i&&t.addRule(`.monaco-editor .focused .selected-text { background-color: ${i}; }`);const n=e.getColor(Tk);n&&t.addRule(`.monaco-editor .selected-text { background-color: ${n}; }`);const o=e.getColor(Ik);o&&!o.isTransparent()&&t.addRule(`.monaco-editor .view-line span.inline-selected-text { color: ${o}; }`)}));class gM{constructor(e,t,i,n,o,s){this.top=e,this.left=t,this.width=i,this.height=n,this.textContent=o,this.textContentClassName=s}}class pM{constructor(e){this._context=e;const t=this._context.configuration.options,i=t.get(44);this._cursorStyle=t.get(24),this._lineHeight=t.get(59),this._typicalHalfwidthCharacterWidth=i.typicalHalfwidthCharacterWidth,this._lineCursorWidth=Math.min(t.get(27),this._typicalHalfwidthCharacterWidth),this._isVisible=!0,this._domNode=p_(document.createElement("div")),this._domNode.setClassName("cursor monaco-mouse-cursor-text"),this._domNode.setHeight(this._lineHeight),this._domNode.setTop(0),this._domNode.setLeft(0),m_(this._domNode,i),this._domNode.setDisplay("none"),this._position=new er(1,1),this._lastRenderedContent="",this._renderData=null}getDomNode(){return this._domNode}getPosition(){return this._position}show(){this._isVisible||(this._domNode.setVisibility("inherit"),this._isVisible=!0)}hide(){this._isVisible&&(this._domNode.setVisibility("hidden"),this._isVisible=!1)}onConfigurationChanged(e){const t=this._context.configuration.options,i=t.get(44);return this._cursorStyle=t.get(24),this._lineHeight=t.get(59),this._typicalHalfwidthCharacterWidth=i.typicalHalfwidthCharacterWidth,this._lineCursorWidth=Math.min(t.get(27),this._typicalHalfwidthCharacterWidth),m_(this._domNode,i),!0}onCursorPositionChanged(e){return this._position=e,!0}_getGraphemeAwarePosition(){const{lineNumber:e,column:t}=this._position,i=this._context.viewModel.getLineContent(e),[n,o]=Lr(i,t-1);return[new er(e,n+1),i.substring(n,o)]}_prepareRender(e){let t="";const[i,n]=this._getGraphemeAwarePosition();if(this._cursorStyle===Af.Line||this._cursorStyle===Af.LineThin){const o=e.visibleRangeForPosition(i);if(!o||o.outsideRenderedLine)return null;let s;this._cursorStyle===Af.Line?(s=JC(this._lineCursorWidth>0?this._lineCursorWidth:2),s>2&&(t=n)):s=JC(1);let r=o.left;s>=2&&r>=1&&(r-=1);const a=e.getVerticalOffsetForLineNumber(i.lineNumber)-e.bigNumbersDelta;return new gM(a,r,s,this._lineHeight,t,"")}const o=e.linesVisibleRangesForRange(new qo(i.lineNumber,i.column,i.lineNumber,i.column+n.length),!1);if(!o||0===o.length)return null;const s=o[0];if(s.outsideRenderedLine||0===s.ranges.length)return null;const r=s.ranges[0],a=r.width<1?this._typicalHalfwidthCharacterWidth:r.width;let l="";if(this._cursorStyle===Af.Block){const e=this._context.viewModel.getViewLineData(i.lineNumber);t=n;const o=e.tokens.findTokenIndexAtOffset(i.column-1);l=e.tokens.getClassName(o)}let d=e.getVerticalOffsetForLineNumber(i.lineNumber)-e.bigNumbersDelta,c=this._lineHeight;return this._cursorStyle!==Af.Underline&&this._cursorStyle!==Af.UnderlineThin||(d+=this._lineHeight-2,c=2),new gM(d,r.left,a,c,t,l)}prepareRender(e){this._renderData=this._prepareRender(e)}render(e){return this._renderData?(this._lastRenderedContent!==this._renderData.textContent&&(this._lastRenderedContent=this._renderData.textContent,this._domNode.domNode.textContent=this._lastRenderedContent),this._domNode.setClassName(`cursor monaco-mouse-cursor-text ${this._renderData.textContentClassName}`),this._domNode.setDisplay("block"),this._domNode.setTop(this._renderData.top),this._domNode.setLeft(this._renderData.left),this._domNode.setWidth(this._renderData.width),this._domNode.setLineHeight(this._renderData.height),this._domNode.setHeight(this._renderData.height),{domNode:this._domNode.domNode,position:this._position,contentLeft:this._renderData.left,height:this._renderData.height,width:2}):(this._domNode.setDisplay("none"),null)}}class mM extends jL{constructor(e){super(e);const t=this._context.configuration.options;this._readOnly=t.get(81),this._cursorBlinking=t.get(22),this._cursorStyle=t.get(24),this._cursorSmoothCaretAnimation=t.get(23),this._selectionIsEmpty=!0,this._isComposingInput=!1,this._isVisible=!1,this._primaryCursor=new pM(this._context),this._secondaryCursors=[],this._renderData=[],this._domNode=p_(document.createElement("div")),this._domNode.setAttribute("role","presentation"),this._domNode.setAttribute("aria-hidden","true"),this._updateDomClassName(),this._domNode.appendChild(this._primaryCursor.getDomNode()),this._startCursorBlinkAnimation=new rb,this._cursorFlatBlinkInterval=new ab,this._blinkingEnabled=!1,this._editorHasFocus=!1,this._updateBlinking()}dispose(){super.dispose(),this._startCursorBlinkAnimation.dispose(),this._cursorFlatBlinkInterval.dispose()}getDomNode(){return this._domNode}onCompositionStart(e){return this._isComposingInput=!0,this._updateBlinking(),!0}onCompositionEnd(e){return this._isComposingInput=!1,this._updateBlinking(),!0}onConfigurationChanged(e){const t=this._context.configuration.options;this._readOnly=t.get(81),this._cursorBlinking=t.get(22),this._cursorStyle=t.get(24),this._cursorSmoothCaretAnimation=t.get(23),this._updateBlinking(),this._updateDomClassName(),this._primaryCursor.onConfigurationChanged(e);for(let i=0,n=this._secondaryCursors.length;i<n;i++)this._secondaryCursors[i].onConfigurationChanged(e);return!0}_onCursorPositionChanged(e,t){if(this._primaryCursor.onCursorPositionChanged(e),this._updateBlinking(),this._secondaryCursors.length<t.length){const e=t.length-this._secondaryCursors.length;for(let t=0;t<e;t++){const e=new pM(this._context);this._domNode.domNode.insertBefore(e.getDomNode().domNode,this._primaryCursor.getDomNode().domNode.nextSibling),this._secondaryCursors.push(e)}}else if(this._secondaryCursors.length>t.length){const e=this._secondaryCursors.length-t.length;for(let t=0;t<e;t++)this._domNode.removeChild(this._secondaryCursors[0].getDomNode()),this._secondaryCursors.splice(0,1)}for(let i=0;i<t.length;i++)this._secondaryCursors[i].onCursorPositionChanged(t[i])}onCursorStateChanged(e){const t=[];for(let n=0,o=e.selections.length;n<o;n++)t[n]=e.selections[n].getPosition();this._onCursorPositionChanged(t[0],t.slice(1));const i=e.selections[0].isEmpty();return this._selectionIsEmpty!==i&&(this._selectionIsEmpty=i,this._updateDomClassName()),!0}onDecorationsChanged(e){return!0}onFlushed(e){return!0}onFocusChanged(e){return this._editorHasFocus=e.isFocused,this._updateBlinking(),!1}onLinesChanged(e){return!0}onLinesDeleted(e){return!0}onLinesInserted(e){return!0}onScrollChanged(e){return!0}onTokensChanged(e){const t=t=>{for(let i=0,n=e.ranges.length;i<n;i++)if(e.ranges[i].fromLineNumber<=t.lineNumber&&t.lineNumber<=e.ranges[i].toLineNumber)return!0;return!1};if(t(this._primaryCursor.getPosition()))return!0;for(const i of this._secondaryCursors)if(t(i.getPosition()))return!0;return!1}onZonesChanged(e){return!0}_getCursorBlinking(){return this._isComposingInput?0:this._editorHasFocus?this._readOnly?5:this._cursorBlinking:0}_updateBlinking(){this._startCursorBlinkAnimation.cancel(),this._cursorFlatBlinkInterval.cancel();const e=this._getCursorBlinking(),t=0===e,i=5===e;t?this._hide():this._show(),this._blinkingEnabled=!1,this._updateDomClassName(),t||i||(1===e?this._cursorFlatBlinkInterval.cancelAndSet((()=>{this._isVisible?this._hide():this._show()}),mM.BLINK_INTERVAL):this._startCursorBlinkAnimation.setIfNotSet((()=>{this._blinkingEnabled=!0,this._updateDomClassName()}),mM.BLINK_INTERVAL))}_updateDomClassName(){this._domNode.setClassName(this._getClassName())}_getClassName(){let e="cursors-layer";switch(this._selectionIsEmpty||(e+=" has-selection"),this._cursorStyle){case Af.Line:e+=" cursor-line-style";break;case Af.Block:e+=" cursor-block-style";break;case Af.Underline:e+=" cursor-underline-style";break;case Af.LineThin:e+=" cursor-line-thin-style";break;case Af.BlockOutline:e+=" cursor-block-outline-style";break;case Af.UnderlineThin:e+=" cursor-underline-thin-style";break;default:e+=" cursor-line-style"}if(this._blinkingEnabled)switch(this._getCursorBlinking()){case 1:e+=" cursor-blink";break;case 2:e+=" cursor-smooth";break;case 3:e+=" cursor-phase";break;case 4:e+=" cursor-expand";break;default:e+=" cursor-solid"}else e+=" cursor-solid";return this._cursorSmoothCaretAnimation&&(e+=" cursor-smooth-caret-animation"),e}_show(){this._primaryCursor.show();for(let e=0,t=this._secondaryCursors.length;e<t;e++)this._secondaryCursors[e].show();this._isVisible=!0}_hide(){this._primaryCursor.hide();for(let e=0,t=this._secondaryCursors.length;e<t;e++)this._secondaryCursors[e].hide();this._isVisible=!1}prepareRender(e){this._primaryCursor.prepareRender(e);for(let t=0,i=this._secondaryCursors.length;t<i;t++)this._secondaryCursors[t].prepareRender(e)}render(e){const t=[];let i=0;const n=this._primaryCursor.render(e);n&&(t[i++]=n);for(let o=0,s=this._secondaryCursors.length;o<s;o++){const n=this._secondaryCursors[o].render(e);n&&(t[i++]=n)}this._renderData=t}getLastRenderData(){return this._renderData}}mM.BLINK_INTERVAL=500,sx(((e,t)=>{const i=e.getColor(qN);if(i){let n=e.getColor(GN);n||(n=i.opposite()),t.addRule(`.monaco-editor .inputarea.ime-input { caret-color: ${i}; }`),t.addRule(`.monaco-editor .cursors-layer .cursor { background-color: ${i}; border-color: ${i}; color: ${n}; }`),"hc"===e.type&&t.addRule(`.monaco-editor .cursors-layer.has-selection .cursor { border-left: 1px solid ${n}; border-right: 1px solid ${n}; }`)}}));const fM=()=>{throw new Error("Invalid change accessor")};class _M extends jL{constructor(e){super(e);const t=this._context.configuration.options,i=t.get(131);this._lineHeight=t.get(59),this._contentWidth=i.contentWidth,this._contentLeft=i.contentLeft,this.domNode=p_(document.createElement("div")),this.domNode.setClassName("view-zones"),this.domNode.setPosition("absolute"),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this.marginDomNode=p_(document.createElement("div")),this.marginDomNode.setClassName("margin-view-zones"),this.marginDomNode.setPosition("absolute"),this.marginDomNode.setAttribute("role","presentation"),this.marginDomNode.setAttribute("aria-hidden","true"),this._zones={}}dispose(){super.dispose(),this._zones={}}_recomputeWhitespacesProps(){const e=this._context.viewLayout.getWhitespaces(),t=new Map;for(const n of e)t.set(n.id,n);let i=!1;return this._context.viewModel.changeWhitespace((e=>{const n=Object.keys(this._zones);for(let o=0,s=n.length;o<s;o++){const s=n[o],r=this._zones[s],a=this._computeWhitespaceProps(r.delegate);r.isInHiddenArea=a.isInHiddenArea;const l=t.get(s);!l||l.afterLineNumber===a.afterViewLineNumber&&l.height===a.heightInPx||(e.changeOneWhitespace(s,a.afterViewLineNumber,a.heightInPx),this._safeCallOnComputedHeight(r.delegate,a.heightInPx),i=!0)}})),i}onConfigurationChanged(e){const t=this._context.configuration.options,i=t.get(131);return this._lineHeight=t.get(59),this._contentWidth=i.contentWidth,this._contentLeft=i.contentLeft,e.hasChanged(59)&&this._recomputeWhitespacesProps(),!0}onLineMappingChanged(e){return this._recomputeWhitespacesProps()}onLinesDeleted(e){return!0}onScrollChanged(e){return e.scrollTopChanged||e.scrollWidthChanged}onZonesChanged(e){return!0}onLinesInserted(e){return!0}_getZoneOrdinal(e){return void 0!==e.afterColumn?e.afterColumn:1e4}_computeWhitespaceProps(e){if(0===e.afterLineNumber)return{isInHiddenArea:!1,afterViewLineNumber:0,heightInPx:this._heightInPixels(e),minWidthInPx:this._minWidthInPixels(e)};let t,i;if(void 0!==e.afterColumn)t=this._context.viewModel.model.validatePosition({lineNumber:e.afterLineNumber,column:e.afterColumn});else{const i=this._context.viewModel.model.validatePosition({lineNumber:e.afterLineNumber,column:1}).lineNumber;t=new er(i,this._context.viewModel.model.getLineMaxColumn(i))}i=t.column===this._context.viewModel.model.getLineMaxColumn(t.lineNumber)?this._context.viewModel.model.validatePosition({lineNumber:t.lineNumber+1,column:1}):this._context.viewModel.model.validatePosition({lineNumber:t.lineNumber,column:t.column+1});const n=this._context.viewModel.coordinatesConverter.convertModelPositionToViewPosition(t,e.afterColumnAffinity),o=this._context.viewModel.coordinatesConverter.modelPositionIsVisible(i);return{isInHiddenArea:!o,afterViewLineNumber:n.lineNumber,heightInPx:o?this._heightInPixels(e):0,minWidthInPx:this._minWidthInPixels(e)}}changeViewZones(e){let t=!1;return this._context.viewModel.changeWhitespace((i=>{const n={addZone:e=>(t=!0,this._addZone(i,e)),removeZone:e=>{e&&(t=this._removeZone(i,e)||t)},layoutZone:e=>{e&&(t=this._layoutZone(i,e)||t)}};!function(e,t){try{e(t)}catch(i){Jo(i)}}(e,n),n.addZone=fM,n.removeZone=fM,n.layoutZone=fM})),t}_addZone(e,t){const i=this._computeWhitespaceProps(t),n={whitespaceId:e.insertWhitespace(i.afterViewLineNumber,this._getZoneOrdinal(t),i.heightInPx,i.minWidthInPx),delegate:t,isInHiddenArea:i.isInHiddenArea,isVisible:!1,domNode:p_(t.domNode),marginDomNode:t.marginDomNode?p_(t.marginDomNode):null};return this._safeCallOnComputedHeight(n.delegate,i.heightInPx),n.domNode.setPosition("absolute"),n.domNode.domNode.style.width="100%",n.domNode.setDisplay("none"),n.domNode.setAttribute("monaco-view-zone",n.whitespaceId),this.domNode.appendChild(n.domNode),n.marginDomNode&&(n.marginDomNode.setPosition("absolute"),n.marginDomNode.domNode.style.width="100%",n.marginDomNode.setDisplay("none"),n.marginDomNode.setAttribute("monaco-view-zone",n.whitespaceId),this.marginDomNode.appendChild(n.marginDomNode)),this._zones[n.whitespaceId]=n,this.setShouldRender(),n.whitespaceId}_removeZone(e,t){if(this._zones.hasOwnProperty(t)){const i=this._zones[t];return delete this._zones[t],e.removeWhitespace(i.whitespaceId),i.domNode.removeAttribute("monaco-visible-view-zone"),i.domNode.removeAttribute("monaco-view-zone"),i.domNode.domNode.parentNode.removeChild(i.domNode.domNode),i.marginDomNode&&(i.marginDomNode.removeAttribute("monaco-visible-view-zone"),i.marginDomNode.removeAttribute("monaco-view-zone"),i.marginDomNode.domNode.parentNode.removeChild(i.marginDomNode.domNode)),this.setShouldRender(),!0}return!1}_layoutZone(e,t){if(this._zones.hasOwnProperty(t)){const i=this._zones[t],n=this._computeWhitespaceProps(i.delegate);return i.isInHiddenArea=n.isInHiddenArea,e.changeOneWhitespace(i.whitespaceId,n.afterViewLineNumber,n.heightInPx),this._safeCallOnComputedHeight(i.delegate,n.heightInPx),this.setShouldRender(),!0}return!1}shouldSuppressMouseDownOnViewZone(e){if(this._zones.hasOwnProperty(e)){const t=this._zones[e];return Boolean(t.delegate.suppressMouseDown)}return!1}_heightInPixels(e){return"number"==typeof e.heightInPx?e.heightInPx:"number"==typeof e.heightInLines?this._lineHeight*e.heightInLines:this._lineHeight}_minWidthInPixels(e){return"number"==typeof e.minWidthInPx?e.minWidthInPx:0}_safeCallOnComputedHeight(e,t){if("function"==typeof e.onComputedHeight)try{e.onComputedHeight(t)}catch(i){Jo(i)}}_safeCallOnDomNodeTop(e,t){if("function"==typeof e.onDomNodeTop)try{e.onDomNodeTop(t)}catch(i){Jo(i)}}prepareRender(e){}render(e){const t=e.viewportData.whitespaceViewportData,i={};let n=!1;for(const s of t)this._zones[s.id].isInHiddenArea||(i[s.id]=s,n=!0);const o=Object.keys(this._zones);for(let s=0,r=o.length;s<r;s++){const t=o[s],n=this._zones[t];let r=0,a=0,l="none";i.hasOwnProperty(t)?(r=i[t].verticalOffset-e.bigNumbersDelta,a=i[t].height,l="block",n.isVisible||(n.domNode.setAttribute("monaco-visible-view-zone","true"),n.isVisible=!0),this._safeCallOnDomNodeTop(n.delegate,e.getScrolledTopFromAbsoluteTop(i[t].verticalOffset))):(n.isVisible&&(n.domNode.removeAttribute("monaco-visible-view-zone"),n.isVisible=!1),this._safeCallOnDomNodeTop(n.delegate,e.getScrolledTopFromAbsoluteTop(-1e6))),n.domNode.setTop(r),n.domNode.setHeight(a),n.domNode.setDisplay(l),n.marginDomNode&&(n.marginDomNode.setTop(r),n.marginDomNode.setHeight(a),n.marginDomNode.setDisplay(l))}n&&(this.domNode.setWidth(Math.max(e.scrollWidth,this._contentWidth)),this.marginDomNode.setWidth(this._contentLeft))}}class vM{constructor(e){this._theme=e}get type(){return this._theme.type}get value(){return this._theme}update(e){this._theme=e}getColor(e){return this._theme.getColor(e)}}class bM{constructor(e,t,i){this.configuration=e,this.theme=new vM(t),this.viewModel=i,this.viewLayout=i.viewLayout}addEventHandler(e){this.viewModel.addViewEventHandler(e)}removeEventHandler(e){this.viewModel.removeViewEventHandler(e)}}class wM{constructor(e,t,i,n){this.selections=e,this.startLineNumber=0|t.startLineNumber,this.endLineNumber=0|t.endLineNumber,this.relativeVerticalOffset=t.relativeVerticalOffset,this.bigNumbersDelta=0|t.bigNumbersDelta,this.whitespaceViewportData=i,this._model=n,this.visibleRange=new qo(t.startLineNumber,this._model.getLineMinColumn(t.startLineNumber),t.endLineNumber,this._model.getLineMaxColumn(t.endLineNumber))}getViewLineRenderingData(e){return this._model.getViewLineRenderingData(this.visibleRange,e)}getDecorationsInViewport(){return this._model.getDecorationsInViewport(this.visibleRange)}}class CM extends HL{constructor(e,t,i,n,o,s){super(),this._selections=[new ar(1,1,1,1)],this._renderAnimationFrame=null;const r=new RI(t,n,o,e);this._context=new bM(t,i,n),this._context.addEventHandler(this),this._viewParts=[],this._textAreaHandler=new WE(this._context,r,this._createTextAreaHandlerHelper()),this._viewParts.push(this._textAreaHandler),this._linesContent=p_(document.createElement("div")),this._linesContent.setClassName("lines-content monaco-editor-background"),this._linesContent.setPosition("absolute"),this.domNode=p_(document.createElement("div")),this.domNode.setClassName(this._getEditorClassName()),this.domNode.setAttribute("role","code"),this._overflowGuardContainer=p_(document.createElement("div")),UL.write(this._overflowGuardContainer,3),this._overflowGuardContainer.setClassName("overflow-guard"),this._scrollbar=new _T(this._context,this._linesContent,this.domNode,this._overflowGuardContainer),this._viewParts.push(this._scrollbar),this._viewLines=new MT(this._context,this._linesContent),this._viewZones=new _M(this._context),this._viewParts.push(this._viewZones);const a=new eM(this._context);this._viewParts.push(a);const l=new rM(this._context);this._viewParts.push(l);const d=new HI(this._context);this._viewParts.push(d),d.addDynamicOverlay(new ZI(this._context)),d.addDynamicOverlay(new hM(this._context)),d.addDynamicOverlay(new LT(this._context)),d.addDynamicOverlay(new XI(this._context));const c=new jI(this._context);this._viewParts.push(c),c.addDynamicOverlay(new YI(this._context)),c.addDynamicOverlay(new wT(this._context)),c.addDynamicOverlay(new OT(this._context)),c.addDynamicOverlay(new AT(this._context)),c.addDynamicOverlay(new PE(this._context));const h=new FE(this._context);h.getDomNode().appendChild(this._viewZones.marginDomNode),h.getDomNode().appendChild(c.getDomNode()),this._viewParts.push(h),this._contentWidgets=new $I(this._context,this.domNode),this._viewParts.push(this._contentWidgets),this._viewCursors=new mM(this._context),this._viewParts.push(this._viewCursors),this._overlayWidgets=new QT(this._context),this._viewParts.push(this._overlayWidgets);const u=new sM(this._context);this._viewParts.push(u);const g=new ZT(this._context);if(this._viewParts.push(g),a){const e=this._scrollbar.getOverviewRulerLayoutInfo();e.parent.insertBefore(a.getDomNode(),e.insertBefore)}this._linesContent.appendChild(d.getDomNode()),this._linesContent.appendChild(u.domNode),this._linesContent.appendChild(this._viewZones.domNode),this._linesContent.appendChild(this._viewLines.getDomNode()),this._linesContent.appendChild(this._contentWidgets.domNode),this._linesContent.appendChild(this._viewCursors.getDomNode()),this._overflowGuardContainer.appendChild(h.getDomNode()),this._overflowGuardContainer.appendChild(this._scrollbar.getDomNode()),this._overflowGuardContainer.appendChild(l.getDomNode()),this._overflowGuardContainer.appendChild(this._textAreaHandler.textArea),this._overflowGuardContainer.appendChild(this._textAreaHandler.textAreaCover),this._overflowGuardContainer.appendChild(this._overlayWidgets.getDomNode()),this._overflowGuardContainer.appendChild(g.getDomNode()),this.domNode.appendChild(this._overflowGuardContainer),s?s.appendChild(this._contentWidgets.overflowingContentWidgetsDomNode.domNode):this.domNode.appendChild(this._contentWidgets.overflowingContentWidgetsDomNode),this._applyLayout(),this._pointerHandler=this._register(new VN(this._context,r,this._createPointerHandlerHelper()))}_flushAccumulatedAndRenderNow(){this._renderNow()}_createPointerHandlerHelper(){return{viewDomNode:this.domNode.domNode,linesContentDomNode:this._linesContent.domNode,focusTextArea:()=>{this.focus()},dispatchTextAreaEvent:e=>{this._textAreaHandler.textArea.domNode.dispatchEvent(e)},getLastRenderData:()=>{const e=this._viewCursors.getLastRenderData()||[],t=this._textAreaHandler.getLastRenderData();return new pN(e,t)},shouldSuppressMouseDownOnViewZone:e=>this._viewZones.shouldSuppressMouseDownOnViewZone(e),shouldSuppressMouseDownOnWidget:e=>this._contentWidgets.shouldSuppressMouseDownOnWidget(e),getPositionFromDOMInfo:(e,t)=>(this._flushAccumulatedAndRenderNow(),this._viewLines.getPositionFromDOMInfo(e,t)),visibleRangeForPosition:(e,t)=>(this._flushAccumulatedAndRenderNow(),this._viewLines.visibleRangeForPosition(new er(e,t))),getLineWidth:e=>(this._flushAccumulatedAndRenderNow(),this._viewLines.getLineWidth(e))}}_createTextAreaHandlerHelper(){return{visibleRangeForPosition:e=>(this._flushAccumulatedAndRenderNow(),this._viewLines.visibleRangeForPosition(e))}}_applyLayout(){const e=this._context.configuration.options.get(131);this.domNode.setWidth(e.width),this.domNode.setHeight(e.height),this._overflowGuardContainer.setWidth(e.width),this._overflowGuardContainer.setHeight(e.height),this._linesContent.setWidth(1e6),this._linesContent.setHeight(1e6)}_getEditorClassName(){const e=this._textAreaHandler.isFocused()?" focused":"";return this._context.configuration.options.get(128)+" "+ix(this._context.theme.type)+e}handleEvents(e){super.handleEvents(e),this._scheduleRender()}onConfigurationChanged(e){return this.domNode.setClassName(this._getEditorClassName()),this._applyLayout(),!1}onCursorStateChanged(e){return this._selections=e.selections,!1}onFocusChanged(e){return this.domNode.setClassName(this._getEditorClassName()),!1}onThemeChanged(e){return this._context.theme.update(e.theme),this.domNode.setClassName(this._getEditorClassName()),!1}dispose(){null!==this._renderAnimationFrame&&(this._renderAnimationFrame.dispose(),this._renderAnimationFrame=null),this._contentWidgets.overflowingContentWidgetsDomNode.domNode.remove(),this._context.removeEventHandler(this),this._viewLines.dispose();for(const e of this._viewParts)e.dispose();super.dispose()}_scheduleRender(){null===this._renderAnimationFrame&&(this._renderAnimationFrame=cC(this._onRenderScheduled.bind(this),100))}_onRenderScheduled(){this._renderAnimationFrame=null,this._flushAccumulatedAndRenderNow()}_renderNow(){!function(e){try{e()}catch(t){Jo(t)}}((()=>this._actualRender()))}_getViewPartsToRender(){const e=[];let t=0;for(const i of this._viewParts)i.shouldRender()&&(e[t++]=i);return e}_actualRender(){if(!tC(this.domNode.domNode))return;let e=this._getViewPartsToRender();if(!this._viewLines.shouldRender()&&0===e.length)return;const t=this._context.viewLayout.getLinesViewportData();this._context.viewModel.setViewport(t.startLineNumber,t.endLineNumber,t.centeredLineNumber);const i=new wM(this._selections,t,this._context.viewLayout.getWhitespaceViewportData(),this._context.viewModel);this._contentWidgets.shouldRender()&&this._contentWidgets.onBeforeRender(i),this._viewLines.shouldRender()&&(this._viewLines.renderText(i),this._viewLines.onDidRender(),e=this._getViewPartsToRender());const n=new $L(this._context.viewLayout,i,this._viewLines);for(const o of e)o.prepareRender(n);for(const o of e)o.render(n),o.onDidRender()}delegateVerticalScrollbarMouseDown(e){this._scrollbar.delegateVerticalScrollbarMouseDown(e)}restoreState(e){this._context.viewModel.viewLayout.setScrollPosition({scrollTop:e.scrollTop},1),this._context.viewModel.tokenizeViewport(),this._renderNow(),this._viewLines.updateLineWidths(),this._context.viewModel.viewLayout.setScrollPosition({scrollLeft:e.scrollLeft},1)}getOffsetForColumn(e,t){const i=this._context.viewModel.model.validatePosition({lineNumber:e,column:t}),n=this._context.viewModel.coordinatesConverter.convertModelPositionToViewPosition(i);this._flushAccumulatedAndRenderNow();const o=this._viewLines.visibleRangeForPosition(new er(n.lineNumber,n.column));return o?o.left:-1}getTargetAtClientPoint(e,t){const i=this._pointerHandler.getTargetAtClientPoint(e,t);return i?PI.convertViewToModelMouseTarget(i,this._context.viewModel.coordinatesConverter):null}createOverviewRuler(e){return new oM(this._context,e)}change(e){this._viewZones.changeViewZones(e),this._scheduleRender()}render(e,t){if(t){this._viewLines.forceShouldRender();for(const e of this._viewParts)e.forceShouldRender()}e?this._flushAccumulatedAndRenderNow():this._scheduleRender()}focus(){this._textAreaHandler.focusTextArea()}isFocused(){return this._textAreaHandler.isFocused()}setAriaOptions(e){this._textAreaHandler.setAriaOptions(e)}addContentWidget(e){this._contentWidgets.addWidget(e.widget),this.layoutContentWidget(e),this._scheduleRender()}layoutContentWidget(e){let t=e.position&&e.position.range||null;if(null===t){const i=e.position?e.position.position:null;null!==i&&(t=new qo(i.lineNumber,i.column,i.lineNumber,i.column))}const i=e.position?e.position.preference:null;this._contentWidgets.setWidgetPosition(e.widget,t,i),this._scheduleRender()}removeContentWidget(e){this._contentWidgets.removeWidget(e.widget),this._scheduleRender()}addOverlayWidget(e){this._overlayWidgets.addWidget(e.widget),this.layoutOverlayWidget(e),this._scheduleRender()}layoutOverlayWidget(e){const t=e.position?e.position.preference:null;this._overlayWidgets.setWidgetPosition(e.widget,t)&&this._scheduleRender()}removeOverlayWidget(e){this._overlayWidgets.removeWidget(e.widget),this._scheduleRender()}}class yM{constructor(e){this._selTrackedRange=null,this._trackSelection=!0,this._setState(e,new ZE(new qo(1,1,1,1),0,new er(1,1),0),new ZE(new qo(1,1,1,1),0,new er(1,1),0))}dispose(e){this._removeTrackedRange(e)}startTrackingSelection(e){this._trackSelection=!0,this._updateTrackedRange(e)}stopTrackingSelection(e){this._trackSelection=!1,this._removeTrackedRange(e)}_updateTrackedRange(e){this._trackSelection&&(this._selTrackedRange=e.model._setTrackedRange(this._selTrackedRange,this.modelState.selection,0))}_removeTrackedRange(e){this._selTrackedRange=e.model._setTrackedRange(this._selTrackedRange,null,0)}asCursorState(){return new KE(this.modelState,this.viewState)}readSelectionFromMarkers(e){const t=e.model._getTrackedRange(this._selTrackedRange);return ar.fromRange(t,this.modelState.selection.getDirection())}ensureValidState(e){this._setState(e,this.modelState,this.viewState)}setState(e,t,i){this._setState(e,t,i)}static _validatePositionWithCache(e,t,i,n){return t.equals(i)?n:e.normalizePosition(t,2)}static _validateViewState(e,t){const i=t.position,n=t.selectionStart.getStartPosition(),o=t.selectionStart.getEndPosition(),s=e.normalizePosition(i,2),r=this._validatePositionWithCache(e,n,i,s),a=this._validatePositionWithCache(e,o,n,r);return i.equals(s)&&n.equals(r)&&o.equals(a)?t:new ZE(qo.fromPositions(r,a),t.selectionStartLeftoverVisibleColumns+n.column-r.column,s,t.leftoverVisibleColumns+i.column-s.column)}_setState(e,t,i){if(i&&(i=yM._validateViewState(e.viewModel,i)),t){const i=e.model.validateRange(t.selectionStart),n=t.selectionStart.equalsRange(i)?t.selectionStartLeftoverVisibleColumns:0,o=e.model.validatePosition(t.position),s=t.position.equals(o)?t.leftoverVisibleColumns:0;t=new ZE(i,n,o,s)}else{if(!i)return;const n=e.model.validateRange(e.coordinatesConverter.convertViewRangeToModelRange(i.selectionStart)),o=e.model.validatePosition(e.coordinatesConverter.convertViewPositionToModelPosition(i.position));t=new ZE(n,i.selectionStartLeftoverVisibleColumns,o,i.leftoverVisibleColumns)}if(i){const n=e.coordinatesConverter.validateViewRange(i.selectionStart,t.selectionStart),o=e.coordinatesConverter.validateViewPosition(i.position,t.position);i=new ZE(n,t.selectionStartLeftoverVisibleColumns,o,t.leftoverVisibleColumns)}else{const n=e.coordinatesConverter.convertModelPositionToViewPosition(new er(t.selectionStart.startLineNumber,t.selectionStart.startColumn)),o=e.coordinatesConverter.convertModelPositionToViewPosition(new er(t.selectionStart.endLineNumber,t.selectionStart.endColumn)),s=new qo(n.lineNumber,n.column,o.lineNumber,o.column),r=e.coordinatesConverter.convertModelPositionToViewPosition(t.position);i=new ZE(s,t.selectionStartLeftoverVisibleColumns,r,t.leftoverVisibleColumns)}this.modelState=t,this.viewState=i,this._updateTrackedRange(e)}}class xM{constructor(e){this.context=e,this.cursors=[new yM(e)],this.lastAddedCursorIndex=0}dispose(){for(const e of this.cursors)e.dispose(this.context)}startTrackingSelections(){for(const e of this.cursors)e.startTrackingSelection(this.context)}stopTrackingSelections(){for(const e of this.cursors)e.stopTrackingSelection(this.context)}updateContext(e){this.context=e}ensureValidState(){for(const e of this.cursors)e.ensureValidState(this.context)}readSelectionFromMarkers(){return this.cursors.map((e=>e.readSelectionFromMarkers(this.context)))}getAll(){return this.cursors.map((e=>e.asCursorState()))}getViewPositions(){return this.cursors.map((e=>e.viewState.position))}getTopMostViewPosition(){return Nr(this.cursors,Er((e=>e.viewState.position),er.compare)).viewState.position}getBottomMostViewPosition(){return Ir(this.cursors,Er((e=>e.viewState.position),er.compare)).viewState.position}getSelections(){return this.cursors.map((e=>e.modelState.selection))}getViewSelections(){return this.cursors.map((e=>e.viewState.selection))}setSelections(e){this.setStates(KE.fromModelSelections(e))}getPrimaryCursor(){return this.cursors[0].asCursorState()}setStates(e){null!==e&&(this.cursors[0].setState(this.context,e[0].modelState,e[0].viewState),this._setSecondaryStates(e.slice(1)))}_setSecondaryStates(e){const t=this.cursors.length-1,i=e.length;if(t<i){const e=i-t;for(let t=0;t<e;t++)this._addSecondaryCursor()}else if(t>i){const e=t-i;for(let t=0;t<e;t++)this._removeSecondaryCursor(this.cursors.length-2)}for(let n=0;n<i;n++)this.cursors[n+1].setState(this.context,e[n].modelState,e[n].viewState)}killSecondaryCursors(){this._setSecondaryStates([])}_addSecondaryCursor(){this.cursors.push(new yM(this.context)),this.lastAddedCursorIndex=this.cursors.length-1}getLastAddedCursorIndex(){return 1===this.cursors.length||0===this.lastAddedCursorIndex?0:this.lastAddedCursorIndex}_removeSecondaryCursor(e){this.lastAddedCursorIndex>=e+1&&this.lastAddedCursorIndex--,this.cursors[e+1].dispose(this.context),this.cursors.splice(e+1,1)}normalize(){if(1===this.cursors.length)return;const e=this.cursors.slice(0),t=[];for(let i=0,n=e.length;i<n;i++)t.push({index:i,selection:e[i].modelState.selection});t.sort(Er((e=>e.selection),qo.compareRangesUsingStarts));for(let i=0;i<t.length-1;i++){const n=t[i],o=t[i+1],s=n.selection,r=o.selection;if(!this.context.cursorConfig.multiCursorMergeOverlapping)continue;let a;if(a=r.isEmpty()||s.isEmpty()?r.getStartPosition().isBeforeOrEqual(s.getEndPosition()):r.getStartPosition().isBefore(s.getEndPosition()),a){const s=n.index<o.index?i:i+1,r=n.index<o.index?i+1:i,a=t[r].index,l=t[s].index,d=t[r].selection,c=t[s].selection;if(!d.equalsSelection(c)){const i=d.plusRange(c),n=d.selectionStartLineNumber===d.startLineNumber&&d.selectionStartColumn===d.startColumn,o=c.selectionStartLineNumber===c.startLineNumber&&c.selectionStartColumn===c.startColumn;let r,h;a===this.lastAddedCursorIndex?(r=n,this.lastAddedCursorIndex=l):r=o,h=r?new ar(i.startLineNumber,i.startColumn,i.endLineNumber,i.endColumn):new ar(i.endLineNumber,i.endColumn,i.startLineNumber,i.startColumn),t[s].selection=h;const u=KE.fromModelSelection(h);e[l].setState(this.context,u.modelState,u.viewState)}for(const e of t)e.index>a&&e.index--;e.splice(a,1),t.splice(r,1),this._removeSecondaryCursor(a-1),i--}}}}class SM{constructor(e,t,i,n){this._cursorContextBrand=void 0,this.model=e,this.viewModel=t,this.coordinatesConverter=i,this.cursorConfig=n}}class kM{constructor(){this.changeType=1}}class DM{constructor(e,t,i,n,o){this.ownerId=e,this.lineNumber=t,this.column=i,this.options=n,this.order=o}static applyInjectedText(e,t){if(!t||0===t.length)return e;let i="",n=0;for(const o of t)i+=e.substring(n,o.column-1),n=o.column-1,i+=o.options.content;return i+=e.substring(n),i}static fromDecorations(e){const t=[];for(const i of e)i.options.before&&i.options.before.content.length>0&&t.push(new DM(i.ownerId,i.range.startLineNumber,i.range.startColumn,i.options.before,0)),i.options.after&&i.options.after.content.length>0&&t.push(new DM(i.ownerId,i.range.endLineNumber,i.range.endColumn,i.options.after,1));return t.sort(((e,t)=>e.lineNumber===t.lineNumber?e.column===t.column?e.order-t.order:e.column-t.column:e.lineNumber-t.lineNumber)),t}}class LM{constructor(e,t,i){this.changeType=2,this.lineNumber=e,this.detail=t,this.injectedText=i}}class NM{constructor(e,t){this.changeType=3,this.fromLineNumber=e,this.toLineNumber=t}}class EM{constructor(e,t,i,n){this.changeType=4,this.injectedTexts=n,this.fromLineNumber=e,this.toLineNumber=t,this.detail=i}}class IM{constructor(){this.changeType=5}}class TM{constructor(e,t,i,n){this.changes=e,this.versionId=t,this.isUndoing=i,this.isRedoing=n,this.resultingSelection=null}containsEvent(e){for(let t=0,i=this.changes.length;t<i;t++){if(this.changes[t].changeType===e)return!0}return!1}static merge(e,t){const i=[].concat(e.changes).concat(t.changes),n=t.versionId,o=e.isUndoing||t.isUndoing,s=e.isRedoing||t.isRedoing;return new TM(i,n,o,s)}}class MM{constructor(e){this.changes=e}}class AM{constructor(e,t){this.rawContentChangedEvent=e,this.contentChangedEvent=t}merge(e){const t=TM.merge(this.rawContentChangedEvent,e.rawContentChangedEvent),i=AM._mergeChangeEvents(this.contentChangedEvent,e.contentChangedEvent);return new AM(t,i)}static _mergeChangeEvents(e,t){return{changes:[].concat(e.changes).concat(t.changes),eol:t.eol,versionId:t.versionId,isUndoing:e.isUndoing||t.isUndoing,isRedoing:e.isRedoing||t.isRedoing,isFlush:e.isFlush||t.isFlush}}}class OM{constructor(){this.type=0}}class RM{constructor(){this.type=1}}class PM{constructor(e){this.type=2,this._source=e}hasChanged(e){return this._source.hasChanged(e)}}class FM{constructor(e,t){this.type=3,this.selections=e,this.modelSelections=t}}class BM{constructor(e){this.type=4,e?(this.affectsMinimap=e.affectsMinimap,this.affectsOverviewRuler=e.affectsOverviewRuler):(this.affectsMinimap=!0,this.affectsOverviewRuler=!0)}}class VM{constructor(){this.type=5}}class WM{constructor(e){this.type=6,this.isFocused=e}}class zM{constructor(){this.type=7}}class HM{constructor(){this.type=8}}class jM{constructor(e,t){this.type=9,this.fromLineNumber=e,this.toLineNumber=t}}class UM{constructor(e,t){this.type=10,this.fromLineNumber=e,this.toLineNumber=t}}class $M{constructor(e,t){this.type=11,this.fromLineNumber=e,this.toLineNumber=t}}class KM{constructor(e,t,i,n,o,s,r){this.source=e,this.minimalReveal=t,this.range=i,this.selections=n,this.verticalType=o,this.revealHorizontal=s,this.scrollType=r,this.type=12}}class qM{constructor(e){this.type=13,this.scrollWidth=e.scrollWidth,this.scrollLeft=e.scrollLeft,this.scrollHeight=e.scrollHeight,this.scrollTop=e.scrollTop,this.scrollWidthChanged=e.scrollWidthChanged,this.scrollLeftChanged=e.scrollLeftChanged,this.scrollHeightChanged=e.scrollHeightChanged,this.scrollTopChanged=e.scrollTopChanged}}class GM{constructor(e){this.theme=e,this.type=14}}class ZM{constructor(e){this.type=15,this.ranges=e}}class YM{constructor(){this.type=16}}class XM{constructor(){this.type=17}}class QM extends Uo{constructor(){super(),this._onEvent=this._register(new $o),this.onEvent=this._onEvent.event,this._eventHandlers=[],this._viewEventQueue=null,this._isConsumingViewEventQueue=!1,this._collector=null,this._collectorCnt=0,this._outgoingEvents=[]}emitOutgoingEvent(e){this._addOutgoingEvent(e),this._emitOutgoingEvents()}_addOutgoingEvent(e){for(let t=0,i=this._outgoingEvents.length;t<i;t++)if(this._outgoingEvents[t].kind===e.kind)return void(this._outgoingEvents[t]=this._outgoingEvents[t].merge(e));this._outgoingEvents.push(e)}_emitOutgoingEvents(){for(;this._outgoingEvents.length>0;){if(this._collector||this._isConsumingViewEventQueue)return;const e=this._outgoingEvents.shift();e.isNoOp()||this._onEvent.fire(e)}}addViewEventHandler(e){for(let t=0,i=this._eventHandlers.length;t<i;t++)this._eventHandlers[t];this._eventHandlers.push(e)}removeViewEventHandler(e){for(let t=0;t<this._eventHandlers.length;t++)if(this._eventHandlers[t]===e){this._eventHandlers.splice(t,1);break}}beginEmitViewEvents(){return this._collectorCnt++,1===this._collectorCnt&&(this._collector=new JM),this._collector}endEmitViewEvents(){if(this._collectorCnt--,0===this._collectorCnt){const e=this._collector.outgoingEvents,t=this._collector.viewEvents;this._collector=null;for(const i of e)this._addOutgoingEvent(i);t.length>0&&this._emitMany(t)}this._emitOutgoingEvents()}emitSingleViewEvent(e){try{this.beginEmitViewEvents().emitViewEvent(e)}finally{this.endEmitViewEvents()}}_emitMany(e){this._viewEventQueue?this._viewEventQueue=this._viewEventQueue.concat(e):this._viewEventQueue=e,this._isConsumingViewEventQueue||this._consumeViewEventQueue()}_consumeViewEventQueue(){try{this._isConsumingViewEventQueue=!0,this._doConsumeQueue()}finally{this._isConsumingViewEventQueue=!1}}_doConsumeQueue(){for(;this._viewEventQueue;){const e=this._viewEventQueue;this._viewEventQueue=null;const t=this._eventHandlers.slice(0);for(const i of t)i.handleEvents(e)}}}class JM{constructor(){this.viewEvents=[],this.outgoingEvents=[]}emitViewEvent(e){this.viewEvents.push(e)}emitOutgoingEvent(e){this.outgoingEvents.push(e)}}class eA{constructor(e,t,i,n){this.kind=0,this._oldContentWidth=e,this._oldContentHeight=t,this.contentWidth=i,this.contentHeight=n,this.contentWidthChanged=this._oldContentWidth!==this.contentWidth,this.contentHeightChanged=this._oldContentHeight!==this.contentHeight}isNoOp(){return!this.contentWidthChanged&&!this.contentHeightChanged}merge(e){return 0!==e.kind?this:new eA(this._oldContentWidth,this._oldContentHeight,e.contentWidth,e.contentHeight)}}class tA{constructor(e,t){this.kind=1,this.oldHasFocus=e,this.hasFocus=t}isNoOp(){return this.oldHasFocus===this.hasFocus}merge(e){return 1!==e.kind?this:new tA(this.oldHasFocus,e.hasFocus)}}class iA{constructor(e,t,i,n,o,s,r,a){this.kind=2,this._oldScrollWidth=e,this._oldScrollLeft=t,this._oldScrollHeight=i,this._oldScrollTop=n,this.scrollWidth=o,this.scrollLeft=s,this.scrollHeight=r,this.scrollTop=a,this.scrollWidthChanged=this._oldScrollWidth!==this.scrollWidth,this.scrollLeftChanged=this._oldScrollLeft!==this.scrollLeft,this.scrollHeightChanged=this._oldScrollHeight!==this.scrollHeight,this.scrollTopChanged=this._oldScrollTop!==this.scrollTop}isNoOp(){return!(this.scrollWidthChanged||this.scrollLeftChanged||this.scrollHeightChanged||this.scrollTopChanged)}merge(e){return 2!==e.kind?this:new iA(this._oldScrollWidth,this._oldScrollLeft,this._oldScrollHeight,this._oldScrollTop,e.scrollWidth,e.scrollLeft,e.scrollHeight,e.scrollTop)}}class nA{constructor(){this.kind=3}isNoOp(){return!1}merge(e){return this}}class oA{constructor(e,t,i,n,o,s,r){this.kind=6,this.oldSelections=e,this.selections=t,this.oldModelVersionId=i,this.modelVersionId=n,this.source=o,this.reason=s,this.reachedMaxCursorCount=r}static _selectionsAreEqual(e,t){if(!e&&!t)return!0;if(!e||!t)return!1;const i=e.length;if(i!==t.length)return!1;for(let n=0;n<i;n++)if(!e[n].equalsSelection(t[n]))return!1;return!0}isNoOp(){return oA._selectionsAreEqual(this.oldSelections,this.selections)&&this.oldModelVersionId===this.modelVersionId}merge(e){return 6!==e.kind?this:new oA(this.oldSelections,e.selections,this.oldModelVersionId,e.modelVersionId,e.source,e.reason,this.reachedMaxCursorCount||e.reachedMaxCursorCount)}}class sA{constructor(){this.kind=5}isNoOp(){return!1}merge(e){return this}}class rA extends Uo{constructor(e,t,i,n){super(),this._model=e,this._knownModelVersionId=this._model.getVersionId(),this._viewModel=t,this._coordinatesConverter=i,this.context=new SM(this._model,this._viewModel,this._coordinatesConverter,n),this._cursors=new xM(this.context),this._hasFocus=!1,this._isHandling=!1,this._isDoingComposition=!1,this._selectionsWhenCompositionStarted=null,this._columnSelectData=null,this._autoClosedActions=[],this._prevEditOperationType=0}dispose(){this._cursors.dispose(),this._autoClosedActions=bs(this._autoClosedActions),super.dispose()}updateConfiguration(e){this.context=new SM(this._model,this._viewModel,this._coordinatesConverter,e),this._cursors.updateContext(this.context)}onLineMappingChanged(e){this._knownModelVersionId===this._model.getVersionId()&&this.setStates(e,"viewModel",0,this.getCursorStates())}setHasFocus(e){this._hasFocus=e}_validateAutoClosedActions(){if(this._autoClosedActions.length>0){const e=this._cursors.getSelections();for(let t=0;t<this._autoClosedActions.length;t++){const i=this._autoClosedActions[t];i.isValid(e)||(i.dispose(),this._autoClosedActions.splice(t,1),t--)}}}getPrimaryCursorState(){return this._cursors.getPrimaryCursor()}getLastAddedCursorIndex(){return this._cursors.getLastAddedCursorIndex()}getCursorStates(){return this._cursors.getAll()}setStates(e,t,i,n){let o=!1;null!==n&&n.length>rA.MAX_CURSOR_COUNT&&(n=n.slice(0,rA.MAX_CURSOR_COUNT),o=!0);const s=aA.from(this._model,this);return this._cursors.setStates(n),this._cursors.normalize(),this._columnSelectData=null,this._validateAutoClosedActions(),this._emitStateChangedIfNecessary(e,t,i,s,o)}setCursorColumnSelectData(e){this._columnSelectData=e}revealPrimary(e,t,i,n,o,s){const r=this._cursors.getViewPositions();let a=null,l=null;r.length>1?l=this._cursors.getViewSelections():a=qo.fromPositions(r[0],r[0]),e.emitViewEvent(new KM(t,i,a,l,n,o,s))}saveState(){const e=[],t=this._cursors.getSelections();for(let i=0,n=t.length;i<n;i++){const n=t[i];e.push({inSelectionMode:!n.isEmpty(),selectionStart:{lineNumber:n.selectionStartLineNumber,column:n.selectionStartColumn},position:{lineNumber:n.positionLineNumber,column:n.positionColumn}})}return e}restoreState(e,t){const i=[];for(let n=0,o=t.length;n<o;n++){const e=t[n];let o=1,s=1;e.position&&e.position.lineNumber&&(o=e.position.lineNumber),e.position&&e.position.column&&(s=e.position.column);let r=o,a=s;e.selectionStart&&e.selectionStart.lineNumber&&(r=e.selectionStart.lineNumber),e.selectionStart&&e.selectionStart.column&&(a=e.selectionStart.column),i.push({selectionStartLineNumber:r,selectionStartColumn:a,positionLineNumber:o,positionColumn:s})}this.setStates(e,"restoreState",0,KE.fromModelSelections(i)),this.revealPrimary(e,"restoreState",!1,0,!0,1)}onModelContentChanged(e,t){if(t instanceof MM){if(this._isHandling)return;this._isHandling=!0;try{this.setStates(e,"modelChange",0,this.getCursorStates())}finally{this._isHandling=!1}}else{if(this._knownModelVersionId=t.versionId,this._isHandling)return;const i=t.containsEvent(1);if(this._prevEditOperationType=0,i)this._cursors.dispose(),this._cursors=new xM(this.context),this._validateAutoClosedActions(),this._emitStateChangedIfNecessary(e,"model",1,null,!1);else if(this._hasFocus&&t.resultingSelection&&t.resultingSelection.length>0){const i=KE.fromModelSelections(t.resultingSelection);this.setStates(e,"modelChange",t.isUndoing?5:t.isRedoing?6:2,i)&&this.revealPrimary(e,"modelChange",!1,0,!0,0)}else{const t=this._cursors.readSelectionFromMarkers();this.setStates(e,"modelChange",2,KE.fromModelSelections(t))}}}getSelection(){return this._cursors.getPrimaryCursor().modelState.selection}getTopMostViewPosition(){return this._cursors.getTopMostViewPosition()}getBottomMostViewPosition(){return this._cursors.getBottomMostViewPosition()}getCursorColumnSelectData(){if(this._columnSelectData)return this._columnSelectData;const e=this._cursors.getPrimaryCursor(),t=e.viewState.selectionStart.getStartPosition(),i=e.viewState.position;return{isReal:!1,fromViewLineNumber:t.lineNumber,fromViewVisualColumn:this.context.cursorConfig.visibleColumnFromColumn(this._viewModel,t),toViewLineNumber:i.lineNumber,toViewVisualColumn:this.context.cursorConfig.visibleColumnFromColumn(this._viewModel,i)}}getSelections(){return this._cursors.getSelections()}setSelections(e,t,i,n){this.setStates(e,t,n,KE.fromModelSelections(i))}getPrevEditOperationType(){return this._prevEditOperationType}setPrevEditOperationType(e){this._prevEditOperationType=e}_pushAutoClosedAction(e,t){const i=[],n=[];for(let r=0,a=e.length;r<a;r++)i.push({range:e[r],options:{description:"auto-closed-character",inlineClassName:"auto-closed-character",stickiness:1}}),n.push({range:t[r],options:{description:"auto-closed-enclosing",stickiness:1}});const o=this._model.deltaDecorations([],i),s=this._model.deltaDecorations([],n);this._autoClosedActions.push(new lA(this._model,o,s))}_executeEditOperation(e){if(!e)return;e.shouldPushStackElementBefore&&this._model.pushStackElement();const t=class{static executeCommands(e,t,i){const n={model:e,selectionsBefore:t,trackedRanges:[],trackedRangesDirection:[]},o=this._innerExecuteCommands(n,i);for(let s=0,r=n.trackedRanges.length;s<r;s++)n.model._setTrackedRange(n.trackedRanges[s],null,0);return o}static _innerExecuteCommands(e,t){if(this._arrayIsEmpty(t))return null;const i=this._getEditOperations(e,t);if(0===i.operations.length)return null;const n=i.operations,o=this._getLoserCursorMap(n);if(o.hasOwnProperty("0"))return null;const s=[];for(let l=0,d=n.length;l<d;l++)o.hasOwnProperty(n[l].identifier.major.toString())||s.push(n[l]);i.hadTrackedEditOperation&&s.length>0&&(s[0]._isTracked=!0);let r=e.model.pushEditOperations(e.selectionsBefore,s,(i=>{const n=[];for(let t=0;t<e.selectionsBefore.length;t++)n[t]=[];for(const e of i)e.identifier&&n[e.identifier.major].push(e);const o=(e,t)=>e.identifier.minor-t.identifier.minor,s=[];for(let r=0;r<e.selectionsBefore.length;r++)n[r].length>0?(n[r].sort(o),s[r]=t[r].computeCursorState(e.model,{getInverseEditOperations:()=>n[r],getTrackedSelection:t=>{const i=parseInt(t,10),n=e.model._getTrackedRange(e.trackedRanges[i]);return 0===e.trackedRangesDirection[i]?new ar(n.startLineNumber,n.startColumn,n.endLineNumber,n.endColumn):new ar(n.endLineNumber,n.endColumn,n.startLineNumber,n.startColumn)}})):s[r]=e.selectionsBefore[r];return s}));r||(r=e.selectionsBefore);const a=[];for(let l in o)o.hasOwnProperty(l)&&a.push(parseInt(l,10));a.sort(((e,t)=>t-e));for(const l of a)r.splice(l,1);return r}static _arrayIsEmpty(e){for(let t=0,i=e.length;t<i;t++)if(e[t])return!1;return!0}static _getEditOperations(e,t){let i=[],n=!1;for(let o=0,s=t.length;o<s;o++){const s=t[o];if(s){const t=this._getEditOperationsFromCommand(e,o,s);i=i.concat(t.operations),n=n||t.hadTrackedEditOperation}}return{operations:i,hadTrackedEditOperation:n}}static _getEditOperationsFromCommand(e,t,i){const n=[];let o=0;const s=(e,s,r=!1)=>{qo.isEmpty(e)&&""===s||n.push({identifier:{major:t,minor:o++},range:e,text:s,forceMoveMarkers:r,isAutoWhitespaceEdit:i.insertsAutoWhitespace})};let r=!1;const a=(e,t,i)=>{r=!0,s(e,t,i)},l=(t,i)=>{const n=ar.liftSelection(t);let o;if(n.isEmpty())if("boolean"==typeof i)o=i?2:3;else{const t=e.model.getLineMaxColumn(n.startLineNumber);o=n.startColumn===t?2:3}else o=1;const s=e.trackedRanges.length,r=e.model._setTrackedRange(null,n,o);return e.trackedRanges[s]=r,e.trackedRangesDirection[s]=n.getDirection(),s.toString()},d={addEditOperation:s,addTrackedEditOperation:a,trackSelection:l};try{i.getEditOperations(e.model,d)}catch(c){return Jo(c),{operations:[],hadTrackedEditOperation:!1}}return{operations:n,hadTrackedEditOperation:r}}static _getLoserCursorMap(e){(e=e.slice(0)).sort(((e,t)=>-qo.compareRangesUsingEnds(e.range,t.range)));const t={};for(let i=1;i<e.length;i++){const n=e[i-1],o=e[i];if(qo.getStartPosition(n.range).isBefore(qo.getEndPosition(o.range))){let s;s=n.identifier.major>o.identifier.major?n.identifier.major:o.identifier.major,t[s.toString()]=!0;for(let t=0;t<e.length;t++)e[t].identifier.major===s&&(e.splice(t,1),t<i&&i--,t--);i>0&&i--}}return t}}.executeCommands(this._model,this._cursors.getSelections(),e.commands);if(t){this._interpretCommandResult(t);const i=[],n=[];for(let t=0;t<e.commands.length;t++){const o=e.commands[t];o instanceof _I&&o.enclosingRange&&o.closeCharacterRange&&(i.push(o.closeCharacterRange),n.push(o.enclosingRange))}i.length>0&&this._pushAutoClosedAction(i,n),this._prevEditOperationType=e.type}e.shouldPushStackElementAfter&&this._model.pushStackElement()}_interpretCommandResult(e){e&&0!==e.length||(e=this._cursors.readSelectionFromMarkers()),this._columnSelectData=null,this._cursors.setSelections(e),this._cursors.normalize()}_emitStateChangedIfNecessary(e,t,i,n,o){const s=aA.from(this._model,this);if(s.equals(n))return!1;const r=this._cursors.getSelections(),a=this._cursors.getViewSelections();if(e.emitViewEvent(new FM(a,r)),!n||n.cursorState.length!==s.cursorState.length||s.cursorState.some(((e,t)=>!e.modelState.equals(n.cursorState[t].modelState)))){const a=n?n.cursorState.map((e=>e.modelState.selection)):null,l=n?n.modelVersionId:0;e.emitOutgoingEvent(new oA(a,r,l,s.modelVersionId,t||"keyboard",i,o))}return!0}_findAutoClosingPairs(e){if(!e.length)return null;const t=[];for(let i=0,n=e.length;i<n;i++){const n=e[i];if(!n.text||n.text.indexOf("\n")>=0)return null;const o=n.text.match(/([)\]}>'"`])([^)\]}>'"`]*)$/);if(!o)return null;const s=o[1],r=this.context.cursorConfig.autoClosingPairs.autoClosingPairsCloseSingleChar.get(s);if(!r||1!==r.length)return null;const a=r[0].open,l=n.text.length-o[2].length-1,d=n.text.lastIndexOf(a,l-1);if(-1===d)return null;t.push([d,l])}return t}executeEdits(e,t,i,n){let o=null;"snippet"===t&&(o=this._findAutoClosingPairs(i)),o&&(i[0]._isTracked=!0);const s=[],r=[],a=this._model.pushEditOperations(this.getSelections(),i,(e=>{if(o)for(let i=0,n=o.length;i<n;i++){const[t,n]=o[i],a=e[i],l=a.range.startLineNumber,d=a.range.startColumn-1+t,c=a.range.startColumn-1+n;s.push(new qo(l,c+1,l,c+2)),r.push(new qo(l,d+1,l,c+2))}const t=n(e);return t&&(this._isHandling=!0),t}));a&&(this._isHandling=!1,this.setSelections(e,t,a,0)),s.length>0&&this._pushAutoClosedAction(s,r)}_executeEdit(e,t,i,n=0){if(this.context.cursorConfig.readOnly)return;const o=aA.from(this._model,this);this._cursors.stopTrackingSelections(),this._isHandling=!0;try{this._cursors.ensureValidState(),e()}catch(s){Jo(s)}this._isHandling=!1,this._cursors.startTrackingSelections(),this._validateAutoClosedActions(),this._emitStateChangedIfNecessary(t,i,n,o,!1)&&this.revealPrimary(t,i,!1,0,!0,0)}setIsDoingComposition(e){this._isDoingComposition=e}getAutoClosedCharacters(){return lA.getAllAutoClosedCharacters(this._autoClosedActions)}startComposition(e){this._selectionsWhenCompositionStarted=this.getSelections().slice(0)}endComposition(e,t){this._executeEdit((()=>{"keyboard"===t&&(this._executeEditOperation(fI.compositionEndWithInterceptors(this._prevEditOperationType,this.context.cursorConfig,this._model,this._selectionsWhenCompositionStarted,this.getSelections(),this.getAutoClosedCharacters())),this._selectionsWhenCompositionStarted=null)}),e,t)}type(e,t,i){this._executeEdit((()=>{if("keyboard"===i){const e=t.length;let i=0;for(;i<e;){const e=ur(t,i),n=t.substr(i,e);this._executeEditOperation(fI.typeWithInterceptors(this._isDoingComposition,this._prevEditOperationType,this.context.cursorConfig,this._model,this.getSelections(),this.getAutoClosedCharacters(),n)),i+=e}}else this._executeEditOperation(fI.typeWithoutInterceptors(this._prevEditOperationType,this.context.cursorConfig,this._model,this.getSelections(),t))}),e,i)}compositionType(e,t,i,n,o,s){if(0!==t.length||0!==i||0!==n)this._executeEdit((()=>{this._executeEditOperation(fI.compositionType(this._prevEditOperationType,this.context.cursorConfig,this._model,this.getSelections(),t,i,n,o))}),e,s);else if(0!==o){const t=this.getSelections().map((e=>{const t=e.getPosition();return new ar(t.lineNumber,t.column+o,t.lineNumber,t.column+o)}));this.setSelections(e,s,t,0)}}paste(e,t,i,n,o){this._executeEdit((()=>{this._executeEditOperation(fI.paste(this.context.cursorConfig,this._model,this.getSelections(),t,i,n||[]))}),e,o,4)}cut(e,t){this._executeEdit((()=>{this._executeEditOperation(rI.cut(this.context.cursorConfig,this._model,this.getSelections()))}),e,t)}executeCommand(e,t,i){this._executeEdit((()=>{this._cursors.killSecondaryCursors(),this._executeEditOperation(new YE(0,[t],{shouldPushStackElementBefore:!1,shouldPushStackElementAfter:!1}))}),e,i)}executeCommands(e,t,i){this._executeEdit((()=>{this._executeEditOperation(new YE(0,t,{shouldPushStackElementBefore:!1,shouldPushStackElementAfter:!1}))}),e,i)}}rA.MAX_CURSOR_COUNT=1e4;class aA{constructor(e,t){this.modelVersionId=e,this.cursorState=t}static from(e,t){return new aA(e.getVersionId(),t.getCursorStates())}equals(e){if(!e)return!1;if(this.modelVersionId!==e.modelVersionId)return!1;if(this.cursorState.length!==e.cursorState.length)return!1;for(let t=0,i=this.cursorState.length;t<i;t++)if(!this.cursorState[t].equals(e.cursorState[t]))return!1;return!0}}class lA{constructor(e,t,i){this._model=e,this._autoClosedCharactersDecorations=t,this._autoClosedEnclosingDecorations=i}static getAllAutoClosedCharacters(e){let t=[];for(const i of e)t=t.concat(i.getAutoClosedCharactersRanges());return t}dispose(){this._autoClosedCharactersDecorations=this._model.deltaDecorations(this._autoClosedCharactersDecorations,[]),this._autoClosedEnclosingDecorations=this._model.deltaDecorations(this._autoClosedEnclosingDecorations,[])}getAutoClosedCharactersRanges(){const e=[];for(let t=0;t<this._autoClosedCharactersDecorations.length;t++){const i=this._model.getDecorationRange(this._autoClosedCharactersDecorations[t]);i&&e.push(i)}return e}isValid(e){const t=[];for(let i=0;i<this._autoClosedEnclosingDecorations.length;i++){const e=this._model.getDecorationRange(this._autoClosedEnclosingDecorations[i]);if(e&&(t.push(e),e.startLineNumber!==e.endLineNumber))return!1}t.sort(qo.compareRangesUsingStarts),e.sort(qo.compareRangesUsingStarts);for(let i=0;i<e.length;i++){if(i>=t.length)return!1;if(!t[i].strictContainsRange(e[i]))return!1}return!0}}class dA{constructor(e,t,i,n,o,s){this.id=e,this.label=t,this.alias=i,this._precondition=n,this._run=o,this._contextKeyService=s}isSupported(){return this._contextKeyService.contextMatchesRules(this._precondition)}run(){return this.isSupported()?this._run():Promise.resolve(void 0)}}const cA="base.contributions.configuration",hA={properties:{},patternProperties:{}},uA={properties:{},patternProperties:{}},gA={properties:{},patternProperties:{}},pA={properties:{},patternProperties:{}},mA={properties:{},patternProperties:{}},fA={properties:{},patternProperties:{}},_A="vscode://schemas/settings/resourceLanguage",vA=Yy.as(uS);const bA="\\[([^\\]]+)\\]",wA=new RegExp(bA,"g"),CA="^(\\[([^\\]]+)\\])+$",yA=new RegExp(CA);function xA(e){const t=[];if(yA.test(e)){let i=wA.exec(e);for(;null==i?void 0:i.length;){const n=i[1].trim();n&&t.push(n),i=wA.exec(e)}}return Qo(t)}const SA=new class{constructor(){this.overrideIdentifiers=new Set,this._onDidSchemaChange=new $o,this._onDidUpdateConfiguration=new $o,this.configurationDefaultsOverrides=new Map,this.defaultLanguageConfigurationOverridesNode={id:"defaultOverrides",title:mf(0,"Default Language Configuration Overrides"),properties:{}},this.configurationContributors=[this.defaultLanguageConfigurationOverridesNode],this.resourceLanguageSettingsSchema={properties:{},patternProperties:{},additionalProperties:!1,errorMessage:"Unknown editor configuration setting",allowTrailingCommas:!0,allowComments:!0},this.configurationProperties={},this.excludedConfigurationProperties={},vA.registerSchema(_A,this.resourceLanguageSettingsSchema),this.registerOverridePropertyPatternKey()}registerConfiguration(e,t=!0){this.registerConfigurations([e],t)}registerConfigurations(e,t=!0){const i=this.doRegisterConfigurations(e,t);vA.registerSchema(_A,this.resourceLanguageSettingsSchema),this._onDidSchemaChange.fire(),this._onDidUpdateConfiguration.fire({properties:i})}registerDefaultConfigurations(e){var t;const i=[],n=[];for(const{overrides:o,source:s}of e)for(const e in o)if(i.push(e),yA.test(e)){const i=Object.assign(Object.assign({},(null===(t=this.configurationDefaultsOverrides.get(e))||void 0===t?void 0:t.value)||{}),o[e]);this.configurationDefaultsOverrides.set(e,{source:s,value:i});const r={type:"object",default:i,description:mf(0,"Configure settings to be overridden for {0} language.",e),$ref:_A,defaultDefaultValue:i,source:Gs(s)?void 0:s};n.push(...xA(e)),this.configurationProperties[e]=r,this.defaultLanguageConfigurationOverridesNode.properties[e]=r}else{this.configurationDefaultsOverrides.set(e,{value:o[e],source:s});const t=this.configurationProperties[e];t&&(this.updatePropertyDefaultValue(e,t),this.updateSchema(e,t))}this.registerOverrideIdentifiers(n),this._onDidSchemaChange.fire(),this._onDidUpdateConfiguration.fire({properties:i,defaultsOverrides:!0})}registerOverrideIdentifiers(e){for(const t of e)this.overrideIdentifiers.add(t);this.updateOverridePropertyPatternKey()}doRegisterConfigurations(e,t){const i=[];return e.forEach((e=>{i.push(...this.validateAndRegisterProperties(e,t,e.extensionInfo,e.restrictedProperties)),this.configurationContributors.push(e),this.registerJSONConfiguration(e)})),i}validateAndRegisterProperties(e,t=!0,i,n,o=3){o=Tr(e.scope)?o:e.scope;let s=[],r=e.properties;if(r)for(let l in r){if(t&&kA(l)){delete r[l];continue}const e=r[l];e.source=i,e.defaultDefaultValue=r[l].default,this.updatePropertyDefaultValue(l,e),yA.test(l)?e.scope=void 0:(e.scope=Tr(e.scope)?o:e.scope,e.restricted=Tr(e.restricted)?!!(null==n?void 0:n.includes(l)):e.restricted),!r[l].hasOwnProperty("included")||r[l].included?(this.configurationProperties[l]=r[l],!r[l].deprecationMessage&&r[l].markdownDeprecationMessage&&(r[l].deprecationMessage=r[l].markdownDeprecationMessage),s.push(l)):(this.excludedConfigurationProperties[l]=r[l],delete r[l])}let a=e.allOf;if(a)for(let l of a)s.push(...this.validateAndRegisterProperties(l,t,i,n,o));return s}getConfigurationProperties(){return this.configurationProperties}registerJSONConfiguration(e){const t=e=>{let i=e.properties;if(i)for(const t in i)this.updateSchema(t,i[t]);let n=e.allOf;n&&n.forEach(t)};t(e)}updateSchema(e,t){switch(hA.properties[e]=t,t.scope){case 1:uA.properties[e]=t;break;case 2:gA.properties[e]=t;break;case 6:pA.properties[e]=t;break;case 3:mA.properties[e]=t;break;case 4:fA.properties[e]=t;break;case 5:fA.properties[e]=t,this.resourceLanguageSettingsSchema.properties[e]=t}}updateOverridePropertyPatternKey(){for(const e of this.overrideIdentifiers.values()){const t=`[${e}]`,i={type:"object",description:mf(0,"Configure editor settings to be overridden for a language."),errorMessage:mf(0,"This setting does not support per-language configuration."),$ref:_A};this.updatePropertyDefaultValue(t,i),hA.properties[t]=i,uA.properties[t]=i,gA.properties[t]=i,pA.properties[t]=i,mA.properties[t]=i,fA.properties[t]=i}this._onDidSchemaChange.fire()}registerOverridePropertyPatternKey(){const e={type:"object",description:mf(0,"Configure editor settings to be overridden for a language."),errorMessage:mf(0,"This setting does not support per-language configuration."),$ref:_A};hA.patternProperties[CA]=e,uA.patternProperties[CA]=e,gA.patternProperties[CA]=e,pA.patternProperties[CA]=e,mA.patternProperties[CA]=e,fA.patternProperties[CA]=e,this._onDidSchemaChange.fire()}updatePropertyDefaultValue(e,t){const i=this.configurationDefaultsOverrides.get(e);let n=null==i?void 0:i.value,o=null==i?void 0:i.source;fr(n)&&(n=t.defaultDefaultValue,o=void 0),fr(n)&&(n=function(e){switch(Array.isArray(e)?e[0]:e){case"boolean":return!1;case"integer":case"number":return 0;case"string":return"";case"array":return[];case"object":return{};default:return null}}(t.type)),t.default=n,t.defaultValueSource=o}};function kA(e){return e.trim()?yA.test(e)?mf(0,"Cannot register '{0}'. This matches property pattern '\\\\[.*\\\\]$' for describing language specific editor settings. Use 'configurationDefaults' contribution.",e):void 0!==SA.getConfigurationProperties()[e]?mf(0,"Cannot register '{0}'. This property is already registered.",e):null:mf(0,"Cannot register an empty property")}Yy.add(cA,SA);const DA=new class{constructor(){this._onDidChangeLanguages=new $o,this.onDidChangeLanguages=this._onDidChangeLanguages.event,this._languages=[]}registerLanguage(e){return this._languages.push(e),this._onDidChangeLanguages.fire(void 0),{dispose:()=>{for(let t=0,i=this._languages.length;t<i;t++)if(this._languages[t]===e)return void this._languages.splice(t,1)}}}getLanguages(){return this._languages}};Yy.add("editor.modesRegistry",DA);const LA="plaintext";DA.registerLanguage({id:LA,extensions:[".txt"],aliases:[mf(0,"Plain Text"),"text"],mimetypes:[LN.text]}),Wv.register(LA,{brackets:[["(",")"],["[","]"],["{","}"]],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:"<",close:">"},{open:'"',close:'"'},{open:"'",close:"'"},{open:"`",close:"`"}],colorizedBracketPairs:[],folding:{offSide:!0}},0),Yy.as(cA).registerDefaultConfigurations([{overrides:{"[plaintext]":{"editor.unicodeHighlight.ambiguousCharacters":!1,"editor.unicodeHighlight.invisibleCharacters":!1}}}]);var NA=globalThis&&globalThis.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{l(n.next(e))}catch(t){s(t)}}function a(e){try{l(n.throw(e))}catch(t){s(t)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}l((n=n.apply(e,t||[])).next())}))};const EA={getInitialState:()=>$v,tokenizeEncoded:(e,t,i)=>qv(0,i)};function IA(e,t,i,n,o,s,r){let a="<div>",l=n,d=0,c=!0;for(let h=0,u=t.getCount();h<u;h++){const u=t.getEndOffset(h);if(u<=n)continue;let g="";for(;l<u&&l<o;l++){const t=e.charCodeAt(l);switch(t){case 9:{let e=s-(l+d)%s;for(d+=e-1;e>0;)r&&c?(g+=" ",c=!1):(g+=" ",c=!0),e--;break}case 60:g+="<",c=!1;break;case 62:g+=">",c=!1;break;case 38:g+="&",c=!1;break;case 0:g+="�",c=!1;break;case 65279:case 8232:case 8233:case 133:g+="<EFBFBD>",c=!1;break;case 13:g+="​",c=!1;break;case 32:r&&c?(g+=" ",c=!1):(g+=" ",c=!0);break;default:g+=String.fromCharCode(t),c=!1}}if(a+=`<span style="${t.getInlineStyle(h,i)}">${g}</span>`,u>o||l>=o)break}return a+="</div>",a}function TA(e,t,i){let n='<div class="monaco-tokenized-source">';const o=Is(e);let s=i.getInitialState();for(let r=0,a=o.length;r<a;r++){const e=o[r];r>0&&(n+="<br/>");const a=i.tokenizeEncoded(e,!0,s);zb.convertToEndOffset(a.tokens,e.length);const l=new zb(a.tokens,e,t).inflate();let d=0;for(let t=0,i=l.getCount();t<i;t++){const i=l.getClassName(t),o=l.getEndOffset(t);n+=`<span class="${i}">${Mr(e.substring(d,o))}</span>`,d=o}s=a.endState}return n+="</div>",n}class MA{constructor(){this._hasPending=!1,this._inserts=[],this._changes=[],this._removes=[]}insert(e){this._hasPending=!0,this._inserts.push(e)}change(e){this._hasPending=!0,this._changes.push(e)}remove(e){this._hasPending=!0,this._removes.push(e)}mustCommit(){return this._hasPending}commit(e){if(!this._hasPending)return;const t=this._inserts,i=this._changes,n=this._removes;this._hasPending=!1,this._inserts=[],this._changes=[],this._removes=[],e._commitPendingChanges(t,i,n)}}class AA{constructor(e,t,i,n,o){this.id=e,this.afterLineNumber=t,this.ordinal=i,this.height=n,this.minWidth=o,this.prefixSum=0}}class OA{constructor(e,t,i,n){this._instanceId=Ar(++OA.INSTANCE_COUNT),this._pendingChanges=new MA,this._lastWhitespaceId=0,this._arr=[],this._prefixSumValidIndex=-1,this._minWidth=-1,this._lineCount=e,this._lineHeight=t,this._paddingTop=i,this._paddingBottom=n}static findInsertionIndex(e,t,i){let n=0,o=e.length;for(;n<o;){const s=n+o>>>1;t===e[s].afterLineNumber?i<e[s].ordinal?o=s:n=s+1:t<e[s].afterLineNumber?o=s:n=s+1}return n}setLineHeight(e){this._checkPendingChanges(),this._lineHeight=e}setPadding(e,t){this._paddingTop=e,this._paddingBottom=t}onFlushed(e){this._checkPendingChanges(),this._lineCount=e}changeWhitespace(e){let t=!1;try{e({insertWhitespace:(e,i,n,o)=>{t=!0,e|=0,i|=0,n|=0,o|=0;const s=this._instanceId+ ++this._lastWhitespaceId;return this._pendingChanges.insert(new AA(s,e,i,n,o)),s},changeOneWhitespace:(e,i,n)=>{t=!0,i|=0,n|=0,this._pendingChanges.change({id:e,newAfterLineNumber:i,newHeight:n})},removeWhitespace:e=>{t=!0,this._pendingChanges.remove({id:e})}})}finally{this._pendingChanges.commit(this)}return t}_commitPendingChanges(e,t,i){if((e.length>0||i.length>0)&&(this._minWidth=-1),e.length+t.length+i.length<=1){for(const t of e)this._insertWhitespace(t);for(const e of t)this._changeOneWhitespace(e.id,e.newAfterLineNumber,e.newHeight);for(const e of i){const t=this._findWhitespaceIndex(e.id);-1!==t&&this._removeWhitespace(t)}return}const n=new Set;for(const a of i)n.add(a.id);const o=new Map;for(const a of t)o.set(a.id,a);const s=e=>{const t=[];for(const i of e)if(!n.has(i.id)){if(o.has(i.id)){const e=o.get(i.id);i.afterLineNumber=e.newAfterLineNumber,i.height=e.newHeight}t.push(i)}return t},r=s(this._arr).concat(s(e));r.sort(((e,t)=>e.afterLineNumber===t.afterLineNumber?e.ordinal-t.ordinal:e.afterLineNumber-t.afterLineNumber)),this._arr=r,this._prefixSumValidIndex=-1}_checkPendingChanges(){this._pendingChanges.mustCommit()&&this._pendingChanges.commit(this)}_insertWhitespace(e){const t=OA.findInsertionIndex(this._arr,e.afterLineNumber,e.ordinal);this._arr.splice(t,0,e),this._prefixSumValidIndex=Math.min(this._prefixSumValidIndex,t-1)}_findWhitespaceIndex(e){const t=this._arr;for(let i=0,n=t.length;i<n;i++)if(t[i].id===e)return i;return-1}_changeOneWhitespace(e,t,i){const n=this._findWhitespaceIndex(e);if(-1!==n&&(this._arr[n].height!==i&&(this._arr[n].height=i,this._prefixSumValidIndex=Math.min(this._prefixSumValidIndex,n-1)),this._arr[n].afterLineNumber!==t)){const e=this._arr[n];this._removeWhitespace(n),e.afterLineNumber=t,this._insertWhitespace(e)}}_removeWhitespace(e){this._arr.splice(e,1),this._prefixSumValidIndex=Math.min(this._prefixSumValidIndex,e-1)}onLinesDeleted(e,t){this._checkPendingChanges(),e|=0,t|=0,this._lineCount-=t-e+1;for(let i=0,n=this._arr.length;i<n;i++){const n=this._arr[i].afterLineNumber;e<=n&&n<=t?this._arr[i].afterLineNumber=e-1:n>t&&(this._arr[i].afterLineNumber-=t-e+1)}}onLinesInserted(e,t){this._checkPendingChanges(),e|=0,t|=0,this._lineCount+=t-e+1;for(let i=0,n=this._arr.length;i<n;i++){e<=this._arr[i].afterLineNumber&&(this._arr[i].afterLineNumber+=t-e+1)}}getWhitespacesTotalHeight(){return this._checkPendingChanges(),0===this._arr.length?0:this.getWhitespacesAccumulatedHeight(this._arr.length-1)}getWhitespacesAccumulatedHeight(e){this._checkPendingChanges(),e|=0;let t=Math.max(0,this._prefixSumValidIndex+1);0===t&&(this._arr[0].prefixSum=this._arr[0].height,t++);for(let i=t;i<=e;i++)this._arr[i].prefixSum=this._arr[i-1].prefixSum+this._arr[i].height;return this._prefixSumValidIndex=Math.max(this._prefixSumValidIndex,e),this._arr[e].prefixSum}getLinesTotalHeight(){this._checkPendingChanges();return this._lineHeight*this._lineCount+this.getWhitespacesTotalHeight()+this._paddingTop+this._paddingBottom}getWhitespaceAccumulatedHeightBeforeLineNumber(e){this._checkPendingChanges(),e|=0;const t=this._findLastWhitespaceBeforeLineNumber(e);return-1===t?0:this.getWhitespacesAccumulatedHeight(t)}_findLastWhitespaceBeforeLineNumber(e){e|=0;const t=this._arr;let i=0,n=t.length-1;for(;i<=n;){const o=i+((n-i|0)/2|0)|0;if(t[o].afterLineNumber<e){if(o+1>=t.length||t[o+1].afterLineNumber>=e)return o;i=o+1|0}else n=o-1|0}return-1}_findFirstWhitespaceAfterLineNumber(e){e|=0;const t=this._findLastWhitespaceBeforeLineNumber(e)+1;return t<this._arr.length?t:-1}getFirstWhitespaceIndexAfterLineNumber(e){return this._checkPendingChanges(),e|=0,this._findFirstWhitespaceAfterLineNumber(e)}getVerticalOffsetForLineNumber(e){let t;this._checkPendingChanges(),t=(e|=0)>1?this._lineHeight*(e-1):0;return t+this.getWhitespaceAccumulatedHeightBeforeLineNumber(e)+this._paddingTop}getWhitespaceMinWidth(){if(this._checkPendingChanges(),-1===this._minWidth){let e=0;for(let t=0,i=this._arr.length;t<i;t++)e=Math.max(e,this._arr[t].minWidth);this._minWidth=e}return this._minWidth}isAfterLines(e){this._checkPendingChanges();return e>this.getLinesTotalHeight()}isInTopPadding(e){return 0!==this._paddingTop&&(this._checkPendingChanges(),e<this._paddingTop)}isInBottomPadding(e){if(0===this._paddingBottom)return!1;this._checkPendingChanges();return e>=this.getLinesTotalHeight()-this._paddingBottom}getLineNumberAtOrAfterVerticalOffset(e){if(this._checkPendingChanges(),(e|=0)<0)return 1;const t=0|this._lineCount,i=this._lineHeight;let n=1,o=t;for(;n<o;){const t=(n+o)/2|0,s=0|this.getVerticalOffsetForLineNumber(t);if(e>=s+i)n=t+1;else{if(e>=s)return t;o=t}}return n>t?t:n}getLinesViewportData(e,t){this._checkPendingChanges(),e|=0,t|=0;const i=this._lineHeight,n=0|this.getLineNumberAtOrAfterVerticalOffset(e),o=0|this.getVerticalOffsetForLineNumber(n);let s=0|this._lineCount,r=0|this.getFirstWhitespaceIndexAfterLineNumber(n);const a=0|this.getWhitespacesCount();let l,d;-1===r?(r=a,d=s+1,l=0):(d=0|this.getAfterLineNumberForWhitespaceIndex(r),l=0|this.getHeightForWhitespaceIndex(r));let c=o,h=c;const u=5e5;let g=0;o>=u&&(g=Math.floor(o/u)*u,g=Math.floor(g/i)*i,h-=g);const p=[],m=e+(t-e)/2;let f=-1;for(let w=n;w<=s;w++){if(-1===f){const e=c,t=c+i;(e<=m&&m<t||e>m)&&(f=w)}for(c+=i,p[w-n]=h,h+=i;d===w;)h+=l,c+=l,r++,r>=a?d=s+1:(d=0|this.getAfterLineNumberForWhitespaceIndex(r),l=0|this.getHeightForWhitespaceIndex(r));if(c>=t){s=w;break}}-1===f&&(f=s);const _=0|this.getVerticalOffsetForLineNumber(s);let v=n,b=s;return v<b&&o<e&&v++,v<b&&_+i>t&&b--,{bigNumbersDelta:g,startLineNumber:n,endLineNumber:s,relativeVerticalOffset:p,centeredLineNumber:f,completelyVisibleStartLineNumber:v,completelyVisibleEndLineNumber:b}}getVerticalOffsetForWhitespaceIndex(e){this._checkPendingChanges(),e|=0;const t=this.getAfterLineNumberForWhitespaceIndex(e);let i,n;return i=t>=1?this._lineHeight*t:0,n=e>0?this.getWhitespacesAccumulatedHeight(e-1):0,i+n+this._paddingTop}getWhitespaceIndexAtOrAfterVerticallOffset(e){this._checkPendingChanges(),e|=0;let t=0,i=this.getWhitespacesCount()-1;if(i<0)return-1;if(e>=this.getVerticalOffsetForWhitespaceIndex(i)+this.getHeightForWhitespaceIndex(i))return-1;for(;t<i;){const n=Math.floor((t+i)/2),o=this.getVerticalOffsetForWhitespaceIndex(n);if(e>=o+this.getHeightForWhitespaceIndex(n))t=n+1;else{if(e>=o)return n;i=n}}return t}getWhitespaceAtVerticalOffset(e){this._checkPendingChanges(),e|=0;const t=this.getWhitespaceIndexAtOrAfterVerticallOffset(e);if(t<0)return null;if(t>=this.getWhitespacesCount())return null;const i=this.getVerticalOffsetForWhitespaceIndex(t);if(i>e)return null;const n=this.getHeightForWhitespaceIndex(t);return{id:this.getIdForWhitespaceIndex(t),afterLineNumber:this.getAfterLineNumberForWhitespaceIndex(t),verticalOffset:i,height:n}}getWhitespaceViewportData(e,t){this._checkPendingChanges(),e|=0,t|=0;const i=this.getWhitespaceIndexAtOrAfterVerticallOffset(e),n=this.getWhitespacesCount()-1;if(i<0)return[];const o=[];for(let s=i;s<=n;s++){const e=this.getVerticalOffsetForWhitespaceIndex(s),i=this.getHeightForWhitespaceIndex(s);if(e>=t)break;o.push({id:this.getIdForWhitespaceIndex(s),afterLineNumber:this.getAfterLineNumberForWhitespaceIndex(s),verticalOffset:e,height:i})}return o}getWhitespaces(){return this._checkPendingChanges(),this._arr.slice(0)}getWhitespacesCount(){return this._checkPendingChanges(),this._arr.length}getIdForWhitespaceIndex(e){return this._checkPendingChanges(),e|=0,this._arr[e].id}getAfterLineNumberForWhitespaceIndex(e){return this._checkPendingChanges(),e|=0,this._arr[e].afterLineNumber}getHeightForWhitespaceIndex(e){return this._checkPendingChanges(),e|=0,this._arr[e].height}}OA.INSTANCE_COUNT=0;class RA{constructor(e,t,i,n){(e|=0)<0&&(e=0),(t|=0)<0&&(t=0),(i|=0)<0&&(i=0),(n|=0)<0&&(n=0),this.width=e,this.contentWidth=t,this.scrollWidth=Math.max(e,t),this.height=i,this.contentHeight=n,this.scrollHeight=Math.max(i,n)}equals(e){return this.width===e.width&&this.contentWidth===e.contentWidth&&this.height===e.height&&this.contentHeight===e.contentHeight}}class PA extends Uo{constructor(e,t){super(),this._onDidContentSizeChange=this._register(new $o),this.onDidContentSizeChange=this._onDidContentSizeChange.event,this._dimensions=new RA(0,0,0,0),this._scrollable=this._register(new aT({forceIntegerValues:!0,smoothScrollDuration:e,scheduleAtNextAnimationFrame:t})),this.onDidScroll=this._scrollable.onScroll}getScrollable(){return this._scrollable}setSmoothScrollDuration(e){this._scrollable.setSmoothScrollDuration(e)}validateScrollPosition(e){return this._scrollable.validateScrollPosition(e)}getScrollDimensions(){return this._dimensions}setScrollDimensions(e){if(this._dimensions.equals(e))return;const t=this._dimensions;this._dimensions=e,this._scrollable.setScrollDimensions({width:e.width,scrollWidth:e.scrollWidth,height:e.height,scrollHeight:e.scrollHeight},!0);const i=t.contentWidth!==e.contentWidth,n=t.contentHeight!==e.contentHeight;(i||n)&&this._onDidContentSizeChange.fire(new eA(t.contentWidth,t.contentHeight,e.contentWidth,e.contentHeight))}getFutureScrollPosition(){return this._scrollable.getFutureScrollPosition()}getCurrentScrollPosition(){return this._scrollable.getCurrentScrollPosition()}setScrollPositionNow(e){this._scrollable.setScrollPositionNow(e)}setScrollPositionSmooth(e){this._scrollable.setScrollPositionSmooth(e)}}class FA extends Uo{constructor(e,t,i){super(),this._configuration=e;const n=this._configuration.options,o=n.get(131),s=n.get(75);this._linesLayout=new OA(t,n.get(59),s.top,s.bottom),this._scrollable=this._register(new PA(0,i)),this._configureSmoothScrollDuration(),this._scrollable.setScrollDimensions(new RA(o.contentWidth,0,o.height,0)),this.onDidScroll=this._scrollable.onDidScroll,this.onDidContentSizeChange=this._scrollable.onDidContentSizeChange,this._updateHeight()}dispose(){super.dispose()}getScrollable(){return this._scrollable.getScrollable()}onHeightMaybeChanged(){this._updateHeight()}_configureSmoothScrollDuration(){this._scrollable.setSmoothScrollDuration(this._configuration.options.get(103)?125:0)}onConfigurationChanged(e){const t=this._configuration.options;if(e.hasChanged(59)&&this._linesLayout.setLineHeight(t.get(59)),e.hasChanged(75)){const e=t.get(75);this._linesLayout.setPadding(e.top,e.bottom)}if(e.hasChanged(131)){const e=t.get(131),i=e.contentWidth,n=e.height,o=this._scrollable.getScrollDimensions(),s=o.contentWidth;this._scrollable.setScrollDimensions(new RA(i,o.contentWidth,n,this._getContentHeight(i,n,s)))}else this._updateHeight();e.hasChanged(103)&&this._configureSmoothScrollDuration()}onFlushed(e){this._linesLayout.onFlushed(e)}onLinesDeleted(e,t){this._linesLayout.onLinesDeleted(e,t)}onLinesInserted(e,t){this._linesLayout.onLinesInserted(e,t)}_getHorizontalScrollbarHeight(e,t){const i=this._configuration.options.get(92);return 2===i.horizontal||e>=t?0:i.horizontalScrollbarSize}_getContentHeight(e,t,i){const n=this._configuration.options;let o=this._linesLayout.getLinesTotalHeight();return n.get(94)?o+=Math.max(0,t-n.get(59)-n.get(75).bottom):o+=this._getHorizontalScrollbarHeight(e,i),o}_updateHeight(){const e=this._scrollable.getScrollDimensions(),t=e.width,i=e.height,n=e.contentWidth;this._scrollable.setScrollDimensions(new RA(t,e.contentWidth,i,this._getContentHeight(t,i,n)))}getCurrentViewport(){const e=this._scrollable.getScrollDimensions(),t=this._scrollable.getCurrentScrollPosition();return new ow(t.scrollTop,t.scrollLeft,e.width,e.height)}getFutureViewport(){const e=this._scrollable.getScrollDimensions(),t=this._scrollable.getFutureScrollPosition();return new ow(t.scrollTop,t.scrollLeft,e.width,e.height)}_computeContentWidth(e){const t=this._configuration.options,i=t.get(132),n=t.get(44);if(i.isViewportWrapping){const i=t.get(131),o=t.get(65);return e>i.contentWidth+n.typicalHalfwidthCharacterWidth&&o.enabled&&"right"===o.side?e+i.verticalScrollbarWidth:e}{const i=t.get(93)*n.typicalHalfwidthCharacterWidth,o=this._linesLayout.getWhitespaceMinWidth();return Math.max(e+i,o)}}setMaxLineWidth(e){const t=this._scrollable.getScrollDimensions();this._scrollable.setScrollDimensions(new RA(t.width,this._computeContentWidth(e),t.height,t.contentHeight)),this._updateHeight()}saveState(){const e=this._scrollable.getFutureScrollPosition(),t=e.scrollTop,i=this._linesLayout.getLineNumberAtOrAfterVerticalOffset(t);return{scrollTop:t,scrollTopWithoutViewZones:t-this._linesLayout.getWhitespaceAccumulatedHeightBeforeLineNumber(i),scrollLeft:e.scrollLeft}}changeWhitespace(e){const t=this._linesLayout.changeWhitespace(e);return t&&this.onHeightMaybeChanged(),t}getVerticalOffsetForLineNumber(e){return this._linesLayout.getVerticalOffsetForLineNumber(e)}isAfterLines(e){return this._linesLayout.isAfterLines(e)}isInTopPadding(e){return this._linesLayout.isInTopPadding(e)}isInBottomPadding(e){return this._linesLayout.isInBottomPadding(e)}getLineNumberAtVerticalOffset(e){return this._linesLayout.getLineNumberAtOrAfterVerticalOffset(e)}getWhitespaceAtVerticalOffset(e){return this._linesLayout.getWhitespaceAtVerticalOffset(e)}getLinesViewportData(){const e=this.getCurrentViewport();return this._linesLayout.getLinesViewportData(e.top,e.top+e.height)}getLinesViewportDataAtScrollTop(e){const t=this._scrollable.getScrollDimensions();return e+t.height>t.scrollHeight&&(e=t.scrollHeight-t.height),e<0&&(e=0),this._linesLayout.getLinesViewportData(e,e+t.height)}getWhitespaceViewportData(){const e=this.getCurrentViewport();return this._linesLayout.getWhitespaceViewportData(e.top,e.top+e.height)}getWhitespaces(){return this._linesLayout.getWhitespaces()}getContentWidth(){return this._scrollable.getScrollDimensions().contentWidth}getScrollWidth(){return this._scrollable.getScrollDimensions().scrollWidth}getContentHeight(){return this._scrollable.getScrollDimensions().contentHeight}getScrollHeight(){return this._scrollable.getScrollDimensions().scrollHeight}getCurrentScrollLeft(){return this._scrollable.getCurrentScrollPosition().scrollLeft}getCurrentScrollTop(){return this._scrollable.getCurrentScrollPosition().scrollTop}validateScrollPosition(e){return this._scrollable.validateScrollPosition(e)}setScrollPosition(e,t){1===t?this._scrollable.setScrollPositionNow(e):this._scrollable.setScrollPositionSmooth(e)}deltaScrollNow(e,t){const i=this._scrollable.getCurrentScrollPosition();this._scrollable.setScrollPositionNow({scrollLeft:i.scrollLeft+e,scrollTop:i.scrollTop+t})}}class BA{constructor(e,t,i,n,o){this.editorId=e,this.model=t,this.configuration=i,this._linesCollection=n,this._coordinatesConverter=o,this._decorationsCache=Object.create(null),this._cachedModelDecorationsResolver=null,this._cachedModelDecorationsResolverViewRange=null}_clearCachedModelDecorationsResolver(){this._cachedModelDecorationsResolver=null,this._cachedModelDecorationsResolverViewRange=null}dispose(){this._decorationsCache=Object.create(null),this._clearCachedModelDecorationsResolver()}reset(){this._decorationsCache=Object.create(null),this._clearCachedModelDecorationsResolver()}onModelDecorationsChanged(){this._decorationsCache=Object.create(null),this._clearCachedModelDecorationsResolver()}onLineMappingChanged(){this._decorationsCache=Object.create(null),this._clearCachedModelDecorationsResolver()}_getOrCreateViewModelDecoration(e){const t=e.id;let i=this._decorationsCache[t];if(!i){const n=e.range,o=e.options;let s;if(o.isWholeLine){const e=this._coordinatesConverter.convertModelPositionToViewPosition(new er(n.startLineNumber,1),0),t=this._coordinatesConverter.convertModelPositionToViewPosition(new er(n.endLineNumber,this.model.getLineMaxColumn(n.endLineNumber)),1);s=new qo(e.lineNumber,e.column,t.lineNumber,t.column)}else s=this._coordinatesConverter.convertModelRangeToViewRange(n,1);i=new cw(s,o),this._decorationsCache[t]=i}return i}getDecorationsViewportData(e){let t=null!==this._cachedModelDecorationsResolver;return t=t&&e.equalsRange(this._cachedModelDecorationsResolverViewRange),t||(this._cachedModelDecorationsResolver=this._getDecorationsViewportData(e),this._cachedModelDecorationsResolverViewRange=e),this._cachedModelDecorationsResolver}_getDecorationsViewportData(e){const t=this._linesCollection.getDecorationsInRange(e,this.editorId,Ff(this.configuration.options)),i=e.startLineNumber,n=e.endLineNumber,o=[];let s=0;const r=[];for(let a=i;a<=n;a++)r[a-i]=[];for(let a=0,l=t.length;a<l;a++){const e=t[a],l=e.options;if(!VA(this.model,e))continue;const d=this._getOrCreateViewModelDecoration(e),c=d.range;if(o[s++]=d,l.inlineClassName){const e=new lw(c,l.inlineClassName,l.inlineClassNameAffectsLetterSpacing?3:0),t=Math.max(i,c.startLineNumber),o=Math.min(n,c.endLineNumber);for(let n=t;n<=o;n++)r[n-i].push(e)}if(l.beforeContentClassName&&i<=c.startLineNumber&&c.startLineNumber<=n){const e=new lw(new qo(c.startLineNumber,c.startColumn,c.startLineNumber,c.startColumn),l.beforeContentClassName,1);r[c.startLineNumber-i].push(e)}if(l.afterContentClassName&&i<=c.endLineNumber&&c.endLineNumber<=n){const e=new lw(new qo(c.endLineNumber,c.endColumn,c.endLineNumber,c.endColumn),l.afterContentClassName,2);r[c.endLineNumber-i].push(e)}}return{decorations:o,inlineDecorations:r}}}function VA(e,t){return(!t.options.hideInCommentTokens||!WA(e,t))&&(!t.options.hideInStringTokens||!zA(e,t))}function WA(e,t){return HA(e,t.range,(e=>1===e))}function zA(e,t){return HA(e,t.range,(e=>2===e))}function HA(e,t,i){for(let n=t.startLineNumber;n<=t.endLineNumber;n++){const o=e.getLineTokens(n),s=n===t.startLineNumber,r=n===t.endLineNumber;let a=s?o.findTokenIndexAtOffset(t.startColumn-1):0;for(;a<o.getCount();){if(r){if(o.getStartOffset(a)>t.endColumn-1)break}if(!i(o.getStandardTokenType(a)))return!1;a++}}return!0}class jA{constructor(e,t,i){this.range=e,this.nestingLevel=t,this.isInvalid=i}}class UA extends class{constructor(e,t,i,n){this.range=e,this.openingBracketRange=t,this.closingBracketRange=i,this.nestingLevel=n}}{constructor(e,t,i,n,o){super(e,t,i,n),this.minVisibleColumnIndentation=o}}class $A{constructor(e,t){this.lineCount=e,this.columnCount=t}toString(){return`${this.lineCount},${this.columnCount}`}}$A.zero=new $A(0,0);const KA=Math.pow(2,26);function qA(e,t){return e*KA+t}function GA(e){const t=e,i=Math.floor(t/KA);return new $A(i,t-i*KA)}function ZA(e,t){return t<KA?e+t:e-e%KA+t}function YA(e,t){return e<t}function XA(e,t){return e<=t}function QA(e,t){return e>=t}function JA(e){return qA(e.lineNumber-1,e.column-1)}function eO(e,t){const i=e,n=Math.floor(i/KA),o=i-n*KA,s=t,r=Math.floor(s/KA);return new qo(n+1,o+1,r+1,s-r*KA+1)}class tO{constructor(e,t,i){this.startOffset=e,this.endOffset=t,this.newLength=i}}class iO{constructor(e,t){this.documentLength=t,this.nextEditIdx=0,this.deltaOldToNewLineCount=0,this.deltaOldToNewColumnCount=0,this.deltaLineIdxInOld=-1,this.edits=e.map((e=>nO.from(e)))}getOffsetBeforeChange(e){return this.adjustNextEdit(e),this.translateCurToOld(e)}getDistanceToNextChange(e){this.adjustNextEdit(e);const t=this.edits[this.nextEditIdx];return function(e,t){const i=e,n=t;if(n-i<=0)return 0;const o=Math.floor(i/KA),s=Math.floor(n/KA),r=n-s*KA;if(o===s)return qA(0,r-(i-o*KA));return qA(s-o,r)}(e,t?this.translateOldToCur(t.offsetObj):this.documentLength)}translateOldToCur(e){return e.lineCount===this.deltaLineIdxInOld?qA(e.lineCount+this.deltaOldToNewLineCount,e.columnCount+this.deltaOldToNewColumnCount):qA(e.lineCount+this.deltaOldToNewLineCount,e.columnCount)}translateCurToOld(e){const t=GA(e);return t.lineCount-this.deltaOldToNewLineCount===this.deltaLineIdxInOld?qA(t.lineCount-this.deltaOldToNewLineCount,t.columnCount-this.deltaOldToNewColumnCount):qA(t.lineCount-this.deltaOldToNewLineCount,t.columnCount)}adjustNextEdit(e){for(;this.nextEditIdx<this.edits.length;){const t=this.edits[this.nextEditIdx],i=this.translateOldToCur(t.endOffsetAfterObj);if(!XA(i,e))break;{this.nextEditIdx++;const e=GA(i),n=GA(this.translateOldToCur(t.endOffsetBeforeObj)),o=e.lineCount-n.lineCount;this.deltaOldToNewLineCount+=o;const s=this.deltaLineIdxInOld===t.endOffsetBeforeObj.lineCount?this.deltaOldToNewColumnCount:0,r=e.columnCount-n.columnCount;this.deltaOldToNewColumnCount=s+r,this.deltaLineIdxInOld=t.endOffsetBeforeObj.lineCount}}}}class nO{constructor(e,t,i){this.endOffsetBeforeObj=GA(t),this.endOffsetAfterObj=GA(ZA(e,i)),this.offsetObj=GA(e)}static from(e){return new nO(e.startOffset,e.endOffset,e.newLength)}}const oO=new Array;class sO{constructor(e,t){this.items=e,this.additionalItems=t}static create(e,t){if(e<=128&&0===t.length){let i=sO.cache[e];return i||(i=new sO(e,t),sO.cache[e]=i),i}return new sO(e,t)}static getEmpty(){return this.empty}add(e,t){const i=t.getKey(e);let n=i>>5;if(0===n){const e=1<<i|this.items;return e===this.items?this:sO.create(e,this.additionalItems)}n--;const o=this.additionalItems.slice(0);for(;o.length<n;)o.push(0);return o[n]|=1<<(31&i),sO.create(this.items,o)}merge(e){const t=this.items|e.items;if(this.additionalItems===oO&&e.additionalItems===oO)return t===this.items?this:t===e.items?e:sO.create(t,oO);const i=new Array;for(let n=0;n<Math.max(this.additionalItems.length,e.additionalItems.length);n++){const t=this.additionalItems[n]||0,o=e.additionalItems[n]||0;i.push(t|o)}return sO.create(t,i)}intersects(e){if(0!=(this.items&e.items))return!0;for(let t=0;t<Math.min(this.additionalItems.length,e.additionalItems.length);t++)if(0!=(this.additionalItems[t]&e.additionalItems[t]))return!0;return!1}}sO.cache=new Array(129),sO.empty=sO.create(0,oO);const rO={getKey:e=>e};class aO{constructor(){this.items=new Map}getKey(e){let t=this.items.get(e);return void 0===t&&(t=this.items.size,this.items.set(e,t)),t}}class lO{constructor(e){this._length=e}get length(){return this._length}}class dO extends lO{constructor(e,t,i,n,o){super(e),this.openingBracket=t,this.child=i,this.closingBracket=n,this.missingOpeningBracketIds=o}static create(e,t,i){let n=e.length;return t&&(n=ZA(n,t.length)),i&&(n=ZA(n,i.length)),new dO(n,e,t,i,t?t.missingOpeningBracketIds:sO.getEmpty())}get kind(){return 2}get listHeight(){return 0}get childrenLength(){return 3}getChild(e){switch(e){case 0:return this.openingBracket;case 1:return this.child;case 2:return this.closingBracket}throw new Error("Invalid child index")}get children(){const e=new Array;return e.push(this.openingBracket),this.child&&e.push(this.child),this.closingBracket&&e.push(this.closingBracket),e}canBeReused(e){return null!==this.closingBracket&&!e.intersects(this.missingOpeningBracketIds)}deepClone(){return new dO(this.length,this.openingBracket.deepClone(),this.child&&this.child.deepClone(),this.closingBracket&&this.closingBracket.deepClone(),this.missingOpeningBracketIds)}computeMinIndentation(e,t){return this.child?this.child.computeMinIndentation(ZA(e,this.openingBracket.length),t):Number.MAX_SAFE_INTEGER}}class cO extends lO{constructor(e,t,i){super(e),this.listHeight=t,this._missingOpeningBracketIds=i,this.cachedMinIndentation=-1}static create23(e,t,i,n=!1){let o=e.length,s=e.missingOpeningBracketIds;if(e.listHeight!==t.listHeight)throw new Error("Invalid list heights");if(o=ZA(o,t.length),s=s.merge(t.missingOpeningBracketIds),i){if(e.listHeight!==i.listHeight)throw new Error("Invalid list heights");o=ZA(o,i.length),s=s.merge(i.missingOpeningBracketIds)}return n?new uO(o,e.listHeight+1,e,t,i,s):new hO(o,e.listHeight+1,e,t,i,s)}static getEmpty(){return new pO(0,0,[],sO.getEmpty())}get kind(){return 4}get missingOpeningBracketIds(){return this._missingOpeningBracketIds}throwIfImmutable(){}makeLastElementMutable(){this.throwIfImmutable();const e=this.childrenLength;if(0===e)return;const t=this.getChild(e-1),i=4===t.kind?t.toMutable():t;return t!==i&&this.setChild(e-1,i),i}makeFirstElementMutable(){this.throwIfImmutable();if(0===this.childrenLength)return;const e=this.getChild(0),t=4===e.kind?e.toMutable():e;return e!==t&&this.setChild(0,t),t}canBeReused(e){if(e.intersects(this.missingOpeningBracketIds))return!1;let t,i=this;for(;4===i.kind&&(t=i.childrenLength)>0;)i=i.getChild(t-1);return i.canBeReused(e)}handleChildrenChanged(){this.throwIfImmutable();const e=this.childrenLength;let t=this.getChild(0).length,i=this.getChild(0).missingOpeningBracketIds;for(let n=1;n<e;n++){const e=this.getChild(n);t=ZA(t,e.length),i=i.merge(e.missingOpeningBracketIds)}this._length=t,this._missingOpeningBracketIds=i,this.cachedMinIndentation=-1}computeMinIndentation(e,t){if(-1!==this.cachedMinIndentation)return this.cachedMinIndentation;let i=Number.MAX_SAFE_INTEGER,n=e;for(let o=0;o<this.childrenLength;o++){const e=this.getChild(o);e&&(i=Math.min(i,e.computeMinIndentation(n,t)),n=ZA(n,e.length))}return this.cachedMinIndentation=i,i}}class hO extends cO{constructor(e,t,i,n,o,s){super(e,t,s),this._item1=i,this._item2=n,this._item3=o}get childrenLength(){return null!==this._item3?3:2}getChild(e){switch(e){case 0:return this._item1;case 1:return this._item2;case 2:return this._item3}throw new Error("Invalid child index")}setChild(e,t){switch(e){case 0:return void(this._item1=t);case 1:return void(this._item2=t);case 2:return void(this._item3=t)}throw new Error("Invalid child index")}get children(){return this._item3?[this._item1,this._item2,this._item3]:[this._item1,this._item2]}get item1(){return this._item1}get item2(){return this._item2}get item3(){return this._item3}deepClone(){return new hO(this.length,this.listHeight,this._item1.deepClone(),this._item2.deepClone(),this._item3?this._item3.deepClone():null,this.missingOpeningBracketIds)}appendChildOfSameHeight(e){if(this._item3)throw new Error("Cannot append to a full (2,3) tree node");this.throwIfImmutable(),this._item3=e,this.handleChildrenChanged()}unappendChild(){if(!this._item3)throw new Error("Cannot remove from a non-full (2,3) tree node");this.throwIfImmutable();const e=this._item3;return this._item3=null,this.handleChildrenChanged(),e}prependChildOfSameHeight(e){if(this._item3)throw new Error("Cannot prepend to a full (2,3) tree node");this.throwIfImmutable(),this._item3=this._item2,this._item2=this._item1,this._item1=e,this.handleChildrenChanged()}unprependChild(){if(!this._item3)throw new Error("Cannot remove from a non-full (2,3) tree node");this.throwIfImmutable();const e=this._item1;return this._item1=this._item2,this._item2=this._item3,this._item3=null,this.handleChildrenChanged(),e}toMutable(){return this}}class uO extends hO{toMutable(){return new hO(this.length,this.listHeight,this.item1,this.item2,this.item3,this.missingOpeningBracketIds)}throwIfImmutable(){throw new Error("this instance is immutable")}}class gO extends cO{constructor(e,t,i,n){super(e,t,n),this._children=i}get childrenLength(){return this._children.length}getChild(e){return this._children[e]}setChild(e,t){this._children[e]=t}get children(){return this._children}deepClone(){const e=new Array(this._children.length);for(let t=0;t<this._children.length;t++)e[t]=this._children[t].deepClone();return new gO(this.length,this.listHeight,e,this.missingOpeningBracketIds)}appendChildOfSameHeight(e){this.throwIfImmutable(),this._children.push(e),this.handleChildrenChanged()}unappendChild(){this.throwIfImmutable();const e=this._children.pop();return this.handleChildrenChanged(),e}prependChildOfSameHeight(e){this.throwIfImmutable(),this._children.unshift(e),this.handleChildrenChanged()}unprependChild(){this.throwIfImmutable();const e=this._children.shift();return this.handleChildrenChanged(),e}toMutable(){return this}}class pO extends gO{toMutable(){return new gO(this.length,this.listHeight,[...this.children],this.missingOpeningBracketIds)}throwIfImmutable(){throw new Error("this instance is immutable")}}const mO=[];class fO extends lO{get listHeight(){return 0}get childrenLength(){return 0}getChild(e){return null}get children(){return mO}deepClone(){return this}}class _O extends fO{get kind(){return 0}get missingOpeningBracketIds(){return sO.getEmpty()}canBeReused(e){return!0}computeMinIndentation(e,t){const i=GA(e),n=(0===i.columnCount?i.lineCount:i.lineCount+1)+1,o=(s=ZA(e,this.length),Math.floor(s/KA)+1);var s;let r=Number.MAX_SAFE_INTEGER;for(let a=n;a<=o;a++){const e=t.getLineFirstNonWhitespaceColumn(a),i=t.getLineContent(a);if(0===e)continue;const n=dN.visibleColumnFromColumn(i,e,t.getOptions().tabSize);r=Math.min(r,n)}return r}}class vO extends fO{constructor(e,t,i){super(e),this.languageId=t,this.bracketIds=i}static create(e,t,i){return new vO(e,t,i)}get kind(){return 1}get missingOpeningBracketIds(){return sO.getEmpty()}canBeReused(e){return!1}computeMinIndentation(e,t){return Number.MAX_SAFE_INTEGER}}class bO extends fO{constructor(e,t){super(t),this.missingOpeningBracketIds=e}get kind(){return 3}canBeReused(e){return!e.intersects(this.missingOpeningBracketIds)}computeMinIndentation(e,t){return Number.MAX_SAFE_INTEGER}}class wO{constructor(e,t,i,n,o){this.length=e,this.kind=t,this.bracketId=i,this.bracketIds=n,this.astNode=o}}class CO{constructor(e,t){this.textModel=e,this.bracketTokens=t,this.reader=new yO(this.textModel,this.bracketTokens),this._offset=0,this.didPeek=!1,this.peeked=null,this.textBufferLineCount=e.getLineCount(),this.textBufferLastLineLength=e.getLineLength(this.textBufferLineCount)}get offset(){return this._offset}get length(){return qA(this.textBufferLineCount,this.textBufferLastLineLength)}skip(e){this.didPeek=!1,this._offset=ZA(this._offset,e);const t=GA(this._offset);this.reader.setPosition(t.lineCount,t.columnCount)}read(){let e;return this.peeked?(this.didPeek=!1,e=this.peeked):e=this.reader.read(),e&&(this._offset=ZA(this._offset,e.length)),e}peek(){return this.didPeek||(this.peeked=this.reader.read(),this.didPeek=!0),this.peeked}}class yO{constructor(e,t){this.textModel=e,this.bracketTokens=t,this.lineIdx=0,this.line=null,this.lineCharOffset=0,this.lineTokens=null,this.lineTokenOffset=0,this.peekedToken=null,this.textBufferLineCount=e.getLineCount(),this.textBufferLastLineLength=e.getLineLength(this.textBufferLineCount)}setPosition(e,t){e===this.lineIdx?(this.lineCharOffset=t,this.lineTokenOffset=0===this.lineCharOffset?0:this.lineTokens.findTokenIndexAtOffset(this.lineCharOffset)):(this.lineIdx=e,this.lineCharOffset=t,this.line=null),this.peekedToken=null}read(){if(this.peekedToken){const e=this.peekedToken;return this.peekedToken=null,this.lineCharOffset+=e.length,e}if(this.lineIdx>this.textBufferLineCount-1||this.lineIdx===this.textBufferLineCount-1&&this.lineCharOffset>=this.textBufferLastLineLength)return null;null===this.line&&(this.lineTokens=this.textModel.getLineTokens(this.lineIdx+1),this.line=this.lineTokens.getLineContent(),this.lineTokenOffset=0===this.lineCharOffset?0:this.lineTokens.findTokenIndexAtOffset(this.lineCharOffset));const e=this.lineIdx,t=this.lineCharOffset;let i=0;for(;;){const n=this.lineTokens,o=n.getCount();let s=null;if(this.lineTokenOffset<o){const r=n.getMetadata(this.lineTokenOffset);for(;this.lineTokenOffset+1<o&&r===n.getMetadata(this.lineTokenOffset+1);)this.lineTokenOffset++;const a=0===ys.getTokenType(r),l=n.getEndOffset(this.lineTokenOffset);if(a&&l!==this.lineCharOffset){const e=n.getLanguageId(this.lineTokenOffset),t=this.line.substring(this.lineCharOffset,l),i=this.bracketTokens.getSingleLanguageBracketTokens(e),o=i.regExpGlobal;if(o){o.lastIndex=0;const e=o.exec(t);e&&(s=i.getToken(e[0]),s&&(this.lineCharOffset+=e.index))}}if(i+=l-this.lineCharOffset,s){if(e!==this.lineIdx||t!==this.lineCharOffset){this.peekedToken=s;break}return this.lineCharOffset+=s.length,s}this.lineTokenOffset++,this.lineCharOffset=l}else{if(this.lineIdx===this.textBufferLineCount-1)break;if(this.lineIdx++,this.lineTokens=this.textModel.getLineTokens(this.lineIdx+1),this.lineTokenOffset=0,this.line=this.lineTokens.getLineContent(),this.lineCharOffset=0,i+=33,i>1e3)break}if(i>1500)break}const n=(o=e,s=t,r=this.lineIdx,a=this.lineCharOffset,o!==r?qA(r-o,a):qA(0,a-s));var o,s,r,a;return new wO(n,0,-1,sO.getEmpty(),new _O(n))}}class xO{constructor(e,t){this.text=e,this._offset=0,this.idx=0;const i=t.getRegExpStr()?new RegExp(t.getRegExpStr()+"|\n","g"):null,n=[];let o,s=0,r=0,a=0,l=0;const d=new Array;for(let u=0;u<60;u++)d.push(new wO(qA(0,u),0,-1,sO.getEmpty(),new _O(qA(0,u))));const c=new Array;for(let u=0;u<60;u++)c.push(new wO(qA(1,u),0,-1,sO.getEmpty(),new _O(qA(1,u))));if(i)for(i.lastIndex=0;null!==(o=i.exec(e));){const e=o.index,i=o[0];if("\n"===i)s++,r=e+1;else{if(a!==e){let t;if(l===s){const i=e-a;if(i<d.length)t=d[i];else{const e=qA(0,i);t=new wO(e,0,-1,sO.getEmpty(),new _O(e))}}else{const i=s-l,n=e-r;if(1===i&&n<c.length)t=c[n];else{const e=qA(i,n);t=new wO(e,0,-1,sO.getEmpty(),new _O(e))}}n.push(t)}n.push(t.getToken(i)),a=e+i.length,l=s}}const h=e.length;if(a!==h){const e=l===s?qA(0,h-a):qA(s-l,h-r);n.push(new wO(e,0,-1,sO.getEmpty(),new _O(e)))}this.length=qA(s,h-r),this.tokens=n}get offset(){return this._offset}read(){return this.tokens[this.idx++]||null}peek(){return this.tokens[this.idx]||null}skip(e){throw new Or}}class SO{constructor(e){this.map=e,this.hasRegExp=!1,this._regExpGlobal=null}static createFromLanguage(e,t){function i(e,i){return t.getKey(`${e}:::${i}`)}const n=e.characterPair.getColorizedBrackets(),o=new Map,s=new Set;for(const[a,l]of n){s.add(a);let t=o.get(l);const n=i(e.languageId,a);t||(t={openingBrackets:sO.getEmpty(),first:n},o.set(l,t)),t.openingBrackets=t.openingBrackets.add(n,rO)}const r=new Map;for(const[a,l]of o){const t=qA(0,a.length);r.set(a,new wO(t,2,l.first,l.openingBrackets,vO.create(t,e.languageId,l.openingBrackets)))}for(const a of s){const t=qA(0,a.length),n=i(e.languageId,a),o=sO.getEmpty().add(n,rO);r.set(a,new wO(t,1,n,o,vO.create(t,e.languageId,o)))}return new SO(r)}getRegExpStr(){if(this.isEmpty)return null;{const e=[...this.map.keys()];return e.sort(),e.reverse(),e.map((e=>function(e){const t=Xo(e);return/^[\w ]+$/.test(e)?`\\b${t}\\b`:t}(e))).join("|")}}get regExpGlobal(){if(!this.hasRegExp){const e=this.getRegExpStr();this._regExpGlobal=e?new RegExp(e,"g"):null,this.hasRegExp=!0}return this._regExpGlobal}getToken(e){return this.map.get(e)}findClosingTokenText(e){for(const[t,i]of this.map)if(i.bracketIds.intersects(e))return t}get isEmpty(){return 0===this.map.size}}class kO{constructor(e,t){this.denseKeyProvider=e,this.getLanguageConfiguration=t,this.languageIdToBracketTokens=new Map}didLanguageChange(e){const t=this.languageIdToBracketTokens.get(e);if(!t)return!1;const i=SO.createFromLanguage(this.getLanguageConfiguration(e),this.denseKeyProvider).getRegExpStr();return t.getRegExpStr()!==i}getSingleLanguageBracketTokens(e){let t=this.languageIdToBracketTokens.get(e);return t||(t=SO.createFromLanguage(this.getLanguageConfiguration(e),this.denseKeyProvider),this.languageIdToBracketTokens.set(e,t)),t}}function DO(e,t=!1){if(0===e.length)return null;if(1===e.length)return e[0];let i=e.length;for(;i>3;){const n=i>>1;for(let o=0;o<n;o++){const n=o<<1;e[o]=cO.create23(e[n],e[n+1],n+3===i?e[n+2]:null,t)}i=n}return cO.create23(e[0],e[1],i>=3?e[2]:null,t)}function LO(e,t){return Math.abs(e.listHeight-t.listHeight)}function NO(e,t){return e.listHeight===t.listHeight?cO.create23(e,t,null,!1):e.listHeight>t.listHeight?function(e,t){let i=e=e.toMutable();const n=new Array;let o;for(;;){if(t.listHeight===i.listHeight){o=t;break}if(4!==i.kind)throw new Error("unexpected");n.push(i),i=i.makeLastElementMutable()}for(let s=n.length-1;s>=0;s--){const e=n[s];o?e.childrenLength>=3?o=cO.create23(e.unappendChild(),o,null,!1):(e.appendChildOfSameHeight(o),o=void 0):e.handleChildrenChanged()}return o?cO.create23(e,o,null,!1):e}(e,t):function(e,t){let i=e=e.toMutable();const n=new Array;for(;t.listHeight!==i.listHeight;){if(4!==i.kind)throw new Error("unexpected");n.push(i),i=i.makeFirstElementMutable()}let o=t;for(let s=n.length-1;s>=0;s--){const e=n[s];o?e.childrenLength>=3?o=cO.create23(o,e.unprependChild(),null,!1):(e.prependChildOfSameHeight(o),o=void 0):e.handleChildrenChanged()}return o?cO.create23(o,e,null,!1):e}(t,e)}class EO{constructor(e){this.lastOffset=0,this.nextNodes=[e],this.offsets=[0],this.idxs=[]}readLongestNodeAt(e,t){if(YA(e,this.lastOffset))throw new Error("Invalid offset");for(this.lastOffset=e;;){const i=TO(this.nextNodes);if(!i)return;const n=TO(this.offsets);if(YA(e,n))return;if(YA(n,e))if(ZA(n,i.length)<=e)this.nextNodeAfterCurrent();else{const e=IO(i);-1!==e?(this.nextNodes.push(i.getChild(e)),this.offsets.push(n),this.idxs.push(e)):this.nextNodeAfterCurrent()}else{if(t(i))return this.nextNodeAfterCurrent(),i;{const e=IO(i);if(-1===e)return void this.nextNodeAfterCurrent();this.nextNodes.push(i.getChild(e)),this.offsets.push(n),this.idxs.push(e)}}}}nextNodeAfterCurrent(){for(;;){const e=TO(this.offsets),t=TO(this.nextNodes);if(this.nextNodes.pop(),this.offsets.pop(),0===this.idxs.length)break;const i=TO(this.nextNodes),n=IO(i,this.idxs[this.idxs.length-1]);if(-1!==n){this.nextNodes.push(i.getChild(n)),this.offsets.push(ZA(e,t.length)),this.idxs[this.idxs.length-1]=n;break}this.idxs.pop()}}}function IO(e,t=-1){for(;;){if(++t>=e.childrenLength)return-1;if(e.getChild(t))return t}}function TO(e){return e.length>0?e[e.length-1]:void 0}function MO(e,t,i,n){return new AO(e,t,i,n).parseDocument()}class AO{constructor(e,t,i,n){if(this.tokenizer=e,this.createImmutableLists=n,this._itemsConstructed=0,this._itemsFromCache=0,i&&n)throw new Error("Not supported");this.oldNodeReader=i?new EO(i):void 0,this.positionMapper=new iO(t,e.length)}parseDocument(){this._itemsConstructed=0,this._itemsFromCache=0;let e=this.parseList(sO.getEmpty());return e||(e=cO.getEmpty()),e}parseList(e){const t=new Array;for(;;){const i=this.tokenizer.peek();if(!i||2===i.kind&&i.bracketIds.intersects(e))break;const n=this.parseChild(e);4===n.kind&&0===n.childrenLength||t.push(n)}const i=this.oldNodeReader?function(e){if(0===e.length)return null;if(1===e.length)return e[0];let t=0;function i(){if(t>=e.length)return null;const i=t,n=e[i].listHeight;for(t++;t<e.length&&e[t].listHeight===n;)t++;return t-i>=2?DO(0===i&&t===e.length?e:e.slice(i,t),!1):e[i]}let n=i(),o=i();if(!o)return n;for(let s=i();s;s=i())LO(n,o)<=LO(o,s)?(n=NO(n,o),o=s):o=NO(o,s);return NO(n,o)}(t):DO(t,this.createImmutableLists);return i}parseChild(e){if(this.oldNodeReader){const t=this.positionMapper.getDistanceToNextChange(this.tokenizer.offset);if(0!==t){const i=this.oldNodeReader.readLongestNodeAt(this.positionMapper.getOffsetBeforeChange(this.tokenizer.offset),(i=>{if(!YA(i.length,t))return!1;return i.canBeReused(e)}));if(i)return this._itemsFromCache++,this.tokenizer.skip(i.length),i}}this._itemsConstructed++;const t=this.tokenizer.read();switch(t.kind){case 2:return new bO(t.bracketIds,t.length);case 0:return t.astNode;case 1:{const i=e.merge(t.bracketIds),n=this.parseList(i),o=this.tokenizer.peek();return o&&2===o.kind&&(o.bracketId===t.bracketId||o.bracketIds.intersects(t.bracketIds))?(this.tokenizer.read(),dO.create(t.astNode,n,o.astNode)):dO.create(t.astNode,n,null)}default:throw new Error("unexpected")}}}class OO extends Uo{constructor(e,t){if(super(),this.textModel=e,this.getLanguageConfiguration=t,this.didChangeEmitter=new $o,this.denseKeyProvider=new aO,this.brackets=new kO(this.denseKeyProvider,this.getLanguageConfiguration),this.onDidChange=this.didChangeEmitter.event,0===e.backgroundTokenizationState){const e=this.brackets.getSingleLanguageBracketTokens(this.textModel.getLanguageId()),t=new xO(this.textModel.getValue(),e);this.initialAstWithoutTokens=MO(t,[],void 0,!0),this.astWithTokens=this.initialAstWithoutTokens}else 2===e.backgroundTokenizationState?(this.initialAstWithoutTokens=void 0,this.astWithTokens=this.parseDocumentFromTextBuffer([],void 0,!1)):1===e.backgroundTokenizationState&&(this.initialAstWithoutTokens=this.parseDocumentFromTextBuffer([],void 0,!0),this.astWithTokens=this.initialAstWithoutTokens)}didLanguageChange(e){return this.brackets.didLanguageChange(e)}handleDidChangeBackgroundTokenizationState(){if(2===this.textModel.backgroundTokenizationState){const e=void 0===this.initialAstWithoutTokens;this.initialAstWithoutTokens=void 0,e||this.didChangeEmitter.fire()}}handleDidChangeTokens({ranges:e}){const t=e.map((e=>new tO(qA(e.fromLineNumber-1,0),qA(e.toLineNumber,0),qA(e.toLineNumber-e.fromLineNumber+1,0))));this.astWithTokens=this.parseDocumentFromTextBuffer(t,this.astWithTokens,!1),this.initialAstWithoutTokens||this.didChangeEmitter.fire()}handleContentChanged(e){const t=e.changes.map((e=>{const t=qo.lift(e.range);return new tO(JA(t.getStartPosition()),JA(t.getEndPosition()),function(e){const t=Is(e);return qA(t.length-1,t[t.length-1].length)}(e.text))})).reverse();this.astWithTokens=this.parseDocumentFromTextBuffer(t,this.astWithTokens,!1),this.initialAstWithoutTokens&&(this.initialAstWithoutTokens=this.parseDocumentFromTextBuffer(t,this.initialAstWithoutTokens,!1))}parseDocumentFromTextBuffer(e,t,i){const n=t;return MO(new CO(this.textModel,this.brackets),e,n,i)}getBracketsInRange(e){const t=qA(e.startLineNumber-1,e.startColumn-1),i=qA(e.endLineNumber-1,e.endColumn-1),n=new Array,o=this.initialAstWithoutTokens||this.astWithTokens;return RO(o,0,o.length,t,i,n),n}getBracketPairsInRange(e,t){const i=new Array,n=JA(e.getStartPosition()),o=JA(e.getEndPosition()),s=this.initialAstWithoutTokens||this.astWithTokens,r=new PO(i,t,this.textModel);return FO(s,0,s.length,n,o,r),i}}function RO(e,t,i,n,o,s,r=0){if(4===e.kind)for(const a of e.children)i=ZA(t,a.length),XA(t,o)&&QA(i,n)&&RO(a,t,i,n,o,s,r),t=i;else if(2===e.kind){r++;if(i=ZA(t,e.openingBracket.length),XA(t,o)&&QA(i,n)){const n=eO(t,i);s.push(new jA(n,r-1,!e.closingBracket))}t=i;if(e.child){const a=e.child;i=ZA(t,a.length),XA(t,o)&&QA(i,n)&&RO(a,t,i,n,o,s,r),t=i}if(e.closingBracket){if(i=ZA(t,e.closingBracket.length),XA(t,o)&&QA(i,n)){const e=eO(t,i);s.push(new jA(e,r-1,!1))}t=i}}else if(3===e.kind){const e=eO(t,i);s.push(new jA(e,r-1,!0))}else if(1===e.kind){const e=eO(t,i);s.push(new jA(e,r-1,!1))}}class PO{constructor(e,t,i){this.result=e,this.includeMinIndentation=t,this.textModel=i}}function FO(e,t,i,n,o,s,r=0){var a;if(2===e.kind){const n=ZA(t,e.openingBracket.length);let o=-1;s.includeMinIndentation&&(o=e.computeMinIndentation(t,s.textModel)),s.result.push(new UA(eO(t,i),eO(t,n),e.closingBracket?eO(ZA(n,(null===(a=e.child)||void 0===a?void 0:a.length)||0),i):void 0,r,o)),r++}let l=t;for(const d of e.children){const e=l;l=ZA(l,d.length),XA(e,o)&&XA(n,l)&&FO(d,e,l,n,o,s,r)}}class BO extends Uo{constructor(e,t){super(),this.textModel=e,this.languageConfigurationService=t,this.bracketPairsTree=this._register(new Rr),this.onDidChangeEmitter=new $o,this.onDidChange=this.onDidChangeEmitter.event,this.bracketsRequested=!1,this._register(this.languageConfigurationService.onDidChange((e=>{var t;e.languageId&&!(null===(t=this.bracketPairsTree.value)||void 0===t?void 0:t.object.didLanguageChange(e.languageId))||(this.bracketPairsTree.clear(),this.updateBracketPairsTree())})))}get isDocumentSupported(){return this.textModel.getValueLength()<=5e6}handleDidChangeOptions(e){this.bracketPairsTree.clear(),this.updateBracketPairsTree()}handleDidChangeLanguage(e){this.bracketPairsTree.clear(),this.updateBracketPairsTree()}handleDidChangeContent(e){var t;null===(t=this.bracketPairsTree.value)||void 0===t||t.object.handleContentChanged(e)}handleDidChangeBackgroundTokenizationState(){var e;null===(e=this.bracketPairsTree.value)||void 0===e||e.object.handleDidChangeBackgroundTokenizationState()}handleDidChangeTokens(e){var t;null===(t=this.bracketPairsTree.value)||void 0===t||t.object.handleDidChangeTokens(e)}updateBracketPairsTree(){if(this.bracketsRequested&&this.isDocumentSupported){if(!this.bracketPairsTree.value){const i=new ws;this.bracketPairsTree.value=(e=i.add(new OO(this.textModel,(e=>this.languageConfigurationService.getLanguageConfiguration(e)))),t=i,{object:e,dispose:()=>null==t?void 0:t.dispose()}),i.add(this.bracketPairsTree.value.object.onDidChange((e=>this.onDidChangeEmitter.fire(e)))),this.onDidChangeEmitter.fire()}}else this.bracketPairsTree.value&&(this.bracketPairsTree.clear(),this.onDidChangeEmitter.fire());var e,t}getBracketPairsInRange(e){var t;return this.bracketsRequested=!0,this.updateBracketPairsTree(),(null===(t=this.bracketPairsTree.value)||void 0===t?void 0:t.object.getBracketPairsInRange(e,!1))||[]}getBracketPairsInRangeWithMinIndentation(e){var t;return this.bracketsRequested=!0,this.updateBracketPairsTree(),(null===(t=this.bracketPairsTree.value)||void 0===t?void 0:t.object.getBracketPairsInRange(e,!0))||[]}getBracketsInRange(e){var t;return this.bracketsRequested=!0,this.updateBracketPairsTree(),(null===(t=this.bracketPairsTree.value)||void 0===t?void 0:t.object.getBracketsInRange(e))||[]}findMatchingBracketUp(e,t,i){const n=e.toLowerCase(),o=this.textModel.validatePosition(t),s=this.textModel.getLanguageIdAtPosition(o.lineNumber,o.column),r=this.languageConfigurationService.getLanguageConfiguration(s).brackets;if(!r)return null;const a=r.textIsBracket[n];return a?zO(this._findMatchingBracketUp(a,o,VO(i))):null}matchBracket(e,t){const i=VO(t);return this._matchBracket(this.textModel.validatePosition(e),i)}_establishBracketSearchOffsets(e,t,i,n){const o=t.getCount(),s=t.getLanguageId(n);let r=Math.max(0,e.column-1-i.maxBracketLength);for(let l=n-1;l>=0;l--){const e=t.getEndOffset(l);if(e<=r)break;if(V_(t.getStandardTokenType(l))||t.getLanguageId(l)!==s){r=e;break}}let a=Math.min(t.getLineContent().length,e.column-1+i.maxBracketLength);for(let l=n+1;l<o;l++){const e=t.getStartOffset(l);if(e>=a)break;if(V_(t.getStandardTokenType(l))||t.getLanguageId(l)!==s){a=e;break}}return{searchStartOffset:r,searchEndOffset:a}}_matchBracket(e,t){const i=e.lineNumber,n=this.textModel.getLineTokens(i),o=this.textModel.getLineContent(i),s=n.findTokenIndexAtOffset(e.column-1);if(s<0)return null;const r=this.languageConfigurationService.getLanguageConfiguration(n.getLanguageId(s)).brackets;if(r&&!V_(n.getStandardTokenType(s))){let{searchStartOffset:a,searchEndOffset:l}=this._establishBracketSearchOffsets(e,n,r,s),d=null;for(;;){const n=fv.findNextBracketInRange(r.forwardRegex,i,o,a,l);if(!n)break;if(n.startColumn<=e.column&&e.column<=n.endColumn){const e=o.substring(n.startColumn-1,n.endColumn-1).toLowerCase(),i=this._matchFoundBracket(n,r.textIsBracket[e],r.textIsOpenBracket[e],t);if(i){if(i instanceof WO)return null;d=i}}a=n.endColumn-1}if(d)return d}if(s>0&&n.getStartOffset(s)===e.column-1){const r=s-1,a=this.languageConfigurationService.getLanguageConfiguration(n.getLanguageId(r)).brackets;if(a&&!V_(n.getStandardTokenType(r))){const{searchStartOffset:s,searchEndOffset:l}=this._establishBracketSearchOffsets(e,n,a,r),d=fv.findPrevBracketInRange(a.reversedRegex,i,o,s,l);if(d&&d.startColumn<=e.column&&e.column<=d.endColumn){const e=o.substring(d.startColumn-1,d.endColumn-1).toLowerCase(),i=this._matchFoundBracket(d,a.textIsBracket[e],a.textIsOpenBracket[e],t);if(i)return i instanceof WO?null:i}}}return null}_matchFoundBracket(e,t,i,n){if(!t)return null;const o=i?this._findMatchingBracketDown(t,e.getEndPosition(),n):this._findMatchingBracketUp(t,e.getStartPosition(),n);return o?o instanceof WO?o:[e,o]:null}_findMatchingBracketUp(e,t,i){const n=e.languageId,o=e.reversedRegex;let s=-1,r=0;const a=(t,n,a,l)=>{for(;;){if(i&&++r%100==0&&!i())return WO.INSTANCE;const d=fv.findPrevBracketInRange(o,t,n,a,l);if(!d)break;const c=n.substring(d.startColumn-1,d.endColumn-1).toLowerCase();if(e.isOpen(c)?s++:e.isClose(c)&&s--,0===s)return d;l=d.startColumn-1}return null};for(let l=t.lineNumber;l>=1;l--){const e=this.textModel.getLineTokens(l),i=e.getCount(),o=this.textModel.getLineContent(l);let s=i-1,r=o.length,d=o.length;l===t.lineNumber&&(s=e.findTokenIndexAtOffset(t.column-1),r=t.column-1,d=t.column-1);let c=!0;for(;s>=0;s--){const t=e.getLanguageId(s)===n&&!V_(e.getStandardTokenType(s));if(t)c?r=e.getStartOffset(s):(r=e.getStartOffset(s),d=e.getEndOffset(s));else if(c&&r!==d){const e=a(l,o,r,d);if(e)return e}c=t}if(c&&r!==d){const e=a(l,o,r,d);if(e)return e}}return null}_findMatchingBracketDown(e,t,i){const n=e.languageId,o=e.forwardRegex;let s=1,r=0;const a=(t,n,a,l)=>{for(;;){if(i&&++r%100==0&&!i())return WO.INSTANCE;const d=fv.findNextBracketInRange(o,t,n,a,l);if(!d)break;const c=n.substring(d.startColumn-1,d.endColumn-1).toLowerCase();if(e.isOpen(c)?s++:e.isClose(c)&&s--,0===s)return d;a=d.endColumn-1}return null},l=this.textModel.getLineCount();for(let d=t.lineNumber;d<=l;d++){const e=this.textModel.getLineTokens(d),i=e.getCount(),o=this.textModel.getLineContent(d);let s=0,r=0,l=0;d===t.lineNumber&&(s=e.findTokenIndexAtOffset(t.column-1),r=t.column-1,l=t.column-1);let c=!0;for(;s<i;s++){const t=e.getLanguageId(s)===n&&!V_(e.getStandardTokenType(s));if(t)c||(r=e.getStartOffset(s)),l=e.getEndOffset(s);else if(c&&r!==l){const e=a(d,o,r,l);if(e)return e}c=t}if(c&&r!==l){const e=a(d,o,r,l);if(e)return e}}return null}findPrevBracket(e){const t=this.textModel.validatePosition(e);let i=null,n=null;for(let o=t.lineNumber;o>=1;o--){const e=this.textModel.getLineTokens(o),s=e.getCount(),r=this.textModel.getLineContent(o);let a=s-1,l=r.length,d=r.length;if(o===t.lineNumber){a=e.findTokenIndexAtOffset(t.column-1),l=t.column-1,d=t.column-1;const o=e.getLanguageId(a);i!==o&&(i=o,n=this.languageConfigurationService.getLanguageConfiguration(i).brackets)}let c=!0;for(;a>=0;a--){const t=e.getLanguageId(a);if(i!==t){if(n&&c&&l!==d){const e=fv.findPrevBracketInRange(n.reversedRegex,o,r,l,d);if(e)return this._toFoundBracket(n,e);c=!1}i=t,n=this.languageConfigurationService.getLanguageConfiguration(i).brackets}const s=!!n&&!V_(e.getStandardTokenType(a));if(s)c?l=e.getStartOffset(a):(l=e.getStartOffset(a),d=e.getEndOffset(a));else if(n&&c&&l!==d){const e=fv.findPrevBracketInRange(n.reversedRegex,o,r,l,d);if(e)return this._toFoundBracket(n,e)}c=s}if(n&&c&&l!==d){const e=fv.findPrevBracketInRange(n.reversedRegex,o,r,l,d);if(e)return this._toFoundBracket(n,e)}}return null}findNextBracket(e){const t=this.textModel.validatePosition(e),i=this.textModel.getLineCount();let n=null,o=null;for(let s=t.lineNumber;s<=i;s++){const e=this.textModel.getLineTokens(s),i=e.getCount(),r=this.textModel.getLineContent(s);let a=0,l=0,d=0;if(s===t.lineNumber){a=e.findTokenIndexAtOffset(t.column-1),l=t.column-1,d=t.column-1;const i=e.getLanguageId(a);n!==i&&(n=i,o=this.languageConfigurationService.getLanguageConfiguration(n).brackets)}let c=!0;for(;a<i;a++){const t=e.getLanguageId(a);if(n!==t){if(o&&c&&l!==d){const e=fv.findNextBracketInRange(o.forwardRegex,s,r,l,d);if(e)return this._toFoundBracket(o,e);c=!1}n=t,o=this.languageConfigurationService.getLanguageConfiguration(n).brackets}const i=!!o&&!V_(e.getStandardTokenType(a));if(i)c||(l=e.getStartOffset(a)),d=e.getEndOffset(a);else if(o&&c&&l!==d){const e=fv.findNextBracketInRange(o.forwardRegex,s,r,l,d);if(e)return this._toFoundBracket(o,e)}c=i}if(o&&c&&l!==d){const e=fv.findNextBracketInRange(o.forwardRegex,s,r,l,d);if(e)return this._toFoundBracket(o,e)}}return null}findEnclosingBrackets(e,t){const i=VO(t),n=this.textModel.validatePosition(e),o=this.textModel.getLineCount(),s=new Map;let r=[];const a=(e,t)=>{if(!s.has(e)){const i=[];for(let e=0,n=t?t.brackets.length:0;e<n;e++)i[e]=0;s.set(e,i)}r=s.get(e)};let l=0;const d=(e,t,n,o,s)=>{for(;;){if(i&&++l%100==0&&!i())return WO.INSTANCE;const a=fv.findNextBracketInRange(e.forwardRegex,t,n,o,s);if(!a)break;const d=n.substring(a.startColumn-1,a.endColumn-1).toLowerCase(),c=e.textIsBracket[d];if(c&&(c.isOpen(d)?r[c.index]++:c.isClose(d)&&r[c.index]--,-1===r[c.index]))return this._matchFoundBracket(a,c,!1,i);o=a.endColumn-1}return null};let c=null,h=null;for(let u=n.lineNumber;u<=o;u++){const e=this.textModel.getLineTokens(u),t=e.getCount(),i=this.textModel.getLineContent(u);let o=0,s=0,r=0;if(u===n.lineNumber){o=e.findTokenIndexAtOffset(n.column-1),s=n.column-1,r=n.column-1;const t=e.getLanguageId(o);c!==t&&(c=t,h=this.languageConfigurationService.getLanguageConfiguration(c).brackets,a(c,h))}let l=!0;for(;o<t;o++){const t=e.getLanguageId(o);if(c!==t){if(h&&l&&s!==r){const e=d(h,u,i,s,r);if(e)return zO(e);l=!1}c=t,h=this.languageConfigurationService.getLanguageConfiguration(c).brackets,a(c,h)}const n=!!h&&!V_(e.getStandardTokenType(o));if(n)l||(s=e.getStartOffset(o)),r=e.getEndOffset(o);else if(h&&l&&s!==r){const e=d(h,u,i,s,r);if(e)return zO(e)}l=n}if(h&&l&&s!==r){const e=d(h,u,i,s,r);if(e)return zO(e)}}return null}_toFoundBracket(e,t){if(!t)return null;let i=this.textModel.getValueInRange(t);i=i.toLowerCase();const n=e.textIsBracket[i];return n?{range:t,open:n.open,close:n.close,isOpen:e.textIsOpenBracket[i]}:null}}function VO(e){if(void 0===e)return()=>!0;{const t=Date.now();return()=>Date.now()-t<=e}}class WO{constructor(){this._searchCanceledBrand=void 0}}function zO(e){return e instanceof WO?null:e}WO.INSTANCE=new WO;class HO extends Uo{constructor(e){super(),this.textModel=e,this.colorProvider=new jO,this.onDidChangeEmitter=new $o,this.onDidChange=this.onDidChangeEmitter.event,this.colorizationOptions=e.getOptions().bracketPairColorizationOptions,this._register(e.bracketPairs.onDidChange((e=>{this.onDidChangeEmitter.fire()})))}handleDidChangeOptions(e){this.colorizationOptions=this.textModel.getOptions().bracketPairColorizationOptions}getDecorationsInRange(e,t,i){if(void 0===t)return[];if(!this.colorizationOptions.enabled)return[];const n=new Array,o=this.textModel.bracketPairs.getBracketsInRange(e);for(const s of o)n.push({id:`bracket${s.range.toString()}-${s.nestingLevel}`,options:{description:"BracketPairColorization",inlineClassName:this.colorProvider.getInlineClassName(s)},ownerId:0,range:s.range});return n}getAllDecorations(e,t){return void 0===e?[]:this.colorizationOptions.enabled?this.getDecorationsInRange(new qo(1,1,this.textModel.getLineCount(),1),e,t):[]}}class jO{constructor(){this.unexpectedClosingBracketClassName="unexpected-closing-bracket"}getInlineClassName(e){return e.isInvalid?this.unexpectedClosingBracketClassName:this.getInlineClassNameOfLevel(e.nestingLevel)}getInlineClassNameOfLevel(e){return"bracket-highlighting-"+e%30}}function UO(e){return e.replace(/\n/g,"\\n").replace(/\r/g,"\\r")}sx(((e,t)=>{const i=[_E,vE,bE,wE,CE,yE],n=new jO;t.addRule(`.monaco-editor .${n.unexpectedClosingBracketClassName} { color: ${e.getColor(xE)}; }`);const o=i.map((t=>e.getColor(t))).filter((e=>!!e)).filter((e=>!e.isTransparent()));for(let s=0;s<30;s++){const e=o[s%o.length];t.addRule(`.monaco-editor .${n.getInlineClassNameOfLevel(s)} { color: ${e}; }`)}}));class $O{constructor(e,t,i,n){this.oldPosition=e,this.oldText=t,this.newPosition=i,this.newText=n}get oldLength(){return this.oldText.length}get oldEnd(){return this.oldPosition+this.oldText.length}get newLength(){return this.newText.length}get newEnd(){return this.newPosition+this.newText.length}toString(){return 0===this.oldText.length?`(insert@${this.oldPosition} "${UO(this.newText)}")`:0===this.newText.length?`(delete@${this.oldPosition} "${UO(this.oldText)}")`:`(replace@${this.oldPosition} "${UO(this.oldText)}" with "${UO(this.newText)}")`}static _writeStringSize(e){return 4+2*e.length}static _writeString(e,t,i){const n=t.length;X_(e,n,i),i+=4;for(let o=0;o<n;o++)Z_(e,t.charCodeAt(o),i),i+=2;return i}static _readString(e,t){const i=Y_(e,t);return ov(e,t+=4,i)}writeSize(){return 8+$O._writeStringSize(this.oldText)+$O._writeStringSize(this.newText)}write(e,t){return X_(e,this.oldPosition,t),t+=4,X_(e,this.newPosition,t),t+=4,t=$O._writeString(e,this.oldText,t),t=$O._writeString(e,this.newText,t)}static read(e,t,i){const n=Y_(e,t),o=Y_(e,t+=4);t+=4;const s=$O._readString(e,t);t+=$O._writeStringSize(s);const r=$O._readString(e,t);return t+=$O._writeStringSize(r),i.push(new $O(n,s,o,r)),t}}class KO{constructor(e,t){this._prevEdits=e,this._currEdits=t,this._result=[],this._resultLen=0,this._prevLen=this._prevEdits.length,this._prevDeltaOffset=0,this._currLen=this._currEdits.length,this._currDeltaOffset=0}compress(){let e=0,t=0,i=this._getPrev(e),n=this._getCurr(t);for(;e<this._prevLen||t<this._currLen;){if(null===i){this._acceptCurr(n),n=this._getCurr(++t);continue}if(null===n){this._acceptPrev(i),i=this._getPrev(++e);continue}if(n.oldEnd<=i.newPosition){this._acceptCurr(n),n=this._getCurr(++t);continue}if(i.newEnd<=n.oldPosition){this._acceptPrev(i),i=this._getPrev(++e);continue}if(n.oldPosition<i.newPosition){const[e,t]=KO._splitCurr(n,i.newPosition-n.oldPosition);this._acceptCurr(e),n=t;continue}if(i.newPosition<n.oldPosition){const[e,t]=KO._splitPrev(i,n.oldPosition-i.newPosition);this._acceptPrev(e),i=t;continue}let o,s;if(n.oldEnd===i.newEnd)o=i,s=n,i=this._getPrev(++e),n=this._getCurr(++t);else if(n.oldEnd<i.newEnd){const[e,r]=KO._splitPrev(i,n.oldLength);o=e,s=n,i=r,n=this._getCurr(++t)}else{const[t,r]=KO._splitCurr(n,i.newLength);o=i,s=t,i=this._getPrev(++e),n=r}this._result[this._resultLen++]=new $O(o.oldPosition,o.oldText,s.newPosition,s.newText),this._prevDeltaOffset+=o.newLength-o.oldLength,this._currDeltaOffset+=s.newLength-s.oldLength}const o=KO._merge(this._result);return KO._removeNoOps(o)}_acceptCurr(e){this._result[this._resultLen++]=KO._rebaseCurr(this._prevDeltaOffset,e),this._currDeltaOffset+=e.newLength-e.oldLength}_getCurr(e){return e<this._currLen?this._currEdits[e]:null}_acceptPrev(e){this._result[this._resultLen++]=KO._rebasePrev(this._currDeltaOffset,e),this._prevDeltaOffset+=e.newLength-e.oldLength}_getPrev(e){return e<this._prevLen?this._prevEdits[e]:null}static _rebaseCurr(e,t){return new $O(t.oldPosition-e,t.oldText,t.newPosition,t.newText)}static _rebasePrev(e,t){return new $O(t.oldPosition,t.oldText,t.newPosition+e,t.newText)}static _splitPrev(e,t){const i=e.newText.substr(0,t),n=e.newText.substr(t);return[new $O(e.oldPosition,e.oldText,e.newPosition,i),new $O(e.oldEnd,"",e.newPosition+t,n)]}static _splitCurr(e,t){const i=e.oldText.substr(0,t),n=e.oldText.substr(t);return[new $O(e.oldPosition,i,e.newPosition,e.newText),new $O(e.oldPosition+t,n,e.newEnd,"")]}static _merge(e){if(0===e.length)return e;const t=[];let i=0,n=e[0];for(let o=1;o<e.length;o++){const s=e[o];n.oldEnd===s.oldPosition?n=new $O(n.oldPosition,n.oldText+s.oldText,n.newPosition,n.newText+s.newText):(t[i++]=n,n=s)}return t[i++]=n,t}static _removeNoOps(e){if(0===e.length)return e;const t=[];let i=0;for(let n=0;n<e.length;n++){const o=e[n];o.oldText!==o.newText&&(t[i++]=o)}return t}}function qO(e){return 47===e||92===e}function GO(e){return e.replace(/[\\/]/g,Pr.sep)}function ZO(e,t=Pr.sep){if(!e)return"";const i=e.length,n=e.charCodeAt(0);if(qO(n)){if(qO(e.charCodeAt(1))&&!qO(e.charCodeAt(2))){let n=3;const o=n;for(;n<i&&!qO(e.charCodeAt(n));n++);if(o!==n&&!qO(e.charCodeAt(n+1)))for(n+=1;n<i;n++)if(qO(e.charCodeAt(n)))return e.slice(0,n+1).replace(/[\\/]/g,t)}return t}if(XO(n)&&58===e.charCodeAt(1))return qO(e.charCodeAt(2))?e.slice(0,2)+t:e.slice(0,2);let o=e.indexOf("://");if(-1!==o)for(o+=3;o<i;o++)if(qO(e.charCodeAt(o)))return e.slice(0,o+1);return""}function YO(e,t,i,n=Fr){if(e===t)return!0;if(!e||!t)return!1;if(t.length>e.length)return!1;if(i){if(!Br(e,t))return!1;if(t.length===e.length)return!0;let i=t.length;return t.charAt(t.length-1)===n&&i--,e.charAt(i)===n}return t.charAt(t.length-1)!==n&&(t+=n),0===e.indexOf(t)}function XO(e){return e>=65&&e<=90||e>=97&&e<=122}function QO(e,t){return!!(void 0!==t?t:Rs)&&(XO(e.charCodeAt(0))&&58===e.charCodeAt(1))}function JO(e){return Wr(e,!0)}class eR{constructor(e){this._ignorePathCasing=e}compare(e,t,i=!1){return e===t?0:zr(this.getComparisonKey(e,i),this.getComparisonKey(t,i))}isEqual(e,t,i=!1){return e===t||!(!e||!t)&&this.getComparisonKey(e,i)===this.getComparisonKey(t,i)}getComparisonKey(e,t=!1){return e.with({path:this._ignorePathCasing(e)?e.path.toLowerCase():void 0,fragment:t?null:void 0}).toString()}isEqualOrParent(e,t,i=!1){if(e.scheme===t.scheme){if(e.scheme===Yw.file)return YO(JO(e),JO(t),this._ignorePathCasing(e))&&e.query===t.query&&(i||e.fragment===t.fragment);if(cR(e.authority,t.authority))return YO(e.path,t.path,this._ignorePathCasing(e),"/")&&e.query===t.query&&(i||e.fragment===t.fragment)}return!1}joinPath(e,...t){return Ps.joinPath(e,...t)}basenameOrAuthority(e){return oR(e)||e.authority}basename(e){return Pr.basename(e.path)}extname(e){return Pr.extname(e.path)}dirname(e){if(0===e.path.length)return e;let t;return e.scheme===Yw.file?t=Ps.file(Hr(JO(e))).path:(t=Pr.dirname(e.path),e.authority&&t.length&&47!==t.charCodeAt(0)&&(t="/")),e.with({path:t})}normalizePath(e){if(!e.path.length)return e;let t;return t=e.scheme===Yw.file?Ps.file(Vr(JO(e))).path:Pr.normalize(e.path),e.with({path:t})}relativePath(e,t){if(e.scheme!==t.scheme||!cR(e.authority,t.authority))return;if(e.scheme===Yw.file){const i=jr(JO(e),JO(t));return Rs?GO(i):i}let i=e.path||"/",n=t.path||"/";if(this._ignorePathCasing(e)){let e=0;for(const t=Math.min(i.length,n.length);e<t&&(i.charCodeAt(e)===n.charCodeAt(e)||i.charAt(e).toLowerCase()===n.charAt(e).toLowerCase());e++);i=n.substr(0,e)+i.substr(e)}return Pr.relative(i,n)}resolvePath(e,t){if(e.scheme===Yw.file){const i=Ps.file(Ur(JO(e),t));return e.with({authority:i.authority,path:i.path})}var i;return-1===(i=t).indexOf("/")&&(i=GO(i)),/^[a-zA-Z]:(\/|$)/.test(i)&&(i="/"+i),t=i,e.with({path:Pr.resolve(e.path,t)})}isAbsolutePath(e){return!!e.path&&"/"===e.path[0]}isEqualAuthority(e,t){return e===t||void 0!==e&&void 0!==t&&$r(e,t)}hasTrailingPathSeparator(e,t=Fr){if(e.scheme===Yw.file){const i=JO(e);return i.length>ZO(i).length&&i[i.length-1]===t}{const t=e.path;return t.length>1&&47===t.charCodeAt(t.length-1)&&!/^[a-zA-Z]:(\/$|\\$)/.test(e.fsPath)}}removeTrailingPathSeparator(e,t=Fr){return hR(e,t)?e.with({path:e.path.substr(0,e.path.length-1)}):e}addTrailingPathSeparator(e,t=Fr){let i=!1;if(e.scheme===Yw.file){const n=JO(e);i=void 0!==n&&n.length===ZO(n).length&&n[n.length-1]===t}else{t="/";const n=e.path;i=1===n.length&&47===n.charCodeAt(n.length-1)}return i||hR(e,t)?e:e.with({path:e.path+"/"})}}const tR=new eR((()=>!1));new eR((e=>e.scheme!==Yw.file||!Vo)),new eR((e=>!0));const iR=tR.isEqual.bind(tR);tR.isEqualOrParent.bind(tR),tR.getComparisonKey.bind(tR);const nR=tR.basenameOrAuthority.bind(tR),oR=tR.basename.bind(tR),sR=tR.extname.bind(tR),rR=tR.dirname.bind(tR),aR=tR.joinPath.bind(tR),lR=tR.normalizePath.bind(tR);tR.relativePath.bind(tR);const dR=tR.resolvePath.bind(tR);tR.isAbsolutePath.bind(tR);const cR=tR.isEqualAuthority.bind(tR),hR=tR.hasTrailingPathSeparator.bind(tR);var uR;function gR(e){return e.toString()}tR.removeTrailingPathSeparator.bind(tR),tR.addTrailingPathSeparator.bind(tR),function(e){e.META_DATA_LABEL="label",e.META_DATA_DESCRIPTION="description",e.META_DATA_SIZE="size",e.META_DATA_MIME="mime",e.parseMetaData=function(t){const i=new Map;t.path.substring(t.path.indexOf(";")+1,t.path.lastIndexOf(";")).split(";").forEach((e=>{const[t,n]=e.split(":");t&&n&&i.set(t,n)}));const n=t.path.substring(0,t.path.indexOf(";"));return n&&i.set(e.META_DATA_MIME,n),i}}(uR||(uR={}));class pR{constructor(e,t,i,n,o,s,r){this.beforeVersionId=e,this.afterVersionId=t,this.beforeEOL=i,this.afterEOL=n,this.beforeCursorState=o,this.afterCursorState=s,this.changes=r}static create(e,t){const i=e.getAlternativeVersionId(),n=fR(e);return new pR(i,i,n,n,t,t,[])}append(e,t,i,n,o){var s,r;t.length>0&&(this.changes=(s=this.changes,r=t,null===s||0===s.length?r:new KO(s,r).compress())),this.afterEOL=i,this.afterVersionId=n,this.afterCursorState=o}static _writeSelectionsSize(e){return 4+16*(e?e.length:0)}static _writeSelections(e,t,i){if(X_(e,t?t.length:0,i),i+=4,t)for(const n of t)X_(e,n.selectionStartLineNumber,i),i+=4,X_(e,n.selectionStartColumn,i),i+=4,X_(e,n.positionLineNumber,i),i+=4,X_(e,n.positionColumn,i),i+=4;return i}static _readSelections(e,t,i){const n=Y_(e,t);t+=4;for(let o=0;o<n;o++){const n=Y_(e,t),o=Y_(e,t+=4),s=Y_(e,t+=4),r=Y_(e,t+=4);t+=4,i.push(new ar(n,o,s,r))}return t}serialize(){let e=10+pR._writeSelectionsSize(this.beforeCursorState)+pR._writeSelectionsSize(this.afterCursorState)+4;for(const n of this.changes)e+=n.writeSize();const t=new Uint8Array(e);let i=0;X_(t,this.beforeVersionId,i),i+=4,X_(t,this.afterVersionId,i),i+=4,J_(t,this.beforeEOL,i),i+=1,J_(t,this.afterEOL,i),i+=1,i=pR._writeSelections(t,this.beforeCursorState,i),i=pR._writeSelections(t,this.afterCursorState,i),X_(t,this.changes.length,i),i+=4;for(const n of this.changes)i=n.write(t,i);return t.buffer}static deserialize(e){const t=new Uint8Array(e);let i=0;const n=Y_(t,i);i+=4;const o=Y_(t,i);i+=4;const s=Q_(t,i);i+=1;const r=Q_(t,i);i+=1;const a=[];i=pR._readSelections(t,i,a);const l=[];i=pR._readSelections(t,i,l);const d=Y_(t,i);i+=4;const c=[];for(let h=0;h<d;h++)i=$O.read(t,i,c);return new pR(n,o,s,r,a,l,c)}}class mR{constructor(e,t){this.model=e,this._data=pR.create(e,t)}get type(){return 0}get resource(){return Ps.isUri(this.model)?this.model:this.model.uri}get label(){return mf(0,"Typing")}toString(){return(this._data instanceof pR?this._data:pR.deserialize(this._data)).changes.map((e=>e.toString())).join(", ")}matchesResource(e){return(Ps.isUri(this.model)?this.model:this.model.uri).toString()===e.toString()}setModel(e){this.model=e}canAppend(e){return this.model===e&&this._data instanceof pR}append(e,t,i,n,o){this._data instanceof pR&&this._data.append(e,t,i,n,o)}close(){this._data instanceof pR&&(this._data=this._data.serialize())}open(){this._data instanceof pR||(this._data=pR.deserialize(this._data))}undo(){if(Ps.isUri(this.model))throw new Error("Invalid SingleModelEditStackElement");this._data instanceof pR&&(this._data=this._data.serialize());const e=pR.deserialize(this._data);this.model._applyUndo(e.changes,e.beforeEOL,e.beforeVersionId,e.beforeCursorState)}redo(){if(Ps.isUri(this.model))throw new Error("Invalid SingleModelEditStackElement");this._data instanceof pR&&(this._data=this._data.serialize());const e=pR.deserialize(this._data);this.model._applyRedo(e.changes,e.afterEOL,e.afterVersionId,e.afterCursorState)}heapSize(){return this._data instanceof pR&&(this._data=this._data.serialize()),this._data.byteLength+168}}function fR(e){return"\n"===e.getEOL()?0:1}function _R(e){return!!e&&(e instanceof mR||e instanceof class{constructor(e,t){this.type=1,this.label=e,this._isOpen=!0,this._editStackElementsArr=t.slice(0),this._editStackElementsMap=new Map;for(const i of this._editStackElementsArr){const e=gR(i.resource);this._editStackElementsMap.set(e,i)}this._delegate=null}get resources(){return this._editStackElementsArr.map((e=>e.resource))}prepareUndoRedo(){if(this._delegate)return this._delegate.prepareUndoRedo(this)}matchesResource(e){const t=gR(e);return this._editStackElementsMap.has(t)}setModel(e){const t=gR(Ps.isUri(e)?e:e.uri);this._editStackElementsMap.has(t)&&this._editStackElementsMap.get(t).setModel(e)}canAppend(e){if(!this._isOpen)return!1;const t=gR(e.uri);return!!this._editStackElementsMap.has(t)&&this._editStackElementsMap.get(t).canAppend(e)}append(e,t,i,n,o){const s=gR(e.uri);this._editStackElementsMap.get(s).append(e,t,i,n,o)}close(){this._isOpen=!1}open(){}undo(){this._isOpen=!1;for(const e of this._editStackElementsArr)e.undo()}redo(){for(const e of this._editStackElementsArr)e.redo()}heapSize(e){const t=gR(e);return this._editStackElementsMap.has(t)?this._editStackElementsMap.get(t).heapSize():0}split(){return this._editStackElementsArr}toString(){let e=[];for(const t of this._editStackElementsArr)e.push(`${oR(t.resource)}: ${t}`);return`{${e.join(", ")}}`}})}class vR{constructor(e,t){this._model=e,this._undoRedoService=t}pushStackElement(){const e=this._undoRedoService.getLastElement(this._model.uri);_R(e)&&e.close()}popStackElement(){const e=this._undoRedoService.getLastElement(this._model.uri);_R(e)&&e.open()}clear(){this._undoRedoService.removeElements(this._model.uri)}_getOrCreateEditStackElement(e){const t=this._undoRedoService.getLastElement(this._model.uri);if(_R(t)&&t.canAppend(this._model))return t;const i=new mR(this._model,e);return this._undoRedoService.pushElement(i),i}pushEOL(e){const t=this._getOrCreateEditStackElement(null);this._model.setEOL(e),t.append(this._model,[],fR(this._model),this._model.getAlternativeVersionId(),null)}pushEditOperation(e,t,i){const n=this._getOrCreateEditStackElement(e),o=this._model.applyEdits(t,!0),s=vR._computeCursorState(i,o),r=o.map(((e,t)=>({index:t,textChange:e.textChange})));return r.sort(((e,t)=>e.textChange.oldPosition===t.textChange.oldPosition?e.index-t.index:e.textChange.oldPosition-t.textChange.oldPosition)),n.append(this._model,r.map((e=>e.textChange)),fR(this._model),this._model.getAlternativeVersionId(),s),s}static _computeCursorState(e,t){try{return e?e(t):null}catch(i){return Jo(i),null}}}class bR{constructor(){this.spacesDiff=0,this.looksLikeAlignment=!1}}function wR(e,t,i,n,o){let s;for(o.spacesDiff=0,o.looksLikeAlignment=!1,s=0;s<t&&s<n;s++){if(e.charCodeAt(s)!==i.charCodeAt(s))break}let r=0,a=0;for(let u=s;u<t;u++){32===e.charCodeAt(u)?r++:a++}let l=0,d=0;for(let u=s;u<n;u++){32===i.charCodeAt(u)?l++:d++}if(r>0&&a>0)return;if(l>0&&d>0)return;const c=Math.abs(a-d),h=Math.abs(r-l);if(0===c)return o.spacesDiff=h,void(h>0&&0<=l-1&&l-1<e.length&&l<i.length&&32!==i.charCodeAt(l)&&32===e.charCodeAt(l-1)&&44===e.charCodeAt(e.length-1)&&(o.looksLikeAlignment=!0));h%c!=0||(o.spacesDiff=h/c)}function CR(e,t,i){const n=Math.min(e.getLineCount(),1e4);let o=0,s=0,r="",a=0;const l=[2,4,6,8,3,5,7],d=[0,0,0,0,0,0,0,0,0],c=new bR;for(let g=1;g<=n;g++){const n=e.getLineLength(g),l=e.getLineContent(g),h=n<=65536;let u=!1,p=0,m=0,f=0;for(let t=0,i=n;t<i;t++){const i=h?l.charCodeAt(t):e.getLineCharCode(g,t);if(9===i)f++;else{if(32!==i){u=!0,p=t;break}m++}}if(!u)continue;if(f>0?o++:m>1&&s++,wR(r,a,l,p,c),c.looksLikeAlignment&&(!i||t!==c.spacesDiff))continue;const _=c.spacesDiff;_<=8&&d[_]++,r=l,a=p}let h=i;o!==s&&(h=o<s);let u=t;if(h){let e=h?0:.1*n;l.forEach((t=>{const i=d[t];i>e&&(e=i,u=t)})),4===u&&d[4]>0&&d[2]>0&&d[2]>=d[4]/2&&(u=2)}return{insertSpaces:h,tabSize:u}}function yR(e){return(1&e.metadata)>>>0}function xR(e,t){e.metadata=254&e.metadata|t<<0}function SR(e){return(2&e.metadata)>>>1==1}function kR(e,t){e.metadata=253&e.metadata|(t?1:0)<<1}function DR(e){return(4&e.metadata)>>>2==1}function LR(e,t){e.metadata=251&e.metadata|(t?1:0)<<2}function NR(e,t){e.metadata=231&e.metadata|t<<3}function ER(e,t){e.metadata=223&e.metadata|(t?1:0)<<5}class IR{constructor(e,t,i){this.metadata=0,this.parent=this,this.left=this,this.right=this,xR(this,1),this.start=t,this.end=i,this.delta=0,this.maxEnd=i,this.id=e,this.ownerId=0,this.options=null,LR(this,!1),NR(this,1),ER(this,!1),this.cachedVersionId=0,this.cachedAbsoluteStart=t,this.cachedAbsoluteEnd=i,this.range=null,kR(this,!1)}reset(e,t,i,n){this.start=t,this.end=i,this.maxEnd=i,this.cachedVersionId=e,this.cachedAbsoluteStart=t,this.cachedAbsoluteEnd=i,this.range=n}setOptions(e){this.options=e;const t=this.options.className;LR(this,"squiggly-error"===t||"squiggly-warning"===t||"squiggly-info"===t),NR(this,this.options.stickiness),ER(this,this.options.collapseOnReplaceEdit)}setCachedOffsets(e,t,i){this.cachedVersionId!==i&&(this.range=null),this.cachedVersionId=i,this.cachedAbsoluteStart=e,this.cachedAbsoluteEnd=t}detach(){this.parent=null,this.left=null,this.right=null}}const TR=new IR(null,0,0);TR.parent=TR,TR.left=TR,TR.right=TR,xR(TR,0);class MR{constructor(){this.root=TR,this.requestNormalizeDelta=!1}intervalSearch(e,t,i,n,o){return this.root===TR?[]:function(e,t,i,n,o,s){let r=e.root,a=0,l=0,d=0,c=0;const h=[];let u=0;for(;r!==TR;)if(SR(r))kR(r.left,!1),kR(r.right,!1),r===r.parent.right&&(a-=r.parent.delta),r=r.parent;else{if(!SR(r.left)){if(l=a+r.maxEnd,l<t){kR(r,!0);continue}if(r.left!==TR){r=r.left;continue}}if(d=a+r.start,d>i)kR(r,!0);else{if(c=a+r.end,c>=t){r.setCachedOffsets(d,c,s);let e=!0;n&&r.ownerId&&r.ownerId!==n&&(e=!1),o&&DR(r)&&(e=!1),e&&(h[u++]=r)}kR(r,!0),r.right===TR||SR(r.right)||(a+=r.delta,r=r.right)}}return kR(e.root,!1),h}(this,e,t,i,n,o)}search(e,t,i){return this.root===TR?[]:function(e,t,i,n){let o=e.root,s=0,r=0,a=0;const l=[];let d=0;for(;o!==TR;){if(SR(o)){kR(o.left,!1),kR(o.right,!1),o===o.parent.right&&(s-=o.parent.delta),o=o.parent;continue}if(o.left!==TR&&!SR(o.left)){o=o.left;continue}r=s+o.start,a=s+o.end,o.setCachedOffsets(r,a,n);let e=!0;t&&o.ownerId&&o.ownerId!==t&&(e=!1),i&&DR(o)&&(e=!1),e&&(l[d++]=o),kR(o,!0),o.right===TR||SR(o.right)||(s+=o.delta,o=o.right)}return kR(e.root,!1),l}(this,e,t,i)}collectNodesFromOwner(e){return function(e,t){let i=e.root;const n=[];let o=0;for(;i!==TR;)SR(i)?(kR(i.left,!1),kR(i.right,!1),i=i.parent):i.left===TR||SR(i.left)?(i.ownerId===t&&(n[o++]=i),kR(i,!0),i.right===TR||SR(i.right)||(i=i.right)):i=i.left;return kR(e.root,!1),n}(this,e)}collectNodesPostOrder(){return function(e){let t=e.root;const i=[];let n=0;for(;t!==TR;)SR(t)?(kR(t.left,!1),kR(t.right,!1),t=t.parent):t.left===TR||SR(t.left)?t.right===TR||SR(t.right)?(i[n++]=t,kR(t,!0)):t=t.right:t=t.left;return kR(e.root,!1),i}(this)}insert(e){RR(this,e),this._normalizeDeltaIfNecessary()}delete(e){PR(this,e),this._normalizeDeltaIfNecessary()}resolveNode(e,t){const i=e;let n=0;for(;e!==this.root;)e===e.parent.right&&(n+=e.parent.delta),e=e.parent;const o=i.start+n,s=i.end+n;i.setCachedOffsets(o,s,t)}acceptReplace(e,t,i,n){const o=function(e,t,i){let n=e.root,o=0,s=0,r=0,a=0;const l=[];let d=0;for(;n!==TR;)if(SR(n))kR(n.left,!1),kR(n.right,!1),n===n.parent.right&&(o-=n.parent.delta),n=n.parent;else{if(!SR(n.left)){if(s=o+n.maxEnd,s<t){kR(n,!0);continue}if(n.left!==TR){n=n.left;continue}}r=o+n.start,r>i?kR(n,!0):(a=o+n.end,a>=t&&(n.setCachedOffsets(r,a,0),l[d++]=n),kR(n,!0),n.right===TR||SR(n.right)||(o+=n.delta,n=n.right))}return kR(e.root,!1),l}(this,e,e+t);for(let s=0,r=o.length;s<r;s++){PR(this,o[s])}this._normalizeDeltaIfNecessary(),function(e,t,i,n){let o=e.root,s=0,r=0,a=0;const l=n-(i-t);for(;o!==TR;)if(SR(o))kR(o.left,!1),kR(o.right,!1),o===o.parent.right&&(s-=o.parent.delta),zR(o),o=o.parent;else{if(!SR(o.left)){if(r=s+o.maxEnd,r<t){kR(o,!0);continue}if(o.left!==TR){o=o.left;continue}}a=s+o.start,a>i?(o.start+=l,o.end+=l,o.delta+=l,(o.delta<-1073741824||o.delta>1073741824)&&(e.requestNormalizeDelta=!0),kR(o,!0)):(kR(o,!0),o.right===TR||SR(o.right)||(s+=o.delta,o=o.right))}kR(e.root,!1)}(this,e,e+t,i),this._normalizeDeltaIfNecessary();for(let s=0,r=o.length;s<r;s++){const r=o[s];r.start=r.cachedAbsoluteStart,r.end=r.cachedAbsoluteEnd,OR(r,e,e+t,i,n),r.maxEnd=r.end,RR(this,r)}this._normalizeDeltaIfNecessary()}_normalizeDeltaIfNecessary(){this.requestNormalizeDelta&&(this.requestNormalizeDelta=!1,function(e){let t=e.root,i=0;for(;t!==TR;)t.left===TR||SR(t.left)?t.right===TR||SR(t.right)?(t.start=i+t.start,t.end=i+t.end,t.delta=0,zR(t),kR(t,!0),kR(t.left,!1),kR(t.right,!1),t===t.parent.right&&(i-=t.parent.delta),t=t.parent):(i+=t.delta,t=t.right):t=t.left;kR(e.root,!1)}(this))}}function AR(e,t,i,n){return e<i||!(e>i)&&(1!==n&&(2===n||t))}function OR(e,t,i,n,o){const s=function(e){return(24&e.metadata)>>>3}(e),r=0===s||2===s,a=1===s||2===s,l=i-t,d=n,c=Math.min(l,d),h=e.start;let u=!1;const g=e.end;let p=!1;t<=h&&g<=i&&function(e){return(32&e.metadata)>>>5==1}(e)&&(e.start=t,u=!0,e.end=t,p=!0);{const e=o?1:l>0?2:0;!u&&AR(h,r,t,e)&&(u=!0),!p&&AR(g,a,t,e)&&(p=!0)}if(c>0&&!o){const e=l>d?2:0;!u&&AR(h,r,t+c,e)&&(u=!0),!p&&AR(g,a,t+c,e)&&(p=!0)}{const n=o?1:0;!u&&AR(h,r,i,n)&&(e.start=t+d,u=!0),!p&&AR(g,a,i,n)&&(e.end=t+d,p=!0)}const m=d-l;u||(e.start=Math.max(0,h+m)),p||(e.end=Math.max(0,g+m)),e.start>e.end&&(e.end=e.start)}function RR(e,t){if(e.root===TR)return t.parent=TR,t.left=TR,t.right=TR,xR(t,0),e.root=t,e.root;!function(e,t){let i=0,n=e.root;const o=t.start,s=t.end;for(;;){if(jR(o,s,n.start+i,n.end+i)<0){if(n.left===TR){t.start-=i,t.end-=i,t.maxEnd-=i,n.left=t;break}n=n.left}else{if(n.right===TR){t.start-=i+n.delta,t.end-=i+n.delta,t.maxEnd-=i+n.delta,n.right=t;break}i+=n.delta,n=n.right}}t.parent=n,t.left=TR,t.right=TR,xR(t,1)}(e,t),HR(t.parent);let i=t;for(;i!==e.root&&1===yR(i.parent);)if(i.parent===i.parent.parent.left){const t=i.parent.parent.right;1===yR(t)?(xR(i.parent,0),xR(t,0),xR(i.parent.parent,1),i=i.parent.parent):(i===i.parent.right&&(i=i.parent,BR(e,i)),xR(i.parent,0),xR(i.parent.parent,1),VR(e,i.parent.parent))}else{const t=i.parent.parent.left;1===yR(t)?(xR(i.parent,0),xR(t,0),xR(i.parent.parent,1),i=i.parent.parent):(i===i.parent.left&&(i=i.parent,VR(e,i)),xR(i.parent,0),xR(i.parent.parent,1),BR(e,i.parent.parent))}return xR(e.root,0),t}function PR(e,t){let i,n;if(t.left===TR?(i=t.right,n=t,i.delta+=t.delta,(i.delta<-1073741824||i.delta>1073741824)&&(e.requestNormalizeDelta=!0),i.start+=t.delta,i.end+=t.delta):t.right===TR?(i=t.left,n=t):(n=function(e){for(;e.left!==TR;)e=e.left;return e}(t.right),i=n.right,i.start+=n.delta,i.end+=n.delta,i.delta+=n.delta,(i.delta<-1073741824||i.delta>1073741824)&&(e.requestNormalizeDelta=!0),n.start+=t.delta,n.end+=t.delta,n.delta=t.delta,(n.delta<-1073741824||n.delta>1073741824)&&(e.requestNormalizeDelta=!0)),n===e.root)return e.root=i,xR(i,0),t.detach(),FR(),zR(i),void(e.root.parent=TR);const o=1===yR(n);if(n===n.parent.left?n.parent.left=i:n.parent.right=i,n===t?i.parent=n.parent:(n.parent===t?i.parent=n:i.parent=n.parent,n.left=t.left,n.right=t.right,n.parent=t.parent,xR(n,yR(t)),t===e.root?e.root=n:t===t.parent.left?t.parent.left=n:t.parent.right=n,n.left!==TR&&(n.left.parent=n),n.right!==TR&&(n.right.parent=n)),t.detach(),o)return HR(i.parent),n!==t&&(HR(n),HR(n.parent)),void FR();let s;for(HR(i),HR(i.parent),n!==t&&(HR(n),HR(n.parent));i!==e.root&&0===yR(i);)i===i.parent.left?(s=i.parent.right,1===yR(s)&&(xR(s,0),xR(i.parent,1),BR(e,i.parent),s=i.parent.right),0===yR(s.left)&&0===yR(s.right)?(xR(s,1),i=i.parent):(0===yR(s.right)&&(xR(s.left,0),xR(s,1),VR(e,s),s=i.parent.right),xR(s,yR(i.parent)),xR(i.parent,0),xR(s.right,0),BR(e,i.parent),i=e.root)):(s=i.parent.left,1===yR(s)&&(xR(s,0),xR(i.parent,1),VR(e,i.parent),s=i.parent.left),0===yR(s.left)&&0===yR(s.right)?(xR(s,1),i=i.parent):(0===yR(s.left)&&(xR(s.right,0),xR(s,1),BR(e,s),s=i.parent.left),xR(s,yR(i.parent)),xR(i.parent,0),xR(s.left,0),VR(e,i.parent),i=e.root));xR(i,0),FR()}function FR(){TR.parent=TR,TR.delta=0,TR.start=0,TR.end=0}function BR(e,t){const i=t.right;i.delta+=t.delta,(i.delta<-1073741824||i.delta>1073741824)&&(e.requestNormalizeDelta=!0),i.start+=t.delta,i.end+=t.delta,t.right=i.left,i.left!==TR&&(i.left.parent=t),i.parent=t.parent,t.parent===TR?e.root=i:t===t.parent.left?t.parent.left=i:t.parent.right=i,i.left=t,t.parent=i,zR(t),zR(i)}function VR(e,t){const i=t.left;t.delta-=i.delta,(t.delta<-1073741824||t.delta>1073741824)&&(e.requestNormalizeDelta=!0),t.start-=i.delta,t.end-=i.delta,t.left=i.right,i.right!==TR&&(i.right.parent=t),i.parent=t.parent,t.parent===TR?e.root=i:t===t.parent.right?t.parent.right=i:t.parent.left=i,i.right=t,t.parent=i,zR(t),zR(i)}function WR(e){let t=e.end;if(e.left!==TR){const i=e.left.maxEnd;i>t&&(t=i)}if(e.right!==TR){const i=e.right.maxEnd+e.delta;i>t&&(t=i)}return t}function zR(e){e.maxEnd=WR(e)}function HR(e){for(;e!==TR;){const t=WR(e);if(e.maxEnd===t)return;e.maxEnd=t,e=e.parent}}function jR(e,t,i,n){return e===i?t-n:e-i}class UR{constructor(e,t){this.piece=e,this.color=t,this.size_left=0,this.lf_left=0,this.parent=this,this.left=this,this.right=this}next(){if(this.right!==$R)return KR(this.right);let e=this;for(;e.parent!==$R&&e.parent.left!==e;)e=e.parent;return e.parent===$R?$R:e.parent}prev(){if(this.left!==$R)return qR(this.left);let e=this;for(;e.parent!==$R&&e.parent.right!==e;)e=e.parent;return e.parent===$R?$R:e.parent}detach(){this.parent=null,this.left=null,this.right=null}}const $R=new UR(null,0);function KR(e){for(;e.left!==$R;)e=e.left;return e}function qR(e){for(;e.right!==$R;)e=e.right;return e}function GR(e){return e===$R?0:e.size_left+e.piece.length+GR(e.right)}function ZR(e){return e===$R?0:e.lf_left+e.piece.lineFeedCnt+ZR(e.right)}function YR(){$R.parent=$R}function XR(e,t){const i=t.right;i.size_left+=t.size_left+(t.piece?t.piece.length:0),i.lf_left+=t.lf_left+(t.piece?t.piece.lineFeedCnt:0),t.right=i.left,i.left!==$R&&(i.left.parent=t),i.parent=t.parent,t.parent===$R?e.root=i:t.parent.left===t?t.parent.left=i:t.parent.right=i,i.left=t,t.parent=i}function QR(e,t){const i=t.left;t.left=i.right,i.right!==$R&&(i.right.parent=t),i.parent=t.parent,t.size_left-=i.size_left+(i.piece?i.piece.length:0),t.lf_left-=i.lf_left+(i.piece?i.piece.lineFeedCnt:0),t.parent===$R?e.root=i:t===t.parent.right?t.parent.right=i:t.parent.left=i,i.right=t,t.parent=i}function JR(e,t){let i,n;if(t.left===$R?(n=t,i=n.right):t.right===$R?(n=t,i=n.left):(n=KR(t.right),i=n.right),n===e.root)return e.root=i,i.color=0,t.detach(),YR(),void(e.root.parent=$R);const o=1===n.color;if(n===n.parent.left?n.parent.left=i:n.parent.right=i,n===t?(i.parent=n.parent,iP(e,i)):(n.parent===t?i.parent=n:i.parent=n.parent,iP(e,i),n.left=t.left,n.right=t.right,n.parent=t.parent,n.color=t.color,t===e.root?e.root=n:t===t.parent.left?t.parent.left=n:t.parent.right=n,n.left!==$R&&(n.left.parent=n),n.right!==$R&&(n.right.parent=n),n.size_left=t.size_left,n.lf_left=t.lf_left,iP(e,n)),t.detach(),i.parent.left===i){const t=GR(i),n=ZR(i);if(t!==i.parent.size_left||n!==i.parent.lf_left){const o=t-i.parent.size_left,s=n-i.parent.lf_left;i.parent.size_left=t,i.parent.lf_left=n,tP(e,i.parent,o,s)}}if(iP(e,i.parent),o)return void YR();let s;for(;i!==e.root&&0===i.color;)i===i.parent.left?(s=i.parent.right,1===s.color&&(s.color=0,i.parent.color=1,XR(e,i.parent),s=i.parent.right),0===s.left.color&&0===s.right.color?(s.color=1,i=i.parent):(0===s.right.color&&(s.left.color=0,s.color=1,QR(e,s),s=i.parent.right),s.color=i.parent.color,i.parent.color=0,s.right.color=0,XR(e,i.parent),i=e.root)):(s=i.parent.left,1===s.color&&(s.color=0,i.parent.color=1,QR(e,i.parent),s=i.parent.left),0===s.left.color&&0===s.right.color?(s.color=1,i=i.parent):(0===s.left.color&&(s.right.color=0,s.color=1,XR(e,s),s=i.parent.left),s.color=i.parent.color,i.parent.color=0,s.left.color=0,QR(e,i.parent),i=e.root));i.color=0,YR()}function eP(e,t){for(iP(e,t);t!==e.root&&1===t.parent.color;)if(t.parent===t.parent.parent.left){const i=t.parent.parent.right;1===i.color?(t.parent.color=0,i.color=0,t.parent.parent.color=1,t=t.parent.parent):(t===t.parent.right&&XR(e,t=t.parent),t.parent.color=0,t.parent.parent.color=1,QR(e,t.parent.parent))}else{const i=t.parent.parent.left;1===i.color?(t.parent.color=0,i.color=0,t.parent.parent.color=1,t=t.parent.parent):(t===t.parent.left&&QR(e,t=t.parent),t.parent.color=0,t.parent.parent.color=1,XR(e,t.parent.parent))}e.root.color=0}function tP(e,t,i,n){for(;t!==e.root&&t!==$R;)t.parent.left===t&&(t.parent.size_left+=i,t.parent.lf_left+=n),t=t.parent}function iP(e,t){let i=0,n=0;if(t!==e.root){for(;t!==e.root&&t===t.parent.right;)t=t.parent;if(t!==e.root)for(i=GR((t=t.parent).left)-t.size_left,n=ZR(t.left)-t.lf_left,t.size_left+=i,t.lf_left+=n;t!==e.root&&(0!==i||0!==n);)t.parent.left===t&&(t.parent.size_left+=i,t.parent.lf_left+=n),t=t.parent}}$R.parent=$R,$R.left=$R,$R.right=$R,$R.color=0;const nP=65535;function oP(e){let t;return t=e[e.length-1]<65536?new Uint16Array(e.length):new Uint32Array(e.length),t.set(e,0),t}class sP{constructor(e,t,i,n,o){this.lineStarts=e,this.cr=t,this.lf=i,this.crlf=n,this.isBasicASCII=o}}function rP(e,t=!0){const i=[0];let n=1;for(let o=0,s=e.length;o<s;o++){const t=e.charCodeAt(o);13===t?o+1<s&&10===e.charCodeAt(o+1)?(i[n++]=o+2,o++):i[n++]=o+1:10===t&&(i[n++]=o+1)}return t?oP(i):i}class aP{constructor(e,t,i,n,o){this.bufferIndex=e,this.start=t,this.end=i,this.lineFeedCnt=n,this.length=o}}class lP{constructor(e,t){this.buffer=e,this.lineStarts=t}}class dP{constructor(e,t){this._pieces=[],this._tree=e,this._BOM=t,this._index=0,e.root!==$R&&e.iterate(e.root,(e=>(e!==$R&&this._pieces.push(e.piece),!0)))}read(){return 0===this._pieces.length?0===this._index?(this._index++,this._BOM):null:this._index>this._pieces.length-1?null:0===this._index?this._BOM+this._tree.getPieceContent(this._pieces[this._index++]):this._tree.getPieceContent(this._pieces[this._index++])}}class cP{constructor(e){this._limit=e,this._cache=[]}get(e){for(let t=this._cache.length-1;t>=0;t--){const i=this._cache[t];if(i.nodeStartOffset<=e&&i.nodeStartOffset+i.node.piece.length>=e)return i}return null}get2(e){for(let t=this._cache.length-1;t>=0;t--){const i=this._cache[t];if(i.nodeStartLineNumber&&i.nodeStartLineNumber<e&&i.nodeStartLineNumber+i.node.piece.lineFeedCnt>=e)return i}return null}set(e){this._cache.length>=this._limit&&this._cache.shift(),this._cache.push(e)}validate(e){let t=!1;const i=this._cache;for(let n=0;n<i.length;n++){const o=i[n];(null===o.node.parent||o.nodeStartOffset>=e)&&(i[n]=null,t=!0)}if(t){const e=[];for(const t of i)null!==t&&e.push(t);this._cache=e}}}class hP{constructor(e,t,i){this.create(e,t,i)}create(e,t,i){this._buffers=[new lP("",[0])],this._lastChangeBufferPos={line:0,column:0},this.root=$R,this._lineCnt=1,this._length=0,this._EOL=t,this._EOLLength=t.length,this._EOLNormalized=i;let n=null;for(let o=0,s=e.length;o<s;o++)if(e[o].buffer.length>0){e[o].lineStarts||(e[o].lineStarts=rP(e[o].buffer));const t=new aP(o+1,{line:0,column:0},{line:e[o].lineStarts.length-1,column:e[o].buffer.length-e[o].lineStarts[e[o].lineStarts.length-1]},e[o].lineStarts.length-1,e[o].buffer.length);this._buffers.push(e[o]),n=this.rbInsertRight(n,t)}this._searchCache=new cP(1),this._lastVisitedLine={lineNumber:0,value:""},this.computeBufferMetadata()}normalizeEOL(e){const t=65535-Math.floor(21845),i=2*t;let n="",o=0;const s=[];if(this.iterate(this.root,(r=>{const a=this.getNodeContent(r),l=a.length;if(o<=t||o+l<i)return n+=a,o+=l,!0;const d=n.replace(/\r\n|\r|\n/g,e);return s.push(new lP(d,rP(d))),n=a,o=l,!0})),o>0){const t=n.replace(/\r\n|\r|\n/g,e);s.push(new lP(t,rP(t)))}this.create(s,e,!0)}getEOL(){return this._EOL}setEOL(e){this._EOL=e,this._EOLLength=this._EOL.length,this.normalizeEOL(e)}createSnapshot(e){return new dP(this,e)}getOffsetAt(e,t){let i=0,n=this.root;for(;n!==$R;)if(n.left!==$R&&n.lf_left+1>=e)n=n.left;else{if(n.lf_left+n.piece.lineFeedCnt+1>=e){i+=n.size_left;return i+(this.getAccumulatedValue(n,e-n.lf_left-2)+t-1)}e-=n.lf_left+n.piece.lineFeedCnt,i+=n.size_left+n.piece.length,n=n.right}return i}getPositionAt(e){e=Math.floor(e),e=Math.max(0,e);let t=this.root,i=0;const n=e;for(;t!==$R;)if(0!==t.size_left&&t.size_left>=e)t=t.left;else{if(t.size_left+t.piece.length>=e){const o=this.getIndexOf(t,e-t.size_left);if(i+=t.lf_left+o.index,0===o.index){const e=this.getOffsetAt(i+1,1);return new er(i+1,n-e+1)}return new er(i+1,o.remainder+1)}if(e-=t.size_left+t.piece.length,i+=t.lf_left+t.piece.lineFeedCnt,t.right===$R){const t=this.getOffsetAt(i+1,1);return new er(i+1,n-e-t+1)}t=t.right}return new er(1,1)}getValueInRange(e,t){if(e.startLineNumber===e.endLineNumber&&e.startColumn===e.endColumn)return"";const i=this.nodeAt2(e.startLineNumber,e.startColumn),n=this.nodeAt2(e.endLineNumber,e.endColumn),o=this.getValueInRange2(i,n);return t?t===this._EOL&&this._EOLNormalized&&t===this.getEOL()&&this._EOLNormalized?o:o.replace(/\r\n|\r|\n/g,t):o}getValueInRange2(e,t){if(e.node===t.node){const i=e.node,n=this._buffers[i.piece.bufferIndex].buffer,o=this.offsetInBuffer(i.piece.bufferIndex,i.piece.start);return n.substring(o+e.remainder,o+t.remainder)}let i=e.node;const n=this._buffers[i.piece.bufferIndex].buffer,o=this.offsetInBuffer(i.piece.bufferIndex,i.piece.start);let s=n.substring(o+e.remainder,o+i.piece.length);for(i=i.next();i!==$R;){const e=this._buffers[i.piece.bufferIndex].buffer,n=this.offsetInBuffer(i.piece.bufferIndex,i.piece.start);if(i===t.node){s+=e.substring(n,n+t.remainder);break}s+=e.substr(n,i.piece.length),i=i.next()}return s}getLinesContent(){const e=[];let t=0,i="",n=!1;return this.iterate(this.root,(o=>{if(o===$R)return!0;const s=o.piece;let r=s.length;if(0===r)return!0;const a=this._buffers[s.bufferIndex].buffer,l=this._buffers[s.bufferIndex].lineStarts,d=s.start.line,c=s.end.line;let h=l[d]+s.start.column;if(n&&(10===a.charCodeAt(h)&&(h++,r--),e[t++]=i,i="",n=!1,0===r))return!0;if(d===c)return this._EOLNormalized||13!==a.charCodeAt(h+r-1)?i+=a.substr(h,r):(n=!0,i+=a.substr(h,r-1)),!0;i+=this._EOLNormalized?a.substring(h,Math.max(h,l[d+1]-this._EOLLength)):a.substring(h,l[d+1]).replace(/(\r\n|\r|\n)$/,""),e[t++]=i;for(let n=d+1;n<c;n++)i=this._EOLNormalized?a.substring(l[n],l[n+1]-this._EOLLength):a.substring(l[n],l[n+1]).replace(/(\r\n|\r|\n)$/,""),e[t++]=i;return this._EOLNormalized||13!==a.charCodeAt(l[c]+s.end.column-1)?i=a.substr(l[c],s.end.column):(n=!0,0===s.end.column?t--:i=a.substr(l[c],s.end.column-1)),!0})),n&&(e[t++]=i,i=""),e[t++]=i,e}getLength(){return this._length}getLineCount(){return this._lineCnt}getLineContent(e){return this._lastVisitedLine.lineNumber===e||(this._lastVisitedLine.lineNumber=e,e===this._lineCnt?this._lastVisitedLine.value=this.getLineRawContent(e):this._EOLNormalized?this._lastVisitedLine.value=this.getLineRawContent(e,this._EOLLength):this._lastVisitedLine.value=this.getLineRawContent(e).replace(/(\r\n|\r|\n)$/,"")),this._lastVisitedLine.value}_getCharCode(e){if(e.remainder===e.node.piece.length){const t=e.node.next();if(!t)return 0;const i=this._buffers[t.piece.bufferIndex],n=this.offsetInBuffer(t.piece.bufferIndex,t.piece.start);return i.buffer.charCodeAt(n)}{const t=this._buffers[e.node.piece.bufferIndex],i=this.offsetInBuffer(e.node.piece.bufferIndex,e.node.piece.start)+e.remainder;return t.buffer.charCodeAt(i)}}getLineCharCode(e,t){const i=this.nodeAt2(e,t+1);return this._getCharCode(i)}getLineLength(e){if(e===this.getLineCount()){const t=this.getOffsetAt(e,1);return this.getLength()-t}return this.getOffsetAt(e+1,1)-this.getOffsetAt(e,1)-this._EOLLength}findMatchesInNode(e,t,i,n,o,s,r,a,l,d,c){const h=this._buffers[e.piece.bufferIndex],u=this.offsetInBuffer(e.piece.bufferIndex,e.piece.start),g=this.offsetInBuffer(e.piece.bufferIndex,o),p=this.offsetInBuffer(e.piece.bufferIndex,s);let m;const f={line:0,column:0};let _,v;t._wordSeparators?(_=h.buffer.substring(g,p),v=e=>e+g,t.reset(0)):(_=h.buffer,v=e=>e,t.reset(g));do{if(m=t.next(_),m){if(v(m.index)>=p)return d;this.positionInBuffer(e,v(m.index)-u,f);const t=this.getLineFeedCnt(e.piece.bufferIndex,o,f),s=f.line===o.line?f.column-o.column+n:f.column+1,r=s+m[0].length;if(c[d++]=Kr(new qo(i+t,s,i+t,r),m,a),v(m.index)+m[0].length>=p)return d;if(d>=l)return d}}while(m);return d}findMatchesLineByLine(e,t,i,n){const o=[];let s=0;const r=new qr(t.wordSeparators,t.regex);let a=this.nodeAt2(e.startLineNumber,e.startColumn);if(null===a)return[];const l=this.nodeAt2(e.endLineNumber,e.endColumn);if(null===l)return[];let d=this.positionInBuffer(a.node,a.remainder);const c=this.positionInBuffer(l.node,l.remainder);if(a.node===l.node)return this.findMatchesInNode(a.node,r,e.startLineNumber,e.startColumn,d,c,t,i,n,s,o),o;let h=e.startLineNumber,u=a.node;for(;u!==l.node;){const l=this.getLineFeedCnt(u.piece.bufferIndex,d,u.piece.end);if(l>=1){const a=this._buffers[u.piece.bufferIndex].lineStarts,c=this.offsetInBuffer(u.piece.bufferIndex,u.piece.start),g=a[d.line+l],p=h===e.startLineNumber?e.startColumn:1;if(s=this.findMatchesInNode(u,r,h,p,d,this.positionInBuffer(u,g-c),t,i,n,s,o),s>=n)return o;h+=l}const c=h===e.startLineNumber?e.startColumn-1:0;if(h===e.endLineNumber){const a=this.getLineContent(h).substring(c,e.endColumn-1);return s=this._findMatchesInLine(t,r,a,e.endLineNumber,c,s,o,i,n),o}if(s=this._findMatchesInLine(t,r,this.getLineContent(h).substr(c),h,c,s,o,i,n),s>=n)return o;h++,a=this.nodeAt2(h,1),u=a.node,d=this.positionInBuffer(a.node,a.remainder)}if(h===e.endLineNumber){const a=h===e.startLineNumber?e.startColumn-1:0,l=this.getLineContent(h).substring(a,e.endColumn-1);return s=this._findMatchesInLine(t,r,l,e.endLineNumber,a,s,o,i,n),o}const g=h===e.startLineNumber?e.startColumn:1;return s=this.findMatchesInNode(l.node,r,h,g,d,c,t,i,n,s,o),o}_findMatchesInLine(e,t,i,n,o,s,r,a,l){const d=e.wordSeparators;if(!a&&e.simpleSearch){const t=e.simpleSearch,a=t.length,c=i.length;let h=-a;for(;-1!==(h=i.indexOf(t,h+a));)if((!d||Gr(d,i,c,h,a))&&(r[s++]=new Zr(new qo(n,h+1+o,n,h+1+a+o),null),s>=l))return s;return s}let c;t.reset(0);do{if(c=t.next(i),c&&(r[s++]=Kr(new qo(n,c.index+1+o,n,c.index+1+c[0].length+o),c,a),s>=l))return s}while(c);return s}insert(e,t,i=!1){if(this._EOLNormalized=this._EOLNormalized&&i,this._lastVisitedLine.lineNumber=0,this._lastVisitedLine.value="",this.root!==$R){const{node:i,remainder:n,nodeStartOffset:o}=this.nodeAt(e),s=i.piece,r=s.bufferIndex,a=this.positionInBuffer(i,n);if(0===i.piece.bufferIndex&&s.end.line===this._lastChangeBufferPos.line&&s.end.column===this._lastChangeBufferPos.column&&o+s.length===e&&t.length<nP)return this.appendToNode(i,t),void this.computeBufferMetadata();if(o===e)this.insertContentToNodeLeft(t,i),this._searchCache.validate(e);else if(o+i.piece.length>e){const e=[];let o=new aP(s.bufferIndex,a,s.end,this.getLineFeedCnt(s.bufferIndex,a,s.end),this.offsetInBuffer(r,s.end)-this.offsetInBuffer(r,a));if(this.shouldCheckCRLF()&&this.endWithCR(t)){if(10===this.nodeCharCodeAt(i,n)){const e={line:o.start.line+1,column:0};o=new aP(o.bufferIndex,e,o.end,this.getLineFeedCnt(o.bufferIndex,e,o.end),o.length-1),t+="\n"}}if(this.shouldCheckCRLF()&&this.startWithLF(t)){if(13===this.nodeCharCodeAt(i,n-1)){const o=this.positionInBuffer(i,n-1);this.deleteNodeTail(i,o),t="\r"+t,0===i.piece.length&&e.push(i)}else this.deleteNodeTail(i,a)}else this.deleteNodeTail(i,a);const l=this.createNewPieces(t);o.length>0&&this.rbInsertRight(i,o);let d=i;for(let t=0;t<l.length;t++)d=this.rbInsertRight(d,l[t]);this.deleteNodes(e)}else this.insertContentToNodeRight(t,i)}else{const e=this.createNewPieces(t);let i=this.rbInsertLeft(null,e[0]);for(let t=1;t<e.length;t++)i=this.rbInsertRight(i,e[t])}this.computeBufferMetadata()}delete(e,t){if(this._lastVisitedLine.lineNumber=0,this._lastVisitedLine.value="",t<=0||this.root===$R)return;const i=this.nodeAt(e),n=this.nodeAt(e+t),o=i.node,s=n.node;if(o===s){const s=this.positionInBuffer(o,i.remainder),r=this.positionInBuffer(o,n.remainder);if(i.nodeStartOffset===e){if(t===o.piece.length){const e=o.next();return JR(this,o),this.validateCRLFWithPrevNode(e),void this.computeBufferMetadata()}return this.deleteNodeHead(o,r),this._searchCache.validate(e),this.validateCRLFWithPrevNode(o),void this.computeBufferMetadata()}return i.nodeStartOffset+o.piece.length===e+t?(this.deleteNodeTail(o,s),this.validateCRLFWithNextNode(o),void this.computeBufferMetadata()):(this.shrinkNode(o,s,r),void this.computeBufferMetadata())}const r=[],a=this.positionInBuffer(o,i.remainder);this.deleteNodeTail(o,a),this._searchCache.validate(e),0===o.piece.length&&r.push(o);const l=this.positionInBuffer(s,n.remainder);this.deleteNodeHead(s,l),0===s.piece.length&&r.push(s);for(let c=o.next();c!==$R&&c!==s;c=c.next())r.push(c);const d=0===o.piece.length?o.prev():o;this.deleteNodes(r),this.validateCRLFWithNextNode(d),this.computeBufferMetadata()}insertContentToNodeLeft(e,t){const i=[];if(this.shouldCheckCRLF()&&this.endWithCR(e)&&this.startWithLF(t)){const n=t.piece,o={line:n.start.line+1,column:0},s=new aP(n.bufferIndex,o,n.end,this.getLineFeedCnt(n.bufferIndex,o,n.end),n.length-1);t.piece=s,e+="\n",tP(this,t,-1,-1),0===t.piece.length&&i.push(t)}const n=this.createNewPieces(e);let o=this.rbInsertLeft(t,n[n.length-1]);for(let s=n.length-2;s>=0;s--)o=this.rbInsertLeft(o,n[s]);this.validateCRLFWithPrevNode(o),this.deleteNodes(i)}insertContentToNodeRight(e,t){this.adjustCarriageReturnFromNext(e,t)&&(e+="\n");const i=this.createNewPieces(e),n=this.rbInsertRight(t,i[0]);let o=n;for(let s=1;s<i.length;s++)o=this.rbInsertRight(o,i[s]);this.validateCRLFWithPrevNode(n)}positionInBuffer(e,t,i){const n=e.piece,o=e.piece.bufferIndex,s=this._buffers[o].lineStarts,r=s[n.start.line]+n.start.column+t;let a=n.start.line,l=n.end.line,d=0,c=0,h=0;for(;a<=l&&(d=a+(l-a)/2|0,h=s[d],d!==l);)if(c=s[d+1],r<h)l=d-1;else{if(!(r>=c))break;a=d+1}return i?(i.line=d,i.column=r-h,null):{line:d,column:r-h}}getLineFeedCnt(e,t,i){if(0===i.column)return i.line-t.line;const n=this._buffers[e].lineStarts;if(i.line===n.length-1)return i.line-t.line;const o=n[i.line+1],s=n[i.line]+i.column;if(o>s+1)return i.line-t.line;const r=s-1;return 13===this._buffers[e].buffer.charCodeAt(r)?i.line-t.line+1:i.line-t.line}offsetInBuffer(e,t){return this._buffers[e].lineStarts[t.line]+t.column}deleteNodes(e){for(let t=0;t<e.length;t++)JR(this,e[t])}createNewPieces(e){if(e.length>nP){const t=[];for(;e.length>nP;){const i=e.charCodeAt(65534);let n;13===i||i>=55296&&i<=56319?(n=e.substring(0,65534),e=e.substring(65534)):(n=e.substring(0,nP),e=e.substring(nP));const o=rP(n);t.push(new aP(this._buffers.length,{line:0,column:0},{line:o.length-1,column:n.length-o[o.length-1]},o.length-1,n.length)),this._buffers.push(new lP(n,o))}const i=rP(e);return t.push(new aP(this._buffers.length,{line:0,column:0},{line:i.length-1,column:e.length-i[i.length-1]},i.length-1,e.length)),this._buffers.push(new lP(e,i)),t}let t=this._buffers[0].buffer.length;const i=rP(e,!1);let n=this._lastChangeBufferPos;if(this._buffers[0].lineStarts[this._buffers[0].lineStarts.length-1]===t&&0!==t&&this.startWithLF(e)&&this.endWithCR(this._buffers[0].buffer)){this._lastChangeBufferPos={line:this._lastChangeBufferPos.line,column:this._lastChangeBufferPos.column+1},n=this._lastChangeBufferPos;for(let e=0;e<i.length;e++)i[e]+=t+1;this._buffers[0].lineStarts=this._buffers[0].lineStarts.concat(i.slice(1)),this._buffers[0].buffer+="_"+e,t+=1}else{if(0!==t)for(let e=0;e<i.length;e++)i[e]+=t;this._buffers[0].lineStarts=this._buffers[0].lineStarts.concat(i.slice(1)),this._buffers[0].buffer+=e}const o=this._buffers[0].buffer.length,s=this._buffers[0].lineStarts.length-1,r={line:s,column:o-this._buffers[0].lineStarts[s]},a=new aP(0,n,r,this.getLineFeedCnt(0,n,r),o-t);return this._lastChangeBufferPos=r,[a]}getLineRawContent(e,t=0){let i=this.root,n="";const o=this._searchCache.get2(e);if(o){i=o.node;const s=this.getAccumulatedValue(i,e-o.nodeStartLineNumber-1),r=this._buffers[i.piece.bufferIndex].buffer,a=this.offsetInBuffer(i.piece.bufferIndex,i.piece.start);if(o.nodeStartLineNumber+i.piece.lineFeedCnt!==e){const n=this.getAccumulatedValue(i,e-o.nodeStartLineNumber);return r.substring(a+s,a+n-t)}n=r.substring(a+s,a+i.piece.length)}else{let o=0;const s=e;for(;i!==$R;)if(i.left!==$R&&i.lf_left>=e-1)i=i.left;else{if(i.lf_left+i.piece.lineFeedCnt>e-1){const n=this.getAccumulatedValue(i,e-i.lf_left-2),r=this.getAccumulatedValue(i,e-i.lf_left-1),a=this._buffers[i.piece.bufferIndex].buffer,l=this.offsetInBuffer(i.piece.bufferIndex,i.piece.start);return o+=i.size_left,this._searchCache.set({node:i,nodeStartOffset:o,nodeStartLineNumber:s-(e-1-i.lf_left)}),a.substring(l+n,l+r-t)}if(i.lf_left+i.piece.lineFeedCnt===e-1){const t=this.getAccumulatedValue(i,e-i.lf_left-2),o=this._buffers[i.piece.bufferIndex].buffer,s=this.offsetInBuffer(i.piece.bufferIndex,i.piece.start);n=o.substring(s+t,s+i.piece.length);break}e-=i.lf_left+i.piece.lineFeedCnt,o+=i.size_left+i.piece.length,i=i.right}}for(i=i.next();i!==$R;){const e=this._buffers[i.piece.bufferIndex].buffer;if(i.piece.lineFeedCnt>0){const o=this.getAccumulatedValue(i,0),s=this.offsetInBuffer(i.piece.bufferIndex,i.piece.start);return n+=e.substring(s,s+o-t),n}{const t=this.offsetInBuffer(i.piece.bufferIndex,i.piece.start);n+=e.substr(t,i.piece.length)}i=i.next()}return n}computeBufferMetadata(){let e=this.root,t=1,i=0;for(;e!==$R;)t+=e.lf_left+e.piece.lineFeedCnt,i+=e.size_left+e.piece.length,e=e.right;this._lineCnt=t,this._length=i,this._searchCache.validate(this._length)}getIndexOf(e,t){const i=e.piece,n=this.positionInBuffer(e,t),o=n.line-i.start.line;if(this.offsetInBuffer(i.bufferIndex,i.end)-this.offsetInBuffer(i.bufferIndex,i.start)===t){const t=this.getLineFeedCnt(e.piece.bufferIndex,i.start,n);if(t!==o)return{index:t,remainder:0}}return{index:o,remainder:n.column}}getAccumulatedValue(e,t){if(t<0)return 0;const i=e.piece,n=this._buffers[i.bufferIndex].lineStarts,o=i.start.line+t+1;return o>i.end.line?n[i.end.line]+i.end.column-n[i.start.line]-i.start.column:n[o]-n[i.start.line]-i.start.column}deleteNodeTail(e,t){const i=e.piece,n=i.lineFeedCnt,o=this.offsetInBuffer(i.bufferIndex,i.end),s=t,r=this.offsetInBuffer(i.bufferIndex,s),a=this.getLineFeedCnt(i.bufferIndex,i.start,s),l=a-n,d=r-o,c=i.length+d;e.piece=new aP(i.bufferIndex,i.start,s,a,c),tP(this,e,d,l)}deleteNodeHead(e,t){const i=e.piece,n=i.lineFeedCnt,o=this.offsetInBuffer(i.bufferIndex,i.start),s=t,r=this.getLineFeedCnt(i.bufferIndex,s,i.end),a=r-n,l=o-this.offsetInBuffer(i.bufferIndex,s),d=i.length+l;e.piece=new aP(i.bufferIndex,s,i.end,r,d),tP(this,e,l,a)}shrinkNode(e,t,i){const n=e.piece,o=n.start,s=n.end,r=n.length,a=n.lineFeedCnt,l=t,d=this.getLineFeedCnt(n.bufferIndex,n.start,l),c=this.offsetInBuffer(n.bufferIndex,t)-this.offsetInBuffer(n.bufferIndex,o);e.piece=new aP(n.bufferIndex,n.start,l,d,c),tP(this,e,c-r,d-a);const h=new aP(n.bufferIndex,i,s,this.getLineFeedCnt(n.bufferIndex,i,s),this.offsetInBuffer(n.bufferIndex,s)-this.offsetInBuffer(n.bufferIndex,i)),u=this.rbInsertRight(e,h);this.validateCRLFWithPrevNode(u)}appendToNode(e,t){this.adjustCarriageReturnFromNext(t,e)&&(t+="\n");const i=this.shouldCheckCRLF()&&this.startWithLF(t)&&this.endWithCR(e),n=this._buffers[0].buffer.length;this._buffers[0].buffer+=t;const o=rP(t,!1);for(let h=0;h<o.length;h++)o[h]+=n;if(i){const e=this._buffers[0].lineStarts[this._buffers[0].lineStarts.length-2];this._buffers[0].lineStarts.pop(),this._lastChangeBufferPos={line:this._lastChangeBufferPos.line-1,column:n-e}}this._buffers[0].lineStarts=this._buffers[0].lineStarts.concat(o.slice(1));const s=this._buffers[0].lineStarts.length-1,r={line:s,column:this._buffers[0].buffer.length-this._buffers[0].lineStarts[s]},a=e.piece.length+t.length,l=e.piece.lineFeedCnt,d=this.getLineFeedCnt(0,e.piece.start,r),c=d-l;e.piece=new aP(e.piece.bufferIndex,e.piece.start,r,d,a),this._lastChangeBufferPos=r,tP(this,e,t.length,c)}nodeAt(e){let t=this.root;const i=this._searchCache.get(e);if(i)return{node:i.node,nodeStartOffset:i.nodeStartOffset,remainder:e-i.nodeStartOffset};let n=0;for(;t!==$R;)if(t.size_left>e)t=t.left;else{if(t.size_left+t.piece.length>=e){n+=t.size_left;const i={node:t,remainder:e-t.size_left,nodeStartOffset:n};return this._searchCache.set(i),i}e-=t.size_left+t.piece.length,n+=t.size_left+t.piece.length,t=t.right}return null}nodeAt2(e,t){let i=this.root,n=0;for(;i!==$R;)if(i.left!==$R&&i.lf_left>=e-1)i=i.left;else{if(i.lf_left+i.piece.lineFeedCnt>e-1){const o=this.getAccumulatedValue(i,e-i.lf_left-2),s=this.getAccumulatedValue(i,e-i.lf_left-1);return n+=i.size_left,{node:i,remainder:Math.min(o+t-1,s),nodeStartOffset:n}}if(i.lf_left+i.piece.lineFeedCnt===e-1){const o=this.getAccumulatedValue(i,e-i.lf_left-2);if(o+t-1<=i.piece.length)return{node:i,remainder:o+t-1,nodeStartOffset:n};t-=i.piece.length-o;break}e-=i.lf_left+i.piece.lineFeedCnt,n+=i.size_left+i.piece.length,i=i.right}for(i=i.next();i!==$R;){if(i.piece.lineFeedCnt>0){const e=this.getAccumulatedValue(i,0),n=this.offsetOfNode(i);return{node:i,remainder:Math.min(t-1,e),nodeStartOffset:n}}if(i.piece.length>=t-1){return{node:i,remainder:t-1,nodeStartOffset:this.offsetOfNode(i)}}t-=i.piece.length,i=i.next()}return null}nodeCharCodeAt(e,t){if(e.piece.lineFeedCnt<1)return-1;const i=this._buffers[e.piece.bufferIndex],n=this.offsetInBuffer(e.piece.bufferIndex,e.piece.start)+t;return i.buffer.charCodeAt(n)}offsetOfNode(e){if(!e)return 0;let t=e.size_left;for(;e!==this.root;)e.parent.right===e&&(t+=e.parent.size_left+e.parent.piece.length),e=e.parent;return t}shouldCheckCRLF(){return!(this._EOLNormalized&&"\n"===this._EOL)}startWithLF(e){if("string"==typeof e)return 10===e.charCodeAt(0);if(e===$R||0===e.piece.lineFeedCnt)return!1;const t=e.piece,i=this._buffers[t.bufferIndex].lineStarts,n=t.start.line,o=i[n]+t.start.column;if(n===i.length-1)return!1;return!(i[n+1]>o+1)&&10===this._buffers[t.bufferIndex].buffer.charCodeAt(o)}endWithCR(e){return"string"==typeof e?13===e.charCodeAt(e.length-1):e!==$R&&0!==e.piece.lineFeedCnt&&13===this.nodeCharCodeAt(e,e.piece.length-1)}validateCRLFWithPrevNode(e){if(this.shouldCheckCRLF()&&this.startWithLF(e)){const t=e.prev();this.endWithCR(t)&&this.fixCRLF(t,e)}}validateCRLFWithNextNode(e){if(this.shouldCheckCRLF()&&this.endWithCR(e)){const t=e.next();this.startWithLF(t)&&this.fixCRLF(e,t)}}fixCRLF(e,t){const i=[],n=this._buffers[e.piece.bufferIndex].lineStarts;let o;o=0===e.piece.end.column?{line:e.piece.end.line-1,column:n[e.piece.end.line]-n[e.piece.end.line-1]-1}:{line:e.piece.end.line,column:e.piece.end.column-1};const s=e.piece.length-1,r=e.piece.lineFeedCnt-1;e.piece=new aP(e.piece.bufferIndex,e.piece.start,o,r,s),tP(this,e,-1,-1),0===e.piece.length&&i.push(e);const a={line:t.piece.start.line+1,column:0},l=t.piece.length-1,d=this.getLineFeedCnt(t.piece.bufferIndex,a,t.piece.end);t.piece=new aP(t.piece.bufferIndex,a,t.piece.end,d,l),tP(this,t,-1,-1),0===t.piece.length&&i.push(t);const c=this.createNewPieces("\r\n");this.rbInsertRight(e,c[0]);for(let h=0;h<i.length;h++)JR(this,i[h])}adjustCarriageReturnFromNext(e,t){if(this.shouldCheckCRLF()&&this.endWithCR(e)){const i=t.next();if(this.startWithLF(i)){if(e+="\n",1===i.piece.length)JR(this,i);else{const e=i.piece,t={line:e.start.line+1,column:0},n=e.length-1,o=this.getLineFeedCnt(e.bufferIndex,t,e.end);i.piece=new aP(e.bufferIndex,t,e.end,o,n),tP(this,i,-1,-1)}return!0}}return!1}iterate(e,t){if(e===$R)return t($R);const i=this.iterate(e.left,t);return i?t(e)&&this.iterate(e.right,t):i}getNodeContent(e){if(e===$R)return"";const t=this._buffers[e.piece.bufferIndex];let i;const n=e.piece,o=this.offsetInBuffer(n.bufferIndex,n.start),s=this.offsetInBuffer(n.bufferIndex,n.end);return i=t.buffer.substring(o,s),i}getPieceContent(e){const t=this._buffers[e.bufferIndex],i=this.offsetInBuffer(e.bufferIndex,e.start),n=this.offsetInBuffer(e.bufferIndex,e.end);return t.buffer.substring(i,n)}rbInsertRight(e,t){const i=new UR(t,1);i.left=$R,i.right=$R,i.parent=$R,i.size_left=0,i.lf_left=0;if(this.root===$R)this.root=i,i.color=0;else if(e.right===$R)e.right=i,i.parent=e;else{const t=KR(e.right);t.left=i,i.parent=t}return eP(this,i),i}rbInsertLeft(e,t){const i=new UR(t,1);if(i.left=$R,i.right=$R,i.parent=$R,i.size_left=0,i.lf_left=0,this.root===$R)this.root=i,i.color=0;else if(e.left===$R)e.left=i,i.parent=e;else{const t=qR(e.left);t.right=i,i.parent=t}return eP(this,i),i}}function uP(e){let t=0,i=0,n=0,o=0;for(let s=0,r=e.length;s<r;s++){const a=e.charCodeAt(s);13===a?(0===t&&(i=s),t++,s+1<r&&10===e.charCodeAt(s+1)?(o|=2,s++):o|=3,n=s+1):10===a&&(o|=1,0===t&&(i=s),t++,n=s+1)}return 0===t&&(i=e.length),[t,i,e.length-n,o]}class gP extends Uo{constructor(e,t,i,n,o,s,r){super(),this._onDidChangeContent=this._register(new $o),this._BOM=t,this._mightContainNonBasicASCII=!s,this._mightContainRTL=n,this._mightContainUnusualLineTerminators=o,this._pieceTree=new hP(e,i,r)}mightContainRTL(){return this._mightContainRTL}mightContainUnusualLineTerminators(){return this._mightContainUnusualLineTerminators}resetMightContainUnusualLineTerminators(){this._mightContainUnusualLineTerminators=!1}mightContainNonBasicASCII(){return this._mightContainNonBasicASCII}getBOM(){return this._BOM}getEOL(){return this._pieceTree.getEOL()}createSnapshot(e){return this._pieceTree.createSnapshot(e?this._BOM:"")}getOffsetAt(e,t){return this._pieceTree.getOffsetAt(e,t)}getPositionAt(e){return this._pieceTree.getPositionAt(e)}getRangeAt(e,t){const i=e+t,n=this.getPositionAt(e),o=this.getPositionAt(i);return new qo(n.lineNumber,n.column,o.lineNumber,o.column)}getValueInRange(e,t=0){if(e.isEmpty())return"";const i=this._getEndOfLine(t);return this._pieceTree.getValueInRange(e,i)}getValueLengthInRange(e,t=0){if(e.isEmpty())return 0;if(e.startLineNumber===e.endLineNumber)return e.endColumn-e.startColumn;const i=this.getOffsetAt(e.startLineNumber,e.startColumn);return this.getOffsetAt(e.endLineNumber,e.endColumn)-i}getCharacterCountInRange(e,t=0){if(this._mightContainNonBasicASCII){let i=0;const n=e.startLineNumber,o=e.endLineNumber;for(let t=n;t<=o;t++){const s=this.getLineContent(t),r=t===n?e.startColumn-1:0,a=t===o?e.endColumn-1:s.length;for(let e=r;e<a;e++)Go(s.charCodeAt(e))?(i+=1,e+=1):i+=1}return i+=this._getEndOfLine(t).length*(o-n),i}return this.getValueLengthInRange(e,t)}getLength(){return this._pieceTree.getLength()}getLineCount(){return this._pieceTree.getLineCount()}getLinesContent(){return this._pieceTree.getLinesContent()}getLineContent(e){return this._pieceTree.getLineContent(e)}getLineCharCode(e,t){return this._pieceTree.getLineCharCode(e,t)}getLineLength(e){return this._pieceTree.getLineLength(e)}getLineFirstNonWhitespaceColumn(e){const t=xs(this.getLineContent(e));return-1===t?0:t+1}getLineLastNonWhitespaceColumn(e){const t=Ss(this.getLineContent(e));return-1===t?0:t+2}_getEndOfLine(e){switch(e){case 1:return"\n";case 2:return"\r\n";case 0:return this.getEOL();default:throw new Error("Unknown EOL preference")}}setEOL(e){this._pieceTree.setEOL(e)}applyEdits(e,t,i){let n=this._mightContainRTL,o=this._mightContainUnusualLineTerminators,s=this._mightContainNonBasicASCII,r=!0,a=[];for(let p=0;p<e.length;p++){const t=e[p];r&&t._isTracked&&(r=!1);const i=t.range;if(t.text){let e=!0;s||(e=!Ds(t.text),s=e),!n&&e&&(n=Ls(t.text)),!o&&e&&(o=Yr(t.text))}let l="",d=0,c=0,h=0;if(t.text){let e;[d,c,h,e]=uP(t.text);const i=this.getEOL(),n="\r\n"===i?2:1;l=0===e||e===n?t.text:t.text.replace(/\r\n|\r|\n/g,i)}a[p]={sortIndex:p,identifier:t.identifier||null,range:i,rangeOffset:this.getOffsetAt(i.startLineNumber,i.startColumn),rangeLength:this.getValueLengthInRange(i),text:l,eolCount:d,firstLineLength:c,lastLineLength:h,forceMoveMarkers:Boolean(t.forceMoveMarkers),isAutoWhitespaceEdit:t.isAutoWhitespaceEdit||!1}}a.sort(gP._sortOpsAscending);let l=!1;for(let p=0,m=a.length-1;p<m;p++){const e=a[p].range.getEndPosition(),t=a[p+1].range.getStartPosition();if(t.isBeforeOrEqual(e)){if(t.isBefore(e))throw new Error("Overlapping ranges are not allowed!");l=!0}}r&&(a=this._reduceOperations(a));const d=i||t?gP._getInverseEditRanges(a):[],c=[];if(t)for(let p=0;p<a.length;p++){const e=a[p],t=d[p];if(e.isAutoWhitespaceEdit&&e.range.isEmpty())for(let i=t.startLineNumber;i<=t.endLineNumber;i++){let n="";i===t.startLineNumber&&(n=this.getLineContent(e.range.startLineNumber),-1!==xs(n))||c.push({lineNumber:i,oldContent:n})}}let h=null;if(i){let e=0;h=[];for(let t=0;t<a.length;t++){const i=a[t],n=d[t],o=this.getValueInRange(i.range),s=i.rangeOffset+e;e+=i.text.length-o.length,h[t]={sortIndex:i.sortIndex,identifier:i.identifier,range:n,text:o,textChange:new $O(i.rangeOffset,o,s,i.text)}}l||h.sort(((e,t)=>e.sortIndex-t.sortIndex))}this._mightContainRTL=n,this._mightContainUnusualLineTerminators=o,this._mightContainNonBasicASCII=s;const u=this._doApplyEdits(a);let g=null;if(t&&c.length>0){c.sort(((e,t)=>t.lineNumber-e.lineNumber)),g=[];for(let e=0,t=c.length;e<t;e++){const t=c[e].lineNumber;if(e>0&&c[e-1].lineNumber===t)continue;const i=c[e].oldContent,n=this.getLineContent(t);0!==n.length&&n!==i&&-1===xs(n)&&g.push(t)}}return this._onDidChangeContent.fire(),new Xr(h,u,g)}_reduceOperations(e){return e.length<1e3?e:[this._toSingleEditOperation(e)]}_toSingleEditOperation(e){let t=!1;const i=e[0].range,n=e[e.length-1].range,o=new qo(i.startLineNumber,i.startColumn,n.endLineNumber,n.endColumn);let s=i.startLineNumber,r=i.startColumn;const a=[];for(let u=0,g=e.length;u<g;u++){const i=e[u],n=i.range;t=t||i.forceMoveMarkers,a.push(this.getValueInRange(new qo(s,r,n.startLineNumber,n.startColumn))),i.text.length>0&&a.push(i.text),s=n.endLineNumber,r=n.endColumn}const l=a.join(""),[d,c,h]=uP(l);return{sortIndex:0,identifier:e[0].identifier,range:o,rangeOffset:this.getOffsetAt(o.startLineNumber,o.startColumn),rangeLength:this.getValueLengthInRange(o,0),text:l,eolCount:d,firstLineLength:c,lastLineLength:h,forceMoveMarkers:t,isAutoWhitespaceEdit:!1}}_doApplyEdits(e){e.sort(gP._sortOpsDescending);const t=[];for(let i=0;i<e.length;i++){const n=e[i],o=n.range.startLineNumber,s=n.range.startColumn,r=n.range.endLineNumber,a=n.range.endColumn;if(o===r&&s===a&&0===n.text.length)continue;n.text?(this._pieceTree.delete(n.rangeOffset,n.rangeLength),this._pieceTree.insert(n.rangeOffset,n.text,!0)):this._pieceTree.delete(n.rangeOffset,n.rangeLength);const l=new qo(o,s,r,a);t.push({range:l,rangeLength:n.rangeLength,text:n.text,rangeOffset:n.rangeOffset,forceMoveMarkers:n.forceMoveMarkers})}return t}findMatchesLineByLine(e,t,i,n){return this._pieceTree.findMatchesLineByLine(e,t,i,n)}static _getInverseEditRanges(e){const t=[];let i=0,n=0,o=null;for(let s=0,r=e.length;s<r;s++){const r=e[s];let a,l,d;if(o?o.range.endLineNumber===r.range.startLineNumber?(a=i,l=n+(r.range.startColumn-o.range.endColumn)):(a=i+(r.range.startLineNumber-o.range.endLineNumber),l=r.range.startColumn):(a=r.range.startLineNumber,l=r.range.startColumn),r.text.length>0){const e=r.eolCount+1;d=1===e?new qo(a,l,a,l+r.firstLineLength):new qo(a,l,a+e-1,r.lastLineLength+1)}else d=new qo(a,l,a,l);i=d.endLineNumber,n=d.endColumn,t.push(d),o=r}return t}static _sortOpsAscending(e,t){const i=qo.compareRangesUsingEnds(e.range,t.range);return 0===i?e.sortIndex-t.sortIndex:i}static _sortOpsDescending(e,t){const i=qo.compareRangesUsingEnds(e.range,t.range);return 0===i?t.sortIndex-e.sortIndex:-i}}class pP{constructor(e,t,i,n,o,s,r,a,l){this._chunks=e,this._bom=t,this._cr=i,this._lf=n,this._crlf=o,this._containsRTL=s,this._containsUnusualLineTerminators=r,this._isBasicASCII=a,this._normalizeEOL=l}_getEOL(e){const t=this._cr+this._lf+this._crlf,i=this._cr+this._crlf;return 0===t?1===e?"\n":"\r\n":i>t/2?"\r\n":"\n"}create(e){const t=this._getEOL(e),i=this._chunks;if(this._normalizeEOL&&("\r\n"===t&&(this._cr>0||this._lf>0)||"\n"===t&&(this._cr>0||this._crlf>0)))for(let o=0,s=i.length;o<s;o++){const e=i[o].buffer.replace(/\r\n|\r|\n/g,t),n=rP(e);i[o]=new lP(e,n)}const n=new gP(i,this._bom,t,this._containsRTL,this._containsUnusualLineTerminators,this._isBasicASCII,this._normalizeEOL);return{textBuffer:n,disposable:n}}}class mP{constructor(){this.chunks=[],this.BOM="",this._hasPreviousChar=!1,this._previousChar=0,this._tmpLineStarts=[],this.cr=0,this.lf=0,this.crlf=0,this.containsRTL=!1,this.containsUnusualLineTerminators=!1,this.isBasicASCII=!0}acceptChunk(e){if(0===e.length)return;0===this.chunks.length&&Es(e)&&(this.BOM=Qr,e=e.substr(1));const t=e.charCodeAt(e.length-1);13===t||t>=55296&&t<=56319?(this._acceptChunk1(e.substr(0,e.length-1),!1),this._hasPreviousChar=!0,this._previousChar=t):(this._acceptChunk1(e,!1),this._hasPreviousChar=!1,this._previousChar=t)}_acceptChunk1(e,t){(t||0!==e.length)&&(this._hasPreviousChar?this._acceptChunk2(String.fromCharCode(this._previousChar)+e):this._acceptChunk2(e))}_acceptChunk2(e){const t=function(e,t){e.length=0,e[0]=0;let i=1,n=0,o=0,s=0,r=!0;for(let l=0,d=t.length;l<d;l++){const a=t.charCodeAt(l);13===a?l+1<d&&10===t.charCodeAt(l+1)?(s++,e[i++]=l+2,l++):(n++,e[i++]=l+1):10===a?(o++,e[i++]=l+1):r&&9!==a&&(a<32||a>126)&&(r=!1)}const a=new sP(oP(e),n,o,s,r);return e.length=0,a}(this._tmpLineStarts,e);this.chunks.push(new lP(e,t.lineStarts)),this.cr+=t.cr,this.lf+=t.lf,this.crlf+=t.crlf,this.isBasicASCII&&(this.isBasicASCII=t.isBasicASCII),this.isBasicASCII||this.containsRTL||(this.containsRTL=Ls(e)),this.isBasicASCII||this.containsUnusualLineTerminators||(this.containsUnusualLineTerminators=Yr(e))}finish(e=!0){return this._finish(),new pP(this.chunks,this.BOM,this.cr,this.lf,this.crlf,this.containsRTL,this.containsUnusualLineTerminators,this.isBasicASCII,e)}_finish(){if(0===this.chunks.length&&this._acceptChunk1("",!0),this._hasPreviousChar){this._hasPreviousChar=!1;const e=this.chunks[this.chunks.length-1];e.buffer+=String.fromCharCode(this._previousChar);const t=rP(e.buffer);e.lineStarts=t,13===this._previousChar&&this.cr++}}}class fP{constructor(e,t){this._startLineNumber=e,this._tokens=t}get startLineNumber(){return this._startLineNumber}get endLineNumber(){return this._startLineNumber+this._tokens.length-1}getLineTokens(e){return this._tokens[e-this._startLineNumber]}appendLineTokens(e){this._tokens.push(e)}}class _P{constructor(){this._tokens=[]}add(e,t){if(this._tokens.length>0){const i=this._tokens[this._tokens.length-1];if(i.endLineNumber+1===e)return void i.appendLineTokens(t)}this._tokens.push(new fP(e,[t]))}finalize(){return this._tokens}}class vP{constructor(e){this._default=e,this._store=[]}get(e){return e<this._store.length?this._store[e]:this._default}set(e,t){for(;e>=this._store.length;)this._store[this._store.length]=this._default;this._store[e]=t}delete(e,t){0===t||e>=this._store.length||this._store.splice(e,t)}insert(e,t){if(0===t||e>=this._store.length)return;const i=[];for(let n=0;n<t;n++)i[n]=this._default;this._store=Jr(this._store,e,i)}}class bP{constructor(e,t){this.tokenizationSupport=e,this.initialState=t,this._lineBeginState=new vP(null),this._lineNeedsTokenization=new vP(!0),this._firstLineNeedsTokenization=0,this._lineBeginState.set(0,this.initialState)}get invalidLineStartIndex(){return this._firstLineNeedsTokenization}markMustBeTokenized(e){this._lineNeedsTokenization.set(e,!0),this._firstLineNeedsTokenization=Math.min(this._firstLineNeedsTokenization,e)}getBeginState(e){return this._lineBeginState.get(e)}setEndState(e,t,i){if(this._lineNeedsTokenization.set(t,!1),this._firstLineNeedsTokenization=t+1,t===e-1)return;const n=this._lineBeginState.get(t+1);if(null===n||!i.equals(n))return this._lineBeginState.set(t+1,i),void this.markMustBeTokenized(t+1);let o=t+1;for(;o<e&&!this._lineNeedsTokenization.get(o);)o++;this._firstLineNeedsTokenization=o}applyEdits(e,t){this.markMustBeTokenized(e.startLineNumber-1),this._lineBeginState.delete(e.startLineNumber,e.endLineNumber-e.startLineNumber),this._lineNeedsTokenization.delete(e.startLineNumber,e.endLineNumber-e.startLineNumber),this._lineBeginState.insert(e.startLineNumber,t),this._lineNeedsTokenization.insert(e.startLineNumber,t)}}class wP extends Uo{constructor(e,t){super(),this._textModel=e,this._languageIdCodec=t,this._isScheduled=!1,this._isDisposed=!1,this._tokenizationStateStore=null,this._register(Ns.onDidChange((e=>{const t=this._textModel.getLanguageId();-1!==e.changedLanguages.indexOf(t)&&(this._resetTokenizationState(),this._textModel.clearTokens())}))),this._resetTokenizationState()}dispose(){this._isDisposed=!0,super.dispose()}handleDidChangeContent(e){if(e.isFlush)this._resetTokenizationState();else{if(this._tokenizationStateStore)for(let t=0,i=e.changes.length;t<i;t++){const i=e.changes[t],[n]=uP(i.text);this._tokenizationStateStore.applyEdits(i.range,n)}this._beginBackgroundTokenization()}}handleDidChangeAttached(){this._beginBackgroundTokenization()}handleDidChangeLanguage(e){this._resetTokenizationState(),this._textModel.clearTokens()}_resetTokenizationState(){const[e,t]=function(e){if(e.isTooLargeForTokenization())return[null,null];const t=Ns.get(e.getLanguageId());if(!t)return[null,null];let i;try{i=t.getInitialState()}catch(n){return Jo(n),[null,null]}return[t,i]}(this._textModel);this._tokenizationStateStore=e&&t?new bP(e,t):null,this._beginBackgroundTokenization()}_beginBackgroundTokenization(){!this._isScheduled&&this._textModel.isAttachedToEditor()&&this._hasLinesToTokenize()&&(this._isScheduled=!0,db((e=>{this._isScheduled=!1,this._backgroundTokenizeWithDeadline(e)})))}_backgroundTokenizeWithDeadline(e){const t=Date.now()+e.timeRemaining(),i=()=>{!this._isDisposed&&this._textModel.isAttachedToEditor()&&this._hasLinesToTokenize()&&(this._backgroundTokenizeForAtLeast1ms(),Date.now()<t?cs(i):this._beginBackgroundTokenization())};i()}_backgroundTokenizeForAtLeast1ms(){const e=this._textModel.getLineCount(),t=new _P,i=ps.create(!1);do{if(i.elapsed()>1)break;if(this._tokenizeOneInvalidLine(t)>=e)break}while(this._hasLinesToTokenize());this._textModel.setTokens(t.finalize(),!this._hasLinesToTokenize())}tokenizeViewport(e,t){const i=new _P;this._tokenizeViewport(i,e,t),this._textModel.setTokens(i.finalize(),!this._hasLinesToTokenize())}reset(){this._resetTokenizationState(),this._textModel.clearTokens()}forceTokenization(e){const t=new _P;this._updateTokensUntilLine(t,e),this._textModel.setTokens(t.finalize(),!this._hasLinesToTokenize())}getTokenTypeIfInsertingCharacter(e,t){if(!this._tokenizationStateStore)return 0;this.forceTokenization(e.lineNumber);const i=this._tokenizationStateStore.getBeginState(e.lineNumber-1);if(!i)return 0;const n=this._textModel.getLanguageId(),o=this._textModel.getLineContent(e.lineNumber),s=o.substring(0,e.column-1)+t+o.substring(e.column-1),r=CP(this._languageIdCodec,n,this._tokenizationStateStore.tokenizationSupport,s,!0,i),a=new zb(r.tokens,s,this._languageIdCodec);if(0===a.getCount())return 0;const l=a.findTokenIndexAtOffset(e.column-1);return a.getStandardTokenType(l)}tokenizeLineWithEdit(e,t,i){const n=e.lineNumber,o=e.column;if(!this._tokenizationStateStore)return null;this.forceTokenization(n);const s=this._tokenizationStateStore.getBeginState(n-1);if(!s)return null;const r=this._textModel.getLineContent(n),a=r.substring(0,o-1)+i+r.substring(o-1+t),l=this._textModel.getLanguageIdAtPosition(n,0),d=CP(this._languageIdCodec,l,this._tokenizationStateStore.tokenizationSupport,a,!0,s);return new zb(d.tokens,a,this._languageIdCodec)}isCheapToTokenize(e){if(!this._tokenizationStateStore)return!0;const t=this._tokenizationStateStore.invalidLineStartIndex+1;return!(e>t)&&(e<t||this._textModel.getLineLength(e)<2048)}_hasLinesToTokenize(){return!!this._tokenizationStateStore&&this._tokenizationStateStore.invalidLineStartIndex<this._textModel.getLineCount()}_tokenizeOneInvalidLine(e){if(!this._tokenizationStateStore||!this._hasLinesToTokenize())return this._textModel.getLineCount()+1;const t=this._tokenizationStateStore.invalidLineStartIndex+1;return this._updateTokensUntilLine(e,t),t}_updateTokensUntilLine(e,t){if(!this._tokenizationStateStore)return;const i=this._textModel.getLanguageId(),n=this._textModel.getLineCount(),o=t-1;for(let s=this._tokenizationStateStore.invalidLineStartIndex;s<=o;s++){const t=this._textModel.getLineContent(s+1),o=this._tokenizationStateStore.getBeginState(s),r=CP(this._languageIdCodec,i,this._tokenizationStateStore.tokenizationSupport,t,!0,o);e.add(s+1,r.tokens),this._tokenizationStateStore.setEndState(n,s,r.endState),s=this._tokenizationStateStore.invalidLineStartIndex-1}}_tokenizeViewport(e,t,i){if(!this._tokenizationStateStore)return;if(i<=this._tokenizationStateStore.invalidLineStartIndex)return;if(t<=this._tokenizationStateStore.invalidLineStartIndex)return void this._updateTokensUntilLine(e,i);let n=this._textModel.getLineFirstNonWhitespaceColumn(t);const o=[];let s=null;for(let l=t-1;n>1&&l>=1;l--){const e=this._textModel.getLineFirstNonWhitespaceColumn(l);if(0!==e&&e<n){if(s=this._tokenizationStateStore.getBeginState(l-1),s)break;o.push(this._textModel.getLineContent(l)),n=e}}s||(s=this._tokenizationStateStore.initialState);const r=this._textModel.getLanguageId();let a=s;for(let l=o.length-1;l>=0;l--){a=CP(this._languageIdCodec,r,this._tokenizationStateStore.tokenizationSupport,o[l],!1,a).endState}for(let l=t;l<=i;l++){const t=this._textModel.getLineContent(l),i=CP(this._languageIdCodec,r,this._tokenizationStateStore.tokenizationSupport,t,!0,a);e.add(l,i.tokens),this._tokenizationStateStore.markMustBeTokenized(l-1),a=i.endState}}}function CP(e,t,i,n,o,s){let r=null;if(i)try{r=i.tokenizeEncoded(n,o,s.clone())}catch(a){Jo(a)}return r||(r=qv(e.encodeLanguageId(t),s)),zb.convertToEndOffset(r.tokens,n.length),r}const yP=new Uint32Array(0).buffer;class xP{static deleteBeginning(e,t){return null===e||e===yP?e:xP.delete(e,0,t)}static deleteEnding(e,t){if(null===e||e===yP)return e;const i=SP(e),n=i[i.length-2];return xP.delete(e,t,n)}static delete(e,t,i){if(null===e||e===yP||t===i)return e;const n=SP(e),o=n.length>>>1;if(0===t&&n[n.length-2]===i)return yP;const s=zb.findIndexInTokensArray(n,t),r=s>0?n[s-1<<1]:0;if(i<n[s<<1]){const r=i-t;for(let e=s;e<o;e++)n[e<<1]-=r;return e}let a,l;r!==t?(n[s<<1]=t,a=s+1<<1,l=t):(a=s<<1,l=r);const d=i-t;for(let h=s+1;h<o;h++){const e=n[h<<1]-d;e>l&&(n[a++]=e,n[a++]=n[1+(h<<1)],l=e)}if(a===n.length)return e;const c=new Uint32Array(a);return c.set(n.subarray(0,a),0),c.buffer}static append(e,t){if(t===yP)return e;if(e===yP)return t;if(null===e)return e;if(null===t)return null;const i=SP(e),n=SP(t),o=n.length>>>1,s=new Uint32Array(i.length+n.length);s.set(i,0);let r=i.length;const a=i[i.length-2];for(let l=0;l<o;l++)s[r++]=n[l<<1]+a,s[r++]=n[1+(l<<1)];return s.buffer}static insert(e,t,i){if(null===e||e===yP)return e;const n=SP(e),o=n.length>>>1;let s=zb.findIndexInTokensArray(n,t);if(s>0){n[s-1<<1]===t&&s--}for(let r=s;r<o;r++)n[r<<1]+=i;return e}}function SP(e){return e instanceof Uint32Array?e:new Uint32Array(e)}class kP{constructor(e){this._lineTokens=[],this._len=0,this._languageIdCodec=e}flush(){this._lineTokens=[],this._len=0}getTokens(e,t,i){let n=null;if(t<this._len&&(n=this._lineTokens[t]),null!==n&&n!==yP)return new zb(SP(n),i,this._languageIdCodec);const o=new Uint32Array(2);return o[0]=i.length,o[1]=DP(this._languageIdCodec.encodeLanguageId(e)),new zb(o,i,this._languageIdCodec)}static _massageTokens(e,t,i){const n=i?SP(i):null;if(0===t){let t=!1;if(n&&n.length>1&&(t=ys.getLanguageId(n[1])!==e),!t)return yP}if(!n||0===n.length){const i=new Uint32Array(2);return i[0]=t,i[1]=DP(e),i.buffer}return n[n.length-2]=t,0===n.byteOffset&&n.byteLength===n.buffer.byteLength?n.buffer:n}_ensureLine(e){for(;e>=this._len;)this._lineTokens[this._len]=null,this._len++}_deleteLines(e,t){0!==t&&(e+t>this._len&&(t=this._len-e),this._lineTokens.splice(e,t),this._len-=t)}_insertLines(e,t){if(0===t)return;const i=[];for(let n=0;n<t;n++)i[n]=null;this._lineTokens=Jr(this._lineTokens,e,i),this._len+=t}setTokens(e,t,i,n,o){const s=kP._massageTokens(this._languageIdCodec.encodeLanguageId(e),i,n);this._ensureLine(t);const r=this._lineTokens[t];return this._lineTokens[t]=s,!!o&&!kP._equals(r,s)}static _equals(e,t){if(!e||!t)return!e&&!t;const i=SP(e),n=SP(t);if(i.length!==n.length)return!1;for(let o=0,s=i.length;o<s;o++)if(i[o]!==n[o])return!1;return!0}acceptEdit(e,t,i){this._acceptDeleteRange(e),this._acceptInsertText(new er(e.startLineNumber,e.startColumn),t,i)}_acceptDeleteRange(e){const t=e.startLineNumber-1;if(t>=this._len)return;if(e.startLineNumber===e.endLineNumber){if(e.startColumn===e.endColumn)return;return void(this._lineTokens[t]=xP.delete(this._lineTokens[t],e.startColumn-1,e.endColumn-1))}this._lineTokens[t]=xP.deleteEnding(this._lineTokens[t],e.startColumn-1);const i=e.endLineNumber-1;let n=null;i<this._len&&(n=xP.deleteBeginning(this._lineTokens[i],e.endColumn-1)),this._lineTokens[t]=xP.append(this._lineTokens[t],n),this._deleteLines(e.startLineNumber,e.endLineNumber-e.startLineNumber)}_acceptInsertText(e,t,i){if(0===t&&0===i)return;const n=e.lineNumber-1;n>=this._len||(0!==t?(this._lineTokens[n]=xP.deleteEnding(this._lineTokens[n],e.column-1),this._lineTokens[n]=xP.insert(this._lineTokens[n],e.column-1,i),this._insertLines(e.lineNumber,t)):this._lineTokens[n]=xP.insert(this._lineTokens[n],e.column-1,i))}}function DP(e){return(16384|e<<0|2<<23)>>>0}class LP{constructor(e){this._pieces=[],this._isComplete=!1,this._languageIdCodec=e}flush(){this._pieces=[],this._isComplete=!1}isEmpty(){return 0===this._pieces.length}set(e,t){this._pieces=e||[],this._isComplete=t}setPartial(e,t){let i=e;if(t.length>0){const n=t[0].getRange(),o=t[t.length-1].getRange();if(!n||!o)return e;i=e.plusRange(n).plusRange(o)}let n=null;for(let o=0,s=this._pieces.length;o<s;o++){const e=this._pieces[o];if(e.endLineNumber<i.startLineNumber)continue;if(e.startLineNumber>i.endLineNumber){n=n||{index:o};break}if(e.removeTokens(i),e.isEmpty()){this._pieces.splice(o,1),o--,s--;continue}if(e.endLineNumber<i.startLineNumber)continue;if(e.startLineNumber>i.endLineNumber){n=n||{index:o};continue}const[t,r]=e.split(i);t.isEmpty()?n=n||{index:o}:r.isEmpty()||(this._pieces.splice(o,1,t,r),o++,s++,n=n||{index:o})}return n=n||{index:this._pieces.length},t.length>0&&(this._pieces=Jr(this._pieces,n.index,t)),i}isComplete(){return this._isComplete}addSparseTokens(e,t){const i=this._pieces;if(0===i.length)return t;const n=i[LP._findFirstPieceWithLine(i,e)].getLineTokens(e);if(!n)return t;const o=t.getCount(),s=n.getCount();let r=0;const a=[];let l=0,d=0;const c=(e,t)=>{e!==d&&(d=e,a[l++]=e,a[l++]=t)};for(let h=0;h<s;h++){const e=n.getStartCharacter(h),i=n.getEndCharacter(h),s=n.getMetadata(h),a=((1&s?1024:0)|(2&s?2048:0)|(4&s?4096:0)|(8&s?8192:0)|(16&s?8372224:0)|(32&s?4286578688:0))>>>0,l=~a>>>0;for(;r<o&&t.getEndOffset(r)<=e;)c(t.getEndOffset(r),t.getMetadata(r)),r++;for(r<o&&t.getStartOffset(r)<e&&c(e,t.getMetadata(r));r<o&&t.getEndOffset(r)<i;)c(t.getEndOffset(r),t.getMetadata(r)&l|s&a),r++;if(r<o)c(i,t.getMetadata(r)&l|s&a),t.getEndOffset(r)===i&&r++;else{const e=Math.min(Math.max(0,r-1),o-1);c(i,t.getMetadata(e)&l|s&a)}}for(;r<o;)c(t.getEndOffset(r),t.getMetadata(r)),r++;return new zb(new Uint32Array(a),t.getLineContent(),this._languageIdCodec)}static _findFirstPieceWithLine(e,t){let i=0,n=e.length-1;for(;i<n;){let o=i+Math.floor((n-i)/2);if(e[o].endLineNumber<t)i=o+1;else{if(!(e[o].startLineNumber>t)){for(;o>i&&e[o-1].startLineNumber<=t&&t<=e[o-1].endLineNumber;)o--;return o}n=o-1}}return i}acceptEdit(e,t,i,n,o){for(const s of this._pieces)s.acceptEdit(e,t,i,n,o)}}const NP=L_("undoRedoService");class EP{constructor(e,t){this.resource=e,this.elements=t}}class IP{constructor(){this.id=IP._ID++,this.order=1}nextOrder(){return 0===this.id?0:this.order++}}IP._ID=0,IP.None=new IP;class TP{constructor(){this.id=TP._ID++,this.order=1}nextOrder(){return 0===this.id?0:this.order++}}TP._ID=0,TP.None=new TP;var MP=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},AP=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};function OP(e){const t=new mP;return t.acceptChunk(e),t.finish()}function RP(e,t){return("string"==typeof e?OP(e):e).create(t)}let PP=0;class FP{constructor(e){this._source=e,this._eos=!1}read(){if(this._eos)return null;const e=[];let t=0,i=0;for(;;){const n=this._source.read();if(null===n)return this._eos=!0,0===t?null:e.join("");if(n.length>0&&(e[t++]=n,i+=n.length),i>=65536)return e.join("")}}}const BP=()=>{throw new Error("Invalid change accessor")};let VP=class e extends Uo{constructor(t,i,n,o=null,s,r,a){super(),this._undoRedoService=s,this._languageService=r,this._languageConfigurationService=a,this._onWillDispose=this._register(new $o),this.onWillDispose=this._onWillDispose.event,this._onDidChangeDecorations=this._register(new XP((e=>this.handleBeforeFireDecorationsChangedEvent(e)))),this.onDidChangeDecorations=this._onDidChangeDecorations.event,this._onDidChangeLanguage=this._register(new $o),this.onDidChangeLanguage=this._onDidChangeLanguage.event,this._onDidChangeLanguageConfiguration=this._register(new $o),this.onDidChangeLanguageConfiguration=this._onDidChangeLanguageConfiguration.event,this._onDidChangeTokens=this._register(new $o),this.onDidChangeTokens=this._onDidChangeTokens.event,this._onDidChangeOptions=this._register(new $o),this.onDidChangeOptions=this._onDidChangeOptions.event,this._onDidChangeAttached=this._register(new $o),this.onDidChangeAttached=this._onDidChangeAttached.event,this._onDidChangeInjectedText=this._register(new $o),this._eventEmitter=this._register(new QP),this._backgroundTokenizationState=0,this._onBackgroundTokenizationStateChanged=this._register(new $o),PP++,this.id="$model"+PP,this.isForSimpleWidget=n.isForSimpleWidget,this._associatedResource=null==o?Ps.parse("inmemory://model/"+PP):o,this._attachedEditorCount=0;const{textBuffer:l,disposable:d}=RP(t,n.defaultEOL);this._buffer=l,this._bufferDisposable=d,this._options=e.resolveOptions(this._buffer,n);const c=this._buffer.getLineCount(),h=this._buffer.getValueLengthInRange(new qo(1,1,c,this._buffer.getLineLength(c)+1),0);n.largeFileOptimizations?this._isTooLargeForTokenization=h>e.LARGE_FILE_SIZE_THRESHOLD||c>e.LARGE_FILE_LINE_COUNT_THRESHOLD:this._isTooLargeForTokenization=!1,this._isTooLargeForSyncing=h>e.MODEL_SYNC_LIMIT,this._versionId=1,this._alternativeVersionId=1,this._initialUndoRedoSnapshot=null,this._isDisposed=!1,this._isDisposing=!1,this._languageId=i,this._languageRegistryListener=this._languageConfigurationService.onDidChange((e=>{e.affects(this._languageId)&&this._onDidChangeLanguageConfiguration.fire({})})),this._instanceId=Ar(PP),this._lastDecorationId=0,this._decorations=Object.create(null),this._decorationsTree=new HP,this._commandManager=new vR(this,this._undoRedoService),this._isUndoing=!1,this._isRedoing=!1,this._trimAutoWhitespaceLines=null,this._tokens=new kP(this._languageService.languageIdCodec),this._semanticTokens=new LP(this._languageService.languageIdCodec),this._tokenization=new wP(this,this._languageService.languageIdCodec),this._bracketPairColorizer=this._register(new BO(this,this._languageConfigurationService)),this._guidesTextModelPart=this._register(new kT(this,this._languageConfigurationService)),this._decorationProvider=this._register(new HO(this)),this._register(this._decorationProvider.onDidChange((()=>{this._onDidChangeDecorations.beginDeferredEmit(),this._onDidChangeDecorations.fire(),this._onDidChangeDecorations.endDeferredEmit()})))}static resolveOptions(e,t){if(t.detectIndentation){const i=CR(e,t.tabSize,t.insertSpaces);return new ea({tabSize:i.tabSize,indentSize:i.tabSize,insertSpaces:i.insertSpaces,trimAutoWhitespace:t.trimAutoWhitespace,defaultEOL:t.defaultEOL,bracketPairColorizationOptions:t.bracketPairColorizationOptions})}return new ea({tabSize:t.tabSize,indentSize:t.indentSize,insertSpaces:t.insertSpaces,trimAutoWhitespace:t.trimAutoWhitespace,defaultEOL:t.defaultEOL,bracketPairColorizationOptions:t.bracketPairColorizationOptions})}onDidChangeContent(e){return this._eventEmitter.slowEvent((t=>e(t.contentChangedEvent)))}onDidChangeContentOrInjectedText(e){return ta(this._eventEmitter.fastEvent((t=>e(t.rawContentChangedEvent))),this._onDidChangeInjectedText.event((t=>e(t))))}get bracketPairs(){return this._bracketPairColorizer}get guides(){return this._guidesTextModelPart}get backgroundTokenizationState(){return this._backgroundTokenizationState}handleTokenizationProgress(e){if(2===this._backgroundTokenizationState)return;const t=e?2:1;this._backgroundTokenizationState!==t&&(this._backgroundTokenizationState=t,this._bracketPairColorizer.handleDidChangeBackgroundTokenizationState(),this._onBackgroundTokenizationStateChanged.fire())}dispose(){this._isDisposing=!0,this._onWillDispose.fire(),this._languageRegistryListener.dispose(),this._tokenization.dispose(),this._isDisposed=!0,super.dispose(),this._bufferDisposable.dispose(),this._isDisposing=!1;const e=new gP([],"","\n",!1,!1,!0,!0);e.dispose(),this._buffer=e,this._bufferDisposable=Uo.None}_assertNotDisposed(){if(this._isDisposed)throw new Error("Model is disposed!")}_emitContentChangedEvent(e,t){this._isDisposing||(this._bracketPairColorizer.handleDidChangeContent(t),this._tokenization.handleDidChangeContent(t),this._eventEmitter.fire(new AM(e,t)))}setValue(e){if(this._assertNotDisposed(),null===e)return;const{textBuffer:t,disposable:i}=RP(e,this._options.defaultEOL);this._setValueFromTextBuffer(t,i)}_createContentChanged2(e,t,i,n,o,s,r){return{changes:[{range:e,rangeOffset:t,rangeLength:i,text:n}],eol:this._buffer.getEOL(),versionId:this.getVersionId(),isUndoing:o,isRedoing:s,isFlush:r}}_setValueFromTextBuffer(e,t){this._assertNotDisposed();const i=this.getFullModelRange(),n=this.getValueLengthInRange(i),o=this.getLineCount(),s=this.getLineMaxColumn(o);this._buffer=e,this._bufferDisposable.dispose(),this._bufferDisposable=t,this._increaseVersionId(),this._tokens.flush(),this._semanticTokens.flush(),this._decorations=Object.create(null),this._decorationsTree=new HP,this._commandManager.clear(),this._trimAutoWhitespaceLines=null,this._emitContentChangedEvent(new TM([new kM],this._versionId,!1,!1),this._createContentChanged2(new qo(1,1,o,s),0,n,this.getValue(),!1,!1,!0))}setEOL(e){this._assertNotDisposed();const t=1===e?"\r\n":"\n";if(this._buffer.getEOL()===t)return;const i=this.getFullModelRange(),n=this.getValueLengthInRange(i),o=this.getLineCount(),s=this.getLineMaxColumn(o);this._onBeforeEOLChange(),this._buffer.setEOL(t),this._increaseVersionId(),this._onAfterEOLChange(),this._emitContentChangedEvent(new TM([new IM],this._versionId,!1,!1),this._createContentChanged2(new qo(1,1,o,s),0,n,this.getValue(),!1,!1,!1))}_onBeforeEOLChange(){this._decorationsTree.ensureAllNodesHaveRanges(this)}_onAfterEOLChange(){const e=this.getVersionId(),t=this._decorationsTree.collectNodesPostOrder();for(let i=0,n=t.length;i<n;i++){const n=t[i],o=n.range,s=n.cachedAbsoluteStart-n.start,r=this._buffer.getOffsetAt(o.startLineNumber,o.startColumn),a=this._buffer.getOffsetAt(o.endLineNumber,o.endColumn);n.cachedAbsoluteStart=r,n.cachedAbsoluteEnd=a,n.cachedVersionId=e,n.start=r-s,n.end=a-s,zR(n)}}onBeforeAttached(){this._attachedEditorCount++,1===this._attachedEditorCount&&(this._tokenization.handleDidChangeAttached(),this._onDidChangeAttached.fire(void 0))}onBeforeDetached(){this._attachedEditorCount--,0===this._attachedEditorCount&&(this._tokenization.handleDidChangeAttached(),this._onDidChangeAttached.fire(void 0))}isAttachedToEditor(){return this._attachedEditorCount>0}getAttachedEditorCount(){return this._attachedEditorCount}isTooLargeForSyncing(){return this._isTooLargeForSyncing}isTooLargeForTokenization(){return this._isTooLargeForTokenization}isDisposed(){return this._isDisposed}isDominatedByLongLines(){if(this._assertNotDisposed(),this.isTooLargeForTokenization())return!1;let e=0,t=0;const i=this._buffer.getLineCount();for(let n=1;n<=i;n++){const i=this._buffer.getLineLength(n);i>=1e4?t+=i:e+=i}return t>e}get uri(){return this._associatedResource}getOptions(){return this._assertNotDisposed(),this._options}getFormattingOptions(){return{tabSize:this._options.indentSize,insertSpaces:this._options.insertSpaces}}updateOptions(e){this._assertNotDisposed();const t=void 0!==e.tabSize?e.tabSize:this._options.tabSize,i=void 0!==e.indentSize?e.indentSize:this._options.indentSize,n=void 0!==e.insertSpaces?e.insertSpaces:this._options.insertSpaces,o=void 0!==e.trimAutoWhitespace?e.trimAutoWhitespace:this._options.trimAutoWhitespace,s=void 0!==e.bracketColorizationOptions?e.bracketColorizationOptions:this._options.bracketPairColorizationOptions,r=new ea({tabSize:t,indentSize:i,insertSpaces:n,defaultEOL:this._options.defaultEOL,trimAutoWhitespace:o,bracketPairColorizationOptions:s});if(this._options.equals(r))return;const a=this._options.createChangeEvent(r);this._options=r,this._bracketPairColorizer.handleDidChangeOptions(a),this._decorationProvider.handleDidChangeOptions(a),this._onDidChangeOptions.fire(a)}detectIndentation(e,t){this._assertNotDisposed();const i=CR(this._buffer,t,e);this.updateOptions({insertSpaces:i.insertSpaces,tabSize:i.tabSize,indentSize:i.tabSize})}normalizeIndentation(e){return this._assertNotDisposed(),zE(e,this._options.indentSize,this._options.insertSpaces)}getVersionId(){return this._assertNotDisposed(),this._versionId}mightContainRTL(){return this._buffer.mightContainRTL()}mightContainUnusualLineTerminators(){return this._buffer.mightContainUnusualLineTerminators()}removeUnusualLineTerminators(e=null){const t=this.findMatches(ia.source,!1,!0,!1,null,!1,1073741824);this._buffer.resetMightContainUnusualLineTerminators(),this.pushEditOperations(e,t.map((e=>({range:e.range,text:null}))),(()=>null))}mightContainNonBasicASCII(){return this._buffer.mightContainNonBasicASCII()}getAlternativeVersionId(){return this._assertNotDisposed(),this._alternativeVersionId}getInitialUndoRedoSnapshot(){return this._assertNotDisposed(),this._initialUndoRedoSnapshot}getOffsetAt(e){this._assertNotDisposed();const t=this._validatePosition(e.lineNumber,e.column,0);return this._buffer.getOffsetAt(t.lineNumber,t.column)}getPositionAt(e){this._assertNotDisposed();const t=Math.min(this._buffer.getLength(),Math.max(0,e));return this._buffer.getPositionAt(t)}_increaseVersionId(){this._versionId=this._versionId+1,this._alternativeVersionId=this._versionId}_overwriteVersionId(e){this._versionId=e}_overwriteAlternativeVersionId(e){this._alternativeVersionId=e}_overwriteInitialUndoRedoSnapshot(e){this._initialUndoRedoSnapshot=e}getValue(e,t=!1){this._assertNotDisposed();const i=this.getFullModelRange(),n=this.getValueInRange(i,e);return t?this._buffer.getBOM()+n:n}createSnapshot(e=!1){return new FP(this._buffer.createSnapshot(e))}getValueLength(e,t=!1){this._assertNotDisposed();const i=this.getFullModelRange(),n=this.getValueLengthInRange(i,e);return t?this._buffer.getBOM().length+n:n}getValueInRange(e,t=0){return this._assertNotDisposed(),this._buffer.getValueInRange(this.validateRange(e),t)}getValueLengthInRange(e,t=0){return this._assertNotDisposed(),this._buffer.getValueLengthInRange(this.validateRange(e),t)}getCharacterCountInRange(e,t=0){return this._assertNotDisposed(),this._buffer.getCharacterCountInRange(this.validateRange(e),t)}getLineCount(){return this._assertNotDisposed(),this._buffer.getLineCount()}getLineContent(e){if(this._assertNotDisposed(),e<1||e>this.getLineCount())throw new Error("Illegal value for lineNumber");return this._buffer.getLineContent(e)}getLineLength(e){if(this._assertNotDisposed(),e<1||e>this.getLineCount())throw new Error("Illegal value for lineNumber");return this._buffer.getLineLength(e)}getLinesContent(){return this._assertNotDisposed(),this._buffer.getLinesContent()}getEOL(){return this._assertNotDisposed(),this._buffer.getEOL()}getEndOfLineSequence(){return this._assertNotDisposed(),"\n"===this._buffer.getEOL()?0:1}getLineMinColumn(e){return this._assertNotDisposed(),1}getLineMaxColumn(e){if(this._assertNotDisposed(),e<1||e>this.getLineCount())throw new Error("Illegal value for lineNumber");return this._buffer.getLineLength(e)+1}getLineFirstNonWhitespaceColumn(e){if(this._assertNotDisposed(),e<1||e>this.getLineCount())throw new Error("Illegal value for lineNumber");return this._buffer.getLineFirstNonWhitespaceColumn(e)}getLineLastNonWhitespaceColumn(e){if(this._assertNotDisposed(),e<1||e>this.getLineCount())throw new Error("Illegal value for lineNumber");return this._buffer.getLineLastNonWhitespaceColumn(e)}_validateRangeRelaxedNoAllocations(e){const t=this._buffer.getLineCount(),i=e.startLineNumber,n=e.startColumn;let o=Math.floor("number"!=typeof i||isNaN(i)?1:i),s=Math.floor("number"!=typeof n||isNaN(n)?1:n);if(o<1)o=1,s=1;else if(o>t)o=t,s=this.getLineMaxColumn(o);else if(s<=1)s=1;else{const e=this.getLineMaxColumn(o);s>=e&&(s=e)}const r=e.endLineNumber,a=e.endColumn;let l=Math.floor("number"!=typeof r||isNaN(r)?1:r),d=Math.floor("number"!=typeof a||isNaN(a)?1:a);if(l<1)l=1,d=1;else if(l>t)l=t,d=this.getLineMaxColumn(l);else if(d<=1)d=1;else{const e=this.getLineMaxColumn(l);d>=e&&(d=e)}return i===o&&n===s&&r===l&&a===d&&e instanceof qo&&!(e instanceof ar)?e:new qo(o,s,l,d)}_isValidPosition(e,t,i){if("number"!=typeof e||"number"!=typeof t)return!1;if(isNaN(e)||isNaN(t))return!1;if(e<1||t<1)return!1;if((0|e)!==e||(0|t)!==t)return!1;if(e>this._buffer.getLineCount())return!1;if(1===t)return!0;if(t>this.getLineMaxColumn(e))return!1;if(1===i){const i=this._buffer.getLineCharCode(e,t-2);if(Go(i))return!1}return!0}_validatePosition(e,t,i){const n=Math.floor("number"!=typeof e||isNaN(e)?1:e),o=Math.floor("number"!=typeof t||isNaN(t)?1:t),s=this._buffer.getLineCount();if(n<1)return new er(1,1);if(n>s)return new er(s,this.getLineMaxColumn(s));if(o<=1)return new er(n,1);const r=this.getLineMaxColumn(n);if(o>=r)return new er(n,r);if(1===i){const e=this._buffer.getLineCharCode(n,o-2);if(Go(e))return new er(n,o-1)}return new er(n,o)}validatePosition(e){return this._assertNotDisposed(),e instanceof er&&this._isValidPosition(e.lineNumber,e.column,1)?e:this._validatePosition(e.lineNumber,e.column,1)}_isValidRange(e,t){const i=e.startLineNumber,n=e.startColumn,o=e.endLineNumber,s=e.endColumn;if(!this._isValidPosition(i,n,0))return!1;if(!this._isValidPosition(o,s,0))return!1;if(1===t){const e=n>1?this._buffer.getLineCharCode(i,n-2):0,t=s>1&&s<=this._buffer.getLineLength(o)?this._buffer.getLineCharCode(o,s-2):0,r=Go(e),a=Go(t);return!r&&!a}return!0}validateRange(e){if(this._assertNotDisposed(),e instanceof qo&&!(e instanceof ar)&&this._isValidRange(e,1))return e;const t=this._validatePosition(e.startLineNumber,e.startColumn,0),i=this._validatePosition(e.endLineNumber,e.endColumn,0),n=t.lineNumber,o=t.column,s=i.lineNumber,r=i.column;{const e=o>1?this._buffer.getLineCharCode(n,o-2):0,t=r>1&&r<=this._buffer.getLineLength(s)?this._buffer.getLineCharCode(s,r-2):0,i=Go(e),a=Go(t);return i||a?n===s&&o===r?new qo(n,o-1,s,r-1):i&&a?new qo(n,o-1,s,r+1):i?new qo(n,o-1,s,r):new qo(n,o,s,r+1):new qo(n,o,s,r)}}modifyPosition(e,t){this._assertNotDisposed();const i=this.getOffsetAt(e)+t;return this.getPositionAt(Math.min(this._buffer.getLength(),Math.max(0,i)))}getFullModelRange(){this._assertNotDisposed();const e=this.getLineCount();return new qo(1,1,e,this.getLineMaxColumn(e))}findMatchesLineByLine(e,t,i,n){return this._buffer.findMatchesLineByLine(e,t,i,n)}findMatches(e,t,i,n,o,s,r=999){this._assertNotDisposed();let a=null;null!==t&&(Array.isArray(t)||(t=[t]),t.every((e=>qo.isIRange(e)))&&(a=t.map((e=>this.validateRange(e))))),null===a&&(a=[this.getFullModelRange()]),a=a.sort(((e,t)=>e.startLineNumber-t.startLineNumber||e.startColumn-t.startColumn));const l=[];let d;if(l.push(a.reduce(((e,t)=>qo.areIntersecting(e,t)?e.plusRange(t):(l.push(e),t)))),!i&&e.indexOf("\n")<0){const t=new oa(e,i,n,o).parseSearchRequest();if(!t)return[];d=e=>this.findMatchesLineByLine(e,t,s,r)}else d=t=>na.findMatches(this,new oa(e,i,n,o),t,s,r);return l.map(d).reduce(((e,t)=>e.concat(t)),[])}findNextMatch(e,t,i,n,o,s){this._assertNotDisposed();const r=this.validatePosition(t);if(!i&&e.indexOf("\n")<0){const t=new oa(e,i,n,o).parseSearchRequest();if(!t)return null;const a=this.getLineCount();let l=new qo(r.lineNumber,r.column,a,this.getLineMaxColumn(a)),d=this.findMatchesLineByLine(l,t,s,1);return na.findNextMatch(this,new oa(e,i,n,o),r,s),d.length>0?d[0]:(l=new qo(1,1,r.lineNumber,this.getLineMaxColumn(r.lineNumber)),d=this.findMatchesLineByLine(l,t,s,1),d.length>0?d[0]:null)}return na.findNextMatch(this,new oa(e,i,n,o),r,s)}findPreviousMatch(e,t,i,n,o,s){this._assertNotDisposed();const r=this.validatePosition(t);return na.findPreviousMatch(this,new oa(e,i,n,o),r,s)}pushStackElement(){this._commandManager.pushStackElement()}popStackElement(){this._commandManager.popStackElement()}pushEOL(e){if(("\n"===this.getEOL()?0:1)!==e)try{this._onDidChangeDecorations.beginDeferredEmit(),this._eventEmitter.beginDeferredEmit(),null===this._initialUndoRedoSnapshot&&(this._initialUndoRedoSnapshot=this._undoRedoService.createSnapshot(this.uri)),this._commandManager.pushEOL(e)}finally{this._eventEmitter.endDeferredEmit(),this._onDidChangeDecorations.endDeferredEmit()}}_validateEditOperation(e){return e instanceof sa?e:new sa(e.identifier||null,this.validateRange(e.range),e.text,e.forceMoveMarkers||!1,e.isAutoWhitespaceEdit||!1,e._isTracked||!1)}_validateEditOperations(e){const t=[];for(let i=0,n=e.length;i<n;i++)t[i]=this._validateEditOperation(e[i]);return t}pushEditOperations(e,t,i){try{return this._onDidChangeDecorations.beginDeferredEmit(),this._eventEmitter.beginDeferredEmit(),this._pushEditOperations(e,this._validateEditOperations(t),i)}finally{this._eventEmitter.endDeferredEmit(),this._onDidChangeDecorations.endDeferredEmit()}}_pushEditOperations(e,t,i){if(this._options.trimAutoWhitespace&&this._trimAutoWhitespaceLines){const i=t.map((e=>({range:this.validateRange(e.range),text:e.text})));let n=!0;if(e)for(let t=0,o=e.length;t<o;t++){const o=e[t];let s=!1;for(let e=0,t=i.length;e<t;e++){const t=i[e].range,n=t.startLineNumber>o.endLineNumber,r=o.startLineNumber>t.endLineNumber;if(!n&&!r){s=!0;break}}if(!s){n=!1;break}}if(n)for(let e=0,o=this._trimAutoWhitespaceLines.length;e<o;e++){const n=this._trimAutoWhitespaceLines[e],o=this.getLineMaxColumn(n);let s=!0;for(let e=0,t=i.length;e<t;e++){const t=i[e].range,r=i[e].text;if(!(n<t.startLineNumber||n>t.endLineNumber)&&!(n===t.startLineNumber&&t.startColumn===o&&t.isEmpty()&&r&&r.length>0&&"\n"===r.charAt(0)||n===t.startLineNumber&&1===t.startColumn&&t.isEmpty()&&r&&r.length>0&&"\n"===r.charAt(r.length-1))){s=!1;break}}if(s){const e=new qo(n,1,n,o);t.push(new sa(null,e,null,!1,!1,!1))}}this._trimAutoWhitespaceLines=null}return null===this._initialUndoRedoSnapshot&&(this._initialUndoRedoSnapshot=this._undoRedoService.createSnapshot(this.uri)),this._commandManager.pushEditOperation(e,t,i)}_applyUndo(e,t,i,n){const o=e.map((e=>{const t=this.getPositionAt(e.newPosition),i=this.getPositionAt(e.newEnd);return{range:new qo(t.lineNumber,t.column,i.lineNumber,i.column),text:e.oldText}}));this._applyUndoRedoEdits(o,t,!0,!1,i,n)}_applyRedo(e,t,i,n){const o=e.map((e=>{const t=this.getPositionAt(e.oldPosition),i=this.getPositionAt(e.oldEnd);return{range:new qo(t.lineNumber,t.column,i.lineNumber,i.column),text:e.newText}}));this._applyUndoRedoEdits(o,t,!1,!0,i,n)}_applyUndoRedoEdits(e,t,i,n,o,s){try{this._onDidChangeDecorations.beginDeferredEmit(),this._eventEmitter.beginDeferredEmit(),this._isUndoing=i,this._isRedoing=n,this.applyEdits(e,!1),this.setEOL(t),this._overwriteAlternativeVersionId(o)}finally{this._isUndoing=!1,this._isRedoing=!1,this._eventEmitter.endDeferredEmit(s),this._onDidChangeDecorations.endDeferredEmit()}}applyEdits(e,t=!1){try{this._onDidChangeDecorations.beginDeferredEmit(),this._eventEmitter.beginDeferredEmit();const i=this._validateEditOperations(e);return this._doApplyEdits(i,t)}finally{this._eventEmitter.endDeferredEmit(),this._onDidChangeDecorations.endDeferredEmit()}}_doApplyEdits(e,t){const i=this._buffer.getLineCount(),n=this._buffer.applyEdits(e,this._options.trimAutoWhitespace,t),o=this._buffer.getLineCount(),s=n.changes;if(this._trimAutoWhitespaceLines=n.trimAutoWhitespaceLineNumbers,0!==s.length){for(let i=0,n=s.length;i<n;i++){const e=s[i],[t,n,o]=uP(e.text);this._tokens.acceptEdit(e.range,t,n),this._semanticTokens.acceptEdit(e.range,t,n,o,e.text.length>0?e.text.charCodeAt(0):0),this._decorationsTree.acceptReplace(e.rangeOffset,e.rangeLength,e.text.length,e.forceMoveMarkers)}const e=[];this._increaseVersionId();let t=i;for(let i=0,n=s.length;i<n;i++){const n=s[i],[r]=uP(n.text);this._onDidChangeDecorations.fire();const a=n.range.startLineNumber,l=n.range.endLineNumber,d=l-a,c=r,h=Math.min(d,c),u=c-d,g=o-t-u+a,p=g,m=g+c,f=this._decorationsTree.getInjectedTextInInterval(this,this.getOffsetAt(new er(p,1)),this.getOffsetAt(new er(m,this.getLineMaxColumn(m))),0),_=DM.fromDecorations(f),v=new Cr(_);for(let t=h;t>=0;t--){const i=a+t,n=g+t;v.takeFromEndWhile((e=>e.lineNumber>n));const o=v.takeFromEndWhile((e=>e.lineNumber===n));e.push(new LM(i,this.getLineContent(n),o))}if(h<d){const t=a+h;e.push(new NM(t+1,l))}if(h<c){const i=new Cr(_),n=a+h,s=c-h,r=o-t-s+n+1,l=[],d=[];for(let e=0;e<s;e++){const t=r+e;d[e]=this.getLineContent(t),i.takeWhile((e=>e.lineNumber<t)),l[e]=i.takeWhile((e=>e.lineNumber===t))}e.push(new EM(n+1,a+c,d,l))}t+=u}this._emitContentChangedEvent(new TM(e,this.getVersionId(),this._isUndoing,this._isRedoing),{changes:s,eol:this._buffer.getEOL(),versionId:this.getVersionId(),isUndoing:this._isUndoing,isRedoing:this._isRedoing,isFlush:!1})}return null===n.reverseEdits?void 0:n.reverseEdits}undo(){return this._undoRedoService.undo(this.uri)}canUndo(){return this._undoRedoService.canUndo(this.uri)}redo(){return this._undoRedoService.redo(this.uri)}canRedo(){return this._undoRedoService.canRedo(this.uri)}handleBeforeFireDecorationsChangedEvent(e){if(null===e||0===e.size)return;const t=[...e].map((e=>new LM(e,this.getLineContent(e),this._getInjectedTextInLine(e))));this._onDidChangeInjectedText.fire(new MM(t))}changeDecorations(e,t=0){this._assertNotDisposed();try{return this._onDidChangeDecorations.beginDeferredEmit(),this._changeDecorations(t,e)}finally{this._onDidChangeDecorations.endDeferredEmit()}}_changeDecorations(e,t){const i={addDecoration:(t,i)=>this._deltaDecorationsImpl(e,[],[{range:t,options:i}])[0],changeDecoration:(e,t)=>{this._changeDecorationImpl(e,t)},changeDecorationOptions:(e,t)=>{this._changeDecorationOptionsImpl(e,YP(t))},removeDecoration:t=>{this._deltaDecorationsImpl(e,[t],[])},deltaDecorations:(t,i)=>0===t.length&&0===i.length?[]:this._deltaDecorationsImpl(e,t,i)};let n=null;try{n=t(i)}catch(o){Jo(o)}return i.addDecoration=BP,i.changeDecoration=BP,i.changeDecorationOptions=BP,i.removeDecoration=BP,i.deltaDecorations=BP,n}deltaDecorations(e,t,i=0){if(this._assertNotDisposed(),e||(e=[]),0===e.length&&0===t.length)return[];try{return this._onDidChangeDecorations.beginDeferredEmit(),this._deltaDecorationsImpl(i,e,t)}finally{this._onDidChangeDecorations.endDeferredEmit()}}_getTrackedRange(e){return this.getDecorationRange(e)}_setTrackedRange(e,t,i){const n=e?this._decorations[e]:null;if(!n)return t?this._deltaDecorationsImpl(0,[],[{range:t,options:ZP[i]}])[0]:null;if(!t)return this._decorationsTree.delete(n),delete this._decorations[n.id],null;const o=this._validateRangeRelaxedNoAllocations(t),s=this._buffer.getOffsetAt(o.startLineNumber,o.startColumn),r=this._buffer.getOffsetAt(o.endLineNumber,o.endColumn);return this._decorationsTree.delete(n),n.reset(this.getVersionId(),s,r,o),n.setOptions(ZP[i]),this._decorationsTree.insert(n),n.id}removeAllDecorationsWithOwnerId(e){if(this._isDisposed)return;const t=this._decorationsTree.collectNodesFromOwner(e);for(let i=0,n=t.length;i<n;i++){const e=t[i];this._decorationsTree.delete(e),delete this._decorations[e.id]}}getDecorationOptions(e){const t=this._decorations[e];return t?t.options:null}getDecorationRange(e){const t=this._decorations[e];return t?this._decorationsTree.getNodeRange(this,t):null}getLineDecorations(e,t=0,i=!1){return e<1||e>this.getLineCount()?[]:this.getLinesDecorations(e,e,t,i)}getLinesDecorations(e,t,i=0,n=!1){const o=this.getLineCount(),s=Math.min(o,Math.max(1,e)),r=Math.min(o,Math.max(1,t)),a=this.getLineMaxColumn(r),l=new qo(s,1,r,a),d=this._getDecorationsInRange(l,i,n);return d.push(...this._decorationProvider.getDecorationsInRange(l,i,n)),d}getDecorationsInRange(e,t=0,i=!1){const n=this.validateRange(e),o=this._getDecorationsInRange(n,t,i);return o.push(...this._decorationProvider.getDecorationsInRange(n,t,i)),o}getOverviewRulerDecorations(e=0,t=!1){return this._decorationsTree.getAll(this,e,t,!0)}getInjectedTextDecorations(e=0){return this._decorationsTree.getAllInjectedText(this,e)}_getInjectedTextInLine(e){const t=this._buffer.getOffsetAt(e,1),i=t+this._buffer.getLineLength(e),n=this._decorationsTree.getInjectedTextInInterval(this,t,i,0);return DM.fromDecorations(n).filter((t=>t.lineNumber===e))}getAllDecorations(e=0,t=!1){let i=this._decorationsTree.getAll(this,e,t,!1);return i=i.concat(this._decorationProvider.getAllDecorations(e,t)),i}_getDecorationsInRange(e,t,i){const n=this._buffer.getOffsetAt(e.startLineNumber,e.startColumn),o=this._buffer.getOffsetAt(e.endLineNumber,e.endColumn);return this._decorationsTree.getAllInInterval(this,n,o,t,i)}getRangeAt(e,t){return this._buffer.getRangeAt(e,t-e)}_changeDecorationImpl(e,t){const i=this._decorations[e];if(!i)return;if(i.options.after){const t=this.getDecorationRange(e);this._onDidChangeDecorations.recordLineAffectedByInjectedText(t.endLineNumber)}if(i.options.before){const t=this.getDecorationRange(e);this._onDidChangeDecorations.recordLineAffectedByInjectedText(t.startLineNumber)}const n=this._validateRangeRelaxedNoAllocations(t),o=this._buffer.getOffsetAt(n.startLineNumber,n.startColumn),s=this._buffer.getOffsetAt(n.endLineNumber,n.endColumn);this._decorationsTree.delete(i),i.reset(this.getVersionId(),o,s,n),this._decorationsTree.insert(i),this._onDidChangeDecorations.checkAffectedAndFire(i.options),i.options.after&&this._onDidChangeDecorations.recordLineAffectedByInjectedText(n.endLineNumber),i.options.before&&this._onDidChangeDecorations.recordLineAffectedByInjectedText(n.startLineNumber)}_changeDecorationOptionsImpl(e,t){const i=this._decorations[e];if(!i)return;const n=!(!i.options.overviewRuler||!i.options.overviewRuler.color),o=!(!t.overviewRuler||!t.overviewRuler.color);if(this._onDidChangeDecorations.checkAffectedAndFire(i.options),this._onDidChangeDecorations.checkAffectedAndFire(t),i.options.after||t.after){const e=this._decorationsTree.getNodeRange(this,i);this._onDidChangeDecorations.recordLineAffectedByInjectedText(e.endLineNumber)}if(i.options.before||t.before){const e=this._decorationsTree.getNodeRange(this,i);this._onDidChangeDecorations.recordLineAffectedByInjectedText(e.startLineNumber)}n!==o?(this._decorationsTree.delete(i),i.setOptions(t),this._decorationsTree.insert(i)):i.setOptions(t)}_deltaDecorationsImpl(e,t,i){const n=this.getVersionId(),o=t.length;let s=0;const r=i.length;let a=0;const l=new Array(r);for(;s<o||a<r;){let d=null;if(s<o){do{d=this._decorations[t[s++]]}while(!d&&s<o);if(d){if(d.options.after){const e=this._decorationsTree.getNodeRange(this,d);this._onDidChangeDecorations.recordLineAffectedByInjectedText(e.endLineNumber)}if(d.options.before){const e=this._decorationsTree.getNodeRange(this,d);this._onDidChangeDecorations.recordLineAffectedByInjectedText(e.startLineNumber)}this._decorationsTree.delete(d),this._onDidChangeDecorations.checkAffectedAndFire(d.options)}}if(a<r){if(!d){const e=++this._lastDecorationId,t=`${this._instanceId};${e}`;d=new IR(t,0,0),this._decorations[t]=d}const t=i[a],o=this._validateRangeRelaxedNoAllocations(t.range),s=YP(t.options),r=this._buffer.getOffsetAt(o.startLineNumber,o.startColumn),c=this._buffer.getOffsetAt(o.endLineNumber,o.endColumn);d.ownerId=e,d.reset(n,r,c,o),d.setOptions(s),d.options.after&&this._onDidChangeDecorations.recordLineAffectedByInjectedText(o.endLineNumber),d.options.before&&this._onDidChangeDecorations.recordLineAffectedByInjectedText(o.startLineNumber),this._onDidChangeDecorations.checkAffectedAndFire(s),this._decorationsTree.insert(d),l[a]=d.id,a++}else d&&delete this._decorations[d.id]}return l}setTokens(e,t=!1){if(0!==e.length){const t=[];for(let i=0,n=e.length;i<n;i++){const n=e[i];let o=0,s=0,r=!1;for(let e=n.startLineNumber;e<=n.endLineNumber;e++)if(r)this._tokens.setTokens(this._languageId,e-1,this._buffer.getLineLength(e),n.getLineTokens(e),!1),s=e;else{this._tokens.setTokens(this._languageId,e-1,this._buffer.getLineLength(e),n.getLineTokens(e),!0)&&(r=!0,o=e,s=e)}r&&t.push({fromLineNumber:o,toLineNumber:s})}t.length>0&&this._emitModelTokensChangedEvent({tokenizationSupportChanged:!1,semanticTokensApplied:!1,ranges:t})}this.handleTokenizationProgress(t)}setSemanticTokens(e,t){this._semanticTokens.set(e,t),this._emitModelTokensChangedEvent({tokenizationSupportChanged:!1,semanticTokensApplied:null!==e,ranges:[{fromLineNumber:1,toLineNumber:this.getLineCount()}]})}hasCompleteSemanticTokens(){return this._semanticTokens.isComplete()}hasSomeSemanticTokens(){return!this._semanticTokens.isEmpty()}setPartialSemanticTokens(e,t){if(this.hasCompleteSemanticTokens())return;const i=this.validateRange(this._semanticTokens.setPartial(e,t));this._emitModelTokensChangedEvent({tokenizationSupportChanged:!1,semanticTokensApplied:!0,ranges:[{fromLineNumber:i.startLineNumber,toLineNumber:i.endLineNumber}]})}tokenizeViewport(e,t){e=Math.max(1,e),t=Math.min(this._buffer.getLineCount(),t),this._tokenization.tokenizeViewport(e,t)}clearTokens(){this._tokens.flush(),this._emitModelTokensChangedEvent({tokenizationSupportChanged:!0,semanticTokensApplied:!1,ranges:[{fromLineNumber:1,toLineNumber:this._buffer.getLineCount()}]})}_emitModelTokensChangedEvent(e){this._isDisposing||(this._bracketPairColorizer.handleDidChangeTokens(e),this._onDidChangeTokens.fire(e))}resetTokenization(){this._tokenization.reset()}forceTokenization(e){if(e<1||e>this.getLineCount())throw new Error("Illegal value for lineNumber");this._tokenization.forceTokenization(e)}isCheapToTokenize(e){return this._tokenization.isCheapToTokenize(e)}tokenizeIfCheap(e){this.isCheapToTokenize(e)&&this.forceTokenization(e)}getLineTokens(e){if(e<1||e>this.getLineCount())throw new Error("Illegal value for lineNumber");return this._getLineTokens(e)}_getLineTokens(e){const t=this.getLineContent(e),i=this._tokens.getTokens(this._languageId,e-1,t);return this._semanticTokens.addSparseTokens(e,i)}getLanguageId(){return this._languageId}setMode(e){if(this._languageId===e)return;const t={oldLanguage:this._languageId,newLanguage:e};this._languageId=e,this._bracketPairColorizer.handleDidChangeLanguage(t),this._tokenization.handleDidChangeLanguage(t),this._onDidChangeLanguage.fire(t),this._onDidChangeLanguageConfiguration.fire({})}getLanguageIdAtPosition(e,t){const i=this.validatePosition(new er(e,t)),n=this.getLineTokens(i.lineNumber);return n.getLanguageId(n.findTokenIndexAtOffset(i.column-1))}getTokenTypeIfInsertingCharacter(e,t,i){const n=this.validatePosition(new er(e,t));return this._tokenization.getTokenTypeIfInsertingCharacter(n,i)}tokenizeLineWithEdit(e,t,i){const n=this.validatePosition(e);return this._tokenization.tokenizeLineWithEdit(n,t,i)}getLanguageConfiguration(e){return this._languageConfigurationService.getLanguageConfiguration(e)}getWordAtPosition(t){this._assertNotDisposed();const i=this.validatePosition(t),n=this.getLineContent(i.lineNumber),o=this._getLineTokens(i.lineNumber),s=o.findTokenIndexAtOffset(i.column-1),[r,a]=e._findLanguageBoundaries(o,s),l=ra(i.column,this.getLanguageConfiguration(o.getLanguageId(s)).getWordDefinition(),n.substring(r,a),r);if(l&&l.startColumn<=t.column&&t.column<=l.endColumn)return l;if(s>0&&r===i.column-1){const[r,a]=e._findLanguageBoundaries(o,s-1),l=ra(i.column,this.getLanguageConfiguration(o.getLanguageId(s-1)).getWordDefinition(),n.substring(r,a),r);if(l&&l.startColumn<=t.column&&t.column<=l.endColumn)return l}return null}static _findLanguageBoundaries(e,t){const i=e.getLanguageId(t);let n=0;for(let s=t;s>=0&&e.getLanguageId(s)===i;s--)n=e.getStartOffset(s);let o=e.getLineContent().length;for(let s=t,r=e.getCount();s<r&&e.getLanguageId(s)===i;s++)o=e.getEndOffset(s);return[n,o]}getWordUntilPosition(e){const t=this.getWordAtPosition(e);return t?{word:t.word.substr(0,e.column-t.startColumn),startColumn:t.startColumn,endColumn:e.column}:{word:"",startColumn:e.column,endColumn:e.column}}normalizePosition(e,t){return e}getLineIndentColumn(e){return function(e){let t=0;for(const i of e){if(" "!==i&&"\t"!==i)break;t++}return t}(this.getLineContent(e))+1}};function WP(e){return!(!e.options.overviewRuler||!e.options.overviewRuler.color)}function zP(e){return!!e.options.after||!!e.options.before}VP.MODEL_SYNC_LIMIT=52428800,VP.LARGE_FILE_SIZE_THRESHOLD=20971520,VP.LARGE_FILE_LINE_COUNT_THRESHOLD=3e5,VP.DEFAULT_CREATION_OPTIONS={isForSimpleWidget:!1,tabSize:ff.tabSize,indentSize:ff.indentSize,insertSpaces:ff.insertSpaces,detectIndentation:!1,defaultEOL:1,trimAutoWhitespace:ff.trimAutoWhitespace,largeFileOptimizations:ff.largeFileOptimizations,bracketPairColorizationOptions:ff.bracketPairColorizationOptions},VP=MP([AP(4,NP),AP(5,Lv),AP(6,Rv)],VP);class HP{constructor(){this._decorationsTree0=new MR,this._decorationsTree1=new MR,this._injectedTextDecorationsTree=new MR}ensureAllNodesHaveRanges(e){this.getAll(e,0,!1,!1)}_ensureNodesHaveRanges(e,t){for(const i of t)null===i.range&&(i.range=e.getRangeAt(i.cachedAbsoluteStart,i.cachedAbsoluteEnd));return t}getAllInInterval(e,t,i,n,o){const s=e.getVersionId(),r=this._intervalSearch(t,i,n,o,s);return this._ensureNodesHaveRanges(e,r)}_intervalSearch(e,t,i,n,o){const s=this._decorationsTree0.intervalSearch(e,t,i,n,o),r=this._decorationsTree1.intervalSearch(e,t,i,n,o),a=this._injectedTextDecorationsTree.intervalSearch(e,t,i,n,o);return s.concat(r).concat(a)}getInjectedTextInInterval(e,t,i,n){const o=e.getVersionId(),s=this._injectedTextDecorationsTree.intervalSearch(t,i,n,!1,o);return this._ensureNodesHaveRanges(e,s).filter((e=>e.options.showIfCollapsed||!e.range.isEmpty()))}getAllInjectedText(e,t){const i=e.getVersionId(),n=this._injectedTextDecorationsTree.search(t,!1,i);return this._ensureNodesHaveRanges(e,n).filter((e=>e.options.showIfCollapsed||!e.range.isEmpty()))}getAll(e,t,i,n){const o=e.getVersionId(),s=this._search(t,i,n,o);return this._ensureNodesHaveRanges(e,s)}_search(e,t,i,n){if(i)return this._decorationsTree1.search(e,t,n);{const i=this._decorationsTree0.search(e,t,n),o=this._decorationsTree1.search(e,t,n),s=this._injectedTextDecorationsTree.search(e,t,n);return i.concat(o).concat(s)}}collectNodesFromOwner(e){const t=this._decorationsTree0.collectNodesFromOwner(e),i=this._decorationsTree1.collectNodesFromOwner(e),n=this._injectedTextDecorationsTree.collectNodesFromOwner(e);return t.concat(i).concat(n)}collectNodesPostOrder(){const e=this._decorationsTree0.collectNodesPostOrder(),t=this._decorationsTree1.collectNodesPostOrder(),i=this._injectedTextDecorationsTree.collectNodesPostOrder();return e.concat(t).concat(i)}insert(e){zP(e)?this._injectedTextDecorationsTree.insert(e):WP(e)?this._decorationsTree1.insert(e):this._decorationsTree0.insert(e)}delete(e){zP(e)?this._injectedTextDecorationsTree.delete(e):WP(e)?this._decorationsTree1.delete(e):this._decorationsTree0.delete(e)}getNodeRange(e,t){const i=e.getVersionId();return t.cachedVersionId!==i&&this._resolveNode(t,i),null===t.range&&(t.range=e.getRangeAt(t.cachedAbsoluteStart,t.cachedAbsoluteEnd)),t.range}_resolveNode(e,t){zP(e)?this._injectedTextDecorationsTree.resolveNode(e,t):WP(e)?this._decorationsTree1.resolveNode(e,t):this._decorationsTree0.resolveNode(e,t)}acceptReplace(e,t,i,n){this._decorationsTree0.acceptReplace(e,t,i,n),this._decorationsTree1.acceptReplace(e,t,i,n),this._injectedTextDecorationsTree.acceptReplace(e,t,i,n)}}function jP(e){return e.replace(/[^a-z0-9\-_]/gi," ")}class UP{constructor(e){this.color=e.color||"",this.darkColor=e.darkColor||""}}class $P extends UP{constructor(e){super(e),this._resolvedColor=null,this.position="number"==typeof e.position?e.position:aa.Center}getColor(e){return this._resolvedColor||("light"!==e.type&&this.darkColor?this._resolvedColor=this._resolveColor(this.darkColor,e):this._resolvedColor=this._resolveColor(this.color,e)),this._resolvedColor}invalidateCachedColor(){this._resolvedColor=null}_resolveColor(e,t){if("string"==typeof e)return e;const i=e?t.getColor(e.id):null;return i?i.toString():""}}class KP extends UP{constructor(e){super(e),this.position=e.position}getColor(e){return this._resolvedColor||("light"!==e.type&&this.darkColor?this._resolvedColor=this._resolveColor(this.darkColor,e):this._resolvedColor=this._resolveColor(this.color,e)),this._resolvedColor}invalidateCachedColor(){this._resolvedColor=void 0}_resolveColor(e,t){return"string"==typeof e?hS.fromHex(e):t.getColor(e.id)}}class qP{constructor(e){this.content=e.content||"",this.inlineClassName=e.inlineClassName||null,this.inlineClassNameAffectsLetterSpacing=e.inlineClassNameAffectsLetterSpacing||!1,this.attachedData=e.attachedData||null,this.cursorStops=e.cursorStops||null}static from(e){return e instanceof qP?e:new qP(e)}}class GP{constructor(e){var t,i;this.description=e.description,this.stickiness=e.stickiness||0,this.zIndex=e.zIndex||0,this.className=e.className?jP(e.className):null,this.hoverMessage=e.hoverMessage||null,this.glyphMarginHoverMessage=e.glyphMarginHoverMessage||null,this.isWholeLine=e.isWholeLine||!1,this.showIfCollapsed=e.showIfCollapsed||!1,this.collapseOnReplaceEdit=e.collapseOnReplaceEdit||!1,this.overviewRuler=e.overviewRuler?new $P(e.overviewRuler):null,this.minimap=e.minimap?new KP(e.minimap):null,this.glyphMarginClassName=e.glyphMarginClassName?jP(e.glyphMarginClassName):null,this.linesDecorationsClassName=e.linesDecorationsClassName?jP(e.linesDecorationsClassName):null,this.firstLineDecorationClassName=e.firstLineDecorationClassName?jP(e.firstLineDecorationClassName):null,this.marginClassName=e.marginClassName?jP(e.marginClassName):null,this.inlineClassName=e.inlineClassName?jP(e.inlineClassName):null,this.inlineClassNameAffectsLetterSpacing=e.inlineClassNameAffectsLetterSpacing||!1,this.beforeContentClassName=e.beforeContentClassName?jP(e.beforeContentClassName):null,this.afterContentClassName=e.afterContentClassName?jP(e.afterContentClassName):null,this.after=e.after?qP.from(e.after):null,this.before=e.before?qP.from(e.before):null,this.hideInCommentTokens=null!==(t=e.hideInCommentTokens)&&void 0!==t&&t,this.hideInStringTokens=null!==(i=e.hideInStringTokens)&&void 0!==i&&i}static register(e){return new GP(e)}static createDynamic(e){return new GP(e)}}GP.EMPTY=GP.register({description:"empty"});const ZP=[GP.register({description:"tracked-range-always-grows-when-typing-at-edges",stickiness:0}),GP.register({description:"tracked-range-never-grows-when-typing-at-edges",stickiness:1}),GP.register({description:"tracked-range-grows-only-when-typing-before",stickiness:2}),GP.register({description:"tracked-range-grows-only-when-typing-after",stickiness:3})];function YP(e){return e instanceof GP?e:GP.createDynamic(e)}class XP extends Uo{constructor(e){super(),this.handleBeforeFire=e,this._actual=this._register(new $o),this.event=this._actual.event,this._affectedInjectedTextLines=null,this._deferredCnt=0,this._shouldFire=!1,this._affectsMinimap=!1,this._affectsOverviewRuler=!1}beginDeferredEmit(){this._deferredCnt++}endDeferredEmit(){var e;if(this._deferredCnt--,0===this._deferredCnt){if(this._shouldFire){this.handleBeforeFire(this._affectedInjectedTextLines);const e={affectsMinimap:this._affectsMinimap,affectsOverviewRuler:this._affectsOverviewRuler};this._shouldFire=!1,this._affectsMinimap=!1,this._affectsOverviewRuler=!1,this._actual.fire(e)}null===(e=this._affectedInjectedTextLines)||void 0===e||e.clear(),this._affectedInjectedTextLines=null}}recordLineAffectedByInjectedText(e){this._affectedInjectedTextLines||(this._affectedInjectedTextLines=new Set),this._affectedInjectedTextLines.add(e)}checkAffectedAndFire(e){this._affectsMinimap||(this._affectsMinimap=!(!e.minimap||!e.minimap.position)),this._affectsOverviewRuler||(this._affectsOverviewRuler=!(!e.overviewRuler||!e.overviewRuler.color)),this._shouldFire=!0}fire(){this._affectsMinimap=!0,this._affectsOverviewRuler=!0,this._shouldFire=!0}}class QP extends Uo{constructor(){super(),this._fastEmitter=this._register(new $o),this.fastEvent=this._fastEmitter.event,this._slowEmitter=this._register(new $o),this.slowEvent=this._slowEmitter.event,this._deferredCnt=0,this._deferredEvent=null}beginDeferredEmit(){this._deferredCnt++}endDeferredEmit(e=null){if(this._deferredCnt--,0===this._deferredCnt&&null!==this._deferredEvent){this._deferredEvent.rawContentChangedEvent.resultingSelection=e;const t=this._deferredEvent;this._deferredEvent=null,this._fastEmitter.fire(t),this._slowEmitter.fire(t)}}fire(e){this._deferredCnt>0?this._deferredEvent?this._deferredEvent=this._deferredEvent.merge(e):this._deferredEvent=e:(this._fastEmitter.fire(e),this._slowEmitter.fire(e))}}function JP(e,t){return null===e?t?tF.INSTANCE:iF.INSTANCE:new eF(e,t)}class eF{constructor(e,t){this._projectionData=e,this._isVisible=t}isVisible(){return this._isVisible}setVisible(e){return this._isVisible=e,this}getProjectionData(){return this._projectionData}getViewLineCount(){return this._isVisible?this._projectionData.getOutputLineCount():0}getViewLineContent(e,t,i){this._assertVisible();const n=i>0?this._projectionData.breakOffsets[i-1]:0,o=this._projectionData.breakOffsets[i];let s;if(null!==this._projectionData.injectionOffsets){const i=this._projectionData.injectionOffsets.map(((e,t)=>new DM(0,0,e+1,this._projectionData.injectionOptions[t],0)));s=DM.applyInjectedText(e.getLineContent(t),i).substring(n,o)}else s=e.getValueInRange({startLineNumber:t,startColumn:n+1,endLineNumber:t,endColumn:o+1});return i>0&&(s=oF(this._projectionData.wrappedTextIndentLength)+s),s}getViewLineLength(e,t,i){return this._assertVisible(),this._projectionData.getLineLength(i)}getViewLineMinColumn(e,t,i){return this._assertVisible(),this._projectionData.getMinOutputOffset(i)+1}getViewLineMaxColumn(e,t,i){return this._assertVisible(),this._projectionData.getMaxOutputOffset(i)+1}getViewLineData(e,t,i){const n=new Array;return this.getViewLinesData(e,t,i,1,0,[!0],n),n[0]}getViewLinesData(e,t,i,n,o,s,r){this._assertVisible();const a=this._projectionData,l=a.injectionOffsets,d=a.injectionOptions;let c,h=null;if(l){h=[];let e=0,t=0;for(let i=0;i<a.getOutputLineCount();i++){const n=new Array;h[i]=n;const o=i>0?a.breakOffsets[i-1]:0,s=a.breakOffsets[i];for(;t<l.length;){const r=d[t].content.length,c=l[t]+e,h=c+r;if(c>s)break;if(o<h){const e=d[t];if(e.inlineClassName){const t=i>0?a.wrappedTextIndentLength:0,r=t+Math.max(c-o,0),l=t+Math.min(h-o,s);r!==l&&n.push(new dw(r,l,e.inlineClassName,e.inlineClassNameAffectsLetterSpacing))}}if(!(h<=s))break;e+=r,t++}}}c=l?e.getLineTokens(t).withInserted(l.map(((e,t)=>({offset:e,text:d[t].content,tokenMetadata:zb.defaultTokenMetadata})))):e.getLineTokens(t);for(let u=i;u<i+n;u++){const e=o+u-i;s[e]?r[e]=this._getViewLineData(c,h?h[u]:null,u):r[e]=null}}_getViewLineData(e,t,i){this._assertVisible();const n=this._projectionData,o=i>0?n.wrappedTextIndentLength:0,s=i>0?n.breakOffsets[i-1]:0,r=n.breakOffsets[i],a=e.sliceAndInflate(s,r,o);let l=a.getLineContent();i>0&&(l=oF(n.wrappedTextIndentLength)+l);const d=this._projectionData.getMinOutputOffset(i)+1,c=l.length+1,h=i+1<this.getViewLineCount(),u=0===i?0:n.breakOffsetsVisibleColumn[i-1];return new rw(l,h,d,c,u,a,t)}getModelColumnOfViewPosition(e,t){return this._assertVisible(),this._projectionData.translateToInputOffset(e,t-1)+1}getViewPositionOfModelPosition(e,t,i=2){this._assertVisible();return this._projectionData.translateToOutputPosition(t-1,i).toPosition(e)}getViewLineNumberOfModelPosition(e,t){this._assertVisible();return e+this._projectionData.translateToOutputPosition(t-1).outputLineIndex}normalizePosition(e,t,i){const n=t.lineNumber-e;return this._projectionData.normalizeOutputPosition(e,t.column-1,i).toPosition(n)}getInjectedTextAt(e,t){return this._projectionData.getInjectedText(e,t-1)}_assertVisible(){if(!this._isVisible)throw new Error("Not supported")}}class tF{constructor(){}isVisible(){return!0}setVisible(e){return e?this:iF.INSTANCE}getProjectionData(){return null}getViewLineCount(){return 1}getViewLineContent(e,t,i){return e.getLineContent(t)}getViewLineLength(e,t,i){return e.getLineLength(t)}getViewLineMinColumn(e,t,i){return e.getLineMinColumn(t)}getViewLineMaxColumn(e,t,i){return e.getLineMaxColumn(t)}getViewLineData(e,t,i){const n=e.getLineTokens(t),o=n.getLineContent();return new rw(o,!1,1,o.length+1,0,n.inflate(),null)}getViewLinesData(e,t,i,n,o,s,r){s[o]?r[o]=this.getViewLineData(e,t,0):r[o]=null}getModelColumnOfViewPosition(e,t){return t}getViewPositionOfModelPosition(e,t){return new er(e,t)}getViewLineNumberOfModelPosition(e,t){return e}normalizePosition(e,t,i){return t}getInjectedTextAt(e,t){return null}}tF.INSTANCE=new tF;class iF{constructor(){}isVisible(){return!1}setVisible(e){return e?tF.INSTANCE:this}getProjectionData(){return null}getViewLineCount(){return 0}getViewLineContent(e,t,i){throw new Error("Not supported")}getViewLineLength(e,t,i){throw new Error("Not supported")}getViewLineMinColumn(e,t,i){throw new Error("Not supported")}getViewLineMaxColumn(e,t,i){throw new Error("Not supported")}getViewLineData(e,t,i){throw new Error("Not supported")}getViewLinesData(e,t,i,n,o,s,r){throw new Error("Not supported")}getModelColumnOfViewPosition(e,t){throw new Error("Not supported")}getViewPositionOfModelPosition(e,t){throw new Error("Not supported")}getViewLineNumberOfModelPosition(e,t){throw new Error("Not supported")}normalizePosition(e,t,i){throw new Error("Not supported")}getInjectedTextAt(e,t){throw new Error("Not supported")}}iF.INSTANCE=new iF;let nF=[""];function oF(e){if(e>=nF.length)for(let t=1;t<=e;t++)nF[t]=sF(t);return nF[e]}function sF(e){return new Array(e+1).join(" ")}class rF{constructor(e,t,i,n,o,s,r,a,l){this._editorId=e,this.model=t,this._validModelVersionId=-1,this._domLineBreaksComputerFactory=i,this._monospaceLineBreaksComputerFactory=n,this.fontInfo=o,this.tabSize=s,this.wrappingStrategy=r,this.wrappingColumn=a,this.wrappingIndent=l,this._constructLines(!0,null)}dispose(){this.hiddenAreasDecorationIds=this.model.deltaDecorations(this.hiddenAreasDecorationIds,[])}createCoordinatesConverter(){return new dF(this)}_constructLines(e,t){this.modelLineProjections=[],e&&(this.hiddenAreasDecorationIds=this.model.deltaDecorations(this.hiddenAreasDecorationIds,[]));const i=this.model.getLinesContent(),n=this.model.getInjectedTextDecorations(this._editorId),o=i.length,s=this.createLineBreaksComputer(),r=new Cr(DM.fromDecorations(n));for(let p=0;p<o;p++){const e=r.takeWhile((e=>e.lineNumber===p+1));s.addRequest(i[p],e,t?t[p]:null)}const a=s.finalize(),l=[],d=this.hiddenAreasDecorationIds.map((e=>this.model.getDecorationRange(e))).sort(qo.compareRangesUsingStarts);let c=1,h=0,u=-1,g=u+1<d.length?h+1:o+2;for(let p=0;p<o;p++){const e=p+1;e===g&&(u++,c=d[u].startLineNumber,h=d[u].endLineNumber,g=u+1<d.length?h+1:o+2);const t=e>=c&&e<=h,i=JP(a[p],!t);l[p]=i.getViewLineCount(),this.modelLineProjections[p]=i}this._validModelVersionId=this.model.getVersionId(),this.projectedModelLineLineCounts=new la(l)}getHiddenAreas(){return this.hiddenAreasDecorationIds.map((e=>this.model.getDecorationRange(e)))}setHiddenAreas(e){const t=function(e){if(0===e.length)return[];const t=e.slice();t.sort(qo.compareRangesUsingStarts);const i=[];let n=t[0].startLineNumber,o=t[0].endLineNumber;for(let s=1,r=t.length;s<r;s++){const e=t[s];e.startLineNumber>o+1?(i.push(new qo(n,1,o,1)),n=e.startLineNumber,o=e.endLineNumber):e.endLineNumber>o&&(o=e.endLineNumber)}return i.push(new qo(n,1,o,1)),i}(e.map((e=>this.model.validateRange(e)))),i=this.hiddenAreasDecorationIds.map((e=>this.model.getDecorationRange(e))).sort(qo.compareRangesUsingStarts);if(t.length===i.length){let e=!1;for(let n=0;n<t.length;n++)if(!t[n].equalsRange(i[n])){e=!0;break}if(!e)return!1}const n=t.map((e=>({range:e,options:GP.EMPTY})));this.hiddenAreasDecorationIds=this.model.deltaDecorations(this.hiddenAreasDecorationIds,n);const o=t;let s=1,r=0,a=-1,l=a+1<o.length?r+1:this.modelLineProjections.length+2,d=!1;for(let c=0;c<this.modelLineProjections.length;c++){const e=c+1;e===l&&(a++,s=o[a].startLineNumber,r=o[a].endLineNumber,l=a+1<o.length?r+1:this.modelLineProjections.length+2);let t=!1;if(e>=s&&e<=r?this.modelLineProjections[c].isVisible()&&(this.modelLineProjections[c]=this.modelLineProjections[c].setVisible(!1),t=!0):(d=!0,this.modelLineProjections[c].isVisible()||(this.modelLineProjections[c]=this.modelLineProjections[c].setVisible(!0),t=!0)),t){const e=this.modelLineProjections[c].getViewLineCount();this.projectedModelLineLineCounts.setValue(c,e)}}return d||this.setHiddenAreas([]),!0}modelPositionIsVisible(e,t){return!(e<1||e>this.modelLineProjections.length)&&this.modelLineProjections[e-1].isVisible()}getModelLineViewLineCount(e){return e<1||e>this.modelLineProjections.length?1:this.modelLineProjections[e-1].getViewLineCount()}setTabSize(e){return this.tabSize!==e&&(this.tabSize=e,this._constructLines(!1,null),!0)}setWrappingSettings(e,t,i,n){const o=this.fontInfo.equals(e),s=this.wrappingStrategy===t,r=this.wrappingColumn===i,a=this.wrappingIndent===n;if(o&&s&&r&&a)return!1;const l=o&&s&&!r&&a;this.fontInfo=e,this.wrappingStrategy=t,this.wrappingColumn=i,this.wrappingIndent=n;let d=null;if(l){d=[];for(let e=0,t=this.modelLineProjections.length;e<t;e++)d[e]=this.modelLineProjections[e].getProjectionData()}return this._constructLines(!1,d),!0}createLineBreaksComputer(){return("advanced"===this.wrappingStrategy?this._domLineBreaksComputerFactory:this._monospaceLineBreaksComputerFactory).createLineBreaksComputer(this.fontInfo,this.tabSize,this.wrappingColumn,this.wrappingIndent)}onModelFlushed(){this._constructLines(!0,null)}onModelLinesDeleted(e,t,i){if(!e||e<=this._validModelVersionId)return null;const n=1===t?1:this.projectedModelLineLineCounts.getPrefixSum(t-1)+1,o=this.projectedModelLineLineCounts.getPrefixSum(i);return this.modelLineProjections.splice(t-1,i-t+1),this.projectedModelLineLineCounts.removeValues(t-1,i-t+1),new UM(n,o)}onModelLinesInserted(e,t,i,n){if(!e||e<=this._validModelVersionId)return null;const o=t>2&&!this.modelLineProjections[t-2].isVisible(),s=1===t?1:this.projectedModelLineLineCounts.getPrefixSum(t-1)+1;let r=0;const a=[],l=[];for(let d=0,c=n.length;d<c;d++){const e=JP(n[d],!o);a.push(e);const t=e.getViewLineCount();r+=t,l[d]=t}return this.modelLineProjections=this.modelLineProjections.slice(0,t-1).concat(a).concat(this.modelLineProjections.slice(t-1)),this.projectedModelLineLineCounts.insertValues(t-1,l),new $M(s,s+r-1)}onModelLineChanged(e,t,i){if(null!==e&&e<=this._validModelVersionId)return[!1,null,null,null];const n=t-1,o=this.modelLineProjections[n].getViewLineCount(),s=JP(i,this.modelLineProjections[n].isVisible());this.modelLineProjections[n]=s;const r=this.modelLineProjections[n].getViewLineCount();let a=!1,l=0,d=-1,c=0,h=-1,u=0,g=-1;o>r?(l=this.projectedModelLineLineCounts.getPrefixSum(t-1)+1,d=l+r-1,u=d+1,g=u+(o-r)-1,a=!0):o<r?(l=this.projectedModelLineLineCounts.getPrefixSum(t-1)+1,d=l+o-1,c=d+1,h=c+(r-o)-1,a=!0):(l=this.projectedModelLineLineCounts.getPrefixSum(t-1)+1,d=l+r-1),this.projectedModelLineLineCounts.setValue(n,r);return[a,l<=d?new jM(l,d):null,c<=h?new $M(c,h):null,u<=g?new UM(u,g):null]}acceptVersionId(e){this._validModelVersionId=e,1!==this.modelLineProjections.length||this.modelLineProjections[0].isVisible()||this.setHiddenAreas([])}getViewLineCount(){return this.projectedModelLineLineCounts.getTotalSum()}_toValidViewLineNumber(e){if(e<1)return 1;const t=this.getViewLineCount();return e>t?t:0|e}getActiveIndentGuide(e,t,i){e=this._toValidViewLineNumber(e),t=this._toValidViewLineNumber(t),i=this._toValidViewLineNumber(i);const n=this.convertViewPositionToModelPosition(e,this.getViewLineMinColumn(e)),o=this.convertViewPositionToModelPosition(t,this.getViewLineMinColumn(t)),s=this.convertViewPositionToModelPosition(i,this.getViewLineMinColumn(i)),r=this.model.guides.getActiveIndentGuide(n.lineNumber,o.lineNumber,s.lineNumber),a=this.convertModelPositionToViewPosition(r.startLineNumber,1),l=this.convertModelPositionToViewPosition(r.endLineNumber,this.model.getLineMaxColumn(r.endLineNumber));return{startLineNumber:a.lineNumber,endLineNumber:l.lineNumber,indent:r.indent}}getViewLineInfo(e){e=this._toValidViewLineNumber(e);const t=this.projectedModelLineLineCounts.getIndexOf(e-1),i=t.index,n=t.remainder;return new aF(i+1,n)}getMinColumnOfViewLine(e){return this.modelLineProjections[e.modelLineNumber-1].getViewLineMinColumn(this.model,e.modelLineNumber,e.modelLineWrappedLineIdx)}getModelStartPositionOfViewLine(e){const t=this.modelLineProjections[e.modelLineNumber-1],i=t.getViewLineMinColumn(this.model,e.modelLineNumber,e.modelLineWrappedLineIdx),n=t.getModelColumnOfViewPosition(e.modelLineWrappedLineIdx,i);return new er(e.modelLineNumber,n)}getModelEndPositionOfViewLine(e){const t=this.modelLineProjections[e.modelLineNumber-1],i=t.getViewLineMaxColumn(this.model,e.modelLineNumber,e.modelLineWrappedLineIdx),n=t.getModelColumnOfViewPosition(e.modelLineWrappedLineIdx,i);return new er(e.modelLineNumber,n)}getViewLineInfosGroupedByModelRanges(e,t){const i=this.getViewLineInfo(e),n=this.getViewLineInfo(t),o=new Array;let s=this.getModelStartPositionOfViewLine(i),r=new Array;for(let a=i.modelLineNumber;a<=n.modelLineNumber;a++){const e=this.modelLineProjections[a-1];if(e.isVisible()){const t=a===i.modelLineNumber?i.modelLineWrappedLineIdx:0,o=a===n.modelLineNumber?n.modelLineWrappedLineIdx+1:e.getViewLineCount();for(let e=t;e<o;e++)r.push(new aF(a,e))}if(!e.isVisible()&&s){const e=new er(a-1,this.model.getLineMaxColumn(a-1)+1),t=qo.fromPositions(s,e);o.push(new lF(t,r)),r=[],s=null}else e.isVisible()&&!s&&(s=new er(a,1))}if(s){const e=qo.fromPositions(s,this.getModelEndPositionOfViewLine(n));o.push(new lF(e,r))}return o}getViewLinesBracketGuides(e,t,i,n){const o=i?this.convertViewPositionToModelPosition(i.lineNumber,i.column):null,s=[];for(const r of this.getViewLineInfosGroupedByModelRanges(e,t)){const e=r.modelRange.startLineNumber,t=this.model.guides.getLinesBracketGuides(e,r.modelRange.endLineNumber,o,n);for(const i of r.viewLines)if(i.isWrappedLineContinuation&&1===this.getMinColumnOfViewLine(i))s.push([]);else{let n=t[i.modelLineNumber-e];n=n.map((e=>e.horizontalLine?new xT(e.visibleColumn,e.className,new ST(e.horizontalLine.top,this.convertModelPositionToViewPosition(i.modelLineNumber,e.horizontalLine.endColumn).column)):e)),s.push(n)}}return s}getViewLinesIndentGuides(e,t){e=this._toValidViewLineNumber(e),t=this._toValidViewLineNumber(t);const i=this.convertViewPositionToModelPosition(e,this.getViewLineMinColumn(e)),n=this.convertViewPositionToModelPosition(t,this.getViewLineMaxColumn(t));let o=[];const s=[],r=[],a=i.lineNumber-1,l=n.lineNumber-1;let d=null;for(let g=a;g<=l;g++){const e=this.modelLineProjections[g];if(e.isVisible()){const t=e.getViewLineNumberOfModelPosition(0,g===a?i.column:1),n=e.getViewLineNumberOfModelPosition(0,this.model.getLineMaxColumn(g+1)),o=n-t+1;let l=0;o>1&&1===e.getViewLineMinColumn(this.model,g+1,n)&&(l=0===t?1:2),s.push(o),r.push(l),null===d&&(d=new er(g+1,0))}else null!==d&&(o=o.concat(this.model.guides.getLinesIndentGuides(d.lineNumber,g)),d=null)}null!==d&&(o=o.concat(this.model.guides.getLinesIndentGuides(d.lineNumber,n.lineNumber)),d=null);const c=t-e+1,h=new Array(c);let u=0;for(let g=0,p=o.length;g<p;g++){let e=o[g];const t=Math.min(c-u,s[g]),i=r[g];let n;n=2===i?0:1===i?1:t;for(let o=0;o<t;o++)o===n&&(e=0),h[u++]=e}return h}getViewLineContent(e){const t=this.getViewLineInfo(e);return this.modelLineProjections[t.modelLineNumber-1].getViewLineContent(this.model,t.modelLineNumber,t.modelLineWrappedLineIdx)}getViewLineLength(e){const t=this.getViewLineInfo(e);return this.modelLineProjections[t.modelLineNumber-1].getViewLineLength(this.model,t.modelLineNumber,t.modelLineWrappedLineIdx)}getViewLineMinColumn(e){const t=this.getViewLineInfo(e);return this.modelLineProjections[t.modelLineNumber-1].getViewLineMinColumn(this.model,t.modelLineNumber,t.modelLineWrappedLineIdx)}getViewLineMaxColumn(e){const t=this.getViewLineInfo(e);return this.modelLineProjections[t.modelLineNumber-1].getViewLineMaxColumn(this.model,t.modelLineNumber,t.modelLineWrappedLineIdx)}getViewLineData(e){const t=this.getViewLineInfo(e);return this.modelLineProjections[t.modelLineNumber-1].getViewLineData(this.model,t.modelLineNumber,t.modelLineWrappedLineIdx)}getViewLinesData(e,t,i){e=this._toValidViewLineNumber(e),t=this._toValidViewLineNumber(t);const n=this.projectedModelLineLineCounts.getIndexOf(e-1);let o=e;const s=n.index,r=n.remainder,a=[];for(let l=s,d=this.model.getLineCount();l<d;l++){const n=this.modelLineProjections[l];if(!n.isVisible())continue;const d=l===s?r:0;let c=n.getViewLineCount()-d,h=!1;if(o+c>t&&(h=!0,c=t-o+1),n.getViewLinesData(this.model,l+1,d,c,o-e,i,a),o+=c,h)break}return a}validateViewPosition(e,t,i){e=this._toValidViewLineNumber(e);const n=this.projectedModelLineLineCounts.getIndexOf(e-1),o=n.index,s=n.remainder,r=this.modelLineProjections[o],a=r.getViewLineMinColumn(this.model,o+1,s),l=r.getViewLineMaxColumn(this.model,o+1,s);t<a&&(t=a),t>l&&(t=l);const d=r.getModelColumnOfViewPosition(s,t);return this.model.validatePosition(new er(o+1,d)).equals(i)?new er(e,t):this.convertModelPositionToViewPosition(i.lineNumber,i.column)}validateViewRange(e,t){const i=this.validateViewPosition(e.startLineNumber,e.startColumn,t.getStartPosition()),n=this.validateViewPosition(e.endLineNumber,e.endColumn,t.getEndPosition());return new qo(i.lineNumber,i.column,n.lineNumber,n.column)}convertViewPositionToModelPosition(e,t){const i=this.getViewLineInfo(e),n=this.modelLineProjections[i.modelLineNumber-1].getModelColumnOfViewPosition(i.modelLineWrappedLineIdx,t);return this.model.validatePosition(new er(i.modelLineNumber,n))}convertViewRangeToModelRange(e){const t=this.convertViewPositionToModelPosition(e.startLineNumber,e.startColumn),i=this.convertViewPositionToModelPosition(e.endLineNumber,e.endColumn);return new qo(t.lineNumber,t.column,i.lineNumber,i.column)}convertModelPositionToViewPosition(e,t,i=2){const n=this.model.validatePosition(new er(e,t)),o=n.lineNumber,s=n.column;let r=o-1,a=!1;for(;r>0&&!this.modelLineProjections[r].isVisible();)r--,a=!0;if(0===r&&!this.modelLineProjections[r].isVisible())return new er(1,1);const l=1+this.projectedModelLineLineCounts.getPrefixSum(r);let d;return d=a?this.modelLineProjections[r].getViewPositionOfModelPosition(l,this.model.getLineMaxColumn(r+1),i):this.modelLineProjections[o-1].getViewPositionOfModelPosition(l,s,i),d}convertModelRangeToViewRange(e,t=0){if(e.isEmpty()){const i=this.convertModelPositionToViewPosition(e.startLineNumber,e.startColumn,t);return qo.fromPositions(i)}{const t=this.convertModelPositionToViewPosition(e.startLineNumber,e.startColumn,1),i=this.convertModelPositionToViewPosition(e.endLineNumber,e.endColumn,0);return new qo(t.lineNumber,t.column,i.lineNumber,i.column)}}getViewLineNumberOfModelPosition(e,t){let i=e-1;if(this.modelLineProjections[i].isVisible()){const e=1+this.projectedModelLineLineCounts.getPrefixSum(i);return this.modelLineProjections[i].getViewLineNumberOfModelPosition(e,t)}for(;i>0&&!this.modelLineProjections[i].isVisible();)i--;if(0===i&&!this.modelLineProjections[i].isVisible())return 1;const n=1+this.projectedModelLineLineCounts.getPrefixSum(i);return this.modelLineProjections[i].getViewLineNumberOfModelPosition(n,this.model.getLineMaxColumn(i+1))}getDecorationsInRange(e,t,i){const n=this.convertViewPositionToModelPosition(e.startLineNumber,e.startColumn),o=this.convertViewPositionToModelPosition(e.endLineNumber,e.endColumn);if(o.lineNumber-n.lineNumber<=e.endLineNumber-e.startLineNumber)return this.model.getDecorationsInRange(new qo(n.lineNumber,1,o.lineNumber,o.column),t,i);let s=[];const r=n.lineNumber-1,a=o.lineNumber-1;let l=null;for(let u=r;u<=a;u++){if(this.modelLineProjections[u].isVisible())null===l&&(l=new er(u+1,u===r?n.column:1));else if(null!==l){const e=this.model.getLineMaxColumn(u);s=s.concat(this.model.getDecorationsInRange(new qo(l.lineNumber,l.column,u,e),t,i)),l=null}}null!==l&&(s=s.concat(this.model.getDecorationsInRange(new qo(l.lineNumber,l.column,o.lineNumber,o.column),t,i)),l=null),s.sort(((e,t)=>{const i=qo.compareRangesUsingStarts(e.range,t.range);return 0===i?e.id<t.id?-1:e.id>t.id?1:0:i}));let d=[],c=0,h=null;for(const u of s){const e=u.id;h!==e&&(h=e,d[c++]=u)}return d}getInjectedTextAt(e){const t=this.getViewLineInfo(e.lineNumber);return this.modelLineProjections[t.modelLineNumber-1].getInjectedTextAt(t.modelLineWrappedLineIdx,e.column)}normalizePosition(e,t){const i=this.getViewLineInfo(e.lineNumber);return this.modelLineProjections[i.modelLineNumber-1].normalizePosition(i.modelLineWrappedLineIdx,e,t)}getLineIndentColumn(e){const t=this.getViewLineInfo(e);return 0===t.modelLineWrappedLineIdx?this.model.getLineIndentColumn(t.modelLineNumber):0}}class aF{constructor(e,t){this.modelLineNumber=e,this.modelLineWrappedLineIdx=t}get isWrappedLineContinuation(){return this.modelLineWrappedLineIdx>0}}class lF{constructor(e,t){this.modelRange=e,this.viewLines=t}}class dF{constructor(e){this._lines=e}convertViewPositionToModelPosition(e){return this._lines.convertViewPositionToModelPosition(e.lineNumber,e.column)}convertViewRangeToModelRange(e){return this._lines.convertViewRangeToModelRange(e)}validateViewPosition(e,t){return this._lines.validateViewPosition(e.lineNumber,e.column,t)}validateViewRange(e,t){return this._lines.validateViewRange(e,t)}convertModelPositionToViewPosition(e,t){return this._lines.convertModelPositionToViewPosition(e.lineNumber,e.column,t)}convertModelRangeToViewRange(e,t){return this._lines.convertModelRangeToViewRange(e,t)}modelPositionIsVisible(e){return this._lines.modelPositionIsVisible(e.lineNumber,e.column)}getModelLineViewLineCount(e){return this._lines.getModelLineViewLineCount(e)}getViewLineNumberOfModelPosition(e,t){return this._lines.getViewLineNumberOfModelPosition(e,t)}}class cF{constructor(e){this.model=e}dispose(){}createCoordinatesConverter(){return new hF(this)}getHiddenAreas(){return[]}setHiddenAreas(e){return!1}setTabSize(e){return!1}setWrappingSettings(e,t,i,n){return!1}createLineBreaksComputer(){const e=[];return{addRequest:(t,i,n)=>{e.push(null)},finalize:()=>e}}onModelFlushed(){}onModelLinesDeleted(e,t,i){return new UM(t,i)}onModelLinesInserted(e,t,i,n){return new $M(t,i)}onModelLineChanged(e,t,i){return[!1,new jM(t,t),null,null]}acceptVersionId(e){}getViewLineCount(){return this.model.getLineCount()}getActiveIndentGuide(e,t,i){return{startLineNumber:e,endLineNumber:e,indent:0}}getViewLinesBracketGuides(e,t,i){return new Array(t-e+1).fill([])}getViewLinesIndentGuides(e,t){const i=t-e+1,n=new Array(i);for(let o=0;o<i;o++)n[o]=0;return n}getViewLineContent(e){return this.model.getLineContent(e)}getViewLineLength(e){return this.model.getLineLength(e)}getViewLineMinColumn(e){return this.model.getLineMinColumn(e)}getViewLineMaxColumn(e){return this.model.getLineMaxColumn(e)}getViewLineData(e){const t=this.model.getLineTokens(e),i=t.getLineContent();return new rw(i,!1,1,i.length+1,0,t.inflate(),null)}getViewLinesData(e,t,i){const n=this.model.getLineCount();e=Math.min(Math.max(1,e),n),t=Math.min(Math.max(1,t),n);const o=[];for(let s=e;s<=t;s++){const t=s-e;o[t]=i[t]?this.getViewLineData(s):null}return o}getDecorationsInRange(e,t,i){return this.model.getDecorationsInRange(e,t,i)}normalizePosition(e,t){return this.model.normalizePosition(e,t)}getLineIndentColumn(e){return this.model.getLineIndentColumn(e)}getInjectedTextAt(e){return null}}class hF{constructor(e){this._lines=e}_validPosition(e){return this._lines.model.validatePosition(e)}_validRange(e){return this._lines.model.validateRange(e)}convertViewPositionToModelPosition(e){return this._validPosition(e)}convertViewRangeToModelRange(e){return this._validRange(e)}validateViewPosition(e,t){return this._validPosition(t)}validateViewRange(e,t){return this._validRange(t)}convertModelPositionToViewPosition(e){return this._validPosition(e)}convertModelRangeToViewRange(e){return this._validRange(e)}modelPositionIsVisible(e){const t=this._lines.model.getLineCount();return!(e.lineNumber<1||e.lineNumber>t)}getModelLineViewLineCount(e){return 1}getViewLineNumberOfModelPosition(e,t){return e}}class uF extends Uo{constructor(e,t,i,n,o,s,r,a){if(super(),this.languageConfigurationService=r,this._themeService=a,this._editorId=e,this._configuration=t,this.model=i,this._eventDispatcher=new QM,this.onEvent=this._eventDispatcher.onEvent,this.cursorConfig=new $E(this.model.getLanguageId(),this.model.getOptions(),this._configuration,this.languageConfigurationService),this._tokenizeViewportSoon=this._register(new lb((()=>this.tokenizeViewport()),50)),this._updateConfigurationViewLineCount=this._register(new lb((()=>this._updateConfigurationViewLineCountNow()),0)),this._hasFocus=!1,this._viewportStartLine=-1,this._viewportStartLineTrackedRange=null,this._viewportStartLineDelta=0,this.model.isTooLargeForTokenization())this._lines=new cF(this.model);else{const e=this._configuration.options,t=e.get(44),i=e.get(125),s=e.get(132),r=e.get(124);this._lines=new rF(this._editorId,this.model,n,o,t,this.model.getOptions().tabSize,i,s.wrappingColumn,r)}this.coordinatesConverter=this._lines.createCoordinatesConverter(),this._cursor=this._register(new rA(i,this,this.coordinatesConverter,this.cursorConfig)),this.viewLayout=this._register(new FA(this._configuration,this.getLineCount(),s)),this._register(this.viewLayout.onDidScroll((e=>{e.scrollTopChanged&&this._tokenizeViewportSoon.schedule(),this._eventDispatcher.emitSingleViewEvent(new qM(e)),this._eventDispatcher.emitOutgoingEvent(new iA(e.oldScrollWidth,e.oldScrollLeft,e.oldScrollHeight,e.oldScrollTop,e.scrollWidth,e.scrollLeft,e.scrollHeight,e.scrollTop))}))),this._register(this.viewLayout.onDidContentSizeChange((e=>{this._eventDispatcher.emitOutgoingEvent(e)}))),this._decorations=new BA(this._editorId,this.model,this._configuration,this._lines,this.coordinatesConverter),this._registerModelEvents(),this._register(this._configuration.onDidChangeFast((e=>{try{const t=this._eventDispatcher.beginEmitViewEvents();this._onConfigurationChanged(t,e)}finally{this._eventDispatcher.endEmitViewEvents()}}))),this._register(PT.getInstance().onDidChange((()=>{this._eventDispatcher.emitSingleViewEvent(new YM)}))),this._register(this._themeService.onDidColorThemeChange((e=>{this._invalidateDecorationsColorCache(),this._eventDispatcher.emitSingleViewEvent(new GM(e))}))),this._updateConfigurationViewLineCountNow()}dispose(){super.dispose(),this._decorations.dispose(),this._lines.dispose(),this._viewportStartLineTrackedRange=this.model._setTrackedRange(this._viewportStartLineTrackedRange,null,1),this._eventDispatcher.dispose()}createLineBreaksComputer(){return this._lines.createLineBreaksComputer()}addViewEventHandler(e){this._eventDispatcher.addViewEventHandler(e)}removeViewEventHandler(e){this._eventDispatcher.removeViewEventHandler(e)}_updateConfigurationViewLineCountNow(){this._configuration.setViewLineCount(this._lines.getViewLineCount())}tokenizeViewport(){const e=this.viewLayout.getLinesViewportData(),t=new qo(e.startLineNumber,this.getLineMinColumn(e.startLineNumber),e.endLineNumber,this.getLineMaxColumn(e.endLineNumber)),i=this._toModelVisibleRanges(t);for(const n of i)this.model.tokenizeViewport(n.startLineNumber,n.endLineNumber)}setHasFocus(e){this._hasFocus=e,this._cursor.setHasFocus(e),this._eventDispatcher.emitSingleViewEvent(new WM(e)),this._eventDispatcher.emitOutgoingEvent(new tA(!e,e))}onCompositionStart(){this._eventDispatcher.emitSingleViewEvent(new OM)}onCompositionEnd(){this._eventDispatcher.emitSingleViewEvent(new RM)}_onConfigurationChanged(e,t){let i=null;if(-1!==this._viewportStartLine){const e=new er(this._viewportStartLine,this.getLineMinColumn(this._viewportStartLine));i=this.coordinatesConverter.convertViewPositionToModelPosition(e)}let n=!1;const o=this._configuration.options,s=o.get(44),r=o.get(125),a=o.get(132),l=o.get(124);if(this._lines.setWrappingSettings(s,r,a.wrappingColumn,l)&&(e.emitViewEvent(new VM),e.emitViewEvent(new HM),e.emitViewEvent(new BM(null)),this._cursor.onLineMappingChanged(e),this._decorations.onLineMappingChanged(),this.viewLayout.onFlushed(this.getLineCount()),0!==this.viewLayout.getCurrentScrollTop()&&(n=!0),this._updateConfigurationViewLineCount.schedule()),t.hasChanged(81)&&(this._decorations.reset(),e.emitViewEvent(new BM(null))),e.emitViewEvent(new PM(t)),this.viewLayout.onConfigurationChanged(t),n&&i){const e=this.coordinatesConverter.convertModelPositionToViewPosition(i),t=this.viewLayout.getVerticalOffsetForLineNumber(e.lineNumber);this.viewLayout.setScrollPosition({scrollTop:t+this._viewportStartLineDelta},1)}$E.shouldRecreate(t)&&(this.cursorConfig=new $E(this.model.getLanguageId(),this.model.getOptions(),this._configuration,this.languageConfigurationService),this._cursor.updateConfiguration(this.cursorConfig))}_registerModelEvents(){this._register(this.model.onDidChangeContentOrInjectedText((e=>{try{const t=this._eventDispatcher.beginEmitViewEvents();let i=!1,n=!1;const o=e.changes,s=e instanceof TM?e.versionId:null,r=this._lines.createLineBreaksComputer();for(const e of o)switch(e.changeType){case 4:for(let t=0;t<e.detail.length;t++){const i=e.detail[t];let n=e.injectedTexts[t];n&&(n=n.filter((e=>!e.ownerId||e.ownerId===this._editorId))),r.addRequest(i,n,null)}break;case 2:{let t=null;e.injectedText&&(t=e.injectedText.filter((e=>!e.ownerId||e.ownerId===this._editorId))),r.addRequest(e.detail,t,null);break}}const a=r.finalize(),l=new Cr(a);for(const e of o)switch(e.changeType){case 1:this._lines.onModelFlushed(),t.emitViewEvent(new VM),this._decorations.reset(),this.viewLayout.onFlushed(this.getLineCount()),i=!0;break;case 3:{const n=this._lines.onModelLinesDeleted(s,e.fromLineNumber,e.toLineNumber);null!==n&&(t.emitViewEvent(n),this.viewLayout.onLinesDeleted(n.fromLineNumber,n.toLineNumber)),i=!0;break}case 4:{const n=l.takeCount(e.detail.length),o=this._lines.onModelLinesInserted(s,e.fromLineNumber,e.toLineNumber,n);null!==o&&(t.emitViewEvent(o),this.viewLayout.onLinesInserted(o.fromLineNumber,o.toLineNumber)),i=!0;break}case 2:{const i=l.dequeue(),[o,r,a,d]=this._lines.onModelLineChanged(s,e.lineNumber,i);n=o,r&&t.emitViewEvent(r),a&&(t.emitViewEvent(a),this.viewLayout.onLinesInserted(a.fromLineNumber,a.toLineNumber)),d&&(t.emitViewEvent(d),this.viewLayout.onLinesDeleted(d.fromLineNumber,d.toLineNumber));break}}null!==s&&this._lines.acceptVersionId(s),this.viewLayout.onHeightMaybeChanged(),!i&&n&&(t.emitViewEvent(new HM),t.emitViewEvent(new BM(null)),this._cursor.onLineMappingChanged(t),this._decorations.onLineMappingChanged())}finally{this._eventDispatcher.endEmitViewEvents()}if(this._viewportStartLine=-1,this._configuration.setModelLineCount(this.model.getLineCount()),this._updateConfigurationViewLineCountNow(),!this._hasFocus&&this.model.getAttachedEditorCount()>=2&&this._viewportStartLineTrackedRange){const e=this.model._getTrackedRange(this._viewportStartLineTrackedRange);if(e){const t=this.coordinatesConverter.convertModelPositionToViewPosition(e.getStartPosition()),i=this.viewLayout.getVerticalOffsetForLineNumber(t.lineNumber);this.viewLayout.setScrollPosition({scrollTop:i+this._viewportStartLineDelta},1)}}try{const t=this._eventDispatcher.beginEmitViewEvents();this._cursor.onModelContentChanged(t,e)}finally{this._eventDispatcher.endEmitViewEvents()}this._tokenizeViewportSoon.schedule()}))),this._register(this.model.onDidChangeTokens((e=>{const t=[];for(let i=0,n=e.ranges.length;i<n;i++){const n=e.ranges[i],o=this.coordinatesConverter.convertModelPositionToViewPosition(new er(n.fromLineNumber,1)).lineNumber,s=this.coordinatesConverter.convertModelPositionToViewPosition(new er(n.toLineNumber,this.model.getLineMaxColumn(n.toLineNumber))).lineNumber;t[i]={fromLineNumber:o,toLineNumber:s}}this._eventDispatcher.emitSingleViewEvent(new ZM(t)),e.tokenizationSupportChanged&&this._tokenizeViewportSoon.schedule()}))),this._register(this.model.onDidChangeLanguageConfiguration((e=>{this._eventDispatcher.emitSingleViewEvent(new zM),this.cursorConfig=new $E(this.model.getLanguageId(),this.model.getOptions(),this._configuration,this.languageConfigurationService),this._cursor.updateConfiguration(this.cursorConfig)}))),this._register(this.model.onDidChangeLanguage((e=>{this.cursorConfig=new $E(this.model.getLanguageId(),this.model.getOptions(),this._configuration,this.languageConfigurationService),this._cursor.updateConfiguration(this.cursorConfig)}))),this._register(this.model.onDidChangeOptions((e=>{if(this._lines.setTabSize(this.model.getOptions().tabSize)){try{const e=this._eventDispatcher.beginEmitViewEvents();e.emitViewEvent(new VM),e.emitViewEvent(new HM),e.emitViewEvent(new BM(null)),this._cursor.onLineMappingChanged(e),this._decorations.onLineMappingChanged(),this.viewLayout.onFlushed(this.getLineCount())}finally{this._eventDispatcher.endEmitViewEvents()}this._updateConfigurationViewLineCount.schedule()}this.cursorConfig=new $E(this.model.getLanguageId(),this.model.getOptions(),this._configuration,this.languageConfigurationService),this._cursor.updateConfiguration(this.cursorConfig)}))),this._register(this.model.onDidChangeDecorations((e=>{this._decorations.onModelDecorationsChanged(),this._eventDispatcher.emitSingleViewEvent(new BM(e))})))}setHiddenAreas(e){let t=!1;try{const i=this._eventDispatcher.beginEmitViewEvents();t=this._lines.setHiddenAreas(e),t&&(i.emitViewEvent(new VM),i.emitViewEvent(new HM),i.emitViewEvent(new BM(null)),this._cursor.onLineMappingChanged(i),this._decorations.onLineMappingChanged(),this.viewLayout.onFlushed(this.getLineCount()),this.viewLayout.onHeightMaybeChanged())}finally{this._eventDispatcher.endEmitViewEvents()}this._updateConfigurationViewLineCount.schedule(),t&&this._eventDispatcher.emitOutgoingEvent(new nA)}getVisibleRangesPlusViewportAboveBelow(){const e=this._configuration.options.get(131),t=this._configuration.options.get(59),i=Math.max(20,Math.round(e.height/t)),n=this.viewLayout.getLinesViewportData(),o=Math.max(1,n.completelyVisibleStartLineNumber-i),s=Math.min(this.getLineCount(),n.completelyVisibleEndLineNumber+i);return this._toModelVisibleRanges(new qo(o,this.getLineMinColumn(o),s,this.getLineMaxColumn(s)))}getVisibleRanges(){const e=this.getCompletelyVisibleViewRange();return this._toModelVisibleRanges(e)}_toModelVisibleRanges(e){const t=this.coordinatesConverter.convertViewRangeToModelRange(e),i=this._lines.getHiddenAreas();if(0===i.length)return[t];const n=[];let o=0,s=t.startLineNumber,r=t.startColumn;const a=t.endLineNumber,l=t.endColumn;for(let d=0,c=i.length;d<c;d++){const e=i[d].startLineNumber,t=i[d].endLineNumber;t<s||(e>a||(s<e&&(n[o++]=new qo(s,r,e-1,this.model.getLineMaxColumn(e-1))),s=t+1,r=1))}return(s<a||s===a&&r<l)&&(n[o++]=new qo(s,r,a,l)),n}getCompletelyVisibleViewRange(){const e=this.viewLayout.getLinesViewportData(),t=e.completelyVisibleStartLineNumber,i=e.completelyVisibleEndLineNumber;return new qo(t,this.getLineMinColumn(t),i,this.getLineMaxColumn(i))}getCompletelyVisibleViewRangeAtScrollTop(e){const t=this.viewLayout.getLinesViewportDataAtScrollTop(e),i=t.completelyVisibleStartLineNumber,n=t.completelyVisibleEndLineNumber;return new qo(i,this.getLineMinColumn(i),n,this.getLineMaxColumn(n))}saveState(){const e=this.viewLayout.saveState(),t=e.scrollTop,i=this.viewLayout.getLineNumberAtVerticalOffset(t),n=this.coordinatesConverter.convertViewPositionToModelPosition(new er(i,this.getLineMinColumn(i))),o=this.viewLayout.getVerticalOffsetForLineNumber(i)-t;return{scrollLeft:e.scrollLeft,firstPosition:n,firstPositionDeltaTop:o}}reduceRestoreState(e){if(void 0===e.firstPosition)return this._reduceRestoreStateCompatibility(e);const t=this.model.validatePosition(e.firstPosition),i=this.coordinatesConverter.convertModelPositionToViewPosition(t),n=this.viewLayout.getVerticalOffsetForLineNumber(i.lineNumber)-e.firstPositionDeltaTop;return{scrollLeft:e.scrollLeft,scrollTop:n}}_reduceRestoreStateCompatibility(e){return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTopWithoutViewZones}}getTabSize(){return this.model.getOptions().tabSize}getLineCount(){return this._lines.getViewLineCount()}setViewport(e,t,i){this._viewportStartLine=e;const n=this.coordinatesConverter.convertViewPositionToModelPosition(new er(e,this.getLineMinColumn(e)));this._viewportStartLineTrackedRange=this.model._setTrackedRange(this._viewportStartLineTrackedRange,new qo(n.lineNumber,n.column,n.lineNumber,n.column),1);const o=this.viewLayout.getVerticalOffsetForLineNumber(e),s=this.viewLayout.getCurrentScrollTop();this._viewportStartLineDelta=s-o}getActiveIndentGuide(e,t,i){return this._lines.getActiveIndentGuide(e,t,i)}getLinesIndentGuides(e,t){return this._lines.getViewLinesIndentGuides(e,t)}getBracketGuidesInRangeByLine(e,t,i,n){return this._lines.getViewLinesBracketGuides(e,t,i,n)}getLineContent(e){return this._lines.getViewLineContent(e)}getLineLength(e){return this._lines.getViewLineLength(e)}getLineMinColumn(e){return this._lines.getViewLineMinColumn(e)}getLineMaxColumn(e){return this._lines.getViewLineMaxColumn(e)}getLineFirstNonWhitespaceColumn(e){const t=xs(this.getLineContent(e));return-1===t?0:t+1}getLineLastNonWhitespaceColumn(e){const t=Ss(this.getLineContent(e));return-1===t?0:t+2}getDecorationsInViewport(e){return this._decorations.getDecorationsViewportData(e).decorations}getInjectedTextAt(e){return this._lines.getInjectedTextAt(e)}getViewLineRenderingData(e,t){const i=this.model.mightContainRTL(),n=this.model.mightContainNonBasicASCII(),o=this.getTabSize(),s=this._lines.getViewLineData(t);let r=this._decorations.getDecorationsViewportData(e).inlineDecorations[t-e.startLineNumber];return s.inlineDecorations&&(r=[...r,...s.inlineDecorations.map((e=>e.toInlineDecoration(t)))]),new aw(s.minColumn,s.maxColumn,s.content,s.continuesWithWrappedLine,i,n,s.tokens,r,o,s.startVisibleColumn)}getViewLineData(e){return this._lines.getViewLineData(e)}getMinimapLinesRenderingData(e,t,i){const n=this._lines.getViewLinesData(e,t,i);return new sw(this.getTabSize(),n)}getAllOverviewRulerDecorations(e){const t=this.model.getOverviewRulerDecorations(this._editorId,Ff(this._configuration.options)),i=new gF;for(const n of t){const t=n.options,o=t.overviewRuler;if(!o)continue;const s=o.position;if(0===s)continue;const r=o.getColor(e.value),a=this.coordinatesConverter.getViewLineNumberOfModelPosition(n.range.startLineNumber,n.range.startColumn),l=this.coordinatesConverter.getViewLineNumberOfModelPosition(n.range.endLineNumber,n.range.endColumn);i.accept(r,t.zIndex,a,l,s)}return i.asArray}_invalidateDecorationsColorCache(){const e=this.model.getOverviewRulerDecorations();for(const t of e){const e=t.options.overviewRuler;e&&e.invalidateCachedColor();const i=t.options.minimap;i&&i.invalidateCachedColor()}}getValueInRange(e,t){const i=this.coordinatesConverter.convertViewRangeToModelRange(e);return this.model.getValueInRange(i,t)}deduceModelPositionRelativeToViewPosition(e,t,i){const n=this.coordinatesConverter.convertViewPositionToModelPosition(e);2===this.model.getEOL().length&&(t<0?t-=i:t+=i);const o=this.model.getOffsetAt(n)+t;return this.model.getPositionAt(o)}getPlainTextToCopy(e,t,i){const n=i?"\r\n":this.model.getEOL();(e=e.slice(0)).sort(qo.compareRangesUsingStarts);let o=!1,s=!1;for(const a of e)a.isEmpty()?o=!0:s=!0;if(!s){if(!t)return"";const i=e.map((e=>e.startLineNumber));let o="";for(let e=0;e<i.length;e++)e>0&&i[e-1]===i[e]||(o+=this.model.getLineContent(i[e])+n);return o}if(o&&t){const t=[];let n=0;for(const o of e){const e=o.startLineNumber;o.isEmpty()?e!==n&&t.push(this.model.getLineContent(e)):t.push(this.model.getValueInRange(o,i?2:0)),n=e}return 1===t.length?t[0]:t}const r=[];for(const a of e)a.isEmpty()||r.push(this.model.getValueInRange(a,i?2:0));return 1===r.length?r[0]:r}getRichTextToCopy(e,t){const i=this.model.getLanguageId();if(i===LA)return null;if(1!==e.length)return null;let n=e[0];if(n.isEmpty()){if(!t)return null;const e=n.startLineNumber;n=new qo(e,this.model.getLineMinColumn(e),e,this.model.getLineMaxColumn(e))}const o=this._configuration.options.get(44),s=this._getColorMap();let r;if(/[:;\\\/<>]/.test(o.fontFamily)||o.fontFamily===Gf.fontFamily)r=Gf.fontFamily;else{r=o.fontFamily,r=r.replace(/"/g,"'");if(!/[,']/.test(r)){/[+ ]/.test(r)&&(r=`'${r}'`)}r=`${r}, ${Gf.fontFamily}`}return{mode:i,html:`<div style="color: ${s[1]};background-color: ${s[2]};font-family: ${r};font-weight: ${o.fontWeight};font-size: ${o.fontSize}px;line-height: ${o.lineHeight}px;white-space: pre;">`+this._getHTMLToCopy(n,s)+"</div>"}}_getHTMLToCopy(e,t){const i=e.startLineNumber,n=e.startColumn,o=e.endLineNumber,s=e.endColumn,r=this.getTabSize();let a="";for(let l=i;l<=o;l++){const e=this.model.getLineTokens(l),d=e.getLineContent(),c=l===i?n-1:0,h=l===o?s-1:d.length;a+=""===d?"<br>":IA(d,e.inflate(),t,c,h,r,Rs)}return a}_getColorMap(){const e=Ns.getColorMap(),t=["#000000"];if(e)for(let i=1,n=e.length;i<n;i++)t[i]=hS.Format.CSS.formatHex(e[i]);return t}getPrimaryCursorState(){return this._cursor.getPrimaryCursorState()}getLastAddedCursorIndex(){return this._cursor.getLastAddedCursorIndex()}getCursorStates(){return this._cursor.getCursorStates()}setCursorStates(e,t,i){return this._withViewEventsCollector((n=>this._cursor.setStates(n,e,t,i)))}getCursorColumnSelectData(){return this._cursor.getCursorColumnSelectData()}getCursorAutoClosedCharacters(){return this._cursor.getAutoClosedCharacters()}setCursorColumnSelectData(e){this._cursor.setCursorColumnSelectData(e)}getPrevEditOperationType(){return this._cursor.getPrevEditOperationType()}setPrevEditOperationType(e){this._cursor.setPrevEditOperationType(e)}getSelection(){return this._cursor.getSelection()}getSelections(){return this._cursor.getSelections()}getPosition(){return this._cursor.getPrimaryCursorState().modelState.position}setSelections(e,t,i=0){this._withViewEventsCollector((n=>this._cursor.setSelections(n,e,t,i)))}saveCursorState(){return this._cursor.saveState()}restoreCursorState(e){this._withViewEventsCollector((t=>this._cursor.restoreState(t,e)))}_executeCursorEdit(e){this._cursor.context.cursorConfig.readOnly?this._eventDispatcher.emitOutgoingEvent(new sA):this._withViewEventsCollector(e)}executeEdits(e,t,i){this._executeCursorEdit((n=>this._cursor.executeEdits(n,e,t,i)))}startComposition(){this._cursor.setIsDoingComposition(!0),this._executeCursorEdit((e=>this._cursor.startComposition(e)))}endComposition(e){this._cursor.setIsDoingComposition(!1),this._executeCursorEdit((t=>this._cursor.endComposition(t,e)))}type(e,t){this._executeCursorEdit((i=>this._cursor.type(i,e,t)))}compositionType(e,t,i,n,o){this._executeCursorEdit((s=>this._cursor.compositionType(s,e,t,i,n,o)))}paste(e,t,i,n){this._executeCursorEdit((o=>this._cursor.paste(o,e,t,i,n)))}cut(e){this._executeCursorEdit((t=>this._cursor.cut(t,e)))}executeCommand(e,t){this._executeCursorEdit((i=>this._cursor.executeCommand(i,e,t)))}executeCommands(e,t){this._executeCursorEdit((i=>this._cursor.executeCommands(i,e,t)))}revealPrimaryCursor(e,t,i=!1){this._withViewEventsCollector((n=>this._cursor.revealPrimary(n,e,i,0,t,0)))}revealTopMostCursor(e){const t=this._cursor.getTopMostViewPosition(),i=new qo(t.lineNumber,t.column,t.lineNumber,t.column);this._withViewEventsCollector((t=>t.emitViewEvent(new KM(e,!1,i,null,0,!0,0))))}revealBottomMostCursor(e){const t=this._cursor.getBottomMostViewPosition(),i=new qo(t.lineNumber,t.column,t.lineNumber,t.column);this._withViewEventsCollector((t=>t.emitViewEvent(new KM(e,!1,i,null,0,!0,0))))}revealRange(e,t,i,n,o){this._withViewEventsCollector((s=>s.emitViewEvent(new KM(e,!1,i,null,n,t,o))))}changeWhitespace(e){this.viewLayout.changeWhitespace(e)&&(this._eventDispatcher.emitSingleViewEvent(new XM),this._eventDispatcher.emitOutgoingEvent(new nA))}_withViewEventsCollector(e){try{return e(this._eventDispatcher.beginEmitViewEvents())}finally{this._eventDispatcher.endEmitViewEvents()}}normalizePosition(e,t){return this._lines.normalizePosition(e,t)}getLineIndentColumn(e){return this._lines.getLineIndentColumn(e)}}class gF{constructor(){this._asMap=Object.create(null),this.asArray=[]}accept(e,t,i,n,o){const s=this._asMap[e];if(s){const e=s.data,t=e[e.length-3],r=e[e.length-1];if(t===o&&r+1>=i)return void(n>r&&(e[e.length-1]=n));e.push(o,i,n)}else{const s=new hw(e,t,[o,i,n]);this._asMap[e]=s,this.asArray.push(s)}}}class pF{constructor(...e){this._entries=new Map;for(let[t,i]of e)this.set(t,i)}set(e,t){const i=this._entries.get(e);return this._entries.set(e,t),i}get(e){return this._entries.get(e)}}var mF;!function(e){e[e.Ignore=0]="Ignore",e[e.Info=1]="Info",e[e.Warning=2]="Warning",e[e.Error=3]="Error"}(mF||(mF={})),function(e){const t="error",i="warning",n="info";e.fromValue=function(o){return o?$r(t,o)?e.Error:$r(i,o)||$r("warn",o)?e.Warning:$r(n,o)?e.Info:e.Ignore:e.Ignore},e.toString=function(o){switch(o){case e.Error:return t;case e.Warning:return i;case e.Info:return n;default:return"ignore"}}}(mF||(mF={}));var fF=mF,_F=fF;const vF=L_("notificationService");class bF{constructor(e,t,i,n,o){this.injectionOffsets=e,this.injectionOptions=t,this.breakOffsets=i,this.breakOffsetsVisibleColumn=n,this.wrappedTextIndentLength=o}getOutputLineCount(){return this.breakOffsets.length}getMinOutputOffset(e){return e>0?this.wrappedTextIndentLength:0}getLineLength(e){const t=e>0?this.breakOffsets[e-1]:0;let i=this.breakOffsets[e]-t;return e>0&&(i+=this.wrappedTextIndentLength),i}getMaxOutputOffset(e){return this.getLineLength(e)}translateToInputOffset(e,t){e>0&&(t=Math.max(0,t-this.wrappedTextIndentLength));let i=0===e?t:this.breakOffsets[e-1]+t;if(null!==this.injectionOffsets)for(let n=0;n<this.injectionOffsets.length&&i>this.injectionOffsets[n];n++)i<this.injectionOffsets[n]+this.injectionOptions[n].content.length?i=this.injectionOffsets[n]:i-=this.injectionOptions[n].content.length;return i}translateToOutputPosition(e,t=2){let i=e;if(null!==this.injectionOffsets)for(let n=0;n<this.injectionOffsets.length&&!(e<this.injectionOffsets[n])&&(1===t||e!==this.injectionOffsets[n]);n++)i+=this.injectionOptions[n].content.length;return this.offsetInInputWithInjectionsToOutputPosition(i,t)}offsetInInputWithInjectionsToOutputPosition(e,t=2){let i=0,n=this.breakOffsets.length-1,o=0,s=0;for(;i<=n;){o=i+(n-i)/2|0;const r=this.breakOffsets[o];if(s=o>0?this.breakOffsets[o-1]:0,0===t)if(e<=s)n=o-1;else{if(!(e>r))break;i=o+1}else if(e<s)n=o-1;else{if(!(e>=r))break;i=o+1}}let r=e-s;return o>0&&(r+=this.wrappedTextIndentLength),new yF(o,r)}normalizeOutputPosition(e,t,i){if(null!==this.injectionOffsets){const n=this.outputPositionToOffsetInInputWithInjections(e,t),o=this.normalizeOffsetInInputWithInjectionsAroundInjections(n,i);if(o!==n)return this.offsetInInputWithInjectionsToOutputPosition(o,i)}if(0===i){if(e>0&&t===this.getMinOutputOffset(e))return new yF(e-1,this.getMaxOutputOffset(e-1))}else if(1===i){if(e<this.getOutputLineCount()-1&&t===this.getMaxOutputOffset(e))return new yF(e+1,this.getMinOutputOffset(e+1))}return new yF(e,t)}outputPositionToOffsetInInputWithInjections(e,t){e>0&&(t=Math.max(0,t-this.wrappedTextIndentLength));return(e>0?this.breakOffsets[e-1]:0)+t}normalizeOffsetInInputWithInjectionsAroundInjections(e,t){const i=this.getInjectedTextAtOffset(e);if(!i)return e;if(2===t){if(e===i.offsetInInputWithInjections+i.length&&wF(this.injectionOptions[i.injectedTextIndex].cursorStops))return i.offsetInInputWithInjections+i.length;{let e=i.offsetInInputWithInjections;if(CF(this.injectionOptions[i.injectedTextIndex].cursorStops))return e;let t=i.injectedTextIndex-1;for(;t>=0&&this.injectionOffsets[t]===this.injectionOffsets[i.injectedTextIndex]&&!wF(this.injectionOptions[t].cursorStops)&&(e-=this.injectionOptions[t].content.length,!CF(this.injectionOptions[t].cursorStops));)t--;return e}}if(1===t){let e=i.offsetInInputWithInjections+i.length,t=i.injectedTextIndex;for(;t+1<this.injectionOffsets.length&&this.injectionOffsets[t+1]===this.injectionOffsets[t];)e+=this.injectionOptions[t+1].content.length,t++;return e}if(0===t){let e=i.offsetInInputWithInjections,t=i.injectedTextIndex;for(;t-1>=0&&this.injectionOffsets[t-1]===this.injectionOffsets[t];)e-=this.injectionOptions[t-1].content.length,t--;return e}nr()}getInjectedText(e,t){const i=this.outputPositionToOffsetInInputWithInjections(e,t),n=this.getInjectedTextAtOffset(i);return n?{options:this.injectionOptions[n.injectedTextIndex]}:null}getInjectedTextAtOffset(e){const t=this.injectionOffsets,i=this.injectionOptions;if(null!==t){let n=0;for(let o=0;o<t.length;o++){const s=i[o].content.length,r=t[o]+n,a=t[o]+n+s;if(r>e)break;if(e<=a)return{injectedTextIndex:o,offsetInInputWithInjections:r,length:s};n+=s}}}}function wF(e){return null==e||(e===da.Right||e===da.Both)}function CF(e){return null==e||(e===da.Left||e===da.Both)}class yF{constructor(e,t){this.outputLineIndex=e,this.outputOffset=t}toString(){return`${this.outputLineIndex}:${this.outputOffset}`}toPosition(e){return new er(e+this.outputLineIndex,this.outputOffset+1)}}class xF{constructor(e,t){this.classifier=new SF(e,t)}static create(e){return new xF(e.get(120),e.get(119))}createLineBreaksComputer(e,t,i,n){const o=[],s=[],r=[];return{addRequest:(e,t,i)=>{o.push(e),s.push(t),r.push(i)},finalize:()=>{const a=e.typicalFullwidthCharacterWidth/e.typicalHalfwidthCharacterWidth,l=[];for(let e=0,d=o.length;e<d;e++){const d=s[e],c=r[e];!c||c.injectionOptions||d?l[e]=NF(this.classifier,o[e],d,t,i,a,n):l[e]=LF(this.classifier,c,o[e],t,i,a,n)}return kF.length=0,DF.length=0,l}}}}class SF extends ca{constructor(e,t){super(0);for(let i=0;i<e.length;i++)this.set(e.charCodeAt(i),1);for(let i=0;i<t.length;i++)this.set(t.charCodeAt(i),2)}get(e){return e>=0&&e<256?this._asciiMap[e]:e>=12352&&e<=12543||e>=13312&&e<=19903||e>=19968&&e<=40959?3:this._map.get(e)||this._defaultValue}}let kF=[],DF=[];function LF(e,t,i,n,o,s,r){if(-1===o)return null;const a=i.length;if(a<=1)return null;const l=t.breakOffsets,d=t.breakOffsetsVisibleColumn,c=MF(i,n,o,s,r),h=o-c,u=kF,g=DF;let p=0,m=0,f=0,_=o;const v=l.length;let b=0;if(b>=0){let e=Math.abs(d[b]-_);for(;b+1<v;){const t=Math.abs(d[b+1]-_);if(t>=e)break;e=t,b++}}for(;b<v;){let t=b<0?0:l[b],o=b<0?0:d[b];m>t&&(t=m,o=f);let r=0,c=0,w=0,C=0;if(o<=_){let f=o,v=0===t?0:i.charCodeAt(t-1),b=0===t?0:e.get(v),y=!0;for(let o=t;o<a;o++){const t=o,a=i.charCodeAt(o);let l,d;if(Go(a)?(o++,l=0,d=2):(l=e.get(a),d=EF(a,f,n,s)),t>m&&TF(v,b,a,l)&&(r=t,c=f),f+=d,f>_){t>m?(w=t,C=f-d):(w=o+1,C=f),f-c>h&&(r=0),y=!1;break}v=a,b=l}if(y){p>0&&(u[p]=l[l.length-1],g[p]=d[l.length-1],p++);break}}if(0===r){let a=o,l=i.charCodeAt(t),d=e.get(l),u=!1;for(let n=t-1;n>=m;n--){const t=n+1,o=i.charCodeAt(n);if(9===o){u=!0;break}let g,p;if(ha(o)?(n--,g=0,p=2):(g=e.get(o),p=ks(o)?s:1),a<=_){if(0===w&&(w=t,C=a),a<=_-h)break;if(TF(o,g,l,d)){r=t,c=a;break}}a-=p,l=o,d=g}if(0!==r){const e=h-(C-c);if(e<=n){const t=i.charCodeAt(w);let o;o=Go(t)?2:EF(t,C,n,s),e-o<0&&(r=0)}}if(u){b--;continue}}if(0===r&&(r=w,c=C),r<=m){const e=i.charCodeAt(m);Go(e)?(r=m+2,c=f+2):(r=m+1,c=f+EF(e,f,n,s))}for(m=r,u[p]=r,f=c,g[p]=c,p++,_=c+h;b<0||b<v&&d[b]<c;)b++;let y=Math.abs(d[b]-_);for(;b+1<v;){const e=Math.abs(d[b+1]-_);if(e>=y)break;y=e,b++}}return 0===p?null:(u.length=p,g.length=p,kF=t.breakOffsets,DF=t.breakOffsetsVisibleColumn,t.breakOffsets=u,t.breakOffsetsVisibleColumn=g,t.wrappedTextIndentLength=c,t)}function NF(e,t,i,n,o,s,r){const a=DM.applyInjectedText(t,i);let l,d;if(i&&i.length>0?(l=i.map((e=>e.options)),d=i.map((e=>e.column-1))):(l=null,d=null),-1===o)return l?new bF(d,l,[a.length],[],0):null;const c=a.length;if(c<=1)return l?new bF(d,l,[a.length],[],0):null;const h=MF(a,n,o,s,r),u=o-h,g=[],p=[];let m=0,f=0,_=0,v=o,b=a.charCodeAt(0),w=e.get(b),C=EF(b,0,n,s),y=1;Go(b)&&(C+=1,b=a.charCodeAt(1),w=e.get(b),y++);for(let x=y;x<c;x++){const t=x,i=a.charCodeAt(x);let o,r;Go(i)?(x++,o=0,r=2):(o=e.get(i),r=EF(i,C,n,s)),TF(b,w,i,o)&&(f=t,_=C),C+=r,C>v&&((0===f||C-_>u)&&(f=t,_=C-r),g[m]=f,p[m]=_,m++,v=_+u,f=0),b=i,w=o}return 0!==m||i&&0!==i.length?(g[m]=c,p[m]=C,new bF(d,l,g,p,h)):null}function EF(e,t,i,n){return 9===e?i-t%i:ks(e)||e<32?n:1}function IF(e,t){return t-e%t}function TF(e,t,i,n){return 32!==i&&(2===t||3===t&&2!==n||1===n||3===n&&1!==t)}function MF(e,t,i,n,o){let s=0;if(0!==o){const r=xs(e);if(-1!==r){for(let i=0;i<r;i++){s+=9===e.charCodeAt(i)?IF(s,t):1}const a=3===o?2:2===o?1:0;for(let e=0;e<a;e++){s+=IF(s,t)}s+n>i&&(s=0)}}return s}var AF;const OF=null===(AF=window.trustedTypes)||void 0===AF?void 0:AF.createPolicy("domLineBreaksComputer",{createHTML:e=>e});class RF{static create(){return new RF}constructor(){}createLineBreaksComputer(e,t,i,n){const o=[],s=[];return{addRequest:(e,t,i)=>{o.push(e),s.push(t)},finalize:()=>function(e,t,i,n,o,s){var r;function a(t){const i=s[t];if(i){const n=DM.applyInjectedText(e[t],i),o=i.map((e=>e.options)),s=i.map((e=>e.column-1));return new bF(s,o,[n.length],[],0)}return null}if(-1===n){const t=[];for(let i=0,n=e.length;i<n;i++)t[i]=a(i);return t}const l=Math.round(n*t.typicalHalfwidthCharacterWidth),d=3===o?2:2===o?1:0,c=Math.round(i*d),h=Math.ceil(t.spaceWidth*c),u=document.createElement("div");m_(u,t);const g=nv(1e4),p=[],m=[],f=[],_=[],v=[];for(let S=0;S<e.length;S++){const n=DM.applyInjectedText(e[S],s[S]);let r=0,a=0,d=l;if(0!==o)if(r=xs(n),-1===r)r=0;else{for(let t=0;t<r;t++){a+=9===n.charCodeAt(t)?i-a%i:1}const e=Math.ceil(t.spaceWidth*a);e+t.typicalFullwidthCharacterWidth>l?(r=0,a=0):d=l-e}const c=n.substr(r),u=PF(c,a,i,d,g,h);p[S]=r,m[S]=a,f[S]=c,_[S]=u[0],v[S]=u[1]}const b=g.build(),w=null!==(r=null==OF?void 0:OF.createHTML(b))&&void 0!==r?r:b;u.innerHTML=w,u.style.position="absolute",u.style.top="10000",u.style.wordWrap="break-word",document.body.appendChild(u);const C=document.createRange(),y=Array.prototype.slice.call(u.children,0),x=[];for(let S=0;S<e.length;S++){const e=FF(C,y[S],f[S],_[S]);if(null===e){x[S]=a(S);continue}const t=p[S],i=m[S]+c,n=v[S],o=[];for(let s=0,a=e.length;s<a;s++)o[s]=n[e[s]];if(0!==t)for(let s=0,a=e.length;s<a;s++)e[s]+=t;let r,l;const d=s[S];d?(r=d.map((e=>e.options)),l=d.map((e=>e.column-1))):(r=null,l=null),x[S]=new bF(l,r,e,o,i)}return document.body.removeChild(u),x}(o,e,t,i,n,s)}}}function PF(e,t,i,n,o,s){if(0!==s){const e=String(s);o.appendASCIIString('<div style="text-indent: -'),o.appendASCIIString(e),o.appendASCIIString("px; padding-left: "),o.appendASCIIString(e),o.appendASCIIString("px; box-sizing: border-box; width:")}else o.appendASCIIString('<div style="width:');o.appendASCIIString(String(n)),o.appendASCIIString('px;">');const r=e.length;let a=t,l=0;const d=[],c=[];let h=0<r?e.charCodeAt(0):0;o.appendASCIIString("<span>");for(let u=0;u<r;u++){0!==u&&u%16384==0&&o.appendASCIIString("</span><span>"),d[u]=l,c[u]=a;const t=h;h=u+1<r?e.charCodeAt(u+1):0;let n=1,s=1;switch(t){case 9:n=i-a%i,s=n;for(let e=1;e<=n;e++)e<n?o.write1(160):o.appendASCII(32);break;case 32:32===h?o.write1(160):o.appendASCII(32);break;case 60:o.appendASCIIString("<");break;case 62:o.appendASCIIString(">");break;case 38:o.appendASCIIString("&");break;case 0:o.appendASCIIString("�");break;case 65279:case 8232:case 8233:case 133:o.write1(65533);break;default:ks(t)&&s++,t<32?o.write1(9216+t):o.write1(t)}l+=n,a+=s}return o.appendASCIIString("</span>"),d[e.length]=l,c[e.length]=a,o.appendASCIIString("</div>"),[d,c]}function FF(e,t,i,n){if(i.length<=1)return null;const o=Array.prototype.slice.call(t.children,0),s=[];try{BF(e,o,n,0,null,i.length-1,null,s)}catch(r){return null}return 0===s.length?null:(s.push(i.length),s)}function BF(e,t,i,n,o,s,r,a){if(n===s)return;if(o=o||VF(e,t,i[n],i[n+1]),r=r||VF(e,t,i[s],i[s+1]),Math.abs(o[0].top-r[0].top)<=.1)return;if(n+1===s)return void a.push(s);const l=n+(s-n)/2|0,d=VF(e,t,i[l],i[l+1]);BF(e,t,i,n,o,l,d,a),BF(e,t,i,l,d,s,r,a)}function VF(e,t,i,n){return e.setStart(t[i/16384|0].firstChild,i%16384),e.setEnd(t[n/16384|0].firstChild,n%16384),e.getClientRects()}var WF=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},zF=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};let HF=0;class jF{constructor(e,t,i,n,o){this.model=e,this.viewModel=t,this.view=i,this.hasRealView=n,this.listenersToRemove=o}dispose(){bs(this.listenersToRemove),this.model.onBeforeDetached(),this.hasRealView&&this.view.dispose(),this.viewModel.dispose()}}let UF=class e extends Uo{constructor(e,t,i,n,o,s,r,a,l,d,c,h){super(),this.languageConfigurationService=c,this._onDidDispose=this._register(new $o),this.onDidDispose=this._onDidDispose.event,this._onDidChangeModelContent=this._register(new $o),this.onDidChangeModelContent=this._onDidChangeModelContent.event,this._onDidChangeModelLanguage=this._register(new $o),this.onDidChangeModelLanguage=this._onDidChangeModelLanguage.event,this._onDidChangeModelLanguageConfiguration=this._register(new $o),this.onDidChangeModelLanguageConfiguration=this._onDidChangeModelLanguageConfiguration.event,this._onDidChangeModelOptions=this._register(new $o),this.onDidChangeModelOptions=this._onDidChangeModelOptions.event,this._onDidChangeModelDecorations=this._register(new $o),this.onDidChangeModelDecorations=this._onDidChangeModelDecorations.event,this._onDidChangeConfiguration=this._register(new $o),this.onDidChangeConfiguration=this._onDidChangeConfiguration.event,this._onDidChangeModel=this._register(new $o),this.onDidChangeModel=this._onDidChangeModel.event,this._onDidChangeCursorPosition=this._register(new $o),this.onDidChangeCursorPosition=this._onDidChangeCursorPosition.event,this._onDidChangeCursorSelection=this._register(new $o),this.onDidChangeCursorSelection=this._onDidChangeCursorSelection.event,this._onDidAttemptReadOnlyEdit=this._register(new $o),this.onDidAttemptReadOnlyEdit=this._onDidAttemptReadOnlyEdit.event,this._onDidLayoutChange=this._register(new $o),this.onDidLayoutChange=this._onDidLayoutChange.event,this._editorTextFocus=this._register(new $F),this.onDidFocusEditorText=this._editorTextFocus.onDidChangeToTrue,this.onDidBlurEditorText=this._editorTextFocus.onDidChangeToFalse,this._editorWidgetFocus=this._register(new $F),this.onDidFocusEditorWidget=this._editorWidgetFocus.onDidChangeToTrue,this.onDidBlurEditorWidget=this._editorWidgetFocus.onDidChangeToFalse,this._onWillType=this._register(new $o),this.onWillType=this._onWillType.event,this._onDidType=this._register(new $o),this.onDidType=this._onDidType.event,this._onDidCompositionStart=this._register(new $o),this.onDidCompositionStart=this._onDidCompositionStart.event,this._onDidCompositionEnd=this._register(new $o),this.onDidCompositionEnd=this._onDidCompositionEnd.event,this._onDidPaste=this._register(new $o),this.onDidPaste=this._onDidPaste.event,this._onMouseUp=this._register(new $o),this.onMouseUp=this._onMouseUp.event,this._onMouseDown=this._register(new $o),this.onMouseDown=this._onMouseDown.event,this._onMouseDrag=this._register(new $o),this.onMouseDrag=this._onMouseDrag.event,this._onMouseDrop=this._register(new $o),this.onMouseDrop=this._onMouseDrop.event,this._onMouseDropCanceled=this._register(new $o),this.onMouseDropCanceled=this._onMouseDropCanceled.event,this._onContextMenu=this._register(new $o),this.onContextMenu=this._onContextMenu.event,this._onMouseMove=this._register(new $o),this.onMouseMove=this._onMouseMove.event,this._onMouseLeave=this._register(new $o),this.onMouseLeave=this._onMouseLeave.event,this._onMouseWheel=this._register(new $o),this.onMouseWheel=this._onMouseWheel.event,this._onKeyUp=this._register(new $o),this.onKeyUp=this._onKeyUp.event,this._onKeyDown=this._register(new $o),this.onKeyDown=this._onKeyDown.event,this._onDidContentSizeChange=this._register(new $o),this.onDidContentSizeChange=this._onDidContentSizeChange.event,this._onDidScrollChange=this._register(new $o),this.onDidScrollChange=this._onDidScrollChange.event,this._onDidChangeViewZones=this._register(new $o),this.onDidChangeViewZones=this._onDidChangeViewZones.event,this._onDidChangeHiddenAreas=this._register(new $o),this.onDidChangeHiddenAreas=this._onDidChangeHiddenAreas.event,this._bannerDomNode=null;const u=Object.assign({},t);let g;this._domElement=e,this._overflowWidgetsDomNode=u.overflowWidgetsDomNode,delete u.overflowWidgetsDomNode,this._id=++HF,this._decorationTypeKeysToIds={},this._decorationTypeSubtypes={},this._telemetryData=i.telemetryData,this._configuration=this._register(this._createConfiguration(i.isSimpleWidget||!1,u,d)),this._register(this._configuration.onDidChange((e=>{this._onDidChangeConfiguration.fire(e);const t=this._configuration.options;if(e.hasChanged(131)){const e=t.get(131);this._onDidLayoutChange.fire(e)}}))),this._contextKeyService=this._register(r.createScoped(this._domElement)),this._notificationService=l,this._codeEditorService=o,this._commandService=s,this._themeService=a,this._register(new KF(this,this._contextKeyService)),this._register(new qF(this,this._contextKeyService,h)),this._instantiationService=n.createChild(new pF([$y,this._contextKeyService])),this._modelData=null,this._contributions={},this._actions={},this._focusTracker=new GF(e),this._register(this._focusTracker.onChange((()=>{this._editorWidgetFocus.setValue(this._focusTracker.hasFocus())}))),this._contentWidgets={},this._overlayWidgets={},g=Array.isArray(i.contributions)?i.contributions:Tx.getEditorContributions();for(const m of g)if(this._contributions[m.id])Jo(new Error(`Cannot have two contributions with the same id ${m.id}`));else try{const e=this._instantiationService.createInstance(m.ctor,this);this._contributions[m.id]=e}catch(p){Jo(p)}Tx.getEditorActions().forEach((e=>{if(this._actions[e.id])return void Jo(new Error(`Cannot have two actions with the same id ${e.id}`));const t=new dA(e.id,e.label,e.alias,Qs(e.precondition),(()=>this._instantiationService.invokeFunction((t=>Promise.resolve(e.runEditorCommand(t,this,null))))),this._contextKeyService);this._actions[t.id]=t})),this._codeEditorService.addCodeEditor(this)}get isSimpleWidget(){return this._configuration.isSimpleWidget}_createConfiguration(e,t,i){return new Zx(e,t,this._domElement,i)}getId(){return this.getEditorType()+":"+this._id}getEditorType(){return M_.ICodeEditor}dispose(){this._codeEditorService.removeCodeEditor(this),this._focusTracker.dispose();const e=Object.keys(this._contributions);for(let t=0,i=e.length;t<i;t++){const i=e[t];this._contributions[i].dispose()}this._contributions={},this._actions={},this._contentWidgets={},this._overlayWidgets={},this._removeDecorationTypes(),this._postDetachModelCleanup(this._detachModel()),this._onDidDispose.fire(),super.dispose()}invokeWithinContext(e){return this._instantiationService.invokeFunction(e)}updateOptions(e){this._configuration.updateOptions(e||{})}getOptions(){return this._configuration.options}getOption(e){return this._configuration.options.get(e)}getRawOptions(){return this._configuration.getRawOptions()}getOverflowWidgetsDomNode(){return this._overflowWidgetsDomNode}getConfiguredWordAtPosition(e){return this._modelData?aI.getWordAtPosition(this._modelData.model,this._configuration.options.get(117),e):null}getValue(e=null){if(!this._modelData)return"";const t=!(!e||!e.preserveBOM);let i=0;return e&&e.lineEnding&&"\n"===e.lineEnding?i=1:e&&e.lineEnding&&"\r\n"===e.lineEnding&&(i=2),this._modelData.model.getValue(i,t)}setValue(e){this._modelData&&this._modelData.model.setValue(e)}getModel(){return this._modelData?this._modelData.model:null}setModel(e=null){const t=e;if(null===this._modelData&&null===t)return;if(this._modelData&&this._modelData.model===t)return;const i=this.hasTextFocus(),n=this._detachModel();this._attachModel(t),i&&this.hasModel()&&this.focus();const o={oldModelUrl:n?n.uri:null,newModelUrl:t?t.uri:null};this._removeDecorationTypes(),this._onDidChangeModel.fire(o),this._postDetachModelCleanup(n)}_removeDecorationTypes(){if(this._decorationTypeKeysToIds={},this._decorationTypeSubtypes){for(let e in this._decorationTypeSubtypes){const t=this._decorationTypeSubtypes[e];for(let i in t)this._removeDecorationType(e+"-"+i)}this._decorationTypeSubtypes={}}}getVisibleRanges(){return this._modelData?this._modelData.viewModel.getVisibleRanges():[]}getVisibleRangesPlusViewportAboveBelow(){return this._modelData?this._modelData.viewModel.getVisibleRangesPlusViewportAboveBelow():[]}getWhitespaces(){return this._modelData?this._modelData.viewModel.viewLayout.getWhitespaces():[]}static _getVerticalOffsetForPosition(e,t,i){const n=e.model.validatePosition({lineNumber:t,column:i}),o=e.viewModel.coordinatesConverter.convertModelPositionToViewPosition(n);return e.viewModel.viewLayout.getVerticalOffsetForLineNumber(o.lineNumber)}getTopForLineNumber(t){return this._modelData?e._getVerticalOffsetForPosition(this._modelData,t,1):-1}getTopForPosition(t,i){return this._modelData?e._getVerticalOffsetForPosition(this._modelData,t,i):-1}setHiddenAreas(e){this._modelData&&this._modelData.viewModel.setHiddenAreas(e.map((e=>qo.lift(e))))}getVisibleColumnFromPosition(e){if(!this._modelData)return e.column;const t=this._modelData.model.validatePosition(e),i=this._modelData.model.getOptions().tabSize;return dN.visibleColumnFromColumn(this._modelData.model.getLineContent(t.lineNumber),t.column,i)+1}getPosition(){return this._modelData?this._modelData.viewModel.getPosition():null}setPosition(e,t="api"){if(this._modelData){if(!er.isIPosition(e))throw new Error("Invalid arguments");this._modelData.viewModel.setSelections(t,[{selectionStartLineNumber:e.lineNumber,selectionStartColumn:e.column,positionLineNumber:e.lineNumber,positionColumn:e.column}])}}_sendRevealRange(e,t,i,n){if(!this._modelData)return;if(!qo.isIRange(e))throw new Error("Invalid arguments");const o=this._modelData.model.validateRange(e),s=this._modelData.viewModel.coordinatesConverter.convertModelRangeToViewRange(o);this._modelData.viewModel.revealRange("api",i,s,t,n)}revealLine(e,t=0){this._revealLine(e,0,t)}revealLineInCenter(e,t=0){this._revealLine(e,1,t)}revealLineInCenterIfOutsideViewport(e,t=0){this._revealLine(e,2,t)}revealLineNearTop(e,t=0){this._revealLine(e,5,t)}_revealLine(e,t,i){if("number"!=typeof e)throw new Error("Invalid arguments");this._sendRevealRange(new qo(e,1,e,1),t,!1,i)}revealPosition(e,t=0){this._revealPosition(e,0,!0,t)}revealPositionInCenter(e,t=0){this._revealPosition(e,1,!0,t)}revealPositionInCenterIfOutsideViewport(e,t=0){this._revealPosition(e,2,!0,t)}revealPositionNearTop(e,t=0){this._revealPosition(e,5,!0,t)}_revealPosition(e,t,i,n){if(!er.isIPosition(e))throw new Error("Invalid arguments");this._sendRevealRange(new qo(e.lineNumber,e.column,e.lineNumber,e.column),t,i,n)}getSelection(){return this._modelData?this._modelData.viewModel.getSelection():null}getSelections(){return this._modelData?this._modelData.viewModel.getSelections():null}setSelection(e,t="api"){const i=ar.isISelection(e),n=qo.isIRange(e);if(!i&&!n)throw new Error("Invalid arguments");if(i)this._setSelectionImpl(e,t);else if(n){const i={selectionStartLineNumber:e.startLineNumber,selectionStartColumn:e.startColumn,positionLineNumber:e.endLineNumber,positionColumn:e.endColumn};this._setSelectionImpl(i,t)}}_setSelectionImpl(e,t){if(!this._modelData)return;const i=new ar(e.selectionStartLineNumber,e.selectionStartColumn,e.positionLineNumber,e.positionColumn);this._modelData.viewModel.setSelections(t,[i])}revealLines(e,t,i=0){this._revealLines(e,t,0,i)}revealLinesInCenter(e,t,i=0){this._revealLines(e,t,1,i)}revealLinesInCenterIfOutsideViewport(e,t,i=0){this._revealLines(e,t,2,i)}revealLinesNearTop(e,t,i=0){this._revealLines(e,t,5,i)}_revealLines(e,t,i,n){if("number"!=typeof e||"number"!=typeof t)throw new Error("Invalid arguments");this._sendRevealRange(new qo(e,1,t,1),i,!1,n)}revealRange(e,t=0,i=!1,n=!0){this._revealRange(e,i?1:0,n,t)}revealRangeInCenter(e,t=0){this._revealRange(e,1,!0,t)}revealRangeInCenterIfOutsideViewport(e,t=0){this._revealRange(e,2,!0,t)}revealRangeNearTop(e,t=0){this._revealRange(e,5,!0,t)}revealRangeNearTopIfOutsideViewport(e,t=0){this._revealRange(e,6,!0,t)}revealRangeAtTop(e,t=0){this._revealRange(e,3,!0,t)}_revealRange(e,t,i,n){if(!qo.isIRange(e))throw new Error("Invalid arguments");this._sendRevealRange(qo.lift(e),t,i,n)}setSelections(e,t="api",i=0){if(this._modelData){if(!e||0===e.length)throw new Error("Invalid arguments");for(let t=0,i=e.length;t<i;t++)if(!ar.isISelection(e[t]))throw new Error("Invalid arguments");this._modelData.viewModel.setSelections(t,e,i)}}getContentWidth(){return this._modelData?this._modelData.viewModel.viewLayout.getContentWidth():-1}getScrollWidth(){return this._modelData?this._modelData.viewModel.viewLayout.getScrollWidth():-1}getScrollLeft(){return this._modelData?this._modelData.viewModel.viewLayout.getCurrentScrollLeft():-1}getContentHeight(){return this._modelData?this._modelData.viewModel.viewLayout.getContentHeight():-1}getScrollHeight(){return this._modelData?this._modelData.viewModel.viewLayout.getScrollHeight():-1}getScrollTop(){return this._modelData?this._modelData.viewModel.viewLayout.getCurrentScrollTop():-1}setScrollLeft(e,t=1){if(this._modelData){if("number"!=typeof e)throw new Error("Invalid arguments");this._modelData.viewModel.viewLayout.setScrollPosition({scrollLeft:e},t)}}setScrollTop(e,t=1){if(this._modelData){if("number"!=typeof e)throw new Error("Invalid arguments");this._modelData.viewModel.viewLayout.setScrollPosition({scrollTop:e},t)}}setScrollPosition(e,t=1){this._modelData&&this._modelData.viewModel.viewLayout.setScrollPosition(e,t)}saveViewState(){if(!this._modelData)return null;const e={},t=Object.keys(this._contributions);for(const i of t){const t=this._contributions[i];"function"==typeof t.saveViewState&&(e[i]=t.saveViewState())}return{cursorState:this._modelData.viewModel.saveCursorState(),viewState:this._modelData.viewModel.saveState(),contributionsState:e}}restoreViewState(e){if(!this._modelData||!this._modelData.hasRealView)return;const t=e;if(t&&t.cursorState&&t.viewState){const e=t.cursorState;Array.isArray(e)?e.length>0&&this._modelData.viewModel.restoreCursorState(e):this._modelData.viewModel.restoreCursorState([e]);const i=t.contributionsState||{},n=Object.keys(this._contributions);for(let t=0,s=n.length;t<s;t++){const e=n[t],o=this._contributions[e];"function"==typeof o.restoreViewState&&o.restoreViewState(i[e])}const o=this._modelData.viewModel.reduceRestoreState(t.viewState);this._modelData.view.restoreState(o)}}getContribution(e){return this._contributions[e]||null}getActions(){const e=[],t=Object.keys(this._actions);for(let i=0,n=t.length;i<n;i++){const n=t[i];e.push(this._actions[n])}return e}getSupportedActions(){let e=this.getActions();return e=e.filter((e=>e.isSupported())),e}getAction(e){return this._actions[e]||null}trigger(e,t,i){switch(i=i||{},t){case"compositionStart":return void this._startComposition();case"compositionEnd":return void this._endComposition(e);case"type":{const t=i;return void this._type(e,t.text||"")}case"replacePreviousChar":{const t=i;return void this._compositionType(e,t.text||"",t.replaceCharCnt||0,0,0)}case"compositionType":{const t=i;return void this._compositionType(e,t.text||"",t.replacePrevCharCnt||0,t.replaceNextCharCnt||0,t.positionDelta||0)}case"paste":{const t=i;return void this._paste(e,t.text||"",t.pasteOnNewLine||!1,t.multicursorText||null,t.mode||null)}case"cut":return void this._cut(e)}const n=this.getAction(t);n?Promise.resolve(n.run()).then(void 0,Jo):this._modelData&&(this._triggerEditorCommand(e,t,i)||this._triggerCommand(t,i))}_triggerCommand(e,t){this._commandService.executeCommand(e,t)}_startComposition(){this._modelData&&(this._modelData.viewModel.startComposition(),this._onDidCompositionStart.fire())}_endComposition(e){this._modelData&&(this._modelData.viewModel.endComposition(e),this._onDidCompositionEnd.fire())}_type(e,t){this._modelData&&0!==t.length&&("keyboard"===e&&this._onWillType.fire(t),this._modelData.viewModel.type(t,e),"keyboard"===e&&this._onDidType.fire(t))}_compositionType(e,t,i,n,o){this._modelData&&this._modelData.viewModel.compositionType(t,i,n,o,e)}_paste(e,t,i,n,o){if(!this._modelData||0===t.length)return;const s=this._modelData.viewModel.getSelection().getStartPosition();this._modelData.viewModel.paste(t,i,n,e);const r=this._modelData.viewModel.getSelection().getStartPosition();"keyboard"===e&&this._onDidPaste.fire({range:new qo(s.lineNumber,s.column,r.lineNumber,r.column),languageId:o})}_cut(e){this._modelData&&this._modelData.viewModel.cut(e)}_triggerEditorCommand(e,t,i){const n=Tx.getEditorCommand(t);return!!n&&((i=i||{}).source=e,this._instantiationService.invokeFunction((e=>{Promise.resolve(n.runEditorCommand(e,this,i)).then(void 0,Jo)})),!0)}_getViewModel(){return this._modelData?this._modelData.viewModel:null}pushUndoStop(){return!!this._modelData&&(!this._configuration.options.get(81)&&(this._modelData.model.pushStackElement(),!0))}popUndoStop(){return!!this._modelData&&(!this._configuration.options.get(81)&&(this._modelData.model.popStackElement(),!0))}executeEdits(e,t,i){if(!this._modelData)return!1;if(this._configuration.options.get(81))return!1;let n;return n=i?Array.isArray(i)?()=>i:i:()=>null,this._modelData.viewModel.executeEdits(e,t,n),!0}executeCommand(e,t){this._modelData&&this._modelData.viewModel.executeCommand(t,e)}executeCommands(e,t){this._modelData&&this._modelData.viewModel.executeCommands(t,e)}changeDecorations(e){return this._modelData?this._modelData.model.changeDecorations(e,this._id):null}getLineDecorations(e){return this._modelData?this._modelData.model.getLineDecorations(e,this._id,Ff(this._configuration.options)):null}getDecorationsInRange(e){return this._modelData?this._modelData.model.getDecorationsInRange(e,this._id,Ff(this._configuration.options)):null}deltaDecorations(e,t){return this._modelData?0===e.length&&0===t.length?e:this._modelData.model.deltaDecorations(e,t,this._id):[]}removeDecorations(e){const t=this._decorationTypeKeysToIds[e];t&&this.deltaDecorations(t,[]),this._decorationTypeKeysToIds.hasOwnProperty(e)&&delete this._decorationTypeKeysToIds[e],this._decorationTypeSubtypes.hasOwnProperty(e)&&delete this._decorationTypeSubtypes[e]}getLayoutInfo(){return this._configuration.options.get(131)}createOverviewRuler(e){return this._modelData&&this._modelData.hasRealView?this._modelData.view.createOverviewRuler(e):null}getContainerDomNode(){return this._domElement}getDomNode(){return this._modelData&&this._modelData.hasRealView?this._modelData.view.domNode.domNode:null}delegateVerticalScrollbarMouseDown(e){this._modelData&&this._modelData.hasRealView&&this._modelData.view.delegateVerticalScrollbarMouseDown(e)}layout(e){this._configuration.observeContainer(e),this.render()}focus(){this._modelData&&this._modelData.hasRealView&&this._modelData.view.focus()}hasTextFocus(){return!(!this._modelData||!this._modelData.hasRealView)&&this._modelData.view.isFocused()}hasWidgetFocus(){return this._focusTracker&&this._focusTracker.hasFocus()}addContentWidget(e){const t={widget:e,position:e.getPosition()};this._contentWidgets.hasOwnProperty(e.getId()),this._contentWidgets[e.getId()]=t,this._modelData&&this._modelData.hasRealView&&this._modelData.view.addContentWidget(t)}layoutContentWidget(e){const t=e.getId();if(this._contentWidgets.hasOwnProperty(t)){const i=this._contentWidgets[t];i.position=e.getPosition(),this._modelData&&this._modelData.hasRealView&&this._modelData.view.layoutContentWidget(i)}}removeContentWidget(e){const t=e.getId();if(this._contentWidgets.hasOwnProperty(t)){const e=this._contentWidgets[t];delete this._contentWidgets[t],this._modelData&&this._modelData.hasRealView&&this._modelData.view.removeContentWidget(e)}}addOverlayWidget(e){const t={widget:e,position:e.getPosition()};this._overlayWidgets.hasOwnProperty(e.getId()),this._overlayWidgets[e.getId()]=t,this._modelData&&this._modelData.hasRealView&&this._modelData.view.addOverlayWidget(t)}layoutOverlayWidget(e){const t=e.getId();if(this._overlayWidgets.hasOwnProperty(t)){const i=this._overlayWidgets[t];i.position=e.getPosition(),this._modelData&&this._modelData.hasRealView&&this._modelData.view.layoutOverlayWidget(i)}}removeOverlayWidget(e){const t=e.getId();if(this._overlayWidgets.hasOwnProperty(t)){const e=this._overlayWidgets[t];delete this._overlayWidgets[t],this._modelData&&this._modelData.hasRealView&&this._modelData.view.removeOverlayWidget(e)}}changeViewZones(e){this._modelData&&this._modelData.hasRealView&&this._modelData.view.change(e)}getTargetAtClientPoint(e,t){return this._modelData&&this._modelData.hasRealView?this._modelData.view.getTargetAtClientPoint(e,t):null}getScrolledVisiblePosition(t){if(!this._modelData||!this._modelData.hasRealView)return null;const i=this._modelData.model.validatePosition(t),n=this._configuration.options,o=n.get(131);return{top:e._getVerticalOffsetForPosition(this._modelData,i.lineNumber,i.column)-this.getScrollTop(),left:this._modelData.view.getOffsetForColumn(i.lineNumber,i.column)+o.glyphMarginWidth+o.lineNumbersWidth+o.decorationsWidth-this.getScrollLeft(),height:n.get(59)}}getOffsetForColumn(e,t){return this._modelData&&this._modelData.hasRealView?this._modelData.view.getOffsetForColumn(e,t):-1}render(e=!1){this._modelData&&this._modelData.hasRealView&&this._modelData.view.render(!0,e)}setAriaOptions(e){this._modelData&&this._modelData.hasRealView&&this._modelData.view.setAriaOptions(e)}applyFontInfo(e){m_(e,this._configuration.options.get(44))}setBanner(e,t){this._bannerDomNode&&this._domElement.contains(this._bannerDomNode)&&this._domElement.removeChild(this._bannerDomNode),this._bannerDomNode=e,this._configuration.setReservedHeight(e?t:0),this._bannerDomNode&&this._domElement.prepend(this._bannerDomNode)}_attachModel(e){if(!e)return void(this._modelData=null);const t=[];this._domElement.setAttribute("data-mode-id",e.getLanguageId()),this._configuration.setIsDominatedByLongLines(e.isDominatedByLongLines()),this._configuration.setModelLineCount(e.getLineCount()),e.onBeforeAttached();const i=new uF(this._id,this._configuration,e,RF.create(),xF.create(this._configuration.options),(e=>hC(e)),this.languageConfigurationService,this._themeService);t.push(e.onDidChangeDecorations((e=>this._onDidChangeModelDecorations.fire(e)))),t.push(e.onDidChangeLanguage((t=>{this._domElement.setAttribute("data-mode-id",e.getLanguageId()),this._onDidChangeModelLanguage.fire(t)}))),t.push(e.onDidChangeLanguageConfiguration((e=>this._onDidChangeModelLanguageConfiguration.fire(e)))),t.push(e.onDidChangeContent((e=>this._onDidChangeModelContent.fire(e)))),t.push(e.onDidChangeOptions((e=>this._onDidChangeModelOptions.fire(e)))),t.push(e.onWillDispose((()=>this.setModel(null)))),t.push(i.onEvent((e=>{switch(e.kind){case 0:this._onDidContentSizeChange.fire(e);break;case 1:this._editorTextFocus.setValue(e.hasFocus);break;case 2:this._onDidScrollChange.fire(e);break;case 3:this._onDidChangeViewZones.fire();break;case 4:this._onDidChangeHiddenAreas.fire();break;case 5:this._onDidAttemptReadOnlyEdit.fire();break;case 6:{e.reachedMaxCursorCount&&this._notificationService.warn(mf(0,"The number of cursors has been limited to {0}.",rA.MAX_CURSOR_COUNT));const t=[];for(let o=0,s=e.selections.length;o<s;o++)t[o]=e.selections[o].getPosition();const i={position:t[0],secondaryPositions:t.slice(1),reason:e.reason,source:e.source};this._onDidChangeCursorPosition.fire(i);const n={selection:e.selections[0],secondarySelections:e.selections.slice(1),modelVersionId:e.modelVersionId,oldSelections:e.oldSelections,oldModelVersionId:e.oldModelVersionId,source:e.source,reason:e.reason};this._onDidChangeCursorSelection.fire(n);break}}})));const[n,o]=this._createView(i);if(o){this._domElement.appendChild(n.domNode.domNode);let t=Object.keys(this._contentWidgets);for(let e=0,i=t.length;e<i;e++){const i=t[e];n.addContentWidget(this._contentWidgets[i])}t=Object.keys(this._overlayWidgets);for(let e=0,i=t.length;e<i;e++){const i=t[e];n.addOverlayWidget(this._overlayWidgets[i])}n.render(!1,!0),n.domNode.domNode.setAttribute("data-uri",e.uri.toString())}this._modelData=new jF(e,i,n,o,t)}_createView(e){let t;t=this.isSimpleWidget?{paste:(e,t,i,n)=>{this._paste("keyboard",e,t,i,n)},type:e=>{this._type("keyboard",e)},compositionType:(e,t,i,n)=>{this._compositionType("keyboard",e,t,i,n)},startComposition:()=>{this._startComposition()},endComposition:()=>{this._endComposition("keyboard")},cut:()=>{this._cut("keyboard")}}:{paste:(e,t,i,n)=>{const o={text:e,pasteOnNewLine:t,multicursorText:i,mode:n};this._commandService.executeCommand("paste",o)},type:e=>{const t={text:e};this._commandService.executeCommand("type",t)},compositionType:(e,t,i,n)=>{if(i||n){const o={text:e,replacePrevCharCnt:t,replaceNextCharCnt:i,positionDelta:n};this._commandService.executeCommand("compositionType",o)}else{const i={text:e,replaceCharCnt:t};this._commandService.executeCommand("replacePreviousChar",i)}},startComposition:()=>{this._commandService.executeCommand("compositionStart",{})},endComposition:()=>{this._commandService.executeCommand("compositionEnd",{})},cut:()=>{this._commandService.executeCommand("cut",{})}};const i=new PI(e.coordinatesConverter);i.onKeyDown=e=>this._onKeyDown.fire(e),i.onKeyUp=e=>this._onKeyUp.fire(e),i.onContextMenu=e=>this._onContextMenu.fire(e),i.onMouseMove=e=>this._onMouseMove.fire(e),i.onMouseLeave=e=>this._onMouseLeave.fire(e),i.onMouseDown=e=>this._onMouseDown.fire(e),i.onMouseUp=e=>this._onMouseUp.fire(e),i.onMouseDrag=e=>this._onMouseDrag.fire(e),i.onMouseDrop=e=>this._onMouseDrop.fire(e),i.onMouseDropCanceled=e=>this._onMouseDropCanceled.fire(e),i.onMouseWheel=e=>this._onMouseWheel.fire(e);return[new CM(t,this._configuration,this._themeService.getColorTheme(),e,i,this._overflowWidgetsDomNode),!0]}_postDetachModelCleanup(e){e&&e.removeAllDecorationsWithOwnerId(this._id)}_detachModel(){if(!this._modelData)return null;const e=this._modelData.model,t=this._modelData.hasRealView?this._modelData.view.domNode.domNode:null;return this._modelData.dispose(),this._modelData=null,this._domElement.removeAttribute("data-mode-id"),t&&this._domElement.contains(t)&&this._domElement.removeChild(t),this._bannerDomNode&&this._domElement.contains(this._bannerDomNode)&&this._domElement.removeChild(this._bannerDomNode),e}_removeDecorationType(e){this._codeEditorService.removeDecorationType(e)}hasModel(){return null!==this._modelData}};UF=WF([zF(3,k_),zF(4,N_),zF(5,wy),zF(6,$y),zF(7,Qy),zF(8,vF),zF(9,$x),zF(10,Rv),zF(11,Lb)],UF);class $F extends Uo{constructor(){super(),this._onDidChangeToTrue=this._register(new $o),this.onDidChangeToTrue=this._onDidChangeToTrue.event,this._onDidChangeToFalse=this._register(new $o),this.onDidChangeToFalse=this._onDidChangeToFalse.event,this._value=0}setValue(e){const t=e?2:1;this._value!==t&&(this._value=t,2===this._value?this._onDidChangeToTrue.fire():1===this._value&&this._onDidChangeToFalse.fire())}}class KF extends Uo{constructor(e,t){super(),this._editor=e,t.createKey("editorId",e.getId()),this._editorSimpleInput=yI.editorSimpleInput.bindTo(t),this._editorFocus=yI.focus.bindTo(t),this._textInputFocus=yI.textInputFocus.bindTo(t),this._editorTextFocus=yI.editorTextFocus.bindTo(t),this._editorTabMovesFocus=yI.tabMovesFocus.bindTo(t),this._editorReadonly=yI.readOnly.bindTo(t),this._inDiffEditor=yI.inDiffEditor.bindTo(t),this._editorColumnSelection=yI.columnSelection.bindTo(t),this._hasMultipleSelections=yI.hasMultipleSelections.bindTo(t),this._hasNonEmptySelection=yI.hasNonEmptySelection.bindTo(t),this._canUndo=yI.canUndo.bindTo(t),this._canRedo=yI.canRedo.bindTo(t),this._register(this._editor.onDidChangeConfiguration((()=>this._updateFromConfig()))),this._register(this._editor.onDidChangeCursorSelection((()=>this._updateFromSelection()))),this._register(this._editor.onDidFocusEditorWidget((()=>this._updateFromFocus()))),this._register(this._editor.onDidBlurEditorWidget((()=>this._updateFromFocus()))),this._register(this._editor.onDidFocusEditorText((()=>this._updateFromFocus()))),this._register(this._editor.onDidBlurEditorText((()=>this._updateFromFocus()))),this._register(this._editor.onDidChangeModel((()=>this._updateFromModel()))),this._register(this._editor.onDidChangeConfiguration((()=>this._updateFromModel()))),this._updateFromConfig(),this._updateFromSelection(),this._updateFromFocus(),this._updateFromModel(),this._editorSimpleInput.set(this._editor.isSimpleWidget)}_updateFromConfig(){const e=this._editor.getOptions();this._editorTabMovesFocus.set(e.get(130)),this._editorReadonly.set(e.get(81)),this._inDiffEditor.set(e.get(54)),this._editorColumnSelection.set(e.get(18))}_updateFromSelection(){const e=this._editor.getSelections();e?(this._hasMultipleSelections.set(e.length>1),this._hasNonEmptySelection.set(e.some((e=>!e.isEmpty())))):(this._hasMultipleSelections.reset(),this._hasNonEmptySelection.reset())}_updateFromFocus(){this._editorFocus.set(this._editor.hasWidgetFocus()&&!this._editor.isSimpleWidget),this._editorTextFocus.set(this._editor.hasTextFocus()&&!this._editor.isSimpleWidget),this._textInputFocus.set(this._editor.hasTextFocus())}_updateFromModel(){const e=this._editor.getModel();this._canUndo.set(Boolean(e&&e.canUndo())),this._canRedo.set(Boolean(e&&e.canRedo()))}}class qF extends Uo{constructor(e,t,i){super(),this._editor=e,this._contextKeyService=t,this._languageFeaturesService=i,this._langId=yI.languageId.bindTo(t),this._hasCompletionItemProvider=yI.hasCompletionItemProvider.bindTo(t),this._hasCodeActionsProvider=yI.hasCodeActionsProvider.bindTo(t),this._hasCodeLensProvider=yI.hasCodeLensProvider.bindTo(t),this._hasDefinitionProvider=yI.hasDefinitionProvider.bindTo(t),this._hasDeclarationProvider=yI.hasDeclarationProvider.bindTo(t),this._hasImplementationProvider=yI.hasImplementationProvider.bindTo(t),this._hasTypeDefinitionProvider=yI.hasTypeDefinitionProvider.bindTo(t),this._hasHoverProvider=yI.hasHoverProvider.bindTo(t),this._hasDocumentHighlightProvider=yI.hasDocumentHighlightProvider.bindTo(t),this._hasDocumentSymbolProvider=yI.hasDocumentSymbolProvider.bindTo(t),this._hasReferenceProvider=yI.hasReferenceProvider.bindTo(t),this._hasRenameProvider=yI.hasRenameProvider.bindTo(t),this._hasSignatureHelpProvider=yI.hasSignatureHelpProvider.bindTo(t),this._hasInlayHintsProvider=yI.hasInlayHintsProvider.bindTo(t),this._hasDocumentFormattingProvider=yI.hasDocumentFormattingProvider.bindTo(t),this._hasDocumentSelectionFormattingProvider=yI.hasDocumentSelectionFormattingProvider.bindTo(t),this._hasMultipleDocumentFormattingProvider=yI.hasMultipleDocumentFormattingProvider.bindTo(t),this._hasMultipleDocumentSelectionFormattingProvider=yI.hasMultipleDocumentSelectionFormattingProvider.bindTo(t),this._isInWalkThrough=yI.isInWalkThroughSnippet.bindTo(t);const n=()=>this._update();this._register(e.onDidChangeModel(n)),this._register(e.onDidChangeModelLanguage(n)),this._register(i.completionProvider.onDidChange(n)),this._register(i.codeActionProvider.onDidChange(n)),this._register(i.codeLensProvider.onDidChange(n)),this._register(i.definitionProvider.onDidChange(n)),this._register(i.declarationProvider.onDidChange(n)),this._register(i.implementationProvider.onDidChange(n)),this._register(i.typeDefinitionProvider.onDidChange(n)),this._register(i.hoverProvider.onDidChange(n)),this._register(i.documentHighlightProvider.onDidChange(n)),this._register(i.documentSymbolProvider.onDidChange(n)),this._register(i.referenceProvider.onDidChange(n)),this._register(i.renameProvider.onDidChange(n)),this._register(i.documentFormattingEditProvider.onDidChange(n)),this._register(i.documentRangeFormattingEditProvider.onDidChange(n)),this._register(i.signatureHelpProvider.onDidChange(n)),this._register(i.inlayHintsProvider.onDidChange(n)),n()}dispose(){super.dispose()}reset(){this._contextKeyService.bufferChangeEvents((()=>{this._langId.reset(),this._hasCompletionItemProvider.reset(),this._hasCodeActionsProvider.reset(),this._hasCodeLensProvider.reset(),this._hasDefinitionProvider.reset(),this._hasDeclarationProvider.reset(),this._hasImplementationProvider.reset(),this._hasTypeDefinitionProvider.reset(),this._hasHoverProvider.reset(),this._hasDocumentHighlightProvider.reset(),this._hasDocumentSymbolProvider.reset(),this._hasReferenceProvider.reset(),this._hasRenameProvider.reset(),this._hasDocumentFormattingProvider.reset(),this._hasDocumentSelectionFormattingProvider.reset(),this._hasSignatureHelpProvider.reset(),this._isInWalkThrough.reset()}))}_update(){const e=this._editor.getModel();e?this._contextKeyService.bufferChangeEvents((()=>{this._langId.set(e.getLanguageId()),this._hasCompletionItemProvider.set(this._languageFeaturesService.completionProvider.has(e)),this._hasCodeActionsProvider.set(this._languageFeaturesService.codeActionProvider.has(e)),this._hasCodeLensProvider.set(this._languageFeaturesService.codeLensProvider.has(e)),this._hasDefinitionProvider.set(this._languageFeaturesService.definitionProvider.has(e)),this._hasDeclarationProvider.set(this._languageFeaturesService.declarationProvider.has(e)),this._hasImplementationProvider.set(this._languageFeaturesService.implementationProvider.has(e)),this._hasTypeDefinitionProvider.set(this._languageFeaturesService.typeDefinitionProvider.has(e)),this._hasHoverProvider.set(this._languageFeaturesService.hoverProvider.has(e)),this._hasDocumentHighlightProvider.set(this._languageFeaturesService.documentHighlightProvider.has(e)),this._hasDocumentSymbolProvider.set(this._languageFeaturesService.documentSymbolProvider.has(e)),this._hasReferenceProvider.set(this._languageFeaturesService.referenceProvider.has(e)),this._hasRenameProvider.set(this._languageFeaturesService.renameProvider.has(e)),this._hasSignatureHelpProvider.set(this._languageFeaturesService.signatureHelpProvider.has(e)),this._hasInlayHintsProvider.set(this._languageFeaturesService.inlayHintsProvider.has(e)),this._hasDocumentFormattingProvider.set(this._languageFeaturesService.documentFormattingEditProvider.has(e)||this._languageFeaturesService.documentRangeFormattingEditProvider.has(e)),this._hasDocumentSelectionFormattingProvider.set(this._languageFeaturesService.documentRangeFormattingEditProvider.has(e)),this._hasMultipleDocumentFormattingProvider.set(this._languageFeaturesService.documentFormattingEditProvider.all(e).length+this._languageFeaturesService.documentRangeFormattingEditProvider.all(e).length>1),this._hasMultipleDocumentSelectionFormattingProvider.set(this._languageFeaturesService.documentRangeFormattingEditProvider.all(e).length>1),this._isInWalkThrough.set(e.uri.scheme===Yw.walkThroughSnippet)})):this.reset()}}class GF extends Uo{constructor(e){super(),this._onChange=this._register(new $o),this.onChange=this._onChange.event,this._hasFocus=!1,this._domFocusTracker=this._register(UC(e)),this._register(this._domFocusTracker.onDidFocus((()=>{this._hasFocus=!0,this._onChange.fire(void 0)}))),this._register(this._domFocusTracker.onDidBlur((()=>{this._hasFocus=!1,this._onChange.fire(void 0)})))}hasFocus(){return this._hasFocus}}const ZF=encodeURIComponent("<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 6 3' enable-background='new 0 0 6 3' height='3' width='6'><g fill='"),YF=encodeURIComponent("'><polygon points='5.5,0 2.5,3 1.1,3 4.1,0'/><polygon points='4,0 6,2 6,0.6 5.4,0'/><polygon points='0,2 1,3 2.4,3 0,0.6'/></g></svg>");function XF(e){return ZF+encodeURIComponent(e.toString())+YF}const QF=encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" height="3" width="12"><g fill="'),JF=encodeURIComponent('"><circle cx="1" cy="1" r="1"/><circle cx="5" cy="1" r="1"/><circle cx="9" cy="1" r="1"/></g></svg>');sx(((e,t)=>{const i=e.getColor(sk);i&&t.addRule(`.monaco-editor .squiggly-error { border-bottom: 4px double ${i}; }`);const n=e.getColor(ok);n&&t.addRule(`.monaco-editor .squiggly-error { background: url("data:image/svg+xml,${XF(n)}") repeat-x bottom left; }`);const o=e.getColor(nk);o&&t.addRule(`.monaco-editor .squiggly-error::before { display: block; content: ''; width: 100%; height: 100%; background: ${o}; }`);const s=e.getColor(lk);s&&t.addRule(`.monaco-editor .squiggly-warning { border-bottom: 4px double ${s}; }`);const r=e.getColor(ak);r&&t.addRule(`.monaco-editor .squiggly-warning { background: url("data:image/svg+xml,${XF(r)}") repeat-x bottom left; }`);const a=e.getColor(rk);a&&t.addRule(`.monaco-editor .squiggly-warning::before { display: block; content: ''; width: 100%; height: 100%; background: ${a}; }`);const l=e.getColor(hk);l&&t.addRule(`.monaco-editor .squiggly-info { border-bottom: 4px double ${l}; }`);const d=e.getColor(ck);d&&t.addRule(`.monaco-editor .squiggly-info { background: url("data:image/svg+xml,${XF(d)}") repeat-x bottom left; }`);const c=e.getColor(dk);c&&t.addRule(`.monaco-editor .squiggly-info::before { display: block; content: ''; width: 100%; height: 100%; background: ${c}; }`);const h=e.getColor(gk);h&&t.addRule(`.monaco-editor .squiggly-hint { border-bottom: 2px dotted ${h}; }`);const u=e.getColor(uk);var g;u&&t.addRule(`.monaco-editor .squiggly-hint { background: url("data:image/svg+xml,${g=u,QF+encodeURIComponent(g.toString())+JF}") no-repeat bottom left; }`);const p=e.getColor(lE);p&&t.addRule(`.monaco-editor.showUnused .squiggly-inline-unnecessary { opacity: ${p.rgba.a}; }`);const m=e.getColor(aE);m&&t.addRule(`.monaco-editor.showUnused .squiggly-unnecessary { border-bottom: 2px dashed ${m}; }`);const f=e.getColor(mk)||"inherit";t.addRule(`.monaco-editor.showDeprecated .squiggly-inline-deprecated { text-decoration: line-through; text-decoration-color: ${f}}`)}));class eB{constructor(e,t,i){const n=e=>this.emitter.fire(e);this.emitter=new $o({onFirstListenerAdd:()=>e.addEventListener(t,n,i),onLastListenerRemove:()=>e.removeEventListener(t,n,i)})}get event(){return this.emitter.event}dispose(){this.emitter.dispose()}}function tB(e){return e.preventDefault(),e.stopPropagation(),e}var iB=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r};var nB;!function(e){e.North="north",e.South="south",e.East="east",e.West="west"}(nB||(nB={}));const oB=new $o;const sB=new $o;class rB{constructor(){this.disposables=new ws}get onPointerMove(){return this.disposables.add(new eB(window,"mousemove")).event}get onPointerUp(){return this.disposables.add(new eB(window,"mouseup")).event}dispose(){this.disposables.dispose()}}iB([tS],rB.prototype,"onPointerMove",null),iB([tS],rB.prototype,"onPointerUp",null);class aB{constructor(e){this.el=e,this.disposables=new ws}get onPointerMove(){return this.disposables.add(new eB(this.el,iS.Change)).event}get onPointerUp(){return this.disposables.add(new eB(this.el,iS.End)).event}dispose(){this.disposables.dispose()}}iB([tS],aB.prototype,"onPointerMove",null),iB([tS],aB.prototype,"onPointerUp",null);class lB{constructor(e){this.factory=e}get onPointerMove(){return this.factory.onPointerMove}get onPointerUp(){return this.factory.onPointerUp}dispose(){}}iB([tS],lB.prototype,"onPointerMove",null),iB([tS],lB.prototype,"onPointerUp",null);const dB="pointer-events-disabled";class cB extends Uo{constructor(e,t,i){super(),this.hoverDelay=300,this.hoverDelayer=this._register(new tb(this.hoverDelay)),this._state=3,this.onDidEnablementChange=this._register(new $o),this._onDidStart=this._register(new $o),this._onDidChange=this._register(new $o),this._onDidReset=this._register(new $o),this._onDidEnd=this._register(new $o),this.orthogonalStartSashDisposables=this._register(new ws),this.orthogonalStartDragHandleDisposables=this._register(new ws),this.orthogonalEndSashDisposables=this._register(new ws),this.orthogonalEndDragHandleDisposables=this._register(new ws),this.onDidStart=this._onDidStart.event,this.onDidChange=this._onDidChange.event,this.onDidReset=this._onDidReset.event,this.onDidEnd=this._onDidEnd.event,this.linkedSash=void 0,this.el=$C(e,YC(".monaco-sash")),i.orthogonalEdge&&this.el.classList.add(`orthogonal-edge-${i.orthogonalEdge}`),zo&&this.el.classList.add("mac");const n=this._register(new eB(this.el,"mousedown")).event;this._register(n((e=>this.onPointerStart(e,new rB)),this));const o=this._register(new eB(this.el,"dblclick")).event;this._register(o(this.onPointerDoublePress,this));const s=this._register(new eB(this.el,"mouseenter")).event;this._register(s((()=>cB.onMouseEnter(this))));const r=this._register(new eB(this.el,"mouseleave")).event;this._register(r((()=>cB.onMouseLeave(this)))),this._register(oS.addTarget(this.el));const a=ds.map(this._register(new eB(this.el,iS.Start)).event,(e=>{var t;return Object.assign(Object.assign({},e),{target:null!==(t=e.initialTarget)&&void 0!==t?t:null})}));this._register(a((e=>this.onPointerStart(e,new aB(this.el))),this));const l=this._register(new eB(this.el,iS.Tap)).event,d=ds.map(ds.filter(ds.debounce(l,((e,t)=>{var i;return{event:t,count:(null!==(i=null==e?void 0:e.count)&&void 0!==i?i:0)+1}}),250),(({count:e})=>2===e)),(({event:e})=>{var t;return Object.assign(Object.assign({},e),{target:null!==(t=e.initialTarget)&&void 0!==t?t:null})}));this._register(d(this.onPointerDoublePress,this)),"number"==typeof i.size?(this.size=i.size,0===i.orientation?this.el.style.width=`${this.size}px`:this.el.style.height=`${this.size}px`):(this.size=4,this._register(oB.event((e=>{this.size=e,this.layout()})))),this._register(sB.event((e=>this.hoverDelay=e))),this.layoutProvider=t,this.orthogonalStartSash=i.orthogonalStartSash,this.orthogonalEndSash=i.orthogonalEndSash,this.orientation=i.orientation||0,1===this.orientation?(this.el.classList.add("horizontal"),this.el.classList.remove("vertical")):(this.el.classList.remove("horizontal"),this.el.classList.add("vertical")),this.el.classList.toggle("debug",false),this.layout()}get state(){return this._state}get orthogonalStartSash(){return this._orthogonalStartSash}get orthogonalEndSash(){return this._orthogonalEndSash}set state(e){this._state!==e&&(this.el.classList.toggle("disabled",0===e),this.el.classList.toggle("minimum",1===e),this.el.classList.toggle("maximum",2===e),this._state=e,this.onDidEnablementChange.fire(e))}set orthogonalStartSash(e){if(this.orthogonalStartDragHandleDisposables.clear(),this.orthogonalStartSashDisposables.clear(),e){const t=t=>{this.orthogonalStartDragHandleDisposables.clear(),0!==t&&(this._orthogonalStartDragHandle=$C(this.el,YC(".orthogonal-drag-handle.start")),this.orthogonalStartDragHandleDisposables.add(es((()=>this._orthogonalStartDragHandle.remove()))),this.orthogonalStartDragHandleDisposables.add(new eB(this._orthogonalStartDragHandle,"mouseenter")).event((()=>cB.onMouseEnter(e)),void 0,this.orthogonalStartDragHandleDisposables),this.orthogonalStartDragHandleDisposables.add(new eB(this._orthogonalStartDragHandle,"mouseleave")).event((()=>cB.onMouseLeave(e)),void 0,this.orthogonalStartDragHandleDisposables))};this.orthogonalStartSashDisposables.add(e.onDidEnablementChange.event(t,this)),t(e.state)}this._orthogonalStartSash=e}set orthogonalEndSash(e){if(this.orthogonalEndDragHandleDisposables.clear(),this.orthogonalEndSashDisposables.clear(),e){const t=t=>{this.orthogonalEndDragHandleDisposables.clear(),0!==t&&(this._orthogonalEndDragHandle=$C(this.el,YC(".orthogonal-drag-handle.end")),this.orthogonalEndDragHandleDisposables.add(es((()=>this._orthogonalEndDragHandle.remove()))),this.orthogonalEndDragHandleDisposables.add(new eB(this._orthogonalEndDragHandle,"mouseenter")).event((()=>cB.onMouseEnter(e)),void 0,this.orthogonalEndDragHandleDisposables),this.orthogonalEndDragHandleDisposables.add(new eB(this._orthogonalEndDragHandle,"mouseleave")).event((()=>cB.onMouseLeave(e)),void 0,this.orthogonalEndDragHandleDisposables))};this.orthogonalEndSashDisposables.add(e.onDidEnablementChange.event(t,this)),t(e.state)}this._orthogonalEndSash=e}onPointerStart(e,t){HC(e);let i=!1;if(!e.__orthogonalSashEvent){const n=this.getOrthogonalSash(e);n&&(i=!0,e.__orthogonalSashEvent=!0,n.onPointerStart(e,new lB(t)))}if(this.linkedSash&&!e.__linkedSashEvent&&(e.__linkedSashEvent=!0,this.linkedSash.onPointerStart(e,new lB(t))),!this.state)return;const n=(o="iframe",Array.prototype.slice.call(document.getElementsByTagName(o),0));var o;for(const u of n)u.classList.add(dB);const s=e.pageX,r=e.pageY,a=e.altKey,l={startX:s,currentX:s,startY:r,currentY:r,altKey:a};this.el.classList.add("active"),this._onDidStart.fire(l);const d=RC(this.el),c=()=>{let e="";e=i?"all-scroll":1===this.orientation?1===this.state?"s-resize":2===this.state?"n-resize":zo?"row-resize":"ns-resize":1===this.state?"e-resize":2===this.state?"w-resize":zo?"col-resize":"ew-resize",d.textContent=`* { cursor: ${e} !important; }`},h=new ws;c(),i||this.onDidEnablementChange.event(c,null,h);t.onPointerMove((e=>{HC(e,!1);const t={startX:s,currentX:e.pageX,startY:r,currentY:e.pageY,altKey:a};this._onDidChange.fire(t)}),null,h),t.onPointerUp((e=>{HC(e,!1),this.el.removeChild(d),this.el.classList.remove("active"),this._onDidEnd.fire(),h.dispose();for(const t of n)t.classList.remove(dB)}),null,h),h.add(t)}onPointerDoublePress(e){const t=this.getOrthogonalSash(e);t&&t._onDidReset.fire(),this.linkedSash&&this.linkedSash._onDidReset.fire(),this._onDidReset.fire()}static onMouseEnter(e,t=!1){e.el.classList.contains("active")?(e.hoverDelayer.cancel(),e.el.classList.add("hover")):e.hoverDelayer.trigger((()=>e.el.classList.add("hover")),e.hoverDelay).then(void 0,(()=>{})),!t&&e.linkedSash&&cB.onMouseEnter(e.linkedSash,!0)}static onMouseLeave(e,t=!1){e.hoverDelayer.cancel(),e.el.classList.remove("hover"),!t&&e.linkedSash&&cB.onMouseLeave(e.linkedSash,!0)}clearSashHoverState(){cB.onMouseLeave(this)}layout(){if(0===this.orientation){const e=this.layoutProvider;this.el.style.left=e.getVerticalSashLeft(this)-this.size/2+"px",e.getVerticalSashTop&&(this.el.style.top=e.getVerticalSashTop(this)+"px"),e.getVerticalSashHeight&&(this.el.style.height=e.getVerticalSashHeight(this)+"px")}else{const e=this.layoutProvider;this.el.style.top=e.getHorizontalSashTop(this)-this.size/2+"px",e.getHorizontalSashLeft&&(this.el.style.left=e.getHorizontalSashLeft(this)+"px"),e.getHorizontalSashWidth&&(this.el.style.width=e.getHorizontalSashWidth(this)+"px")}}getOrthogonalSash(e){if(e.target&&e.target instanceof HTMLElement)return e.target.classList.contains("orthogonal-drag-handle")?e.target.classList.contains("start")?this.orthogonalStartSash:this.orthogonalEndSash:void 0}dispose(){super.dispose(),this.el.remove()}}class hB{constructor(e,t,i){this._visiblePosition=e,this._visiblePositionScrollDelta=t,this._cursorPosition=i}static capture(e){let t=null,i=0;if(0!==e.getScrollTop()){const n=e.getVisibleRanges();if(n.length>0){t=n[0].getStartPosition();const o=e.getTopForPosition(t.lineNumber,t.column);i=e.getScrollTop()-o}}return new hB(t,i,e.getPosition())}restore(e){if(this._visiblePosition){const t=e.getTopForPosition(this._visiblePosition.lineNumber,this._visiblePosition.column);e.setScrollTop(t+this._visiblePositionScrollDelta)}}restoreRelativeVerticalPositionOfCursor(e){const t=e.getPosition();if(!this._cursorPosition||!t)return;const i=e.getTopForLineNumber(t.lineNumber)-e.getTopForLineNumber(this._cursorPosition.lineNumber);e.setScrollTop(e.getScrollTop()+i)}}const uB={RESOURCES:"ResourceURLs",DOWNLOAD_URL:"DownloadURL",FILES:"Files",TEXT:LN.text,TERMINALS:"Terminals"};class gB{constructor(e){this.data=e}update(){}getData(){return this.data}}const pB={CurrentDragAndDropData:void 0};class mB extends Uo{constructor(e,t,i={}){super(),this.options=i,this._context=e||this,this._action=t,t instanceof my&&this._register(t.onDidChange((e=>{this.element&&this.handleActionChangeEvent(e)})))}handleActionChangeEvent(e){void 0!==e.enabled&&this.updateEnabled(),void 0!==e.checked&&this.updateChecked(),void 0!==e.class&&this.updateClass(),void 0!==e.label&&(this.updateLabel(),this.updateTooltip()),void 0!==e.tooltip&&this.updateTooltip()}get actionRunner(){return this._actionRunner||(this._actionRunner=this._register(new fy)),this._actionRunner}set actionRunner(e){this._actionRunner=e}getAction(){return this._action}isEnabled(){return this._action.enabled}setActionContext(e){this._context=e}render(e){const t=this.element=e;this._register(oS.addTarget(e));const i=this.options&&this.options.draggable;i&&(e.draggable=!0,o_&&this._register(nC(e,zC.DRAG_START,(e=>{var t;return null===(t=e.dataTransfer)||void 0===t?void 0:t.setData(uB.TEXT,this._action.label)})))),this._register(nC(t,iS.Tap,(e=>this.onClick(e,!0)))),this._register(nC(t,zC.MOUSE_DOWN,(e=>{i||HC(e,!0),this._action.enabled&&0===e.button&&t.classList.add("active")}))),zo&&this._register(nC(t,zC.CONTEXT_MENU,(e=>{0===e.button&&!0===e.ctrlKey&&this.onClick(e)}))),this._register(nC(t,zC.CLICK,(e=>{HC(e,!0),this.options&&this.options.isMenu||this.onClick(e)}))),this._register(nC(t,zC.DBLCLICK,(e=>{HC(e,!0)}))),[zC.MOUSE_UP,zC.MOUSE_OUT].forEach((e=>{this._register(nC(t,e,(e=>{HC(e),t.classList.remove("active")})))}))}onClick(e,t=!1){var i;HC(e,!0);const n=Tr(this._context)?(null===(i=this.options)||void 0===i?void 0:i.useEventAsContext)?e:{preserveFocus:t}:this._context;this.actionRunner.run(this._action,n)}focus(){this.element&&(this.element.tabIndex=0,this.element.focus(),this.element.classList.add("focused"))}blur(){this.element&&(this.element.blur(),this.element.tabIndex=-1,this.element.classList.remove("focused"))}setFocusable(e){this.element&&(this.element.tabIndex=e?0:-1)}get trapsArrowNavigation(){return!1}updateEnabled(){}updateLabel(){}updateTooltip(){}updateClass(){}updateChecked(){}dispose(){this.element&&(this.element.remove(),this.element=void 0),super.dispose()}}class fB extends mB{constructor(e,t,i={}){super(e,t,i),this.options=i,this.options.icon=void 0!==i.icon&&i.icon,this.options.label=void 0===i.label||i.label,this.cssClass=""}render(e){super.render(e),this.element&&(this.label=$C(this.element,YC("a.action-label"))),this.label&&(this._action.id===_y.ID?this.label.setAttribute("role","presentation"):this.options.isMenu?this.label.setAttribute("role","menuitem"):this.label.setAttribute("role","button")),this.options.label&&this.options.keybinding&&this.element&&($C(this.element,YC("span.keybinding")).textContent=this.options.keybinding),this.updateClass(),this.updateLabel(),this.updateTooltip(),this.updateEnabled(),this.updateChecked()}focus(){this.label&&(this.label.tabIndex=0,this.label.focus())}blur(){this.label&&(this.label.tabIndex=-1)}setFocusable(e){this.label&&(this.label.tabIndex=e?0:-1)}updateLabel(){this.options.label&&this.label&&(this.label.textContent=this.getAction().label)}updateTooltip(){let e=null;this.getAction().tooltip?e=this.getAction().tooltip:!this.options.label&&this.getAction().label&&this.options.icon&&(e=this.getAction().label,this.options.keybinding&&(e=mf(0,"{0} ({1})",e,this.options.keybinding))),e&&this.label&&(this.label.title=e)}updateClass(){this.cssClass&&this.label&&this.label.classList.remove(...this.cssClass.split(" ")),this.options.icon?(this.cssClass=this.getAction().class,this.label&&(this.label.classList.add("codicon"),this.cssClass&&this.label.classList.add(...this.cssClass.split(" "))),this.updateEnabled()):this.label&&this.label.classList.remove("codicon")}updateEnabled(){this.getAction().enabled?(this.label&&(this.label.removeAttribute("aria-disabled"),this.label.classList.remove("disabled")),this.element&&this.element.classList.remove("disabled")):(this.label&&(this.label.setAttribute("aria-disabled","true"),this.label.classList.add("disabled")),this.element&&this.element.classList.add("disabled"))}updateChecked(){this.label&&(this.getAction().checked?this.label.classList.add("checked"):this.label.classList.remove("checked"))}}var _B=globalThis&&globalThis.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{l(n.next(e))}catch(t){s(t)}}function a(e){try{l(n.throw(e))}catch(t){s(t)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}l((n=n.apply(e,t||[])).next())}))};class vB extends Uo{constructor(e,t={}){var i,n,o,s,r,a;let l,d;switch(super(),this.triggerKeyDown=!1,this.focusable=!0,this._onDidBlur=this._register(new $o),this.onDidBlur=this._onDidBlur.event,this._onDidCancel=this._register(new $o({onFirstListenerAdd:()=>this.cancelHasListener=!0})),this.onDidCancel=this._onDidCancel.event,this.cancelHasListener=!1,this._onDidRun=this._register(new $o),this.onDidRun=this._onDidRun.event,this._onBeforeRun=this._register(new $o),this.onBeforeRun=this._onBeforeRun.event,this.options=t,this._context=null!==(i=t.context)&&void 0!==i?i:null,this._orientation=null!==(n=this.options.orientation)&&void 0!==n?n:0,this._triggerKeys={keyDown:null!==(s=null===(o=this.options.triggerKeys)||void 0===o?void 0:o.keyDown)&&void 0!==s&&s,keys:null!==(a=null===(r=this.options.triggerKeys)||void 0===r?void 0:r.keys)&&void 0!==a?a:[3,10]},this.options.actionRunner?this._actionRunner=this.options.actionRunner:(this._actionRunner=new fy,this._register(this._actionRunner)),this._register(this._actionRunner.onDidRun((e=>this._onDidRun.fire(e)))),this._register(this._actionRunner.onBeforeRun((e=>this._onBeforeRun.fire(e)))),this._actionIds=[],this.viewItems=[],this.focusedItem=void 0,this.domNode=document.createElement("div"),this.domNode.className="monaco-action-bar",!1!==t.animated&&this.domNode.classList.add("animated"),this._orientation){case 0:l=[15],d=[17];break;case 1:l=[16],d=[18],this.domNode.className+=" vertical"}this._register(nC(this.domNode,zC.KEY_DOWN,(e=>{const t=new jw(e);let i=!0;const n="number"==typeof this.focusedItem?this.viewItems[this.focusedItem]:void 0;l&&(t.equals(l[0])||t.equals(l[1]))?i=this.focusPrevious():d&&(t.equals(d[0])||t.equals(d[1]))?i=this.focusNext():t.equals(9)&&this.cancelHasListener?this._onDidCancel.fire():t.equals(14)?i=this.focusFirst():t.equals(13)?i=this.focusLast():t.equals(2)&&n instanceof mB&&n.trapsArrowNavigation?i=this.focusNext():this.isTriggerKeyEvent(t)?this._triggerKeys.keyDown?this.doTrigger(t):this.triggerKeyDown=!0:i=!1,i&&(t.preventDefault(),t.stopPropagation())}))),this._register(nC(this.domNode,zC.KEY_UP,(e=>{const t=new jw(e);this.isTriggerKeyEvent(t)?(!this._triggerKeys.keyDown&&this.triggerKeyDown&&(this.triggerKeyDown=!1,this.doTrigger(t)),t.preventDefault(),t.stopPropagation()):(t.equals(2)||t.equals(1026))&&this.updateFocusedItem()}))),this.focusTracker=this._register(UC(this.domNode)),this._register(this.focusTracker.onDidBlur((()=>{OC()!==this.domNode&&NC(OC(),this.domNode)||(this._onDidBlur.fire(),this.focusedItem=void 0,this.previouslyFocusedItem=void 0,this.triggerKeyDown=!1)}))),this._register(this.focusTracker.onDidFocus((()=>this.updateFocusedItem()))),this.actionsList=document.createElement("ul"),this.actionsList.className="actions-container",this.actionsList.setAttribute("role","toolbar"),this.options.ariaLabel&&this.actionsList.setAttribute("aria-label",this.options.ariaLabel),this.domNode.appendChild(this.actionsList),e.appendChild(this.domNode)}refreshRole(){this.length()>=2?this.actionsList.setAttribute("role","toolbar"):this.actionsList.setAttribute("role","presentation")}setFocusable(e){if(this.focusable=e,this.focusable){const e=this.viewItems.find((e=>e instanceof mB&&e.isEnabled()));e instanceof mB&&e.setFocusable(!0)}else this.viewItems.forEach((e=>{e instanceof mB&&e.setFocusable(!1)}))}isTriggerKeyEvent(e){let t=!1;return this._triggerKeys.keys.forEach((i=>{t=t||e.equals(i)})),t}updateFocusedItem(){for(let e=0;e<this.actionsList.children.length;e++){const t=this.actionsList.children[e];if(NC(OC(),t)){this.focusedItem=e;break}}}get context(){return this._context}set context(e){this._context=e,this.viewItems.forEach((t=>t.setActionContext(e)))}get actionRunner(){return this._actionRunner}set actionRunner(e){e&&(this._actionRunner=e,this.viewItems.forEach((t=>t.actionRunner=e)))}getContainer(){return this.domNode}push(e,t={}){const i=Array.isArray(e)?e:[e];let n=vr(t.index)?t.index:null;i.forEach((e=>{const i=document.createElement("li");let o;i.className="action-item",i.setAttribute("role","presentation"),this.options.allowContextMenu||this._register(nC(i,zC.CONTEXT_MENU,(e=>{HC(e,!0)}))),this.options.actionViewItemProvider&&(o=this.options.actionViewItemProvider(e)),o||(o=new fB(this.context,e,t)),o.actionRunner=this._actionRunner,o.setActionContext(this.context),o.render(i),this.focusable&&o instanceof mB&&0===this.viewItems.length&&o.setFocusable(!0),null===n||n<0||n>=this.actionsList.children.length?(this.actionsList.appendChild(i),this.viewItems.push(o),this._actionIds.push(e.id)):(this.actionsList.insertBefore(i,this.actionsList.children[n]),this.viewItems.splice(n,0,o),this._actionIds.splice(n,0,e.id),n++)})),"number"==typeof this.focusedItem&&this.focus(this.focusedItem),this.refreshRole()}clear(){bs(this.viewItems),this.viewItems=[],this._actionIds=[],eC(this.actionsList),this.refreshRole()}length(){return this.viewItems.length}focus(e){let t,i=!1;if(void 0===e?i=!0:"number"==typeof e?t=e:"boolean"==typeof e&&(i=e),i&&void 0===this.focusedItem){const e=this.viewItems.findIndex((e=>e.isEnabled()));this.focusedItem=-1===e?void 0:e,this.updateFocus(void 0,void 0,!0)}else void 0!==t&&(this.focusedItem=t),this.updateFocus(void 0,void 0,!0)}focusFirst(){return this.focusedItem=this.length()-1,this.focusNext(!0)}focusLast(){return this.focusedItem=0,this.focusPrevious(!0)}focusNext(e){if(void 0===this.focusedItem)this.focusedItem=this.viewItems.length-1;else if(this.viewItems.length<=1)return!1;const t=this.focusedItem;let i;do{if(!e&&this.options.preventLoopNavigation&&this.focusedItem+1>=this.viewItems.length)return this.focusedItem=t,!1;this.focusedItem=(this.focusedItem+1)%this.viewItems.length,i=this.viewItems[this.focusedItem]}while(this.focusedItem!==t&&this.options.focusOnlyEnabledItems&&!i.isEnabled());return this.updateFocus(),!0}focusPrevious(e){if(void 0===this.focusedItem)this.focusedItem=0;else if(this.viewItems.length<=1)return!1;const t=this.focusedItem;let i;do{if(this.focusedItem=this.focusedItem-1,this.focusedItem<0){if(!e&&this.options.preventLoopNavigation)return this.focusedItem=t,!1;this.focusedItem=this.viewItems.length-1}i=this.viewItems[this.focusedItem]}while(this.focusedItem!==t&&this.options.focusOnlyEnabledItems&&!i.isEnabled());return this.updateFocus(!0),!0}updateFocus(e,t,i=!1){var n;void 0===this.focusedItem&&this.actionsList.focus({preventScroll:t}),void 0!==this.previouslyFocusedItem&&this.previouslyFocusedItem!==this.focusedItem&&(null===(n=this.viewItems[this.previouslyFocusedItem])||void 0===n||n.blur());const o=void 0!==this.focusedItem&&this.viewItems[this.focusedItem];if(o){let n=!0;ua(o.focus)||(n=!1),this.options.focusOnlyEnabledItems&&ua(o.isEnabled)&&!o.isEnabled()&&(n=!1),n?(i||this.previouslyFocusedItem!==this.focusedItem)&&(o.focus(e),this.previouslyFocusedItem=this.focusedItem):(this.actionsList.focus({preventScroll:t}),this.previouslyFocusedItem=void 0)}}doTrigger(e){if(void 0===this.focusedItem)return;const t=this.viewItems[this.focusedItem];if(t instanceof mB){const i=null===t._context||void 0===t._context?e:t._context;this.run(t._action,i)}}run(e,t){return _B(this,void 0,void 0,(function*(){yield this._actionRunner.run(e,t)}))}dispose(){bs(this.viewItems),this.viewItems=[],this._actionIds=[],this.getContainer().remove(),super.dispose()}}var bB;!function(e){e.getDefinition=function(e,t){let i=e.defaults;for(;ex.isThemeIcon(i);){const e=wB.getIcon(i.id);if(!e)return;i=e.defaults}return i}}(bB||(bB={}));const wB=new class{constructor(){this._onDidChange=new $o,this.onDidChange=this._onDidChange.event,this.iconSchema={definitions:{icons:{type:"object",properties:{fontId:{type:"string",description:mf(0,"The id of the font to use. If not set, the font that is defined first is used.")},fontCharacter:{type:"string",description:mf(0,"The font character associated with the icon definition.")}},additionalProperties:!1,defaultSnippets:[{body:{fontCharacter:"\\\\e030"}}]}},type:"object",properties:{}},this.iconReferenceSchema={type:"string",pattern:`^${Ys.iconNameExpression}$`,enum:[],enumDescriptions:[]},this.iconsById={},this.iconFontsById={}}registerIcon(e,t,i,n){const o=this.iconsById[e];if(o){if(i&&!o.description){o.description=i,this.iconSchema.properties[e].markdownDescription=`${i} $(${e})`;const t=this.iconReferenceSchema.enum.indexOf(e);-1!==t&&(this.iconReferenceSchema.enumDescriptions[t]=i),this._onDidChange.fire()}return o}let s={id:e,description:i,defaults:t,deprecationMessage:n};this.iconsById[e]=s;let r={$ref:"#/definitions/icons"};return n&&(r.deprecationMessage=n),i&&(r.markdownDescription=`${i}: $(${e})`),this.iconSchema.properties[e]=r,this.iconReferenceSchema.enum.push(e),this.iconReferenceSchema.enumDescriptions.push(i||""),this._onDidChange.fire(),{id:e}}getIcons(){return Object.keys(this.iconsById).map((e=>this.iconsById[e]))}getIcon(e){return this.iconsById[e]}getIconSchema(){return this.iconSchema}toString(){const e=(e,t)=>e.id.localeCompare(t.id),t=e=>{for(;ex.isThemeIcon(e.defaults);)e=this.iconsById[e.defaults.id];return`codicon codicon-${e?e.id:""}`};let i=[];i.push("| preview | identifier | default codicon ID | description"),i.push("| ----------- | --------------------------------- | --------------------------------- | --------------------------------- |");const n=Object.keys(this.iconsById).map((e=>this.iconsById[e]));for(const o of n.filter((e=>!!e.description)).sort(e))i.push(`|<i class="${t(o)}"></i>|${o.id}|${ex.isThemeIcon(o.defaults)?o.defaults.id:o.id}|${o.description||""}|`);i.push("| preview | identifier "),i.push("| ----------- | --------------------------------- |");for(const o of n.filter((e=>!ex.isThemeIcon(e.defaults))).sort(e))i.push(`|<i class="${t(o)}"></i>|${o.id}|`);return i.join("\n")}};function CB(e,t,i,n){return wB.registerIcon(e,t,i,n)}function yB(){return wB}Yy.add("base.contributions.icons",wB),function(){for(const e of br.getAll())wB.registerIcon(e.id,e.definition,e.description)}();const xB="vscode://schemas/icons";let SB=Yy.as(uS);SB.registerSchema(xB,wB.getIconSchema());const kB=new lb((()=>SB.notifySchemaChanged(xB)),200);wB.onDidChange((()=>{kB.isScheduled()||kB.schedule()}));const DB=CB("widget-close",br.close,mf(0,"Icon for the close action in widgets."));CB("goto-previous-location",br.arrowUp,mf(0,"Icon for goto previous editor location.")),CB("goto-next-location",br.arrowDown,mf(0,"Icon for goto next editor location.")),ex.modify(br.sync,"spin"),ex.modify(br.loading,"spin");var LB,NB=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},EB=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}},IB=globalThis&&globalThis.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{l(n.next(e))}catch(t){s(t)}}function a(e){try{l(n.throw(e))}catch(t){s(t)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}l((n=n.apply(e,t||[])).next())}))};class TB{constructor(e,t,i,n){this.originalLineStart=e,this.originalLineEnd=t,this.modifiedLineStart=i,this.modifiedLineEnd=n}getType(){return 0===this.originalLineStart?1:0===this.modifiedLineStart?2:0}}class MB{constructor(e){this.entries=e}}const AB=CB("diff-review-insert",br.add,mf(0,"Icon for 'Insert' in diff review.")),OB=CB("diff-review-remove",br.remove,mf(0,"Icon for 'Remove' in diff review.")),RB=CB("diff-review-close",br.close,mf(0,"Icon for 'Close' in diff review."));let PB=class e extends Uo{constructor(e,t){super(),this._languageService=t,this._width=0,this._diffEditor=e,this._isVisible=!1,this.shadow=p_(document.createElement("div")),this.shadow.setClassName("diff-review-shadow"),this.actionBarContainer=p_(document.createElement("div")),this.actionBarContainer.setClassName("diff-review-actions"),this._actionBar=this._register(new vB(this.actionBarContainer.domNode)),this._actionBar.push(new my("diffreview.close",mf(0,"Close"),"close-diff-review "+ex.asClassName(RB),!0,(()=>IB(this,void 0,void 0,(function*(){return this.hide()})))),{label:!1,icon:!0}),this.domNode=p_(document.createElement("div")),this.domNode.setClassName("diff-review monaco-editor-background"),this._content=p_(document.createElement("div")),this._content.setClassName("diff-review-content"),this._content.setAttribute("role","code"),this.scrollbar=this._register(new fT(this._content.domNode,{})),this.domNode.domNode.appendChild(this.scrollbar.getDomNode()),this._register(e.onDidUpdateDiff((()=>{this._isVisible&&(this._diffs=this._compute(),this._render())}))),this._register(e.getModifiedEditor().onDidChangeCursorPosition((()=>{this._isVisible&&this._render()}))),this._register(sC(this.domNode.domNode,"click",(e=>{e.preventDefault();const t=EC(e.target,"diff-review-row");t&&this._goToRow(t)}))),this._register(sC(this.domNode.domNode,"keydown",(e=>{(e.equals(18)||e.equals(2066)||e.equals(530))&&(e.preventDefault(),this._goToRow(this._getNextRow())),(e.equals(16)||e.equals(2064)||e.equals(528))&&(e.preventDefault(),this._goToRow(this._getPrevRow())),(e.equals(9)||e.equals(2057)||e.equals(521)||e.equals(1033))&&(e.preventDefault(),this.hide()),(e.equals(10)||e.equals(3))&&(e.preventDefault(),this.accept())}))),this._diffs=[],this._currentDiff=null}prev(){let e=0;if(this._isVisible||(this._diffs=this._compute()),this._isVisible){let t=-1;for(let e=0,i=this._diffs.length;e<i;e++)if(this._diffs[e]===this._currentDiff){t=e;break}e=this._diffs.length+t-1}else e=this._findDiffIndex(this._diffEditor.getPosition());if(0===this._diffs.length)return;e%=this._diffs.length;const t=this._diffs[e].entries;this._diffEditor.setPosition(new er(t[0].modifiedLineStart,1)),this._diffEditor.setSelection({startColumn:1,startLineNumber:t[0].modifiedLineStart,endColumn:1073741824,endLineNumber:t[t.length-1].modifiedLineEnd}),this._isVisible=!0,this._diffEditor.doLayout(),this._render(),this._goToRow(this._getNextRow())}next(){let e=0;if(this._isVisible||(this._diffs=this._compute()),this._isVisible){let t=-1;for(let e=0,i=this._diffs.length;e<i;e++)if(this._diffs[e]===this._currentDiff){t=e;break}e=t+1}else e=this._findDiffIndex(this._diffEditor.getPosition());if(0===this._diffs.length)return;e%=this._diffs.length;const t=this._diffs[e].entries;this._diffEditor.setPosition(new er(t[0].modifiedLineStart,1)),this._diffEditor.setSelection({startColumn:1,startLineNumber:t[0].modifiedLineStart,endColumn:1073741824,endLineNumber:t[t.length-1].modifiedLineEnd}),this._isVisible=!0,this._diffEditor.doLayout(),this._render(),this._goToRow(this._getNextRow())}accept(){let e=-1;const t=this._getCurrentFocusedRow();if(t){const i=parseInt(t.getAttribute("data-line"),10);isNaN(i)||(e=i)}this.hide(),-1!==e&&(this._diffEditor.setPosition(new er(e,1)),this._diffEditor.revealPosition(new er(e,1),1))}hide(){this._isVisible=!1,this._diffEditor.updateOptions({readOnly:!1}),this._diffEditor.focus(),this._diffEditor.doLayout(),this._render()}_getPrevRow(){const e=this._getCurrentFocusedRow();return e?e.previousElementSibling?e.previousElementSibling:e:this._getFirstRow()}_getNextRow(){const e=this._getCurrentFocusedRow();return e?e.nextElementSibling?e.nextElementSibling:e:this._getFirstRow()}_getFirstRow(){return this.domNode.domNode.querySelector(".diff-review-row")}_getCurrentFocusedRow(){const e=document.activeElement;return e&&/diff-review-row/.test(e.className)?e:null}_goToRow(e){const t=this._getCurrentFocusedRow();e.tabIndex=0,e.focus(),t&&t!==e&&(t.tabIndex=-1),this.scrollbar.scanDomNode()}isVisible(){return this._isVisible}layout(e,t,i){this._width=t,this.shadow.setTop(e-6),this.shadow.setWidth(t),this.shadow.setHeight(this._isVisible?6:0),this.domNode.setTop(e),this.domNode.setWidth(t),this.domNode.setHeight(i),this._content.setHeight(i),this._content.setWidth(t),this._isVisible?(this.actionBarContainer.setAttribute("aria-hidden","false"),this.actionBarContainer.setDisplay("block")):(this.actionBarContainer.setAttribute("aria-hidden","true"),this.actionBarContainer.setDisplay("none"))}_compute(){const t=this._diffEditor.getLineChanges();if(!t||0===t.length)return[];const i=this._diffEditor.getOriginalEditor().getModel(),n=this._diffEditor.getModifiedEditor().getModel();return i&&n?e._mergeAdjacent(t,i.getLineCount(),n.getLineCount()):[]}static _mergeAdjacent(e,t,i){if(!e||0===e.length)return[];const n=[];let o=0;for(let l=0,d=e.length;l<d;l++){const s=e[l],r=s.originalStartLineNumber,a=s.originalEndLineNumber,c=s.modifiedStartLineNumber,h=s.modifiedEndLineNumber,u=[];let g=0;{const t=0===a?r:r-1,i=0===h?c:c-1;let n=1,o=1;if(l>0){const t=e[l-1];n=0===t.originalEndLineNumber?t.originalStartLineNumber+1:t.originalEndLineNumber+1,o=0===t.modifiedEndLineNumber?t.modifiedStartLineNumber+1:t.modifiedEndLineNumber+1}let s=t-3+1,d=i-3+1;if(s<n){const e=n-s;s+=e,d+=e}if(d<o){const e=o-d;s+=e,d+=e}u[g++]=new TB(s,t,d,i)}0!==a&&(u[g++]=new TB(r,a,0,0)),0!==h&&(u[g++]=new TB(0,0,c,h));{const n=0===a?r+1:a+1,o=0===h?c+1:h+1;let s=t,p=i;if(l+1<d){const t=e[l+1];s=0===t.originalEndLineNumber?t.originalStartLineNumber:t.originalStartLineNumber-1,p=0===t.modifiedEndLineNumber?t.modifiedStartLineNumber:t.modifiedStartLineNumber-1}let m=n+3-1,f=o+3-1;if(m>s){const e=s-m;m+=e,f+=e}if(f>p){const e=p-f;m+=e,f+=e}u[g++]=new TB(n,m,o,f)}n[o++]=new MB(u)}let s=n[0].entries;const r=[];let a=0;for(let l=1,d=n.length;l<d;l++){const e=n[l].entries,t=s[s.length-1],i=e[0];0===t.getType()&&0===i.getType()&&i.originalLineStart<=t.originalLineEnd?(s[s.length-1]=new TB(t.originalLineStart,i.originalLineEnd,t.modifiedLineStart,i.modifiedLineEnd),s=s.concat(e.slice(1))):(r[a++]=new MB(s),s=e)}return r[a++]=new MB(s),r}_findDiffIndex(e){const t=e.lineNumber;for(let i=0,n=this._diffs.length;i<n;i++){const e=this._diffs[i].entries;if(t<=e[e.length-1].modifiedLineEnd)return i}return 0}_render(){const t=this._diffEditor.getOriginalEditor().getOptions(),i=this._diffEditor.getModifiedEditor().getOptions(),n=this._diffEditor.getOriginalEditor().getModel(),o=this._diffEditor.getModifiedEditor().getModel(),s=n.getOptions(),r=o.getOptions();if(!this._isVisible||!n||!o)return eC(this._content.domNode),this._currentDiff=null,void this.scrollbar.scanDomNode();this._diffEditor.updateOptions({readOnly:!0});const a=this._findDiffIndex(this._diffEditor.getPosition());if(this._diffs[a]===this._currentDiff)return;this._currentDiff=this._diffs[a];const l=this._diffs[a].entries,d=document.createElement("div");d.className="diff-review-table",d.setAttribute("role","list"),d.setAttribute("aria-label",'Difference review. Use "Stage | Unstage | Revert Selected Ranges" commands'),m_(d,i.get(44));let c=0,h=0,u=0,g=0;for(let e=0,x=l.length;e<x;e++){const t=l[e],i=t.originalLineStart,n=t.originalLineEnd,o=t.modifiedLineStart,s=t.modifiedLineEnd;0!==i&&(0===c||i<c)&&(c=i),0!==n&&(0===h||n>h)&&(h=n),0!==o&&(0===u||o<u)&&(u=o),0!==s&&(0===g||s>g)&&(g=s)}const p=document.createElement("div");p.className="diff-review-row";const m=document.createElement("div");m.className="diff-review-cell diff-review-summary";const f=h-c+1,_=g-u+1;m.appendChild(document.createTextNode(`${a+1}/${this._diffs.length}: @@ -${c},${f} +${u},${_} @@`)),p.setAttribute("data-line",String(u));const v=e=>0===e?mf(0,"no lines changed"):1===e?mf(0,"1 line changed"):mf(0,"{0} lines changed",e),b=v(f),w=v(_);p.setAttribute("aria-label",mf(0,"Difference {0} of {1}: original line {2}, {3}, modified line {4}, {5}",a+1,this._diffs.length,c,b,u,w)),p.appendChild(m),p.setAttribute("role","listitem"),d.appendChild(p);const C=i.get(59);let y=u;for(let x=0,S=l.length;x<S;x++){const a=l[x];e._renderSection(d,a,y,C,this._width,t,n,s,i,o,r,this._languageService.languageIdCodec),0!==a.modifiedLineStart&&(y=a.modifiedLineEnd)}eC(this._content.domNode),this._content.domNode.appendChild(d),this.scrollbar.scanDomNode()}static _renderSection(t,i,n,o,s,r,a,l,d,c,h,u){const g=i.getType();let p="diff-review-row",m="";let f=null;switch(g){case 1:p="diff-review-row line-insert",m=" char-insert",f=AB;break;case 2:p="diff-review-row line-delete",m=" char-delete",f=OB}const _=i.originalLineStart,v=i.originalLineEnd,b=i.modifiedLineStart,w=i.modifiedLineEnd,C=Math.max(w-b,v-_),y=r.get(131),x=y.glyphMarginWidth+y.lineNumbersWidth,S=d.get(131),k=10+S.glyphMarginWidth+S.lineNumbersWidth;for(let D=0;D<=C;D++){const i=0===_?0:_+D,v=0===b?0:b+D,w=document.createElement("div");w.style.minWidth=s+"px",w.className=p,w.setAttribute("role","listitem"),0!==v&&(n=v),w.setAttribute("data-line",String(n));const C=document.createElement("div");C.className="diff-review-cell",C.style.height=`${o}px`,w.appendChild(C);const y=document.createElement("span");y.style.width=x+"px",y.style.minWidth=x+"px",y.className="diff-review-line-number"+m,0!==i?y.appendChild(document.createTextNode(String(i))):y.innerText=" ",C.appendChild(y);const S=document.createElement("span");S.style.width=k+"px",S.style.minWidth=k+"px",S.style.paddingRight="10px",S.className="diff-review-line-number"+m,0!==v?S.appendChild(document.createTextNode(String(v))):S.innerText=" ",C.appendChild(S);const L=document.createElement("span");if(L.className="diff-review-spacer",f){const e=document.createElement("span");e.className=ex.asClassName(f),e.innerText=" ",L.appendChild(e)}else L.innerText=" ";let N;if(C.appendChild(L),0!==v){let t=this._renderLine(c,d,h.tabSize,v,u);e._ttPolicy&&(t=e._ttPolicy.createHTML(t)),C.insertAdjacentHTML("beforeend",t),N=c.getLineContent(v)}else{let t=this._renderLine(a,r,l.tabSize,i,u);e._ttPolicy&&(t=e._ttPolicy.createHTML(t)),C.insertAdjacentHTML("beforeend",t),N=a.getLineContent(i)}0===N.length&&(N=mf(0,"blank"));let E="";switch(g){case 0:E=i===v?mf(0,"{0} unchanged line {1}",N,i):mf(0,"{0} original line {1} modified line {2}",N,i,v);break;case 1:E=mf(0,"+ {0} modified line {1}",N,v);break;case 2:E=mf(0,"- {0} original line {1}",N,i)}w.setAttribute("aria-label",E),t.appendChild(w)}}static _renderLine(e,t,i,n,o){const s=e.getLineContent(n),r=t.get(44),a=zb.createEmpty(s,o),l=aw.isBasicASCII(s,e.mightContainNonBasicASCII()),d=aw.containsRTL(s,l,e.mightContainRTL());return ew(new Gb(r.isMonospace&&!t.get(29),r.canUseHalfwidthRightwardsArrow,s,!1,l,d,0,a,[],i,0,r.spaceWidth,r.middotWidth,r.wsmiddotWidth,t.get(105),t.get(88),t.get(83),t.get(45)!==Of.OFF,null)).html}};PB._ttPolicy=null===(LB=window.trustedTypes)||void 0===LB?void 0:LB.createPolicy("diffReview",{createHTML:e=>e}),PB=NB([EB(1,Lv)],PB),sx(((e,t)=>{const i=e.getColor(QN);i&&t.addRule(`.monaco-diff-editor .diff-review-line-number { color: ${i}; }`);const n=e.getColor(QS);n&&t.addRule(`.monaco-diff-editor .diff-review-shadow { box-shadow: ${n} 0 -6px 6px -6px inset; }`)}));function FB(e){const t=e.get(N_),i=t.listDiffEditors(),n=t.getActiveCodeEditor();if(!n)return null;for(let o=0,s=i.length;o<s;o++){const e=i[o];if(e.getModifiedEditor().getId()===n.getId()||e.getOriginalEditor().getId()===n.getId())return e}return null}Lx(class extends xx{constructor(){super({id:"editor.action.diffReview.next",label:mf(0,"Go to Next Difference"),alias:"Go to Next Difference",precondition:Sy.has("isInDiffEditor"),kbOpts:{kbExpr:null,primary:65,weight:100}})}run(e,t){const i=FB(e);i&&i.diffReviewNext()}}),Lx(class extends xx{constructor(){super({id:"editor.action.diffReview.prev",label:mf(0,"Go to Previous Difference"),alias:"Go to Previous Difference",precondition:Sy.has("isInDiffEditor"),kbOpts:{kbExpr:null,primary:1089,weight:100}})}run(e,t){const i=FB(e);i&&i.diffReviewPrev()}});const BB=L_("editorWorkerService"),VB=L_("contextViewService"),WB=L_("contextMenuService");var zB=globalThis&&globalThis.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{l(n.next(e))}catch(t){s(t)}}function a(e){try{l(n.throw(e))}catch(t){s(t)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}l((n=n.apply(e,t||[])).next())}))};class HB extends Uo{constructor(e,t,i,n,o,s){super(),this._viewZoneId=e,this._marginDomNode=t,this.editor=i,this.diff=n,this._contextMenuService=o,this._clipboardService=s,this._visibility=!1,this._marginDomNode.style.zIndex="10",this._diffActions=document.createElement("div"),this._diffActions.className=br.lightBulb.classNames+" lightbulb-glyph",this._diffActions.style.position="absolute";const r=i.getOption(59),a=i.getModel().getEOL();this._diffActions.style.right="0px",this._diffActions.style.visibility="hidden",this._diffActions.style.height=`${r}px`,this._diffActions.style.lineHeight=`${r}px`,this._marginDomNode.appendChild(this._diffActions);const l=[],d=0===n.modifiedEndLineNumber;l.push(new my("diff.clipboard.copyDeletedContent",d?n.originalEndLineNumber>n.modifiedStartLineNumber?mf(0,"Copy deleted lines"):mf(0,"Copy deleted line"):n.originalEndLineNumber>n.modifiedStartLineNumber?mf(0,"Copy changed lines"):mf(0,"Copy changed line"),void 0,!0,(()=>zB(this,void 0,void 0,(function*(){const e=new qo(n.originalStartLineNumber,1,n.originalEndLineNumber+1,1),t=n.originalModel.getValueInRange(e);yield this._clipboardService.writeText(t)})))));let c,h=0;n.originalEndLineNumber>n.modifiedStartLineNumber&&(c=new my("diff.clipboard.copyDeletedLineContent",mf(0,d?"Copy deleted line ({0})":"Copy changed line ({0})",n.originalStartLineNumber),void 0,!0,(()=>zB(this,void 0,void 0,(function*(){const e=n.originalModel.getLineContent(n.originalStartLineNumber+h);if(""===e){const e=n.originalModel.getEndOfLineSequence();yield this._clipboardService.writeText(0===e?"\n":"\r\n")}else yield this._clipboardService.writeText(e)})))),l.push(c));i.getOption(81)||l.push(new my("diff.inline.revertChange",mf(0,"Revert this change"),void 0,!0,(()=>zB(this,void 0,void 0,(function*(){const e=new qo(n.originalStartLineNumber,1,n.originalEndLineNumber,n.originalModel.getLineMaxColumn(n.originalEndLineNumber)),t=n.originalModel.getValueInRange(e);if(0===n.modifiedEndLineNumber){const e=i.getModel().getLineMaxColumn(n.modifiedStartLineNumber);i.executeEdits("diffEditor",[{range:new qo(n.modifiedStartLineNumber,e,n.modifiedStartLineNumber,e),text:a+t}])}else{const e=i.getModel().getLineMaxColumn(n.modifiedEndLineNumber);i.executeEdits("diffEditor",[{range:new qo(n.modifiedStartLineNumber,1,n.modifiedEndLineNumber,e),text:t}])}})))));const u=(e,t)=>{this._contextMenuService.showContextMenu({getAnchor:()=>({x:e,y:t}),getActions:()=>(c&&(c.label=mf(0,d?"Copy deleted line ({0})":"Copy changed line ({0})",n.originalStartLineNumber+h)),l),autoSelectFirstItem:!0})};this._register(sC(this._diffActions,"mousedown",(e=>{const{top:t,height:i}=yC(this._diffActions),n=Math.floor(r/3);e.preventDefault(),u(e.posx,t+i+n)}))),this._register(i.onMouseMove((e=>{if(8===e.target.type||5===e.target.type){e.target.detail.viewZoneId===this._viewZoneId?(this.visibility=!0,h=this._updateLightBulbPosition(this._marginDomNode,e.event.browserEvent.y,r)):this.visibility=!1}else this.visibility=!1}))),this._register(i.onMouseDown((e=>{if(e.event.rightButton&&(8===e.target.type||5===e.target.type)){e.target.detail.viewZoneId===this._viewZoneId&&(e.event.preventDefault(),h=this._updateLightBulbPosition(this._marginDomNode,e.event.browserEvent.y,r),u(e.event.posx,e.event.posy+r))}})))}get visibility(){return this._visibility}set visibility(e){this._visibility!==e&&(this._visibility=e,this._diffActions.style.visibility=e?"visible":"hidden")}_updateLightBulbPosition(e,t,i){const{top:n}=yC(e),o=t-n,s=Math.floor(o/i),r=s*i;if(this._diffActions.style.top=`${r}px`,this.diff.viewLineCounts){let e=0;for(let t=0;t<this.diff.viewLineCounts.length;t++)if(e+=this.diff.viewLineCounts[t],s<e)return t}return s}}const jB=L_("clipboardService");Object.freeze({total(){},worked(){},done(){}});class UB{constructor(e){this.callback=e}report(e){this._value=e,this.callback(this._value)}}UB.None=Object.freeze({report(){}});const $B=L_("editorProgressService");var KB,qB=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},GB=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};class ZB{constructor(e,t){this._contextMenuService=e,this._clipboardService=t,this._zones=[],this._inlineDiffMargins=[],this._zonesMap={},this._decorations=[]}getForeignViewZones(e){return e.filter((e=>!this._zonesMap[String(e.id)]))}clean(e){this._zones.length>0&&e.changeViewZones((e=>{for(const t of this._zones)e.removeZone(t)})),this._zones=[],this._zonesMap={},this._decorations=e.deltaDecorations(this._decorations,[])}apply(e,t,i,n){const o=n?hB.capture(e):null;e.changeViewZones((t=>{var n;for(const e of this._zones)t.removeZone(e);for(const e of this._inlineDiffMargins)e.dispose();this._zones=[],this._zonesMap={},this._inlineDiffMargins=[];for(let o=0,s=i.zones.length;o<s;o++){const s=i.zones[o];s.suppressMouseDown=!0;const r=t.addZone(s);this._zones.push(r),this._zonesMap[String(r)]=!0,i.zones[o].diff&&s.marginDomNode&&(s.suppressMouseDown=!1,0!==(null===(n=i.zones[o].diff)||void 0===n?void 0:n.originalModel.getValueLength())&&this._inlineDiffMargins.push(new HB(r,s.marginDomNode,e,i.zones[o].diff,this._contextMenuService,this._clipboardService)))}})),o&&o.restore(e),this._decorations=e.deltaDecorations(this._decorations,i.decorations),t&&t.setZones(i.overviewZones)}}let YB=0;const XB=CB("diff-insert",br.add,mf(0,"Line decoration for inserts in the diff editor.")),QB=CB("diff-remove",br.remove,mf(0,"Line decoration for removals in the diff editor.")),JB=null===(KB=window.trustedTypes)||void 0===KB?void 0:KB.createPolicy("diffEditorWidget",{createHTML:e=>e});let eV=class e extends Uo{constructor(t,i,n,o,s,r,a,l,d,c,h,u){super(),this._editorProgressService=u,this._onDidDispose=this._register(new $o),this.onDidDispose=this._onDidDispose.event,this._onDidUpdateDiff=this._register(new $o),this.onDidUpdateDiff=this._onDidUpdateDiff.event,this._onDidContentSizeChange=this._register(new $o),this._lastOriginalWarning=null,this._lastModifiedWarning=null,this._editorWorkerService=s,this._codeEditorService=l,this._contextKeyService=this._register(r.createScoped(t)),this._instantiationService=a.createChild(new pF([$y,this._contextKeyService])),this._contextKeyService.createKey("isInDiffEditor",!0),this._themeService=d,this._notificationService=c,this._id=++YB,this._state=0,this._updatingDiffProgress=null,this._domElement=t,i=i||{},this._options=pV(i,{enableSplitViewResizing:!0,renderSideBySide:!0,maxComputationTime:5e3,maxFileSize:50,ignoreTrimWhitespace:!0,renderIndicators:!0,originalEditable:!1,diffCodeLens:!1,renderOverviewRuler:!0,diffWordWrap:"inherit"}),void 0!==i.isInEmbeddedEditor?this._contextKeyService.createKey("isInEmbeddedDiffEditor",i.isInEmbeddedEditor):this._contextKeyService.createKey("isInEmbeddedDiffEditor",!1),this._updateDecorationsRunner=this._register(new lb((()=>this._updateDecorations()),0)),this._containerDomElement=document.createElement("div"),this._containerDomElement.className=e._getClassName(this._themeService.getColorTheme(),this._options.renderSideBySide),this._containerDomElement.style.position="relative",this._containerDomElement.style.height="100%",this._domElement.appendChild(this._containerDomElement),this._overviewViewportDomElement=p_(document.createElement("div")),this._overviewViewportDomElement.setClassName("diffViewport"),this._overviewViewportDomElement.setPosition("absolute"),this._overviewDomElement=document.createElement("div"),this._overviewDomElement.className="diffOverview",this._overviewDomElement.style.position="absolute",this._overviewDomElement.appendChild(this._overviewViewportDomElement.domNode),this._register(sC(this._overviewDomElement,"mousedown",(e=>{this._modifiedEditor.delegateVerticalScrollbarMouseDown(e)}))),this._options.renderOverviewRuler&&this._containerDomElement.appendChild(this._overviewDomElement),this._originalDomNode=document.createElement("div"),this._originalDomNode.className="editor original",this._originalDomNode.style.position="absolute",this._originalDomNode.style.height="100%",this._containerDomElement.appendChild(this._originalDomNode),this._modifiedDomNode=document.createElement("div"),this._modifiedDomNode.className="editor modified",this._modifiedDomNode.style.position="absolute",this._modifiedDomNode.style.height="100%",this._containerDomElement.appendChild(this._modifiedDomNode),this._beginUpdateDecorationsTimeout=-1,this._currentlyChangingViewZones=!1,this._diffComputationToken=0,this._originalEditorState=new ZB(h,o),this._modifiedEditorState=new ZB(h,o),this._isVisible=!0,this._isHandlingScrollEvent=!1,this._elementSizeObserver=this._register(new Wx(this._containerDomElement,i.dimension)),this._register(this._elementSizeObserver.onDidChange((()=>this._onDidContainerSizeChanged()))),i.automaticLayout&&this._elementSizeObserver.startObserving(),this._diffComputationResult=null,this._originalEditor=this._createLeftHandSideEditor(i,n.originalEditor||{}),this._modifiedEditor=this._createRightHandSideEditor(i,n.modifiedEditor||{}),this._originalOverviewRuler=null,this._modifiedOverviewRuler=null,this._reviewPane=a.createInstance(PB,this),this._containerDomElement.appendChild(this._reviewPane.domNode.domNode),this._containerDomElement.appendChild(this._reviewPane.shadow.domNode),this._containerDomElement.appendChild(this._reviewPane.actionBarContainer.domNode),this._options.renderSideBySide?this._setStrategy(new rV(this._createDataSource(),this._options.enableSplitViewResizing)):this._setStrategy(new lV(this._createDataSource(),this._options.enableSplitViewResizing)),this._register(d.onDidColorThemeChange((t=>{this._strategy&&this._strategy.applyColors(t)&&this._updateDecorationsRunner.schedule(),this._containerDomElement.className=e._getClassName(this._themeService.getColorTheme(),this._options.renderSideBySide)})));const g=Tx.getDiffEditorContributions();for(const e of g)try{this._register(a.createInstance(e.ctor,this))}catch(p){Jo(p)}this._codeEditorService.addDiffEditor(this)}_setState(e){this._state!==e&&(this._state=e,this._updatingDiffProgress&&(this._updatingDiffProgress.done(),this._updatingDiffProgress=null),1===this._state&&(this._updatingDiffProgress=this._editorProgressService.show(!0,1e3)))}diffReviewNext(){this._reviewPane.next()}diffReviewPrev(){this._reviewPane.prev()}static _getClassName(e,t){let i="monaco-diff-editor monaco-editor-background ";return t&&(i+="side-by-side "),i+=ix(e.type),i}_recreateOverviewRulers(){this._options.renderOverviewRuler&&(this._originalOverviewRuler&&(this._overviewDomElement.removeChild(this._originalOverviewRuler.getDomNode()),this._originalOverviewRuler.dispose()),this._originalEditor.hasModel()&&(this._originalOverviewRuler=this._originalEditor.createOverviewRuler("original diffOverviewRuler"),this._overviewDomElement.appendChild(this._originalOverviewRuler.getDomNode())),this._modifiedOverviewRuler&&(this._overviewDomElement.removeChild(this._modifiedOverviewRuler.getDomNode()),this._modifiedOverviewRuler.dispose()),this._modifiedEditor.hasModel()&&(this._modifiedOverviewRuler=this._modifiedEditor.createOverviewRuler("modified diffOverviewRuler"),this._overviewDomElement.appendChild(this._modifiedOverviewRuler.getDomNode())),this._layoutOverviewRulers())}_createLeftHandSideEditor(t,i){const n=this._createInnerEditor(this._instantiationService,this._originalDomNode,this._adjustOptionsForLeftHandSide(t),i);this._register(n.onDidScrollChange((e=>{this._isHandlingScrollEvent||(e.scrollTopChanged||e.scrollLeftChanged||e.scrollHeightChanged)&&(this._isHandlingScrollEvent=!0,this._modifiedEditor.setScrollPosition({scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}),this._isHandlingScrollEvent=!1,this._layoutOverviewViewport())}))),this._register(n.onDidChangeViewZones((()=>{this._onViewZonesChanged()}))),this._register(n.onDidChangeConfiguration((e=>{n.getModel()&&(e.hasChanged(44)&&this._updateDecorationsRunner.schedule(),e.hasChanged(132)&&(this._updateDecorationsRunner.cancel(),this._updateDecorations()))}))),this._register(n.onDidChangeHiddenAreas((()=>{this._updateDecorationsRunner.cancel(),this._updateDecorations()}))),this._register(n.onDidChangeModelContent((()=>{this._isVisible&&this._beginUpdateDecorationsSoon()})));const o=this._contextKeyService.createKey("isInDiffLeftEditor",n.hasWidgetFocus());return this._register(n.onDidFocusEditorWidget((()=>o.set(!0)))),this._register(n.onDidBlurEditorWidget((()=>o.set(!1)))),this._register(n.onDidContentSizeChange((t=>{const i=this._originalEditor.getContentWidth()+this._modifiedEditor.getContentWidth()+e.ONE_OVERVIEW_WIDTH,n=Math.max(this._modifiedEditor.getContentHeight(),this._originalEditor.getContentHeight());this._onDidContentSizeChange.fire({contentHeight:n,contentWidth:i,contentHeightChanged:t.contentHeightChanged,contentWidthChanged:t.contentWidthChanged})}))),n}_createRightHandSideEditor(t,i){const n=this._createInnerEditor(this._instantiationService,this._modifiedDomNode,this._adjustOptionsForRightHandSide(t),i);this._register(n.onDidScrollChange((e=>{this._isHandlingScrollEvent||(e.scrollTopChanged||e.scrollLeftChanged||e.scrollHeightChanged)&&(this._isHandlingScrollEvent=!0,this._originalEditor.setScrollPosition({scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}),this._isHandlingScrollEvent=!1,this._layoutOverviewViewport())}))),this._register(n.onDidChangeViewZones((()=>{this._onViewZonesChanged()}))),this._register(n.onDidChangeConfiguration((e=>{n.getModel()&&(e.hasChanged(44)&&this._updateDecorationsRunner.schedule(),e.hasChanged(132)&&(this._updateDecorationsRunner.cancel(),this._updateDecorations()))}))),this._register(n.onDidChangeHiddenAreas((()=>{this._updateDecorationsRunner.cancel(),this._updateDecorations()}))),this._register(n.onDidChangeModelContent((()=>{this._isVisible&&this._beginUpdateDecorationsSoon()}))),this._register(n.onDidChangeModelOptions((e=>{e.tabSize&&this._updateDecorationsRunner.schedule()})));const o=this._contextKeyService.createKey("isInDiffRightEditor",n.hasWidgetFocus());return this._register(n.onDidFocusEditorWidget((()=>o.set(!0)))),this._register(n.onDidBlurEditorWidget((()=>o.set(!1)))),this._register(n.onDidContentSizeChange((t=>{const i=this._originalEditor.getContentWidth()+this._modifiedEditor.getContentWidth()+e.ONE_OVERVIEW_WIDTH,n=Math.max(this._modifiedEditor.getContentHeight(),this._originalEditor.getContentHeight());this._onDidContentSizeChange.fire({contentHeight:n,contentWidth:i,contentHeightChanged:t.contentHeightChanged,contentWidthChanged:t.contentWidthChanged})}))),n}_createInnerEditor(e,t,i,n){return e.createInstance(UF,t,i,n)}dispose(){this._codeEditorService.removeDiffEditor(this),-1!==this._beginUpdateDecorationsTimeout&&(window.clearTimeout(this._beginUpdateDecorationsTimeout),this._beginUpdateDecorationsTimeout=-1),this._cleanViewZonesAndDecorations(),this._originalOverviewRuler&&(this._overviewDomElement.removeChild(this._originalOverviewRuler.getDomNode()),this._originalOverviewRuler.dispose()),this._modifiedOverviewRuler&&(this._overviewDomElement.removeChild(this._modifiedOverviewRuler.getDomNode()),this._modifiedOverviewRuler.dispose()),this._overviewDomElement.removeChild(this._overviewViewportDomElement.domNode),this._options.renderOverviewRuler&&this._containerDomElement.removeChild(this._overviewDomElement),this._containerDomElement.removeChild(this._originalDomNode),this._originalEditor.dispose(),this._containerDomElement.removeChild(this._modifiedDomNode),this._modifiedEditor.dispose(),this._strategy.dispose(),this._containerDomElement.removeChild(this._reviewPane.domNode.domNode),this._containerDomElement.removeChild(this._reviewPane.shadow.domNode),this._containerDomElement.removeChild(this._reviewPane.actionBarContainer.domNode),this._reviewPane.dispose(),this._domElement.removeChild(this._containerDomElement),this._onDidDispose.fire(),super.dispose()}getId(){return this.getEditorType()+":"+this._id}getEditorType(){return M_.IDiffEditor}getLineChanges(){return this._diffComputationResult?this._diffComputationResult.changes:null}getOriginalEditor(){return this._originalEditor}getModifiedEditor(){return this._modifiedEditor}updateOptions(t){const i=pV(t,this._options),n=function(e,t){return{enableSplitViewResizing:e.enableSplitViewResizing!==t.enableSplitViewResizing,renderSideBySide:e.renderSideBySide!==t.renderSideBySide,maxComputationTime:e.maxComputationTime!==t.maxComputationTime,maxFileSize:e.maxFileSize!==t.maxFileSize,ignoreTrimWhitespace:e.ignoreTrimWhitespace!==t.ignoreTrimWhitespace,renderIndicators:e.renderIndicators!==t.renderIndicators,originalEditable:e.originalEditable!==t.originalEditable,diffCodeLens:e.diffCodeLens!==t.diffCodeLens,renderOverviewRuler:e.renderOverviewRuler!==t.renderOverviewRuler,diffWordWrap:e.diffWordWrap!==t.diffWordWrap}}(this._options,i);this._options=i;const o=n.ignoreTrimWhitespace||n.renderIndicators,s=this._isVisible&&(n.maxComputationTime||n.maxFileSize);o?this._beginUpdateDecorations():s&&this._beginUpdateDecorationsSoon(),this._modifiedEditor.updateOptions(this._adjustOptionsForRightHandSide(t)),this._originalEditor.updateOptions(this._adjustOptionsForLeftHandSide(t)),this._strategy.setEnableSplitViewResizing(this._options.enableSplitViewResizing),n.renderSideBySide&&(this._options.renderSideBySide?this._setStrategy(new rV(this._createDataSource(),this._options.enableSplitViewResizing)):this._setStrategy(new lV(this._createDataSource(),this._options.enableSplitViewResizing)),this._containerDomElement.className=e._getClassName(this._themeService.getColorTheme(),this._options.renderSideBySide)),n.renderOverviewRuler&&(this._options.renderOverviewRuler?this._containerDomElement.appendChild(this._overviewDomElement):this._containerDomElement.removeChild(this._overviewDomElement))}getModel(){return{original:this._originalEditor.getModel(),modified:this._modifiedEditor.getModel()}}setModel(e){if(e&&(!e.original||!e.modified))throw new Error(e.original?"DiffEditorWidget.setModel: Modified model is null":"DiffEditorWidget.setModel: Original model is null");this._cleanViewZonesAndDecorations(),this._originalEditor.setModel(e?e.original:null),this._modifiedEditor.setModel(e?e.modified:null),this._updateDecorationsRunner.cancel(),e&&(this._originalEditor.setScrollTop(0),this._modifiedEditor.setScrollTop(0)),this._diffComputationResult=null,this._diffComputationToken++,this._setState(0),e&&(this._recreateOverviewRulers(),this._beginUpdateDecorations()),this._layoutOverviewViewport()}getContainerDomNode(){return this._domElement}getVisibleColumnFromPosition(e){return this._modifiedEditor.getVisibleColumnFromPosition(e)}getPosition(){return this._modifiedEditor.getPosition()}setPosition(e,t="api"){this._modifiedEditor.setPosition(e,t)}revealLine(e,t=0){this._modifiedEditor.revealLine(e,t)}revealLineInCenter(e,t=0){this._modifiedEditor.revealLineInCenter(e,t)}revealLineInCenterIfOutsideViewport(e,t=0){this._modifiedEditor.revealLineInCenterIfOutsideViewport(e,t)}revealLineNearTop(e,t=0){this._modifiedEditor.revealLineNearTop(e,t)}revealPosition(e,t=0){this._modifiedEditor.revealPosition(e,t)}revealPositionInCenter(e,t=0){this._modifiedEditor.revealPositionInCenter(e,t)}revealPositionInCenterIfOutsideViewport(e,t=0){this._modifiedEditor.revealPositionInCenterIfOutsideViewport(e,t)}revealPositionNearTop(e,t=0){this._modifiedEditor.revealPositionNearTop(e,t)}getSelection(){return this._modifiedEditor.getSelection()}getSelections(){return this._modifiedEditor.getSelections()}setSelection(e,t="api"){this._modifiedEditor.setSelection(e,t)}setSelections(e,t="api"){this._modifiedEditor.setSelections(e,t)}revealLines(e,t,i=0){this._modifiedEditor.revealLines(e,t,i)}revealLinesInCenter(e,t,i=0){this._modifiedEditor.revealLinesInCenter(e,t,i)}revealLinesInCenterIfOutsideViewport(e,t,i=0){this._modifiedEditor.revealLinesInCenterIfOutsideViewport(e,t,i)}revealLinesNearTop(e,t,i=0){this._modifiedEditor.revealLinesNearTop(e,t,i)}revealRange(e,t=0,i=!1,n=!0){this._modifiedEditor.revealRange(e,t,i,n)}revealRangeInCenter(e,t=0){this._modifiedEditor.revealRangeInCenter(e,t)}revealRangeInCenterIfOutsideViewport(e,t=0){this._modifiedEditor.revealRangeInCenterIfOutsideViewport(e,t)}revealRangeNearTop(e,t=0){this._modifiedEditor.revealRangeNearTop(e,t)}revealRangeNearTopIfOutsideViewport(e,t=0){this._modifiedEditor.revealRangeNearTopIfOutsideViewport(e,t)}revealRangeAtTop(e,t=0){this._modifiedEditor.revealRangeAtTop(e,t)}getSupportedActions(){return this._modifiedEditor.getSupportedActions()}saveViewState(){return{original:this._originalEditor.saveViewState(),modified:this._modifiedEditor.saveViewState()}}restoreViewState(e){if(e&&e.original&&e.modified){const t=e;this._originalEditor.restoreViewState(t.original),this._modifiedEditor.restoreViewState(t.modified)}}layout(e){this._elementSizeObserver.observe(e)}focus(){this._modifiedEditor.focus()}hasTextFocus(){return this._originalEditor.hasTextFocus()||this._modifiedEditor.hasTextFocus()}trigger(e,t,i){this._modifiedEditor.trigger(e,t,i)}changeDecorations(e){return this._modifiedEditor.changeDecorations(e)}_onDidContainerSizeChanged(){this._doLayout()}_getReviewHeight(){return this._reviewPane.isVisible()?this._elementSizeObserver.getHeight():0}_layoutOverviewRulers(){if(!this._options.renderOverviewRuler)return;if(!this._originalOverviewRuler||!this._modifiedOverviewRuler)return;const t=this._elementSizeObserver.getHeight(),i=this._getReviewHeight(),n=e.ENTIRE_DIFF_OVERVIEW_WIDTH-2*e.ONE_OVERVIEW_WIDTH;this._modifiedEditor.getLayoutInfo()&&(this._originalOverviewRuler.setLayout({top:0,width:e.ONE_OVERVIEW_WIDTH,right:n+e.ONE_OVERVIEW_WIDTH,height:t-i}),this._modifiedOverviewRuler.setLayout({top:0,right:0,width:e.ONE_OVERVIEW_WIDTH,height:t-i}))}_onViewZonesChanged(){this._currentlyChangingViewZones||this._updateDecorationsRunner.schedule()}_beginUpdateDecorationsSoon(){-1!==this._beginUpdateDecorationsTimeout&&(window.clearTimeout(this._beginUpdateDecorationsTimeout),this._beginUpdateDecorationsTimeout=-1),this._beginUpdateDecorationsTimeout=window.setTimeout((()=>this._beginUpdateDecorations()),e.UPDATE_DIFF_DECORATIONS_DELAY)}static _equals(e,t){return!e&&!t||!(!e||!t)&&e.toString()===t.toString()}_beginUpdateDecorations(){this._beginUpdateDecorationsTimeout=-1;const t=this._originalEditor.getModel(),i=this._modifiedEditor.getModel();if(!t||!i)return;this._diffComputationToken++;const n=this._diffComputationToken,o=1024*this._options.maxFileSize*1024,s=e=>{const t=e.getValueLength();return 0===o||t<=o};s(t)&&s(i)?(this._setState(1),this._editorWorkerService.computeDiff(t.uri,i.uri,this._options.ignoreTrimWhitespace,this._options.maxComputationTime).then((e=>{n===this._diffComputationToken&&t===this._originalEditor.getModel()&&i===this._modifiedEditor.getModel()&&(this._setState(2),this._diffComputationResult=e,this._updateDecorationsRunner.schedule(),this._onDidUpdateDiff.fire())}),(e=>{n===this._diffComputationToken&&t===this._originalEditor.getModel()&&i===this._modifiedEditor.getModel()&&(this._setState(2),this._diffComputationResult=null,this._updateDecorationsRunner.schedule())}))):e._equals(t.uri,this._lastOriginalWarning)&&e._equals(i.uri,this._lastModifiedWarning)||(this._lastOriginalWarning=t.uri,this._lastModifiedWarning=i.uri,this._notificationService.warn(mf(0,"Cannot compare files because one file is too large.")))}_cleanViewZonesAndDecorations(){this._originalEditorState.clean(this._originalEditor),this._modifiedEditorState.clean(this._modifiedEditor)}_updateDecorations(){if(!this._originalEditor.getModel()||!this._modifiedEditor.getModel())return;const e=this._diffComputationResult?this._diffComputationResult.changes:[],t=this._originalEditorState.getForeignViewZones(this._originalEditor.getWhitespaces()),i=this._modifiedEditorState.getForeignViewZones(this._modifiedEditor.getWhitespaces()),n=this._strategy.getEditorsDiffDecorations(e,this._options.ignoreTrimWhitespace,this._options.renderIndicators,t,i);try{this._currentlyChangingViewZones=!0,this._originalEditorState.apply(this._originalEditor,this._originalOverviewRuler,n.original,!1),this._modifiedEditorState.apply(this._modifiedEditor,this._modifiedOverviewRuler,n.modified,!0)}finally{this._currentlyChangingViewZones=!1}}_adjustOptionsForSubEditor(e){const t=Object.assign({},e);return t.inDiffEditor=!0,t.automaticLayout=!1,t.scrollbar=Object.assign({},t.scrollbar||{}),t.scrollbar.vertical="visible",t.folding=!1,t.codeLens=this._options.diffCodeLens,t.fixedOverflowWidgets=!0,t.minimap=Object.assign({},t.minimap||{}),t.minimap.enabled=!1,t}_adjustOptionsForLeftHandSide(e){const t=this._adjustOptionsForSubEditor(e);return this._options.renderSideBySide?t.wordWrapOverride1=this._options.diffWordWrap:(t.wordWrapOverride1="off",t.wordWrapOverride2="off"),e.originalAriaLabel&&(t.ariaLabel=e.originalAriaLabel),t.readOnly=!this._options.originalEditable,t.extraEditorClassName="original-in-monaco-diff-editor",Object.assign(Object.assign({},t),{dimension:{height:0,width:0}})}_adjustOptionsForRightHandSide(t){const i=this._adjustOptionsForSubEditor(t);return t.modifiedAriaLabel&&(i.ariaLabel=t.modifiedAriaLabel),i.wordWrapOverride1=this._options.diffWordWrap,i.revealHorizontalRightPadding=Xf.revealHorizontalRightPadding.defaultValue+e.ENTIRE_DIFF_OVERVIEW_WIDTH,i.scrollbar.verticalHasArrows=!1,i.extraEditorClassName="modified-in-monaco-diff-editor",Object.assign(Object.assign({},i),{dimension:{height:0,width:0}})}doLayout(){this._elementSizeObserver.observe(),this._doLayout()}_doLayout(){const t=this._elementSizeObserver.getWidth(),i=this._elementSizeObserver.getHeight(),n=this._getReviewHeight(),o=this._strategy.layout();this._originalDomNode.style.width=o+"px",this._originalDomNode.style.left="0px",this._modifiedDomNode.style.width=t-o+"px",this._modifiedDomNode.style.left=o+"px",this._overviewDomElement.style.top="0px",this._overviewDomElement.style.height=i-n+"px",this._overviewDomElement.style.width=e.ENTIRE_DIFF_OVERVIEW_WIDTH+"px",this._overviewDomElement.style.left=t-e.ENTIRE_DIFF_OVERVIEW_WIDTH+"px",this._overviewViewportDomElement.setWidth(e.ENTIRE_DIFF_OVERVIEW_WIDTH),this._overviewViewportDomElement.setHeight(30),this._originalEditor.layout({width:o,height:i-n}),this._modifiedEditor.layout({width:t-o-(this._options.renderOverviewRuler?e.ENTIRE_DIFF_OVERVIEW_WIDTH:0),height:i-n}),(this._originalOverviewRuler||this._modifiedOverviewRuler)&&this._layoutOverviewRulers(),this._reviewPane.layout(i-n,t,n),this._layoutOverviewViewport()}_layoutOverviewViewport(){const e=this._computeOverviewViewport();e?(this._overviewViewportDomElement.setTop(e.top),this._overviewViewportDomElement.setHeight(e.height)):(this._overviewViewportDomElement.setTop(0),this._overviewViewportDomElement.setHeight(0))}_computeOverviewViewport(){const e=this._modifiedEditor.getLayoutInfo();if(!e)return null;const t=this._modifiedEditor.getScrollTop(),i=this._modifiedEditor.getScrollHeight(),n=Math.max(0,e.height),o=Math.max(0,n-0),s=i>0?o/i:0;return{height:Math.max(0,Math.floor(e.height*s)),top:Math.floor(t*s)}}_createDataSource(){return{getWidth:()=>this._elementSizeObserver.getWidth(),getHeight:()=>this._elementSizeObserver.getHeight()-this._getReviewHeight(),getOptions:()=>({renderOverviewRuler:this._options.renderOverviewRuler}),getContainerDomNode:()=>this._containerDomElement,relayoutEditors:()=>{this._doLayout()},getOriginalEditor:()=>this._originalEditor,getModifiedEditor:()=>this._modifiedEditor}}_setStrategy(e){this._strategy&&this._strategy.dispose(),this._strategy=e,e.applyColors(this._themeService.getColorTheme()),this._diffComputationResult&&this._updateDecorations(),this._doLayout()}_getLineChangeAtOrBeforeLineNumber(e,t){const i=this._diffComputationResult?this._diffComputationResult.changes:[];if(0===i.length||e<t(i[0]))return null;let n=0,o=i.length-1;for(;n<o;){const s=Math.floor((n+o)/2),r=t(i[s]),a=s+1<=o?t(i[s+1]):1073741824;e<r?o=s-1:e>=a?n=s+1:(n=s,o=s)}return i[n]}_getEquivalentLineForOriginalLineNumber(e){const t=this._getLineChangeAtOrBeforeLineNumber(e,(e=>e.originalStartLineNumber));if(!t)return e;const i=t.originalStartLineNumber+(t.originalEndLineNumber>0?-1:0),n=t.modifiedStartLineNumber+(t.modifiedEndLineNumber>0?-1:0),o=t.originalEndLineNumber>0?t.originalEndLineNumber-t.originalStartLineNumber+1:0,s=t.modifiedEndLineNumber>0?t.modifiedEndLineNumber-t.modifiedStartLineNumber+1:0,r=e-i;return r<=o?n+Math.min(r,s):n+s-o+r}_getEquivalentLineForModifiedLineNumber(e){const t=this._getLineChangeAtOrBeforeLineNumber(e,(e=>e.modifiedStartLineNumber));if(!t)return e;const i=t.originalStartLineNumber+(t.originalEndLineNumber>0?-1:0),n=t.modifiedStartLineNumber+(t.modifiedEndLineNumber>0?-1:0),o=t.originalEndLineNumber>0?t.originalEndLineNumber-t.originalStartLineNumber+1:0,s=t.modifiedEndLineNumber>0?t.modifiedEndLineNumber-t.modifiedStartLineNumber+1:0,r=e-n;return r<=s?i+Math.min(r,o):i+o-s+r}getDiffLineInformationForOriginal(e){return this._diffComputationResult?{equivalentLineNumber:this._getEquivalentLineForOriginalLineNumber(e)}:null}getDiffLineInformationForModified(e){return this._diffComputationResult?{equivalentLineNumber:this._getEquivalentLineForModifiedLineNumber(e)}:null}};eV.ONE_OVERVIEW_WIDTH=15,eV.ENTIRE_DIFF_OVERVIEW_WIDTH=30,eV.UPDATE_DIFF_DECORATIONS_DELAY=200,eV=qB([GB(3,jB),GB(4,BB),GB(5,$y),GB(6,k_),GB(7,N_),GB(8,Qy),GB(9,vF),GB(10,WB),GB(11,$B)],eV);class tV extends Uo{constructor(e){super(),this._dataSource=e,this._insertColor=null,this._removeColor=null}applyColors(e){const t=e.getColor(lD)||(e.getColor(iD)||eD).transparent(2),i=e.getColor(dD)||(e.getColor(nD)||tD).transparent(2),n=!t.equals(this._insertColor)||!i.equals(this._removeColor);return this._insertColor=t,this._removeColor=i,n}getEditorsDiffDecorations(e,t,i,n,o){o=o.sort(((e,t)=>e.afterLineNumber-t.afterLineNumber)),n=n.sort(((e,t)=>e.afterLineNumber-t.afterLineNumber));const s=this._getViewZones(e,n,o,i),r=this._getOriginalEditorDecorations(s,e,t,i),a=this._getModifiedEditorDecorations(s,e,t,i);return{original:{decorations:r.decorations,overviewZones:r.overviewZones,zones:s.original},modified:{decorations:a.decorations,overviewZones:a.overviewZones,zones:s.modified}}}}class iV{constructor(e){this._source=e,this._index=-1,this.current=null,this.advance()}advance(){this._index++,this._index<this._source.length?this.current=this._source[this._index]:this.current=null}}class nV{constructor(e,t,i,n,o){this._lineChanges=e,this._originalForeignVZ=t,this._modifiedForeignVZ=i,this._originalEditor=n,this._modifiedEditor=o}static _getViewLineCount(e,t,i){const n=e.getModel(),o=e._getViewModel();if(n&&o){const e=gV(n,o,t,i);return e.endLineNumber-e.startLineNumber+1}return i-t+1}getViewZones(){const e=this._originalEditor.getOption(59),t=this._modifiedEditor.getOption(59),i=-1!==this._originalEditor.getOption(132).wrappingColumn,n=-1!==this._modifiedEditor.getOption(132).wrappingColumn,o=i||n,s=this._originalEditor.getModel(),r=this._originalEditor._getViewModel().coordinatesConverter,a=this._modifiedEditor._getViewModel().coordinatesConverter,l=[],d=[];let c=0,h=0,u=0,g=0,p=0,m=0;const f=(e,t)=>e.afterLineNumber-t.afterLineNumber,_=(e,t)=>{if(null===t.domNode&&e.length>0){const i=e[e.length-1];if(i.afterLineNumber===t.afterLineNumber&&null===i.domNode)return void(i.heightInLines+=t.heightInLines)}e.push(t)},v=new iV(this._modifiedForeignVZ),b=new iV(this._originalForeignVZ);let w=1,C=1;for(let y=0,x=this._lineChanges.length;y<=x;y++){const i=y<x?this._lineChanges[y]:null;null!==i?(u=i.originalStartLineNumber+(i.originalEndLineNumber>0?-1:0),g=i.modifiedStartLineNumber+(i.modifiedEndLineNumber>0?-1:0),h=i.originalEndLineNumber>0?nV._getViewLineCount(this._originalEditor,i.originalStartLineNumber,i.originalEndLineNumber):0,c=i.modifiedEndLineNumber>0?nV._getViewLineCount(this._modifiedEditor,i.modifiedStartLineNumber,i.modifiedEndLineNumber):0,p=Math.max(i.originalStartLineNumber,i.originalEndLineNumber),m=Math.max(i.modifiedStartLineNumber,i.modifiedEndLineNumber)):(u+=1e7+h,g+=1e7+c,p=u,m=g);let n=[],S=[];if(o){let e;e=i?i.originalEndLineNumber>0?i.originalStartLineNumber-w:i.modifiedStartLineNumber-C:s.getLineCount()-w+1;for(let t=0;t<e;t++){const e=w+t,i=C+t,o=r.getModelLineViewLineCount(e),s=a.getModelLineViewLineCount(i);o<s?n.push({afterLineNumber:e,heightInLines:s-o,domNode:null,marginDomNode:null}):o>s&&S.push({afterLineNumber:i,heightInLines:o-s,domNode:null,marginDomNode:null})}i&&(w=(i.originalEndLineNumber>0?i.originalEndLineNumber:i.originalStartLineNumber)+1,C=(i.modifiedEndLineNumber>0?i.modifiedEndLineNumber:i.modifiedStartLineNumber)+1)}for(;v.current&&v.current.afterLineNumber<=m;){let e;e=v.current.afterLineNumber<=g?u-g+v.current.afterLineNumber:p;let o=null;i&&i.modifiedStartLineNumber<=v.current.afterLineNumber&&v.current.afterLineNumber<=i.modifiedEndLineNumber&&(o=this._createOriginalMarginDomNodeForModifiedForeignViewZoneInAddedRegion()),n.push({afterLineNumber:e,heightInLines:v.current.height/t,domNode:null,marginDomNode:o}),v.advance()}for(;b.current&&b.current.afterLineNumber<=p;){let t;t=b.current.afterLineNumber<=u?g-u+b.current.afterLineNumber:m,S.push({afterLineNumber:t,heightInLines:b.current.height/e,domNode:null}),b.advance()}if(null!==i&&cV(i)){const e=this._produceOriginalFromDiff(i,h,c);e&&n.push(e)}if(null!==i&&hV(i)){const e=this._produceModifiedFromDiff(i,h,c);e&&S.push(e)}let k=0,D=0;for(n=n.sort(f),S=S.sort(f);k<n.length&&D<S.length;){const e=n[k],t=S[D],i=e.afterLineNumber-u,o=t.afterLineNumber-g;i<o?(_(l,e),k++):o<i?(_(d,t),D++):e.shouldNotShrink?(_(l,e),k++):t.shouldNotShrink?(_(d,t),D++):e.heightInLines>=t.heightInLines?(e.heightInLines-=t.heightInLines,D++):(t.heightInLines-=e.heightInLines,k++)}for(;k<n.length;)_(l,n[k]),k++;for(;D<S.length;)_(d,S[D]),D++}return{original:nV._ensureDomNodes(l),modified:nV._ensureDomNodes(d)}}static _ensureDomNodes(e){return e.map((e=>(e.domNode||(e.domNode=uV()),e)))}}function oV(e,t,i,n,o){return{range:new qo(e,t,i,n),options:o}}const sV={charDelete:GP.register({description:"diff-editor-char-delete",className:"char-delete"}),charDeleteWholeLine:GP.register({description:"diff-editor-char-delete-whole-line",className:"char-delete",isWholeLine:!0}),charInsert:GP.register({description:"diff-editor-char-insert",className:"char-insert"}),charInsertWholeLine:GP.register({description:"diff-editor-char-insert-whole-line",className:"char-insert",isWholeLine:!0}),lineInsert:GP.register({description:"diff-editor-line-insert",className:"line-insert",marginClassName:"gutter-insert",isWholeLine:!0}),lineInsertWithSign:GP.register({description:"diff-editor-line-insert-with-sign",className:"line-insert",linesDecorationsClassName:"insert-sign "+ex.asClassName(XB),marginClassName:"gutter-insert",isWholeLine:!0}),lineDelete:GP.register({description:"diff-editor-line-delete",className:"line-delete",marginClassName:"gutter-delete",isWholeLine:!0}),lineDeleteWithSign:GP.register({description:"diff-editor-line-delete-with-sign",className:"line-delete",linesDecorationsClassName:"delete-sign "+ex.asClassName(QB),marginClassName:"gutter-delete",isWholeLine:!0}),lineDeleteMargin:GP.register({description:"diff-editor-line-delete-margin",marginClassName:"gutter-delete"})};class rV extends tV{constructor(e,t){super(e),this._disableSash=!1===t,this._sashRatio=null,this._sashPosition=null,this._startSashPosition=null,this._sash=this._register(new cB(this._dataSource.getContainerDomNode(),this,{orientation:0})),this._disableSash&&(this._sash.state=0),this._sash.onDidStart((()=>this._onSashDragStart())),this._sash.onDidChange((e=>this._onSashDrag(e))),this._sash.onDidEnd((()=>this._onSashDragEnd())),this._sash.onDidReset((()=>this._onSashReset()))}setEnableSplitViewResizing(e){const t=!1===e;this._disableSash!==t&&(this._disableSash=t,this._sash.state=this._disableSash?0:3)}layout(e=this._sashRatio){const t=this._dataSource.getWidth()-(this._dataSource.getOptions().renderOverviewRuler?eV.ENTIRE_DIFF_OVERVIEW_WIDTH:0);let i=Math.floor((e||.5)*t);const n=Math.floor(.5*t);return i=this._disableSash?n:i||n,t>2*rV.MINIMUM_EDITOR_WIDTH?(i<rV.MINIMUM_EDITOR_WIDTH&&(i=rV.MINIMUM_EDITOR_WIDTH),i>t-rV.MINIMUM_EDITOR_WIDTH&&(i=t-rV.MINIMUM_EDITOR_WIDTH)):i=n,this._sashPosition!==i&&(this._sashPosition=i),this._sash.layout(),this._sashPosition}_onSashDragStart(){this._startSashPosition=this._sashPosition}_onSashDrag(e){const t=this._dataSource.getWidth()-(this._dataSource.getOptions().renderOverviewRuler?eV.ENTIRE_DIFF_OVERVIEW_WIDTH:0),i=this.layout((this._startSashPosition+(e.currentX-e.startX))/t);this._sashRatio=i/t,this._dataSource.relayoutEditors()}_onSashDragEnd(){this._sash.layout()}_onSashReset(){this._sashRatio=.5,this._dataSource.relayoutEditors(),this._sash.layout()}getVerticalSashTop(e){return 0}getVerticalSashLeft(e){return this._sashPosition}getVerticalSashHeight(e){return this._dataSource.getHeight()}_getViewZones(e,t,i){const n=this._dataSource.getOriginalEditor(),o=this._dataSource.getModifiedEditor();return new aV(e,t,i,n,o).getViewZones()}_getOriginalEditorDecorations(e,t,i,n){const o=this._dataSource.getOriginalEditor(),s=String(this._removeColor),r={decorations:[],overviewZones:[]},a=o.getModel(),l=o._getViewModel();for(const d of t)if(hV(d)){r.decorations.push({range:new qo(d.originalStartLineNumber,1,d.originalEndLineNumber,1073741824),options:n?sV.lineDeleteWithSign:sV.lineDelete}),cV(d)&&d.charChanges||r.decorations.push(oV(d.originalStartLineNumber,1,d.originalEndLineNumber,1073741824,sV.charDeleteWholeLine));const e=gV(a,l,d.originalStartLineNumber,d.originalEndLineNumber);if(r.overviewZones.push(new iM(e.startLineNumber,e.endLineNumber,0,s)),d.charChanges)for(const t of d.charChanges)if(hV(t))if(i)for(let e=t.originalStartLineNumber;e<=t.originalEndLineNumber;e++){let i,n;i=e===t.originalStartLineNumber?t.originalStartColumn:a.getLineFirstNonWhitespaceColumn(e),n=e===t.originalEndLineNumber?t.originalEndColumn:a.getLineLastNonWhitespaceColumn(e),r.decorations.push(oV(e,i,e,n,sV.charDelete))}else r.decorations.push(oV(t.originalStartLineNumber,t.originalStartColumn,t.originalEndLineNumber,t.originalEndColumn,sV.charDelete))}return r}_getModifiedEditorDecorations(e,t,i,n){const o=this._dataSource.getModifiedEditor(),s=String(this._insertColor),r={decorations:[],overviewZones:[]},a=o.getModel(),l=o._getViewModel();for(const d of t)if(cV(d)){r.decorations.push({range:new qo(d.modifiedStartLineNumber,1,d.modifiedEndLineNumber,1073741824),options:n?sV.lineInsertWithSign:sV.lineInsert}),hV(d)&&d.charChanges||r.decorations.push(oV(d.modifiedStartLineNumber,1,d.modifiedEndLineNumber,1073741824,sV.charInsertWholeLine));const e=gV(a,l,d.modifiedStartLineNumber,d.modifiedEndLineNumber);if(r.overviewZones.push(new iM(e.startLineNumber,e.endLineNumber,0,s)),d.charChanges)for(const t of d.charChanges)if(cV(t))if(i)for(let e=t.modifiedStartLineNumber;e<=t.modifiedEndLineNumber;e++){let i,n;i=e===t.modifiedStartLineNumber?t.modifiedStartColumn:a.getLineFirstNonWhitespaceColumn(e),n=e===t.modifiedEndLineNumber?t.modifiedEndColumn:a.getLineLastNonWhitespaceColumn(e),r.decorations.push(oV(e,i,e,n,sV.charInsert))}else r.decorations.push(oV(t.modifiedStartLineNumber,t.modifiedStartColumn,t.modifiedEndLineNumber,t.modifiedEndColumn,sV.charInsert))}return r}}rV.MINIMUM_EDITOR_WIDTH=100;class aV extends nV{constructor(e,t,i,n,o){super(e,t,i,n,o)}_createOriginalMarginDomNodeForModifiedForeignViewZoneInAddedRegion(){return null}_produceOriginalFromDiff(e,t,i){return i>t?{afterLineNumber:Math.max(e.originalStartLineNumber,e.originalEndLineNumber),heightInLines:i-t,domNode:null}:null}_produceModifiedFromDiff(e,t,i){return t>i?{afterLineNumber:Math.max(e.modifiedStartLineNumber,e.modifiedEndLineNumber),heightInLines:t-i,domNode:null}:null}}class lV extends tV{constructor(e,t){super(e),this._decorationsLeft=e.getOriginalEditor().getLayoutInfo().decorationsLeft,this._register(e.getOriginalEditor().onDidLayoutChange((t=>{this._decorationsLeft!==t.decorationsLeft&&(this._decorationsLeft=t.decorationsLeft,e.relayoutEditors())})))}setEnableSplitViewResizing(e){}_getViewZones(e,t,i,n){const o=this._dataSource.getOriginalEditor(),s=this._dataSource.getModifiedEditor();return new dV(e,t,i,o,s,n).getViewZones()}_getOriginalEditorDecorations(e,t,i,n){const o=String(this._removeColor),s={decorations:[],overviewZones:[]},r=this._dataSource.getOriginalEditor(),a=r.getModel(),l=r._getViewModel();let d=0;for(const c of t)if(hV(c)){for(s.decorations.push({range:new qo(c.originalStartLineNumber,1,c.originalEndLineNumber,1073741824),options:sV.lineDeleteMargin});d<e.modified.length;){const t=e.modified[d];if(t.diff&&t.diff.originalStartLineNumber>=c.originalStartLineNumber)break;d++}let t=0;if(d<e.modified.length){const i=e.modified[d];i.diff&&i.diff.originalStartLineNumber===c.originalStartLineNumber&&i.diff.originalEndLineNumber===c.originalEndLineNumber&&i.diff.modifiedStartLineNumber===c.modifiedStartLineNumber&&i.diff.modifiedEndLineNumber===c.modifiedEndLineNumber&&(t=i.heightInLines)}const i=gV(a,l,c.originalStartLineNumber,c.originalEndLineNumber);s.overviewZones.push(new iM(i.startLineNumber,i.endLineNumber,t,o))}return s}_getModifiedEditorDecorations(e,t,i,n){const o=this._dataSource.getModifiedEditor(),s=String(this._insertColor),r={decorations:[],overviewZones:[]},a=o.getModel(),l=o._getViewModel();for(const d of t)if(cV(d)){r.decorations.push({range:new qo(d.modifiedStartLineNumber,1,d.modifiedEndLineNumber,1073741824),options:n?sV.lineInsertWithSign:sV.lineInsert});const e=gV(a,l,d.modifiedStartLineNumber,d.modifiedEndLineNumber);if(r.overviewZones.push(new iM(e.startLineNumber,e.endLineNumber,0,s)),d.charChanges){for(const t of d.charChanges)if(cV(t))if(i)for(let e=t.modifiedStartLineNumber;e<=t.modifiedEndLineNumber;e++){let i,n;i=e===t.modifiedStartLineNumber?t.modifiedStartColumn:a.getLineFirstNonWhitespaceColumn(e),n=e===t.modifiedEndLineNumber?t.modifiedEndColumn:a.getLineLastNonWhitespaceColumn(e),r.decorations.push(oV(e,i,e,n,sV.charInsert))}else r.decorations.push(oV(t.modifiedStartLineNumber,t.modifiedStartColumn,t.modifiedEndLineNumber,t.modifiedEndColumn,sV.charInsert))}else r.decorations.push(oV(d.modifiedStartLineNumber,1,d.modifiedEndLineNumber,1073741824,sV.charInsertWholeLine))}return r}layout(){return Math.max(5,this._decorationsLeft)}}class dV extends nV{constructor(e,t,i,n,o,s){super(e,t,i,n,o),this._originalModel=n.getModel(),this._renderIndicators=s,this._pendingLineChange=[],this._pendingViewZones=[],this._lineBreaksComputer=this._modifiedEditor._getViewModel().createLineBreaksComputer()}getViewZones(){const e=super.getViewZones();return this._finalize(e),e}_createOriginalMarginDomNodeForModifiedForeignViewZoneInAddedRegion(){const e=document.createElement("div");return e.className="inline-added-margin-view-zone",e}_produceOriginalFromDiff(e,t,i){const n=document.createElement("div");return n.className="inline-added-margin-view-zone",{afterLineNumber:Math.max(e.originalStartLineNumber,e.originalEndLineNumber),heightInLines:i,domNode:document.createElement("div"),marginDomNode:n}}_produceModifiedFromDiff(e,t,i){const n=document.createElement("div");n.className="view-lines line-delete monaco-mouse-cursor-text";const o=document.createElement("div");o.className="inline-deleted-margin-view-zone";const s={shouldNotShrink:!0,afterLineNumber:0===e.modifiedEndLineNumber?e.modifiedStartLineNumber:e.modifiedStartLineNumber-1,heightInLines:t,minWidthInPx:0,domNode:n,marginDomNode:o,diff:{originalStartLineNumber:e.originalStartLineNumber,originalEndLineNumber:e.originalEndLineNumber,modifiedStartLineNumber:e.modifiedStartLineNumber,modifiedEndLineNumber:e.modifiedEndLineNumber,originalModel:this._originalModel,viewLineCounts:null}};for(let r=e.originalStartLineNumber;r<=e.originalEndLineNumber;r++)this._lineBreaksComputer.addRequest(this._originalModel.getLineContent(r),null,null);return this._pendingLineChange.push(e),this._pendingViewZones.push(s),s}_finalize(e){const t=this._modifiedEditor.getOptions(),i=this._modifiedEditor.getModel().getOptions().tabSize,n=t.get(44),o=t.get(29),s=n.typicalHalfwidthCharacterWidth,r=t.get(93),a=this._originalModel.mightContainNonBasicASCII(),l=this._originalModel.mightContainRTL(),d=t.get(59),c=t.get(131).decorationsWidth,h=t.get(105),u=t.get(88),g=t.get(83),p=t.get(45),m=this._lineBreaksComputer.finalize();let f=0;for(let _=0;_<this._pendingLineChange.length;_++){const t=this._pendingLineChange[_],v=this._pendingViewZones[_],b=v.domNode;m_(b,n);const w=v.marginDomNode;m_(w,n);const C=[];if(t.charChanges)for(const e of t.charChanges)hV(e)&&C.push(new lw(new qo(e.originalStartLineNumber,e.originalStartColumn,e.originalEndLineNumber,e.originalEndColumn),"char-delete",0));const y=C.length>0,x=nv(1e4);let S=0,k=0,D=null;for(let s=t.originalStartLineNumber;s<=t.originalEndLineNumber;s++){const r=s-t.originalStartLineNumber,_=this._originalModel.getLineTokens(s),b=_.getLineContent(),L=m[f++],N=jb.filter(C,s,1,b.length+1);if(L){let t=0;for(const e of L.breakOffsets){const s=_.sliceAndInflate(t,e,0),r=b.substring(t,e);S=Math.max(S,this._renderOriginalLine(k++,r,s,jb.extractWrapped(N,t,e),y,a,l,n,o,d,c,h,u,g,p,i,x,w)),t=e}for(D||(D=[]);D.length<r;)D[D.length]=1;D[r]=L.breakOffsets.length,v.heightInLines+=L.breakOffsets.length-1;const m=document.createElement("div");m.className="gutter-delete",e.original.push({afterLineNumber:s,afterColumn:0,heightInLines:L.breakOffsets.length-1,domNode:uV(),marginDomNode:m})}else S=Math.max(S,this._renderOriginalLine(k++,b,_,N,y,a,l,n,o,d,c,h,u,g,p,i,x,w))}S+=r;const L=x.build(),N=JB?JB.createHTML(L):L;if(b.innerHTML=N,v.minWidthInPx=S*s,D){const e=t.originalEndLineNumber-t.originalStartLineNumber;for(;D.length<=e;)D[D.length]=1}v.diff.viewLineCounts=D}e.original.sort(((e,t)=>e.afterLineNumber-t.afterLineNumber))}_renderOriginalLine(e,t,i,n,o,s,r,a,l,d,c,h,u,g,p,m,f,_){f.appendASCIIString('<div class="view-line'),o||f.appendASCIIString(" char-delete"),f.appendASCIIString('" style="top:'),f.appendASCIIString(String(e*d)),f.appendASCIIString('px;width:1000000px;">');const v=aw.isBasicASCII(t,s),b=aw.containsRTL(t,v,r),w=Qb(new Gb(a.isMonospace&&!l,a.canUseHalfwidthRightwardsArrow,t,!1,v,b,0,i,n,m,0,a.spaceWidth,a.middotWidth,a.wsmiddotWidth,h,u,g,p!==Of.OFF,null),f);if(f.appendASCIIString("</div>"),this._renderIndicators){const t=document.createElement("div");t.className=`delete-sign ${ex.asClassName(QB)}`,t.setAttribute("style",`position:absolute;top:${e*d}px;width:${c}px;height:${d}px;right:0;`),_.appendChild(t)}return w.characterMapping.getAbsoluteOffset(w.characterMapping.length)}}function cV(e){return e.modifiedEndLineNumber>0}function hV(e){return e.originalEndLineNumber>0}function uV(){const e=document.createElement("div");return e.className="diagonal-fill",e}function gV(e,t,i,n){const o=e.getLineCount();return i=Math.min(o,Math.max(1,i)),n=Math.min(o,Math.max(1,n)),t.coordinatesConverter.convertModelRangeToViewRange(new qo(i,e.getLineMinColumn(i),n,e.getLineMaxColumn(n)))}function pV(e,t){return{enableSplitViewResizing:Sf(e.enableSplitViewResizing,t.enableSplitViewResizing),renderSideBySide:Sf(e.renderSideBySide,t.renderSideBySide),maxComputationTime:Df(e.maxComputationTime,t.maxComputationTime,0,1073741824),maxFileSize:Df(e.maxFileSize,t.maxFileSize,0,1073741824),ignoreTrimWhitespace:Sf(e.ignoreTrimWhitespace,t.ignoreTrimWhitespace),renderIndicators:Sf(e.renderIndicators,t.renderIndicators),originalEditable:Sf(e.originalEditable,t.originalEditable),diffCodeLens:Sf(e.diffCodeLens,t.diffCodeLens),renderOverviewRuler:Sf(e.renderOverviewRuler,t.renderOverviewRuler),diffWordWrap:(i=e.diffWordWrap,n=t.diffWordWrap,If(i,n,["off","on","inherit"]))};var i,n}sx(((e,t)=>{const i=e.getColor(iD);i&&t.addRule(`.monaco-editor .char-insert, .monaco-diff-editor .char-insert { background-color: ${i}; }`);const n=e.getColor(oD)||i;n&&t.addRule(`.monaco-editor .line-insert, .monaco-diff-editor .line-insert { background-color: ${n}; }`);const o=e.getColor(rD)||n;o&&(t.addRule(`.monaco-editor .inline-added-margin-view-zone { background-color: ${o}; }`),t.addRule(`.monaco-editor .gutter-insert, .monaco-diff-editor .gutter-insert { background-color: ${o}; }`));const s=e.getColor(nD);s&&t.addRule(`.monaco-editor .char-delete, .monaco-diff-editor .char-delete { background-color: ${s}; }`);const r=e.getColor(sD)||s;r&&t.addRule(`.monaco-editor .line-delete, .monaco-diff-editor .line-delete { background-color: ${r}; }`);const a=e.getColor(aD)||r;a&&(t.addRule(`.monaco-editor .inline-deleted-margin-view-zone { background-color: ${a}; }`),t.addRule(`.monaco-editor .gutter-delete, .monaco-diff-editor .gutter-delete { background-color: ${a}; }`));const l=e.getColor(cD);l&&t.addRule(`.monaco-editor .line-insert, .monaco-editor .char-insert { border: 1px ${"hc"===e.type?"dashed":"solid"} ${l}; }`);const d=e.getColor(hD);d&&t.addRule(`.monaco-editor .line-delete, .monaco-editor .char-delete { border: 1px ${"hc"===e.type?"dashed":"solid"} ${d}; }`);const c=e.getColor(QS);c&&t.addRule(`.monaco-diff-editor.side-by-side .editor.modified { box-shadow: -6px 0 5px -5px ${c}; }`);const h=e.getColor(uD);h&&t.addRule(`.monaco-diff-editor.side-by-side .editor.modified { border-left: 1px solid ${h}; }`);const u=e.getColor(JS);u&&t.addRule(`\n\t\t\t.monaco-diff-editor .diffViewport {\n\t\t\t\tbackground: ${u};\n\t\t\t}\n\t\t`);const g=e.getColor(ek);g&&t.addRule(`\n\t\t\t.monaco-diff-editor .diffViewport:hover {\n\t\t\t\tbackground: ${g};\n\t\t\t}\n\t\t`);const p=e.getColor(tk);p&&t.addRule(`\n\t\t\t.monaco-diff-editor .diffViewport:active {\n\t\t\t\tbackground: ${p};\n\t\t\t}\n\t\t`);const m=e.getColor(gD);t.addRule(`\n\t.monaco-editor .diagonal-fill {\n\t\tbackground-image: linear-gradient(\n\t\t\t-45deg,\n\t\t\t${m} 12.5%,\n\t\t\t#0000 12.5%, #0000 50%,\n\t\t\t${m} 50%, ${m} 62.5%,\n\t\t\t#0000 62.5%, #0000 100%\n\t\t);\n\t\tbackground-size: 8px 8px;\n\t}\n\t`)}));var mV=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},fV=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};let _V=class extends Uo{constructor(e){super(),this._themeService=e,this._onCodeEditorAdd=this._register(new $o),this.onCodeEditorAdd=this._onCodeEditorAdd.event,this._onCodeEditorRemove=this._register(new $o),this.onCodeEditorRemove=this._onCodeEditorRemove.event,this._onDiffEditorAdd=this._register(new $o),this.onDiffEditorAdd=this._onDiffEditorAdd.event,this._onDiffEditorRemove=this._register(new $o),this.onDiffEditorRemove=this._onDiffEditorRemove.event,this._decorationOptionProviders=new Map,this._modelProperties=new Map,this._codeEditors=Object.create(null),this._diffEditors=Object.create(null),this._globalStyleSheet=null}addCodeEditor(e){this._codeEditors[e.getId()]=e,this._onCodeEditorAdd.fire(e)}removeCodeEditor(e){delete this._codeEditors[e.getId()]&&this._onCodeEditorRemove.fire(e)}listCodeEditors(){return Object.keys(this._codeEditors).map((e=>this._codeEditors[e]))}addDiffEditor(e){this._diffEditors[e.getId()]=e,this._onDiffEditorAdd.fire(e)}removeDiffEditor(e){delete this._diffEditors[e.getId()]&&this._onDiffEditorRemove.fire(e)}listDiffEditors(){return Object.keys(this._diffEditors).map((e=>this._diffEditors[e]))}getFocusedCodeEditor(){let e=null;const t=this.listCodeEditors();for(const i of t){if(i.hasTextFocus())return i;i.hasWidgetFocus()&&(e=i)}return e}removeDecorationType(e){const t=this._decorationOptionProviders.get(e);t&&(t.refCount--,t.refCount<=0&&(this._decorationOptionProviders.delete(e),t.dispose(),this.listCodeEditors().forEach((t=>t.removeDecorations(e)))))}setModelProperty(e,t,i){const n=e.toString();let o;this._modelProperties.has(n)?o=this._modelProperties.get(n):(o=new Map,this._modelProperties.set(n,o)),o.set(t,i)}getModelProperty(e,t){const i=e.toString();if(this._modelProperties.has(i)){return this._modelProperties.get(i).get(t)}}};_V=mV([fV(0,Qy)],_V);var vV=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},bV=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};let wV=class extends _V{constructor(e,t){super(t),this.onCodeEditorAdd((()=>this._checkContextKey())),this.onCodeEditorRemove((()=>this._checkContextKey())),this._editorIsOpen=e.createKey("editorIsOpen",!1),this._activeCodeEditor=null}_checkContextKey(){let e=!1;for(const t of this.listCodeEditors())if(!t.isSimpleWidget){e=!0;break}this._editorIsOpen.set(e)}setActiveCodeEditor(e){this._activeCodeEditor=e}getActiveCodeEditor(){return this._activeCodeEditor}openCodeEditor(e,t,i){return t?Promise.resolve(this.doOpenEditor(t,e)):Promise.resolve(null)}doOpenEditor(e,t){if(!this.findModel(e,t.resource)){if(t.resource){const i=t.resource.scheme;if(i===Yw.http||i===Yw.https)return ey(t.resource.toString()),e}return null}const i=t.options?t.options.selection:null;if(i)if("number"==typeof i.endLineNumber&&"number"==typeof i.endColumn)e.setSelection(i),e.revealRangeInCenter(i,1);else{const t={lineNumber:i.startLineNumber,column:i.startColumn};e.setPosition(t),e.revealPositionInCenter(t,1)}return e}findModel(e,t){const i=e.getModel();return i&&i.uri.toString()!==t.toString()?null:i}};wV=vV([bV(0,$y),bV(1,Qy)],wV),Iv(N_,wV);const CV=L_("layoutService");var yV=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},xV=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};let SV=class{constructor(e){this._codeEditorService=e,this.onDidLayout=ds.None}get dimension(){return this._dimension||(this._dimension=vC(window.document.body)),this._dimension}get hasContainer(){return!1}get container(){throw new Error("ILayoutService.container is not available in the standalone editor!")}focus(){var e;null===(e=this._codeEditorService.getFocusedCodeEditor())||void 0===e||e.focus()}};SV=yV([xV(0,N_)],SV);let kV=class extends SV{constructor(e,t){super(t),this._container=e}get hasContainer(){return!1}get container(){return this._container}};kV=yV([xV(1,N_)],kV),Iv(CV,SV);const DV=L_("dialogService");var LV=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},NV=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}},EV=globalThis&&globalThis.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{l(n.next(e))}catch(t){s(t)}}function a(e){try{l(n.throw(e))}catch(t){s(t)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}l((n=n.apply(e,t||[])).next())}))};function IV(e){return e.scheme===Yw.file?e.fsPath:e.path}let TV=0;class MV{constructor(e,t,i,n,o,s,r){this.id=++TV,this.type=0,this.actual=e,this.label=e.label,this.confirmBeforeUndo=e.confirmBeforeUndo||!1,this.resourceLabel=t,this.strResource=i,this.resourceLabels=[this.resourceLabel],this.strResources=[this.strResource],this.groupId=n,this.groupOrder=o,this.sourceId=s,this.sourceOrder=r,this.isValid=!0}setValid(e){this.isValid=e}toString(){return`[id:${this.id}] [group:${this.groupId}] [${this.isValid?" VALID":"INVALID"}] ${this.actual.constructor.name} - ${this.actual}`}}class AV{constructor(e,t){this.resourceLabel=e,this.reason=t}}class OV{constructor(){this.elements=new Map}createMessage(){const e=[],t=[];for(const[,n]of this.elements){(0===n.reason?e:t).push(n.resourceLabel)}let i=[];return e.length>0&&i.push(mf(0,"The following files have been closed and modified on disk: {0}.",e.join(", "))),t.length>0&&i.push(mf(0,"The following files have been modified in an incompatible way: {0}.",t.join(", "))),i.join("\n")}get size(){return this.elements.size}has(e){return this.elements.has(e)}set(e,t){this.elements.set(e,t)}delete(e){return this.elements.delete(e)}}class RV{constructor(e,t,i,n,o,s,r){this.id=++TV,this.type=1,this.actual=e,this.label=e.label,this.confirmBeforeUndo=e.confirmBeforeUndo||!1,this.resourceLabels=t,this.strResources=i,this.groupId=n,this.groupOrder=o,this.sourceId=s,this.sourceOrder=r,this.removedResources=null,this.invalidatedResources=null}canSplit(){return"function"==typeof this.actual.split}removeResource(e,t,i){this.removedResources||(this.removedResources=new OV),this.removedResources.has(t)||this.removedResources.set(t,new AV(e,i))}setValid(e,t,i){i?this.invalidatedResources&&(this.invalidatedResources.delete(t),0===this.invalidatedResources.size&&(this.invalidatedResources=null)):(this.invalidatedResources||(this.invalidatedResources=new OV),this.invalidatedResources.has(t)||this.invalidatedResources.set(t,new AV(e,0)))}toString(){return`[id:${this.id}] [group:${this.groupId}] [${this.invalidatedResources?"INVALID":" VALID"}] ${this.actual.constructor.name} - ${this.actual}`}}class PV{constructor(e,t){this.resourceLabel=e,this.strResource=t,this._past=[],this._future=[],this.locked=!1,this.versionId=1}dispose(){for(const e of this._past)1===e.type&&e.removeResource(this.resourceLabel,this.strResource,0);for(const e of this._future)1===e.type&&e.removeResource(this.resourceLabel,this.strResource,0);this.versionId++}toString(){let e=[];e.push(`* ${this.strResource}:`);for(let t=0;t<this._past.length;t++)e.push(` * [UNDO] ${this._past[t]}`);for(let t=this._future.length-1;t>=0;t--)e.push(` * [REDO] ${this._future[t]}`);return e.join("\n")}flushAllElements(){this._past=[],this._future=[],this.versionId++}_setElementValidFlag(e,t){1===e.type?e.setValid(this.resourceLabel,this.strResource,t):e.setValid(t)}setElementsValidFlag(e,t){for(const i of this._past)t(i.actual)&&this._setElementValidFlag(i,e);for(const i of this._future)t(i.actual)&&this._setElementValidFlag(i,e)}pushElement(e){for(const t of this._future)1===t.type&&t.removeResource(this.resourceLabel,this.strResource,1);this._future=[],this._past.push(e),this.versionId++}createSnapshot(e){const t=[];for(let i=0,n=this._past.length;i<n;i++)t.push(this._past[i].id);for(let i=this._future.length-1;i>=0;i--)t.push(this._future[i].id);return new EP(e,t)}restoreSnapshot(e){const t=e.elements.length;let i=!0,n=0,o=-1;for(let r=0,a=this._past.length;r<a;r++,n++){const s=this._past[r];i&&(n>=t||s.id!==e.elements[n])&&(i=!1,o=0),i||1!==s.type||s.removeResource(this.resourceLabel,this.strResource,0)}let s=-1;for(let r=this._future.length-1;r>=0;r--,n++){const o=this._future[r];i&&(n>=t||o.id!==e.elements[n])&&(i=!1,s=r),i||1!==o.type||o.removeResource(this.resourceLabel,this.strResource,0)}-1!==o&&(this._past=this._past.slice(0,o)),-1!==s&&(this._future=this._future.slice(s+1)),this.versionId++}getElements(){const e=[],t=[];for(const i of this._past)e.push(i.actual);for(const i of this._future)t.push(i.actual);return{past:e,future:t}}getClosestPastElement(){return 0===this._past.length?null:this._past[this._past.length-1]}getSecondClosestPastElement(){return this._past.length<2?null:this._past[this._past.length-2]}getClosestFutureElement(){return 0===this._future.length?null:this._future[this._future.length-1]}hasPastElements(){return this._past.length>0}hasFutureElements(){return this._future.length>0}splitPastWorkspaceElement(e,t){for(let i=this._past.length-1;i>=0;i--)if(this._past[i]===e){t.has(this.strResource)?this._past[i]=t.get(this.strResource):this._past.splice(i,1);break}this.versionId++}splitFutureWorkspaceElement(e,t){for(let i=this._future.length-1;i>=0;i--)if(this._future[i]===e){t.has(this.strResource)?this._future[i]=t.get(this.strResource):this._future.splice(i,1);break}this.versionId++}moveBackward(e){this._past.pop(),this._future.push(e),this.versionId++}moveForward(e){this._future.pop(),this._past.push(e),this.versionId++}}class FV{constructor(e){this.editStacks=e,this._versionIds=[];for(let t=0,i=this.editStacks.length;t<i;t++)this._versionIds[t]=this.editStacks[t].versionId}isValid(){for(let e=0,t=this.editStacks.length;e<t;e++)if(this._versionIds[e]!==this.editStacks[e].versionId)return!1;return!0}}const BV=new PV("","");BV.locked=!0;let VV=class{constructor(e,t){this._dialogService=e,this._notificationService=t,this._editStacks=new Map,this._uriComparisonKeyComputers=[]}getUriComparisonKey(e){for(const t of this._uriComparisonKeyComputers)if(t[0]===e.scheme)return t[1].getComparisonKey(e);return e.toString()}_print(e){let t=[];for(const i of this._editStacks)t.push(i[1].toString())}pushElement(e,t=IP.None,i=TP.None){if(0===e.type){const n=IV(e.resource),o=this.getUriComparisonKey(e.resource);this._pushElement(new MV(e,n,o,t.id,t.nextOrder(),i.id,i.nextOrder()))}else{const n=new Set,o=[],s=[];for(const t of e.resources){const e=IV(t),i=this.getUriComparisonKey(t);n.has(i)||(n.add(i),o.push(e),s.push(i))}1===o.length?this._pushElement(new MV(e,o[0],s[0],t.id,t.nextOrder(),i.id,i.nextOrder())):this._pushElement(new RV(e,o,s,t.id,t.nextOrder(),i.id,i.nextOrder()))}}_pushElement(e){for(let t=0,i=e.strResources.length;t<i;t++){const i=e.resourceLabels[t],n=e.strResources[t];let o;this._editStacks.has(n)?o=this._editStacks.get(n):(o=new PV(i,n),this._editStacks.set(n,o)),o.pushElement(e)}}getLastElement(e){const t=this.getUriComparisonKey(e);if(this._editStacks.has(t)){const e=this._editStacks.get(t);if(e.hasFutureElements())return null;const i=e.getClosestPastElement();return i?i.actual:null}return null}_splitPastWorkspaceElement(e,t){const i=e.actual.split(),n=new Map;for(const o of i){const e=IV(o.resource),t=this.getUriComparisonKey(o.resource),i=new MV(o,e,t,0,0,0,0);n.set(i.strResource,i)}for(const o of e.strResources){if(t&&t.has(o))continue;this._editStacks.get(o).splitPastWorkspaceElement(e,n)}}_splitFutureWorkspaceElement(e,t){const i=e.actual.split(),n=new Map;for(const o of i){const e=IV(o.resource),t=this.getUriComparisonKey(o.resource),i=new MV(o,e,t,0,0,0,0);n.set(i.strResource,i)}for(const o of e.strResources){if(t&&t.has(o))continue;this._editStacks.get(o).splitFutureWorkspaceElement(e,n)}}removeElements(e){const t="string"==typeof e?e:this.getUriComparisonKey(e);if(this._editStacks.has(t)){this._editStacks.get(t).dispose(),this._editStacks.delete(t)}}setElementsValidFlag(e,t,i){const n=this.getUriComparisonKey(e);if(this._editStacks.has(n)){this._editStacks.get(n).setElementsValidFlag(t,i)}}createSnapshot(e){const t=this.getUriComparisonKey(e);if(this._editStacks.has(t)){return this._editStacks.get(t).createSnapshot(e)}return new EP(e,[])}restoreSnapshot(e){const t=this.getUriComparisonKey(e.resource);if(this._editStacks.has(t)){const i=this._editStacks.get(t);i.restoreSnapshot(e),i.hasPastElements()||i.hasFutureElements()||(i.dispose(),this._editStacks.delete(t))}}getElements(e){const t=this.getUriComparisonKey(e);if(this._editStacks.has(t)){return this._editStacks.get(t).getElements()}return{past:[],future:[]}}_findClosestUndoElementWithSource(e){if(!e)return[null,null];let t=null,i=null;for(const[n,o]of this._editStacks){const s=o.getClosestPastElement();s&&(s.sourceId===e&&(!t||s.sourceOrder>t.sourceOrder)&&(t=s,i=n))}return[t,i]}canUndo(e){if(e instanceof TP){const[,t]=this._findClosestUndoElementWithSource(e.id);return!!t}const t=this.getUriComparisonKey(e);if(this._editStacks.has(t)){return this._editStacks.get(t).hasPastElements()}return!1}_onError(e,t){Jo(e);for(const i of t.strResources)this.removeElements(i);this._notificationService.error(e)}_acquireLocks(e){for(const t of e.editStacks)if(t.locked)throw new Error("Cannot acquire edit stack lock");for(const t of e.editStacks)t.locked=!0;return()=>{for(const t of e.editStacks)t.locked=!1}}_safeInvokeWithLocks(e,t,i,n,o){const s=this._acquireLocks(i);let r;try{r=t()}catch(a){return s(),n.dispose(),this._onError(a,e)}return r?r.then((()=>(s(),n.dispose(),o())),(t=>(s(),n.dispose(),this._onError(t,e)))):(s(),n.dispose(),o())}_invokeWorkspacePrepare(e){return EV(this,void 0,void 0,(function*(){if(void 0===e.actual.prepareUndoRedo)return Uo.None;const t=e.actual.prepareUndoRedo();return void 0===t?Uo.None:t}))}_invokeResourcePrepare(e,t){if(1!==e.actual.type||void 0===e.actual.prepareUndoRedo)return t(Uo.None);const i=e.actual.prepareUndoRedo();return i?ga(i)?t(i):i.then((e=>t(e))):t(Uo.None)}_getAffectedEditStacks(e){const t=[];for(const i of e.strResources)t.push(this._editStacks.get(i)||BV);return new FV(t)}_tryToSplitAndUndo(e,t,i,n){if(t.canSplit())return this._splitPastWorkspaceElement(t,i),this._notificationService.warn(n),new WV(this._undo(e,0,!0));for(const o of t.strResources)this.removeElements(o);return this._notificationService.warn(n),new WV}_checkWorkspaceUndo(e,t,i,n){if(t.removedResources)return this._tryToSplitAndUndo(e,t,t.removedResources,mf(0,"Could not undo '{0}' across all files. {1}",t.label,t.removedResources.createMessage()));if(n&&t.invalidatedResources)return this._tryToSplitAndUndo(e,t,t.invalidatedResources,mf(0,"Could not undo '{0}' across all files. {1}",t.label,t.invalidatedResources.createMessage()));const o=[];for(const r of i.editStacks)r.getClosestPastElement()!==t&&o.push(r.resourceLabel);if(o.length>0)return this._tryToSplitAndUndo(e,t,null,mf(0,"Could not undo '{0}' across all files because changes were made to {1}",t.label,o.join(", ")));const s=[];for(const r of i.editStacks)r.locked&&s.push(r.resourceLabel);return s.length>0?this._tryToSplitAndUndo(e,t,null,mf(0,"Could not undo '{0}' across all files because there is already an undo or redo operation running on {1}",t.label,s.join(", "))):i.isValid()?null:this._tryToSplitAndUndo(e,t,null,mf(0,"Could not undo '{0}' across all files because an undo or redo operation occurred in the meantime",t.label))}_workspaceUndo(e,t,i){const n=this._getAffectedEditStacks(t),o=this._checkWorkspaceUndo(e,t,n,!1);return o?o.returnValue:this._confirmAndExecuteWorkspaceUndo(e,t,n,i)}_isPartOfUndoGroup(e){if(!e.groupId)return!1;for(const[,t]of this._editStacks){const i=t.getClosestPastElement();if(i){if(i===e){const i=t.getSecondClosestPastElement();if(i&&i.groupId===e.groupId)return!0}if(i.groupId===e.groupId)return!0}}return!1}_confirmAndExecuteWorkspaceUndo(e,t,i,n){return EV(this,void 0,void 0,(function*(){if(t.canSplit()&&!this._isPartOfUndoGroup(t)){const o=yield this._dialogService.show(fF.Info,mf(0,"Would you like to undo '{0}' across all files?",t.label),[mf(0,"Undo in {0} Files",i.editStacks.length),mf(0,"Undo this File"),mf(0,"Cancel")],{cancelId:2});if(2===o.choice)return;if(1===o.choice)return this._splitPastWorkspaceElement(t,null),this._undo(e,0,!0);const s=this._checkWorkspaceUndo(e,t,i,!1);if(s)return s.returnValue;n=!0}let o;try{o=yield this._invokeWorkspacePrepare(t)}catch(r){return this._onError(r,t)}const s=this._checkWorkspaceUndo(e,t,i,!0);if(s)return o.dispose(),s.returnValue;for(const e of i.editStacks)e.moveBackward(t);return this._safeInvokeWithLocks(t,(()=>t.actual.undo()),i,o,(()=>this._continueUndoInGroup(t.groupId,n)))}))}_resourceUndo(e,t,i){if(t.isValid){if(!e.locked)return this._invokeResourcePrepare(t,(n=>(e.moveBackward(t),this._safeInvokeWithLocks(t,(()=>t.actual.undo()),new FV([e]),n,(()=>this._continueUndoInGroup(t.groupId,i))))));{const e=mf(0,"Could not undo '{0}' because there is already an undo or redo operation running.",t.label);this._notificationService.warn(e)}}else e.flushAllElements()}_findClosestUndoElementInGroup(e){if(!e)return[null,null];let t=null,i=null;for(const[n,o]of this._editStacks){const s=o.getClosestPastElement();s&&(s.groupId===e&&(!t||s.groupOrder>t.groupOrder)&&(t=s,i=n))}return[t,i]}_continueUndoInGroup(e,t){if(!e)return;const[,i]=this._findClosestUndoElementInGroup(e);return i?this._undo(i,0,t):void 0}undo(e){if(e instanceof TP){const[,t]=this._findClosestUndoElementWithSource(e.id);return t?this._undo(t,e.id,!1):void 0}return"string"==typeof e?this._undo(e,0,!1):this._undo(this.getUriComparisonKey(e),0,!1)}_undo(e,t=0,i){if(!this._editStacks.has(e))return;const n=this._editStacks.get(e),o=n.getClosestPastElement();if(!o)return;if(o.groupId){const[e,n]=this._findClosestUndoElementInGroup(o.groupId);if(o!==e&&n)return this._undo(n,t,i)}if((o.sourceId!==t||o.confirmBeforeUndo)&&!i)return this._confirmAndContinueUndo(e,t,o);try{return 1===o.type?this._workspaceUndo(e,o,i):this._resourceUndo(n,o,i)}finally{}}_confirmAndContinueUndo(e,t,i){return EV(this,void 0,void 0,(function*(){if(1!==(yield this._dialogService.show(fF.Info,mf(0,"Would you like to undo '{0}'?",i.label),[mf(0,"Yes"),mf(0,"No")],{cancelId:1})).choice)return this._undo(e,t,!0)}))}_findClosestRedoElementWithSource(e){if(!e)return[null,null];let t=null,i=null;for(const[n,o]of this._editStacks){const s=o.getClosestFutureElement();s&&(s.sourceId===e&&(!t||s.sourceOrder<t.sourceOrder)&&(t=s,i=n))}return[t,i]}canRedo(e){if(e instanceof TP){const[,t]=this._findClosestRedoElementWithSource(e.id);return!!t}const t=this.getUriComparisonKey(e);if(this._editStacks.has(t)){return this._editStacks.get(t).hasFutureElements()}return!1}_tryToSplitAndRedo(e,t,i,n){if(t.canSplit())return this._splitFutureWorkspaceElement(t,i),this._notificationService.warn(n),new WV(this._redo(e));for(const o of t.strResources)this.removeElements(o);return this._notificationService.warn(n),new WV}_checkWorkspaceRedo(e,t,i,n){if(t.removedResources)return this._tryToSplitAndRedo(e,t,t.removedResources,mf(0,"Could not redo '{0}' across all files. {1}",t.label,t.removedResources.createMessage()));if(n&&t.invalidatedResources)return this._tryToSplitAndRedo(e,t,t.invalidatedResources,mf(0,"Could not redo '{0}' across all files. {1}",t.label,t.invalidatedResources.createMessage()));const o=[];for(const r of i.editStacks)r.getClosestFutureElement()!==t&&o.push(r.resourceLabel);if(o.length>0)return this._tryToSplitAndRedo(e,t,null,mf(0,"Could not redo '{0}' across all files because changes were made to {1}",t.label,o.join(", ")));const s=[];for(const r of i.editStacks)r.locked&&s.push(r.resourceLabel);return s.length>0?this._tryToSplitAndRedo(e,t,null,mf(0,"Could not redo '{0}' across all files because there is already an undo or redo operation running on {1}",t.label,s.join(", "))):i.isValid()?null:this._tryToSplitAndRedo(e,t,null,mf(0,"Could not redo '{0}' across all files because an undo or redo operation occurred in the meantime",t.label))}_workspaceRedo(e,t){const i=this._getAffectedEditStacks(t),n=this._checkWorkspaceRedo(e,t,i,!1);return n?n.returnValue:this._executeWorkspaceRedo(e,t,i)}_executeWorkspaceRedo(e,t,i){return EV(this,void 0,void 0,(function*(){let n;try{n=yield this._invokeWorkspacePrepare(t)}catch(s){return this._onError(s,t)}const o=this._checkWorkspaceRedo(e,t,i,!0);if(o)return n.dispose(),o.returnValue;for(const e of i.editStacks)e.moveForward(t);return this._safeInvokeWithLocks(t,(()=>t.actual.redo()),i,n,(()=>this._continueRedoInGroup(t.groupId)))}))}_resourceRedo(e,t){if(t.isValid){if(!e.locked)return this._invokeResourcePrepare(t,(i=>(e.moveForward(t),this._safeInvokeWithLocks(t,(()=>t.actual.redo()),new FV([e]),i,(()=>this._continueRedoInGroup(t.groupId))))));{const e=mf(0,"Could not redo '{0}' because there is already an undo or redo operation running.",t.label);this._notificationService.warn(e)}}else e.flushAllElements()}_findClosestRedoElementInGroup(e){if(!e)return[null,null];let t=null,i=null;for(const[n,o]of this._editStacks){const s=o.getClosestFutureElement();s&&(s.groupId===e&&(!t||s.groupOrder<t.groupOrder)&&(t=s,i=n))}return[t,i]}_continueRedoInGroup(e){if(!e)return;const[,t]=this._findClosestRedoElementInGroup(e);return t?this._redo(t):void 0}redo(e){if(e instanceof TP){const[,t]=this._findClosestRedoElementWithSource(e.id);return t?this._redo(t):void 0}return"string"==typeof e?this._redo(e):this._redo(this.getUriComparisonKey(e))}_redo(e){if(!this._editStacks.has(e))return;const t=this._editStacks.get(e),i=t.getClosestFutureElement();if(i){if(i.groupId){const[e,t]=this._findClosestRedoElementInGroup(i.groupId);if(i!==e&&t)return this._redo(t)}try{return 1===i.type?this._workspaceRedo(e,i):this._resourceRedo(t,i)}finally{}}}};VV=LV([NV(0,DV),NV(1,vF)],VV);class WV{constructor(e){this.returnValue=e}}var zV,HV;Iv(NP,VV);class jV{constructor(){this._value="",this._pos=0}reset(e){return this._value=e,this._pos=0,this}next(){return this._pos+=1,this}hasNext(){return this._pos<this._value.length-1}cmp(e){return e.charCodeAt(0)-this._value.charCodeAt(this._pos)}value(){return this._value[this._pos]}}class UV{constructor(e=!0){this._caseSensitive=e}reset(e){return this._value=e,this._from=0,this._to=0,this.next()}hasNext(){return this._to<this._value.length}next(){this._from=this._to;let e=!0;for(;this._to<this._value.length;this._to++){if(46===this._value.charCodeAt(this._to)){if(!e)break;this._from++}else e=!1}return this}cmp(e){return this._caseSensitive?pa(e,this._value,0,e.length,this._from,this._to):ma(e,this._value,0,e.length,this._from,this._to)}value(){return this._value.substring(this._from,this._to)}}class $V{constructor(e=!0,t=!0){this._splitOnBackslash=e,this._caseSensitive=t}reset(e){this._from=0,this._to=0,this._value=e,this._valueLen=e.length;for(let t=e.length-1;t>=0;t--,this._valueLen--){const e=this._value.charCodeAt(t);if(!(47===e||this._splitOnBackslash&&92===e))break}return this.next()}hasNext(){return this._to<this._valueLen}next(){this._from=this._to;let e=!0;for(;this._to<this._valueLen;this._to++){const t=this._value.charCodeAt(this._to);if(47===t||this._splitOnBackslash&&92===t){if(!e)break;this._from++}else e=!1}return this}cmp(e){return this._caseSensitive?pa(e,this._value,0,e.length,this._from,this._to):ma(e,this._value,0,e.length,this._from,this._to)}value(){return this._value.substring(this._from,this._to)}}class KV{constructor(e){this._ignorePathCasing=e,this._states=[],this._stateIdx=0}reset(e){return this._value=e,this._states=[],this._value.scheme&&this._states.push(1),this._value.authority&&this._states.push(2),this._value.path&&(this._pathIterator=new $V(!1,!this._ignorePathCasing(e)),this._pathIterator.reset(e.path),this._pathIterator.value()&&this._states.push(3)),this._value.query&&this._states.push(4),this._value.fragment&&this._states.push(5),this._stateIdx=0,this}next(){return 3===this._states[this._stateIdx]&&this._pathIterator.hasNext()?this._pathIterator.next():this._stateIdx+=1,this}hasNext(){return 3===this._states[this._stateIdx]&&this._pathIterator.hasNext()||this._stateIdx<this._states.length-1}cmp(e){if(1===this._states[this._stateIdx])return fa(e,this._value.scheme);if(2===this._states[this._stateIdx])return fa(e,this._value.authority);if(3===this._states[this._stateIdx])return this._pathIterator.cmp(e);if(4===this._states[this._stateIdx])return zr(e,this._value.query);if(5===this._states[this._stateIdx])return zr(e,this._value.fragment);throw new Error}value(){if(1===this._states[this._stateIdx])return this._value.scheme;if(2===this._states[this._stateIdx])return this._value.authority;if(3===this._states[this._stateIdx])return this._pathIterator.value();if(4===this._states[this._stateIdx])return this._value.query;if(5===this._states[this._stateIdx])return this._value.fragment;throw new Error}}class qV{constructor(){this.height=1}rotateLeft(){const e=this.right;return this.right=e.left,e.left=this,this.updateHeight(),e.updateHeight(),e}rotateRight(){const e=this.left;return this.left=e.right,e.right=this,this.updateHeight(),e.updateHeight(),e}updateHeight(){this.height=1+Math.max(this.heightLeft,this.heightRight)}balanceFactor(){return this.heightRight-this.heightLeft}get heightLeft(){var e,t;return null!==(t=null===(e=this.left)||void 0===e?void 0:e.height)&&void 0!==t?t:0}get heightRight(){var e,t;return null!==(t=null===(e=this.right)||void 0===e?void 0:e.height)&&void 0!==t?t:0}}class GV{constructor(e){this._iter=e}static forUris(e=(()=>!1)){return new GV(new KV(e))}static forStrings(){return new GV(new jV)}static forConfigKeys(){return new GV(new UV)}clear(){this._root=void 0}set(e,t){const i=this._iter.reset(e);let n;this._root||(this._root=new qV,this._root.segment=i.value());const o=[];for(n=this._root;;){const e=i.cmp(n.segment);if(e>0)n.left||(n.left=new qV,n.left.segment=i.value()),o.push([-1,n]),n=n.left;else if(e<0)n.right||(n.right=new qV,n.right.segment=i.value()),o.push([1,n]),n=n.right;else{if(!i.hasNext())break;i.next(),n.mid||(n.mid=new qV,n.mid.segment=i.value()),o.push([0,n]),n=n.mid}}const s=n.value;n.value=t,n.key=e;for(let r=o.length-1;r>=0;r--){const e=o[r][1];e.updateHeight();const t=e.balanceFactor();if(t<-1||t>1){const t=o[r][0],i=o[r+1][0];if(1===t&&1===i)o[r][1]=e.rotateLeft();else if(-1===t&&-1===i)o[r][1]=e.rotateRight();else if(1===t&&-1===i)e.right=o[r+1][1]=o[r+1][1].rotateRight(),o[r][1]=e.rotateLeft();else{if(-1!==t||1!==i)throw new Error;e.left=o[r+1][1]=o[r+1][1].rotateLeft(),o[r][1]=e.rotateRight()}if(r>0)switch(o[r-1][0]){case-1:o[r-1][1].left=o[r][1];break;case 1:o[r-1][1].right=o[r][1];break;case 0:o[r-1][1].mid=o[r][1]}else this._root=o[0][1]}}return s}get(e){var t;return null===(t=this._getNode(e))||void 0===t?void 0:t.value}_getNode(e){const t=this._iter.reset(e);let i=this._root;for(;i;){const e=t.cmp(i.segment);if(e>0)i=i.left;else if(e<0)i=i.right;else{if(!t.hasNext())break;t.next(),i=i.mid}}return i}has(e){const t=this._getNode(e);return!(void 0===(null==t?void 0:t.value)&&void 0===(null==t?void 0:t.mid))}delete(e){return this._delete(e,!1)}deleteSuperstr(e){return this._delete(e,!0)}_delete(e,t){var i;const n=this._iter.reset(e),o=[];let s=this._root;for(;s;){const e=n.cmp(s.segment);if(e>0)o.push([-1,s]),s=s.left;else if(e<0)o.push([1,s]),s=s.right;else{if(!n.hasNext())break;n.next(),o.push([0,s]),s=s.mid}}if(s){if(t?(s.left=void 0,s.mid=void 0,s.right=void 0,s.height=1):(s.key=void 0,s.value=void 0),!s.mid&&!s.value)if(s.left&&s.right){const e=this._min(s.right),{key:t,value:i,segment:n}=e;this._delete(e.key,!1),s.key=t,s.value=i,s.segment=n}else{const e=null!==(i=s.left)&&void 0!==i?i:s.right;if(o.length>0){const[t,i]=o[o.length-1];switch(t){case-1:i.left=e;break;case 0:i.mid=e;break;case 1:i.right=e}}else this._root=e}for(let e=o.length-1;e>=0;e--){const t=o[e][1];t.updateHeight();const i=t.balanceFactor();if(i>1?(t.right.balanceFactor()>=0||(t.right=t.right.rotateRight()),o[e][1]=t.rotateLeft()):i<-1&&(t.left.balanceFactor()<=0||(t.left=t.left.rotateLeft()),o[e][1]=t.rotateRight()),e>0)switch(o[e-1][0]){case-1:o[e-1][1].left=o[e][1];break;case 1:o[e-1][1].right=o[e][1];break;case 0:o[e-1][1].mid=o[e][1]}else this._root=o[0][1]}}}_min(e){for(;e.left;)e=e.left;return e}findSubstr(e){const t=this._iter.reset(e);let i,n=this._root;for(;n;){const e=t.cmp(n.segment);if(e>0)n=n.left;else if(e<0)n=n.right;else{if(!t.hasNext())break;t.next(),i=n.value||i,n=n.mid}}return n&&n.value||i}findSuperstr(e){const t=this._iter.reset(e);let i=this._root;for(;i;){const e=t.cmp(i.segment);if(e>0)i=i.left;else if(e<0)i=i.right;else{if(!t.hasNext())return i.mid?this._entries(i.mid):void 0;t.next(),i=i.mid}}}forEach(e){for(const[t,i]of this)e(i,t)}*[Symbol.iterator](){yield*this._entries(this._root)}*_entries(e){e&&(e.left&&(yield*this._entries(e.left)),e.value&&(yield[e.key,e.value]),e.mid&&(yield*this._entries(e.mid)),e.right&&(yield*this._entries(e.right)))}}class ZV{constructor(e,t){this.uri=e,this.value=t}}class YV{constructor(e,t){this[zV]="ResourceMap",e instanceof YV?(this.map=new Map(e.map),this.toKey=null!=t?t:YV.defaultToKey):(this.map=new Map,this.toKey=null!=e?e:YV.defaultToKey)}set(e,t){return this.map.set(this.toKey(e),new ZV(e,t)),this}get(e){var t;return null===(t=this.map.get(this.toKey(e)))||void 0===t?void 0:t.value}has(e){return this.map.has(this.toKey(e))}get size(){return this.map.size}clear(){this.map.clear()}delete(e){return this.map.delete(this.toKey(e))}forEach(e,t){void 0!==t&&(e=e.bind(t));for(let[i,n]of this.map)e(n.value,n.uri,this)}*values(){for(let e of this.map.values())yield e.value}*keys(){for(let e of this.map.values())yield e.uri}*entries(){for(let e of this.map.values())yield[e.uri,e.value]}*[(zV=Symbol.toStringTag,Symbol.iterator)](){for(let[,e]of this.map)yield[e.uri,e.value]}}YV.defaultToKey=e=>e.toString();class XV{constructor(){this[HV]="LinkedMap",this._map=new Map,this._head=void 0,this._tail=void 0,this._size=0,this._state=0}clear(){this._map.clear(),this._head=void 0,this._tail=void 0,this._size=0,this._state++}isEmpty(){return!this._head&&!this._tail}get size(){return this._size}get first(){var e;return null===(e=this._head)||void 0===e?void 0:e.value}get last(){var e;return null===(e=this._tail)||void 0===e?void 0:e.value}has(e){return this._map.has(e)}get(e,t=0){const i=this._map.get(e);if(i)return 0!==t&&this.touch(i,t),i.value}set(e,t,i=0){let n=this._map.get(e);if(n)n.value=t,0!==i&&this.touch(n,i);else{switch(n={key:e,value:t,next:void 0,previous:void 0},i){case 0:case 2:default:this.addItemLast(n);break;case 1:this.addItemFirst(n)}this._map.set(e,n),this._size++}return this}delete(e){return!!this.remove(e)}remove(e){const t=this._map.get(e);if(t)return this._map.delete(e),this.removeItem(t),this._size--,t.value}shift(){if(!this._head&&!this._tail)return;if(!this._head||!this._tail)throw new Error("Invalid list");const e=this._head;return this._map.delete(e.key),this.removeItem(e),this._size--,e.value}forEach(e,t){const i=this._state;let n=this._head;for(;n;){if(t?e.bind(t)(n.value,n.key,this):e(n.value,n.key,this),this._state!==i)throw new Error("LinkedMap got modified during iteration.");n=n.next}}keys(){const e=this,t=this._state;let i=this._head;const n={[Symbol.iterator]:()=>n,next(){if(e._state!==t)throw new Error("LinkedMap got modified during iteration.");if(i){const e={value:i.key,done:!1};return i=i.next,e}return{value:void 0,done:!0}}};return n}values(){const e=this,t=this._state;let i=this._head;const n={[Symbol.iterator]:()=>n,next(){if(e._state!==t)throw new Error("LinkedMap got modified during iteration.");if(i){const e={value:i.value,done:!1};return i=i.next,e}return{value:void 0,done:!0}}};return n}entries(){const e=this,t=this._state;let i=this._head;const n={[Symbol.iterator]:()=>n,next(){if(e._state!==t)throw new Error("LinkedMap got modified during iteration.");if(i){const e={value:[i.key,i.value],done:!1};return i=i.next,e}return{value:void 0,done:!0}}};return n}[(HV=Symbol.toStringTag,Symbol.iterator)](){return this.entries()}trimOld(e){if(e>=this.size)return;if(0===e)return void this.clear();let t=this._head,i=this.size;for(;t&&i>e;)this._map.delete(t.key),t=t.next,i--;this._head=t,this._size=i,t&&(t.previous=void 0),this._state++}addItemFirst(e){if(this._head||this._tail){if(!this._head)throw new Error("Invalid list");e.next=this._head,this._head.previous=e}else this._tail=e;this._head=e,this._state++}addItemLast(e){if(this._head||this._tail){if(!this._tail)throw new Error("Invalid list");e.previous=this._tail,this._tail.next=e}else this._head=e;this._tail=e,this._state++}removeItem(e){if(e===this._head&&e===this._tail)this._head=void 0,this._tail=void 0;else if(e===this._head){if(!e.next)throw new Error("Invalid list");e.next.previous=void 0,this._head=e.next}else if(e===this._tail){if(!e.previous)throw new Error("Invalid list");e.previous.next=void 0,this._tail=e.previous}else{const t=e.next,i=e.previous;if(!t||!i)throw new Error("Invalid list");t.previous=i,i.next=t}e.next=void 0,e.previous=void 0,this._state++}touch(e,t){if(!this._head||!this._tail)throw new Error("Invalid list");if(1===t||2===t)if(1===t){if(e===this._head)return;const t=e.next,i=e.previous;e===this._tail?(i.next=void 0,this._tail=i):(t.previous=i,i.next=t),e.previous=void 0,e.next=this._head,this._head.previous=e,this._head=e,this._state++}else if(2===t){if(e===this._tail)return;const t=e.next,i=e.previous;e===this._head?(t.previous=void 0,this._head=t):(t.previous=i,i.next=t),e.next=void 0,e.previous=this._tail,this._tail.next=e,this._tail=e,this._state++}}toJSON(){const e=[];return this.forEach(((t,i)=>{e.push([i,t])})),e}fromJSON(e){this.clear();for(const[t,i]of e)this.set(t,i)}}class QV extends XV{constructor(e,t=1){super(),this._limit=e,this._ratio=Math.min(Math.max(0,t),1)}get limit(){return this._limit}set limit(e){this._limit=e,this.checkTrim()}get(e,t=2){return super.get(e,t)}peek(e){return super.get(e,0)}set(e,t){return super.set(e,t,2),this.checkTrim(),this}checkTrim(){this.size>this._limit&&this.trimOld(Math.round(this._limit*this._ratio))}}function JV(e,t,i){return Math.min(Math.max(e,t),i)}class eW{constructor(){this._n=1,this._val=0}update(e){return this._val=this._val+(e-this._val)/this._n,this._n+=1,this._val}get value(){return this._val}}class tW{constructor(e){this._n=0,this._val=0,this._values=[],this._index=0,this._sum=0,this._values=new Array(e),this._values.fill(0,0,e)}update(e){const t=this._values[this._index];return this._values[this._index]=e,this._index=(this._index+1)%this._values.length,this._sum-=t,this._sum+=e,this._n<this._values.length&&(this._n+=1),this._val=this._sum/this._n,this._val}get value(){return this._val}}var iW=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},nW=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};const oW=L_("ILanguageFeatureDebounceService");var sW;!function(e){const t=new WeakMap;let i=0;e.of=function(e){let n=t.get(e);return void 0===n&&(n=++i,t.set(e,n)),n}}(sW||(sW={}));class rW{constructor(e,t,i,n,o,s){this._logService=e,this._name=t,this._registry=i,this._default=n,this._min=o,this._max=s,this._cache=new QV(50,.7)}_key(e){return e.id+this._registry.all(e).reduce(((e,t)=>_a(sW.of(t),e)),0)}get(e){const t=this._key(e),i=this._cache.get(t);return i?JV(i.value,this._min,this._max):this.default()}update(e,t){const i=this._key(e);let n=this._cache.get(i);n||(n=new tW(6),this._cache.set(i,n));const o=JV(n.update(t),this._min,this._max);return this._logService.trace(`[DEBOUNCE: ${this._name}] for ${e.uri.toString()} is ${o}ms`),o}_overall(){const e=new eW;for(const[,t]of this._cache)e.update(t.value);return e.value}default(){return JV(0|this._overall()||this._default,this._min,this._max)}}let aW=class{constructor(e){this._logService=e,this._data=new Map}for(e,t,i){var n,o,s;const r=null!==(n=null==i?void 0:i.min)&&void 0!==n?n:50,a=null!==(o=null==i?void 0:i.max)&&void 0!==o?o:Math.pow(r,2),l=null!==(s=null==i?void 0:i.key)&&void 0!==s?s:void 0,d=`${sW.of(e)},${r}${l?","+l:""}`;let c=this._data.get(d);return c||(c=new rW(this._logService,t,e,0|this._overallAverage()||1.5*r,r,a),this._data.set(d,c)),c}_overallAverage(){let e=new eW;for(let t of this._data.values())e.update(t.default());return e.value}};aW=iW([nW(0,Cb)],aW),Iv(oW,aW,!0);const lW=L_("IWorkspaceEditService");class dW{constructor(e){this.metadata=e}static convert(e){return e.edits.map((e=>{if(Zs(t=e)&&Ps.isUri(t.resource)&&Zs(t.edit))return new cW(e.resource,e.edit,e.modelVersionId,e.metadata);var t;if(function(e){return Zs(e)&&(Boolean(e.newUri)||Boolean(e.oldUri))}(e))return new hW(e.oldUri,e.newUri,e.options,e.metadata);throw new Error("Unsupported edit")}))}}class cW extends dW{constructor(e,t,i,n){super(n),this.resource=e,this.textEdit=t,this.versionId=i}}class hW extends dW{constructor(e,t,i,n){super(n),this.oldResource=e,this.newResource=t,this.options=i}}const uW=Object.freeze({id:"editor",order:5,type:"object",title:mf(0,"Editor"),scope:5}),gW=Object.assign(Object.assign({},uW),{properties:{"editor.tabSize":{type:"number",default:ff.tabSize,minimum:1,markdownDescription:mf(0,"The number of spaces a tab is equal to. This setting is overridden based on the file contents when `#editor.detectIndentation#` is on.")},"editor.insertSpaces":{type:"boolean",default:ff.insertSpaces,markdownDescription:mf(0,"Insert spaces when pressing `Tab`. This setting is overridden based on the file contents when `#editor.detectIndentation#` is on.")},"editor.detectIndentation":{type:"boolean",default:ff.detectIndentation,markdownDescription:mf(0,"Controls whether `#editor.tabSize#` and `#editor.insertSpaces#` will be automatically detected when a file is opened based on the file contents.")},"editor.trimAutoWhitespace":{type:"boolean",default:ff.trimAutoWhitespace,description:mf(0,"Remove trailing auto inserted whitespace.")},"editor.largeFileOptimizations":{type:"boolean",default:ff.largeFileOptimizations,description:mf(0,"Special handling for large files to disable certain memory intensive features.")},"editor.wordBasedSuggestions":{type:"boolean",default:!0,description:mf(0,"Controls whether completions should be computed based on words in the document.")},"editor.wordBasedSuggestionsMode":{enum:["currentDocument","matchingDocuments","allDocuments"],default:"matchingDocuments",enumDescriptions:[mf(0,"Only suggest words from the active document."),mf(0,"Suggest words from all open documents of the same language."),mf(0,"Suggest words from all open documents.")],description:mf(0,"Controls from which documents word based completions are computed.")},"editor.semanticHighlighting.enabled":{enum:[!0,!1,"configuredByTheme"],enumDescriptions:[mf(0,"Semantic highlighting enabled for all color themes."),mf(0,"Semantic highlighting disabled for all color themes."),mf(0,"Semantic highlighting is configured by the current color theme's `semanticHighlighting` setting.")],default:"configuredByTheme",description:mf(0,"Controls whether the semanticHighlighting is shown for the languages that support it.")},"editor.stablePeek":{type:"boolean",default:!1,markdownDescription:mf(0,"Keep peek editors open even when double clicking their content or when hitting `Escape`.")},"editor.maxTokenizationLineLength":{type:"integer",default:2e4,description:mf(0,"Lines above this length will not be tokenized for performance reasons")},"editor.language.brackets":{type:"array",default:!1,description:mf(0,"Defines the bracket symbols that increase or decrease the indentation."),items:{type:"array",items:[{type:"string",description:mf(0,"The opening bracket character or string sequence.")},{type:"string",description:mf(0,"The closing bracket character or string sequence.")}]}},"editor.language.colorizedBracketPairs":{type:"array",default:!1,description:mf(0,"Defines the bracket pairs that are colorized by their nesting level if bracket pair colorization is enabled."),items:{type:"array",items:[{type:"string",description:mf(0,"The opening bracket character or string sequence.")},{type:"string",description:mf(0,"The closing bracket character or string sequence.")}]}},"diffEditor.maxComputationTime":{type:"number",default:5e3,description:mf(0,"Timeout in milliseconds after which diff computation is cancelled. Use 0 for no timeout.")},"diffEditor.maxFileSize":{type:"number",default:50,description:mf(0,"Maximum file size in MB for which to compute diffs. Use 0 for no limit.")},"diffEditor.renderSideBySide":{type:"boolean",default:!0,description:mf(0,"Controls whether the diff editor shows the diff side by side or inline.")},"diffEditor.ignoreTrimWhitespace":{type:"boolean",default:!0,description:mf(0,"When enabled, the diff editor ignores changes in leading or trailing whitespace.")},"diffEditor.renderIndicators":{type:"boolean",default:!0,description:mf(0,"Controls whether the diff editor shows +/- indicators for added/removed changes.")},"diffEditor.codeLens":{type:"boolean",default:!1,description:mf(0,"Controls whether the editor shows CodeLens.")},"diffEditor.wordWrap":{type:"string",enum:["off","on","inherit"],default:"inherit",markdownEnumDescriptions:[mf(0,"Lines will never wrap."),mf(0,"Lines will wrap at the viewport width."),mf(0,"Lines will wrap according to the `#editor.wordWrap#` setting.")]}}});function pW(e){return void 0!==e.type||void 0!==e.anyOf}for(const e of Zf){const t=e.schema;if(void 0!==t)if(pW(t))gW.properties[`editor.${e.name}`]=t;else for(const e in t)Object.hasOwnProperty.call(t,e)&&(gW.properties[e]=t[e])}let mW=null;function fW(){return null===mW&&(mW=Object.create(null),Object.keys(gW.properties).forEach((e=>{mW[e]=!0}))),mW}Yy.as(cA).registerConfiguration(gW);class _W{static insert(e,t){return{range:new qo(e.lineNumber,e.column,e.lineNumber,e.column),text:t,forceMoveMarkers:!0}}static delete(e){return{range:e,text:null}}static replace(e,t){return{range:e,text:t}}static replaceMove(e,t){return{range:e,text:t,forceMoveMarkers:!0}}}class vW{constructor(e={},t=[],i=[]){this._contents=e,this._keys=t,this._overrides=i,this.isFrozen=!1,this.overrideConfigurations=new Map}get contents(){return this.checkAndFreeze(this._contents)}get overrides(){return this.checkAndFreeze(this._overrides)}get keys(){return this.checkAndFreeze(this._keys)}isEmpty(){return 0===this._keys.length&&0===Object.keys(this._contents).length&&0===this._overrides.length}getValue(e){return e?Dv(this.contents,e):this.contents}getOverrideValue(e,t){const i=this.getContentsForOverrideIdentifer(t);return i?e?Dv(i,e):i:void 0}override(e){let t=this.overrideConfigurations.get(e);return t||(t=this.createOverrideConfigurationModel(e),this.overrideConfigurations.set(e,t)),t}merge(...e){const t=tr(this.contents),i=tr(this.overrides),n=[...this.keys];for(const o of e){this.mergeContents(t,o.contents);for(const e of o.overrides){const[t]=i.filter((t=>jo(t.identifiers,e.identifiers)));t?(this.mergeContents(t.contents,e.contents),t.keys.push(...e.keys),t.keys=Qo(t.keys)):i.push(tr(e))}for(const e of o.keys)-1===n.indexOf(e)&&n.push(e)}return new vW(t,n,i)}freeze(){return this.isFrozen=!0,this}createOverrideConfigurationModel(e){const t=this.getContentsForOverrideIdentifer(e);if(!t||"object"!=typeof t||!Object.keys(t).length)return this;let i={};for(const n of Qo([...Object.keys(this.contents),...Object.keys(t)])){let e=this.contents[n],o=t[n];o&&("object"==typeof e&&"object"==typeof o?(e=tr(e),this.mergeContents(e,o)):e=o),i[n]=e}return new vW(i,this.keys,this.overrides)}mergeContents(e,t){for(const i of Object.keys(t))i in e&&Zs(e[i])&&Zs(t[i])?this.mergeContents(e[i],t[i]):e[i]=tr(t[i])}checkAndFreeze(e){return this.isFrozen&&!Object.isFrozen(e)?va(e):e}getContentsForOverrideIdentifer(e){let t=null,i=null;const n=e=>{e&&(i?this.mergeContents(i,e):i=tr(e))};for(const o of this.overrides)jo(o.identifiers,[e])?t=o.contents:o.identifiers.includes(e)&&n(o.contents);return n(t),i}toJSON(){return{contents:this.contents,overrides:this.overrides,keys:this.keys}}setValue(e,t){this.addKey(e),xv(this.contents,e,t,(e=>{throw new Error(e)}))}removeValue(e){this.removeKey(e)&&Sv(this.contents,e)}addKey(e){let t=this.keys.length;for(let i=0;i<t;i++)0===e.indexOf(this.keys[i])&&(t=i);this.keys.splice(t,1,e)}removeKey(e){let t=this.keys.indexOf(e);return-1!==t&&(this.keys.splice(t,1),!0)}}class bW extends vW{constructor(e={}){const t=Yy.as(cA).getConfigurationProperties(),i=Object.keys(t),n=Object.create(null),o=[];for(const s in t){const i=e[s];xv(n,s,void 0!==i?i:t[s].default,(e=>{}))}for(const s of Object.keys(n))yA.test(s)&&o.push({identifiers:xA(s),keys:Object.keys(n[s]),contents:yv(n[s],(e=>{}))});super(n,i,o)}}class wW{constructor(e,t,i=new vW,n=new vW,o=new YV,s=new vW,r=new YV,a=!0){this._defaultConfiguration=e,this._localUserConfiguration=t,this._remoteUserConfiguration=i,this._workspaceConfiguration=n,this._folderConfigurations=o,this._memoryConfiguration=s,this._memoryConfigurationByResource=r,this._freeze=a,this._workspaceConsolidatedConfiguration=null,this._foldersConsolidatedConfigurations=new YV,this._userConfiguration=null}getValue(e,t,i){return this.getConsolidateConfigurationModel(t,i).getValue(e)}updateValue(e,t,i={}){let n;i.resource?(n=this._memoryConfigurationByResource.get(i.resource),n||(n=new vW,this._memoryConfigurationByResource.set(i.resource,n))):n=this._memoryConfiguration,void 0===t?n.removeValue(e):n.setValue(e,t),i.resource||(this._workspaceConsolidatedConfiguration=null)}inspect(e,t,i){const n=this.getConsolidateConfigurationModel(t,i),o=this.getFolderConfigurationModelForResource(t.resource,i),s=t.resource&&this._memoryConfigurationByResource.get(t.resource)||this._memoryConfiguration,r=t.overrideIdentifier?this._defaultConfiguration.freeze().override(t.overrideIdentifier).getValue(e):this._defaultConfiguration.freeze().getValue(e),a=t.overrideIdentifier?this.userConfiguration.freeze().override(t.overrideIdentifier).getValue(e):this.userConfiguration.freeze().getValue(e),l=t.overrideIdentifier?this.localUserConfiguration.freeze().override(t.overrideIdentifier).getValue(e):this.localUserConfiguration.freeze().getValue(e),d=t.overrideIdentifier?this.remoteUserConfiguration.freeze().override(t.overrideIdentifier).getValue(e):this.remoteUserConfiguration.freeze().getValue(e),c=i?t.overrideIdentifier?this._workspaceConfiguration.freeze().override(t.overrideIdentifier).getValue(e):this._workspaceConfiguration.freeze().getValue(e):void 0,h=o?t.overrideIdentifier?o.freeze().override(t.overrideIdentifier).getValue(e):o.freeze().getValue(e):void 0,u=t.overrideIdentifier?s.override(t.overrideIdentifier).getValue(e):s.getValue(e),g=n.getValue(e),p=Qo(ba(n.overrides.map((e=>e.identifiers)))).filter((t=>void 0!==n.getOverrideValue(e,t)));return{defaultValue:r,userValue:a,userLocalValue:l,userRemoteValue:d,workspaceValue:c,workspaceFolderValue:h,memoryValue:u,value:g,default:void 0!==r?{value:this._defaultConfiguration.freeze().getValue(e),override:t.overrideIdentifier?this._defaultConfiguration.freeze().getOverrideValue(e,t.overrideIdentifier):void 0}:void 0,user:void 0!==a?{value:this.userConfiguration.freeze().getValue(e),override:t.overrideIdentifier?this.userConfiguration.freeze().getOverrideValue(e,t.overrideIdentifier):void 0}:void 0,userLocal:void 0!==l?{value:this.localUserConfiguration.freeze().getValue(e),override:t.overrideIdentifier?this.localUserConfiguration.freeze().getOverrideValue(e,t.overrideIdentifier):void 0}:void 0,userRemote:void 0!==d?{value:this.remoteUserConfiguration.freeze().getValue(e),override:t.overrideIdentifier?this.remoteUserConfiguration.freeze().getOverrideValue(e,t.overrideIdentifier):void 0}:void 0,workspace:void 0!==c?{value:this._workspaceConfiguration.freeze().getValue(e),override:t.overrideIdentifier?this._workspaceConfiguration.freeze().getOverrideValue(e,t.overrideIdentifier):void 0}:void 0,workspaceFolder:void 0!==h?{value:null==o?void 0:o.freeze().getValue(e),override:t.overrideIdentifier?null==o?void 0:o.freeze().getOverrideValue(e,t.overrideIdentifier):void 0}:void 0,memory:void 0!==u?{value:s.getValue(e),override:t.overrideIdentifier?s.getOverrideValue(e,t.overrideIdentifier):void 0}:void 0,overrideIdentifiers:p.length?p:void 0}}get userConfiguration(){return this._userConfiguration||(this._userConfiguration=this._remoteUserConfiguration.isEmpty()?this._localUserConfiguration:this._localUserConfiguration.merge(this._remoteUserConfiguration),this._freeze&&this._userConfiguration.freeze()),this._userConfiguration}get localUserConfiguration(){return this._localUserConfiguration}get remoteUserConfiguration(){return this._remoteUserConfiguration}getConsolidateConfigurationModel(e,t){let i=this.getConsolidatedConfigurationModelForResource(e,t);return e.overrideIdentifier?i.override(e.overrideIdentifier):i}getConsolidatedConfigurationModelForResource({resource:e},t){let i=this.getWorkspaceConsolidatedConfiguration();if(t&&e){const n=t.getFolder(e);n&&(i=this.getFolderConsolidatedConfiguration(n.uri)||i);const o=this._memoryConfigurationByResource.get(e);o&&(i=i.merge(o))}return i}getWorkspaceConsolidatedConfiguration(){return this._workspaceConsolidatedConfiguration||(this._workspaceConsolidatedConfiguration=this._defaultConfiguration.merge(this.userConfiguration,this._workspaceConfiguration,this._memoryConfiguration),this._freeze&&(this._workspaceConfiguration=this._workspaceConfiguration.freeze())),this._workspaceConsolidatedConfiguration}getFolderConsolidatedConfiguration(e){let t=this._foldersConsolidatedConfigurations.get(e);if(!t){const i=this.getWorkspaceConsolidatedConfiguration(),n=this._folderConfigurations.get(e);n?(t=i.merge(n),this._freeze&&(t=t.freeze()),this._foldersConsolidatedConfigurations.set(e,t)):t=i}return t}getFolderConfigurationModelForResource(e,t){if(t&&e){const i=t.getFolder(e);if(i)return this._folderConfigurations.get(i.uri)}}toData(){return{defaults:{contents:this._defaultConfiguration.contents,overrides:this._defaultConfiguration.overrides,keys:this._defaultConfiguration.keys},user:{contents:this.userConfiguration.contents,overrides:this.userConfiguration.overrides,keys:this.userConfiguration.keys},workspace:{contents:this._workspaceConfiguration.contents,overrides:this._workspaceConfiguration.overrides,keys:this._workspaceConfiguration.keys},folders:[...this._folderConfigurations.keys()].reduce(((e,t)=>{const{contents:i,overrides:n,keys:o}=this._folderConfigurations.get(t);return e.push([t,{contents:i,overrides:n,keys:o}]),e}),[])}}static parse(e){const t=this.parseConfigurationModel(e.defaults),i=this.parseConfigurationModel(e.user),n=this.parseConfigurationModel(e.workspace),o=e.folders.reduce(((e,t)=>(e.set(Ps.revive(t[0]),this.parseConfigurationModel(t[1])),e)),new YV);return new wW(t,i,new vW,n,o,new vW,new YV,!1)}static parseConfigurationModel(e){return new vW(e.contents,e.keys,e.overrides).freeze()}}class CW{constructor(e,t,i,n){this.change=e,this.previous=t,this.currentConfiguraiton=i,this.currentWorkspace=n,this._previousConfiguration=void 0;const o=new Set;e.keys.forEach((e=>o.add(e))),e.overrides.forEach((([,e])=>e.forEach((e=>o.add(e))))),this.affectedKeys=[...o.values()];const s=new vW;this.affectedKeys.forEach((e=>s.setValue(e,{}))),this.affectedKeysTree=s.contents}get previousConfiguration(){return!this._previousConfiguration&&this.previous&&(this._previousConfiguration=wW.parse(this.previous.data)),this._previousConfiguration}affectsConfiguration(e,t){var i;if(this.doesAffectedKeysTreeContains(this.affectedKeysTree,e)){if(t){const n=this.previousConfiguration?this.previousConfiguration.getValue(e,t,null===(i=this.previous)||void 0===i?void 0:i.workspace):void 0,o=this.currentConfiguraiton.getValue(e,t,this.currentWorkspace);return!Ho(n,o)}return!0}return!1}doesAffectedKeysTreeContains(e,t){let i,n=yv({[t]:!0},(()=>{}));for(;"object"==typeof n&&(i=Object.keys(n)[0]);){if(!(e=e[i]))return!1;n=n[i]}return!0}}const yW=/^(cursor|delete)/;class xW extends Uo{constructor(e,t,i,n,o){super(),this._contextKeyService=e,this._commandService=t,this._telemetryService=i,this._notificationService=n,this._logService=o,this._onDidUpdateKeybindings=this._register(new $o),this._currentChord=null,this._currentChordChecker=new ab,this._currentChordStatusMessage=null,this._ignoreSingleModifiers=SW.EMPTY,this._currentSingleModifier=null,this._currentSingleModifierClearTimeout=new rb,this._logging=!1}get onDidUpdateKeybindings(){return this._onDidUpdateKeybindings?this._onDidUpdateKeybindings.event:ds.None}dispose(){super.dispose()}_log(e){this._logging&&this._logService.info(`[KeybindingService]: ${e}`)}getKeybindings(){return this._getResolver().getKeybindings()}lookupKeybinding(e,t){const i=this._getResolver().lookupPrimaryKeybinding(e,t||this._contextKeyService);if(i)return i.resolvedKeybinding}dispatchEvent(e,t){return this._dispatch(e,t)}softDispatch(e,t){const i=this.resolveKeyboardEvent(e);if(i.isChord())return null;const[n]=i.getDispatchParts();if(null===n)return null;const o=this._contextKeyService.getContext(t),s=this._currentChord?this._currentChord.keypress:null;return this._getResolver().resolve(o,s,n)}_enterChordMode(e,t){this._currentChord={keypress:e,label:t},this._currentChordStatusMessage=this._notificationService.status(mf(0,"({0}) was pressed. Waiting for second key of chord...",t));const i=Date.now();this._currentChordChecker.cancelAndSet((()=>{this._documentHasFocus()?Date.now()-i>5e3&&this._leaveChordMode():this._leaveChordMode()}),500)}_leaveChordMode(){this._currentChordStatusMessage&&(this._currentChordStatusMessage.dispose(),this._currentChordStatusMessage=null),this._currentChordChecker.cancel(),this._currentChord=null}_dispatch(e,t){return this._doDispatch(this.resolveKeyboardEvent(e),t,!1)}_singleModifierDispatch(e,t){const i=this.resolveKeyboardEvent(e),[n]=i.getSingleModifierDispatchParts();if(n)return this._ignoreSingleModifiers.has(n)?(this._log(`+ Ignoring single modifier ${n} due to it being pressed together with other keys.`),this._ignoreSingleModifiers=SW.EMPTY,this._currentSingleModifierClearTimeout.cancel(),this._currentSingleModifier=null,!1):(this._ignoreSingleModifiers=SW.EMPTY,null===this._currentSingleModifier?(this._log(`+ Storing single modifier for possible chord ${n}.`),this._currentSingleModifier=n,this._currentSingleModifierClearTimeout.cancelAndSet((()=>{this._log("+ Clearing single modifier due to 300ms elapsed."),this._currentSingleModifier=null}),300),!1):n===this._currentSingleModifier?(this._log(`/ Dispatching single modifier chord ${n} ${n}`),this._currentSingleModifierClearTimeout.cancel(),this._currentSingleModifier=null,this._doDispatch(i,t,!0)):(this._log(`+ Clearing single modifier due to modifier mismatch: ${this._currentSingleModifier} ${n}`),this._currentSingleModifierClearTimeout.cancel(),this._currentSingleModifier=null,!1));const[o]=i.getParts();return this._ignoreSingleModifiers=new SW(o),null!==this._currentSingleModifier&&this._log("+ Clearing single modifier due to other key up."),this._currentSingleModifierClearTimeout.cancel(),this._currentSingleModifier=null,!1}_doDispatch(e,t,i=!1){let n=!1;if(e.isChord())return!1;let o=null,s=null;if(i){const[t]=e.getSingleModifierDispatchParts();o=t,s=t}else[o]=e.getDispatchParts(),s=this._currentChord?this._currentChord.keypress:null;if(null===o)return this._log("\\ Keyboard event cannot be dispatched in keydown phase."),n;const r=this._contextKeyService.getContext(t),a=e.getLabel(),l=this._getResolver().resolve(r,s,o);return this._logService.trace("KeybindingService#dispatch",a,null==l?void 0:l.commandId),l&&l.enterChord?(n=!0,this._enterChordMode(o,a),n):(this._currentChord&&(l&&l.commandId||(this._notificationService.status(mf(0,"The key combination ({0}, {1}) is not a command.",this._currentChord.label,a),{hideAfter:1e4}),n=!0)),this._leaveChordMode(),l&&l.commandId&&(l.bubble||(n=!0),void 0===l.commandArgs?this._commandService.executeCommand(l.commandId).then(void 0,(e=>this._notificationService.warn(e))):this._commandService.executeCommand(l.commandId,l.commandArgs).then(void 0,(e=>this._notificationService.warn(e))),yW.test(l.commandId)||this._telemetryService.publicLog2("workbenchActionExecuted",{id:l.commandId,from:"keybinding"})),n)}mightProducePrintableCharacter(e){return!e.ctrlKey&&!e.metaKey&&(e.keyCode>=31&&e.keyCode<=56||e.keyCode>=21&&e.keyCode<=30)}}class SW{constructor(e){this._ctrlKey=!!e&&e.ctrlKey,this._shiftKey=!!e&&e.shiftKey,this._altKey=!!e&&e.altKey,this._metaKey=!!e&&e.metaKey}has(e){switch(e){case"ctrl":return this._ctrlKey;case"shift":return this._shiftKey;case"alt":return this._altKey;case"meta":return this._metaKey}}}SW.EMPTY=new SW(null);const kW=L_("keybindingService");class DW{constructor(e,t,i){this._log=i,this._defaultKeybindings=e,this._defaultBoundCommands=new Map;for(const n of e){const e=n.command;e&&"-"!==e.charAt(0)&&this._defaultBoundCommands.set(e,!0)}this._map=new Map,this._lookupMap=new Map,this._keybindings=DW.handleRemovals([].concat(e).concat(t));for(let n=0,o=this._keybindings.length;n<o;n++){let e=this._keybindings[n];0!==e.keypressParts.length&&(e.when&&0===e.when.type||this._addKeyPress(e.keypressParts[0],e))}}static _isTargetedForRemoval(e,t,i,n){if(t&&e.keypressParts[0]!==t)return!1;if(i&&e.keypressParts[1]!==i)return!1;if(n){if(!e.when)return!1;if(!function(e,t){const i=e?e.substituteConstants():void 0,n=t?t.substituteConstants():void 0;return!i&&!n||!(!i||!n)&&i.equals(n)}(n,e.when))return!1}return!0}static handleRemovals(e){const t=new Map;for(let n=0,o=e.length;n<o;n++){const i=e[n];if(i.command&&"-"===i.command.charAt(0)){const e=i.command.substring(1);t.has(e)?t.get(e).push(i):t.set(e,[i])}}if(0===t.size)return e;const i=[];for(let n=0,o=e.length;n<o;n++){const o=e[n];if(!o.command||0===o.command.length){i.push(o);continue}if("-"===o.command.charAt(0))continue;const s=t.get(o.command);if(!s||!o.isDefault){i.push(o);continue}let r=!1;for(const e of s){const t=e.keypressParts[0],i=e.keypressParts[1],n=e.when;if(this._isTargetedForRemoval(o,t,i,n)){r=!0;break}}r||i.push(o)}return i}_addKeyPress(e,t){const i=this._map.get(e);if(void 0===i)return this._map.set(e,[t]),void this._addToLookupMap(t);for(let n=i.length-1;n>=0;n--){let e=i[n];if(e.command===t.command)continue;const o=e.keypressParts.length>1,s=t.keypressParts.length>1;o&&s&&e.keypressParts[1]!==t.keypressParts[1]||DW.whenIsEntirelyIncluded(e.when,t.when)&&this._removeFromLookupMap(e)}i.push(t),this._addToLookupMap(t)}_addToLookupMap(e){if(!e.command)return;let t=this._lookupMap.get(e.command);void 0===t?(t=[e],this._lookupMap.set(e.command,t)):t.push(e)}_removeFromLookupMap(e){if(!e.command)return;let t=this._lookupMap.get(e.command);if(void 0!==t)for(let i=0,n=t.length;i<n;i++)if(t[i]===e)return void t.splice(i,1)}static whenIsEntirelyIncluded(e,t){return!t||1===t.type||!(!e||1===e.type)&&Gy(e,t)}getKeybindings(){return this._keybindings}lookupPrimaryKeybinding(e,t){const i=this._lookupMap.get(e);if(void 0===i||0===i.length)return null;if(1===i.length)return i[0];for(let n=i.length-1;n>=0;n--){const e=i[n];if(t.contextMatchesRules(e.when))return e}return i[i.length-1]}resolve(e,t,i){this._log(`| Resolving ${i}${t?` chorded from ${t}`:""}`);let n=null;if(null!==t){const e=this._map.get(t);if(void 0===e)return this._log("\\ No keybinding entries."),null;n=[];for(let t=0,o=e.length;t<o;t++){let o=e[t];o.keypressParts[1]===i&&n.push(o)}}else{const e=this._map.get(i);if(void 0===e)return this._log("\\ No keybinding entries."),null;n=e}let o=this._findCommand(e,n);return o?null===t&&o.keypressParts.length>1&&null!==o.keypressParts[1]?(this._log(`\\ From ${n.length} keybinding entries, matched chord, when: ${LW(o.when)}, source: ${NW(o)}.`),{enterChord:!0,leaveChord:!1,commandId:null,commandArgs:null,bubble:!1}):(this._log(`\\ From ${n.length} keybinding entries, matched ${o.command}, when: ${LW(o.when)}, source: ${NW(o)}.`),{enterChord:!1,leaveChord:o.keypressParts.length>1,commandId:o.command,commandArgs:o.commandArgs,bubble:o.bubble}):(this._log(`\\ From ${n.length} keybinding entries, no when clauses matched the context.`),null)}_findCommand(e,t){for(let i=t.length-1;i>=0;i--){let n=t[i];if(DW._contextMatchesRules(e,n.when))return n}return null}static _contextMatchesRules(e,t){return!t||t.evaluate(e)}}function LW(e){return e?`${e.serialize()}`:"no when condition"}function NW(e){return e.extensionId?e.isBuiltinExtension?`built-in extension ${e.extensionId}`:`user extension ${e.extensionId}`:e.isDefault?"built-in":"user"}class EW{constructor(e,t,i,n,o,s,r){this._resolvedKeybindingItemBrand=void 0,this.resolvedKeybinding=e,this.keypressParts=e?IW(e.getDispatchParts()):[],e&&0===this.keypressParts.length&&(this.keypressParts=IW(e.getSingleModifierDispatchParts())),this.bubble=!!t&&94===t.charCodeAt(0),this.command=this.bubble?t.substr(1):t,this.commandArgs=i,this.when=n,this.isDefault=o,this.extensionId=s,this.isBuiltinExtension=r}}function IW(e){let t=[];for(let i=0,n=e.length;i<n;i++){const n=e[i];if(!n)return t;t.push(n)}return t}class TW{constructor(e,t,i=t){this.modifierLabels=[null],this.modifierLabels[2]=e,this.modifierLabels[1]=t,this.modifierLabels[3]=i}toLabel(e,t,i){if(0===t.length)return null;const n=[];for(let o=0,s=t.length;o<s;o++){const s=t[o],r=i(s);if(null===r)return null;n[o]=RW(s,r,this.modifierLabels[e])}return n.join(" ")}}const MW=new TW({ctrlKey:"⌃",shiftKey:"⇧",altKey:"⌥",metaKey:"⌘",separator:""},{ctrlKey:mf(0,"Ctrl"),shiftKey:mf(0,"Shift"),altKey:mf(0,"Alt"),metaKey:mf(0,"Windows"),separator:"+"},{ctrlKey:mf(0,"Ctrl"),shiftKey:mf(0,"Shift"),altKey:mf(0,"Alt"),metaKey:mf(0,"Super"),separator:"+"}),AW=new TW({ctrlKey:mf(0,"Control"),shiftKey:mf(0,"Shift"),altKey:mf(0,"Option"),metaKey:mf(0,"Command"),separator:"+"},{ctrlKey:mf(0,"Control"),shiftKey:mf(0,"Shift"),altKey:mf(0,"Alt"),metaKey:mf(0,"Windows"),separator:"+"},{ctrlKey:mf(0,"Control"),shiftKey:mf(0,"Shift"),altKey:mf(0,"Alt"),metaKey:mf(0,"Super"),separator:"+"}),OW=new TW({ctrlKey:"Ctrl",shiftKey:"Shift",altKey:"Alt",metaKey:"Cmd",separator:"+"},{ctrlKey:"Ctrl",shiftKey:"Shift",altKey:"Alt",metaKey:"Super",separator:"+"});function RW(e,t,i){if(null===t)return"";const n=[];return e.ctrlKey&&n.push(i.ctrlKey),e.shiftKey&&n.push(i.shiftKey),e.altKey&&n.push(i.altKey),e.metaKey&&n.push(i.metaKey),""!==t&&n.push(t),n.join(i.separator)}new TW({ctrlKey:"ctrl",shiftKey:"shift",altKey:"alt",metaKey:"cmd",separator:"+"},{ctrlKey:"ctrl",shiftKey:"shift",altKey:"alt",metaKey:"win",separator:"+"},{ctrlKey:"ctrl",shiftKey:"shift",altKey:"alt",metaKey:"meta",separator:"+"});class PW extends class extends class{}{constructor(e,t){if(super(),0===t.length)throw Ms("parts");this._os=e,this._parts=t}getLabel(){return MW.toLabel(this._os,this._parts,(e=>this._getLabel(e)))}getAriaLabel(){return AW.toLabel(this._os,this._parts,(e=>this._getAriaLabel(e)))}getElectronAccelerator(){return this._parts.length>1||this._parts[0].isDuplicateModifierCase()?null:OW.toLabel(this._os,this._parts,(e=>this._getElectronAccelerator(e)))}isChord(){return this._parts.length>1}getParts(){return this._parts.map((e=>this._getPart(e)))}_getPart(e){return new Ww(e.ctrlKey,e.shiftKey,e.altKey,e.metaKey,this._getLabel(e),this._getAriaLabel(e))}getDispatchParts(){return this._parts.map((e=>this._getDispatchPart(e)))}getSingleModifierDispatchParts(){return this._parts.map((e=>this._getSingleModifierDispatchPart(e)))}}{constructor(e,t){super(t,e.parts)}_keyCodeToUILabel(e){if(2===this._os)switch(e){case 15:return"←";case 16:return"↑";case 17:return"→";case 18:return"↓"}return As.toString(e)}_getLabel(e){return e.isDuplicateModifierCase()?"":this._keyCodeToUILabel(e.keyCode)}_getAriaLabel(e){return e.isDuplicateModifierCase()?"":As.toString(e.keyCode)}_getElectronAccelerator(e){return As.toElectronAccelerator(e.keyCode)}_getDispatchPart(e){return PW.getDispatchStr(e)}static getDispatchStr(e){if(e.isModifierKey())return null;let t="";return e.ctrlKey&&(t+="ctrl+"),e.shiftKey&&(t+="shift+"),e.altKey&&(t+="alt+"),e.metaKey&&(t+="meta+"),t+=As.toString(e.keyCode),t}_getSingleModifierDispatchPart(e){return 5!==e.keyCode||e.shiftKey||e.altKey||e.metaKey?4!==e.keyCode||e.ctrlKey||e.altKey||e.metaKey?6!==e.keyCode||e.ctrlKey||e.shiftKey||e.metaKey?57!==e.keyCode||e.ctrlKey||e.shiftKey||e.altKey?null:"meta":"alt":"shift":"ctrl"}static _scanCodeToKeyCode(e){const t=wa[e];if(-1!==t)return t;switch(e){case 10:return 31;case 11:return 32;case 12:return 33;case 13:return 34;case 14:return 35;case 15:return 36;case 16:return 37;case 17:return 38;case 18:return 39;case 19:return 40;case 20:return 41;case 21:return 42;case 22:return 43;case 23:return 44;case 24:return 45;case 25:return 46;case 26:return 47;case 27:return 48;case 28:return 49;case 29:return 50;case 30:return 51;case 31:return 52;case 32:return 53;case 33:return 54;case 34:return 55;case 35:return 56;case 36:return 22;case 37:return 23;case 38:return 24;case 39:return 25;case 40:return 26;case 41:return 27;case 42:return 28;case 43:return 29;case 44:return 30;case 45:return 21;case 51:return 83;case 52:return 81;case 53:return 87;case 54:return 89;case 55:return 88;case 56:return 0;case 57:return 80;case 58:return 90;case 59:return 86;case 60:return 82;case 61:return 84;case 62:return 85;case 106:return 92}return 0}static _resolveSimpleUserBinding(e){if(!e)return null;if(e instanceof Bw)return e;const t=this._scanCodeToKeyCode(e.scanCode);return 0===t?null:new Bw(e.ctrlKey,e.shiftKey,e.altKey,e.metaKey,t)}static resolveUserBinding(e,t){const i=IW(e.map((e=>this._resolveSimpleUserBinding(e))));return i.length>0?[new PW(new Vw(i),t)]:[]}}const FW=L_("labelService"),BW=L_("contextService");function VW(e){const t=e;return"string"==typeof(null==t?void 0:t.id)&&Ps.isUri(t.uri)}class WW{constructor(e,t){this.raw=t,this.uri=e.uri,this.index=e.index,this.name=e.name}toJSON(){return{uri:this.uri,name:this.name,index:this.index}}}const zW="code-workspace";var HW,jW,UW,$W,KW,qW,GW,ZW,YW;mf(0,"Code Workspace"),function(e){e.noSelection=mf(0,"No selection"),e.singleSelectionRange=mf(0,"Line {0}, Column {1} ({2} selected)"),e.singleSelection=mf(0,"Line {0}, Column {1}"),e.multiSelectionRange=mf(0,"{0} selections ({1} characters selected)"),e.multiSelection=mf(0,"{0} selections"),e.emergencyConfOn=mf(0,"Now changing the setting `accessibilitySupport` to 'on'."),e.openingDocs=mf(0,"Now opening the Editor Accessibility documentation page."),e.readonlyDiffEditor=mf(0," in a read-only pane of a diff editor."),e.editableDiffEditor=mf(0," in a pane of a diff editor."),e.readonlyEditor=mf(0," in a read-only code editor"),e.editableEditor=mf(0," in a code editor"),e.changeConfigToOnMac=mf(0,"To configure the editor to be optimized for usage with a Screen Reader press Command+E now."),e.changeConfigToOnWinLinux=mf(0,"To configure the editor to be optimized for usage with a Screen Reader press Control+E now."),e.auto_on=mf(0,"The editor is configured to be optimized for usage with a Screen Reader."),e.auto_off=mf(0,"The editor is configured to never be optimized for usage with a Screen Reader, which is not the case at this time."),e.tabFocusModeOnMsg=mf(0,"Pressing Tab in the current editor will move focus to the next focusable element. Toggle this behavior by pressing {0}."),e.tabFocusModeOnMsgNoKb=mf(0,"Pressing Tab in the current editor will move focus to the next focusable element. The command {0} is currently not triggerable by a keybinding."),e.tabFocusModeOffMsg=mf(0,"Pressing Tab in the current editor will insert the tab character. Toggle this behavior by pressing {0}."),e.tabFocusModeOffMsgNoKb=mf(0,"Pressing Tab in the current editor will insert the tab character. The command {0} is currently not triggerable by a keybinding."),e.openDocMac=mf(0,"Press Command+H now to open a browser window with more information related to editor accessibility."),e.openDocWinLinux=mf(0,"Press Control+H now to open a browser window with more information related to editor accessibility."),e.outroMsg=mf(0,"You can dismiss this tooltip and return to the editor by pressing Escape or Shift+Escape."),e.showAccessibilityHelpAction=mf(0,"Show Accessibility Help")}(HW||(HW={})),function(e){e.inspectTokensAction=mf(0,"Developer: Inspect Tokens")}(jW||(jW={})),function(e){e.gotoLineActionLabel=mf(0,"Go to Line/Column...")}(UW||(UW={})),function(e){e.helpQuickAccessActionLabel=mf(0,"Show all Quick Access Providers")}($W||($W={})),function(e){e.quickCommandActionLabel=mf(0,"Command Palette"),e.quickCommandHelp=mf(0,"Show And Run Commands")}(KW||(KW={})),function(e){e.quickOutlineActionLabel=mf(0,"Go to Symbol..."),e.quickOutlineByCategoryActionLabel=mf(0,"Go to Symbol by Category...")}(qW||(qW={})),function(e){e.editorViewAccessibleLabel=mf(0,"Editor content"),e.accessibilityHelpMessage=mf(0,"Press Alt+F1 for Accessibility Options.")}(GW||(GW={})),function(e){e.toggleHighContrast=mf(0,"Toggle High Contrast Theme")}(ZW||(ZW={})),function(e){e.bulkEditServiceSummary=mf(0,"Made {0} edits in {1} files")}(YW||(YW={}));const XW=L_("workspaceTrustManagementService");var QW;!function(e){function t(e,t){if(e.start>=t.end||t.start>=e.end)return{start:0,end:0};const i=Math.max(e.start,t.start),n=Math.min(e.end,t.end);return n-i<=0?{start:0,end:0}:{start:i,end:n}}function i(e){return e.end-e.start<=0}e.intersect=t,e.isEmpty=i,e.intersects=function(e,n){return!i(t(e,n))},e.relativeComplement=function(e,t){const n=[],o={start:e.start,end:Math.min(t.start,e.end)},s={start:Math.max(t.end,e.start),end:e.end};return i(o)||n.push(o),i(s)||n.push(s),n}}(QW||(QW={}));var JW;function ez(e,t,i){const n=i.mode===JW.ALIGN?i.offset:i.offset+i.size,o=i.mode===JW.ALIGN?i.offset+i.size:i.offset;return 0===i.position?t<=e-n?n:t<=o?o-t:Math.max(e-t,0):t<=o?o-t:t<=e-n?n:0}!function(e){e[e.AVOID=0]="AVOID",e[e.ALIGN=1]="ALIGN"}(JW||(JW={}));class tz extends Uo{constructor(e,t){super(),this.container=null,this.delegate=null,this.toDisposeOnClean=Uo.None,this.toDisposeOnSetContainer=Uo.None,this.shadowRoot=null,this.shadowRootHostElement=null,this.view=YC(".context-view"),this.useFixedPosition=!1,this.useShadowDOM=!1,QC(this.view),this.setContainer(e,t),this._register(es((()=>this.setContainer(null,1))))}setContainer(e,t){var i;if(this.container&&(this.toDisposeOnSetContainer.dispose(),this.shadowRoot?(this.shadowRoot.removeChild(this.view),this.shadowRoot=null,null===(i=this.shadowRootHostElement)||void 0===i||i.remove(),this.shadowRootHostElement=null):this.container.removeChild(this.view),this.container=null),e){if(this.container=e,this.useFixedPosition=1!==t,this.useShadowDOM=3===t,this.useShadowDOM){this.shadowRootHostElement=YC(".shadow-root-host"),this.container.appendChild(this.shadowRootHostElement),this.shadowRoot=this.shadowRootHostElement.attachShadow({mode:"open"});const e=document.createElement("style");e.textContent=iz,this.shadowRoot.appendChild(e),this.shadowRoot.appendChild(this.view),this.shadowRoot.appendChild(YC("slot"))}else this.container.appendChild(this.view);const i=new ws;tz.BUBBLE_UP_EVENTS.forEach((e=>{i.add(sC(this.container,e,(e=>{this.onDOMEvent(e,!1)})))})),tz.BUBBLE_DOWN_EVENTS.forEach((e=>{i.add(sC(this.container,e,(e=>{this.onDOMEvent(e,!0)}),!0))})),this.toDisposeOnSetContainer=i}}show(e){this.isVisible()&&this.hide(),eC(this.view),this.view.className="context-view",this.view.style.top="0px",this.view.style.left="0px",this.view.style.zIndex="2500",this.view.style.position=this.useFixedPosition?"fixed":"absolute",XC(this.view),this.toDisposeOnClean=e.render(this.view)||Uo.None,this.delegate=e,this.doLayout(),this.delegate.focus&&this.delegate.focus()}getViewElement(){return this.view}layout(){this.isVisible()&&(!1!==this.delegate.canRelayout||Vs&&Rw?(this.delegate.layout&&this.delegate.layout(),this.doLayout()):this.hide())}doLayout(){if(!this.isVisible())return;let e,t=this.delegate.getAnchor();if(WC(t)){let i=yC(t);e={top:i.top,left:i.left,width:i.width,height:i.height}}else e={top:t.y,left:t.x,width:t.width||1,height:t.height||2};const i=SC(this.view),n=LC(this.view),o=this.delegate.anchorPosition||0,s=this.delegate.anchorAlignment||0;let r,a;if(0===(this.delegate.anchorAxisAlignment||0)){const t={offset:e.top-window.pageYOffset,size:e.height,position:0===o?0:1},l={offset:e.left,size:e.width,position:0===s?0:1,mode:JW.ALIGN};r=ez(window.innerHeight,n,t)+window.pageYOffset,QW.intersects({start:r,end:r+n},{start:t.offset,end:t.offset+t.size})&&(l.mode=JW.AVOID),a=ez(window.innerWidth,i,l)}else{const t={offset:e.left,size:e.width,position:0===s?0:1},l={offset:e.top,size:e.height,position:0===o?0:1,mode:JW.ALIGN};a=ez(window.innerWidth,i,t),QW.intersects({start:a,end:a+i},{start:t.offset,end:t.offset+t.size})&&(l.mode=JW.AVOID),r=ez(window.innerHeight,n,l)+window.pageYOffset}this.view.classList.remove("top","bottom","left","right"),this.view.classList.add(0===o?"bottom":"top"),this.view.classList.add(0===s?"left":"right"),this.view.classList.toggle("fixed",this.useFixedPosition);const l=yC(this.container);this.view.style.top=r-(this.useFixedPosition?yC(this.view).top:l.top)+"px",this.view.style.left=a-(this.useFixedPosition?yC(this.view).left:l.left)+"px",this.view.style.width="initial"}hide(e){const t=this.delegate;this.delegate=null,(null==t?void 0:t.onHide)&&t.onHide(e),this.toDisposeOnClean.dispose(),QC(this.view)}isVisible(){return!!this.delegate}onDOMEvent(e,t){this.delegate&&(this.delegate.onDOMEvent?this.delegate.onDOMEvent(e,document.activeElement):t&&!NC(e.target,this.container)&&this.hide())}dispose(){this.hide(),super.dispose()}}tz.BUBBLE_UP_EVENTS=["click","keydown","focus","blur"],tz.BUBBLE_DOWN_EVENTS=["click"];let iz='\n\t:host {\n\t\tall: initial; /* 1st rule so subsequent properties are reset. */\n\t}\n\n\t@font-face {\n\t\tfont-family: "codicon";\n\t\tfont-display: block;\n\t\tsrc: url("./codicon.ttf?5d4d76ab2ce5108968ad644d591a16a6") format("truetype");\n\t}\n\n\t.codicon[class*=\'codicon-\'] {\n\t\tfont: normal normal normal 16px/1 codicon;\n\t\tdisplay: inline-block;\n\t\ttext-decoration: none;\n\t\ttext-rendering: auto;\n\t\ttext-align: center;\n\t\t-webkit-font-smoothing: antialiased;\n\t\t-moz-osx-font-smoothing: grayscale;\n\t\tuser-select: none;\n\t\t-webkit-user-select: none;\n\t\t-ms-user-select: none;\n\t}\n\n\t:host {\n\t\tfont-family: -apple-system, BlinkMacSystemFont, "Segoe WPC", "Segoe UI", "HelveticaNeue-Light", system-ui, "Ubuntu", "Droid Sans", sans-serif;\n\t}\n\n\t:host-context(.mac) { font-family: -apple-system, BlinkMacSystemFont, sans-serif; }\n\t:host-context(.mac:lang(zh-Hans)) { font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", sans-serif; }\n\t:host-context(.mac:lang(zh-Hant)) { font-family: -apple-system, BlinkMacSystemFont, "PingFang TC", sans-serif; }\n\t:host-context(.mac:lang(ja)) { font-family: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic Pro", sans-serif; }\n\t:host-context(.mac:lang(ko)) { font-family: -apple-system, BlinkMacSystemFont, "Nanum Gothic", "Apple SD Gothic Neo", "AppleGothic", sans-serif; }\n\n\t:host-context(.windows) { font-family: "Segoe WPC", "Segoe UI", sans-serif; }\n\t:host-context(.windows:lang(zh-Hans)) { font-family: "Segoe WPC", "Segoe UI", "Microsoft YaHei", sans-serif; }\n\t:host-context(.windows:lang(zh-Hant)) { font-family: "Segoe WPC", "Segoe UI", "Microsoft Jhenghei", sans-serif; }\n\t:host-context(.windows:lang(ja)) { font-family: "Segoe WPC", "Segoe UI", "Yu Gothic UI", "Meiryo UI", sans-serif; }\n\t:host-context(.windows:lang(ko)) { font-family: "Segoe WPC", "Segoe UI", "Malgun Gothic", "Dotom", sans-serif; }\n\n\t:host-context(.linux) { font-family: system-ui, "Ubuntu", "Droid Sans", sans-serif; }\n\t:host-context(.linux:lang(zh-Hans)) { font-family: system-ui, "Ubuntu", "Droid Sans", "Source Han Sans SC", "Source Han Sans CN", "Source Han Sans", sans-serif; }\n\t:host-context(.linux:lang(zh-Hant)) { font-family: system-ui, "Ubuntu", "Droid Sans", "Source Han Sans TC", "Source Han Sans TW", "Source Han Sans", sans-serif; }\n\t:host-context(.linux:lang(ja)) { font-family: system-ui, "Ubuntu", "Droid Sans", "Source Han Sans J", "Source Han Sans JP", "Source Han Sans", sans-serif; }\n\t:host-context(.linux:lang(ko)) { font-family: system-ui, "Ubuntu", "Droid Sans", "Source Han Sans K", "Source Han Sans JR", "Source Han Sans", "UnDotum", "FBaekmuk Gulim", sans-serif; }\n';var nz=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},oz=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};let sz=class extends Uo{constructor(e){super(),this.layoutService=e,this.currentViewDisposable=Uo.None,this.container=e.hasContainer?e.container:null,this.contextView=this._register(new tz(this.container,1)),this.layout(),this._register(e.onDidLayout((()=>this.layout())))}setContainer(e,t){this.contextView.setContainer(e,t||1)}showContextView(e,t,i){t?t!==this.container&&(this.container=t,this.setContainer(t,i?3:2)):this.layoutService.hasContainer&&this.container!==this.layoutService.container&&(this.container=this.layoutService.container,this.setContainer(this.container,1)),this.contextView.show(e);const n=es((()=>{this.currentViewDisposable===n&&this.hideContextView()}));return this.currentViewDisposable=n,n}getContextViewElement(){return this.contextView.getViewElement()}layout(){this.contextView.layout()}hideContextView(e){this.contextView.hide(e)}};sz=nz([oz(0,CV)],sz);const rz="**",az="[/\\\\]",lz="[^/\\\\]",dz=/\//g;function cz(e){switch(e){case 0:return"";case 1:return"[^/\\\\]*?";default:return"(?:[/\\\\]|[^/\\\\]+[/\\\\]|[/\\\\][^/\\\\]+)*?"}}function hz(e,t){if(!e)return[];const i=[];let n=!1,o=!1,s="";for(const r of e){switch(r){case t:if(!n&&!o){i.push(s),s="";continue}break;case"{":n=!0;break;case"}":n=!1;break;case"[":o=!0;break;case"]":o=!1}s+=r}return s&&i.push(s),i}function uz(e){if(!e)return"";let t="";const i=hz(e,"/");if(i.every((e=>e===rz)))t=".*";else{let e=!1;i.forEach(((n,o)=>{if(n===rz)return void(e||(t+=cz(2),e=!0));let s=!1,r="",a=!1,l="";for(const e of n)if("}"!==e&&s)r+=e;else if(!a||"]"===e&&l)switch(e){case"{":s=!0;continue;case"[":a=!0;continue;case"}":{const e=`(?:${hz(r,",").map((e=>uz(e))).join("|")})`;t+=e,s=!1,r="";break}case"]":t+="["+l+"]",a=!1,l="";break;case"?":t+=lz;continue;case"*":t+=cz(1);continue;default:t+=Xo(e)}else{let t;t="-"===e?e:"^"!==e&&"!"!==e||l?"/"===e?"":Xo(e):"^",l+=t}o<i.length-1&&(i[o+1]!==rz||o+2<i.length)&&(t+=az),e=!1}))}return t}const gz=/^\*\*\/\*\.[\w\.-]+$/,pz=/^\*\*\/([\w\.-]+)\/?$/,mz=/^{\*\*\/\*?[\w\.-]+\/?(,\*\*\/\*?[\w\.-]+\/?)*}$/,fz=/^{\*\*\/\*?[\w\.-]+(\/(\*\*)?)?(,\*\*\/\*?[\w\.-]+(\/(\*\*)?)?)*}$/,_z=/^\*\*((\/[\w\.-]+)+)\/?$/,vz=/^([\w\.-]+(\/[\w\.-]+)*)\/?$/,bz=new QV(1e4),wz=function(){return!1},Cz=function(){return null};function yz(e,t){if(!e)return Cz;let i;i="string"!=typeof e?e.pattern:e,i=i.trim();const n=`${i}_${!!t.trimForExclusions}`;let o,s=bz.get(n);if(s)return xz(s,e);if(gz.test(i)){const e=i.substr(4);s=function(t,n){return"string"==typeof t&&t.endsWith(e)?i:null}}else s=(o=pz.exec(Sz(i,t)))?function(e,t){const i=`/${e}`,n=`\\${e}`,o=function(o,s){return"string"!=typeof o?null:s?s===e?t:null:o===e||o.endsWith(i)||o.endsWith(n)?t:null},s=[e];return o.basenames=s,o.patterns=[t],o.allBasenames=s,o}(o[1],i):(t.trimForExclusions?fz:mz).test(i)?function(e,t){const i=Lz(e.slice(1,-1).split(",").map((e=>yz(e,t))).filter((e=>e!==Cz)),e),n=i.length;if(!n)return Cz;if(1===n)return i[0];const o=function(t,n){for(let o=0,s=i.length;o<s;o++)if(i[o](t,n))return e;return null},s=i.find((e=>!!e.allBasenames));s&&(o.allBasenames=s.allBasenames);const r=i.reduce(((e,t)=>t.allPaths?e.concat(t.allPaths):e),[]);r.length&&(o.allPaths=r);return o}(i,t):(o=_z.exec(Sz(i,t)))?kz(o[1].substr(1),i,!0):(o=vz.exec(Sz(i,t)))?kz(o[1],i,!1):function(e){try{const t=new RegExp(`^${uz(e)}$`);return function(i){return t.lastIndex=0,"string"==typeof i&&t.test(i)?e:null}}catch(t){return Cz}}(i);return bz.set(n,s),xz(s,e)}function xz(e,t){return"string"==typeof t?e:function(i,n){return YO(i,t.base,!Vo)?e(i.substr(t.base.length+1),n):null}}function Sz(e,t){return t.trimForExclusions&&e.endsWith("/**")?e.substr(0,e.length-2):e}function kz(e,t,i){const n=Fr===Pr.sep,o=n?e:e.replace(dz,Fr),s=Fr+o,r=Pr.sep+e,a=i?function(i,a){return"string"!=typeof i||i!==o&&!i.endsWith(s)&&(n||i!==e&&!i.endsWith(r))?null:t}:function(i,s){return"string"!=typeof i||i!==o&&(n||i!==e)?null:t};return a.allPaths=[(i?"*/":"./")+e],a}function Dz(e,t={}){if(!e)return wz;if("string"==typeof e||function(e){const t=e;if(!t)return!1;return"string"==typeof t.base&&"string"==typeof t.pattern}(e)){const i=yz(e,t);if(i===Cz)return wz;const n=function(e,t){return!!i(e,t)};return i.allBasenames&&(n.allBasenames=i.allBasenames),i.allPaths&&(n.allPaths=i.allPaths),n}return function(e,t){const i=Lz(Object.getOwnPropertyNames(e).map((i=>function(e,t,i){if(!1===t)return Cz;const n=yz(e,i);if(n===Cz)return Cz;if("boolean"==typeof t)return n;if(t){const i=t.when;if("string"==typeof i){const t=(t,o,s,r)=>{if(!r||!n(t,o))return null;const a=r(i.replace("$(basename)",s));return(l=a)&&"function"==typeof l.then?a.then((t=>t?e:null)):a?e:null;var l};return t.requiresSiblings=!0,t}}return n}(i,e[i],t))).filter((e=>e!==Cz))),n=i.length;if(!n)return Cz;if(!i.some((e=>!!e.requiresSiblings))){if(1===n)return i[0];const e=function(e,t){for(let n=0,o=i.length;n<o;n++){const o=i[n](e,t);if(o)return o}return null},t=i.find((e=>!!e.allBasenames));t&&(e.allBasenames=t.allBasenames);const o=i.reduce(((e,t)=>t.allPaths?e.concat(t.allPaths):e),[]);return o.length&&(e.allPaths=o),e}const o=function(e,t,n){let o;for(let s=0,r=i.length;s<r;s++){const r=i[s];r.requiresSiblings&&n&&(t||(t=Ca(e)),o||(o=t.substr(0,t.length-ya(e).length)));const a=r(e,t,o,n);if(a)return a}return null},s=i.find((e=>!!e.allBasenames));s&&(o.allBasenames=s.allBasenames);const r=i.reduce(((e,t)=>t.allPaths?e.concat(t.allPaths):e),[]);r.length&&(o.allPaths=r);return o}(e,t)}function Lz(e,t){const i=e.filter((e=>!!e.basenames));if(i.length<2)return e;const n=i.reduce(((e,t)=>{const i=t.basenames;return i?e.concat(i):e}),[]);let o;if(t){o=[];for(let e=0,i=n.length;e<i;e++)o.push(t)}else o=i.reduce(((e,t)=>{const i=t.patterns;return i?e.concat(i):e}),[]);const s=function(e,t){if("string"!=typeof e)return null;if(!t){let i;for(i=e.length;i>0;i--){const t=e.charCodeAt(i-1);if(47===t||92===t)break}t=e.substr(i)}const i=n.indexOf(t);return-1!==i?o[i]:null};s.basenames=n,s.patterns=o,s.allBasenames=n;const r=e.filter((e=>!e.basenames));return r.push(s),r}let Nz=[],Ez=[],Iz=[];function Tz(e,t=!1){!function(e,t,i){const n=function(e,t){return{id:e.id,mime:e.mime,filename:e.filename,extension:e.extension,filepattern:e.filepattern,firstline:e.firstline,userConfigured:t,filenameLowercase:e.filename?e.filename.toLowerCase():void 0,extensionLowercase:e.extension?e.extension.toLowerCase():void 0,filepatternLowercase:e.filepattern?Dz(e.filepattern.toLowerCase()):void 0,filepatternOnPath:!!e.filepattern&&e.filepattern.indexOf(Pr.sep)>=0}}(e,t);Nz.push(n),n.userConfigured?Iz.push(n):Ez.push(n);i&&!n.userConfigured&&Nz.forEach((e=>{e.mime===n.mime||e.userConfigured||(n.extension&&(e.extension,n.extension),n.filename&&(e.filename,n.filename),n.filepattern&&(e.filepattern,n.filepattern),n.firstline&&(e.firstline,n.firstline))}))}(e,!1,t)}function Mz(e,t){let i;if(e)switch(e.scheme){case Yw.file:i=e.fsPath;break;case Yw.data:i=uR.parseMetaData(e).get(uR.META_DATA_LABEL);break;default:i=e.path}if(!i)return[LN.unknown];i=i.toLowerCase();const n=Ca(i),o=Az(i,n,Iz);if(o)return[o,LN.text];const s=Az(i,n,Ez);if(s)return[s,LN.text];if(t){const e=function(e){Es(e)&&(e=e.substr(1));if(e.length>0)for(let t=Nz.length-1;t>=0;t--){const i=Nz[t];if(!i.firstline)continue;const n=e.match(i.firstline);if(n&&n.length>0)return i.mime}return}(t);if(e)return[e,LN.text]}return[LN.unknown]}function Az(e,t,i){var n;let o,s,r;for(let a=i.length-1;a>=0;a--){const l=i[a];if(t===l.filenameLowercase){o=l;break}if(l.filepattern&&(!s||l.filepattern.length>s.filepattern.length)){const i=l.filepatternOnPath?e:t;(null===(n=l.filepatternLowercase)||void 0===n?void 0:n.call(l,i))&&(s=l)}l.extension&&(!r||l.extension.length>r.extension.length)&&t.endsWith(l.extensionLowercase)&&(r=l)}return o?o.mime:s?s.mime:r?r.mime:void 0}const Oz=Object.prototype.hasOwnProperty,Rz="vs.editor.nullLanguage";Wv.register(Rz,{});class Pz{constructor(){this._languageIdToLanguage=[],this._languageToLanguageId=new Map,this._register(Rz,0),this._register(LA,1),this._nextLanguageId=2}_register(e,t){this._languageIdToLanguage[t]=e,this._languageToLanguageId.set(e,t)}register(e){if(this._languageToLanguageId.has(e))return;const t=this._nextLanguageId++;this._register(e,t)}encodeLanguageId(e){return this._languageToLanguageId.get(e)||0}decodeLanguageId(e){return this._languageIdToLanguage[e]||Rz}}class Fz extends Uo{constructor(e=!0,t=!1){super(),this._onDidChange=this._register(new $o),this.onDidChange=this._onDidChange.event,Fz.instanceCount++,this._warnOnOverwrite=t,this.languageIdCodec=new Pz,this._dynamicLanguages=[],this._languages={},this._mimeTypesMap={},this._nameMap={},this._lowercaseNameMap={},e&&(this._initializeFromRegistry(),this._register(DA.onDidChangeLanguages((e=>{this._initializeFromRegistry()}))))}dispose(){Fz.instanceCount--,super.dispose()}_initializeFromRegistry(){this._languages={},this._mimeTypesMap={},this._nameMap={},this._lowercaseNameMap={},Nz=Nz.filter((e=>e.userConfigured)),Ez=[];const e=[].concat(DA.getLanguages()).concat(this._dynamicLanguages);this._registerLanguages(e)}_registerLanguages(e){for(const t of e)this._registerLanguage(t);this._mimeTypesMap={},this._nameMap={},this._lowercaseNameMap={},Object.keys(this._languages).forEach((e=>{const t=this._languages[e];t.name&&(this._nameMap[t.name]=t.identifier),t.aliases.forEach((e=>{this._lowercaseNameMap[e.toLowerCase()]=t.identifier})),t.mimetypes.forEach((e=>{this._mimeTypesMap[e]=t.identifier}))})),Yy.as(cA).registerOverrideIdentifiers(this.getRegisteredLanguageIds()),this._onDidChange.fire()}_registerLanguage(e){const t=e.id;let i;Oz.call(this._languages,t)?i=this._languages[t]:(this.languageIdCodec.register(t),i={identifier:t,name:null,mimetypes:[],aliases:[],extensions:[],filenames:[],configurationFiles:[],icons:[]},this._languages[t]=i),this._mergeLanguage(i,e)}_mergeLanguage(e,t){const i=t.id;let n=null;if(Array.isArray(t.mimetypes)&&t.mimetypes.length>0&&(e.mimetypes.push(...t.mimetypes),n=t.mimetypes[0]),n||(n=`text/x-${i}`,e.mimetypes.push(n)),Array.isArray(t.extensions)){t.configuration?e.extensions=t.extensions.concat(e.extensions):e.extensions=e.extensions.concat(t.extensions);for(let e of t.extensions)Tz({id:i,mime:n,extension:e},this._warnOnOverwrite)}if(Array.isArray(t.filenames))for(let a of t.filenames)Tz({id:i,mime:n,filename:a},this._warnOnOverwrite),e.filenames.push(a);if(Array.isArray(t.filenamePatterns))for(let a of t.filenamePatterns)Tz({id:i,mime:n,filepattern:a},this._warnOnOverwrite);if("string"==typeof t.firstLine&&t.firstLine.length>0){let e=t.firstLine;"^"!==e.charAt(0)&&(e="^"+e);try{const t=new RegExp(e);xa(t)||Tz({id:i,mime:n,firstline:t},this._warnOnOverwrite)}catch(r){Jo(r)}}e.aliases.push(i);let o=null;if(void 0!==t.aliases&&Array.isArray(t.aliases)&&(o=0===t.aliases.length?[null]:t.aliases),null!==o)for(const a of o)a&&0!==a.length&&e.aliases.push(a);const s=null!==o&&o.length>0;if(s&&null===o[0]);else{const t=(s?o[0]:null)||i;!s&&e.name||(e.name=t)}t.configuration&&e.configurationFiles.push(t.configuration),t.icon&&e.icons.push(t.icon)}isRegisteredLanguageId(e){return!!e&&Oz.call(this._languages,e)}getRegisteredLanguageIds(){return Object.keys(this._languages)}getLanguageIdByLanguageName(e){const t=e.toLowerCase();return Oz.call(this._lowercaseNameMap,t)?this._lowercaseNameMap[t]:null}getLanguageIdByMimeType(e){return e&&Oz.call(this._mimeTypesMap,e)?this._mimeTypesMap[e]:null}guessLanguageIdByFilepathOrFirstLine(e,t){if(!e&&!t)return[];const i=Mz(e,t);return Sa(i.map((e=>this.getLanguageIdByMimeType(e))))}}Fz.instanceCount=0;class Bz extends Uo{constructor(e=!1){super(),this._onDidEncounterLanguage=this._register(new $o),this.onDidEncounterLanguage=this._onDidEncounterLanguage.event,this._onDidChange=this._register(new $o({leakWarningThreshold:200})),this.onDidChange=this._onDidChange.event,Bz.instanceCount++,this._encounteredLanguages=new Set,this._registry=this._register(new Fz(!0,e)),this.languageIdCodec=this._registry.languageIdCodec,this._register(this._registry.onDidChange((()=>this._onDidChange.fire())))}dispose(){Bz.instanceCount--,super.dispose()}isRegisteredLanguageId(e){return this._registry.isRegisteredLanguageId(e)}getLanguageIdByLanguageName(e){return this._registry.getLanguageIdByLanguageName(e)}getLanguageIdByMimeType(e){return this._registry.getLanguageIdByMimeType(e)}guessLanguageIdByFilepathOrFirstLine(e,t){const i=this._registry.guessLanguageIdByFilepathOrFirstLine(e,t);return ka(i,null)}createById(e){return new Vz(this.onDidChange,(()=>this._createAndGetLanguageIdentifier(e)))}createByFilepathOrFirstLine(e,t){return new Vz(this.onDidChange,(()=>{const i=this.guessLanguageIdByFilepathOrFirstLine(e,t);return this._createAndGetLanguageIdentifier(i)}))}_createAndGetLanguageIdentifier(e){return e&&this.isRegisteredLanguageId(e)||(e=LA),this._encounteredLanguages.has(e)||(this._encounteredLanguages.add(e),Ns.getOrCreate(e),this._onDidEncounterLanguage.fire(e)),e}}Bz.instanceCount=0;class Vz{constructor(e,t){this._onDidChangeLanguages=e,this._selector=t,this._listener=null,this._emitter=null,this.languageId=this._selector()}_dispose(){this._listener&&(this._listener.dispose(),this._listener=null),this._emitter&&(this._emitter.dispose(),this._emitter=null)}get onDidChange(){return this._listener||(this._listener=this._onDidChangeLanguages((()=>this._evaluate()))),this._emitter||(this._emitter=new $o({onLastListenerRemove:()=>{this._dispose()}})),this._emitter.event}_evaluate(){const e=this._selector();e!==this.languageId&&(this.languageId=e,this._emitter&&this._emitter.fire(this.languageId))}}function Wz(e){let t=e.definition;for(;t instanceof br;)t=t.definition;return`.codicon-${e.id}:before { content: '${t.fontCharacter}'; }`}function zz(...e){return function(t,i){for(let n=0,o=e.length;n<o;n++){const o=e[n](t,i);if(o)return o}return null}}jz.bind(void 0,!1);const Hz=jz.bind(void 0,!0);function jz(e,t,i){if(!i||i.length<t.length)return null;let n;return n=e?Br(i,t):0===i.indexOf(t),n?t.length>0?[{start:0,end:t.length}]:[]:null}function Uz(e,t){const i=t.toLowerCase().indexOf(e.toLowerCase());return-1===i?null:[{start:i,end:i+e.length}]}function $z(e,t,i,n){if(i===e.length)return[];if(n===t.length)return null;if(e[i]===t[n]){let o=null;return(o=$z(e,t,i+1,n+1))?Jz({start:n,end:n+1},o):null}return $z(e,t,i,n+1)}function Kz(e){return 97<=e&&e<=122}function qz(e){return 65<=e&&e<=90}function Gz(e){return 48<=e&&e<=57}function Zz(e){return 32===e||9===e||10===e||13===e}const Yz=new Set;function Xz(e){return Zz(e)||Yz.has(e)}function Qz(e){return Kz(e)||qz(e)||Gz(e)}function Jz(e,t){return 0===t.length?t=[e]:e.end===t[0].start?t[0].start=e.start:t.unshift(e),t}function eH(e,t){for(let i=t;i<e.length;i++){const t=e.charCodeAt(i);if(qz(t)||Gz(t)||i>0&&!Qz(e.charCodeAt(i-1)))return i}return e.length}function tH(e,t,i,n){if(i===e.length)return[];if(n===t.length)return null;if(e[i]!==t[n].toLowerCase())return null;{let o=null,s=n+1;for(o=tH(e,t,i+1,n+1);!o&&(s=eH(t,s))<t.length;)o=tH(e,t,i+1,s),s++;return null===o?null:Jz({start:n,end:n+1},o)}}function iH(e,t){if(!t)return null;if(0===(t=t.trim()).length)return null;if(!function(e){let t=0,i=0,n=0,o=0;for(let s=0;s<e.length;s++)n=e.charCodeAt(s),qz(n)&&t++,Kz(n)&&i++,Zz(n)&&o++;return 0!==t&&0!==i||0!==o?t<=5:e.length<=30}(e))return null;if(t.length>60)return null;const i=function(e){let t=0,i=0,n=0,o=0,s=0;for(let r=0;r<e.length;r++)s=e.charCodeAt(r),qz(s)&&t++,Kz(s)&&i++,Qz(s)&&n++,Gz(s)&&o++;return{upperPercent:t/e.length,lowerPercent:i/e.length,alphaPercent:n/e.length,numericPercent:o/e.length}}(t);if(!function(e){const{upperPercent:t,lowerPercent:i,alphaPercent:n,numericPercent:o}=e;return i>.2&&t<.8&&n>.6&&o<.2}(i)){if(!function(e){const{upperPercent:t,lowerPercent:i}=e;return 0===i&&t>.6}(i))return null;t=t.toLowerCase()}let n=null,o=0;for(e=e.toLowerCase();o<t.length&&null===(n=tH(e,t,0,o));)o=eH(t,o+1);return n}function nH(e,t,i,n,o){if(i===e.length)return[];if(n===t.length)return null;if(s=e.charCodeAt(i),r=t.charCodeAt(n),s===r||Xz(s)&&Xz(r)){let s=null,r=n+1;if(s=nH(e,t,i+1,n+1,o),!o)for(;!s&&(r=oH(t,r))<t.length;)s=nH(e,t,i+1,r,o),r++;return null===s?null:Jz({start:n,end:n+1},s)}return null;var s,r}function oH(e,t){for(let i=t;i<e.length;i++)if(Xz(e.charCodeAt(i))||i>0&&Xz(e.charCodeAt(i-1)))return i;return e.length}"()[]{}<>`'\"-/;:,.?!".split("").forEach((e=>Yz.add(e.charCodeAt(0))));const sH=zz(Hz,iH,Uz),rH=zz(Hz,iH,(function(e,t){return $z(e.toLowerCase(),t.toLowerCase(),0,0)})),aH=new QV(1e4);function lH(e,t,i=!1){if("string"!=typeof e||"string"!=typeof t)return null;let n=aH.get(e);n||(n=new RegExp(Da(e),"i"),aH.set(e,n));const o=n.exec(t);return o?[{start:o.index,end:o.index+o[0].length}]:i?rH(e,t):sH(e,t)}function dH(e,t,i,n,o,s){const r=Math.min(13,e.length);for(;i<r;i++){const r=xH(e,t,i,n,o,s,!1);if(r)return r}return[0,s]}function cH(e){if(void 0===e)return[];const t=[],i=e[1];for(let n=e.length-1;n>1;n--){const o=e[n]+i,s=t[t.length-1];s&&s.end===o?s.end=o+1:t.push({start:o,end:o+1})}return t}const hH=128;function uH(){const e=[],t=[];for(let i=0;i<=hH;i++)t[i]=0;for(let i=0;i<=hH;i++)e.push(t.slice(0));return e}function gH(e){const t=[];for(let i=0;i<=e;i++)t[i]=0;return t}const pH=gH(256),mH=gH(256),fH=uH(),_H=uH(),vH=uH();function bH(e,t){if(t<0||t>=e.length)return!1;const i=e.codePointAt(t);switch(i){case 95:case 45:case 46:case 32:case 47:case 92:case 39:case 34:case 58:case 36:case 60:case 40:case 91:return!0;case void 0:return!1;default:return!!or(i)}}function wH(e,t){if(t<0||t>=e.length)return!1;switch(e.charCodeAt(t)){case 32:case 9:return!0;default:return!1}}function CH(e,t,i){return t[e]!==i[e]}var yH;function xH(e,t,i,n,o,s,r){const a=e.length>hH?hH:e.length,l=n.length>hH?hH:n.length;if(i>=a||s>=l||a-i>l-s)return;if(!function(e,t,i,n,o,s,r=!1){for(;t<i&&o<s;)e[t]===n[o]&&(r&&(pH[t]=o),t+=1),o+=1;return t===i}(t,i,a,o,s,l,!0))return;!function(e,t,i,n,o,s){let r=e-1,a=t-1;for(;r>=i&&a>=n;)o[r]===s[a]&&(mH[r]=a,r--),a--}(a,l,i,s,t,o);let d=1,c=1,h=i,u=s;const g=[!1];for(d=1,h=i;h<a;d++,h++){const r=pH[h],p=mH[h],m=h+1<a?mH[h+1]:l;for(c=r-s+1,u=r;u<m;c++,u++){let a=Number.MIN_SAFE_INTEGER,m=!1;u<=p&&(a=SH(e,t,h,i,n,o,u,l,s,0===fH[d-1][c-1],g));let f=0;a!==Number.MAX_SAFE_INTEGER&&(m=!0,f=a+_H[d-1][c-1]);const _=u>r,v=_?_H[d][c-1]+(fH[d][c-1]>0?-5:0):0,b=u>r+1&&fH[d][c-1]>0,w=b?_H[d][c-2]+(fH[d][c-2]>0?-5:0):0;if(b&&(!_||w>=v)&&(!m||w>=f))_H[d][c]=w,vH[d][c]=3,fH[d][c]=0;else if(_&&(!m||v>=f))_H[d][c]=v,vH[d][c]=2,fH[d][c]=0;else{if(!m)throw new Error("not possible");_H[d][c]=f,vH[d][c]=1,fH[d][c]=fH[d-1][c-1]+1}}}if(!g[0]&&!r)return;d--,c--;const p=[_H[d][c],s];let m=0,f=0;for(;d>=1;){let e=c;do{const t=vH[d][e];if(3===t)e-=2;else{if(2!==t)break;e-=1}}while(e>=1);m>1&&t[i+d-1]===o[s+c-1]&&!CH(e+s-1,n,o)&&m+1>fH[d][e]&&(e=c),e===c?m++:m=1,f||(f=e),d--,c=e-1,p.push(c)}l===a&&(p[0]+=2);const _=f-a;return p[0]-=_,p}function SH(e,t,i,n,o,s,r,a,l,d,c){if(t[i]!==s[r])return Number.MIN_SAFE_INTEGER;let h=1,u=!1;return r===i-n?h=e[i]===o[r]?7:5:!CH(r,o,s)||0!==r&&CH(r-1,o,s)?!bH(s,r)||0!==r&&bH(s,r-1)?(bH(s,r-1)||wH(s,r-1))&&(h=5,u=!0):h=5:(h=e[i]===o[r]?7:5,u=!0),h>1&&i===n&&(c[0]=!0),u||(u=CH(r,o,s)||bH(s,r-1)||wH(s,r-1)),i===n?r>l&&(h-=u?3:5):h+=d?u?2:0:u?0:1,r+1===a&&(h-=u?3:5),h}function kH(e,t,i,n,o,s,r){return function(e,t,i,n,o,s,r,a){let l=xH(e,t,i,n,o,s,a);if(l&&!r)return l;if(e.length>=3){const t=Math.min(7,e.length-1);for(let r=i+1;r<t;r++){const t=DH(e,r);if(t){const e=xH(t,t.toLowerCase(),i,n,o,s,a);e&&(e[0]-=3,(!l||e[0]>l[0])&&(l=e))}}}return l}(e,t,i,n,o,s,!0,r)}function DH(e,t){if(t+1>=e.length)return;const i=e[t],n=e[t+1];return i!==n?e.slice(0,t)+n+i+e.slice(t+2):void 0}!function(e){e.Default=[-100,0],e.isDefault=function(e){return!e||2===e.length&&-100===e[0]&&0===e[1]}}(yH||(yH={}));const LH="$(",NH=new RegExp(`\\$\\(${Ys.iconNameExpression}(?:${Ys.iconModifierExpression})?\\)`,"g"),EH=new RegExp(Ys.iconNameCharacter),IH=new RegExp(`(\\\\)?${NH.source}`,"g");const TH=new RegExp(`\\\\${NH.source}`,"g");const MH=new RegExp(`(\\s)?(\\\\)?${NH.source}(\\s)?`,"g");function AH(e){return-1===e.indexOf(LH)?e:e.replace(MH,((e,t,i,n)=>i?e:t||n||""))}function OH(e){const t=e.indexOf(LH);return-1===t?{text:e}:function(e,t){const i=[];let n="";function o(e){if(e){n+=e;for(const t of e)i.push(d)}}let s,r,a=-1,l="",d=0,c=t;const h=e.length;o(e.substr(0,t));for(;c<h;){if(s=e[c],r=e[c+1],s===LH[0]&&r===LH[1])a=c,o(l),l=LH,c++;else if(")"===s&&-1!==a){d+=c-a+1,a=-1,l=""}else-1!==a?EH.test(s)?l+=s:(o(l),a=-1,l=""):o(s);c++}return o(l),{text:n,iconOffsets:i}}(e,t)}function RH(e,t,i=!1){const{text:n,iconOffsets:o}=t;if(!o||0===o.length)return lH(e,n,i);const s=La(n," "),r=n.length-s.length,a=lH(e,s,i);if(a)for(const l of a){const e=o[l.start+r]+r;l.start+=e,l.end+=e}return a}const PH=/\(&([^\s&])\)|(^|[^&])&([^\s&])/,FH=/(&)?(&)([^\s&])/g;var BH;!function(e){e[e.Right=0]="Right",e[e.Left=1]="Left"}(BH||(BH={}));class VH extends vB{constructor(e,t,i={}){e.classList.add("monaco-menu-container"),e.setAttribute("role","presentation");const n=document.createElement("div");n.classList.add("monaco-menu"),n.setAttribute("role","presentation"),super(n,{orientation:1,actionViewItemProvider:e=>this.doGetActionViewItem(e,i,o),context:i.context,actionRunner:i.actionRunner,ariaLabel:i.ariaLabel,focusOnlyEnabledItems:!0,triggerKeys:{keys:[3,...zo||Vo?[10]:[]],keyDown:!0}}),this.menuElement=n,this.actionsList.setAttribute("role","menu"),this.actionsList.tabIndex=0,this.menuDisposables=this._register(new ws),this.initializeOrUpdateStyleSheet(e,{}),this._register(oS.addTarget(n)),nC(n,zC.KEY_DOWN,(e=>{new jw(e).equals(2)&&e.preventDefault()})),i.enableMnemonics&&this.menuDisposables.add(nC(n,zC.KEY_DOWN,(e=>{const t=e.key.toLocaleLowerCase();if(this.mnemonics.has(t)){HC(e,!0);const i=this.mnemonics.get(t);if(1===i.length&&(i[0]instanceof zH&&i[0].container&&this.focusItemByElement(i[0].container),i[0].onClick(e)),i.length>1){const e=i.shift();e&&e.container&&(this.focusItemByElement(e.container),i.push(e)),this.mnemonics.set(t,i)}}}))),Vo&&this._register(nC(n,zC.KEY_DOWN,(e=>{const t=new jw(e);t.equals(14)||t.equals(11)?(this.focusedItem=this.viewItems.length-1,this.focusNext(),HC(e,!0)):(t.equals(13)||t.equals(12))&&(this.focusedItem=0,this.focusPrevious(),HC(e,!0))}))),this._register(nC(this.domNode,zC.MOUSE_OUT,(e=>{NC(e.relatedTarget,this.domNode)||(this.focusedItem=void 0,this.updateFocus(),e.stopPropagation())}))),this._register(nC(this.actionsList,zC.MOUSE_OVER,(e=>{let t=e.target;if(t&&NC(t,this.actionsList)&&t!==this.actionsList){for(;t.parentElement!==this.actionsList&&null!==t.parentElement;)t=t.parentElement;if(t.classList.contains("action-item")){const e=this.focusedItem;this.setFocusedItem(t),e!==this.focusedItem&&this.updateFocus()}}}))),this._register(oS.addTarget(this.actionsList)),this._register(nC(this.actionsList,iS.Tap,(e=>{let t=e.initialTarget;if(t&&NC(t,this.actionsList)&&t!==this.actionsList){for(;t.parentElement!==this.actionsList&&null!==t.parentElement;)t=t.parentElement;if(t.classList.contains("action-item")){const e=this.focusedItem;this.setFocusedItem(t),e!==this.focusedItem&&this.updateFocus()}}})));let o={parent:this};this.mnemonics=new Map,this.scrollableElement=this._register(new fT(n,{alwaysConsumeMouseWheel:!0,horizontal:2,vertical:3,verticalScrollbarSize:7,handleMouseWheel:!0,useShadows:!0}));const s=this.scrollableElement.getDomNode();s.style.position="",this._register(nC(n,iS.Change,(e=>{HC(e,!0);const t=this.scrollableElement.getScrollPosition().scrollTop;this.scrollableElement.setScrollPosition({scrollTop:t-e.translationY})}))),this._register(nC(s,zC.MOUSE_UP,(e=>{e.preventDefault()}))),n.style.maxHeight=`${Math.max(10,window.innerHeight-e.getBoundingClientRect().top-35)}px`,t=t.filter((e=>{var t;return!(null===(t=i.submenuIds)||void 0===t?void 0:t.has(e.id))})),this.push(t,{icon:!0,label:!0,isMenu:!0}),e.appendChild(this.scrollableElement.getDomNode()),this.scrollableElement.scanDomNode(),this.viewItems.filter((e=>!(e instanceof HH))).forEach(((e,t,i)=>{e.updatePositionInSet(t+1,i.length)}))}initializeOrUpdateStyleSheet(e,t){this.styleSheet||(MC(e)?this.styleSheet=RC(e):(VH.globalStyleSheet||(VH.globalStyleSheet=RC()),this.styleSheet=VH.globalStyleSheet)),this.styleSheet.textContent=function(e,t){let i=`\n.monaco-menu {\n\tfont-size: 13px;\n\n}\n\n${Wz(br.menuSelection)}\n${Wz(br.menuSubmenu)}\n\n.monaco-menu .monaco-action-bar {\n\ttext-align: right;\n\toverflow: hidden;\n\twhite-space: nowrap;\n}\n\n.monaco-menu .monaco-action-bar .actions-container {\n\tdisplay: flex;\n\tmargin: 0 auto;\n\tpadding: 0;\n\twidth: 100%;\n\tjustify-content: flex-end;\n}\n\n.monaco-menu .monaco-action-bar.vertical .actions-container {\n\tdisplay: inline-block;\n}\n\n.monaco-menu .monaco-action-bar.reverse .actions-container {\n\tflex-direction: row-reverse;\n}\n\n.monaco-menu .monaco-action-bar .action-item {\n\tcursor: pointer;\n\tdisplay: inline-block;\n\ttransition: transform 50ms ease;\n\tposition: relative; /* DO NOT REMOVE - this is the key to preventing the ghosting icon bug in Chrome 42 */\n}\n\n.monaco-menu .monaco-action-bar .action-item.disabled {\n\tcursor: default;\n}\n\n.monaco-menu .monaco-action-bar.animated .action-item.active {\n\ttransform: scale(1.272019649, 1.272019649); /* 1.272019649 = √φ */\n}\n\n.monaco-menu .monaco-action-bar .action-item .icon,\n.monaco-menu .monaco-action-bar .action-item .codicon {\n\tdisplay: inline-block;\n}\n\n.monaco-menu .monaco-action-bar .action-item .codicon {\n\tdisplay: flex;\n\talign-items: center;\n}\n\n.monaco-menu .monaco-action-bar .action-label {\n\tfont-size: 11px;\n\tmargin-right: 4px;\n}\n\n.monaco-menu .monaco-action-bar .action-item.disabled .action-label,\n.monaco-menu .monaco-action-bar .action-item.disabled .action-label:hover {\n\topacity: 0.4;\n}\n\n/* Vertical actions */\n\n.monaco-menu .monaco-action-bar.vertical {\n\ttext-align: left;\n}\n\n.monaco-menu .monaco-action-bar.vertical .action-item {\n\tdisplay: block;\n}\n\n.monaco-menu .monaco-action-bar.vertical .action-label.separator {\n\tdisplay: block;\n\tborder-bottom: 1px solid #bbb;\n\tpadding-top: 1px;\n\tmargin-left: .8em;\n\tmargin-right: .8em;\n}\n\n.monaco-menu .secondary-actions .monaco-action-bar .action-label {\n\tmargin-left: 6px;\n}\n\n/* Action Items */\n.monaco-menu .monaco-action-bar .action-item.select-container {\n\toverflow: hidden; /* somehow the dropdown overflows its container, we prevent it here to not push */\n\tflex: 1;\n\tmax-width: 170px;\n\tmin-width: 60px;\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n\tmargin-right: 10px;\n}\n\n.monaco-menu .monaco-action-bar.vertical {\n\tmargin-left: 0;\n\toverflow: visible;\n}\n\n.monaco-menu .monaco-action-bar.vertical .actions-container {\n\tdisplay: block;\n}\n\n.monaco-menu .monaco-action-bar.vertical .action-item {\n\tpadding: 0;\n\ttransform: none;\n\tdisplay: flex;\n}\n\n.monaco-menu .monaco-action-bar.vertical .action-item.active {\n\ttransform: none;\n}\n\n.monaco-menu .monaco-action-bar.vertical .action-menu-item {\n\tflex: 1 1 auto;\n\tdisplay: flex;\n\theight: 2em;\n\talign-items: center;\n\tposition: relative;\n}\n\n.monaco-menu .monaco-action-bar.vertical .action-label {\n\tflex: 1 1 auto;\n\ttext-decoration: none;\n\tpadding: 0 1em;\n\tbackground: none;\n\tfont-size: 12px;\n\tline-height: 1;\n}\n\n.monaco-menu .monaco-action-bar.vertical .keybinding,\n.monaco-menu .monaco-action-bar.vertical .submenu-indicator {\n\tdisplay: inline-block;\n\tflex: 2 1 auto;\n\tpadding: 0 1em;\n\ttext-align: right;\n\tfont-size: 12px;\n\tline-height: 1;\n}\n\n.monaco-menu .monaco-action-bar.vertical .submenu-indicator {\n\theight: 100%;\n}\n\n.monaco-menu .monaco-action-bar.vertical .submenu-indicator.codicon {\n\tfont-size: 16px !important;\n\tdisplay: flex;\n\talign-items: center;\n}\n\n.monaco-menu .monaco-action-bar.vertical .submenu-indicator.codicon::before {\n\tmargin-left: auto;\n\tmargin-right: -20px;\n}\n\n.monaco-menu .monaco-action-bar.vertical .action-item.disabled .keybinding,\n.monaco-menu .monaco-action-bar.vertical .action-item.disabled .submenu-indicator {\n\topacity: 0.4;\n}\n\n.monaco-menu .monaco-action-bar.vertical .action-label:not(.separator) {\n\tdisplay: inline-block;\n\tbox-sizing: border-box;\n\tmargin: 0;\n}\n\n.monaco-menu .monaco-action-bar.vertical .action-item {\n\tposition: static;\n\toverflow: visible;\n}\n\n.monaco-menu .monaco-action-bar.vertical .action-item .monaco-submenu {\n\tposition: absolute;\n}\n\n.monaco-menu .monaco-action-bar.vertical .action-label.separator {\n\tpadding: 0.5em 0 0 0;\n\tmargin-bottom: 0.5em;\n\twidth: 100%;\n\theight: 0px !important;\n\tmargin-left: .8em !important;\n\tmargin-right: .8em !important;\n}\n\n.monaco-menu .monaco-action-bar.vertical .action-label.separator.text {\n\tpadding: 0.7em 1em 0.1em 1em;\n\tfont-weight: bold;\n\topacity: 1;\n}\n\n.monaco-menu .monaco-action-bar.vertical .action-label:hover {\n\tcolor: inherit;\n}\n\n.monaco-menu .monaco-action-bar.vertical .menu-item-check {\n\tposition: absolute;\n\tvisibility: hidden;\n\twidth: 1em;\n\theight: 100%;\n}\n\n.monaco-menu .monaco-action-bar.vertical .action-menu-item.checked .menu-item-check {\n\tvisibility: visible;\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n}\n\n/* Context Menu */\n\n.context-view.monaco-menu-container {\n\toutline: 0;\n\tborder: none;\n\tanimation: fadeIn 0.083s linear;\n\t-webkit-app-region: no-drag;\n}\n\n.context-view.monaco-menu-container :focus,\n.context-view.monaco-menu-container .monaco-action-bar.vertical:focus,\n.context-view.monaco-menu-container .monaco-action-bar.vertical :focus {\n\toutline: 0;\n}\n\n.monaco-menu .monaco-action-bar.vertical .action-item {\n\tborder: thin solid transparent; /* prevents jumping behaviour on hover or focus */\n}\n\n\n/* High Contrast Theming */\n:host-context(.hc-black) .context-view.monaco-menu-container {\n\tbox-shadow: none;\n}\n\n:host-context(.hc-black) .monaco-menu .monaco-action-bar.vertical .action-item.focused {\n\tbackground: none;\n}\n\n/* Vertical Action Bar Styles */\n\n.monaco-menu .monaco-action-bar.vertical {\n\tpadding: .5em 0;\n}\n\n.monaco-menu .monaco-action-bar.vertical .action-menu-item {\n\theight: 1.8em;\n}\n\n.monaco-menu .monaco-action-bar.vertical .action-label:not(.separator),\n.monaco-menu .monaco-action-bar.vertical .keybinding {\n\tfont-size: inherit;\n\tpadding: 0 2em;\n}\n\n.monaco-menu .monaco-action-bar.vertical .menu-item-check {\n\tfont-size: inherit;\n\twidth: 2em;\n}\n\n.monaco-menu .monaco-action-bar.vertical .action-label.separator {\n\tfont-size: inherit;\n\tpadding: 0.2em 0 0 0;\n\tmargin-bottom: 0.2em;\n}\n\n:host-context(.linux) .monaco-menu .monaco-action-bar.vertical .action-label.separator {\n\tmargin-left: 0;\n\tmargin-right: 0;\n}\n\n.monaco-menu .monaco-action-bar.vertical .submenu-indicator {\n\tfont-size: 60%;\n\tpadding: 0 1.8em;\n}\n\n:host-context(.linux) .monaco-menu .monaco-action-bar.vertical .submenu-indicator {\n\theight: 100%;\n\tmask-size: 10px 10px;\n\t-webkit-mask-size: 10px 10px;\n}\n\n.monaco-menu .action-item {\n\tcursor: default;\n}`;if(t){i+="\n\t\t\t/* Arrows */\n\t\t\t.monaco-scrollable-element > .scrollbar > .scra {\n\t\t\t\tcursor: pointer;\n\t\t\t\tfont-size: 11px !important;\n\t\t\t}\n\n\t\t\t.monaco-scrollable-element > .visible {\n\t\t\t\topacity: 1;\n\n\t\t\t\t/* Background rule added for IE9 - to allow clicks on dom node */\n\t\t\t\tbackground:rgba(0,0,0,0);\n\n\t\t\t\ttransition: opacity 100ms linear;\n\t\t\t}\n\t\t\t.monaco-scrollable-element > .invisible {\n\t\t\t\topacity: 0;\n\t\t\t\tpointer-events: none;\n\t\t\t}\n\t\t\t.monaco-scrollable-element > .invisible.fade {\n\t\t\t\ttransition: opacity 800ms linear;\n\t\t\t}\n\n\t\t\t/* Scrollable Content Inset Shadow */\n\t\t\t.monaco-scrollable-element > .shadow {\n\t\t\t\tposition: absolute;\n\t\t\t\tdisplay: none;\n\t\t\t}\n\t\t\t.monaco-scrollable-element > .shadow.top {\n\t\t\t\tdisplay: block;\n\t\t\t\ttop: 0;\n\t\t\t\tleft: 3px;\n\t\t\t\theight: 3px;\n\t\t\t\twidth: 100%;\n\t\t\t}\n\t\t\t.monaco-scrollable-element > .shadow.left {\n\t\t\t\tdisplay: block;\n\t\t\t\ttop: 3px;\n\t\t\t\tleft: 0;\n\t\t\t\theight: 100%;\n\t\t\t\twidth: 3px;\n\t\t\t}\n\t\t\t.monaco-scrollable-element > .shadow.top-left-corner {\n\t\t\t\tdisplay: block;\n\t\t\t\ttop: 0;\n\t\t\t\tleft: 0;\n\t\t\t\theight: 3px;\n\t\t\t\twidth: 3px;\n\t\t\t}\n\t\t";const t=e.scrollbarShadow;t&&(i+=`\n\t\t\t\t.monaco-scrollable-element > .shadow.top {\n\t\t\t\t\tbox-shadow: ${t} 0 6px 6px -6px inset;\n\t\t\t\t}\n\n\t\t\t\t.monaco-scrollable-element > .shadow.left {\n\t\t\t\t\tbox-shadow: ${t} 6px 0 6px -6px inset;\n\t\t\t\t}\n\n\t\t\t\t.monaco-scrollable-element > .shadow.top.left {\n\t\t\t\t\tbox-shadow: ${t} 6px 6px 6px -6px inset;\n\t\t\t\t}\n\t\t\t`);const n=e.scrollbarSliderBackground;n&&(i+=`\n\t\t\t\t.monaco-scrollable-element > .scrollbar > .slider {\n\t\t\t\t\tbackground: ${n};\n\t\t\t\t}\n\t\t\t`);const o=e.scrollbarSliderHoverBackground;o&&(i+=`\n\t\t\t\t.monaco-scrollable-element > .scrollbar > .slider:hover {\n\t\t\t\t\tbackground: ${o};\n\t\t\t\t}\n\t\t\t`);const s=e.scrollbarSliderActiveBackground;s&&(i+=`\n\t\t\t\t.monaco-scrollable-element > .scrollbar > .slider.active {\n\t\t\t\t\tbackground: ${s};\n\t\t\t\t}\n\t\t\t`)}return i}(t,MC(e))}style(e){const t=this.getContainer();this.initializeOrUpdateStyleSheet(t,e);const i=e.foregroundColor?`${e.foregroundColor}`:"",n=e.backgroundColor?`${e.backgroundColor}`:"",o=e.borderColor?`1px solid ${e.borderColor}`:"",s=e.shadowColor?`0 2px 4px ${e.shadowColor}`:"";t.style.border=o,this.domNode.style.color=i,this.domNode.style.backgroundColor=n,t.style.boxShadow=s,this.viewItems&&this.viewItems.forEach((t=>{(t instanceof WH||t instanceof HH)&&t.style(e)}))}getContainer(){return this.scrollableElement.getDomNode()}get onScroll(){return this.scrollableElement.onScroll}focusItemByElement(e){const t=this.focusedItem;this.setFocusedItem(e),t!==this.focusedItem&&this.updateFocus()}setFocusedItem(e){for(let t=0;t<this.actionsList.children.length;t++){if(e===this.actionsList.children[t]){this.focusedItem=t;break}}}updateFocus(e){super.updateFocus(e,!0,!0),void 0!==this.focusedItem&&this.scrollableElement.setScrollPosition({scrollTop:Math.round(this.menuElement.scrollTop)})}doGetActionViewItem(e,t,i){if(e instanceof _y)return new HH(t.context,e,{icon:!0});if(e instanceof vy){const n=new zH(e,e.actions,i,Object.assign(Object.assign({},t),{submenuIds:new Set([...t.submenuIds||[],e.id])}));if(t.enableMnemonics){const e=n.getMnemonic();if(e&&n.isEnabled()){let t=[];this.mnemonics.has(e)&&(t=this.mnemonics.get(e)),t.push(n),this.mnemonics.set(e,t)}}return n}{const i={enableMnemonics:t.enableMnemonics,useEventAsContext:t.useEventAsContext};if(t.getKeyBinding){const n=t.getKeyBinding(e);if(n){const e=n.getLabel();e&&(i.keybinding=e)}}const n=new WH(t.context,e,i);if(t.enableMnemonics){const e=n.getMnemonic();if(e&&n.isEnabled()){let t=[];this.mnemonics.has(e)&&(t=this.mnemonics.get(e)),t.push(n),this.mnemonics.set(e,t)}}return n}}}class WH extends mB{constructor(e,t,i={}){if(i.isMenu=!0,super(t,t,i),this.options=i,this.options.icon=void 0!==i.icon&&i.icon,this.options.label=void 0===i.label||i.label,this.cssClass="",this.options.label&&i.enableMnemonics){let e=this.getAction().label;if(e){let t=PH.exec(e);t&&(this.mnemonic=(t[1]?t[1]:t[3]).toLocaleLowerCase())}}this.runOnceToEnableMouseUp=new lb((()=>{this.element&&(this._register(nC(this.element,zC.MOUSE_UP,(e=>{if(HC(e,!0),o_){if(new Gw(e).rightButton)return;this.onClick(e)}else setTimeout((()=>{this.onClick(e)}),0)}))),this._register(nC(this.element,zC.CONTEXT_MENU,(e=>{HC(e,!0)}))))}),100),this._register(this.runOnceToEnableMouseUp)}render(e){super.render(e),this.element&&(this.container=e,this.item=$C(this.element,YC("a.action-menu-item")),this._action.id===_y.ID?this.item.setAttribute("role","presentation"):(this.item.setAttribute("role","menuitem"),this.mnemonic&&this.item.setAttribute("aria-keyshortcuts",`${this.mnemonic}`)),this.check=$C(this.item,YC("span.menu-item-check"+br.menuSelection.cssSelector)),this.check.setAttribute("role","none"),this.label=$C(this.item,YC("span.action-label")),this.options.label&&this.options.keybinding&&($C(this.item,YC("span.keybinding")).textContent=this.options.keybinding),this.runOnceToEnableMouseUp.schedule(),this.updateClass(),this.updateLabel(),this.updateTooltip(),this.updateEnabled(),this.updateChecked())}blur(){super.blur(),this.applyStyle()}focus(){super.focus(),this.item&&this.item.focus(),this.applyStyle()}updatePositionInSet(e,t){this.item&&(this.item.setAttribute("aria-posinset",`${e}`),this.item.setAttribute("aria-setsize",`${t}`))}updateLabel(){if(this.label&&this.options.label){eC(this.label);let e=AH(this.getAction().label);if(e){const t=function(e){const t=PH,i=t.exec(e);if(!i)return e;const n=!i[1];return e.replace(t,n?"$2$3":"").trim()}(e);this.options.enableMnemonics||(e=t),this.label.setAttribute("aria-label",t.replace(/&&/g,"&"));const i=PH.exec(e);if(i){e=Mr(e),FH.lastIndex=0;let t=FH.exec(e);for(;t&&t[1];)t=FH.exec(e);const n=e=>e.replace(/&&/g,"&");t?this.label.append(La(n(e.substr(0,t.index))," "),YC("u",{"aria-hidden":"true"},t[3]),Na(n(e.substr(t.index+t[0].length))," ")):this.label.innerText=n(e).trim(),this.item&&this.item.setAttribute("aria-keyshortcuts",(i[1]?i[1]:i[3]).toLocaleLowerCase())}else this.label.innerText=e.replace(/&&/g,"&").trim()}}}updateTooltip(){}updateClass(){this.cssClass&&this.item&&this.item.classList.remove(...this.cssClass.split(" ")),this.options.icon&&this.label?(this.cssClass=this.getAction().class||"",this.label.classList.add("icon"),this.cssClass&&this.label.classList.add(...this.cssClass.split(" ")),this.updateEnabled()):this.label&&this.label.classList.remove("icon")}updateEnabled(){this.getAction().enabled?(this.element&&(this.element.classList.remove("disabled"),this.element.removeAttribute("aria-disabled")),this.item&&(this.item.classList.remove("disabled"),this.item.removeAttribute("aria-disabled"),this.item.tabIndex=0)):(this.element&&(this.element.classList.add("disabled"),this.element.setAttribute("aria-disabled","true")),this.item&&(this.item.classList.add("disabled"),this.item.setAttribute("aria-disabled","true")))}updateChecked(){if(!this.item)return;const e=this.getAction().checked;this.item.classList.toggle("checked",!!e),void 0!==e?(this.item.setAttribute("role","menuitemcheckbox"),this.item.setAttribute("aria-checked",e?"true":"false")):(this.item.setAttribute("role","menuitem"),this.item.setAttribute("aria-checked",""))}getMnemonic(){return this.mnemonic}applyStyle(){if(!this.menuStyle)return;const e=this.element&&this.element.classList.contains("focused"),t=e&&this.menuStyle.selectionForegroundColor?this.menuStyle.selectionForegroundColor:this.menuStyle.foregroundColor,i=e&&this.menuStyle.selectionBackgroundColor?this.menuStyle.selectionBackgroundColor:void 0,n=e&&this.menuStyle.selectionBorderColor?`thin solid ${this.menuStyle.selectionBorderColor}`:"";this.item&&(this.item.style.color=t?t.toString():"",this.item.style.backgroundColor=i?i.toString():""),this.check&&(this.check.style.color=t?t.toString():""),this.container&&(this.container.style.border=n)}style(e){this.menuStyle=e,this.applyStyle()}}class zH extends WH{constructor(e,t,i,n){super(e,e,n),this.submenuActions=t,this.parentData=i,this.submenuOptions=n,this.mysubmenu=null,this.submenuDisposables=this._register(new ws),this.mouseOver=!1,this.expandDirection=n&&void 0!==n.expandDirection?n.expandDirection:BH.Right,this.showScheduler=new lb((()=>{this.mouseOver&&(this.cleanupExistingSubmenu(!1),this.createSubmenu(!1))}),250),this.hideScheduler=new lb((()=>{this.element&&!NC(OC(),this.element)&&this.parentData.submenu===this.mysubmenu&&(this.parentData.parent.focus(!1),this.cleanupExistingSubmenu(!0))}),750)}render(e){super.render(e),this.element&&(this.item&&(this.item.classList.add("monaco-submenu-item"),this.item.tabIndex=0,this.item.setAttribute("aria-haspopup","true"),this.updateAriaExpanded("false"),this.submenuIndicator=$C(this.item,YC("span.submenu-indicator"+br.menuSubmenu.cssSelector)),this.submenuIndicator.setAttribute("aria-hidden","true")),this._register(nC(this.element,zC.KEY_UP,(e=>{let t=new jw(e);(t.equals(17)||t.equals(3))&&(HC(e,!0),this.createSubmenu(!0))}))),this._register(nC(this.element,zC.KEY_DOWN,(e=>{let t=new jw(e);OC()===this.item&&(t.equals(17)||t.equals(3))&&HC(e,!0)}))),this._register(nC(this.element,zC.MOUSE_OVER,(e=>{this.mouseOver||(this.mouseOver=!0,this.showScheduler.schedule())}))),this._register(nC(this.element,zC.MOUSE_LEAVE,(e=>{this.mouseOver=!1}))),this._register(nC(this.element,zC.FOCUS_OUT,(e=>{this.element&&!NC(OC(),this.element)&&this.hideScheduler.schedule()}))),this._register(this.parentData.parent.onScroll((()=>{this.parentData.parent.focus(!1),this.cleanupExistingSubmenu(!1)}))))}updateEnabled(){}onClick(e){HC(e,!0),this.cleanupExistingSubmenu(!1),this.createSubmenu(!0)}cleanupExistingSubmenu(e){if(this.parentData.submenu&&(e||this.parentData.submenu!==this.mysubmenu)){try{this.parentData.submenu.dispose()}catch(Bte){}this.parentData.submenu=void 0,this.updateAriaExpanded("false"),this.submenuContainer&&(this.submenuDisposables.clear(),this.submenuContainer=void 0)}}calculateSubmenuMenuLayout(e,t,i,n){const o={top:0,left:0};return o.left=ez(e.width,t.width,{position:n===BH.Right?0:1,offset:i.left,size:i.width}),o.left>=i.left&&o.left<i.left+i.width&&(i.left+10+t.width<=e.width&&(o.left=i.left+10),i.top+=10,i.height=0),o.top=ez(e.height,t.height,{position:0,offset:i.top,size:0}),o.top+t.height===i.top&&o.top+i.height+t.height<=e.height&&(o.top+=i.height),o}createSubmenu(e=!0){if(this.element)if(this.parentData.submenu)this.parentData.submenu.focus(!1);else{this.updateAriaExpanded("true"),this.submenuContainer=$C(this.element,YC("div.monaco-submenu")),this.submenuContainer.classList.add("menubar-menu-items-holder","context-view");const t=getComputedStyle(this.parentData.parent.domNode),i=parseFloat(t.paddingTop||"0")||0;this.submenuContainer.style.zIndex="1",this.submenuContainer.style.position="fixed",this.submenuContainer.style.top="0",this.submenuContainer.style.left="0",this.parentData.submenu=new VH(this.submenuContainer,this.submenuActions.length?this.submenuActions:[new by],this.submenuOptions),this.menuStyle&&this.parentData.submenu.style(this.menuStyle);const n=this.element.getBoundingClientRect(),o={top:n.top-i,left:n.left,height:n.height+2*i,width:n.width},s=this.submenuContainer.getBoundingClientRect(),{top:r,left:a}=this.calculateSubmenuMenuLayout(new wC(window.innerWidth,window.innerHeight),wC.lift(s),o,this.expandDirection);this.submenuContainer.style.left=a-s.left+"px",this.submenuContainer.style.top=r-s.top+"px",this.submenuDisposables.add(nC(this.submenuContainer,zC.KEY_UP,(e=>{new jw(e).equals(15)&&(HC(e,!0),this.parentData.parent.focus(),this.cleanupExistingSubmenu(!0))}))),this.submenuDisposables.add(nC(this.submenuContainer,zC.KEY_DOWN,(e=>{new jw(e).equals(15)&&HC(e,!0)}))),this.submenuDisposables.add(this.parentData.submenu.onDidCancel((()=>{this.parentData.parent.focus(),this.cleanupExistingSubmenu(!0)}))),this.parentData.submenu.focus(e),this.mysubmenu=this.parentData.submenu}}updateAriaExpanded(e){var t;this.item&&(null===(t=this.item)||void 0===t||t.setAttribute("aria-expanded",e))}applyStyle(){if(super.applyStyle(),!this.menuStyle)return;const e=this.element&&this.element.classList.contains("focused")&&this.menuStyle.selectionForegroundColor?this.menuStyle.selectionForegroundColor:this.menuStyle.foregroundColor;this.submenuIndicator&&(this.submenuIndicator.style.color=e?`${e}`:""),this.parentData.submenu&&this.parentData.submenu.style(this.menuStyle)}dispose(){super.dispose(),this.hideScheduler.dispose(),this.mysubmenu&&(this.mysubmenu.dispose(),this.mysubmenu=null),this.submenuContainer&&(this.submenuContainer=void 0)}}class HH extends fB{style(e){this.label&&(this.label.style.borderBottomColor=e.separatorColor?`${e.separatorColor}`:"")}}function jH(e,t){const i=Object.create(null);for(let n in t){const o=t[n];o&&(i[n]=kL(o,e))}return i}function UH(e,t,i){function n(){const n=jH(e.getColorTheme(),t);"function"==typeof i?i(n):i.style(n)}return n(),e.onDidColorThemeChange(n)}function $H(e,t,i){return UH(t,Object.assign(Object.assign({},KH),i||{}),e)}const KH={listFocusBackground:pD,listFocusForeground:mD,listFocusOutline:fD,listActiveSelectionBackground:_D,listActiveSelectionForeground:vD,listActiveSelectionIconForeground:bD,listFocusAndSelectionBackground:_D,listFocusAndSelectionForeground:vD,listInactiveSelectionBackground:wD,listInactiveSelectionIconForeground:yD,listInactiveSelectionForeground:CD,listInactiveFocusBackground:xD,listInactiveFocusOutline:SD,listHoverBackground:kD,listHoverForeground:DD,listDropBackground:LD,listSelectionOutline:xS,listHoverOutline:xS,listFilterWidgetBackground:AD,listFilterWidgetOutline:OD,listFilterWidgetNoMatchesOutline:RD,listMatchesShadow:LS,treeIndentGuidesStroke:PD,tableColumnsBorder:FD,tableOddRowsBackgroundColor:BD},qH={shadowColor:LS,borderColor:jD,foregroundColor:UD,backgroundColor:$D,selectionForegroundColor:KD,selectionBackgroundColor:qD,selectionBorderColor:GD,separatorColor:ZD,scrollbarShadow:QS,scrollbarSliderBackground:JS,scrollbarSliderHoverBackground:ek,scrollbarSliderActiveBackground:tk};class GH{constructor(e,t,i,n,o){this.contextViewService=e,this.telemetryService=t,this.notificationService=i,this.keybindingService=n,this.themeService=o,this.focusToReturn=null,this.block=null,this.options={blockMouse:!0}}configure(e){this.options=e}showContextMenu(e){const t=e.getActions();if(!t.length)return;let i;this.focusToReturn=document.activeElement;let n=WC(e.domForShadowRoot)?e.domForShadowRoot:void 0;this.contextViewService.showContextView({getAnchor:()=>e.getAnchor(),canRelayout:!1,anchorAlignment:e.anchorAlignment,anchorAxisAlignment:e.anchorAxisAlignment,render:n=>{let o=e.getMenuClassName?e.getMenuClassName():"";o&&(n.className+=" "+o),this.options.blockMouse&&(this.block=n.appendChild(YC(".context-view-block")),this.block.style.position="fixed",this.block.style.cursor="initial",this.block.style.left="0",this.block.style.top="0",this.block.style.width="100%",this.block.style.height="100%",this.block.style.zIndex="-1",nC(this.block,zC.MOUSE_DOWN,(e=>e.stopPropagation())));const s=new ws,r=e.actionRunner||new fy;var a,l;return r.onBeforeRun(this.onActionRun,this,s),r.onDidRun(this.onDidActionRun,this,s),i=new VH(n,t,{actionViewItemProvider:e.getActionViewItem,context:e.getActionsContext?e.getActionsContext():null,actionRunner:r,getKeyBinding:e.getKeyBinding?e.getKeyBinding:e=>this.keybindingService.lookupKeybinding(e.id)}),s.add((a=i,UH(this.themeService,Object.assign(Object.assign({},qH),l),a))),i.onDidCancel((()=>this.contextViewService.hideContextView(!0)),null,s),i.onDidBlur((()=>this.contextViewService.hideContextView(!0)),null,s),s.add(nC(window,zC.BLUR,(()=>this.contextViewService.hideContextView(!0)))),s.add(nC(window,zC.MOUSE_DOWN,(e=>{if(e.defaultPrevented)return;let t=new Gw(e),i=t.target;if(!t.rightButton){for(;i;){if(i===n)return;i=i.parentElement}this.contextViewService.hideContextView(!0)}}))),ta(s,i)},focus:()=>{i&&i.focus(!!e.autoSelectFirstItem)},onHide:t=>{e.onHide&&e.onHide(!!t),this.block&&(this.block.remove(),this.block=null),this.focusToReturn&&this.focusToReturn.focus()}},n,!!n)}onActionRun(e){this.telemetryService.publicLog2("workbenchActionExecuted",{id:e.action.id,from:"contextMenu"}),this.contextViewService.hideContextView(!1),this.focusToReturn&&this.focusToReturn.focus()}onDidActionRun(e){e.error&&!Ea(e.error)&&this.notificationService.error(e.error)}}var ZH=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},YH=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};let XH=class extends Uo{constructor(e,t,i,n,o){super(),this._onDidShowContextMenu=new $o,this._onDidHideContextMenu=new $o,this.contextMenuHandler=new GH(i,e,t,n,o)}configure(e){this.contextMenuHandler.configure(e)}showContextMenu(e){this.contextMenuHandler.showContextMenu(Object.assign(Object.assign({},e),{onHide:t=>{e.onHide&&e.onHide(t),this._onDidHideContextMenu.fire()}})),ny.getInstance().resetKeyStatus(),this._onDidShowContextMenu.fire()}};function QH(e){let t=JSON.parse(e);return t=JH(t),t}function JH(e,t=0){if(!e||t>200)return e;if("object"==typeof e){switch(e.$mid){case 1:return Ps.revive(e);case 2:return new RegExp(e.source,e.flags);case 14:return new Date(e.source)}if(e instanceof q_||e instanceof Uint8Array)return e;if(Array.isArray(e))for(let i=0;i<e.length;++i)e[i]=JH(e[i],t+1);else for(const i in e)Object.hasOwnProperty.call(e,i)&&(e[i]=JH(e[i],t+1))}return e}var ej;XH=ZH([YH(0,vx),YH(1,vF),YH(2,VB),YH(3,kW),YH(4,Qy)],XH),function(e){e[e.API=0]="API",e[e.USER=1]="USER"}(ej||(ej={}));var tj=globalThis&&globalThis.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{l(n.next(e))}catch(t){s(t)}}function a(e){try{l(n.throw(e))}catch(t){s(t)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}l((n=n.apply(e,t||[])).next())}))};const ij=L_("openerService"),nj=Object.freeze({_serviceBrand:void 0,registerOpener:()=>Uo.None,registerValidator:()=>Uo.None,registerExternalUriResolver:()=>Uo.None,setDefaultExternalOpener(){},registerExternalOpener:()=>Uo.None,open(){return tj(this,void 0,void 0,(function*(){return!1}))},resolveExternalUri(e){return tj(this,void 0,void 0,(function*(){return{resolved:e,dispose(){}}}))}});function oj(e,t){return Ps.isUri(e)?$r(e.scheme,t):Br(e,t+":")}function sj(e,...t){return t.some((t=>oj(e,t)))}var rj=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},aj=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}},lj=globalThis&&globalThis.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{l(n.next(e))}catch(t){s(t)}}function a(e){try{l(n.throw(e))}catch(t){s(t)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}l((n=n.apply(e,t||[])).next())}))};let dj=class{constructor(e){this._commandService=e}open(e,t){return lj(this,void 0,void 0,(function*(){if(!oj(e,Yw.command))return!1;if(!(null==t?void 0:t.allowCommands))return!0;"string"==typeof e&&(e=Ps.parse(e));let i=[];try{i=QH(decodeURIComponent(e.query))}catch(Bte){try{i=QH(e.query)}catch(O3){}}return Array.isArray(i)||(i=[i]),yield this._commandService.executeCommand(e.path,...i),!0}))}};dj=rj([aj(0,wy)],dj);let cj=class{constructor(e){this._editorService=e}open(e,t){return lj(this,void 0,void 0,(function*(){"string"==typeof e&&(e=Ps.parse(e));const{selection:i,uri:n}=function(e){let t;const i=/^L?(\d+)(?:,(\d+))?(-L?(\d+)(?:,(\d+))?)?/.exec(e.fragment);return i&&(t={startLineNumber:parseInt(i[1]),startColumn:i[2]?parseInt(i[2]):1,endLineNumber:i[4]?parseInt(i[4]):void 0,endColumn:i[4]?i[5]?parseInt(i[5]):1:void 0},e=e.with({fragment:""})),{selection:t,uri:e}}(e);return(e=n).scheme===Yw.file&&(e=lR(e)),yield this._editorService.openCodeEditor({resource:e,options:Object.assign({selection:i,source:(null==t?void 0:t.fromUserGesture)?ej.USER:ej.API},null==t?void 0:t.editorOptions)},this._editorService.getFocusedCodeEditor(),null==t?void 0:t.openToSide),!0}))}};cj=rj([aj(0,N_)],cj);let hj=class{constructor(e,t){this._openers=new zs,this._validators=new zs,this._resolvers=new zs,this._resolvedUriTargets=new YV((e=>e.with({path:null,fragment:null,query:null}).toString())),this._externalOpeners=new zs,this._defaultExternalOpener={openExternal:e=>lj(this,void 0,void 0,(function*(){return sj(e,Yw.http,Yw.https)?ey(e):window.location.href=e,!0}))},this._openers.push({open:(e,t)=>lj(this,void 0,void 0,(function*(){return!(!(null==t?void 0:t.openExternal)&&!sj(e,Yw.mailto,Yw.http,Yw.https,Yw.vsls))&&(yield this._doOpenExternal(e,t),!0)}))}),this._openers.push(new dj(t)),this._openers.push(new cj(e))}registerOpener(e){return{dispose:this._openers.unshift(e)}}registerValidator(e){return{dispose:this._validators.push(e)}}registerExternalUriResolver(e){return{dispose:this._resolvers.push(e)}}setDefaultExternalOpener(e){this._defaultExternalOpener=e}registerExternalOpener(e){return{dispose:this._externalOpeners.push(e)}}open(e,t){var i;return lj(this,void 0,void 0,(function*(){const n="string"==typeof e?Ps.parse(e):e,o=null!==(i=this._resolvedUriTargets.get(n))&&void 0!==i?i:e;for(const e of this._validators)if(!(yield e.shouldOpen(o)))return!1;for(const i of this._openers){if(yield i.open(e,t))return!0}return!1}))}resolveExternalUri(e,t){return lj(this,void 0,void 0,(function*(){for(const i of this._resolvers)try{const n=yield i.resolveExternalUri(e,t);if(n)return this._resolvedUriTargets.has(n.resolved)||this._resolvedUriTargets.set(n.resolved,e),n}catch(Bte){}throw new Error("Could not resolve external URI: "+e.toString())}))}_doOpenExternal(e,t){return lj(this,void 0,void 0,(function*(){const i="string"==typeof e?Ps.parse(e):e;let n,o;try{n=(yield this.resolveExternalUri(i,t)).resolved}catch(Bte){n=i}if(o="string"==typeof e&&i.toString()===n.toString()?e:encodeURI(n.toString(!0)),null==t?void 0:t.allowContributedOpeners){const e="string"==typeof(null==t?void 0:t.allowContributedOpeners)?null==t?void 0:t.allowContributedOpeners:void 0;for(const t of this._externalOpeners){if(yield t.openExternal(o,{sourceUri:i,preferredOpenerId:e},Ia.None))return!0}}return this._defaultExternalOpener.openExternal(o,{sourceUri:i},Ia.None)}))}dispose(){this._validators.clear()}};var uj,gj;hj=rj([aj(0,N_),aj(1,wy)],hj),function(e){e[e.Hint=1]="Hint",e[e.Info=2]="Info",e[e.Warning=4]="Warning",e[e.Error=8]="Error"}(uj||(uj={})),function(e){e.compare=function(e,t){return t-e};const t=Object.create(null);t[e.Error]=mf(0,"Error"),t[e.Warning]=mf(0,"Warning"),t[e.Info]=mf(0,"Info"),e.toString=function(e){return t[e]||""},e.fromSeverity=function(t){switch(t){case fF.Error:return e.Error;case fF.Warning:return e.Warning;case fF.Info:return e.Info;case fF.Ignore:return e.Hint}},e.toSeverity=function(t){switch(t){case e.Error:return fF.Error;case e.Warning:return fF.Warning;case e.Info:return fF.Info;case e.Hint:return fF.Ignore}}}(uj||(uj={})),function(e){const t="";function i(e,i){let n=[t];return e.source?n.push(e.source.replace("¦","\\¦")):n.push(t),e.code?"string"==typeof e.code?n.push(e.code.replace("¦","\\¦")):n.push(e.code.value.replace("¦","\\¦")):n.push(t),void 0!==e.severity&&null!==e.severity?n.push(uj.toString(e.severity)):n.push(t),e.message&&i?n.push(e.message.replace("¦","\\¦")):n.push(t),void 0!==e.startLineNumber&&null!==e.startLineNumber?n.push(e.startLineNumber.toString()):n.push(t),void 0!==e.startColumn&&null!==e.startColumn?n.push(e.startColumn.toString()):n.push(t),void 0!==e.endLineNumber&&null!==e.endLineNumber?n.push(e.endLineNumber.toString()):n.push(t),void 0!==e.endColumn&&null!==e.endColumn?n.push(e.endColumn.toString()):n.push(t),n.push(t),n.join("¦")}e.makeKey=function(e){return i(e,!0)},e.makeKeyOptionalMessage=i}(gj||(gj={}));const pj=L_("markerService");var mj=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},fj=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};class _j extends Uo{constructor(e){super(),this.model=e,this._markersData=new Map,this._register(es((()=>{this.model.deltaDecorations([...this._markersData.keys()],[]),this._markersData.clear()})))}update(e,t){const i=[...this._markersData.keys()];this._markersData.clear();const n=this.model.deltaDecorations(i,t);for(let o=0;o<n.length;o++)this._markersData.set(n[o],e[o]);return 0!==i.length||0!==n.length}getMarker(e){return this._markersData.get(e.id)}}let vj=class extends Uo{constructor(e,t){super(),this._markerService=t,this._onDidChangeMarker=this._register(new $o),this._markerDecorations=new YV,e.getModels().forEach((e=>this._onModelAdded(e))),this._register(e.onModelAdded(this._onModelAdded,this)),this._register(e.onModelRemoved(this._onModelRemoved,this)),this._register(this._markerService.onMarkerChanged(this._handleMarkerChange,this))}dispose(){super.dispose(),this._markerDecorations.forEach((e=>e.dispose())),this._markerDecorations.clear()}getMarker(e,t){const i=this._markerDecorations.get(e);return i&&i.getMarker(t)||null}_handleMarkerChange(e){e.forEach((e=>{const t=this._markerDecorations.get(e);t&&this._updateDecorations(t)}))}_onModelAdded(e){const t=new _j(e);this._markerDecorations.set(e.uri,t),this._updateDecorations(t)}_onModelRemoved(e){const t=this._markerDecorations.get(e.uri);t&&(t.dispose(),this._markerDecorations.delete(e.uri)),e.uri.scheme!==Yw.inMemory&&e.uri.scheme!==Yw.internal&&e.uri.scheme!==Yw.vscode||this._markerService&&this._markerService.read({resource:e.uri}).map((e=>e.owner)).forEach((t=>this._markerService.remove(t,[e.uri])))}_updateDecorations(e){const t=this._markerService.read({resource:e.model.uri,take:500}),i=t.map((t=>({range:this._createDecorationRange(e.model,t),options:this._createDecorationOption(t)})));e.update(t,i)&&this._onDidChangeMarker.fire(e.model)}_createDecorationRange(e,t){let i=qo.lift(t);if(t.severity!==uj.Hint||this._hasMarkerTag(t,1)||this._hasMarkerTag(t,2)||(i=i.setEndPosition(i.startLineNumber,i.startColumn+2)),i=e.validateRange(i),i.isEmpty()){const t=e.getLineLastNonWhitespaceColumn(i.startLineNumber)||e.getLineMaxColumn(i.startLineNumber);if(1===t||i.endColumn>=t)return i;const n=e.getWordAtPosition(i.getStartPosition());n&&(i=new qo(i.startLineNumber,n.startColumn,i.endLineNumber,n.endColumn))}else if(t.endColumn===Number.MAX_VALUE&&1===t.startColumn&&i.startLineNumber===i.endLineNumber){let n=e.getLineFirstNonWhitespaceColumn(t.startLineNumber);n<i.endColumn&&(i=new qo(i.startLineNumber,n,i.endLineNumber,i.endColumn),t.startColumn=n)}return i}_createDecorationOption(e){let t,i,n,o,s;switch(e.severity){case uj.Hint:t=this._hasMarkerTag(e,2)?void 0:this._hasMarkerTag(e,1)?"squiggly-unnecessary":"squiggly-hint",n=0;break;case uj.Warning:t="squiggly-warning",i=tx(mE),n=20,s={color:tx(hL),position:Dr.Inline};break;case uj.Info:t="squiggly-info",i=tx(fE),n=10;break;case uj.Error:default:t="squiggly-error",i=tx(pE),n=30,s={color:tx(cL),position:Dr.Inline}}return e.tags&&(-1!==e.tags.indexOf(1)&&(o="squiggly-inline-unnecessary"),-1!==e.tags.indexOf(2)&&(o="squiggly-inline-deprecated")),{description:"marker-decoration",stickiness:1,className:t,showIfCollapsed:!0,overviewRuler:{color:i,position:aa.Right},minimap:s,zIndex:n,inlineClassName:o}}_hasMarkerTag(e,t){return!!e.tags&&e.tags.indexOf(t)>=0}};vj=mj([fj(0,Gv),fj(1,pj)],vj);class bj{constructor(e,t){this._startLineNumber=e,this._tokens=t,this._endLineNumber=this._startLineNumber+this._tokens.getMaxDeltaLine()}static create(e,t){return new bj(e,new wj(t))}get startLineNumber(){return this._startLineNumber}get endLineNumber(){return this._endLineNumber}toString(){return this._tokens.toString(this._startLineNumber)}_updateEndLineNumber(){this._endLineNumber=this._startLineNumber+this._tokens.getMaxDeltaLine()}isEmpty(){return this._tokens.isEmpty()}getLineTokens(e){return this._startLineNumber<=e&&e<=this._endLineNumber?this._tokens.getLineTokens(e-this._startLineNumber):null}getRange(){const e=this._tokens.getRange();return e?new qo(this._startLineNumber+e.startLineNumber,e.startColumn,this._startLineNumber+e.endLineNumber,e.endColumn):e}removeTokens(e){const t=e.startLineNumber-this._startLineNumber,i=e.endLineNumber-this._startLineNumber;this._startLineNumber+=this._tokens.removeTokens(t,e.startColumn-1,i,e.endColumn-1),this._updateEndLineNumber()}split(e){const t=e.startLineNumber-this._startLineNumber,i=e.endLineNumber-this._startLineNumber,[n,o,s]=this._tokens.split(t,e.startColumn-1,i,e.endColumn-1);return[new bj(this._startLineNumber,n),new bj(this._startLineNumber+s,o)]}applyEdit(e,t){const[i,n,o]=uP(t);this.acceptEdit(e,i,n,o,t.length>0?t.charCodeAt(0):0)}acceptEdit(e,t,i,n,o){this._acceptDeleteRange(e),this._acceptInsertText(new er(e.startLineNumber,e.startColumn),t,i,n,o),this._updateEndLineNumber()}_acceptDeleteRange(e){if(e.startLineNumber===e.endLineNumber&&e.startColumn===e.endColumn)return;const t=e.startLineNumber-this._startLineNumber,i=e.endLineNumber-this._startLineNumber;if(i<0){const e=i-t;return void(this._startLineNumber-=e)}const n=this._tokens.getMaxDeltaLine();if(!(t>=n+1)){if(t<0&&i>=n+1)return this._startLineNumber=0,void this._tokens.clear();if(t<0){const n=-t;this._startLineNumber-=n,this._tokens.acceptDeleteRange(e.startColumn-1,0,0,i,e.endColumn-1)}else this._tokens.acceptDeleteRange(0,t,e.startColumn-1,i,e.endColumn-1)}}_acceptInsertText(e,t,i,n,o){if(0===t&&0===i)return;const s=e.lineNumber-this._startLineNumber;if(s<0)return void(this._startLineNumber+=t);s>=this._tokens.getMaxDeltaLine()+1||this._tokens.acceptInsertText(s,e.column-1,t,i,n,o)}}class wj{constructor(e){this._tokens=e,this._tokenCount=e.length/4}toString(e){const t=[];for(let i=0;i<this._tokenCount;i++)t.push(`(${this._getDeltaLine(i)+e},${this._getStartCharacter(i)}-${this._getEndCharacter(i)})`);return`[${t.join(",")}]`}getMaxDeltaLine(){const e=this._getTokenCount();return 0===e?-1:this._getDeltaLine(e-1)}getRange(){const e=this._getTokenCount();if(0===e)return null;const t=this._getStartCharacter(0),i=this._getDeltaLine(e-1),n=this._getEndCharacter(e-1);return new qo(0,t+1,i,n+1)}_getTokenCount(){return this._tokenCount}_getDeltaLine(e){return this._tokens[4*e]}_getStartCharacter(e){return this._tokens[4*e+1]}_getEndCharacter(e){return this._tokens[4*e+2]}isEmpty(){return 0===this._getTokenCount()}getLineTokens(e){let t=0,i=this._getTokenCount()-1;for(;t<i;){const n=t+Math.floor((i-t)/2),o=this._getDeltaLine(n);if(o<e)t=n+1;else{if(!(o>e)){let o=n;for(;o>t&&this._getDeltaLine(o-1)===e;)o--;let s=n;for(;s<i&&this._getDeltaLine(s+1)===e;)s++;return new Cj(this._tokens.subarray(4*o,4*s+4))}i=n-1}}return this._getDeltaLine(t)===e?new Cj(this._tokens.subarray(4*t,4*t+4)):null}clear(){this._tokenCount=0}removeTokens(e,t,i,n){const o=this._tokens,s=this._tokenCount;let r=0,a=!1,l=0;for(let d=0;d<s;d++){const s=4*d,c=o[s],h=o[s+1],u=o[s+2],g=o[s+3];if((c>e||c===e&&u>=t)&&(c<i||c===i&&h<=n))a=!0;else{if(0===r&&(l=c),a){const e=4*r;o[e]=c-l,o[e+1]=h,o[e+2]=u,o[e+3]=g}r++}}return this._tokenCount=r,l}split(e,t,i,n){const o=this._tokens,s=this._tokenCount,r=[],a=[];let l=r,d=0,c=0;for(let h=0;h<s;h++){const s=4*h,r=o[s],u=o[s+1],g=o[s+2],p=o[s+3];if(r>e||r===e&&g>=t){if(r<i||r===i&&u<=n)continue;l!==a&&(l=a,d=0,c=r)}l[d++]=r-c,l[d++]=u,l[d++]=g,l[d++]=p}return[new wj(new Uint32Array(r)),new wj(new Uint32Array(a)),c]}acceptDeleteRange(e,t,i,n,o){const s=this._tokens,r=this._tokenCount,a=n-t;let l=0,d=!1;for(let c=0;c<r;c++){const h=4*c;let u=s[h],g=s[h+1],p=s[h+2];const m=s[h+3];if(u<t||u===t&&p<=i){l++;continue}if(u===t&&g<i)u===n&&p>o?p-=o-i:p=i;else if(u===t&&g===i){if(!(u===n&&p>o)){d=!0;continue}p-=o-i}else if(u<n||u===n&&g<o){if(!(u===n&&p>o)){d=!0;continue}u===t?(g=i,p=g+(p-o)):(g=0,p=g+(p-o))}else if(u>n){if(0===a&&!d){l=r;break}u-=a}else{if(!(u===n&&g>=o))throw new Error("Not possible!");e&&0===u&&(g+=e,p+=e),u-=a,g-=o-i,p-=o-i}const f=4*l;s[f]=u,s[f+1]=g,s[f+2]=p,s[f+3]=m,l++}this._tokenCount=l}acceptInsertText(e,t,i,n,o,s){const r=0===i&&1===n&&(s>=48&&s<=57||s>=65&&s<=90||s>=97&&s<=122),a=this._tokens,l=this._tokenCount;for(let d=0;d<l;d++){const s=4*d;let l=a[s],c=a[s+1],h=a[s+2];if(!(l<e||l===e&&h<t)){if(l===e&&h===t){if(!r)continue;h+=1}else if(l===e&&c<t&&t<h)0===i?h+=n:h=t;else{if(l===e&&c===t&&r)continue;if(l===e)if(l+=i,0===i)c+=n,h+=n;else{const e=h-c;c=o+(c-t),h=c+e}else l+=i}a[s]=l,a[s+1]=c,a[s+2]=h}}}}class Cj{constructor(e){this._tokens=e}getCount(){return this._tokens.length/4}getStartCharacter(e){return this._tokens[4*e+1]}getEndCharacter(e){return this._tokens[4*e+2]}getMetadata(e){return this._tokens[4*e+3]}}var yj=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},xj=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};let Sj=class{constructor(e,t,i,n){this._legend=e,this._themeService=t,this._languageService=i,this._logService=n,this._hashTable=new Lj,this._hasWarnedOverlappingTokens=!1}getMetadata(e,t,i){const n=this._languageService.languageIdCodec.encodeLanguageId(i),o=this._hashTable.get(e,t,n);let s;if(o)s=o.metadata,this._logService.getLevel()===yb.Trace&&this._logService.trace(`SemanticTokensProviderStyling [CACHED] ${e} / ${t}: foreground ${ys.getForeground(s)}, fontStyle ${ys.getFontStyle(s).toString(2)}`);else{let o=this._legend.tokenTypes[e];const r=[];if(o){let e=t;for(let t=0;e>0&&t<this._legend.tokenModifiers.length;t++)1&e&&r.push(this._legend.tokenModifiers[t]),e>>=1;e>0&&this._logService.getLevel()===yb.Trace&&(this._logService.trace(`SemanticTokensProviderStyling: unknown token modifier index: ${t.toString(2)} for legend: ${JSON.stringify(this._legend.tokenModifiers)}`),r.push("not-in-legend"));const n=this._themeService.getColorTheme().getTokenStyleMetadata(o,r,i);if(void 0===n)s=2147483647;else{if(s=0,void 0!==n.italic){s|=1|(n.italic?1:0)<<10}if(void 0!==n.bold){s|=2|(n.bold?2:0)<<10}if(void 0!==n.underline){s|=4|(n.underline?4:0)<<10}if(void 0!==n.strikethrough){s|=8|(n.strikethrough?8:0)<<10}if(n.foreground){s|=16|n.foreground<<14}0===s&&(s=2147483647)}}else this._logService.getLevel()===yb.Trace&&this._logService.trace(`SemanticTokensProviderStyling: unknown token type index: ${e} for legend: ${JSON.stringify(this._legend.tokenTypes)}`),s=2147483647,o="not-in-legend";this._hashTable.add(e,t,n,s),this._logService.getLevel()===yb.Trace&&this._logService.trace(`SemanticTokensProviderStyling ${e} (${o}) / ${t} (${r.join(" ")}): foreground ${ys.getForeground(s)}, fontStyle ${ys.getFontStyle(s).toString(2)}`)}return s}warnOverlappingSemanticTokens(e,t){this._hasWarnedOverlappingTokens||(this._hasWarnedOverlappingTokens=!0)}};function kj(e,t,i){const n=e.data,o=e.data.length/5|0,s=Math.max(Math.ceil(o/1024),400),r=[];let a=0,l=1,d=0;for(;a<o;){const e=a;let c=Math.min(e+s,o);if(c<o){let t=c;for(;t-1>e&&0===n[5*t];)t--;if(t-1===e){let e=c;for(;e+1<o&&0===n[5*e];)e++;c=e}else c=t}let h=new Uint32Array(4*(c-e)),u=0,g=0,p=0,m=0,f=0;for(;a<c;){const e=5*a,o=n[e],s=n[e+1],r=l+o|0,c=0===o?d+s|0:s,_=n[e+2],v=n[e+3],b=n[e+4],w=t.getMetadata(v,b,i);2147483647!==w&&(0===g&&(g=r),p===r&&f>c&&(t.warnOverlappingSemanticTokens(r,c+1),m<c?h[u-4+2]=c:u-=4),h[u]=r-g,h[u+1]=c,h[u+2]=c+_,h[u+3]=w,u+=4,p=r,m=c,f=c+_),l=r,d=c,a++}u!==h.length&&(h=h.subarray(0,u));const _=bj.create(g,h);r.push(_)}return r}Sj=yj([xj(1,Qy),xj(2,Lv),xj(3,Cb)],Sj);class Dj{constructor(e,t,i,n){this.tokenTypeIndex=e,this.tokenModifierSet=t,this.languageId=i,this.metadata=n,this.next=null}}class Lj{constructor(){this._elementsCount=0,this._currentLengthIndex=0,this._currentLength=Lj._SIZES[this._currentLengthIndex],this._growCount=Math.round(this._currentLengthIndex+1<Lj._SIZES.length?2/3*this._currentLength:0),this._elements=[],Lj._nullOutEntries(this._elements,this._currentLength)}static _nullOutEntries(e,t){for(let i=0;i<t;i++)e[i]=null}_hash2(e,t){return(e<<5)-e+t|0}_hashFunc(e,t,i){return this._hash2(this._hash2(e,t),i)%this._currentLength}get(e,t,i){const n=this._hashFunc(e,t,i);let o=this._elements[n];for(;o;){if(o.tokenTypeIndex===e&&o.tokenModifierSet===t&&o.languageId===i)return o;o=o.next}return null}add(e,t,i,n){if(this._elementsCount++,0!==this._growCount&&this._elementsCount>=this._growCount){const e=this._elements;this._currentLengthIndex++,this._currentLength=Lj._SIZES[this._currentLengthIndex],this._growCount=Math.round(this._currentLengthIndex+1<Lj._SIZES.length?2/3*this._currentLength:0),this._elements=[],Lj._nullOutEntries(this._elements,this._currentLength);for(const t of e){let e=t;for(;e;){const t=e.next;e.next=null,this._add(e),e=t}}}this._add(new Dj(e,t,i,n))}_add(e){const t=this._hashFunc(e.tokenTypeIndex,e.tokenModifierSet,e.languageId);e.next=this._elements[t],this._elements[t]=e}}function Nj(e){const t=new Uint32Array(function(e){let t=0;if(t+=2,"full"===e.type)t+=1+e.data.length;else{t+=1,t+=3*e.deltas.length;for(const i of e.deltas)i.data&&(t+=i.data.length)}return t}(e));let i=0;if(t[i++]=e.id,"full"===e.type)t[i++]=1,t[i++]=e.data.length,t.set(e.data,i),i+=e.data.length;else{t[i++]=2,t[i++]=e.deltas.length;for(const n of e.deltas)t[i++]=n.start,t[i++]=n.deleteCount,n.data?(t[i++]=n.data.length,t.set(n.data,i),i+=n.data.length):t[i++]=0}return function(e){const t=new Uint8Array(e.buffer,e.byteOffset,4*e.length);return Zo()||function(e){for(let t=0,i=e.length;t<i;t+=4){const i=e[t+0],n=e[t+1],o=e[t+2],s=e[t+3];e[t+0]=s,e[t+1]=o,e[t+2]=n,e[t+3]=i}}(t),q_.wrap(t)}(t)}Lj._SIZES=[3,7,13,31,61,127,251,509,1021,2039,4093,8191,16381,32749,65521,131071,262139,524287,1048573,2097143];var Ej=globalThis&&globalThis.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{l(n.next(e))}catch(t){s(t)}}function a(e){try{l(n.throw(e))}catch(t){s(t)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}l((n=n.apply(e,t||[])).next())}))};function Ij(e){return e&&!!e.data}function Tj(e){return e&&Array.isArray(e.edits)}class Mj{constructor(e,t,i){this.provider=e,this.tokens=t,this.error=i}}function Aj(e,t){return e.has(t)}function Oj(e,t,i,n,o){return Ej(this,void 0,void 0,(function*(){const s=function(e,t){const i=e.orderedGroups(t);return i.length>0?i[0]:[]}(e,t),r=yield Promise.all(s.map((e=>Ej(this,void 0,void 0,(function*(){let s,r=null;try{s=yield e.provideDocumentSemanticTokens(t,e===i?n:null,o)}catch(a){r=a,s=null}return s&&(Ij(s)||Tj(s))||(s=null),new Mj(e,s,r)})))));for(const e of r){if(e.error)throw e.error;if(e.tokens)return e}return r.length>0?r[0]:null}))}class Rj{constructor(e,t){this.provider=e,this.tokens=t}}function Pj(e,t){const i=e.orderedGroups(t);return i.length>0?i[0]:[]}function Fj(e,t,i,n){return Ej(this,void 0,void 0,(function*(){const o=Pj(e,t),s=yield Promise.all(o.map((e=>Ej(this,void 0,void 0,(function*(){let o;try{o=yield e.provideDocumentRangeSemanticTokens(t,i,n)}catch(s){Ta(s),o=null}return o&&Ij(o)||(o=null),new Rj(e,o)})))));for(const e of s)if(e.tokens)return e;return s.length>0?s[0]:null}))}Cy.registerCommand("_provideDocumentSemanticTokensLegend",((e,...t)=>Ej(void 0,void 0,void 0,(function*(){const[i]=t;Js(i instanceof Ps);const n=e.get(Gv).getModel(i);if(!n)return;const{documentSemanticTokensProvider:o}=e.get(Lb),s=function(e,t){const i=e.orderedGroups(t);return i.length>0?i[0]:null}(o,n);return s?s[0].getLegend():e.get(wy).executeCommand("_provideDocumentRangeSemanticTokensLegend",i)})))),Cy.registerCommand("_provideDocumentSemanticTokens",((e,...t)=>Ej(void 0,void 0,void 0,(function*(){const[i]=t;Js(i instanceof Ps);const n=e.get(Gv).getModel(i);if(!n)return;const{documentSemanticTokensProvider:o}=e.get(Lb);if(!Aj(o,n))return e.get(wy).executeCommand("_provideDocumentRangeSemanticTokens",i,n.getFullModelRange());const s=yield Oj(o,n,null,null,Ia.None);if(!s)return;const{provider:r,tokens:a}=s;if(!a||!Ij(a))return;const l=Nj({id:0,type:"full",data:a.data});return a.resultId&&r.releaseDocumentSemanticTokens(a.resultId),l})))),Cy.registerCommand("_provideDocumentRangeSemanticTokensLegend",((e,...t)=>Ej(void 0,void 0,void 0,(function*(){const[i,n]=t;Js(i instanceof Ps);const o=e.get(Gv).getModel(i);if(!o)return;const{documentRangeSemanticTokensProvider:s}=e.get(Lb),r=Pj(s,o);if(0===r.length)return;if(1===r.length)return r[0].getLegend();if(!n||!qo.isIRange(n))return r[0].getLegend();const a=yield Fj(s,o,qo.lift(n),Ia.None);return a?a.provider.getLegend():void 0})))),Cy.registerCommand("_provideDocumentRangeSemanticTokens",((e,...t)=>Ej(void 0,void 0,void 0,(function*(){const[i,n]=t;Js(i instanceof Ps),Js(qo.isIRange(n));const o=e.get(Gv).getModel(i);if(!o)return;const{documentRangeSemanticTokensProvider:s}=e.get(Lb),r=yield Fj(s,o,qo.lift(n),Ia.None);return r&&r.tokens?Nj({id:0,type:"full",data:r.tokens.data}):void 0}))));var Bj=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},Vj=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};function Wj(e){return e.toString()}function zj(e){const t=new Ma,i=e.createSnapshot();let n;for(;n=i.read();)t.update(n);return t.digest()}class Hj{constructor(e,t,i){this._modelEventListeners=new ws,this.model=e,this._languageSelection=null,this._languageSelectionListener=null,this._modelEventListeners.add(e.onWillDispose((()=>t(e)))),this._modelEventListeners.add(e.onDidChangeLanguage((t=>i(e,t))))}_disposeLanguageSelection(){this._languageSelectionListener&&(this._languageSelectionListener.dispose(),this._languageSelectionListener=null)}dispose(){this._modelEventListeners.dispose(),this._disposeLanguageSelection()}setLanguage(e){this._disposeLanguageSelection(),this._languageSelection=e,this._languageSelectionListener=this._languageSelection.onDidChange((()=>this.model.setMode(e.languageId))),this.model.setMode(e.languageId)}}const jj=Vo||zo?1:2;class Uj{constructor(e,t,i,n,o,s,r,a){this.uri=e,this.initialUndoRedoSnapshot=t,this.time=i,this.sharesUndoRedoStack=n,this.heapSize=o,this.sha1=s,this.versionId=r,this.alternativeVersionId=a}}let $j=class e extends Uo{constructor(e,t,i,n,o,s,r,a,l){super(),this._configurationService=e,this._resourcePropertiesService=t,this._themeService=i,this._logService=n,this._undoRedoService=o,this._languageService=s,this._languageConfigurationService=r,this._languageFeatureDebounceService=a,this._onModelAdded=this._register(new $o),this.onModelAdded=this._onModelAdded.event,this._onModelRemoved=this._register(new $o),this.onModelRemoved=this._onModelRemoved.event,this._onModelModeChanged=this._register(new $o),this.onModelLanguageChanged=this._onModelModeChanged.event,this._modelCreationOptionsByLanguageAndResource=Object.create(null),this._models={},this._disposedModels=new Map,this._disposedModelsHeapSize=0,this._semanticStyling=this._register(new Zj(this._themeService,this._languageService,this._logService)),this._register(this._configurationService.onDidChangeConfiguration((()=>this._updateModelOptions()))),this._updateModelOptions(),this._register(new Gj(this._semanticStyling,this,this._themeService,this._configurationService,this._languageFeatureDebounceService,l))}static _readModelOptions(e,t){var i;let n=ff.tabSize;if(e.editor&&void 0!==e.editor.tabSize){const t=parseInt(e.editor.tabSize,10);isNaN(t)||(n=t),n<1&&(n=1)}let o=n;if(e.editor&&void 0!==e.editor.indentSize&&"tabSize"!==e.editor.indentSize){const t=parseInt(e.editor.indentSize,10);isNaN(t)||(o=t),o<1&&(o=1)}let s=ff.insertSpaces;e.editor&&void 0!==e.editor.insertSpaces&&(s="false"!==e.editor.insertSpaces&&Boolean(e.editor.insertSpaces));let r=jj;const a=e.eol;"\r\n"===a?r=2:"\n"===a&&(r=1);let l=ff.trimAutoWhitespace;e.editor&&void 0!==e.editor.trimAutoWhitespace&&(l="false"!==e.editor.trimAutoWhitespace&&Boolean(e.editor.trimAutoWhitespace));let d=ff.detectIndentation;e.editor&&void 0!==e.editor.detectIndentation&&(d="false"!==e.editor.detectIndentation&&Boolean(e.editor.detectIndentation));let c=ff.largeFileOptimizations;e.editor&&void 0!==e.editor.largeFileOptimizations&&(c="false"!==e.editor.largeFileOptimizations&&Boolean(e.editor.largeFileOptimizations));let h=ff.bracketPairColorizationOptions;return(null===(i=e.editor)||void 0===i?void 0:i.bracketPairColorization)&&"object"==typeof e.editor.bracketPairColorization&&(h={enabled:!!e.editor.bracketPairColorization.enabled}),{isForSimpleWidget:t,tabSize:n,indentSize:o,insertSpaces:s,detectIndentation:d,defaultEOL:r,trimAutoWhitespace:l,largeFileOptimizations:c,bracketPairColorizationOptions:h}}_getEOL(e,t){if(e)return this._resourcePropertiesService.getEOL(e,t);const i=this._configurationService.getValue("files.eol",{overrideIdentifier:t});return i&&"string"==typeof i&&"auto"!==i?i:3===Xs||2===Xs?"\n":"\r\n"}_shouldRestoreUndoStack(){const e=this._configurationService.getValue("files.restoreUndoStack");return"boolean"!=typeof e||e}getCreationOptions(t,i,n){let o=this._modelCreationOptionsByLanguageAndResource[t+i];if(!o){const s=this._configurationService.getValue("editor",{overrideIdentifier:t,resource:i}),r=this._getEOL(i,t);o=e._readModelOptions({editor:s,eol:r},n),this._modelCreationOptionsByLanguageAndResource[t+i]=o}return o}_updateModelOptions(){const t=this._modelCreationOptionsByLanguageAndResource;this._modelCreationOptionsByLanguageAndResource=Object.create(null);const i=Object.keys(this._models);for(let n=0,o=i.length;n<o;n++){const o=i[n],s=this._models[o],r=s.model.getLanguageId(),a=s.model.uri,l=t[r+a],d=this.getCreationOptions(r,a,s.model.isForSimpleWidget);e._setModelOptionsForModel(s.model,d,l)}}static _setModelOptionsForModel(e,t,i){i&&i.defaultEOL!==t.defaultEOL&&1===e.getLineCount()&&e.setEOL(1===t.defaultEOL?0:1),i&&i.detectIndentation===t.detectIndentation&&i.insertSpaces===t.insertSpaces&&i.tabSize===t.tabSize&&i.indentSize===t.indentSize&&i.trimAutoWhitespace===t.trimAutoWhitespace&&Ho(i.bracketPairColorizationOptions,t.bracketPairColorizationOptions)||(t.detectIndentation?(e.detectIndentation(t.insertSpaces,t.tabSize),e.updateOptions({trimAutoWhitespace:t.trimAutoWhitespace,bracketColorizationOptions:t.bracketPairColorizationOptions})):e.updateOptions({insertSpaces:t.insertSpaces,tabSize:t.tabSize,indentSize:t.indentSize,trimAutoWhitespace:t.trimAutoWhitespace,bracketColorizationOptions:t.bracketPairColorizationOptions}))}_insertDisposedModel(e){this._disposedModels.set(Wj(e.uri),e),this._disposedModelsHeapSize+=e.heapSize}_removeDisposedModel(e){const t=this._disposedModels.get(Wj(e));return t&&(this._disposedModelsHeapSize-=t.heapSize),this._disposedModels.delete(Wj(e)),t}_ensureDisposedModelsHeapSize(e){if(this._disposedModelsHeapSize>e){const t=[];for(this._disposedModels.forEach((e=>{e.sharesUndoRedoStack||t.push(e)})),t.sort(((e,t)=>e.time-t.time));t.length>0&&this._disposedModelsHeapSize>e;){const e=t.shift();this._removeDisposedModel(e.uri),null!==e.initialUndoRedoSnapshot&&this._undoRedoService.restoreSnapshot(e.initialUndoRedoSnapshot)}}}_createModelData(e,t,i,n){const o=this.getCreationOptions(t,i,n),s=new VP(e,t,o,i,this._undoRedoService,this._languageService,this._languageConfigurationService);if(i&&this._disposedModels.has(Wj(i))){const e=this._removeDisposedModel(i),t=this._undoRedoService.getElements(i),n=zj(s)===e.sha1;if(n||e.sharesUndoRedoStack){for(const e of t.past)_R(e)&&e.matchesResource(i)&&e.setModel(s);for(const e of t.future)_R(e)&&e.matchesResource(i)&&e.setModel(s);this._undoRedoService.setElementsValidFlag(i,!0,(e=>_R(e)&&e.matchesResource(i))),n&&(s._overwriteVersionId(e.versionId),s._overwriteAlternativeVersionId(e.alternativeVersionId),s._overwriteInitialUndoRedoSnapshot(e.initialUndoRedoSnapshot))}else null!==e.initialUndoRedoSnapshot&&this._undoRedoService.restoreSnapshot(e.initialUndoRedoSnapshot)}const r=Wj(s.uri);if(this._models[r])throw new Error("ModelService: Cannot add model because it already exists!");const a=new Hj(s,(e=>this._onWillDispose(e)),((e,t)=>this._onDidChangeLanguage(e,t)));return this._models[r]=a,a}createModel(e,t,i,n=!1){let o;return t?(o=this._createModelData(e,t.languageId,i,n),this.setMode(o.model,t)):o=this._createModelData(e,LA,i,n),this._onModelAdded.fire(o.model),o.model}setMode(e,t){if(!t)return;const i=this._models[Wj(e.uri)];i&&i.setLanguage(t)}getModels(){const e=[],t=Object.keys(this._models);for(let i=0,n=t.length;i<n;i++){const n=t[i];e.push(this._models[n].model)}return e}getModel(e){const t=Wj(e),i=this._models[t];return i?i.model:null}getSemanticTokensProviderStyling(e){return this._semanticStyling.get(e)}_schemaShouldMaintainUndoRedoElements(e){return e.scheme===Yw.file||e.scheme===Yw.vscodeRemote||e.scheme===Yw.userData||e.scheme===Yw.vscodeNotebookCell||"fake-fs"===e.scheme}_onWillDispose(t){const i=Wj(t.uri),n=this._models[i],o=this._undoRedoService.getUriComparisonKey(t.uri)!==t.uri.toString();let s=!1,r=0;if(o||this._shouldRestoreUndoStack()&&this._schemaShouldMaintainUndoRedoElements(t.uri)){const e=this._undoRedoService.getElements(t.uri);if(e.past.length>0||e.future.length>0){for(const i of e.past)_R(i)&&i.matchesResource(t.uri)&&(s=!0,r+=i.heapSize(t.uri),i.setModel(t.uri));for(const i of e.future)_R(i)&&i.matchesResource(t.uri)&&(s=!0,r+=i.heapSize(t.uri),i.setModel(t.uri))}}const a=e.MAX_MEMORY_FOR_CLOSED_FILES_UNDO_STACK;if(s)if(!o&&r>a){const e=n.model.getInitialUndoRedoSnapshot();null!==e&&this._undoRedoService.restoreSnapshot(e)}else this._ensureDisposedModelsHeapSize(a-r),this._undoRedoService.setElementsValidFlag(t.uri,!1,(e=>_R(e)&&e.matchesResource(t.uri))),this._insertDisposedModel(new Uj(t.uri,n.model.getInitialUndoRedoSnapshot(),Date.now(),o,r,zj(t),t.getVersionId(),t.getAlternativeVersionId()));else if(!o){const e=n.model.getInitialUndoRedoSnapshot();null!==e&&this._undoRedoService.restoreSnapshot(e)}delete this._models[i],n.dispose(),delete this._modelCreationOptionsByLanguageAndResource[t.getLanguageId()+t.uri],this._onModelRemoved.fire(t)}_onDidChangeLanguage(t,i){const n=i.oldLanguage,o=t.getLanguageId(),s=this.getCreationOptions(n,t.uri,t.isForSimpleWidget),r=this.getCreationOptions(o,t.uri,t.isForSimpleWidget);e._setModelOptionsForModel(t,r,s),this._onModelModeChanged.fire({model:t,oldLanguageId:n})}};$j.MAX_MEMORY_FOR_CLOSED_FILES_UNDO_STACK=20971520,$j=Bj([Vj(0,Cv),Vj(1,wb),Vj(2,Qy),Vj(3,Cb),Vj(4,NP),Vj(5,Lv),Vj(6,Rv),Vj(7,oW),Vj(8,Lb)],$j);const Kj="editor.semanticHighlighting";function qj(e,t,i){var n;const o=null===(n=i.getValue(Kj,{overrideIdentifier:e.getLanguageId(),resource:e.uri}))||void 0===n?void 0:n.enabled;return"boolean"==typeof o?o:t.getColorTheme().semanticHighlighting}let Gj=class extends Uo{constructor(e,t,i,n,o,s){super(),this._watchers=Object.create(null),this._semanticStyling=e;const r=e=>{this._watchers[e.uri.toString()]=new Xj(e,this._semanticStyling,i,o,s)},a=(e,t)=>{t.dispose(),delete this._watchers[e.uri.toString()]},l=()=>{for(let e of t.getModels()){const t=this._watchers[e.uri.toString()];qj(e,i,n)?t||r(e):t&&a(e,t)}};this._register(t.onModelAdded((e=>{qj(e,i,n)&&r(e)}))),this._register(t.onModelRemoved((e=>{const t=this._watchers[e.uri.toString()];t&&a(e,t)}))),this._register(n.onDidChangeConfiguration((e=>{e.affectsConfiguration(Kj)&&l()}))),this._register(i.onDidColorThemeChange(l))}};Gj=Bj([Vj(1,Gv),Vj(2,Qy),Vj(3,Cv),Vj(4,oW),Vj(5,Lb)],Gj);class Zj extends Uo{constructor(e,t,i){super(),this._themeService=e,this._languageService=t,this._logService=i,this._caches=new WeakMap,this._register(this._themeService.onDidColorThemeChange((()=>{this._caches=new WeakMap})))}get(e){return this._caches.has(e)||this._caches.set(e,new Sj(e.getLegend(),this._themeService,this._languageService,this._logService)),this._caches.get(e)}}class Yj{constructor(e,t,i){this.provider=e,this.resultId=t,this.data=i}dispose(){this.provider.releaseDocumentSemanticTokens(this.resultId)}}let Xj=class e extends Uo{constructor(t,i,n,o,s){super(),this._isDisposed=!1,this._model=t,this._semanticStyling=i,this._provider=s.documentSemanticTokensProvider,this._debounceInformation=o.for(this._provider,"DocumentSemanticTokens",{min:e.REQUEST_MIN_DELAY,max:e.REQUEST_MAX_DELAY}),this._fetchDocumentSemanticTokens=this._register(new lb((()=>this._fetchDocumentSemanticTokensNow()),e.REQUEST_MIN_DELAY)),this._currentDocumentResponse=null,this._currentDocumentRequestCancellationTokenSource=null,this._documentProvidersChangeListeners=[],this._register(this._model.onDidChangeContent((()=>{this._fetchDocumentSemanticTokens.isScheduled()||this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model))}))),this._register(this._model.onDidChangeLanguage((()=>{this._currentDocumentResponse&&(this._currentDocumentResponse.dispose(),this._currentDocumentResponse=null),this._currentDocumentRequestCancellationTokenSource&&(this._currentDocumentRequestCancellationTokenSource.cancel(),this._currentDocumentRequestCancellationTokenSource=null),this._setDocumentSemanticTokens(null,null,null,[]),this._fetchDocumentSemanticTokens.schedule(0)})));const r=()=>{bs(this._documentProvidersChangeListeners),this._documentProvidersChangeListeners=[];for(const e of this._provider.all(t))"function"==typeof e.onDidChange&&this._documentProvidersChangeListeners.push(e.onDidChange((()=>this._fetchDocumentSemanticTokens.schedule(0))))};r(),this._register(this._provider.onDidChange((()=>{r(),this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model))}))),this._register(n.onDidColorThemeChange((e=>{this._setDocumentSemanticTokens(null,null,null,[]),this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model))}))),this._fetchDocumentSemanticTokens.schedule(0)}dispose(){this._currentDocumentResponse&&(this._currentDocumentResponse.dispose(),this._currentDocumentResponse=null),this._currentDocumentRequestCancellationTokenSource&&(this._currentDocumentRequestCancellationTokenSource.cancel(),this._currentDocumentRequestCancellationTokenSource=null),this._setDocumentSemanticTokens(null,null,null,[]),this._isDisposed=!0,super.dispose()}_fetchDocumentSemanticTokensNow(){if(this._currentDocumentRequestCancellationTokenSource)return;if(!Aj(this._provider,this._model))return void(this._currentDocumentResponse&&this._model.setSemanticTokens(null,!1));const e=new as,t=this._currentDocumentResponse?this._currentDocumentResponse.provider:null,i=this._currentDocumentResponse&&this._currentDocumentResponse.resultId||null,n=Oj(this._provider,this._model,t,i,e.token);this._currentDocumentRequestCancellationTokenSource=e;const o=[],s=this._model.onDidChangeContent((e=>{o.push(e)})),r=new ps(!1);n.then((e=>{if(this._debounceInformation.update(this._model,r.elapsed()),this._currentDocumentRequestCancellationTokenSource=null,s.dispose(),e){const{provider:t,tokens:i}=e,n=this._semanticStyling.get(t);this._setDocumentSemanticTokens(t,i||null,n,o)}else this._setDocumentSemanticTokens(null,null,null,o)}),(e=>{e&&(Ea(e)||"string"==typeof e.message&&-1!==e.message.indexOf("busy"))||Jo(e),this._currentDocumentRequestCancellationTokenSource=null,s.dispose(),o.length>0&&(this._fetchDocumentSemanticTokens.isScheduled()||this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model)))}))}static _copy(e,t,i,n,o){for(let s=0;s<o;s++)i[n+s]=e[t+s]}_setDocumentSemanticTokens(t,i,n,o){const s=this._currentDocumentResponse,r=()=>{o.length>0&&!this._fetchDocumentSemanticTokens.isScheduled()&&this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model))};if(this._currentDocumentResponse&&(this._currentDocumentResponse.dispose(),this._currentDocumentResponse=null),this._isDisposed)t&&i&&t.releaseDocumentSemanticTokens(i.resultId);else if(t&&n){if(!i)return this._model.setSemanticTokens(null,!0),void r();if(Tj(i)){if(!s)return void this._model.setSemanticTokens(null,!0);if(0===i.edits.length)i={resultId:i.resultId,data:s.data};else{let t=0;for(const e of i.edits)t+=(e.data?e.data.length:0)-e.deleteCount;const n=s.data,o=new Uint32Array(n.length+t);let r=n.length,a=o.length;for(let s=i.edits.length-1;s>=0;s--){const t=i.edits[s],l=r-(t.start+t.deleteCount);l>0&&(e._copy(n,r-l,o,a-l,l),a-=l),t.data&&(e._copy(t.data,0,o,a-t.data.length,t.data.length),a-=t.data.length),r=t.start}r>0&&e._copy(n,0,o,0,r),i={resultId:i.resultId,data:o}}}if(Ij(i)){this._currentDocumentResponse=new Yj(t,i.resultId,i.data);const e=kj(i,n,this._model.getLanguageId());if(o.length>0)for(const t of o)for(const i of e)for(const e of t.changes)i.applyEdit(e.range,e.text);this._model.setSemanticTokens(e,!0)}else this._model.setSemanticTokens(null,!0);r()}else this._model.setSemanticTokens(null,!1)}};Xj.REQUEST_MIN_DELAY=300,Xj.REQUEST_MAX_DELAY=2e3,Xj=Bj([Vj(2,Qy),Vj(3,oW),Vj(4,Lb)],Xj);const Qj=new RegExp(`(\\\\)?\\$\\((${Ys.iconNameExpression}(?:${Ys.iconModifierExpression})?)\\)`,"g");function Jj(e){const t=new Array;let i,n=0,o=0;for(;null!==(i=Qj.exec(e));){o=i.index||0,t.push(e.substring(n,o)),n=(i.index||0)+i[0].length;const[,s,r]=i;t.push(s?`$(${r})`:eU({id:r}))}return n<e.length&&t.push(e.substring(n)),t}function eU(e){const t=YC("span");return t.classList.add(...Ys.asClassNameArray(e)),t}const tU={buttonBackground:hS.fromHex("#0E639C"),buttonHoverBackground:hS.fromHex("#006BB3"),buttonForeground:hS.white};class iU extends Uo{constructor(e,t){super(),this._onDidClick=this._register(new $o),this.options=t||Object.create(null),Ko(this.options,tU,!1),this.buttonForeground=this.options.buttonForeground,this.buttonBackground=this.options.buttonBackground,this.buttonHoverBackground=this.options.buttonHoverBackground,this.buttonSecondaryForeground=this.options.buttonSecondaryForeground,this.buttonSecondaryBackground=this.options.buttonSecondaryBackground,this.buttonSecondaryHoverBackground=this.options.buttonSecondaryHoverBackground,this.buttonBorder=this.options.buttonBorder,this._element=document.createElement("a"),this._element.classList.add("monaco-button"),this._element.tabIndex=0,this._element.setAttribute("role","button"),e.appendChild(this._element),this._register(oS.addTarget(this._element)),[zC.CLICK,iS.Tap].forEach((e=>{this._register(nC(this._element,e,(e=>{this.enabled?this._onDidClick.fire(e):HC(e)})))})),this._register(nC(this._element,zC.KEY_DOWN,(e=>{const t=new jw(e);let i=!1;this.enabled&&(t.equals(3)||t.equals(10))?(this._onDidClick.fire(e),i=!0):t.equals(9)&&(this._element.blur(),i=!0),i&&HC(t,!0)}))),this._register(nC(this._element,zC.MOUSE_OVER,(e=>{this._element.classList.contains("disabled")||this.setHoverBackground()}))),this._register(nC(this._element,zC.MOUSE_OUT,(e=>{this.applyStyles()}))),this.focusTracker=this._register(UC(this._element)),this._register(this.focusTracker.onDidFocus((()=>this.setHoverBackground()))),this._register(this.focusTracker.onDidBlur((()=>this.applyStyles()))),this.applyStyles()}get onDidClick(){return this._onDidClick.event}setHoverBackground(){let e;e=this.options.secondary?this.buttonSecondaryHoverBackground?this.buttonSecondaryHoverBackground.toString():null:this.buttonHoverBackground?this.buttonHoverBackground.toString():null,e&&(this._element.style.backgroundColor=e)}style(e){this.buttonForeground=e.buttonForeground,this.buttonBackground=e.buttonBackground,this.buttonHoverBackground=e.buttonHoverBackground,this.buttonSecondaryForeground=e.buttonSecondaryForeground,this.buttonSecondaryBackground=e.buttonSecondaryBackground,this.buttonSecondaryHoverBackground=e.buttonSecondaryHoverBackground,this.buttonBorder=e.buttonBorder,this.applyStyles()}applyStyles(){if(this._element){let e,t;this.options.secondary?(t=this.buttonSecondaryForeground?this.buttonSecondaryForeground.toString():"",e=this.buttonSecondaryBackground?this.buttonSecondaryBackground.toString():""):(t=this.buttonForeground?this.buttonForeground.toString():"",e=this.buttonBackground?this.buttonBackground.toString():"");const i=this.buttonBorder?this.buttonBorder.toString():"";this._element.style.color=t,this._element.style.backgroundColor=e,this._element.style.borderWidth=i?"1px":"",this._element.style.borderStyle=i?"solid":"",this._element.style.borderColor=i}}get element(){return this._element}set label(e){this._element.classList.add("monaco-text-button"),this.options.supportIcons?KC(this._element,...Jj(e)):this._element.textContent=e,"string"==typeof this.options.title?this._element.title=this.options.title:this.options.title&&(this._element.title=e)}set enabled(e){e?(this._element.classList.remove("disabled"),this._element.setAttribute("aria-disabled",String(!1)),this._element.tabIndex=0):(this._element.classList.add("disabled"),this._element.setAttribute("aria-disabled",String(!0)))}get enabled(){return!this._element.classList.contains("disabled")}}const nU={badgeBackground:hS.fromHex("#4D4D4D"),badgeForeground:hS.fromHex("#FFFFFF")};class oU{constructor(e,t){this.count=0,this.options=t||Object.create(null),Ko(this.options,nU,!1),this.badgeBackground=this.options.badgeBackground,this.badgeForeground=this.options.badgeForeground,this.badgeBorder=this.options.badgeBorder,this.element=$C(e,YC(".monaco-count-badge")),this.countFormat=this.options.countFormat||"{0}",this.titleFormat=this.options.titleFormat||"",this.setCount(this.options.count||0)}setCount(e){this.count=e,this.render()}setTitleFormat(e){this.titleFormat=e,this.render()}render(){this.element.textContent=Aa(this.countFormat,this.count),this.element.title=Aa(this.titleFormat,this.count),this.applyStyles()}style(e){this.badgeBackground=e.badgeBackground,this.badgeForeground=e.badgeForeground,this.badgeBorder=e.badgeBorder,this.applyStyles()}applyStyles(){if(this.element){const e=this.badgeBackground?this.badgeBackground.toString():"",t=this.badgeForeground?this.badgeForeground.toString():"",i=this.badgeBorder?this.badgeBorder.toString():"";this.element.style.backgroundColor=e,this.element.style.color=t,this.element.style.borderWidth=i?"1px":"",this.element.style.borderStyle=i?"solid":"",this.element.style.borderColor=i}}}const sU="done",rU="active",aU="infinite",lU="infinite-long-running",dU="discrete",cU={progressBarBackground:hS.fromHex("#0E70C0")};class hU extends Uo{constructor(e,t){super(),this.options=t||Object.create(null),Ko(this.options,cU,!1),this.workedVal=0,this.progressBarBackground=this.options.progressBarBackground,this.showDelayedScheduler=this._register(new lb((()=>XC(this.element)),0)),this.longRunningScheduler=this._register(new lb((()=>this.infiniteLongRunning()),hU.LONG_RUNNING_INFINITE_THRESHOLD)),this.create(e)}create(e){this.element=document.createElement("div"),this.element.classList.add("monaco-progress-container"),this.element.setAttribute("role","progressbar"),this.element.setAttribute("aria-valuemin","0"),e.appendChild(this.element),this.bit=document.createElement("div"),this.bit.classList.add("progress-bit"),this.element.appendChild(this.bit),this.applyStyles()}off(){this.bit.style.width="inherit",this.bit.style.opacity="1",this.element.classList.remove(rU,aU,lU,dU),this.workedVal=0,this.totalWork=void 0,this.longRunningScheduler.cancel()}stop(){return this.doDone(!1)}doDone(e){return this.element.classList.add(sU),this.element.classList.contains(aU)?(this.bit.style.opacity="0",e?setTimeout((()=>this.off()),200):this.off()):(this.bit.style.width="inherit",e?setTimeout((()=>this.off()),200):this.off()),this}infinite(){return this.bit.style.width="2%",this.bit.style.opacity="1",this.element.classList.remove(dU,sU,lU),this.element.classList.add(rU,aU),this.longRunningScheduler.schedule(),this}infiniteLongRunning(){this.element.classList.add(lU)}getContainer(){return this.element}style(e){this.progressBarBackground=e.progressBarBackground,this.applyStyles()}applyStyles(){if(this.bit){const e=this.progressBarBackground?this.progressBarBackground.toString():"";this.bit.style.backgroundColor=e}}}hU.LONG_RUNNING_INFINITE_THRESHOLD=1e4;class uU{constructor(e){this._prefix=e,this._lastId=0}nextId(){return this._prefix+ ++this._lastId}}const gU=new uU("id#");const pU={},mU=new uU("quick-input-button-icon-");function fU(e){if(!e)return;let t;const i=e.dark.toString();return pU[i]?t=pU[i]:(t=mU.nextId(),BC(`.${t}`,`background-image: ${ty(e.light||e.dark)}`),BC(`.vs-dark .${t}, .hc-black .${t}`,`background-image: ${ty(e.dark)}`),pU[i]=t),t}const _U={ctrlCmd:!1,alt:!1};var vU,bU;function wU(e,t={}){const i=CU(t);return xU(i,function(e,t){const i={type:1,children:[]};let n=0,o=i;const s=[],r=new yU(e);for(;!r.eos();){let e=r.next();const i="\\"===e&&0!==kU(r.peek(),t);if(i&&(e=r.next()),!i&&SU(e,t)&&e===r.peek()){r.advance(),2===o.type&&(o=s.pop());const i=kU(e,t);if(o.type===i||5===o.type&&6===i)o=s.pop();else{const e={type:i,children:[]};5===i&&(e.index=n,n++),o.children.push(e),s.push(o),o=e}}else if("\n"===e)2===o.type&&(o=s.pop()),o.children.push({type:8});else if(2!==o.type){const t={type:2,content:e};o.children.push(t),s.push(o),o=t}else o.content+=e}2===o.type&&(o=s.pop());return i}(e,!!t.renderCodeSegments),t.actionHandler,t.renderCodeSegments),i}function CU(e){const t=e.inline?"span":"div",i=document.createElement(t);return e.className&&(i.className=e.className),i}!function(e){e[e.Blur=1]="Blur",e[e.Gesture=2]="Gesture",e[e.Other=3]="Other"}(vU||(vU={})),function(e){e[e.NONE=0]="NONE",e[e.FIRST=1]="FIRST",e[e.SECOND=2]="SECOND",e[e.LAST=3]="LAST"}(bU||(bU={}));class yU{constructor(e){this.source=e,this.index=0}eos(){return this.index>=this.source.length}next(){const e=this.peek();return this.advance(),e}peek(){return this.source[this.index]}advance(){this.index++}}function xU(e,t,i,n){let o;if(2===t.type)o=document.createTextNode(t.content||"");else if(3===t.type)o=document.createElement("b");else if(4===t.type)o=document.createElement("i");else if(7===t.type&&n)o=document.createElement("code");else if(5===t.type&&i){const e=document.createElement("a");i.disposables.add(sC(e,"click",(e=>{i.callback(String(t.index),e)}))),o=e}else 8===t.type?o=document.createElement("br"):1===t.type&&(o=e);o&&e!==o&&e.appendChild(o),o&&Array.isArray(t.children)&&t.children.forEach((e=>{xU(o,e,i,n)}))}function SU(e,t){return 0!==kU(e,t)}function kU(e,t){switch(e){case"*":return 3;case"_":return 4;case"[":return 5;case"]":return 6;case"`":return t?7:0;default:return 0}}class DU{constructor(e,t=0,i=e.length,n=t-1){this.items=e,this.start=t,this.end=i,this.index=n}current(){return this.index===this.start-1||this.index===this.end?null:this.items[this.index]}next(){return this.index=Math.min(this.index+1,this.end),this.current()}previous(){return this.index=Math.max(this.index-1,this.start-1),this.current()}first(){return this.index=this.start,this.current()}last(){return this.index=this.end-1,this.current()}}class LU{constructor(e=[],t=10){this._initialize(e),this._limit=t,this._onChange()}getHistory(){return this._elements}add(e){this._history.delete(e),this._history.add(e),this._onChange()}next(){return this._currentPosition()!==this._elements.length-1?this._navigator.next():null}previous(){return 0!==this._currentPosition()?this._navigator.previous():null}current(){return this._navigator.current()}first(){return this._navigator.first()}last(){return this._navigator.last()}has(e){return this._history.has(e)}_onChange(){this._reduceToLimit();const e=this._elements;this._navigator=new DU(e,0,e.length,e.length)}_reduceToLimit(){const e=this._elements;e.length>this._limit&&this._initialize(e.slice(e.length-this._limit))}_currentPosition(){const e=this._navigator.current();return e?this._elements.indexOf(e):-1}_initialize(e){this._history=new Set;for(const t of e)this._history.add(t)}get _elements(){const e=[];return this._history.forEach((t=>e.push(t))),e}}const NU=YC,EU={inputBackground:hS.fromHex("#3C3C3C"),inputForeground:hS.fromHex("#CCCCCC"),inputValidationInfoBorder:hS.fromHex("#55AAFF"),inputValidationInfoBackground:hS.fromHex("#063B49"),inputValidationWarningBorder:hS.fromHex("#B89500"),inputValidationWarningBackground:hS.fromHex("#352A05"),inputValidationErrorBorder:hS.fromHex("#BE1100"),inputValidationErrorBackground:hS.fromHex("#5A1D1D")};class IU extends QI{constructor(e,t,i){var n;super(),this.state="idle",this.maxHeight=Number.POSITIVE_INFINITY,this._onDidChange=this._register(new $o),this.onDidChange=this._onDidChange.event,this._onDidHeightChange=this._register(new $o),this.onDidHeightChange=this._onDidHeightChange.event,this.contextViewProvider=t,this.options=i||Object.create(null),Ko(this.options,EU,!1),this.message=null,this.placeholder=this.options.placeholder||"",this.tooltip=null!==(n=this.options.tooltip)&&void 0!==n?n:this.placeholder||"",this.ariaLabel=this.options.ariaLabel||"",this.inputBackground=this.options.inputBackground,this.inputForeground=this.options.inputForeground,this.inputBorder=this.options.inputBorder,this.inputValidationInfoBorder=this.options.inputValidationInfoBorder,this.inputValidationInfoBackground=this.options.inputValidationInfoBackground,this.inputValidationInfoForeground=this.options.inputValidationInfoForeground,this.inputValidationWarningBorder=this.options.inputValidationWarningBorder,this.inputValidationWarningBackground=this.options.inputValidationWarningBackground,this.inputValidationWarningForeground=this.options.inputValidationWarningForeground,this.inputValidationErrorBorder=this.options.inputValidationErrorBorder,this.inputValidationErrorBackground=this.options.inputValidationErrorBackground,this.inputValidationErrorForeground=this.options.inputValidationErrorForeground,this.options.validationOptions&&(this.validation=this.options.validationOptions.validation),this.element=$C(e,NU(".monaco-inputbox.idle"));let o=this.options.flexibleHeight?"textarea":"input",s=$C(this.element,NU(".ibwrapper"));if(this.input=$C(s,NU(o+".input.empty")),this.input.setAttribute("autocorrect","off"),this.input.setAttribute("autocapitalize","off"),this.input.setAttribute("spellcheck","false"),this.onfocus(this.input,(()=>this.element.classList.add("synthetic-focus"))),this.onblur(this.input,(()=>this.element.classList.remove("synthetic-focus"))),this.options.flexibleHeight){this.maxHeight="number"==typeof this.options.flexibleMaxHeight?this.options.flexibleMaxHeight:Number.POSITIVE_INFINITY,this.mirror=$C(s,NU("div.mirror")),this.mirror.innerText=" ",this.scrollableElement=new pT(this.element,{vertical:1}),this.options.flexibleWidth&&(this.input.setAttribute("wrap","off"),this.mirror.style.whiteSpace="pre",this.mirror.style.wordWrap="initial"),$C(e,this.scrollableElement.getDomNode()),this._register(this.scrollableElement),this._register(this.scrollableElement.onScroll((e=>this.input.scrollTop=e.scrollTop)));const t=this._register(new eB(document,"selectionchange")),i=ds.filter(t.event,(()=>{const e=document.getSelection();return(null==e?void 0:e.anchorNode)===s}));this._register(i(this.updateScrollDimensions,this)),this._register(this.onDidHeightChange(this.updateScrollDimensions,this))}else this.input.type=this.options.type||"text",this.input.setAttribute("wrap","off");this.ariaLabel&&this.input.setAttribute("aria-label",this.ariaLabel),this.placeholder&&!this.options.showPlaceholderOnFocus&&this.setPlaceHolder(this.placeholder),this.tooltip&&this.setTooltip(this.tooltip),this.oninput(this.input,(()=>this.onValueChange())),this.onblur(this.input,(()=>this.onBlur())),this.onfocus(this.input,(()=>this.onFocus())),this.ignoreGesture(this.input),setTimeout((()=>this.updateMirror()),0),this.options.actions&&(this.actionbar=this._register(new vB(this.element)),this.actionbar.push(this.options.actions,{icon:!0,label:!1})),this.applyStyles()}onBlur(){this._hideMessage(),this.options.showPlaceholderOnFocus&&this.input.setAttribute("placeholder","")}onFocus(){this._showMessage(),this.options.showPlaceholderOnFocus&&this.input.setAttribute("placeholder",this.placeholder||"")}setPlaceHolder(e){this.placeholder=e,this.input.setAttribute("placeholder",e)}setTooltip(e){this.tooltip=e,this.input.title=e}setAriaLabel(e){this.ariaLabel=e,e?this.input.setAttribute("aria-label",this.ariaLabel):this.input.removeAttribute("aria-label")}getAriaLabel(){return this.ariaLabel}get inputElement(){return this.input}get value(){return this.input.value}set value(e){this.input.value!==e&&(this.input.value=e,this.onValueChange())}get height(){return"number"==typeof this.cachedHeight?this.cachedHeight:LC(this.element)}focus(){this.input.focus()}blur(){this.input.blur()}hasFocus(){return document.activeElement===this.input}select(e=null){this.input.select(),e&&(this.input.setSelectionRange(e.start,e.end),e.end===this.input.value.length&&(this.input.scrollLeft=this.input.scrollWidth))}isSelectionAtEnd(){return this.input.selectionEnd===this.input.value.length&&this.input.selectionStart===this.input.selectionEnd}enable(){this.input.removeAttribute("disabled")}disable(){this.blur(),this.input.disabled=!0,this._hideMessage()}get width(){return SC(this.input)}set width(e){if(this.options.flexibleHeight&&this.options.flexibleWidth){let t=0;if(this.mirror){t=(parseFloat(this.mirror.style.paddingLeft||"")||0)+(parseFloat(this.mirror.style.paddingRight||"")||0)}this.input.style.width=e-t+"px"}else this.input.style.width=e+"px";this.mirror&&(this.mirror.style.width=e+"px")}set paddingRight(e){this.input.style.width=`calc(100% - ${e}px)`,this.mirror&&(this.mirror.style.paddingRight=e+"px")}updateScrollDimensions(){if("number"!=typeof this.cachedContentHeight||"number"!=typeof this.cachedHeight||!this.scrollableElement)return;const e=this.cachedContentHeight,t=this.cachedHeight,i=this.input.scrollTop;this.scrollableElement.setScrollDimensions({scrollHeight:e,height:t}),this.scrollableElement.setScrollPosition({scrollTop:i})}showMessage(e,t){this.message=e,this.element.classList.remove("idle"),this.element.classList.remove("info"),this.element.classList.remove("warning"),this.element.classList.remove("error"),this.element.classList.add(this.classForType(e.type));const i=this.stylesForType(this.message.type);this.element.style.border=i.border?`1px solid ${i.border}`:"",(this.hasFocus()||t)&&this._showMessage()}hideMessage(){this.message=null,this.element.classList.remove("info"),this.element.classList.remove("warning"),this.element.classList.remove("error"),this.element.classList.add("idle"),this._hideMessage(),this.applyStyles()}validate(){let e=null;return this.validation&&(e=this.validation(this.value),e?(this.inputElement.setAttribute("aria-invalid","true"),this.showMessage(e)):this.inputElement.hasAttribute("aria-invalid")&&(this.inputElement.removeAttribute("aria-invalid"),this.hideMessage())),null==e?void 0:e.type}stylesForType(e){switch(e){case 1:return{border:this.inputValidationInfoBorder,background:this.inputValidationInfoBackground,foreground:this.inputValidationInfoForeground};case 2:return{border:this.inputValidationWarningBorder,background:this.inputValidationWarningBackground,foreground:this.inputValidationWarningForeground};default:return{border:this.inputValidationErrorBorder,background:this.inputValidationErrorBackground,foreground:this.inputValidationErrorForeground}}}classForType(e){switch(e){case 1:return"info";case 2:return"warning";default:return"error"}}_showMessage(){if(!this.contextViewProvider||!this.message)return;let e,t,i=()=>e.style.width=SC(this.element)+"px";this.contextViewProvider.showContextView({getAnchor:()=>this.element,anchorAlignment:1,render:t=>{if(!this.message)return null;e=$C(t,NU(".monaco-inputbox-container")),i();const n={inline:!0,className:"monaco-inputbox-message"},o=this.message.formatContent?wU(this.message.content,n):function(e,t={}){const i=CU(t);return i.textContent=e,i}(this.message.content,n);o.classList.add(this.classForType(this.message.type));const s=this.stylesForType(this.message.type);return o.style.backgroundColor=s.background?s.background.toString():"",o.style.color=s.foreground?s.foreground.toString():"",o.style.border=s.border?`1px solid ${s.border}`:"",$C(e,o),null},onHide:()=>{this.state="closed"},layout:i}),t=3===this.message.type?mf(0,"Error: {0}",this.message.content):2===this.message.type?mf(0,"Warning: {0}",this.message.content):mf(0,"Info: {0}",this.message.content),dy(t),this.state="open"}_hideMessage(){this.contextViewProvider&&("open"===this.state&&this.contextViewProvider.hideContextView(),this.state="idle")}onValueChange(){this._onDidChange.fire(this.value),this.validate(),this.updateMirror(),this.input.classList.toggle("empty",!this.value),"open"===this.state&&this.contextViewProvider&&this.contextViewProvider.layout()}updateMirror(){if(!this.mirror)return;const e=this.value,t=10===e.charCodeAt(e.length-1)?" ":"";(e+t).replace(/\u000c/g,"")?this.mirror.textContent=e+t:this.mirror.innerText=" ",this.layout()}style(e){this.inputBackground=e.inputBackground,this.inputForeground=e.inputForeground,this.inputBorder=e.inputBorder,this.inputValidationInfoBackground=e.inputValidationInfoBackground,this.inputValidationInfoForeground=e.inputValidationInfoForeground,this.inputValidationInfoBorder=e.inputValidationInfoBorder,this.inputValidationWarningBackground=e.inputValidationWarningBackground,this.inputValidationWarningForeground=e.inputValidationWarningForeground,this.inputValidationWarningBorder=e.inputValidationWarningBorder,this.inputValidationErrorBackground=e.inputValidationErrorBackground,this.inputValidationErrorForeground=e.inputValidationErrorForeground,this.inputValidationErrorBorder=e.inputValidationErrorBorder,this.applyStyles()}applyStyles(){const e=this.inputBackground?this.inputBackground.toString():"",t=this.inputForeground?this.inputForeground.toString():"",i=this.inputBorder?this.inputBorder.toString():"";this.element.style.backgroundColor=e,this.element.style.color=t,this.input.style.backgroundColor="inherit",this.input.style.color=t,this.element.style.borderWidth=i?"1px":"",this.element.style.borderStyle=i?"solid":"",this.element.style.borderColor=i}layout(){if(!this.mirror)return;const e=this.cachedContentHeight;this.cachedContentHeight=LC(this.mirror),e!==this.cachedContentHeight&&(this.cachedHeight=Math.min(this.cachedContentHeight,this.maxHeight),this.input.style.height=this.cachedHeight+"px",this._onDidHeightChange.fire(this.cachedContentHeight))}insertAtCursor(e){const t=this.inputElement,i=t.selectionStart,n=t.selectionEnd,o=t.value;null!==i&&null!==n&&(this.value=o.substr(0,i)+e+o.substr(n),t.setSelectionRange(i+1,i+1),this.layout())}dispose(){this._hideMessage(),this.message=null,this.actionbar&&this.actionbar.dispose(),super.dispose()}}class TU extends IU{constructor(e,t,i){const n=mf(0,"for history"),o=` or ⇅ ${n}`,s=` (⇅ ${n})`;super(e,t,i),this.history=new LU(i.history,100);const r=()=>{if(i.showHistoryHint&&i.showHistoryHint()&&!this.placeholder.endsWith(o)&&!this.placeholder.endsWith(s)&&this.history.getHistory().length){const e=this.placeholder.endsWith(")")?o:s,t=this.placeholder+e;i.showPlaceholderOnFocus&&document.activeElement!==this.input?this.placeholder=t:this.setPlaceHolder(t)}};this.observer=new MutationObserver(((e,t)=>{e.forEach((e=>{e.target.textContent||r()}))})),this.observer.observe(this.input,{attributeFilter:["class"]}),this.onfocus(this.input,(()=>r())),this.onblur(this.input,(()=>{const e=e=>{if(this.placeholder.endsWith(e)){const t=this.placeholder.slice(0,this.placeholder.length-e.length);return i.showPlaceholderOnFocus?this.placeholder=t:this.setPlaceHolder(t),!0}return!1};e(s)||e(o)}))}dispose(){super.dispose(),this.observer&&(this.observer.disconnect(),this.observer=void 0)}addToHistory(){this.value&&this.value!==this.getCurrentValue()&&this.history.add(this.value)}showNextValue(){this.history.has(this.value)||this.addToHistory();let e=this.getNextValue();e&&(e=e===this.value?this.getNextValue():e),e&&(this.value=e,cy(this.value))}showPreviousValue(){this.history.has(this.value)||this.addToHistory();let e=this.getPreviousValue();e&&(e=e===this.value?this.getPreviousValue():e),e&&(this.value=e,cy(this.value))}getCurrentValue(){let e=this.history.current();return e||(e=this.history.last(),this.history.next()),e}getPreviousValue(){return this.history.previous()||this.history.first()}getNextValue(){return this.history.next()||this.history.last()}}const MU=YC;class AU extends Uo{constructor(e){super(),this.parent=e,this.onKeyDown=e=>nC(this.inputBox.inputElement,zC.KEY_DOWN,(t=>{e(new jw(t))})),this.onMouseDown=e=>nC(this.inputBox.inputElement,zC.MOUSE_DOWN,(t=>{e(new Gw(t))})),this.onDidChange=e=>this.inputBox.onDidChange(e),this.container=$C(this.parent,MU(".quick-input-box")),this.inputBox=this._register(new IU(this.container,void 0))}get value(){return this.inputBox.value}set value(e){this.inputBox.value=e}select(e=null){this.inputBox.select(e)}isSelectionAtEnd(){return this.inputBox.isSelectionAtEnd()}get placeholder(){return this.inputBox.inputElement.getAttribute("placeholder")||""}set placeholder(e){this.inputBox.setPlaceHolder(e)}get ariaLabel(){return this.inputBox.getAriaLabel()}set ariaLabel(e){this.inputBox.setAriaLabel(e)}get password(){return"password"===this.inputBox.inputElement.type}set password(e){this.inputBox.inputElement.type=e?"password":"text"}setAttribute(e,t){this.inputBox.inputElement.setAttribute(e,t)}removeAttribute(e){this.inputBox.inputElement.removeAttribute(e)}showDecoration(e){e===fF.Ignore?this.inputBox.hideMessage():this.inputBox.showMessage({type:e===fF.Info?1:e===fF.Warning?2:3,content:""})}stylesForType(e){return this.inputBox.stylesForType(e===fF.Info?1:e===fF.Warning?2:3)}setFocus(){this.inputBox.focus()}layout(){this.inputBox.layout()}style(e){this.inputBox.style(e)}}class OU{constructor(e,t){var i;this.text="",this.title="",this.highlights=[],this.didEverRender=!1,this.supportIcons=null!==(i=null==t?void 0:t.supportIcons)&&void 0!==i&&i,this.domNode=$C(e,YC("span.monaco-highlighted-label"))}get element(){return this.domNode}set(e,t=[],i="",n){e||(e=""),n&&(e=OU.escapeNewLines(e,t)),this.didEverRender&&this.text===e&&this.title===i&&Ho(this.highlights,t)||(this.text=e,this.title=i,this.highlights=t,this.render())}render(){const e=[];let t=0;for(const i of this.highlights){if(i.end===i.start)continue;if(t<i.start){const n=this.text.substring(t,i.start);e.push(YC("span",void 0,...this.supportIcons?Jj(n):[n])),t=i.end}const n=this.text.substring(i.start,i.end),o=YC("span.highlight",void 0,...this.supportIcons?Jj(n):[n]);i.extraClasses&&o.classList.add(...i.extraClasses),e.push(o),t=i.end}if(t<this.text.length){const i=this.text.substring(t);e.push(YC("span",void 0,...this.supportIcons?Jj(i):[i]))}KC(this.domNode,...e),this.title?this.domNode.title=this.title:this.domNode.removeAttribute("title"),this.didEverRender=!0}static escapeNewLines(e,t){let i=0,n=0;return e.replace(/\r\n|\r|\n/g,((e,o)=>{n="\r\n"===e?-1:0,o+=i;for(const i of t)i.end<=o||(i.start>=o&&(i.start+=n),i.end>=o&&(i.end+=n));return i+=n,"⏎"}))}}class RU{constructor(e="",t=!1){var i,n,o;if(this.value=e,"string"!=typeof this.value)throw Ms("value");"boolean"==typeof t?(this.isTrusted=t,this.supportThemeIcons=!1,this.supportHtml=!1):(this.isTrusted=null!==(i=t.isTrusted)&&void 0!==i?i:void 0,this.supportThemeIcons=null!==(n=t.supportThemeIcons)&&void 0!==n&&n,this.supportHtml=null!==(o=t.supportHtml)&&void 0!==o&&o)}appendText(e,t=0){return this.value+=function(e){return e.replace(/[\\`*_{}[\]()#+\-!]/g,"\\$&")}(this.supportThemeIcons?function(e){return e.replace(IH,((e,t)=>t?e:`\\${e}`))}(e):e).replace(/([ \t]+)/g,((e,t)=>" ".repeat(t.length))).replace(/\>/gm,"\\>").replace(/\n/g,1===t?"\\\n":"\n\n"),this}appendMarkdown(e){return this.value+=e,this}appendCodeblock(e,t){return this.value+="\n```",this.value+=e,this.value+="\n",this.value+=t,this.value+="\n```\n",this}}function PU(e){return FU(e)?!e.value:!Array.isArray(e)||e.every(PU)}function FU(e){return e instanceof RU||!(!e||"object"!=typeof e)&&!("string"!=typeof e.value||"boolean"!=typeof e.isTrusted&&void 0!==e.isTrusted||"boolean"!=typeof e.supportThemeIcons&&void 0!==e.supportThemeIcons)}function BU(e){return e?e.replace(/\\([\\`*_{}[\]()#+\-.!])/g,"$1"):e}var VU=globalThis&&globalThis.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{l(n.next(e))}catch(t){s(t)}}function a(e){try{l(n.throw(e))}catch(t){s(t)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}l((n=n.apply(e,t||[])).next())}))};class WU{constructor(e,t,i){this.hoverDelegate=e,this.target=t,this.fadeInAnimation=i}update(e,t){var i;return VU(this,void 0,void 0,(function*(){if(this._cancellationTokenSource&&(this._cancellationTokenSource.dispose(!0),this._cancellationTokenSource=void 0),this.isDisposed)return;let n;if(void 0===e||Gs(e)||e instanceof HTMLElement)n=e;else if(ua(e.markdown)){this._hoverWidget||this.show(mf(0,"Loading..."),t),this._cancellationTokenSource=new as;const i=this._cancellationTokenSource.token;if(n=yield e.markdown(i),void 0===n&&(n=e.markdownNotSupportedFallback),this.isDisposed||i.isCancellationRequested)return}else n=null!==(i=e.markdown)&&void 0!==i?i:e.markdownNotSupportedFallback;this.show(n,t)}))}show(e,t){const i=this._hoverWidget;if(this.hasContent(e)){const n={content:e,target:this.target,showPointer:"element"===this.hoverDelegate.placement,hoverPosition:2,skipFadeInAnimation:!this.fadeInAnimation||!!i};this._hoverWidget=this.hoverDelegate.showHover(n,t)}null==i||i.dispose()}hasContent(e){return!!e&&(!FU(e)||!!e.value)}get isDisposed(){var e;return null===(e=this._hoverWidget)||void 0===e?void 0:e.isDisposed}dispose(){var e,t;null===(e=this._hoverWidget)||void 0===e||e.dispose(),null===(t=this._cancellationTokenSource)||void 0===t||t.dispose(!0),this._cancellationTokenSource=void 0}}class zU{constructor(e){this._element=e}get element(){return this._element}set textContent(e){this.disposed||e===this._textContent||(this._textContent=e,this._element.textContent=e)}set className(e){this.disposed||e===this._className||(this._className=e,this._element.className=e)}set empty(e){this.disposed||e===this._empty||(this._empty=e,this._element.style.marginLeft=e?"0":"")}dispose(){this.disposed=!0}}class HU extends Uo{constructor(e,t){super(),this.customHovers=new Map,this.domNode=this._register(new zU($C(e,YC(".monaco-icon-label")))),this.labelContainer=$C(this.domNode.element,YC(".monaco-icon-label-container"));const i=$C(this.labelContainer,YC("span.monaco-icon-name-container"));this.descriptionContainer=this._register(new zU($C(this.labelContainer,YC("span.monaco-icon-description-container")))),(null==t?void 0:t.supportHighlights)||(null==t?void 0:t.supportIcons)?this.nameNode=new UU(i,!!t.supportIcons):this.nameNode=new jU(i),(null==t?void 0:t.supportDescriptionHighlights)?this.descriptionNodeFactory=()=>new OU($C(this.descriptionContainer.element,YC("span.label-description")),{supportIcons:!!t.supportIcons}):this.descriptionNodeFactory=()=>this._register(new zU($C(this.descriptionContainer.element,YC("span.label-description")))),this.hoverDelegate=null==t?void 0:t.hoverDelegate}get element(){return this.domNode.element}setLabel(e,t,i){const n=["monaco-icon-label"];i&&(i.extraClasses&&n.push(...i.extraClasses),i.italic&&n.push("italic"),i.strikethrough&&n.push("strikethrough")),this.domNode.className=n.join(" "),this.setupHover((null==i?void 0:i.descriptionTitle)?this.labelContainer:this.element,null==i?void 0:i.title),this.nameNode.setLabel(e,i),(t||this.descriptionNode)&&(this.descriptionNode||(this.descriptionNode=this.descriptionNodeFactory()),this.descriptionNode instanceof OU?(this.descriptionNode.set(t||"",i?i.descriptionMatches:void 0),this.setupHover(this.descriptionNode.element,null==i?void 0:i.descriptionTitle)):(this.descriptionNode.textContent=t||"",this.setupHover(this.descriptionNode.element,(null==i?void 0:i.descriptionTitle)||""),this.descriptionNode.empty=!t))}setupHover(e,t){const i=this.customHovers.get(e);if(i&&(i.dispose(),this.customHovers.delete(e)),t)if(this.hoverDelegate){const i=function(e,t,i){let n,o;const s=(t,i)=>{var s;t&&(null==o||o.dispose(),o=void 0),i&&(null==n||n.dispose(),n=void 0),null===(s=e.onDidHideHover)||void 0===s||s.call(e)},r=(n,s,r)=>new rb((()=>VU(this,void 0,void 0,(function*(){o&&!o.isDisposed||(o=new WU(e,r||t,n>0),yield o.update(i,s))}))),n),a=nC(t,zC.MOUSE_OVER,(()=>{if(n)return;const i=new ws;i.add(nC(t,zC.MOUSE_LEAVE,(e=>s(!1,e.fromElement===t)),!0)),i.add(nC(t,zC.MOUSE_DOWN,(()=>s(!0,!0)),!0));const o={targetElements:[t],dispose:()=>{}};if(void 0===e.placement||"mouse"===e.placement){const e=e=>o.x=e.x+10;i.add(nC(t,zC.MOUSE_MOVE,e,!0))}i.add(r(e.delay,!1,o)),n=i}),!0);return{show:e=>{s(!1,!0),r(0,e)},hide:()=>{s(!0,!0)},update:e=>VU(this,void 0,void 0,(function*(){i=e,yield null==o?void 0:o.update(i)})),dispose:()=>{a.dispose(),s(!0,!0)}}}(this.hoverDelegate,e,t);i&&this.customHovers.set(e,i)}else!function(e,t){Gs(t)?e.title=AH(t):(null==t?void 0:t.markdownNotSupportedFallback)?e.title=t.markdownNotSupportedFallback:e.removeAttribute("title")}(e,t);else e.removeAttribute("title")}dispose(){super.dispose();for(const e of this.customHovers.values())e.dispose();this.customHovers.clear()}}class jU{constructor(e){this.container=e,this.label=void 0,this.singleLabel=void 0}setLabel(e,t){if(this.label!==e||!Ho(this.options,t))if(this.label=e,this.options=t,"string"==typeof e)this.singleLabel||(this.container.innerText="",this.container.classList.remove("multiple"),this.singleLabel=$C(this.container,YC("a.label-name",{id:null==t?void 0:t.domId}))),this.singleLabel.textContent=e;else{this.container.innerText="",this.container.classList.add("multiple"),this.singleLabel=void 0;for(let i=0;i<e.length;i++){const n=e[i],o=(null==t?void 0:t.domId)&&`${null==t?void 0:t.domId}_${i}`;$C(this.container,YC("a.label-name",{id:o,"data-icon-label-count":e.length,"data-icon-label-index":i,role:"treeitem"},n)),i<e.length-1&&$C(this.container,YC("span.label-separator",void 0,(null==t?void 0:t.separator)||"/"))}}}}class UU{constructor(e,t){this.container=e,this.supportIcons=t,this.label=void 0,this.singleLabel=void 0}setLabel(e,t){if(this.label!==e||!Ho(this.options,t))if(this.label=e,this.options=t,"string"==typeof e)this.singleLabel||(this.container.innerText="",this.container.classList.remove("multiple"),this.singleLabel=new OU($C(this.container,YC("a.label-name",{id:null==t?void 0:t.domId})),{supportIcons:this.supportIcons})),this.singleLabel.set(e,null==t?void 0:t.matches,void 0,null==t?void 0:t.labelEscapeNewLines);else{this.container.innerText="",this.container.classList.add("multiple"),this.singleLabel=void 0;const i=(null==t?void 0:t.separator)||"/",n=function(e,t,i){if(!i)return;let n=0;return e.map((e=>{const o={start:n,end:n+e.length},s=i.map((e=>QW.intersect(o,e))).filter((e=>!QW.isEmpty(e))).map((({start:e,end:t})=>({start:e-n,end:t-n})));return n=o.end+t.length,s}))}(e,i,null==t?void 0:t.matches);for(let o=0;o<e.length;o++){const s=e[o],r=n?n[o]:void 0,a=YC("a.label-name",{id:(null==t?void 0:t.domId)&&`${null==t?void 0:t.domId}_${o}`,"data-icon-label-count":e.length,"data-icon-label-index":o,role:"treeitem"});new OU($C(this.container,a),{supportIcons:this.supportIcons}).set(s,r,void 0,null==t?void 0:t.labelEscapeNewLines),o<e.length-1&&$C(a,YC("span.label-separator",void 0,i))}}}}const $U=YC;class KU{constructor(e,t,i){this.os=t,this.keyElements=new Set,this.options=i||Object.create(null),this.labelBackground=this.options.keybindingLabelBackground,this.labelForeground=this.options.keybindingLabelForeground,this.labelBorder=this.options.keybindingLabelBorder,this.labelBottomBorder=this.options.keybindingLabelBottomBorder,this.labelShadow=this.options.keybindingLabelShadow,this.domNode=$C(e,$U(".monaco-keybinding")),this.didEverRender=!1,e.appendChild(this.domNode)}get element(){return this.domNode}set(e,t){this.didEverRender&&this.keybinding===e&&KU.areSame(this.matches,t)||(this.keybinding=e,this.matches=t,this.render())}render(){if(this.clear(),this.keybinding){let[e,t]=this.keybinding.getParts();e&&this.renderPart(this.domNode,e,this.matches?this.matches.firstPart:null),t&&($C(this.domNode,$U("span.monaco-keybinding-key-chord-separator",void 0," ")),this.renderPart(this.domNode,t,this.matches?this.matches.chordPart:null)),this.domNode.title=this.keybinding.getAriaLabel()||""}else this.options&&this.options.renderUnboundKeybindings&&this.renderUnbound(this.domNode);this.applyStyles(),this.didEverRender=!0}clear(){eC(this.domNode),this.keyElements.clear()}renderPart(e,t,i){const n=MW.modifierLabels[this.os];t.ctrlKey&&this.renderKey(e,n.ctrlKey,Boolean(null==i?void 0:i.ctrlKey),n.separator),t.shiftKey&&this.renderKey(e,n.shiftKey,Boolean(null==i?void 0:i.shiftKey),n.separator),t.altKey&&this.renderKey(e,n.altKey,Boolean(null==i?void 0:i.altKey),n.separator),t.metaKey&&this.renderKey(e,n.metaKey,Boolean(null==i?void 0:i.metaKey),n.separator);const o=t.keyLabel;o&&this.renderKey(e,o,Boolean(null==i?void 0:i.keyCode),"")}renderKey(e,t,i,n){$C(e,this.createKeyElement(t,i?".highlight":"")),n&&$C(e,$U("span.monaco-keybinding-key-separator",void 0,n))}renderUnbound(e){$C(e,this.createKeyElement(mf(0,"Unbound")))}createKeyElement(e,t=""){const i=$U("span.monaco-keybinding-key"+t,void 0,e);return this.keyElements.add(i),i}style(e){this.labelBackground=e.keybindingLabelBackground,this.labelForeground=e.keybindingLabelForeground,this.labelBorder=e.keybindingLabelBorder,this.labelBottomBorder=e.keybindingLabelBottomBorder,this.labelShadow=e.keybindingLabelShadow,this.applyStyles()}applyStyles(){var e;if(this.element){for(const t of this.keyElements)this.labelBackground&&(t.style.backgroundColor=null===(e=this.labelBackground)||void 0===e?void 0:e.toString()),this.labelBorder&&(t.style.borderColor=this.labelBorder.toString()),this.labelBottomBorder&&(t.style.borderBottomColor=this.labelBottomBorder.toString()),this.labelShadow&&(t.style.boxShadow=`inset 0 -1px 0 ${this.labelShadow}`);this.labelForeground&&(this.element.style.color=this.labelForeground.toString())}}static areSame(e,t){return e===t||!e&&!t||!!e&&!!t&&Ho(e.firstPart,t.firstPart)&&Ho(e.chordPart,t.chordPart)}}const qU=new cb((()=>{const e=new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"});return{collator:e,collatorIsNumeric:e.resolvedOptions().numeric}}));function GU(e,t,i){const n=e.toLowerCase(),o=t.toLowerCase(),s=function(e,t,i){const n=e.toLowerCase(),o=t.toLowerCase(),s=n.startsWith(i),r=o.startsWith(i);if(s!==r)return s?-1:1;if(s&&r){if(n.length<o.length)return-1;if(n.length>o.length)return 1}return 0}(e,t,i);if(s)return s;const r=n.endsWith(i);if(r!==o.endsWith(i))return r?-1:1;const a=function(e,t,i=!1){const n=e||"",o=t||"",s=qU.value.collator.compare(n,o);return qU.value.collatorIsNumeric&&0===s&&n!==o?n<o?-1:1:s}(n,o);return 0!==a?a:n.localeCompare(o)}new cb((()=>({collator:new Intl.Collator(void 0,{numeric:!0})}))),new cb((()=>({collator:new Intl.Collator(void 0,{numeric:!0,sensitivity:"accent"})})));var ZU=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},YU=globalThis&&globalThis.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{l(n.next(e))}catch(t){s(t)}}function a(e){try{l(n.throw(e))}catch(t){s(t)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}l((n=n.apply(e,t||[])).next())}))};const XU=YC;class QU{constructor(e){this.hidden=!1,this._onChecked=new $o,this.onChecked=this._onChecked.event,Object.assign(this,e)}get checked(){return!!this._checked}set checked(e){e!==this._checked&&(this._checked=e,this._onChecked.fire(e))}dispose(){this._onChecked.dispose()}}class JU{get templateId(){return JU.ID}renderTemplate(e){const t=Object.create(null);t.toDisposeElement=[],t.toDisposeTemplate=[],t.entry=$C(e,XU(".quick-input-list-entry"));const i=$C(t.entry,XU("label.quick-input-list-label"));t.toDisposeTemplate.push(sC(i,zC.CLICK,(e=>{t.checkbox.offsetParent||e.preventDefault()}))),t.checkbox=$C(i,XU("input.quick-input-list-checkbox")),t.checkbox.type="checkbox",t.toDisposeTemplate.push(sC(t.checkbox,zC.CHANGE,(e=>{t.element.checked=t.checkbox.checked})));const n=$C(i,XU(".quick-input-list-rows")),o=$C(n,XU(".quick-input-list-row")),s=$C(n,XU(".quick-input-list-row"));t.label=new HU(o,{supportHighlights:!0,supportDescriptionHighlights:!0,supportIcons:!0});const r=$C(o,XU(".quick-input-list-entry-keybinding"));t.keybinding=new KU(r,Xs);const a=$C(s,XU(".quick-input-list-label-meta"));return t.detail=new HU(a,{supportHighlights:!0,supportIcons:!0}),t.separator=$C(t.entry,XU(".quick-input-list-separator")),t.actionBar=new vB(t.entry),t.actionBar.domNode.classList.add("quick-input-list-entry-action-bar"),t.toDisposeTemplate.push(t.actionBar),t}renderElement(e,t,i){i.toDisposeElement=bs(i.toDisposeElement),i.element=e,i.checkbox.checked=e.checked,i.toDisposeElement.push(e.onChecked((e=>i.checkbox.checked=e)));const{labelHighlights:n,descriptionHighlights:o,detailHighlights:s}=e,r=Object.create(null);r.matches=n||[],r.descriptionTitle=e.saneDescription,r.descriptionMatches=o||[],r.extraClasses=e.item.iconClasses,r.italic=e.item.italic,r.strikethrough=e.item.strikethrough,i.label.setLabel(e.saneLabel,e.saneDescription,r),i.keybinding.set(e.item.keybinding),e.saneDetail&&i.detail.setLabel(e.saneDetail,void 0,{matches:s,title:e.saneDetail}),e.separator&&e.separator.label?(i.separator.textContent=e.separator.label,i.separator.style.display=""):i.separator.style.display="none",i.entry.classList.toggle("quick-input-list-separator-border",!!e.separator),i.actionBar.clear();const a=e.item.buttons;a&&a.length?(i.actionBar.push(a.map(((t,i)=>{let n=t.iconClass||(t.iconPath?fU(t.iconPath):void 0);t.alwaysVisible&&(n=n?`${n} always-visible`:"always-visible");const o=new my(`id-${i}`,"",n,!0,(()=>YU(this,void 0,void 0,(function*(){e.fireButtonTriggered({button:t,item:e.item})}))));return o.tooltip=t.tooltip||"",o})),{icon:!0,label:!1}),i.entry.classList.add("has-actions")):i.entry.classList.remove("has-actions")}disposeElement(e,t,i){i.toDisposeElement=bs(i.toDisposeElement)}disposeTemplate(e){e.toDisposeElement=bs(e.toDisposeElement),e.toDisposeTemplate=bs(e.toDisposeTemplate)}}JU.ID="listelement";class e${getHeight(e){return e.saneDetail?44:22}getTemplateId(e){return JU.ID}}var t$;!function(e){e[e.First=1]="First",e[e.Second=2]="Second",e[e.Last=3]="Last",e[e.Next=4]="Next",e[e.Previous=5]="Previous",e[e.NextPage=6]="NextPage",e[e.PreviousPage=7]="PreviousPage"}(t$||(t$={}));class i${constructor(e,t,i){this.parent=e,this.inputElements=[],this.elements=[],this.elementsToIndexes=new Map,this.matchOnDescription=!1,this.matchOnDetail=!1,this.matchOnLabel=!0,this.matchOnMeta=!0,this.sortByLabel=!0,this._onChangedAllVisibleChecked=new $o,this.onChangedAllVisibleChecked=this._onChangedAllVisibleChecked.event,this._onChangedCheckedCount=new $o,this.onChangedCheckedCount=this._onChangedCheckedCount.event,this._onChangedVisibleCount=new $o,this.onChangedVisibleCount=this._onChangedVisibleCount.event,this._onChangedCheckedElements=new $o,this.onChangedCheckedElements=this._onChangedCheckedElements.event,this._onButtonTriggered=new $o,this.onButtonTriggered=this._onButtonTriggered.event,this._onKeyDown=new $o,this.onKeyDown=this._onKeyDown.event,this._onLeave=new $o,this.onLeave=this._onLeave.event,this._fireCheckedEvents=!0,this.elementDisposables=[],this.disposables=[],this.id=t,this.container=$C(this.parent,XU(".quick-input-list"));const n=new e$,o=new n$;this.list=i.createList("QuickInput",this.container,n,[new JU],{identityProvider:{getId:e=>e.saneLabel},setRowLineHeight:!1,multipleSelectionSupport:!1,horizontalScrolling:!1,accessibilityProvider:o}),this.list.getHTMLElement().id=t,this.disposables.push(this.list),this.disposables.push(this.list.onKeyDown((e=>{const t=new jw(e);switch(t.keyCode){case 10:this.toggleCheckbox();break;case 31:(zo?e.metaKey:e.ctrlKey)&&this.list.setFocus(Oa(this.list.length));break;case 16:{const e=this.list.getFocus();1===e.length&&0===e[0]&&this._onLeave.fire();break}case 18:{const e=this.list.getFocus();1===e.length&&e[0]===this.list.length-1&&this._onLeave.fire();break}}this._onKeyDown.fire(t)}))),this.disposables.push(this.list.onMouseDown((e=>{2!==e.browserEvent.button&&e.browserEvent.preventDefault()}))),this.disposables.push(nC(this.container,zC.CLICK,(e=>{(e.x||e.y)&&this._onLeave.fire()}))),this.disposables.push(this.list.onMouseMiddleClick((e=>{this._onLeave.fire()}))),this.disposables.push(this.list.onContextMenu((e=>{"number"==typeof e.index&&(e.browserEvent.preventDefault(),this.list.setSelection([e.index]))}))),this.disposables.push(this._onChangedAllVisibleChecked,this._onChangedCheckedCount,this._onChangedVisibleCount,this._onChangedCheckedElements,this._onButtonTriggered,this._onLeave,this._onKeyDown)}get onDidChangeFocus(){return ds.map(this.list.onDidChangeFocus,(e=>e.elements.map((e=>e.item))))}get onDidChangeSelection(){return ds.map(this.list.onDidChangeSelection,(e=>({items:e.elements.map((e=>e.item)),event:e.browserEvent})))}get scrollTop(){return this.list.scrollTop}set scrollTop(e){this.list.scrollTop=e}getAllVisibleChecked(){return this.allVisibleChecked(this.elements,!1)}allVisibleChecked(e,t=!0){for(let i=0,n=e.length;i<n;i++){const n=e[i];if(!n.hidden){if(!n.checked)return!1;t=!0}}return t}getCheckedCount(){let e=0;const t=this.elements;for(let i=0,n=t.length;i<n;i++)t[i].checked&&e++;return e}getVisibleCount(){let e=0;const t=this.elements;for(let i=0,n=t.length;i<n;i++)t[i].hidden||e++;return e}setAllVisibleChecked(e){try{this._fireCheckedEvents=!1,this.elements.forEach((t=>{t.hidden||(t.checked=e)}))}finally{this._fireCheckedEvents=!0,this.fireCheckedEvents()}}setElements(e){this.elementDisposables=bs(this.elementDisposables);const t=e=>this.fireButtonTriggered(e);this.inputElements=e,this.elements=e.reduce(((i,n,o)=>{var s,r,a;if("separator"!==n.type){const l=o&&e[o-1],d=n.label&&n.label.replace(/\r?\n/g," "),c=n.meta&&n.meta.replace(/\r?\n/g," "),h=n.description&&n.description.replace(/\r?\n/g," "),u=n.detail&&n.detail.replace(/\r?\n/g," "),g=n.ariaLabel||[d,h,u].map((e=>Ra(e))).filter((e=>!!e)).join(", "),p=this.parent.classList.contains("show-checkboxes");i.push(new QU({hasCheckbox:p,index:o,item:n,saneLabel:d,saneMeta:c,saneAriaLabel:g,saneDescription:h,saneDetail:u,labelHighlights:null===(s=n.highlights)||void 0===s?void 0:s.label,descriptionHighlights:null===(r=n.highlights)||void 0===r?void 0:r.description,detailHighlights:null===(a=n.highlights)||void 0===a?void 0:a.detail,checked:!1,separator:l&&"separator"===l.type?l:void 0,fireButtonTriggered:t}))}return i}),[]),this.elementDisposables.push(...this.elements),this.elementDisposables.push(...this.elements.map((e=>e.onChecked((()=>this.fireCheckedEvents()))))),this.elementsToIndexes=this.elements.reduce(((e,t,i)=>(e.set(t.item,i),e)),new Map),this.list.splice(0,this.list.length),this.list.splice(0,this.list.length,this.elements),this._onChangedVisibleCount.fire(this.elements.length)}getFocusedElements(){return this.list.getFocusedElements().map((e=>e.item))}setFocusedElements(e){if(this.list.setFocus(e.filter((e=>this.elementsToIndexes.has(e))).map((e=>this.elementsToIndexes.get(e)))),e.length>0){const e=this.list.getFocus()[0];"number"==typeof e&&this.list.reveal(e)}}getActiveDescendant(){return this.list.getHTMLElement().getAttribute("aria-activedescendant")}setSelectedElements(e){this.list.setSelection(e.filter((e=>this.elementsToIndexes.has(e))).map((e=>this.elementsToIndexes.get(e))))}getCheckedElements(){return this.elements.filter((e=>e.checked)).map((e=>e.item))}setCheckedElements(e){try{this._fireCheckedEvents=!1;const t=new Set;for(const i of e)t.add(i);for(const e of this.elements)e.checked=t.has(e.item)}finally{this._fireCheckedEvents=!0,this.fireCheckedEvents()}}set enabled(e){this.list.getHTMLElement().style.pointerEvents=e?"":"none"}focus(e){if(!this.list.length)return;switch(e===t$.Next&&this.list.getFocus()[0]===this.list.length-1&&(e=t$.First),e===t$.Previous&&0===this.list.getFocus()[0]&&(e=t$.Last),e===t$.Second&&this.list.length<2&&(e=t$.First),e){case t$.First:this.list.focusFirst();break;case t$.Second:this.list.focusNth(1);break;case t$.Last:this.list.focusLast();break;case t$.Next:this.list.focusNext();break;case t$.Previous:this.list.focusPrevious();break;case t$.NextPage:this.list.focusNextPage();break;case t$.PreviousPage:this.list.focusPreviousPage()}const t=this.list.getFocus()[0];"number"==typeof t&&this.list.reveal(t)}clearFocus(){this.list.setFocus([])}domFocus(){this.list.domFocus()}layout(e){this.list.getHTMLElement().style.maxHeight=e?`calc(${44*Math.floor(e/44)}px)`:"",this.list.layout()}filter(e){if(!(this.sortByLabel||this.matchOnLabel||this.matchOnDescription||this.matchOnDetail))return this.list.layout(),!1;if((e=e.trim())&&(this.matchOnLabel||this.matchOnDescription||this.matchOnDetail)){let t;this.elements.forEach((i=>{const n=this.matchOnLabel?Qs(RH(e,OH(i.saneLabel))):void 0,o=this.matchOnDescription?Qs(RH(e,OH(i.saneDescription||""))):void 0,s=this.matchOnDetail?Qs(RH(e,OH(i.saneDetail||""))):void 0,r=this.matchOnMeta?Qs(RH(e,OH(i.saneMeta||""))):void 0;if(n||o||s||r?(i.labelHighlights=n,i.descriptionHighlights=o,i.detailHighlights=s,i.hidden=!1):(i.labelHighlights=void 0,i.descriptionHighlights=void 0,i.detailHighlights=void 0,i.hidden=!i.item.alwaysShow),i.separator=void 0,!this.sortByLabel){const e=i.index&&this.inputElements[i.index-1];t=e&&"separator"===e.type?e:t,t&&!i.hidden&&(i.separator=t,t=void 0)}}))}else this.elements.forEach((e=>{e.labelHighlights=void 0,e.descriptionHighlights=void 0,e.detailHighlights=void 0,e.hidden=!1;const t=e.index&&this.inputElements[e.index-1];e.separator=t&&"separator"===t.type?t:void 0}));const t=this.elements.filter((e=>!e.hidden));if(this.sortByLabel&&e){const i=e.toLowerCase();t.sort(((e,t)=>function(e,t,i){const n=e.labelHighlights||[],o=t.labelHighlights||[];if(n.length&&!o.length)return-1;if(!n.length&&o.length)return 1;if(0===n.length&&0===o.length)return 0;return GU(e.saneLabel,t.saneLabel,i)}(e,t,i)))}return this.elementsToIndexes=t.reduce(((e,t,i)=>(e.set(t.item,i),e)),new Map),this.list.splice(0,this.list.length,t),this.list.setFocus([]),this.list.layout(),this._onChangedAllVisibleChecked.fire(this.getAllVisibleChecked()),this._onChangedVisibleCount.fire(t.length),!0}toggleCheckbox(){try{this._fireCheckedEvents=!1;const e=this.list.getFocusedElements(),t=this.allVisibleChecked(e);for(const i of e)i.checked=!t}finally{this._fireCheckedEvents=!0,this.fireCheckedEvents()}}display(e){this.container.style.display=e?"":"none"}isDisplayed(){return"none"!==this.container.style.display}dispose(){this.elementDisposables=bs(this.elementDisposables),this.disposables=bs(this.disposables)}fireCheckedEvents(){this._fireCheckedEvents&&(this._onChangedAllVisibleChecked.fire(this.getAllVisibleChecked()),this._onChangedCheckedCount.fire(this.getCheckedCount()),this._onChangedCheckedElements.fire(this.getCheckedElements()))}fireButtonTriggered(e){this._onButtonTriggered.fire(e)}style(e){this.list.style(e)}}ZU([tS],i$.prototype,"onDidChangeFocus",null),ZU([tS],i$.prototype,"onDidChangeSelection",null);class n${getWidgetAriaLabel(){return mf(0,"Quick Input")}getAriaLabel(e){return e.saneAriaLabel}getWidgetRole(){return"listbox"}getRole(e){return e.hasCheckbox?"checkbox":"option"}isChecked(e){if(e.hasCheckbox)return{value:e.checked,onDidChange:e.onChecked}}}var o$=globalThis&&globalThis.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{l(n.next(e))}catch(t){s(t)}}function a(e){try{l(n.throw(e))}catch(t){s(t)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}l((n=n.apply(e,t||[])).next())}))};const s$=YC,r$={iconClass:br.quickInputBack.classNames,tooltip:mf(0,"Back"),handle:-1};class a$ extends Uo{constructor(e){super(),this.ui=e,this.visible=!1,this._enabled=!0,this._busy=!1,this._ignoreFocusOut=!1,this._buttons=[],this.noValidationMessage=a$.noPromptMessage,this._severity=fF.Ignore,this.buttonsUpdated=!1,this.onDidTriggerButtonEmitter=this._register(new $o),this.onDidHideEmitter=this._register(new $o),this.onDisposeEmitter=this._register(new $o),this.visibleDisposables=this._register(new ws),this.onDidHide=this.onDidHideEmitter.event}get title(){return this._title}set title(e){this._title=e,this.update()}get description(){return this._description}set description(e){this._description=e,this.update()}get step(){return this._steps}set step(e){this._steps=e,this.update()}get totalSteps(){return this._totalSteps}set totalSteps(e){this._totalSteps=e,this.update()}get enabled(){return this._enabled}set enabled(e){this._enabled=e,this.update()}get contextKey(){return this._contextKey}set contextKey(e){this._contextKey=e,this.update()}get busy(){return this._busy}set busy(e){this._busy=e,this.update()}get ignoreFocusOut(){return this._ignoreFocusOut}set ignoreFocusOut(e){const t=this._ignoreFocusOut!==e&&!Vs;this._ignoreFocusOut=e&&!Vs,t&&this.update()}get buttons(){return this._buttons}set buttons(e){this._buttons=e,this.buttonsUpdated=!0,this.update()}get validationMessage(){return this._validationMessage}set validationMessage(e){this._validationMessage=e,this.update()}get severity(){return this._severity}set severity(e){this._severity=e,this.update()}show(){this.visible||(this.visibleDisposables.add(this.ui.onDidTriggerButton((e=>{-1!==this.buttons.indexOf(e)&&this.onDidTriggerButtonEmitter.fire(e)}))),this.ui.show(this),this.visible=!0,this._lastValidationMessage=void 0,this._lastSeverity=void 0,this.buttons.length&&(this.buttonsUpdated=!0),this.update())}hide(){this.visible&&this.ui.hide()}didHide(e=vU.Other){this.visible=!1,this.visibleDisposables.clear(),this.onDidHideEmitter.fire({reason:e})}update(){if(!this.visible)return;const e=this.getTitle();e&&this.ui.title.textContent!==e?this.ui.title.textContent=e:e||" "===this.ui.title.innerHTML||(this.ui.title.innerText=" ");const t=this.getDescription();if(this.ui.description1.textContent!==t&&(this.ui.description1.textContent=t),this.ui.description2.textContent!==t&&(this.ui.description2.textContent=t),this.busy&&!this.busyDelay&&(this.busyDelay=new rb,this.busyDelay.setIfNotSet((()=>{this.visible&&this.ui.progressBar.infinite()}),800)),!this.busy&&this.busyDelay&&(this.ui.progressBar.stop(),this.busyDelay.cancel(),this.busyDelay=void 0),this.buttonsUpdated){this.buttonsUpdated=!1,this.ui.leftActionBar.clear();const e=this.buttons.filter((e=>e===r$));this.ui.leftActionBar.push(e.map(((e,t)=>{const i=new my(`id-${t}`,"",e.iconClass||fU(e.iconPath),!0,(()=>o$(this,void 0,void 0,(function*(){this.onDidTriggerButtonEmitter.fire(e)}))));return i.tooltip=e.tooltip||"",i})),{icon:!0,label:!1}),this.ui.rightActionBar.clear();const t=this.buttons.filter((e=>e!==r$));this.ui.rightActionBar.push(t.map(((e,t)=>{const i=new my(`id-${t}`,"",e.iconClass||fU(e.iconPath),!0,(()=>o$(this,void 0,void 0,(function*(){this.onDidTriggerButtonEmitter.fire(e)}))));return i.tooltip=e.tooltip||"",i})),{icon:!0,label:!1})}this.ui.ignoreFocusOut=this.ignoreFocusOut,this.ui.setEnabled(this.enabled),this.ui.setContextKey(this.contextKey);const i=this.validationMessage||this.noValidationMessage;this._lastValidationMessage!==i&&(this._lastValidationMessage=i,KC(this.ui.message,...Jj(i))),this._lastSeverity!==this.severity&&(this._lastSeverity=this.severity,this.showMessageDecoration(this.severity))}getTitle(){return this.title&&this.step?`${this.title} (${this.getSteps()})`:this.title?this.title:this.step?this.getSteps():""}getDescription(){return this.description||""}getSteps(){return this.step&&this.totalSteps?mf(0,"{0}/{1}",this.step,this.totalSteps):this.step?String(this.step):""}showMessageDecoration(e){if(this.ui.inputBox.showDecoration(e),e!==fF.Ignore){const t=this.ui.inputBox.stylesForType(e);this.ui.message.style.color=t.foreground?`${t.foreground}`:"",this.ui.message.style.backgroundColor=t.background?`${t.background}`:"",this.ui.message.style.border=t.border?`1px solid ${t.border}`:"",this.ui.message.style.marginBottom="-2px"}else this.ui.message.style.color="",this.ui.message.style.backgroundColor="",this.ui.message.style.border="",this.ui.message.style.marginBottom=""}dispose(){this.hide(),this.onDisposeEmitter.fire(),super.dispose()}}a$.noPromptMessage=mf(0,"Press 'Enter' to confirm your input or 'Escape' to cancel");class l$ extends a${constructor(){super(...arguments),this._value="",this.onDidChangeValueEmitter=this._register(new $o),this.onWillAcceptEmitter=this._register(new $o),this.onDidAcceptEmitter=this._register(new $o),this.onDidCustomEmitter=this._register(new $o),this._items=[],this.itemsUpdated=!1,this._canSelectMany=!1,this._canAcceptInBackground=!1,this._matchOnDescription=!1,this._matchOnDetail=!1,this._matchOnLabel=!0,this._sortByLabel=!0,this._autoFocusOnList=!0,this._keepScrollPosition=!1,this._itemActivation=this.ui.isScreenReaderOptimized()?bU.NONE:bU.FIRST,this._activeItems=[],this.activeItemsUpdated=!1,this.activeItemsToConfirm=[],this.onDidChangeActiveEmitter=this._register(new $o),this._selectedItems=[],this.selectedItemsUpdated=!1,this.selectedItemsToConfirm=[],this.onDidChangeSelectionEmitter=this._register(new $o),this.onDidTriggerItemButtonEmitter=this._register(new $o),this.valueSelectionUpdated=!0,this._ok="default",this._customButton=!1,this.filterValue=e=>e,this.onDidChangeValue=this.onDidChangeValueEmitter.event,this.onWillAccept=this.onWillAcceptEmitter.event,this.onDidAccept=this.onDidAcceptEmitter.event,this.onDidChangeActive=this.onDidChangeActiveEmitter.event,this.onDidChangeSelection=this.onDidChangeSelectionEmitter.event,this.onDidTriggerItemButton=this.onDidTriggerItemButtonEmitter.event}get quickNavigate(){return this._quickNavigate}set quickNavigate(e){this._quickNavigate=e,this.update()}get value(){return this._value}set value(e){this.doSetValue(e)}doSetValue(e,t){if(this._value!==e){if(this._value=e,t||this.update(),this.visible){this.ui.list.filter(this.filterValue(this._value))&&this.trySelectFirst()}this.onDidChangeValueEmitter.fire(this._value)}}set ariaLabel(e){this._ariaLabel=e,this.update()}get ariaLabel(){return this._ariaLabel}get placeholder(){return this._placeholder}set placeholder(e){this._placeholder=e,this.update()}get items(){return this._items}get scrollTop(){return this.ui.list.scrollTop}set scrollTop(e){this.ui.list.scrollTop=e}set items(e){this._items=e,this.itemsUpdated=!0,this.update()}get canSelectMany(){return this._canSelectMany}set canSelectMany(e){this._canSelectMany=e,this.update()}get canAcceptInBackground(){return this._canAcceptInBackground}set canAcceptInBackground(e){this._canAcceptInBackground=e}get matchOnDescription(){return this._matchOnDescription}set matchOnDescription(e){this._matchOnDescription=e,this.update()}get matchOnDetail(){return this._matchOnDetail}set matchOnDetail(e){this._matchOnDetail=e,this.update()}get matchOnLabel(){return this._matchOnLabel}set matchOnLabel(e){this._matchOnLabel=e,this.update()}get sortByLabel(){return this._sortByLabel}set sortByLabel(e){this._sortByLabel=e,this.update()}get autoFocusOnList(){return this._autoFocusOnList}set autoFocusOnList(e){this._autoFocusOnList=e,this.update()}get keepScrollPosition(){return this._keepScrollPosition}set keepScrollPosition(e){this._keepScrollPosition=e}get itemActivation(){return this._itemActivation}set itemActivation(e){this._itemActivation=e}get activeItems(){return this._activeItems}set activeItems(e){this._activeItems=e,this.activeItemsUpdated=!0,this.update()}get selectedItems(){return this._selectedItems}set selectedItems(e){this._selectedItems=e,this.selectedItemsUpdated=!0,this.update()}get keyMods(){return this._quickNavigate?_U:this.ui.keyMods}set valueSelection(e){this._valueSelection=e,this.valueSelectionUpdated=!0,this.update()}get customButton(){return this._customButton}set customButton(e){this._customButton=e,this.update()}get customLabel(){return this._customButtonLabel}set customLabel(e){this._customButtonLabel=e,this.update()}get customHover(){return this._customButtonHover}set customHover(e){this._customButtonHover=e,this.update()}get ok(){return this._ok}set ok(e){this._ok=e,this.update()}get hideInput(){return!!this._hideInput}set hideInput(e){this._hideInput=e,this.update()}trySelectFirst(){this.autoFocusOnList&&(this.canSelectMany||this.ui.list.focus(t$.First))}show(){this.visible||(this.visibleDisposables.add(this.ui.inputBox.onDidChange((e=>{this.doSetValue(e,!0)}))),this.visibleDisposables.add(this.ui.inputBox.onMouseDown((e=>{this.autoFocusOnList||this.ui.list.clearFocus()}))),this.visibleDisposables.add((this._hideInput?this.ui.list:this.ui.inputBox).onKeyDown((e=>{switch(e.keyCode){case 18:this.ui.list.focus(t$.Next),this.canSelectMany&&this.ui.list.domFocus(),HC(e,!0);break;case 16:this.ui.list.getFocusedElements().length?this.ui.list.focus(t$.Previous):this.ui.list.focus(t$.Last),this.canSelectMany&&this.ui.list.domFocus(),HC(e,!0);break;case 12:this.ui.list.focus(t$.NextPage),this.canSelectMany&&this.ui.list.domFocus(),HC(e,!0);break;case 11:this.ui.list.focus(t$.PreviousPage),this.canSelectMany&&this.ui.list.domFocus(),HC(e,!0);break;case 17:if(!this._canAcceptInBackground)return;if(!this.ui.inputBox.isSelectionAtEnd())return;this.activeItems[0]&&(this._selectedItems=[this.activeItems[0]],this.onDidChangeSelectionEmitter.fire(this.selectedItems),this.handleAccept(!0));break;case 14:!e.ctrlKey&&!e.metaKey||e.shiftKey||e.altKey||(this.ui.list.focus(t$.First),HC(e,!0));break;case 13:!e.ctrlKey&&!e.metaKey||e.shiftKey||e.altKey||(this.ui.list.focus(t$.Last),HC(e,!0))}}))),this.visibleDisposables.add(this.ui.onDidAccept((()=>{this.canSelectMany?this.ui.list.getCheckedElements().length||(this._selectedItems=[],this.onDidChangeSelectionEmitter.fire(this.selectedItems)):this.activeItems[0]&&(this._selectedItems=[this.activeItems[0]],this.onDidChangeSelectionEmitter.fire(this.selectedItems)),this.handleAccept(!1)}))),this.visibleDisposables.add(this.ui.onDidCustom((()=>{this.onDidCustomEmitter.fire()}))),this.visibleDisposables.add(this.ui.list.onDidChangeFocus((e=>{this.activeItemsUpdated||this.activeItemsToConfirm!==this._activeItems&&jo(e,this._activeItems,((e,t)=>e===t))||(this._activeItems=e,this.onDidChangeActiveEmitter.fire(e))}))),this.visibleDisposables.add(this.ui.list.onDidChangeSelection((({items:e,event:t})=>{this.canSelectMany?e.length&&this.ui.list.setSelectedElements([]):this.selectedItemsToConfirm!==this._selectedItems&&jo(e,this._selectedItems,((e,t)=>e===t))||(this._selectedItems=e,this.onDidChangeSelectionEmitter.fire(e),e.length&&this.handleAccept(t instanceof MouseEvent&&1===t.button))}))),this.visibleDisposables.add(this.ui.list.onChangedCheckedElements((e=>{this.canSelectMany&&(this.selectedItemsToConfirm!==this._selectedItems&&jo(e,this._selectedItems,((e,t)=>e===t))||(this._selectedItems=e,this.onDidChangeSelectionEmitter.fire(e)))}))),this.visibleDisposables.add(this.ui.list.onButtonTriggered((e=>this.onDidTriggerItemButtonEmitter.fire(e)))),this.visibleDisposables.add(this.registerQuickNavigation()),this.valueSelectionUpdated=!0),super.show()}handleAccept(e){let t=!1;this.onWillAcceptEmitter.fire({veto:()=>t=!0}),t||this.onDidAcceptEmitter.fire({inBackground:e})}registerQuickNavigation(){return nC(this.ui.container,zC.KEY_UP,(e=>{if(this.canSelectMany||!this._quickNavigate)return;const t=new jw(e),i=t.keyCode;this._quickNavigate.keybindings.some((e=>{const[n,o]=e.getParts();return!o&&(n.shiftKey&&4===i?!(t.ctrlKey||t.altKey||t.metaKey):!(!n.altKey||6!==i)||(!(!n.ctrlKey||5!==i)||!(!n.metaKey||57!==i)))}))&&(this.activeItems[0]&&(this._selectedItems=[this.activeItems[0]],this.onDidChangeSelectionEmitter.fire(this.selectedItems),this.handleAccept(!1)),this._quickNavigate=void 0)}))}update(){if(!this.visible)return;const e=this.keepScrollPosition?this.scrollTop:0,t=!!this._hideInput&&this._items.length>0;this.ui.container.classList.toggle("hidden-input",t&&!this.description);const i={title:!!this.title||!!this.step||!!this.buttons.length,description:!!this.description,checkAll:this.canSelectMany&&!this._hideCheckAll,checkBox:this.canSelectMany,inputBox:!t,progressBar:!t,visibleCount:!0,count:this.canSelectMany,ok:"default"===this.ok?this.canSelectMany:this.ok,list:!0,message:!!this.validationMessage,customButton:this.customButton};this.ui.setVisibilities(i),super.update(),this.ui.inputBox.value!==this.value&&(this.ui.inputBox.value=this.value),this.valueSelectionUpdated&&(this.valueSelectionUpdated=!1,this.ui.inputBox.select(this._valueSelection&&{start:this._valueSelection[0],end:this._valueSelection[1]})),this.ui.inputBox.placeholder!==(this.placeholder||"")&&(this.ui.inputBox.placeholder=this.placeholder||"");const n=this.ariaLabel||this.placeholder||l$.DEFAULT_ARIA_LABEL;if(this.ui.inputBox.ariaLabel!==n&&(this.ui.inputBox.ariaLabel=n),this.ui.list.matchOnDescription=this.matchOnDescription,this.ui.list.matchOnDetail=this.matchOnDetail,this.ui.list.matchOnLabel=this.matchOnLabel,this.ui.list.sortByLabel=this.sortByLabel,this.itemsUpdated)switch(this.itemsUpdated=!1,this.ui.list.setElements(this.items),this.ui.list.filter(this.filterValue(this.ui.inputBox.value)),this.ui.checkAll.checked=this.ui.list.getAllVisibleChecked(),this.ui.visibleCount.setCount(this.ui.list.getVisibleCount()),this.ui.count.setCount(this.ui.list.getCheckedCount()),this._itemActivation){case bU.NONE:this._itemActivation=bU.FIRST;break;case bU.SECOND:this.ui.list.focus(t$.Second),this._itemActivation=bU.FIRST;break;case bU.LAST:this.ui.list.focus(t$.Last),this._itemActivation=bU.FIRST;break;default:this.trySelectFirst()}this.ui.container.classList.contains("show-checkboxes")!==!!this.canSelectMany&&(this.canSelectMany?this.ui.list.clearFocus():this.trySelectFirst()),this.activeItemsUpdated&&(this.activeItemsUpdated=!1,this.activeItemsToConfirm=this._activeItems,this.ui.list.setFocusedElements(this.activeItems),this.activeItemsToConfirm===this._activeItems&&(this.activeItemsToConfirm=null)),this.selectedItemsUpdated&&(this.selectedItemsUpdated=!1,this.selectedItemsToConfirm=this._selectedItems,this.canSelectMany?this.ui.list.setCheckedElements(this.selectedItems):this.ui.list.setSelectedElements(this.selectedItems),this.selectedItemsToConfirm===this._selectedItems&&(this.selectedItemsToConfirm=null)),this.ui.customButton.label=this.customLabel||"",this.ui.customButton.element.title=this.customHover||"",this.ui.setComboboxAccessibility(!0),i.inputBox||(this.ui.list.domFocus(),this.canSelectMany&&this.ui.list.focus(t$.First)),this.keepScrollPosition&&(this.scrollTop=e)}}l$.DEFAULT_ARIA_LABEL=mf(0,"Type to narrow down results.");class d$ extends Uo{constructor(e){super(),this.options=e,this.comboboxAccessibility=!1,this.enabled=!0,this.onDidAcceptEmitter=this._register(new $o),this.onDidCustomEmitter=this._register(new $o),this.onDidTriggerButtonEmitter=this._register(new $o),this.keyMods={ctrlCmd:!1,alt:!1},this.controller=null,this.onShowEmitter=this._register(new $o),this.onShow=this.onShowEmitter.event,this.onHideEmitter=this._register(new $o),this.onHide=this.onHideEmitter.event,this.idPrefix=e.idPrefix,this.parentElement=e.container,this.styles=e.styles,this.registerKeyModsListeners()}registerKeyModsListeners(){const e=e=>{this.keyMods.ctrlCmd=e.ctrlKey||e.metaKey,this.keyMods.alt=e.altKey};this._register(nC(window,zC.KEY_DOWN,e,!0)),this._register(nC(window,zC.KEY_UP,e,!0)),this._register(nC(window,zC.MOUSE_DOWN,e,!0))}getUI(){if(this.ui)return this.ui;const e=$C(this.parentElement,s$(".quick-input-widget.show-file-icons"));e.tabIndex=-1,e.style.display="none";const t=RC(e),i=$C(e,s$(".quick-input-titlebar")),n=this._register(new vB(i));n.domNode.classList.add("quick-input-left-action-bar");const o=$C(i,s$(".quick-input-title")),s=this._register(new vB(i));s.domNode.classList.add("quick-input-right-action-bar");const r=$C(e,s$(".quick-input-description")),a=$C(e,s$(".quick-input-header")),l=$C(a,s$("input.quick-input-check-all"));l.type="checkbox",this._register(sC(l,zC.CHANGE,(e=>{const t=l.checked;y.setAllVisibleChecked(t)}))),this._register(nC(l,zC.CLICK,(e=>{(e.x||e.y)&&u.setFocus()})));const d=$C(a,s$(".quick-input-description")),c=$C(a,s$(".quick-input-and-message")),h=$C(c,s$(".quick-input-filter")),u=this._register(new AU(h));u.setAttribute("aria-describedby",`${this.idPrefix}message`);const g=$C(h,s$(".quick-input-visible-count"));g.setAttribute("aria-live","polite"),g.setAttribute("aria-atomic","true");const p=new oU(g,{countFormat:mf(0,"{0} Results")}),m=$C(h,s$(".quick-input-count"));m.setAttribute("aria-live","polite");const f=new oU(m,{countFormat:mf(0,"{0} Selected")}),_=$C(a,s$(".quick-input-action")),v=new iU(_);v.label=mf(0,"OK"),this._register(v.onDidClick((e=>{this.onDidAcceptEmitter.fire()})));const b=$C(a,s$(".quick-input-action")),w=new iU(b);w.label=mf(0,"Custom"),this._register(w.onDidClick((e=>{this.onDidCustomEmitter.fire()})));const C=$C(c,s$(`#${this.idPrefix}message.quick-input-message`)),y=this._register(new i$(e,this.idPrefix+"list",this.options));this._register(y.onChangedAllVisibleChecked((e=>{l.checked=e}))),this._register(y.onChangedVisibleCount((e=>{p.setCount(e)}))),this._register(y.onChangedCheckedCount((e=>{f.setCount(e)}))),this._register(y.onLeave((()=>{setTimeout((()=>{u.setFocus(),this.controller instanceof l$&&this.controller.canSelectMany&&y.clearFocus()}),0)}))),this._register(y.onDidChangeFocus((()=>{this.comboboxAccessibility&&this.getUI().inputBox.setAttribute("aria-activedescendant",this.getUI().list.getActiveDescendant()||"")})));const x=new hU(e);x.getContainer().classList.add("quick-input-progress");const S=UC(e);return this._register(S),this._register(nC(e,zC.FOCUS,(e=>{this.previousFocusElement=e.relatedTarget instanceof HTMLElement?e.relatedTarget:void 0}),!0)),this._register(S.onDidBlur((()=>{this.getUI().ignoreFocusOut||this.options.ignoreFocusOut()||this.hide(vU.Blur),this.previousFocusElement=void 0}))),this._register(nC(e,zC.FOCUS,(e=>{u.setFocus()}))),this._register(nC(e,zC.KEY_DOWN,(t=>{const i=new jw(t);switch(i.keyCode){case 3:HC(t,!0),this.onDidAcceptEmitter.fire();break;case 9:HC(t,!0),this.hide(vU.Gesture);break;case 2:if(!i.altKey&&!i.ctrlKey&&!i.metaKey){const n=[".action-label.codicon"];e.classList.contains("show-checkboxes")?n.push("input"):n.push("input[type=text]"),this.getUI().list.isDisplayed()&&n.push(".monaco-list");const o=e.querySelectorAll(n.join(", "));i.shiftKey&&i.target===o[0]?(HC(t,!0),o[o.length-1].focus()):i.shiftKey||i.target!==o[o.length-1]||(HC(t,!0),o[0].focus())}}}))),this.ui={container:e,styleSheet:t,leftActionBar:n,titleBar:i,title:o,description1:r,description2:d,rightActionBar:s,checkAll:l,filterContainer:h,inputBox:u,visibleCountContainer:g,visibleCount:p,countContainer:m,count:f,okContainer:_,ok:v,message:C,customButtonContainer:b,customButton:w,list:y,progressBar:x,onDidAccept:this.onDidAcceptEmitter.event,onDidCustom:this.onDidCustomEmitter.event,onDidTriggerButton:this.onDidTriggerButtonEmitter.event,ignoreFocusOut:!1,keyMods:this.keyMods,isScreenReaderOptimized:()=>this.options.isScreenReaderOptimized(),show:e=>this.show(e),hide:()=>this.hide(),setVisibilities:e=>this.setVisibilities(e),setComboboxAccessibility:e=>this.setComboboxAccessibility(e),setEnabled:e=>this.setEnabled(e),setContextKey:e=>this.options.setContextKey(e)},this.updateStyles(),this.ui}pick(e,t={},i=Ia.None){return new Promise(((n,o)=>{let s=e=>{s=n,t.onKeyMods&&t.onKeyMods(r.keyMods),n(e)};if(i.isCancellationRequested)return void s(void 0);const r=this.createQuickPick();let a;const l=[r,r.onDidAccept((()=>{if(r.canSelectMany)s(r.selectedItems.slice()),r.hide();else{const e=r.activeItems[0];e&&(s(e),r.hide())}})),r.onDidChangeActive((e=>{const i=e[0];i&&t.onDidFocus&&t.onDidFocus(i)})),r.onDidChangeSelection((e=>{if(!r.canSelectMany){const t=e[0];t&&(s(t),r.hide())}})),r.onDidTriggerItemButton((e=>t.onDidTriggerItemButton&&t.onDidTriggerItemButton(Object.assign(Object.assign({},e),{removeItem:()=>{const t=r.items.indexOf(e.item);if(-1!==t){const e=r.items.slice(),i=e.splice(t,1),n=r.activeItems.filter((e=>e!==i[0])),o=r.keepScrollPosition;r.keepScrollPosition=!0,r.items=e,n&&(r.activeItems=n),r.keepScrollPosition=o}}})))),r.onDidChangeValue((e=>{!a||e||1===r.activeItems.length&&r.activeItems[0]===a||(r.activeItems=[a])})),i.onCancellationRequested((()=>{r.hide()})),r.onDidHide((()=>{bs(l),s(void 0)}))];r.title=t.title,r.canSelectMany=!!t.canPickMany,r.placeholder=t.placeHolder,r.ignoreFocusOut=!!t.ignoreFocusLost,r.matchOnDescription=!!t.matchOnDescription,r.matchOnDetail=!!t.matchOnDetail,r.matchOnLabel=void 0===t.matchOnLabel||t.matchOnLabel,r.autoFocusOnList=void 0===t.autoFocusOnList||t.autoFocusOnList,r.quickNavigate=t.quickNavigate,r.contextKey=t.contextKey,r.busy=!0,Promise.all([e,t.activeItem]).then((([e,t])=>{a=t,r.busy=!1,r.items=e,r.canSelectMany&&(r.selectedItems=e.filter((e=>"separator"!==e.type&&e.picked))),a&&(r.activeItems=[a])})),r.show(),Promise.resolve(e).then(void 0,(e=>{o(e),r.hide()}))}))}createQuickPick(){const e=this.getUI();return new l$(e)}show(e){const t=this.getUI();this.onShowEmitter.fire();const i=this.controller;this.controller=e,i&&i.didHide(),this.setEnabled(!0),t.leftActionBar.clear(),t.title.textContent="",t.description1.textContent="",t.description2.textContent="",t.rightActionBar.clear(),t.checkAll.checked=!1,t.inputBox.placeholder="",t.inputBox.password=!1,t.inputBox.showDecoration(fF.Ignore),t.visibleCount.setCount(0),t.count.setCount(0),KC(t.message),t.progressBar.stop(),t.list.setElements([]),t.list.matchOnDescription=!1,t.list.matchOnDetail=!1,t.list.matchOnLabel=!0,t.list.sortByLabel=!0,t.ignoreFocusOut=!1,this.setComboboxAccessibility(!1),t.inputBox.ariaLabel="";const n=this.options.backKeybindingLabel();r$.tooltip=n?mf(0,"Back ({0})",n):mf(0,"Back"),t.container.style.display="",this.updateLayout(),t.inputBox.setFocus()}setVisibilities(e){const t=this.getUI();t.title.style.display=e.title?"":"none",t.description1.style.display=e.description&&(e.inputBox||e.checkAll)?"":"none",t.description2.style.display=!e.description||e.inputBox||e.checkAll?"none":"",t.checkAll.style.display=e.checkAll?"":"none",t.filterContainer.style.display=e.inputBox?"":"none",t.visibleCountContainer.style.display=e.visibleCount?"":"none",t.countContainer.style.display=e.count?"":"none",t.okContainer.style.display=e.ok?"":"none",t.customButtonContainer.style.display=e.customButton?"":"none",t.message.style.display=e.message?"":"none",t.progressBar.getContainer().style.display=e.progressBar?"":"none",t.list.display(!!e.list),t.container.classList[e.checkBox?"add":"remove"]("show-checkboxes"),this.updateLayout()}setComboboxAccessibility(e){if(e!==this.comboboxAccessibility){const t=this.getUI();this.comboboxAccessibility=e,this.comboboxAccessibility?(t.inputBox.setAttribute("role","combobox"),t.inputBox.setAttribute("aria-haspopup","true"),t.inputBox.setAttribute("aria-autocomplete","list"),t.inputBox.setAttribute("aria-activedescendant",t.list.getActiveDescendant()||"")):(t.inputBox.removeAttribute("role"),t.inputBox.removeAttribute("aria-haspopup"),t.inputBox.removeAttribute("aria-autocomplete"),t.inputBox.removeAttribute("aria-activedescendant"))}}setEnabled(e){if(e!==this.enabled){this.enabled=e;for(const t of this.getUI().leftActionBar.viewItems)t.getAction().enabled=e;for(const t of this.getUI().rightActionBar.viewItems)t.getAction().enabled=e;this.getUI().checkAll.disabled=!e,this.getUI().ok.enabled=e,this.getUI().list.enabled=e}}hide(e){var t;const i=this.controller;if(i){const n=!(null===(t=this.ui)||void 0===t?void 0:t.container.contains(document.activeElement));if(this.controller=null,this.onHideEmitter.fire(),this.getUI().container.style.display="none",!n){let e=this.previousFocusElement;for(;e&&!e.offsetParent;)e=Qs(e.parentElement);(null==e?void 0:e.offsetParent)?(e.focus(),this.previousFocusElement=void 0):this.options.returnFocus()}i.didHide(e)}}layout(e,t){this.dimension=e,this.titleBarOffset=t,this.updateLayout()}updateLayout(){if(this.ui){this.ui.container.style.top=`${this.titleBarOffset}px`;const e=this.ui.container.style,t=Math.min(.62*this.dimension.width,d$.MAX_WIDTH);e.width=t+"px",e.marginLeft="-"+t/2+"px",this.ui.inputBox.layout(),this.ui.list.layout(this.dimension&&.4*this.dimension.height)}}applyStyles(e){this.styles=e,this.updateStyles()}updateStyles(){if(this.ui){const{quickInputTitleBackground:e,quickInputBackground:t,quickInputForeground:i,contrastBorder:n,widgetShadow:o}=this.styles.widget;this.ui.titleBar.style.backgroundColor=e?e.toString():"",this.ui.container.style.backgroundColor=t?t.toString():"",this.ui.container.style.color=i?i.toString():"",this.ui.container.style.border=n?`1px solid ${n}`:"",this.ui.container.style.boxShadow=o?`0 0 8px 2px ${o}`:"",this.ui.inputBox.style(this.styles.inputBox),this.ui.count.style(this.styles.countBadge),this.ui.ok.style(this.styles.button),this.ui.customButton.style(this.styles.button),this.ui.progressBar.style(this.styles.progressBar),this.ui.list.style(this.styles.list);const s=[];this.styles.list.pickerGroupBorder&&s.push(`.quick-input-list .quick-input-list-entry { border-top-color: ${this.styles.list.pickerGroupBorder}; }`),this.styles.list.pickerGroupForeground&&s.push(`.quick-input-list .quick-input-list-separator { color: ${this.styles.list.pickerGroupForeground}; }`),(this.styles.keybindingLabel.keybindingLabelBackground||this.styles.keybindingLabel.keybindingLabelBorder||this.styles.keybindingLabel.keybindingLabelBottomBorder||this.styles.keybindingLabel.keybindingLabelShadow||this.styles.keybindingLabel.keybindingLabelForeground)&&(s.push(".quick-input-list .monaco-keybinding > .monaco-keybinding-key {"),this.styles.keybindingLabel.keybindingLabelBackground&&s.push(`background-color: ${this.styles.keybindingLabel.keybindingLabelBackground};`),this.styles.keybindingLabel.keybindingLabelBorder&&s.push(`border-color: ${this.styles.keybindingLabel.keybindingLabelBorder};`),this.styles.keybindingLabel.keybindingLabelBottomBorder&&s.push(`border-bottom-color: ${this.styles.keybindingLabel.keybindingLabelBottomBorder};`),this.styles.keybindingLabel.keybindingLabelShadow&&s.push(`box-shadow: inset 0 -1px 0 ${this.styles.keybindingLabel.keybindingLabelShadow};`),this.styles.keybindingLabel.keybindingLabelForeground&&s.push(`color: ${this.styles.keybindingLabel.keybindingLabelForeground};`),s.push("}"));const r=s.join("\n");r!==this.ui.styleSheet.textContent&&(this.ui.styleSheet.textContent=r)}}}d$.MAX_WIDTH=600;class c${constructor(e){this.spliceables=e}splice(e,t,i){this.spliceables.forEach((n=>n.splice(e,t,i)))}}class h$ extends Error{constructor(e,t){super(`ListError [${e}] ${t}`)}}function u$(e,t){const i=[];for(let n of t){if(e.start>=n.range.end)continue;if(e.end<n.range.start)break;const t=QW.intersect(e,n.range);QW.isEmpty(t)||i.push({range:t,size:n.size})}return i}function g$({start:e,end:t},i){return{start:e+i,end:t+i}}class p${constructor(){this.groups=[],this._size=0}splice(e,t,i=[]){const n=i.length-t,o=u$({start:0,end:e},this.groups),s=u$({start:e+t,end:Number.POSITIVE_INFINITY},this.groups).map((e=>({range:g$(e.range,n),size:e.size}))),r=i.map(((t,i)=>({range:{start:e+i,end:e+i+1},size:t.size})));this.groups=function(...e){return function(e){const t=[];let i=null;for(let n of e){const e=n.range.start,o=n.range.end,s=n.size;i&&s===i.size?i.range.end=o:(i={range:{start:e,end:o},size:s},t.push(i))}return t}(e.reduce(((e,t)=>e.concat(t)),[]))}(o,r,s),this._size=this.groups.reduce(((e,t)=>e+t.size*(t.range.end-t.range.start)),0)}get count(){const e=this.groups.length;return e?this.groups[e-1].range.end:0}get size(){return this._size}indexAt(e){if(e<0)return-1;let t=0,i=0;for(let n of this.groups){const o=n.range.end-n.range.start,s=i+o*n.size;if(e<s)return t+Math.floor((e-i)/n.size);t+=o,i=s}return t}indexAfter(e){return Math.min(this.indexAt(e)+1,this.count)}positionAt(e){if(e<0)return-1;let t=0,i=0;for(let n of this.groups){const o=n.range.end-n.range.start,s=i+o;if(e<s)return t+(e-i)*n.size;t+=o*n.size,i=s}return-1}}class m${constructor(e){this.renderers=e,this.cache=new Map}alloc(e){let t=this.getTemplateCache(e).pop();if(!t){const i=YC(".monaco-list-row");t={domNode:i,templateId:e,templateData:this.getRenderer(e).renderTemplate(i)}}return t}release(e){e&&this.releaseRow(e)}releaseRow(e){const{domNode:t,templateId:i}=e;t&&(t.classList.remove("scrolling"),function(e){try{e.parentElement&&e.parentElement.removeChild(e)}catch(t){}}(t));this.getTemplateCache(i).push(e)}getTemplateCache(e){let t=this.cache.get(e);return t||(t=[],this.cache.set(e,t)),t}dispose(){this.cache.forEach(((e,t)=>{for(const i of e){this.getRenderer(t).disposeTemplate(i.templateData),i.templateData=null}})),this.cache.clear()}getRenderer(e){const t=this.renderers.get(e);if(!t)throw new Error(`No renderer found for ${e}`);return t}}var f$=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r};const _$={useShadows:!0,verticalScrollMode:1,setRowLineHeight:!0,setRowHeight:!0,supportDynamicHeights:!1,dnd:{getDragElements:e=>[e],getDragURI:()=>null,onDragStart(){},onDragOver:()=>!1,drop(){}},horizontalScrolling:!1,transformOptimization:!0,alwaysConsumeMouseWheel:!0};class v${constructor(e){this.elements=e}update(){}getData(){return this.elements}}class b${constructor(e){this.elements=e}update(){}getData(){return this.elements}}class w${constructor(){this.types=[],this.files=[]}update(e){if(e.types&&this.types.splice(0,this.types.length,...e.types),e.files){this.files.splice(0,this.files.length);for(let t=0;t<e.files.length;t++){const i=e.files.item(t);i&&(i.size||i.type)&&this.files.push(i)}}}getData(){return{types:this.types,files:this.files}}}class C${constructor(e){(null==e?void 0:e.getSetSize)?this.getSetSize=e.getSetSize.bind(e):this.getSetSize=(e,t,i)=>i,(null==e?void 0:e.getPosInSet)?this.getPosInSet=e.getPosInSet.bind(e):this.getPosInSet=(e,t)=>t+1,(null==e?void 0:e.getRole)?this.getRole=e.getRole.bind(e):this.getRole=e=>"listitem",(null==e?void 0:e.isChecked)?this.isChecked=e.isChecked.bind(e):this.isChecked=e=>{}}}class y${constructor(e,t,i,n=_$){if(this.virtualDelegate=t,this.domId="list_id_"+ ++y$.InstanceCount,this.renderers=new Map,this.renderWidth=0,this._scrollHeight=0,this.scrollableElementUpdateDisposable=null,this.scrollableElementWidthDelayer=new tb(50),this.splicing=!1,this.dragOverAnimationStopDisposable=Uo.None,this.dragOverMouseY=0,this.canDrop=!1,this.currentDragFeedbackDisposable=Uo.None,this.onDragLeaveTimeout=Uo.None,this.disposables=new ws,this._onDidChangeContentHeight=new $o,this._horizontalScrolling=!1,n.horizontalScrolling&&n.supportDynamicHeights)throw new Error("Horizontal scrolling and dynamic heights not supported simultaneously");this.items=[],this.itemId=0,this.rangeMap=new p$;for(const s of i)this.renderers.set(s.templateId,s);this.cache=this.disposables.add(new m$(this.renderers)),this.lastRenderTop=0,this.lastRenderHeight=0,this.domNode=document.createElement("div"),this.domNode.className="monaco-list",this.domNode.classList.add(this.domId),this.domNode.tabIndex=0,this.domNode.classList.toggle("mouse-support","boolean"!=typeof n.mouseSupport||n.mouseSupport),this._horizontalScrolling=Pa(n,(e=>e.horizontalScrolling),_$.horizontalScrolling),this.domNode.classList.toggle("horizontal-scrolling",this._horizontalScrolling),this.additionalScrollHeight=void 0===n.additionalScrollHeight?0:n.additionalScrollHeight,this.accessibilityProvider=new C$(n.accessibilityProvider),this.rowsContainer=document.createElement("div"),this.rowsContainer.className="monaco-list-rows";const o=Pa(n,(e=>e.transformOptimization),_$.transformOptimization);o&&(this.rowsContainer.style.transform="translate3d(0px, 0px, 0px)"),this.disposables.add(oS.addTarget(this.rowsContainer)),this.scrollable=new aT({forceIntegerValues:!0,smoothScrollDuration:Pa(n,(e=>e.smoothScrolling),!1)?125:0,scheduleAtNextAnimationFrame:e=>hC(e)}),this.scrollableElement=this.disposables.add(new mT(this.rowsContainer,{alwaysConsumeMouseWheel:Pa(n,(e=>e.alwaysConsumeMouseWheel),_$.alwaysConsumeMouseWheel),horizontal:1,vertical:Pa(n,(e=>e.verticalScrollMode),_$.verticalScrollMode),useShadows:Pa(n,(e=>e.useShadows),_$.useShadows),mouseWheelScrollSensitivity:n.mouseWheelScrollSensitivity,fastScrollSensitivity:n.fastScrollSensitivity},this.scrollable)),this.domNode.appendChild(this.scrollableElement.getDomNode()),e.appendChild(this.domNode),this.scrollableElement.onScroll(this.onScroll,this,this.disposables),this.disposables.add(nC(this.rowsContainer,iS.Change,(e=>this.onTouchChange(e)))),this.disposables.add(nC(this.scrollableElement.getDomNode(),"scroll",(e=>e.target.scrollTop=0))),this.disposables.add(nC(this.domNode,"dragover",(e=>this.onDragOver(this.toDragEvent(e))))),this.disposables.add(nC(this.domNode,"drop",(e=>this.onDrop(this.toDragEvent(e))))),this.disposables.add(nC(this.domNode,"dragleave",(e=>this.onDragLeave(this.toDragEvent(e))))),this.disposables.add(nC(this.domNode,"dragend",(e=>this.onDragEnd(e)))),this.setRowLineHeight=Pa(n,(e=>e.setRowLineHeight),_$.setRowLineHeight),this.setRowHeight=Pa(n,(e=>e.setRowHeight),_$.setRowHeight),this.supportDynamicHeights=Pa(n,(e=>e.supportDynamicHeights),_$.supportDynamicHeights),this.dnd=Pa(n,(e=>e.dnd),_$.dnd),this.layout()}get contentHeight(){return this.rangeMap.size}get horizontalScrolling(){return this._horizontalScrolling}set horizontalScrolling(e){if(e!==this._horizontalScrolling){if(e&&this.supportDynamicHeights)throw new Error("Horizontal scrolling and dynamic heights not supported simultaneously");if(this._horizontalScrolling=e,this.domNode.classList.toggle("horizontal-scrolling",this._horizontalScrolling),this._horizontalScrolling){for(const e of this.items)this.measureItemWidth(e);this.updateScrollWidth(),this.scrollableElement.setScrollDimensions({width:kC(this.domNode)}),this.rowsContainer.style.width=`${Math.max(this.scrollWidth||0,this.renderWidth)}px`}else this.scrollableElementWidthDelayer.cancel(),this.scrollableElement.setScrollDimensions({width:this.renderWidth,scrollWidth:this.renderWidth}),this.rowsContainer.style.width=""}}updateOptions(e){void 0!==e.additionalScrollHeight&&(this.additionalScrollHeight=e.additionalScrollHeight,this.scrollableElement.setScrollDimensions({scrollHeight:this.scrollHeight})),void 0!==e.smoothScrolling&&this.scrollable.setSmoothScrollDuration(e.smoothScrolling?125:0),void 0!==e.horizontalScrolling&&(this.horizontalScrolling=e.horizontalScrolling),void 0!==e.mouseWheelScrollSensitivity&&this.scrollableElement.updateOptions({mouseWheelScrollSensitivity:e.mouseWheelScrollSensitivity}),void 0!==e.fastScrollSensitivity&&this.scrollableElement.updateOptions({fastScrollSensitivity:e.fastScrollSensitivity})}splice(e,t,i=[]){if(this.splicing)throw new Error("Can't run recursive splices.");this.splicing=!0;try{return this._splice(e,t,i)}finally{this.splicing=!1,this._onDidChangeContentHeight.fire(this.contentHeight)}}_splice(e,t,i=[]){const n=this.getRenderRange(this.lastRenderTop,this.lastRenderHeight),o={start:e,end:e+t},s=QW.intersect(n,o),r=new Map;for(let w=s.end-1;w>=s.start;w--){const e=this.items[w];if(e.dragStartDisposable.dispose(),e.row){let t=r.get(e.templateId);t||(t=[],r.set(e.templateId,t));const i=this.renderers.get(e.templateId);i&&i.disposeElement&&i.disposeElement(e.element,w,e.row.templateData,e.size),t.push(e.row)}e.row=null}const a={start:e+t,end:this.items.length},l=QW.intersect(a,n),d=QW.relativeComplement(a,n),c=i.map((e=>({id:String(this.itemId++),element:e,templateId:this.virtualDelegate.getTemplateId(e),size:this.virtualDelegate.getHeight(e),width:void 0,hasDynamicHeight:!!this.virtualDelegate.hasDynamicHeight&&this.virtualDelegate.hasDynamicHeight(e),lastDynamicHeightWidth:void 0,row:null,uri:void 0,dropTarget:!1,dragStartDisposable:Uo.None,checkedDisposable:Uo.None})));let h;0===e&&t>=this.items.length?(this.rangeMap=new p$,this.rangeMap.splice(0,0,c),h=this.items,this.items=c):(this.rangeMap.splice(e,t,c),h=this.items.splice(e,t,...c));const u=i.length-t,g=this.getRenderRange(this.lastRenderTop,this.lastRenderHeight),p=g$(l,u),m=QW.intersect(g,p);for(let w=m.start;w<m.end;w++)this.updateItemInDOM(this.items[w],w);const f=QW.relativeComplement(p,g);for(const w of f)for(let e=w.start;e<w.end;e++)this.removeItemFromDOM(e);const _=d.map((e=>g$(e,u))),v=[{start:e,end:e+i.length},..._].map((e=>QW.intersect(g,e))),b=this.getNextToLastElement(v);for(const w of v)for(let e=w.start;e<w.end;e++){const t=this.items[e],i=r.get(t.templateId),n=null==i?void 0:i.pop();this.insertItemInDOM(e,b,n)}for(const w of r.values())for(const e of w)this.cache.release(e);return this.eventuallyUpdateScrollDimensions(),this.supportDynamicHeights&&this._rerender(this.scrollTop,this.renderHeight),h.map((e=>e.element))}eventuallyUpdateScrollDimensions(){this._scrollHeight=this.contentHeight,this.rowsContainer.style.height=`${this._scrollHeight}px`,this.scrollableElementUpdateDisposable||(this.scrollableElementUpdateDisposable=hC((()=>{this.scrollableElement.setScrollDimensions({scrollHeight:this.scrollHeight}),this.updateScrollWidth(),this.scrollableElementUpdateDisposable=null})))}eventuallyUpdateScrollWidth(){this.horizontalScrolling?this.scrollableElementWidthDelayer.trigger((()=>this.updateScrollWidth())):this.scrollableElementWidthDelayer.cancel()}updateScrollWidth(){if(!this.horizontalScrolling)return;let e=0;for(const t of this.items)void 0!==t.width&&(e=Math.max(e,t.width));this.scrollWidth=e,this.scrollableElement.setScrollDimensions({scrollWidth:0===e?0:e+10})}rerender(){if(this.supportDynamicHeights){for(const e of this.items)e.lastDynamicHeightWidth=void 0;this._rerender(this.lastRenderTop,this.lastRenderHeight)}}get length(){return this.items.length}get renderHeight(){return this.scrollableElement.getScrollDimensions().height}element(e){return this.items[e].element}domElement(e){const t=this.items[e].row;return t&&t.domNode}elementHeight(e){return this.items[e].size}elementTop(e){return this.rangeMap.positionAt(e)}indexAt(e){return this.rangeMap.indexAt(e)}indexAfter(e){return this.rangeMap.indexAfter(e)}layout(e,t){let i={height:"number"==typeof e?e:DC(this.domNode)};this.scrollableElementUpdateDisposable&&(this.scrollableElementUpdateDisposable.dispose(),this.scrollableElementUpdateDisposable=null,i.scrollHeight=this.scrollHeight),this.scrollableElement.setScrollDimensions(i),void 0!==t&&(this.renderWidth=t,this.supportDynamicHeights&&this._rerender(this.scrollTop,this.renderHeight)),this.horizontalScrolling&&this.scrollableElement.setScrollDimensions({width:"number"==typeof t?t:kC(this.domNode)})}render(e,t,i,n,o,s=!1){const r=this.getRenderRange(t,i),a=QW.relativeComplement(r,e),l=QW.relativeComplement(e,r),d=this.getNextToLastElement(a);if(s){const t=QW.intersect(e,r);for(let e=t.start;e<t.end;e++)this.updateItemInDOM(this.items[e],e)}for(const c of a)for(let e=c.start;e<c.end;e++)this.insertItemInDOM(e,d);for(const c of l)for(let e=c.start;e<c.end;e++)this.removeItemFromDOM(e);void 0!==n&&(this.rowsContainer.style.left=`-${n}px`),this.rowsContainer.style.top=`-${t}px`,this.horizontalScrolling&&void 0!==o&&(this.rowsContainer.style.width=`${Math.max(o,this.renderWidth)}px`),this.lastRenderTop=t,this.lastRenderHeight=i}insertItemInDOM(e,t,i){const n=this.items[e];n.row||(n.row=null!=i?i:this.cache.alloc(n.templateId));const o=this.accessibilityProvider.getRole(n.element)||"listitem";n.row.domNode.setAttribute("role",o);const s=this.accessibilityProvider.isChecked(n.element);if("boolean"==typeof s)n.row.domNode.setAttribute("aria-checked",String(!!s));else if(s){const e=e=>n.row.domNode.setAttribute("aria-checked",String(!!e));e(s.value),n.checkedDisposable=s.onDidChange(e)}n.row.domNode.parentElement||(t?this.rowsContainer.insertBefore(n.row.domNode,t):this.rowsContainer.appendChild(n.row.domNode)),this.updateItemInDOM(n,e);const r=this.renderers.get(n.templateId);if(!r)throw new Error(`No renderer found for template id ${n.templateId}`);r&&r.renderElement(n.element,e,n.row.templateData,n.size);const a=this.dnd.getDragURI(n.element);n.dragStartDisposable.dispose(),n.row.domNode.draggable=!!a,a&&(n.dragStartDisposable=nC(n.row.domNode,"dragstart",(e=>this.onDragStart(n.element,a,e)))),this.horizontalScrolling&&(this.measureItemWidth(n),this.eventuallyUpdateScrollWidth())}measureItemWidth(e){if(!e.row||!e.row.domNode)return;e.row.domNode.style.width=o_?"-moz-fit-content":"fit-content",e.width=kC(e.row.domNode);const t=window.getComputedStyle(e.row.domNode);t.paddingLeft&&(e.width+=parseFloat(t.paddingLeft)),t.paddingRight&&(e.width+=parseFloat(t.paddingRight)),e.row.domNode.style.width=""}updateItemInDOM(e,t){e.row.domNode.style.top=`${this.elementTop(t)}px`,this.setRowHeight&&(e.row.domNode.style.height=`${e.size}px`),this.setRowLineHeight&&(e.row.domNode.style.lineHeight=`${e.size}px`),e.row.domNode.setAttribute("data-index",`${t}`),e.row.domNode.setAttribute("data-last-element",t===this.length-1?"true":"false"),e.row.domNode.setAttribute("data-parity",t%2==0?"even":"odd"),e.row.domNode.setAttribute("aria-setsize",String(this.accessibilityProvider.getSetSize(e.element,t,this.length))),e.row.domNode.setAttribute("aria-posinset",String(this.accessibilityProvider.getPosInSet(e.element,t))),e.row.domNode.setAttribute("id",this.getElementDomId(t)),e.row.domNode.classList.toggle("drop-target",e.dropTarget)}removeItemFromDOM(e){const t=this.items[e];if(t.dragStartDisposable.dispose(),t.checkedDisposable.dispose(),t.row){const i=this.renderers.get(t.templateId);i&&i.disposeElement&&i.disposeElement(t.element,e,t.row.templateData,t.size),this.cache.release(t.row),t.row=null}this.horizontalScrolling&&this.eventuallyUpdateScrollWidth()}getScrollTop(){return this.scrollableElement.getScrollPosition().scrollTop}setScrollTop(e,t){this.scrollableElementUpdateDisposable&&(this.scrollableElementUpdateDisposable.dispose(),this.scrollableElementUpdateDisposable=null,this.scrollableElement.setScrollDimensions({scrollHeight:this.scrollHeight})),this.scrollableElement.setScrollPosition({scrollTop:e,reuseAnimation:t})}get scrollTop(){return this.getScrollTop()}set scrollTop(e){this.setScrollTop(e)}get scrollHeight(){return this._scrollHeight+(this.horizontalScrolling?10:0)+this.additionalScrollHeight}get onMouseClick(){return ds.map(this.disposables.add(new eB(this.domNode,"click")).event,(e=>this.toMouseEvent(e)))}get onMouseDblClick(){return ds.map(this.disposables.add(new eB(this.domNode,"dblclick")).event,(e=>this.toMouseEvent(e)))}get onMouseMiddleClick(){return ds.filter(ds.map(this.disposables.add(new eB(this.domNode,"auxclick")).event,(e=>this.toMouseEvent(e))),(e=>1===e.browserEvent.button))}get onMouseDown(){return ds.map(this.disposables.add(new eB(this.domNode,"mousedown")).event,(e=>this.toMouseEvent(e)))}get onContextMenu(){return ds.any(ds.map(this.disposables.add(new eB(this.domNode,"contextmenu")).event,(e=>this.toMouseEvent(e))),ds.map(this.disposables.add(new eB(this.domNode,iS.Contextmenu)).event,(e=>this.toGestureEvent(e))))}get onTouchStart(){return ds.map(this.disposables.add(new eB(this.domNode,"touchstart")).event,(e=>this.toTouchEvent(e)))}get onTap(){return ds.map(this.disposables.add(new eB(this.rowsContainer,iS.Tap)).event,(e=>this.toGestureEvent(e)))}toMouseEvent(e){const t=this.getItemIndexFromEventTarget(e.target||null),i=void 0===t?void 0:this.items[t];return{browserEvent:e,index:t,element:i&&i.element}}toTouchEvent(e){const t=this.getItemIndexFromEventTarget(e.target||null),i=void 0===t?void 0:this.items[t];return{browserEvent:e,index:t,element:i&&i.element}}toGestureEvent(e){const t=this.getItemIndexFromEventTarget(e.initialTarget||null),i=void 0===t?void 0:this.items[t];return{browserEvent:e,index:t,element:i&&i.element}}toDragEvent(e){const t=this.getItemIndexFromEventTarget(e.target||null),i=void 0===t?void 0:this.items[t];return{browserEvent:e,index:t,element:i&&i.element}}onScroll(e){try{const t=this.getRenderRange(this.lastRenderTop,this.lastRenderHeight);this.render(t,e.scrollTop,e.height,e.scrollLeft,e.scrollWidth),this.supportDynamicHeights&&this._rerender(e.scrollTop,e.height,e.inSmoothScrolling)}catch(t){throw t}}onTouchChange(e){e.preventDefault(),e.stopPropagation(),this.scrollTop-=e.translationY}onDragStart(e,t,i){if(!i.dataTransfer)return;const n=this.dnd.getDragElements(e);if(i.dataTransfer.effectAllowed="copyMove",i.dataTransfer.setData(uB.TEXT,t),i.dataTransfer.setDragImage){let e;this.dnd.getDragLabel&&(e=this.dnd.getDragLabel(n,i)),void 0===e&&(e=String(n.length));const t=YC(".monaco-drag-image");t.textContent=e,document.body.appendChild(t),i.dataTransfer.setDragImage(t,-10,-10),setTimeout((()=>document.body.removeChild(t)),0)}this.currentDragData=new v$(n),pB.CurrentDragAndDropData=new b$(n),this.dnd.onDragStart&&this.dnd.onDragStart(this.currentDragData,i)}onDragOver(e){if(e.browserEvent.preventDefault(),this.onDragLeaveTimeout.dispose(),pB.CurrentDragAndDropData&&"vscode-ui"===pB.CurrentDragAndDropData.getData())return!1;if(this.setupDragAndDropScrollTopAnimation(e.browserEvent),!e.browserEvent.dataTransfer)return!1;if(!this.currentDragData)if(pB.CurrentDragAndDropData)this.currentDragData=pB.CurrentDragAndDropData;else{if(!e.browserEvent.dataTransfer.types)return!1;this.currentDragData=new w$}const t=this.dnd.onDragOver(this.currentDragData,e.element,e.index,e.browserEvent);if(this.canDrop="boolean"==typeof t?t:t.accept,!this.canDrop)return this.currentDragFeedback=void 0,this.currentDragFeedbackDisposable.dispose(),!1;let i;if(e.browserEvent.dataTransfer.dropEffect="boolean"!=typeof t&&0===t.effect?"copy":"move",i="boolean"!=typeof t&&t.feedback?t.feedback:void 0===e.index?[-1]:[e.index],i=Qo(i).filter((e=>e>=-1&&e<this.length)).sort(((e,t)=>e-t)),i=-1===i[0]?[-1]:i,n=this.currentDragFeedback,o=i,Array.isArray(n)&&Array.isArray(o)?jo(n,o):n===o)return!0;var n,o;if(this.currentDragFeedback=i,this.currentDragFeedbackDisposable.dispose(),-1===i[0])this.domNode.classList.add("drop-target"),this.rowsContainer.classList.add("drop-target"),this.currentDragFeedbackDisposable=es((()=>{this.domNode.classList.remove("drop-target"),this.rowsContainer.classList.remove("drop-target")}));else{for(const e of i){const t=this.items[e];t.dropTarget=!0,t.row&&t.row.domNode.classList.add("drop-target")}this.currentDragFeedbackDisposable=es((()=>{for(const e of i){const t=this.items[e];t.dropTarget=!1,t.row&&t.row.domNode.classList.remove("drop-target")}}))}return!0}onDragLeave(e){var t,i;this.onDragLeaveTimeout.dispose(),this.onDragLeaveTimeout=ob((()=>this.clearDragOverFeedback()),100),this.currentDragData&&(null===(i=(t=this.dnd).onDragLeave)||void 0===i||i.call(t,this.currentDragData,e.element,e.index,e.browserEvent))}onDrop(e){if(!this.canDrop)return;const t=this.currentDragData;this.teardownDragAndDropScrollTopAnimation(),this.clearDragOverFeedback(),this.currentDragData=void 0,pB.CurrentDragAndDropData=void 0,t&&e.browserEvent.dataTransfer&&(e.browserEvent.preventDefault(),t.update(e.browserEvent.dataTransfer),this.dnd.drop(t,e.element,e.index,e.browserEvent))}onDragEnd(e){this.canDrop=!1,this.teardownDragAndDropScrollTopAnimation(),this.clearDragOverFeedback(),this.currentDragData=void 0,pB.CurrentDragAndDropData=void 0,this.dnd.onDragEnd&&this.dnd.onDragEnd(e)}clearDragOverFeedback(){this.currentDragFeedback=void 0,this.currentDragFeedbackDisposable.dispose(),this.currentDragFeedbackDisposable=Uo.None}setupDragAndDropScrollTopAnimation(e){if(!this.dragOverAnimationDisposable){const e=CC(this.domNode).top;this.dragOverAnimationDisposable=function(e){const t=()=>{e(),i=hC(t)};let i=hC(t);return es((()=>i.dispose()))}(this.animateDragAndDropScrollTop.bind(this,e))}this.dragOverAnimationStopDisposable.dispose(),this.dragOverAnimationStopDisposable=ob((()=>{this.dragOverAnimationDisposable&&(this.dragOverAnimationDisposable.dispose(),this.dragOverAnimationDisposable=void 0)}),1e3),this.dragOverMouseY=e.pageY}animateDragAndDropScrollTop(e){if(void 0===this.dragOverMouseY)return;const t=this.dragOverMouseY-e,i=this.renderHeight-35;t<35?this.scrollTop+=Math.max(-14,Math.floor(.3*(t-35))):t>i&&(this.scrollTop+=Math.min(14,Math.floor(.3*(t-i))))}teardownDragAndDropScrollTopAnimation(){this.dragOverAnimationStopDisposable.dispose(),this.dragOverAnimationDisposable&&(this.dragOverAnimationDisposable.dispose(),this.dragOverAnimationDisposable=void 0)}getItemIndexFromEventTarget(e){const t=this.scrollableElement.getDomNode();let i=e;for(;i instanceof HTMLElement&&i!==this.rowsContainer&&t.contains(i);){const e=i.getAttribute("data-index");if(e){const t=Number(e);if(!isNaN(t))return t}i=i.parentElement}}getRenderRange(e,t){return{start:this.rangeMap.indexAt(e),end:this.rangeMap.indexAfter(e+t-1)}}_rerender(e,t,i){const n=this.getRenderRange(e,t);let o,s;e===this.elementTop(n.start)?(o=n.start,s=0):n.end-n.start>1&&(o=n.start+1,s=this.elementTop(o)-e);let r=0;for(;;){const a=this.getRenderRange(e,t);let l=!1;for(let e=a.start;e<a.end;e++){const t=this.probeDynamicHeight(e);0!==t&&this.rangeMap.splice(e,1,[this.items[e]]),r+=t,l=l||0!==t}if(!l){0!==r&&this.eventuallyUpdateScrollDimensions();const t=QW.relativeComplement(n,a);for(const e of t)for(let t=e.start;t<e.end;t++)this.items[t].row&&this.removeItemFromDOM(t);const l=QW.relativeComplement(a,n);for(const e of l)for(let t=e.start;t<e.end;t++){const e=t+1,i=e<this.items.length?this.items[e].row:null,n=i?i.domNode:null;this.insertItemInDOM(t,n)}for(let e=a.start;e<a.end;e++)this.items[e].row&&this.updateItemInDOM(this.items[e],e);if("number"==typeof o){const t=this.scrollable.getFutureScrollPosition().scrollTop-e,n=this.elementTop(o)-s+t;this.setScrollTop(n,i)}return void this._onDidChangeContentHeight.fire(this.contentHeight)}}}probeDynamicHeight(e){const t=this.items[e];if(this.virtualDelegate.getDynamicHeight){const e=this.virtualDelegate.getDynamicHeight(t.element);if(null!==e){const i=t.size;return t.size=e,t.lastDynamicHeightWidth=this.renderWidth,e-i}}if(!t.hasDynamicHeight||t.lastDynamicHeightWidth===this.renderWidth)return 0;if(this.virtualDelegate.hasDynamicHeight&&!this.virtualDelegate.hasDynamicHeight(t.element))return 0;const i=t.size;if(!this.setRowHeight&&t.row){let e=t.row.domNode.offsetHeight;return t.size=e,t.lastDynamicHeightWidth=this.renderWidth,e-i}const n=this.cache.alloc(t.templateId);n.domNode.style.height="",this.rowsContainer.appendChild(n.domNode);const o=this.renderers.get(t.templateId);return o&&(o.renderElement(t.element,e,n.templateData,void 0),o.disposeElement&&o.disposeElement(t.element,e,n.templateData,void 0)),t.size=n.domNode.offsetHeight,this.virtualDelegate.setDynamicHeight&&this.virtualDelegate.setDynamicHeight(t.element,t.size),t.lastDynamicHeightWidth=this.renderWidth,this.rowsContainer.removeChild(n.domNode),this.cache.release(n),t.size-i}getNextToLastElement(e){const t=e[e.length-1];if(!t)return null;const i=this.items[t.end];return i&&i.row?i.row.domNode:null}getElementDomId(e){return`${this.domId}_${e}`}dispose(){if(this.items){for(const e of this.items)if(e.row){const t=this.renderers.get(e.row.templateId);t&&(t.disposeElement&&t.disposeElement(e.element,-1,e.row.templateData,void 0),t.disposeTemplate(e.row.templateData))}this.items=[]}this.domNode&&this.domNode.parentNode&&this.domNode.parentNode.removeChild(this.domNode),bs(this.disposables)}}y$.InstanceCount=0,f$([tS],y$.prototype,"onMouseClick",null),f$([tS],y$.prototype,"onMouseDblClick",null),f$([tS],y$.prototype,"onMouseMiddleClick",null),f$([tS],y$.prototype,"onMouseDown",null),f$([tS],y$.prototype,"onContextMenu",null),f$([tS],y$.prototype,"onTouchStart",null),f$([tS],y$.prototype,"onTap",null);var x$,S$=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},k$=globalThis&&globalThis.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{l(n.next(e))}catch(t){s(t)}}function a(e){try{l(n.throw(e))}catch(t){s(t)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}l((n=n.apply(e,t||[])).next())}))};class D${constructor(e){this.trait=e,this.renderedElements=[]}get templateId(){return`template:${this.trait.name}`}renderTemplate(e){return e}renderElement(e,t,i){const n=this.renderedElements.findIndex((e=>e.templateData===i));if(n>=0){const e=this.renderedElements[n];this.trait.unrender(i),e.index=t}else{const e={index:t,templateData:i};this.renderedElements.push(e)}this.trait.renderIndex(t,i)}splice(e,t,i){const n=[];for(const o of this.renderedElements)o.index<e?n.push(o):o.index>=e+t&&n.push({index:o.index+i-t,templateData:o.templateData});this.renderedElements=n}renderIndexes(e){for(const{index:t,templateData:i}of this.renderedElements)e.indexOf(t)>-1&&this.trait.renderIndex(t,i)}disposeTemplate(e){const t=this.renderedElements.findIndex((t=>t.templateData===e));t<0||this.renderedElements.splice(t,1)}}class L${constructor(e){this._trait=e,this.length=0,this.indexes=[],this.sortedIndexes=[],this._onChange=new $o,this.onChange=this._onChange.event}get name(){return this._trait}get renderer(){return new D$(this)}splice(e,t,i){var n;t=Math.max(0,Math.min(t,this.length-e));const o=i.length-t,s=e+t,r=[...this.sortedIndexes.filter((t=>t<e)),...i.map(((t,i)=>t?i+e:-1)).filter((e=>-1!==e)),...this.sortedIndexes.filter((e=>e>=s)).map((e=>e+o))],a=this.length+o;if(this.sortedIndexes.length>0&&0===r.length&&a>0){const t=null!==(n=this.sortedIndexes.find((t=>t>=e)))&&void 0!==n?n:a-1;r.push(Math.min(t,a-1))}this.renderer.splice(e,t,i.length),this._set(r,r),this.length=a}renderIndex(e,t){t.classList.toggle(this._trait,this.contains(e))}unrender(e){e.classList.remove(this._trait)}set(e,t){return this._set(e,[...e].sort(U$),t)}_set(e,t,i){const n=this.indexes,o=this.sortedIndexes;this.indexes=e,this.sortedIndexes=t;const s=j$(o,e);return this.renderer.renderIndexes(s),this._onChange.fire({indexes:e,browserEvent:i}),n}get(){return this.indexes}contains(e){return Fa(this.sortedIndexes,e,U$)>=0}dispose(){bs(this._onChange)}}S$([tS],L$.prototype,"renderer",null);class N$ extends L${constructor(e){super("selected"),this.setAriaSelected=e}renderIndex(e,t){super.renderIndex(e,t),this.setAriaSelected&&(this.contains(e)?t.setAttribute("aria-selected","true"):t.setAttribute("aria-selected","false"))}}class E${constructor(e,t,i){this.trait=e,this.view=t,this.identityProvider=i}splice(e,t,i){if(!this.identityProvider)return this.trait.splice(e,t,i.map((()=>!1)));const n=this.trait.get().map((e=>this.identityProvider.getId(this.view.element(e)).toString())),o=i.map((e=>n.indexOf(this.identityProvider.getId(e).toString())>-1));this.trait.splice(e,t,o)}}function I$(e){return"INPUT"===e.tagName||"TEXTAREA"===e.tagName}function T$(e){return!!e.classList.contains("monaco-editor")||!e.classList.contains("monaco-list")&&(!!e.parentElement&&T$(e.parentElement))}class M${constructor(e,t,i){this.list=e,this.view=t,this.disposables=new ws,this.multipleSelectionDisposables=new ws,this.onKeyDown.filter((e=>3===e.keyCode)).on(this.onEnter,this,this.disposables),this.onKeyDown.filter((e=>16===e.keyCode)).on(this.onUpArrow,this,this.disposables),this.onKeyDown.filter((e=>18===e.keyCode)).on(this.onDownArrow,this,this.disposables),this.onKeyDown.filter((e=>11===e.keyCode)).on(this.onPageUpArrow,this,this.disposables),this.onKeyDown.filter((e=>12===e.keyCode)).on(this.onPageDownArrow,this,this.disposables),this.onKeyDown.filter((e=>9===e.keyCode)).on(this.onEscape,this,this.disposables),!1!==i.multipleSelectionSupport&&this.onKeyDown.filter((e=>(zo?e.metaKey:e.ctrlKey)&&31===e.keyCode)).on(this.onCtrlA,this,this.multipleSelectionDisposables)}get onKeyDown(){return ds.chain(this.disposables.add(new eB(this.view.domNode,"keydown")).event).filter((e=>!I$(e.target))).map((e=>new jw(e)))}updateOptions(e){void 0!==e.multipleSelectionSupport&&(this.multipleSelectionDisposables.clear(),e.multipleSelectionSupport&&this.onKeyDown.filter((e=>(zo?e.metaKey:e.ctrlKey)&&31===e.keyCode)).on(this.onCtrlA,this,this.multipleSelectionDisposables))}onEnter(e){e.preventDefault(),e.stopPropagation(),this.list.setSelection(this.list.getFocus(),e.browserEvent)}onUpArrow(e){e.preventDefault(),e.stopPropagation(),this.list.focusPrevious(1,!1,e.browserEvent);const t=this.list.getFocus()[0];this.list.setAnchor(t),this.list.reveal(t),this.view.domNode.focus()}onDownArrow(e){e.preventDefault(),e.stopPropagation(),this.list.focusNext(1,!1,e.browserEvent);const t=this.list.getFocus()[0];this.list.setAnchor(t),this.list.reveal(t),this.view.domNode.focus()}onPageUpArrow(e){e.preventDefault(),e.stopPropagation(),this.list.focusPreviousPage(e.browserEvent);const t=this.list.getFocus()[0];this.list.setAnchor(t),this.list.reveal(t),this.view.domNode.focus()}onPageDownArrow(e){e.preventDefault(),e.stopPropagation(),this.list.focusNextPage(e.browserEvent);const t=this.list.getFocus()[0];this.list.setAnchor(t),this.list.reveal(t),this.view.domNode.focus()}onCtrlA(e){e.preventDefault(),e.stopPropagation(),this.list.setSelection(Oa(this.list.length),e.browserEvent),this.list.setAnchor(void 0),this.view.domNode.focus()}onEscape(e){this.list.getSelection().length&&(e.preventDefault(),e.stopPropagation(),this.list.setSelection([],e.browserEvent),this.list.setAnchor(void 0),this.view.domNode.focus())}dispose(){this.disposables.dispose(),this.multipleSelectionDisposables.dispose()}}S$([tS],M$.prototype,"onKeyDown",null),function(e){e[e.Idle=0]="Idle",e[e.Typing=1]="Typing"}(x$||(x$={}));const A$=new class{mightProducePrintableCharacter(e){return!(e.ctrlKey||e.metaKey||e.altKey)&&(e.keyCode>=31&&e.keyCode<=56||e.keyCode>=21&&e.keyCode<=30||e.keyCode>=93&&e.keyCode<=102||e.keyCode>=80&&e.keyCode<=90)}};class O${constructor(e,t,i,n){this.list=e,this.view=t,this.keyboardNavigationLabelProvider=i,this.delegate=n,this.enabled=!1,this.state=x$.Idle,this.automaticKeyboardNavigation=!0,this.triggered=!1,this.previouslyFocused=-1,this.enabledDisposables=new ws,this.disposables=new ws,this.updateOptions(e.options)}updateOptions(e){void 0===e.enableKeyboardNavigation||!!e.enableKeyboardNavigation?this.enable():this.disable(),void 0!==e.automaticKeyboardNavigation&&(this.automaticKeyboardNavigation=e.automaticKeyboardNavigation)}enable(){if(this.enabled)return;const e=ds.chain(this.enabledDisposables.add(new eB(this.view.domNode,"keydown")).event).filter((e=>!I$(e.target))).filter((()=>this.automaticKeyboardNavigation||this.triggered)).map((e=>new jw(e))).filter((e=>this.delegate.mightProducePrintableCharacter(e))).forEach((e=>e.preventDefault())).map((e=>e.browserEvent.key)).event,t=ds.debounce(e,(()=>null),800);ds.reduce(ds.any(e,t),((e,t)=>null===t?null:(e||"")+t))(this.onInput,this,this.enabledDisposables),t(this.onClear,this,this.enabledDisposables),this.enabled=!0,this.triggered=!1}disable(){this.enabled&&(this.enabledDisposables.clear(),this.enabled=!1,this.triggered=!1)}onClear(){var e;const t=this.list.getFocus();if(t.length>0&&t[0]===this.previouslyFocused){const i=null===(e=this.list.options.accessibilityProvider)||void 0===e?void 0:e.getAriaLabel(this.list.element(t[0]));i&&dy(i)}this.previouslyFocused=-1}onInput(e){if(!e)return this.state=x$.Idle,void(this.triggered=!1);const t=this.list.getFocus(),i=t.length>0?t[0]:0,n=this.state===x$.Idle?1:0;this.state=x$.Typing;for(let o=0;o<this.list.length;o++){const t=(i+o+n)%this.list.length,s=this.keyboardNavigationLabelProvider.getKeyboardNavigationLabel(this.view.element(t)),r=s&&s.toString();if(void 0===r||Hz(e,r))return this.previouslyFocused=i,this.list.setFocus([t]),void this.list.reveal(t)}}dispose(){this.disable(),this.enabledDisposables.dispose(),this.disposables.dispose()}}class R${constructor(e,t){this.list=e,this.view=t,this.disposables=new ws;ds.chain(this.disposables.add(new eB(t.domNode,"keydown")).event).filter((e=>!I$(e.target))).map((e=>new jw(e))).filter((e=>!(2!==e.keyCode||e.ctrlKey||e.metaKey||e.shiftKey||e.altKey))).on(this.onTab,this,this.disposables)}onTab(e){if(e.target!==this.view.domNode)return;const t=this.list.getFocus();if(0===t.length)return;const i=this.view.domElement(t[0]);if(!i)return;const n=i.querySelector("[tabIndex]");if(!(n&&n instanceof HTMLElement&&-1!==n.tabIndex))return;const o=window.getComputedStyle(n);"hidden"!==o.visibility&&"none"!==o.display&&(e.preventDefault(),e.stopPropagation(),n.focus())}dispose(){this.disposables.dispose()}}function P$(e){return zo?e.browserEvent.metaKey:e.browserEvent.ctrlKey}function F$(e){return e.browserEvent.shiftKey}const B$={isSelectionSingleChangeEvent:P$,isSelectionRangeChangeEvent:F$};class V${constructor(e){this.list=e,this.disposables=new ws,this._onPointer=new $o,this.onPointer=this._onPointer.event,!1!==e.options.multipleSelectionSupport&&(this.multipleSelectionController=this.list.options.multipleSelectionController||B$),this.mouseSupport=void 0===e.options.mouseSupport||!!e.options.mouseSupport,this.mouseSupport&&(e.onMouseDown(this.onMouseDown,this,this.disposables),e.onContextMenu(this.onContextMenu,this,this.disposables),e.onMouseDblClick(this.onDoubleClick,this,this.disposables),e.onTouchStart(this.onMouseDown,this,this.disposables),this.disposables.add(oS.addTarget(e.getHTMLElement()))),ds.any(e.onMouseClick,e.onMouseMiddleClick,e.onTap)(this.onViewPointer,this,this.disposables)}updateOptions(e){void 0!==e.multipleSelectionSupport&&(this.multipleSelectionController=void 0,e.multipleSelectionSupport&&(this.multipleSelectionController=this.list.options.multipleSelectionController||B$))}isSelectionSingleChangeEvent(e){return!!this.multipleSelectionController&&this.multipleSelectionController.isSelectionSingleChangeEvent(e)}isSelectionRangeChangeEvent(e){return!!this.multipleSelectionController&&this.multipleSelectionController.isSelectionRangeChangeEvent(e)}isSelectionChangeEvent(e){return this.isSelectionSingleChangeEvent(e)||this.isSelectionRangeChangeEvent(e)}onMouseDown(e){T$(e.browserEvent.target)||document.activeElement!==e.browserEvent.target&&this.list.domFocus()}onContextMenu(e){if(T$(e.browserEvent.target))return;const t=void 0===e.index?[]:[e.index];this.list.setFocus(t,e.browserEvent)}onViewPointer(e){if(!this.mouseSupport)return;if(I$(e.browserEvent.target)||T$(e.browserEvent.target))return;const t=e.index;return void 0===t?(this.list.setFocus([],e.browserEvent),this.list.setSelection([],e.browserEvent),void this.list.setAnchor(void 0)):this.isSelectionRangeChangeEvent(e)||this.isSelectionChangeEvent(e)?this.changeSelection(e):(this.list.setFocus([t],e.browserEvent),this.list.setAnchor(t),(i=e.browserEvent)instanceof MouseEvent&&2===i.button||this.list.setSelection([t],e.browserEvent),void this._onPointer.fire(e));var i}onDoubleClick(e){if(I$(e.browserEvent.target)||T$(e.browserEvent.target))return;if(this.isSelectionChangeEvent(e))return;const t=this.list.getFocus();this.list.setSelection(t,e.browserEvent)}changeSelection(e){const t=e.index;let i=this.list.getAnchor();if(this.isSelectionRangeChangeEvent(e)){if(void 0===i){const e=this.list.getFocus()[0];i=null!=e?e:t,this.list.setAnchor(i)}const n=Math.min(i,t),o=Math.max(i,t),s=Oa(n,o+1),r=this.list.getSelection(),a=function(e,t){const i=e.indexOf(t);if(-1===i)return[];const n=[];let o=i-1;for(;o>=0&&e[o]===t-(i-o);)n.push(e[o--]);n.reverse(),o=i;for(;o<e.length&&e[o]===t+(o-i);)n.push(e[o++]);return n}(j$(r,[i]),i);if(0===a.length)return;const l=j$(s,function(e,t){const i=[];let n=0,o=0;for(;n<e.length||o<t.length;)if(n>=e.length)i.push(t[o++]);else if(o>=t.length)i.push(e[n++]);else{if(e[n]===t[o]){n++,o++;continue}e[n]<t[o]?i.push(e[n++]):o++}return i}(r,a));this.list.setSelection(l,e.browserEvent),this.list.setFocus([t],e.browserEvent)}else if(this.isSelectionSingleChangeEvent(e)){const i=this.list.getSelection(),n=i.filter((e=>e!==t));this.list.setFocus([t]),this.list.setAnchor(t),i.length===n.length?this.list.setSelection([...n,t],e.browserEvent):this.list.setSelection(n,e.browserEvent)}}dispose(){this.disposables.dispose()}}class W${constructor(e,t){this.styleElement=e,this.selectorSuffix=t}style(e){const t=this.selectorSuffix&&`.${this.selectorSuffix}`,i=[];e.listBackground&&e.listBackground.isOpaque()&&i.push(`.monaco-list${t} .monaco-list-rows { background: ${e.listBackground}; }`),e.listFocusBackground&&(i.push(`.monaco-list${t}:focus .monaco-list-row.focused { background-color: ${e.listFocusBackground}; }`),i.push(`.monaco-list${t}:focus .monaco-list-row.focused:hover { background-color: ${e.listFocusBackground}; }`)),e.listFocusForeground&&i.push(`.monaco-list${t}:focus .monaco-list-row.focused { color: ${e.listFocusForeground}; }`),e.listActiveSelectionBackground&&(i.push(`.monaco-list${t}:focus .monaco-list-row.selected { background-color: ${e.listActiveSelectionBackground}; }`),i.push(`.monaco-list${t}:focus .monaco-list-row.selected:hover { background-color: ${e.listActiveSelectionBackground}; }`)),e.listActiveSelectionForeground&&i.push(`.monaco-list${t}:focus .monaco-list-row.selected { color: ${e.listActiveSelectionForeground}; }`),e.listActiveSelectionIconForeground&&i.push(`.monaco-list${t}:focus .monaco-list-row.selected .codicon { color: ${e.listActiveSelectionIconForeground}; }`),e.listFocusAndSelectionBackground&&i.push(`\n\t\t\t\t.monaco-drag-image,\n\t\t\t\t.monaco-list${t}:focus .monaco-list-row.selected.focused { background-color: ${e.listFocusAndSelectionBackground}; }\n\t\t\t`),e.listFocusAndSelectionForeground&&i.push(`\n\t\t\t\t.monaco-drag-image,\n\t\t\t\t.monaco-list${t}:focus .monaco-list-row.selected.focused { color: ${e.listFocusAndSelectionForeground}; }\n\t\t\t`),e.listInactiveFocusForeground&&(i.push(`.monaco-list${t} .monaco-list-row.focused { color: ${e.listInactiveFocusForeground}; }`),i.push(`.monaco-list${t} .monaco-list-row.focused:hover { color: ${e.listInactiveFocusForeground}; }`)),e.listInactiveSelectionIconForeground&&i.push(`.monaco-list${t} .monaco-list-row.focused .codicon { color: ${e.listInactiveSelectionIconForeground}; }`),e.listInactiveFocusBackground&&(i.push(`.monaco-list${t} .monaco-list-row.focused { background-color: ${e.listInactiveFocusBackground}; }`),i.push(`.monaco-list${t} .monaco-list-row.focused:hover { background-color: ${e.listInactiveFocusBackground}; }`)),e.listInactiveSelectionBackground&&(i.push(`.monaco-list${t} .monaco-list-row.selected { background-color: ${e.listInactiveSelectionBackground}; }`),i.push(`.monaco-list${t} .monaco-list-row.selected:hover { background-color: ${e.listInactiveSelectionBackground}; }`)),e.listInactiveSelectionForeground&&i.push(`.monaco-list${t} .monaco-list-row.selected { color: ${e.listInactiveSelectionForeground}; }`),e.listHoverBackground&&i.push(`.monaco-list${t}:not(.drop-target) .monaco-list-row:hover:not(.selected):not(.focused) { background-color: ${e.listHoverBackground}; }`),e.listHoverForeground&&i.push(`.monaco-list${t} .monaco-list-row:hover:not(.selected):not(.focused) { color: ${e.listHoverForeground}; }`),e.listSelectionOutline&&i.push(`.monaco-list${t} .monaco-list-row.selected { outline: 1px dotted ${e.listSelectionOutline}; outline-offset: -1px; }`),e.listFocusOutline&&i.push(`\n\t\t\t\t.monaco-drag-image,\n\t\t\t\t.monaco-list${t}:focus .monaco-list-row.focused { outline: 1px solid ${e.listFocusOutline}; outline-offset: -1px; }\n\t\t\t\t.monaco-workbench.context-menu-visible .monaco-list${t}.last-focused .monaco-list-row.focused { outline: 1px solid ${e.listFocusOutline}; outline-offset: -1px; }\n\t\t\t`),e.listInactiveFocusOutline&&i.push(`.monaco-list${t} .monaco-list-row.focused { outline: 1px dotted ${e.listInactiveFocusOutline}; outline-offset: -1px; }`),e.listHoverOutline&&i.push(`.monaco-list${t} .monaco-list-row:hover { outline: 1px dashed ${e.listHoverOutline}; outline-offset: -1px; }`),e.listDropBackground&&i.push(`\n\t\t\t\t.monaco-list${t}.drop-target,\n\t\t\t\t.monaco-list${t} .monaco-list-rows.drop-target,\n\t\t\t\t.monaco-list${t} .monaco-list-row.drop-target { background-color: ${e.listDropBackground} !important; color: inherit !important; }\n\t\t\t`),e.listFilterWidgetBackground&&i.push(`.monaco-list-type-filter { background-color: ${e.listFilterWidgetBackground} }`),e.listFilterWidgetOutline&&i.push(`.monaco-list-type-filter { border: 1px solid ${e.listFilterWidgetOutline}; }`),e.listFilterWidgetNoMatchesOutline&&i.push(`.monaco-list-type-filter.no-matches { border: 1px solid ${e.listFilterWidgetNoMatchesOutline}; }`),e.listMatchesShadow&&i.push(`.monaco-list-type-filter { box-shadow: 1px 1px 1px ${e.listMatchesShadow}; }`),e.tableColumnsBorder&&i.push(`\n\t\t\t\t.monaco-table:hover > .monaco-split-view2,\n\t\t\t\t.monaco-table:hover > .monaco-split-view2 .monaco-sash.vertical::before {\n\t\t\t\t\tborder-color: ${e.tableColumnsBorder};\n\t\t\t}`),e.tableOddRowsBackgroundColor&&i.push(`\n\t\t\t\t.monaco-table .monaco-list-row[data-parity=odd]:not(.focused):not(.selected):not(:hover) .monaco-table-tr,\n\t\t\t\t.monaco-table .monaco-list:not(:focus) .monaco-list-row[data-parity=odd].focused:not(.selected):not(:hover) .monaco-table-tr,\n\t\t\t\t.monaco-table .monaco-list:not(.focused) .monaco-list-row[data-parity=odd].focused:not(.selected):not(:hover) .monaco-table-tr {\n\t\t\t\t\tbackground-color: ${e.tableOddRowsBackgroundColor};\n\t\t\t\t}\n\t\t\t`),this.styleElement.textContent=i.join("\n")}}const z$={listFocusBackground:hS.fromHex("#7FB0D0"),listActiveSelectionBackground:hS.fromHex("#0E639C"),listActiveSelectionForeground:hS.fromHex("#FFFFFF"),listActiveSelectionIconForeground:hS.fromHex("#FFFFFF"),listFocusAndSelectionBackground:hS.fromHex("#094771"),listFocusAndSelectionForeground:hS.fromHex("#FFFFFF"),listInactiveSelectionBackground:hS.fromHex("#3F3F46"),listInactiveSelectionIconForeground:hS.fromHex("#FFFFFF"),listHoverBackground:hS.fromHex("#2A2D2E"),listDropBackground:hS.fromHex("#383B3D"),treeIndentGuidesStroke:hS.fromHex("#a9a9a9"),tableColumnsBorder:hS.fromHex("#cccccc").transparent(.2),tableOddRowsBackgroundColor:hS.fromHex("#cccccc").transparent(.04)},H$={keyboardSupport:!0,mouseSupport:!0,multipleSelectionSupport:!0,dnd:{getDragURI:()=>null,onDragStart(){},onDragOver:()=>!1,drop(){}}};function j$(e,t){const i=[];let n=0,o=0;for(;n<e.length||o<t.length;)if(n>=e.length)i.push(t[o++]);else if(o>=t.length)i.push(e[n++]);else{if(e[n]===t[o]){i.push(e[n]),n++,o++;continue}e[n]<t[o]?i.push(e[n++]):i.push(t[o++])}return i}const U$=(e,t)=>e-t;class $${constructor(e,t){this._templateId=e,this.renderers=t}get templateId(){return this._templateId}renderTemplate(e){return this.renderers.map((t=>t.renderTemplate(e)))}renderElement(e,t,i,n){let o=0;for(const s of this.renderers)s.renderElement(e,t,i[o++],n)}disposeElement(e,t,i,n){let o=0;for(const s of this.renderers)s.disposeElement&&s.disposeElement(e,t,i[o],n),o+=1}disposeTemplate(e){let t=0;for(const i of this.renderers)i.disposeTemplate(e[t++])}}class K${constructor(e){this.accessibilityProvider=e,this.templateId="a18n"}renderTemplate(e){return e}renderElement(e,t,i){const n=this.accessibilityProvider.getAriaLabel(e);n?i.setAttribute("aria-label",n):i.removeAttribute("aria-label");const o=this.accessibilityProvider.getAriaLevel&&this.accessibilityProvider.getAriaLevel(e);"number"==typeof o?i.setAttribute("aria-level",`${o}`):i.removeAttribute("aria-level")}disposeTemplate(e){}}class q${constructor(e,t){this.list=e,this.dnd=t}getDragElements(e){const t=this.list.getSelectedElements();return t.indexOf(e)>-1?t:[e]}getDragURI(e){return this.dnd.getDragURI(e)}getDragLabel(e,t){if(this.dnd.getDragLabel)return this.dnd.getDragLabel(e,t)}onDragStart(e,t){this.dnd.onDragStart&&this.dnd.onDragStart(e,t)}onDragOver(e,t,i,n){return this.dnd.onDragOver(e,t,i,n)}onDragLeave(e,t,i,n){var o,s;null===(s=(o=this.dnd).onDragLeave)||void 0===s||s.call(o,e,t,i,n)}onDragEnd(e){this.dnd.onDragEnd&&this.dnd.onDragEnd(e)}drop(e,t,i,n){this.dnd.drop(e,t,i,n)}}class G${constructor(e,t,i,n,o=H$){var s;this.user=e,this._options=o,this.focus=new L$("focused"),this.anchor=new L$("anchor"),this.eventBufferer=new Ba,this._ariaLabel="",this.disposables=new ws,this._onDidDispose=new $o,this.onDidDispose=this._onDidDispose.event;const r=this._options.accessibilityProvider&&this._options.accessibilityProvider.getWidgetRole?null===(s=this._options.accessibilityProvider)||void 0===s?void 0:s.getWidgetRole():"list";this.selection=new N$("listbox"!==r),Ko(o,z$,!1);const a=[this.focus.renderer,this.selection.renderer];this.accessibilityProvider=o.accessibilityProvider,this.accessibilityProvider&&(a.push(new K$(this.accessibilityProvider)),this.accessibilityProvider.onDidChangeActiveDescendant&&this.accessibilityProvider.onDidChangeActiveDescendant(this.onDidChangeActiveDescendant,this,this.disposables)),n=n.map((e=>new $$(e.templateId,[...a,e])));const l=Object.assign(Object.assign({},o),{dnd:o.dnd&&new q$(this,o.dnd)});if(this.view=new y$(t,i,n,l),this.view.domNode.setAttribute("role",r),o.styleController)this.styleController=o.styleController(this.view.domId);else{const e=RC(this.view.domNode);this.styleController=new W$(e,this.view.domId)}if(this.spliceable=new c$([new E$(this.focus,this.view,o.identityProvider),new E$(this.selection,this.view,o.identityProvider),new E$(this.anchor,this.view,o.identityProvider),this.view]),this.disposables.add(this.focus),this.disposables.add(this.selection),this.disposables.add(this.anchor),this.disposables.add(this.view),this.disposables.add(this._onDidDispose),this.disposables.add(new R$(this,this.view)),("boolean"!=typeof o.keyboardSupport||o.keyboardSupport)&&(this.keyboardController=new M$(this,this.view,o),this.disposables.add(this.keyboardController)),o.keyboardNavigationLabelProvider){const e=o.keyboardNavigationDelegate||A$;this.typeLabelController=new O$(this,this.view,o.keyboardNavigationLabelProvider,e),this.disposables.add(this.typeLabelController)}this.mouseController=this.createMouseController(o),this.disposables.add(this.mouseController),this.onDidChangeFocus(this._onFocusChange,this,this.disposables),this.onDidChangeSelection(this._onSelectionChange,this,this.disposables),this.accessibilityProvider&&(this.ariaLabel=this.accessibilityProvider.getWidgetAriaLabel()),!1!==this._options.multipleSelectionSupport&&this.view.domNode.setAttribute("aria-multiselectable","true")}get onDidChangeFocus(){return ds.map(this.eventBufferer.wrapEvent(this.focus.onChange),(e=>this.toListEvent(e)))}get onDidChangeSelection(){return ds.map(this.eventBufferer.wrapEvent(this.selection.onChange),(e=>this.toListEvent(e)))}get domId(){return this.view.domId}get onMouseClick(){return this.view.onMouseClick}get onMouseDblClick(){return this.view.onMouseDblClick}get onMouseMiddleClick(){return this.view.onMouseMiddleClick}get onPointer(){return this.mouseController.onPointer}get onMouseDown(){return this.view.onMouseDown}get onTouchStart(){return this.view.onTouchStart}get onTap(){return this.view.onTap}get onContextMenu(){let e=!1;const t=ds.chain(this.disposables.add(new eB(this.view.domNode,"keydown")).event).map((e=>new jw(e))).filter((t=>e=58===t.keyCode||t.shiftKey&&68===t.keyCode)).map(tB).filter((()=>!1)).event,i=ds.chain(this.disposables.add(new eB(this.view.domNode,"keyup")).event).forEach((()=>e=!1)).map((e=>new jw(e))).filter((e=>58===e.keyCode||e.shiftKey&&68===e.keyCode)).map(tB).map((({browserEvent:e})=>{const t=this.getFocus(),i=t.length?t[0]:void 0;return{index:i,element:void 0!==i?this.view.element(i):void 0,anchor:void 0!==i?this.view.domElement(i):this.view.domNode,browserEvent:e}})).event,n=ds.chain(this.view.onContextMenu).filter((t=>!e)).map((({element:e,index:t,browserEvent:i})=>({element:e,index:t,anchor:{x:i.pageX+1,y:i.pageY},browserEvent:i}))).event;return ds.any(t,i,n)}get onKeyDown(){return this.disposables.add(new eB(this.view.domNode,"keydown")).event}get onDidFocus(){return ds.signal(this.disposables.add(new eB(this.view.domNode,"focus",!0)).event)}createMouseController(e){return new V$(this)}updateOptions(e={}){var t;this._options=Object.assign(Object.assign({},this._options),e),this.typeLabelController&&this.typeLabelController.updateOptions(this._options),void 0!==this._options.multipleSelectionController&&(this._options.multipleSelectionSupport?this.view.domNode.setAttribute("aria-multiselectable","true"):this.view.domNode.removeAttribute("aria-multiselectable")),this.mouseController.updateOptions(e),null===(t=this.keyboardController)||void 0===t||t.updateOptions(e),this.view.updateOptions(e)}get options(){return this._options}splice(e,t,i=[]){if(e<0||e>this.view.length)throw new h$(this.user,`Invalid start index: ${e}`);if(t<0)throw new h$(this.user,`Invalid delete count: ${t}`);0===t&&0===i.length||this.eventBufferer.bufferEvents((()=>this.spliceable.splice(e,t,i)))}rerender(){this.view.rerender()}element(e){return this.view.element(e)}get length(){return this.view.length}get contentHeight(){return this.view.contentHeight}get scrollTop(){return this.view.getScrollTop()}set scrollTop(e){this.view.setScrollTop(e)}get ariaLabel(){return this._ariaLabel}set ariaLabel(e){this._ariaLabel=e,this.view.domNode.setAttribute("aria-label",e)}domFocus(){this.view.domNode.focus({preventScroll:!0})}layout(e,t){this.view.layout(e,t)}setSelection(e,t){for(const i of e)if(i<0||i>=this.length)throw new h$(this.user,`Invalid index ${i}`);this.selection.set(e,t)}getSelection(){return this.selection.get()}getSelectedElements(){return this.getSelection().map((e=>this.view.element(e)))}setAnchor(e){if(void 0!==e){if(e<0||e>=this.length)throw new h$(this.user,`Invalid index ${e}`);this.anchor.set([e])}else this.anchor.set([])}getAnchor(){return ka(this.anchor.get(),void 0)}getAnchorElement(){const e=this.getAnchor();return void 0===e?void 0:this.element(e)}setFocus(e,t){for(const i of e)if(i<0||i>=this.length)throw new h$(this.user,`Invalid index ${i}`);this.focus.set(e,t)}focusNext(e=1,t=!1,i,n){if(0===this.length)return;const o=this.focus.get(),s=this.findNextIndex(o.length>0?o[0]+e:0,t,n);s>-1&&this.setFocus([s],i)}focusPrevious(e=1,t=!1,i,n){if(0===this.length)return;const o=this.focus.get(),s=this.findPreviousIndex(o.length>0?o[0]-e:0,t,n);s>-1&&this.setFocus([s],i)}focusNextPage(e,t){return k$(this,void 0,void 0,(function*(){let i=this.view.indexAt(this.view.getScrollTop()+this.view.renderHeight);i=0===i?0:i-1;const n=this.view.element(i),o=this.getFocusedElements()[0];if(o!==n){const n=this.findPreviousIndex(i,!1,t);n>-1&&o!==this.view.element(n)?this.setFocus([n],e):this.setFocus([i],e)}else{const n=this.view.getScrollTop();this.view.setScrollTop(n+this.view.renderHeight-this.view.elementHeight(i)),this.view.getScrollTop()!==n&&(this.setFocus([]),yield nb(0),yield this.focusNextPage(e,t))}}))}focusPreviousPage(e,t){return k$(this,void 0,void 0,(function*(){let i;const n=this.view.getScrollTop();i=0===n?this.view.indexAt(n):this.view.indexAfter(n-1);const o=this.view.element(i),s=this.getFocusedElements()[0];if(s!==o){const n=this.findNextIndex(i,!1,t);n>-1&&s!==this.view.element(n)?this.setFocus([n],e):this.setFocus([i],e)}else{const i=n;this.view.setScrollTop(n-this.view.renderHeight),this.view.getScrollTop()!==i&&(this.setFocus([]),yield nb(0),yield this.focusPreviousPage(e,t))}}))}focusLast(e,t){if(0===this.length)return;const i=this.findPreviousIndex(this.length-1,!1,t);i>-1&&this.setFocus([i],e)}focusFirst(e,t){this.focusNth(0,e,t)}focusNth(e,t,i){if(0===this.length)return;const n=this.findNextIndex(e,!1,i);n>-1&&this.setFocus([n],t)}findNextIndex(e,t=!1,i){for(let n=0;n<this.length;n++){if(e>=this.length&&!t)return-1;if(e%=this.length,!i||i(this.element(e)))return e;e++}return-1}findPreviousIndex(e,t=!1,i){for(let n=0;n<this.length;n++){if(e<0&&!t)return-1;if(e=(this.length+e%this.length)%this.length,!i||i(this.element(e)))return e;e--}return-1}getFocus(){return this.focus.get()}getFocusedElements(){return this.getFocus().map((e=>this.view.element(e)))}reveal(e,t){if(e<0||e>=this.length)throw new h$(this.user,`Invalid index ${e}`);const i=this.view.getScrollTop(),n=this.view.elementTop(e),o=this.view.elementHeight(e);if(vr(t)){const e=o-this.view.renderHeight;this.view.setScrollTop(e*JV(t,0,1)+n)}else{const e=n+o,t=i+this.view.renderHeight;n<i&&e>=t||(n<i||e>=t&&o>=this.view.renderHeight?this.view.setScrollTop(n):e>=t&&this.view.setScrollTop(e-this.view.renderHeight))}}getRelativeTop(e){if(e<0||e>=this.length)throw new h$(this.user,`Invalid index ${e}`);const t=this.view.getScrollTop(),i=this.view.elementTop(e),n=this.view.elementHeight(e);if(i<t||i+n>t+this.view.renderHeight)return null;const o=n-this.view.renderHeight;return Math.abs((t-i)/o)}getHTMLElement(){return this.view.domNode}style(e){this.styleController.style(e)}toListEvent({indexes:e,browserEvent:t}){return{indexes:e,elements:e.map((e=>this.view.element(e))),browserEvent:t}}_onFocusChange(){const e=this.focus.get();this.view.domNode.classList.toggle("element-focused",e.length>0),this.onDidChangeActiveDescendant()}onDidChangeActiveDescendant(){var e;const t=this.focus.get();if(t.length>0){let i;(null===(e=this.accessibilityProvider)||void 0===e?void 0:e.getActiveDescendantId)&&(i=this.accessibilityProvider.getActiveDescendantId(this.view.element(t[0]))),this.view.domNode.setAttribute("aria-activedescendant",i||this.view.getElementDomId(t[0]))}else this.view.domNode.removeAttribute("aria-activedescendant")}_onSelectionChange(){const e=this.selection.get();this.view.domNode.classList.toggle("selection-none",0===e.length),this.view.domNode.classList.toggle("selection-single",1===e.length),this.view.domNode.classList.toggle("selection-multiple",e.length>1)}dispose(){this._onDidDispose.fire(),this.disposables.dispose(),this._onDidDispose.dispose()}}S$([tS],G$.prototype,"onDidChangeFocus",null),S$([tS],G$.prototype,"onDidChangeSelection",null),S$([tS],G$.prototype,"onContextMenu",null),S$([tS],G$.prototype,"onKeyDown",null),S$([tS],G$.prototype,"onDidFocus",null);class Z${constructor(e,t){this.renderer=e,this.modelProvider=t}get templateId(){return this.renderer.templateId}renderTemplate(e){return{data:this.renderer.renderTemplate(e),disposable:Uo.None}}renderElement(e,t,i,n){if(i.disposable&&i.disposable.dispose(),!i.data)return;const o=this.modelProvider();if(o.isResolved(e))return this.renderer.renderElement(o.get(e),e,i.data,n);const s=new as,r=o.resolve(e,s.token);i.disposable={dispose:()=>s.cancel()},this.renderer.renderPlaceholder(e,i.data),r.then((t=>this.renderer.renderElement(t,e,i.data,n)))}disposeTemplate(e){e.disposable&&(e.disposable.dispose(),e.disposable=void 0),e.data&&(this.renderer.disposeTemplate(e.data),e.data=void 0)}}class Y${constructor(e,t){this.modelProvider=e,this.accessibilityProvider=t}getWidgetAriaLabel(){return this.accessibilityProvider.getWidgetAriaLabel()}getAriaLabel(e){const t=this.modelProvider();return t.isResolved(e)?this.accessibilityProvider.getAriaLabel(t.get(e)):null}}const X$={separatorBorder:hS.transparent};class Q${constructor(e,t,i,n){this.container=e,this.view=t,this.disposable=n,this._cachedVisibleSize=void 0,"number"==typeof i?(this._size=i,this._cachedVisibleSize=void 0,e.classList.add("visible")):(this._size=0,this._cachedVisibleSize=i.cachedVisibleSize)}set size(e){this._size=e}get size(){return this._size}get visible(){return void 0===this._cachedVisibleSize}setVisible(e,t){e!==this.visible&&(e?(this.size=JV(this._cachedVisibleSize,this.viewMinimumSize,this.viewMaximumSize),this._cachedVisibleSize=void 0):(this._cachedVisibleSize="number"==typeof t?t:this.size,this.size=0),this.container.classList.toggle("visible",e),this.view.setVisible&&this.view.setVisible(e))}get minimumSize(){return this.visible?this.view.minimumSize:0}get viewMinimumSize(){return this.view.minimumSize}get maximumSize(){return this.visible?this.view.maximumSize:0}get viewMaximumSize(){return this.view.maximumSize}get priority(){return this.view.priority}get snap(){return!!this.view.snap}set enabled(e){this.container.style.pointerEvents=e?"":"none"}layout(e,t){this.layoutContainer(e),this.view.layout(this.size,e,t)}dispose(){return this.disposable.dispose(),this.view}}class J$ extends Q${layoutContainer(e){this.container.style.top=`${e}px`,this.container.style.height=`${this.size}px`}}class eK extends Q${layoutContainer(e){this.container.style.left=`${e}px`,this.container.style.width=`${this.size}px`}}var tK,iK;!function(e){e[e.Idle=0]="Idle",e[e.Busy=1]="Busy"}(tK||(tK={})),function(e){e.Distribute={type:"distribute"},e.Split=function(e){return{type:"split",index:e}},e.Invisible=function(e){return{type:"invisible",cachedVisibleSize:e}}}(iK||(iK={}));class nK extends Uo{constructor(e,t={}){var i,n,o,s,r;super(),this.size=0,this.contentSize=0,this.proportions=void 0,this.viewItems=[],this.sashItems=[],this.state=tK.Idle,this._onDidSashChange=this._register(new $o),this._onDidSashReset=this._register(new $o),this._startSnappingEnabled=!0,this._endSnappingEnabled=!0,this.onDidSashChange=this._onDidSashChange.event,this.onDidSashReset=this._onDidSashReset.event,this.orientation=null!==(i=t.orientation)&&void 0!==i?i:0,this.inverseAltBehavior=null!==(n=t.inverseAltBehavior)&&void 0!==n&&n,this.proportionalLayout=null===(o=t.proportionalLayout)||void 0===o||o,this.getSashOrthogonalSize=t.getSashOrthogonalSize,this.el=document.createElement("div"),this.el.classList.add("monaco-split-view2"),this.el.classList.add(0===this.orientation?"vertical":"horizontal"),e.appendChild(this.el),this.sashContainer=$C(this.el,YC(".sash-container")),this.viewContainer=YC(".split-view-container"),this.scrollable=new aT({forceIntegerValues:!0,smoothScrollDuration:125,scheduleAtNextAnimationFrame:hC}),this.scrollableElement=this._register(new mT(this.viewContainer,{vertical:0===this.orientation?null!==(s=t.scrollbarVisibility)&&void 0!==s?s:1:2,horizontal:1===this.orientation?null!==(r=t.scrollbarVisibility)&&void 0!==r?r:1:2},this.scrollable)),this.onDidScroll=this.scrollableElement.onScroll,this._register(this.onDidScroll((e=>{this.viewContainer.scrollTop=e.scrollTop,this.viewContainer.scrollLeft=e.scrollLeft}))),$C(this.el,this.scrollableElement.getDomNode()),this.style(t.styles||X$),t.descriptor&&(this.size=t.descriptor.size,t.descriptor.views.forEach(((e,t)=>{const i=fr(e.visible)||e.visible?e.size:{type:"invisible",cachedVisibleSize:e.size},n=e.view;this.doAddView(n,i,t,!0)})),this.contentSize=this.viewItems.reduce(((e,t)=>e+t.size),0),this.saveProportions())}get orthogonalStartSash(){return this._orthogonalStartSash}get orthogonalEndSash(){return this._orthogonalEndSash}get startSnappingEnabled(){return this._startSnappingEnabled}get endSnappingEnabled(){return this._endSnappingEnabled}set orthogonalStartSash(e){for(const t of this.sashItems)t.sash.orthogonalStartSash=e;this._orthogonalStartSash=e}set orthogonalEndSash(e){for(const t of this.sashItems)t.sash.orthogonalEndSash=e;this._orthogonalEndSash=e}set startSnappingEnabled(e){this._startSnappingEnabled!==e&&(this._startSnappingEnabled=e,this.updateSashEnablement())}set endSnappingEnabled(e){this._endSnappingEnabled!==e&&(this._endSnappingEnabled=e,this.updateSashEnablement())}style(e){e.separatorBorder.isTransparent()?(this.el.classList.remove("separator-border"),this.el.style.removeProperty("--separator-border")):(this.el.classList.add("separator-border"),this.el.style.setProperty("--separator-border",e.separatorBorder.toString()))}addView(e,t,i=this.viewItems.length,n){this.doAddView(e,t,i,n)}layout(e,t){const i=Math.max(this.size,this.contentSize);if(this.size=e,this.layoutContext=t,this.proportions)for(let n=0;n<this.viewItems.length;n++){const t=this.viewItems[n];t.size=JV(Math.round(this.proportions[n]*e),t.minimumSize,t.maximumSize)}else{const t=Oa(this.viewItems.length),n=t.filter((e=>1===this.viewItems[e].priority)),o=t.filter((e=>2===this.viewItems[e].priority));this.resize(this.viewItems.length-1,e-i,void 0,n,o)}this.distributeEmptySpace(),this.layoutViews()}saveProportions(){this.proportionalLayout&&this.contentSize>0&&(this.proportions=this.viewItems.map((e=>e.size/this.contentSize)))}onSashStart({sash:e,start:t,alt:i}){for(const r of this.viewItems)r.enabled=!1;const n=this.sashItems.findIndex((t=>t.sash===e)),o=ta(nC(document.body,"keydown",(e=>s(this.sashDragState.current,e.altKey))),nC(document.body,"keyup",(()=>s(this.sashDragState.current,!1)))),s=(e,t)=>{const i=this.viewItems.map((e=>e.size));let s,r,a=Number.NEGATIVE_INFINITY,l=Number.POSITIVE_INFINITY;if(this.inverseAltBehavior&&(t=!t),t){if(n===this.sashItems.length-1){const e=this.viewItems[n];a=(e.minimumSize-e.size)/2,l=(e.maximumSize-e.size)/2}else{const e=this.viewItems[n+1];a=(e.size-e.maximumSize)/2,l=(e.size-e.minimumSize)/2}}if(!t){const e=Oa(n,-1),t=Oa(n+1,this.viewItems.length),o=e.reduce(((e,t)=>e+(this.viewItems[t].minimumSize-i[t])),0),a=e.reduce(((e,t)=>e+(this.viewItems[t].viewMaximumSize-i[t])),0),l=0===t.length?Number.POSITIVE_INFINITY:t.reduce(((e,t)=>e+(i[t]-this.viewItems[t].minimumSize)),0),d=0===t.length?Number.NEGATIVE_INFINITY:t.reduce(((e,t)=>e+(i[t]-this.viewItems[t].viewMaximumSize)),0),c=Math.max(o,d),h=Math.min(l,a),u=this.findFirstSnapIndex(e),g=this.findFirstSnapIndex(t);if("number"==typeof u){const e=this.viewItems[u],t=Math.floor(e.viewMinimumSize/2);s={index:u,limitDelta:e.visible?c-t:c+t,size:e.size}}if("number"==typeof g){const e=this.viewItems[g],t=Math.floor(e.viewMinimumSize/2);r={index:g,limitDelta:e.visible?h+t:h-t,size:e.size}}}this.sashDragState={start:e,current:e,index:n,sizes:i,minDelta:a,maxDelta:l,alt:t,snapBefore:s,snapAfter:r,disposable:o}};s(t,i)}onSashChange({current:e}){const{index:t,start:i,sizes:n,alt:o,minDelta:s,maxDelta:r,snapBefore:a,snapAfter:l}=this.sashDragState;this.sashDragState.current=e;const d=e-i,c=this.resize(t,d,n,void 0,void 0,s,r,a,l);if(o){const e=t===this.sashItems.length-1,i=this.viewItems.map((e=>e.size)),n=e?t:t+1,o=this.viewItems[n],s=o.size-o.maximumSize,r=o.size-o.minimumSize,a=e?t-1:t+1;this.resize(a,-c,i,void 0,void 0,s,r)}this.distributeEmptySpace(),this.layoutViews()}onSashEnd(e){this._onDidSashChange.fire(e),this.sashDragState.disposable.dispose(),this.saveProportions();for(const t of this.viewItems)t.enabled=!0}onViewChange(e,t){const i=this.viewItems.indexOf(e);i<0||i>=this.viewItems.length||(t=JV(t="number"==typeof t?t:e.size,e.minimumSize,e.maximumSize),this.inverseAltBehavior&&i>0?(this.resize(i-1,Math.floor((e.size-t)/2)),this.distributeEmptySpace(),this.layoutViews()):(e.size=t,this.relayout([i],void 0)))}resizeView(e,t){if(this.state!==tK.Idle)throw new Error("Cant modify splitview");if(this.state=tK.Busy,e<0||e>=this.viewItems.length)return;const i=Oa(this.viewItems.length).filter((t=>t!==e)),n=[...i.filter((e=>1===this.viewItems[e].priority)),e],o=i.filter((e=>2===this.viewItems[e].priority)),s=this.viewItems[e];t=JV(t=Math.round(t),s.minimumSize,Math.min(s.maximumSize,this.size)),s.size=t,this.relayout(n,o),this.state=tK.Idle}distributeViewSizes(){const e=[];let t=0;for(const r of this.viewItems)r.maximumSize-r.minimumSize>0&&(e.push(r),t+=r.size);const i=Math.floor(t/e.length);for(const r of e)r.size=JV(i,r.minimumSize,r.maximumSize);const n=Oa(this.viewItems.length),o=n.filter((e=>1===this.viewItems[e].priority)),s=n.filter((e=>2===this.viewItems[e].priority));this.relayout(o,s)}getViewSize(e){return e<0||e>=this.viewItems.length?-1:this.viewItems[e].size}doAddView(e,t,i=this.viewItems.length,n){if(this.state!==tK.Idle)throw new Error("Cant modify splitview");this.state=tK.Busy;const o=YC(".split-view-view");i===this.viewItems.length?this.viewContainer.appendChild(o):this.viewContainer.insertBefore(o,this.viewContainer.children.item(i));const s=e.onDidChange((e=>this.onViewChange(d,e))),r=es((()=>this.viewContainer.removeChild(o))),a=ta(s,r);let l;l="number"==typeof t?t:"split"===t.type?this.getViewSize(t.index)/2:"invisible"===t.type?{cachedVisibleSize:t.cachedVisibleSize}:e.minimumSize;const d=0===this.orientation?new J$(o,e,l,a):new eK(o,e,l,a);if(this.viewItems.splice(i,0,d),this.viewItems.length>1){let e={orthogonalStartSash:this.orthogonalStartSash,orthogonalEndSash:this.orthogonalEndSash};const t=0===this.orientation?new cB(this.sashContainer,{getHorizontalSashTop:e=>this.getSashPosition(e),getHorizontalSashWidth:this.getSashOrthogonalSize},Object.assign(Object.assign({},e),{orientation:1})):new cB(this.sashContainer,{getVerticalSashLeft:e=>this.getSashPosition(e),getVerticalSashHeight:this.getSashOrthogonalSize},Object.assign(Object.assign({},e),{orientation:0})),n=0===this.orientation?e=>({sash:t,start:e.startY,current:e.currentY,alt:e.altKey}):e=>({sash:t,start:e.startX,current:e.currentX,alt:e.altKey}),o=ds.map(t.onDidStart,n)(this.onSashStart,this),s=ds.map(t.onDidChange,n)(this.onSashChange,this),r=ds.map(t.onDidEnd,(()=>this.sashItems.findIndex((e=>e.sash===t)))),a=r(this.onSashEnd,this),l=t.onDidReset((()=>{const e=this.sashItems.findIndex((e=>e.sash===t)),i=Oa(e,-1),n=Oa(e+1,this.viewItems.length),o=this.findFirstSnapIndex(i),s=this.findFirstSnapIndex(n);("number"!=typeof o||this.viewItems[o].visible)&&("number"!=typeof s||this.viewItems[s].visible)&&this._onDidSashReset.fire(e)})),d=ta(o,s,a,l,t),c={sash:t,disposable:d};this.sashItems.splice(i-1,0,c)}let c;o.appendChild(e.element),"number"!=typeof t&&"split"===t.type&&(c=[t.index]),n||this.relayout([i],c),this.state=tK.Idle,n||"number"==typeof t||"distribute"!==t.type||this.distributeViewSizes()}relayout(e,t){const i=this.viewItems.reduce(((e,t)=>e+t.size),0);this.resize(this.viewItems.length-1,this.size-i,void 0,e,t),this.distributeEmptySpace(),this.layoutViews(),this.saveProportions()}resize(e,t,i=this.viewItems.map((e=>e.size)),n,o,s=Number.NEGATIVE_INFINITY,r=Number.POSITIVE_INFINITY,a,l){if(e<0||e>=this.viewItems.length)return 0;const d=Oa(e,-1),c=Oa(e+1,this.viewItems.length);if(o)for(const y of o)Va(d,y),Va(c,y);if(n)for(const y of n)Wa(d,y),Wa(c,y);const h=d.map((e=>this.viewItems[e])),u=d.map((e=>i[e])),g=c.map((e=>this.viewItems[e])),p=c.map((e=>i[e])),m=d.reduce(((e,t)=>e+(this.viewItems[t].minimumSize-i[t])),0),f=d.reduce(((e,t)=>e+(this.viewItems[t].maximumSize-i[t])),0),_=0===c.length?Number.POSITIVE_INFINITY:c.reduce(((e,t)=>e+(i[t]-this.viewItems[t].minimumSize)),0),v=0===c.length?Number.NEGATIVE_INFINITY:c.reduce(((e,t)=>e+(i[t]-this.viewItems[t].maximumSize)),0),b=Math.max(m,v,s),w=Math.min(_,f,r);let C=!1;if(a){const e=this.viewItems[a.index],i=t>=a.limitDelta;C=i!==e.visible,e.setVisible(i,a.size)}if(!C&&l){const e=this.viewItems[l.index],i=t<l.limitDelta;C=i!==e.visible,e.setVisible(i,l.size)}if(C)return this.resize(e,t,i,n,o,s,r);for(let y=0,x=t=JV(t,b,w);y<h.length;y++){const e=h[y],t=JV(u[y]+x,e.minimumSize,e.maximumSize);x-=t-u[y],e.size=t}for(let y=0,x=t;y<g.length;y++){const e=g[y],t=JV(p[y]-x,e.minimumSize,e.maximumSize);x+=t-p[y],e.size=t}return t}distributeEmptySpace(e){const t=this.viewItems.reduce(((e,t)=>e+t.size),0);let i=this.size-t;const n=Oa(this.viewItems.length-1,-1),o=n.filter((e=>1===this.viewItems[e].priority)),s=n.filter((e=>2===this.viewItems[e].priority));for(const r of s)Va(n,r);for(const r of o)Wa(n,r);"number"==typeof e&&Wa(n,e);for(let r=0;0!==i&&r<n.length;r++){const e=this.viewItems[n[r]],t=JV(e.size+i,e.minimumSize,e.maximumSize);i-=t-e.size,e.size=t}}layoutViews(){this.contentSize=this.viewItems.reduce(((e,t)=>e+t.size),0);let e=0;for(const t of this.viewItems)t.layout(e,this.layoutContext),e+=t.size;this.sashItems.forEach((e=>e.sash.layout())),this.updateSashEnablement(),this.updateScrollableElement()}updateScrollableElement(){0===this.orientation?this.scrollableElement.setScrollDimensions({height:this.size,scrollHeight:this.contentSize}):this.scrollableElement.setScrollDimensions({width:this.size,scrollWidth:this.contentSize})}updateSashEnablement(){let e=!1;const t=this.viewItems.map((t=>e=t.size-t.minimumSize>0||e));e=!1;const i=this.viewItems.map((t=>e=t.maximumSize-t.size>0||e)),n=[...this.viewItems].reverse();e=!1;const o=n.map((t=>e=t.size-t.minimumSize>0||e)).reverse();e=!1;const s=n.map((t=>e=t.maximumSize-t.size>0||e)).reverse();let r=0;for(let a=0;a<this.sashItems.length;a++){const{sash:e}=this.sashItems[a];r+=this.viewItems[a].size;const n=!(t[a]&&s[a+1]),l=!(i[a]&&o[a+1]);if(n&&l){const i=Oa(a,-1),n=Oa(a+1,this.viewItems.length),s=this.findFirstSnapIndex(i),l=this.findFirstSnapIndex(n),d="number"==typeof s&&!this.viewItems[s].visible,c="number"==typeof l&&!this.viewItems[l].visible;d&&o[a]&&(r>0||this.startSnappingEnabled)?e.state=1:c&&t[a]&&(r<this.contentSize||this.endSnappingEnabled)?e.state=2:e.state=0}else e.state=n&&!l?1:!n&&l?2:3}}getSashPosition(e){let t=0;for(let i=0;i<this.sashItems.length;i++)if(t+=this.viewItems[i].size,this.sashItems[i].sash===e)return t;return 0}findFirstSnapIndex(e){for(const t of e){const e=this.viewItems[t];if(e.visible&&e.snap)return t}for(const t of e){const e=this.viewItems[t];if(e.visible&&e.maximumSize-e.minimumSize>0)return;if(!e.visible&&e.snap)return t}}dispose(){super.dispose(),bs(this.viewItems),this.viewItems=[],this.sashItems.forEach((e=>e.disposable.dispose())),this.sashItems=[]}}var oK;class sK{constructor(e,t,i){this.columns=e,this.getColumnSize=i,this.templateId=sK.TemplateId,this.renderedTemplates=new Set;const n=new Map(t.map((e=>[e.templateId,e])));this.renderers=[];for(const o of e){const e=n.get(o.templateId);if(!e)throw new Error(`Table cell renderer for template id ${o.templateId} not found.`);this.renderers.push(e)}}renderTemplate(e){const t=$C(e,YC(".monaco-table-tr")),i=[],n=[];for(let s=0;s<this.columns.length;s++){const e=this.renderers[s],o=$C(t,YC(".monaco-table-td",{"data-col-index":s}));o.style.width=`${this.getColumnSize(s)}px`,i.push(o),n.push(e.renderTemplate(o))}const o={container:e,cellContainers:i,cellTemplateData:n};return this.renderedTemplates.add(o),o}renderElement(e,t,i,n){for(let o=0;o<this.columns.length;o++){const s=this.columns[o].project(e);this.renderers[o].renderElement(s,t,i.cellTemplateData[o],n)}}disposeElement(e,t,i,n){for(let o=0;o<this.columns.length;o++){const s=this.renderers[o];if(s.disposeElement){const r=this.columns[o].project(e);s.disposeElement(r,t,i.cellTemplateData[o],n)}}}disposeTemplate(e){for(let t=0;t<this.columns.length;t++){this.renderers[t].disposeTemplate(e.cellTemplateData[t])}eC(e.container),this.renderedTemplates.delete(e)}layoutColumn(e,t){for(const{cellContainers:i}of this.renderedTemplates)i[e].style.width=`${t}px`}}sK.TemplateId="row";class rK{constructor(e,t){this.column=e,this.index=t,this._onDidLayout=new $o,this.onDidLayout=this._onDidLayout.event,this.element=YC(".monaco-table-th",{"data-col-index":t,title:e.tooltip},e.label)}get minimumSize(){var e;return null!==(e=this.column.minimumWidth)&&void 0!==e?e:120}get maximumSize(){var e;return null!==(e=this.column.maximumWidth)&&void 0!==e?e:Number.POSITIVE_INFINITY}get onDidChange(){var e;return null!==(e=this.column.onDidChangeWidthConstraints)&&void 0!==e?e:ds.None}layout(e){this._onDidLayout.fire([this.index,e])}}class aK{constructor(e,t,i,n,o,s){this.virtualDelegate=i,this.domId="table_id_"+ ++aK.InstanceCount,this.disposables=new ws,this.cachedWidth=0,this.cachedHeight=0,this.domNode=$C(t,YC(`.monaco-table.${this.domId}`));const r=n.map(((e,t)=>new rK(e,t))),a={size:r.reduce(((e,t)=>e+t.column.weight),0),views:r.map((e=>({size:e.column.weight,view:e})))};this.splitview=this.disposables.add(new nK(this.domNode,{orientation:1,scrollbarVisibility:2,getSashOrthogonalSize:()=>this.cachedHeight,descriptor:a})),this.splitview.el.style.height=`${i.headerRowHeight}px`,this.splitview.el.style.lineHeight=`${i.headerRowHeight}px`;const l=new sK(n,o,(e=>this.splitview.getViewSize(e)));var d;this.list=this.disposables.add(new G$(e,this.domNode,(d=i,{getHeight:e=>d.getHeight(e),getTemplateId:()=>sK.TemplateId}),[l],s)),ds.any(...r.map((e=>e.onDidLayout)))((([e,t])=>l.layoutColumn(e,t)),null,this.disposables),this.splitview.onDidSashReset((e=>{const t=n.reduce(((e,t)=>e+t.weight),0),i=n[e].weight/t*this.cachedWidth;this.splitview.resizeView(e,i)}),null,this.disposables),this.styleElement=RC(this.domNode),this.style({})}get onDidChangeFocus(){return this.list.onDidChangeFocus}get onDidChangeSelection(){return this.list.onDidChangeSelection}get onMouseDblClick(){return this.list.onMouseDblClick}get onPointer(){return this.list.onPointer}get onDidFocus(){return this.list.onDidFocus}get onDidDispose(){return this.list.onDidDispose}updateOptions(e){this.list.updateOptions(e)}splice(e,t,i=[]){this.list.splice(e,t,i)}getHTMLElement(){return this.domNode}style(e){const t=[];t.push(`.monaco-table.${this.domId} > .monaco-split-view2 .monaco-sash.vertical::before {\n\t\t\ttop: ${this.virtualDelegate.headerRowHeight+1}px;\n\t\t\theight: calc(100% - ${this.virtualDelegate.headerRowHeight}px);\n\t\t}`),this.styleElement.textContent=t.join("\n"),this.list.style(e)}getSelectedElements(){return this.list.getSelectedElements()}getSelection(){return this.list.getSelection()}getFocus(){return this.list.getFocus()}dispose(){this.disposables.dispose()}}aK.InstanceCount=0,function(e){e[e.Unknown=0]="Unknown",e[e.Twistie=1]="Twistie",e[e.Element=2]="Element"}(oK||(oK={}));class lK extends Error{constructor(e,t){super(`TreeError [${e}] ${t}`)}}class dK{constructor(e){this.fn=e,this._map=new WeakMap}map(e){let t=this._map.get(e);return t||(t=this.fn(e),this._map.set(e,t)),t}}function cK(e){return"object"==typeof e&&"visibility"in e&&"data"in e}function hK(e){switch(e){case!0:return 1;case!1:return 0;default:return e}}function uK(e){return"boolean"==typeof e.collapsible}class gK{constructor(e,t,i,n={}){this.user=e,this.list=t,this.rootRef=[],this.eventBufferer=new Ba,this._onDidChangeCollapseState=new $o,this.onDidChangeCollapseState=this.eventBufferer.wrapEvent(this._onDidChangeCollapseState.event),this._onDidChangeRenderNodeCount=new $o,this.onDidChangeRenderNodeCount=this.eventBufferer.wrapEvent(this._onDidChangeRenderNodeCount.event),this._onDidSplice=new $o,this.onDidSplice=this._onDidSplice.event,this.refilterDelayer=new tb(eb),this.collapseByDefault=void 0!==n.collapseByDefault&&n.collapseByDefault,this.filter=n.filter,this.autoExpandSingleChildren=void 0!==n.autoExpandSingleChildren&&n.autoExpandSingleChildren,this.root={parent:void 0,element:i,children:[],depth:0,visibleChildrenCount:0,visibleChildIndex:-1,collapsible:!1,collapsed:!1,renderNodeCount:0,visibility:1,visible:!0,filterData:void 0}}splice(e,t,i=Hs.empty(),n={}){if(0===e.length)throw new lK(this.user,"Invalid tree location");n.diffIdentityProvider?this.spliceSmart(n.diffIdentityProvider,e,t,i,n):this.spliceSimple(e,t,i,n)}spliceSmart(e,t,i,n,o,s){var r;void 0===n&&(n=Hs.empty()),void 0===s&&(s=null!==(r=o.diffDepth)&&void 0!==r?r:0);const{parentNode:a}=this.getParentNodeWithListIndex(t);if(!a.lastDiffIds)return this.spliceSimple(t,i,n,o);const l=[...n],d=t[t.length-1],c=new za({getElements:()=>a.lastDiffIds},{getElements:()=>[...a.children.slice(0,d),...l,...a.children.slice(d+i)].map((t=>e.getId(t.element).toString()))}).ComputeDiff(!1);if(c.quitEarly)return a.lastDiffIds=void 0,this.spliceSimple(t,i,l,o);const h=t.slice(0,-1),u=(t,i,n)=>{if(s>0)for(let r=0;r<n;r++)t--,i--,this.spliceSmart(e,[...h,t,0],Number.MAX_SAFE_INTEGER,l[i].children,o,s-1)};let g=Math.min(a.children.length,d+i),p=l.length;for(const m of c.changes.sort(((e,t)=>t.originalStart-e.originalStart)))u(g,p,g-(m.originalStart+m.originalLength)),g=m.originalStart,p=m.modifiedStart-d,this.spliceSimple([...h,g],m.originalLength,Hs.slice(l,p,p+m.modifiedLength),o);u(g,p,g)}spliceSimple(e,t,i=Hs.empty(),{onDidCreateNode:n,onDidDeleteNode:o,diffIdentityProvider:s}){const{parentNode:r,listIndex:a,revealed:l,visible:d}=this.getParentNodeWithListIndex(e),c=[],h=Hs.map(i,(e=>this.createTreeNode(e,r,r.visible?1:0,l,c,n))),u=e[e.length-1],g=r.children.length>0;let p=0;for(let y=u;y>=0&&y<r.children.length;y--){const e=r.children[y];if(e.visible){p=e.visibleChildIndex;break}}const m=[];let f=0,_=0;for(const y of h)m.push(y),_+=y.renderNodeCount,y.visible&&(y.visibleChildIndex=p+f++);const v=Ha(r.children,u,t,m);s?r.lastDiffIds?Ha(r.lastDiffIds,u,t,m.map((e=>s.getId(e.element).toString()))):r.lastDiffIds=r.children.map((e=>s.getId(e.element).toString())):r.lastDiffIds=void 0;let b=0;for(const y of v)y.visible&&b++;if(0!==b)for(let y=u+m.length;y<r.children.length;y++){const e=r.children[y];e.visible&&(e.visibleChildIndex-=b)}if(r.visibleChildrenCount+=f-b,l&&d){const e=v.reduce(((e,t)=>e+(t.visible?t.renderNodeCount:0)),0);this._updateAncestorsRenderNodeCount(r,_-e),this.list.splice(a,e,c)}if(v.length>0&&o){const e=t=>{o(t),t.children.forEach(e)};v.forEach(e)}this._onDidSplice.fire({insertedNodes:m,deletedNodes:v});const w=r.children.length>0;g!==w&&this.setCollapsible(e.slice(0,-1),w);let C=r;for(;C;){if(2===C.visibility){this.refilterDelayer.trigger((()=>this.refilter()));break}C=C.parent}}rerender(e){if(0===e.length)throw new lK(this.user,"Invalid tree location");const{node:t,listIndex:i,revealed:n}=this.getTreeNodeWithListIndex(e);t.visible&&n&&this.list.splice(i,1,[t])}has(e){return this.hasTreeNode(e)}getListIndex(e){const{listIndex:t,visible:i,revealed:n}=this.getTreeNodeWithListIndex(e);return i&&n?t:-1}getListRenderCount(e){return this.getTreeNode(e).renderNodeCount}isCollapsible(e){return this.getTreeNode(e).collapsible}setCollapsible(e,t){const i=this.getTreeNode(e);void 0===t&&(t=!i.collapsible);const n={collapsible:t};return this.eventBufferer.bufferEvents((()=>this._setCollapseState(e,n)))}isCollapsed(e){return this.getTreeNode(e).collapsed}setCollapsed(e,t,i){const n=this.getTreeNode(e);void 0===t&&(t=!n.collapsed);const o={collapsed:t,recursive:i||!1};return this.eventBufferer.bufferEvents((()=>this._setCollapseState(e,o)))}_setCollapseState(e,t){const{node:i,listIndex:n,revealed:o}=this.getTreeNodeWithListIndex(e),s=this._setListNodeCollapseState(i,n,o,t);if(i!==this.root&&this.autoExpandSingleChildren&&s&&!uK(t)&&i.collapsible&&!i.collapsed&&!t.recursive){let n=-1;for(let e=0;e<i.children.length;e++){if(i.children[e].visible){if(n>-1){n=-1;break}n=e}}n>-1&&this._setCollapseState([...e,n],t)}return s}_setListNodeCollapseState(e,t,i,n){const o=this._setNodeCollapseState(e,n,!1);if(!i||!e.visible||!o)return o;const s=e.renderNodeCount,r=this.updateNodeAfterCollapseChange(e),a=s-(-1===t?0:1);return this.list.splice(t+1,a,r.slice(1)),o}_setNodeCollapseState(e,t,i){let n;if(e===this.root?n=!1:(uK(t)?(n=e.collapsible!==t.collapsible,e.collapsible=t.collapsible):e.collapsible?(n=e.collapsed!==t.collapsed,e.collapsed=t.collapsed):n=!1,n&&this._onDidChangeCollapseState.fire({node:e,deep:i})),!uK(t)&&t.recursive)for(const o of e.children)n=this._setNodeCollapseState(o,t,!0)||n;return n}expandTo(e){this.eventBufferer.bufferEvents((()=>{let t=this.getTreeNode(e);for(;t.parent;)t=t.parent,e=e.slice(0,e.length-1),t.collapsed&&this._setCollapseState(e,{collapsed:!1,recursive:!1})}))}refilter(){const e=this.root.renderNodeCount,t=this.updateNodeAfterFilterChange(this.root);this.list.splice(0,e,t),this.refilterDelayer.cancel()}createTreeNode(e,t,i,n,o,s){const r={parent:t,element:e.element,children:[],depth:t.depth+1,visibleChildrenCount:0,visibleChildIndex:-1,collapsible:"boolean"==typeof e.collapsible?e.collapsible:void 0!==e.collapsed,collapsed:void 0===e.collapsed?this.collapseByDefault:e.collapsed,renderNodeCount:1,visibility:1,visible:!0,filterData:void 0},a=this._filterNode(r,i);r.visibility=a,n&&o.push(r);const l=e.children||Hs.empty(),d=n&&0!==a&&!r.collapsed,c=Hs.map(l,(e=>this.createTreeNode(e,r,a,d,o,s)));let h=0,u=1;for(const g of c)r.children.push(g),u+=g.renderNodeCount,g.visible&&(g.visibleChildIndex=h++);return r.collapsible=r.collapsible||r.children.length>0,r.visibleChildrenCount=h,r.visible=2===a?h>0:1===a,r.visible?r.collapsed||(r.renderNodeCount=u):(r.renderNodeCount=0,n&&o.pop()),s&&s(r),r}updateNodeAfterCollapseChange(e){const t=e.renderNodeCount,i=[];return this._updateNodeAfterCollapseChange(e,i),this._updateAncestorsRenderNodeCount(e.parent,i.length-t),i}_updateNodeAfterCollapseChange(e,t){if(!1===e.visible)return 0;if(t.push(e),e.renderNodeCount=1,!e.collapsed)for(const i of e.children)e.renderNodeCount+=this._updateNodeAfterCollapseChange(i,t);return this._onDidChangeRenderNodeCount.fire(e),e.renderNodeCount}updateNodeAfterFilterChange(e){const t=e.renderNodeCount,i=[];return this._updateNodeAfterFilterChange(e,e.visible?1:0,i),this._updateAncestorsRenderNodeCount(e.parent,i.length-t),i}_updateNodeAfterFilterChange(e,t,i,n=!0){let o;if(e!==this.root){if(o=this._filterNode(e,t),0===o)return e.visible=!1,e.renderNodeCount=0,!1;n&&i.push(e)}const s=i.length;e.renderNodeCount=e===this.root?0:1;let r=!1;if(e.collapsed&&0===o)e.visibleChildrenCount=0;else{let t=0;for(const s of e.children)r=this._updateNodeAfterFilterChange(s,o,i,n&&!e.collapsed)||r,s.visible&&(s.visibleChildIndex=t++);e.visibleChildrenCount=t}return e!==this.root&&(e.visible=2===o?r:1===o,e.visibility=o),e.visible?e.collapsed||(e.renderNodeCount+=i.length-s):(e.renderNodeCount=0,n&&i.pop()),this._onDidChangeRenderNodeCount.fire(e),e.visible}_updateAncestorsRenderNodeCount(e,t){if(0!==t)for(;e;)e.renderNodeCount+=t,this._onDidChangeRenderNodeCount.fire(e),e=e.parent}_filterNode(e,t){const i=this.filter?this.filter.filter(e.element,t):1;return"boolean"==typeof i?(e.filterData=void 0,i?1:0):cK(i)?(e.filterData=i.data,hK(i.visibility)):(e.filterData=void 0,hK(i))}hasTreeNode(e,t=this.root){if(!e||0===e.length)return!0;const[i,...n]=e;return!(i<0||i>t.children.length)&&this.hasTreeNode(n,t.children[i])}getTreeNode(e,t=this.root){if(!e||0===e.length)return t;const[i,...n]=e;if(i<0||i>t.children.length)throw new lK(this.user,"Invalid tree location");return this.getTreeNode(n,t.children[i])}getTreeNodeWithListIndex(e){if(0===e.length)return{node:this.root,listIndex:-1,revealed:!0,visible:!1};const{parentNode:t,listIndex:i,revealed:n,visible:o}=this.getParentNodeWithListIndex(e),s=e[e.length-1];if(s<0||s>t.children.length)throw new lK(this.user,"Invalid tree location");const r=t.children[s];return{node:r,listIndex:i,revealed:n,visible:o&&r.visible}}getParentNodeWithListIndex(e,t=this.root,i=0,n=!0,o=!0){const[s,...r]=e;if(s<0||s>t.children.length)throw new lK(this.user,"Invalid tree location");for(let a=0;a<s;a++)i+=t.children[a].renderNodeCount;return n=n&&!t.collapsed,o=o&&t.visible,0===r.length?{parentNode:t,listIndex:i,revealed:n,visible:o}:this.getParentNodeWithListIndex(r,t.children[s],i+1,n,o)}getNode(e=[]){return this.getTreeNode(e)}getNodeLocation(e){const t=[];let i=e;for(;i.parent;)t.push(i.parent.children.indexOf(i)),i=i.parent;return t.reverse()}getParentNodeLocation(e){return 0===e.length?void 0:1===e.length?[]:ja(e)[0]}getFirstElementChild(e){const t=this.getTreeNode(e);if(0!==t.children.length)return t.children[0].element}}var pK;class mK extends v${constructor(e){super(e.elements.map((e=>e.element))),this.data=e}}function fK(e){return e instanceof v$?new mK(e):e}class _K{constructor(e,t){this.modelProvider=e,this.dnd=t,this.autoExpandDisposable=Uo.None}getDragURI(e){return this.dnd.getDragURI(e.element)}getDragLabel(e,t){if(this.dnd.getDragLabel)return this.dnd.getDragLabel(e.map((e=>e.element)),t)}onDragStart(e,t){this.dnd.onDragStart&&this.dnd.onDragStart(fK(e),t)}onDragOver(e,t,i,n,o=!0){const s=this.dnd.onDragOver(fK(e),t&&t.element,i,n),r=this.autoExpandNode!==t;if(r&&(this.autoExpandDisposable.dispose(),this.autoExpandNode=t),void 0===t)return s;if(r&&"boolean"!=typeof s&&s.autoExpand&&(this.autoExpandDisposable=ob((()=>{const e=this.modelProvider(),i=e.getNodeLocation(t);e.isCollapsed(i)&&e.setCollapsed(i,!1),this.autoExpandNode=void 0}),500)),"boolean"==typeof s||!s.accept||void 0===s.bubble||s.feedback){if(!o){return{accept:"boolean"==typeof s?s:s.accept,effect:"boolean"==typeof s?void 0:s.effect,feedback:[i]}}return s}if(1===s.bubble){const i=this.modelProvider(),o=i.getNodeLocation(t),s=i.getParentNodeLocation(o),r=i.getNode(s),a=s&&i.getListIndex(s);return this.onDragOver(e,r,a,n,!1)}const a=this.modelProvider(),l=a.getNodeLocation(t),d=a.getListIndex(l),c=a.getListRenderCount(l);return Object.assign(Object.assign({},s),{feedback:Oa(d,d+c)})}drop(e,t,i,n){this.autoExpandDisposable.dispose(),this.autoExpandNode=void 0,this.dnd.drop(fK(e),t&&t.element,i,n)}onDragEnd(e){this.dnd.onDragEnd&&this.dnd.onDragEnd(e)}}class vK{constructor(e){this.delegate=e}getHeight(e){return this.delegate.getHeight(e.element)}getTemplateId(e){return this.delegate.getTemplateId(e.element)}hasDynamicHeight(e){return!!this.delegate.hasDynamicHeight&&this.delegate.hasDynamicHeight(e.element)}setDynamicHeight(e,t){this.delegate.setDynamicHeight&&this.delegate.setDynamicHeight(e.element,t)}}!function(e){e.None="none",e.OnHover="onHover",e.Always="always"}(pK||(pK={}));class bK{constructor(e,t=[]){this._elements=t,this.onDidChange=ds.forEach(e,(e=>this._elements=e))}get elements(){return this._elements}}class wK{constructor(e,t,i,n,o={}){this.renderer=e,this.modelProvider=t,this.activeNodes=n,this.renderedElements=new Map,this.renderedNodes=new Map,this.indent=wK.DefaultIndent,this.hideTwistiesOfChildlessElements=!1,this.shouldRenderIndentGuides=!1,this.renderedIndentGuides=new Hx,this.activeIndentNodes=new Set,this.indentGuidesDisposable=Uo.None,this.disposables=new ws,this.templateId=e.templateId,this.updateOptions(o),ds.map(i,(e=>e.node))(this.onDidChangeNodeTwistieState,this,this.disposables),e.onDidChangeTwistieState&&e.onDidChangeTwistieState(this.onDidChangeTwistieState,this,this.disposables)}updateOptions(e={}){if(void 0!==e.indent&&(this.indent=JV(e.indent,0,40)),void 0!==e.renderIndentGuides){const t=e.renderIndentGuides!==pK.None;if(t!==this.shouldRenderIndentGuides&&(this.shouldRenderIndentGuides=t,this.indentGuidesDisposable.dispose(),t)){const e=new ws;this.activeNodes.onDidChange(this._onDidChangeActiveNodes,this,e),this.indentGuidesDisposable=e,this._onDidChangeActiveNodes(this.activeNodes.elements)}}void 0!==e.hideTwistiesOfChildlessElements&&(this.hideTwistiesOfChildlessElements=e.hideTwistiesOfChildlessElements)}renderTemplate(e){const t=$C(e,YC(".monaco-tl-row")),i=$C(t,YC(".monaco-tl-indent")),n=$C(t,YC(".monaco-tl-twistie")),o=$C(t,YC(".monaco-tl-contents")),s=this.renderer.renderTemplate(o);return{container:e,indent:i,twistie:n,indentGuidesDisposable:Uo.None,templateData:s}}renderElement(e,t,i,n){"number"==typeof n&&(this.renderedNodes.set(e,{templateData:i,height:n}),this.renderedElements.set(e.element,e));const o=wK.DefaultIndent+(e.depth-1)*this.indent;i.twistie.style.paddingLeft=`${o}px`,i.indent.style.width=o+this.indent-16+"px",this.renderTwistie(e,i),"number"==typeof n&&this.renderIndentGuides(e,i),this.renderer.renderElement(e,t,i.templateData,n)}disposeElement(e,t,i,n){i.indentGuidesDisposable.dispose(),this.renderer.disposeElement&&this.renderer.disposeElement(e,t,i.templateData,n),"number"==typeof n&&(this.renderedNodes.delete(e),this.renderedElements.delete(e.element))}disposeTemplate(e){this.renderer.disposeTemplate(e.templateData)}onDidChangeTwistieState(e){const t=this.renderedElements.get(e);t&&this.onDidChangeNodeTwistieState(t)}onDidChangeNodeTwistieState(e){const t=this.renderedNodes.get(e);t&&(this.renderTwistie(e,t.templateData),this._onDidChangeActiveNodes(this.activeNodes.elements),this.renderIndentGuides(e,t.templateData))}renderTwistie(e,t){t.twistie.classList.remove(...br.treeItemExpanded.classNamesArray);let i=!1;this.renderer.renderTwistie&&(i=this.renderer.renderTwistie(e.element,t.twistie)),e.collapsible&&(!this.hideTwistiesOfChildlessElements||e.visibleChildrenCount>0)?(i||t.twistie.classList.add(...br.treeItemExpanded.classNamesArray),t.twistie.classList.add("collapsible"),t.twistie.classList.toggle("collapsed",e.collapsed)):t.twistie.classList.remove("collapsible","collapsed"),e.collapsible?t.container.setAttribute("aria-expanded",String(!e.collapsed)):t.container.removeAttribute("aria-expanded")}renderIndentGuides(e,t){if(eC(t.indent),t.indentGuidesDisposable.dispose(),!this.shouldRenderIndentGuides)return;const i=new ws,n=this.modelProvider();let o=e;for(;;){const e=n.getNodeLocation(o),s=n.getParentNodeLocation(e);if(!s)break;const r=n.getNode(s),a=YC(".indent-guide",{style:`width: ${this.indent}px`});this.activeIndentNodes.has(r)&&a.classList.add("active"),0===t.indent.childElementCount?t.indent.appendChild(a):t.indent.insertBefore(a,t.indent.firstElementChild),this.renderedIndentGuides.add(r,a),i.add(es((()=>this.renderedIndentGuides.delete(r,a)))),o=r}t.indentGuidesDisposable=i}_onDidChangeActiveNodes(e){if(!this.shouldRenderIndentGuides)return;const t=new Set,i=this.modelProvider();e.forEach((e=>{const n=i.getNodeLocation(e);try{const o=i.getParentNodeLocation(n);e.collapsible&&e.children.length>0&&!e.collapsed?t.add(e):o&&t.add(i.getNode(o))}catch(Bte){}})),this.activeIndentNodes.forEach((e=>{t.has(e)||this.renderedIndentGuides.forEach(e,(e=>e.classList.remove("active")))})),t.forEach((e=>{this.activeIndentNodes.has(e)||this.renderedIndentGuides.forEach(e,(e=>e.classList.add("active")))})),this.activeIndentNodes=t}dispose(){this.renderedNodes.clear(),this.renderedElements.clear(),this.indentGuidesDisposable.dispose(),bs(this.disposables)}}wK.DefaultIndent=8;class CK{constructor(e,t,i){this.tree=e,this.keyboardNavigationLabelProvider=t,this._filter=i,this._totalCount=0,this._matchCount=0,this._pattern="",this._lowercasePattern="",this.disposables=new ws,e.onWillRefilter(this.reset,this,this.disposables)}get totalCount(){return this._totalCount}get matchCount(){return this._matchCount}set pattern(e){this._pattern=e,this._lowercasePattern=e.toLowerCase()}filter(e,t){if(this._filter){const i=this._filter.filter(e,t);if(this.tree.options.simpleKeyboardNavigation)return i;let n;if(n="boolean"==typeof i?i?1:0:cK(i)?hK(i.visibility):i,0===n)return!1}if(this._totalCount++,this.tree.options.simpleKeyboardNavigation||!this._pattern)return this._matchCount++,{data:yH.Default,visibility:!0};const i=this.keyboardNavigationLabelProvider.getKeyboardNavigationLabel(e),n=Array.isArray(i)?i:[i];for(const o of n){const e=o&&o.toString();if(void 0===e)return{data:yH.Default,visibility:!0};const t=xH(this._pattern,this._lowercasePattern,0,e,e.toLowerCase(),0,!0);if(t)return this._matchCount++,1===n.length?{data:t,visibility:!0}:{data:{label:e,score:t},visibility:!0}}return this.tree.options.filterOnType?2:{data:yH.Default,visibility:!0}}reset(){this._totalCount=0,this._matchCount=0}dispose(){bs(this.disposables)}}class yK{constructor(e,t,i,n,o){this.tree=e,this.view=i,this.filter=n,this.keyboardNavigationDelegate=o,this._enabled=!1,this._pattern="",this._empty=!1,this._onDidChangeEmptyState=new $o,this.positionClassName="ne",this.automaticKeyboardNavigation=!0,this.triggered=!1,this._onDidChangePattern=new $o,this.enabledDisposables=new ws,this.disposables=new ws,this.domNode=YC(`.monaco-list-type-filter.${this.positionClassName}`),this.domNode.draggable=!0,this.disposables.add(nC(this.domNode,"dragstart",(()=>this.onDragStart()))),this.messageDomNode=$C(i.getHTMLElement(),YC(".monaco-list-type-filter-message")),this.labelDomNode=$C(this.domNode,YC("span.label"));const s=$C(this.domNode,YC(".controls"));this._filterOnType=!!e.options.filterOnType,this.filterOnTypeDomNode=$C(s,YC("input.filter")),this.filterOnTypeDomNode.type="checkbox",this.filterOnTypeDomNode.checked=this._filterOnType,this.filterOnTypeDomNode.tabIndex=-1,this.updateFilterOnTypeTitleAndIcon(),this.disposables.add(nC(this.filterOnTypeDomNode,"input",(()=>this.onDidChangeFilterOnType()))),this.clearDomNode=$C(s,YC("button.clear"+br.treeFilterClear.cssSelector)),this.clearDomNode.tabIndex=-1,this.clearDomNode.title=mf(0,"Clear"),this.keyboardNavigationEventFilter=e.options.keyboardNavigationEventFilter,t.onDidSplice(this.onDidSpliceModel,this,this.disposables),this.updateOptions(e.options)}get enabled(){return this._enabled}get pattern(){return this._pattern}get filterOnType(){return this._filterOnType}updateOptions(e){e.simpleKeyboardNavigation?this.disable():this.enable(),void 0!==e.filterOnType&&(this._filterOnType=!!e.filterOnType,this.filterOnTypeDomNode.checked=this._filterOnType,this.updateFilterOnTypeTitleAndIcon()),void 0!==e.automaticKeyboardNavigation&&(this.automaticKeyboardNavigation=e.automaticKeyboardNavigation),this.tree.refilter(),this.render(),this.automaticKeyboardNavigation||this.onEventOrInput("")}enable(){if(this._enabled)return;const e=this.enabledDisposables.add(new eB(this.view.getHTMLElement(),"keydown")),t=ds.chain(e.event).filter((e=>!I$(e.target)||e.target===this.filterOnTypeDomNode)).filter((e=>"Dead"!==e.key&&!/^Media/.test(e.key))).map((e=>new jw(e))).filter(this.keyboardNavigationEventFilter||(()=>!0)).filter((()=>this.automaticKeyboardNavigation||this.triggered)).filter((e=>this.keyboardNavigationDelegate.mightProducePrintableCharacter(e)&&!(18===e.keyCode||16===e.keyCode||15===e.keyCode||17===e.keyCode)||(this.pattern.length>0||this.triggered)&&(9===e.keyCode||1===e.keyCode)&&!e.altKey&&!e.ctrlKey&&!e.metaKey||1===e.keyCode&&(zo?e.altKey&&!e.metaKey:e.ctrlKey)&&!e.shiftKey)).forEach((e=>{e.stopPropagation(),e.preventDefault()})).event,i=this.enabledDisposables.add(new eB(this.clearDomNode,"click"));ds.chain(ds.any(t,i.event)).event(this.onEventOrInput,this,this.enabledDisposables),this.filter.pattern="",this.tree.refilter(),this.render(),this._enabled=!0,this.triggered=!1}disable(){this._enabled&&(this.domNode.remove(),this.enabledDisposables.clear(),this.tree.refilter(),this.render(),this._enabled=!1,this.triggered=!1)}onEventOrInput(e){"string"==typeof e?this.onInput(e):e instanceof MouseEvent||9===e.keyCode||1===e.keyCode&&(zo?e.altKey:e.ctrlKey)?this.onInput(""):1===e.keyCode?this.onInput(0===this.pattern.length?"":this.pattern.substr(0,this.pattern.length-1)):this.onInput(this.pattern+e.browserEvent.key)}onInput(e){const t=this.view.getHTMLElement();e&&!this.domNode.parentElement?t.append(this.domNode):!e&&this.domNode.parentElement&&(this.domNode.remove(),this.tree.domFocus()),this._pattern=e,this._onDidChangePattern.fire(e),this.filter.pattern=e,this.tree.refilter(),e&&this.tree.focusNext(0,!0,void 0,(e=>!yH.isDefault(e.filterData)));const i=this.tree.getFocus();if(i.length>0){const e=i[0];null===this.tree.getRelativeTop(e)&&this.tree.reveal(e,.5)}this.render(),e||(this.triggered=!1)}onDragStart(){const e=this.view.getHTMLElement(),{left:t}=yC(e),i=e.clientWidth,n=i/2,o=this.domNode.clientWidth,s=new ws;let r=this.positionClassName;const a=()=>{switch(r){case"nw":this.domNode.style.top="4px",this.domNode.style.left="4px";break;case"ne":this.domNode.style.top="4px",this.domNode.style.left=i-o-6+"px"}},l=()=>{this.positionClassName=r,this.domNode.className=`monaco-list-type-filter ${this.positionClassName}`,this.domNode.style.top="",this.domNode.style.left="",bs(s)};a(),this.domNode.classList.remove(r),this.domNode.classList.add("dragging"),s.add(es((()=>this.domNode.classList.remove("dragging")))),s.add(nC(document,"dragover",(e=>(e=>{e.preventDefault();const i=e.clientX-t;e.dataTransfer&&(e.dataTransfer.dropEffect="none"),r=i<n?"nw":"ne",a()})(e)))),s.add(nC(this.domNode,"dragend",(()=>l()))),pB.CurrentDragAndDropData=new gB("vscode-ui"),s.add(es((()=>pB.CurrentDragAndDropData=void 0)))}onDidSpliceModel(){this._enabled&&0!==this.pattern.length&&(this.tree.refilter(),this.render())}onDidChangeFilterOnType(){this.tree.updateOptions({filterOnType:this.filterOnTypeDomNode.checked}),this.tree.refilter(),this.tree.domFocus(),this.render(),this.updateFilterOnTypeTitleAndIcon()}updateFilterOnTypeTitleAndIcon(){this.filterOnType?(this.filterOnTypeDomNode.classList.remove(...br.treeFilterOnTypeOff.classNamesArray),this.filterOnTypeDomNode.classList.add(...br.treeFilterOnTypeOn.classNamesArray),this.filterOnTypeDomNode.title=mf(0,"Disable Filter on Type")):(this.filterOnTypeDomNode.classList.remove(...br.treeFilterOnTypeOn.classNamesArray),this.filterOnTypeDomNode.classList.add(...br.treeFilterOnTypeOff.classNamesArray),this.filterOnTypeDomNode.title=mf(0,"Enable Filter on Type"))}render(){const e=this.filter.totalCount>0&&0===this.filter.matchCount;this.pattern&&this.tree.options.filterOnType&&e?(this.messageDomNode.textContent=mf(0,"No elements found"),this._empty=!0):(this.messageDomNode.innerText="",this._empty=!1),this.domNode.classList.toggle("no-matches",e),this.domNode.title=mf(0,"Matched {0} out of {1} elements",this.filter.matchCount,this.filter.totalCount),this.labelDomNode.textContent=this.pattern.length>16?"…"+this.pattern.substr(this.pattern.length-16):this.pattern,this._onDidChangeEmptyState.fire(this._empty)}shouldAllowFocus(e){return!(this.enabled&&this.pattern&&!this.filterOnType)||(this.filter.totalCount>0&&this.filter.matchCount<=1||!yH.isDefault(e.filterData))}dispose(){this._enabled&&(this.domNode.remove(),this.enabledDisposables.dispose(),this._enabled=!1,this.triggered=!1),this._onDidChangePattern.dispose(),bs(this.disposables)}}function xK(e){let t=oK.Unknown;return IC(e.browserEvent.target,"monaco-tl-twistie","monaco-tl-row")?t=oK.Twistie:IC(e.browserEvent.target,"monaco-tl-contents","monaco-tl-row")&&(t=oK.Element),{browserEvent:e.browserEvent,element:e.element?e.element.element:null,target:t}}function SK(e,t){t(e),e.children.forEach((e=>SK(e,t)))}class kK{constructor(e,t){this.getFirstViewElementWithTrait=e,this.identityProvider=t,this.nodes=[],this._onDidChange=new $o,this.onDidChange=this._onDidChange.event}get nodeSet(){return this._nodeSet||(this._nodeSet=this.createNodeSet()),this._nodeSet}set(e,t){!(null==t?void 0:t.__forceEvent)&&jo(this.nodes,e)||this._set(e,!1,t)}_set(e,t,i){if(this.nodes=[...e],this.elements=void 0,this._nodeSet=void 0,!t){const e=this;this._onDidChange.fire({get elements(){return e.get()},browserEvent:i})}}get(){return this.elements||(this.elements=this.nodes.map((e=>e.element))),[...this.elements]}getNodes(){return this.nodes}has(e){return this.nodeSet.has(e)}onDidModelSplice({insertedNodes:e,deletedNodes:t}){if(!this.identityProvider){const e=this.createNodeSet(),i=t=>e.delete(t);return t.forEach((e=>SK(e,i))),void this.set([...e.values()])}const i=new Set,n=e=>i.add(this.identityProvider.getId(e.element).toString());t.forEach((e=>SK(e,n)));const o=new Map,s=e=>o.set(this.identityProvider.getId(e.element).toString(),e);e.forEach((e=>SK(e,s)));const r=[];for(const a of this.nodes){const e=this.identityProvider.getId(a.element).toString();if(i.has(e)){const t=o.get(e);t&&r.push(t)}else r.push(a)}if(this.nodes.length>0&&0===r.length){const e=this.getFirstViewElementWithTrait();e&&r.push(e)}this._set(r,!0)}createNodeSet(){const e=new Set;for(const t of this.nodes)e.add(t);return e}}class DK extends V${constructor(e,t){super(e),this.tree=t}onViewPointer(e){if(I$(e.browserEvent.target)||T$(e.browserEvent.target))return;const t=e.element;if(!t)return super.onViewPointer(e);if(this.isSelectionRangeChangeEvent(e)||this.isSelectionSingleChangeEvent(e))return super.onViewPointer(e);const i=e.browserEvent.target,n=i.classList.contains("monaco-tl-twistie")||i.classList.contains("monaco-icon-label")&&i.classList.contains("folder-icon")&&e.browserEvent.offsetX<16;let o=!1;if(o="function"==typeof this.tree.expandOnlyOnTwistieClick?this.tree.expandOnlyOnTwistieClick(t.element):!!this.tree.expandOnlyOnTwistieClick,o&&!n&&2!==e.browserEvent.detail)return super.onViewPointer(e);if(!this.tree.expandOnDoubleClick&&2===e.browserEvent.detail)return super.onViewPointer(e);if(t.collapsible){const i=this.tree.model,s=i.getNodeLocation(t),r=e.browserEvent.altKey;if(this.tree.setFocus([s]),i.setCollapsed(s,void 0,r),o&&n)return}super.onViewPointer(e)}onDoubleClick(e){!e.browserEvent.target.classList.contains("monaco-tl-twistie")&&this.tree.expandOnDoubleClick&&super.onDoubleClick(e)}}class LK extends G${constructor(e,t,i,n,o,s,r,a){super(e,t,i,n,a),this.focusTrait=o,this.selectionTrait=s,this.anchorTrait=r}createMouseController(e){return new DK(this,e.tree)}splice(e,t,i=[]){if(super.splice(e,t,i),0===i.length)return;const n=[],o=[];let s;i.forEach(((t,i)=>{this.focusTrait.has(t)&&n.push(e+i),this.selectionTrait.has(t)&&o.push(e+i),this.anchorTrait.has(t)&&(s=e+i)})),n.length>0&&super.setFocus(Qo([...super.getFocus(),...n])),o.length>0&&super.setSelection(Qo([...super.getSelection(),...o])),"number"==typeof s&&super.setAnchor(s)}setFocus(e,t,i=!1){super.setFocus(e,t),i||this.focusTrait.set(e.map((e=>this.element(e))),t)}setSelection(e,t,i=!1){super.setSelection(e,t),i||this.selectionTrait.set(e.map((e=>this.element(e))),t)}setAnchor(e,t=!1){super.setAnchor(e),t||(void 0===e?this.anchorTrait.set([]):this.anchorTrait.set([this.element(e)]))}}class NK{constructor(e,t,i,n,o={}){this._user=e,this._options=o,this.eventBufferer=new Ba,this.disposables=new ws,this._onWillRefilter=new $o,this.onWillRefilter=this._onWillRefilter.event,this._onDidUpdateOptions=new $o;const s=new vK(i),r=new Ua,a=new Ua,l=new bK(a.event);this.renderers=n.map((e=>new wK(e,(()=>this.model),r.event,l,o)));for(let g of this.renderers)this.disposables.add(g);let d;var c,h;o.keyboardNavigationLabelProvider&&(d=new CK(this,o.keyboardNavigationLabelProvider,o.filter),o=Object.assign(Object.assign({},o),{filter:d}),this.disposables.add(d)),this.focus=new kK((()=>this.view.getFocusedElements()[0]),o.identityProvider),this.selection=new kK((()=>this.view.getSelectedElements()[0]),o.identityProvider),this.anchor=new kK((()=>this.view.getAnchorElement()),o.identityProvider),this.view=new LK(e,t,s,this.renderers,this.focus,this.selection,this.anchor,Object.assign(Object.assign({},(c=()=>this.model,(h=o)&&Object.assign(Object.assign({},h),{identityProvider:h.identityProvider&&{getId:e=>h.identityProvider.getId(e.element)},dnd:h.dnd&&new _K(c,h.dnd),multipleSelectionController:h.multipleSelectionController&&{isSelectionSingleChangeEvent:e=>h.multipleSelectionController.isSelectionSingleChangeEvent(Object.assign(Object.assign({},e),{element:e.element})),isSelectionRangeChangeEvent:e=>h.multipleSelectionController.isSelectionRangeChangeEvent(Object.assign(Object.assign({},e),{element:e.element}))},accessibilityProvider:h.accessibilityProvider&&Object.assign(Object.assign({},h.accessibilityProvider),{getSetSize(e){const t=c(),i=t.getNodeLocation(e),n=t.getParentNodeLocation(i);return t.getNode(n).visibleChildrenCount},getPosInSet:e=>e.visibleChildIndex+1,isChecked:h.accessibilityProvider&&h.accessibilityProvider.isChecked?e=>h.accessibilityProvider.isChecked(e.element):void 0,getRole:h.accessibilityProvider&&h.accessibilityProvider.getRole?e=>h.accessibilityProvider.getRole(e.element):()=>"treeitem",getAriaLabel:e=>h.accessibilityProvider.getAriaLabel(e.element),getWidgetAriaLabel:()=>h.accessibilityProvider.getWidgetAriaLabel(),getWidgetRole:h.accessibilityProvider&&h.accessibilityProvider.getWidgetRole?()=>h.accessibilityProvider.getWidgetRole():()=>"tree",getAriaLevel:h.accessibilityProvider&&h.accessibilityProvider.getAriaLevel?e=>h.accessibilityProvider.getAriaLevel(e.element):e=>e.depth,getActiveDescendantId:h.accessibilityProvider.getActiveDescendantId&&(e=>h.accessibilityProvider.getActiveDescendantId(e.element))}),keyboardNavigationLabelProvider:h.keyboardNavigationLabelProvider&&Object.assign(Object.assign({},h.keyboardNavigationLabelProvider),{getKeyboardNavigationLabel:e=>h.keyboardNavigationLabelProvider.getKeyboardNavigationLabel(e.element)}),enableKeyboardNavigation:h.simpleKeyboardNavigation}))),{tree:this})),this.model=this.createModel(e,this.view,o),r.input=this.model.onDidChangeCollapseState;const u=ds.forEach(this.model.onDidSplice,(e=>{this.eventBufferer.bufferEvents((()=>{this.focus.onDidModelSplice(e),this.selection.onDidModelSplice(e)}))}));if(u((()=>null),null,this.disposables),a.input=ds.chain(ds.any(u,this.focus.onDidChange,this.selection.onDidChange)).debounce((()=>null),0).map((()=>{const e=new Set;for(const t of this.focus.getNodes())e.add(t);for(const t of this.selection.getNodes())e.add(t);return[...e.values()]})).event,!1!==o.keyboardSupport){const e=ds.chain(this.view.onKeyDown).filter((e=>!I$(e.target))).map((e=>new jw(e)));e.filter((e=>15===e.keyCode)).on(this.onLeftArrow,this,this.disposables),e.filter((e=>17===e.keyCode)).on(this.onRightArrow,this,this.disposables),e.filter((e=>10===e.keyCode)).on(this.onSpace,this,this.disposables)}if(o.keyboardNavigationLabelProvider){const e=o.keyboardNavigationDelegate||A$;this.typeFilterController=new yK(this,this.model,this.view,d,e),this.focusNavigationFilter=e=>this.typeFilterController.shouldAllowFocus(e),this.disposables.add(this.typeFilterController)}this.styleElement=RC(this.view.getHTMLElement()),this.getHTMLElement().classList.toggle("always",this._options.renderIndentGuides===pK.Always)}get onDidChangeFocus(){return this.eventBufferer.wrapEvent(this.focus.onDidChange)}get onDidChangeSelection(){return this.eventBufferer.wrapEvent(this.selection.onDidChange)}get onMouseDblClick(){return ds.map(this.view.onMouseDblClick,xK)}get onPointer(){return ds.map(this.view.onPointer,xK)}get onDidFocus(){return this.view.onDidFocus}get onDidChangeModel(){return ds.signal(this.model.onDidSplice)}get onDidChangeCollapseState(){return this.model.onDidChangeCollapseState}get expandOnDoubleClick(){return void 0===this._options.expandOnDoubleClick||this._options.expandOnDoubleClick}get expandOnlyOnTwistieClick(){return void 0===this._options.expandOnlyOnTwistieClick||this._options.expandOnlyOnTwistieClick}get onDidDispose(){return this.view.onDidDispose}updateOptions(e={}){this._options=Object.assign(Object.assign({},this._options),e);for(const t of this.renderers)t.updateOptions(e);this.view.updateOptions(Object.assign(Object.assign({},this._options),{enableKeyboardNavigation:this._options.simpleKeyboardNavigation})),this.typeFilterController&&this.typeFilterController.updateOptions(this._options),this._onDidUpdateOptions.fire(this._options),this.getHTMLElement().classList.toggle("always",this._options.renderIndentGuides===pK.Always)}get options(){return this._options}getHTMLElement(){return this.view.getHTMLElement()}get scrollTop(){return this.view.scrollTop}set scrollTop(e){this.view.scrollTop=e}domFocus(){this.view.domFocus()}layout(e,t){this.view.layout(e,t)}style(e){const t=`.${this.view.domId}`,i=[];e.treeIndentGuidesStroke&&(i.push(`.monaco-list${t}:hover .monaco-tl-indent > .indent-guide, .monaco-list${t}.always .monaco-tl-indent > .indent-guide { border-color: ${e.treeIndentGuidesStroke.transparent(.4)}; }`),i.push(`.monaco-list${t} .monaco-tl-indent > .indent-guide.active { border-color: ${e.treeIndentGuidesStroke}; }`)),this.styleElement.textContent=i.join("\n"),this.view.style(e)}getParentElement(e){const t=this.model.getParentNodeLocation(e);return this.model.getNode(t).element}getFirstElementChild(e){return this.model.getFirstElementChild(e)}getNode(e){return this.model.getNode(e)}collapse(e,t=!1){return this.model.setCollapsed(e,!0,t)}expand(e,t=!1){return this.model.setCollapsed(e,!1,t)}isCollapsible(e){return this.model.isCollapsible(e)}setCollapsible(e,t){return this.model.setCollapsible(e,t)}isCollapsed(e){return this.model.isCollapsed(e)}refilter(){this._onWillRefilter.fire(void 0),this.model.refilter()}setSelection(e,t){const i=e.map((e=>this.model.getNode(e)));this.selection.set(i,t);const n=e.map((e=>this.model.getListIndex(e))).filter((e=>e>-1));this.view.setSelection(n,t,!0)}getSelection(){return this.selection.get()}setFocus(e,t){const i=e.map((e=>this.model.getNode(e)));this.focus.set(i,t);const n=e.map((e=>this.model.getListIndex(e))).filter((e=>e>-1));this.view.setFocus(n,t,!0)}focusNext(e=1,t=!1,i,n=this.focusNavigationFilter){this.view.focusNext(e,t,i,n)}getFocus(){return this.focus.get()}reveal(e,t){this.model.expandTo(e);const i=this.model.getListIndex(e);-1!==i&&this.view.reveal(i,t)}getRelativeTop(e){const t=this.model.getListIndex(e);return-1===t?null:this.view.getRelativeTop(t)}onLeftArrow(e){e.preventDefault(),e.stopPropagation();const t=this.view.getFocusedElements();if(0===t.length)return;const i=t[0],n=this.model.getNodeLocation(i);if(!this.model.setCollapsed(n,!0)){const e=this.model.getParentNodeLocation(n);if(!e)return;const t=this.model.getListIndex(e);this.view.reveal(t),this.view.setFocus([t])}}onRightArrow(e){e.preventDefault(),e.stopPropagation();const t=this.view.getFocusedElements();if(0===t.length)return;const i=t[0],n=this.model.getNodeLocation(i);if(!this.model.setCollapsed(n,!1)){if(!i.children.some((e=>e.visible)))return;const[e]=this.view.getFocus(),t=e+1;this.view.reveal(t),this.view.setFocus([t])}}onSpace(e){e.preventDefault(),e.stopPropagation();const t=this.view.getFocusedElements();if(0===t.length)return;const i=t[0],n=this.model.getNodeLocation(i),o=e.browserEvent.altKey;this.model.setCollapsed(n,void 0,o)}dispose(){bs(this.disposables),this.view.dispose()}}class EK{constructor(e,t,i={}){this.user=e,this.rootRef=null,this.nodes=new Map,this.nodesByIdentity=new Map,this.model=new gK(e,t,null,i),this.onDidSplice=this.model.onDidSplice,this.onDidChangeCollapseState=this.model.onDidChangeCollapseState,this.onDidChangeRenderNodeCount=this.model.onDidChangeRenderNodeCount,i.sorter&&(this.sorter={compare:(e,t)=>i.sorter.compare(e.element,t.element)}),this.identityProvider=i.identityProvider}setChildren(e,t=Hs.empty(),i={}){const n=this.getElementLocation(e);this._setChildren(n,this.preserveCollapseState(t),i)}_setChildren(e,t=Hs.empty(),i){const n=new Set,o=new Set;this.model.splice([...e,0],Number.MAX_VALUE,t,Object.assign(Object.assign({},i),{onDidCreateNode:e=>{var t;if(null===e.element)return;const s=e;if(n.add(s.element),this.nodes.set(s.element,s),this.identityProvider){const e=this.identityProvider.getId(s.element).toString();o.add(e),this.nodesByIdentity.set(e,s)}null===(t=i.onDidCreateNode)||void 0===t||t.call(i,s)},onDidDeleteNode:e=>{var t;if(null===e.element)return;const s=e;if(n.has(s.element)||this.nodes.delete(s.element),this.identityProvider){const e=this.identityProvider.getId(s.element).toString();o.has(e)||this.nodesByIdentity.delete(e)}null===(t=i.onDidDeleteNode)||void 0===t||t.call(i,s)}}))}preserveCollapseState(e=Hs.empty()){return this.sorter&&(e=[...e].sort(this.sorter.compare.bind(this.sorter))),Hs.map(e,(e=>{let t=this.nodes.get(e.element);if(!t&&this.identityProvider){const i=this.identityProvider.getId(e.element).toString();t=this.nodesByIdentity.get(i)}if(!t)return Object.assign(Object.assign({},e),{children:this.preserveCollapseState(e.children)});const i="boolean"==typeof e.collapsible?e.collapsible:t.collapsible,n=void 0!==e.collapsed?e.collapsed:t.collapsed;return Object.assign(Object.assign({},e),{collapsible:i,collapsed:n,children:this.preserveCollapseState(e.children)})}))}rerender(e){const t=this.getElementLocation(e);this.model.rerender(t)}getFirstElementChild(e=null){const t=this.getElementLocation(e);return this.model.getFirstElementChild(t)}has(e){return this.nodes.has(e)}getListIndex(e){const t=this.getElementLocation(e);return this.model.getListIndex(t)}getListRenderCount(e){const t=this.getElementLocation(e);return this.model.getListRenderCount(t)}isCollapsible(e){const t=this.getElementLocation(e);return this.model.isCollapsible(t)}setCollapsible(e,t){const i=this.getElementLocation(e);return this.model.setCollapsible(i,t)}isCollapsed(e){const t=this.getElementLocation(e);return this.model.isCollapsed(t)}setCollapsed(e,t,i){const n=this.getElementLocation(e);return this.model.setCollapsed(n,t,i)}expandTo(e){const t=this.getElementLocation(e);this.model.expandTo(t)}refilter(){this.model.refilter()}getNode(e=null){if(null===e)return this.model.getNode(this.model.rootRef);const t=this.nodes.get(e);if(!t)throw new lK(this.user,`Tree element not found: ${e}`);return t}getNodeLocation(e){return e.element}getParentNodeLocation(e){if(null===e)throw new lK(this.user,"Invalid getParentNodeLocation call");const t=this.nodes.get(e);if(!t)throw new lK(this.user,`Tree element not found: ${e}`);const i=this.model.getNodeLocation(t),n=this.model.getParentNodeLocation(i);return this.model.getNode(n).element}getElementLocation(e){if(null===e)return[];const t=this.nodes.get(e);if(!t)throw new lK(this.user,`Tree element not found: ${e}`);return this.model.getNodeLocation(t)}}function IK(e){return{element:{elements:[e.element],incompressible:e.incompressible||!1},children:Hs.map(Hs.from(e.children),IK),collapsible:e.collapsible,collapsed:e.collapsed}}function TK(e){const t=[e.element],i=e.incompressible||!1;let n,o;for(;[o,n]=Hs.consume(Hs.from(e.children),2),1===o.length&&!o[0].incompressible;)e=o[0],t.push(e.element);return{element:{elements:t,incompressible:i},children:Hs.map(Hs.concat(o,n),TK),collapsible:e.collapsible,collapsed:e.collapsed}}function MK(e,t=0){let i;return i=t<e.element.elements.length-1?[MK(e,t+1)]:Hs.map(Hs.from(e.children),(e=>MK(e,0))),0===t&&e.element.incompressible?{element:e.element.elements[t],children:i,incompressible:!0,collapsible:e.collapsible,collapsed:e.collapsed}:{element:e.element.elements[t],children:i,collapsible:e.collapsible,collapsed:e.collapsed}}function AK(e){return MK(e,0)}function OK(e,t,i){return e.element===t?Object.assign(Object.assign({},e),{children:i}):Object.assign(Object.assign({},e),{children:Hs.map(Hs.from(e.children),(e=>OK(e,t,i)))})}class RK{constructor(e,t,i={}){this.user=e,this.rootRef=null,this.nodes=new Map,this.model=new EK(e,t,i),this.enabled=void 0===i.compressionEnabled||i.compressionEnabled,this.identityProvider=i.identityProvider}get onDidSplice(){return this.model.onDidSplice}get onDidChangeCollapseState(){return this.model.onDidChangeCollapseState}get onDidChangeRenderNodeCount(){return this.model.onDidChangeRenderNodeCount}setChildren(e,t=Hs.empty(),i){const n=i.diffIdentityProvider&&(o=i.diffIdentityProvider,{getId:e=>e.elements.map((e=>o.getId(e).toString())).join("\0")});var o;if(null===e){const e=Hs.map(t,this.enabled?TK:IK);return void this._setChildren(null,e,{diffIdentityProvider:n,diffDepth:1/0})}const s=this.nodes.get(e);if(!s)throw new Error("Unknown compressed tree node");const r=this.model.getNode(s),a=this.model.getParentNodeLocation(s),l=this.model.getNode(a),d=OK(AK(r),e,t),c=(this.enabled?TK:IK)(d),h=l.children.map((e=>e===r?c:e));this._setChildren(l.element,h,{diffIdentityProvider:n,diffDepth:r.depth-l.depth})}setCompressionEnabled(e){if(e===this.enabled)return;this.enabled=e;const t=this.model.getNode().children,i=Hs.map(t,AK),n=Hs.map(i,e?TK:IK);this._setChildren(null,n,{diffIdentityProvider:this.identityProvider,diffDepth:1/0})}_setChildren(e,t,i){const n=new Set;this.model.setChildren(e,t,Object.assign(Object.assign({},i),{onDidCreateNode:e=>{for(const t of e.element.elements)n.add(t),this.nodes.set(t,e.element)},onDidDeleteNode:e=>{for(const t of e.element.elements)n.has(t)||this.nodes.delete(t)}}))}has(e){return this.nodes.has(e)}getListIndex(e){const t=this.getCompressedNode(e);return this.model.getListIndex(t)}getListRenderCount(e){const t=this.getCompressedNode(e);return this.model.getListRenderCount(t)}getNode(e){if(void 0===e)return this.model.getNode();const t=this.getCompressedNode(e);return this.model.getNode(t)}getNodeLocation(e){const t=this.model.getNodeLocation(e);return null===t?null:t.elements[t.elements.length-1]}getParentNodeLocation(e){const t=this.getCompressedNode(e),i=this.model.getParentNodeLocation(t);return null===i?null:i.elements[i.elements.length-1]}getFirstElementChild(e){const t=this.getCompressedNode(e);return this.model.getFirstElementChild(t)}isCollapsible(e){const t=this.getCompressedNode(e);return this.model.isCollapsible(t)}setCollapsible(e,t){const i=this.getCompressedNode(e);return this.model.setCollapsible(i,t)}isCollapsed(e){const t=this.getCompressedNode(e);return this.model.isCollapsed(t)}setCollapsed(e,t,i){const n=this.getCompressedNode(e);return this.model.setCollapsed(n,t,i)}expandTo(e){const t=this.getCompressedNode(e);this.model.expandTo(t)}rerender(e){const t=this.getCompressedNode(e);this.model.rerender(t)}refilter(){this.model.refilter()}getCompressedNode(e){if(null===e)return null;const t=this.nodes.get(e);if(!t)throw new lK(this.user,`Tree element not found: ${e}`);return t}}const PK=e=>e[e.length-1];class FK{constructor(e,t){this.unwrapper=e,this.node=t}get element(){return null===this.node.element?null:this.unwrapper(this.node.element)}get children(){return this.node.children.map((e=>new FK(this.unwrapper,e)))}get depth(){return this.node.depth}get visibleChildrenCount(){return this.node.visibleChildrenCount}get visibleChildIndex(){return this.node.visibleChildIndex}get collapsible(){return this.node.collapsible}get collapsed(){return this.node.collapsed}get visible(){return this.node.visible}get filterData(){return this.node.filterData}}class BK{constructor(e,t,i={}){this.rootRef=null,this.elementMapper=i.elementMapper||PK;const n=e=>this.elementMapper(e.elements);this.nodeMapper=new dK((e=>new FK(n,e))),this.model=new RK(e,function(e,t){return{splice(i,n,o){t.splice(i,n,o.map((t=>e.map(t))))},updateElementHeight(e,i){t.updateElementHeight(e,i)}}}(this.nodeMapper,t),function(e,t){return Object.assign(Object.assign({},t),{identityProvider:t.identityProvider&&{getId:i=>t.identityProvider.getId(e(i))},sorter:t.sorter&&{compare:(e,i)=>t.sorter.compare(e.elements[0],i.elements[0])},filter:t.filter&&{filter:(i,n)=>t.filter.filter(e(i),n)}})}(n,i))}get onDidSplice(){return ds.map(this.model.onDidSplice,(({insertedNodes:e,deletedNodes:t})=>({insertedNodes:e.map((e=>this.nodeMapper.map(e))),deletedNodes:t.map((e=>this.nodeMapper.map(e)))})))}get onDidChangeCollapseState(){return ds.map(this.model.onDidChangeCollapseState,(({node:e,deep:t})=>({node:this.nodeMapper.map(e),deep:t})))}get onDidChangeRenderNodeCount(){return ds.map(this.model.onDidChangeRenderNodeCount,(e=>this.nodeMapper.map(e)))}setChildren(e,t=Hs.empty(),i={}){this.model.setChildren(e,t,i)}setCompressionEnabled(e){this.model.setCompressionEnabled(e)}has(e){return this.model.has(e)}getListIndex(e){return this.model.getListIndex(e)}getListRenderCount(e){return this.model.getListRenderCount(e)}getNode(e){return this.nodeMapper.map(this.model.getNode(e))}getNodeLocation(e){return e.element}getParentNodeLocation(e){return this.model.getParentNodeLocation(e)}getFirstElementChild(e){const t=this.model.getFirstElementChild(e);return null==t?t:this.elementMapper(t.elements)}isCollapsible(e){return this.model.isCollapsible(e)}setCollapsible(e,t){return this.model.setCollapsible(e,t)}isCollapsed(e){return this.model.isCollapsed(e)}setCollapsed(e,t,i){return this.model.setCollapsed(e,t,i)}expandTo(e){return this.model.expandTo(e)}rerender(e){return this.model.rerender(e)}refilter(){return this.model.refilter()}getCompressedTreeNode(e=null){return this.model.getNode(e)}}var VK=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r};class WK extends NK{constructor(e,t,i,n,o={}){super(e,t,i,n,o),this.user=e}get onDidChangeCollapseState(){return this.model.onDidChangeCollapseState}setChildren(e,t=Hs.empty(),i){this.model.setChildren(e,t,i)}rerender(e){void 0!==e?this.model.rerender(e):this.view.rerender()}hasElement(e){return this.model.has(e)}createModel(e,t,i){return new EK(e,t,i)}}class zK{constructor(e,t){this._compressedTreeNodeProvider=e,this.renderer=t,this.templateId=t.templateId,t.onDidChangeTwistieState&&(this.onDidChangeTwistieState=t.onDidChangeTwistieState)}get compressedTreeNodeProvider(){return this._compressedTreeNodeProvider()}renderTemplate(e){return{compressedTreeNode:void 0,data:this.renderer.renderTemplate(e)}}renderElement(e,t,i,n){const o=this.compressedTreeNodeProvider.getCompressedTreeNode(e.element);1===o.element.elements.length?(i.compressedTreeNode=void 0,this.renderer.renderElement(e,t,i.data,n)):(i.compressedTreeNode=o,this.renderer.renderCompressedElements(o,t,i.data,n))}disposeElement(e,t,i,n){i.compressedTreeNode?this.renderer.disposeCompressedElements&&this.renderer.disposeCompressedElements(i.compressedTreeNode,t,i.data,n):this.renderer.disposeElement&&this.renderer.disposeElement(e,t,i.data,n)}disposeTemplate(e){this.renderer.disposeTemplate(e.data)}renderTwistie(e,t){return!!this.renderer.renderTwistie&&this.renderer.renderTwistie(e,t)}}VK([tS],zK.prototype,"compressedTreeNodeProvider",null);class HK extends WK{constructor(e,t,i,n,o={}){const s=()=>this;super(e,t,i,n.map((e=>new zK(s,e))),function(e,t){return t&&Object.assign(Object.assign({},t),{keyboardNavigationLabelProvider:t.keyboardNavigationLabelProvider&&{getKeyboardNavigationLabel(i){let n;try{n=e().getCompressedTreeNode(i)}catch(Bte){return t.keyboardNavigationLabelProvider.getKeyboardNavigationLabel(i)}return 1===n.element.elements.length?t.keyboardNavigationLabelProvider.getKeyboardNavigationLabel(i):t.keyboardNavigationLabelProvider.getCompressedNodeKeyboardNavigationLabel(n.element.elements)}}})}(s,o))}setChildren(e,t=Hs.empty(),i){this.model.setChildren(e,t,i)}createModel(e,t,i){return new BK(e,t,i)}updateOptions(e={}){super.updateOptions(e),void 0!==e.compressionEnabled&&this.model.setCompressionEnabled(e.compressionEnabled)}getCompressedTreeNode(e=null){return this.model.getCompressedTreeNode(e)}}var jK=globalThis&&globalThis.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{l(n.next(e))}catch(t){s(t)}}function a(e){try{l(n.throw(e))}catch(t){s(t)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}l((n=n.apply(e,t||[])).next())}))};function UK(e){return Object.assign(Object.assign({},e),{children:[],refreshPromise:void 0,stale:!0,slow:!1,collapsedByDefault:void 0})}function $K(e,t){return!!t.parent&&(t.parent===e||$K(e,t.parent))}class KK{constructor(e){this.node=e}get element(){return this.node.element.element}get children(){return this.node.children.map((e=>new KK(e)))}get depth(){return this.node.depth}get visibleChildrenCount(){return this.node.visibleChildrenCount}get visibleChildIndex(){return this.node.visibleChildIndex}get collapsible(){return this.node.collapsible}get collapsed(){return this.node.collapsed}get visible(){return this.node.visible}get filterData(){return this.node.filterData}}class qK{constructor(e,t,i){this.renderer=e,this.nodeMapper=t,this.onDidChangeTwistieState=i,this.renderedNodes=new Map,this.templateId=e.templateId}renderTemplate(e){return{templateData:this.renderer.renderTemplate(e)}}renderElement(e,t,i,n){this.renderer.renderElement(this.nodeMapper.map(e),t,i.templateData,n)}renderTwistie(e,t){return e.slow?(t.classList.add(...br.treeItemLoading.classNamesArray),!0):(t.classList.remove(...br.treeItemLoading.classNamesArray),!1)}disposeElement(e,t,i,n){this.renderer.disposeElement&&this.renderer.disposeElement(this.nodeMapper.map(e),t,i.templateData,n)}disposeTemplate(e){this.renderer.disposeTemplate(e.templateData)}dispose(){this.renderedNodes.clear()}}function GK(e){return{browserEvent:e.browserEvent,elements:e.elements.map((e=>e.element))}}function ZK(e){return{browserEvent:e.browserEvent,element:e.element&&e.element.element,target:e.target}}class YK extends v${constructor(e){super(e.elements.map((e=>e.element))),this.data=e}}function XK(e){return e instanceof v$?new YK(e):e}class QK{constructor(e){this.dnd=e}getDragURI(e){return this.dnd.getDragURI(e.element)}getDragLabel(e,t){if(this.dnd.getDragLabel)return this.dnd.getDragLabel(e.map((e=>e.element)),t)}onDragStart(e,t){this.dnd.onDragStart&&this.dnd.onDragStart(XK(e),t)}onDragOver(e,t,i,n,o=!0){return this.dnd.onDragOver(XK(e),t&&t.element,i,n)}drop(e,t,i,n){this.dnd.drop(XK(e),t&&t.element,i,n)}onDragEnd(e){this.dnd.onDragEnd&&this.dnd.onDragEnd(e)}}function JK(e){return e&&Object.assign(Object.assign({},e),{collapseByDefault:!0,identityProvider:e.identityProvider&&{getId:t=>e.identityProvider.getId(t.element)},dnd:e.dnd&&new QK(e.dnd),multipleSelectionController:e.multipleSelectionController&&{isSelectionSingleChangeEvent:t=>e.multipleSelectionController.isSelectionSingleChangeEvent(Object.assign(Object.assign({},t),{element:t.element})),isSelectionRangeChangeEvent:t=>e.multipleSelectionController.isSelectionRangeChangeEvent(Object.assign(Object.assign({},t),{element:t.element}))},accessibilityProvider:e.accessibilityProvider&&Object.assign(Object.assign({},e.accessibilityProvider),{getPosInSet:void 0,getSetSize:void 0,getRole:e.accessibilityProvider.getRole?t=>e.accessibilityProvider.getRole(t.element):()=>"treeitem",isChecked:e.accessibilityProvider.isChecked?t=>{var i;return!!(null===(i=e.accessibilityProvider)||void 0===i?void 0:i.isChecked(t.element))}:void 0,getAriaLabel:t=>e.accessibilityProvider.getAriaLabel(t.element),getWidgetAriaLabel:()=>e.accessibilityProvider.getWidgetAriaLabel(),getWidgetRole:e.accessibilityProvider.getWidgetRole?()=>e.accessibilityProvider.getWidgetRole():()=>"tree",getAriaLevel:e.accessibilityProvider.getAriaLevel&&(t=>e.accessibilityProvider.getAriaLevel(t.element)),getActiveDescendantId:e.accessibilityProvider.getActiveDescendantId&&(t=>e.accessibilityProvider.getActiveDescendantId(t.element))}),filter:e.filter&&{filter:(t,i)=>e.filter.filter(t.element,i)},keyboardNavigationLabelProvider:e.keyboardNavigationLabelProvider&&Object.assign(Object.assign({},e.keyboardNavigationLabelProvider),{getKeyboardNavigationLabel:t=>e.keyboardNavigationLabelProvider.getKeyboardNavigationLabel(t.element)}),sorter:void 0,expandOnlyOnTwistieClick:void 0===e.expandOnlyOnTwistieClick?void 0:"function"!=typeof e.expandOnlyOnTwistieClick?e.expandOnlyOnTwistieClick:t=>e.expandOnlyOnTwistieClick(t.element),additionalScrollHeight:e.additionalScrollHeight})}function eq(e,t){t(e),e.children.forEach((e=>eq(e,t)))}class tq{constructor(e,t,i,n,o,s={}){this.user=e,this.dataSource=o,this.nodes=new Map,this.subTreeRefreshPromises=new Map,this.refreshPromises=new Map,this._onDidRender=new $o,this._onDidChangeNodeSlowState=new $o,this.nodeMapper=new dK((e=>new KK(e))),this.disposables=new ws,this.identityProvider=s.identityProvider,this.autoExpandSingleChildren=void 0!==s.autoExpandSingleChildren&&s.autoExpandSingleChildren,this.sorter=s.sorter,this.collapseByDefault=s.collapseByDefault,this.tree=this.createTree(e,t,i,n,s),this.root=UK({element:void 0,parent:null,hasChildren:!0}),this.identityProvider&&(this.root=Object.assign(Object.assign({},this.root),{id:null})),this.nodes.set(null,this.root),this.tree.onDidChangeCollapseState(this._onDidChangeCollapseState,this,this.disposables)}get onDidChangeFocus(){return ds.map(this.tree.onDidChangeFocus,GK)}get onDidChangeSelection(){return ds.map(this.tree.onDidChangeSelection,GK)}get onMouseDblClick(){return ds.map(this.tree.onMouseDblClick,ZK)}get onPointer(){return ds.map(this.tree.onPointer,ZK)}get onDidFocus(){return this.tree.onDidFocus}get onDidChangeModel(){return this.tree.onDidChangeModel}get onDidChangeCollapseState(){return this.tree.onDidChangeCollapseState}get onDidDispose(){return this.tree.onDidDispose}createTree(e,t,i,n,o){const s=new vK(i),r=n.map((e=>new qK(e,this.nodeMapper,this._onDidChangeNodeSlowState.event))),a=JK(o)||{};return new WK(e,t,s,r,a)}updateOptions(e={}){this.tree.updateOptions(e)}getHTMLElement(){return this.tree.getHTMLElement()}get scrollTop(){return this.tree.scrollTop}set scrollTop(e){this.tree.scrollTop=e}domFocus(){this.tree.domFocus()}layout(e,t){this.tree.layout(e,t)}style(e){this.tree.style(e)}getInput(){return this.root.element}setInput(e,t){return jK(this,void 0,void 0,(function*(){this.refreshPromises.forEach((e=>e.cancel())),this.refreshPromises.clear(),this.root.element=e;const i=t&&{viewState:t,focus:[],selection:[]};yield this._updateChildren(e,!0,!1,i),i&&(this.tree.setFocus(i.focus),this.tree.setSelection(i.selection)),t&&"number"==typeof t.scrollTop&&(this.scrollTop=t.scrollTop)}))}_updateChildren(e=this.root.element,t=!0,i=!1,n,o){return jK(this,void 0,void 0,(function*(){if(void 0===this.root.element)throw new lK(this.user,"Tree input not set");this.root.refreshPromise&&(yield this.root.refreshPromise,yield ds.toPromise(this._onDidRender.event));const s=this.getDataNode(e);if(yield this.refreshAndRenderNode(s,t,n,o),i)try{this.tree.rerender(s)}catch(Bte){}}))}rerender(e){if(void 0===e||e===this.root.element)return void this.tree.rerender();const t=this.getDataNode(e);this.tree.rerender(t)}getNode(e=this.root.element){const t=this.getDataNode(e),i=this.tree.getNode(t===this.root?null:t);return this.nodeMapper.map(i)}collapse(e,t=!1){const i=this.getDataNode(e);return this.tree.collapse(i===this.root?null:i,t)}expand(e,t=!1){return jK(this,void 0,void 0,(function*(){if(void 0===this.root.element)throw new lK(this.user,"Tree input not set");this.root.refreshPromise&&(yield this.root.refreshPromise,yield ds.toPromise(this._onDidRender.event));const i=this.getDataNode(e);if(this.tree.hasElement(i)&&!this.tree.isCollapsible(i))return!1;if(i.refreshPromise&&(yield this.root.refreshPromise,yield ds.toPromise(this._onDidRender.event)),i!==this.root&&!i.refreshPromise&&!this.tree.isCollapsed(i))return!1;const n=this.tree.expand(i===this.root?null:i,t);return i.refreshPromise&&(yield this.root.refreshPromise,yield ds.toPromise(this._onDidRender.event)),n}))}setSelection(e,t){const i=e.map((e=>this.getDataNode(e)));this.tree.setSelection(i,t)}getSelection(){return this.tree.getSelection().map((e=>e.element))}setFocus(e,t){const i=e.map((e=>this.getDataNode(e)));this.tree.setFocus(i,t)}getFocus(){return this.tree.getFocus().map((e=>e.element))}reveal(e,t){this.tree.reveal(this.getDataNode(e),t)}getParentElement(e){const t=this.tree.getParentElement(this.getDataNode(e));return t&&t.element}getFirstElementChild(e=this.root.element){const t=this.getDataNode(e),i=this.tree.getFirstElementChild(t===this.root?null:t);return i&&i.element}getDataNode(e){const t=this.nodes.get(e===this.root.element?null:e);if(!t)throw new lK(this.user,`Data tree node not found: ${e}`);return t}refreshAndRenderNode(e,t,i,n){return jK(this,void 0,void 0,(function*(){yield this.refreshNode(e,t,i),this.render(e,i,n)}))}refreshNode(e,t,i){return jK(this,void 0,void 0,(function*(){let n;return this.subTreeRefreshPromises.forEach(((o,s)=>{!n&&function(e,t){return e===t||$K(e,t)||$K(t,e)}(s,e)&&(n=o.then((()=>this.refreshNode(e,t,i))))})),n||this.doRefreshSubTree(e,t,i)}))}doRefreshSubTree(e,t,i){return jK(this,void 0,void 0,(function*(){let n;e.refreshPromise=new Promise((e=>n=e)),this.subTreeRefreshPromises.set(e,e.refreshPromise),e.refreshPromise.finally((()=>{e.refreshPromise=void 0,this.subTreeRefreshPromises.delete(e)}));try{const o=yield this.doRefreshNode(e,t,i);e.stale=!1,yield ub.settled(o.map((e=>this.doRefreshSubTree(e,t,i))))}finally{n()}}))}doRefreshNode(e,t,i){return jK(this,void 0,void 0,(function*(){let n;if(e.hasChildren=!!this.dataSource.hasChildren(e.element),e.hasChildren){const t=this.doGetChildren(e);if($a(t))n=Promise.resolve(t);else{const i=nb(800);i.then((()=>{e.slow=!0,this._onDidChangeNodeSlowState.fire(e)}),(e=>null)),n=t.finally((()=>i.cancel()))}}else n=Promise.resolve(Hs.empty());try{const o=yield n;return this.setChildren(e,o,t,i)}catch(o){if(e!==this.root&&this.tree.hasElement(e)&&this.tree.collapse(e),Ea(o))return[];throw o}finally{e.slow&&(e.slow=!1,this._onDidChangeNodeSlowState.fire(e))}}))}doGetChildren(e){let t=this.refreshPromises.get(e);if(t)return t;const i=this.dataSource.getChildren(e.element);return $a(i)?this.processChildren(i):(t=Xv((()=>jK(this,void 0,void 0,(function*(){return this.processChildren(yield i)})))),this.refreshPromises.set(e,t),t.finally((()=>{this.refreshPromises.delete(e)})))}_onDidChangeCollapseState({node:e,deep:t}){null!==e.element&&!e.collapsed&&e.element.stale&&(t?this.collapse(e.element.element):this.refreshAndRenderNode(e.element,!1).catch(Jo))}setChildren(e,t,i,n){const o=[...t];if(0===e.children.length&&0===o.length)return[];const s=new Map,r=new Map;for(const d of e.children)if(s.set(d.element,d),this.identityProvider){const e=this.tree.isCollapsed(d);r.set(d.id,{node:d,collapsed:e})}const a=[],l=o.map((t=>{const o=!!this.dataSource.hasChildren(t);if(!this.identityProvider){const i=UK({element:t,parent:e,hasChildren:o});return o&&this.collapseByDefault&&!this.collapseByDefault(t)&&(i.collapsedByDefault=!1,a.push(i)),i}const l=this.identityProvider.getId(t).toString(),d=r.get(l);if(d){const e=d.node;return s.delete(e.element),this.nodes.delete(e.element),this.nodes.set(t,e),e.element=t,e.hasChildren=o,i?d.collapsed?(e.children.forEach((e=>eq(e,(e=>this.nodes.delete(e.element))))),e.children.splice(0,e.children.length),e.stale=!0):a.push(e):o&&this.collapseByDefault&&!this.collapseByDefault(t)&&(e.collapsedByDefault=!1,a.push(e)),e}const c=UK({element:t,parent:e,id:l,hasChildren:o});return n&&n.viewState.focus&&n.viewState.focus.indexOf(l)>-1&&n.focus.push(c),n&&n.viewState.selection&&n.viewState.selection.indexOf(l)>-1&&n.selection.push(c),n&&n.viewState.expanded&&n.viewState.expanded.indexOf(l)>-1?a.push(c):o&&this.collapseByDefault&&!this.collapseByDefault(t)&&(c.collapsedByDefault=!1,a.push(c)),c}));for(const d of s.values())eq(d,(e=>this.nodes.delete(e.element)));for(const d of l)this.nodes.set(d.element,d);return e.children.splice(0,e.children.length,...l),e!==this.root&&this.autoExpandSingleChildren&&1===l.length&&0===a.length&&(l[0].collapsedByDefault=!1,a.push(l[0])),a}render(e,t,i){const n=e.children.map((e=>this.asTreeElement(e,t))),o=i&&Object.assign(Object.assign({},i),{diffIdentityProvider:i.diffIdentityProvider&&{getId:e=>i.diffIdentityProvider.getId(e.element)}});this.tree.setChildren(e===this.root?null:e,n,o),e!==this.root&&this.tree.setCollapsible(e,e.hasChildren),this._onDidRender.fire()}asTreeElement(e,t){if(e.stale)return{element:e,collapsible:e.hasChildren,collapsed:!0};let i;return i=!(t&&t.viewState.expanded&&e.id&&t.viewState.expanded.indexOf(e.id)>-1)&&e.collapsedByDefault,e.collapsedByDefault=void 0,{element:e,children:e.hasChildren?Hs.map(e.children,(e=>this.asTreeElement(e,t))):[],collapsible:e.hasChildren,collapsed:i}}processChildren(e){return this.sorter&&(e=[...e].sort(this.sorter.compare.bind(this.sorter))),e}dispose(){this.disposables.dispose()}}class iq{constructor(e){this.node=e}get element(){return{elements:this.node.element.elements.map((e=>e.element)),incompressible:this.node.element.incompressible}}get children(){return this.node.children.map((e=>new iq(e)))}get depth(){return this.node.depth}get visibleChildrenCount(){return this.node.visibleChildrenCount}get visibleChildIndex(){return this.node.visibleChildIndex}get collapsible(){return this.node.collapsible}get collapsed(){return this.node.collapsed}get visible(){return this.node.visible}get filterData(){return this.node.filterData}}class nq{constructor(e,t,i,n){this.renderer=e,this.nodeMapper=t,this.compressibleNodeMapperProvider=i,this.onDidChangeTwistieState=n,this.renderedNodes=new Map,this.disposables=[],this.templateId=e.templateId}renderTemplate(e){return{templateData:this.renderer.renderTemplate(e)}}renderElement(e,t,i,n){this.renderer.renderElement(this.nodeMapper.map(e),t,i.templateData,n)}renderCompressedElements(e,t,i,n){this.renderer.renderCompressedElements(this.compressibleNodeMapperProvider().map(e),t,i.templateData,n)}renderTwistie(e,t){return e.slow?(t.classList.add(...br.treeItemLoading.classNamesArray),!0):(t.classList.remove(...br.treeItemLoading.classNamesArray),!1)}disposeElement(e,t,i,n){this.renderer.disposeElement&&this.renderer.disposeElement(this.nodeMapper.map(e),t,i.templateData,n)}disposeCompressedElements(e,t,i,n){this.renderer.disposeCompressedElements&&this.renderer.disposeCompressedElements(this.compressibleNodeMapperProvider().map(e),t,i.templateData,n)}disposeTemplate(e){this.renderer.disposeTemplate(e.templateData)}dispose(){this.renderedNodes.clear(),this.disposables=bs(this.disposables)}}class oq extends tq{constructor(e,t,i,n,o,s,r={}){super(e,t,i,o,s,r),this.compressionDelegate=n,this.compressibleNodeMapper=new dK((e=>new iq(e))),this.filter=r.filter}createTree(e,t,i,n,o){const s=new vK(i),r=n.map((e=>new nq(e,this.nodeMapper,(()=>this.compressibleNodeMapper),this._onDidChangeNodeSlowState.event))),a=function(e){const t=e&&JK(e);return t&&Object.assign(Object.assign({},t),{keyboardNavigationLabelProvider:t.keyboardNavigationLabelProvider&&Object.assign(Object.assign({},t.keyboardNavigationLabelProvider),{getCompressedNodeKeyboardNavigationLabel:t=>e.keyboardNavigationLabelProvider.getCompressedNodeKeyboardNavigationLabel(t.map((e=>e.element)))})})}(o)||{};return new HK(e,t,s,r,a)}asTreeElement(e,t){return Object.assign({incompressible:this.compressionDelegate.isIncompressible(e.element)},super.asTreeElement(e,t))}updateOptions(e={}){this.tree.updateOptions(e)}render(e,t){if(!this.identityProvider)return super.render(e,t);const i=e=>this.identityProvider.getId(e).toString(),n=e=>{const t=new Set;for(const n of e){const e=this.tree.getCompressedTreeNode(n===this.root?null:n);if(e.element)for(const n of e.element.elements)t.add(i(n.element))}return t},o=n(this.tree.getSelection()),s=n(this.tree.getFocus());super.render(e,t);const r=this.getSelection();let a=!1;const l=this.getFocus();let d=!1;const c=e=>{const t=e.element;if(t)for(let n=0;n<t.elements.length;n++){const e=i(t.elements[n].element),c=t.elements[t.elements.length-1].element;o.has(e)&&-1===r.indexOf(c)&&(r.push(c),a=!0),s.has(e)&&-1===l.indexOf(c)&&(l.push(c),d=!0)}e.children.forEach(c)};c(this.tree.getCompressedTreeNode(e===this.root?null:e)),a&&this.setSelection(r),d&&this.setFocus(l)}processChildren(e){return this.filter&&(e=Hs.filter(e,(e=>{const t=this.filter.filter(e,1),i="boolean"==typeof(n=t)?n?1:0:cK(n)?hK(n.visibility):hK(n);var n;if(2===i)throw new Error("Recursive tree visibility not supported in async data compressed trees");return 1===i}))),super.processChildren(e)}}class sq extends NK{constructor(e,t,i,n,o,s={}){super(e,t,i,n,s),this.user=e,this.dataSource=o,this.identityProvider=s.identityProvider}createModel(e,t,i){return new EK(e,t,i)}}new Uy("isMac",zo,mf(0,"Whether the operating system is macOS")),new Uy("isLinux",Vo,mf(0,"Whether the operating system is Linux"));const rq=new Uy("isWindows",Rs,mf(0,"Whether the operating system is Windows"));new Uy("isWeb",Fs,mf(0,"Whether the platform is a web browser")),new Uy("isMacNative",zo&&!Fs,mf(0,"Whether the operating system is macOS on a non-browser platform")),new Uy("isIOS",Vs,mf(0,"Whether the operating system is iOS")),new Uy("isDevelopment",!1,!0);const aq="inputFocus";new Uy(aq,!1,mf(0,"Whether keyboard focus is inside an input box"));var lq=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},dq=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};const cq=L_("listService");let hq=class{constructor(e){this._themeService=e,this.disposables=new ws,this.lists=[],this._lastFocusedWidget=void 0,this._hasCreatedStyleController=!1}get lastFocusedList(){return this._lastFocusedWidget}setLastFocusedList(e){var t,i;e!==this._lastFocusedWidget&&(null===(t=this._lastFocusedWidget)||void 0===t||t.getHTMLElement().classList.remove("last-focused"),this._lastFocusedWidget=e,null===(i=this._lastFocusedWidget)||void 0===i||i.getHTMLElement().classList.add("last-focused"))}register(e,t){if(!this._hasCreatedStyleController){this._hasCreatedStyleController=!0;const e=new W$(RC(),"");this.disposables.add($H(e,this._themeService))}if(this.lists.some((t=>t.widget===e)))throw new Error("Cannot register the same widget multiple times");const i={widget:e,extraContextKeys:t};return this.lists.push(i),e.getHTMLElement()===document.activeElement&&this.setLastFocusedList(e),ta(e.onDidFocus((()=>this.setLastFocusedList(e))),es((()=>this.lists.splice(this.lists.indexOf(i),1))),e.onDidDispose((()=>{this.lists=this.lists.filter((e=>e!==i)),this._lastFocusedWidget===e&&this.setLastFocusedList(void 0)})))}dispose(){this.disposables.dispose()}};hq=lq([dq(0,Qy)],hq);const uq=new Uy("listFocus",!0),gq=new Uy("listSupportsMultiselect",!0),pq=Sy.and(uq,Sy.not(aq)),mq=new Uy("listHasSelectionOrFocus",!1),fq=new Uy("listDoubleSelection",!1),_q=new Uy("listMultiSelection",!1),vq=new Uy("listSelectionNavigation",!1),bq=new Uy("treeElementCanCollapse",!1),wq=new Uy("treeElementHasParent",!1),Cq=new Uy("treeElementCanExpand",!1),yq=new Uy("treeElementHasChild",!1),xq="listAutomaticKeyboardNavigation";function Sq(e,t){const i=e.createScoped(t.getHTMLElement());return uq.bindTo(i),i}const kq="workbench.list.multiSelectModifier",Dq="workbench.list.openMode",Lq="workbench.list.horizontalScrolling",Nq="workbench.list.keyboardNavigation",Eq="workbench.list.automaticKeyboardNavigation",Iq="workbench.tree.indent",Tq="workbench.tree.renderIndentGuides",Mq="workbench.list.smoothScrolling",Aq="workbench.list.mouseWheelScrollSensitivity",Oq="workbench.list.fastScrollSensitivity",Rq="workbench.tree.expandMode";function Pq(e){return"alt"===e.getValue(kq)}class Fq extends Uo{constructor(e){super(),this.configurationService=e,this.useAltAsMultipleSelectionModifier=Pq(e),this.registerListeners()}registerListeners(){this._register(this.configurationService.onDidChangeConfiguration((e=>{e.affectsConfiguration(kq)&&(this.useAltAsMultipleSelectionModifier=Pq(this.configurationService))})))}isSelectionSingleChangeEvent(e){return this.useAltAsMultipleSelectionModifier?e.browserEvent.altKey:P$(e)}isSelectionRangeChangeEvent(e){return F$(e)}}function Bq(e,t,i){var n;const o=new ws;return[Object.assign(Object.assign({},e),{keyboardNavigationDelegate:{mightProducePrintableCharacter:e=>i.mightProducePrintableCharacter(e)},smoothScrolling:Boolean(t.getValue(Mq)),mouseWheelScrollSensitivity:t.getValue(Aq),fastScrollSensitivity:t.getValue(Oq),multipleSelectionController:null!==(n=e.multipleSelectionController)&&void 0!==n?n:o.add(new Fq(t))}),o]}let Vq=class extends G${constructor(e,t,i,n,o,s,r,a,l,d){const c=void 0!==o.horizontalScrolling?o.horizontalScrolling:Boolean(l.getValue(Lq)),[h,u]=Bq(o,l,d);super(e,t,i,n,Object.assign(Object.assign(Object.assign({keyboardSupport:!1},jH(a.getColorTheme(),KH)),h),{horizontalScrolling:c})),this.disposables.add(u),this.contextKeyService=Sq(s,this),this.themeService=a,this.listSupportsMultiSelect=gq.bindTo(this.contextKeyService),this.listSupportsMultiSelect.set(!1!==o.multipleSelectionSupport);vq.bindTo(this.contextKeyService).set(Boolean(o.selectionNavigation)),this.listHasSelectionOrFocus=mq.bindTo(this.contextKeyService),this.listDoubleSelection=fq.bindTo(this.contextKeyService),this.listMultiSelection=_q.bindTo(this.contextKeyService),this.horizontalScrolling=o.horizontalScrolling,this._useAltAsMultipleSelectionModifier=Pq(l),this.disposables.add(this.contextKeyService),this.disposables.add(r.register(this)),o.overrideStyles&&this.updateStyles(o.overrideStyles),this.disposables.add(this.onDidChangeSelection((()=>{const e=this.getSelection(),t=this.getFocus();this.contextKeyService.bufferChangeEvents((()=>{this.listHasSelectionOrFocus.set(e.length>0||t.length>0),this.listMultiSelection.set(e.length>1),this.listDoubleSelection.set(2===e.length)}))}))),this.disposables.add(this.onDidChangeFocus((()=>{const e=this.getSelection(),t=this.getFocus();this.listHasSelectionOrFocus.set(e.length>0||t.length>0)}))),this.disposables.add(l.onDidChangeConfiguration((e=>{e.affectsConfiguration(kq)&&(this._useAltAsMultipleSelectionModifier=Pq(l));let t={};if(e.affectsConfiguration(Lq)&&void 0===this.horizontalScrolling){const e=Boolean(l.getValue(Lq));t=Object.assign(Object.assign({},t),{horizontalScrolling:e})}if(e.affectsConfiguration(Mq)){const e=Boolean(l.getValue(Mq));t=Object.assign(Object.assign({},t),{smoothScrolling:e})}if(e.affectsConfiguration(Aq)){const e=l.getValue(Aq);t=Object.assign(Object.assign({},t),{mouseWheelScrollSensitivity:e})}if(e.affectsConfiguration(Oq)){const e=l.getValue(Oq);t=Object.assign(Object.assign({},t),{fastScrollSensitivity:e})}Object.keys(t).length>0&&this.updateOptions(t)}))),this.navigator=new jq(this,Object.assign({configurationService:l},o)),this.disposables.add(this.navigator)}updateOptions(e){super.updateOptions(e),e.overrideStyles&&this.updateStyles(e.overrideStyles),void 0!==e.multipleSelectionSupport&&this.listSupportsMultiSelect.set(!!e.multipleSelectionSupport)}updateStyles(e){var t;null===(t=this._styler)||void 0===t||t.dispose(),this._styler=$H(this,this.themeService,e)}dispose(){var e;null===(e=this._styler)||void 0===e||e.dispose(),super.dispose()}};Vq=lq([dq(5,$y),dq(6,cq),dq(7,Qy),dq(8,Cv),dq(9,kW)],Vq);let Wq=class extends class{constructor(e,t,i,n,o={}){const s=()=>this.model,r=n.map((e=>new Z$(e,s)));this.list=new G$(e,t,i,r,function(e,t){return Object.assign(Object.assign({},t),{accessibilityProvider:t.accessibilityProvider&&new Y$(e,t.accessibilityProvider)})}(s,o))}updateOptions(e){this.list.updateOptions(e)}getHTMLElement(){return this.list.getHTMLElement()}get onDidFocus(){return this.list.onDidFocus}get onDidDispose(){return this.list.onDidDispose}get onMouseDblClick(){return ds.map(this.list.onMouseDblClick,(({element:e,index:t,browserEvent:i})=>({element:void 0===e?void 0:this._model.get(e),index:t,browserEvent:i})))}get onPointer(){return ds.map(this.list.onPointer,(({element:e,index:t,browserEvent:i})=>({element:void 0===e?void 0:this._model.get(e),index:t,browserEvent:i})))}get onDidChangeSelection(){return ds.map(this.list.onDidChangeSelection,(({elements:e,indexes:t,browserEvent:i})=>({elements:e.map((e=>this._model.get(e))),indexes:t,browserEvent:i})))}get model(){return this._model}set model(e){this._model=e,this.list.splice(0,this.list.length,Oa(e.length))}getFocus(){return this.list.getFocus()}getSelection(){return this.list.getSelection()}getSelectedElements(){return this.getSelection().map((e=>this.model.get(e)))}style(e){this.list.style(e)}dispose(){this.list.dispose()}}{constructor(e,t,i,n,o,s,r,a,l,d){const c=void 0!==o.horizontalScrolling?o.horizontalScrolling:Boolean(l.getValue(Lq)),[h,u]=Bq(o,l,d);super(e,t,i,n,Object.assign(Object.assign(Object.assign({keyboardSupport:!1},jH(a.getColorTheme(),KH)),h),{horizontalScrolling:c})),this.disposables=new ws,this.disposables.add(u),this.contextKeyService=Sq(s,this),this.themeService=a,this.horizontalScrolling=o.horizontalScrolling,this.listSupportsMultiSelect=gq.bindTo(this.contextKeyService),this.listSupportsMultiSelect.set(!1!==o.multipleSelectionSupport);vq.bindTo(this.contextKeyService).set(Boolean(o.selectionNavigation)),this._useAltAsMultipleSelectionModifier=Pq(l),this.disposables.add(this.contextKeyService),this.disposables.add(r.register(this)),o.overrideStyles&&this.updateStyles(o.overrideStyles),o.overrideStyles&&this.disposables.add($H(this,a,o.overrideStyles)),this.disposables.add(l.onDidChangeConfiguration((e=>{e.affectsConfiguration(kq)&&(this._useAltAsMultipleSelectionModifier=Pq(l));let t={};if(e.affectsConfiguration(Lq)&&void 0===this.horizontalScrolling){const e=Boolean(l.getValue(Lq));t=Object.assign(Object.assign({},t),{horizontalScrolling:e})}if(e.affectsConfiguration(Mq)){const e=Boolean(l.getValue(Mq));t=Object.assign(Object.assign({},t),{smoothScrolling:e})}if(e.affectsConfiguration(Aq)){const e=l.getValue(Aq);t=Object.assign(Object.assign({},t),{mouseWheelScrollSensitivity:e})}if(e.affectsConfiguration(Oq)){const e=l.getValue(Oq);t=Object.assign(Object.assign({},t),{fastScrollSensitivity:e})}Object.keys(t).length>0&&this.updateOptions(t)}))),this.navigator=new jq(this,Object.assign({configurationService:l},o)),this.disposables.add(this.navigator)}updateOptions(e){super.updateOptions(e),e.overrideStyles&&this.updateStyles(e.overrideStyles),void 0!==e.multipleSelectionSupport&&this.listSupportsMultiSelect.set(!!e.multipleSelectionSupport)}updateStyles(e){var t;null===(t=this._styler)||void 0===t||t.dispose(),this._styler=$H(this,this.themeService,e)}dispose(){var e;null===(e=this._styler)||void 0===e||e.dispose(),this.disposables.dispose(),super.dispose()}};Wq=lq([dq(5,$y),dq(6,cq),dq(7,Qy),dq(8,Cv),dq(9,kW)],Wq);let zq=class extends aK{constructor(e,t,i,n,o,s,r,a,l,d,c){const h=void 0!==s.horizontalScrolling?s.horizontalScrolling:Boolean(d.getValue(Lq)),[u,g]=Bq(s,d,c);super(e,t,i,n,o,Object.assign(Object.assign(Object.assign({keyboardSupport:!1},jH(l.getColorTheme(),KH)),u),{horizontalScrolling:h})),this.disposables.add(g),this.contextKeyService=Sq(r,this),this.themeService=l,this.listSupportsMultiSelect=gq.bindTo(this.contextKeyService),this.listSupportsMultiSelect.set(!1!==s.multipleSelectionSupport);vq.bindTo(this.contextKeyService).set(Boolean(s.selectionNavigation)),this.listHasSelectionOrFocus=mq.bindTo(this.contextKeyService),this.listDoubleSelection=fq.bindTo(this.contextKeyService),this.listMultiSelection=_q.bindTo(this.contextKeyService),this.horizontalScrolling=s.horizontalScrolling,this._useAltAsMultipleSelectionModifier=Pq(d),this.disposables.add(this.contextKeyService),this.disposables.add(a.register(this)),s.overrideStyles&&this.updateStyles(s.overrideStyles),this.disposables.add(this.onDidChangeSelection((()=>{const e=this.getSelection(),t=this.getFocus();this.contextKeyService.bufferChangeEvents((()=>{this.listHasSelectionOrFocus.set(e.length>0||t.length>0),this.listMultiSelection.set(e.length>1),this.listDoubleSelection.set(2===e.length)}))}))),this.disposables.add(this.onDidChangeFocus((()=>{const e=this.getSelection(),t=this.getFocus();this.listHasSelectionOrFocus.set(e.length>0||t.length>0)}))),this.disposables.add(d.onDidChangeConfiguration((e=>{e.affectsConfiguration(kq)&&(this._useAltAsMultipleSelectionModifier=Pq(d));let t={};if(e.affectsConfiguration(Lq)&&void 0===this.horizontalScrolling){const e=Boolean(d.getValue(Lq));t=Object.assign(Object.assign({},t),{horizontalScrolling:e})}if(e.affectsConfiguration(Mq)){const e=Boolean(d.getValue(Mq));t=Object.assign(Object.assign({},t),{smoothScrolling:e})}if(e.affectsConfiguration(Aq)){const e=d.getValue(Aq);t=Object.assign(Object.assign({},t),{mouseWheelScrollSensitivity:e})}if(e.affectsConfiguration(Oq)){const e=d.getValue(Oq);t=Object.assign(Object.assign({},t),{fastScrollSensitivity:e})}Object.keys(t).length>0&&this.updateOptions(t)}))),this.navigator=new Uq(this,Object.assign({configurationService:d},s)),this.disposables.add(this.navigator)}updateOptions(e){super.updateOptions(e),e.overrideStyles&&this.updateStyles(e.overrideStyles),void 0!==e.multipleSelectionSupport&&this.listSupportsMultiSelect.set(!!e.multipleSelectionSupport)}updateStyles(e){var t;null===(t=this._styler)||void 0===t||t.dispose(),this._styler=$H(this,this.themeService,e)}dispose(){var e;null===(e=this._styler)||void 0===e||e.dispose(),this.disposables.dispose(),super.dispose()}};zq=lq([dq(6,$y),dq(7,cq),dq(8,Qy),dq(9,Cv),dq(10,kW)],zq);class Hq extends Uo{constructor(e,t){var i;super(),this.widget=e,this._onDidOpen=this._register(new $o),this.onDidOpen=this._onDidOpen.event,this._register(ds.filter(this.widget.onDidChangeSelection,(e=>e.browserEvent instanceof KeyboardEvent))((e=>this.onSelectionFromKeyboard(e)))),this._register(this.widget.onPointer((e=>this.onPointer(e.element,e.browserEvent)))),this._register(this.widget.onMouseDblClick((e=>this.onMouseDblClick(e.element,e.browserEvent)))),"boolean"!=typeof(null==t?void 0:t.openOnSingleClick)&&(null==t?void 0:t.configurationService)?(this.openOnSingleClick="doubleClick"!==(null==t?void 0:t.configurationService.getValue(Dq)),this._register(null==t?void 0:t.configurationService.onDidChangeConfiguration((()=>{this.openOnSingleClick="doubleClick"!==(null==t?void 0:t.configurationService.getValue(Dq))})))):this.openOnSingleClick=null===(i=null==t?void 0:t.openOnSingleClick)||void 0===i||i}onSelectionFromKeyboard(e){if(1!==e.elements.length)return;const t=e.browserEvent,i="boolean"!=typeof t.preserveFocus||t.preserveFocus,n="boolean"==typeof t.pinned?t.pinned:!i;this._open(this.getSelectedElement(),i,n,!1,e.browserEvent)}onPointer(e,t){if(!this.openOnSingleClick)return;if(2===t.detail)return;const i=1===t.button,n=t.ctrlKey||t.metaKey||t.altKey;this._open(e,!0,i,n,t)}onMouseDblClick(e,t){if(!t)return;const i=t.target;if(i.classList.contains("monaco-tl-twistie")||i.classList.contains("monaco-icon-label")&&i.classList.contains("folder-icon")&&t.offsetX<16)return;const n=t.ctrlKey||t.metaKey||t.altKey;this._open(e,!1,!0,n,t)}_open(e,t,i,n,o){e&&this._onDidOpen.fire({editorOptions:{preserveFocus:t,pinned:i,revealIfVisible:!0},sideBySide:n,element:e,browserEvent:o})}}class jq extends Hq{constructor(e,t){super(e,t),this.widget=e}getSelectedElement(){return this.widget.getSelectedElements()[0]}}class Uq extends Hq{constructor(e,t){super(e,t)}getSelectedElement(){return this.widget.getSelectedElements()[0]}}class $q extends Hq{constructor(e,t){super(e,t)}getSelectedElement(){var e;return null!==(e=this.widget.getSelection()[0])&&void 0!==e?e:void 0}}function Kq(e,t){let i=!1;return n=>{if(n.toKeybinding().isModifierKey())return!1;if(i)return i=!1,!1;const o=t.softDispatch(n,e);return o&&o.enterChord?(i=!0,!1):(i=!1,!0)}}let qq=class extends WK{constructor(e,t,i,n,o,s,r,a,l,d,c){const{options:h,getAutomaticKeyboardNavigation:u,disposable:g}=Qq(t,o,s,l,d,c);super(e,t,i,n,h),this.disposables.add(g),this.internals=new Jq(this,o,u,o.overrideStyles,s,r,a,l,c),this.disposables.add(this.internals)}updateOptions(e){super.updateOptions(e),this.internals.updateOptions(e)}};qq=lq([dq(5,$y),dq(6,cq),dq(7,Qy),dq(8,Cv),dq(9,kW),dq(10,$x)],qq);let Gq=class extends HK{constructor(e,t,i,n,o,s,r,a,l,d,c){const{options:h,getAutomaticKeyboardNavigation:u,disposable:g}=Qq(t,o,s,l,d,c);super(e,t,i,n,h),this.disposables.add(g),this.internals=new Jq(this,o,u,o.overrideStyles,s,r,a,l,c),this.disposables.add(this.internals)}updateOptions(e={}){super.updateOptions(e),e.overrideStyles&&this.internals.updateStyleOverrides(e.overrideStyles),this.internals.updateOptions(e)}};Gq=lq([dq(5,$y),dq(6,cq),dq(7,Qy),dq(8,Cv),dq(9,kW),dq(10,$x)],Gq);let Zq=class extends sq{constructor(e,t,i,n,o,s,r,a,l,d,c,h){const{options:u,getAutomaticKeyboardNavigation:g,disposable:p}=Qq(t,s,r,d,c,h);super(e,t,i,n,o,u),this.disposables.add(p),this.internals=new Jq(this,s,g,s.overrideStyles,r,a,l,d,h),this.disposables.add(this.internals)}updateOptions(e={}){super.updateOptions(e),e.overrideStyles&&this.internals.updateStyleOverrides(e.overrideStyles),this.internals.updateOptions(e)}};Zq=lq([dq(6,$y),dq(7,cq),dq(8,Qy),dq(9,Cv),dq(10,kW),dq(11,$x)],Zq);let Yq=class extends tq{constructor(e,t,i,n,o,s,r,a,l,d,c,h){const{options:u,getAutomaticKeyboardNavigation:g,disposable:p}=Qq(t,s,r,d,c,h);super(e,t,i,n,o,u),this.disposables.add(p),this.internals=new Jq(this,s,g,s.overrideStyles,r,a,l,d,h),this.disposables.add(this.internals)}get onDidOpen(){return this.internals.onDidOpen}updateOptions(e={}){super.updateOptions(e),e.overrideStyles&&this.internals.updateStyleOverrides(e.overrideStyles),this.internals.updateOptions(e)}};Yq=lq([dq(6,$y),dq(7,cq),dq(8,Qy),dq(9,Cv),dq(10,kW),dq(11,$x)],Yq);let Xq=class extends oq{constructor(e,t,i,n,o,s,r,a,l,d,c,h,u){const{options:g,getAutomaticKeyboardNavigation:p,disposable:m}=Qq(t,r,a,c,h,u);super(e,t,i,n,o,s,g),this.disposables.add(m),this.internals=new Jq(this,r,p,r.overrideStyles,a,l,d,c,u),this.disposables.add(this.internals)}updateOptions(e){super.updateOptions(e),this.internals.updateOptions(e)}};function Qq(e,t,i,n,o,s){var r;const a=()=>{let e=Boolean(i.getContextKeyValue(xq));return e&&(e=Boolean(n.getValue(Eq))),e},l=s.isScreenReaderOptimized(),d=t.simpleKeyboardNavigation||l?"simple":n.getValue(Nq),c=void 0!==t.horizontalScrolling?t.horizontalScrolling:Boolean(n.getValue(Lq)),[h,u]=Bq(t,n,o),g=t.additionalScrollHeight;return{getAutomaticKeyboardNavigation:a,disposable:u,options:Object.assign(Object.assign({keyboardSupport:!1},h),{indent:"number"==typeof n.getValue(Iq)?n.getValue(Iq):void 0,renderIndentGuides:n.getValue(Tq),smoothScrolling:Boolean(n.getValue(Mq)),automaticKeyboardNavigation:a(),simpleKeyboardNavigation:"simple"===d,filterOnType:"filter"===d,horizontalScrolling:c,keyboardNavigationEventFilter:Kq(e,o),additionalScrollHeight:g,hideTwistiesOfChildlessElements:t.hideTwistiesOfChildlessElements,expandOnlyOnTwistieClick:null!==(r=t.expandOnlyOnTwistieClick)&&void 0!==r?r:"doubleClick"===n.getValue(Rq)})}}Xq=lq([dq(7,$y),dq(8,cq),dq(9,Qy),dq(10,Cv),dq(11,kW),dq(12,$x)],Xq);let Jq=class{constructor(e,t,i,n,o,s,r,a,l){this.tree=e,this.themeService=r,this.disposables=[],this.contextKeyService=Sq(o,e),this.listSupportsMultiSelect=gq.bindTo(this.contextKeyService),this.listSupportsMultiSelect.set(!1!==t.multipleSelectionSupport);vq.bindTo(this.contextKeyService).set(Boolean(t.selectionNavigation)),this.hasSelectionOrFocus=mq.bindTo(this.contextKeyService),this.hasDoubleSelection=fq.bindTo(this.contextKeyService),this.hasMultiSelection=_q.bindTo(this.contextKeyService),this.treeElementCanCollapse=bq.bindTo(this.contextKeyService),this.treeElementHasParent=wq.bindTo(this.contextKeyService),this.treeElementCanExpand=Cq.bindTo(this.contextKeyService),this.treeElementHasChild=yq.bindTo(this.contextKeyService),this._useAltAsMultipleSelectionModifier=Pq(a);const d=new Set;d.add(xq);const c=()=>{const t=l.isScreenReaderOptimized()?"simple":a.getValue(Nq);e.updateOptions({simpleKeyboardNavigation:"simple"===t,filterOnType:"filter"===t})};this.updateStyleOverrides(n);const h=()=>{const t=e.getFocus()[0];if(!t)return;const i=e.getNode(t);this.treeElementCanCollapse.set(i.collapsible&&!i.collapsed),this.treeElementHasParent.set(!!e.getParentElement(t)),this.treeElementCanExpand.set(i.collapsible&&i.collapsed),this.treeElementHasChild.set(!!e.getFirstElementChild(t))};this.disposables.push(this.contextKeyService,s.register(e),e.onDidChangeSelection((()=>{const t=e.getSelection(),i=e.getFocus();this.contextKeyService.bufferChangeEvents((()=>{this.hasSelectionOrFocus.set(t.length>0||i.length>0),this.hasMultiSelection.set(t.length>1),this.hasDoubleSelection.set(2===t.length)}))})),e.onDidChangeFocus((()=>{const t=e.getSelection(),i=e.getFocus();this.hasSelectionOrFocus.set(t.length>0||i.length>0),h()})),e.onDidChangeCollapseState(h),e.onDidChangeModel(h),a.onDidChangeConfiguration((n=>{let o={};if(n.affectsConfiguration(kq)&&(this._useAltAsMultipleSelectionModifier=Pq(a)),n.affectsConfiguration(Iq)){const e=a.getValue(Iq);o=Object.assign(Object.assign({},o),{indent:e})}if(n.affectsConfiguration(Tq)){const e=a.getValue(Tq);o=Object.assign(Object.assign({},o),{renderIndentGuides:e})}if(n.affectsConfiguration(Mq)){const e=Boolean(a.getValue(Mq));o=Object.assign(Object.assign({},o),{smoothScrolling:e})}if(n.affectsConfiguration(Nq)&&c(),n.affectsConfiguration(Eq)&&(o=Object.assign(Object.assign({},o),{automaticKeyboardNavigation:i()})),n.affectsConfiguration(Lq)&&void 0===t.horizontalScrolling){const e=Boolean(a.getValue(Lq));o=Object.assign(Object.assign({},o),{horizontalScrolling:e})}if(n.affectsConfiguration(Rq)&&void 0===t.expandOnlyOnTwistieClick&&(o=Object.assign(Object.assign({},o),{expandOnlyOnTwistieClick:"doubleClick"===a.getValue(Rq)})),n.affectsConfiguration(Aq)){const e=a.getValue(Aq);o=Object.assign(Object.assign({},o),{mouseWheelScrollSensitivity:e})}if(n.affectsConfiguration(Oq)){const e=a.getValue(Oq);o=Object.assign(Object.assign({},o),{fastScrollSensitivity:e})}Object.keys(o).length>0&&e.updateOptions(o)})),this.contextKeyService.onDidChangeContext((t=>{t.affectsSome(d)&&e.updateOptions({automaticKeyboardNavigation:i()})})),l.onDidChangeScreenReaderOptimized((()=>c()))),this.navigator=new $q(e,Object.assign({configurationService:a},t)),this.disposables.push(this.navigator)}get onDidOpen(){return this.navigator.onDidOpen}updateOptions(e){void 0!==e.multipleSelectionSupport&&this.listSupportsMultiSelect.set(!!e.multipleSelectionSupport)}updateStyleOverrides(e){bs(this.styler),this.styler=e?$H(this.tree,this.themeService,e):Uo.None}dispose(){this.disposables=bs(this.disposables),bs(this.styler),this.styler=void 0}};Jq=lq([dq(4,$y),dq(5,cq),dq(6,Qy),dq(7,Cv),dq(8,$x)],Jq);var eG;Yy.as(cA).registerConfiguration({id:"workbench",order:7,title:mf(0,"Workbench"),type:"object",properties:{[kq]:{type:"string",enum:["ctrlCmd","alt"],enumDescriptions:[mf(0,"Maps to `Control` on Windows and Linux and to `Command` on macOS."),mf(0,"Maps to `Alt` on Windows and Linux and to `Option` on macOS.")],default:"ctrlCmd",description:mf(0,"The modifier to be used to add an item in trees and lists to a multi-selection with the mouse (for example in the explorer, open editors and scm view). The 'Open to Side' mouse gestures - if supported - will adapt such that they do not conflict with the multiselect modifier.")},[Dq]:{type:"string",enum:["singleClick","doubleClick"],default:"singleClick",description:mf(0,"Controls how to open items in trees and lists using the mouse (if supported). Note that some trees and lists might choose to ignore this setting if it is not applicable.")},[Lq]:{type:"boolean",default:!1,description:mf(0,"Controls whether lists and trees support horizontal scrolling in the workbench. Warning: turning on this setting has a performance implication.")},[Iq]:{type:"number",default:8,minimum:4,maximum:40,description:mf(0,"Controls tree indentation in pixels.")},[Tq]:{type:"string",enum:["none","onHover","always"],default:"onHover",description:mf(0,"Controls whether the tree should render indent guides.")},[Mq]:{type:"boolean",default:!1,description:mf(0,"Controls whether lists and trees have smooth scrolling.")},[Aq]:{type:"number",default:1,description:mf(0,"A multiplier to be used on the `deltaX` and `deltaY` of mouse wheel scroll events.")},[Oq]:{type:"number",default:5,description:mf(0,"Scrolling speed multiplier when pressing `Alt`.")},[Nq]:{type:"string",enum:["simple","highlight","filter"],enumDescriptions:[mf(0,"Simple keyboard navigation focuses elements which match the keyboard input. Matching is done only on prefixes."),mf(0,"Highlight keyboard navigation highlights elements which match the keyboard input. Further up and down navigation will traverse only the highlighted elements."),mf(0,"Filter keyboard navigation will filter out and hide all the elements which do not match the keyboard input.")],default:"highlight",description:mf(0,"Controls the keyboard navigation style for lists and trees in the workbench. Can be simple, highlight and filter.")},[Eq]:{type:"boolean",default:!0,markdownDescription:mf(0,"Controls whether keyboard navigation in lists and trees is automatically triggered simply by typing. If set to `false`, keyboard navigation is only triggered when executing the `list.toggleKeyboardNavigation` command, for which you can assign a keyboard shortcut.")},[Rq]:{type:"string",enum:["singleClick","doubleClick"],default:"singleClick",description:mf(0,"Controls how tree folders are expanded when clicking the folder names. Note that some trees and lists might choose to ignore this setting if it is not applicable.")}}}),function(e){e[e.PRESERVE=0]="PRESERVE",e[e.LAST=1]="LAST"}(eG||(eG={}));const tG="workbench.contributions.quickaccess";Yy.add(tG,new class{constructor(){this.providers=[],this.defaultProvider=void 0}registerQuickAccessProvider(e){return 0===e.prefix.length?this.defaultProvider=e:this.providers.push(e),this.providers.sort(((e,t)=>t.prefix.length-e.prefix.length)),es((()=>{this.providers.splice(this.providers.indexOf(e),1),this.defaultProvider===e&&(this.defaultProvider=void 0)}))}getQuickAccessProviders(){return Sa([this.defaultProvider,...this.providers])}getQuickAccessProvider(e){return e&&this.providers.find((t=>e.startsWith(t.prefix)))||void 0||this.defaultProvider}});const iG=L_("quickInputService");var nG=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},oG=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};let sG=class extends Uo{constructor(e,t){super(),this.quickInputService=e,this.instantiationService=t,this.registry=Yy.as(tG),this.mapProviderToDescriptor=new Map,this.lastAcceptedPickerValues=new Map,this.visibleQuickAccess=void 0}show(e="",t){this.doShowOrPick(e,!1,t)}doShowOrPick(e,t,i){var n;const[o,s]=this.getOrInstantiateProvider(e),r=this.visibleQuickAccess,a=null==r?void 0:r.descriptor;if(r&&s&&a===s)return e===s.prefix||(null==i?void 0:i.preserveValue)||(r.picker.value=e),void this.adjustValueSelection(r.picker,s,i);if(s&&!(null==i?void 0:i.preserveValue)){let t;if(r&&a&&a!==s){const e=r.value.substr(a.prefix.length);e&&(t=`${s.prefix}${e}`)}if(!t){const e=null==o?void 0:o.defaultFilterValue;e===eG.LAST?t=this.lastAcceptedPickerValues.get(s):"string"==typeof e&&(t=`${s.prefix}${e}`)}"string"==typeof t&&(e=t)}const l=new ws,d=l.add(this.quickInputService.createQuickPick());let c;d.value=e,this.adjustValueSelection(d,s,i),d.placeholder=null==s?void 0:s.placeholder,d.quickNavigate=null==i?void 0:i.quickNavigateConfiguration,d.hideInput=!!d.quickNavigate&&!r,("number"==typeof(null==i?void 0:i.itemActivation)||(null==i?void 0:i.quickNavigateConfiguration))&&(d.itemActivation=null!==(n=null==i?void 0:i.itemActivation)&&void 0!==n?n:bU.SECOND),d.contextKey=null==s?void 0:s.contextKey,d.filterValue=e=>e.substring(s?s.prefix.length:0),(null==s?void 0:s.placeholder)&&(d.ariaLabel=null==s?void 0:s.placeholder),t&&(c=new hb,l.add(kr(d.onWillAccept)((e=>{e.veto(),d.hide()})))),l.add(this.registerPickerListeners(d,o,s,e));const h=l.add(new as);return o&&l.add(o.provide(d,h.token)),kr(d.onDidHide)((()=>{0===d.selectedItems.length&&h.cancel(),l.dispose(),null==c||c.complete(d.selectedItems.slice(0))})),d.show(),t?null==c?void 0:c.p:void 0}adjustValueSelection(e,t,i){var n;let o;o=(null==i?void 0:i.preserveValue)?[e.value.length,e.value.length]:[null!==(n=null==t?void 0:t.prefix.length)&&void 0!==n?n:0,e.value.length],e.valueSelection=o}registerPickerListeners(e,t,i,n){const o=new ws,s=this.visibleQuickAccess={picker:e,descriptor:i,value:n};return o.add(es((()=>{s===this.visibleQuickAccess&&(this.visibleQuickAccess=void 0)}))),o.add(e.onDidChangeValue((e=>{const[i]=this.getOrInstantiateProvider(e);i!==t?this.show(e,{preserveValue:!0}):s.value=e}))),i&&o.add(e.onDidAccept((()=>{this.lastAcceptedPickerValues.set(i,e.value)}))),o}getOrInstantiateProvider(e){const t=this.registry.getQuickAccessProvider(e);if(!t)return[void 0,void 0];let i=this.mapProviderToDescriptor.get(t);return i||(i=this.instantiationService.createInstance(t.ctor),this.mapProviderToDescriptor.set(t,i)),[i,t]}};sG=nG([oG(0,iG),oG(1,k_)],sG);var rG=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},aG=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};let lG=class extends rx{constructor(e,t,i,n,o){super(i),this.instantiationService=e,this.contextKeyService=t,this.accessibilityService=n,this.layoutService=o,this.contexts=new Map}get controller(){return this._controller||(this._controller=this._register(this.createController())),this._controller}get quickAccess(){return this._quickAccess||(this._quickAccess=this._register(this.instantiationService.createInstance(sG))),this._quickAccess}createController(e=this.layoutService,t){var i,n;const o={idPrefix:"quickInput_",container:e.container,ignoreFocusOut:()=>!1,isScreenReaderOptimized:()=>this.accessibilityService.isScreenReaderOptimized(),backKeybindingLabel:()=>{},setContextKey:e=>this.setContextKey(e),returnFocus:()=>e.focus(),createList:(e,t,i,n,o)=>this.instantiationService.createInstance(Vq,e,t,i,n,o),styles:this.computeStyles()},s=this._register(new d$(Object.assign(Object.assign({},o),t)));return s.layout(e.dimension,null!==(n=null===(i=e.offset)||void 0===i?void 0:i.top)&&void 0!==n?n:0),this._register(e.onDidLayout((t=>{var i,n;return s.layout(t,null!==(n=null===(i=e.offset)||void 0===i?void 0:i.top)&&void 0!==n?n:0)}))),this._register(s.onShow((()=>this.resetContextKeys()))),this._register(s.onHide((()=>this.resetContextKeys()))),s}setContextKey(e){let t;e&&(t=this.contexts.get(e),t||(t=new Uy(e,!1).bindTo(this.contextKeyService),this.contexts.set(e,t))),t&&t.get()||(this.resetContextKeys(),t&&t.set(!0))}resetContextKeys(){this.contexts.forEach((e=>{e.get()&&e.reset()}))}pick(e,t={},i=Ia.None){return this.controller.pick(e,t,i)}createQuickPick(){return this.controller.createQuickPick()}updateStyles(){this.controller.applyStyles(this.computeStyles())}computeStyles(){return{widget:Object.assign({},jH(this.theme,{quickInputBackground:wk,quickInputForeground:Ck,quickInputTitleBackground:yk,contrastBorder:yS,widgetShadow:LS})),inputBox:jH(this.theme,{inputForeground:ES,inputBackground:NS,inputBorder:IS,inputValidationInfoBackground:OS,inputValidationInfoForeground:RS,inputValidationInfoBorder:PS,inputValidationWarningBackground:FS,inputValidationWarningForeground:BS,inputValidationWarningBorder:VS,inputValidationErrorBackground:WS,inputValidationErrorForeground:zS,inputValidationErrorBorder:HS}),countBadge:jH(this.theme,{badgeBackground:YS,badgeForeground:XS,badgeBorder:yS}),button:jH(this.theme,{buttonForeground:KS,buttonBackground:qS,buttonHoverBackground:GS,buttonBorder:yS}),progressBar:jH(this.theme,{progressBarBackground:ik}),keybindingLabel:jH(this.theme,{keybindingLabelBackground:kk,keybindingLabelForeground:Dk,keybindingLabelBorder:Lk,keybindingLabelBottomBorder:Nk,keybindingLabelShadow:LS}),list:jH(this.theme,{listBackground:wk,listInactiveFocusForeground:WD,listInactiveSelectionIconForeground:zD,listInactiveFocusBackground:HD,listFocusOutline:xS,listInactiveFocusOutline:xS,pickerGroupBorder:Sk,pickerGroupForeground:xk})}}};lG=rG([aG(0,k_),aG(1,$y),aG(2,Qy),aG(3,$x),aG(4,CV)],lG);var dG=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},cG=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};let hG=class extends lG{constructor(e,t,i,n,o,s){super(t,i,n,o,new kV(e.getContainerDomNode(),s)),this.host=void 0;const r=gG.get(e);if(r){const t=r.widget;this.host={_serviceBrand:void 0,get hasContainer(){return!0},get container(){return t.getDomNode()},get dimension(){return e.getLayoutInfo()},get onDidLayout(){return e.onDidLayoutChange},focus:()=>e.focus()}}else this.host=void 0}createController(){return super.createController(this.host)}};hG=dG([cG(1,k_),cG(2,$y),cG(3,Qy),cG(4,$x),cG(5,N_)],hG);let uG=class{constructor(e,t){this.instantiationService=e,this.codeEditorService=t,this.mapEditorToService=new Map}get activeService(){const e=this.codeEditorService.getFocusedCodeEditor();if(!e)throw new Error("Quick input service needs a focused editor to work.");let t=this.mapEditorToService.get(e);if(!t){const i=t=this.instantiationService.createInstance(hG,e);this.mapEditorToService.set(e,t),kr(e.onDidDispose)((()=>{i.dispose(),this.mapEditorToService.delete(e)}))}return t}get quickAccess(){return this.activeService.quickAccess}pick(e,t={},i=Ia.None){return this.activeService.pick(e,t,i)}createQuickPick(){return this.activeService.createQuickPick()}};uG=dG([cG(0,k_),cG(1,N_)],uG);class gG{constructor(e){this.editor=e,this.widget=new pG(this.editor)}static get(e){return e.getContribution(gG.ID)}dispose(){this.widget.dispose()}}gG.ID="editor.controller.quickInput";class pG{constructor(e){this.codeEditor=e,this.domNode=document.createElement("div"),this.codeEditor.addOverlayWidget(this)}getId(){return pG.ID}getDomNode(){return this.domNode}getPosition(){return{preference:2}}dispose(){this.codeEditor.removeOverlayWidget(this)}}pG.ID="editor.contrib.quickInputWidget",Ix(gG.ID,gG);class mG{constructor(e,t,i,n,o){this._parsedThemeRuleBrand=void 0,this.token=e,this.index=t,this.fontStyle=i,this.foreground=n,this.background=o}}const fG=/^#?([0-9A-Fa-f]{6})([0-9A-Fa-f]{2})?$/;class _G{constructor(){this._lastColorId=0,this._id2color=[],this._color2id=new Map}getId(e){if(null===e)return 0;const t=e.match(fG);if(!t)throw new Error("Illegal value for token color: "+e);e=t[1].toUpperCase();let i=this._color2id.get(e);return i||(i=++this._lastColorId,this._color2id.set(e,i),this._id2color[i]=hS.fromHex("#"+e),i)}getColorMap(){return this._id2color.slice(0)}}class vG{constructor(e,t){this._colorMap=e,this._root=t,this._cache=new Map}static createFromRawTokenTheme(e,t){return this.createFromParsedTokenTheme(function(e){if(!e||!Array.isArray(e))return[];const t=[];let i=0;for(let n=0,o=e.length;n<o;n++){const o=e[n];let s=-1;if("string"==typeof o.fontStyle){s=0;const e=o.fontStyle.split(" ");for(let t=0,i=e.length;t<i;t++)switch(e[t]){case"italic":s|=1;break;case"bold":s|=2;break;case"underline":s|=4;break;case"strikethrough":s|=8}}let r=null;"string"==typeof o.foreground&&(r=o.foreground);let a=null;"string"==typeof o.background&&(a=o.background),t[i++]=new mG(o.token||"",n,s,r,a)}return t}(e),t)}static createFromParsedTokenTheme(e,t){return function(e,t){e.sort(((e,t)=>{const i=function(e,t){return e<t?-1:e>t?1:0}(e.token,t.token);return 0!==i?i:e.index-t.index}));let i=0,n="000000",o="ffffff";for(;e.length>=1&&""===e[0].token;){const t=e.shift();-1!==t.fontStyle&&(i=t.fontStyle),null!==t.foreground&&(n=t.foreground),null!==t.background&&(o=t.background)}const s=new _G;for(let c of t)s.getId(c);const r=s.getId(n),a=s.getId(o),l=new wG(i,r,a),d=new CG(l);for(let c=0,h=e.length;c<h;c++){const t=e[c];d.insert(t.token,t.fontStyle,s.getId(t.foreground),s.getId(t.background))}return new vG(s,d)}(e,t)}getColorMap(){return this._colorMap.getColorMap()}_match(e){return this._root.match(e)}match(e,t){let i=this._cache.get(t);if(void 0===i){const e=this._match(t),n=function(e){const t=e.match(bG);if(!t)return 0;switch(t[1]){case"comment":return 1;case"string":return 2;case"regex":case"regexp":return 3}throw new Error("Unexpected match for standard token type!")}(t);i=(e.metadata|n<<8)>>>0,this._cache.set(t,i)}return(i|e<<0)>>>0}}const bG=/\b(comment|string|regex|regexp)\b/;class wG{constructor(e,t,i){this._themeTrieElementRuleBrand=void 0,this._fontStyle=e,this._foreground=t,this._background=i,this.metadata=(this._fontStyle<<10|this._foreground<<14|this._background<<23)>>>0}clone(){return new wG(this._fontStyle,this._foreground,this._background)}acceptOverwrite(e,t,i){-1!==e&&(this._fontStyle=e),0!==t&&(this._foreground=t),0!==i&&(this._background=i),this.metadata=(this._fontStyle<<10|this._foreground<<14|this._background<<23)>>>0}}class CG{constructor(e){this._themeTrieElementBrand=void 0,this._mainRule=e,this._children=new Map}match(e){if(""===e)return this._mainRule;const t=e.indexOf(".");let i,n;-1===t?(i=e,n=""):(i=e.substring(0,t),n=e.substring(t+1));const o=this._children.get(i);return void 0!==o?o.match(n):this._mainRule}insert(e,t,i,n){if(""===e)return void this._mainRule.acceptOverwrite(t,i,n);const o=e.indexOf(".");let s,r;-1===o?(s=e,r=""):(s=e.substring(0,o),r=e.substring(o+1));let a=this._children.get(s);void 0===a&&(a=new CG(this._mainRule.clone()),this._children.set(s,a)),a.insert(r,t,i,n)}}const yG={base:"vs",inherit:!1,rules:[{token:"",foreground:"000000",background:"fffffe"},{token:"invalid",foreground:"cd3131"},{token:"emphasis",fontStyle:"italic"},{token:"strong",fontStyle:"bold"},{token:"variable",foreground:"001188"},{token:"variable.predefined",foreground:"4864AA"},{token:"constant",foreground:"dd0000"},{token:"comment",foreground:"008000"},{token:"number",foreground:"098658"},{token:"number.hex",foreground:"3030c0"},{token:"regexp",foreground:"800000"},{token:"annotation",foreground:"808080"},{token:"type",foreground:"008080"},{token:"delimiter",foreground:"000000"},{token:"delimiter.html",foreground:"383838"},{token:"delimiter.xml",foreground:"0000FF"},{token:"tag",foreground:"800000"},{token:"tag.id.pug",foreground:"4F76AC"},{token:"tag.class.pug",foreground:"4F76AC"},{token:"meta.scss",foreground:"800000"},{token:"metatag",foreground:"e00000"},{token:"metatag.content.html",foreground:"FF0000"},{token:"metatag.html",foreground:"808080"},{token:"metatag.xml",foreground:"808080"},{token:"metatag.php",fontStyle:"bold"},{token:"key",foreground:"863B00"},{token:"string.key.json",foreground:"A31515"},{token:"string.value.json",foreground:"0451A5"},{token:"attribute.name",foreground:"FF0000"},{token:"attribute.value",foreground:"0451A5"},{token:"attribute.value.number",foreground:"098658"},{token:"attribute.value.unit",foreground:"098658"},{token:"attribute.value.html",foreground:"0000FF"},{token:"attribute.value.xml",foreground:"0000FF"},{token:"string",foreground:"A31515"},{token:"string.html",foreground:"0000FF"},{token:"string.sql",foreground:"FF0000"},{token:"string.yaml",foreground:"0451A5"},{token:"keyword",foreground:"0000FF"},{token:"keyword.json",foreground:"0451A5"},{token:"keyword.flow",foreground:"AF00DB"},{token:"keyword.flow.scss",foreground:"0000FF"},{token:"operator.scss",foreground:"666666"},{token:"operator.sql",foreground:"778899"},{token:"operator.swift",foreground:"666666"},{token:"predefined.sql",foreground:"C700C7"}],colors:{[pk]:"#FFFFFE",[mk]:"#000000",[Tk]:"#E5EBF1",[YN]:"#D3D3D3",[XN]:"#939393",[Mk]:"#ADD6FF4D"}},xG={base:"vs-dark",inherit:!1,rules:[{token:"",foreground:"D4D4D4",background:"1E1E1E"},{token:"invalid",foreground:"f44747"},{token:"emphasis",fontStyle:"italic"},{token:"strong",fontStyle:"bold"},{token:"variable",foreground:"74B0DF"},{token:"variable.predefined",foreground:"4864AA"},{token:"variable.parameter",foreground:"9CDCFE"},{token:"constant",foreground:"569CD6"},{token:"comment",foreground:"608B4E"},{token:"number",foreground:"B5CEA8"},{token:"number.hex",foreground:"5BB498"},{token:"regexp",foreground:"B46695"},{token:"annotation",foreground:"cc6666"},{token:"type",foreground:"3DC9B0"},{token:"delimiter",foreground:"DCDCDC"},{token:"delimiter.html",foreground:"808080"},{token:"delimiter.xml",foreground:"808080"},{token:"tag",foreground:"569CD6"},{token:"tag.id.pug",foreground:"4F76AC"},{token:"tag.class.pug",foreground:"4F76AC"},{token:"meta.scss",foreground:"A79873"},{token:"meta.tag",foreground:"CE9178"},{token:"metatag",foreground:"DD6A6F"},{token:"metatag.content.html",foreground:"9CDCFE"},{token:"metatag.html",foreground:"569CD6"},{token:"metatag.xml",foreground:"569CD6"},{token:"metatag.php",fontStyle:"bold"},{token:"key",foreground:"9CDCFE"},{token:"string.key.json",foreground:"9CDCFE"},{token:"string.value.json",foreground:"CE9178"},{token:"attribute.name",foreground:"9CDCFE"},{token:"attribute.value",foreground:"CE9178"},{token:"attribute.value.number.css",foreground:"B5CEA8"},{token:"attribute.value.unit.css",foreground:"B5CEA8"},{token:"attribute.value.hex.css",foreground:"D4D4D4"},{token:"string",foreground:"CE9178"},{token:"string.sql",foreground:"FF0000"},{token:"keyword",foreground:"569CD6"},{token:"keyword.flow",foreground:"C586C0"},{token:"keyword.json",foreground:"CE9178"},{token:"keyword.flow.scss",foreground:"569CD6"},{token:"operator.scss",foreground:"909090"},{token:"operator.sql",foreground:"778899"},{token:"operator.swift",foreground:"909090"},{token:"predefined.sql",foreground:"FF00FF"}],colors:{[pk]:"#1E1E1E",[mk]:"#D4D4D4",[Tk]:"#3A3D41",[YN]:"#404040",[XN]:"#707070",[Mk]:"#ADD6FF26"}},SG={base:"hc-black",inherit:!1,rules:[{token:"",foreground:"FFFFFF",background:"000000"},{token:"invalid",foreground:"f44747"},{token:"emphasis",fontStyle:"italic"},{token:"strong",fontStyle:"bold"},{token:"variable",foreground:"1AEBFF"},{token:"variable.parameter",foreground:"9CDCFE"},{token:"constant",foreground:"569CD6"},{token:"comment",foreground:"608B4E"},{token:"number",foreground:"FFFFFF"},{token:"regexp",foreground:"C0C0C0"},{token:"annotation",foreground:"569CD6"},{token:"type",foreground:"3DC9B0"},{token:"delimiter",foreground:"FFFF00"},{token:"delimiter.html",foreground:"FFFF00"},{token:"tag",foreground:"569CD6"},{token:"tag.id.pug",foreground:"4F76AC"},{token:"tag.class.pug",foreground:"4F76AC"},{token:"meta",foreground:"D4D4D4"},{token:"meta.tag",foreground:"CE9178"},{token:"metatag",foreground:"569CD6"},{token:"metatag.content.html",foreground:"1AEBFF"},{token:"metatag.html",foreground:"569CD6"},{token:"metatag.xml",foreground:"569CD6"},{token:"metatag.php",fontStyle:"bold"},{token:"key",foreground:"9CDCFE"},{token:"string.key",foreground:"9CDCFE"},{token:"string.value",foreground:"CE9178"},{token:"attribute.name",foreground:"569CD6"},{token:"attribute.value",foreground:"3FF23F"},{token:"string",foreground:"CE9178"},{token:"string.sql",foreground:"FF0000"},{token:"keyword",foreground:"569CD6"},{token:"keyword.flow",foreground:"C586C0"},{token:"operator.sql",foreground:"778899"},{token:"operator.swift",foreground:"909090"},{token:"predefined.sql",foreground:"FF00FF"}],colors:{[pk]:"#000000",[mk]:"#FFFFFF",[YN]:"#FFFFFF",[XN]:"#FFFFFF"}};class kG{getIcon(e){const t=yB();let i=e.defaults;for(;ex.isThemeIcon(i);){const e=t.getIcon(i.id);if(!e)return;i=e.defaults}return i}}const DG="vs",LG="vs-dark",NG="hc-black",EG=Yy.as(mS),IG=Yy.as(nx);class TG{constructor(e,t){this.semanticHighlighting=!1,this.themeData=t;const i=t.base;e.length>0?(MG(e)?this.id=e:this.id=i+" "+e,this.themeName=e):(this.id=i,this.themeName=i),this.colors=null,this.defaultColors=Object.create(null),this._tokenTheme=null}get base(){return this.themeData.base}notifyBaseUpdated(){this.themeData.inherit&&(this.colors=null,this._tokenTheme=null)}getColors(){if(!this.colors){const e=new Map;for(let t in this.themeData.colors)e.set(t,hS.fromHex(this.themeData.colors[t]));if(this.themeData.inherit){const t=AG(this.themeData.base);for(let i in t.colors)e.has(i)||e.set(i,hS.fromHex(t.colors[i]))}this.colors=e}return this.colors}getColor(e,t){const i=this.getColors().get(e);return i||(!1!==t?this.getDefault(e):void 0)}getDefault(e){let t=this.defaultColors[e];return t||(t=EG.resolveDefaultColor(e,this),this.defaultColors[e]=t,t)}defines(e){return Object.prototype.hasOwnProperty.call(this.getColors(),e)}get type(){switch(this.base){case DG:return Xy.LIGHT;case NG:return Xy.HIGH_CONTRAST;default:return Xy.DARK}}get tokenTheme(){if(!this._tokenTheme){let e=[],t=[];if(this.themeData.inherit){const i=AG(this.themeData.base);e=i.rules,i.encodedTokensColors&&(t=i.encodedTokensColors)}const i=this.themeData.colors["editor.foreground"],n=this.themeData.colors["editor.background"];if(i||n){const t={token:""};i&&(t.foreground=i),n&&(t.background=n),e.push(t)}e=e.concat(this.themeData.rules),this.themeData.encodedTokensColors&&(t=this.themeData.encodedTokensColors),this._tokenTheme=vG.createFromRawTokenTheme(e,t)}return this._tokenTheme}getTokenStyleMetadata(e,t,i){const n=this.tokenTheme._match([e].concat(t).join(".")).metadata,o=ys.getForeground(n),s=ys.getFontStyle(n);return{foreground:o,italic:Boolean(1&s),bold:Boolean(2&s),underline:Boolean(4&s),strikethrough:Boolean(8&s)}}}function MG(e){return e===DG||e===LG||e===NG}function AG(e){switch(e){case DG:return yG;case LG:return xG;case NG:return SG}}function OG(e){const t=AG(e);return new TG(e,t)}const RG=L_("themeService");var PG=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},FG=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};let BG=class extends Uo{constructor(e,t){super(),this._contextKeyService=e,this._configurationService=t,this._accessibilitySupport=0,this._onDidChangeScreenReaderOptimized=new $o,this._accessibilityModeEnabledContext=Kx.bindTo(this._contextKeyService);const i=()=>this._accessibilityModeEnabledContext.set(this.isScreenReaderOptimized());this._register(this._configurationService.onDidChangeConfiguration((e=>{e.affectsConfiguration("editor.accessibilitySupport")&&(i(),this._onDidChangeScreenReaderOptimized.fire())}))),i(),this.onDidChangeScreenReaderOptimized((()=>i()))}get onDidChangeScreenReaderOptimized(){return this._onDidChangeScreenReaderOptimized.event}isScreenReaderOptimized(){const e=this._configurationService.getValue("editor.accessibilitySupport");return"on"===e||"auto"===e&&2===this._accessibilitySupport}getAccessibilitySupport(){return this._accessibilitySupport}};BG=PG([FG(0,$y),FG(1,Cv)],BG);var VG=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},WG=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};let zG=class{constructor(e){this._commandService=e}createMenu(e,t,i){return new HG(e,Object.assign({emitEventsForSubmenuChanges:!1,eventDebounceDelay:50},i),this._commandService,t,this)}};zG=VG([WG(0,wy)],zG);let HG=class e{constructor(e,t,i,n,o){this._id=e,this._options=t,this._commandService=i,this._contextKeyService=n,this._menuService=o,this._disposables=new ws,this._menuGroups=[],this._contextKeys=new Set,this._build();const s=new lb((()=>{this._build(),this._onDidChange.fire(this)}),t.eventDebounceDelay);this._disposables.add(s),this._disposables.add(ux.onDidChangeMenu((t=>{t.has(e)&&s.schedule()})));const r=this._disposables.add(new ws);this._onDidChange=new $o({onFirstListenerAdd:()=>{const e=new lb((()=>this._onDidChange.fire(this)),t.eventDebounceDelay);r.add(e),r.add(n.onDidChangeContext((t=>{t.affectsSome(this._contextKeys)&&e.schedule()})))},onLastListenerRemove:r.clear.bind(r)}),this.onDidChange=this._onDidChange.event}dispose(){this._disposables.dispose(),this._onDidChange.dispose()}_build(){this._menuGroups.length=0,this._contextKeys.clear();const t=ux.getMenuItems(this._id);let i;t.sort(e._compareMenuItems);for(const e of t){const t=e.group||"";i&&i[0]===t||(i=[t,[]],this._menuGroups.push(i)),i[1].push(e),this._collectContextKeys(e)}}_collectContextKeys(t){if(e._fillInKbExprKeys(t.when,this._contextKeys),dx(t)){if(t.command.precondition&&e._fillInKbExprKeys(t.command.precondition,this._contextKeys),t.command.toggled){const i=t.command.toggled.condition||t.command.toggled;e._fillInKbExprKeys(i,this._contextKeys)}}else this._options.emitEventsForSubmenuChanges&&ux.getMenuItems(t.submenu).forEach(this._collectContextKeys,this)}getActions(e){const t=[];for(let i of this._menuGroups){const[n,o]=i,s=[];for(const t of o)if(this._contextKeyService.contextMatchesRules(t.when)){const i=dx(t)?new px(t.command,t.alt,e,this._contextKeyService,this._commandService):new gx(t,this._menuService,this._contextKeyService,e);s.push(i)}s.length>0&&t.push([n,s])}return t}static _fillInKbExprKeys(e,t){if(e)for(let i of e.keys())t.add(i)}static _compareMenuItems(t,i){let n=t.group,o=i.group;if(n!==o){if(!n)return 1;if(!o)return-1;if("navigation"===n)return-1;if("navigation"===o)return 1;let e=n.localeCompare(o);if(0!==e)return e}let s=t.order||0,r=i.order||0;return s<r?-1:s>r?1:e._compareTitles(dx(t)?t.command.title:t.title,dx(i)?i.command.title:i.title)}static _compareTitles(e,t){const i="string"==typeof e?e:e.original,n="string"==typeof t?t:t.original;return i.localeCompare(n)}};HG=VG([WG(2,wy),WG(3,$y),WG(4,hx)],HG);var jG=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},UG=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}},$G=globalThis&&globalThis.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{l(n.next(e))}catch(t){s(t)}}function a(e){try{l(n.throw(e))}catch(t){s(t)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}l((n=n.apply(e,t||[])).next())}))};let KG=class extends Uo{constructor(e,t){super(),this.layoutService=e,this.logService=t,this.mapTextToType=new Map,this.findText="",(a_||l_)&&this.installWebKitWriteTextWorkaround()}installWebKitWriteTextWorkaround(){const e=()=>{const e=new hb;this.webKitPendingClipboardWritePromise&&!this.webKitPendingClipboardWritePromise.isSettled&&this.webKitPendingClipboardWritePromise.cancel(),this.webKitPendingClipboardWritePromise=e,navigator.clipboard.write([new ClipboardItem({"text/plain":e.p})]).catch((t=>$G(this,void 0,void 0,(function*(){t instanceof Error&&"NotAllowedError"===t.name&&e.isRejected||this.logService.error(t)}))))};this.layoutService.hasContainer&&(this._register(nC(this.layoutService.container,"click",e)),this._register(nC(this.layoutService.container,"keydown",e)))}writeText(e,t){return $G(this,void 0,void 0,(function*(){if(t)return void this.mapTextToType.set(t,e);if(this.webKitPendingClipboardWritePromise)return this.webKitPendingClipboardWritePromise.complete(e);try{return yield navigator.clipboard.writeText(e)}catch(o){}const i=document.activeElement,n=document.body.appendChild(YC("textarea",{"aria-hidden":!0}));n.style.height="1px",n.style.width="1px",n.style.position="absolute",n.value=e,n.focus(),n.select(),document.execCommand("copy"),i instanceof HTMLElement&&i.focus(),document.body.removeChild(n)}))}readText(e){return $G(this,void 0,void 0,(function*(){if(e)return this.mapTextToType.get(e)||"";try{return yield navigator.clipboard.readText()}catch(t){return""}}))}readFindText(){return $G(this,void 0,void 0,(function*(){return this.findText}))}writeFindText(e){return $G(this,void 0,void 0,(function*(){this.findText=e}))}};KG=jG([UG(0,CV),UG(1,Cb)],KG);var qG=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},GG=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};const ZG="data-keybinding-context";class YG{constructor(e,t){this._id=e,this._parent=t,this._value=Object.create(null),this._value._contextId=e}setValue(e,t){return this._value[e]!==t&&(this._value[e]=t,!0)}removeValue(e){return e in this._value&&(delete this._value[e],!0)}getValue(e){const t=this._value[e];return void 0===t&&this._parent?this._parent.getValue(e):t}}class XG extends YG{constructor(){super(-1,null)}setValue(e,t){return!1}removeValue(e){return!1}getValue(e){}}XG.INSTANCE=new XG;class QG extends YG{constructor(e,t,i){super(e,null),this._configurationService=t,this._values=GV.forConfigKeys(),this._listener=this._configurationService.onDidChangeConfiguration((e=>{if(6===e.source){const e=Array.from(Hs.map(this._values,(([e])=>e)));this._values.clear(),i.fire(new tZ(e))}else{const t=[];for(const i of e.affectedKeys){const e=`config.${i}`,n=this._values.findSuperstr(e);void 0!==n&&(t.push(...Hs.map(n,(([e])=>e))),this._values.deleteSuperstr(e)),this._values.has(e)&&(t.push(e),this._values.delete(e))}i.fire(new tZ(t))}}))}dispose(){this._listener.dispose()}getValue(e){if(0!==e.indexOf(QG._keyPrefix))return super.getValue(e);if(this._values.has(e))return this._values.get(e);const t=e.substr(QG._keyPrefix.length),i=this._configurationService.getValue(t);let n;switch(typeof i){case"number":case"boolean":case"string":n=i;break;default:n=Array.isArray(i)?JSON.stringify(i):i}return this._values.set(e,n),n}setValue(e,t){return super.setValue(e,t)}removeValue(e){return super.removeValue(e)}}QG._keyPrefix="config.";class JG{constructor(e,t,i){this._service=e,this._key=t,this._defaultValue=i,this.reset()}set(e){this._service.setContext(this._key,e)}reset(){void 0===this._defaultValue?this._service.removeContext(this._key):this._service.setContext(this._key,this._defaultValue)}get(){return this._service.getContextKeyValue(this._key)}}class eZ{constructor(e){this.key=e}affectsSome(e){return e.has(this.key)}}class tZ{constructor(e){this.keys=e}affectsSome(e){for(const t of this.keys)if(e.has(t))return!0;return!1}}class iZ{constructor(e){this.events=e}affectsSome(e){for(const t of this.events)if(t.affectsSome(e))return!0;return!1}}class nZ{constructor(e){this._onDidChangeContext=new Ka({merge:e=>new iZ(e)}),this.onDidChangeContext=this._onDidChangeContext.event,this._isDisposed=!1,this._myContextId=e}createKey(e,t){if(this._isDisposed)throw new Error("AbstractContextKeyService has been disposed");return new JG(this,e,t)}bufferChangeEvents(e){this._onDidChangeContext.pause();try{e()}finally{this._onDidChangeContext.resume()}}createScoped(e){if(this._isDisposed)throw new Error("AbstractContextKeyService has been disposed");return new sZ(this,e)}contextMatchesRules(e){if(this._isDisposed)throw new Error("AbstractContextKeyService has been disposed");const t=this.getContextValuesContainer(this._myContextId);return!e||e.evaluate(t)}getContextKeyValue(e){if(!this._isDisposed)return this.getContextValuesContainer(this._myContextId).getValue(e)}setContext(e,t){if(this._isDisposed)return;const i=this.getContextValuesContainer(this._myContextId);i&&i.setValue(e,t)&&this._onDidChangeContext.fire(new eZ(e))}removeContext(e){this._isDisposed||this.getContextValuesContainer(this._myContextId).removeValue(e)&&this._onDidChangeContext.fire(new eZ(e))}getContext(e){return this._isDisposed?XG.INSTANCE:this.getContextValuesContainer(function(e){for(;e;){if(e.hasAttribute(ZG)){const t=e.getAttribute(ZG);return t?parseInt(t,10):NaN}e=e.parentElement}return 0}(e))}}let oZ=class extends nZ{constructor(e){super(0),this._contexts=new Map,this._toDispose=new ws,this._lastContextId=0;const t=new QG(this._myContextId,e,this._onDidChangeContext);this._contexts.set(this._myContextId,t),this._toDispose.add(t)}dispose(){this._onDidChangeContext.dispose(),this._isDisposed=!0,this._toDispose.dispose()}getContextValuesContainer(e){return this._isDisposed?XG.INSTANCE:this._contexts.get(e)||XG.INSTANCE}createChildContext(e=this._myContextId){if(this._isDisposed)throw new Error("ContextKeyService has been disposed");let t=++this._lastContextId;return this._contexts.set(t,new YG(t,this.getContextValuesContainer(e))),t}disposeContext(e){this._isDisposed||this._contexts.delete(e)}};oZ=qG([GG(0,Cv)],oZ);class sZ extends nZ{constructor(e,t){if(super(e.createChildContext()),this._parentChangeListener=new Rr,this._parent=e,this._updateParentChangeListener(),this._domNode=t,this._domNode.hasAttribute(ZG)){let e="";this._domNode.classList&&(e=Array.from(this._domNode.classList.values()).join(", "))}this._domNode.setAttribute(ZG,String(this._myContextId))}_updateParentChangeListener(){this._parentChangeListener.value=this._parent.onDidChangeContext(this._onDidChangeContext.fire,this._onDidChangeContext)}dispose(){this._isDisposed||(this._onDidChangeContext.dispose(),this._parent.disposeContext(this._myContextId),this._parentChangeListener.dispose(),this._domNode.removeAttribute(ZG),this._isDisposed=!0)}getContextValuesContainer(e){return this._isDisposed?XG.INSTANCE:this._parent.getContextValuesContainer(e)}createChildContext(e=this._myContextId){if(this._isDisposed)throw new Error("ScopedContextKeyService has been disposed");return this._parent.createChildContext(e)}disposeContext(e){this._isDisposed||this._parent.disposeContext(e)}}Cy.registerCommand("setContext",(function(e,t,i){e.get($y).createKey(String(t),i)})),Cy.registerCommand({id:"getContextKeyInfo",handler:()=>[...Uy.all()].sort(((e,t)=>e.key.localeCompare(t.key))),description:{description:mf(0,"A command that returns information about context keys"),args:[]}}),Cy.registerCommand("_generateContextKeyInfo",(function(){const e=[],t=new Set;for(let i of Uy.all())t.has(i.key)||(t.add(i.key),e.push(i));e.sort(((e,t)=>e.key.localeCompare(t.key)))}));class rZ{constructor(e){this.incoming=new Map,this.outgoing=new Map,this.data=e}}class aZ{constructor(e){this._hashFn=e,this._nodes=new Map}roots(){const e=[];for(let t of this._nodes.values())0===t.outgoing.size&&e.push(t);return e}insertEdge(e,t){const i=this.lookupOrInsertNode(e),n=this.lookupOrInsertNode(t);i.outgoing.set(this._hashFn(t),n),n.incoming.set(this._hashFn(e),i)}removeNode(e){const t=this._hashFn(e);this._nodes.delete(t);for(let i of this._nodes.values())i.outgoing.delete(t),i.incoming.delete(t)}lookupOrInsertNode(e){const t=this._hashFn(e);let i=this._nodes.get(t);return i||(i=new rZ(e),this._nodes.set(t,i)),i}isEmpty(){return 0===this._nodes.size}toString(){let e=[];for(let[t,i]of this._nodes)e.push(`${t}, (incoming)[${[...i.incoming.keys()].join(", ")}], (outgoing)[${[...i.outgoing.keys()].join(",")}]`);return e.join("\n")}findCycleSlow(){for(let[e,t]of this._nodes){const i=new Set([e]),n=this._findCycle(t,i);if(n)return n}}_findCycle(e,t){for(let[i,n]of e.outgoing){if(t.has(i))return[...t,i].join(" -> ");t.add(i);const e=this._findCycle(n,t);if(e)return e;t.delete(i)}}}class lZ extends Error{constructor(e){var t;super("cyclic dependency between services"),this.message=null!==(t=e.findCycleSlow())&&void 0!==t?t:`UNABLE to detect cycle, dumping graph: \n${e.toString()}`}}class dZ{constructor(e=new pF,t=!1,i){this._activeInstantiations=new Set,this._services=e,this._strict=t,this._parent=i,this._services.set(k_,this)}createChild(e){return new dZ(e,this._strict,this)}invokeFunction(e,...t){let i=cZ.traceInvocation(e),n=!1;try{return e({get:e=>{if(n)throw qa("service accessor is only valid during the invocation of its target method");const t=this._getOrCreateServiceInstance(e,i);if(!t)throw new Error(`[invokeFunction] unknown service '${e}'`);return t}},...t)}finally{n=!0,i.stop()}}createInstance(e,...t){let i,n;return e instanceof Nv?(i=cZ.traceCreation(e.ctor),n=this._createInstance(e.ctor,e.staticArguments.concat(t),i)):(i=cZ.traceCreation(e),n=this._createInstance(e,t,i)),i.stop(),n}_createInstance(e,t=[],i){let n=S_.getServiceDependencies(e).sort(((e,t)=>e.index-t.index)),o=[];for(const r of n){let t=this._getOrCreateServiceInstance(r.id,i);t||this._throwIfStrict(`[createInstance] ${e.name} depends on UNKNOWN service ${r.id}.`,!1),o.push(t)}let s=n.length>0?n[0].index:t.length;if(t.length!==s){let e=s-t.length;t=e>0?t.concat(new Array(e)):t.slice(0,s)}return new e(...[...t,...o])}_setServiceInstance(e,t){if(this._services.get(e)instanceof Nv)this._services.set(e,t);else{if(!this._parent)throw new Error("illegalState - setting UNKNOWN service instance");this._parent._setServiceInstance(e,t)}}_getServiceInstanceOrDescriptor(e){let t=this._services.get(e);return!t&&this._parent?this._parent._getServiceInstanceOrDescriptor(e):t}_getOrCreateServiceInstance(e,t){let i=this._getServiceInstanceOrDescriptor(e);return i instanceof Nv?this._safeCreateAndCacheServiceInstance(e,i,t.branch(e,!0)):(t.branch(e,!1),i)}_safeCreateAndCacheServiceInstance(e,t,i){if(this._activeInstantiations.has(e))throw new Error(`illegal state - RECURSIVELY instantiating service '${e}'`);this._activeInstantiations.add(e);try{return this._createAndCacheServiceInstance(e,t,i)}finally{this._activeInstantiations.delete(e)}}_createAndCacheServiceInstance(e,t,i){const n=new aZ((e=>e.id.toString()));let o=0;const s=[{id:e,desc:t,_trace:i}];for(;s.length;){const t=s.pop();if(n.lookupOrInsertNode(t),o++>1e3)throw new lZ(n);for(let i of S_.getServiceDependencies(t.desc.ctor)){let o=this._getServiceInstanceOrDescriptor(i.id);if(o||this._throwIfStrict(`[createInstance] ${e} depends on ${i.id} which is NOT registered.`,!0),o instanceof Nv){const e={id:i.id,desc:o,_trace:t._trace.branch(i.id,!0)};n.insertEdge(t,e),s.push(e)}}}for(;;){const e=n.roots();if(0===e.length){if(!n.isEmpty())throw new lZ(n);break}for(const{data:t}of e){if(this._getServiceInstanceOrDescriptor(t.id)instanceof Nv){const e=this._createServiceInstanceWithOwner(t.id,t.desc.ctor,t.desc.staticArguments,t.desc.supportsDelayedInstantiation,t._trace);this._setServiceInstance(t.id,e)}n.removeNode(t)}}return this._getServiceInstanceOrDescriptor(e)}_createServiceInstanceWithOwner(e,t,i=[],n,o){if(this._services.get(e)instanceof Nv)return this._createServiceInstance(t,i,n,o);if(this._parent)return this._parent._createServiceInstanceWithOwner(e,t,i,n,o);throw new Error(`illegalState - creating UNKNOWN service instance ${t.name}`)}_createServiceInstance(e,t=[],i,n){if(i){const i=new cb((()=>this._createInstance(e,t,n)));return new Proxy(Object.create(null),{get(e,t){if(t in e)return e[t];let n=i.value,o=n[t];return"function"!=typeof o||(o=o.bind(n),e[t]=o),o},set:(e,t,n)=>(i.value[t]=n,!0)})}return this._createInstance(e,t,n)}_throwIfStrict(e,t){if(this._strict)throw new Error(e)}}class cZ{constructor(e,t){this.type=e,this.name=t,this._start=Date.now(),this._dep=[]}static traceInvocation(e){return cZ._None}static traceCreation(e){return cZ._None}branch(e,t){let i=new cZ(2,e.toString());return this._dep.push([e,t,i]),i}stop(){let e=Date.now()-this._start;cZ._totals+=e;let t=!1;this.type,this.name,function e(i,n){let o=[],s=new Array(i+1).join("\t");for(const[r,a,l]of n._dep)if(a&&l){t=!0,o.push(`${s}CREATES -> ${r}`);let n=e(i+1,l);n&&o.push(n)}else o.push(`${s}uses -> ${r}`);return o.join("\n")}(1,this),e.toFixed(2),cZ._totals.toFixed(2)}}cZ._None=new class extends cZ{constructor(){super(-1,null)}stop(){}branch(){return this}},cZ._totals=0;class hZ{constructor(){this._byResource=new YV,this._byOwner=new Map}set(e,t,i){let n=this._byResource.get(e);n||(n=new Map,this._byResource.set(e,n)),n.set(t,i);let o=this._byOwner.get(t);o||(o=new YV,this._byOwner.set(t,o)),o.set(e,i)}get(e,t){let i=this._byResource.get(e);return null==i?void 0:i.get(t)}delete(e,t){let i=!1,n=!1,o=this._byResource.get(e);o&&(i=o.delete(t));let s=this._byOwner.get(t);if(s&&(n=s.delete(e)),i!==n)throw new Error("illegal state");return i&&n}values(e){var t,i,n,o;return"string"==typeof e?null!==(i=null===(t=this._byOwner.get(e))||void 0===t?void 0:t.values())&&void 0!==i?i:Hs.empty():Ps.isUri(e)?null!==(o=null===(n=this._byResource.get(e))||void 0===n?void 0:n.values())&&void 0!==o?o:Hs.empty():Hs.map(Hs.concat(...this._byOwner.values()),(e=>e[1]))}}class uZ{constructor(e){this.errors=0,this.infos=0,this.warnings=0,this.unknowns=0,this._data=new YV,this._service=e,this._subscription=e.onMarkerChanged(this._update,this)}dispose(){this._subscription.dispose()}_update(e){for(const t of e){const e=this._data.get(t);e&&this._substract(e);const i=this._resourceStats(t);this._add(i),this._data.set(t,i)}}_resourceStats(e){const t={errors:0,warnings:0,infos:0,unknowns:0};if(e.scheme===Yw.inMemory||e.scheme===Yw.walkThrough||e.scheme===Yw.walkThroughSnippet)return t;for(const{severity:i}of this._service.read({resource:e}))i===uj.Error?t.errors+=1:i===uj.Warning?t.warnings+=1:i===uj.Info?t.infos+=1:t.unknowns+=1;return t}_substract(e){this.errors-=e.errors,this.warnings-=e.warnings,this.infos-=e.infos,this.unknowns-=e.unknowns}_add(e){this.errors+=e.errors,this.warnings+=e.warnings,this.infos+=e.infos,this.unknowns+=e.unknowns}}class gZ{constructor(){this._onMarkerChanged=new Ga({delay:0,merge:gZ._merge}),this.onMarkerChanged=this._onMarkerChanged.event,this._data=new hZ,this._stats=new uZ(this)}dispose(){this._stats.dispose(),this._onMarkerChanged.dispose()}remove(e,t){for(const i of t||[])this.changeOne(e,i,[])}changeOne(e,t,i){if(Za(i)){this._data.delete(t,e)&&this._onMarkerChanged.fire([t])}else{const n=[];for(const o of i){const i=gZ._toMarker(e,t,o);i&&n.push(i)}this._data.set(t,e,n),this._onMarkerChanged.fire([t])}}static _toMarker(e,t,i){let{code:n,severity:o,message:s,source:r,startLineNumber:a,startColumn:l,endLineNumber:d,endColumn:c,relatedInformation:h,tags:u}=i;if(s)return a=a>0?a:1,l=l>0?l:1,d=d>=a?d:a,c=c>0?c:l,{resource:t,owner:e,code:n,severity:o,message:s,source:r,startLineNumber:a,startColumn:l,endLineNumber:d,endColumn:c,relatedInformation:h,tags:u}}read(e=Object.create(null)){let{owner:t,resource:i,severities:n,take:o}=e;if((!o||o<0)&&(o=-1),t&&i){const e=this._data.get(i,t);if(e){const t=[];for(const i of e)if(gZ._accept(i,n)){const e=t.push(i);if(o>0&&e===o)break}return t}return[]}if(t||i){const e=this._data.values(null!=i?i:t),s=[];for(const t of e)for(const e of t)if(gZ._accept(e,n)){const t=s.push(e);if(o>0&&t===o)return s}return s}{const e=[];for(let t of this._data.values())for(let i of t)if(gZ._accept(i,n)){const t=e.push(i);if(o>0&&t===o)return e}return e}}static _accept(e,t){return void 0===t||(t&e.severity)===e.severity}static _merge(e){const t=new YV;for(let i of e)for(let e of i)t.set(e,!0);return Array.from(t.keys())}}var pZ,mZ=globalThis&&globalThis.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{l(n.next(e))}catch(t){s(t)}}function a(e){try{l(n.throw(e))}catch(t){s(t)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}l((n=n.apply(e,t||[])).next())}))};!function(e){e[e.None=0]="None",e[e.Initialized=1]="Initialized",e[e.Closed=2]="Closed"}(pZ||(pZ={}));class fZ extends Uo{constructor(e,t=Object.create(null)){super(),this.database=e,this.options=t,this._onDidChangeStorage=this._register(new $o),this.onDidChangeStorage=this._onDidChangeStorage.event,this.state=pZ.None,this.cache=new Map,this.flushDelayer=new ib(fZ.DEFAULT_FLUSH_DELAY),this.pendingDeletes=new Set,this.pendingInserts=new Map,this.whenFlushedCallbacks=[],this.registerListeners()}registerListeners(){this._register(this.database.onDidChangeItemsExternal((e=>this.onDidChangeItemsExternal(e))))}onDidChangeItemsExternal(e){var t,i;null===(t=e.changed)||void 0===t||t.forEach(((e,t)=>this.accept(t,e))),null===(i=e.deleted)||void 0===i||i.forEach((e=>this.accept(e,void 0)))}accept(e,t){if(this.state===pZ.Closed)return;let i=!1;if(Tr(t))i=this.cache.delete(e);else{this.cache.get(e)!==t&&(this.cache.set(e,t),i=!0)}i&&this._onDidChangeStorage.fire(e)}get(e,t){const i=this.cache.get(e);return Tr(i)?t:i}getBoolean(e,t){const i=this.get(e);return Tr(i)?t:"true"===i}getNumber(e,t){const i=this.get(e);return Tr(i)?t:parseInt(i,10)}set(e,t){return mZ(this,void 0,void 0,(function*(){if(this.state===pZ.Closed)return;if(Tr(t))return this.delete(e);const i=String(t);return this.cache.get(e)!==i?(this.cache.set(e,i),this.pendingInserts.set(e,i),this.pendingDeletes.delete(e),this._onDidChangeStorage.fire(e),this.doFlush()):void 0}))}delete(e){return mZ(this,void 0,void 0,(function*(){if(this.state===pZ.Closed)return;return this.cache.delete(e)?(this.pendingDeletes.has(e)||this.pendingDeletes.add(e),this.pendingInserts.delete(e),this._onDidChangeStorage.fire(e),this.doFlush()):void 0}))}get hasPending(){return this.pendingInserts.size>0||this.pendingDeletes.size>0}flushPending(){return mZ(this,void 0,void 0,(function*(){if(!this.hasPending)return;const e={insert:this.pendingInserts,delete:this.pendingDeletes};return this.pendingDeletes=new Set,this.pendingInserts=new Map,this.database.updateItems(e).finally((()=>{var e;if(!this.hasPending)for(;this.whenFlushedCallbacks.length;)null===(e=this.whenFlushedCallbacks.pop())||void 0===e||e()}))}))}doFlush(e){return mZ(this,void 0,void 0,(function*(){return this.flushDelayer.trigger((()=>this.flushPending()),e)}))}dispose(){this.flushDelayer.dispose(),super.dispose()}}fZ.DEFAULT_FLUSH_DELAY=100;class _Z{constructor(){this.onDidChangeItemsExternal=ds.None,this.items=new Map}updateItems(e){return mZ(this,void 0,void 0,(function*(){e.insert&&e.insert.forEach(((e,t)=>this.items.set(t,e))),e.delete&&e.delete.forEach((e=>this.items.delete(e)))}))}}const vZ="__$__targetStorageMarker",bZ=L_("storageService");var wZ;!function(e){e[e.NONE=0]="NONE",e[e.SHUTDOWN=1]="SHUTDOWN"}(wZ||(wZ={}));class CZ extends Uo{constructor(e={flushInterval:CZ.DEFAULT_FLUSH_INTERVAL}){super(),this.options=e,this._onDidChangeValue=this._register(new Ka),this._onDidChangeTarget=this._register(new Ka),this._onWillSaveState=this._register(new $o),this.onWillSaveState=this._onWillSaveState.event,this._workspaceKeyTargets=void 0,this._globalKeyTargets=void 0}emitDidChangeValue(e,t){t===vZ?(0===e?this._globalKeyTargets=void 0:1===e&&(this._workspaceKeyTargets=void 0),this._onDidChangeTarget.fire({scope:e})):this._onDidChangeValue.fire({scope:e,key:t,target:this.getKeyTargets(e)[t]})}get(e,t,i){var n;return null===(n=this.getStorage(t))||void 0===n?void 0:n.get(e,i)}getBoolean(e,t,i){var n;return null===(n=this.getStorage(t))||void 0===n?void 0:n.getBoolean(e,i)}getNumber(e,t,i){var n;return null===(n=this.getStorage(t))||void 0===n?void 0:n.getNumber(e,i)}store(e,t,i,n){Tr(t)?this.remove(e,i):this.withPausedEmitters((()=>{var o;this.updateKeyTarget(e,i,n),null===(o=this.getStorage(i))||void 0===o||o.set(e,t)}))}remove(e,t){this.withPausedEmitters((()=>{var i;this.updateKeyTarget(e,t,void 0),null===(i=this.getStorage(t))||void 0===i||i.delete(e)}))}withPausedEmitters(e){this._onDidChangeValue.pause(),this._onDidChangeTarget.pause();try{e()}finally{this._onDidChangeValue.resume(),this._onDidChangeTarget.resume()}}updateKeyTarget(e,t,i){var n,o;const s=this.getKeyTargets(t);"number"==typeof i?s[e]!==i&&(s[e]=i,null===(n=this.getStorage(t))||void 0===n||n.set(vZ,JSON.stringify(s))):"number"==typeof s[e]&&(delete s[e],null===(o=this.getStorage(t))||void 0===o||o.set(vZ,JSON.stringify(s)))}get workspaceKeyTargets(){return this._workspaceKeyTargets||(this._workspaceKeyTargets=this.loadKeyTargets(1)),this._workspaceKeyTargets}get globalKeyTargets(){return this._globalKeyTargets||(this._globalKeyTargets=this.loadKeyTargets(0)),this._globalKeyTargets}getKeyTargets(e){return 0===e?this.globalKeyTargets:this.workspaceKeyTargets}loadKeyTargets(e){const t=this.get(vZ,e);if(t)try{return JSON.parse(t)}catch(i){}return Object.create(null)}}CZ.DEFAULT_FLUSH_INTERVAL=6e4;function yZ(e,t,i,n,o){if(Array.isArray(e)){let s=0;for(const r of e){const e=yZ(r,t,i,n,o);if(10===e)return e;e>s&&(s=e)}return s}if("string"==typeof e)return n?"*"===e?5:e===i?10:0:0;if(e){const{language:l,pattern:d,scheme:c,hasAccessToAllModels:h,notebookType:u}=e;if(!n&&!h)return 0;let g=0;if(c)if(c===t.scheme)g=10;else{if("*"!==c)return 0;g=5}if(l)if(l===i)g=10;else{if("*"!==l)return 0;g=Math.max(g,5)}if(u)if(u===o)g=10;else{if("*"!==u)return 0;g=Math.max(g,5)}if(d){let e;if(e="string"==typeof d?d:Object.assign(Object.assign({},d),{base:Vr(d.base)}),e!==t.fsPath&&(s=e,r=t.fsPath,!s||"string"!=typeof r||!Dz(s)(r,void 0,a)))return 0;g=10}return g}return 0;var s,r,a}function xZ(e){return"string"!=typeof e&&(Array.isArray(e)?e.every(xZ):!!e.exclusive)}class SZ{constructor(e){this._notebookTypeResolver=e,this._clock=0,this._entries=[],this._onDidChange=new $o,this.onDidChange=this._onDidChange.event}register(e,t){let i={selector:e,provider:t,_score:-1,_time:this._clock++};return this._entries.push(i),this._lastCandidate=void 0,this._onDidChange.fire(this._entries.length),es((()=>{if(i){const e=this._entries.indexOf(i);e>=0&&(this._entries.splice(e,1),this._lastCandidate=void 0,this._onDidChange.fire(this._entries.length),i=void 0)}}))}has(e){return this.all(e).length>0}all(e){if(!e)return[];this._updateScores(e);const t=[];for(let i of this._entries)i._score>0&&t.push(i.provider);return t}ordered(e){const t=[];return this._orderedForEach(e,(e=>t.push(e.provider))),t}orderedGroups(e){const t=[];let i,n;return this._orderedForEach(e,(e=>{i&&n===e._score?i.push(e.provider):(n=e._score,i=[e.provider],t.push(i))})),t}_orderedForEach(e,t){if(e){this._updateScores(e);for(const e of this._entries)e._score>0&&t(e)}}_updateScores(e){var t;const i=null===(t=this._notebookTypeResolver)||void 0===t?void 0:t.call(this,e.uri),n={uri:e.uri.toString(),language:e.getLanguageId(),notebookType:i};if(!this._lastCandidate||this._lastCandidate.language!==n.language||this._lastCandidate.uri!==n.uri||this._lastCandidate.notebookType!==n.notebookType){this._lastCandidate=n;for(let t of this._entries)if(t._score=yZ(t.selector,e.uri,e.getLanguageId(),Ya(e),i),xZ(t.selector)&&t._score>0){for(let e of this._entries)e._score=0;t._score=1e3;break}this._entries.sort(SZ._compareByScoreAndTime)}}static _compareByScoreAndTime(e,t){return e._score<t._score?1:e._score>t._score?-1:e._time<t._time?1:e._time>t._time?-1:0}}Iv(Lb,class{constructor(){this.referenceProvider=new SZ(this._score.bind(this)),this.renameProvider=new SZ(this._score.bind(this)),this.codeActionProvider=new SZ(this._score.bind(this)),this.definitionProvider=new SZ(this._score.bind(this)),this.typeDefinitionProvider=new SZ(this._score.bind(this)),this.declarationProvider=new SZ(this._score.bind(this)),this.implementationProvider=new SZ(this._score.bind(this)),this.documentSymbolProvider=new SZ(this._score.bind(this)),this.inlayHintsProvider=new SZ(this._score.bind(this)),this.colorProvider=new SZ(this._score.bind(this)),this.codeLensProvider=new SZ(this._score.bind(this)),this.documentFormattingEditProvider=new SZ(this._score.bind(this)),this.documentRangeFormattingEditProvider=new SZ(this._score.bind(this)),this.onTypeFormattingEditProvider=new SZ(this._score.bind(this)),this.signatureHelpProvider=new SZ(this._score.bind(this)),this.hoverProvider=new SZ(this._score.bind(this)),this.documentHighlightProvider=new SZ(this._score.bind(this)),this.selectionRangeProvider=new SZ(this._score.bind(this)),this.foldingRangeProvider=new SZ(this._score.bind(this)),this.linkProvider=new SZ(this._score.bind(this)),this.inlineCompletionsProvider=new SZ(this._score.bind(this)),this.completionProvider=new SZ(this._score.bind(this)),this.linkedEditingRangeProvider=new SZ(this._score.bind(this)),this.documentRangeSemanticTokensProvider=new SZ(this._score.bind(this)),this.documentSemanticTokensProvider=new SZ(this._score.bind(this))}_score(e){var t;return null===(t=this._notebookTypeResolver)||void 0===t?void 0:t.call(this,e)}},!0);var kZ=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},DZ=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}},LZ=globalThis&&globalThis.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{l(n.next(e))}catch(t){s(t)}}function a(e){try{l(n.throw(e))}catch(t){s(t)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}l((n=n.apply(e,t||[])).next())}))};class NZ{constructor(e){this.disposed=!1,this.model=e,this._onWillDispose=new $o}get textEditorModel(){return this.model}dispose(){this.disposed=!0,this._onWillDispose.fire()}}let EZ=class{constructor(e){this.modelService=e}createModelReference(e){const t=this.modelService.getModel(e);return t?Promise.resolve(new Xa(new NZ(t))):Promise.reject(new Error("Model not found"))}};EZ=kZ([DZ(0,Gv)],EZ);class IZ{show(){return IZ.NULL_PROGRESS_RUNNER}showWhile(e,t){return LZ(this,void 0,void 0,(function*(){yield e}))}}IZ.NULL_PROGRESS_RUNNER={done:()=>{},total:()=>{},worked:()=>{}};class TZ{info(e){return this.notify({severity:fF.Info,message:e})}warn(e){return this.notify({severity:fF.Warning,message:e})}error(e){return this.notify({severity:fF.Error,message:e})}notify(e){switch(e.severity){case fF.Error:case fF.Warning:}return TZ.NO_OP}status(e,t){return Uo.None}}TZ.NO_OP=new class{};let MZ=class{constructor(e){this._onWillExecuteCommand=new $o,this._onDidExecuteCommand=new $o,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this._instantiationService=e}executeCommand(e,...t){const i=Cy.getCommand(e);if(!i)return Promise.reject(new Error(`command '${e}' not found`));try{this._onWillExecuteCommand.fire({commandId:e,args:t});const n=this._instantiationService.invokeFunction.apply(this._instantiationService,[i.handler,...t]);return this._onDidExecuteCommand.fire({commandId:e,args:t}),Promise.resolve(n)}catch(n){return Promise.reject(n)}}};MZ=kZ([DZ(0,k_)],MZ);let AZ=class extends xW{constructor(e,t,i,n,o,s){super(e,t,i,n,o),this._cachedResolver=null,this._dynamicKeybindings=[],this._domNodeListeners=[];const r=e=>{const t=new ws;t.add(nC(e,zC.KEY_DOWN,(e=>{const t=new jw(e);this._dispatch(t,t.target)&&(t.preventDefault(),t.stopPropagation())}))),t.add(nC(e,zC.KEY_UP,(e=>{const t=new jw(e);this._singleModifierDispatch(t,t.target)&&t.preventDefault()}))),this._domNodeListeners.push(new OZ(e,t))},a=e=>{for(let t=0;t<this._domNodeListeners.length;t++){const i=this._domNodeListeners[t];i.domNode===e&&(this._domNodeListeners.splice(t,1),i.dispose())}},l=e=>{e.getOption(54)||r(e.getContainerDomNode())};this._register(s.onCodeEditorAdd(l)),this._register(s.onCodeEditorRemove((e=>{e.getOption(54)||a(e.getContainerDomNode())}))),s.listCodeEditors().forEach(l);const d=e=>{r(e.getContainerDomNode())};this._register(s.onDiffEditorAdd(d)),this._register(s.onDiffEditorRemove((e=>{a(e.getContainerDomNode())}))),s.listDiffEditors().forEach(d)}addDynamicKeybinding(e,t,i,n){const o=Pw(t,Xs),s=new ws;return o&&(this._dynamicKeybindings.push({keybinding:o.parts,command:e,when:n,weight1:1e3,weight2:0,extensionId:null,isBuiltinExtension:!1}),s.add(es((()=>{for(let t=0;t<this._dynamicKeybindings.length;t++){if(this._dynamicKeybindings[t].command===e)return this._dynamicKeybindings.splice(t,1),void this.updateResolver({source:1})}})))),s.add(Cy.registerCommand(e,i)),this.updateResolver({source:1}),s}updateResolver(e){this._cachedResolver=null,this._onDidUpdateKeybindings.fire(e)}_getResolver(){if(!this._cachedResolver){const e=this._toNormalizedKeybindingItems(fx.getDefaultKeybindings(),!0),t=this._toNormalizedKeybindingItems(this._dynamicKeybindings,!1);this._cachedResolver=new DW(e,t,(e=>this._log(e)))}return this._cachedResolver}_documentHasFocus(){return document.hasFocus()}_toNormalizedKeybindingItems(e,t){const i=[];let n=0;for(const o of e){const e=o.when||void 0,s=o.keybinding;if(s){const r=PW.resolveUserBinding(s,Xs);for(const s of r)i[n++]=new EW(s,o.command,o.commandArgs,e,t,null,!1)}else i[n++]=new EW(void 0,o.command,o.commandArgs,e,t,null,!1)}return i}resolveKeyboardEvent(e){const t=new Bw(e.ctrlKey,e.shiftKey,e.altKey,e.metaKey,e.keyCode).toChord();return new PW(t,Xs)}};AZ=kZ([DZ(0,$y),DZ(1,wy),DZ(2,vx),DZ(3,vF),DZ(4,Cb),DZ(5,N_)],AZ);class OZ extends Uo{constructor(e,t){super(),this.domNode=e,this._register(t)}}function RZ(e){return e&&"object"==typeof e&&(!e.overrideIdentifier||"string"==typeof e.overrideIdentifier)&&(!e.resource||e.resource instanceof Ps)}class PZ{constructor(){this._onDidChangeConfiguration=new $o,this.onDidChangeConfiguration=this._onDidChangeConfiguration.event,this._configuration=new wW(new bW,new vW)}getValue(e,t){const i="string"==typeof e?e:void 0,n=RZ(e)?e:RZ(t)?t:{};return this._configuration.getValue(i,n,void 0)}updateValues(e){const t={data:this._configuration.toData()},i=[];for(const n of e){const[e,t]=n;this.getValue(e)!==t&&(this._configuration.updateValue(e,t),i.push(e))}if(i.length>0){const e=new CW({keys:i,overrides:[]},t,this._configuration);e.source=7,e.sourceConfig=null,this._onDidChangeConfiguration.fire(e)}return Promise.resolve()}updateValue(e,t,i,n){return this.updateValues([[e,t]])}inspect(e,t={}){return this._configuration.inspect(e,t,void 0)}}let FZ=class{constructor(e){this.configurationService=e,this._onDidChangeConfiguration=new $o,this.configurationService.onDidChangeConfiguration((e=>{this._onDidChangeConfiguration.fire({affectedKeys:e.affectedKeys,affectsConfiguration:(t,i)=>e.affectsConfiguration(i)})}))}getValue(e,t,i){const n=(er.isIPosition(t)?t:null)?"string"==typeof i?i:void 0:"string"==typeof t?t:void 0;return void 0===n?this.configurationService.getValue():this.configurationService.getValue(n)}};FZ=kZ([DZ(0,Cv)],FZ);let BZ=class{constructor(e){this.configurationService=e}getEOL(e,t){const i=this.configurationService.getValue("files.eol",{overrideIdentifier:t,resource:e});return i&&"string"==typeof i&&"auto"!==i?i:Vo||zo?"\n":"\r\n"}};BZ=kZ([DZ(0,Cv)],BZ);class VZ{constructor(){const e=Ps.from({scheme:VZ.SCHEME,authority:"model",path:"/"});this.workspace={id:"4064f6ec-cb38-4ad0-af64-ee6467e63c82",folders:[new WW({uri:e,name:"",index:0})]}}getWorkspace(){return this.workspace}}function WZ(e,t,i){if(!t)return;if(!(e instanceof PZ))return;const n=[];Object.keys(t).forEach((e=>{(function(e){return fW()[`editor.${e}`]||!1})(e)&&n.push([`editor.${e}`,t[e]]),i&&function(e){return fW()[`diffEditor.${e}`]||!1}(e)&&n.push([`diffEditor.${e}`,t[e]])})),n.length>0&&e.updateValues(n)}VZ.SCHEME="inmemory";let zZ=class{constructor(e){this._modelService=e}hasPreviewHandler(){return!1}apply(e,t){return LZ(this,void 0,void 0,(function*(){const t=new Map;for(let o of e){if(!(o instanceof cW))throw new Error("bad edit - only text edits are supported");const e=this._modelService.getModel(o.resource);if(!e)throw new Error("bad edit - model not found");if("number"==typeof o.versionId&&e.getVersionId()!==o.versionId)throw new Error("bad state - model changed in the meantime");let i=t.get(e);i||(i=[],t.set(e,i)),i.push(_W.replaceMove(qo.lift(o.textEdit.range),o.textEdit.text))}let i=0,n=0;for(const[e,o]of t)e.pushStackElement(),e.pushEditOperations([],o,(()=>[])),e.pushStackElement(),n+=1,i+=o.length;return{ariaSummary:Aa(YW.bulkEditServiceSummary,i,n)}}))}};zZ=kZ([DZ(0,Gv)],zZ);let HZ=class extends sz{constructor(e,t){super(e),this._codeEditorService=t}showContextView(e,t,i){if(!t){const e=this._codeEditorService.getFocusedCodeEditor()||this._codeEditorService.getActiveCodeEditor();e&&(t=e.getContainerDomNode())}return super.showContextView(e,t,i)}};HZ=kZ([DZ(0,CV),DZ(1,N_)],HZ);let jZ=class extends XH{constructor(e,t,i,n,o){super(e,t,i,n,o),this.configure({blockMouse:!1})}};var UZ;jZ=kZ([DZ(0,vx),DZ(1,vF),DZ(2,VB),DZ(3,kW),DZ(4,Qy)],jZ),Iv(Cv,PZ),Iv(bb,FZ),Iv(wb,BZ),Iv(BW,VZ),Iv(FW,class{getUriLabel(e,t){return"file"===e.scheme?e.fsPath:e.path}}),Iv(vx,class{publicLog(e,t){return Promise.resolve(void 0)}publicLog2(e,t){return this.publicLog(e,t)}}),Iv(DV,class{confirm(e){return this.doConfirm(e).then((e=>({confirmed:e,checkboxChecked:!1})))}doConfirm(e){let t=e.message;return e.detail&&(t=t+"\n\n"+e.detail),Promise.resolve(window.confirm(t))}show(e,t,i,n){return Promise.resolve({choice:0})}}),Iv(vF,TZ),Iv(pj,gZ),Iv(Lv,class extends Bz{constructor(){super()}}),Iv(RG,class extends Uo{constructor(){super(),this._onColorThemeChange=this._register(new $o),this.onDidColorThemeChange=this._onColorThemeChange.event,this._onProductIconThemeChange=this._register(new $o),this.onDidProductIconThemeChange=this._onProductIconThemeChange.event,this._environment=Object.create(null),this._builtInProductIconTheme=new kG,this._autoDetectHighContrast=!0,this._knownThemes=new Map,this._knownThemes.set(DG,OG(DG)),this._knownThemes.set(LG,OG(LG)),this._knownThemes.set(NG,OG(NG));const e=function(e){const t=new $o,i=yB();return i.onDidChange((()=>t.fire())),null==e||e.onDidProductIconThemeChange((()=>t.fire())),{onDidChange:t.event,getCSS(){const t=e?e.getProductIconTheme():new kG,n={},o=e=>{const i=t.getIcon(e);if(!i)return;const o=i.font;return o?(n[o.id]=o.definition,`.codicon-${e.id}:before { content: '${i.fontCharacter}'; font-family: ${iy(o.id)}; }`):`.codicon-${e.id}:before { content: '${i.fontCharacter}'; }`},s=[];for(let e of i.getIcons()){const t=o(e);t&&s.push(t)}for(let e in n){const t=n[e],i=t.weight?`font-weight: ${t.weight};`:"",o=t.style?`font-style: ${t.style};`:"",r=t.src.map((e=>`${ty(e.location)} format('${e.format}')`)).join(", ");s.push(`@font-face { src: ${r}; font-family: ${iy(e)};${i}${o} font-display: block; }`)}return s.join("\n")}}}(this);var t,i;this._codiconCSS=e.getCSS(),this._themeCSS="",this._allCSS=`${this._codiconCSS}\n${this._themeCSS}`,this._globalStyleElement=null,this._styleElements=[],this._colorMapOverride=null,this.setTheme(DG),e.onDidChange((()=>{this._codiconCSS=e.getCSS(),this._updateCSS()})),t="(forced-colors: active)",i=()=>{this._updateActualTheme()},window.matchMedia(t).addEventListener("change",i)}registerEditorContainer(e){return MC(e)?this._registerShadowDomContainer(e):this._registerRegularEditorContainer()}_registerRegularEditorContainer(){return this._globalStyleElement||(this._globalStyleElement=RC(),this._globalStyleElement.className="monaco-colors",this._globalStyleElement.textContent=this._allCSS,this._styleElements.push(this._globalStyleElement)),Uo.None}_registerShadowDomContainer(e){const t=RC(e);return t.className="monaco-colors",t.textContent=this._allCSS,this._styleElements.push(t),{dispose:()=>{for(let e=0;e<this._styleElements.length;e++)if(this._styleElements[e]===t)return void this._styleElements.splice(e,1)}}}defineTheme(e,t){if(!/^[a-z0-9\-]+$/i.test(e))throw new Error("Illegal theme name!");if(!MG(t.base)&&!MG(e))throw new Error("Illegal theme base!");this._knownThemes.set(e,new TG(e,t)),MG(e)&&this._knownThemes.forEach((t=>{t.base===e&&t.notifyBaseUpdated()})),this._theme.themeName===e&&this.setTheme(e)}getColorTheme(){return this._theme}setColorMapOverride(e){this._colorMapOverride=e,this._updateThemeOrColorMap()}setTheme(e){let t;t=this._knownThemes.has(e)?this._knownThemes.get(e):this._knownThemes.get(DG),this._desiredTheme=t,this._updateActualTheme()}_updateActualTheme(){const e=this._autoDetectHighContrast&&window.matchMedia("(forced-colors: active)").matches?this._knownThemes.get(NG):this._desiredTheme;this._theme!==e&&(this._theme=e,this._updateThemeOrColorMap())}setAutoDetectHighContrast(e){this._autoDetectHighContrast=e,this._updateActualTheme()}_updateThemeOrColorMap(){const e=[],t={},i={addRule:i=>{t[i]||(e.push(i),t[i]=!0)}};IG.getThemingParticipants().forEach((e=>e(this._theme,i,this._environment)));const n=[];for(const s of EG.getColors()){const e=this._theme.getColor(s.id,!0);e&&n.push(`${pS(s.id)}: ${e.toString()};`)}i.addRule(`.monaco-editor { ${n.join("\n")} }`);const o=this._colorMapOverride||this._theme.tokenTheme.getColorMap();i.addRule(function(e){const t=[];for(let i=1,n=e.length;i<n;i++){const n=e[i];t[i]=`.mtk${i} { color: ${n}; }`}return t.push(".mtki { font-style: italic; }"),t.push(".mtkb { font-weight: bold; }"),t.push(".mtku { text-decoration: underline; text-underline-position: under; }"),t.push(".mtks { text-decoration: line-through; }"),t.push(".mtks.mtku { text-decoration: underline line-through; text-underline-position: under; }"),t.join("\n")}(o)),this._themeCSS=e.join("\n"),this._updateCSS(),Ns.setColorMap(o),this._onColorThemeChange.fire(this._theme)}_updateCSS(){this._allCSS=`${this._codiconCSS}\n${this._themeCSS}`,this._styleElements.forEach((e=>e.textContent=this._allCSS))}getFileIconTheme(){return{hasFileIcons:!1,hasFolderIcons:!1,hidesExplorerArrows:!1}}getProductIconTheme(){return this._builtInProductIconTheme}}),Iv(Cb,class extends Db{constructor(){super(new kb)}}),Iv(Gv,$j),Iv(uy,vj),Iv($y,oZ),Iv($B,IZ),Iv(bZ,class extends CZ{constructor(){super(),this.globalStorage=this._register(new fZ(new _Z)),this.workspaceStorage=this._register(new fZ(new _Z)),this._register(this.workspaceStorage.onDidChangeStorage((e=>this.emitDidChangeValue(1,e)))),this._register(this.globalStorage.onDidChangeStorage((e=>this.emitDidChangeValue(0,e))))}getStorage(e){return 0===e?this.globalStorage:this.workspaceStorage}}),Iv(BB,Ab),Iv(lW,zZ),Iv(XW,class{constructor(){this._neverEmitter=new $o,this.onDidChangeTrust=this._neverEmitter.event}isWorkspaceTrusted(){return!0}}),Iv(gy,EZ),Iv($x,BG),Iv(cq,hq),Iv(wy,MZ),Iv(kW,AZ),Iv(iG,uG),Iv(VB,HZ),Iv(ij,hj),Iv(jB,KG),Iv(WB,jZ),Iv(hx,zG),function(e){const t=new pF;for(const[o,s]of Tv())t.set(o,s);const i=new dZ(t,!0);t.set(k_,i),e.get=function(e){const n=t.get(e);if(!n)throw new Error("Missing service "+e);return n instanceof Nv?i.invokeFunction((t=>t.get(e))):n};let n=!1;e.initialize=function(e){if(n)return i;n=!0;for(const[i,n]of Tv())t.get(i)||t.set(i,n);for(const i in e)if(e.hasOwnProperty(i)){const n=L_(i);t.get(n)instanceof Nv&&t.set(n,e[i])}return i}}(UZ||(UZ={}));var $Z=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},KZ=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};let qZ=0,GZ=!1;function ZZ(e){if(!e){if(GZ)return;GZ=!0}!function(e){oy=document.createElement("div"),oy.className="monaco-aria-container";const t=()=>{const e=document.createElement("div");return e.className="monaco-alert",e.setAttribute("role","alert"),e.setAttribute("aria-atomic","true"),oy.appendChild(e),e};sy=t(),ry=t();const i=()=>{const e=document.createElement("div");return e.className="monaco-status",e.setAttribute("role","complementary"),e.setAttribute("aria-live","polite"),e.setAttribute("aria-atomic","true"),oy.appendChild(e),e};ay=i(),ly=i(),e.appendChild(oy)}(e||document.body)}let YZ=class extends UF{constructor(e,t,i,n,o,s,r,a,l,d,c,h){const u=Object.assign({},t);u.ariaLabel=u.ariaLabel||GW.editorViewAccessibleLabel,u.ariaLabel=u.ariaLabel+";"+GW.accessibilityHelpMessage,super(e,u,{},i,n,o,s,a,l,d,c,h),this._standaloneKeybindingService=r instanceof AZ?r:null,ZZ(u.ariaContainerElement)}addCommand(e,t,i){if(!this._standaloneKeybindingService)return null;const n="DYNAMIC_"+ ++qZ,o=Sy.deserialize(i);return this._standaloneKeybindingService.addDynamicKeybinding(n,e,t,o),n}createContextKey(e,t){return this._contextKeyService.createKey(e,t)}addAction(e){if("string"!=typeof e.id||"string"!=typeof e.label||"function"!=typeof e.run)throw new Error("Invalid action descriptor, `id`, `label` and `run` are required properties!");if(!this._standaloneKeybindingService)return Uo.None;const t=e.id,i=e.label,n=Sy.and(Sy.equals("editorId",this.getId()),Sy.deserialize(e.precondition)),o=e.keybindings,s=Sy.and(n,Sy.deserialize(e.keybindingContext)),r=e.contextMenuGroupId||null,a=e.contextMenuOrder||0,l=(t,...i)=>Promise.resolve(e.run(this,...i)),d=new ws,c=this.getId()+":"+t;if(d.add(Cy.registerCommand(c,l)),r){const e={command:{id:c,title:i},when:n,group:r,order:a};d.add(ux.appendMenuItem(cx.EditorContext,e))}if(Array.isArray(o))for(const u of o)d.add(this._standaloneKeybindingService.addDynamicKeybinding(c,u,l,s));const h=new dA(c,i,i,n,l,this._contextKeyService);return this._actions[t]=h,d.add(es((()=>{delete this._actions[t]}))),d}_triggerCommand(e,t){if(this._codeEditorService instanceof wV)try{this._codeEditorService.setActiveCodeEditor(this),super._triggerCommand(e,t)}finally{this._codeEditorService.setActiveCodeEditor(null)}else super._triggerCommand(e,t)}};YZ=$Z([KZ(2,k_),KZ(3,N_),KZ(4,wy),KZ(5,$y),KZ(6,kW),KZ(7,Qy),KZ(8,vF),KZ(9,$x),KZ(10,Rv),KZ(11,Lb)],YZ);let XZ=class extends YZ{constructor(e,t,i,n,o,s,r,a,l,d,c,h,u,g,p){const m=Object.assign({},t);WZ(d,m,!1);const f=a.registerEditorContainer(e);"string"==typeof m.theme&&a.setTheme(m.theme),void 0!==m.autoDetectHighContrast&&a.setAutoDetectHighContrast(Boolean(m.autoDetectHighContrast));const _=m.model;let v;if(delete m.model,super(e,m,i,n,o,s,r,a,l,c,g,p),this._configurationService=d,this._standaloneThemeService=a,this._register(f),void 0===_){const e=u.getLanguageIdByMimeType(m.language)||m.language||LA;v=JZ(h,u,m.value||"",e,void 0),this._ownsModel=!0}else v=_,this._ownsModel=!1;if(this._attachModel(v),v){const e={oldModelUrl:null,newModelUrl:v.uri};this._onDidChangeModel.fire(e)}}dispose(){super.dispose()}updateOptions(e){WZ(this._configurationService,e,!1),"string"==typeof e.theme&&this._standaloneThemeService.setTheme(e.theme),void 0!==e.autoDetectHighContrast&&this._standaloneThemeService.setAutoDetectHighContrast(Boolean(e.autoDetectHighContrast)),super.updateOptions(e)}_postDetachModelCleanup(e){super._postDetachModelCleanup(e),e&&this._ownsModel&&(e.dispose(),this._ownsModel=!1)}};XZ=$Z([KZ(2,k_),KZ(3,N_),KZ(4,wy),KZ(5,$y),KZ(6,kW),KZ(7,RG),KZ(8,vF),KZ(9,Cv),KZ(10,$x),KZ(11,Gv),KZ(12,Lv),KZ(13,Rv),KZ(14,Lb)],XZ);let QZ=class extends eV{constructor(e,t,i,n,o,s,r,a,l,d,c,h){const u=Object.assign({},t);WZ(l,u,!0);const g=r.registerEditorContainer(e);"string"==typeof u.theme&&r.setTheme(u.theme),void 0!==u.autoDetectHighContrast&&r.setAutoDetectHighContrast(Boolean(u.autoDetectHighContrast)),super(e,u,{},h,o,n,i,s,r,a,d,c),this._configurationService=l,this._standaloneThemeService=r,this._register(g)}dispose(){super.dispose()}updateOptions(e){WZ(this._configurationService,e,!0),"string"==typeof e.theme&&this._standaloneThemeService.setTheme(e.theme),void 0!==e.autoDetectHighContrast&&this._standaloneThemeService.setAutoDetectHighContrast(Boolean(e.autoDetectHighContrast)),super.updateOptions(e)}_createInnerEditor(e,t,i){return e.createInstance(YZ,t,i)}getOriginalEditor(){return super.getOriginalEditor()}getModifiedEditor(){return super.getModifiedEditor()}addCommand(e,t,i){return this.getModifiedEditor().addCommand(e,t,i)}createContextKey(e,t){return this.getModifiedEditor().createContextKey(e,t)}addAction(e){return this.getModifiedEditor().addAction(e)}};function JZ(e,t,i,n,o){if(i=i||"",!n){const n=i.indexOf("\n");let s=i;return-1!==n&&(s=i.substring(0,n)),eY(e,i,t.createByFilepathOrFirstLine(o||null,s),o)}return eY(e,i,t.createById(n),o)}function eY(e,t,i,n){return e.createModel(t,i,n)}function tY(e,t,i){return UZ.initialize(i||{}).createInstance(XZ,e,t)}function iY(e){return UZ.get(N_).onCodeEditorAdd((t=>{e(t)}))}function nY(e,t,i){return UZ.initialize(i||{}).createInstance(QZ,e,t)}function oY(e,t){return new T_(e,t)}function sY(e,t,i){const n=UZ.get(Lv),o=n.getLanguageIdByMimeType(t)||t;return JZ(UZ.get(Gv),n,e,o,i)}function rY(e,t){const i=UZ.get(Lv);UZ.get(Gv).setMode(e,i.createById(t))}function aY(e,t,i){if(e){UZ.get(pj).changeOne(t,e.uri,i)}}function lY(e){return UZ.get(pj).read(e)}function dY(e){return UZ.get(pj).onMarkerChanged(e)}function cY(e){return UZ.get(Gv).getModel(e)}function hY(){return UZ.get(Gv).getModels()}function uY(e){return UZ.get(Gv).onModelAdded(e)}function gY(e){return UZ.get(Gv).onModelRemoved(e)}function pY(e){return UZ.get(Gv).onModelLanguageChanged((t=>{e({model:t.model,oldLanguage:t.oldLanguageId})}))}function mY(e){return function(e,t,i){return new Wb(e,t,i)}(UZ.get(Gv),UZ.get(Rv),e)}function fY(e,t){const i=UZ.get(Lv),n=UZ.get(RG);return n.registerEditorContainer(e),Aw.colorizeElement(n,i,e,t)}function _Y(e,t,i){const n=UZ.get(Lv);return UZ.get(RG).registerEditorContainer(document.body),Aw.colorize(n,e,t,i)}function vY(e,t,i=4){return UZ.get(RG).registerEditorContainer(document.body),Aw.colorizeModelLine(e,t,i)}function bY(e,t){Ns.getOrCreate(t);const i=function(e){return Ns.get(e)||{getInitialState:()=>$v,tokenize:(t,i,n)=>Kv(e,n)}}(t),n=Is(e),o=[];let s=i.getInitialState();for(let r=0,a=n.length;r<a;r++){const e=n[r],t=i.tokenize(e,!0,s);o[r]=t.tokens,s=t.endState}return o}function wY(e,t){UZ.get(RG).defineTheme(e,t)}function CY(e){UZ.get(RG).setTheme(e)}function yY(){x_.clearAllFontInfos()}function xY(e,t){return Cy.registerCommand({id:e,handler:t})}function SY(e,t){return"boolean"==typeof e?e:t}function kY(e,t){return"string"==typeof e?e:t}function DY(e,t=!1){t&&(e=e.map((function(e){return e.toLowerCase()})));const i=function(e){const t={};for(const i of e)t[i]=!0;return t}(e);return t?function(e){return void 0!==i[e.toLowerCase()]&&i.hasOwnProperty(e.toLowerCase())}:function(e){return void 0!==i[e]&&i.hasOwnProperty(e)}}function LY(e,t){t=t.replace(/@@/g,"");let i,n=0;do{i=!1,t=t.replace(/@(\w+)/g,(function(n,o){i=!0;let s="";if("string"==typeof e[o])s=e[o];else{if(!(e[o]&&e[o]instanceof RegExp))throw void 0===e[o]?vw(e,"language definition does not contain attribute '"+o+"', used at: "+t):vw(e,"attribute reference '"+o+"' must be a string, used at: "+t);s=e[o].source}return mw(s)?"":"(?:"+s+")"})),n++}while(i&&n<5);t=t.replace(/\x01/g,"@");const o=(e.ignoreCase?"i":"")+(e.unicode?"u":"");return new RegExp(t,o)}function NY(e,t,i,n){let o=-1,s=i,r=i.match(/^\$(([sS]?)(\d\d?)|#)(.*)$/);r&&(r[3]&&(o=parseInt(r[3]),r[2]&&(o+=100)),s=r[4]);let a,l="~",d=s;if(s&&0!==s.length?/^\w*$/.test(d)?l="==":(r=s.match(/^(@|!@|~|!~|==|!=)(.*)$/),r&&(l=r[1],d=r[2])):(l="!=",d=""),"~"!==l&&"!~"!==l||!/^(\w|\|)*$/.test(d))if("@"===l||"!@"===l){const i=e[d];if(!i)throw vw(e,"the @ match target '"+d+"' is not defined, in rule: "+t);if(!function(e,t){if(!t)return!1;if(!Array.isArray(t))return!1;for(const i of t)if(!e(i))return!1;return!0}((function(e){return"string"==typeof e}),i))throw vw(e,"the @ match target '"+d+"' must be an array of strings, in rule: "+t);const n=DY(i,e.ignoreCase);a=function(e){return"@"===l?n(e):!n(e)}}else if("~"===l||"!~"===l)if(d.indexOf("$")<0){const t=LY(e,"^"+d+"$");a=function(e){return"~"===l?t.test(e):!t.test(e)}}else a=function(t,i,n,o){return LY(e,"^"+bw(e,d,i,n,o)+"$").test(t)};else if(d.indexOf("$")<0){const t=fw(e,d);a=function(e){return"=="===l?e===t:e!==t}}else{const t=fw(e,d);a=function(i,n,o,s,r){const a=bw(e,t,n,o,s);return"=="===l?i===a:i!==a}}else{const t=DY(d.split("|"),e.ignoreCase);a=function(e){return"~"===l?t(e):!t(e)}}return-1===o?{name:i,value:n,test:function(e,t,i,n){return a(e,e,t,i,n)}}:{name:i,value:n,test:function(e,t,i,n){const s=function(e,t,i,n){if(n<0)return e;if(n<t.length)return t[n];if(n>=100){n-=100;const e=i.split(".");if(e.unshift(i),n<e.length)return e[n]}return null}(e,t,i,o);return a(s||"",e,t,i,n)}}}function EY(e,t,i){if(i){if("string"==typeof i)return i;if(i.token||""===i.token){if("string"!=typeof i.token)throw vw(e,"a 'token' attribute must be of type string, in rule: "+t);{const n={token:i.token};if(i.token.indexOf("$")>=0&&(n.tokenSubst=!0),"string"==typeof i.bracket)if("@open"===i.bracket)n.bracket=1;else{if("@close"!==i.bracket)throw vw(e,"a 'bracket' attribute must be either '@open' or '@close', in rule: "+t);n.bracket=-1}if(i.next){if("string"!=typeof i.next)throw vw(e,"the next state must be a string value in rule: "+t);{let o=i.next;if(!/^(@pop|@push|@popall)$/.test(o)&&("@"===o[0]&&(o=o.substr(1)),o.indexOf("$")<0&&!function(e,t){let i=t;for(;i&&i.length>0;){if(e.stateNames[i])return!0;const t=i.lastIndexOf(".");i=t<0?null:i.substr(0,t)}return!1}(e,bw(e,o,"",[],""))))throw vw(e,"the next state '"+i.next+"' is not defined in rule: "+t);n.next=o}}return"number"==typeof i.goBack&&(n.goBack=i.goBack),"string"==typeof i.switchTo&&(n.switchTo=i.switchTo),"string"==typeof i.log&&(n.log=i.log),"string"==typeof i.nextEmbedded&&(n.nextEmbedded=i.nextEmbedded,e.usesEmbedded=!0),n}}if(Array.isArray(i)){const n=[];for(let o=0,s=i.length;o<s;o++)n[o]=EY(e,t,i[o]);return{group:n}}if(i.cases){const n=[];for(let s in i.cases)if(i.cases.hasOwnProperty(s)){const o=EY(e,t,i.cases[s]);"@default"===s||"@"===s||""===s?n.push({test:void 0,value:o,name:s}):"@eos"===s?n.push({test:function(e,t,i,n){return n},value:o,name:s}):n.push(NY(e,t,s,o))}const o=e.defaultToken;return{test:function(e,t,i,s){for(const o of n){if(!o.test||o.test(e,t,i,s))return o.value}return o}}}throw vw(e,"an action must be a string, an object with a 'token' or 'cases' attribute, or an array of actions; in rule: "+t)}return{token:""}}QZ=$Z([KZ(2,k_),KZ(3,$y),KZ(4,BB),KZ(5,N_),KZ(6,RG),KZ(7,vF),KZ(8,Cv),KZ(9,WB),KZ(10,$B),KZ(11,jB)],QZ);class IY{constructor(e){this.regex=new RegExp(""),this.action={token:""},this.matchOnlyAtLineStart=!1,this.name="",this.name=e}setRegex(e,t){let i;if("string"==typeof t)i=t;else{if(!(t instanceof RegExp))throw vw(e,"rules must start with a match string or regular expression: "+this.name);i=t.source}this.matchOnlyAtLineStart=i.length>0&&"^"===i[0],this.name=this.name+": "+i,this.regex=LY(e,"^(?:"+(this.matchOnlyAtLineStart?i.substr(1):i)+")")}setAction(e,t){this.action=EY(e,this.name,t)}}function TY(e,t){if(!t||"object"!=typeof t)throw new Error("Monarch: expecting a language definition object");const i={};i.languageId=e,i.includeLF=SY(t.includeLF,!1),i.noThrow=!1,i.maxStack=100,i.start="string"==typeof t.start?t.start:null,i.ignoreCase=SY(t.ignoreCase,!1),i.unicode=SY(t.unicode,!1),i.tokenPostfix=kY(t.tokenPostfix,"."+i.languageId),i.defaultToken=kY(t.defaultToken,"source"),i.usesEmbedded=!1;const n=t;function o(e,s,r){for(const a of r){let r=a.include;if(r){if("string"!=typeof r)throw vw(i,"an 'include' attribute must be a string at: "+e);if("@"===r[0]&&(r=r.substr(1)),!t.tokenizer[r])throw vw(i,"include target '"+r+"' is not defined at: "+e);o(e+"."+r,s,t.tokenizer[r])}else{const t=new IY(e);if(Array.isArray(a)&&a.length>=1&&a.length<=3)if(t.setRegex(n,a[0]),a.length>=3)if("string"==typeof a[1])t.setAction(n,{token:a[1],next:a[2]});else{if("object"!=typeof a[1])throw vw(i,"a next state as the last element of a rule can only be given if the action is either an object or a string, at: "+e);{const e=a[1];e.next=a[2],t.setAction(n,e)}}else t.setAction(n,a[1]);else{if(!a.regex)throw vw(i,"a rule must either be an array, or an object with a 'regex' or 'include' field at: "+e);a.name&&"string"==typeof a.name&&(t.name=a.name),a.matchOnlyAtStart&&(t.matchOnlyAtLineStart=SY(a.matchOnlyAtLineStart,!1)),t.setRegex(n,a.regex),t.setAction(n,a.action)}s.push(t)}}}if(n.languageId=e,n.includeLF=i.includeLF,n.ignoreCase=i.ignoreCase,n.unicode=i.unicode,n.noThrow=i.noThrow,n.usesEmbedded=i.usesEmbedded,n.stateNames=t.tokenizer,n.defaultToken=i.defaultToken,!t.tokenizer||"object"!=typeof t.tokenizer)throw vw(i,"a language definition must define the 'tokenizer' attribute as an object");i.tokenizer=[];for(let r in t.tokenizer)if(t.tokenizer.hasOwnProperty(r)){i.start||(i.start=r);const e=t.tokenizer[r];i.tokenizer[r]=new Array,o("tokenizer."+r,i.tokenizer[r],e)}if(i.usesEmbedded=n.usesEmbedded,t.brackets){if(!Array.isArray(t.brackets))throw vw(i,"the 'brackets' attribute must be defined as an array")}else t.brackets=[{open:"{",close:"}",token:"delimiter.curly"},{open:"[",close:"]",token:"delimiter.square"},{open:"(",close:")",token:"delimiter.parenthesis"},{open:"<",close:">",token:"delimiter.angle"}];const s=[];for(let r of t.brackets){let e=r;if(e&&Array.isArray(e)&&3===e.length&&(e={token:e[2],open:e[0],close:e[1]}),e.open===e.close)throw vw(i,"open and close brackets in a 'brackets' attribute must be different: "+e.open+"\n hint: use the 'bracket' attribute if matching on equal brackets is required.");if("string"!=typeof e.open||"string"!=typeof e.token||"string"!=typeof e.close)throw vw(i,"every element in the 'brackets' array must be a '{open,close,token}' object or array");s.push({token:e.token+i.tokenPostfix,open:fw(i,e.open),close:fw(i,e.close)})}return i.brackets=s,i.noThrow=!0,i}var MY=globalThis&&globalThis.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{l(n.next(e))}catch(t){s(t)}}function a(e){try{l(n.throw(e))}catch(t){s(t)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}l((n=n.apply(e,t||[])).next())}))};function AY(e){DA.registerLanguage(e)}function OY(){let e=[];return e=e.concat(DA.getLanguages()),e}function RY(e){return UZ.get(Lv).languageIdCodec.encodeLanguageId(e)}function PY(e,t){const i=UZ.get(Lv).onDidEncounterLanguage((n=>{n===e&&(i.dispose(),t())}));return i}function FY(e,t){if(!UZ.get(Lv).isRegisteredLanguageId(e))throw new Error(`Cannot set configuration for unknown language ${e}`);return Wv.register(e,t,100)}class BY{constructor(e,t){this._languageId=e,this._actual=t}getInitialState(){return this._actual.getInitialState()}tokenize(e,t,i){if("function"==typeof this._actual.tokenize)return VY.adaptTokenize(this._languageId,this._actual,e,i);throw new Error("Not supported!")}tokenizeEncoded(e,t,i){const n=this._actual.tokenizeEncoded(e,i);return new os(n.tokens,n.endState)}}class VY{constructor(e,t,i,n){this._languageId=e,this._actual=t,this._languageService=i,this._standaloneThemeService=n}getInitialState(){return this._actual.getInitialState()}static _toClassicTokens(e,t){const i=[];let n=0;for(let o=0,s=e.length;o<s;o++){const s=e[o];let r=s.startIndex;0===o?r=0:r<n&&(r=n),i[o]=new rs(r,s.scopes,t),n=r}return i}static adaptTokenize(e,t,i,n){const o=t.tokenize(i,n),s=VY._toClassicTokens(o.tokens,e);let r;return r=o.endState.equals(n)?n:o.endState,new ss(s,r)}tokenize(e,t,i){return VY.adaptTokenize(this._languageId,this._actual,e,i)}_toBinaryTokens(e,t){const i=e.encodeLanguageId(this._languageId),n=this._standaloneThemeService.getColorTheme().tokenTheme,o=[];let s=0,r=0;for(let l=0,d=t.length;l<d;l++){const e=t[l],a=n.match(i,e.scopes);if(s>0&&o[s-1]===a)continue;let d=e.startIndex;0===l?d=0:d<r&&(d=r),o[s++]=d,o[s++]=a,r=d}const a=new Uint32Array(s);for(let l=0;l<s;l++)a[l]=o[l];return a}tokenizeEncoded(e,t,i){const n=this._actual.tokenize(e,i),o=this._toBinaryTokens(this._languageService.languageIdCodec,n.tokens);let s;return s=n.endState.equals(i)?i:n.endState,new os(o,s)}}function WY(e){return e&&"function"==typeof e.then}function zY(e){const t=UZ.get(RG);if(e){const i=[null];for(let t=1,n=e.length;t<n;t++)i[t]=hS.fromHex(e[t]);t.setColorMapOverride(i)}else t.setColorMapOverride(null)}function HY(e,t){return function(e){return"tokenizeEncoded"in e}(t)?new BY(e,t):new VY(e,t,UZ.get(Lv),UZ.get(RG))}function jY(e,t){const i={createTokenizationSupport:()=>MY(this,void 0,void 0,(function*(){const i=yield Promise.resolve(t.create());return i?"function"==typeof i.getInitialState?HY(e,i):new Nw(UZ.get(Lv),UZ.get(RG),e,TY(e,i)):null}))};return Ns.registerFactory(e,i)}function UY(e,t){if(!UZ.get(Lv).isRegisteredLanguageId(e))throw new Error(`Cannot set tokens provider for unknown language ${e}`);return WY(t)?jY(e,{create:()=>t}):Ns.register(e,HY(e,t))}function $Y(e,t){return WY(t)?jY(e,{create:()=>t}):Ns.register(e,(t=>new Nw(UZ.get(Lv),UZ.get(RG),e,TY(e,t)))(t))}function KY(e,t){return UZ.get(Lb).referenceProvider.register(e,t)}function qY(e,t){return UZ.get(Lb).renameProvider.register(e,t)}function GY(e,t){return UZ.get(Lb).signatureHelpProvider.register(e,t)}function ZY(e,t){return UZ.get(Lb).hoverProvider.register(e,{provideHover:(e,i,n)=>{const o=e.getWordAtPosition(i);return Promise.resolve(t.provideHover(e,i,n)).then((e=>{if(e)return!e.range&&o&&(e.range=new qo(i.lineNumber,o.startColumn,i.lineNumber,o.endColumn)),e.range||(e.range=new qo(i.lineNumber,i.column,i.lineNumber,i.column)),e}))}})}function YY(e,t){return UZ.get(Lb).documentSymbolProvider.register(e,t)}function XY(e,t){return UZ.get(Lb).documentHighlightProvider.register(e,t)}function QY(e,t){return UZ.get(Lb).linkedEditingRangeProvider.register(e,t)}function JY(e,t){return UZ.get(Lb).definitionProvider.register(e,t)}function eX(e,t){return UZ.get(Lb).implementationProvider.register(e,t)}function tX(e,t){return UZ.get(Lb).typeDefinitionProvider.register(e,t)}function iX(e,t){return UZ.get(Lb).codeLensProvider.register(e,t)}function nX(e,t,i){return UZ.get(Lb).codeActionProvider.register(e,{providedCodeActionKinds:null==i?void 0:i.providedCodeActionKinds,provideCodeActions:(e,i,n,o)=>{const s=UZ.get(pj).read({resource:e.uri}).filter((e=>qo.areIntersectingOrTouching(e,i)));return t.provideCodeActions(e,i,{markers:s,only:n.only},o)},resolveCodeAction:t.resolveCodeAction})}function oX(e,t){return UZ.get(Lb).documentFormattingEditProvider.register(e,t)}function sX(e,t){return UZ.get(Lb).documentRangeFormattingEditProvider.register(e,t)}function rX(e,t){return UZ.get(Lb).onTypeFormattingEditProvider.register(e,t)}function aX(e,t){return UZ.get(Lb).linkProvider.register(e,t)}function lX(e,t){return UZ.get(Lb).completionProvider.register(e,t)}function dX(e,t){return UZ.get(Lb).colorProvider.register(e,t)}function cX(e,t){return UZ.get(Lb).foldingRangeProvider.register(e,t)}function hX(e,t){return UZ.get(Lb).declarationProvider.register(e,t)}function uX(e,t){return UZ.get(Lb).selectionRangeProvider.register(e,t)}function gX(e,t){return UZ.get(Lb).documentSemanticTokensProvider.register(e,t)}function pX(e,t){return UZ.get(Lb).documentRangeSemanticTokensProvider.register(e,t)}function mX(e,t){return UZ.get(Lb).inlineCompletionsProvider.register(e,t)}function fX(e,t){return UZ.get(Lb).inlayHintsProvider.register(e,t)}const _X=L_("IEditorCancelService"),vX=new Uy("cancellableOperation",!1,mf(0,"Whether the editor runs a cancellable operation, e.g. like 'Peek References'"));Iv(_X,class{constructor(){this._tokens=new WeakMap}add(e,t){let i,n=this._tokens.get(e);return n||(n=e.invokeWithinContext((e=>({key:vX.bindTo(e.get($y)),tokens:new zs}))),this._tokens.set(e,n)),n.key.set(!0),i=n.tokens.push(t),()=>{i&&(i(),n.key.set(!n.tokens.isEmpty()),i=void 0)}}cancel(e){const t=this._tokens.get(e);if(!t)return;const i=t.tokens.pop();i&&(i.cancel(),t.key.set(!t.tokens.isEmpty()))}},!0);class bX extends as{constructor(e,t){super(t),this.editor=e,this._unregister=e.invokeWithinContext((t=>t.get(_X).add(e,this)))}dispose(){this._unregister(),super.dispose()}}Dx(new class extends yx{constructor(){super({id:"editor.cancelOperation",kbOpts:{weight:100,primary:9},precondition:vX})}runEditorCommand(e,t){e.get(_X).cancel(t)}});class wX{constructor(e,t){if(this.flags=t,0!=(1&this.flags)){const t=e.getModel();this.modelVersionId=t?Aa("{0}#{1}",t.uri.toString(),t.getVersionId()):null}else this.modelVersionId=null;0!=(4&this.flags)?this.position=e.getPosition():this.position=null,0!=(2&this.flags)?this.selection=e.getSelection():this.selection=null,0!=(8&this.flags)?(this.scrollLeft=e.getScrollLeft(),this.scrollTop=e.getScrollTop()):(this.scrollLeft=-1,this.scrollTop=-1)}_equals(e){if(!(e instanceof wX))return!1;const t=e;return this.modelVersionId===t.modelVersionId&&(this.scrollLeft===t.scrollLeft&&this.scrollTop===t.scrollTop&&(!(!this.position&&t.position||this.position&&!t.position||this.position&&t.position&&!this.position.equals(t.position))&&!(!this.selection&&t.selection||this.selection&&!t.selection||this.selection&&t.selection&&!this.selection.equalsRange(t.selection))))}validate(e){return this._equals(new wX(e,this.flags))}}class CX extends bX{constructor(e,t,i,n){super(e,n),this._listener=new ws,4&t&&this._listener.add(e.onDidChangeCursorPosition((e=>{i&&qo.containsPosition(i,e.position)||this.cancel()}))),2&t&&this._listener.add(e.onDidChangeCursorSelection((e=>{i&&qo.containsRange(i,e.selection)||this.cancel()}))),8&t&&this._listener.add(e.onDidScrollChange((e=>this.cancel()))),1&t&&(this._listener.add(e.onDidChangeModel((e=>this.cancel()))),this._listener.add(e.onDidChangeModelContent((e=>this.cancel()))))}dispose(){this._listener.dispose(),super.dispose()}}class yX extends as{constructor(e,t){super(t),this._listener=e.onDidChangeContent((()=>this.cancel()))}dispose(){this._listener.dispose(),super.dispose()}}function xX(e){return!(!e||"function"!=typeof e.getEditorType)&&e.getEditorType()===M_.ICodeEditor}function SX(e){return!(!e||"function"!=typeof e.getEditorType)&&e.getEditorType()===M_.IDiffEditor}function kX(e){return xX(e)?e:SX(e)?e.getModifiedEditor():null}class DX{static _handleEolEdits(e,t){let i,n=[];for(let o of t)"number"==typeof o.eol&&(i=o.eol),o.range&&"string"==typeof o.text&&n.push(o);return"number"==typeof i&&e.hasModel()&&e.getModel().pushEOL(i),n}static _isFullModelReplaceEdit(e,t){if(!e.hasModel())return!1;const i=e.getModel(),n=i.validateRange(t.range);return i.getFullModelRange().equalsRange(n)}static execute(e,t,i){i&&e.pushUndoStop();const n=DX._handleEolEdits(e,t);1===n.length&&DX._isFullModelReplaceEdit(e,n[0])?e.executeEdits("formatEditsCommand",n.map((e=>_W.replace(qo.lift(e.range),e.text)))):e.executeEdits("formatEditsCommand",n.map((e=>_W.replaceMove(qo.lift(e.range),e.text)))),i&&e.pushUndoStop()}}class LX{constructor(e){this.value=e,this._lower=e.toLowerCase()}static toKey(e){return"string"==typeof e?e.toLowerCase():e._lower}}var NX,EX=globalThis&&globalThis.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{l(n.next(e))}catch(t){s(t)}}function a(e){try{l(n.throw(e))}catch(t){s(t)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}l((n=n.apply(e,t||[])).next())}))};function IX(e){if(!(e=e.filter((e=>e.range))).length)return;let{range:t}=e[0];for(let o=1;o<e.length;o++)t=qo.plusRange(t,e[o].range);const{startLineNumber:i,endLineNumber:n}=t;i===n?1===e.length?dy(mf(0,"Made 1 formatting edit on line {0}",i)):dy(mf(0,"Made {0} formatting edits on line {1}",e.length,i)):1===e.length?dy(mf(0,"Made 1 formatting edit between lines {0} and {1}",i,n)):dy(mf(0,"Made {0} formatting edits between lines {1} and {2}",e.length,i,n))}function TX(e,t,i){const n=[],o=new Set,s=e.ordered(i);for(const a of s)n.push(a),a.extensionId&&o.add(LX.toKey(a.extensionId));const r=t.ordered(i);for(const a of r){if(a.extensionId){if(o.has(LX.toKey(a.extensionId)))continue;o.add(LX.toKey(a.extensionId))}n.push({displayName:a.displayName,extensionId:a.extensionId,provideDocumentFormattingEdits:(e,t,i)=>a.provideDocumentRangeFormattingEdits(e,e.getFullModelRange(),t,i)})}return n}class MX{static setFormatterSelector(e){return{dispose:MX._selectors.unshift(e)}}static select(e,t,i){return EX(this,void 0,void 0,(function*(){if(0===e.length)return;const n=Hs.first(MX._selectors);return n?yield n(e,t,i):void 0}))}}function AX(e,t,i,n,o,s){return EX(this,void 0,void 0,(function*(){const r=e.get(k_),{documentRangeFormattingEditProvider:a}=e.get(Lb),l=xX(t)?t.getModel():t,d=a.ordered(l),c=yield MX.select(d,l,n);c&&(o.report(c),yield r.invokeFunction(OX,c,t,i,s))}))}function OX(e,t,i,n,o){return EX(this,void 0,void 0,(function*(){const s=e.get(BB);let r,a;xX(i)?(r=i.getModel(),a=new CX(i,5,void 0,o)):(r=i,a=new yX(i,o));let l=[],d=0;for(let e of Ml(n).sort(qo.compareRangesUsingStarts))d>0&&qo.areIntersectingOrTouching(l[d-1],e)?l[d-1]=qo.fromPositions(l[d-1].getStartPosition(),e.getEndPosition()):d=l.push(e);const c=e=>EX(this,void 0,void 0,(function*(){return(yield t.provideDocumentRangeFormattingEdits(r,e,r.getFormattingOptions(),a.token))||[]})),h=(e,t)=>{if(!e.length||!t.length)return!1;const i=e.reduce(((e,t)=>qo.plusRange(e,t.range)),e[0].range);if(!t.some((e=>qo.intersectRanges(i,e.range))))return!1;for(let n of e)for(let e of t)if(qo.intersectRanges(n.range,e.range))return!0;return!1},u=[],g=[];try{for(let e of l){if(a.token.isCancellationRequested)return!0;g.push(yield c(e))}for(let e=0;e<l.length;++e)for(let t=e+1;t<l.length;++t){if(a.token.isCancellationRequested)return!0;if(h(g[e],g[t])){const i=qo.plusRange(l[e],l[t]),n=yield c(i);l.splice(t,1),l.splice(e,1),l.push(i),g.splice(t,1),g.splice(e,1),g.push(n),e=0,t=0}}for(let e of g){if(a.token.isCancellationRequested)return!0;const t=yield s.computeMoreMinimalEdits(r.uri,e);t&&u.push(...t)}}finally{a.dispose()}if(0===u.length)return!1;if(xX(i))DX.execute(i,u,!0),IX(u),i.revealPositionInCenterIfOutsideViewport(i.getPosition(),1);else{const[{range:e}]=u,t=new ar(e.startLineNumber,e.startColumn,e.endLineNumber,e.endColumn);r.pushEditOperations([t],u.map((e=>({text:e.text,range:qo.lift(e.range),forceMoveMarkers:!0}))),(e=>{for(const{range:i}of e)if(qo.areIntersectingOrTouching(i,t))return[new ar(i.startLineNumber,i.startColumn,i.endLineNumber,i.endColumn)];return null}))}return!0}))}function RX(e,t,i,n,o){return EX(this,void 0,void 0,(function*(){const s=e.get(k_),r=e.get(Lb),a=xX(t)?t.getModel():t,l=TX(r.documentFormattingEditProvider,r.documentRangeFormattingEditProvider,a),d=yield MX.select(l,a,i);d&&(n.report(d),yield s.invokeFunction(PX,d,t,i,o))}))}function PX(e,t,i,n,o){return EX(this,void 0,void 0,(function*(){const s=e.get(BB);let r,a,l;xX(i)?(r=i.getModel(),a=new CX(i,5,void 0,o)):(r=i,a=new yX(i,o));try{const e=yield t.provideDocumentFormattingEdits(r,r.getFormattingOptions(),a.token);if(l=yield s.computeMoreMinimalEdits(r.uri,e),a.token.isCancellationRequested)return!0}finally{a.dispose()}if(!l||0===l.length)return!1;if(xX(i))DX.execute(i,l,2!==n),2!==n&&(IX(l),i.revealPositionInCenterIfOutsideViewport(i.getPosition(),1));else{const[{range:e}]=l,t=new ar(e.startLineNumber,e.startColumn,e.endLineNumber,e.endColumn);r.pushEditOperations([t],l.map((e=>({text:e.text,range:qo.lift(e.range),forceMoveMarkers:!0}))),(e=>{for(const{range:i}of e)if(qo.areIntersectingOrTouching(i,t))return[new ar(i.startLineNumber,i.startColumn,i.endLineNumber,i.endColumn)];return null}))}return!0}))}function FX(e,t,i,n,o,s,r){const a=t.onTypeFormattingEditProvider.ordered(i);return 0===a.length||a[0].autoFormatTriggerCharacters.indexOf(o)<0?Promise.resolve(void 0):Promise.resolve(a[0].provideOnTypeFormattingEdits(i,n,o,s,r)).catch(Ta).then((t=>e.computeMoreMinimalEdits(i.uri,t)))}MX._selectors=new zs,Cy.registerCommand("_executeFormatRangeProvider",(function(e,...t){return EX(this,void 0,void 0,(function*(){const[i,n,o]=t;Js(Ps.isUri(i)),Js(qo.isIRange(n));const s=e.get(gy),r=e.get(BB),a=e.get(Lb),l=yield s.createModelReference(i);try{return function(e,t,i,n,o,s){return EX(this,void 0,void 0,(function*(){const r=t.documentRangeFormattingEditProvider.ordered(i);for(const t of r){let r=yield Promise.resolve(t.provideDocumentRangeFormattingEdits(i,n,o,s)).catch(Ta);if(gs(r))return yield e.computeMoreMinimalEdits(i.uri,r)}}))}(r,a,l.object.textEditorModel,qo.lift(n),o,Ia.None)}finally{l.dispose()}}))})),Cy.registerCommand("_executeFormatDocumentProvider",(function(e,...t){return EX(this,void 0,void 0,(function*(){const[i,n]=t;Js(Ps.isUri(i));const o=e.get(gy),s=e.get(BB),r=e.get(Lb),a=yield o.createModelReference(i);try{return function(e,t,i,n,o){return EX(this,void 0,void 0,(function*(){const s=TX(t.documentFormattingEditProvider,t.documentRangeFormattingEditProvider,i);for(const t of s){let s=yield Promise.resolve(t.provideDocumentFormattingEdits(i,n,o)).catch(Ta);if(gs(s))return yield e.computeMoreMinimalEdits(i.uri,s)}}))}(s,r,a.object.textEditorModel,n,Ia.None)}finally{a.dispose()}}))})),Cy.registerCommand("_executeFormatOnTypeProvider",(function(e,...t){return EX(this,void 0,void 0,(function*(){const[i,n,o,s]=t;Js(Ps.isUri(i)),Js(er.isIPosition(n)),Js("string"==typeof o);const r=e.get(gy),a=e.get(BB),l=e.get(Lb),d=yield r.createModelReference(i);try{return FX(a,l,d.object.textEditorModel,er.lift(n),o,s,Ia.None)}finally{d.dispose()}}))})),Xf.wrappingIndent.defaultValue=0,Xf.glyphMargin.defaultValue=!1,Xf.autoIndent.defaultValue=3,Xf.overviewRulerLanes.defaultValue=2,MX.setFormatterSelector(((e,t,i)=>Promise.resolve(e[0])));const BX=Al();BX.editor={create:tY,onDidCreateEditor:iY,createDiffEditor:nY,createDiffNavigator:oY,createModel:sY,setModelLanguage:rY,setModelMarkers:aY,getModelMarkers:lY,onDidChangeMarkers:dY,getModels:hY,getModel:cY,onDidCreateModel:uY,onWillDisposeModel:gY,onDidChangeModelLanguage:pY,createWebWorker:mY,colorizeElement:fY,colorize:_Y,colorizeModelLine:vY,tokenize:bY,defineTheme:wY,setTheme:CY,remeasureFonts:yY,registerCommand:xY,AccessibilitySupport:Qa,ContentWidgetPositionPreference:Ja,CursorChangeReason:el,DefaultEndOfLine:tl,EditorAutoIndentStrategy:il,EditorOption:nl,EndOfLinePreference:ol,EndOfLineSequence:sl,MinimapPosition:rl,MouseTargetType:al,OverlayWidgetPositionPreference:ll,OverviewRulerLane:dl,RenderLineNumbersType:cl,RenderMinimap:hl,ScrollbarVisibility:ul,ScrollType:gl,TextEditorCursorBlinkingStyle:pl,TextEditorCursorStyle:ml,TrackedRangeStickiness:fl,WrappingIndent:_l,InjectedTextCursorStops:vl,PositionAffinity:bl,ConfigurationChangedEvent:_f,BareFontInfo:w_,FontInfo:C_,TextModelResolvedOptions:ea,FindMatch:Zr,ApplyUpdateResult:wf,EditorType:M_,EditorOptions:Xf},BX.languages={register:AY,getLanguages:OY,onLanguage:PY,getEncodedLanguageId:RY,setLanguageConfiguration:FY,setColorMap:zY,registerTokensProviderFactory:jY,setTokensProvider:UY,setMonarchTokensProvider:$Y,registerReferenceProvider:KY,registerRenameProvider:qY,registerCompletionItemProvider:lX,registerSignatureHelpProvider:GY,registerHoverProvider:ZY,registerDocumentSymbolProvider:YY,registerDocumentHighlightProvider:XY,registerLinkedEditingRangeProvider:QY,registerDefinitionProvider:JY,registerImplementationProvider:eX,registerTypeDefinitionProvider:tX,registerCodeLensProvider:iX,registerCodeActionProvider:nX,registerDocumentFormattingEditProvider:oX,registerDocumentRangeFormattingEditProvider:sX,registerOnTypeFormattingEditProvider:rX,registerLinkProvider:aX,registerColorProvider:dX,registerFoldingRangeProvider:cX,registerDeclarationProvider:hX,registerSelectionRangeProvider:uX,registerDocumentSemanticTokensProvider:gX,registerDocumentRangeSemanticTokensProvider:pX,registerInlineCompletionsProvider:mX,registerInlayHintsProvider:fX,DocumentHighlightKind:wl,CompletionItemKind:Cl,CompletionItemTag:yl,CompletionItemInsertTextRule:xl,SymbolKind:Sl,SymbolTag:kl,IndentAction:Dl,CompletionTriggerKind:Ll,SignatureHelpTriggerKind:Nl,InlayHintKind:El,InlineCompletionTriggerKind:Il,FoldingRangeKind:Tl};const VX=BX.CancellationTokenSource,WX=BX.Emitter,zX=BX.KeyCode,HX=BX.KeyMod,jX=BX.Position,UX=BX.Range,$X=BX.Selection,KX=BX.SelectionDirection,qX=BX.MarkerSeverity,GX=BX.MarkerTag,ZX=BX.Uri,YX=BX.Token,XX=BX.editor,QX=BX.languages;((null===(NX=us.MonacoEnvironment)||void 0===NX?void 0:NX.globalAPI)||"function"==typeof define&&define.amd)&&(self.monaco=BX),void 0!==self.require&&"function"==typeof self.require.config&&self.require.config({ignoreDuplicateModules:["vscode-languageserver-types","vscode-languageserver-types/main","vscode-languageserver-textdocument","vscode-languageserver-textdocument/main","vscode-nls","vscode-nls/vscode-nls","jsonc-parser","jsonc-parser/main","vscode-uri","vscode-uri/index","vs/basic-languages/typescript/typescript"]});var JX=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",CancellationTokenSource:VX,Emitter:WX,KeyCode:zX,KeyMod:HX,Position:jX,Range:UX,Selection:$X,SelectionDirection:KX,MarkerSeverity:qX,MarkerTag:GX,Uri:ZX,Token:YX,editor:XX,languages:QX});t("m",JX); |
|
|
var UQ=Object.defineProperty,$Q=Object.getOwnPropertyDescriptor,KQ=Object.getOwnPropertyNames,qQ=Object.prototype.hasOwnProperty,GQ={};((e,t,i,n)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let o of KQ(t))qQ.call(e,o)||!i&&"default"===o||UQ(e,o,{get:()=>t[o],enumerable:!(n=$Q(t,o))||n.enumerable})})(GQ,JX);var ZQ=(e=>(e[e.None=0]="None",e[e.CommonJS=1]="CommonJS",e[e.AMD=2]="AMD",e[e.UMD=3]="UMD",e[e.System=4]="System",e[e.ES2015=5]="ES2015",e[e.ESNext=99]="ESNext",e))(ZQ||{}),YQ=(e=>(e[e.None=0]="None",e[e.Preserve=1]="Preserve",e[e.React=2]="React",e[e.ReactNative=3]="ReactNative",e[e.ReactJSX=4]="ReactJSX",e[e.ReactJSXDev=5]="ReactJSXDev",e))(YQ||{}),XQ=(e=>(e[e.CarriageReturnLineFeed=0]="CarriageReturnLineFeed",e[e.LineFeed=1]="LineFeed",e))(XQ||{}),QQ=(e=>(e[e.ES3=0]="ES3",e[e.ES5=1]="ES5",e[e.ES2015=2]="ES2015",e[e.ES2016=3]="ES2016",e[e.ES2017=4]="ES2017",e[e.ES2018=5]="ES2018",e[e.ES2019=6]="ES2019",e[e.ES2020=7]="ES2020",e[e.ESNext=99]="ESNext",e[e.JSON=100]="JSON",e[e.Latest=99]="Latest",e))(QQ||{}),JQ=(e=>(e[e.Classic=1]="Classic",e[e.NodeJs=2]="NodeJs",e))(JQ||{}),eJ=class{constructor(t,i,n,o){e(this,"_onDidChange",new GQ.Emitter),e(this,"_onDidExtraLibsChange",new GQ.Emitter),e(this,"_extraLibs",void 0),e(this,"_removedExtraLibs",void 0),e(this,"_eagerModelSync",void 0),e(this,"_compilerOptions",void 0),e(this,"_diagnosticsOptions",void 0),e(this,"_workerOptions",void 0),e(this,"_onDidExtraLibsChangeTimeout",void 0),e(this,"_inlayHintsOptions",void 0),this._extraLibs=Object.create(null),this._removedExtraLibs=Object.create(null),this._eagerModelSync=!1,this.setCompilerOptions(t),this.setDiagnosticsOptions(i),this.setWorkerOptions(n),this.setInlayHintsOptions(o),this._onDidExtraLibsChangeTimeout=-1}get onDidChange(){return this._onDidChange.event}get onDidExtraLibsChange(){return this._onDidExtraLibsChange.event}get workerOptions(){return this._workerOptions}get inlayHintsOptions(){return this._inlayHintsOptions}getExtraLibs(){return this._extraLibs}addExtraLib(e,t){let i;if(i=void 0===t?`ts:extralib-${Math.random().toString(36).substring(2,15)}`:t,this._extraLibs[i]&&this._extraLibs[i].content===e)return{dispose:()=>{}};let n=1;return this._removedExtraLibs[i]&&(n=this._removedExtraLibs[i]+1),this._extraLibs[i]&&(n=this._extraLibs[i].version+1),this._extraLibs[i]={content:e,version:n},this._fireOnDidExtraLibsChangeSoon(),{dispose:()=>{let e=this._extraLibs[i];e&&e.version===n&&(delete this._extraLibs[i],this._removedExtraLibs[i]=n,this._fireOnDidExtraLibsChangeSoon())}}}setExtraLibs(e){for(const t in this._extraLibs)this._removedExtraLibs[t]=this._extraLibs[t].version;if(this._extraLibs=Object.create(null),e&&e.length>0)for(const t of e){const e=t.filePath||`ts:extralib-${Math.random().toString(36).substring(2,15)}`,i=t.content;let n=1;this._removedExtraLibs[e]&&(n=this._removedExtraLibs[e]+1),this._extraLibs[e]={content:i,version:n}}this._fireOnDidExtraLibsChangeSoon()}_fireOnDidExtraLibsChangeSoon(){-1===this._onDidExtraLibsChangeTimeout&&(this._onDidExtraLibsChangeTimeout=window.setTimeout((()=>{this._onDidExtraLibsChangeTimeout=-1,this._onDidExtraLibsChange.fire(void 0)}),0))}getCompilerOptions(){return this._compilerOptions}setCompilerOptions(e){this._compilerOptions=e||Object.create(null),this._onDidChange.fire(void 0)}getDiagnosticsOptions(){return this._diagnosticsOptions}setDiagnosticsOptions(e){this._diagnosticsOptions=e||Object.create(null),this._onDidChange.fire(void 0)}setWorkerOptions(e){this._workerOptions=e||Object.create(null),this._onDidChange.fire(void 0)}setInlayHintsOptions(e){this._inlayHintsOptions=e||Object.create(null),this._onDidChange.fire(void 0)}setMaximumWorkerIdleTime(e){}setEagerModelSync(e){this._eagerModelSync=e}getEagerModelSync(){return this._eagerModelSync}},tJ=t("t",new eJ({allowNonTsExtensions:!0,target:99},{noSemanticValidation:!1,noSyntaxValidation:!1,onlyVisible:!1},{},{})),iJ=new eJ({allowNonTsExtensions:!0,allowJs:!0,target:99},{noSemanticValidation:!0,noSyntaxValidation:!1,onlyVisible:!1},{},{});function nJ(){return Po((()=>i.import("./tsMode-legacy.83a739fd.js")),void 0)}GQ.languages.typescript={ModuleKind:ZQ,JsxEmit:YQ,NewLineKind:XQ,ScriptTarget:QQ,ModuleResolutionKind:JQ,typescriptVersion:"4.5.5",typescriptDefaults:tJ,javascriptDefaults:iJ,getTypeScriptWorker:()=>nJ().then((e=>e.getTypeScriptWorker())),getJavaScriptWorker:()=>nJ().then((e=>e.getJavaScriptWorker()))},GQ.languages.onLanguage("typescript",(()=>nJ().then((e=>e.setupTypeScript(tJ))))),GQ.languages.onLanguage("javascript",(()=>nJ().then((e=>e.setupJavaScript(iJ)))));var oJ=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},sJ=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}},rJ=globalThis&&globalThis.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{l(n.next(e))}catch(t){s(t)}}function a(e){try{l(n.throw(e))}catch(t){s(t)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}l((n=n.apply(e,t||[])).next())}))};const aJ=new Uy("selectionAnchorSet",!1);let lJ=class e{constructor(e,t){this.editor=e,this.selectionAnchorSetContextKey=aJ.bindTo(t),this.modelChangeListener=e.onDidChangeModel((()=>this.selectionAnchorSetContextKey.reset()))}static get(t){return t.getContribution(e.ID)}setSelectionAnchor(){if(this.editor.hasModel()){const e=this.editor.getPosition(),t=this.decorationId?[this.decorationId]:[],i=this.editor.deltaDecorations(t,[{range:ar.fromPositions(e,e),options:{description:"selection-anchor",stickiness:1,hoverMessage:(new RU).appendText(mf(0,"Selection Anchor")),className:"selection-anchor"}}]);this.decorationId=i[0],this.selectionAnchorSetContextKey.set(!!this.decorationId),dy(mf(0,"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(ar.fromPositions(e.getStartPosition(),t)),this.cancelSelectionAnchor()}}}cancelSelectionAnchor(){this.decorationId&&(this.editor.deltaDecorations([this.decorationId],[]),this.decorationId=void 0,this.selectionAnchorSetContextKey.set(!1))}dispose(){this.cancelSelectionAnchor(),this.modelChangeListener.dispose()}};lJ.ID="editor.contrib.selectionAnchorController",lJ=oJ([sJ(1,$y)],lJ);Ix(lJ.ID,lJ),Lx(class extends xx{constructor(){super({id:"editor.action.setSelectionAnchor",label:mf(0,"Set Selection Anchor"),alias:"Set Selection Anchor",precondition:void 0,kbOpts:{kbExpr:yI.editorTextFocus,primary:Ol(2089,2080),weight:100}})}run(e,t){var i;return rJ(this,void 0,void 0,(function*(){null===(i=lJ.get(t))||void 0===i||i.setSelectionAnchor()}))}}),Lx(class extends xx{constructor(){super({id:"editor.action.goToSelectionAnchor",label:mf(0,"Go to Selection Anchor"),alias:"Go to Selection Anchor",precondition:aJ})}run(e,t){var i;return rJ(this,void 0,void 0,(function*(){null===(i=lJ.get(t))||void 0===i||i.goToSelectionAnchor()}))}}),Lx(class extends xx{constructor(){super({id:"editor.action.selectFromAnchorToCursor",label:mf(0,"Select from Anchor to Cursor"),alias:"Select from Anchor to Cursor",precondition:aJ,kbOpts:{kbExpr:yI.editorTextFocus,primary:Ol(2089,2089),weight:100}})}run(e,t){var i;return rJ(this,void 0,void 0,(function*(){null===(i=lJ.get(t))||void 0===i||i.selectFromAnchorToCursor()}))}}),Lx(class extends xx{constructor(){super({id:"editor.action.cancelSelectionAnchor",label:mf(0,"Cancel Selection Anchor"),alias:"Cancel Selection Anchor",precondition:aJ,kbOpts:{kbExpr:yI.editorTextFocus,primary:9,weight:100}})}run(e,t){var i;return rJ(this,void 0,void 0,(function*(){null===(i=lJ.get(t))||void 0===i||i.cancelSelectionAnchor()}))}});const dJ=_S("editorOverviewRuler.bracketMatchForeground",{dark:"#A0A0A0",light:"#A0A0A0",hc:"#A0A0A0"},mf(0,"Overview ruler marker color for matching brackets."));class cJ{constructor(e,t,i){this.position=e,this.brackets=t,this.options=i}}class hJ extends Uo{constructor(e){super(),this._editor=e,this._lastBracketsData=[],this._lastVersionId=0,this._decorations=[],this._updateBracketsSoon=this._register(new lb((()=>this._updateBrackets()),50)),this._matchBrackets=this._editor.getOption(64),this._updateBracketsSoon.schedule(),this._register(e.onDidChangeCursorPosition((e=>{"never"!==this._matchBrackets&&this._updateBracketsSoon.schedule()}))),this._register(e.onDidChangeModelContent((e=>{this._updateBracketsSoon.schedule()}))),this._register(e.onDidChangeModel((e=>{this._lastBracketsData=[],this._decorations=[],this._updateBracketsSoon.schedule()}))),this._register(e.onDidChangeModelLanguageConfiguration((e=>{this._lastBracketsData=[],this._updateBracketsSoon.schedule()}))),this._register(e.onDidChangeConfiguration((e=>{e.hasChanged(64)&&(this._matchBrackets=this._editor.getOption(64),this._decorations=this._editor.deltaDecorations(this._decorations,[]),this._lastBracketsData=[],this._lastVersionId=0,this._updateBracketsSoon.schedule())}))),this._register(e.onDidBlurEditorWidget((()=>{this._updateBracketsSoon.schedule()}))),this._register(e.onDidFocusEditorWidget((()=>{this._updateBracketsSoon.schedule()})))}static get(e){return e.getContribution(hJ.ID)}jumpToBracket(){if(!this._editor.hasModel())return;const e=this._editor.getModel(),t=this._editor.getSelections().map((t=>{const i=t.getStartPosition(),n=e.bracketPairs.matchBracket(i);let o=null;if(n)n[0].containsPosition(i)?o=n[1].getStartPosition():n[1].containsPosition(i)&&(o=n[0].getStartPosition());else{const t=e.bracketPairs.findEnclosingBrackets(i);if(t)o=t[0].getStartPosition();else{const t=e.bracketPairs.findNextBracket(i);t&&t.range&&(o=t.range.getStartPosition())}}return o?new ar(o.lineNumber,o.column,o.lineNumber,o.column):new ar(i.lineNumber,i.column,i.lineNumber,i.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 s=t.bracketPairs.matchBracket(o);if(!s&&(s=t.bracketPairs.findEnclosingBrackets(o),!s)){const e=t.bracketPairs.findNextBracket(o);e&&e.range&&(s=t.bracketPairs.matchBracket(e.range.getStartPosition()))}let r=null,a=null;if(s){s.sort(qo.compareRangesUsingStarts);const[t,i]=s;if(r=e?t.getStartPosition():t.getEndPosition(),a=e?i.getEndPosition():i.getStartPosition(),i.containsPosition(o)){const e=r;r=a,a=e}}r&&a&&i.push(new ar(r.lineNumber,r.column,a.lineNumber,a.column))})),i.length>0&&(this._editor.setSelections(i),this._editor.revealRange(i[0]))}_updateBrackets(){if("never"===this._matchBrackets)return;this._recomputeBrackets();let e=[],t=0;for(const i of this._lastBracketsData){let n=i.brackets;n&&(e[t++]={range:n[0],options:i.options},e[t++]={range:n[1],options:i.options})}this._decorations=this._editor.deltaDecorations(this._decorations,e)}_recomputeBrackets(){if(!this._editor.hasModel()||!this._editor.hasWidgetFocus())return this._lastBracketsData=[],void(this._lastVersionId=0);const e=this._editor.getSelections();if(e.length>100)return this._lastBracketsData=[],void(this._lastVersionId=0);const t=this._editor.getModel(),i=t.getVersionId();let n=[];this._lastVersionId===i&&(n=this._lastBracketsData);let o=[],s=0;for(let c=0,h=e.length;c<h;c++){let t=e[c];t.isEmpty()&&(o[s++]=t.getStartPosition())}o.length>1&&o.sort(er.compare);let r=[],a=0,l=0,d=n.length;for(let c=0,h=o.length;c<h;c++){let e=o[c];for(;l<d&&n[l].position.isBefore(e);)l++;if(l<d&&n[l].position.equals(e))r[a++]=n[l];else{let i=t.bracketPairs.matchBracket(e,20),n=hJ._DECORATION_OPTIONS_WITH_OVERVIEW_RULER;i||"always"!==this._matchBrackets||(i=t.bracketPairs.findEnclosingBrackets(e,20),n=hJ._DECORATION_OPTIONS_WITHOUT_OVERVIEW_RULER),r[a++]=new cJ(e,i,n)}}this._lastBracketsData=r,this._lastVersionId=i}}hJ.ID="editor.contrib.bracketMatchingController",hJ._DECORATION_OPTIONS_WITH_OVERVIEW_RULER=GP.register({description:"bracket-match-overview",stickiness:1,className:"bracket-match",overviewRuler:{color:tx(dJ),position:aa.Center}}),hJ._DECORATION_OPTIONS_WITHOUT_OVERVIEW_RULER=GP.register({description:"bracket-match-no-overview",stickiness:1,className:"bracket-match"}),Ix(hJ.ID,hJ),Lx(class extends xx{constructor(){super({id:"editor.action.selectToBracket",label:mf(0,"Select to Bracket"),alias:"Select to Bracket",precondition:void 0,description:{description:"Select to Bracket",args:[{name:"args",schema:{type:"object",properties:{selectBrackets:{type:"boolean",default:!0}}}}]}})}run(e,t,i){var n;let o=!0;i&&!1===i.selectBrackets&&(o=!1),null===(n=hJ.get(t))||void 0===n||n.selectToBracket(o)}}),Lx(class extends xx{constructor(){super({id:"editor.action.jumpToBracket",label:mf(0,"Go to Bracket"),alias:"Go to Bracket",precondition:void 0,kbOpts:{kbExpr:yI.editorTextFocus,primary:3160,weight:100}})}run(e,t){var i;null===(i=hJ.get(t))||void 0===i||i.jumpToBracket()}}),sx(((e,t)=>{const i=e.getColor(iE);i&&t.addRule(`.monaco-editor .bracket-match { background-color: ${i}; }`);const n=e.getColor(nE);n&&t.addRule(`.monaco-editor .bracket-match { border: 1px solid ${n}; }`)})),ux.appendMenuItem(cx.MenubarGoMenu,{group:"5_infile_nav",command:{id:"editor.action.jumpToBracket",title:mf(0,"Go to &&Bracket")},order:2});class uJ{constructor(e,t){this._selection=e,this._isMovingLeft=t}getEditOperations(e,t){if(this._selection.startLineNumber!==this._selection.endLineNumber||this._selection.isEmpty())return;const i=this._selection.startLineNumber,n=this._selection.startColumn,o=this._selection.endColumn;if((!this._isMovingLeft||1!==n)&&(this._isMovingLeft||o!==e.getLineMaxColumn(i)))if(this._isMovingLeft){const s=new qo(i,n-1,i,n),r=e.getValueInRange(s);t.addEditOperation(s,null),t.addEditOperation(new qo(i,o,i,o),r)}else{const s=new qo(i,o,i,o+1),r=e.getValueInRange(s);t.addEditOperation(s,null),t.addEditOperation(new qo(i,n,i,n),r)}}computeCursorState(e,t){return this._isMovingLeft?new ar(this._selection.startLineNumber,this._selection.startColumn-1,this._selection.endLineNumber,this._selection.endColumn-1):new ar(this._selection.startLineNumber,this._selection.startColumn+1,this._selection.endLineNumber,this._selection.endColumn+1)}}class gJ extends xx{constructor(e,t){super(t),this.left=e}run(e,t){if(!t.hasModel())return;const i=[],n=t.getSelections();for(const o of n)i.push(new uJ(o,this.left));t.pushUndoStop(),t.executeCommands(this.id,i),t.pushUndoStop()}}Lx(class extends gJ{constructor(){super(!0,{id:"editor.action.moveCarretLeftAction",label:mf(0,"Move Selected Text Left"),alias:"Move Selected Text Left",precondition:yI.writable})}}),Lx(class extends gJ{constructor(){super(!1,{id:"editor.action.moveCarretRightAction",label:mf(0,"Move Selected Text Right"),alias:"Move Selected Text Right",precondition:yI.writable})}});Lx(class extends xx{constructor(){super({id:"editor.action.transposeLetters",label:mf(0,"Transpose Letters"),alias:"Transpose Letters",precondition:yI.writable,kbOpts:{kbExpr:yI.textInputFocus,primary:0,mac:{primary:306},weight:100}})}run(e,t){if(!t.hasModel())return;let i=t.getModel(),n=[],o=t.getSelections();for(let s of o){if(!s.isEmpty())continue;let e=s.startLineNumber,t=s.startColumn,o=i.getLineMaxColumn(e);if(1===e&&(1===t||2===t&&2===o))continue;let r=t===o?s.getPosition():sI.rightPosition(i,s.getPosition().lineNumber,s.getPosition().column),a=sI.leftPosition(i,r),l=sI.leftPosition(i,a),d=i.getValueInRange(qo.fromPositions(l,a)),c=i.getValueInRange(qo.fromPositions(a,r)),h=qo.fromPositions(l,r);n.push(new JE(h,c+d))}n.length>0&&(t.pushUndoStop(),t.executeCommands(this.id,n),t.pushUndoStop())}});var pJ=globalThis&&globalThis.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{l(n.next(e))}catch(t){s(t)}}function a(e){try{l(n.throw(e))}catch(t){s(t)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}l((n=n.apply(e,t||[])).next())}))};const mJ="9_cutcopypaste",fJ=Ts||document.queryCommandSupported("cut"),_J=Ts||document.queryCommandSupported("copy"),vJ=void 0!==navigator.clipboard&&!o_||document.queryCommandSupported("paste");function bJ(e){return e.register(),e}const wJ=fJ?bJ(new wx({id:"editor.action.clipboardCutAction",precondition:void 0,kbOpts:Ts?{primary:2102,win:{primary:2102,secondary:[1044]},weight:100}:void 0,menuOpts:[{menuId:cx.MenubarEditMenu,group:"2_ccp",title:mf(0,"Cu&&t"),order:1},{menuId:cx.EditorContext,group:mJ,title:mf(0,"Cut"),when:yI.writable,order:1},{menuId:cx.CommandPalette,group:"",title:mf(0,"Cut"),order:1},{menuId:cx.SimpleEditorContext,group:mJ,title:mf(0,"Cut"),when:yI.writable,order:1}]})):void 0,CJ=_J?bJ(new wx({id:"editor.action.clipboardCopyAction",precondition:void 0,kbOpts:Ts?{primary:2081,win:{primary:2081,secondary:[2067]},weight:100}:void 0,menuOpts:[{menuId:cx.MenubarEditMenu,group:"2_ccp",title:mf(0,"&&Copy"),order:2},{menuId:cx.EditorContext,group:mJ,title:mf(0,"Copy"),order:2},{menuId:cx.CommandPalette,group:"",title:mf(0,"Copy"),order:1},{menuId:cx.SimpleEditorContext,group:mJ,title:mf(0,"Copy"),order:2}]})):void 0;ux.appendMenuItem(cx.MenubarEditMenu,{submenu:cx.MenubarCopy,title:{value:mf(0,"Copy As"),original:"Copy As"},group:"2_ccp",order:3}),ux.appendMenuItem(cx.EditorContext,{submenu:cx.EditorContextCopy,title:{value:mf(0,"Copy As"),original:"Copy As"},group:mJ,order:3});const yJ=vJ?bJ(new wx({id:"editor.action.clipboardPasteAction",precondition:void 0,kbOpts:Ts?{primary:2100,win:{primary:2100,secondary:[1043]},linux:{primary:2100,secondary:[1043]},weight:100}:void 0,menuOpts:[{menuId:cx.MenubarEditMenu,group:"2_ccp",title:mf(0,"&&Paste"),order:4},{menuId:cx.EditorContext,group:mJ,title:mf(0,"Paste"),when:yI.writable,order:4},{menuId:cx.CommandPalette,group:"",title:mf(0,"Paste"),order:1},{menuId:cx.SimpleEditorContext,group:mJ,title:mf(0,"Paste"),when:yI.writable,order:4}]})):void 0;class xJ extends xx{constructor(){super({id:"editor.action.clipboardCopyWithSyntaxHighlightingAction",label:mf(0,"Copy With Syntax Highlighting"),alias:"Copy With Syntax Highlighting",precondition:void 0,kbOpts:{kbExpr:yI.textInputFocus,primary:0,weight:100}})}run(e,t){if(!t.hasModel())return;!t.getOption(32)&&t.getSelection().isEmpty()||(TN.forceCopyWithSyntaxHighlighting=!0,t.focus(),document.execCommand("copy"),TN.forceCopyWithSyntaxHighlighting=!1)}}function SJ(e,t){e&&(e.addImplementation(1e4,"code-editor",((e,i)=>{const n=e.get(N_).getFocusedCodeEditor();if(n&&n.hasTextFocus()){const e=n.getOption(32),i=n.getSelection();return i&&i.isEmpty()&&!e||document.execCommand(t),!0}return!1})),e.addImplementation(0,"generic-dom",((e,i)=>(document.execCommand(t),!0))))}SJ(wJ,"cut"),SJ(CJ,"copy"),yJ&&(yJ.addImplementation(1e4,"code-editor",((e,t)=>{const i=e.get(N_),n=e.get(jB),o=i.getFocusedCodeEditor();if(o&&o.hasTextFocus()){return!(!document.execCommand("paste")&&Fs)||pJ(void 0,void 0,void 0,(function*(){const e=yield n.readText();if(""!==e){const t=MN.INSTANCE.get(e);let i=!1,n=null,s=null;t&&(i=o.getOption(32)&&!!t.isFromEmptySelection,n=void 0!==t.multicursorText?t.multicursorText:null,s=t.mode),o.trigger("keyboard","paste",{text:e,pasteOnNewLine:i,multicursorText:n,mode:s})}}))}return!1})),yJ.addImplementation(0,"generic-dom",((e,t)=>(document.execCommand("paste"),!0)))),_J&&Lx(xJ);class kJ{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+kJ.sep)}intersects(e){return this.contains(e)||e.contains(this)}append(e){return new kJ(this.value+kJ.sep+e)}}function DJ(e,t,i){return!!t.contains(e)&&(!i||!t.contains(i))}kJ.sep=".",kJ.None=new kJ("@@none@@"),kJ.Empty=new kJ(""),kJ.QuickFix=new kJ("quickfix"),kJ.Refactor=new kJ("refactor"),kJ.Source=new kJ("source"),kJ.SourceOrganizeImports=kJ.Source.append("organizeImports"),kJ.SourceFixAll=kJ.Source.append("fixAll");class LJ{constructor(e,t,i){this.kind=e,this.apply=t,this.preferred=i}static fromUser(e,t){return e&&"object"==typeof e?new LJ(LJ.getKindFromUser(e,t.kind),LJ.getApplyFromUser(e,t.apply),LJ.getPreferredUser(e)):new LJ(t.kind,t.apply,!1)}static getApplyFromUser(e,t){switch("string"==typeof e.apply?e.apply.toLowerCase():""){case"first":return"first";case"never":return"never";case"ifsingle":return"ifSingle";default:return t}}static getKindFromUser(e,t){return"string"==typeof e.kind?new kJ(e.kind):t}static getPreferredUser(e){return"boolean"==typeof e.preferred&&e.preferred}}var NJ=globalThis&&globalThis.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{l(n.next(e))}catch(t){s(t)}}function a(e){try{l(n.throw(e))}catch(t){s(t)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}l((n=n.apply(e,t||[])).next())}))};const EJ="editor.action.codeAction",IJ="editor.action.refactor",TJ="editor.action.sourceAction",MJ="editor.action.organizeImports",AJ="editor.action.fixAll";class OJ{constructor(e,t){this.action=e,this.provider=t}resolve(e){var t;return NJ(this,void 0,void 0,(function*(){if((null===(t=this.provider)||void 0===t?void 0:t.resolveCodeAction)&&!this.action.edit){let t;try{t=yield this.provider.resolveCodeAction(this.action,e)}catch(i){Ta(i)}t&&(this.action.edit=t.edit)}return this}))}}class RJ extends Uo{constructor(e,t,i){super(),this.documentation=t,this._register(i),this.allActions=[...e].sort(RJ.codeActionsComparator),this.validActions=this.allActions.filter((({action:e})=>!e.disabled))}static codeActionsComparator({action:e},{action:t}){return e.isPreferred&&!t.isPreferred?-1:!e.isPreferred&&t.isPreferred?1:gs(e.diagnostics)?gs(t.diagnostics)?e.diagnostics[0].message.localeCompare(t.diagnostics[0].message):-1:gs(t.diagnostics)?1:0}get hasAutoFix(){return this.validActions.some((({action:e})=>!!e.kind&&kJ.QuickFix.contains(new kJ(e.kind))&&!!e.isPreferred))}}const PJ={actions:[],documentation:void 0};function FJ(e,t,i,n,o,s){var r;const a=n.filter||{},l={only:null===(r=a.include)||void 0===r?void 0:r.value,trigger:n.type},d=new yX(t,s),c=function(e,t,i){return e.all(t).filter((e=>!e.providedCodeActionKinds||e.providedCodeActionKinds.some((e=>function(e,t){return!(e.include&&!e.include.intersects(t)||e.excludes&&e.excludes.some((i=>DJ(t,i,e.include)))||!e.includeSourceActions&&kJ.Source.contains(t))}(i,new kJ(e))))))}(e,t,a),h=new ws,u=c.map((e=>NJ(this,void 0,void 0,(function*(){try{o.report(e);const n=yield e.provideCodeActions(t,i,l,d.token);if(n&&h.add(n),d.token.isCancellationRequested)return PJ;const s=((null==n?void 0:n.actions)||[]).filter((e=>e&&function(e,t){const i=t.kind?new kJ(t.kind):void 0;return!(!(!e.include||i&&e.include.contains(i))||e.excludes&&i&&e.excludes.some((t=>DJ(i,t,e.include)))||!e.includeSourceActions&&i&&kJ.Source.contains(i)||e.onlyIncludePreferredActions&&!t.isPreferred)}(a,e))),r=function(e,t,i){if(!e.documentation)return;const n=e.documentation.map((e=>({kind:new kJ(e.kind),command:e.command})));if(i){let e;for(const t of n)t.kind.contains(i)&&(e?e.kind.contains(t.kind)&&(e=t):e=t);if(e)return null==e?void 0:e.command}for(const o of t)if(o.kind)for(const e of n)if(e.kind.contains(new kJ(o.kind)))return e.command;return}(e,s,a.include);return{actions:s.map((t=>new OJ(t,e))),documentation:r}}catch(n){if(Ea(n))throw n;return Ta(n),PJ}})))),g=e.onDidChange((()=>{const i=e.all(t);jo(i,c)||d.cancel()}));return Promise.all(u).then((e=>{const t=ba(e.map((e=>e.actions))),i=Sa(e.map((e=>e.documentation)));return new RJ(t,i,h)})).finally((()=>{g.dispose(),d.dispose()}))}Cy.registerCommand("_executeCodeActionProvider",(function(e,t,i,n,o){return NJ(this,void 0,void 0,(function*(){if(!(t instanceof Ps))throw Ms();const{codeActionProvider:s}=e.get(Lb),r=e.get(Gv).getModel(t);if(!r)throw Ms();const a=ar.isISelection(i)?ar.liftSelection(i):qo.isIRange(i)?r.validateRange(i):void 0;if(!a)throw Ms();const l="string"==typeof n?new kJ(n):void 0,d=yield FJ(s,r,a,{type:1,filter:{includeSourceActions:!0,include:l}},UB.None,Ia.None),c=[],h=Math.min(d.validActions.length,"number"==typeof o?o:0);for(let e=0;e<h;e++)c.push(d.validActions[e].resolve(Ia.None));try{return yield Promise.all(c),d.validActions.map((e=>e.action))}finally{setTimeout((()=>d.dispose()),100)}}))}));var BJ=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},VJ=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};let WJ=class e{constructor(t,i){this._messageWidget=new Rr,this._messageListeners=new ws,this._editor=t,this._visible=e.MESSAGE_VISIBLE.bindTo(i),this._editorListener=this._editor.onDidAttemptReadOnlyEdit((()=>this._onDidAttemptReadOnlyEdit()))}static get(t){return t.getContribution(e.ID)}dispose(){this._editorListener.dispose(),this._messageListeners.dispose(),this._messageWidget.dispose(),this._visible.reset()}showMessage(e,t){let i;dy(e),this._visible.set(!0),this._messageWidget.clear(),this._messageListeners.clear(),this._messageWidget.value=new zJ(this._editor,t,e),this._messageListeners.add(this._editor.onDidBlurEditorText((()=>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(new rb((()=>this.closeMessage()),3e3)),this._messageListeners.add(this._editor.onMouseMove((e=>{e.target.position&&(i?i.containsPosition(e.target.position)||this.closeMessage():i=new qo(t.lineNumber-3,1,e.target.position.lineNumber+3,1))})))}closeMessage(){this._visible.reset(),this._messageListeners.clear(),this._messageWidget.value&&this._messageListeners.add(zJ.fadeOut(this._messageWidget.value))}_onDidAttemptReadOnlyEdit(){this._editor.hasModel()&&this.showMessage(mf(0,"Cannot edit in read-only editor"),this._editor.getPosition())}};WJ.ID="editor.contrib.messageController",WJ.MESSAGE_VISIBLE=new Uy("messageVisible",!1,mf(0,"Whether the editor is currently showing an inline message")),WJ=BJ([VJ(1,$y)],WJ);Dx(new(yx.bindToContribution(WJ.get))({id:"leaveEditorMessage",precondition:WJ.MESSAGE_VISIBLE,handler:e=>e.closeMessage(),kbOpts:{weight:130,primary:9}}));class zJ{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-1},this._domNode=document.createElement("div"),this._domNode.classList.add("monaco-editor-overlaymessage");const o=document.createElement("div");o.classList.add("anchor","top"),this._domNode.appendChild(o);const s=document.createElement("div");s.classList.add("message"),s.textContent=n,this._domNode.appendChild(s);const r=document.createElement("div");r.classList.add("anchor","below"),this._domNode.appendChild(r),this._editor.addContentWidget(this),this._domNode.classList.add("fadeIn")}static fadeOut(e){let t;const i=()=>{e.dispose(),clearTimeout(t),e.getDomNode().removeEventListener("animationend",i)};return t=setTimeout(i,110),e.getDomNode().addEventListener("animationend",i),e.getDomNode().classList.add("fadeOut"),{dispose:i}}dispose(){this._editor.removeContentWidget(this)}getId(){return"messageoverlay"}getDomNode(){return this._domNode}getPosition(){return{position:this._position,preference:[1,2]}}afterRender(e){this._domNode.classList.toggle("below",2===e)}}Ix(WJ.ID,WJ);var HJ=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},jJ=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}},UJ=globalThis&&globalThis.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{l(n.next(e))}catch(t){s(t)}}function a(e){try{l(n.throw(e))}catch(t){s(t)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}l((n=n.apply(e,t||[])).next())}))};class $J extends my{constructor(e,t){super(e.command?e.command.id:e.title,e.title.replace(/\r\n|\r|\n/g," "),void 0,!e.disabled,t),this.action=e}}let KJ=class extends Uo{constructor(e,t,i,n,o){super(),this._editor=e,this._delegate=t,this._contextMenuService=i,this._languageFeaturesService=o,this._visible=!1,this._showingActions=this._register(new Rr),this._keybindingResolver=new qJ({getKeybindings:()=>n.getKeybindings()})}get isVisible(){return this._visible}show(e,t,i,n){return UJ(this,void 0,void 0,(function*(){const o=n.includeDisabledActions?t.allActions:t.validActions;if(!o.length)return void(this._visible=!1);if(!this._editor.getDomNode())throw this._visible=!1,_s();this._visible=!0,this._showingActions.value=t;const s=this.getMenuActions(e,o,t.documentation),r=er.isIPosition(i)?this._toCoords(i):i||{x:0,y:0},a=this._keybindingResolver.getResolver(),l=this._editor.getOption(115);this._contextMenuService.showContextMenu({domForShadowRoot:l?this._editor.getDomNode():void 0,getAnchor:()=>r,getActions:()=>s,onHide:()=>{this._visible=!1,this._editor.focus()},autoSelectFirstItem:!0,getKeyBinding:e=>e instanceof $J?a(e.action):void 0})}))}getMenuActions(e,t,i){var n,o;const s=e=>new $J(e.action,(()=>this._delegate.onSelectCodeAction(e))),r=t.map(s),a=[...i],l=this._editor.getModel();if(l&&r.length)for(const d of this._languageFeaturesService.codeActionProvider.all(l))d._getAdditionalMenuItems&&a.push(...d._getAdditionalMenuItems({trigger:e.type,only:null===(o=null===(n=e.filter)||void 0===n?void 0:n.include)||void 0===o?void 0:o.value},t.map((e=>e.action))));return a.length&&r.push(new _y,...a.map((e=>s(new OJ({title:e.title,command:e},void 0))))),r}_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=yC(this._editor.getDomNode());return{x:i.left+t.left,y:i.top+t.top+t.height}}};KJ=HJ([jJ(2,WB),jJ(3,kW),jJ(4,Lb)],KJ);class qJ{constructor(e){this._keybindingProvider=e}getResolver(){const e=new Rl((()=>this._keybindingProvider.getKeybindings().filter((e=>qJ.codeActionCommands.indexOf(e.command)>=0)).filter((e=>e.resolvedKeybinding)).map((e=>{let t=e.commandArgs;return e.command===MJ?t={kind:kJ.SourceOrganizeImports.value}:e.command===AJ&&(t={kind:kJ.SourceFixAll.value}),Object.assign({resolvedKeybinding:e.resolvedKeybinding},LJ.fromUser(t,{kind:kJ.None,apply:"never"}))}))));return t=>{if(t.kind){const i=this.bestKeybindingForCodeAction(t,e.getValue());return null==i?void 0:i.resolvedKeybinding}}}bestKeybindingForCodeAction(e,t){if(!e.kind)return;const i=new kJ(e.kind);return t.filter((e=>e.kind.contains(i))).filter((t=>!t.preferred||e.isPreferred)).reduceRight(((e,t)=>e?e.kind.contains(t.kind)?t:e:t),void 0)}}qJ.codeActionCommands=[IJ,EJ,TJ,MJ,AJ];var GJ,ZJ=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},YJ=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};!function(e){e.Hidden={type:0};e.Showing=class{constructor(e,t,i,n){this.actions=e,this.trigger=t,this.editorPosition=i,this.widgetPosition=n,this.type=1}}}(GJ||(GJ={}));let XJ=class e extends Uo{constructor(e,t,i,n){var o;super(),this._editor=e,this._quickFixActionId=t,this._preferredFixActionId=i,this._keybindingService=n,this._onClick=this._register(new $o),this.onClick=this._onClick.event,this._state=GJ.Hidden,this._domNode=document.createElement("div"),this._domNode.className=br.lightBulb.classNames,this._editor.addContentWidget(this),this._register(this._editor.onDidChangeModelContent((e=>{const t=this._editor.getModel();(1!==this.state.type||!t||this.state.editorPosition.lineNumber>=t.getLineCount())&&this.hide()}))),oS.ignoreTarget(this._domNode),this._register(rC(this._domNode,oC((e=>{if(1!==this.state.type)return;this._editor.focus(),e.preventDefault();const{top:t,height:i}=yC(this._domNode),n=this._editor.getOption(59);let o=Math.floor(n/3);null!==this.state.widgetPosition.position&&this.state.widgetPosition.position.lineNumber<this.state.editorPosition.lineNumber&&(o+=n),this._onClick.fire({x:e.posx,y:t+i+o,actions:this.state.actions,trigger:this.state.trigger})})),o)),this._register(nC(this._domNode,"mouseenter",(e=>{if(1!=(1&e.buttons))return;this.hide();const t=new rS;t.startMonitoring(e.target,e.buttons,sS,(()=>{}),(()=>{t.dispose()}))}))),this._register(this._editor.onDidChangeConfiguration((e=>{e.hasChanged(57)&&!this._editor.getOption(57).enabled&&this.hide()}))),this._updateLightBulbTitleAndIcon(),this._register(this._keybindingService.onDidUpdateKeybindings(this._updateLightBulbTitleAndIcon,this))}dispose(){super.dispose(),this._editor.removeContentWidget(this)}getId(){return"LightBulbWidget"}getDomNode(){return this._domNode}getPosition(){return 1===this._state.type?this._state.widgetPosition:null}update(t,i,n){if(t.validActions.length<=0)return this.hide();const o=this._editor.getOptions();if(!o.get(57).enabled)return this.hide();const s=this._editor.getModel();if(!s)return this.hide();const{lineNumber:r,column:a}=s.validatePosition(n),l=s.getOptions().tabSize,d=o.get(44),c=yT(s.getLineContent(r),l),h=e=>e>2&&this._editor.getTopForLineNumber(e)===this._editor.getTopForLineNumber(e-1);let u=r;if(!(d.spaceWidth*c>22))if(r>1&&!h(r-1))u-=1;else if(h(r+1)){if(a*d.spaceWidth<22)return this.hide()}else u+=1;this.state=new GJ.Showing(t,i,n,{position:{lineNumber:u,column:1},preference:e._posPref}),this._editor.layoutContentWidget(this)}hide(){this.state=GJ.Hidden,this._editor.layoutContentWidget(this)}get state(){return this._state}set state(e){this._state=e,this._updateLightBulbTitleAndIcon()}_updateLightBulbTitleAndIcon(){if(1===this.state.type&&this.state.actions.hasAutoFix){this._domNode.classList.remove(...br.lightBulb.classNamesArray),this._domNode.classList.add(...br.lightbulbAutofix.classNamesArray);const e=this._keybindingService.lookupKeybinding(this._preferredFixActionId);if(e)return void(this.title=mf(0,"Show Code Actions. Preferred Quick Fix Available ({0})",e.getLabel()))}this._domNode.classList.remove(...br.lightbulbAutofix.classNamesArray),this._domNode.classList.add(...br.lightBulb.classNamesArray);const e=this._keybindingService.lookupKeybinding(this._quickFixActionId);this.title=e?mf(0,"Show Code Actions ({0})",e.getLabel()):mf(0,"Show Code Actions")}set title(e){this._domNode.title=e}};XJ._posPref=[0],XJ=ZJ([YJ(3,kW)],XJ),sx(((e,t)=>{var i;const n=null===(i=e.getColor(pk))||void 0===i?void 0:i.transparent(.7),o=e.getColor(Qk);o&&t.addRule(`\n\t\t.monaco-editor .contentWidgets ${br.lightBulb.cssSelector} {\n\t\t\tcolor: ${o};\n\t\t\tbackground-color: ${n};\n\t\t}`);const s=e.getColor(Jk);s&&t.addRule(`\n\t\t.monaco-editor .contentWidgets ${br.lightbulbAutofix.cssSelector} {\n\t\t\tcolor: ${s};\n\t\t\tbackground-color: ${n};\n\t\t}`)}));var QJ,JJ=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},e0=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}},t0=globalThis&&globalThis.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{l(n.next(e))}catch(t){s(t)}}function a(e){try{l(n.throw(e))}catch(t){s(t)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}l((n=n.apply(e,t||[])).next())}))},i0=globalThis&&globalThis.__classPrivateFieldSet||function(e,t,i,n,o){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?o.call(e,i):o?o.value=i:t.set(e,i),i},n0=globalThis&&globalThis.__classPrivateFieldGet||function(e,t,i,n){if("a"===i&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?n:"a"===i?n.call(e):n?n.value:t.get(e)};let o0=class extends Uo{constructor(e,t,i,n,o){super(),this._editor=e,this.delegate=n,this._activeCodeActions=this._register(new Rr),QJ.set(this,!1),this._codeActionWidget=new Rl((()=>this._register(o.createInstance(KJ,this._editor,{onSelectCodeAction:e=>t0(this,void 0,void 0,(function*(){this.delegate.applyCodeAction(e,!0)}))})))),this._lightBulbWidget=new Rl((()=>{const e=this._register(o.createInstance(XJ,this._editor,t,i));return this._register(e.onClick((e=>this.showCodeActionList(e.trigger,e.actions,e,{includeDisabledActions:!1})))),e}))}dispose(){i0(this,QJ,!0,"f"),super.dispose()}update(e){var t,i,n,o,s;return t0(this,void 0,void 0,(function*(){if(1!==e.type)return void(null===(t=this._lightBulbWidget.rawValue)||void 0===t||t.hide());let r;try{r=yield e.actions}catch(a){return void Jo(a)}if(!n0(this,QJ,"f"))if(this._lightBulbWidget.getValue().update(r,e.trigger,e.position),1===e.trigger.type){if(null===(i=e.trigger.filter)||void 0===i?void 0:i.include){const t=this.tryGetValidActionToApply(e.trigger,r);if(t){try{this._lightBulbWidget.getValue().hide(),yield this.delegate.applyCodeAction(t,!1)}finally{r.dispose()}return}if(e.trigger.context){const t=this.getInvalidActionThatWouldHaveBeenApplied(e.trigger,r);if(t&&t.action.disabled)return null===(n=WJ.get(this._editor))||void 0===n||n.showMessage(t.action.disabled,e.trigger.context.position),void r.dispose()}}const t=!!(null===(o=e.trigger.filter)||void 0===o?void 0:o.include);if(e.trigger.context&&(!r.allActions.length||!t&&!r.validActions.length))return null===(s=WJ.get(this._editor))||void 0===s||s.showMessage(e.trigger.context.notAvailableMessage,e.trigger.context.position),this._activeCodeActions.value=r,void r.dispose();this._activeCodeActions.value=r,this._codeActionWidget.getValue().show(e.trigger,r,e.position,{includeDisabledActions:t})}else this._codeActionWidget.getValue().isVisible?r.dispose():this._activeCodeActions.value=r}))}getInvalidActionThatWouldHaveBeenApplied(e,t){if(t.allActions.length)return"first"===e.autoApply&&0===t.validActions.length||"ifSingle"===e.autoApply&&1===t.allActions.length?t.allActions.find((({action:e})=>e.disabled)):void 0}tryGetValidActionToApply(e,t){if(t.validActions.length)return"first"===e.autoApply&&t.validActions.length>0||"ifSingle"===e.autoApply&&1===t.validActions.length?t.validActions[0]:void 0}showCodeActionList(e,t,i,n){return t0(this,void 0,void 0,(function*(){this._codeActionWidget.getValue().show(e,t,i,n)}))}};QJ=new WeakMap,o0=JJ([e0(4,k_)],o0);var s0,r0=globalThis&&globalThis.__classPrivateFieldGet||function(e,t,i,n){if("a"===i&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?n:"a"===i?n.call(e):n?n.value:t.get(e)},a0=globalThis&&globalThis.__classPrivateFieldSet||function(e,t,i,n,o){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?o.call(e,i):o?o.value=i:t.set(e,i),i};const l0=new Uy("supportedCodeAction","");class d0 extends Uo{constructor(e,t,i,n=250){super(),this._editor=e,this._markerService=t,this._signalChange=i,this._delay=n,this._autoTriggerTimer=this._register(new rb),this._register(this._markerService.onMarkerChanged((e=>this._onMarkerChanges(e)))),this._register(this._editor.onDidChangeCursorPosition((()=>this._onCursorChange())))}trigger(e){const t=this._getRangeOfSelectionUnlessWhitespaceEnclosed(e);return this._createEventAndSignalChange(e,t)}_onMarkerChanges(e){const t=this._editor.getModel();t&&e.some((e=>iR(e,t.uri)))&&this._autoTriggerTimer.cancelAndSet((()=>{this.trigger({type:2})}),this._delay)}_onCursorChange(){this._autoTriggerTimer.cancelAndSet((()=>{this.trigger({type:2})}),this._delay)}_getRangeOfMarker(e){const t=this._editor.getModel();if(t)for(const i of this._markerService.read({resource:t.uri})){const n=t.validateRange(i);if(qo.intersectRanges(n,e))return qo.lift(n)}}_getRangeOfSelectionUnlessWhitespaceEnclosed(e){if(!this._editor.hasModel())return;const t=this._editor.getModel(),i=this._editor.getSelection();if(i.isEmpty()&&2===e.type){const{lineNumber:e,column:n}=i.getPosition(),o=t.getLineContent(e);if(0===o.length)return;if(1===n){if(/\s/.test(o[0]))return}else if(n===t.getLineMaxColumn(e)){if(/\s/.test(o[o.length-1]))return}else if(/\s/.test(o[n-2])&&/\s/.test(o[n-1]))return}return i}_createEventAndSignalChange(e,t){const i=this._editor.getModel();if(!t||!i)return void this._signalChange(void 0);const n=this._getRangeOfMarker(t),o=n?n.getStartPosition():t.getStartPosition(),s={trigger:e,selection:t,position:o};return this._signalChange(s),s}}var c0;!function(e){e.Empty={type:0};e.Triggered=class{constructor(e,t,i,n){this.trigger=e,this.rangeOrSelection=t,this.position=i,this._cancellablePromise=n,this.type=1,this.actions=n.catch((e=>{if(Ea(e))return h0;throw e}))}cancel(){this._cancellablePromise.cancel()}}}(c0||(c0={}));const h0={allActions:[],validActions:[],dispose:()=>{},documentation:[],hasAutoFix:!1};class u0 extends Uo{constructor(e,t,i,n,o){super(),this._editor=e,this._registry=t,this._markerService=i,this._progressService=o,this._codeActionOracle=this._register(new Rr),this._state=c0.Empty,this._onDidChangeState=this._register(new $o),this.onDidChangeState=this._onDidChangeState.event,s0.set(this,!1),this._supportedCodeActions=l0.bindTo(n),this._register(this._editor.onDidChangeModel((()=>this._update()))),this._register(this._editor.onDidChangeModelLanguage((()=>this._update()))),this._register(this._registry.onDidChange((()=>this._update()))),this._update()}dispose(){r0(this,s0,"f")||(a0(this,s0,!0,"f"),super.dispose(),this.setState(c0.Empty,!0))}_update(){if(r0(this,s0,"f"))return;this._codeActionOracle.value=void 0,this.setState(c0.Empty);const e=this._editor.getModel();if(e&&this._registry.has(e)&&!this._editor.getOption(81)){const t=[];for(const i of this._registry.all(e))Array.isArray(i.providedCodeActionKinds)&&t.push(...i.providedCodeActionKinds);this._supportedCodeActions.set(t.join(" ")),this._codeActionOracle.value=new d0(this._editor,this._markerService,(t=>{var i;if(!t)return void this.setState(c0.Empty);const n=Xv((i=>FJ(this._registry,e,t.selection,t.trigger,UB.None,i)));1===t.trigger.type&&(null===(i=this._progressService)||void 0===i||i.showWhile(n,250)),this.setState(new c0.Triggered(t.trigger,t.selection,t.position,n))}),void 0),this._codeActionOracle.value.trigger({type:2})}else this._supportedCodeActions.reset()}trigger(e){this._codeActionOracle.value&&this._codeActionOracle.value.trigger(e)}setState(e,t){e!==this._state&&(1===this._state.type&&this._state.cancel(),this._state=e,t||r0(this,s0,"f")||this._onDidChangeState.fire(e))}}s0=new WeakMap;var g0=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},p0=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}},m0=globalThis&&globalThis.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{l(n.next(e))}catch(t){s(t)}}function a(e){try{l(n.throw(e))}catch(t){s(t)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}l((n=n.apply(e,t||[])).next())}))};function f0(e){return Sy.regex(l0.keys()[0],new RegExp("(\\s|^)"+Xo(e.value)+"\\b"))}const _0={type:"object",defaultSnippets:[{body:{kind:""}}],properties:{kind:{type:"string",description:mf(0,"Kind of the code action to run.")},apply:{type:"string",description:mf(0,"Controls when the returned actions are applied."),default:"ifSingle",enum:["first","ifSingle","never"],enumDescriptions:[mf(0,"Always apply the first returned code action."),mf(0,"Apply the first returned code action if it is the only one."),mf(0,"Do not apply the returned code actions.")]},preferred:{type:"boolean",default:!1,description:mf(0,"Controls if only preferred code actions should be returned.")}}};let v0=class e extends Uo{constructor(e,t,i,n,o,s){super(),this._instantiationService=o,this._editor=e,this._model=this._register(new u0(this._editor,s.codeActionProvider,t,i,n)),this._register(this._model.onDidChangeState((e=>this.update(e)))),this._ui=new Rl((()=>this._register(new o0(e,C0.Id,y0.Id,{applyCodeAction:(e,t)=>m0(this,void 0,void 0,(function*(){try{yield this._applyCodeAction(e)}finally{t&&this._trigger({type:2,filter:{}})}}))},this._instantiationService))))}static get(t){return t.getContribution(e.ID)}update(e){this._ui.getValue().update(e)}showCodeActions(e,t,i){return this._ui.getValue().showCodeActionList(e,t,i,{includeDisabledActions:!1})}manualTriggerAtCurrentPosition(e,t,i){var n;if(!this._editor.hasModel())return;null===(n=WJ.get(this._editor))||void 0===n||n.closeMessage();const o=this._editor.getPosition();this._trigger({type:1,filter:t,autoApply:i,context:{notAvailableMessage:e,position:o}})}_trigger(e){return this._model.trigger(e)}_applyCodeAction(e){return this._instantiationService.invokeFunction(b0,e,this._editor)}};function b0(e,t,i){return m0(this,void 0,void 0,(function*(){const n=e.get(lW),o=e.get(wy),s=e.get(vx),r=e.get(vF);if(s.publicLog2("codeAction.applyCodeAction",{codeActionTitle:t.action.title,codeActionKind:t.action.kind,codeActionIsPreferred:!!t.action.isPreferred}),yield t.resolve(Ia.None),t.action.edit&&(yield n.apply(dW.convert(t.action.edit),{editor:i,label:t.action.title})),t.action.command)try{yield o.executeCommand(t.action.command.id,...t.action.command.arguments||[])}catch(a){const e=function(e){return"string"==typeof e?e:e instanceof Error&&"string"==typeof e.message?e.message:void 0}(a);r.error("string"==typeof e?e:mf(0,"An unknown error occurred while applying the code action"))}}))}function w0(e,t,i,n){if(e.hasModel()){const o=v0.get(e);o&&o.manualTriggerAtCurrentPosition(t,i,n)}}v0.ID="editor.contrib.quickFixController",v0=g0([p0(1,pj),p0(2,$y),p0(3,$B),p0(4,k_),p0(5,Lb)],v0);class C0 extends xx{constructor(){super({id:C0.Id,label:mf(0,"Quick Fix..."),alias:"Quick Fix...",precondition:Sy.and(yI.writable,yI.hasCodeActionsProvider),kbOpts:{kbExpr:yI.editorTextFocus,primary:2132,weight:100}})}run(e,t){return w0(t,mf(0,"No code actions available"),void 0,void 0)}}C0.Id="editor.action.quickFix";class y0 extends xx{constructor(){super({id:y0.Id,label:mf(0,"Auto Fix..."),alias:"Auto Fix...",precondition:Sy.and(yI.writable,f0(kJ.QuickFix)),kbOpts:{kbExpr:yI.editorTextFocus,primary:1620,mac:{primary:2644},weight:100}})}run(e,t){return w0(t,mf(0,"No auto fixes available"),{include:kJ.QuickFix,onlyIncludePreferredActions:!0},"ifSingle")}}y0.Id="editor.action.autoFix",Ix(v0.ID,v0),Lx(C0),Lx(class extends xx{constructor(){super({id:IJ,label:mf(0,"Refactor..."),alias:"Refactor...",precondition:Sy.and(yI.writable,yI.hasCodeActionsProvider),kbOpts:{kbExpr:yI.editorTextFocus,primary:3120,mac:{primary:1328},weight:100},contextMenuOpts:{group:"1_modification",order:2,when:Sy.and(yI.writable,f0(kJ.Refactor))},description:{description:"Refactor...",args:[{name:"args",schema:_0}]}})}run(e,t,i){const n=LJ.fromUser(i,{kind:kJ.Refactor,apply:"never"});return w0(t,"string"==typeof(null==i?void 0:i.kind)?n.preferred?mf(0,"No preferred refactorings for '{0}' available",i.kind):mf(0,"No refactorings for '{0}' available",i.kind):n.preferred?mf(0,"No preferred refactorings available"):mf(0,"No refactorings available"),{include:kJ.Refactor.contains(n.kind)?n.kind:kJ.None,onlyIncludePreferredActions:n.preferred},n.apply)}}),Lx(class extends xx{constructor(){super({id:TJ,label:mf(0,"Source Action..."),alias:"Source Action...",precondition:Sy.and(yI.writable,yI.hasCodeActionsProvider),contextMenuOpts:{group:"1_modification",order:2.1,when:Sy.and(yI.writable,f0(kJ.Source))},description:{description:"Source Action...",args:[{name:"args",schema:_0}]}})}run(e,t,i){const n=LJ.fromUser(i,{kind:kJ.Source,apply:"never"});return w0(t,"string"==typeof(null==i?void 0:i.kind)?n.preferred?mf(0,"No preferred source actions for '{0}' available",i.kind):mf(0,"No source actions for '{0}' available",i.kind):n.preferred?mf(0,"No preferred source actions available"):mf(0,"No source actions available"),{include:kJ.Source.contains(n.kind)?n.kind:kJ.None,includeSourceActions:!0,onlyIncludePreferredActions:n.preferred},n.apply)}}),Lx(class extends xx{constructor(){super({id:MJ,label:mf(0,"Organize Imports"),alias:"Organize Imports",precondition:Sy.and(yI.writable,f0(kJ.SourceOrganizeImports)),kbOpts:{kbExpr:yI.editorTextFocus,primary:1581,weight:100}})}run(e,t){return w0(t,mf(0,"No organize imports action available"),{include:kJ.SourceOrganizeImports,includeSourceActions:!0},"ifSingle")}}),Lx(y0),Lx(class extends xx{constructor(){super({id:AJ,label:mf(0,"Fix All"),alias:"Fix All",precondition:Sy.and(yI.writable,f0(kJ.SourceFixAll))})}run(e,t){return w0(t,mf(0,"No fix all action available"),{include:kJ.SourceFixAll,includeSourceActions:!0},"ifSingle")}}),Dx(new class extends yx{constructor(){super({id:EJ,precondition:Sy.and(yI.writable,yI.hasCodeActionsProvider),description:{description:"Trigger a code action",args:[{name:"args",schema:_0}]}})}runEditorCommand(e,t,i){const n=LJ.fromUser(i,{kind:kJ.Empty,apply:"ifSingle"});return w0(t,"string"==typeof(null==i?void 0:i.kind)?n.preferred?mf(0,"No preferred code actions for '{0}' available",i.kind):mf(0,"No code actions for '{0}' available",i.kind):n.preferred?mf(0,"No preferred code actions available"):mf(0,"No code actions available"),{include:n.kind,includeSourceActions:!0,onlyIncludePreferredActions:n.preferred},n.apply)}});var x0=globalThis&&globalThis.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{l(n.next(e))}catch(t){s(t)}}function a(e){try{l(n.throw(e))}catch(t){s(t)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}l((n=n.apply(e,t||[])).next())}))};class S0{constructor(){this.lenses=[],this._disposables=new ws}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})}}function k0(e,t,i){return x0(this,void 0,void 0,(function*(){const n=e.ordered(t),o=new Map,s=new S0,r=n.map(((e,n)=>x0(this,void 0,void 0,(function*(){o.set(e,n);try{const n=yield Promise.resolve(e.provideCodeLenses(t,i));n&&s.add(n,e)}catch(r){Ta(r)}}))));return yield Promise.all(r),s.lenses=s.lenses.sort(((e,t)=>e.symbol.range.startLineNumber<t.symbol.range.startLineNumber?-1:e.symbol.range.startLineNumber>t.symbol.range.startLineNumber?1:o.get(e.provider)<o.get(t.provider)?-1:o.get(e.provider)>o.get(t.provider)?1:e.symbol.range.startColumn<t.symbol.range.startColumn?-1:e.symbol.range.startColumn>t.symbol.range.startColumn?1:0)),s}))}Cy.registerCommand("_executeCodeLensProvider",(function(e,...t){let[i,n]=t;Js(Ps.isUri(i)),Js("number"==typeof n||!n);const{codeLensProvider:o}=e.get(Lb),s=e.get(Gv).getModel(i);if(!s)throw Ms();const r=[],a=new ws;return k0(o,s,Ia.None).then((e=>{a.add(e);let t=[];for(const i of e.lenses)null==n||Boolean(i.symbol.command)?r.push(i.symbol):n-- >0&&i.provider.resolveCodeLens&&t.push(Promise.resolve(i.provider.resolveCodeLens(s,i.symbol,Ia.None)).then((e=>r.push(e||i.symbol))));return Promise.all(t)})).then((()=>r)).finally((()=>{setTimeout((()=>a.dispose()),100)}))}));var D0=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},L0=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};const N0=L_("ICodeLensCache");class E0{constructor(e,t){this.lineCount=e,this.data=t}}let I0=class{constructor(e){this._fakeProvider=new class{provideCodeLenses(){throw new Error("not supported")}},this._cache=new QV(20,.75);db((()=>e.remove("codelens/cache",1)));const t="codelens/cache2",i=e.get(t,1,"{}");this._deserialize(i),kr(e.onWillSaveState)((i=>{i.reason===wZ.SHUTDOWN&&e.store(t,this._serialize(),1,1)}))}put(e,t){const i=t.lenses.map((e=>{var t;return{range:e.symbol.range,command:e.symbol.command&&{id:"",title:null===(t=e.symbol.command)||void 0===t?void 0:t.title}}})),n=new S0;n.add({lenses:i,dispose:()=>{}},this._fakeProvider);const o=new E0(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 e of i.data.lenses)n.add(e.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 e in t){const i=t[e],n=[];for(const e of i.lines)n.push({range:new qo(e,1,e,11)});const o=new S0;o.add({lenses:n,dispose(){}},this._fakeProvider),this._cache.set(e,new E0(i.lineCount,o))}}catch(Bte){}}};I0=D0([L0(0,bZ)],I0),Iv(N0,I0);class T0{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){void 0===this._lastHeight?this._lastHeight=e:this._lastHeight!==e&&(this._lastHeight=e,this._onHeight())}isVisible(){return 0!==this._lastHeight&&this.domNode.hasAttribute("monaco-visible-view-zone")}}class M0{constructor(e,t,i){this.allowEditorOverflow=!1,this.suppressMouseDown=!0,this._commands=new Map,this._isEmpty=!0,this._editor=e,this._id="codelens.widget-"+M0._idPool++,this.updatePosition(i),this._domNode=document.createElement("span"),this._domNode.className=`codelens-decoration ${t}`}withCommands(e,t){this._commands.clear();let i=[],n=!1;for(let o=0;o<e.length;o++){const t=e[o];if(t&&(n=!0,t.command)){const n=Jj(t.command.title.trim());t.command.id?(i.push(YC("a",{id:String(o),title:t.command.tooltip},...n)),this._commands.set(String(o),t.command)):i.push(YC("span",{title:t.command.tooltip},...n)),o+1<e.length&&i.push(YC("span",void 0," | "))}}n?(KC(this._domNode,...i),this._isEmpty&&t&&this._domNode.classList.add("fadein"),this._isEmpty=!1):KC(this._domNode,YC("span",void 0,"no commands"))}getCommand(e){return e.parentElement===this._domNode?this._commands.get(e.id):void 0}getId(){return this._id}getDomNode(){return this._domNode}updatePosition(e){const t=this._editor.getModel().getLineFirstNonWhitespaceColumn(e);this._widgetPosition={position:{lineNumber:e,column:t},preference:[1]}}getPosition(){return this._widgetPosition||null}}M0._idPool=0;class A0{constructor(){this._removeDecorations=[],this._addDecorations=[],this._addDecorationsCallbacks=[]}addDecoration(e,t){this._addDecorations.push(e),this._addDecorationsCallbacks.push(t)}removeDecoration(e){this._removeDecorations.push(e)}commit(e){let t=e.deltaDecorations(this._removeDecorations,this._addDecorations);for(let i=0,n=t.length;i<n;i++)this._addDecorationsCallbacks[i](t[i])}}class O0{constructor(e,t,i,n,o,s,r){let a;this._isDisposed=!1,this._editor=t,this._className=i,this._data=e,this._decorationIds=[];let l=[];this._data.forEach(((e,t)=>{e.symbol.command&&l.push(e.symbol),n.addDecoration({range:e.symbol.range,options:GP.EMPTY},(e=>this._decorationIds[t]=e)),a=a?qo.plusRange(a,e.symbol.range):qo.lift(e.symbol.range)})),this._viewZone=new T0(a.startLineNumber-1,s,r),this._viewZoneId=o.addZone(this._viewZone),l.length>0&&(this._createContentWidgetIfNecessary(),this._contentWidget.withCommands(l,!1))}_createContentWidgetIfNecessary(){this._contentWidget?this._editor.layoutContentWidget(this._contentWidget):(this._contentWidget=new M0(this._editor,this._className,this._viewZone.afterLineNumber+1),this._editor.addContentWidget(this._contentWidget))}dispose(e,t){this._decorationIds.forEach(e.removeDecoration,e),this._decorationIds=[],t&&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||qo.isEmpty(n.range)!==i.isEmpty())}))}updateCodeLensSymbols(e,t){this._decorationIds.forEach(t.removeDecoration,t),this._decorationIds=[],this._data=e,this._data.forEach(((e,i)=>{t.addDecoration({range:e.symbol.range,options:GP.EMPTY},(e=>this._decorationIds[i]=e))}))}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<this._decorationIds.length;t++){const i=e.getDecorationRange(this._decorationIds[t]);i&&(this._data[t].symbol.range=i)}return this._data}updateCommands(e){this._createContentWidgetIfNecessary(),this._contentWidget.withCommands(e,!0);for(let t=0;t<this._data.length;t++){const i=e[t];if(i){const{symbol:e}=this._data[t];e.command=i.command||e.command}}}getCommand(e){var t;return null===(t=this._contentWidget)||void 0===t?void 0:t.getCommand(e)}getLineNumber(){const e=this._editor.getModel().getDecorationRange(this._decorationIds[0]);return e?e.startLineNumber:-1}update(e){if(this.isValid()){const t=this._editor.getModel().getDecorationRange(this._decorationIds[0]);t&&(this._viewZone.afterLineNumber=t.startLineNumber-1,e.layoutZone(this._viewZoneId),this._contentWidget&&(this._contentWidget.updatePosition(t.startLineNumber),this._editor.layoutContentWidget(this._contentWidget)))}}}var R0=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},P0=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}},F0=globalThis&&globalThis.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{l(n.next(e))}catch(t){s(t)}}function a(e){try{l(n.throw(e))}catch(t){s(t)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}l((n=n.apply(e,t||[])).next())}))};let B0=class{constructor(e,t,i,n,o,s){this._editor=e,this._languageFeaturesService=t,this._commandService=n,this._notificationService=o,this._codeLensCache=s,this._disposables=new ws,this._localToDispose=new ws,this._lenses=[],this._oldCodeLensModels=new ws,this._provideCodeLensDebounce=i.for(t.codeLensProvider,"CodeLensProvide",{min:250}),this._resolveCodeLensesDebounce=i.for(t.codeLensProvider,"CodeLensResolve",{min:250,salt:"resolve"}),this._resolveCodeLensesScheduler=new lb((()=>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((e=>{(e.hasChanged(44)||e.hasChanged(16)||e.hasChanged(15))&&this._updateLensStyle(),e.hasChanged(14)&&this._onModelChange()}))),this._disposables.add(t.codeLensProvider.onDidChange(this._onModelChange,this)),this._onModelChange(),this._styleClassName="_"+Pl(this._editor.getId()).toString(16),this._styleElement=RC(MC(this._editor.getContainerDomNode())?this._editor.getContainerDomNode():void 0),this._updateLensStyle()}dispose(){var e;this._localDispose(),this._disposables.dispose(),this._oldCodeLensModels.dispose(),null===(e=this._currentCodeLensModel)||void 0===e||e.dispose(),this._styleElement.remove()}_getLayoutInfo(){let e,t=this._editor.getOption(16);return!t||t<5?(t=.9*this._editor.getOption(46)|0,e=this._editor.getOption(59)):e=t*Math.max(1.3,this._editor.getOption(59)/this._editor.getOption(46))|0,{codeLensHeight:e,fontSize:t}}_updateLensStyle(){const{codeLensHeight:e,fontSize:t}=this._getLayoutInfo(),i=this._editor.getOption(15),n=this._editor.getOption(44),o=`--codelens-font-family${this._styleClassName}`,s=`--codelens-font-features${this._styleClassName}`;let r=`\n\t\t.monaco-editor .codelens-decoration.${this._styleClassName} { line-height: ${e}px; font-size: ${t}px; padding-right: ${Math.round(.5*t)}px; font-feature-settings: var(${s}) }\n\t\t.monaco-editor .codelens-decoration.${this._styleClassName} span.codicon { line-height: ${e}px; font-size: ${t}px; }\n\t\t`;i&&(r+=`.monaco-editor .codelens-decoration.${this._styleClassName} { font-family: var(${o}), ${Gf.fontFamily}}`),this._styleElement.textContent=r,this._editor.getContainerDomNode().style.setProperty(o,null!=i?i:"inherit"),this._editor.getContainerDomNode().style.setProperty(s,n.fontFeatureSettings),this._editor.changeViewZones((t=>{for(let i of this._lenses)i.updateHeight(e,t)}))}_localDispose(){var e,t,i;null===(e=this._getCodeLensModelPromise)||void 0===e||e.cancel(),this._getCodeLensModelPromise=void 0,null===(t=this._resolveCodeLensesPromise)||void 0===t||t.cancel(),this._resolveCodeLensesPromise=void 0,this._localToDispose.clear(),this._oldCodeLensModels.clear(),null===(i=this._currentCodeLensModel)||void 0===i||i.dispose()}_onModelChange(){this._localDispose();const e=this._editor.getModel();if(!e)return;if(!this._editor.getOption(14))return;const t=this._codeLensCache.get(e);if(t&&this._renderCodeLensSymbols(t),!this._languageFeaturesService.codeLensProvider.has(e))return void(t&&this._localToDispose.add(ob((()=>{const i=this._codeLensCache.get(e);t===i&&(this._codeLensCache.delete(e),this._onModelChange())}),3e4)));for(const n of this._languageFeaturesService.codeLensProvider.all(e))if("function"==typeof n.onDidChange){let e=n.onDidChange((()=>i.schedule()));this._localToDispose.add(e)}const i=new lb((()=>{var t;const n=Date.now();null===(t=this._getCodeLensModelPromise)||void 0===t||t.cancel(),this._getCodeLensModelPromise=Xv((t=>k0(this._languageFeaturesService.codeLensProvider,e,t))),this._getCodeLensModelPromise.then((t=>{this._currentCodeLensModel&&this._oldCodeLensModels.add(this._currentCodeLensModel),this._currentCodeLensModel=t,this._codeLensCache.put(e,t);const o=this._provideCodeLensDebounce.update(e,Date.now()-n);i.delay=o,this._renderCodeLensSymbols(t),this._resolveCodeLensesInViewportSoon()}),Jo)}),this._provideCodeLensDebounce.get(e));this._localToDispose.add(i),this._localToDispose.add(es((()=>this._resolveCodeLensesScheduler.cancel()))),this._localToDispose.add(this._editor.onDidChangeModelContent((()=>{this._editor.changeDecorations((e=>{this._editor.changeViewZones((t=>{let i=[],n=-1;this._lenses.forEach((e=>{e.isValid()&&n!==e.getLineNumber()?(e.update(t),n=e.getLineNumber()):i.push(e)}));let o=new A0;i.forEach((e=>{e.dispose(o,t),this._lenses.splice(this._lenses.indexOf(e),1)})),o.commit(e)}))})),i.schedule()}))),this._localToDispose.add(this._editor.onDidFocusEditorWidget((()=>{i.schedule()}))),this._localToDispose.add(this._editor.onDidScrollChange((e=>{e.scrollTopChanged&&this._lenses.length>0&&this._resolveCodeLensesInViewportSoon()}))),this._localToDispose.add(this._editor.onDidLayoutChange((()=>{this._resolveCodeLensesInViewportSoon()}))),this._localToDispose.add(es((()=>{if(this._editor.getModel()){const e=hB.capture(this._editor);this._editor.changeDecorations((e=>{this._editor.changeViewZones((t=>{this._disposeAllLenses(e,t)}))})),e.restore(this._editor)}else this._disposeAllLenses(void 0,void 0)}))),this._localToDispose.add(this._editor.onMouseDown((e=>{if(9!==e.target.type)return;let t=e.target.element;if("SPAN"===(null==t?void 0:t.tagName)&&(t=t.parentElement),"A"===(null==t?void 0:t.tagName))for(const i of this._lenses){let e=i.getCommand(t);if(e){this._commandService.executeCommand(e.id,...e.arguments||[]).catch((e=>this._notificationService.error(e)));break}}}))),i.schedule()}_disposeAllLenses(e,t){const i=new A0;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;let t,i=this._editor.getModel().getLineCount(),n=[];for(let r of e.lenses){let e=r.symbol.range.startLineNumber;e<1||e>i||(t&&t[t.length-1].symbol.range.startLineNumber===e?t.push(r):(t=[r],n.push(t)))}const o=hB.capture(this._editor),s=this._getLayoutInfo();this._editor.changeDecorations((e=>{this._editor.changeViewZones((t=>{const i=new A0;let o=0,r=0;for(;r<n.length&&o<this._lenses.length;){let e=n[r][0].symbol.range.startLineNumber,a=this._lenses[o].getLineNumber();a<e?(this._lenses[o].dispose(i,t),this._lenses.splice(o,1)):a===e?(this._lenses[o].updateCodeLensSymbols(n[r],i),r++,o++):(this._lenses.splice(o,0,new O0(n[r],this._editor,this._styleClassName,i,t,s.codeLensHeight,(()=>this._resolveCodeLensesInViewportSoon()))),o++,r++)}for(;o<this._lenses.length;)this._lenses[o].dispose(i,t),this._lenses.splice(o,1);for(;r<n.length;)this._lenses.push(new O0(n[r],this._editor,this._styleClassName,i,t,s.codeLensHeight,(()=>this._resolveCodeLensesInViewportSoon()))),r++;i.commit(e)}))})),o.restore(this._editor)}_resolveCodeLensesInViewportSoon(){this._editor.getModel()&&this._resolveCodeLensesScheduler.schedule()}_resolveCodeLensesInViewport(){var e;null===(e=this._resolveCodeLensesPromise)||void 0===e||e.cancel(),this._resolveCodeLensesPromise=void 0;const t=this._editor.getModel();if(!t)return;const i=[],n=[];if(this._lenses.forEach((e=>{const o=e.computeIfNecessary(t);o&&(i.push(o),n.push(e))})),0===i.length)return;const o=Date.now(),s=Xv((e=>{const o=i.map(((i,o)=>{const s=new Array(i.length),r=i.map(((i,n)=>i.symbol.command||"function"!=typeof i.provider.resolveCodeLens?(s[n]=i.symbol,Promise.resolve(void 0)):Promise.resolve(i.provider.resolveCodeLens(t,i.symbol,e)).then((e=>{s[n]=e}),Ta)));return Promise.all(r).then((()=>{e.isCancellationRequested||n[o].isDisposed()||n[o].updateCommands(s)}))}));return Promise.all(o)}));this._resolveCodeLensesPromise=s,this._resolveCodeLensesPromise.then((()=>{const e=this._resolveCodeLensesDebounce.update(t,Date.now()-o);this._resolveCodeLensesScheduler.delay=e,this._currentCodeLensModel&&this._codeLensCache.put(t,this._currentCodeLensModel),this._oldCodeLensModels.clear(),s===this._resolveCodeLensesPromise&&(this._resolveCodeLensesPromise=void 0)}),(e=>{Jo(e),s===this._resolveCodeLensesPromise&&(this._resolveCodeLensesPromise=void 0)}))}getModel(){return this._currentCodeLensModel}};function V0(e,t,i,n){return Promise.resolve(i.provideColorPresentations(e,t,n))}B0.ID="css.editor.codeLens",B0=R0([P0(1,Lb),P0(2,oW),P0(3,wy),P0(4,vF),P0(5,N0)],B0),Ix(B0.ID,B0),Lx(class extends xx{constructor(){super({id:"codelens.showLensesInCurrentLine",precondition:yI.hasCodeLensProvider,label:mf(0,"Show CodeLens Commands For Current Line"),alias:"Show CodeLens Commands For Current Line"})}run(e,t){return F0(this,void 0,void 0,(function*(){if(!t.hasModel())return;const i=e.get(iG),n=e.get(wy),o=e.get(vF),s=t.getSelection().positionLineNumber,r=t.getContribution(B0.ID);if(!r)return;const a=r.getModel();if(!a)return;const l=[];for(const e of a.lenses)e.symbol.command&&e.symbol.range.startLineNumber===s&&l.push({label:e.symbol.command.title,command:e.symbol.command});if(0===l.length)return;const d=yield i.pick(l,{canPickMany:!1});if(d){if(a.isDisposed)return yield n.executeCommand(this.id);try{yield n.executeCommand(d.command.id,...d.command.arguments||[])}catch(c){o.error(c)}}}))}}),Cy.registerCommand("_executeDocumentColorProvider",(function(e,...t){const[i]=t;if(!(i instanceof Ps))throw Ms();const{colorProvider:n}=e.get(Lb),o=e.get(Gv).getModel(i);if(!o)throw Ms();const s=[],r=n.ordered(o).reverse().map((e=>Promise.resolve(e.provideDocumentColors(o,Ia.None)).then((e=>{if(Array.isArray(e))for(let t of e)s.push({range:t.range,color:[t.color.red,t.color.green,t.color.blue,t.color.alpha]})}))));return Promise.all(r).then((()=>s))})),Cy.registerCommand("_executeColorPresentationProvider",(function(e,...t){const[i,n]=t,{uri:o,range:s}=n;if(!(o instanceof Ps&&Array.isArray(i)&&4===i.length&&qo.isIRange(s)))throw Ms();const[r,a,l,d]=i,{colorProvider:c}=e.get(Lb),h=e.get(Gv).getModel(o);if(!h)throw Ms();const u={range:s,color:{red:r,green:a,blue:l,alpha:d}},g=[],p=c.ordered(h).reverse().map((e=>Promise.resolve(e.provideColorPresentations(h,u,Ia.None)).then((e=>{Array.isArray(e)&&g.push(...e)}))));return Promise.all(p).then((()=>g))}));var W0=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},z0=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}},H0=globalThis&&globalThis.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{l(n.next(e))}catch(t){s(t)}}function a(e){try{l(n.throw(e))}catch(t){s(t)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}l((n=n.apply(e,t||[])).next())}))};const j0=Object.create({});let U0=class e extends Uo{constructor(t,i,n,o){super(),this._editor=t,this._configurationService=i,this._languageFeaturesService=n,this._localToDispose=this._register(new ws),this._decorationsIds=[],this._colorDatas=new Map,this._colorDecoratorIds=new Set,this._ruleFactory=new VL(this._editor),this._colorDecorationClassRefs=this._register(new ws),this._debounceInformation=o.for(n.colorProvider,"Document Colors",{min:e.RECOMPUTE_TIME}),this._register(t.onDidChangeModel((()=>{this._isEnabled=this.isEnabled(),this.onModelChanged()}))),this._register(t.onDidChangeModelLanguage((()=>this.onModelChanged()))),this._register(n.colorProvider.onDidChange((()=>this.onModelChanged()))),this._register(t.onDidChangeConfiguration((()=>{let e=this._isEnabled;this._isEnabled=this.isEnabled(),e!==this._isEnabled&&(this._isEnabled?this.onModelChanged():this.removeAllDecorations())}))),this._timeoutTimer=null,this._computePromise=null,this._isEnabled=this.isEnabled(),this.onModelChanged()}isEnabled(){const e=this._editor.getModel();if(!e)return!1;const t=e.getLanguageId(),i=this._configurationService.getValue(t);if(i&&"object"==typeof i){const e=i.colorDecorators;if(e&&void 0!==e.enable&&!e.enable)return e.enable}return this._editor.getOption(17)}static get(e){return e.getContribution(this.ID)}dispose(){this.stop(),this.removeAllDecorations(),super.dispose()}onModelChanged(){if(this.stop(),!this._isEnabled)return;const e=this._editor.getModel();e&&this._languageFeaturesService.colorProvider.has(e)&&(this._localToDispose.add(this._editor.onDidChangeModelContent((()=>{this._timeoutTimer||(this._timeoutTimer=new rb,this._timeoutTimer.cancelAndSet((()=>{this._timeoutTimer=null,this.beginCompute()}),this._debounceInformation.get(e)))}))),this.beginCompute())}beginCompute(){this._computePromise=Xv((e=>H0(this,void 0,void 0,(function*(){const t=this._editor.getModel();if(!t)return Promise.resolve([]);const i=new ps(!1),n=yield function(e,t,i){const n=[],o=e.ordered(t).reverse().map((e=>Promise.resolve(e.provideDocumentColors(t,i)).then((t=>{if(Array.isArray(t))for(let i of t)n.push({colorInfo:i,provider:e})}))));return Promise.all(o).then((()=>n))}(this._languageFeaturesService.colorProvider,t,e);return this._debounceInformation.update(t,i.elapsed()),n})))),this._computePromise.then((e=>{this.updateDecorations(e),this.updateColorDecorators(e),this._computePromise=null}),Jo)}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((e=>({range:{startLineNumber:e.colorInfo.range.startLineNumber,startColumn:e.colorInfo.range.startColumn,endLineNumber:e.colorInfo.range.endLineNumber,endColumn:e.colorInfo.range.endColumn},options:GP.EMPTY})));this._decorationsIds=this._editor.deltaDecorations(this._decorationsIds,t),this._colorDatas=new Map,this._decorationsIds.forEach(((t,i)=>this._colorDatas.set(t,e[i])))}updateColorDecorators(e){this._colorDecorationClassRefs.clear();let t=[];for(let i=0;i<e.length&&t.length<500;i++){const{red:n,green:o,blue:s,alpha:r}=e[i].colorInfo.color,a=new lS(Math.round(255*n),Math.round(255*o),Math.round(255*s),r);let l=`rgba(${a.r}, ${a.g}, ${a.b}, ${a.a})`;const d=this._colorDecorationClassRefs.add(this._ruleFactory.createClassNameRef({backgroundColor:l}));t.push({range:{startLineNumber:e[i].colorInfo.range.startLineNumber,startColumn:e[i].colorInfo.range.startColumn,endLineNumber:e[i].colorInfo.range.endLineNumber,endColumn:e[i].colorInfo.range.endColumn},options:{description:"colorDetector",before:{content:Fl,inlineClassName:`${d.className} colorpicker-color-decoration`,inlineClassNameAffectsLetterSpacing:!0,attachedData:j0}}})}this._colorDecoratorIds=new Set(this._editor.deltaDecorations([...this._colorDecoratorIds],t))}removeAllDecorations(){this._decorationsIds=this._editor.deltaDecorations(this._decorationsIds,[]),this._colorDecoratorIds=new Set(this._editor.deltaDecorations([...this._colorDecoratorIds],[])),this._colorDecorationClassRefs.clear()}getColorData(e){const t=this._editor.getModel();if(!t)return null;const i=t.getDecorationsInRange(qo.fromPositions(e,e)).filter((e=>this._colorDatas.has(e.id)));return 0===i.length?null:this._colorDatas.get(i[0].id)}isColorDecorationId(e){return this._colorDecoratorIds.has(e)}};U0.ID="editor.contrib.colorDetector",U0.RECOMPUTE_TIME=1e3,U0=W0([z0(1,Cv),z0(2,Lb),z0(3,oW)],U0),Ix(U0.ID,U0);class $0{constructor(e,t,i){this.presentationIndex=i,this._onColorFlushed=new $o,this.onColorFlushed=this._onColorFlushed.event,this._onDidChangeColor=new $o,this.onDidChangeColor=this._onDidChangeColor.event,this._onDidChangePresentation=new $o,this.onDidChangePresentation=this._onDidChangePresentation.event,this.originalColor=e,this._color=e,this._colorPresentations=t}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)}selectNextColorPresentation(){this.presentationIndex=(this.presentationIndex+1)%this.colorPresentations.length,this.flushColor(),this._onDidChangePresentation.fire(this.presentation)}guessColorPresentation(e,t){for(let i=0;i<this.colorPresentations.length;i++)if(t.toLowerCase()===this.colorPresentations[i].label){this.presentationIndex=i,this._onDidChangePresentation.fire(this.presentation);break}}flushColor(){this._onColorFlushed.fire(this._color)}}const K0=YC;class q0 extends Uo{constructor(e,t,i){super(),this.model=t,this.domNode=K0(".colorpicker-header"),$C(e,this.domNode),this.pickedColorNode=$C(this.domNode,K0(".picked-color"));const n=mf(0,"Click to toggle color options (rgb/hsl/hex)");this.pickedColorNode.setAttribute("title",n);const o=$C(this.domNode,K0(".original-color"));o.style.backgroundColor=hS.Format.CSS.format(this.model.originalColor)||"",this.backgroundColor=i.getColorTheme().getColor(zk)||hS.white,this._register(sx(((e,t)=>{this.backgroundColor=e.getColor(zk)||hS.white}))),this._register(nC(this.pickedColorNode,zC.CLICK,(()=>this.model.selectNextColorPresentation()))),this._register(nC(o,zC.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=hS.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)}onDidChangeColor(e){this.pickedColorNode.style.backgroundColor=hS.Format.CSS.format(e)||"",this.pickedColorNode.classList.toggle("light",e.rgba.a<.5?this.backgroundColor.isLighter():e.isLighter()),this.onDidChangePresentation()}onDidChangePresentation(){this.pickedColorNode.textContent=this.model.presentation?this.model.presentation.label:"",this.pickedColorNode.prepend(K0(".codicon.codicon-color-mode"))}}class G0 extends Uo{constructor(e,t,i){super(),this.model=t,this.pixelRatio=i,this.domNode=K0(".colorpicker-body"),$C(e,this.domNode),this.saturationBox=new Z0(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 X0(this.domNode,this.model),this._register(this.opacityStrip),this._register(this.opacityStrip.onDidChange(this.onDidOpacityChange,this)),this._register(this.opacityStrip.onColorFlushed(this.flushColor,this)),this.hueStrip=new Q0(this.domNode,this.model),this._register(this.hueStrip),this._register(this.hueStrip.onDidChange(this.onDidHueChange,this)),this._register(this.hueStrip.onColorFlushed(this.flushColor,this))}flushColor(){this.model.flushColor()}onDidSaturationValueChange({s:e,v:t}){const i=this.model.color.hsva;this.model.color=new hS(new cS(i.h,e,t,i.a))}onDidOpacityChange(e){const t=this.model.color.hsva;this.model.color=new hS(new cS(t.h,t.s,t.v,e))}onDidHueChange(e){const t=this.model.color.hsva,i=360*(1-e);this.model.color=new hS(new cS(360===i?0:i,t.s,t.v,t.a))}layout(){this.saturationBox.layout(),this.opacityStrip.layout(),this.hueStrip.layout()}}class Z0 extends Uo{constructor(e,t,i){super(),this.model=t,this.pixelRatio=i,this._onDidChange=new $o,this.onDidChange=this._onDidChange.event,this._onColorFlushed=new $o,this.onColorFlushed=this._onColorFlushed.event,this.domNode=K0(".saturation-wrap"),$C(e,this.domNode),this.canvas=document.createElement("canvas"),this.canvas.className="saturation-box",$C(this.domNode,this.canvas),this.selection=K0(".saturation-selection"),$C(this.domNode,this.selection),this.layout(),this._register(rC(this.domNode,(e=>this.onMouseDown(e)))),this._register(this.model.onDidChangeColor(this.onDidChangeColor,this)),this.monitor=null}onMouseDown(e){this.monitor=this._register(new rS);const t=yC(this.domNode);e.target!==this.selection&&this.onDidChangePosition(e.offsetX,e.offsetY),this.monitor.startMonitoring(e.target,e.buttons,sS,(e=>this.onDidChangePosition(e.posx-t.left,e.posy-t.top)),(()=>null));const i=aC(document,(()=>{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 hS(new cS(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=hS.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(){this.monitor&&this.monitor.isMonitoring()||this.paint()}}class Y0 extends Uo{constructor(e,t){super(),this.model=t,this._onDidChange=new $o,this.onDidChange=this._onDidChange.event,this._onColorFlushed=new $o,this.onColorFlushed=this._onColorFlushed.event,this.domNode=$C(e,K0(".strip")),this.overlay=$C(this.domNode,K0(".overlay")),this.slider=$C(this.domNode,K0(".slider")),this.slider.style.top="0px",this._register(rC(this.domNode,(e=>this.onMouseDown(e)))),this.layout()}layout(){this.height=this.domNode.offsetHeight-this.slider.offsetHeight;const e=this.getValue(this.model.color);this.updateSliderPosition(e)}onMouseDown(e){const t=this._register(new rS),i=yC(this.domNode);this.domNode.classList.add("grabbing"),e.target!==this.slider&&this.onDidChangeTop(e.offsetY),t.startMonitoring(e.target,e.buttons,sS,(e=>this.onDidChangeTop(e.posy-i.top)),(()=>null));const n=aC(document,(()=>{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 X0 extends Y0{constructor(e,t){super(e,t),this.domNode.classList.add("opacity-strip"),this._register(t.onDidChangeColor(this.onDidChangeColor,this)),this.onDidChangeColor(this.model.color)}onDidChangeColor(e){const{r:t,g:i,b:n}=e.rgba,o=new hS(new lS(t,i,n,1)),s=new hS(new lS(t,i,n,0));this.overlay.style.background=`linear-gradient(to bottom, ${o} 0%, ${s} 100%)`}getValue(e){return e.hsva.a}}class Q0 extends Y0{constructor(e,t){super(e,t),this.domNode.classList.add("hue-strip")}getValue(e){return 1-e.hsva.h/360}}class J0 extends QI{constructor(e,t,i,n){super(),this.model=t,this.pixelRatio=i,this._register(t_.onDidChange((()=>this.layout())));const o=K0(".colorpicker-widget");e.appendChild(o);const s=new q0(o,this.model,n);this.body=new G0(o,this.model,this.pixelRatio),this._register(s),this._register(this.body)}layout(){this.body.layout()}}var e1=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},t1=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}},i1=globalThis&&globalThis.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{l(n.next(e))}catch(t){s(t)}}function a(e){try{l(n.throw(e))}catch(t){s(t)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}l((n=n.apply(e,t||[])).next())}))};class n1{constructor(e,t,i,n){this.owner=e,this.range=t,this.model=i,this.provider=n,this.forceShowAtRange=!0}isValidForHoverAnchor(e){return 1===e.type&&this.range.startColumn<=e.range.startColumn&&this.range.endColumn>=e.range.endColumn}}let o1=class{constructor(e,t){this._editor=e,this._themeService=t,this.hoverOrdinal=1}computeSync(e,t){return[]}computeAsync(e,t,i){return pb.fromPromise(this._computeAsync(e,t,i))}_computeAsync(e,t,i){return i1(this,void 0,void 0,(function*(){if(!this._editor.hasModel())return[];const e=U0.get(this._editor);if(!e)return[];for(const i of t){if(!e.isColorDecorationId(i.id))continue;const t=e.getColorData(i.range.getStartPosition());if(t){return[yield this._createColorHover(this._editor.getModel(),t.colorInfo,t.provider)]}}return[]}))}_createColorHover(e,t,i){return i1(this,void 0,void 0,(function*(){const n=e.getValueInRange(t.range),{red:o,green:s,blue:r,alpha:a}=t.color,l=new lS(Math.round(255*o),Math.round(255*s),Math.round(255*r),a),d=new hS(l),c=yield V0(e,t,i,Ia.None),h=new $0(d,[],0);return h.colorPresentations=c||[],h.guessColorPresentation(d,n),new n1(this,qo.lift(t.range),h,i)}))}renderHoverParts(e,t){if(0===t.length||!this._editor.hasModel())return Uo.None;const i=new ws,n=t[0],o=this._editor.getModel(),s=n.model,r=i.add(new J0(e.fragment,s,this._editor.getOption(129),this._themeService));e.setColorPicker(r);let a=new qo(n.range.startLineNumber,n.range.startColumn,n.range.endLineNumber,n.range.endColumn);const l=()=>{let t,i;if(s.presentation.textEdit){t=[s.presentation.textEdit],i=new qo(s.presentation.textEdit.range.startLineNumber,s.presentation.textEdit.range.startColumn,s.presentation.textEdit.range.endLineNumber,s.presentation.textEdit.range.endColumn);const e=this._editor.getModel()._setTrackedRange(null,i,3);this._editor.pushUndoStop(),this._editor.executeEdits("colorpicker",t),i=this._editor.getModel()._getTrackedRange(e)||i}else t=[{range:a,text:s.presentation.label,forceMoveMarkers:!1}],i=a.setEndPosition(a.endLineNumber,a.startColumn+s.presentation.label.length),this._editor.pushUndoStop(),this._editor.executeEdits("colorpicker",t);s.presentation.additionalTextEdits&&(t=[...s.presentation.additionalTextEdits],this._editor.executeEdits("colorpicker",t),e.hide()),this._editor.pushUndoStop(),a=i},d=e=>V0(o,{range:a,color:{red:e.rgba.r/255,green:e.rgba.g/255,blue:e.rgba.b/255,alpha:e.rgba.a}},n.provider,Ia.None).then((e=>{s.colorPresentations=e||[]}));return i.add(s.onColorFlushed((e=>{d(e).then(l)}))),i.add(s.onDidChangeColor(d)),i}};o1=e1([t1(1,Qy)],o1);function s1(e,t){return!!e[t]}class r1{constructor(e,t){this.target=e.target,this.hasTriggerModifier=s1(e.event,t.triggerModifier),this.hasSideBySideModifier=s1(e.event,t.triggerSideBySideModifier),this.isNoneOrSingleMouseDown=e.event.detail<=1}}class a1{constructor(e,t){this.keyCodeIsTriggerKey=e.keyCode===t.triggerKey,this.keyCodeIsSideBySideKey=e.keyCode===t.triggerSideBySideKey,this.hasTriggerModifier=s1(e,t.triggerModifier)}}class l1{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 d1(e){return"altKey"===e?zo?new l1(57,"metaKey",6,"altKey"):new l1(5,"ctrlKey",6,"altKey"):zo?new l1(6,"altKey",57,"metaKey"):new l1(6,"altKey",5,"ctrlKey")}class c1 extends Uo{constructor(e){super(),this._onMouseMoveOrRelevantKeyDown=this._register(new $o),this.onMouseMoveOrRelevantKeyDown=this._onMouseMoveOrRelevantKeyDown.event,this._onExecute=this._register(new $o),this.onExecute=this._onExecute.event,this._onCancel=this._register(new $o),this.onCancel=this._onCancel.event,this._editor=e,this._opts=d1(this._editor.getOption(70)),this._lastMouseMoveEvent=null,this._hasTriggerKeyOnMouseDown=!1,this._lineNumberOnMouseDown=0,this._register(this._editor.onDidChangeConfiguration((e=>{if(e.hasChanged(70)){const e=d1(this._editor.getOption(70));if(this._opts.equals(e))return;this._opts=e,this._lastMouseMoveEvent=null,this._hasTriggerKeyOnMouseDown=!1,this._lineNumberOnMouseDown=0,this._onCancel.fire()}}))),this._register(this._editor.onMouseMove((e=>this._onEditorMouseMove(new r1(e,this._opts))))),this._register(this._editor.onMouseDown((e=>this._onEditorMouseDown(new r1(e,this._opts))))),this._register(this._editor.onMouseUp((e=>this._onEditorMouseUp(new r1(e,this._opts))))),this._register(this._editor.onKeyDown((e=>this._onEditorKeyDown(new a1(e,this._opts))))),this._register(this._editor.onKeyUp((e=>this._onEditorKeyUp(new a1(e,this._opts))))),this._register(this._editor.onMouseDrag((()=>this._resetHandler()))),this._register(this._editor.onDidChangeCursorSelection((e=>this._onDidChangeCursorSelection(e)))),this._register(this._editor.onDidChangeModel((e=>this._resetHandler()))),this._register(this._editor.onDidChangeModelContent((()=>this._resetHandler()))),this._register(this._editor.onDidScrollChange((e=>{(e.scrollTopChanged||e.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=e.target.position?e.target.position.lineNumber:0}_onEditorMouseUp(e){const t=e.target.position?e.target.position.lineNumber:0;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()}}var h1=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},u1=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};let g1=class extends UF{constructor(e,t,i,n,o,s,r,a,l,d,c,h){super(e,Object.assign(Object.assign({},i.getRawOptions()),{overflowWidgetsDomNode:i.getOverflowWidgetsDomNode()}),{},n,o,s,r,a,l,d,c,h),this._parentEditor=i,this._overwriteOptions=t,super.updateOptions(this._overwriteOptions),this._register(i.onDidChangeConfiguration((e=>this._onParentConfigurationChanged(e))))}getParentEditor(){return this._parentEditor}_onParentConfigurationChanged(e){super.updateOptions(this._parentEditor.getRawOptions()),super.updateOptions(this._overwriteOptions)}updateOptions(e){Ko(this._overwriteOptions,e,!0),super.updateOptions(this._overwriteOptions)}};g1=h1([u1(3,k_),u1(4,N_),u1(5,wy),u1(6,$y),u1(7,Qy),u1(8,vF),u1(9,$x),u1(10,Rv),u1(11,Lb)],g1);const p1=new hS(new lS(0,122,204)),m1={showArrow:!0,showFrame:!0,className:"",frameColor:p1,arrowColor:p1,keepEditorSelection:!1};class f1{constructor(e,t,i,n,o,s){this.id="",this.domNode=e,this.afterLineNumber=t,this.afterColumn=i,this.heightInLines=n,this._onDomNodeTop=o,this._onComputedHeight=s}onDomNodeTop(e){this._onDomNodeTop(e)}onComputedHeight(e){this._onComputedHeight(e)}}class _1{constructor(e,t){this._id=e,this._domNode=t}getId(){return this._id}getDomNode(){return this._domNode}getPosition(){return null}}class v1{constructor(e){this._editor=e,this._ruleName=v1._IdGenerator.nextId(),this._decorations=[],this._color=null,this._height=-1}dispose(){this.hide(),VC(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(){VC(this._ruleName),BC(`.monaco-editor ${this._ruleName}`,`border-style: solid; border-color: transparent; border-bottom-color: ${this._color}; border-width: ${this._height}px; bottom: -${this._height}px; margin-left: -${this._height}px; `)}show(e){1===e.column&&(e={lineNumber:e.lineNumber,column:2}),this._decorations=this._editor.deltaDecorations(this._decorations,[{range:qo.fromPositions(e),options:{description:"zone-widget-arrow",className:this._ruleName,stickiness:1}}])}hide(){this._editor.deltaDecorations(this._decorations,[])}}v1._IdGenerator=new uU(".arrow-decoration-");class b1 extends fy{constructor(e,t){super(),this._onDidChangeVisibility=this._register(new $o),this.onDidChangeVisibility=this._onDidChangeVisibility.event,this._element=$C(e,YC(".monaco-dropdown")),this._label=$C(this._element,YC(".dropdown-label"));let i=t.labelRenderer;i||(i=e=>(e.textContent=t.label||"",null));for(const o of[zC.CLICK,zC.MOUSE_DOWN,iS.Tap])this._register(nC(this.element,o,(e=>HC(e,!0))));for(const o of[zC.MOUSE_DOWN,iS.Tap])this._register(nC(this._label,o,(e=>{e instanceof MouseEvent&&e.detail>1||(this.visible?this.hide():this.show())})));this._register(nC(this._label,zC.KEY_UP,(e=>{const t=new jw(e);(t.equals(3)||t.equals(10))&&(HC(e,!0),this.visible?this.hide():this.show())})));const n=i(this._label);n&&this._register(n),this._register(oS.addTarget(this._label))}get element(){return this._element}show(){this.visible||(this.visible=!0,this._onDidChangeVisibility.fire(!0))}hide(){this.visible&&(this.visible=!1,this._onDidChangeVisibility.fire(!1))}dispose(){super.dispose(),this.hide(),this.boxContainer&&(this.boxContainer.remove(),this.boxContainer=void 0),this.contents&&(this.contents.remove(),this.contents=void 0),this._label&&(this._label.remove(),this._label=void 0)}}class w1 extends b1{constructor(e,t){super(e,t),this._actions=[],this._contextMenuProvider=t.contextMenuProvider,this.actions=t.actions||[],this.actionProvider=t.actionProvider,this.menuClassName=t.menuClassName||"",this.menuAsChild=!!t.menuAsChild}set menuOptions(e){this._menuOptions=e}get menuOptions(){return this._menuOptions}get actions(){return this.actionProvider?this.actionProvider.getActions():this._actions}set actions(e){this._actions=e}show(){super.show(),this.element.classList.add("active"),this._contextMenuProvider.showContextMenu({getAnchor:()=>this.element,getActions:()=>this.actions,getActionsContext:()=>this.menuOptions?this.menuOptions.context:null,getActionViewItem:e=>this.menuOptions&&this.menuOptions.actionViewItemProvider?this.menuOptions.actionViewItemProvider(e):void 0,getKeyBinding:e=>this.menuOptions&&this.menuOptions.getKeyBinding?this.menuOptions.getKeyBinding(e):void 0,getMenuClassName:()=>this.menuClassName,onHide:()=>this.onHide(),actionRunner:this.menuOptions?this.menuOptions.actionRunner:void 0,anchorAlignment:this.menuOptions?this.menuOptions.anchorAlignment:0,domForShadowRoot:this.menuAsChild?this.element:void 0})}hide(){super.hide()}onHide(){this.hide(),this.element.classList.remove("active")}}class C1 extends mB{constructor(e,t,i,n=Object.create(null)){super(null,e,n),this.actionItem=null,this._onDidChangeVisibility=this._register(new $o),this.menuActionsOrProvider=t,this.contextMenuProvider=i,this.options=n,this.options.actionRunner&&(this.actionRunner=this.options.actionRunner)}render(e){this.actionItem=e;const t=Array.isArray(this.menuActionsOrProvider),i={contextMenuProvider:this.contextMenuProvider,labelRenderer:e=>{this.element=$C(e,YC("a.action-label"));let t=[];return"string"==typeof this.options.classNames?t=this.options.classNames.split(/\s+/g).filter((e=>!!e)):this.options.classNames&&(t=this.options.classNames),t.find((e=>"icon"===e))||t.push("codicon"),this.element.classList.add(...t),this.element.setAttribute("role","button"),this.element.setAttribute("aria-haspopup","true"),this.element.setAttribute("aria-expanded","false"),this.element.title=this._action.label||"",null},menuAsChild:this.options.menuAsChild,actions:t?this.menuActionsOrProvider:void 0,actionProvider:t?void 0:this.menuActionsOrProvider};if(this.dropdownMenu=this._register(new w1(e,i)),this._register(this.dropdownMenu.onDidChangeVisibility((e=>{var t;null===(t=this.element)||void 0===t||t.setAttribute("aria-expanded",`${e}`),this._onDidChangeVisibility.fire(e)}))),this.dropdownMenu.menuOptions={actionViewItemProvider:this.options.actionViewItemProvider,actionRunner:this.actionRunner,getKeyBinding:this.options.keybindingProvider,context:this._context},this.options.anchorAlignmentProvider){const e=this;this.dropdownMenu.menuOptions=Object.assign(Object.assign({},this.dropdownMenu.menuOptions),{get anchorAlignment(){return e.options.anchorAlignmentProvider()}})}this.updateEnabled()}setActionContext(e){super.setActionContext(e),this.dropdownMenu&&(this.dropdownMenu.menuOptions?this.dropdownMenu.menuOptions.context=e:this.dropdownMenu.menuOptions={context:e})}updateEnabled(){var e,t;const i=!this.getAction().enabled;null===(e=this.actionItem)||void 0===e||e.classList.toggle("disabled",i),null===(t=this.element)||void 0===t||t.classList.toggle("disabled",i)}}var y1=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},x1=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}},S1=globalThis&&globalThis.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{l(n.next(e))}catch(t){s(t)}}function a(e){try{l(n.throw(e))}catch(t){s(t)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}l((n=n.apply(e,t||[])).next())}))};function k1(e,t,i,n,o,s,r){const a=e.getActions(t);return function(e,t,i,n=(e=>"navigation"===e),o=Number.MAX_SAFE_INTEGER,s=(()=>!1),r=!1){let a,l;Array.isArray(t)?(a=t,l=t):(a=t.primary,l=t.secondary);const d=new Set;for(const[c,h]of e){let e;n(c)?(e=a,e.length>0&&r&&e.push(new _y)):(e=l,e.length>0&&e.push(new _y));for(let t of h){i&&(t=t instanceof px&&t.alt?t.alt:t);const n=e.push(t);t instanceof vy&&d.add({group:c,action:t,index:n-1})}}for(const{group:c,action:h,index:u}of d){const e=n(c)?a:l,t=h.actions;(t.length<=1||e.length+t.length-2<=o)&&s(h,c,e.length)&&e.splice(u,1,...t)}if(a!==l&&a.length>o){const e=a.splice(o,a.length-o);l.unshift(...e,new _y)}}(a,i,!1,"string"==typeof n?e=>e===n:n,o,s,r),function(e){const t=new ws;for(const[,i]of e)for(const e of i)t.add(e);return t}(a)}let D1=class extends fB{constructor(e,t,i,n,o){super(void 0,e,{icon:!(!e.class&&!e.item.icon),label:!e.class&&!e.item.icon,draggable:null==t?void 0:t.draggable}),this._keybindingService=i,this._notificationService=n,this._contextKeyService=o,this._wantsAltCommand=!1,this._itemClassDispose=this._register(new Rr),this._altKey=ny.getInstance()}get _menuItemAction(){return this._action}get _commandAction(){return this._wantsAltCommand&&this._menuItemAction.alt||this._menuItemAction}onClick(e){return S1(this,void 0,void 0,(function*(){e.preventDefault(),e.stopPropagation();try{yield this.actionRunner.run(this._commandAction,this._context)}catch(t){this._notificationService.error(t)}}))}render(e){super.render(e),e.classList.add("menu-entry"),this._updateItemClass(this._menuItemAction.item);let t=!1,i=this._altKey.keyStatus.altKey||(Rs||Vo)&&this._altKey.keyStatus.shiftKey;const n=()=>{const e=t&&i;e!==this._wantsAltCommand&&(this._wantsAltCommand=e,this.updateLabel(),this.updateTooltip(),this.updateClass())};this._menuItemAction.alt&&this._register(this._altKey.event((e=>{i=e.altKey||(Rs||Vo)&&e.shiftKey,n()}))),this._register(nC(e,"mouseleave",(e=>{t=!1,n()}))),this._register(nC(e,"mouseenter",(e=>{t=!0,n()})))}updateLabel(){this.options.label&&this.label&&(this.label.textContent=this._commandAction.label)}updateTooltip(){if(this.label){const e=this._keybindingService.lookupKeybinding(this._commandAction.id,this._contextKeyService),t=e&&e.getLabel(),i=this._commandAction.tooltip||this._commandAction.label;let n=t?mf(0,"{0} ({1})",i,t):i;if(!this._wantsAltCommand&&this._menuItemAction.alt){const e=this._menuItemAction.alt.tooltip||this._menuItemAction.alt.label,t=this._keybindingService.lookupKeybinding(this._menuItemAction.alt.id,this._contextKeyService),i=t&&t.getLabel(),o=i?mf(0,"{0} ({1})",e,i):e;n+=`\n[${MW.modifierLabels[Xs].altKey}] ${o}`}this.label.title=n}}updateClass(){this.options.icon&&(this._commandAction!==this._menuItemAction?this._menuItemAction.alt&&this._updateItemClass(this._menuItemAction.alt.item):this._menuItemAction.alt&&this._updateItemClass(this._menuItemAction.item))}_updateItemClass(e){var t;this._itemClassDispose.value=void 0;const{element:i,label:n}=this;if(!i||!n)return;const o=this._commandAction.checked&&(null===(t=e.toggled)||void 0===t?void 0:t.icon)?e.toggled.icon:e.icon;if(o)if(ex.isThemeIcon(o)){const e=ex.asClassNameArray(o);n.classList.add(...e),this._itemClassDispose.value=es((()=>{n.classList.remove(...e)}))}else o.light&&n.style.setProperty("--menu-entry-icon-light",ty(o.light)),o.dark&&n.style.setProperty("--menu-entry-icon-dark",ty(o.dark)),n.classList.add("icon"),this._itemClassDispose.value=es((()=>{n.classList.remove("icon"),n.style.removeProperty("--menu-entry-icon-light"),n.style.removeProperty("--menu-entry-icon-dark")}))}};D1=y1([x1(2,kW),x1(3,vF),x1(4,$y)],D1);let L1=class extends C1{constructor(e,t,i){var n,o;const s=Object.assign({},null!=t?t:Object.create(null),{menuAsChild:null!==(n=null==t?void 0:t.menuAsChild)&&void 0!==n&&n,classNames:null!==(o=null==t?void 0:t.classNames)&&void 0!==o?o:ex.isThemeIcon(e.item.icon)?ex.asClassName(e.item.icon):void 0});super(e,{getActions:()=>e.actions},i,s)}render(e){if(super.render(e),this.element){e.classList.add("menu-entry");const{icon:t}=this._action.item;t&&!ex.isThemeIcon(t)&&(this.element.classList.add("icon"),t.light&&this.element.style.setProperty("--menu-entry-icon-light",ty(t.light)),t.dark&&this.element.style.setProperty("--menu-entry-icon-dark",ty(t.dark)))}}};L1=y1([x1(2,WB)],L1);let N1=class extends mB{constructor(e,t,i,n,o,s,r,a){var l,d,c;let h;super(null,e),this._keybindingService=i,this._notificationService=n,this._contextMenuService=o,this._menuService=s,this._instaService=r,this._storageService=a,this._container=null,this._storageKey=`${e.item.submenu._debugName}_lastActionId`;let u=a.get(this._storageKey,1);u&&(h=e.actions.find((e=>u===e.id))),h||(h=e.actions[0]),this._defaultAction=this._instaService.createInstance(D1,h,void 0);const g=Object.assign({},null!=t?t:Object.create(null),{menuAsChild:null===(l=null==t?void 0:t.menuAsChild)||void 0===l||l,classNames:null!==(d=null==t?void 0:t.classNames)&&void 0!==d?d:["codicon","codicon-chevron-down"],actionRunner:null!==(c=null==t?void 0:t.actionRunner)&&void 0!==c?c:new fy});this._dropdown=new C1(e,e.actions,this._contextMenuService,g),this._dropdown.actionRunner.onDidRun((e=>{e.action instanceof px&&this.update(e.action)}))}update(e){var t,i;this._storageService.store(this._storageKey,e.id,1,0),this._defaultAction.dispose(),this._defaultAction=this._instaService.createInstance(D1,e,void 0),this._defaultAction.actionRunner=new class extends fy{runAction(e,t){return S1(this,void 0,void 0,(function*(){yield e.run(void 0)}))}},this._container&&this._defaultAction.render((t=this._container,i=YC(".action-container"),t.insertBefore(i,t.firstChild),i))}setActionContext(e){super.setActionContext(e),this._defaultAction.setActionContext(e),this._dropdown.setActionContext(e)}render(e){this._container=e,super.render(this._container),this._container.classList.add("monaco-dropdown-with-default");const t=YC(".action-container");this._defaultAction.render($C(this._container,t)),this._register(nC(t,zC.KEY_DOWN,(e=>{const t=new jw(e);t.equals(17)&&(this._defaultAction.element.tabIndex=-1,this._dropdown.focus(),t.stopPropagation())})));const i=YC(".dropdown-action-container");this._dropdown.render($C(this._container,i)),this._register(nC(i,zC.KEY_DOWN,(e=>{var t;const i=new jw(e);i.equals(15)&&(this._defaultAction.element.tabIndex=0,this._dropdown.setFocusable(!1),null===(t=this._defaultAction.element)||void 0===t||t.focus(),i.stopPropagation())})))}focus(e){e?this._dropdown.focus():(this._defaultAction.element.tabIndex=0,this._defaultAction.element.focus())}blur(){this._defaultAction.element.tabIndex=-1,this._dropdown.blur(),this._container.blur()}setFocusable(e){e?this._defaultAction.element.tabIndex=0:(this._defaultAction.element.tabIndex=-1,this._dropdown.setFocusable(!1))}dispose(){this._defaultAction.dispose(),this._dropdown.dispose(),super.dispose()}};function E1(e,t,i){return t instanceof px?e.createInstance(D1,t,void 0):t instanceof gx?t.item.rememberDefaultAction?e.createInstance(N1,t,i):e.createInstance(L1,t,i):void 0}N1=y1([x1(2,kW),x1(3,vF),x1(4,WB),x1(5,hx),x1(6,k_),x1(7,bZ)],N1);var I1=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},T1=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};const M1=L_("IPeekViewService");var A1;Iv(M1,class{constructor(){this._widgets=new Map}addExclusiveWidget(e,t){const i=this._widgets.get(e);i&&(i.listener.dispose(),i.widget.dispose());this._widgets.set(e,{widget:t,listener:t.onDidClose((()=>{const i=this._widgets.get(e);i&&i.widget===t&&(i.listener.dispose(),this._widgets.delete(e))}))})}}),function(e){e.inPeekEditor=new Uy("inReferenceSearchEditor",!0,mf(0,"Whether the current code editor is embedded inside peek")),e.notInPeekEditor=e.inPeekEditor.toNegated()}(A1||(A1={}));let O1=class{constructor(e,t){e instanceof g1&&A1.inPeekEditor.bindTo(t)}dispose(){}};O1.ID="editor.contrib.referenceController",O1=I1([T1(1,$y)],O1),Ix(O1.ID,O1);const R1={headerBackgroundColor:hS.white,primaryHeadingColor:hS.fromHex("#333333"),secondaryHeadingColor:hS.fromHex("#6c6c6cb3")};let P1=class extends class{constructor(e,t={}){this._arrow=null,this._overlayWidget=null,this._resizeSash=null,this._positionMarkerId=[],this._viewZone=null,this._disposables=new ws,this.container=null,this._isShowing=!1,this.editor=e,this.options=tr(t),Ko(this.options,m1,!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((e=>{const t=this._getWidth(e);this.domNode.style.width=t+"px",this.domNode.style.left=this._getLeft(e)+"px",this._onWidth(t)})))}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.editor.deltaDecorations(this._positionMarkerId,[]),this._positionMarkerId=[],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 v1(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){let e=this.options.frameColor.toString();this.container.style.borderTopColor=e,this.container.style.borderBottomColor=e}if(this._arrow&&this.options.arrowColor){let 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&&0===e.minimap.minimapLeft?e.minimap.minimapWidth:0}_onViewZoneTop(e){this.domNode.style.top=e+"px"}_onViewZoneHeight(e){if(this.domNode.style.height=`${e}px`,this.container){let t=e-this._decoratingElementsHeight();this.container.style.height=`${t}px`;const i=this.editor.getLayoutInfo();this._doLayout(t,this._getWidth(i))}this._resizeSash&&this._resizeSash.layout()}get position(){const[e]=this._positionMarkerId;if(!e)return;const t=this.editor.getModel();if(!t)return;const i=t.getDecorationRange(e);return i?i.getStartPosition():void 0}show(e,t){const i=qo.isIRange(e)?qo.lift(e):qo.fromPositions(e);this._isShowing=!0,this._showImpl(i,t),this._isShowing=!1,this._positionMarkerId=this.editor.deltaDecorations(this._positionMarkerId,[{range:i,options:GP.EMPTY}])}hide(){this._viewZone&&(this.editor.changeViewZones((e=>{this._viewZone&&e.removeZone(this._viewZone.id)})),this._viewZone=null),this._overlayWidget&&(this.editor.removeOverlayWidget(this._overlayWidget),this._overlayWidget=null),this._arrow&&this._arrow.hide()}_decoratingElementsHeight(){let e=this.editor.getOption(59),t=0;if(this.options.showArrow){t+=2*Math.round(e/3)}if(this.options.showFrame){t+=2*Math.round(e/9)}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 s=document.createElement("div");s.style.overflow="hidden";const r=this.editor.getOption(59),a=Math.max(12,this.editor.getLayoutInfo().height/r*.8);t=Math.min(t,a);let l=0,d=0;if(this._arrow&&this.options.showArrow&&(l=Math.round(r/3),this._arrow.height=l,this._arrow.show(i)),this.options.showFrame&&(d=Math.round(r/9)),this.editor.changeViewZones((e=>{this._viewZone&&e.removeZone(this._viewZone.id),this._overlayWidget&&(this.editor.removeOverlayWidget(this._overlayWidget),this._overlayWidget=null),this.domNode.style.top="-1000px",this._viewZone=new f1(s,i.lineNumber,i.column,t,(e=>this._onViewZoneTop(e)),(e=>this._onViewZoneHeight(e))),this._viewZone.id=e.addZone(this._viewZone),this._overlayWidget=new _1("vs.editor.contrib.zoneWidget"+this._viewZone.id,this.domNode),this.editor.addOverlayWidget(this._overlayWidget)})),this.container&&this.options.showFrame){const e=this.options.frameWidth?this.options.frameWidth:d;this.container.style.borderTopWidth=e+"px",this.container.style.borderBottomWidth=e+"px"}let c=t*r-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 h=this.editor.getModel();if(h){const t=e.endLineNumber+1;t<=h.getLineCount()?this.revealLine(t,!1):this.revealLine(h.getLineCount(),!0)}}revealLine(e,t){t?this.editor.revealLineInCenter(e,0):this.editor.revealLine(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;let e;this._resizeSash=this._disposables.add(new cB(this.domNode,this,{orientation:1})),this.options.isResizeable||(this._resizeSash.state=0),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){let i=(t.currentY-e.startY)/this.editor.getOption(59),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(null===this.domNode.style.height?0:parseInt(this.domNode.style.height))-this._decoratingElementsHeight()/2}getHorizontalSashWidth(){const e=this.editor.getLayoutInfo();return e.width-e.minimap.minimapWidth}}{constructor(e,t,i){super(e,t),this.instantiationService=i,this._onDidClose=new $o,this.onDidClose=this._onDidClose.event,Ko(this.options,R1,!1)}dispose(){this.disposed||(this.disposed=!0,super.dispose(),this._onDidClose.fire(this))}style(e){let 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();let 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=YC(".head"),this._bodyElement=YC(".body"),this._fillHead(this._headElement),this._fillBody(this._bodyElement),e.appendChild(this._headElement),e.appendChild(this._bodyElement)}_fillHead(e,t){const i=YC(".peekview-title");this.options.supportOnTitleClick&&(i.classList.add("clickable"),sC(i,"click",(e=>this._onTitleClick(e)))),$C(this._headElement,i),this._fillTitleIcon(i),this._primaryHeading=YC("span.filename"),this._secondaryHeading=YC("span.dirname"),this._metaHeading=YC("span.meta"),$C(i,this._primaryHeading,this._secondaryHeading,this._metaHeading);const n=YC(".peekview-actions");$C(this._headElement,n);const o=this._getActionBarOptions();this._actionbarWidget=new vB(n,o),this._disposables.add(this._actionbarWidget),t||this._actionbarWidget.push(new my("peekview.close",mf(0,"Close"),br.close.classNames,!0,(()=>(this.dispose(),Promise.resolve()))),{label:!1,icon:!0})}_fillTitleIcon(e){}_getActionBarOptions(){return{actionViewItemProvider:E1.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:eC(this._secondaryHeading))}setMetaTitle(e){this._metaHeading&&(e?(this._metaHeading.innerText=e,XC(this._metaHeading)):QC(this._metaHeading))}_doLayout(e,t){if(!this._isShowing&&e<0)return void this.dispose();const i=Math.ceil(1.2*this.editor.getOption(59)),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`)}};P1=I1([T1(2,k_)],P1);const F1=_S("peekViewTitle.background",{dark:yL(ck,.1),light:yL(ck,.1),hc:null},mf(0,"Background color of the peek view title area.")),B1=_S("peekViewTitleLabel.foreground",{dark:hS.white,light:hS.black,hc:hS.white},mf(0,"Color of the peek view title.")),V1=_S("peekViewTitleDescription.foreground",{dark:"#ccccccb3",light:"#616161",hc:"#FFFFFF99"},mf(0,"Color of the peek view title info.")),W1=_S("peekView.border",{dark:ck,light:ck,hc:yS},mf(0,"Color of the peek view borders and arrow.")),z1=_S("peekViewResult.background",{dark:"#252526",light:"#F3F3F3",hc:hS.black},mf(0,"Background color of the peek view result list."));_S("peekViewResult.lineForeground",{dark:"#bbbbbb",light:"#646465",hc:hS.white},mf(0,"Foreground color for line nodes in the peek view result list.")),_S("peekViewResult.fileForeground",{dark:hS.white,light:"#1E1E1E",hc:hS.white},mf(0,"Foreground color for file nodes in the peek view result list.")),_S("peekViewResult.selectionBackground",{dark:"#3399ff33",light:"#3399ff33",hc:null},mf(0,"Background color of the selected entry in the peek view result list.")),_S("peekViewResult.selectionForeground",{dark:hS.white,light:"#6C6C6C",hc:hS.white},mf(0,"Foreground color of the selected entry in the peek view result list."));const H1=_S("peekViewEditor.background",{dark:"#001F33",light:"#F2F8FC",hc:hS.black},mf(0,"Background color of the peek view editor."));_S("peekViewEditorGutter.background",{dark:H1,light:H1,hc:H1},mf(0,"Background color of the gutter in the peek view editor.")),_S("peekViewResult.matchHighlightBackground",{dark:"#ea5c004d",light:"#ea5c004d",hc:null},mf(0,"Match highlight color in the peek view result list.")),_S("peekViewEditor.matchHighlightBackground",{dark:"#ff8f0099",light:"#f5d802de",hc:null},mf(0,"Match highlight color in the peek view editor.")),_S("peekViewEditor.matchHighlightBorder",{dark:null,light:null,hc:xS},mf(0,"Match highlight border in the peek view editor."));var j1=globalThis&&globalThis.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{l(n.next(e))}catch(t){s(t)}}function a(e){try{l(n.throw(e))}catch(t){s(t)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}l((n=n.apply(e,t||[])).next())}))};class U1{constructor(e,t,i,n){this.isProviderFirst=e,this.parent=t,this.link=i,this._rangeCallback=n,this.id=gU.nextId()}get uri(){return this.link.uri}get range(){var e,t;return null!==(t=null!==(e=this._range)&&void 0!==e?e:this.link.targetSelectionRange)&&void 0!==t?t:this.link.range}set range(e){this._range=e,this._rangeCallback(this)}get ariaMessage(){var e;const t=null===(e=this.parent.getPreview(this))||void 0===e?void 0:e.preview(this.range);return t?mf(0,"symbol in {0} on line {1} at column {2}, {3}",oR(this.uri),this.range.startLineNumber,this.range.startColumn,t.value):mf(0,"symbol in {0} on line {1} at column {2}",oR(this.uri),this.range.startLineNumber,this.range.startColumn)}}class $1{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:s,endColumn:r}=e,a=i.getWordUntilPosition({lineNumber:n,column:o-t}),l=new qo(n,a.startColumn,n,o),d=new qo(s,r,s,1073741824),c=i.getValueInRange(l).replace(/^\s+/,""),h=i.getValueInRange(e);return{value:c+h+i.getValueInRange(d).replace(/\s+$/,""),highlight:{start:c.length,end:c.length+h.length}}}}class K1{constructor(e,t){this.parent=e,this.uri=t,this.children=[],this._previews=new YV}dispose(){bs(this._previews.values()),this._previews.clear()}getPreview(e){return this._previews.get(e.uri)}get ariaMessage(){const e=this.children.length;return 1===e?mf(0,"1 symbol in {0}, full path {1}",oR(this.uri),this.uri.fsPath):mf(0,"{0} symbols in {1}, full path {2}",e,oR(this.uri),this.uri.fsPath)}resolve(e){return j1(this,void 0,void 0,(function*(){if(0!==this._previews.size)return this;for(let i of this.children)if(!this._previews.has(i.uri))try{const t=yield e.createModelReference(i.uri);this._previews.set(i.uri,new $1(t))}catch(t){Jo(t)}return this}))}}class q1{constructor(e,t){this.groups=[],this.references=[],this._onDidChangeReferenceRange=new $o,this.onDidChangeReferenceRange=this._onDidChangeReferenceRange.event,this._links=e,this._title=t;const[i]=e;let n;e.sort(q1._compareReferences);for(let o of e)if(n&&tR.isEqual(n.uri,o.uri,!0)||(n=new K1(this,o.uri),this.groups.push(n)),0===n.children.length||0!==q1._compareReferences(o,n.children[n.children.length-1])){const e=new U1(i===o,n,o,(e=>this._onDidChangeReferenceRange.fire(e)));this.references.push(e),n.children.push(e)}}dispose(){bs(this.groups),this._onDidChangeReferenceRange.dispose(),this.groups.length=0}clone(){return new q1(this._links,this._title)}get title(){return this._title}get isEmpty(){return 0===this.groups.length}get ariaMessage(){return this.isEmpty?mf(0,"No results found"):1===this.references.length?mf(0,"Found 1 symbol in {0}",this.references[0].uri.fsPath):1===this.groups.length?mf(0,"Found {0} symbols in {1}",this.references.length,this.groups[0].uri.fsPath):mf(0,"Found {0} symbols in {1} files",this.references.length,this.groups.length)}nextOrPreviousReference(e,t){let{parent:i}=e,n=i.children.indexOf(e),o=i.children.length,s=i.parent.groups.length;return 1===s||t&&n+1<o||!t&&n>0?(n=t?(n+1)%o:(n+o-1)%o,i.children[n]):(n=i.parent.groups.indexOf(i),t?(n=(n+1)%s,i.parent.groups[n].children[0]):(n=(n+s-1)%s,i.parent.groups[n].children[i.parent.groups[n].children.length-1]))}nearestReference(e,t){const i=this.references.map(((i,n)=>({idx:n,prefixLen:lr(i.uri.toString(),e.toString()),offsetDist:100*Math.abs(i.range.startLineNumber-t.lineNumber)+Math.abs(i.range.startColumn-t.column)}))).sort(((e,t)=>e.prefixLen>t.prefixLen?-1:e.prefixLen<t.prefixLen?1:e.offsetDist<t.offsetDist?-1:e.offsetDist>t.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()&&qo.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 tR.compare(e.uri,t.uri)||qo.compareRangesUsingStarts(e.range,t.range)}}function G1(e){if(!e)return;"string"==typeof e&&(e=Ps.file(e));const t=oR(e)||(e.scheme===Yw.file?e.fsPath:e.path);return Rs&&function(e){const t=Vr(e);return Rs?!(e.length>3)&&QO(t)&&(2===e.length||92===t.charCodeAt(2)):t===Pr.sep}(t)?Z1(t):t}function Z1(e,t){return QO(e,t)?e.charAt(0).toUpperCase()+e.slice(1):e}var Y1=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},X1=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};let Q1=class{constructor(e){this._resolverService=e}hasChildren(e){return e instanceof q1||e instanceof K1}getChildren(e){if(e instanceof q1)return e.groups;if(e instanceof K1)return e.resolve(this._resolverService).then((e=>e.children));throw new Error("bad tree")}};Q1=Y1([X1(0,gy)],Q1);class J1{getHeight(){return 23}getTemplateId(e){return e instanceof K1?n3.id:s3.id}}let e3=class{constructor(e){this._keybindingService=e}getKeyboardNavigationLabel(e){var t;if(e instanceof U1){const i=null===(t=e.parent.getPreview(e))||void 0===t?void 0:t.preview(e.range);if(i)return i.value}return oR(e.uri)}};e3=Y1([X1(0,kW)],e3);class t3{getId(e){return e instanceof U1?e.id:e.uri}}let i3=class extends Uo{constructor(e,t,i){super(),this._uriLabel=t;const n=document.createElement("div");n.classList.add("reference-file"),this.file=this._register(new HU(n,{supportHighlights:!0})),this.badge=new oU($C(n,YC(".count"))),this._register(function(e,t,i){return UH(t,{badgeBackground:(null==i?void 0:i.badgeBackground)||YS,badgeForeground:(null==i?void 0:i.badgeForeground)||XS,badgeBorder:yS},e)}(this.badge,i)),e.appendChild(n)}set(e,t){let i=rR(e.uri);this.file.setLabel(G1(e.uri),this._uriLabel.getUriLabel(i,{relative:!0}),{title:this._uriLabel.getUriLabel(e.uri),matches:t});const n=e.children.length;this.badge.setCount(n),n>1?this.badge.setTitleFormat(mf(0,"{0} references",n)):this.badge.setTitleFormat(mf(0,"{0} reference",n))}};i3=Y1([X1(1,FW),X1(2,Qy)],i3);let n3=class e{constructor(t){this._instantiationService=t,this.templateId=e.id}renderTemplate(e){return this._instantiationService.createInstance(i3,e)}renderElement(e,t,i){i.set(e.element,cH(e.filterData))}disposeTemplate(e){e.dispose()}};n3.id="FileReferencesRenderer",n3=Y1([X1(0,k_)],n3);class o3{constructor(e){this.label=new OU(e)}set(e,t){var i;const n=null===(i=e.parent.getPreview(e))||void 0===i?void 0:i.preview(e.range);if(n&&n.value){const{value:e,highlight:i}=n;t&&!yH.isDefault(t)?(this.label.element.classList.toggle("referenceMatch",!1),this.label.set(e,cH(t))):(this.label.element.classList.toggle("referenceMatch",!0),this.label.set(e,[i]))}else this.label.set(`${oR(e.uri)}:${e.range.startLineNumber+1}:${e.range.startColumn+1}`)}}class s3{constructor(){this.templateId=s3.id}renderTemplate(e){return new o3(e)}renderElement(e,t,i){i.set(e.element,e.filterData)}disposeTemplate(){}}s3.id="OneReferenceRenderer";class r3{getWidgetAriaLabel(){return mf(0,"References")}getAriaLabel(e){return e.ariaMessage}}var a3=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},l3=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}},d3=globalThis&&globalThis.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{l(n.next(e))}catch(t){s(t)}}function a(e){try{l(n.throw(e))}catch(t){s(t)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}l((n=n.apply(e,t||[])).next())}))};class c3{constructor(e,t){this._editor=e,this._model=t,this._decorations=new Map,this._decorationIgnoreSet=new Set,this._callOnDispose=new ws,this._callOnModelChange=new ws,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(let t of this._model.references)if(t.uri.toString()===e.uri.toString())return void this._addDecorations(t.parent)}_addDecorations(e){if(!this._editor.hasModel())return;this._callOnModelChange.add(this._editor.getModel().onDidChangeDecorations((()=>this._onDecorationChanged())));const t=[],i=[];for(let o=0,s=e.children.length;o<s;o++){let n=e.children[o];this._decorationIgnoreSet.has(n.id)||n.uri.toString()===this._editor.getModel().uri.toString()&&(t.push({range:n.range,options:c3.DecorationOptions}),i.push(o))}const n=this._editor.deltaDecorations([],t);for(let o=0;o<n.length;o++)this._decorations.set(n[o],e.children[i[o]])}_onDecorationChanged(){const e=[],t=this._editor.getModel();if(t){for(let[i,n]of this._decorations){const o=t.getDecorationRange(i);if(!o)continue;let s=!1;if(!qo.equalsRange(o,n.range)){if(qo.spansMultipleLines(o))s=!0;else{n.range.endColumn-n.range.startColumn!==o.endColumn-o.startColumn&&(s=!0)}s?(this._decorationIgnoreSet.add(n.id),e.push(i)):n.range=o}}for(let t=0,i=e.length;t<i;t++)this._decorations.delete(e[t]);this._editor.deltaDecorations(e,[])}}removeDecorations(){this._editor.deltaDecorations([...this._decorations.keys()],[]),this._decorations.clear()}}c3.DecorationOptions=GP.register({description:"reference-decoration",stickiness:1,className:"reference-decoration"});class h3 extends Yq{}let u3=class extends P1{constructor(e,t,i,n,o,s,r,a,l,d,c,h){super(e,{showFrame:!1,showArrow:!0,isResizeable:!0,isAccessible:!0,supportOnTitleClick:!0},s),this._defaultTreeKeyboardSupport=t,this.layoutData=i,this._textModelResolverService=o,this._instantiationService=s,this._peekViewService=r,this._uriLabel=a,this._undoRedoService=l,this._keybindingService=d,this._languageService=c,this._languageConfigurationService=h,this._disposeOnNewModel=new ws,this._callOnDispose=new ws,this._onDidSelectReference=new $o,this.onDidSelectReference=this._onDidSelectReference.event,this._dim=new wC(0,0),this._applyTheme(n.getColorTheme()),this._callOnDispose.add(n.onDidColorThemeChange(this._applyTheme.bind(this))),this._peekViewService.addExclusiveWidget(e,this),this.create()}dispose(){this.setModel(void 0),this._callOnDispose.dispose(),this._disposeOnNewModel.dispose(),bs(this._preview),bs(this._previewNotAvailableMessage),bs(this._tree),bs(this._previewModelReference),this._splitView.dispose(),super.dispose()}_applyTheme(e){const t=e.getColor(W1)||hS.transparent;this.style({arrowColor:t,frameColor:t,headerBackgroundColor:e.getColor(F1)||hS.transparent,primaryHeadingColor:e.getColor(B1),secondaryHeadingColor:e.getColor(V1)})}show(e){this.editor.revealRangeInCenterIfOutsideViewport(e,0),super.show(e,this.layoutData.heightInLines||18)}focusOnReferenceTree(){this._tree.domFocus()}focusOnPreviewEditor(){this._preview.focus()}isPreviewEditorFocused(){return this._preview.hasTextFocus()}_onTitleClick(e){this._preview&&this._preview.getModel()&&this._onDidSelectReference.fire({element:this._getFocusedReference(),kind:e.ctrlKey||e.metaKey||e.altKey?"side":"open",source:"title"})}_fillBody(e){this.setCssClass("reference-zone-widget"),this._messageContainer=$C(e,YC("div.messages")),QC(this._messageContainer),this._splitView=new nK(e,{orientation:1}),this._previewContainer=$C(e,YC("div.preview.inline"));this._preview=this._instantiationService.createInstance(g1,this._previewContainer,{scrollBeyondLastLine:!1,scrollbar:{verticalScrollbarSize:14,horizontal:"auto",useShadows:!0,verticalHasArrows:!1,horizontalHasArrows:!1,alwaysConsumeMouseWheel:!1},overviewRulerLanes:2,fixedOverflowWidgets:!0,minimap:{enabled:!1}},this.editor),QC(this._previewContainer),this._previewNotAvailableMessage=new VP(mf(0,"no preview available"),LA,VP.DEFAULT_CREATION_OPTIONS,null,this._undoRedoService,this._languageService,this._languageConfigurationService),this._treeContainer=$C(e,YC("div.ref-tree.inline"));const t={keyboardSupport:this._defaultTreeKeyboardSupport,accessibilityProvider:new r3,keyboardNavigationLabelProvider:this._instantiationService.createInstance(e3),identityProvider:new t3,openOnSingleClick:!0,selectionNavigation:!0,overrideStyles:{listBackground:z1}};this._defaultTreeKeyboardSupport&&this._callOnDispose.add(sC(this._treeContainer,"keydown",(e=>{e.equals(9)&&(this._keybindingService.dispatchEvent(e,e.target),e.stopPropagation())}),!0)),this._tree=this._instantiationService.createInstance(h3,"ReferencesWidget",this._treeContainer,new J1,[this._instantiationService.createInstance(n3),this._instantiationService.createInstance(s3)],this._instantiationService.createInstance(Q1),t),this._splitView.addView({onDidChange:ds.None,element:this._previewContainer,minimumSize:200,maximumSize:Number.MAX_VALUE,layout:e=>{this._preview.layout({height:this._dim.height,width:e})}},iK.Distribute),this._splitView.addView({onDidChange:ds.None,element:this._treeContainer,minimumSize:100,maximumSize:Number.MAX_VALUE,layout:e=>{this._treeContainer.style.height=`${this._dim.height}px`,this._treeContainer.style.width=`${e}px`,this._tree.layout(this._dim.height,e)}},iK.Distribute),this._disposables.add(this._splitView.onDidSashChange((()=>{this._dim.width&&(this.layoutData.ratio=this._splitView.getViewSize(0)/this._dim.width)}),void 0));let i=(e,t)=>{e instanceof U1&&("show"===t&&this._revealReference(e,!1),this._onDidSelectReference.fire({element:e,kind:t,source:"tree"}))};this._tree.onDidOpen((e=>{e.sideBySide?i(e.element,"side"):e.editorOptions.pinned?i(e.element,"goto"):i(e.element,"show")})),QC(this._treeContainer)}_onWidth(e){this._dim&&this._doLayoutBody(this._dim.height,e)}_doLayoutBody(e,t){super._doLayoutBody(e,t),this._dim=new wC(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=mf(0,"No results"),XC(this._messageContainer),Promise.resolve(void 0)):(QC(this._messageContainer),this._decorationsManager=new c3(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(2!==t.detail)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"),XC(this._treeContainer),XC(this._previewContainer),this._splitView.layout(this._dim.width),this.focusOnReferenceTree(),this._tree.setInput(1===this._model.groups.length?this._model.groups[0]:this._model)):Promise.resolve(void 0)}_getFocusedReference(){const[e]=this._tree.getFocus();return e instanceof U1?e:e instanceof K1&&e.children.length>0?e.children[0]:void 0}revealReference(e){return d3(this,void 0,void 0,(function*(){yield this._revealReference(e,!1),this._onDidSelectReference.fire({element:e,kind:"goto",source:"tree"})}))}_revealReference(e,t){return d3(this,void 0,void 0,(function*(){if(this._revealedReference===e)return;this._revealedReference=e,e.uri.scheme!==Yw.inMemory?this.setTitle(nR(e.uri),this._uriLabel.getUriLabel(rR(e.uri))):this.setTitle(mf(0,"References"));const i=this._textModelResolverService.createModelReference(e.uri);this._tree.getInput()===e.parent||(t&&this._tree.reveal(e.parent),yield this._tree.expand(e.parent)),this._tree.reveal(e);const n=yield i;if(!this._model)return void n.dispose();bs(this._previewModelReference);const o=n.object;if(o){const t=this._preview.getModel()===o.textEditorModel?0:1,i=qo.lift(e.range).collapseToStart();this._previewModelReference=n,this._preview.setModel(o.textEditorModel),this._preview.setSelection(i),this._preview.revealRangeInCenter(i,t)}else this._preview.setModel(this._previewNotAvailableMessage),n.dispose()}))}};u3=a3([l3(3,Qy),l3(4,gy),l3(5,k_),l3(6,M1),l3(7,FW),l3(8,NP),l3(9,kW),l3(10,Lv),l3(11,Rv)],u3);var g3=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},p3=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}},m3=globalThis&&globalThis.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{l(n.next(e))}catch(t){s(t)}}function a(e){try{l(n.throw(e))}catch(t){s(t)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}l((n=n.apply(e,t||[])).next())}))};const f3=new Uy("referenceSearchVisible",!1,mf(0,"Whether reference peek is visible, like 'Peek References' or 'Peek Definition'"));let _3=class e{constructor(e,t,i,n,o,s,r,a){this._defaultTreeKeyboardSupport=e,this._editor=t,this._editorService=n,this._notificationService=o,this._instantiationService=s,this._storageService=r,this._configurationService=a,this._disposables=new ws,this._requestIdPool=0,this._ignoreModelChangeEvent=!1,this._referenceSearchVisible=f3.bindTo(i)}static get(t){return t.getContribution(e.ID)}dispose(){var e,t;this._referenceSearchVisible.reset(),this._disposables.dispose(),null===(e=this._widget)||void 0===e||e.dispose(),null===(t=this._model)||void 0===t||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",s=class{constructor(){this.ratio=.7,this.heightInLines=18}static fromJSON(e){let t,i;try{const n=JSON.parse(e);t=n.ratio,i=n.heightInLines}catch(Bte){}return{ratio:t||.7,heightInLines:i||18}}}.fromJSON(this._storageService.get(o,0,"{}"));this._widget=this._instantiationService.createInstance(u3,this._editor,this._defaultTreeKeyboardSupport,s),this._widget.setTitle(mf(0,"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((e=>{let{element:t,kind:n}=e;if(t)switch(n){case"open":"editor"===e.source&&this._configurationService.getValue("editor.stablePeek")||this.openReference(t,!1,!1);break;case"side":this.openReference(t,!0,!1);break;case"goto":i?this._gotoReference(t):this.openReference(t,!1,!0)}})));const r=++this._requestIdPool;t.then((t=>{var i;if(r===this._requestIdPool&&this._widget)return null===(i=this._model)||void 0===i||i.dispose(),this._model=t,this._widget.setModel(this._model).then((()=>{if(this._widget&&this._model&&this._editor.hasModel()){this._model.isEmpty?this._widget.setMetaTitle(""):this._widget.setMetaTitle(mf(0,"{0} ({1})",this._model.title,this._model.references.length));let t=this._editor.getModel().uri,i=new er(e.startLineNumber,e.startColumn),n=this._model.nearestReference(t,i);if(n)return this._widget.setSelection(n).then((()=>{this._widget&&"editor"===this._editor.getOption(77)&&this._widget.focusOnPreviewEditor()}))}}));t.dispose()}),(e=>{this._notificationService.error(e)}))}changeFocusBetweenPreviewAndReferences(){this._widget&&(this._widget.isPreviewEditorFocused()?this._widget.focusOnReferenceTree():this._widget.focusOnPreviewEditor())}goToNextOrPreviousReference(e){return m3(this,void 0,void 0,(function*(){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(),s=this._widget.isPreviewEditorFocused();yield this._widget.setSelection(n),yield this._gotoReference(n),o?this._editor.focus():this._widget&&s&&this._widget.focusOnPreviewEditor()}))}revealReference(e){return m3(this,void 0,void 0,(function*(){this._editor.hasModel()&&this._model&&this._widget&&(yield this._widget.revealReference(e))}))}closeWidget(e=!0){var t,i;null===(t=this._widget)||void 0===t||t.dispose(),null===(i=this._model)||void 0===i||i.dispose(),this._referenceSearchVisible.reset(),this._disposables.clear(),this._widget=void 0,this._model=void 0,e&&this._editor.focus(),this._requestIdPool+=1}_gotoReference(t){this._widget&&this._widget.hide(),this._ignoreModelChangeEvent=!0;const i=qo.lift(t.range).collapseToStart();return this._editorService.openCodeEditor({resource:t.uri,options:{selection:i,selectionSource:"code.jump"}},this._editor).then((t=>{var n;if(this._ignoreModelChangeEvent=!1,t&&this._widget)if(this._editor===t)this._widget.show(i),this._widget.focusOnReferenceTree();else{const o=e.get(t),s=this._model.clone();this.closeWidget(),t.focus(),null==o||o.toggleWidget(i,Xv((e=>Promise.resolve(s))),null!==(n=this._peekMode)&&void 0!==n&&n)}else this.closeWidget()}),(e=>{this._ignoreModelChangeEvent=!1,Jo(e)}))}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)}};function v3(e,t){const i=function(e){let t=e.get(N_).getFocusedCodeEditor();return t instanceof g1?t.getParentEditor():t}(e);if(!i)return;const n=_3.get(i);n&&t(n)}_3.ID="editor.contrib.referencesController",_3=g3([p3(2,$y),p3(3,N_),p3(4,vF),p3(5,k_),p3(6,bZ),p3(7,Cv)],_3),fx.registerCommandAndKeybindingRule({id:"togglePeekWidgetFocus",weight:100,primary:Ol(2089,60),when:Sy.or(f3,A1.inPeekEditor),handler(e){v3(e,(e=>{e.changeFocusBetweenPreviewAndReferences()}))}}),fx.registerCommandAndKeybindingRule({id:"goToNextReference",weight:90,primary:62,secondary:[70],when:Sy.or(f3,A1.inPeekEditor),handler(e){v3(e,(e=>{e.goToNextOrPreviousReference(!0)}))}}),fx.registerCommandAndKeybindingRule({id:"goToPreviousReference",weight:90,primary:1086,secondary:[1094],when:Sy.or(f3,A1.inPeekEditor),handler(e){v3(e,(e=>{e.goToNextOrPreviousReference(!1)}))}}),Cy.registerCommandAlias("goToNextReferenceFromEmbeddedEditor","goToNextReference"),Cy.registerCommandAlias("goToPreviousReferenceFromEmbeddedEditor","goToPreviousReference"),Cy.registerCommandAlias("closeReferenceSearchEditor","closeReferenceSearch"),Cy.registerCommand("closeReferenceSearch",(e=>v3(e,(e=>e.closeWidget())))),fx.registerKeybindingRule({id:"closeReferenceSearch",weight:-1,primary:9,secondary:[1033],when:Sy.and(A1.inPeekEditor,Sy.not("config.editor.stablePeek"))}),fx.registerKeybindingRule({id:"closeReferenceSearch",weight:250,primary:9,secondary:[1033],when:Sy.and(f3,Sy.not("config.editor.stablePeek"))}),fx.registerCommandAndKeybindingRule({id:"revealReference",weight:200,primary:3,mac:{primary:3,secondary:[2066]},when:Sy.and(f3,pq,bq.negate(),Cq.negate()),handler(e){var t;const i=null===(t=e.get(cq).lastFocusedList)||void 0===t?void 0:t.getFocus();Array.isArray(i)&&i[0]instanceof U1&&v3(e,(e=>e.revealReference(i[0])))}}),fx.registerCommandAndKeybindingRule({id:"openReferenceToSide",weight:100,primary:2051,mac:{primary:259},when:Sy.and(f3,pq,bq.negate(),Cq.negate()),handler(e){var t;const i=null===(t=e.get(cq).lastFocusedList)||void 0===t?void 0:t.getFocus();Array.isArray(i)&&i[0]instanceof U1&&v3(e,(e=>e.openReference(i[0],!0,!0)))}}),Cy.registerCommand("openReference",(e=>{var t;const i=null===(t=e.get(cq).lastFocusedList)||void 0===t?void 0:t.getFocus();Array.isArray(i)&&i[0]instanceof U1&&v3(e,(e=>e.openReference(i[0],!1,!0)))}));var b3=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},w3=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};const C3=new Uy("hasSymbols",!1,mf(0,"Whether there are symbol locations that can be navigated via keyboard-only.")),y3=L_("ISymbolNavigationService");let x3=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=C3.bindTo(e)}reset(){var e,t;this._ctxHasSymbols.reset(),null===(e=this._currentState)||void 0===e||e.dispose(),null===(t=this._currentMessage)||void 0===t||t.dispose(),this._currentModel=void 0,this._currentIdx=-1}put(e){const t=e.parent.parent;if(t.references.length<=1)return void this.reset();this._currentModel=t,this._currentIdx=t.references.indexOf(e),this._ctxHasSymbols.set(!0),this._showMessage();const i=new S3(this._editorService),n=i.onDidChange((e=>{if(this._ignoreEditorChange)return;const i=this._editorService.getActiveCodeEditor();if(!i)return;const n=i.getModel(),o=i.getPosition();if(!n||!o)return;let s=!1,r=!1;for(const a of t.references)if(iR(a.uri,n.uri))s=!0,r=r||qo.containsPosition(a.range,o);else if(s)break;s&&r||this.reset()}));this._currentState=ta(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:qo.collapseToStart(t.range),selectionRevealType:3}},e).finally((()=>{this._ignoreEditorChange=!1}))}_showMessage(){var e;null===(e=this._currentMessage)||void 0===e||e.dispose();const t=this._keybindingService.lookupKeybinding("editor.gotoNextSymbolFromResult"),i=t?mf(0,"Symbol {0} of {1}, {2} for next",this._currentIdx+1,this._currentModel.references.length,t.getLabel()):mf(0,"Symbol {0} of {1}",this._currentIdx+1,this._currentModel.references.length);this._currentMessage=this._notificationService.status(i)}};x3=b3([w3(0,$y),w3(1,N_),w3(2,vF),w3(3,kW)],x3),Iv(y3,x3,!0),Dx(new class extends yx{constructor(){super({id:"editor.gotoNextSymbolFromResult",precondition:C3,kbOpts:{weight:100,primary:70}})}runEditorCommand(e,t){return e.get(y3).revealNext(t)}}),fx.registerCommandAndKeybindingRule({id:"editor.gotoNextSymbolFromResult.cancel",weight:100,when:C3,primary:9,handler(e){e.get(y3).reset()}});let S3=class{constructor(e){this._listener=new Map,this._disposables=new ws,this._onDidChange=new $o,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(),bs(this._listener.values())}_onDidAddEditor(e){this._listener.set(e,ta(e.onDidChangeCursorPosition((t=>this._onDidChange.fire({editor:e}))),e.onDidChangeModelContent((t=>this._onDidChange.fire({editor:e})))))}_onDidRemoveEditor(e){var t;null===(t=this._listener.get(e))||void 0===t||t.dispose(),this._listener.delete(e)}};S3=b3([w3(0,N_)],S3);var k3=globalThis&&globalThis.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{l(n.next(e))}catch(t){s(t)}}function a(e){try{l(n.throw(e))}catch(t){s(t)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}l((n=n.apply(e,t||[])).next())}))};function D3(e,t,i,n){const o=i.ordered(e).map((i=>Promise.resolve(n(i,e,t)).then(void 0,(e=>{Ta(e)}))));return Promise.all(o).then((e=>{const t=[];for(let i of e)Array.isArray(i)?t.push(...i):i&&t.push(i);return t}))}function L3(e,t,i,n){return D3(t,i,e,((e,t,i)=>e.provideDefinition(t,i,n)))}function N3(e,t,i,n){return D3(t,i,e,((e,t,i)=>e.provideDeclaration(t,i,n)))}function E3(e,t,i,n){return D3(t,i,e,((e,t,i)=>e.provideImplementation(t,i,n)))}function I3(e,t,i,n){return D3(t,i,e,((e,t,i)=>e.provideTypeDefinition(t,i,n)))}function T3(e,t,i,n,o){return D3(t,i,e,((e,t,i)=>k3(this,void 0,void 0,(function*(){const s=yield e.provideReferences(t,i,{includeDeclaration:!0},o);if(!n||!s||2!==s.length)return s;const r=yield e.provideReferences(t,i,{includeDeclaration:!1},o);return r&&1===r.length?r:s}))))}function M3(e){return k3(this,void 0,void 0,(function*(){const t=yield e(),i=new q1(t,""),n=i.references.map((e=>e.link));return i.dispose(),n}))}kx("_executeDefinitionProvider",((e,t,i)=>{const n=L3(e.get(Lb).definitionProvider,t,i,Ia.None);return M3((()=>n))})),kx("_executeTypeDefinitionProvider",((e,t,i)=>{const n=I3(e.get(Lb).typeDefinitionProvider,t,i,Ia.None);return M3((()=>n))})),kx("_executeDeclarationProvider",((e,t,i)=>{const n=N3(e.get(Lb).declarationProvider,t,i,Ia.None);return M3((()=>n))})),kx("_executeReferenceProvider",((e,t,i)=>{const n=T3(e.get(Lb).referenceProvider,t,i,!1,Ia.None);return M3((()=>n))})),kx("_executeImplementationProvider",((e,t,i)=>{const n=E3(e.get(Lb).implementationProvider,t,i,Ia.None);return M3((()=>n))}));var A3,O3,R3,P3,F3,B3,V3,W3,z3=globalThis&&globalThis.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{l(n.next(e))}catch(t){s(t)}}function a(e){try{l(n.throw(e))}catch(t){s(t)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}l((n=n.apply(e,t||[])).next())}))};ux.appendMenuItem(cx.EditorContext,{submenu:cx.EditorContextPeek,title:mf(0,"Peek"),group:"navigation",order:100});const H3=new Set;function j3(e){const t=new e;return Ex(t),H3.add(t.id),t}class U3{constructor(e,t){this.model=e,this.position=t}static is(e){return!(!e||"object"!=typeof e)&&(e instanceof U3||!(!er.isIPosition(e.position)||!e.model))}}class $3 extends xx{constructor(e,t){super(t),this.configuration=e}run(e,t,i){if(!t.hasModel())return Promise.resolve(void 0);const n=e.get(vF),o=e.get(N_),s=e.get($B),r=e.get(y3),a=e.get(Lb),l=t.getModel(),d=t.getPosition(),c=U3.is(i)?i:new U3(l,d),h=new CX(t,5),u=Qv(this._getLocationModel(a,c.model,c.position,h.token),h.token).then((e=>z3(this,void 0,void 0,(function*(){var i;if(!e||h.token.isCancellationRequested)return;let n;if(dy(e.ariaMessage),e.referenceAt(l.uri,d)){const e=this._getAlternativeCommand(t);e!==this.id&&H3.has(e)&&(n=t.getAction(e))}const s=e.references.length;if(0===s){if(!this.configuration.muteMessage){const e=l.getWordAtPosition(d);null===(i=WJ.get(t))||void 0===i||i.showMessage(this._getNoResultFoundMessage(e),d)}}else{if(1!==s||!n)return this._onResult(o,r,t,e);n.run()}}))),(e=>{n.error(e)})).finally((()=>{h.dispose()}));return s.showWhile(u,250),u}_onResult(e,t,i,n){return z3(this,void 0,void 0,(function*(){const o=this._getGoToPreference(i);if(i instanceof g1||!(this.configuration.openInPeek||"peek"===o&&n.references.length>1)){const s=n.firstReference(),r=n.references.length>1&&"gotoAndPeek"===o,a=yield this._openReference(i,e,s,this.configuration.openToSide,!r);r&&a?this._openInPeek(a,n):n.dispose(),"goto"===o&&t.put(s)}else this._openInPeek(i,n)}))}_openReference(e,t,i,n,o){return z3(this,void 0,void 0,(function*(){let s;if(Bl(i)&&(s=i.targetSelectionRange),s||(s=i.range),!s)return;const r=yield t.openCodeEditor({resource:i.uri,options:{selection:qo.collapseToStart(s),selectionRevealType:3,selectionSource:"code.jump"}},e,n);if(r){if(o){const e=r.getModel(),t=r.deltaDecorations([],[{range:s,options:{description:"symbol-navigate-action-highlight",className:"symbolHighlight"}}]);setTimeout((()=>{r.getModel()===e&&r.deltaDecorations(t,[])}),350)}return r}}))}_openInPeek(e,t){const i=_3.get(e);i&&e.hasModel()?i.toggleWidget(e.getSelection(),Xv((e=>Promise.resolve(t))),this.configuration.openInPeek):t.dispose()}}class K3 extends $3{_getLocationModel(e,t,i,n){return z3(this,void 0,void 0,(function*(){return new q1(yield L3(e.definitionProvider,t,i,n),mf(0,"Definitions"))}))}_getNoResultFoundMessage(e){return e&&e.word?mf(0,"No definition found for '{0}'",e.word):mf(0,"No definition found")}_getAlternativeCommand(e){return e.getOption(51).alternativeDefinitionCommand}_getGoToPreference(e){return e.getOption(51).multipleDefinitions}}const q3=Fs&&!h_?2118:70;j3(((A3=class e extends K3{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:e.id,label:mf(0,"Go to Definition"),alias:"Go to Definition",precondition:Sy.and(yI.hasDefinitionProvider,yI.isInWalkThroughSnippet.toNegated()),kbOpts:{kbExpr:yI.editorTextFocus,primary:q3,weight:100},contextMenuOpts:{group:"navigation",order:1.1}}),Cy.registerCommandAlias("editor.action.goToDeclaration",e.id)}}).id="editor.action.revealDefinition",A3)),j3(((O3=class e extends K3{constructor(){super({openToSide:!0,openInPeek:!1,muteMessage:!1},{id:e.id,label:mf(0,"Open Definition to the Side"),alias:"Open Definition to the Side",precondition:Sy.and(yI.hasDefinitionProvider,yI.isInWalkThroughSnippet.toNegated()),kbOpts:{kbExpr:yI.editorTextFocus,primary:Ol(2089,q3),weight:100}}),Cy.registerCommandAlias("editor.action.openDeclarationToTheSide",e.id)}}).id="editor.action.revealDefinitionAside",O3)),j3(((R3=class e extends K3{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:e.id,label:mf(0,"Peek Definition"),alias:"Peek Definition",precondition:Sy.and(yI.hasDefinitionProvider,A1.notInPeekEditor,yI.isInWalkThroughSnippet.toNegated()),kbOpts:{kbExpr:yI.editorTextFocus,primary:582,linux:{primary:3140},weight:100},contextMenuOpts:{menuId:cx.EditorContextPeek,group:"peek",order:2}}),Cy.registerCommandAlias("editor.action.previewDeclaration",e.id)}}).id="editor.action.peekDefinition",R3));class G3 extends $3{_getLocationModel(e,t,i,n){return z3(this,void 0,void 0,(function*(){return new q1(yield N3(e.declarationProvider,t,i,n),mf(0,"Declarations"))}))}_getNoResultFoundMessage(e){return e&&e.word?mf(0,"No declaration found for '{0}'",e.word):mf(0,"No declaration found")}_getAlternativeCommand(e){return e.getOption(51).alternativeDeclarationCommand}_getGoToPreference(e){return e.getOption(51).multipleDeclarations}}j3(((P3=class e extends G3{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:e.id,label:mf(0,"Go to Declaration"),alias:"Go to Declaration",precondition:Sy.and(yI.hasDeclarationProvider,yI.isInWalkThroughSnippet.toNegated()),contextMenuOpts:{group:"navigation",order:1.3}})}_getNoResultFoundMessage(e){return e&&e.word?mf(0,"No declaration found for '{0}'",e.word):mf(0,"No declaration found")}}).id="editor.action.revealDeclaration",P3)),j3(class extends G3{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:"editor.action.peekDeclaration",label:mf(0,"Peek Declaration"),alias:"Peek Declaration",precondition:Sy.and(yI.hasDeclarationProvider,A1.notInPeekEditor,yI.isInWalkThroughSnippet.toNegated()),contextMenuOpts:{menuId:cx.EditorContextPeek,group:"peek",order:3}})}});class Z3 extends $3{_getLocationModel(e,t,i,n){return z3(this,void 0,void 0,(function*(){return new q1(yield I3(e.typeDefinitionProvider,t,i,n),mf(0,"Type Definitions"))}))}_getNoResultFoundMessage(e){return e&&e.word?mf(0,"No type definition found for '{0}'",e.word):mf(0,"No type definition found")}_getAlternativeCommand(e){return e.getOption(51).alternativeTypeDefinitionCommand}_getGoToPreference(e){return e.getOption(51).multipleTypeDefinitions}}j3(((F3=class e extends Z3{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:e.ID,label:mf(0,"Go to Type Definition"),alias:"Go to Type Definition",precondition:Sy.and(yI.hasTypeDefinitionProvider,yI.isInWalkThroughSnippet.toNegated()),kbOpts:{kbExpr:yI.editorTextFocus,primary:0,weight:100},contextMenuOpts:{group:"navigation",order:1.4}})}}).ID="editor.action.goToTypeDefinition",F3)),j3(((B3=class e extends Z3{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:e.ID,label:mf(0,"Peek Type Definition"),alias:"Peek Type Definition",precondition:Sy.and(yI.hasTypeDefinitionProvider,A1.notInPeekEditor,yI.isInWalkThroughSnippet.toNegated()),contextMenuOpts:{menuId:cx.EditorContextPeek,group:"peek",order:4}})}}).ID="editor.action.peekTypeDefinition",B3));class Y3 extends $3{_getLocationModel(e,t,i,n){return z3(this,void 0,void 0,(function*(){return new q1(yield E3(e.implementationProvider,t,i,n),mf(0,"Implementations"))}))}_getNoResultFoundMessage(e){return e&&e.word?mf(0,"No implementation found for '{0}'",e.word):mf(0,"No implementation found")}_getAlternativeCommand(e){return e.getOption(51).alternativeImplementationCommand}_getGoToPreference(e){return e.getOption(51).multipleImplementations}}j3(((V3=class e extends Y3{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:e.ID,label:mf(0,"Go to Implementations"),alias:"Go to Implementations",precondition:Sy.and(yI.hasImplementationProvider,yI.isInWalkThroughSnippet.toNegated()),kbOpts:{kbExpr:yI.editorTextFocus,primary:2118,weight:100},contextMenuOpts:{group:"navigation",order:1.45}})}}).ID="editor.action.goToImplementation",V3)),j3(((W3=class e extends Y3{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:e.ID,label:mf(0,"Peek Implementations"),alias:"Peek Implementations",precondition:Sy.and(yI.hasImplementationProvider,A1.notInPeekEditor,yI.isInWalkThroughSnippet.toNegated()),kbOpts:{kbExpr:yI.editorTextFocus,primary:3142,weight:100},contextMenuOpts:{menuId:cx.EditorContextPeek,group:"peek",order:5}})}}).ID="editor.action.peekImplementation",W3));class X3 extends $3{_getNoResultFoundMessage(e){return e?mf(0,"No references found for '{0}'",e.word):mf(0,"No references found")}_getAlternativeCommand(e){return e.getOption(51).alternativeReferenceCommand}_getGoToPreference(e){return e.getOption(51).multipleReferences}}j3(class extends X3{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:"editor.action.goToReferences",label:mf(0,"Go to References"),alias:"Go to References",precondition:Sy.and(yI.hasReferenceProvider,A1.notInPeekEditor,yI.isInWalkThroughSnippet.toNegated()),kbOpts:{kbExpr:yI.editorTextFocus,primary:1094,weight:100},contextMenuOpts:{group:"navigation",order:1.45}})}_getLocationModel(e,t,i,n){return z3(this,void 0,void 0,(function*(){return new q1(yield T3(e.referenceProvider,t,i,!0,n),mf(0,"References"))}))}}),j3(class extends X3{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:"editor.action.referenceSearch.trigger",label:mf(0,"Peek References"),alias:"Peek References",precondition:Sy.and(yI.hasReferenceProvider,A1.notInPeekEditor,yI.isInWalkThroughSnippet.toNegated()),contextMenuOpts:{menuId:cx.EditorContextPeek,group:"peek",order:6}})}_getLocationModel(e,t,i,n){return z3(this,void 0,void 0,(function*(){return new q1(yield T3(e.referenceProvider,t,i,!1,n),mf(0,"References"))}))}});class Q3 extends $3{constructor(e,t,i){super(e,{id:"editor.action.goToLocation",label:mf(0,"Go to Any Symbol"),alias:"Go to Any Symbol",precondition:Sy.and(A1.notInPeekEditor,yI.isInWalkThroughSnippet.toNegated())}),this._references=t,this._gotoMultipleBehaviour=i}_getLocationModel(e,t,i,n){return z3(this,void 0,void 0,(function*(){return new q1(this._references,mf(0,"Locations"))}))}_getNoResultFoundMessage(e){return e&&mf(0,"No results for '{0}'",e.word)||""}_getGoToPreference(e){var t;return null!==(t=this._gotoMultipleBehaviour)&&void 0!==t?t:e.getOption(51).multipleReferences}_getAlternativeCommand(){return""}}Cy.registerCommand({id:"editor.action.goToLocations",description:{description:"Go to locations from a position in a file",args:[{name:"uri",description:"The text document in which to start",constraint:Ps},{name:"position",description:"The position at which to start",constraint:er.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:(e,t,i,n,o,s,r)=>z3(void 0,void 0,void 0,(function*(){Js(Ps.isUri(t)),Js(er.isIPosition(i)),Js(Array.isArray(n)),Js(void 0===o||"string"==typeof o),Js(void 0===r||"boolean"==typeof r);const a=e.get(N_),l=yield a.openCodeEditor({resource:t},a.getFocusedCodeEditor());if(xX(l))return l.setPosition(i),l.revealPositionInCenterIfOutsideViewport(i,0),l.invokeWithinContext((e=>{const t=new class extends Q3{_getNoResultFoundMessage(e){return s||super._getNoResultFoundMessage(e)}}({muteMessage:!Boolean(s),openInPeek:Boolean(r),openToSide:!1},n,o);e.get(k_).invokeFunction(t.run.bind(t),l)}))}))}),Cy.registerCommand({id:"editor.action.peekLocations",description:{description:"Peek locations from a position in a file",args:[{name:"uri",description:"The text document in which to start",constraint:Ps},{name:"position",description:"The position at which to start",constraint:er.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:(e,t,i,n,o)=>z3(void 0,void 0,void 0,(function*(){e.get(wy).executeCommand("editor.action.goToLocations",t,i,n,o,void 0,!0)}))}),Cy.registerCommand({id:"editor.action.findReferences",handler:(e,t,i)=>{Js(Ps.isUri(t)),Js(er.isIPosition(i));const n=e.get(Lb),o=e.get(N_);return o.openCodeEditor({resource:t},o.getFocusedCodeEditor()).then((e=>{if(!xX(e)||!e.hasModel())return;const t=_3.get(e);if(!t)return;const o=Xv((t=>T3(n.referenceProvider,e.getModel(),er.lift(i),!1,t).then((e=>new q1(e,mf(0,"References")))))),s=new qo(i.lineNumber,i.column,i.lineNumber,i.column);return Promise.resolve(t.toggleWidget(s,o,!1))}))}}),Cy.registerCommandAlias("editor.action.showReferences","editor.action.peekLocations"),ux.appendMenuItems([{id:cx.MenubarGoMenu,item:{command:{id:"editor.action.revealDefinition",title:mf(0,"Go to &&Definition")},group:"4_symbol_nav",order:2}},{id:cx.MenubarGoMenu,item:{command:{id:"editor.action.revealDeclaration",title:mf(0,"Go to &&Declaration")},group:"4_symbol_nav",order:3}},{id:cx.MenubarGoMenu,item:{command:{id:"editor.action.goToTypeDefinition",title:mf(0,"Go to &&Type Definition")},group:"4_symbol_nav",order:3}},{id:cx.MenubarGoMenu,item:{command:{id:"editor.action.goToImplementation",title:mf(0,"Go to &&Implementations")},group:"4_symbol_nav",order:4}},{id:cx.MenubarGoMenu,item:{command:{id:"editor.action.goToReferences",title:mf(0,"Go to &&References")},group:"4_symbol_nav",order:5}}]);var J3=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},e2=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};let t2=class e{constructor(e,t,i,n){this.textModelResolverService=t,this.languageService=i,this.languageFeaturesService=n,this.toUnhook=new ws,this.toUnhookForKeyboard=new ws,this.linkDecorations=[],this.currentWordAtPosition=null,this.previousPromise=null,this.editor=e;let o=new c1(e);this.toUnhook.add(o),this.toUnhook.add(o.onMouseMoveOrRelevantKeyDown((([e,t])=>{this.startFindDefinitionFromMouse(e,Qs(t))}))),this.toUnhook.add(o.onExecute((e=>{this.isEnabled(e)&&this.gotoDefinition(e.target.position,e.hasSideBySideModifier).then((()=>{this.removeLinkDecorations()}),(e=>{this.removeLinkDecorations(),Jo(e)}))}))),this.toUnhook.add(o.onCancel((()=>{this.removeLinkDecorations(),this.currentWordAtPosition=null})))}static get(t){return t.getContribution(e.ID)}startFindDefinitionFromCursor(e){return this.startFindDefinition(e).then((()=>{this.toUnhookForKeyboard.add(this.editor.onDidChangeCursorPosition((()=>{this.currentWordAtPosition=null,this.removeLinkDecorations(),this.toUnhookForKeyboard.clear()}))),this.toUnhookForKeyboard.add(this.editor.onKeyDown((e=>{e&&(this.currentWordAtPosition=null,this.removeLinkDecorations(),this.toUnhookForKeyboard.clear())})))}))}startFindDefinitionFromMouse(e,t){if(9===e.target.type&&this.linkDecorations.length>0)return;if(!this.editor.hasModel()||!this.isEnabled(e,t))return this.currentWordAtPosition=null,void this.removeLinkDecorations();const i=e.target.position;this.startFindDefinition(i)}startFindDefinition(e){var t;this.toUnhookForKeyboard.clear();const i=e?null===(t=this.editor.getModel())||void 0===t?void 0:t.getWordAtPosition(e):null;if(!i)return this.currentWordAtPosition=null,this.removeLinkDecorations(),Promise.resolve(0);if(this.currentWordAtPosition&&this.currentWordAtPosition.startColumn===i.startColumn&&this.currentWordAtPosition.endColumn===i.endColumn&&this.currentWordAtPosition.word===i.word)return Promise.resolve(0);this.currentWordAtPosition=i;let n=new wX(this.editor,15);return this.previousPromise&&(this.previousPromise.cancel(),this.previousPromise=null),this.previousPromise=Xv((t=>this.findDefinition(e,t))),this.previousPromise.then((t=>{if(t&&t.length&&n.validate(this.editor))if(t.length>1)this.addDecoration(new qo(e.lineNumber,i.startColumn,e.lineNumber,i.endColumn),(new RU).appendText(mf(0,"Click to show {0} definitions.",t.length)));else{let n=t[0];if(!n.uri)return;this.textModelResolverService.createModelReference(n.uri).then((t=>{if(!t.object||!t.object.textEditorModel)return void t.dispose();const{object:{textEditorModel:o}}=t,{startLineNumber:s}=n.range;if(s<1||s>o.getLineCount())return void t.dispose();const r=this.getPreviewValue(o,s,n);let a;a=n.originSelectionRange?qo.lift(n.originSelectionRange):new qo(e.lineNumber,i.startColumn,e.lineNumber,i.endColumn);const l=this.languageService.guessLanguageIdByFilepathOrFirstLine(o.uri);this.addDecoration(a,(new RU).appendCodeblock(l||"",r)),t.dispose()}))}else this.removeLinkDecorations()})).then(void 0,Jo)}getPreviewValue(t,i,n){let o=n.targetSelectionRange?n.range:this.getPreviewRangeBasedOnBrackets(t,i);o.endLineNumber-o.startLineNumber>=e.MAX_SOURCE_PREVIEW_LINES&&(o=this.getPreviewRangeBasedOnIndentation(t,i));return this.stripIndentationFromPreviewRange(t,i,o)}stripIndentationFromPreviewRange(e,t,i){let n=e.getLineFirstNonWhitespaceColumn(t);for(let o=t+1;o<i.endLineNumber;o++){const t=e.getLineFirstNonWhitespaceColumn(o);n=Math.min(n,t)}return e.getValueInRange(i).replace(new RegExp(`^\\s{${n-1}}`,"gm"),"").trim()}getPreviewRangeBasedOnIndentation(t,i){const n=t.getLineFirstNonWhitespaceColumn(i),o=Math.min(t.getLineCount(),i+e.MAX_SOURCE_PREVIEW_LINES);let s=i+1;for(;s<o;s++){if(n===t.getLineFirstNonWhitespaceColumn(s))break}return new qo(i,1,s+1,1)}getPreviewRangeBasedOnBrackets(t,i){const n=Math.min(t.getLineCount(),i+e.MAX_SOURCE_PREVIEW_LINES),o=[];let s=!0,r=t.bracketPairs.findNextBracket(new er(i,1));for(;null!==r;){if(0===o.length)o.push(r);else{const e=o[o.length-1];if(e.open[0]===r.open[0]&&e.isOpen&&!r.isOpen?o.pop():o.push(r),0===o.length){if(!s)return new qo(i,1,r.range.endLineNumber+1,1);s=!1}}const e=t.getLineMaxColumn(i);let a=r.range.endLineNumber,l=r.range.endColumn;if(e===r.range.endColumn&&(a++,l=1),a>n)return new qo(i,1,n+1,1);r=t.bracketPairs.findNextBracket(new er(a,l))}return new qo(i,1,n+1,1)}addDecoration(e,t){const i={range:e,options:{description:"goto-definition-link",inlineClassName:"goto-definition-link",hoverMessage:t}};this.linkDecorations=this.editor.deltaDecorations(this.linkDecorations,[i])}removeLinkDecorations(){this.linkDecorations.length>0&&(this.linkDecorations=this.editor.deltaDecorations(this.linkDecorations,[]))}isEnabled(e,t){return this.editor.hasModel()&&e.isNoneOrSingleMouseDown&&6===e.target.type&&(e.hasTriggerModifier||!!t&&t.keyCodeIsTriggerKey)&&this.languageFeaturesService.definitionProvider.has(this.editor.getModel())}findDefinition(e,t){const i=this.editor.getModel();return i?L3(this.languageFeaturesService.definitionProvider,i,e,t):Promise.resolve(null)}gotoDefinition(e,t){return this.editor.setPosition(e),this.editor.invokeWithinContext((e=>{const i=!t&&this.editor.getOption(78)&&!this.isInPeekEditor(e);return new K3({openToSide:t,openInPeek:i,muteMessage:!0},{alias:"",label:"",id:"",precondition:void 0}).run(e,this.editor)}))}isInPeekEditor(e){const t=e.get($y);return A1.inPeekEditor.getValue(t)}dispose(){this.toUnhook.dispose()}};t2.ID="editor.contrib.gotodefinitionatposition",t2.MAX_SOURCE_PREVIEW_LINES=8,t2=J3([e2(1,gy),e2(2,Lv),e2(3,Lb)],t2),Ix(t2.ID,t2),sx(((e,t)=>{const i=e.getColor($k);i&&t.addRule(`.monaco-editor .goto-definition-link { color: ${i} !important; }`)}));const i2=YC;class n2 extends Uo{constructor(){super(),this.containerDomNode=document.createElement("div"),this.containerDomNode.className="monaco-hover",this.containerDomNode.tabIndex=0,this.containerDomNode.setAttribute("role","tooltip"),this.contentsDomNode=document.createElement("div"),this.contentsDomNode.className="monaco-hover-content",this.scrollbar=this._register(new fT(this.contentsDomNode,{consumeMouseWheelIfScrollbarIsNeeded:!0})),this.containerDomNode.appendChild(this.scrollbar.getDomNode())}onContentsChanged(){this.scrollbar.scanDomNode()}}class o2 extends Uo{constructor(e,t,i){super(),this.actionContainer=$C(e,i2("div.action-container")),this.actionContainer.setAttribute("tabindex","0"),this.action=$C(this.actionContainer,i2("a.action")),this.action.setAttribute("role","button"),t.iconClass&&$C(this.action,i2(`span.icon.${t.iconClass}`));$C(this.action,i2("span")).textContent=i?`${t.label} (${i})`:t.label,this._register(nC(this.actionContainer,zC.CLICK,(e=>{e.stopPropagation(),e.preventDefault(),t.run(this.actionContainer)}))),this._register(nC(this.actionContainer,zC.KEY_UP,(e=>{new jw(e).equals(3)&&(e.stopPropagation(),e.preventDefault(),t.run(this.actionContainer))}))),this.setEnabled(!0)}static render(e,t,i){return new o2(e,t,i)}setEnabled(e){e?(this.actionContainer.classList.remove("disabled"),this.actionContainer.removeAttribute("aria-disabled")):(this.actionContainer.classList.add("disabled"),this.actionContainer.setAttribute("aria-disabled","true"))}}var s2=globalThis&&globalThis.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{l(n.next(e))}catch(t){s(t)}}function a(e){try{l(n.throw(e))}catch(t){s(t)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}l((n=n.apply(e,t||[])).next())}))},r2=globalThis&&globalThis.__asyncValues||function(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,i=e[Symbol.asyncIterator];return i?i.call(e):(e="function"==typeof __values?__values(e):e[Symbol.iterator](),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(i){t[i]=e[i]&&function(t){return new Promise((function(n,o){(function(e,t,i,n){Promise.resolve(n).then((function(t){e({value:t,done:i})}),t)})(n,o,(t=e[i](t)).done,t.value)}))}}};class a2{constructor(e,t,i){this.value=e,this.isComplete=t,this.hasLoadingMessage=i}}class l2 extends Uo{constructor(e,t){super(),this._editor=e,this._computer=t,this._onResult=this._register(new $o),this.onResult=this._onResult.event,this._firstWaitScheduler=this._register(new lb((()=>this._triggerAsyncComputation()),0)),this._secondWaitScheduler=this._register(new lb((()=>this._triggerSyncComputation()),0)),this._loadingMessageScheduler=this._register(new lb((()=>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(53).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=function(e){const t=new as,i=e(t.token);return new mb(t,(e=>Zv(this,void 0,void 0,(function*(){var n,o;const s=t.token.onCancellationRequested((()=>{s.dispose(),t.dispose(),e.reject(new ls)}));try{try{for(var r,a=Yv(i);!(r=yield a.next()).done;){const i=r.value;if(t.token.isCancellationRequested)return;e.emitOne(i)}}catch(l){n={error:l}}finally{try{r&&!r.done&&(o=a.return)&&(yield o.call(a))}finally{if(n)throw n.error}}s.dispose(),t.dispose()}catch(d){s.dispose(),t.dispose(),e.reject(d)}}))))}((e=>this._computer.computeAsync(e))),(()=>{s2(this,void 0,void 0,(function*(){var e,t;try{try{for(var i,n=r2(this._asyncIterable);!(i=yield n.next()).done;){const e=i.value;e&&(this._result.push(e),this._fireResult())}}catch(o){e={error:o}}finally{try{i&&!i.done&&(t=n.return)&&(yield t.call(n))}finally{if(e)throw e.error}}this._asyncIterableDone=!0,3!==this._state&&4!==this._state||this._setState(0)}catch(s){Jo(s)}}))})()):this._asyncIterableDone=!0}_triggerSyncComputation(){this._computer.computeSync&&(this._result=this._result.concat(this._computer.computeSync())),this._setState(this._asyncIterableDone?0:3)}_triggerLoadingMessage(){3===this._state&&this._setState(4)}_fireResult(){if(1===this._state||2===this._state)return;const e=0===this._state,t=4===this._state;this._onResult.fire(new a2(this._result.slice(0),e,t))}start(e){if(0===e)0===this._state&&(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()}}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 d2{constructor(e,t){this.priority=e,this.range=t,this.type=1}equals(e){return 1===e.type&&this.range.equalsRange(e.range)}canAdoptVisibleHover(e,t){return 1===e.type&&t.lineNumber===this.range.startLineNumber}}class c2{constructor(e,t,i){this.priority=e,this.owner=t,this.range=i,this.type=2}equals(e){return 2===e.type&&this.owner===e.owner}canAdoptVisibleHover(e,t){return 2===e.type&&this.owner===e.owner}}const h2=new class{constructor(){this._participants=[]}register(e){this._participants.push(e)}getAll(){return this._participants}};class u2{constructor(){this.value="",this.pos=0}static isDigitCharacter(e){return e>=48&&e<=57}static isVariableCharacter(e){return 95===e||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};let e,t=this.pos,i=0,n=this.value.charCodeAt(t);if(e=u2._table[n],"number"==typeof e)return this.pos+=1,{type:e,pos:t,len:1};if(u2.isDigitCharacter(n)){e=8;do{i+=1,n=this.value.charCodeAt(t+i)}while(u2.isDigitCharacter(n));return this.pos+=i,{type:e,pos:t,len:i}}if(u2.isVariableCharacter(n)){e=9;do{n=this.value.charCodeAt(t+ ++i)}while(u2.isVariableCharacter(n)||u2.isDigitCharacter(n));return this.pos+=i,{type:e,pos:t,len:i}}e=10;do{i+=1,n=this.value.charCodeAt(t+i)}while(!isNaN(n)&&void 0===u2._table[n]&&!u2.isDigitCharacter(n)&&!u2.isVariableCharacter(n));return this.pos+=i,{type:e,pos:t,len:i}}}u2._table={36:0,58:1,44:2,123:3,125:4,92:5,47:6,124:7,43:11,45:12,63:13};class g2{constructor(){this._children=[]}appendChild(e){return e instanceof p2&&this._children[this._children.length-1]instanceof p2?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 e(t,i){for(const n of t)n.parent=i,e(n.children,n)}(t,i)}get children(){return this._children}get snippet(){let e=this;for(;;){if(!e)return;if(e instanceof y2)return e;e=e.parent}}toString(){return this.children.reduce(((e,t)=>e+t.toString()),"")}len(){return 0}}class p2 extends g2{constructor(e){super(),this.value=e}toString(){return this.value}len(){return this.value.length}clone(){return new p2(this.value)}}class m2 extends g2{}class f2 extends m2{constructor(e){super(),this.index=e}static compareByIndex(e,t){return e.index===t.index?0:e.isFinalTabstop?1:t.isFinalTabstop||e.index<t.index?-1:e.index>t.index?1:0}get isFinalTabstop(){return 0===this.index}get choice(){return 1===this._children.length&&this._children[0]instanceof _2?this._children[0]:void 0}clone(){let e=new f2(this.index);return this.transform&&(e.transform=this.transform.clone()),e._children=this.children.map((e=>e.clone())),e}}class _2 extends g2{constructor(){super(...arguments),this.options=[]}appendChild(e){return e instanceof p2&&(e.parent=this,this.options.push(e)),this}toString(){return this.options[0].value}len(){return this.options[0].len()}clone(){let e=new _2;return this.options.forEach(e.appendChild,e),e}}class v2 extends g2{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((e=>e instanceof b2&&Boolean(e.elseValue)))&&(n=this._replace([])),n}_replace(e){let t="";for(const i of this._children)if(i instanceof b2){let n=e[i.index]||"";n=i.resolve(n),t+=n}else t+=i.toString();return t}toString(){return""}clone(){let e=new v2;return e.regexp=new RegExp(this.regexp.source,(this.regexp.ignoreCase?"i":"")+(this.regexp.global?"g":"")),e._children=this.children.map((e=>e.clone())),e}}class b2 extends g2{constructor(e,t,i,n){super(),this.index=e,this.shorthandName=t,this.ifValue=i,this.elseValue=n}resolve(e){return"upcase"===this.shorthandName?e?e.toLocaleUpperCase():"":"downcase"===this.shorthandName?e?e.toLocaleLowerCase():"":"capitalize"===this.shorthandName?e?e[0].toLocaleUpperCase()+e.substr(1):"":"pascalcase"===this.shorthandName?e?this._toPascalCase(e):"":"camelcase"===this.shorthandName?e?this._toCamelCase(e):"":Boolean(e)&&"string"==typeof this.ifValue?this.ifValue:Boolean(e)||"string"!=typeof this.elseValue?e||"":this.elseValue}_toPascalCase(e){const t=e.match(/[a-z0-9]+/gi);return t?t.map((e=>e.charAt(0).toUpperCase()+e.substr(1).toLowerCase())).join(""):e}_toCamelCase(e){const t=e.match(/[a-z0-9]+/gi);return t?t.map(((e,t)=>0===t?e.toLowerCase():e.charAt(0).toUpperCase()+e.substr(1).toLowerCase())).join(""):e}clone(){return new b2(this.index,this.shorthandName,this.ifValue,this.elseValue)}}class w2 extends m2{constructor(e){super(),this.name=e}resolve(e){let t=e.resolve(this);return this.transform&&(t=this.transform.resolve(t||"")),void 0!==t&&(this._children=[new p2(t)],!0)}clone(){const e=new w2(this.name);return this.transform&&(e.transform=this.transform.clone()),e._children=this.children.map((e=>e.clone())),e}}function C2(e,t){const i=[...e];for(;i.length>0;){const e=i.shift();if(!t(e))break;i.unshift(...e.children)}}class y2 extends g2{get placeholderInfo(){if(!this._placeholders){let e,t=[];this.walk((function(i){return i instanceof f2&&(t.push(i),e=!e||e.index<i.index?i:e),!0})),this._placeholders={all:t,last:e}}return this._placeholders}get placeholders(){const{all:e}=this.placeholderInfo;return e}offset(e){let t=0,i=!1;return this.walk((n=>n===e?(i=!0,!1):(t+=n.len(),!0))),i?t:-1}fullLen(e){let t=0;return C2([e],(e=>(t+=e.len(),!0))),t}enclosingPlaceholders(e){let t=[],{parent:i}=e;for(;i;)i instanceof f2&&t.push(i),i=i.parent;return t}resolveVariables(e){return this.walk((t=>(t instanceof w2&&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(){let e=new y2;return this._children=this.children.map((e=>e.clone())),e}walk(e){C2(this.children,e)}}class x2{constructor(){this._scanner=new u2,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){this._scanner.text(e),this._token=this._scanner.next();const n=new y2;for(;this._parse(n););const o=new Map,s=[];let r=0;n.walk((e=>(e instanceof f2&&(r+=1,e.isFinalTabstop?o.set(0,void 0):!o.has(e.index)&&e.children.length>0?o.set(e.index,e.children):s.push(e)),!0)));for(const a of s){const e=o.get(a.index);if(e){const t=new f2(a.index);t.transform=a.transform;for(const i of e)t.appendChild(i.clone());n.replace(a,[t])}}return i||(i=r>0&&t),!o.has(0)&&i&&n.appendChild(new f2(0)),n}_accept(e,t){if(void 0===e||this._token.type===e){let e=!t||this._scanner.tokenText(this._token);return this._token=this._scanner.next(),e}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(14===this._token.type)return!1;if(5===this._token.type){const e=this._scanner.next();if(0!==e.type&&4!==e.type&&5!==e.type)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 p2(t)),!0)}_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 f2(Number(t)):new w2(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 n=new f2(Number(t));if(this._accept(1))for(;;){if(this._accept(4))return e.appendChild(n),!0;if(!this._parse(n))return e.appendChild(new p2("${"+t+":")),n.children.forEach(e.appendChild,e),!0}else{if(!(n.index>0&&this._accept(7)))return this._accept(6)?this._parseTransform(n)?(e.appendChild(n),!0):(this._backTo(i),!1):this._accept(4)?(e.appendChild(n),!0):this._backTo(i);{const t=new _2;for(;;){if(this._parseChoiceElement(t)){if(this._accept(2))continue;if(this._accept(7)&&(n.appendChild(t),this._accept(4)))return e.appendChild(n),!0}return this._backTo(i),!1}}}}_parseChoiceElement(e){const t=this._token,i=[];for(;2!==this._token.type&&7!==this._token.type;){let e;if(e=(e=this._accept(5,!0))?this._accept(2,!0)||this._accept(7,!0)||this._accept(5,!0)||e:this._accept(void 0,!0),!e)return this._backTo(t),!1;i.push(e)}return 0===i.length?(this._backTo(t),!1):(e.appendChild(new p2(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 n=new w2(t);if(!this._accept(1))return this._accept(6)?this._parseTransform(n)?(e.appendChild(n),!0):(this._backTo(i),!1):this._accept(4)?(e.appendChild(n),!0):this._backTo(i);for(;;){if(this._accept(4))return e.appendChild(n),!0;if(!this._parse(n))return e.appendChild(new p2("${"+t+":")),n.children.forEach(e.appendChild,e),!0}}_parseTransform(e){let t=new v2,i="",n="";for(;!this._accept(6);){let e;if(e=this._accept(5,!0))e=this._accept(6,!0)||e,i+=e;else{if(14===this._token.type)return!1;i+=this._accept(void 0,!0)}}for(;!this._accept(6);){let e;if(e=this._accept(5,!0))e=this._accept(5,!0)||this._accept(6,!0)||e,t.appendChild(new p2(e));else if(!this._parseFormatString(t)&&!this._parseAnything(t))return!1}for(;!this._accept(4);){if(14===this._token.type)return!1;n+=this._accept(void 0,!0)}try{t.regexp=new RegExp(i,n)}catch(o){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);let n=this._accept(8,!0);if(!n)return this._backTo(t),!1;if(!i)return e.appendChild(new b2(Number(n))),!0;if(this._accept(4))return e.appendChild(new b2(Number(n))),!0;if(!this._accept(1))return this._backTo(t),!1;if(this._accept(6)){let i=this._accept(9,!0);return i&&this._accept(4)?(e.appendChild(new b2(Number(n),i)),!0):(this._backTo(t),!1)}if(this._accept(11)){let t=this._until(4);if(t)return e.appendChild(new b2(Number(n),void 0,t,void 0)),!0}else if(this._accept(12)){let t=this._until(4);if(t)return e.appendChild(new b2(Number(n),void 0,void 0,t)),!0}else if(this._accept(13)){let t=this._until(1);if(t){let i=this._until(4);if(i)return e.appendChild(new b2(Number(n),void 0,t,i)),!0}}else{let t=this._until(4);if(t)return e.appendChild(new b2(Number(n),void 0,void 0,t)),!0}return this._backTo(t),!1}_parseAnything(e){return 14!==this._token.type&&(e.appendChild(new p2(this._scanner.tokenText(this._token))),this._accept(void 0),!0)}}const S2={inputActiveOptionBorder:hS.fromHex("#007ACC00"),inputActiveOptionForeground:hS.fromHex("#FFFFFF"),inputActiveOptionBackground:hS.fromHex("#0E639C50")};class k2 extends QI{constructor(e){super(),this._onChange=this._register(new $o),this.onChange=this._onChange.event,this._onKeyDown=this._register(new $o),this.onKeyDown=this._onKeyDown.event,this._opts=Object.assign(Object.assign({},S2),e),this._checked=this._opts.isChecked;const t=["monaco-custom-checkbox"];this._opts.icon&&t.push(...Ys.asClassNameArray(this._opts.icon)),this._opts.actionClassName&&t.push(...this._opts.actionClassName.split(" ")),this._checked&&t.push("checked"),this.domNode=document.createElement("div"),this.domNode.title=this._opts.title,this.domNode.classList.add(...t),this._opts.notFocusable||(this.domNode.tabIndex=0),this.domNode.setAttribute("role","checkbox"),this.domNode.setAttribute("aria-checked",String(this._checked)),this.domNode.setAttribute("aria-label",this._opts.title),this.applyStyles(),this.onclick(this.domNode,(e=>{this.enabled&&(this.checked=!this._checked,this._onChange.fire(!1),e.preventDefault())})),this.ignoreGesture(this.domNode),this.onkeydown(this.domNode,(e=>{if(10===e.keyCode||3===e.keyCode)return this.checked=!this._checked,this._onChange.fire(!0),void e.preventDefault();this._onKeyDown.fire(e)}))}get enabled(){return"true"!==this.domNode.getAttribute("aria-disabled")}focus(){this.domNode.focus()}get checked(){return this._checked}set checked(e){this._checked=e,this.domNode.setAttribute("aria-checked",String(this._checked)),this.domNode.classList.toggle("checked",this._checked),this.applyStyles()}width(){return 22}style(e){e.inputActiveOptionBorder&&(this._opts.inputActiveOptionBorder=e.inputActiveOptionBorder),e.inputActiveOptionForeground&&(this._opts.inputActiveOptionForeground=e.inputActiveOptionForeground),e.inputActiveOptionBackground&&(this._opts.inputActiveOptionBackground=e.inputActiveOptionBackground),this.applyStyles()}applyStyles(){this.domNode&&(this.domNode.style.borderColor=this._checked&&this._opts.inputActiveOptionBorder?this._opts.inputActiveOptionBorder.toString():"",this.domNode.style.color=this._checked&&this._opts.inputActiveOptionForeground?this._opts.inputActiveOptionForeground.toString():"inherit",this.domNode.style.backgroundColor=this._checked&&this._opts.inputActiveOptionBackground?this._opts.inputActiveOptionBackground.toString():"")}enable(){this.domNode.setAttribute("aria-disabled",String(!1))}disable(){this.domNode.setAttribute("aria-disabled",String(!0))}}const D2=mf(0,"Match Case"),L2=mf(0,"Match Whole Word"),N2=mf(0,"Use Regular Expression");class E2 extends k2{constructor(e){super({icon:br.caseSensitive,title:D2+e.appendTitle,isChecked:e.isChecked,inputActiveOptionBorder:e.inputActiveOptionBorder,inputActiveOptionForeground:e.inputActiveOptionForeground,inputActiveOptionBackground:e.inputActiveOptionBackground})}}class I2 extends k2{constructor(e){super({icon:br.wholeWord,title:L2+e.appendTitle,isChecked:e.isChecked,inputActiveOptionBorder:e.inputActiveOptionBorder,inputActiveOptionForeground:e.inputActiveOptionForeground,inputActiveOptionBackground:e.inputActiveOptionBackground})}}class T2 extends k2{constructor(e){super({icon:br.regex,title:N2+e.appendTitle,isChecked:e.isChecked,inputActiveOptionBorder:e.inputActiveOptionBorder,inputActiveOptionForeground:e.inputActiveOptionForeground,inputActiveOptionBackground:e.inputActiveOptionBackground})}}const M2=mf(0,"input");class A2 extends QI{constructor(e,t,i,n){super(),this._showOptionButtons=i,this.fixFocusOnOptionClickEnabled=!0,this.imeSessionInProgress=!1,this._onDidOptionChange=this._register(new $o),this.onDidOptionChange=this._onDidOptionChange.event,this._onKeyDown=this._register(new $o),this.onKeyDown=this._onKeyDown.event,this._onMouseDown=this._register(new $o),this.onMouseDown=this._onMouseDown.event,this._onInput=this._register(new $o),this._onKeyUp=this._register(new $o),this._onCaseSensitiveKeyDown=this._register(new $o),this.onCaseSensitiveKeyDown=this._onCaseSensitiveKeyDown.event,this._onRegexKeyDown=this._register(new $o),this.onRegexKeyDown=this._onRegexKeyDown.event,this._lastHighlightFindOptions=0,this.contextViewProvider=t,this.placeholder=n.placeholder||"",this.validation=n.validation,this.label=n.label||M2,this.inputActiveOptionBorder=n.inputActiveOptionBorder,this.inputActiveOptionForeground=n.inputActiveOptionForeground,this.inputActiveOptionBackground=n.inputActiveOptionBackground,this.inputBackground=n.inputBackground,this.inputForeground=n.inputForeground,this.inputBorder=n.inputBorder,this.inputValidationInfoBorder=n.inputValidationInfoBorder,this.inputValidationInfoBackground=n.inputValidationInfoBackground,this.inputValidationInfoForeground=n.inputValidationInfoForeground,this.inputValidationWarningBorder=n.inputValidationWarningBorder,this.inputValidationWarningBackground=n.inputValidationWarningBackground,this.inputValidationWarningForeground=n.inputValidationWarningForeground,this.inputValidationErrorBorder=n.inputValidationErrorBorder,this.inputValidationErrorBackground=n.inputValidationErrorBackground,this.inputValidationErrorForeground=n.inputValidationErrorForeground;const o=n.appendCaseSensitiveLabel||"",s=n.appendWholeWordsLabel||"",r=n.appendRegexLabel||"",a=n.history||[],l=!!n.flexibleHeight,d=!!n.flexibleWidth,c=n.flexibleMaxHeight;this.domNode=document.createElement("div"),this.domNode.classList.add("monaco-findInput"),this.inputBox=this._register(new TU(this.domNode,this.contextViewProvider,{placeholder:this.placeholder||"",ariaLabel:this.label||"",validationOptions:{validation:this.validation},inputBackground:this.inputBackground,inputForeground:this.inputForeground,inputBorder:this.inputBorder,inputValidationInfoBackground:this.inputValidationInfoBackground,inputValidationInfoForeground:this.inputValidationInfoForeground,inputValidationInfoBorder:this.inputValidationInfoBorder,inputValidationWarningBackground:this.inputValidationWarningBackground,inputValidationWarningForeground:this.inputValidationWarningForeground,inputValidationWarningBorder:this.inputValidationWarningBorder,inputValidationErrorBackground:this.inputValidationErrorBackground,inputValidationErrorForeground:this.inputValidationErrorForeground,inputValidationErrorBorder:this.inputValidationErrorBorder,history:a,showHistoryHint:n.showHistoryHint,flexibleHeight:l,flexibleWidth:d,flexibleMaxHeight:c})),this.regex=this._register(new T2({appendTitle:r,isChecked:!1,inputActiveOptionBorder:this.inputActiveOptionBorder,inputActiveOptionForeground:this.inputActiveOptionForeground,inputActiveOptionBackground:this.inputActiveOptionBackground})),this._register(this.regex.onChange((e=>{this._onDidOptionChange.fire(e),!e&&this.fixFocusOnOptionClickEnabled&&this.inputBox.focus(),this.validate()}))),this._register(this.regex.onKeyDown((e=>{this._onRegexKeyDown.fire(e)}))),this.wholeWords=this._register(new I2({appendTitle:s,isChecked:!1,inputActiveOptionBorder:this.inputActiveOptionBorder,inputActiveOptionForeground:this.inputActiveOptionForeground,inputActiveOptionBackground:this.inputActiveOptionBackground})),this._register(this.wholeWords.onChange((e=>{this._onDidOptionChange.fire(e),!e&&this.fixFocusOnOptionClickEnabled&&this.inputBox.focus(),this.validate()}))),this.caseSensitive=this._register(new E2({appendTitle:o,isChecked:!1,inputActiveOptionBorder:this.inputActiveOptionBorder,inputActiveOptionForeground:this.inputActiveOptionForeground,inputActiveOptionBackground:this.inputActiveOptionBackground})),this._register(this.caseSensitive.onChange((e=>{this._onDidOptionChange.fire(e),!e&&this.fixFocusOnOptionClickEnabled&&this.inputBox.focus(),this.validate()}))),this._register(this.caseSensitive.onKeyDown((e=>{this._onCaseSensitiveKeyDown.fire(e)}))),this._showOptionButtons&&(this.inputBox.paddingRight=this.caseSensitive.width()+this.wholeWords.width()+this.regex.width());let h=[this.caseSensitive.domNode,this.wholeWords.domNode,this.regex.domNode];this.onkeydown(this.domNode,(e=>{if(e.equals(15)||e.equals(17)||e.equals(9)){let t=h.indexOf(document.activeElement);if(t>=0){let i=-1;e.equals(17)?i=(t+1)%h.length:e.equals(15)&&(i=0===t?h.length-1:t-1),e.equals(9)?(h[t].blur(),this.inputBox.focus()):i>=0&&h[i].focus(),HC(e,!0)}}})),this.controls=document.createElement("div"),this.controls.className="controls",this.controls.style.display=this._showOptionButtons?"block":"none",this.controls.appendChild(this.caseSensitive.domNode),this.controls.appendChild(this.wholeWords.domNode),this.controls.appendChild(this.regex.domNode),this.domNode.appendChild(this.controls),e&&e.appendChild(this.domNode),this._register(nC(this.inputBox.inputElement,"compositionstart",(e=>{this.imeSessionInProgress=!0}))),this._register(nC(this.inputBox.inputElement,"compositionend",(e=>{this.imeSessionInProgress=!1,this._onInput.fire()}))),this.onkeydown(this.inputBox.inputElement,(e=>this._onKeyDown.fire(e))),this.onkeyup(this.inputBox.inputElement,(e=>this._onKeyUp.fire(e))),this.oninput(this.inputBox.inputElement,(e=>this._onInput.fire())),this.onmousedown(this.inputBox.inputElement,(e=>this._onMouseDown.fire(e)))}enable(){this.domNode.classList.remove("disabled"),this.inputBox.enable(),this.regex.enable(),this.wholeWords.enable(),this.caseSensitive.enable()}disable(){this.domNode.classList.add("disabled"),this.inputBox.disable(),this.regex.disable(),this.wholeWords.disable(),this.caseSensitive.disable()}setFocusInputOnOptionClick(e){this.fixFocusOnOptionClickEnabled=e}setEnabled(e){e?this.enable():this.disable()}getValue(){return this.inputBox.value}setValue(e){this.inputBox.value!==e&&(this.inputBox.value=e)}style(e){this.inputActiveOptionBorder=e.inputActiveOptionBorder,this.inputActiveOptionForeground=e.inputActiveOptionForeground,this.inputActiveOptionBackground=e.inputActiveOptionBackground,this.inputBackground=e.inputBackground,this.inputForeground=e.inputForeground,this.inputBorder=e.inputBorder,this.inputValidationInfoBackground=e.inputValidationInfoBackground,this.inputValidationInfoForeground=e.inputValidationInfoForeground,this.inputValidationInfoBorder=e.inputValidationInfoBorder,this.inputValidationWarningBackground=e.inputValidationWarningBackground,this.inputValidationWarningForeground=e.inputValidationWarningForeground,this.inputValidationWarningBorder=e.inputValidationWarningBorder,this.inputValidationErrorBackground=e.inputValidationErrorBackground,this.inputValidationErrorForeground=e.inputValidationErrorForeground,this.inputValidationErrorBorder=e.inputValidationErrorBorder,this.applyStyles()}applyStyles(){if(this.domNode){const e={inputActiveOptionBorder:this.inputActiveOptionBorder,inputActiveOptionForeground:this.inputActiveOptionForeground,inputActiveOptionBackground:this.inputActiveOptionBackground};this.regex.style(e),this.wholeWords.style(e),this.caseSensitive.style(e);const t={inputBackground:this.inputBackground,inputForeground:this.inputForeground,inputBorder:this.inputBorder,inputValidationInfoBackground:this.inputValidationInfoBackground,inputValidationInfoForeground:this.inputValidationInfoForeground,inputValidationInfoBorder:this.inputValidationInfoBorder,inputValidationWarningBackground:this.inputValidationWarningBackground,inputValidationWarningForeground:this.inputValidationWarningForeground,inputValidationWarningBorder:this.inputValidationWarningBorder,inputValidationErrorBackground:this.inputValidationErrorBackground,inputValidationErrorForeground:this.inputValidationErrorForeground,inputValidationErrorBorder:this.inputValidationErrorBorder};this.inputBox.style(t)}}select(){this.inputBox.select()}focus(){this.inputBox.focus()}getCaseSensitive(){return this.caseSensitive.checked}setCaseSensitive(e){this.caseSensitive.checked=e}getWholeWords(){return this.wholeWords.checked}setWholeWords(e){this.wholeWords.checked=e}getRegex(){return this.regex.checked}setRegex(e){this.regex.checked=e,this.validate()}focusOnCaseSensitive(){this.caseSensitive.focus()}highlightFindOptions(){this.domNode.classList.remove("highlight-"+this._lastHighlightFindOptions),this._lastHighlightFindOptions=1-this._lastHighlightFindOptions,this.domNode.classList.add("highlight-"+this._lastHighlightFindOptions)}validate(){this.inputBox.validate()}clearMessage(){this.inputBox.hideMessage()}}const O2=mf(0,"input"),R2=mf(0,"Preserve Case");class P2 extends k2{constructor(e){super({icon:br.preserveCase,title:R2+e.appendTitle,isChecked:e.isChecked,inputActiveOptionBorder:e.inputActiveOptionBorder,inputActiveOptionForeground:e.inputActiveOptionForeground,inputActiveOptionBackground:e.inputActiveOptionBackground})}}class F2 extends QI{constructor(e,t,i,n){super(),this._showOptionButtons=i,this.fixFocusOnOptionClickEnabled=!0,this.cachedOptionsWidth=0,this._onDidOptionChange=this._register(new $o),this.onDidOptionChange=this._onDidOptionChange.event,this._onKeyDown=this._register(new $o),this.onKeyDown=this._onKeyDown.event,this._onMouseDown=this._register(new $o),this._onInput=this._register(new $o),this._onKeyUp=this._register(new $o),this._onPreserveCaseKeyDown=this._register(new $o),this.onPreserveCaseKeyDown=this._onPreserveCaseKeyDown.event,this.contextViewProvider=t,this.placeholder=n.placeholder||"",this.validation=n.validation,this.label=n.label||O2,this.inputActiveOptionBorder=n.inputActiveOptionBorder,this.inputActiveOptionForeground=n.inputActiveOptionForeground,this.inputActiveOptionBackground=n.inputActiveOptionBackground,this.inputBackground=n.inputBackground,this.inputForeground=n.inputForeground,this.inputBorder=n.inputBorder,this.inputValidationInfoBorder=n.inputValidationInfoBorder,this.inputValidationInfoBackground=n.inputValidationInfoBackground,this.inputValidationInfoForeground=n.inputValidationInfoForeground,this.inputValidationWarningBorder=n.inputValidationWarningBorder,this.inputValidationWarningBackground=n.inputValidationWarningBackground,this.inputValidationWarningForeground=n.inputValidationWarningForeground,this.inputValidationErrorBorder=n.inputValidationErrorBorder,this.inputValidationErrorBackground=n.inputValidationErrorBackground,this.inputValidationErrorForeground=n.inputValidationErrorForeground;const o=n.appendPreserveCaseLabel||"",s=n.history||[],r=!!n.flexibleHeight,a=!!n.flexibleWidth,l=n.flexibleMaxHeight;this.domNode=document.createElement("div"),this.domNode.classList.add("monaco-findInput"),this.inputBox=this._register(new TU(this.domNode,this.contextViewProvider,{ariaLabel:this.label||"",placeholder:this.placeholder||"",validationOptions:{validation:this.validation},inputBackground:this.inputBackground,inputForeground:this.inputForeground,inputBorder:this.inputBorder,inputValidationInfoBackground:this.inputValidationInfoBackground,inputValidationInfoForeground:this.inputValidationInfoForeground,inputValidationInfoBorder:this.inputValidationInfoBorder,inputValidationWarningBackground:this.inputValidationWarningBackground,inputValidationWarningForeground:this.inputValidationWarningForeground,inputValidationWarningBorder:this.inputValidationWarningBorder,inputValidationErrorBackground:this.inputValidationErrorBackground,inputValidationErrorForeground:this.inputValidationErrorForeground,inputValidationErrorBorder:this.inputValidationErrorBorder,history:s,showHistoryHint:n.showHistoryHint,flexibleHeight:r,flexibleWidth:a,flexibleMaxHeight:l})),this.preserveCase=this._register(new P2({appendTitle:o,isChecked:!1,inputActiveOptionBorder:this.inputActiveOptionBorder,inputActiveOptionForeground:this.inputActiveOptionForeground,inputActiveOptionBackground:this.inputActiveOptionBackground})),this._register(this.preserveCase.onChange((e=>{this._onDidOptionChange.fire(e),!e&&this.fixFocusOnOptionClickEnabled&&this.inputBox.focus(),this.validate()}))),this._register(this.preserveCase.onKeyDown((e=>{this._onPreserveCaseKeyDown.fire(e)}))),this._showOptionButtons?this.cachedOptionsWidth=this.preserveCase.width():this.cachedOptionsWidth=0;let d=[this.preserveCase.domNode];this.onkeydown(this.domNode,(e=>{if(e.equals(15)||e.equals(17)||e.equals(9)){let t=d.indexOf(document.activeElement);if(t>=0){let i=-1;e.equals(17)?i=(t+1)%d.length:e.equals(15)&&(i=0===t?d.length-1:t-1),e.equals(9)?(d[t].blur(),this.inputBox.focus()):i>=0&&d[i].focus(),HC(e,!0)}}}));let c=document.createElement("div");c.className="controls",c.style.display=this._showOptionButtons?"block":"none",c.appendChild(this.preserveCase.domNode),this.domNode.appendChild(c),e&&e.appendChild(this.domNode),this.onkeydown(this.inputBox.inputElement,(e=>this._onKeyDown.fire(e))),this.onkeyup(this.inputBox.inputElement,(e=>this._onKeyUp.fire(e))),this.oninput(this.inputBox.inputElement,(e=>this._onInput.fire())),this.onmousedown(this.inputBox.inputElement,(e=>this._onMouseDown.fire(e)))}enable(){this.domNode.classList.remove("disabled"),this.inputBox.enable(),this.preserveCase.enable()}disable(){this.domNode.classList.add("disabled"),this.inputBox.disable(),this.preserveCase.disable()}setEnabled(e){e?this.enable():this.disable()}style(e){this.inputActiveOptionBorder=e.inputActiveOptionBorder,this.inputActiveOptionForeground=e.inputActiveOptionForeground,this.inputActiveOptionBackground=e.inputActiveOptionBackground,this.inputBackground=e.inputBackground,this.inputForeground=e.inputForeground,this.inputBorder=e.inputBorder,this.inputValidationInfoBackground=e.inputValidationInfoBackground,this.inputValidationInfoForeground=e.inputValidationInfoForeground,this.inputValidationInfoBorder=e.inputValidationInfoBorder,this.inputValidationWarningBackground=e.inputValidationWarningBackground,this.inputValidationWarningForeground=e.inputValidationWarningForeground,this.inputValidationWarningBorder=e.inputValidationWarningBorder,this.inputValidationErrorBackground=e.inputValidationErrorBackground,this.inputValidationErrorForeground=e.inputValidationErrorForeground,this.inputValidationErrorBorder=e.inputValidationErrorBorder,this.applyStyles()}applyStyles(){if(this.domNode){const e={inputActiveOptionBorder:this.inputActiveOptionBorder,inputActiveOptionForeground:this.inputActiveOptionForeground,inputActiveOptionBackground:this.inputActiveOptionBackground};this.preserveCase.style(e);const t={inputBackground:this.inputBackground,inputForeground:this.inputForeground,inputBorder:this.inputBorder,inputValidationInfoBackground:this.inputValidationInfoBackground,inputValidationInfoForeground:this.inputValidationInfoForeground,inputValidationInfoBorder:this.inputValidationInfoBorder,inputValidationWarningBackground:this.inputValidationWarningBackground,inputValidationWarningForeground:this.inputValidationWarningForeground,inputValidationWarningBorder:this.inputValidationWarningBorder,inputValidationErrorBackground:this.inputValidationErrorBackground,inputValidationErrorForeground:this.inputValidationErrorForeground,inputValidationErrorBorder:this.inputValidationErrorBorder};this.inputBox.style(t)}}select(){this.inputBox.select()}focus(){this.inputBox.focus()}getPreserveCase(){return this.preserveCase.checked}setPreserveCase(e){this.preserveCase.checked=e}focusOnPreserve(){this.preserveCase.focus()}validate(){this.inputBox&&this.inputBox.validate()}set width(e){this.inputBox.paddingRight=this.cachedOptionsWidth,this.inputBox.width=e,this.domNode.style.width=e+"px"}dispose(){super.dispose()}}var B2=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},V2=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};const W2=new Uy("suggestWidgetVisible",!1,mf(0,"Whether suggestion are visible")),z2="historyNavigationWidget",H2="historyNavigationForwardsEnabled",j2="historyNavigationBackwardsEnabled";function U2(e,t){return e.getContext(document.activeElement).getValue(t)}function $2(e,t){const i=function(e,t){return e.createScoped(t.target)}(e,t);!function(e,t,i){new Uy(i,t).bindTo(e)}(i,t,z2);return{scopedContextKeyService:i,historyNavigationForwardsEnablement:new Uy(H2,!0).bindTo(i),historyNavigationBackwardsEnablement:new Uy(j2,!0).bindTo(i)}}let K2=class extends A2{constructor(e,t,i,n,o=!1){super(e,t,o,i),this._register($2(n,{target:this.inputBox.element,historyNavigator:this.inputBox}).scopedContextKeyService)}};K2=B2([V2(3,$y)],K2);let q2=class extends F2{constructor(e,t,i,n,o=!1){super(e,t,o,i),this._register($2(n,{target:this.inputBox.element,historyNavigator:this.inputBox}).scopedContextKeyService)}};q2=B2([V2(3,$y)],q2),fx.registerCommandAndKeybindingRule({id:"history.showPrevious",weight:200,when:Sy.and(Sy.has(z2),Sy.equals(j2,!0),W2.isEqualTo(!1)),primary:16,secondary:[528],handler:e=>{const t=U2(e.get($y),z2);if(t){t.historyNavigator.showPreviousValue()}}}),fx.registerCommandAndKeybindingRule({id:"history.showNext",weight:200,when:Sy.and(Sy.has(z2),Sy.equals(H2,!0),W2.isEqualTo(!1)),primary:18,secondary:[530],handler:e=>{const t=U2(e.get($y),z2);if(t){t.historyNavigator.showNextValue()}}});var G2=globalThis&&globalThis.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{l(n.next(e))}catch(t){s(t)}}function a(e){try{l(n.throw(e))}catch(t){s(t)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}l((n=n.apply(e,t||[])).next())}))};const Z2={Visible:W2,DetailsVisible:new Uy("suggestWidgetDetailsVisible",!1,mf(0,"Whether suggestion details are visible")),MultipleSuggestions:new Uy("suggestWidgetMultipleSuggestions",!1,mf(0,"Whether there are multiple suggestions to pick from")),MakesTextEdit:new Uy("suggestionMakesTextEdit",!0,mf(0,"Whether inserting the current suggestion yields in a change or has everything already been typed")),AcceptSuggestionsOnEnter:new Uy("acceptSuggestionOnEnter",!0,mf(0,"Whether suggestions are inserted when pressing Enter")),HasInsertAndReplaceRange:new Uy("suggestionHasInsertAndReplaceRange",!1,mf(0,"Whether the current suggestion has insert and replace behaviour")),InsertMode:new Uy("suggestionInsertMode",void 0,{type:"string",description:mf(0,"Whether the default behaviour is to insert or replace")}),CanResolve:new Uy("suggestionCanResolve",!1,mf(0,"Whether the current suggestion supports to resolve further details"))},Y2=new cx("suggestWidgetStatusBar");class X2{constructor(e,t,i,n){this.position=e,this.completion=t,this.container=i,this.provider=n,this.isInvalid=!1,this.score=yH.Default,this.distance=0,this.textLabel="string"==typeof t.label?t.label:t.label.label,this.labelLow=this.textLabel.toLowerCase(),this.isInvalid=!this.textLabel,this.sortTextLow=t.sortText&&t.sortText.toLowerCase(),this.filterTextLow=t.filterText&&t.filterText.toLowerCase(),qo.isIRange(t.range)?(this.editStart=new er(t.range.startLineNumber,t.range.startColumn),this.editInsertEnd=new er(t.range.endLineNumber,t.range.endColumn),this.editReplaceEnd=new er(t.range.endLineNumber,t.range.endColumn),this.isInvalid=this.isInvalid||qo.spansMultipleLines(t.range)||t.range.startLineNumber!==e.lineNumber):(this.editStart=new er(t.range.insert.startLineNumber,t.range.insert.startColumn),this.editInsertEnd=new er(t.range.insert.endLineNumber,t.range.insert.endColumn),this.editReplaceEnd=new er(t.range.replace.endLineNumber,t.range.replace.endColumn),this.isInvalid=this.isInvalid||qo.spansMultipleLines(t.range.insert)||qo.spansMultipleLines(t.range.replace)||t.range.insert.startLineNumber!==e.lineNumber||t.range.replace.startLineNumber!==e.lineNumber||t.range.insert.startColumn!==t.range.replace.startColumn),"function"!=typeof n.resolveCompletionItem&&(this._resolveCache=Promise.resolve(),this._isResolved=!0)}get isResolved(){return!!this._isResolved}resolve(e){return G2(this,void 0,void 0,(function*(){if(!this._resolveCache){const t=e.onCancellationRequested((()=>{this._resolveCache=void 0,this._isResolved=!1}));this._resolveCache=Promise.resolve(this.provider.resolveCompletionItem(this.completion,e)).then((e=>{Object.assign(this.completion,e),this._isResolved=!0,t.dispose()}),(e=>{Ea(e)&&(this._resolveCache=void 0,this._isResolved=!1)}))}return this._resolveCache}))}}class Q2{constructor(e=2,t=new Set,i=new Set,n=!0){this.snippetSortOrder=e,this.kindFilter=t,this.providerFilter=i,this.showDeprecated=n}}Q2.default=new Q2;class J2{constructor(e,t,i,n){this.items=e,this.needsClipboard=t,this.durations=i,this.disposable=n}}function e6(e,t,i,n=Q2.default,o={triggerKind:0},s=Ia.None){return G2(this,void 0,void 0,(function*(){const r=new ps(!0);i=i.clone();const a=t.getWordAtPosition(i),l=a?new qo(i.lineNumber,a.startColumn,i.lineNumber,a.endColumn):qo.fromPositions(i),d={replace:l,insert:l.setEndPosition(i.lineNumber,i.column)},c=[],h=new ws,u=[];let g=!1;const p=(e,t,o)=>{var s,r,a;let l=!1;if(!t)return l;for(let h of t.suggestions)if(!n.kindFilter.has(h.kind)){if(!n.showDeprecated&&(null===(s=null==h?void 0:h.tags)||void 0===s?void 0:s.includes(1)))continue;h.range||(h.range=d),h.sortText||(h.sortText="string"==typeof h.label?h.label:h.label.label),!g&&h.insertTextRules&&4&h.insertTextRules&&(g=x2.guessNeedsClipboard(h.insertText)),c.push(new X2(i,h,t,e)),l=!0}return ga(t)&&h.add(t),u.push({providerName:null!==(r=e._debugDisplayName)&&void 0!==r?r:"unknown_provider",elapsedProvider:null!==(a=t.duration)&&void 0!==a?a:-1,elapsedOverall:o.elapsed()}),l},m=(()=>G2(this,void 0,void 0,(function*(){})))();for(let f of e.orderedGroups(t)){let e=!1;if(yield Promise.all(f.map((r=>G2(this,void 0,void 0,(function*(){if(!(n.providerFilter.size>0)||n.providerFilter.has(r))try{const n=new ps(!0),a=yield r.provideCompletionItems(t,i,o,s);e=p(r,a,n)||e}catch(a){Ta(a)}}))))),e||s.isCancellationRequested)break}return yield m,s.isCancellationRequested?(h.dispose(),Promise.reject(_s())):new J2(c.sort(n6(n.snippetSortOrder)),g,{entries:u,elapsed:r.elapsed()},h)}))}function t6(e,t){if(e.sortTextLow&&t.sortTextLow){if(e.sortTextLow<t.sortTextLow)return-1;if(e.sortTextLow>t.sortTextLow)return 1}return e.completion.label<t.completion.label?-1:e.completion.label>t.completion.label?1:e.completion.kind-t.completion.kind}const i6=new Map;function n6(e){return i6.get(e)}let o6;i6.set(0,(function(e,t){if(e.completion.kind!==t.completion.kind){if(27===e.completion.kind)return-1;if(27===t.completion.kind)return 1}return t6(e,t)})),i6.set(2,(function(e,t){if(e.completion.kind!==t.completion.kind){if(27===e.completion.kind)return 1;if(27===t.completion.kind)return-1}return t6(e,t)})),i6.set(1,t6),Cy.registerCommand("_executeCompletionItemProvider",((e,...t)=>G2(void 0,void 0,void 0,(function*(){const[i,n,o,s]=t;Js(Ps.isUri(i)),Js(er.isIPosition(n)),Js("string"==typeof o||!o),Js("number"==typeof s||!s);const{completionProvider:r}=e.get(Lb),a=yield e.get(gy).createModelReference(i);try{const e={incomplete:!1,suggestions:[]},t=[],i=yield e6(r,a.object.textEditorModel,er.lift(n),void 0,{triggerCharacter:o,triggerKind:o?1:0});for(const n of i.items)t.length<(null!=s?s:0)&&t.push(n.resolve(Ia.None)),e.incomplete=e.incomplete||n.container.incomplete,e.suggestions.push(n.completion);try{return yield Promise.all(t),e}finally{setTimeout((()=>i.disposable.dispose()),100)}}finally{a.dispose()}}))));let s6=[];function r6(e,t,i){const{completionProvider:n}=e.get(Lb);o6||(o6=new class{provideCompletionItems(){let e={suggestions:s6.slice(0)};return s6.length=0,e}},n.register("*",o6)),setTimeout((()=>{var e;s6.push(...i),null===(e=t.getContribution("editor.contrib.suggestController"))||void 0===e||e.triggerSuggest((new Set).add(o6))}),0)}var a6=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},l6=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};const d6=YC;let c6=class e extends Uo{constructor(e,t,i){super(),this._editor=e,this._instantiationService=t,this._keybindingService=i,this._widget=this._register(this._instantiationService.createInstance(g6,this._editor)),this._decorationsChangerListener=this._register(new h6(this._editor)),this._messages=[],this._messagesAreComplete=!1,this._participants=[];for(const n of h2.getAll())this._participants.push(this._instantiationService.createInstance(n,this._editor));this._participants.sort(((e,t)=>e.hoverOrdinal-t.hoverOrdinal)),this._computer=new m6(this._editor,this._participants),this._hoverOperation=this._register(new l2(this._editor,this._computer)),this._register(this._hoverOperation.onResult((e=>{this._withResult(e.value,e.isComplete,e.hasLoadingMessage)}))),this._register(this._decorationsChangerListener.onDidChangeModelDecorations((()=>this._onModelDecorationsChanged()))),this._register(sC(this._widget.getDomNode(),"keydown",(e=>{e.equals(9)&&this.hide()}))),this._register(Ns.onDidChange((()=>{this._widget.position&&this._computer.anchor&&this._messages.length>0&&(this._widget.clear(),this._renderMessages(this._computer.anchor,this._messages))})))}_onModelDecorationsChanged(){this._widget.position&&(this._hoverOperation.cancel(),this._widget.isColorPickerVisible||this._hoverOperation.start(0))}maybeShowAt(e){const t=[];for(const n of this._participants)if(n.suggestHoverAnchor){const i=n.suggestHoverAnchor(e);i&&t.push(i)}const i=e.target;if(6===i.type&&t.push(new d2(0,i.range)),7===i.type){const e=this._editor.getOption(44).typicalHalfwidthCharacterWidth/2;!i.detail.isAfterLines&&"number"==typeof i.detail.horizontalDistanceToText&&i.detail.horizontalDistanceToText<e&&t.push(new d2(0,i.range))}return 0!==t.length&&(t.sort(((e,t)=>t.priority-e.priority)),this._startShowingAt(t[0],0,!1),!0)}startShowingAtRange(e,t,i){this._startShowingAt(new d2(0,e),t,i)}_startShowingAt(e,t,i){if(!this._computer.anchor||!this._computer.anchor.equals(e)){if(this._hoverOperation.cancel(),this._widget.position)if(this._computer.anchor&&e.canAdoptVisibleHover(this._computer.anchor,this._widget.position)){const t=this._messages.filter((t=>t.isValidForHoverAnchor(e)));if(0===t.length)this.hide();else{if(t.length===this._messages.length&&this._messagesAreComplete)return;this._renderMessages(e,t)}}else this.hide();this._computer.anchor=e,this._computer.shouldFocus=i,this._hoverOperation.start(t)}}hide(){this._computer.anchor=null,this._hoverOperation.cancel(),this._widget.hide()}isColorPickerVisible(){return this._widget.isColorPickerVisible}_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,t,i){this._messages=i?this._addLoadingMessage(e):e,this._messagesAreComplete=t,this._computer.anchor&&this._messages.length>0?this._renderMessages(this._computer.anchor,this._messages):t&&this.hide()}_renderMessages(t,i){let n=1073741824,o=i[0].range,s=null;for(const e of i)n=Math.min(n,e.range.startColumn),o=qo.plusRange(o,e.range),e.forceShowAtRange&&(s=e.range);const r=new ws,a=r.add(new p6(this._keybindingService)),l=document.createDocumentFragment();let d=null;const c={fragment:l,statusBar:a,setColorPicker:e=>d=e,onContentsChanged:()=>this._widget.onContentsChanged(),hide:()=>this.hide()};for(const e of this._participants){const t=i.filter((t=>t.owner===e));t.length>0&&r.add(e.renderHoverParts(c,t))}if(a.hasContent&&l.appendChild(a.hoverElement),l.hasChildNodes()){if(o){const t=this._decorationsChangerListener.deltaDecorations([],[{range:o,options:e._DECORATION_OPTIONS}]);r.add(es((()=>{this._decorationsChangerListener.deltaDecorations(t,[])})))}this._widget.showAt(l,new u6(d,s?s.getStartPosition():new er(t.range.startLineNumber,n),s||o,this._editor.getOption(53).above,this._computer.shouldFocus,r))}else r.dispose()}};c6._DECORATION_OPTIONS=GP.register({description:"content-hover-highlight",className:"hoverHighlight"}),c6=a6([l6(1,k_),l6(2,kW)],c6);class h6 extends Uo{constructor(e){super(),this._editor=e,this._onDidChangeModelDecorations=this._register(new $o),this.onDidChangeModelDecorations=this._onDidChangeModelDecorations.event,this._isChangingDecorations=!1,this._register(this._editor.onDidChangeModelDecorations((e=>{this._isChangingDecorations||this._onDidChangeModelDecorations.fire(e)})))}deltaDecorations(e,t){try{return this._isChangingDecorations=!0,this._editor.deltaDecorations(e,t)}finally{this._isChangingDecorations=!1}}}class u6{constructor(e,t,i,n,o,s){this.colorPicker=e,this.showAtPosition=t,this.showAtRange=i,this.preferAbove=n,this.stoleFocus=o,this.disposables=s}}let g6=class e extends Uo{constructor(e,t){super(),this._editor=e,this._contextKeyService=t,this.allowEditorOverflow=!0,this._hoverVisibleKey=yI.hoverVisible.bindTo(this._contextKeyService),this._hover=this._register(new n2),this._visibleData=null,this._register(this._editor.onDidLayoutChange((()=>this._layout()))),this._register(this._editor.onDidChangeConfiguration((e=>{e.hasChanged(44)&&this._updateFont()}))),this._setVisibleData(null),this._layout(),this._editor.addContentWidget(this)}get position(){var e,t;return null!==(t=null===(e=this._visibleData)||void 0===e?void 0:e.showAtPosition)&&void 0!==t?t:null}get isColorPickerVisible(){var e;return Boolean(null===(e=this._visibleData)||void 0===e?void 0:e.colorPicker)}dispose(){this._editor.removeContentWidget(this),this._visibleData&&this._visibleData.disposables.dispose(),super.dispose()}getId(){return e.ID}getDomNode(){return this._hover.containerDomNode}getPosition(){if(!this._visibleData)return null;let e=this._visibleData.preferAbove;return!e&&this._contextKeyService.getContextKeyValue(Z2.Visible.key)&&(e=!0),{position:this._visibleData.showAtPosition,range:this._visibleData.showAtRange,preference:e?[1,2]:[2,1]}}_setVisibleData(e){this._visibleData&&this._visibleData.disposables.dispose(),this._visibleData=e,this._hoverVisibleKey.set(!!this._visibleData),this._hover.containerDomNode.classList.toggle("hidden",!this._visibleData)}_layout(){const e=Math.max(this._editor.getLayoutInfo().height/4,250),{fontSize:t,lineHeight:i}=this._editor.getOption(44);this._hover.contentsDomNode.style.fontSize=`${t}px`,this._hover.contentsDomNode.style.lineHeight=""+i/t,this._hover.contentsDomNode.style.maxHeight=`${e}px`,this._hover.contentsDomNode.style.maxWidth=`${Math.max(.66*this._editor.getLayoutInfo().width,500)}px`}_updateFont(){Array.prototype.slice.call(this._hover.contentsDomNode.getElementsByClassName("code")).forEach((e=>this._editor.applyFontInfo(e)))}showAt(e,t){this._setVisibleData(t),this._hover.contentsDomNode.textContent="",this._hover.contentsDomNode.appendChild(e),this._hover.contentsDomNode.style.paddingBottom="",this._updateFont(),this._editor.layoutContentWidget(this),this.onContentsChanged(),this._editor.render(),this._editor.layoutContentWidget(this),this.onContentsChanged(),t.stoleFocus&&this._hover.containerDomNode.focus(),t.colorPicker&&t.colorPicker.layout()}hide(){if(this._visibleData){const e=this._visibleData.stoleFocus;this._setVisibleData(null),this._editor.layoutContentWidget(this),e&&this._editor.focus()}}onContentsChanged(){this._hover.onContentsChanged();const e=this._hover.scrollbar.getScrollDimensions();if(e.scrollWidth>e.width){const e=`${this._hover.scrollbar.options.horizontalScrollbarSize}px`;this._hover.contentsDomNode.style.paddingBottom!==e&&(this._hover.contentsDomNode.style.paddingBottom=e,this._editor.layoutContentWidget(this),this._hover.onContentsChanged())}}clear(){this._hover.contentsDomNode.textContent=""}};g6.ID="editor.contrib.contentHoverWidget",g6=a6([l6(1,$y)],g6);let p6=class extends Uo{constructor(e){super(),this._keybindingService=e,this._hasContent=!1,this.hoverElement=d6("div.hover-row.status-bar"),this.actionsElement=$C(this.hoverElement,d6("div.actions"))}get hasContent(){return this._hasContent}addAction(e){const t=this._keybindingService.lookupKeybinding(e.commandId),i=t?t.getLabel():null;return this._hasContent=!0,this._register(o2.render(this.actionsElement,e,i))}append(e){const t=$C(this.actionsElement,e);return this._hasContent=!0,t}};p6=a6([l6(0,kW)],p6);class m6{constructor(e,t){this._editor=e,this._participants=t,this._anchor=null,this._shouldFocus=!1}get anchor(){return this._anchor}set anchor(e){this._anchor=e}get shouldFocus(){return this._shouldFocus}set shouldFocus(e){this._shouldFocus=e}static _getLineDecorations(e,t){if(1!==t.type)return[];const i=e.getModel(),n=t.range.startLineNumber,o=i.getLineMaxColumn(n);return e.getLineDecorations(n).filter((e=>{if(e.options.isWholeLine)return!0;const i=e.range.startLineNumber===n?e.range.startColumn:1,s=e.range.endLineNumber===n?e.range.endColumn:o;if(e.options.showIfCollapsed){if(i>t.range.startColumn+1||t.range.endColumn-1>s)return!1}else if(i>t.range.startColumn||t.range.endColumn>s)return!1;return!0}))}computeAsync(e){const t=this._anchor;if(!this._editor.hasModel()||!t)return pb.EMPTY;const i=m6._getLineDecorations(this._editor,t);return pb.merge(this._participants.map((n=>n.computeAsync?n.computeAsync(t,i,e):pb.EMPTY)))}computeSync(){if(!this._editor.hasModel()||!this._anchor)return[];const e=m6._getLineDecorations(this._editor,this._anchor);let t=[];for(const i of this._participants)t=t.concat(i.computeSync(this._anchor,e));return Sa(t)}}/*! @license DOMPurify 2.3.1 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/2.3.1/LICENSE */var f6=Object.hasOwnProperty,_6=Object.setPrototypeOf,v6=Object.isFrozen,b6=Object.getPrototypeOf,w6=Object.getOwnPropertyDescriptor,C6=Object.freeze,y6=Object.seal,x6=Object.create,S6="undefined"!=typeof Reflect&&Reflect,k6=S6.apply,D6=S6.construct;k6||(k6=function(e,t,i){return e.apply(t,i)}),C6||(C6=function(e){return e}),y6||(y6=function(e){return e}),D6||(D6=function(e,t){return new(Function.prototype.bind.apply(e,[null].concat(function(e){if(Array.isArray(e)){for(var t=0,i=Array(e.length);t<e.length;t++)i[t]=e[t];return i}return Array.from(e)}(t))))});var L6,N6=B6(Array.prototype.forEach),E6=B6(Array.prototype.pop),I6=B6(Array.prototype.push),T6=B6(String.prototype.toLowerCase),M6=B6(String.prototype.match),A6=B6(String.prototype.replace),O6=B6(String.prototype.indexOf),R6=B6(String.prototype.trim),P6=B6(RegExp.prototype.test),F6=(L6=TypeError,function(){for(var e=arguments.length,t=Array(e),i=0;i<e;i++)t[i]=arguments[i];return D6(L6,t)});function B6(e){return function(t){for(var i=arguments.length,n=Array(i>1?i-1:0),o=1;o<i;o++)n[o-1]=arguments[o];return k6(e,t,n)}}function V6(e,t){_6&&_6(e,null);for(var i=t.length;i--;){var n=t[i];if("string"==typeof n){var o=T6(n);o!==n&&(v6(t)||(t[i]=o),n=o)}e[n]=!0}return e}function W6(e){var t=x6(null),i=void 0;for(i in e)k6(f6,e,[i])&&(t[i]=e[i]);return t}function z6(e,t){for(;null!==e;){var i=w6(e,t);if(i){if(i.get)return B6(i.get);if("function"==typeof i.value)return B6(i.value)}e=b6(e)}return function(e){return null}}var H6=C6(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),j6=C6(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),U6=C6(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),$6=C6(["animate","color-profile","cursor","discard","fedropshadow","feimage","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),K6=C6(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover"]),q6=C6(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),G6=C6(["#text"]),Z6=C6(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","xmlns","slot"]),Y6=C6(["accent-height","accumulate","additive","alignment-baseline","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","targetx","targety","transform","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),X6=C6(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Q6=C6(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),J6=y6(/\{\{[\s\S]*|[\s\S]*\}\}/gm),e5=y6(/<%[\s\S]*|[\s\S]*%>/gm),t5=y6(/^data-[\-\w.\u00B7-\uFFFF]/),i5=y6(/^aria-[\-\w]+$/),n5=y6(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),o5=y6(/^(?:\w+script|data):/i),s5=y6(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),r5="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function a5(e){if(Array.isArray(e)){for(var t=0,i=Array(e.length);t<e.length;t++)i[t]=e[t];return i}return Array.from(e)}var l5=function(){return"undefined"==typeof window?null:window},d5=function(e,t){if("object"!==(void 0===e?"undefined":r5(e))||"function"!=typeof e.createPolicy)return null;var i=null,n="data-tt-policy-suffix";t.currentScript&&t.currentScript.hasAttribute(n)&&(i=t.currentScript.getAttribute(n));var o="dompurify"+(i?"#"+i:"");try{return e.createPolicy(o,{createHTML:function(e){return e}})}catch(Id){return null}};var c5=function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:l5(),i=function(t){return e(t)};if(i.version="2.3.1",i.removed=[],!t||!t.document||9!==t.document.nodeType)return i.isSupported=!1,i;var n=t.document,o=t.document,s=t.DocumentFragment,r=t.HTMLTemplateElement,a=t.Node,l=t.Element,d=t.NodeFilter,c=t.NamedNodeMap,h=void 0===c?t.NamedNodeMap||t.MozNamedAttrMap:c,u=t.Text,g=t.Comment,p=t.DOMParser,m=t.trustedTypes,f=l.prototype,_=z6(f,"cloneNode"),v=z6(f,"nextSibling"),b=z6(f,"childNodes"),w=z6(f,"parentNode");if("function"==typeof r){var C=o.createElement("template");C.content&&C.content.ownerDocument&&(o=C.content.ownerDocument)}var y=d5(m,n),x=y&&te?y.createHTML(""):"",S=o,k=S.implementation,D=S.createNodeIterator,L=S.createDocumentFragment,N=S.getElementsByTagName,E=n.importNode,I={};try{I=W6(o).documentMode?o.documentMode:{}}catch(Id){}var T={};i.isSupported="function"==typeof w&&k&&void 0!==k.createHTMLDocument&&9!==I;var M=J6,A=e5,O=t5,R=i5,P=o5,F=s5,B=n5,V=null,W=V6({},[].concat(a5(H6),a5(j6),a5(U6),a5(K6),a5(G6))),z=null,H=V6({},[].concat(a5(Z6),a5(Y6),a5(X6),a5(Q6))),j=null,U=null,$=!0,K=!0,q=!1,G=!1,Z=!1,Y=!1,X=!1,Q=!1,J=!1,ee=!0,te=!1,ie=!0,ne=!0,oe=!1,se={},re=null,ae=V6({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),le=null,de=V6({},["audio","video","img","source","image","track"]),ce=null,he=V6({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ue="http://www.w3.org/1998/Math/MathML",ge="http://www.w3.org/2000/svg",pe="http://www.w3.org/1999/xhtml",me=pe,fe=!1,_e=null,ve=o.createElement("form"),be=function(e){_e&&_e===e||(e&&"object"===(void 0===e?"undefined":r5(e))||(e={}),e=W6(e),V="ALLOWED_TAGS"in e?V6({},e.ALLOWED_TAGS):W,z="ALLOWED_ATTR"in e?V6({},e.ALLOWED_ATTR):H,ce="ADD_URI_SAFE_ATTR"in e?V6(W6(he),e.ADD_URI_SAFE_ATTR):he,le="ADD_DATA_URI_TAGS"in e?V6(W6(de),e.ADD_DATA_URI_TAGS):de,re="FORBID_CONTENTS"in e?V6({},e.FORBID_CONTENTS):ae,j="FORBID_TAGS"in e?V6({},e.FORBID_TAGS):{},U="FORBID_ATTR"in e?V6({},e.FORBID_ATTR):{},se="USE_PROFILES"in e&&e.USE_PROFILES,$=!1!==e.ALLOW_ARIA_ATTR,K=!1!==e.ALLOW_DATA_ATTR,q=e.ALLOW_UNKNOWN_PROTOCOLS||!1,G=e.SAFE_FOR_TEMPLATES||!1,Z=e.WHOLE_DOCUMENT||!1,Q=e.RETURN_DOM||!1,J=e.RETURN_DOM_FRAGMENT||!1,ee=!1!==e.RETURN_DOM_IMPORT,te=e.RETURN_TRUSTED_TYPE||!1,X=e.FORCE_BODY||!1,ie=!1!==e.SANITIZE_DOM,ne=!1!==e.KEEP_CONTENT,oe=e.IN_PLACE||!1,B=e.ALLOWED_URI_REGEXP||B,me=e.NAMESPACE||pe,G&&(K=!1),J&&(Q=!0),se&&(V=V6({},[].concat(a5(G6))),z=[],!0===se.html&&(V6(V,H6),V6(z,Z6)),!0===se.svg&&(V6(V,j6),V6(z,Y6),V6(z,Q6)),!0===se.svgFilters&&(V6(V,U6),V6(z,Y6),V6(z,Q6)),!0===se.mathMl&&(V6(V,K6),V6(z,X6),V6(z,Q6))),e.ADD_TAGS&&(V===W&&(V=W6(V)),V6(V,e.ADD_TAGS)),e.ADD_ATTR&&(z===H&&(z=W6(z)),V6(z,e.ADD_ATTR)),e.ADD_URI_SAFE_ATTR&&V6(ce,e.ADD_URI_SAFE_ATTR),e.FORBID_CONTENTS&&(re===ae&&(re=W6(re)),V6(re,e.FORBID_CONTENTS)),ne&&(V["#text"]=!0),Z&&V6(V,["html","head","body"]),V.table&&(V6(V,["tbody"]),delete j.tbody),C6&&C6(e),_e=e)},we=V6({},["mi","mo","mn","ms","mtext"]),Ce=V6({},["foreignobject","desc","title","annotation-xml"]),ye=V6({},j6);V6(ye,U6),V6(ye,$6);var xe=V6({},K6);V6(xe,q6);var Se=function(e){var t=w(e);t&&t.tagName||(t={namespaceURI:pe,tagName:"template"});var i=T6(e.tagName),n=T6(t.tagName);if(e.namespaceURI===ge)return t.namespaceURI===pe?"svg"===i:t.namespaceURI===ue?"svg"===i&&("annotation-xml"===n||we[n]):Boolean(ye[i]);if(e.namespaceURI===ue)return t.namespaceURI===pe?"math"===i:t.namespaceURI===ge?"math"===i&&Ce[n]:Boolean(xe[i]);if(e.namespaceURI===pe){if(t.namespaceURI===ge&&!Ce[n])return!1;if(t.namespaceURI===ue&&!we[n])return!1;var o=V6({},["title","style","font","a","script"]);return!xe[i]&&(o[i]||!ye[i])}return!1},ke=function(e){I6(i.removed,{element:e});try{e.parentNode.removeChild(e)}catch(Id){try{e.outerHTML=x}catch(Id){e.remove()}}},De=function(e,t){try{I6(i.removed,{attribute:t.getAttributeNode(e),from:t})}catch(Id){I6(i.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e&&!z[e])if(Q||J)try{ke(t)}catch(Id){}else try{t.setAttribute(e,"")}catch(Id){}},Le=function(e){var t=void 0,i=void 0;if(X)e="<remove></remove>"+e;else{var n=M6(e,/^[\r\n\t ]+/);i=n&&n[0]}var s=y?y.createHTML(e):e;if(me===pe)try{t=(new p).parseFromString(s,"text/html")}catch(Id){}if(!t||!t.documentElement){t=k.createDocument(me,"template",null);try{t.documentElement.innerHTML=fe?"":s}catch(Id){}}var r=t.body||t.documentElement;return e&&i&&r.insertBefore(o.createTextNode(i),r.childNodes[0]||null),me===pe?N.call(t,Z?"html":"body")[0]:Z?t.documentElement:r},Ne=function(e){return D.call(e.ownerDocument||e,e,d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT,null,!1)},Ee=function(e){return!(e instanceof u||e instanceof g)&&!("string"==typeof e.nodeName&&"string"==typeof e.textContent&&"function"==typeof e.removeChild&&e.attributes instanceof h&&"function"==typeof e.removeAttribute&&"function"==typeof e.setAttribute&&"string"==typeof e.namespaceURI&&"function"==typeof e.insertBefore)},Ie=function(e){return"object"===(void 0===a?"undefined":r5(a))?e instanceof a:e&&"object"===(void 0===e?"undefined":r5(e))&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName},Te=function(e,t,n){T[e]&&N6(T[e],(function(e){e.call(i,t,n,_e)}))},Me=function(e){var t=void 0;if(Te("beforeSanitizeElements",e,null),Ee(e))return ke(e),!0;if(M6(e.nodeName,/[\u0080-\uFFFF]/))return ke(e),!0;var n=T6(e.nodeName);if(Te("uponSanitizeElement",e,{tagName:n,allowedTags:V}),!Ie(e.firstElementChild)&&(!Ie(e.content)||!Ie(e.content.firstElementChild))&&P6(/<[/\w]/g,e.innerHTML)&&P6(/<[/\w]/g,e.textContent))return ke(e),!0;if("select"===n&&P6(/<template/i,e.innerHTML))return ke(e),!0;if(!V[n]||j[n]){if(ne&&!re[n]){var o=w(e)||e.parentNode,s=b(e)||e.childNodes;if(s&&o)for(var r=s.length-1;r>=0;--r)o.insertBefore(_(s[r],!0),v(e))}return ke(e),!0}return e instanceof l&&!Se(e)?(ke(e),!0):"noscript"!==n&&"noembed"!==n||!P6(/<\/no(script|embed)/i,e.innerHTML)?(G&&3===e.nodeType&&(t=e.textContent,t=A6(t,M," "),t=A6(t,A," "),e.textContent!==t&&(I6(i.removed,{element:e.cloneNode()}),e.textContent=t)),Te("afterSanitizeElements",e,null),!1):(ke(e),!0)},Ae=function(e,t,i){if(ie&&("id"===t||"name"===t)&&(i in o||i in ve))return!1;if(K&&!U[t]&&P6(O,t));else if($&&P6(R,t));else{if(!z[t]||U[t])return!1;if(ce[t]);else if(P6(B,A6(i,F,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==O6(i,"data:")||!le[e]){if(q&&!P6(P,A6(i,F,"")));else if(i)return!1}else;}return!0},Oe=function(e){var t=void 0,n=void 0,o=void 0,s=void 0;Te("beforeSanitizeAttributes",e,null);var r=e.attributes;if(r){var a={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:z};for(s=r.length;s--;){var l=t=r[s],d=l.name,c=l.namespaceURI;if(n=R6(t.value),o=T6(d),a.attrName=o,a.attrValue=n,a.keepAttr=!0,a.forceKeepAttr=void 0,Te("uponSanitizeAttribute",e,a),n=a.attrValue,!a.forceKeepAttr&&(De(d,e),a.keepAttr))if(P6(/\/>/i,n))De(d,e);else{G&&(n=A6(n,M," "),n=A6(n,A," "));var h=e.nodeName.toLowerCase();if(Ae(h,o,n))try{c?e.setAttributeNS(c,d,n):e.setAttribute(d,n),E6(i.removed)}catch(Id){}}}Te("afterSanitizeAttributes",e,null)}},Re=function e(t){var i=void 0,n=Ne(t);for(Te("beforeSanitizeShadowDOM",t,null);i=n.nextNode();)Te("uponSanitizeShadowNode",i,null),Me(i)||(i.content instanceof s&&e(i.content),Oe(i));Te("afterSanitizeShadowDOM",t,null)};return i.sanitize=function(e,o){var r=void 0,l=void 0,d=void 0,c=void 0,h=void 0;if((fe=!e)&&(e="\x3c!--\x3e"),"string"!=typeof e&&!Ie(e)){if("function"!=typeof e.toString)throw F6("toString is not a function");if("string"!=typeof(e=e.toString()))throw F6("dirty is not a string, aborting")}if(!i.isSupported){if("object"===r5(t.toStaticHTML)||"function"==typeof t.toStaticHTML){if("string"==typeof e)return t.toStaticHTML(e);if(Ie(e))return t.toStaticHTML(e.outerHTML)}return e}if(Y||be(o),i.removed=[],"string"==typeof e&&(oe=!1),oe);else if(e instanceof a)1===(l=(r=Le("\x3c!----\x3e")).ownerDocument.importNode(e,!0)).nodeType&&"BODY"===l.nodeName||"HTML"===l.nodeName?r=l:r.appendChild(l);else{if(!Q&&!G&&!Z&&-1===e.indexOf("<"))return y&&te?y.createHTML(e):e;if(!(r=Le(e)))return Q?null:x}r&&X&&ke(r.firstChild);for(var u=Ne(oe?e:r);d=u.nextNode();)3===d.nodeType&&d===c||Me(d)||(d.content instanceof s&&Re(d.content),Oe(d),c=d);if(c=null,oe)return e;if(Q){if(J)for(h=L.call(r.ownerDocument);r.firstChild;)h.appendChild(r.firstChild);else h=r;return ee&&(h=E.call(n,h,!0)),h}var g=Z?r.outerHTML:r.innerHTML;return G&&(g=A6(g,M," "),g=A6(g,A," ")),y&&te?y.createHTML(g):g},i.setConfig=function(e){be(e),Y=!0},i.clearConfig=function(){_e=null,Y=!1},i.isValidAttribute=function(e,t,i){_e||be({});var n=T6(e),o=T6(t);return Ae(n,o,i)},i.addHook=function(e,t){"function"==typeof t&&(T[e]=T[e]||[],I6(T[e],t))},i.removeHook=function(e){T[e]&&E6(T[e])},i.removeHooks=function(e){T[e]&&(T[e]=[])},i.removeAllHooks=function(){T={}},i}();c5.version,c5.isSupported;const h5=c5.sanitize;c5.setConfig,c5.clearConfig,c5.isValidAttribute;const u5=c5.addHook,g5=c5.removeHook;c5.removeHooks,c5.removeAllHooks;let p5={};!function(){function e(e,t){t(p5)}e.amd=!0,function(n,o){"object"==typeof t&&void 0!==i?o(t):e.amd?e(0,o):o((n="undefined"!=typeof globalThis?globalThis:n||self).marked={})}(this,(function(e){function t(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=new Array(t);i<t;i++)n[i]=e[i];return n}function n(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return i(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?i(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var o=0;return function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function o(){return{baseUrl:null,breaks:!1,extensions:null,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}e.defaults={baseUrl:null,breaks:!1,extensions:null,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1};var s=/[&<>"']/,r=/[&<>"']/g,a=/[<>"']|&(?!#?\w+;)/,l=/[<>"']|&(?!#?\w+;)/g,d={"&":"&","<":"<",">":">",'"':""","'":"'"},c=function(e){return d[e]};function h(e,t){if(t){if(s.test(e))return e.replace(r,c)}else if(a.test(e))return e.replace(l,c);return e}var u=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi;function g(e){return e.replace(u,(function(e,t){return"colon"===(t=t.toLowerCase())?":":"#"===t.charAt(0)?"x"===t.charAt(1)?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):""}))}var p=/(^|[^\[])\^/g;function m(e,t){e=e.source||e,t=t||"";var i={replace:function(t,n){return n=(n=n.source||n).replace(p,"$1"),e=e.replace(t,n),i},getRegex:function(){return new RegExp(e,t)}};return i}var f=/[^\w:]/g,_=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function v(e,t,i){if(e){var n;try{n=decodeURIComponent(g(i)).replace(f,"").toLowerCase()}catch(o){return null}if(0===n.indexOf("javascript:")||0===n.indexOf("vbscript:")||0===n.indexOf("data:"))return null}t&&!_.test(i)&&(i=function(e,t){b[" "+e]||(w.test(e)?b[" "+e]=e+"/":b[" "+e]=D(e,"/",!0));var i=-1===(e=b[" "+e]).indexOf(":");return"//"===t.substring(0,2)?i?t:e.replace(C,"$1")+t:"/"===t.charAt(0)?i?t:e.replace(y,"$1")+t:e+t}(t,i));try{i=encodeURI(i).replace(/%25/g,"%")}catch(o){return null}return i}var b={},w=/^[^:]+:\/*[^/]*$/,C=/^([^:]+:)[\s\S]*$/,y=/^([^:]+:\/*[^/]*)[\s\S]*$/;var x={exec:function(){}};function S(e){for(var t,i,n=1;n<arguments.length;n++)for(i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}function k(e,t){var i=e.replace(/\|/g,(function(e,t,i){for(var n=!1,o=t;--o>=0&&"\\"===i[o];)n=!n;return n?"|":" |"})).split(/ \|/),n=0;if(i[0].trim()||i.shift(),i[i.length-1].trim()||i.pop(),i.length>t)i.splice(t);else for(;i.length<t;)i.push("");for(;n<i.length;n++)i[n]=i[n].trim().replace(/\\\|/g,"|");return i}function D(e,t,i){var n=e.length;if(0===n)return"";for(var o=0;o<n;){var s=e.charAt(n-o-1);if(s!==t||i){if(s===t||!i)break;o++}else o++}return e.substr(0,n-o)}function L(e){e&&e.sanitize&&e.silent}function N(e,t){if(t<1)return"";for(var i="";t>1;)1&t&&(i+=e),t>>=1,e+=e;return i+e}function E(e,t,i,n){var o=t.href,s=t.title?h(t.title):null,r=e[1].replace(/\\([\[\]])/g,"$1");if("!"!==e[0].charAt(0)){n.state.inLink=!0;var a={type:"link",raw:i,href:o,title:s,text:r,tokens:n.inlineTokens(r,[])};return n.state.inLink=!1,a}return{type:"image",raw:i,href:o,title:s,text:h(r)}}var I=function(){function t(t){this.options=t||e.defaults}var i=t.prototype;return i.space=function(e){var t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}},i.code=function(e){var t=this.rules.block.code.exec(e);if(t){var i=t[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?i:D(i,"\n")}}},i.fences=function(e){var t=this.rules.block.fences.exec(e);if(t){var i=t[0],n=function(e,t){var i=e.match(/^(\s+)(?:```)/);if(null===i)return t;var n=i[1];return t.split("\n").map((function(e){var t=e.match(/^\s+/);return null===t?e:t[0].length>=n.length?e.slice(n.length):e})).join("\n")}(i,t[3]||"");return{type:"code",raw:i,lang:t[2]?t[2].trim():t[2],text:n}}},i.heading=function(e){var t=this.rules.block.heading.exec(e);if(t){var i=t[2].trim();if(/#$/.test(i)){var n=D(i,"#");this.options.pedantic?i=n.trim():n&&!/ $/.test(n)||(i=n.trim())}var o={type:"heading",raw:t[0],depth:t[1].length,text:i,tokens:[]};return this.lexer.inline(o.text,o.tokens),o}},i.hr=function(e){var t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:t[0]}},i.blockquote=function(e){var t=this.rules.block.blockquote.exec(e);if(t){var i=t[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:t[0],tokens:this.lexer.blockTokens(i,[]),text:i}}},i.list=function(e){var t=this.rules.block.list.exec(e);if(t){var i,o,s,r,a,l,d,c,h,u,g,p,m=t[1].trim(),f=m.length>1,_={type:"list",raw:"",ordered:f,start:f?+m.slice(0,-1):"",loose:!1,items:[]};m=f?"\\d{1,9}\\"+m.slice(-1):"\\"+m,this.options.pedantic&&(m=f?m:"[*+-]");for(var v=new RegExp("^( {0,3}"+m+")((?: [^\\n]*)?(?:\\n|$))");e&&(p=!1,t=v.exec(e))&&!this.rules.block.hr.test(e);){if(i=t[0],e=e.substring(i.length),c=t[2].split("\n",1)[0],h=e.split("\n",1)[0],this.options.pedantic?(r=2,g=c.trimLeft()):(r=(r=t[2].search(/[^ ]/))>4?1:r,g=c.slice(r),r+=t[1].length),l=!1,!c&&/^ *$/.test(h)&&(i+=h+"\n",e=e.substring(h.length+1),p=!0),!p)for(var b=new RegExp("^ {0,"+Math.min(3,r-1)+"}(?:[*+-]|\\d{1,9}[.)])");e&&(c=u=e.split("\n",1)[0],this.options.pedantic&&(c=c.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),!b.test(c));){if(c.search(/[^ ]/)>=r||!c.trim())g+="\n"+c.slice(r);else{if(l)break;g+="\n"+c}l||c.trim()||(l=!0),i+=u+"\n",e=e.substring(u.length+1)}_.loose||(d?_.loose=!0:/\n *\n *$/.test(i)&&(d=!0)),this.options.gfm&&(o=/^\[[ xX]\] /.exec(g))&&(s="[ ] "!==o[0],g=g.replace(/^\[[ xX]\] +/,"")),_.items.push({type:"list_item",raw:i,task:!!o,checked:s,loose:!1,text:g}),_.raw+=i}_.items[_.items.length-1].raw=i.trimRight(),_.items[_.items.length-1].text=g.trimRight(),_.raw=_.raw.trimRight();var w=_.items.length;for(a=0;a<w;a++){this.lexer.state.top=!1,_.items[a].tokens=this.lexer.blockTokens(_.items[a].text,[]);var C=_.items[a].tokens.filter((function(e){return"space"===e.type})),y=C.every((function(e){for(var t,i=0,o=n(e.raw.split(""));!(t=o()).done;){if("\n"===t.value&&(i+=1),i>1)return!0}return!1}));!_.loose&&C.length&&y&&(_.loose=!0,_.items[a].loose=!0)}return _}},i.html=function(e){var t=this.rules.block.html.exec(e);if(t){var i={type:"html",raw:t[0],pre:!this.options.sanitizer&&("pre"===t[1]||"script"===t[1]||"style"===t[1]),text:t[0]};return this.options.sanitize&&(i.type="paragraph",i.text=this.options.sanitizer?this.options.sanitizer(t[0]):h(t[0]),i.tokens=[],this.lexer.inline(i.text,i.tokens)),i}},i.def=function(e){var t=this.rules.block.def.exec(e);if(t)return t[3]&&(t[3]=t[3].substring(1,t[3].length-1)),{type:"def",tag:t[1].toLowerCase().replace(/\s+/g," "),raw:t[0],href:t[2],title:t[3]}},i.table=function(e){var t=this.rules.block.table.exec(e);if(t){var i={type:"table",header:k(t[1]).map((function(e){return{text:e}})),align:t[2].replace(/^ *|\| *$/g,"").split(/ *\| */),rows:t[3]?t[3].replace(/\n[ \t]*$/,"").split("\n"):[]};if(i.header.length===i.align.length){i.raw=t[0];var n,o,s,r,a=i.align.length;for(n=0;n<a;n++)/^ *-+: *$/.test(i.align[n])?i.align[n]="right":/^ *:-+: *$/.test(i.align[n])?i.align[n]="center":/^ *:-+ *$/.test(i.align[n])?i.align[n]="left":i.align[n]=null;for(a=i.rows.length,n=0;n<a;n++)i.rows[n]=k(i.rows[n],i.header.length).map((function(e){return{text:e}}));for(a=i.header.length,o=0;o<a;o++)i.header[o].tokens=[],this.lexer.inlineTokens(i.header[o].text,i.header[o].tokens);for(a=i.rows.length,o=0;o<a;o++)for(r=i.rows[o],s=0;s<r.length;s++)r[s].tokens=[],this.lexer.inlineTokens(r[s].text,r[s].tokens);return i}}},i.lheading=function(e){var t=this.rules.block.lheading.exec(e);if(t){var i={type:"heading",raw:t[0],depth:"="===t[2].charAt(0)?1:2,text:t[1],tokens:[]};return this.lexer.inline(i.text,i.tokens),i}},i.paragraph=function(e){var t=this.rules.block.paragraph.exec(e);if(t){var i={type:"paragraph",raw:t[0],text:"\n"===t[1].charAt(t[1].length-1)?t[1].slice(0,-1):t[1],tokens:[]};return this.lexer.inline(i.text,i.tokens),i}},i.text=function(e){var t=this.rules.block.text.exec(e);if(t){var i={type:"text",raw:t[0],text:t[0],tokens:[]};return this.lexer.inline(i.text,i.tokens),i}},i.escape=function(e){var t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:h(t[1])}},i.tag=function(e){var t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&/^<a /i.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&/^<\/a>/i.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:this.options.sanitize?"text":"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(t[0]):h(t[0]):t[0]}},i.link=function(e){var t=this.rules.inline.link.exec(e);if(t){var i=t[2].trim();if(!this.options.pedantic&&/^</.test(i)){if(!/>$/.test(i))return;var n=D(i.slice(0,-1),"\\");if((i.length-n.length)%2==0)return}else{var o=function(e,t){if(-1===e.indexOf(t[1]))return-1;for(var i=e.length,n=0,o=0;o<i;o++)if("\\"===e[o])o++;else if(e[o]===t[0])n++;else if(e[o]===t[1]&&--n<0)return o;return-1}(t[2],"()");if(o>-1){var s=(0===t[0].indexOf("!")?5:4)+t[1].length+o;t[2]=t[2].substring(0,o),t[0]=t[0].substring(0,s).trim(),t[3]=""}}var r=t[2],a="";if(this.options.pedantic){var l=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(r);l&&(r=l[1],a=l[3])}else a=t[3]?t[3].slice(1,-1):"";return r=r.trim(),/^</.test(r)&&(r=this.options.pedantic&&!/>$/.test(i)?r.slice(1):r.slice(1,-1)),E(t,{href:r?r.replace(this.rules.inline._escapes,"$1"):r,title:a?a.replace(this.rules.inline._escapes,"$1"):a},t[0],this.lexer)}},i.reflink=function(e,t){var i;if((i=this.rules.inline.reflink.exec(e))||(i=this.rules.inline.nolink.exec(e))){var n=(i[2]||i[1]).replace(/\s+/g," ");if(!(n=t[n.toLowerCase()])||!n.href){var o=i[0].charAt(0);return{type:"text",raw:o,text:o}}return E(i,n,i[0],this.lexer)}},i.emStrong=function(e,t,i){void 0===i&&(i="");var n=this.rules.inline.emStrong.lDelim.exec(e);if(n&&(!n[3]||!i.match(/(?:[0-9A-Za-z\xAA\xB2\xB3\xB5\xB9\xBA\xBC-\xBE\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u0660-\u0669\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07C0-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0966-\u096F\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09E6-\u09F1\u09F4-\u09F9\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A66-\u0A6F\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AE6-\u0AEF\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B66-\u0B6F\u0B71-\u0B77\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0BE6-\u0BF2\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C66-\u0C6F\u0C78-\u0C7E\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CE6-\u0CEF\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D58-\u0D61\u0D66-\u0D78\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DE6-\u0DEF\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F20-\u0F33\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F-\u1049\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u1090-\u1099\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1369-\u137C\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u17E0-\u17E9\u17F0-\u17F9\u1810-\u1819\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A16\u1A20-\u1A54\u1A80-\u1A89\u1A90-\u1A99\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B50-\u1B59\u1B83-\u1BA0\u1BAE-\u1BE5\u1C00-\u1C23\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2070\u2071\u2074-\u2079\u207F-\u2089\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2150-\u2189\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2CFD\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u3192-\u3195\u31A0-\u31BF\u31F0-\u31FF\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA830-\uA835\uA840-\uA873\uA882-\uA8B3\uA8D0-\uA8D9\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA900-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF-\uA9D9\uA9E0-\uA9E4\uA9E6-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA50-\uAA59\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD07-\uDD33\uDD40-\uDD78\uDD8A\uDD8B\uDE80-\uDE9C\uDEA0-\uDED0\uDEE1-\uDEFB\uDF00-\uDF23\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC58-\uDC76\uDC79-\uDC9E\uDCA7-\uDCAF\uDCE0-\uDCF2\uDCF4\uDCF5\uDCFB-\uDD1B\uDD20-\uDD39\uDD80-\uDDB7\uDDBC-\uDDCF\uDDD2-\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE40-\uDE48\uDE60-\uDE7E\uDE80-\uDE9F\uDEC0-\uDEC7\uDEC9-\uDEE4\uDEEB-\uDEEF\uDF00-\uDF35\uDF40-\uDF55\uDF58-\uDF72\uDF78-\uDF91\uDFA9-\uDFAF]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDCFA-\uDD23\uDD30-\uDD39\uDE60-\uDE7E\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF27\uDF30-\uDF45\uDF51-\uDF54\uDF70-\uDF81\uDFB0-\uDFCB\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC52-\uDC6F\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD03-\uDD26\uDD36-\uDD3F\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDD0-\uDDDA\uDDDC\uDDE1-\uDDF4\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDEF0-\uDEF9\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC50-\uDC59\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE50-\uDE59\uDE80-\uDEAA\uDEB8\uDEC0-\uDEC9\uDF00-\uDF1A\uDF30-\uDF3B\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCF2\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDD50-\uDD59\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC50-\uDC6C\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD50-\uDD59\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDDA0-\uDDA9\uDEE0-\uDEF2\uDFB0\uDFC0-\uDFD4]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDE70-\uDEBE\uDEC0-\uDEC9\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF50-\uDF59\uDF5B-\uDF61\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE96\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD50-\uDD52\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD834[\uDEE0-\uDEF3\uDF60-\uDF78]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD837[\uDF00-\uDF1E]|\uD838[\uDD00-\uDD2C\uDD37-\uDD3D\uDD40-\uDD49\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB\uDEF0-\uDEF9]|\uD839[\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDCC7-\uDCCF\uDD00-\uDD43\uDD4B\uDD50-\uDD59]|\uD83B[\uDC71-\uDCAB\uDCAD-\uDCAF\uDCB1-\uDCB4\uDD01-\uDD2D\uDD2F-\uDD3D\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD83C[\uDD00-\uDD0C]|\uD83E[\uDFF0-\uDFF9]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF38\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A])/))){var o=n[1]||n[2]||"";if(!o||o&&(""===i||this.rules.inline.punctuation.exec(i))){var s,r,a=n[0].length-1,l=a,d=0,c="*"===n[0][0]?this.rules.inline.emStrong.rDelimAst:this.rules.inline.emStrong.rDelimUnd;for(c.lastIndex=0,t=t.slice(-1*e.length+a);null!=(n=c.exec(t));)if(s=n[1]||n[2]||n[3]||n[4]||n[5]||n[6])if(r=s.length,n[3]||n[4])l+=r;else if(!((n[5]||n[6])&&a%3)||(a+r)%3){if(!((l-=r)>0)){if(r=Math.min(r,r+l+d),Math.min(a,r)%2){var h=e.slice(1,a+n.index+r);return{type:"em",raw:e.slice(0,a+n.index+r+1),text:h,tokens:this.lexer.inlineTokens(h,[])}}var u=e.slice(2,a+n.index+r-1);return{type:"strong",raw:e.slice(0,a+n.index+r+1),text:u,tokens:this.lexer.inlineTokens(u,[])}}}else d+=r}}},i.codespan=function(e){var t=this.rules.inline.code.exec(e);if(t){var i=t[2].replace(/\n/g," "),n=/[^ ]/.test(i),o=/^ /.test(i)&&/ $/.test(i);return n&&o&&(i=i.substring(1,i.length-1)),i=h(i,!0),{type:"codespan",raw:t[0],text:i}}},i.br=function(e){var t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}},i.del=function(e){var t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2],[])}},i.autolink=function(e,t){var i,n,o=this.rules.inline.autolink.exec(e);if(o)return n="@"===o[2]?"mailto:"+(i=h(this.options.mangle?t(o[1]):o[1])):i=h(o[1]),{type:"link",raw:o[0],text:i,href:n,tokens:[{type:"text",raw:i,text:i}]}},i.url=function(e,t){var i;if(i=this.rules.inline.url.exec(e)){var n,o;if("@"===i[2])o="mailto:"+(n=h(this.options.mangle?t(i[0]):i[0]));else{var s;do{s=i[0],i[0]=this.rules.inline._backpedal.exec(i[0])[0]}while(s!==i[0]);n=h(i[0]),o="www."===i[1]?"http://"+n:n}return{type:"link",raw:i[0],text:n,href:o,tokens:[{type:"text",raw:n,text:n}]}}},i.inlineText=function(e,t){var i,n=this.rules.inline.text.exec(e);if(n)return i=this.lexer.state.inRawBlock?this.options.sanitize?this.options.sanitizer?this.options.sanitizer(n[0]):h(n[0]):n[0]:h(this.options.smartypants?t(n[0]):n[0]),{type:"text",raw:n[0],text:i}},t}(),T={newline:/^(?: *(?:\n|$))+/,code:/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?=\n|$)|$)/,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3}bull)( [^\n]+?)?(?:\n|$)/,html:"^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))",def:/^ {0,3}\[(label)\]: *(?:\n *)?<?([^\s>]+)>?(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/,table:x,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,text:/^[^\n]+/,_label:/(?!\s*\])(?:\\.|[^\[\]\\])+/,_title:/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/};T.def=m(T.def).replace("label",T._label).replace("title",T._title).getRegex(),T.bullet=/(?:[*+-]|\d{1,9}[.)])/,T.listItemStart=m(/^( *)(bull) */).replace("bull",T.bullet).getRegex(),T.list=m(T.list).replace(/bull/g,T.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+T.def.source+")").getRegex(),T._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",T._comment=/<!--(?!-?>)[\s\S]*?(?:-->|$)/,T.html=m(T.html,"i").replace("comment",T._comment).replace("tag",T._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),T.paragraph=m(T._paragraph).replace("hr",T.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",T._tag).getRegex(),T.blockquote=m(T.blockquote).replace("paragraph",T.paragraph).getRegex(),T.normal=S({},T),T.gfm=S({},T.normal,{table:"^ *([^\\n ].*\\|.*)\\n {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"}),T.gfm.table=m(T.gfm.table).replace("hr",T.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",T._tag).getRegex(),T.gfm.paragraph=m(T._paragraph).replace("hr",T.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("table",T.gfm.table).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",T._tag).getRegex(),T.pedantic=S({},T.normal,{html:m("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",T._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:x,paragraph:m(T.normal._paragraph).replace("hr",T.hr).replace("heading"," *#{1,6} *[^\n]").replace("lheading",T.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var M={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:x,tag:"^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(ref)\]/,nolink:/^!?\[(ref)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",emStrong:{lDelim:/^(?:\*+(?:([punct_])|[^\s*]))|^_+(?:([punct*])|([^\s_]))/,rDelimAst:/^[^_*]*?\_\_[^_*]*?\*[^_*]*?(?=\_\_)|[punct_](\*+)(?=[\s]|$)|[^punct*_\s](\*+)(?=[punct_\s]|$)|[punct_\s](\*+)(?=[^punct*_\s])|[\s](\*+)(?=[punct_])|[punct_](\*+)(?=[punct_])|[^punct*_\s](\*+)(?=[^punct*_\s])/,rDelimUnd:/^[^_*]*?\*\*[^_*]*?\_[^_*]*?(?=\*\*)|[punct*](\_+)(?=[\s]|$)|[^punct*_\s](\_+)(?=[punct*\s]|$)|[punct*\s](\_+)(?=[^punct*_\s])|[\s](\_+)(?=[punct*])|[punct*](\_+)(?=[punct*])/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:x,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,punctuation:/^([\spunctuation])/};function A(e){return e.replace(/---/g,"—").replace(/--/g,"–").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1‘").replace(/'/g,"’").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1“").replace(/"/g,"”").replace(/\.{3}/g,"…")}function O(e){var t,i,n="",o=e.length;for(t=0;t<o;t++)i=e.charCodeAt(t),Math.random()>.5&&(i="x"+i.toString(16)),n+="&#"+i+";";return n}M._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",M.punctuation=m(M.punctuation).replace(/punctuation/g,M._punctuation).getRegex(),M.blockSkip=/\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g,M.escapedEmSt=/\\\*|\\_/g,M._comment=m(T._comment).replace("(?:--\x3e|$)","--\x3e").getRegex(),M.emStrong.lDelim=m(M.emStrong.lDelim).replace(/punct/g,M._punctuation).getRegex(),M.emStrong.rDelimAst=m(M.emStrong.rDelimAst,"g").replace(/punct/g,M._punctuation).getRegex(),M.emStrong.rDelimUnd=m(M.emStrong.rDelimUnd,"g").replace(/punct/g,M._punctuation).getRegex(),M._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,M._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,M._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/,M.autolink=m(M.autolink).replace("scheme",M._scheme).replace("email",M._email).getRegex(),M._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,M.tag=m(M.tag).replace("comment",M._comment).replace("attribute",M._attribute).getRegex(),M._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,M._href=/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/,M._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,M.link=m(M.link).replace("label",M._label).replace("href",M._href).replace("title",M._title).getRegex(),M.reflink=m(M.reflink).replace("label",M._label).replace("ref",T._label).getRegex(),M.nolink=m(M.nolink).replace("ref",T._label).getRegex(),M.reflinkSearch=m(M.reflinkSearch,"g").replace("reflink",M.reflink).replace("nolink",M.nolink).getRegex(),M.normal=S({},M),M.pedantic=S({},M.normal,{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:m(/^!?\[(label)\]\((.*?)\)/).replace("label",M._label).getRegex(),reflink:m(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",M._label).getRegex()}),M.gfm=S({},M.normal,{escape:m(M.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/}),M.gfm.url=m(M.gfm.url,"i").replace("email",M.gfm._extended_email).getRegex(),M.breaks=S({},M.gfm,{br:m(M.br).replace("{2,}","*").getRegex(),text:m(M.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var R=function(){function i(t){this.tokens=[],this.tokens.links=Object.create(null),this.options=t||e.defaults,this.options.tokenizer=this.options.tokenizer||new I,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};var i={block:T.normal,inline:M.normal};this.options.pedantic?(i.block=T.pedantic,i.inline=M.pedantic):this.options.gfm&&(i.block=T.gfm,this.options.breaks?i.inline=M.breaks:i.inline=M.gfm),this.tokenizer.rules=i}i.lex=function(e,t){return new i(t).lex(e)},i.lexInline=function(e,t){return new i(t).inlineTokens(e)};var n,o,s,r=i.prototype;return r.lex=function(e){var t;for(e=e.replace(/\r\n|\r/g,"\n").replace(/\t/g," "),this.blockTokens(e,this.tokens);t=this.inlineQueue.shift();)this.inlineTokens(t.src,t.tokens);return this.tokens},r.blockTokens=function(e,t){var i,n,o,s,r=this;for(void 0===t&&(t=[]),this.options.pedantic&&(e=e.replace(/^ +$/gm,""));e;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some((function(n){return!!(i=n.call({lexer:r},e,t))&&(e=e.substring(i.raw.length),t.push(i),!0)}))))if(i=this.tokenizer.space(e))e=e.substring(i.raw.length),1===i.raw.length&&t.length>0?t[t.length-1].raw+="\n":t.push(i);else if(i=this.tokenizer.code(e))e=e.substring(i.raw.length),!(n=t[t.length-1])||"paragraph"!==n.type&&"text"!==n.type?t.push(i):(n.raw+="\n"+i.raw,n.text+="\n"+i.text,this.inlineQueue[this.inlineQueue.length-1].src=n.text);else if(i=this.tokenizer.fences(e))e=e.substring(i.raw.length),t.push(i);else if(i=this.tokenizer.heading(e))e=e.substring(i.raw.length),t.push(i);else if(i=this.tokenizer.hr(e))e=e.substring(i.raw.length),t.push(i);else if(i=this.tokenizer.blockquote(e))e=e.substring(i.raw.length),t.push(i);else if(i=this.tokenizer.list(e))e=e.substring(i.raw.length),t.push(i);else if(i=this.tokenizer.html(e))e=e.substring(i.raw.length),t.push(i);else if(i=this.tokenizer.def(e))e=e.substring(i.raw.length),!(n=t[t.length-1])||"paragraph"!==n.type&&"text"!==n.type?this.tokens.links[i.tag]||(this.tokens.links[i.tag]={href:i.href,title:i.title}):(n.raw+="\n"+i.raw,n.text+="\n"+i.raw,this.inlineQueue[this.inlineQueue.length-1].src=n.text);else if(i=this.tokenizer.table(e))e=e.substring(i.raw.length),t.push(i);else if(i=this.tokenizer.lheading(e))e=e.substring(i.raw.length),t.push(i);else if(o=e,this.options.extensions&&this.options.extensions.startBlock&&function(){var t=1/0,i=e.slice(1),n=void 0;r.options.extensions.startBlock.forEach((function(e){"number"==typeof(n=e.call({lexer:this},i))&&n>=0&&(t=Math.min(t,n))})),t<1/0&&t>=0&&(o=e.substring(0,t+1))}(),this.state.top&&(i=this.tokenizer.paragraph(o)))n=t[t.length-1],s&&"paragraph"===n.type?(n.raw+="\n"+i.raw,n.text+="\n"+i.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=n.text):t.push(i),s=o.length!==e.length,e=e.substring(i.raw.length);else if(i=this.tokenizer.text(e))e=e.substring(i.raw.length),(n=t[t.length-1])&&"text"===n.type?(n.raw+="\n"+i.raw,n.text+="\n"+i.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=n.text):t.push(i);else if(e){var a="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent)break;throw new Error(a)}return this.state.top=!0,t},r.inline=function(e,t){this.inlineQueue.push({src:e,tokens:t})},r.inlineTokens=function(e,t){var i,n,o,s=this;void 0===t&&(t=[]);var r,a,l,d=e;if(this.tokens.links){var c=Object.keys(this.tokens.links);if(c.length>0)for(;null!=(r=this.tokenizer.rules.inline.reflinkSearch.exec(d));)c.includes(r[0].slice(r[0].lastIndexOf("[")+1,-1))&&(d=d.slice(0,r.index)+"["+N("a",r[0].length-2)+"]"+d.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;null!=(r=this.tokenizer.rules.inline.blockSkip.exec(d));)d=d.slice(0,r.index)+"["+N("a",r[0].length-2)+"]"+d.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;null!=(r=this.tokenizer.rules.inline.escapedEmSt.exec(d));)d=d.slice(0,r.index)+"++"+d.slice(this.tokenizer.rules.inline.escapedEmSt.lastIndex);for(;e;)if(a||(l=""),a=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some((function(n){return!!(i=n.call({lexer:s},e,t))&&(e=e.substring(i.raw.length),t.push(i),!0)}))))if(i=this.tokenizer.escape(e))e=e.substring(i.raw.length),t.push(i);else if(i=this.tokenizer.tag(e))e=e.substring(i.raw.length),(n=t[t.length-1])&&"text"===i.type&&"text"===n.type?(n.raw+=i.raw,n.text+=i.text):t.push(i);else if(i=this.tokenizer.link(e))e=e.substring(i.raw.length),t.push(i);else if(i=this.tokenizer.reflink(e,this.tokens.links))e=e.substring(i.raw.length),(n=t[t.length-1])&&"text"===i.type&&"text"===n.type?(n.raw+=i.raw,n.text+=i.text):t.push(i);else if(i=this.tokenizer.emStrong(e,d,l))e=e.substring(i.raw.length),t.push(i);else if(i=this.tokenizer.codespan(e))e=e.substring(i.raw.length),t.push(i);else if(i=this.tokenizer.br(e))e=e.substring(i.raw.length),t.push(i);else if(i=this.tokenizer.del(e))e=e.substring(i.raw.length),t.push(i);else if(i=this.tokenizer.autolink(e,O))e=e.substring(i.raw.length),t.push(i);else if(this.state.inLink||!(i=this.tokenizer.url(e,O))){if(o=e,this.options.extensions&&this.options.extensions.startInline&&function(){var t=1/0,i=e.slice(1),n=void 0;s.options.extensions.startInline.forEach((function(e){"number"==typeof(n=e.call({lexer:this},i))&&n>=0&&(t=Math.min(t,n))})),t<1/0&&t>=0&&(o=e.substring(0,t+1))}(),i=this.tokenizer.inlineText(o,A))e=e.substring(i.raw.length),"_"!==i.raw.slice(-1)&&(l=i.raw.slice(-1)),a=!0,(n=t[t.length-1])&&"text"===n.type?(n.raw+=i.raw,n.text+=i.text):t.push(i);else if(e){var h="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent)break;throw new Error(h)}}else e=e.substring(i.raw.length),t.push(i);return t},n=i,s=[{key:"rules",get:function(){return{block:T,inline:M}}}],(o=null)&&t(n.prototype,o),s&&t(n,s),Object.defineProperty(n,"prototype",{writable:!1}),i}(),P=function(){function t(t){this.options=t||e.defaults}var i=t.prototype;return i.code=function(e,t,i){var n=(t||"").match(/\S*/)[0];if(this.options.highlight){var o=this.options.highlight(e,n);null!=o&&o!==e&&(i=!0,e=o)}return e=e.replace(/\n$/,"")+"\n",n?'<pre><code class="'+this.options.langPrefix+h(n,!0)+'">'+(i?e:h(e,!0))+"</code></pre>\n":"<pre><code>"+(i?e:h(e,!0))+"</code></pre>\n"},i.blockquote=function(e){return"<blockquote>\n"+e+"</blockquote>\n"},i.html=function(e){return e},i.heading=function(e,t,i,n){return this.options.headerIds?"<h"+t+' id="'+this.options.headerPrefix+n.slug(i)+'">'+e+"</h"+t+">\n":"<h"+t+">"+e+"</h"+t+">\n"},i.hr=function(){return this.options.xhtml?"<hr/>\n":"<hr>\n"},i.list=function(e,t,i){var n=t?"ol":"ul";return"<"+n+(t&&1!==i?' start="'+i+'"':"")+">\n"+e+"</"+n+">\n"},i.listitem=function(e){return"<li>"+e+"</li>\n"},i.checkbox=function(e){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},i.paragraph=function(e){return"<p>"+e+"</p>\n"},i.table=function(e,t){return t&&(t="<tbody>"+t+"</tbody>"),"<table>\n<thead>\n"+e+"</thead>\n"+t+"</table>\n"},i.tablerow=function(e){return"<tr>\n"+e+"</tr>\n"},i.tablecell=function(e,t){var i=t.header?"th":"td";return(t.align?"<"+i+' align="'+t.align+'">':"<"+i+">")+e+"</"+i+">\n"},i.strong=function(e){return"<strong>"+e+"</strong>"},i.em=function(e){return"<em>"+e+"</em>"},i.codespan=function(e){return"<code>"+e+"</code>"},i.br=function(){return this.options.xhtml?"<br/>":"<br>"},i.del=function(e){return"<del>"+e+"</del>"},i.link=function(e,t,i){if(null===(e=v(this.options.sanitize,this.options.baseUrl,e)))return i;var n='<a href="'+h(e)+'"';return t&&(n+=' title="'+t+'"'),n+=">"+i+"</a>"},i.image=function(e,t,i){if(null===(e=v(this.options.sanitize,this.options.baseUrl,e)))return i;var n='<img src="'+e+'" alt="'+i+'"';return t&&(n+=' title="'+t+'"'),n+=this.options.xhtml?"/>":">"},i.text=function(e){return e},t}(),F=function(){function e(){}var t=e.prototype;return t.strong=function(e){return e},t.em=function(e){return e},t.codespan=function(e){return e},t.del=function(e){return e},t.html=function(e){return e},t.text=function(e){return e},t.link=function(e,t,i){return""+i},t.image=function(e,t,i){return""+i},t.br=function(){return""},e}(),B=function(){function e(){this.seen={}}var t=e.prototype;return t.serialize=function(e){return e.toLowerCase().trim().replace(/<[!\/a-z].*?>/gi,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-")},t.getNextSafeSlug=function(e,t){var i=e,n=0;if(this.seen.hasOwnProperty(i)){n=this.seen[e];do{i=e+"-"+ ++n}while(this.seen.hasOwnProperty(i))}return t||(this.seen[e]=n,this.seen[i]=0),i},t.slug=function(e,t){void 0===t&&(t={});var i=this.serialize(e);return this.getNextSafeSlug(i,t.dryrun)},e}(),V=function(){function t(t){this.options=t||e.defaults,this.options.renderer=this.options.renderer||new P,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new F,this.slugger=new B}t.parse=function(e,i){return new t(i).parse(e)},t.parseInline=function(e,i){return new t(i).parseInline(e)};var i=t.prototype;return i.parse=function(e,t){void 0===t&&(t=!0);var i,n,o,s,r,a,l,d,c,h,u,p,m,f,_,v,b,w,C,y="",x=e.length;for(i=0;i<x;i++)if(h=e[i],!(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[h.type])||!1===(C=this.options.extensions.renderers[h.type].call({parser:this},h))&&["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(h.type))switch(h.type){case"space":continue;case"hr":y+=this.renderer.hr();continue;case"heading":y+=this.renderer.heading(this.parseInline(h.tokens),h.depth,g(this.parseInline(h.tokens,this.textRenderer)),this.slugger);continue;case"code":y+=this.renderer.code(h.text,h.lang,h.escaped);continue;case"table":for(d="",l="",s=h.header.length,n=0;n<s;n++)l+=this.renderer.tablecell(this.parseInline(h.header[n].tokens),{header:!0,align:h.align[n]});for(d+=this.renderer.tablerow(l),c="",s=h.rows.length,n=0;n<s;n++){for(l="",r=(a=h.rows[n]).length,o=0;o<r;o++)l+=this.renderer.tablecell(this.parseInline(a[o].tokens),{header:!1,align:h.align[o]});c+=this.renderer.tablerow(l)}y+=this.renderer.table(d,c);continue;case"blockquote":c=this.parse(h.tokens),y+=this.renderer.blockquote(c);continue;case"list":for(u=h.ordered,p=h.start,m=h.loose,s=h.items.length,c="",n=0;n<s;n++)v=(_=h.items[n]).checked,b=_.task,f="",_.task&&(w=this.renderer.checkbox(v),m?_.tokens.length>0&&"paragraph"===_.tokens[0].type?(_.tokens[0].text=w+" "+_.tokens[0].text,_.tokens[0].tokens&&_.tokens[0].tokens.length>0&&"text"===_.tokens[0].tokens[0].type&&(_.tokens[0].tokens[0].text=w+" "+_.tokens[0].tokens[0].text)):_.tokens.unshift({type:"text",text:w}):f+=w),f+=this.parse(_.tokens,m),c+=this.renderer.listitem(f,b,v);y+=this.renderer.list(c,u,p);continue;case"html":y+=this.renderer.html(h.text);continue;case"paragraph":y+=this.renderer.paragraph(this.parseInline(h.tokens));continue;case"text":for(c=h.tokens?this.parseInline(h.tokens):h.text;i+1<x&&"text"===e[i+1].type;)c+="\n"+((h=e[++i]).tokens?this.parseInline(h.tokens):h.text);y+=t?this.renderer.paragraph(c):c;continue;default:var S='Token with "'+h.type+'" type was not found.';if(this.options.silent)return;throw new Error(S)}else y+=C||"";return y},i.parseInline=function(e,t){t=t||this.renderer;var i,n,o,s="",r=e.length;for(i=0;i<r;i++)if(n=e[i],!(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[n.type])||!1===(o=this.options.extensions.renderers[n.type].call({parser:this},n))&&["escape","html","link","image","strong","em","codespan","br","del","text"].includes(n.type))switch(n.type){case"escape":case"text":s+=t.text(n.text);break;case"html":s+=t.html(n.text);break;case"link":s+=t.link(n.href,n.title,this.parseInline(n.tokens,t));break;case"image":s+=t.image(n.href,n.title,n.text);break;case"strong":s+=t.strong(this.parseInline(n.tokens,t));break;case"em":s+=t.em(this.parseInline(n.tokens,t));break;case"codespan":s+=t.codespan(n.text);break;case"br":s+=t.br();break;case"del":s+=t.del(this.parseInline(n.tokens,t));break;default:var a='Token with "'+n.type+'" type was not found.';if(this.options.silent)return;throw new Error(a)}else s+=o||"";return s},t}();function W(e,t,i){if(null==e)throw new Error("marked(): input parameter is undefined or null");if("string"!=typeof e)throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected");if("function"==typeof t&&(i=t,t=null),L(t=S({},W.defaults,t||{})),i){var n,o=t.highlight;try{n=R.lex(e,t)}catch(l){return i(l)}var s=function(e){var s;if(!e)try{t.walkTokens&&W.walkTokens(n,t.walkTokens),s=V.parse(n,t)}catch(l){e=l}return t.highlight=o,e?i(e):i(null,s)};if(!o||o.length<3)return s();if(delete t.highlight,!n.length)return s();var r=0;return W.walkTokens(n,(function(e){"code"===e.type&&(r++,setTimeout((function(){o(e.text,e.lang,(function(t,i){if(t)return s(t);null!=i&&i!==e.text&&(e.text=i,e.escaped=!0),0===--r&&s()}))}),0))})),void(0===r&&s())}try{var a=R.lex(e,t);return t.walkTokens&&W.walkTokens(a,t.walkTokens),V.parse(a,t)}catch(l){if(l.message+="\nPlease report this to https://github.com/markedjs/marked.",t.silent)return"<p>An error occurred:</p><pre>"+h(l.message+"",!0)+"</pre>";throw l}}W.options=W.setOptions=function(t){var i;return S(W.defaults,t),i=W.defaults,e.defaults=i,W},W.getDefaults=o,W.defaults=e.defaults,W.use=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];var n,o=S.apply(void 0,[{}].concat(t)),s=W.defaults.extensions||{renderers:{},childTokens:{}};t.forEach((function(e){if(e.extensions&&(n=!0,e.extensions.forEach((function(e){if(!e.name)throw new Error("extension name required");if(e.renderer){var t=s.renderers?s.renderers[e.name]:null;s.renderers[e.name]=t?function(){for(var i=arguments.length,n=new Array(i),o=0;o<i;o++)n[o]=arguments[o];var s=e.renderer.apply(this,n);return!1===s&&(s=t.apply(this,n)),s}:e.renderer}if(e.tokenizer){if(!e.level||"block"!==e.level&&"inline"!==e.level)throw new Error("extension level must be 'block' or 'inline'");s[e.level]?s[e.level].unshift(e.tokenizer):s[e.level]=[e.tokenizer],e.start&&("block"===e.level?s.startBlock?s.startBlock.push(e.start):s.startBlock=[e.start]:"inline"===e.level&&(s.startInline?s.startInline.push(e.start):s.startInline=[e.start]))}e.childTokens&&(s.childTokens[e.name]=e.childTokens)}))),e.renderer&&function(){var t=W.defaults.renderer||new P,i=function(i){var n=t[i];t[i]=function(){for(var o=arguments.length,s=new Array(o),r=0;r<o;r++)s[r]=arguments[r];var a=e.renderer[i].apply(t,s);return!1===a&&(a=n.apply(t,s)),a}};for(var n in e.renderer)i(n);o.renderer=t}(),e.tokenizer&&function(){var t=W.defaults.tokenizer||new I,i=function(i){var n=t[i];t[i]=function(){for(var o=arguments.length,s=new Array(o),r=0;r<o;r++)s[r]=arguments[r];var a=e.tokenizer[i].apply(t,s);return!1===a&&(a=n.apply(t,s)),a}};for(var n in e.tokenizer)i(n);o.tokenizer=t}(),e.walkTokens){var t=W.defaults.walkTokens;o.walkTokens=function(i){e.walkTokens.call(this,i),t&&t.call(this,i)}}n&&(o.extensions=s),W.setOptions(o)}))},W.walkTokens=function(e,t){for(var i,o=function(){var e=i.value;switch(t.call(W,e),e.type){case"table":for(var o,s=n(e.header);!(o=s()).done;){var r=o.value;W.walkTokens(r.tokens,t)}for(var a,l=n(e.rows);!(a=l()).done;)for(var d,c=n(a.value);!(d=c()).done;){var h=d.value;W.walkTokens(h.tokens,t)}break;case"list":W.walkTokens(e.items,t);break;default:W.defaults.extensions&&W.defaults.extensions.childTokens&&W.defaults.extensions.childTokens[e.type]?W.defaults.extensions.childTokens[e.type].forEach((function(i){W.walkTokens(e[i],t)})):e.tokens&&W.walkTokens(e.tokens,t)}},s=n(e);!(i=s()).done;)o()},W.parseInline=function(e,t){if(null==e)throw new Error("marked.parseInline(): input parameter is undefined or null");if("string"!=typeof e)throw new Error("marked.parseInline(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected");L(t=S({},W.defaults,t||{}));try{var i=R.lexInline(e,t);return t.walkTokens&&W.walkTokens(i,t.walkTokens),V.parseInline(i,t)}catch(n){if(n.message+="\nPlease report this to https://github.com/markedjs/marked.",t.silent)return"<p>An error occurred:</p><pre>"+h(n.message+"",!0)+"</pre>";throw n}},W.Parser=V,W.parser=V.parse,W.Renderer=P,W.TextRenderer=F,W.Lexer=R,W.lexer=R.lex,W.Tokenizer=I,W.Slugger=B,W.parse=W;var z=W.options,H=W.setOptions,j=W.use,U=W.walkTokens,$=W.parseInline,K=W,q=V.parse,G=R.lex;e.Lexer=R,e.Parser=V,e.Renderer=P,e.Slugger=B,e.TextRenderer=F,e.Tokenizer=I,e.getDefaults=o,e.lexer=G,e.marked=W,e.options=z,e.parse=K,e.parseInline=$,e.parser=q,e.setOptions=H,e.use=j,e.walkTokens=U,Object.defineProperty(e,"__esModule",{value:!0})}))}();var m5=p5||t;function f5(e,t={},i={}){var n;const o=new ws;let s=!1;const r=o.add(new as),a=CU(t),l=function(t){let i;try{i=QH(decodeURIComponent(t))}catch(n){}return i?(i=Vl(i,(t=>e.uris&&e.uris[t]?Ps.revive(e.uris[t]):void 0)),encodeURIComponent(JSON.stringify(i))):t},d=function(t,i){const n=e.uris&&e.uris[t];let o=Ps.revive(n);return i?t.startsWith(Yw.data+":")?t:(o||(o=Ps.parse(t)),Jw.asBrowserUri(o).toString(!0)):o?Ps.parse(t).toString()===o.toString()?t:(o.query&&(o=o.with({query:l(o.query)})),o.toString()):t};let c;const h=new Promise((e=>c=e)),u=new m5.Renderer;if(u.image=(e,t,i)=>{let n=[],o=[];return e&&(({href:e,dimensions:n}=function(e){const t=[],i=e.split("|").map((e=>e.trim()));e=i[0];const n=i[1];if(n){const e=/height=(\d+)/.exec(n),i=/width=(\d+)/.exec(n),o=e?e[1]:"",s=i?i[1]:"",r=isFinite(parseInt(s)),a=isFinite(parseInt(o));r&&t.push(`width="${s}"`),a&&t.push(`height="${o}"`)}return{href:e,dimensions:t}}(e)),o.push(`src="${e}"`)),i&&o.push(`alt="${i}"`),t&&o.push(`title="${t}"`),n.length&&(o=o.concat(n)),"<img "+o.join(" ")+">"},u.link=(t,i,n)=>"string"!=typeof t?"":(t===n&&(n=BU(n)),t=d(t,!1),e.baseUri&&(t=_5(Ps.from(e.baseUri),t)),i="string"==typeof i?BU(i):"",!(t=BU(t))||/^data:|javascript:/i.test(t)||/^command:/i.test(t)&&!e.isTrusted||/^command:(\/\/\/)?_workbench\.downloadResource/i.test(t)?n:`<a data-href="${t=t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}" title="${i||t}">${n}</a>`),u.paragraph=e=>`<p>${e}</p>`,t.codeBlockRenderer&&(u.code=(e,i)=>{const n=t.codeBlockRenderer(null!=i?i:"",e),o=gU.nextId();return Qv(Promise.all([n,h]),r.token).then((e=>{var i;if(!s&&e){const n=a.querySelector(`div[data-code="${o}"]`);n&&KC(n,e[0]),null===(i=t.asyncRenderCallback)||void 0===i||i.call(t)}})).catch((()=>{})),`<div class="code" data-code="${o}">${Mr(e)}</div>`}),t.actionHandler){const i=t.actionHandler.disposables.add(new eB(a,"click")),n=t.actionHandler.disposables.add(new eB(a,"auxclick"));t.actionHandler.disposables.add(ds.any(i.event,n.event)((i=>{const n=new Gw(i);if(!n.leftButton&&!n.middleButton)return;let o=n.target;if("A"===o.tagName||(o=o.parentElement,o&&"A"===o.tagName))try{let i=o.dataset.href;i&&(e.baseUri&&(i=_5(Ps.from(e.baseUri),i)),t.actionHandler.callback(i,n))}catch(s){Jo(s)}finally{n.preventDefault()}})))}e.supportHtml||(i.sanitizer=t=>(e.isTrusted?t.match(/^(<span[^>]+>)|(<\/\s*span>)$/):void 0)?t:"",i.sanitize=!0,i.silent=!0),i.renderer=u;let g=null!==(n=e.value)&&void 0!==n?n:"";g.length>1e5&&(g=`${g.substr(0,1e5)}…`),e.supportThemeIcons&&(g=function(e){return e.replace(TH,(e=>`\\${e}`))}(g));let p=m5.parse(g,i);if(e.supportThemeIcons){p=Jj(p).map((e=>"string"==typeof e?e:e.outerHTML)).join("")}const m=(new DOMParser).parseFromString(v5(e,p),"text/html");if(m.body.querySelectorAll("img").forEach((t=>{const i=t.getAttribute("src");if(i){let o=i;try{e.baseUri&&(o=_5(Ps.from(e.baseUri),o))}catch(n){}t.src=d(o,!0)}})),a.innerHTML=v5(e,m.body.innerHTML),c(),t.asyncRenderCallback)for(const f of a.getElementsByTagName("img")){const e=o.add(nC(f,"load",(()=>{e.dispose(),t.asyncRenderCallback()})))}return{element:a,dispose:()=>{s=!0,r.cancel(),o.dispose()}}}function _5(e,t){return/^\w[\w\d+.-]*:/.test(t)?t:e.path.endsWith("/")?dR(e,t).toString():dR(rR(e),t).toString()}function v5(e,t){const{config:i,allowedSchemes:n}=function(e){const t=[Yw.http,Yw.https,Yw.mailto,Yw.data,Yw.file,Yw.vscodeFileResource,Yw.vscodeRemote,Yw.vscodeRemoteResource];e.isTrusted&&t.push(Yw.command);return{config:{ALLOWED_TAGS:["ul","li","p","b","i","code","blockquote","ol","h1","h2","h3","h4","h5","h6","hr","em","pre","table","thead","tbody","tr","th","td","div","del","a","strong","br","img","span"],ALLOWED_ATTR:["href","data-href","target","title","src","alt","class","style","data-code","width","height","align"],ALLOW_UNKNOWN_PROTOCOLS:!0},allowedSchemes:t}}(e);u5("uponSanitizeAttribute",((e,t)=>{if("style"!==t.attrName&&"class"!==t.attrName);else{if("SPAN"===e.tagName){if("style"===t.attrName)return void(t.keepAttr=/^(color\:#[0-9a-fA-F]+;)?(background-color\:#[0-9a-fA-F]+;)?$/.test(t.attrValue));if("class"===t.attrName)return void(t.keepAttr=/^codicon codicon-[a-z\-]+( codicon-modifier-[a-z\-]+)?$/.test(t.attrValue))}t.keepAttr=!1}}));const o=document.createElement("a");u5("afterSanitizeAttributes",(e=>{for(const t of["href","src"])e.hasAttribute(t)&&(o.href=e.getAttribute(t),n.includes(o.protocol.replace(/:$/,""))||e.removeAttribute(t))}));try{return h5(t,Object.assign(Object.assign({},i),{RETURN_TRUSTED_TYPE:!0}))}finally{g5("uponSanitizeAttribute"),g5("afterSanitizeAttributes")}}var b5,w5=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},C5=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}},y5=globalThis&&globalThis.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{l(n.next(e))}catch(t){s(t)}}function a(e){try{l(n.throw(e))}catch(t){s(t)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}l((n=n.apply(e,t||[])).next())}))};let x5=class e{constructor(e,t,i){this._options=e,this._languageService=t,this._openerService=i,this._onDidRenderAsync=new $o,this.onDidRenderAsync=this._onDidRenderAsync.event}dispose(){this._onDidRenderAsync.dispose()}render(e,t,i){if(!e){return{element:document.createElement("span"),dispose:()=>{}}}const n=new ws;return{element:n.add(f5(e,Object.assign(Object.assign({},this._getRenderOptions(e,n)),t),i)).element,dispose:()=>n.dispose()}}_getRenderOptions(t,i){return{codeBlockRenderer:(t,i)=>y5(this,void 0,void 0,(function*(){var n,o,s;let r;t?r=this._languageService.getLanguageIdByLanguageName(t):this._options.editor&&(r=null===(n=this._options.editor.getModel())||void 0===n?void 0:n.getLanguageId()),r||(r=LA);const a=yield function(e,t,i){return NA(this,void 0,void 0,(function*(){if(!i)return TA(t,e.languageIdCodec,EA);const n=yield Ns.getOrCreate(i);return TA(t,e.languageIdCodec,n||EA)}))}(this._languageService,i,r),l=document.createElement("span");if(l.innerHTML=null!==(s=null===(o=e._ttpTokenizer)||void 0===o?void 0:o.createHTML(a))&&void 0!==s?s:a,this._options.editor){m_(l,this._options.editor.getOption(44))}else this._options.codeBlockFontFamily&&(l.style.fontFamily=this._options.codeBlockFontFamily);return l})),asyncRenderCallback:()=>this._onDidRenderAsync.fire(),actionHandler:{callback:e=>this._openerService.open(e,{fromUserGesture:!0,allowContributedOpeners:!0,allowCommands:t.isTrusted}).catch(Jo),disposables:i}}}};x5._ttpTokenizer=null===(b5=window.trustedTypes)||void 0===b5?void 0:b5.createPolicy("tokenizeToString",{createHTML:e=>e}),x5=w5([C5(1,Lv),C5(2,ij)],x5);const S5=YC;class k5 extends Uo{constructor(e,t,i=nj){super(),this._renderDisposeables=this._register(new ws),this._editor=e,this._isVisible=!1,this._messages=[],this._hover=this._register(new n2),this._hover.containerDomNode.classList.toggle("hidden",!this._isVisible),this._markdownRenderer=this._register(new x5({editor:this._editor},t,i)),this._computer=new D5(this._editor),this._hoverOperation=this._register(new l2(this._editor,this._computer)),this._register(this._hoverOperation.onResult((e=>{this._withResult(e.value)}))),this._register(this._editor.onDidChangeModelDecorations((()=>this._onModelDecorationsChanged()))),this._register(this._editor.onDidChangeConfiguration((e=>{e.hasChanged(44)&&this._updateFont()}))),this._editor.addOverlayWidget(this)}dispose(){this._editor.removeOverlayWidget(this),super.dispose()}getId(){return k5.ID}getDomNode(){return this._hover.containerDomNode}getPosition(){return null}_updateFont(){Array.prototype.slice.call(this._hover.contentsDomNode.getElementsByClassName("code")).forEach((e=>this._editor.applyFontInfo(e)))}_onModelDecorationsChanged(){this._isVisible&&(this._hoverOperation.cancel(),this._hoverOperation.start(0))}startShowingAt(e){this._computer.lineNumber!==e&&(this._hoverOperation.cancel(),this.hide(),this._computer.lineNumber=e,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 e=S5("div.hover-row.markdown-hover"),t=$C(e,S5("div.hover-contents")),o=this._renderDisposeables.add(this._markdownRenderer.render(n.value));t.appendChild(o.element),i.appendChild(e)}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(59),s=i-n-(this._hover.containerDomNode.clientHeight-o)/2;this._hover.containerDomNode.style.left=`${t.glyphMarginLeft+t.glyphMarginWidth}px`,this._hover.containerDomNode.style.top=`${Math.max(Math.round(s),0)}px`}}k5.ID="editor.contrib.modesGlyphHoverWidget";class D5{constructor(e){this._editor=e,this._lineNumber=-1}get lineNumber(){return this._lineNumber}set lineNumber(e){this._lineNumber=e}computeSync(){const e=e=>({value:e}),t=this._editor.getLineDecorations(this._lineNumber),i=[];if(!t)return i;for(const n of t){if(!n.options.glyphMarginClassName)continue;const t=n.options.glyphMarginHoverMessage;t&&!PU(t)&&i.push(...Ml(t).map(e))}return i}}var L5=globalThis&&globalThis.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{l(n.next(e))}catch(t){s(t)}}function a(e){try{l(n.throw(e))}catch(t){s(t)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}l((n=n.apply(e,t||[])).next())}))};class N5{constructor(e,t,i){this.provider=e,this.hover=t,this.ordinal=i}}function E5(e,t,i,n){const o=e.ordered(t).map(((e,o)=>function(e,t,i,n,o){return L5(this,void 0,void 0,(function*(){try{const s=yield Promise.resolve(e.provideHover(i,n,o));if(s&&function(e){const t=void 0!==e.range,i=void 0!==e.contents&&e.contents&&e.contents.length>0;return t&&i}(s))return new N5(e,s,t)}catch(s){Ta(s)}}))}(e,o,t,i,n)));return pb.fromPromises(o).coalesce()}kx("_executeHoverProvider",((e,t,i)=>function(e,t,i,n){return E5(e,t,i,n).map((e=>e.hover)).toPromise()}(e.get(Lb).hoverProvider,t,i,Ia.None)));var I5=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},T5=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};const M5=YC;class A5{constructor(e,t,i,n){this.owner=e,this.range=t,this.contents=i,this.ordinal=n}isValidForHoverAnchor(e){return 1===e.type&&this.range.startColumn<=e.range.startColumn&&this.range.endColumn>=e.range.endColumn}}let O5=class{constructor(e,t,i,n,o){this._editor=e,this._languageService=t,this._openerService=i,this._configurationService=n,this._languageFeaturesService=o,this.hoverOrdinal=2}createLoadingMessage(e){return new A5(this,e.range,[(new RU).appendText(mf(0,"Loading..."))],2e3)}computeSync(e,t){if(!this._editor.hasModel()||1!==e.type)return[];const i=this._editor.getModel(),n=e.range.startLineNumber,o=i.getLineMaxColumn(n),s=[];let r=1e3;const a=i.getLineLength(n),l=i.getLanguageIdAtPosition(e.range.startLineNumber,e.range.startColumn),d=this._configurationService.getValue("editor.maxTokenizationLineLength",{overrideIdentifier:l});"number"==typeof d&&a>=d&&s.push(new A5(this,e.range,[{value:mf(0,"Tokenization is skipped for long lines for performance reasons. This can be configured via `editor.maxTokenizationLineLength`.")}],r++));for(const c of t){const t=c.range.startLineNumber===n?c.range.startColumn:1,i=c.range.endLineNumber===n?c.range.endColumn:o,a=c.options.hoverMessage;if(!a||PU(a))continue;const l=new qo(e.range.startLineNumber,t,e.range.startLineNumber,i);s.push(new A5(this,l,Ml(a),r++))}return s}computeAsync(e,t,i){if(!this._editor.hasModel()||1!==e.type)return pb.EMPTY;const n=this._editor.getModel();if(!this._languageFeaturesService.hoverProvider.has(n))return pb.EMPTY;const o=new er(e.range.startLineNumber,e.range.startColumn);return E5(this._languageFeaturesService.hoverProvider,n,o,i).filter((e=>!PU(e.hover.contents))).map((t=>{const i=t.hover.range?qo.lift(t.hover.range):e.range;return new A5(this,i,t.hover.contents,t.ordinal)}))}renderHoverParts(e,t){return R5(e,t,this._editor,this._languageService,this._openerService)}};function R5(e,t,i,n,o){t.sort(((e,t)=>e.ordinal-t.ordinal));const s=new ws;for(const r of t)for(const t of r.contents){if(PU(t))continue;const r=M5("div.hover-row.markdown-hover"),a=$C(r,M5("div.hover-contents")),l=s.add(new x5({editor:i},n,o));s.add(l.onDidRenderAsync((()=>{a.className="hover-contents code-hover-contents",e.onContentsChanged()})));const d=s.add(l.render(t));a.appendChild(d.element),e.fragment.appendChild(r)}return s}O5=I5([T5(1,Lv),T5(2,ij),T5(3,Cv),T5(4,Lb)],O5);var P5=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},F5=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};class B5{constructor(e,t,i){this.marker=e,this.index=t,this.total=i}}let V5=class{constructor(e,t,i){this._markerService=t,this._configService=i,this._onDidChange=new $o,this.onDidChange=this._onDidChange.event,this._dispoables=new ws,this._markers=[],this._nextIdx=-1,Ps.isUri(e)?this._resourceFilter=t=>t.toString()===e.toString():e&&(this._resourceFilter=e);const n=this._configService.getValue("problems.sortOrder"),o=(e,t)=>{let i=zr(e.resource.toString(),t.resource.toString());return 0===i&&(i="position"===n?qo.compareRangesUsingStarts(e,t)||uj.compare(e.severity,t.severity):uj.compare(e.severity,t.severity)||qo.compareRangesUsingStarts(e,t)),i},s=()=>{this._markers=this._markerService.read({resource:Ps.isUri(e)?e:void 0,severities:uj.Error|uj.Warning|uj.Info}),"function"==typeof e&&(this._markers=this._markers.filter((e=>this._resourceFilter(e.resource)))),this._markers.sort(o)};s(),this._dispoables.add(t.onMarkerChanged((e=>{this._resourceFilter&&!e.some((e=>this._resourceFilter(e)))||(s(),this._nextIdx=-1,this._onDidChange.fire())})))}dispose(){this._dispoables.dispose(),this._onDidChange.dispose()}matches(e){return!this._resourceFilter&&!e||!(!this._resourceFilter||!e)&&this._resourceFilter(e)}get selected(){const e=this._markers[this._nextIdx];return e&&new B5(e,this._nextIdx+1,this._markers.length)}_initIdx(e,t,i){let n=!1,o=this._markers.findIndex((t=>t.resource.toString()===e.uri.toString()));o<0&&(o=Fa(this._markers,{resource:e.uri},((e,t)=>zr(e.resource.toString(),t.resource.toString()))),o<0&&(o=~o));for(let s=o;s<this._markers.length;s++){let i=qo.lift(this._markers[s]);if(i.isEmpty()){const t=e.getWordAtPosition(i.getStartPosition());t&&(i=new qo(i.startLineNumber,t.startColumn,i.startLineNumber,t.endColumn))}if(t&&(i.containsPosition(t)||t.isBeforeOrEqual(i.getStartPosition()))){this._nextIdx=s,n=!0;break}if(this._markers[s].resource.toString()!==e.uri.toString())break}n||(this._nextIdx=i?0:this._markers.length-1),this._nextIdx<0&&(this._nextIdx=this._markers.length-1)}resetIndex(){this._nextIdx=-1}move(e,t,i){if(0===this._markers.length)return!1;let n=this._nextIdx;return-1===this._nextIdx?this._initIdx(t,i,e):e?this._nextIdx=(this._nextIdx+1)%this._markers.length:e||(this._nextIdx=(this._nextIdx-1+this._markers.length)%this._markers.length),n!==this._nextIdx}find(e,t){let i=this._markers.findIndex((t=>t.resource.toString()===e.toString()));if(!(i<0))for(;i<this._markers.length;i++)if(qo.containsPosition(this._markers[i],t))return new B5(this._markers[i],i+1,this._markers.length)}};V5=P5([F5(1,pj),F5(2,Cv)],V5);const W5=L_("IMarkerNavigationService");let z5=class{constructor(e,t){this._markerService=e,this._configService=t,this._provider=new zs}getMarkerList(e){for(let t of this._provider){const i=t.getMarkerList(e);if(i)return i}return new V5(e,this._markerService,this._configService)}};z5=P5([F5(0,pj),F5(1,Cv)],z5),Iv(W5,z5,!0);var H5;!function(e){e.className=function(e){switch(e){case fF.Ignore:return"severity-ignore "+br.info.classNames;case fF.Info:return br.info.classNames;case fF.Warning:return br.warning.classNames;case fF.Error:return br.error.classNames;default:return""}}}(H5||(H5={})),sx(((e,t)=>{const i=e.getColor(_L);if(i){const e=br.error.cssSelector;t.addRule(`\n\t\t\t.monaco-editor .zone-widget ${e},\n\t\t\t.markers-panel .marker-icon${e},\n\t\t\t.text-search-provider-messages .providerMessage ${e},\n\t\t\t.extensions-viewlet > .extensions ${e} {\n\t\t\t\tcolor: ${i};\n\t\t\t}\n\t\t`)}const n=e.getColor(vL);if(n){const e=br.warning.cssSelector;t.addRule(`\n\t\t\t.monaco-editor .zone-widget ${e},\n\t\t\t.markers-panel .marker-icon${e},\n\t\t\t.extensions-viewlet > .extensions ${e},\n\t\t\t.extension-editor ${e},\n\t\t\t.text-search-provider-messages .providerMessage ${e},\n\t\t\t.preferences-editor ${e} {\n\t\t\t\tcolor: ${n};\n\t\t\t}\n\t\t`)}const o=e.getColor(bL);if(o){const e=br.info.cssSelector;t.addRule(`\n\t\t\t.monaco-editor .zone-widget ${e},\n\t\t\t.markers-panel .marker-icon${e},\n\t\t\t.extensions-viewlet > .extensions ${e},\n\t\t\t.text-search-provider-messages .providerMessage ${e},\n\t\t\t.extension-editor ${e} {\n\t\t\t\tcolor: ${o};\n\t\t\t}\n\t\t`)}}));var j5=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},U5=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};class $5{constructor(e,t,i,n,o){this._openerService=n,this._labelService=o,this._lines=0,this._longestLineLength=0,this._relatedDiagnostics=new WeakMap,this._disposables=new ws,this._editor=t;const s=document.createElement("div");s.className="descriptioncontainer",this._messageBlock=document.createElement("div"),this._messageBlock.classList.add("message"),this._messageBlock.setAttribute("aria-live","assertive"),this._messageBlock.setAttribute("role","alert"),s.appendChild(this._messageBlock),this._relatedBlock=document.createElement("div"),s.appendChild(this._relatedBlock),this._disposables.add(sC(this._relatedBlock,"click",(e=>{e.preventDefault();const t=this._relatedDiagnostics.get(e.target);t&&i(t)}))),this._scrollable=new pT(s,{horizontal:1,vertical:1,useShadows:!1,horizontalScrollbarSize:6,verticalScrollbarSize:6}),e.appendChild(this._scrollable.getDomNode()),this._disposables.add(this._scrollable.onScroll((e=>{s.style.left=`-${e.scrollLeft}px`,s.style.top=`-${e.scrollTop}px`}))),this._disposables.add(this._scrollable)}dispose(){bs(this._disposables)}update(e){const{source:t,message:i,relatedInformation:n,code:o}=e;let s=((null==t?void 0:t.length)||0)+"()".length;o&&(s+="string"==typeof o?o.length:o.value.length);const r=Is(i);this._lines=r.length,this._longestLineLength=0;for(const h of r)this._longestLineLength=Math.max(h.length+s,this._longestLineLength);eC(this._messageBlock),this._messageBlock.setAttribute("aria-label",this.getAriaLabel(e)),this._editor.applyFontInfo(this._messageBlock);let a=this._messageBlock;for(const h of r)a=document.createElement("div"),a.innerText=h,""===h&&(a.style.height=this._messageBlock.style.lineHeight),this._messageBlock.appendChild(a);if(t||o){const e=document.createElement("span");if(e.classList.add("details"),a.appendChild(e),t){const i=document.createElement("span");i.innerText=t,i.classList.add("source"),e.appendChild(i)}if(o)if("string"==typeof o){const t=document.createElement("span");t.innerText=`(${o})`,t.classList.add("code"),e.appendChild(t)}else{this._codeLink=YC("a.code-link"),this._codeLink.setAttribute("href",`${o.target.toString()}`),this._codeLink.onclick=e=>{this._openerService.open(o.target,{allowCommands:!0}),e.preventDefault(),e.stopPropagation()};$C(this._codeLink,YC("span")).innerText=o.value,e.appendChild(this._codeLink)}}if(eC(this._relatedBlock),this._editor.applyFontInfo(this._relatedBlock),gs(n)){const e=this._relatedBlock.appendChild(document.createElement("div"));e.style.paddingTop=`${Math.floor(.66*this._editor.getOption(59))}px`,this._lines+=1;for(const t of n){let i=document.createElement("div"),n=document.createElement("a");n.classList.add("filename"),n.innerText=`${G1(t.resource)}(${t.startLineNumber}, ${t.startColumn}): `,n.title=this._labelService.getUriLabel(t.resource),this._relatedDiagnostics.set(n,t);let o=document.createElement("span");o.innerText=t.message,i.appendChild(n),i.appendChild(o),this._lines+=1,e.appendChild(i)}}const l=this._editor.getOption(44),d=Math.ceil(l.typicalFullwidthCharacterWidth*this._longestLineLength*.75),c=l.lineHeight*this._lines;this._scrollable.setScrollDimensions({scrollWidth:d,scrollHeight:c})}layout(e,t){this._scrollable.getDomNode().style.height=`${e}px`,this._scrollable.getDomNode().style.width=`${t}px`,this._scrollable.setScrollDimensions({width:t,height:e})}getHeightInLines(){return Math.min(17,this._lines)}getAriaLabel(e){let t="";switch(e.severity){case uj.Error:t=mf(0,"Error");break;case uj.Warning:t=mf(0,"Warning");break;case uj.Info:t=mf(0,"Info");break;case uj.Hint:t=mf(0,"Hint")}let i=mf(0,"{0} at {1}. ",t,e.startLineNumber+":"+e.startColumn);const n=this._editor.getModel();if(n&&e.startLineNumber<=n.getLineCount()&&e.startLineNumber>=1){i=`${n.getLineContent(e.startLineNumber)}, ${i}`}return i}}let K5=class e extends P1{constructor(e,t,i,n,o,s,r){super(e,{showArrow:!0,showFrame:!0,isAccessible:!0,frameWidth:1},o),this._themeService=t,this._openerService=i,this._menuService=n,this._contextKeyService=s,this._labelService=r,this._callOnDispose=new ws,this._onDidSelectRelatedInformation=new $o,this.onDidSelectRelatedInformation=this._onDidSelectRelatedInformation.event,this._severity=uj.Warning,this._backgroundColor=hS.white,this._applyTheme(t.getColorTheme()),this._callOnDispose.add(t.onDidColorThemeChange(this._applyTheme.bind(this))),this.create()}_applyTheme(e){this._backgroundColor=e.getColor(i4);let t=Y5,i=X5;this._severity===uj.Warning?(t=Q5,i=J5):this._severity===uj.Info&&(t=e4,i=t4);const n=e.getColor(t),o=e.getColor(i);this.style({arrowColor:n,frameColor:n,headerBackgroundColor:o,primaryHeadingColor:e.getColor(B1),secondaryHeadingColor:e.getColor(V1)})}_applyStyles(){this._parentContainer&&(this._parentContainer.style.backgroundColor=this._backgroundColor?this._backgroundColor.toString():""),super._applyStyles()}dispose(){this._callOnDispose.dispose(),super.dispose()}_fillHead(t){super._fillHead(t),this._disposables.add(this._actionbarWidget.actionRunner.onBeforeRun((e=>this.editor.focus())));const i=[],n=this._menuService.createMenu(e.TitleMenu,this._contextKeyService);k1(n,void 0,i),this._actionbarWidget.push(i,{label:!1,icon:!0,index:0}),n.dispose()}_fillTitleIcon(e){this._icon=$C(e,YC(""))}_fillBody(e){this._parentContainer=e,e.classList.add("marker-widget"),this._parentContainer.tabIndex=0,this._parentContainer.setAttribute("role","tooltip"),this._container=document.createElement("div"),e.appendChild(this._container),this._message=new $5(this._container,this.editor,(e=>this._onDidSelectRelatedInformation.fire(e)),this._openerService,this._labelService),this._disposables.add(this._message)}show(){throw new Error("call showAtMarker")}showAtMarker(e,t,i){this._container.classList.remove("stale"),this._message.update(e),this._severity=e.severity,this._applyTheme(this._themeService.getColorTheme());let n=qo.lift(e);const o=this.editor.getPosition();let s=o&&n.containsPosition(o)?o:n.getStartPosition();super.show(s,this.computeRequiredHeight());const r=this.editor.getModel();if(r){const e=mf(0,i>1?"{0} of {1} problems":"{0} of {1} problem",t,i);this.setTitle(oR(r.uri),e)}this._icon.className=`codicon ${H5.className(uj.toSeverity(this._severity))}`,this.editor.revealPositionNearTop(s,0),this.editor.focus()}updateMarker(e){this._container.classList.remove("stale"),this._message.update(e)}showStale(){this._container.classList.add("stale"),this._relayout()}_doLayoutBody(e,t){super._doLayoutBody(e,t),this._heightInPixel=e,this._message.layout(e,t),this._container.style.height=`${e}px`}_onWidth(e){this._message.layout(this._heightInPixel,e)}_relayout(){super._relayout(this.computeRequiredHeight())}computeRequiredHeight(){return 3+this._message.getHeightInLines()}};K5.TitleMenu=new cx("gotoErrorTitleMenu"),K5=j5([U5(1,Qy),U5(2,ij),U5(3,hx),U5(4,k_),U5(5,$y),U5(6,FW)],K5);let q5=xL(ok,sk),G5=xL(ak,lk),Z5=xL(ck,hk);const Y5=_S("editorMarkerNavigationError.background",{dark:q5,light:q5,hc:yS},mf(0,"Editor marker navigation widget error color.")),X5=_S("editorMarkerNavigationError.headerBackground",{dark:yL(Y5,.1),light:yL(Y5,.1),hc:null},mf(0,"Editor marker navigation widget error heading background.")),Q5=_S("editorMarkerNavigationWarning.background",{dark:G5,light:G5,hc:yS},mf(0,"Editor marker navigation widget warning color.")),J5=_S("editorMarkerNavigationWarning.headerBackground",{dark:yL(Q5,.1),light:yL(Q5,.1),hc:"#0C141F"},mf(0,"Editor marker navigation widget warning heading background.")),e4=_S("editorMarkerNavigationInfo.background",{dark:Z5,light:Z5,hc:yS},mf(0,"Editor marker navigation widget info color.")),t4=_S("editorMarkerNavigationInfo.headerBackground",{dark:yL(e4,.1),light:yL(e4,.1),hc:null},mf(0,"Editor marker navigation widget info heading background.")),i4=_S("editorMarkerNavigation.background",{dark:pk,light:pk,hc:pk},mf(0,"Editor marker navigation widget background."));var n4=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},o4=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}},s4=globalThis&&globalThis.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{l(n.next(e))}catch(t){s(t)}}function a(e){try{l(n.throw(e))}catch(t){s(t)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}l((n=n.apply(e,t||[])).next())}))};let r4=class e{constructor(e,t,i,n,o){this._markerNavigationService=t,this._contextKeyService=i,this._editorService=n,this._instantiationService=o,this._sessionDispoables=new ws,this._editor=e,this._widgetVisible=c4.bindTo(this._contextKeyService)}static get(t){return t.getContribution(e.ID)}dispose(){this._cleanUp(),this._sessionDispoables.dispose()}_cleanUp(){this._widgetVisible.reset(),this._sessionDispoables.clear(),this._widget=void 0,this._model=void 0}_getOrCreateModel(e){if(this._model&&this._model.matches(e))return this._model;let t=!1;return this._model&&(t=!0,this._cleanUp()),this._model=this._markerNavigationService.getMarkerList(e),t&&this._model.move(!0,this._editor.getModel(),this._editor.getPosition()),this._widget=this._instantiationService.createInstance(K5,this._editor),this._widget.onDidClose((()=>this.close()),this,this._sessionDispoables),this._widgetVisible.set(!0),this._sessionDispoables.add(this._model),this._sessionDispoables.add(this._widget),this._sessionDispoables.add(this._editor.onDidChangeCursorPosition((e=>{var t,i,n;(null===(t=this._model)||void 0===t?void 0:t.selected)&&qo.containsPosition(null===(i=this._model)||void 0===i?void 0:i.selected.marker,e.position)||null===(n=this._model)||void 0===n||n.resetIndex()}))),this._sessionDispoables.add(this._model.onDidChange((()=>{if(!this._widget||!this._widget.position||!this._model)return;const e=this._model.find(this._editor.getModel().uri,this._widget.position);e?this._widget.updateMarker(e.marker):this._widget.showStale()}))),this._sessionDispoables.add(this._widget.onDidSelectRelatedInformation((e=>{this._editorService.openCodeEditor({resource:e.resource,options:{pinned:!0,revealIfOpened:!0,selection:qo.lift(e).collapseToStart()}},this._editor),this.close(!1)}))),this._sessionDispoables.add(this._editor.onDidChangeModel((()=>this._cleanUp()))),this._model}close(e=!0){this._cleanUp(),e&&this._editor.focus()}showAtMarker(e){if(this._editor.hasModel()){const t=this._getOrCreateModel(this._editor.getModel().uri);t.resetIndex(),t.move(!0,this._editor.getModel(),new er(e.startLineNumber,e.startColumn)),t.selected&&this._widget.showAtMarker(t.selected.marker,t.selected.index,t.selected.total)}}nagivate(t,i){var n,o;return s4(this,void 0,void 0,(function*(){if(this._editor.hasModel()){const s=this._getOrCreateModel(i?void 0:this._editor.getModel().uri);if(s.move(t,this._editor.getModel(),this._editor.getPosition()),!s.selected)return;if(s.selected.marker.resource.toString()!==this._editor.getModel().uri.toString()){this._cleanUp();const r=yield this._editorService.openCodeEditor({resource:s.selected.marker.resource,options:{pinned:!1,revealIfOpened:!0,selectionRevealType:2,selection:s.selected.marker}},this._editor);r&&(null===(n=e.get(r))||void 0===n||n.close(),null===(o=e.get(r))||void 0===o||o.nagivate(t,i))}else this._widget.showAtMarker(s.selected.marker,s.selected.index,s.selected.total)}}))}};r4.ID="editor.contrib.markerController",r4=n4([o4(1,W5),o4(2,$y),o4(3,N_),o4(4,k_)],r4);class a4 extends xx{constructor(e,t,i){super(i),this._next=e,this._multiFile=t}run(e,t){var i;return s4(this,void 0,void 0,(function*(){t.hasModel()&&(null===(i=r4.get(t))||void 0===i||i.nagivate(this._next,this._multiFile))}))}}class l4 extends a4{constructor(){super(!0,!1,{id:l4.ID,label:l4.LABEL,alias:"Go to Next Problem (Error, Warning, Info)",precondition:void 0,kbOpts:{kbExpr:yI.focus,primary:578,weight:100},menuOpts:{menuId:K5.TitleMenu,title:l4.LABEL,icon:CB("marker-navigation-next",br.arrowDown,mf(0,"Icon for goto next marker.")),group:"navigation",order:1}})}}l4.ID="editor.action.marker.next",l4.LABEL=mf(0,"Go to Next Problem (Error, Warning, Info)");class d4 extends a4{constructor(){super(!1,!1,{id:d4.ID,label:d4.LABEL,alias:"Go to Previous Problem (Error, Warning, Info)",precondition:void 0,kbOpts:{kbExpr:yI.focus,primary:1602,weight:100},menuOpts:{menuId:K5.TitleMenu,title:d4.LABEL,icon:CB("marker-navigation-previous",br.arrowUp,mf(0,"Icon for goto previous marker.")),group:"navigation",order:2}})}}d4.ID="editor.action.marker.prev",d4.LABEL=mf(0,"Go to Previous Problem (Error, Warning, Info)");Ix(r4.ID,r4),Lx(l4),Lx(d4),Lx(class extends a4{constructor(){super(!0,!0,{id:"editor.action.marker.nextInFiles",label:mf(0,"Go to Next Problem in Files (Error, Warning, Info)"),alias:"Go to Next Problem in Files (Error, Warning, Info)",precondition:void 0,kbOpts:{kbExpr:yI.focus,primary:66,weight:100},menuOpts:{menuId:cx.MenubarGoMenu,title:mf(0,"Next &&Problem"),group:"6_problem_nav",order:1}})}}),Lx(class extends a4{constructor(){super(!1,!0,{id:"editor.action.marker.prevInFiles",label:mf(0,"Go to Previous Problem in Files (Error, Warning, Info)"),alias:"Go to Previous Problem in Files (Error, Warning, Info)",precondition:void 0,kbOpts:{kbExpr:yI.focus,primary:1090,weight:100},menuOpts:{menuId:cx.MenubarGoMenu,title:mf(0,"Previous &&Problem"),group:"6_problem_nav",order:2}})}});const c4=new Uy("markersNavigationVisible",!1);Dx(new(yx.bindToContribution(r4.get))({id:"closeMarkersNavigation",precondition:c4,handler:e=>e.close(),kbOpts:{weight:150,kbExpr:yI.focus,primary:9,secondary:[1033]}}));var h4=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},u4=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};const g4=YC;class p4{constructor(e,t,i){this.owner=e,this.range=t,this.marker=i}isValidForHoverAnchor(e){return 1===e.type&&this.range.startColumn<=e.range.startColumn&&this.range.endColumn>=e.range.endColumn}}const m4={type:1,filter:{include:kJ.QuickFix}};let f4=class{constructor(e,t,i,n){this._editor=e,this._markerDecorationsService=t,this._openerService=i,this._languageFeaturesService=n,this.hoverOrdinal=5,this.recentMarkerCodeActionsInfo=void 0}computeSync(e,t){if(!this._editor.hasModel()||1!==e.type)return[];const i=this._editor.getModel(),n=e.range.startLineNumber,o=i.getLineMaxColumn(n),s=[];for(const r of t){const t=r.range.startLineNumber===n?r.range.startColumn:1,a=r.range.endLineNumber===n?r.range.endColumn:o,l=this._markerDecorationsService.getMarker(i.uri,r);if(!l)continue;const d=new qo(e.range.startLineNumber,t,e.range.startLineNumber,a);s.push(new p4(this,d,l))}return s}renderHoverParts(e,t){if(!t.length)return Uo.None;const i=new ws;t.forEach((t=>e.fragment.appendChild(this.renderMarkerHover(t,i))));const n=1===t.length?t[0]:t.sort(((e,t)=>uj.compare(e.marker.severity,t.marker.severity)))[0];return this.renderMarkerStatusbar(e,n,i),i}renderMarkerHover(e,t){const i=g4("div.hover-row"),n=$C(i,g4("div.marker.hover-contents")),{source:o,message:s,code:r,relatedInformation:a}=e.marker;this._editor.applyFontInfo(n);const l=$C(n,g4("span"));if(l.style.whiteSpace="pre-wrap",l.innerText=s,o||r)if(r&&"string"!=typeof r){const e=g4("span");if(o){$C(e,g4("span")).innerText=o}const i=$C(e,g4("a.code-link"));i.setAttribute("href",r.target.toString()),t.add(nC(i,"click",(e=>{this._openerService.open(r.target,{allowCommands:!0}),e.preventDefault(),e.stopPropagation()})));$C(i,g4("span")).innerText=r.value;const s=$C(n,e);s.style.opacity="0.6",s.style.paddingLeft="6px"}else{const e=$C(n,g4("span"));e.style.opacity="0.6",e.style.paddingLeft="6px",e.innerText=o&&r?`${o}(${r})`:o||`(${r})`}if(gs(a))for(const{message:d,resource:c,startLineNumber:h,startColumn:u}of a){const e=$C(n,g4("div"));e.style.marginTop="8px";const i=$C(e,g4("a"));i.innerText=`${oR(c)}(${h}, ${u}): `,i.style.cursor="pointer",t.add(nC(i,"click",(e=>{e.stopPropagation(),e.preventDefault(),this._openerService&&this._openerService.open(c,{fromUserGesture:!0,editorOptions:{selection:{startLineNumber:h,startColumn:u}}}).catch(Jo)})));const o=$C(e,g4("span"));o.innerText=d,this._editor.applyFontInfo(o)}return i}renderMarkerStatusbar(e,t,i){if(t.marker.severity!==uj.Error&&t.marker.severity!==uj.Warning&&t.marker.severity!==uj.Info||e.statusBar.addAction({label:mf(0,"View Problem"),commandId:l4.ID,run:()=>{var i;e.hide(),null===(i=r4.get(this._editor))||void 0===i||i.showAtMarker(t.marker),this._editor.focus()}}),!this._editor.getOption(81)){const n=e.statusBar.append(g4("div"));this.recentMarkerCodeActionsInfo&&(gj.makeKey(this.recentMarkerCodeActionsInfo.marker)===gj.makeKey(t.marker)?this.recentMarkerCodeActionsInfo.hasCodeActions||(n.textContent=mf(0,"No quick fixes available")):this.recentMarkerCodeActionsInfo=void 0);const o=this.recentMarkerCodeActionsInfo&&!this.recentMarkerCodeActionsInfo.hasCodeActions?Uo.None:i.add(ob((()=>n.textContent=mf(0,"Checking for quick fixes...")),200));n.textContent||(n.textContent=String.fromCharCode(160));const s=this.getCodeActions(t.marker);i.add(es((()=>s.cancel()))),s.then((s=>{if(o.dispose(),this.recentMarkerCodeActionsInfo={marker:t.marker,hasCodeActions:s.validActions.length>0},!this.recentMarkerCodeActionsInfo.hasCodeActions)return s.dispose(),void(n.textContent=mf(0,"No quick fixes available"));n.style.display="none";let r=!1;i.add(es((()=>{r||s.dispose()}))),e.statusBar.addAction({label:mf(0,"Quick Fix..."),commandId:C0.Id,run:t=>{r=!0;const i=v0.get(this._editor),n=yC(t);e.hide(),null==i||i.showCodeActions(m4,s,{x:n.left+6,y:n.top+n.height+6})}})}),Jo)}}getCodeActions(e){return Xv((t=>FJ(this._languageFeaturesService.codeActionProvider,this._editor.getModel(),new qo(e.startLineNumber,e.startColumn,e.endLineNumber,e.endColumn),m4,UB.None,t)))}};f4=h4([u4(1,uy),u4(2,ij),u4(3,Lb)],f4),sx(((e,t)=>{const i=e.getColor(SS);i&&t.addRule(`.monaco-hover .hover-contents a.code-link span { color: ${i}; }`);const n=e.getColor(kS);n&&t.addRule(`.monaco-hover .hover-contents a.code-link span:hover { color: ${n}; }`)}));var _4=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},v4=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};let b4=class e{constructor(e,t,i,n,o){this._editor=e,this._instantiationService=t,this._openerService=i,this._languageService=n,this._toUnhook=new ws,this._isMouseDown=!1,this._hoverClicked=!1,this._contentWidget=null,this._glyphWidget=null,this._hookEvents(),this._didChangeConfigurationHandler=this._editor.onDidChangeConfiguration((e=>{e.hasChanged(53)&&(this._unhookEvents(),this._hookEvents())}))}static get(t){return t.getContribution(e.ID)}_hookEvents(){const e=()=>this._hideWidgets(),t=this._editor.getOption(53);this._isHoverEnabled=t.enabled,this._isHoverSticky=t.sticky,this._isHoverEnabled?(this._toUnhook.add(this._editor.onMouseDown((e=>this._onEditorMouseDown(e)))),this._toUnhook.add(this._editor.onMouseUp((e=>this._onEditorMouseUp(e)))),this._toUnhook.add(this._editor.onMouseMove((e=>this._onEditorMouseMove(e)))),this._toUnhook.add(this._editor.onKeyDown((e=>this._onKeyDown(e))))):(this._toUnhook.add(this._editor.onMouseMove((e=>this._onEditorMouseMove(e)))),this._toUnhook.add(this._editor.onKeyDown((e=>this._onKeyDown(e))))),this._toUnhook.add(this._editor.onMouseLeave(e)),this._toUnhook.add(this._editor.onDidChangeModel(e)),this._toUnhook.add(this._editor.onDidScrollChange((e=>this._onEditorScrollChanged(e))))}_unhookEvents(){this._toUnhook.clear()}_onEditorScrollChanged(e){(e.scrollTopChanged||e.scrollLeftChanged)&&this._hideWidgets()}_onEditorMouseDown(e){this._isMouseDown=!0;const t=e.target;9!==t.type||t.detail!==g6.ID?12===t.type&&t.detail===k5.ID||(12!==t.type&&(this._hoverClicked=!1),this._hideWidgets()):this._hoverClicked=!0}_onEditorMouseUp(e){this._isMouseDown=!1}_onEditorMouseMove(e){var t,i,n,o,s;const r=e.target;if(this._isMouseDown&&this._hoverClicked)return;if(this._isHoverSticky&&9===r.type&&r.detail===g6.ID)return;if(this._isHoverSticky&&!(null===(i=null===(t=e.event.browserEvent.view)||void 0===t?void 0:t.getSelection())||void 0===i?void 0:i.isCollapsed))return;if(!this._isHoverSticky&&9===r.type&&r.detail===g6.ID&&(null===(n=this._contentWidget)||void 0===n?void 0:n.isColorPickerVisible()))return;if(this._isHoverSticky&&12===r.type&&r.detail===k5.ID)return;if(!this._isHoverEnabled)return void this._hideWidgets();if(!this._getOrCreateContentWidget().maybeShowAt(e))return 2===r.type&&r.position?(null===(s=this._contentWidget)||void 0===s||s.hide(),this._glyphWidget||(this._glyphWidget=new k5(this._editor,this._languageService,this._openerService)),void this._glyphWidget.startShowingAt(r.position.lineNumber)):void this._hideWidgets();null===(o=this._glyphWidget)||void 0===o||o.hide()}_onKeyDown(e){5!==e.keyCode&&6!==e.keyCode&&57!==e.keyCode&&4!==e.keyCode&&this._hideWidgets()}_hideWidgets(){var e,t,i;this._isMouseDown&&this._hoverClicked&&(null===(e=this._contentWidget)||void 0===e?void 0:e.isColorPickerVisible())||(this._hoverClicked=!1,null===(t=this._glyphWidget)||void 0===t||t.hide(),null===(i=this._contentWidget)||void 0===i||i.hide())}_getOrCreateContentWidget(){return this._contentWidget||(this._contentWidget=this._instantiationService.createInstance(c6,this._editor)),this._contentWidget}isColorPickerVisible(){var e;return(null===(e=this._contentWidget)||void 0===e?void 0:e.isColorPickerVisible())||!1}showContentHover(e,t,i){this._getOrCreateContentWidget().startShowingAtRange(e,t,i)}dispose(){var e,t;this._unhookEvents(),this._toUnhook.dispose(),this._didChangeConfigurationHandler.dispose(),null===(e=this._glyphWidget)||void 0===e||e.dispose(),null===(t=this._contentWidget)||void 0===t||t.dispose()}};b4.ID="editor.contrib.hover",b4=_4([v4(1,k_),v4(2,ij),v4(3,Lv),v4(4,$y)],b4);Ix(b4.ID,b4),Lx(class extends xx{constructor(){super({id:"editor.action.showHover",label:mf(0,"Show Hover"),alias:"Show Hover",precondition:void 0,kbOpts:{kbExpr:yI.editorTextFocus,primary:Ol(2089,2087),weight:100}})}run(e,t){if(!t.hasModel())return;let i=b4.get(t);if(!i)return;const n=t.getPosition(),o=new qo(n.lineNumber,n.column,n.lineNumber,n.column),s=2===t.getOption(2);i.showContentHover(o,1,s)}}),Lx(class extends xx{constructor(){super({id:"editor.action.showDefinitionPreviewHover",label:mf(0,"Show Definition Preview Hover"),alias:"Show Definition Preview Hover",precondition:void 0})}run(e,t){const i=b4.get(t);if(!i)return;const n=t.getPosition();if(!n)return;const o=new qo(n.lineNumber,n.column,n.lineNumber,n.column),s=t2.get(t);if(!s)return;s.startFindDefinitionFromCursor(n).then((()=>{i.showContentHover(o,1,!0)}))}}),h2.register(O5),h2.register(f4),sx(((e,t)=>{const i=e.getColor(Wk);i&&t.addRule(`.monaco-editor .hoverHighlight { background-color: ${i}; }`);const n=e.getColor(zk);n&&t.addRule(`.monaco-editor .monaco-hover { background-color: ${n}; }`);const o=e.getColor(jk);o&&(t.addRule(`.monaco-editor .monaco-hover { border: 1px solid ${o}; }`),t.addRule(`.monaco-editor .monaco-hover .hover-row:not(:first-child):not(:empty) { border-top: 1px solid ${o.transparent(.5)}; }`),t.addRule(`.monaco-editor .monaco-hover hr { border-top: 1px solid ${o.transparent(.5)}; }`),t.addRule(`.monaco-editor .monaco-hover hr { border-bottom: 0px solid ${o.transparent(.5)}; }`));const s=e.getColor(SS);s&&t.addRule(`.monaco-editor .monaco-hover a { color: ${s}; }`);const r=e.getColor(kS);r&&t.addRule(`.monaco-editor .monaco-hover a:hover { color: ${r}; }`);const a=e.getColor(Hk);a&&t.addRule(`.monaco-editor .monaco-hover { color: ${a}; }`);const l=e.getColor(Uk);l&&t.addRule(`.monaco-editor .monaco-hover .hover-row .actions { background-color: ${l}; }`);const d=e.getColor(DS);d&&t.addRule(`.monaco-editor .monaco-hover code { background-color: ${d}; }`)}));class w4 extends Uo{constructor(e){super(),this._editor=e,this._register(e.onMouseDown((e=>this.onMouseDown(e))))}dispose(){super.dispose()}onMouseDown(e){const t=e.target;if(6!==t.type)return;if(!t.detail.injectedText)return;if(t.detail.injectedText.options.attachedData!==j0)return;if(!t.range)return;const i=this._editor.getContribution(b4.ID);if(i&&!i.isColorPickerVisible()){const e=new qo(t.range.startLineNumber,t.range.startColumn+1,t.range.endLineNumber,t.range.endColumn+1);i.showContentHover(e,1,!1)}}}w4.ID="editor.contrib.colorContribution",Ix(w4.ID,w4),h2.register(o1);class C4{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;if(i+n>e.length)return!1;for(let o=0;o<n;o++){const n=e.charCodeAt(i+o),s=t.charCodeAt(o);if(n!==s&&!(n>=65&&n<=90&&n+32===s||s>=65&&s<=90&&s+32===n))return!1}return!0}_createOperationsForBlockComment(e,t,i,n,o,s){const r=e.startLineNumber,a=e.startColumn,l=e.endLineNumber,d=e.endColumn,c=o.getLineContent(r),h=o.getLineContent(l);let u,g=c.lastIndexOf(t,a-1+t.length),p=h.indexOf(i,d-1-i.length);if(-1!==g&&-1!==p)if(r===l){c.substring(g+t.length,p).indexOf(i)>=0&&(g=-1,p=-1)}else{const e=c.substring(g+t.length),n=h.substring(0,p);(e.indexOf(i)>=0||n.indexOf(i)>=0)&&(g=-1,p=-1)}-1!==g&&-1!==p?(n&&g+t.length<c.length&&32===c.charCodeAt(g+t.length)&&(t+=" "),n&&p>0&&32===h.charCodeAt(p-1)&&(i=" "+i,p-=1),u=C4._createRemoveBlockCommentOperations(new qo(r,g+t.length+1,l,p+1),t,i)):(u=C4._createAddBlockCommentOperations(e,t,i,this._insertSpace),this._usedEndToken=1===u.length?i:null);for(const m of u)s.addTrackedEditOperation(m.range,m.text)}static _createRemoveBlockCommentOperations(e,t,i){let n=[];return qo.isEmpty(e)?n.push(_W.delete(new qo(e.startLineNumber,e.startColumn-t.length,e.endLineNumber,e.endColumn+i.length))):(n.push(_W.delete(new qo(e.startLineNumber,e.startColumn-t.length,e.startLineNumber,e.startColumn))),n.push(_W.delete(new qo(e.endLineNumber,e.endColumn,e.endLineNumber,e.endColumn+i.length)))),n}static _createAddBlockCommentOperations(e,t,i,n){let o=[];return qo.isEmpty(e)?o.push(_W.replace(new qo(e.startLineNumber,e.startColumn,e.endLineNumber,e.endColumn),t+" "+i)):(o.push(_W.insert(new er(e.startLineNumber,e.startColumn),t+(n?" ":""))),o.push(_W.insert(new er(e.endLineNumber,e.endColumn),(n?" ":"")+i))),o}getEditOperations(e,t){const i=this._selection.startLineNumber,n=this._selection.startColumn;e.tokenizeIfCheap(i);const o=e.getLanguageIdAtPosition(i,n),s=this.languageConfigurationService.getLanguageConfiguration(o).comments;s&&s.blockCommentStartToken&&s.blockCommentEndToken&&this._createOperationsForBlockComment(this._selection,s.blockCommentStartToken,s.blockCommentEndToken,this._insertSpace,e,t)}computeCursorState(e,t){const i=t.getInverseEditOperations();if(2===i.length){const e=i[0],t=i[1];return new ar(e.range.endLineNumber,e.range.endColumn,t.range.startLineNumber,t.range.startColumn)}{const e=i[0].range,t=this._usedEndToken?-this._usedEndToken.length-1:0;return new ar(e.endLineNumber,e.endColumn+t,e.endLineNumber,e.endColumn+t)}}}class y4{constructor(e,t,i,n,o,s,r){this.languageConfigurationService=e,this._selection=t,this._tabSize=i,this._type=n,this._insertSpace=o,this._selectionId=null,this._deltaColumn=0,this._moveEndPositionDown=!1,this._ignoreEmptyLines=s,this._ignoreFirstLine=r||!1}static _gatherPreflightCommentStrings(e,t,i,n){e.tokenizeIfCheap(t);const o=e.getLanguageIdAtPosition(t,1),s=n.getLanguageConfiguration(o).comments,r=s?s.lineCommentToken:null;if(!r)return null;let a=[];for(let l=0,d=i-t+1;l<d;l++)a[l]={ignore:!1,commentStr:r,commentStrOffset:0,commentStrLength:r.length};return a}static _analyzeLines(e,t,i,n,o,s,r,a){let l,d=!0;l=0===e||1!==e;for(let c=0,h=n.length;c<h;c++){const a=n[c],h=o+c;if(h===o&&r){a.ignore=!0;continue}const u=i.getLineContent(h),g=xs(u);if(-1!==g){if(d=!1,a.ignore=!1,a.commentStrOffset=g,l&&!C4._haystackHasNeedleAtOffset(u,a.commentStr,g)&&(0===e?l=!1:1===e||(a.ignore=!0)),l&&t){const e=g+a.commentStrLength;e<u.length&&32===u.charCodeAt(e)&&(a.commentStrLength+=1)}}else a.ignore=s,a.commentStrOffset=u.length}if(0===e&&d){l=!1;for(let e=0,t=n.length;e<t;e++)n[e].ignore=!1}return{supported:!0,shouldRemoveComments:l,lines:n}}static _gatherPreflightData(e,t,i,n,o,s,r,a){const l=y4._gatherPreflightCommentStrings(i,n,o,a);return null===l?{supported:!1}:y4._analyzeLines(e,t,i,l,n,s,r,a)}_executeLineComments(e,t,i,n){let o;i.shouldRemoveComments?o=y4._createRemoveLineCommentsOperations(i.lines,n.startLineNumber):(y4._normalizeInsertionPoint(e,i.lines,n.startLineNumber,this._tabSize),o=this._createAddLineCommentsOperations(i.lines,n.startLineNumber));const s=new er(n.positionLineNumber,n.positionColumn);for(let r=0,a=o.length;r<a;r++)if(t.addEditOperation(o[r].range,o[r].text),qo.isEmpty(o[r].range)&&qo.getStartPosition(o[r].range).equals(s)){e.getLineContent(s.lineNumber).length+1===s.column&&(this._deltaColumn=(o[r].text||"").length)}this._selectionId=t.trackSelection(n)}_attemptRemoveBlockComment(e,t,i,n){let o=t.startLineNumber,s=t.endLineNumber,r=n.length+Math.max(e.getLineFirstNonWhitespaceColumn(t.startLineNumber),t.startColumn),a=e.getLineContent(o).lastIndexOf(i,r-1),l=e.getLineContent(s).indexOf(n,t.endColumn-1-i.length);return-1!==a&&-1===l&&(l=e.getLineContent(o).indexOf(n,a+i.length),s=o),-1===a&&-1!==l&&(a=e.getLineContent(s).lastIndexOf(i,l),o=s),!t.isEmpty()||-1!==a&&-1!==l||(a=e.getLineContent(o).indexOf(i),-1!==a&&(l=e.getLineContent(o).indexOf(n,a+i.length))),-1!==a&&32===e.getLineContent(o).charCodeAt(a+i.length)&&(i+=" "),-1!==l&&32===e.getLineContent(s).charCodeAt(l-1)&&(n=" "+n,l-=1),-1!==a&&-1!==l?C4._createRemoveBlockCommentOperations(new qo(o,a+i.length+1,s,l+1),i,n):null}_executeBlockComment(e,t,i){e.tokenizeIfCheap(i.startLineNumber);let n=e.getLanguageIdAtPosition(i.startLineNumber,1),o=Wv.getComments(n);if(!o||!o.blockCommentStartToken||!o.blockCommentEndToken)return;const s=o.blockCommentStartToken,r=o.blockCommentEndToken;let a=this._attemptRemoveBlockComment(e,i,s,r);if(!a){if(i.isEmpty()){const t=e.getLineContent(i.startLineNumber);let n=xs(t);-1===n&&(n=t.length),a=C4._createAddBlockCommentOperations(new qo(i.startLineNumber,n+1,i.startLineNumber,t.length+1),s,r,this._insertSpace)}else a=C4._createAddBlockCommentOperations(new qo(i.startLineNumber,e.getLineFirstNonWhitespaceColumn(i.startLineNumber),i.endLineNumber,e.getLineMaxColumn(i.endLineNumber)),s,r,this._insertSpace);1===a.length&&(this._deltaColumn=s.length+1)}this._selectionId=t.trackSelection(i);for(const l of a)t.addEditOperation(l.range,l.text)}getEditOperations(e,t){let i=this._selection;if(this._moveEndPositionDown=!1,i.startLineNumber===i.endLineNumber&&this._ignoreFirstLine)return t.addEditOperation(new qo(i.startLineNumber,e.getLineMaxColumn(i.startLineNumber),i.startLineNumber+1,1),i.startLineNumber===e.getLineCount()?"":"\n"),void(this._selectionId=t.trackSelection(i));i.startLineNumber<i.endLineNumber&&1===i.endColumn&&(this._moveEndPositionDown=!0,i=i.setEndPosition(i.endLineNumber-1,e.getLineMaxColumn(i.endLineNumber-1)));const n=y4._gatherPreflightData(this._type,this._insertSpace,e,i.startLineNumber,i.endLineNumber,this._ignoreEmptyLines,this._ignoreFirstLine,this.languageConfigurationService);return n.supported?this._executeLineComments(e,t,n,i):this._executeBlockComment(e,t,i)}computeCursorState(e,t){let i=t.getTrackedSelection(this._selectionId);return this._moveEndPositionDown&&(i=i.setEndPosition(i.endLineNumber+1,1)),new ar(i.selectionStartLineNumber,i.selectionStartColumn+this._deltaColumn,i.positionLineNumber,i.positionColumn+this._deltaColumn)}static _createRemoveLineCommentsOperations(e,t){let i=[];for(let n=0,o=e.length;n<o;n++){const o=e[n];o.ignore||i.push(_W.delete(new qo(t+n,o.commentStrOffset+1,t+n,o.commentStrOffset+o.commentStrLength+1)))}return i}_createAddLineCommentsOperations(e,t){let i=[];const n=this._insertSpace?" ":"";for(let o=0,s=e.length;o<s;o++){const s=e[o];s.ignore||i.push(_W.insert(new er(t+o,s.commentStrOffset+1),s.commentStr+n))}return i}static nextVisibleColumn(e,t,i,n){return i?e+(t-e%t):e+n}static _normalizeInsertionPoint(e,t,i,n){let o,s,r=1073741824;for(let a=0,l=t.length;a<l;a++){if(t[a].ignore)continue;const o=e.getLineContent(i+a);let s=0;for(let e=0,i=t[a].commentStrOffset;s<r&&e<i;e++)s=y4.nextVisibleColumn(s,n,9===o.charCodeAt(e),1);s<r&&(r=s)}r=Math.floor(r/n)*n;for(let a=0,l=t.length;a<l;a++){if(t[a].ignore)continue;const l=e.getLineContent(i+a);let d=0;for(o=0,s=t[a].commentStrOffset;d<r&&o<s;o++)d=y4.nextVisibleColumn(d,n,9===l.charCodeAt(o),1);t[a].commentStrOffset=d>r?o-1:o}}}class x4 extends xx{constructor(e,t){super(t),this._type=e}run(e,t){const i=e.get(Rv);if(!t.hasModel())return;const n=[],o=t.getModel().getOptions(),s=t.getOption(19),r=t.getSelections().map(((e,t)=>({selection:e,index:t,ignoreFirstLine:!1})));r.sort(((e,t)=>qo.compareRangesUsingStarts(e.selection,t.selection)));let a=r[0];for(let l=1;l<r.length;l++){const e=r[l];a.selection.endLineNumber===e.selection.startLineNumber&&(a.index<e.index?e.ignoreFirstLine=!0:(a.ignoreFirstLine=!0,a=e))}for(const l of r)n.push(new y4(i,l.selection,o.tabSize,this._type,s.insertSpace,s.ignoreEmptyLines,l.ignoreFirstLine));t.pushUndoStop(),t.executeCommands(this.id,n),t.pushUndoStop()}}Lx(class extends x4{constructor(){super(0,{id:"editor.action.commentLine",label:mf(0,"Toggle Line Comment"),alias:"Toggle Line Comment",precondition:yI.writable,kbOpts:{kbExpr:yI.editorTextFocus,primary:2133,weight:100},menuOpts:{menuId:cx.MenubarEditMenu,group:"5_insert",title:mf(0,"&&Toggle Line Comment"),order:1}})}}),Lx(class extends x4{constructor(){super(1,{id:"editor.action.addCommentLine",label:mf(0,"Add Line Comment"),alias:"Add Line Comment",precondition:yI.writable,kbOpts:{kbExpr:yI.editorTextFocus,primary:Ol(2089,2081),weight:100}})}}),Lx(class extends x4{constructor(){super(2,{id:"editor.action.removeCommentLine",label:mf(0,"Remove Line Comment"),alias:"Remove Line Comment",precondition:yI.writable,kbOpts:{kbExpr:yI.editorTextFocus,primary:Ol(2089,2099),weight:100}})}}),Lx(class extends xx{constructor(){super({id:"editor.action.blockComment",label:mf(0,"Toggle Block Comment"),alias:"Toggle Block Comment",precondition:yI.writable,kbOpts:{kbExpr:yI.editorTextFocus,primary:1567,linux:{primary:3103},weight:100},menuOpts:{menuId:cx.MenubarEditMenu,group:"5_insert",title:mf(0,"Toggle &&Block Comment"),order:2}})}run(e,t){const i=e.get(Rv);if(!t.hasModel())return;const n=t.getOption(19),o=[],s=t.getSelections();for(const r of s)o.push(new C4(r,n.insertSpace,i));t.pushUndoStop(),t.executeCommands(this.id,o),t.pushUndoStop()}});var S4=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},k4=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};let D4=class e{constructor(e,t,i,n,o,s){this._contextMenuService=t,this._contextViewService=i,this._contextKeyService=n,this._keybindingService=o,this._menuService=s,this._toDispose=new ws,this._contextMenuIsBeingShownCount=0,this._editor=e,this._toDispose.add(this._editor.onContextMenu((e=>this._onContextMenu(e)))),this._toDispose.add(this._editor.onMouseWheel((e=>{if(this._contextMenuIsBeingShownCount>0){const t=this._contextViewService.getContextViewElement(),i=e.srcElement;i.shadowRoot&&AC(t)===i.shadowRoot||this._contextViewService.hideContextView()}}))),this._toDispose.add(this._editor.onKeyDown((e=>{58===e.keyCode&&(e.preventDefault(),e.stopPropagation(),this.showContextMenu())})))}static get(t){return t.getContribution(e.ID)}_onContextMenu(e){if(!this._editor.hasModel())return;if(!this._editor.getOption(20))return this._editor.focus(),void(e.target.position&&!this._editor.getSelection().containsPosition(e.target.position)&&this._editor.setPosition(e.target.position));if(12===e.target.type)return;if(6===e.target.type&&e.target.detail.injectedText)return;if(e.event.preventDefault(),e.event.stopPropagation(),6!==e.target.type&&7!==e.target.type&&1!==e.target.type)return;if(this._editor.focus(),e.target.position){let t=!1;for(const i of this._editor.getSelections())if(i.containsPosition(e.target.position)){t=!0;break}t||this._editor.setPosition(e.target.position)}let t=null;1!==e.target.type&&(t={x:e.event.posx-1,width:2,y:e.event.posy-1,height:2}),this.showContextMenu(t)}showContextMenu(e){if(!this._editor.getOption(20))return;if(!this._editor.hasModel())return;if(!this._contextMenuService)return void this._editor.focus();const t=this._getMenuActions(this._editor.getModel(),this._editor.isSimpleWidget?cx.SimpleEditorContext:cx.EditorContext);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(let s of o){const[,t]=s;let n=0;for(const o of t)if(o instanceof gx){const t=this._getMenuActions(e,o.item.submenu);t.length>0&&(i.push(new vy(o.id,o.label,t)),n++)}else i.push(o),n++;n&&i.push(new _y)}return i.length&&i.pop(),i}_doShowContextMenu(e,t=null){if(!this._editor.hasModel())return;const i=this._editor.getOption(53);if(this._editor.updateOptions({hover:{enabled:!1}}),!t){this._editor.revealPosition(this._editor.getPosition(),1),this._editor.render();const e=this._editor.getScrolledVisiblePosition(this._editor.getPosition()),i=yC(this._editor.getDomNode()),n=i.left+e.left,o=i.top+e.top+e.height;t={x:n,y:o}}const n=this._editor.getOption(115)&&!Vs;this._contextMenuIsBeingShownCount++,this._contextMenuService.showContextMenu({domForShadowRoot:n?this._editor.getDomNode():void 0,getAnchor:()=>t,getActions:()=>e,getActionViewItem:e=>{const t=this._keybindingFor(e);if(t)return new fB(e,e,{label:!0,keybinding:t.getLabel(),isMenu:!0});const i=e;return"function"==typeof i.getActionViewItem?i.getActionViewItem():new fB(e,e,{icon:!0,label:!0,isMenu:!0})},getKeyBinding:e=>this._keybindingFor(e),onHide:e=>{this._contextMenuIsBeingShownCount--,this._editor.focus(),this._editor.updateOptions({hover:i})}})}_keybindingFor(e){return this._keybindingService.lookupKeybinding(e.id)}dispose(){this._contextMenuIsBeingShownCount>0&&this._contextViewService.hideContextView(),this._toDispose.dispose()}};D4.ID="editor.contrib.contextmenu",D4=S4([k4(1,WB),k4(2,VB),k4(3,$y),k4(4,kW),k4(5,hx)],D4);Ix(D4.ID,D4),Lx(class extends xx{constructor(){super({id:"editor.action.showContextMenu",label:mf(0,"Show Editor Context Menu"),alias:"Show Editor Context Menu",precondition:void 0,kbOpts:{kbExpr:yI.textInputFocus,primary:1092,weight:100}})}run(e,t){var i;null===(i=D4.get(t))||void 0===i||i.showContextMenu()}});class L4{constructor(e){this.selections=e}equals(e){const t=this.selections.length;if(t!==e.selections.length)return!1;for(let i=0;i<t;i++)if(!this.selections[i].equalsSelection(e.selections[i]))return!1;return!0}}class N4{constructor(e,t,i){this.cursorState=e,this.scrollTop=t,this.scrollLeft=i}}class E4 extends Uo{constructor(e){super(),this._editor=e,this._isCursorUndoRedo=!1,this._undoStack=[],this._redoStack=[],this._register(e.onDidChangeModel((e=>{this._undoStack=[],this._redoStack=[]}))),this._register(e.onDidChangeModelContent((e=>{this._undoStack=[],this._redoStack=[]}))),this._register(e.onDidChangeCursorSelection((t=>{if(this._isCursorUndoRedo)return;if(!t.oldSelections)return;if(t.oldModelVersionId!==t.modelVersionId)return;const i=new L4(t.oldSelections);this._undoStack.length>0&&this._undoStack[this._undoStack.length-1].cursorState.equals(i)||(this._undoStack.push(new N4(i,e.getScrollTop(),e.getScrollLeft())),this._redoStack=[],this._undoStack.length>50&&this._undoStack.shift())})))}static get(e){return e.getContribution(E4.ID)}cursorUndo(){this._editor.hasModel()&&0!==this._undoStack.length&&(this._redoStack.push(new N4(new L4(this._editor.getSelections()),this._editor.getScrollTop(),this._editor.getScrollLeft())),this._applyState(this._undoStack.pop()))}cursorRedo(){this._editor.hasModel()&&0!==this._redoStack.length&&(this._undoStack.push(new N4(new L4(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}}E4.ID="editor.contrib.cursorUndoRedoController";Ix(E4.ID,E4),Lx(class extends xx{constructor(){super({id:"cursorUndo",label:mf(0,"Cursor Undo"),alias:"Cursor Undo",precondition:void 0,kbOpts:{kbExpr:yI.textInputFocus,primary:2099,weight:100}})}run(e,t,i){var n;null===(n=E4.get(t))||void 0===n||n.cursorUndo()}}),Lx(class extends xx{constructor(){super({id:"cursorRedo",label:mf(0,"Cursor Redo"),alias:"Cursor Redo",precondition:void 0})}run(e,t,i){var n;null===(n=E4.get(t))||void 0===n||n.cursorRedo()}});class I4{constructor(e,t,i){this.selection=e,this.targetPosition=t,this.copy=i,this.targetSelection=null}getEditOperations(e,t){let i=e.getValueInRange(this.selection);this.copy||t.addEditOperation(this.selection,null),t.addEditOperation(new qo(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.copy?this.targetSelection=new ar(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):this.targetPosition.lineNumber>this.selection.endLineNumber?this.targetSelection=new ar(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):this.targetPosition.lineNumber<this.selection.endLineNumber?this.targetSelection=new ar(this.targetPosition.lineNumber,this.targetPosition.column,this.targetPosition.lineNumber+this.selection.endLineNumber-this.selection.startLineNumber,this.selection.startLineNumber===this.selection.endLineNumber?this.targetPosition.column+this.selection.endColumn-this.selection.startColumn:this.selection.endColumn):this.selection.endColumn<=this.targetPosition.column?this.targetSelection=new ar(this.targetPosition.lineNumber-this.selection.endLineNumber+this.selection.startLineNumber,(this.selection.startLineNumber,this.selection.endLineNumber,this.targetPosition.column-this.selection.endColumn+this.selection.startColumn),this.targetPosition.lineNumber,this.selection.startLineNumber===this.selection.endLineNumber?this.targetPosition.column:this.selection.endColumn):this.targetSelection=new ar(this.targetPosition.lineNumber-this.selection.endLineNumber+this.selection.startLineNumber,this.targetPosition.column,this.targetPosition.lineNumber,this.targetPosition.column+this.selection.endColumn-this.selection.startColumn):this.targetSelection=this.selection}computeCursorState(e,t){return this.targetSelection}}function T4(e){return zo?e.altKey:e.ctrlKey}class M4 extends Uo{constructor(e){super(),this._editor=e,this._register(this._editor.onMouseDown((e=>this._onEditorMouseDown(e)))),this._register(this._editor.onMouseUp((e=>this._onEditorMouseUp(e)))),this._register(this._editor.onMouseDrag((e=>this._onEditorMouseDrag(e)))),this._register(this._editor.onMouseDrop((e=>this._onEditorMouseDrop(e)))),this._register(this._editor.onMouseDropCanceled((()=>this._onEditorMouseDropCanceled()))),this._register(this._editor.onKeyDown((e=>this.onEditorKeyDown(e)))),this._register(this._editor.onKeyUp((e=>this.onEditorKeyUp(e)))),this._register(this._editor.onDidBlurEditorWidget((()=>this.onEditorBlur()))),this._register(this._editor.onDidBlurEditorText((()=>this.onEditorBlur()))),this._dndDecorationIds=[],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(31)&&!this._editor.getOption(18)&&(T4(e)&&(this._modifierPressed=!0),this._mouseDown&&T4(e)&&this._editor.updateOptions({mouseStyle:"copy"}))}onEditorKeyUp(e){this._editor.getOption(31)&&!this._editor.getOption(18)&&(T4(e)&&(this._modifierPressed=!1),this._mouseDown&&e.keyCode===M4.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){let t=e.target;if(null===this._dragSelection){let e=(this._editor.getSelections()||[]).filter((e=>t.position&&e.containsPosition(t.position)));if(1!==e.length)return;this._dragSelection=e[0]}T4(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){let t=new er(e.target.position.lineNumber,e.target.position.column);if(null===this._dragSelection){let i=null;if(e.event.shiftKey){let e=this._editor.getSelection();if(e){const{selectionStartLineNumber:n,selectionStartColumn:o}=e;i=[new ar(n,o,t.lineNumber,t.column)]}}else i=(this._editor.getSelections()||[]).map((e=>e.containsPosition(t)?new ar(t.lineNumber,t.column,t.lineNumber,t.column):e));this._editor.setSelections(i||[],"mouse",3)}else(!this._dragSelection.containsPosition(t)||(T4(e.event)||this._modifierPressed)&&(this._dragSelection.getEndPosition().equals(t)||this._dragSelection.getStartPosition().equals(t)))&&(this._editor.pushUndoStop(),this._editor.executeCommand(M4.ID,new I4(this._dragSelection,t,T4(e.event)||this._modifierPressed)),this._editor.pushUndoStop())}this._editor.updateOptions({mouseStyle:"text"}),this._removeDecoration(),this._dragSelection=null,this._mouseDown=!1}showAt(e){let t=[{range:new qo(e.lineNumber,e.column,e.lineNumber,e.column),options:M4._DECORATION_OPTIONS}];this._dndDecorationIds=this._editor.deltaDecorations(this._dndDecorationIds,t),this._editor.revealPosition(e,1)}_removeDecoration(){this._dndDecorationIds=this._editor.deltaDecorations(this._dndDecorationIds,[])}_hitContent(e){return 6===e.type||7===e.type}_hitMargin(e){return 2===e.type||3===e.type||4===e.type}dispose(){this._removeDecoration(),this._dragSelection=null,this._mouseDown=!1,this._modifierPressed=!1,super.dispose()}}M4.ID="editor.contrib.dragAndDrop",M4.TRIGGER_KEY_VALUE=zo?6:5,M4._DECORATION_OPTIONS=GP.register({description:"dnd-target",className:"dnd-target"}),Ix(M4.ID,M4);class A4{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.deltaDecorations(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((e=>this._editor.getModel().getDecorationRange(e))).filter((e=>!!e));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}getCurrentMatchesPosition(e){let t=this._editor.getModel().getDecorationsInRange(e);for(const i of t){const e=i.options;if(e===A4._FIND_MATCH_DECORATION||e===A4._CURRENT_FIND_MATCH_DECORATION)return this._getDecorationIndex(i.id)}return 0}setCurrentFindMatch(e){let t=null,i=0;if(e)for(let n=0,o=this._decorations.length;n<o;n++){let o=this._editor.getModel().getDecorationRange(this._decorations[n]);if(e.equalsRange(o)){t=this._decorations[n],i=n+1;break}}return null===this._highlightedDecorationId&&null===t||this._editor.changeDecorations((e=>{if(null!==this._highlightedDecorationId&&(e.changeDecorationOptions(this._highlightedDecorationId,A4._FIND_MATCH_DECORATION),this._highlightedDecorationId=null),null!==t&&(this._highlightedDecorationId=t,e.changeDecorationOptions(this._highlightedDecorationId,A4._CURRENT_FIND_MATCH_DECORATION)),null!==this._rangeHighlightDecorationId&&(e.removeDecoration(this._rangeHighlightDecorationId),this._rangeHighlightDecorationId=null),null!==t){let i=this._editor.getModel().getDecorationRange(t);if(i.startLineNumber!==i.endLineNumber&&1===i.endColumn){let e=i.endLineNumber-1,t=this._editor.getModel().getLineMaxColumn(e);i=new qo(i.startLineNumber,i.startColumn,e,t)}this._rangeHighlightDecorationId=e.addDecoration(i,A4._RANGE_HIGHLIGHT_DECORATION)}})),i}set(e,t){this._editor.changeDecorations((i=>{let n=A4._FIND_MATCH_DECORATION,o=[];if(e.length>1e3){n=A4._FIND_MATCH_NO_OVERVIEW_DECORATION;const t=this._editor.getModel().getLineCount(),i=this._editor.getLayoutInfo().height/t,s=Math.max(2,Math.ceil(3/i));let r=e[0].range.startLineNumber,a=e[0].range.endLineNumber;for(let n=1,l=e.length;n<l;n++){const t=e[n].range;a+s>=t.startLineNumber?t.endLineNumber>a&&(a=t.endLineNumber):(o.push({range:new qo(r,1,a,1),options:A4._FIND_MATCH_ONLY_OVERVIEW_DECORATION}),r=t.startLineNumber,a=t.endLineNumber)}o.push({range:new qo(r,1,a,1),options:A4._FIND_MATCH_ONLY_OVERVIEW_DECORATION})}let s=new Array(e.length);for(let t=0,r=e.length;t<r;t++)s[t]={range:e[t].range,options:n};this._decorations=i.deltaDecorations(this._decorations,s),this._overviewRulerApproximateDecorations=i.deltaDecorations(this._overviewRulerApproximateDecorations,o),this._rangeHighlightDecorationId&&(i.removeDecoration(this._rangeHighlightDecorationId),this._rangeHighlightDecorationId=null),this._findScopeDecorationIds.length&&(this._findScopeDecorationIds.forEach((e=>i.removeDecoration(e))),this._findScopeDecorationIds=[]),(null==t?void 0:t.length)&&(this._findScopeDecorationIds=t.map((e=>i.addDecoration(e,A4._FIND_SCOPE_DECORATION))))}))}matchBeforePosition(e){if(0===this._decorations.length)return null;for(let t=this._decorations.length-1;t>=0;t--){let i=this._decorations[t],n=this._editor.getModel().getDecorationRange(i);if(n&&!(n.endLineNumber>e.lineNumber)){if(n.endLineNumber<e.lineNumber)return n;if(!(n.endColumn>e.column))return n}}return this._editor.getModel().getDecorationRange(this._decorations[this._decorations.length-1])}matchAfterPosition(e){if(0===this._decorations.length)return null;for(let t=0,i=this._decorations.length;t<i;t++){let i=this._decorations[t],n=this._editor.getModel().getDecorationRange(i);if(n&&!(n.startLineNumber<e.lineNumber)){if(n.startLineNumber>e.lineNumber)return n;if(!(n.startColumn<e.column))return n}}return this._editor.getModel().getDecorationRange(this._decorations[0])}_allDecorations(){let e=[];return e=e.concat(this._decorations),e=e.concat(this._overviewRulerApproximateDecorations),this._findScopeDecorationIds.length&&e.push(...this._findScopeDecorationIds),this._rangeHighlightDecorationId&&e.push(this._rangeHighlightDecorationId),e}}A4._CURRENT_FIND_MATCH_DECORATION=GP.register({description:"current-find-match",stickiness:1,zIndex:13,className:"currentFindMatch",showIfCollapsed:!0,overviewRuler:{color:tx(sL),position:aa.Center},minimap:{color:tx(aL),position:Dr.Inline}}),A4._FIND_MATCH_DECORATION=GP.register({description:"find-match",stickiness:1,zIndex:10,className:"findMatch",showIfCollapsed:!0,overviewRuler:{color:tx(sL),position:aa.Center},minimap:{color:tx(aL),position:Dr.Inline}}),A4._FIND_MATCH_NO_OVERVIEW_DECORATION=GP.register({description:"find-match-no-overview",stickiness:1,className:"findMatch",showIfCollapsed:!0}),A4._FIND_MATCH_ONLY_OVERVIEW_DECORATION=GP.register({description:"find-match-only-overview",stickiness:1,overviewRuler:{color:tx(sL),position:aa.Center}}),A4._RANGE_HIGHLIGHT_DECORATION=GP.register({description:"find-range-highlight",stickiness:1,className:"rangeHighlight",isWholeLine:!0}),A4._FIND_SCOPE_DECORATION=GP.register({description:"find-scope",className:"findScope",isWholeLine:!0});class O4{constructor(e,t,i){this._editorSelection=e,this._ranges=t,this._replaceStrings=i,this._trackedEditorSelectionId=null}getEditOperations(e,t){if(this._ranges.length>0){let e=[];for(let t=0;t<this._ranges.length;t++)e.push({range:this._ranges[t],text:this._replaceStrings[t]});e.sort(((e,t)=>qo.compareRangesUsingStarts(e.range,t.range)));let i=[],n=e[0];for(let t=1;t<e.length;t++)n.range.endLineNumber===e[t].range.startLineNumber&&n.range.endColumn===e[t].range.startColumn?(n.range=n.range.plusRange(e[t].range),n.text=n.text+e[t].text):(i.push(n),n=e[t]);i.push(n);for(const o of i)t.addEditOperation(o.range,o.text)}this._trackedEditorSelectionId=t.trackSelection(this._editorSelection)}computeCursorState(e,t){return t.getTrackedSelection(this._trackedEditorSelectionId)}}function R4(e,t){if(e&&""!==e[0]){const i=P4(e,t,"-"),n=P4(e,t,"_");return i&&!n?F4(e,t,"-"):!i&&n?F4(e,t,"_"):e[0].toUpperCase()===e[0]?t.toUpperCase():e[0].toLowerCase()===e[0]?t.toLowerCase():Wl(e[0][0])&&t.length>0?t[0].toUpperCase()+t.substr(1):e[0][0].toUpperCase()!==e[0][0]&&t.length>0?t[0].toLowerCase()+t.substr(1):t}return t}function P4(e,t,i){return-1!==e[0].indexOf(i)&&-1!==t.indexOf(i)&&e[0].split(i).length===t.split(i).length}function F4(e,t,i){const n=t.split(i),o=e[0].split(i);let s="";return n.forEach(((e,t)=>{s+=R4([o[t]],e)+i})),s.slice(0,-1)}class B4{constructor(e){this.staticValue=e,this.kind=0}}class V4{constructor(e){this.pieces=e,this.kind=1}}class W4{constructor(e){e&&0!==e.length?1===e.length&&null!==e[0].staticValue?this._state=new B4(e[0].staticValue):this._state=new V4(e):this._state=new B4("")}static fromStaticValue(e){return new W4([z4.staticValue(e)])}get hasReplacementPatterns(){return 1===this._state.kind}buildReplaceString(e,t){if(0===this._state.kind)return t?R4(e,this._state.staticValue):this._state.staticValue;let i="";for(let n=0,o=this._state.pieces.length;n<o;n++){let t=this._state.pieces[n];if(null!==t.staticValue){i+=t.staticValue;continue}let o=W4._substitute(t.matchIndex,e);if(null!==t.caseOps&&t.caseOps.length>0){let e=[],i=t.caseOps.length,n=0;for(let s=0,r=o.length;s<r;s++){if(n>=i){e.push(o.slice(s));break}switch(t.caseOps[n]){case"U":e.push(o[s].toUpperCase());break;case"u":e.push(o[s].toUpperCase()),n++;break;case"L":e.push(o[s].toLowerCase());break;case"l":e.push(o[s].toLowerCase()),n++;break;default:e.push(o[s])}}o=e.join("")}i+=o}return i}static _substitute(e,t){if(null===t)return"";if(0===e)return t[0];let i="";for(;e>0;){if(e<t.length){return(t[e]||"")+i}i=String(e%10)+i,e=Math.floor(e/10)}return"$"+i}}class z4{constructor(e,t,i){this.staticValue=e,this.matchIndex=t,i&&0!==i.length?this.caseOps=i.slice(0):this.caseOps=null}static staticValue(e){return new z4(e,-1,null)}static caseOps(e,t){return new z4(null,e,t)}}class H4{constructor(e){this._source=e,this._lastCharIndex=0,this._result=[],this._resultLen=0,this._currentStaticPiece=""}emitUnchanged(e){this._emitStatic(this._source.substring(this._lastCharIndex,e)),this._lastCharIndex=e}emitStatic(e,t){this._emitStatic(e),this._lastCharIndex=t}_emitStatic(e){0!==e.length&&(this._currentStaticPiece+=e)}emitMatchIndex(e,t,i){0!==this._currentStaticPiece.length&&(this._result[this._resultLen++]=z4.staticValue(this._currentStaticPiece),this._currentStaticPiece=""),this._result[this._resultLen++]=z4.caseOps(e,i),this._lastCharIndex=t}finalize(){return this.emitUnchanged(this._source.length),0!==this._currentStaticPiece.length&&(this._result[this._resultLen++]=z4.staticValue(this._currentStaticPiece),this._currentStaticPiece=""),new W4(this._result)}}const j4=new Uy("findWidgetVisible",!1);j4.toNegated();const U4=new Uy("findInputFocussed",!1),$4=new Uy("replaceInputFocussed",!1),K4={primary:545,mac:{primary:2593}},q4={primary:565,mac:{primary:2613}},G4={primary:560,mac:{primary:2608}},Z4={primary:554,mac:{primary:2602}},Y4={primary:558,mac:{primary:2606}},X4="actions.find",Q4="actions.findWithSelection",J4="editor.actions.findWithArgs",e8="editor.action.nextMatchFindAction",t8="editor.action.previousMatchFindAction",i8="editor.action.nextSelectionMatchFindAction",n8="editor.action.previousSelectionMatchFindAction",o8="editor.action.startFindReplaceAction",s8="closeFindWidget",r8="toggleFindCaseSensitive",a8="toggleFindWholeWord",l8="toggleFindRegex",d8="toggleFindInSelection",c8="togglePreserveCase",h8="editor.action.replaceOne",u8="editor.action.replaceAll",g8="editor.action.selectAllMatches",p8=19999;class m8{constructor(e,t){this._toDispose=new ws,this._editor=e,this._state=t,this._isDisposed=!1,this._startSearchingTimer=new rb,this._decorations=new A4(e),this._toDispose.add(this._decorations),this._updateDecorationsScheduler=new lb((()=>this.research(!1)),100),this._toDispose.add(this._updateDecorationsScheduler),this._toDispose.add(this._editor.onDidChangeCursorPosition((e=>{3!==e.reason&&5!==e.reason&&6!==e.reason||this._decorations.setStartPosition(this._editor.getPosition())}))),this._ignoreModelContentChanged=!1,this._toDispose.add(this._editor.onDidChangeModelContent((e=>{this._ignoreModelContentChanged||(e.isFlush&&this._decorations.reset(),this._decorations.setStartPosition(this._editor.getPosition()),this._updateDecorationsScheduler.schedule())}))),this._toDispose.add(this._state.onFindReplaceStateChange((e=>this._onStateChanged(e)))),this.research(!1,this._state.searchScope)}dispose(){this._isDisposed=!0,bs(this._startSearchingTimer),this._toDispose.dispose()}_onStateChanged(e){if(!this._isDisposed&&this._editor.hasModel()&&(e.searchString||e.isReplaceRevealed||e.isRegex||e.wholeWord||e.matchCase||e.searchScope)){this._editor.getModel().isTooLargeForSyncing()?(this._startSearchingTimer.cancel(),this._startSearchingTimer.setIfNotSet((()=>{e.searchScope?this.research(e.moveCursor,this._state.searchScope):this.research(e.moveCursor)}),240)):e.searchScope?this.research(e.moveCursor,this._state.searchScope):this.research(e.moveCursor)}}static _getSearchRange(e,t){return t||e.getFullModelRange()}research(e,t){let i=null;void 0!==t?null!==t&&(i=Array.isArray(t)?t:[t]):i=this._decorations.getFindScopes(),null!==i&&(i=i.map((e=>{if(e.startLineNumber!==e.endLineNumber){let t=e.endLineNumber;return 1===e.endColumn&&(t-=1),new qo(e.startLineNumber,1,t,this._editor.getModel().getLineMaxColumn(t))}return e})));let n=this._findMatches(i,!1,p8);this._decorations.set(n,i);const o=this._editor.getSelection();let s=this._decorations.getCurrentMatchesPosition(o);if(0===s&&n.length>0){const e=zl(n.map((e=>e.range)),(e=>qo.compareRangesUsingStarts(e,o)>=0));s=e>0?e-1+1:s}this._state.changeMatchInfo(s,this._decorations.getCount(),void 0),e&&this._editor.getOption(35).cursorMoveOnType&&this._moveToNextMatch(this._decorations.getStartPosition())}_hasMatches(){return this._state.matchesCount>0}_cannotFind(){if(!this._hasMatches()){let e=this._decorations.getFindScope();return e&&this._editor.revealRangeInCenterIfOutsideViewport(e,0),!0}return!1}_setCurrentFindMatch(e){let t=this._decorations.setCurrentFindMatch(e);this._state.changeMatchInfo(t,this._decorations.getCount(),e),this._editor.setSelection(e),this._editor.revealRangeInCenterIfOutsideViewport(e,0)}_prevSearchPosition(e){let t=this._state.isRegex&&(this._state.searchString.indexOf("^")>=0||this._state.searchString.indexOf("$")>=0),{lineNumber:i,column:n}=e,o=this._editor.getModel();return t||1===n?(1===i?i=o.getLineCount():i--,n=o.getLineMaxColumn(i)):n--,new er(i,n)}_moveToPrevMatch(e,t=!1){if(!this._state.canNavigateBack()){const t=this._decorations.matchAfterPosition(e);return void(t&&this._setCurrentFindMatch(t))}if(this._decorations.getCount()<p8){let t=this._decorations.matchBeforePosition(e);return t&&t.isEmpty()&&t.getStartPosition().equals(e)&&(e=this._prevSearchPosition(e),t=this._decorations.matchBeforePosition(e)),void(t&&this._setCurrentFindMatch(t))}if(this._cannotFind())return;let i=this._decorations.getFindScope(),n=m8._getSearchRange(this._editor.getModel(),i);n.getEndPosition().isBefore(e)&&(e=n.getEndPosition()),e.isBefore(n.getStartPosition())&&(e=n.getEndPosition());let{lineNumber:o,column:s}=e,r=this._editor.getModel(),a=new er(o,s),l=r.findPreviousMatch(this._state.searchString,a,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(117):null,!1);return l&&l.range.isEmpty()&&l.range.getStartPosition().equals(a)&&(a=this._prevSearchPosition(a),l=r.findPreviousMatch(this._state.searchString,a,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(117):null,!1)),l?t||n.containsRange(l.range)?void this._setCurrentFindMatch(l.range):this._moveToPrevMatch(l.range.getStartPosition(),!0):void 0}moveToPrevMatch(){this._moveToPrevMatch(this._editor.getSelection().getStartPosition())}_nextSearchPosition(e){let t=this._state.isRegex&&(this._state.searchString.indexOf("^")>=0||this._state.searchString.indexOf("$")>=0),{lineNumber:i,column:n}=e,o=this._editor.getModel();return t||n===o.getLineMaxColumn(i)?(i===o.getLineCount()?i=1:i++,n=1):n++,new er(i,n)}_moveToNextMatch(e){if(!this._state.canNavigateForward()){const t=this._decorations.matchBeforePosition(e);return void(t&&this._setCurrentFindMatch(t))}if(this._decorations.getCount()<p8){let t=this._decorations.matchAfterPosition(e);return t&&t.isEmpty()&&t.getStartPosition().equals(e)&&(e=this._nextSearchPosition(e),t=this._decorations.matchAfterPosition(e)),void(t&&this._setCurrentFindMatch(t))}let t=this._getNextMatch(e,!1,!0);t&&this._setCurrentFindMatch(t.range)}_getNextMatch(e,t,i,n=!1){if(this._cannotFind())return null;let o=this._decorations.getFindScope(),s=m8._getSearchRange(this._editor.getModel(),o);s.getEndPosition().isBefore(e)&&(e=s.getStartPosition()),e.isBefore(s.getStartPosition())&&(e=s.getStartPosition());let{lineNumber:r,column:a}=e,l=this._editor.getModel(),d=new er(r,a),c=l.findNextMatch(this._state.searchString,d,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(117):null,t);return i&&c&&c.range.isEmpty()&&c.range.getStartPosition().equals(d)&&(d=this._nextSearchPosition(d),c=l.findNextMatch(this._state.searchString,d,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(117):null,t)),c?n||s.containsRange(c.range)?c:this._getNextMatch(c.range.getEndPosition(),t,i,!0):null}moveToNextMatch(){this._moveToNextMatch(this._editor.getSelection().getEndPosition())}_getReplacePattern(){return this._state.isRegex?function(e){if(!e||0===e.length)return new W4(null);let t=[],i=new H4(e);for(let n=0,o=e.length;n<o;n++){let s=e.charCodeAt(n);if(92!==s){if(36===s){if(n++,n>=o)break;let s=e.charCodeAt(n);if(36===s){i.emitUnchanged(n-1),i.emitStatic("$",n+1);continue}if(48===s||38===s){i.emitUnchanged(n-1),i.emitMatchIndex(0,n+1,t),t.length=0;continue}if(49<=s&&s<=57){let r=s-48;if(n+1<o){let o=e.charCodeAt(n+1);if(48<=o&&o<=57){n++,r=10*r+(o-48),i.emitUnchanged(n-2),i.emitMatchIndex(r,n+1,t),t.length=0;continue}}i.emitUnchanged(n-1),i.emitMatchIndex(r,n+1,t),t.length=0;continue}}}else{if(n++,n>=o)break;let s=e.charCodeAt(n);switch(s){case 92:i.emitUnchanged(n-1),i.emitStatic("\\",n+1);break;case 110:i.emitUnchanged(n-1),i.emitStatic("\n",n+1);break;case 116:i.emitUnchanged(n-1),i.emitStatic("\t",n+1);break;case 117:case 85:case 108:case 76:i.emitUnchanged(n-1),i.emitStatic("",n+1),t.push(String.fromCharCode(s))}}}return i.finalize()}(this._state.replaceString):W4.fromStaticValue(this._state.replaceString)}replace(){if(!this._hasMatches())return;let e=this._getReplacePattern(),t=this._editor.getSelection(),i=this._getNextMatch(t.getStartPosition(),!0,!1);if(i)if(t.equalsRange(i.range)){let n=e.buildReplaceString(i.matches,this._state.preserveCase),o=new JE(t,n);this._executeEditorCommand("replace",o),this._decorations.setStartPosition(new er(t.startLineNumber,t.startColumn+n.length)),this.research(!0)}else this._decorations.setStartPosition(this._editor.getPosition()),this._setCurrentFindMatch(i.range)}_findMatches(e,t,i){const n=(e||[null]).map((e=>m8._getSearchRange(this._editor.getModel(),e)));return this._editor.getModel().findMatches(this._state.searchString,n,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(117):null,t,i)}replaceAll(){if(!this._hasMatches())return;const e=this._decorations.getFindScopes();null===e&&this._state.matchesCount>=p8?this._largeReplaceAll():this._regularReplaceAll(e),this.research(!1)}_largeReplaceAll(){const e=new oa(this._state.searchString,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(117):null).parseSearchRequest();if(!e)return;let t=e.regex;if(!t.multiline){let e="mu";t.ignoreCase&&(e+="i"),t.global&&(e+="g"),t=new RegExp(t.source,e)}const i=this._editor.getModel(),n=i.getValue(1),o=i.getFullModelRange(),s=this._getReplacePattern();let r;const a=this._state.preserveCase;r=s.hasReplacementPatterns||a?n.replace(t,(function(){return s.buildReplaceString(arguments,a)})):n.replace(t,s.buildReplaceString(null,a));let l=new nI(o,r,this._editor.getSelection());this._executeEditorCommand("replaceAll",l)}_regularReplaceAll(e){const t=this._getReplacePattern();let i=this._findMatches(e,t.hasReplacementPatterns||this._state.preserveCase,1073741824),n=[];for(let s=0,r=i.length;s<r;s++)n[s]=t.buildReplaceString(i[s].matches,this._state.preserveCase);let o=new O4(this._editor.getSelection(),i.map((e=>e.range)),n);this._executeEditorCommand("replaceAll",o)}selectAllMatches(){if(!this._hasMatches())return;let e=this._decorations.getFindScopes(),t=this._findMatches(e,!1,1073741824).map((e=>new ar(e.range.startLineNumber,e.range.startColumn,e.range.endLineNumber,e.range.endColumn))),i=this._editor.getSelection();for(let n=0,o=t.length;n<o;n++){if(t[n].equalsRange(i)){t=[i].concat(t.slice(0,n)).concat(t.slice(n+1));break}}this._editor.setSelections(t)}_executeEditorCommand(e,t){try{this._ignoreModelContentChanged=!0,this._editor.pushUndoStop(),this._editor.executeCommand(e,t),this._editor.pushUndoStop()}finally{this._ignoreModelContentChanged=!1}}}class f8 extends QI{constructor(e,t,i,n){super(),this._hideSoon=this._register(new lb((()=>this._hide()),2e3)),this._isVisible=!1,this._editor=e,this._state=t,this._keybindingService=i,this._domNode=document.createElement("div"),this._domNode.className="findOptionsWidget",this._domNode.style.display="none",this._domNode.style.top="10px",this._domNode.setAttribute("role","presentation"),this._domNode.setAttribute("aria-hidden","true");const o=n.getColorTheme().getColor(TS),s=n.getColorTheme().getColor(AS),r=n.getColorTheme().getColor(MS);this.caseSensitive=this._register(new E2({appendTitle:this._keybindingLabelFor(r8),isChecked:this._state.matchCase,inputActiveOptionBorder:o,inputActiveOptionForeground:s,inputActiveOptionBackground:r})),this._domNode.appendChild(this.caseSensitive.domNode),this._register(this.caseSensitive.onChange((()=>{this._state.change({matchCase:this.caseSensitive.checked},!1)}))),this.wholeWords=this._register(new I2({appendTitle:this._keybindingLabelFor(a8),isChecked:this._state.wholeWord,inputActiveOptionBorder:o,inputActiveOptionForeground:s,inputActiveOptionBackground:r})),this._domNode.appendChild(this.wholeWords.domNode),this._register(this.wholeWords.onChange((()=>{this._state.change({wholeWord:this.wholeWords.checked},!1)}))),this.regex=this._register(new T2({appendTitle:this._keybindingLabelFor(l8),isChecked:this._state.isRegex,inputActiveOptionBorder:o,inputActiveOptionForeground:s,inputActiveOptionBackground:r})),this._domNode.appendChild(this.regex.domNode),this._register(this.regex.onChange((()=>{this._state.change({isRegex:this.regex.checked},!1)}))),this._editor.addOverlayWidget(this),this._register(this._state.onFindReplaceStateChange((e=>{let t=!1;e.isRegex&&(this.regex.checked=this._state.isRegex,t=!0),e.wholeWord&&(this.wholeWords.checked=this._state.wholeWord,t=!0),e.matchCase&&(this.caseSensitive.checked=this._state.matchCase,t=!0),!this._state.isRevealed&&t&&this._revealTemporarily()}))),this._register(lC(this._domNode,(e=>this._onMouseOut()))),this._register(nC(this._domNode,"mouseover",(e=>this._onMouseOver()))),this._applyTheme(n.getColorTheme()),this._register(n.onDidColorThemeChange(this._applyTheme.bind(this)))}_keybindingLabelFor(e){let t=this._keybindingService.lookupKeybinding(e);return t?` (${t.getLabel()})`:""}dispose(){this._editor.removeOverlayWidget(this),super.dispose()}getId(){return f8.ID}getDomNode(){return this._domNode}getPosition(){return{preference:0}}highlightFindOptions(){this._revealTemporarily()}_revealTemporarily(){this._show(),this._hideSoon.schedule()}_onMouseOut(){this._hideSoon.schedule()}_onMouseOver(){this._hideSoon.cancel()}_show(){this._isVisible||(this._isVisible=!0,this._domNode.style.display="block")}_hide(){this._isVisible&&(this._isVisible=!1,this._domNode.style.display="none")}_applyTheme(e){let t={inputActiveOptionBorder:e.getColor(TS),inputActiveOptionForeground:e.getColor(AS),inputActiveOptionBackground:e.getColor(MS)};this.caseSensitive.style(t),this.wholeWords.style(t),this.regex.style(t)}}function _8(e,t){return 1===e||2!==e&&t}f8.ID="editor.contrib.findOptionsWidget",sx(((e,t)=>{const i=e.getColor(fk);i&&t.addRule(`.monaco-editor .findOptionsWidget { background-color: ${i}; }`);const n=e.getColor(_k);n&&t.addRule(`.monaco-editor .findOptionsWidget { color: ${n}; }`);const o=e.getColor(LS);o&&t.addRule(`.monaco-editor .findOptionsWidget { box-shadow: 0 0 8px 2px ${o}; }`);const s=e.getColor(yS);s&&t.addRule(`.monaco-editor .findOptionsWidget { border: 2px solid ${s}; }`)}));class v8 extends Uo{constructor(){super(),this._onFindReplaceStateChange=this._register(new $o),this.onFindReplaceStateChange=this._onFindReplaceStateChange.event,this._searchString="",this._replaceString="",this._isRevealed=!1,this._isReplaceRevealed=!1,this._isRegex=!1,this._isRegexOverride=0,this._wholeWord=!1,this._wholeWordOverride=0,this._matchCase=!1,this._matchCaseOverride=0,this._preserveCase=!1,this._preserveCaseOverride=0,this._searchScope=null,this._matchesPosition=0,this._matchesCount=0,this._currentMatch=null,this._loop=!0,this._isSearching=!1,this._filters=null}get searchString(){return this._searchString}get replaceString(){return this._replaceString}get isRevealed(){return this._isRevealed}get isReplaceRevealed(){return this._isReplaceRevealed}get isRegex(){return _8(this._isRegexOverride,this._isRegex)}get wholeWord(){return _8(this._wholeWordOverride,this._wholeWord)}get matchCase(){return _8(this._matchCaseOverride,this._matchCase)}get preserveCase(){return _8(this._preserveCaseOverride,this._preserveCase)}get actualIsRegex(){return this._isRegex}get actualWholeWord(){return this._wholeWord}get actualMatchCase(){return this._matchCase}get actualPreserveCase(){return this._preserveCase}get searchScope(){return this._searchScope}get matchesPosition(){return this._matchesPosition}get matchesCount(){return this._matchesCount}get currentMatch(){return this._currentMatch}changeMatchInfo(e,t,i){let n={moveCursor:!1,updateHistory:!1,searchString:!1,replaceString:!1,isRevealed:!1,isReplaceRevealed:!1,isRegex:!1,wholeWord:!1,matchCase:!1,preserveCase:!1,searchScope:!1,matchesPosition:!1,matchesCount:!1,currentMatch:!1,loop:!1,isSearching:!1,filters:!1},o=!1;0===t&&(e=0),e>t&&(e=t),this._matchesPosition!==e&&(this._matchesPosition=e,n.matchesPosition=!0,o=!0),this._matchesCount!==t&&(this._matchesCount=t,n.matchesCount=!0,o=!0),void 0!==i&&(qo.equalsRange(this._currentMatch,i)||(this._currentMatch=i,n.currentMatch=!0,o=!0)),o&&this._onFindReplaceStateChange.fire(n)}change(e,t,i=!0){var n;let o={moveCursor:t,updateHistory:i,searchString:!1,replaceString:!1,isRevealed:!1,isReplaceRevealed:!1,isRegex:!1,wholeWord:!1,matchCase:!1,preserveCase:!1,searchScope:!1,matchesPosition:!1,matchesCount:!1,currentMatch:!1,loop:!1,isSearching:!1,filters:!1},s=!1;const r=this.isRegex,a=this.wholeWord,l=this.matchCase,d=this.preserveCase;void 0!==e.searchString&&this._searchString!==e.searchString&&(this._searchString=e.searchString,o.searchString=!0,s=!0),void 0!==e.replaceString&&this._replaceString!==e.replaceString&&(this._replaceString=e.replaceString,o.replaceString=!0,s=!0),void 0!==e.isRevealed&&this._isRevealed!==e.isRevealed&&(this._isRevealed=e.isRevealed,o.isRevealed=!0,s=!0),void 0!==e.isReplaceRevealed&&this._isReplaceRevealed!==e.isReplaceRevealed&&(this._isReplaceRevealed=e.isReplaceRevealed,o.isReplaceRevealed=!0,s=!0),void 0!==e.isRegex&&(this._isRegex=e.isRegex),void 0!==e.wholeWord&&(this._wholeWord=e.wholeWord),void 0!==e.matchCase&&(this._matchCase=e.matchCase),void 0!==e.preserveCase&&(this._preserveCase=e.preserveCase),void 0!==e.searchScope&&((null===(n=e.searchScope)||void 0===n?void 0:n.every((e=>{var t;return null===(t=this._searchScope)||void 0===t?void 0:t.some((t=>!qo.equalsRange(t,e)))})))||(this._searchScope=e.searchScope,o.searchScope=!0,s=!0)),void 0!==e.loop&&this._loop!==e.loop&&(this._loop=e.loop,o.loop=!0,s=!0),void 0!==e.isSearching&&this._isSearching!==e.isSearching&&(this._isSearching=e.isSearching,o.isSearching=!0,s=!0),void 0!==e.filters&&(this._filters?this._filters.update(e.filters):this._filters=e.filters,o.filters=!0,s=!0),this._isRegexOverride=void 0!==e.isRegexOverride?e.isRegexOverride:0,this._wholeWordOverride=void 0!==e.wholeWordOverride?e.wholeWordOverride:0,this._matchCaseOverride=void 0!==e.matchCaseOverride?e.matchCaseOverride:0,this._preserveCaseOverride=void 0!==e.preserveCaseOverride?e.preserveCaseOverride:0,r!==this.isRegex&&(s=!0,o.isRegex=!0),a!==this.wholeWord&&(s=!0,o.wholeWord=!0),l!==this.matchCase&&(s=!0,o.matchCase=!0),d!==this.preserveCase&&(s=!0,o.preserveCase=!0),s&&this._onFindReplaceStateChange.fire(o)}canNavigateBack(){return this.canNavigateInLoop()||1!==this.matchesPosition}canNavigateForward(){return this.canNavigateInLoop()||this.matchesPosition<this.matchesCount}canNavigateInLoop(){return this._loop||this.matchesCount>=p8}}function b8(e){var t,i;return"Up"===(null===(t=e.lookupKeybinding("history.showPrevious"))||void 0===t?void 0:t.getElectronAccelerator())&&"Down"===(null===(i=e.lookupKeybinding("history.showNext"))||void 0===i?void 0:i.getElectronAccelerator())}var w8=globalThis&&globalThis.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{l(n.next(e))}catch(t){s(t)}}function a(e){try{l(n.throw(e))}catch(t){s(t)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}l((n=n.apply(e,t||[])).next())}))};const C8=CB("find-selection",br.selection,mf(0,"Icon for 'Find in Selection' in the editor find widget.")),y8=CB("find-collapsed",br.chevronRight,mf(0,"Icon to indicate that the editor find widget is collapsed.")),x8=CB("find-expanded",br.chevronDown,mf(0,"Icon to indicate that the editor find widget is expanded.")),S8=CB("find-replace",br.replace,mf(0,"Icon for 'Replace' in the editor find widget.")),k8=CB("find-replace-all",br.replaceAll,mf(0,"Icon for 'Replace All' in the editor find widget.")),D8=CB("find-previous-match",br.arrowUp,mf(0,"Icon for 'Find Previous' in the editor find widget.")),L8=CB("find-next-match",br.arrowDown,mf(0,"Icon for 'Find Next' in the editor find widget.")),N8=mf(0,"Find"),E8=mf(0,"Find"),I8=mf(0,"Previous Match"),T8=mf(0,"Next Match"),M8=mf(0,"Find in Selection"),A8=mf(0,"Close"),O8=mf(0,"Replace"),R8=mf(0,"Replace"),P8=mf(0,"Replace"),F8=mf(0,"Replace All"),B8=mf(0,"Toggle Replace"),V8=mf(0,"Only the first {0} results are highlighted, but all find operations work on the entire text.",p8),W8=mf(0,"{0} of {1}"),z8=mf(0,"No results"),H8=419;let j8=69;const U8="ctrlEnterReplaceAll.windows.donotask",$8=zo?256:2048;class K8{constructor(e){this.afterLineNumber=e,this.heightInPx=33,this.suppressMouseDown=!1,this.domNode=document.createElement("div"),this.domNode.className="dock-find-viewzone"}}function q8(e,t,i){const n=!!t.match(/\n/);i&&n&&i.selectionStart>0&&e.stopPropagation()}function G8(e,t,i){const n=!!t.match(/\n/);i&&n&&i.selectionEnd<i.value.length&&e.stopPropagation()}class Z8 extends QI{constructor(e,t,i,n,o,s,r,a,l){super(),this._cachedHeight=null,this._revealTimeouts=[],this._codeEditor=e,this._controller=t,this._state=i,this._contextViewProvider=n,this._keybindingService=o,this._contextKeyService=s,this._storageService=a,this._notificationService=l,this._ctrlEnterReplaceAllWarningPrompted=!!a.getBoolean(U8,0),this._isVisible=!1,this._isReplaceVisible=!1,this._ignoreChangeEvent=!1,this._updateHistoryDelayer=new tb(500),this._register(es((()=>this._updateHistoryDelayer.cancel()))),this._register(this._state.onFindReplaceStateChange((e=>this._onStateChanged(e)))),this._buildDomNode(),this._updateButtons(),this._tryUpdateWidgetWidth(),this._findInput.inputBox.layout(),this._register(this._codeEditor.onDidChangeConfiguration((e=>{if(e.hasChanged(81)&&(this._codeEditor.getOption(81)&&this._state.change({isReplaceRevealed:!1},!1),this._updateButtons()),e.hasChanged(131)&&this._tryUpdateWidgetWidth(),e.hasChanged(2)&&this.updateAccessibilitySupport(),e.hasChanged(35)){const e=this._codeEditor.getOption(35).addExtraSpaceOnTop;e&&!this._viewZone&&(this._viewZone=new K8(0),this._showViewZone()),!e&&this._viewZone&&this._removeViewZone()}}))),this.updateAccessibilitySupport(),this._register(this._codeEditor.onDidChangeCursorSelection((()=>{this._isVisible&&this._updateToggleSelectionFindButton()}))),this._register(this._codeEditor.onDidFocusEditorWidget((()=>w8(this,void 0,void 0,(function*(){if(this._isVisible){let e=yield this._controller.getGlobalBufferTerm();e&&e!==this._state.searchString&&(this._state.change({searchString:e},!1),this._findInput.select())}}))))),this._findInputFocused=U4.bindTo(s),this._findFocusTracker=this._register(UC(this._findInput.inputBox.inputElement)),this._register(this._findFocusTracker.onDidFocus((()=>{this._findInputFocused.set(!0),this._updateSearchScope()}))),this._register(this._findFocusTracker.onDidBlur((()=>{this._findInputFocused.set(!1)}))),this._replaceInputFocused=$4.bindTo(s),this._replaceFocusTracker=this._register(UC(this._replaceInput.inputBox.inputElement)),this._register(this._replaceFocusTracker.onDidFocus((()=>{this._replaceInputFocused.set(!0),this._updateSearchScope()}))),this._register(this._replaceFocusTracker.onDidBlur((()=>{this._replaceInputFocused.set(!1)}))),this._codeEditor.addOverlayWidget(this),this._codeEditor.getOption(35).addExtraSpaceOnTop&&(this._viewZone=new K8(0)),this._applyTheme(r.getColorTheme()),this._register(r.onDidColorThemeChange(this._applyTheme.bind(this))),this._register(this._codeEditor.onDidChangeModel((()=>{this._isVisible&&(this._viewZoneId=void 0)}))),this._register(this._codeEditor.onDidScrollChange((e=>{e.scrollTopChanged?this._layoutViewZone():setTimeout((()=>{this._layoutViewZone()}),0)})))}getId(){return Z8.ID}getDomNode(){return this._domNode}getPosition(){return this._isVisible?{preference:0}:null}_onStateChanged(e){if(e.searchString){try{this._ignoreChangeEvent=!0,this._findInput.setValue(this._state.searchString)}finally{this._ignoreChangeEvent=!1}this._updateButtons()}if(e.replaceString&&(this._replaceInput.inputBox.value=this._state.replaceString),e.isRevealed&&(this._state.isRevealed?this._reveal():this._hide(!0)),e.isReplaceRevealed&&(this._state.isReplaceRevealed?this._codeEditor.getOption(81)||this._isReplaceVisible||(this._isReplaceVisible=!0,this._replaceInput.width=SC(this._findInput.domNode),this._updateButtons(),this._replaceInput.inputBox.layout()):this._isReplaceVisible&&(this._isReplaceVisible=!1,this._updateButtons())),(e.isRevealed||e.isReplaceRevealed)&&(this._state.isRevealed||this._state.isReplaceRevealed)&&this._tryUpdateHeight()&&this._showViewZone(),e.isRegex&&this._findInput.setRegex(this._state.isRegex),e.wholeWord&&this._findInput.setWholeWords(this._state.wholeWord),e.matchCase&&this._findInput.setCaseSensitive(this._state.matchCase),e.preserveCase&&this._replaceInput.setPreserveCase(this._state.preserveCase),e.searchScope&&(this._state.searchScope?this._toggleSelectionFind.checked=!0:this._toggleSelectionFind.checked=!1,this._updateToggleSelectionFindButton()),e.searchString||e.matchesCount||e.matchesPosition){let e=this._state.searchString.length>0&&0===this._state.matchesCount;this._domNode.classList.toggle("no-results",e),this._updateMatchesCount(),this._updateButtons()}(e.searchString||e.currentMatch)&&this._layoutViewZone(),e.updateHistory&&this._delayedUpdateHistory(),e.loop&&this._updateButtons()}_delayedUpdateHistory(){this._updateHistoryDelayer.trigger(this._updateHistory.bind(this)).then(void 0,Jo)}_updateHistory(){this._state.searchString&&this._findInput.inputBox.addToHistory(),this._state.replaceString&&this._replaceInput.inputBox.addToHistory()}_updateMatchesCount(){let e;if(this._matchesCount.style.minWidth=j8+"px",this._state.matchesCount>=p8?this._matchesCount.title=V8:this._matchesCount.title="",this._matchesCount.firstChild&&this._matchesCount.removeChild(this._matchesCount.firstChild),this._state.matchesCount>0){let t=String(this._state.matchesCount);this._state.matchesCount>=p8&&(t+="+");let i=String(this._state.matchesPosition);"0"===i&&(i="?"),e=Aa(W8,i,t)}else e=z8;this._matchesCount.appendChild(document.createTextNode(e)),dy(this._getAriaLabel(e,this._state.currentMatch,this._state.searchString)),j8=Math.max(j8,this._matchesCount.clientWidth)}_getAriaLabel(e,t,i){if(e===z8)return""===i?mf(0,"{0} found",e):mf(0,"{0} found for '{1}'",e,i);if(t){const n=mf(0,"{0} found for '{1}', at {2}",e,i,t.startLineNumber+":"+t.startColumn),o=this._codeEditor.getModel();if(o&&t.startLineNumber<=o.getLineCount()&&t.startLineNumber>=1){return`${o.getLineContent(t.startLineNumber)}, ${n}`}return n}return mf(0,"{0} found for '{1}'",e,i)}_updateToggleSelectionFindButton(){let e=this._codeEditor.getSelection(),t=!!e&&(e.startLineNumber!==e.endLineNumber||e.startColumn!==e.endColumn),i=this._toggleSelectionFind.checked;this._isVisible&&(i||t)?this._toggleSelectionFind.enable():this._toggleSelectionFind.disable()}_updateButtons(){this._findInput.setEnabled(this._isVisible),this._replaceInput.setEnabled(this._isVisible&&this._isReplaceVisible),this._updateToggleSelectionFindButton(),this._closeBtn.setEnabled(this._isVisible);let e=this._state.searchString.length>0,t=!!this._state.matchesCount;this._prevBtn.setEnabled(this._isVisible&&e&&t&&this._state.canNavigateBack()),this._nextBtn.setEnabled(this._isVisible&&e&&t&&this._state.canNavigateForward()),this._replaceBtn.setEnabled(this._isVisible&&this._isReplaceVisible&&e),this._replaceAllBtn.setEnabled(this._isVisible&&this._isReplaceVisible&&e),this._domNode.classList.toggle("replaceToggled",this._isReplaceVisible),this._toggleReplaceBtn.setExpanded(this._isReplaceVisible);let i=!this._codeEditor.getOption(81);this._toggleReplaceBtn.setEnabled(this._isVisible&&i)}_reveal(){if(this._revealTimeouts.forEach((e=>{clearTimeout(e)})),this._revealTimeouts=[],!this._isVisible){this._isVisible=!0;const e=this._codeEditor.getSelection();switch(this._codeEditor.getOption(35).autoFindInSelection){case"always":this._toggleSelectionFind.checked=!0;break;case"never":this._toggleSelectionFind.checked=!1;break;case"multiline":{const t=!!e&&e.startLineNumber!==e.endLineNumber;this._toggleSelectionFind.checked=t;break}}this._tryUpdateWidgetWidth(),this._updateButtons(),this._revealTimeouts.push(setTimeout((()=>{this._domNode.classList.add("visible"),this._domNode.setAttribute("aria-hidden","false")}),0)),this._revealTimeouts.push(setTimeout((()=>{this._findInput.validate()}),200)),this._codeEditor.layoutOverlayWidget(this);let t=!0;if(this._codeEditor.getOption(35).seedSearchStringFromSelection&&e){const i=this._codeEditor.getDomNode();if(i){const n=yC(i),o=this._codeEditor.getScrolledVisiblePosition(e.getStartPosition()),s=n.left+(o?o.left:0),r=o?o.top:0;if(this._viewZone&&r<this._viewZone.heightInPx){e.endLineNumber>e.startLineNumber&&(t=!1);const i=CC(this._domNode).left;s>i&&(t=!1);const o=this._codeEditor.getScrolledVisiblePosition(e.getEndPosition());n.left+(o?o.left:0)>i&&(t=!1)}}}this._showViewZone(t)}}_hide(e){this._revealTimeouts.forEach((e=>{clearTimeout(e)})),this._revealTimeouts=[],this._isVisible&&(this._isVisible=!1,this._updateButtons(),this._domNode.classList.remove("visible"),this._domNode.setAttribute("aria-hidden","true"),this._findInput.clearMessage(),e&&this._codeEditor.focus(),this._codeEditor.layoutOverlayWidget(this),this._removeViewZone())}_layoutViewZone(e){if(!this._codeEditor.getOption(35).addExtraSpaceOnTop)return void this._removeViewZone();if(!this._isVisible)return;const t=this._viewZone;void 0===this._viewZoneId&&t&&this._codeEditor.changeViewZones((i=>{t.heightInPx=this._getHeight(),this._viewZoneId=i.addZone(t),this._codeEditor.setScrollTop(e||this._codeEditor.getScrollTop()+t.heightInPx)}))}_showViewZone(e=!0){if(!this._isVisible)return;if(!this._codeEditor.getOption(35).addExtraSpaceOnTop)return;void 0===this._viewZone&&(this._viewZone=new K8(0));const t=this._viewZone;this._codeEditor.changeViewZones((i=>{if(void 0!==this._viewZoneId){const n=this._getHeight();if(n===t.heightInPx)return;let o=n-t.heightInPx;return t.heightInPx=n,i.layoutZone(this._viewZoneId),void(e&&this._codeEditor.setScrollTop(this._codeEditor.getScrollTop()+o))}{let n=this._getHeight();if(n-=this._codeEditor.getOption(75).top,n<=0)return;t.heightInPx=n,this._viewZoneId=i.addZone(t),e&&this._codeEditor.setScrollTop(this._codeEditor.getScrollTop()+n)}}))}_removeViewZone(){this._codeEditor.changeViewZones((e=>{void 0!==this._viewZoneId&&(e.removeZone(this._viewZoneId),this._viewZoneId=void 0,this._viewZone&&(this._codeEditor.setScrollTop(this._codeEditor.getScrollTop()-this._viewZone.heightInPx),this._viewZone=void 0))}))}_applyTheme(e){let t={inputActiveOptionBorder:e.getColor(TS),inputActiveOptionBackground:e.getColor(MS),inputActiveOptionForeground:e.getColor(AS),inputBackground:e.getColor(NS),inputForeground:e.getColor(ES),inputBorder:e.getColor(IS),inputValidationInfoBackground:e.getColor(OS),inputValidationInfoForeground:e.getColor(RS),inputValidationInfoBorder:e.getColor(PS),inputValidationWarningBackground:e.getColor(FS),inputValidationWarningForeground:e.getColor(BS),inputValidationWarningBorder:e.getColor(VS),inputValidationErrorBackground:e.getColor(WS),inputValidationErrorForeground:e.getColor(zS),inputValidationErrorBorder:e.getColor(HS)};this._findInput.style(t),this._replaceInput.style(t),this._toggleSelectionFind.style(t)}_tryUpdateWidgetWidth(){if(!this._isVisible)return;if(!tC(this._domNode))return;const e=this._codeEditor.getLayoutInfo();if(e.contentWidth<=0)return void this._domNode.classList.add("hiddenEditor");this._domNode.classList.contains("hiddenEditor")&&this._domNode.classList.remove("hiddenEditor");const t=e.width,i=e.minimap.minimapWidth;let n=!1,o=!1,s=!1;if(this._resized){if(SC(this._domNode)>H8)return this._domNode.style.maxWidth=t-28-i-15+"px",void(this._replaceInput.width=SC(this._findInput.domNode))}if(447+i>=t&&(o=!0),447+i-j8>=t&&(s=!0),447+i-j8>=t+50&&(n=!0),this._domNode.classList.toggle("collapsed-find-widget",n),this._domNode.classList.toggle("narrow-find-widget",s),this._domNode.classList.toggle("reduced-find-widget",o),s||n||(this._domNode.style.maxWidth=t-28-i-15+"px"),this._resized){this._findInput.inputBox.layout();let e=this._findInput.inputBox.element.clientWidth;e>0&&(this._replaceInput.width=e)}else this._isReplaceVisible&&(this._replaceInput.width=SC(this._findInput.domNode))}_getHeight(){let e=0;return e+=4,e+=this._findInput.inputBox.height+2,this._isReplaceVisible&&(e+=4,e+=this._replaceInput.inputBox.height+2),e+=4,e}_tryUpdateHeight(){const e=this._getHeight();return(null===this._cachedHeight||this._cachedHeight!==e)&&(this._cachedHeight=e,this._domNode.style.height=`${e}px`,!0)}focusFindInput(){this._findInput.select(),this._findInput.focus()}focusReplaceInput(){this._replaceInput.select(),this._replaceInput.focus()}highlightFindOptions(){this._findInput.highlightFindOptions()}_updateSearchScope(){if(this._codeEditor.hasModel()&&this._toggleSelectionFind.checked){let e=this._codeEditor.getSelections();e.map((e=>{1===e.endColumn&&e.endLineNumber>e.startLineNumber&&(e=e.setEndPosition(e.endLineNumber-1,this._codeEditor.getModel().getLineMaxColumn(e.endLineNumber-1)));const t=this._state.currentMatch;return e.startLineNumber===e.endLineNumber||qo.equalsRange(e,t)?null:e})).filter((e=>!!e)),e.length&&this._state.change({searchScope:e},!0)}}_onFindInputMouseDown(e){e.middleButton&&e.stopPropagation()}_onFindInputKeyDown(e){return e.equals(3|$8)?(this._keybindingService.dispatchEvent(e,e.target)||this._findInput.inputBox.insertAtCursor("\n"),void e.preventDefault()):e.equals(2)?(this._isReplaceVisible?this._replaceInput.focus():this._findInput.focusOnCaseSensitive(),void e.preventDefault()):e.equals(2066)?(this._codeEditor.focus(),void e.preventDefault()):e.equals(16)?q8(e,this._findInput.getValue(),this._findInput.domNode.querySelector("textarea")):e.equals(18)?G8(e,this._findInput.getValue(),this._findInput.domNode.querySelector("textarea")):void 0}_onReplaceInputKeyDown(e){return e.equals(3|$8)?(this._keybindingService.dispatchEvent(e,e.target)||(Rs&&Ts&&!this._ctrlEnterReplaceAllWarningPrompted&&(this._notificationService.info(mf(0,"Ctrl+Enter now inserts line break instead of replacing all. You can modify the keybinding for editor.action.replaceAll to override this behavior.")),this._ctrlEnterReplaceAllWarningPrompted=!0,this._storageService.store(U8,!0,0,0)),this._replaceInput.inputBox.insertAtCursor("\n")),void e.preventDefault()):e.equals(2)?(this._findInput.focusOnCaseSensitive(),void e.preventDefault()):e.equals(1026)?(this._findInput.focus(),void e.preventDefault()):e.equals(2066)?(this._codeEditor.focus(),void e.preventDefault()):e.equals(16)?q8(e,this._replaceInput.inputBox.value,this._replaceInput.inputBox.element.querySelector("textarea")):e.equals(18)?G8(e,this._replaceInput.inputBox.value,this._replaceInput.inputBox.element.querySelector("textarea")):void 0}getVerticalSashLeft(e){return 0}_keybindingLabelFor(e){let t=this._keybindingService.lookupKeybinding(e);return t?` (${t.getLabel()})`:""}_buildDomNode(){this._findInput=this._register(new K2(null,this._contextViewProvider,{width:221,label:N8,placeholder:E8,appendCaseSensitiveLabel:this._keybindingLabelFor(r8),appendWholeWordsLabel:this._keybindingLabelFor(a8),appendRegexLabel:this._keybindingLabelFor(l8),validation:e=>{if(0===e.length||!this._findInput.getRegex())return null;try{return new RegExp(e,"gu"),null}catch(t){return{content:t.message}}},flexibleHeight:true,flexibleWidth:true,flexibleMaxHeight:118,showHistoryHint:()=>b8(this._keybindingService)},this._contextKeyService,!0)),this._findInput.setRegex(!!this._state.isRegex),this._findInput.setCaseSensitive(!!this._state.matchCase),this._findInput.setWholeWords(!!this._state.wholeWord),this._register(this._findInput.onKeyDown((e=>this._onFindInputKeyDown(e)))),this._register(this._findInput.inputBox.onDidChange((()=>{this._ignoreChangeEvent||this._state.change({searchString:this._findInput.getValue()},!0)}))),this._register(this._findInput.onDidOptionChange((()=>{this._state.change({isRegex:this._findInput.getRegex(),wholeWord:this._findInput.getWholeWords(),matchCase:this._findInput.getCaseSensitive()},!0)}))),this._register(this._findInput.onCaseSensitiveKeyDown((e=>{e.equals(1026)&&this._isReplaceVisible&&(this._replaceInput.focus(),e.preventDefault())}))),this._register(this._findInput.onRegexKeyDown((e=>{e.equals(2)&&this._isReplaceVisible&&(this._replaceInput.focusOnPreserve(),e.preventDefault())}))),this._register(this._findInput.inputBox.onDidHeightChange((e=>{this._tryUpdateHeight()&&this._showViewZone()}))),Vo&&this._register(this._findInput.onMouseDown((e=>this._onFindInputMouseDown(e)))),this._matchesCount=document.createElement("div"),this._matchesCount.className="matchesCount",this._updateMatchesCount(),this._prevBtn=this._register(new Y8({label:I8+this._keybindingLabelFor(t8),icon:D8,onTrigger:()=>{this._codeEditor.getAction(t8).run().then(void 0,Jo)}})),this._nextBtn=this._register(new Y8({label:T8+this._keybindingLabelFor(e8),icon:L8,onTrigger:()=>{this._codeEditor.getAction(e8).run().then(void 0,Jo)}}));let e=document.createElement("div");e.className="find-part",e.appendChild(this._findInput.domNode);const t=document.createElement("div");t.className="find-actions",e.appendChild(t),t.appendChild(this._matchesCount),t.appendChild(this._prevBtn.domNode),t.appendChild(this._nextBtn.domNode),this._toggleSelectionFind=this._register(new k2({icon:C8,title:M8+this._keybindingLabelFor(d8),isChecked:!1})),this._register(this._toggleSelectionFind.onChange((()=>{if(this._toggleSelectionFind.checked){if(this._codeEditor.hasModel()){let e=this._codeEditor.getSelections();e.map((e=>(1===e.endColumn&&e.endLineNumber>e.startLineNumber&&(e=e.setEndPosition(e.endLineNumber-1,this._codeEditor.getModel().getLineMaxColumn(e.endLineNumber-1))),e.isEmpty()?null:e))).filter((e=>!!e)),e.length&&this._state.change({searchScope:e},!0)}}else this._state.change({searchScope:null},!0)}))),t.appendChild(this._toggleSelectionFind.domNode),this._closeBtn=this._register(new Y8({label:A8+this._keybindingLabelFor(s8),icon:DB,onTrigger:()=>{this._state.change({isRevealed:!1,searchScope:null},!1)},onKeyDown:e=>{e.equals(2)&&this._isReplaceVisible&&(this._replaceBtn.isEnabled()?this._replaceBtn.focus():this._codeEditor.focus(),e.preventDefault())}})),t.appendChild(this._closeBtn.domNode),this._replaceInput=this._register(new q2(null,void 0,{label:O8,placeholder:R8,appendPreserveCaseLabel:this._keybindingLabelFor(c8),history:[],flexibleHeight:true,flexibleWidth:true,flexibleMaxHeight:118,showHistoryHint:()=>b8(this._keybindingService)},this._contextKeyService,!0)),this._replaceInput.setPreserveCase(!!this._state.preserveCase),this._register(this._replaceInput.onKeyDown((e=>this._onReplaceInputKeyDown(e)))),this._register(this._replaceInput.inputBox.onDidChange((()=>{this._state.change({replaceString:this._replaceInput.inputBox.value},!1)}))),this._register(this._replaceInput.inputBox.onDidHeightChange((e=>{this._isReplaceVisible&&this._tryUpdateHeight()&&this._showViewZone()}))),this._register(this._replaceInput.onDidOptionChange((()=>{this._state.change({preserveCase:this._replaceInput.getPreserveCase()},!0)}))),this._register(this._replaceInput.onPreserveCaseKeyDown((e=>{e.equals(2)&&(this._prevBtn.isEnabled()?this._prevBtn.focus():this._nextBtn.isEnabled()?this._nextBtn.focus():this._toggleSelectionFind.enabled?this._toggleSelectionFind.focus():this._closeBtn.isEnabled()&&this._closeBtn.focus(),e.preventDefault())}))),this._replaceBtn=this._register(new Y8({label:P8+this._keybindingLabelFor(h8),icon:S8,onTrigger:()=>{this._controller.replace()},onKeyDown:e=>{e.equals(1026)&&(this._closeBtn.focus(),e.preventDefault())}})),this._replaceAllBtn=this._register(new Y8({label:F8+this._keybindingLabelFor(u8),icon:k8,onTrigger:()=>{this._controller.replaceAll()}}));let i=document.createElement("div");i.className="replace-part",i.appendChild(this._replaceInput.domNode);const n=document.createElement("div");n.className="replace-actions",i.appendChild(n),n.appendChild(this._replaceBtn.domNode),n.appendChild(this._replaceAllBtn.domNode),this._toggleReplaceBtn=this._register(new Y8({label:B8,className:"codicon toggle left",onTrigger:()=>{this._state.change({isReplaceRevealed:!this._isReplaceVisible},!1),this._isReplaceVisible&&(this._replaceInput.width=SC(this._findInput.domNode),this._replaceInput.inputBox.layout()),this._showViewZone()}})),this._toggleReplaceBtn.setExpanded(this._isReplaceVisible),this._domNode=document.createElement("div"),this._domNode.className="editor-widget find-widget",this._domNode.setAttribute("aria-hidden","true"),this._domNode.style.width="419px",this._domNode.appendChild(this._toggleReplaceBtn.domNode),this._domNode.appendChild(e),this._domNode.appendChild(i),this._resizeSash=new cB(this._domNode,this,{orientation:0,size:2}),this._resized=!1;let o=H8;this._register(this._resizeSash.onDidStart((()=>{o=SC(this._domNode)}))),this._register(this._resizeSash.onDidChange((e=>{this._resized=!0;let t=o+e.startX-e.currentX;if(t<H8)return;t>(parseFloat(_C(this._domNode).maxWidth)||0)||(this._domNode.style.width=`${t}px`,this._isReplaceVisible&&(this._replaceInput.width=SC(this._findInput.domNode)),this._findInput.inputBox.layout(),this._tryUpdateHeight())}))),this._register(this._resizeSash.onDidReset((()=>{const e=SC(this._domNode);if(e<H8)return;let t=H8;if(!this._resized||e===H8){const e=this._codeEditor.getLayoutInfo();t=e.width-28-e.minimap.minimapWidth-15,this._resized=!0}this._domNode.style.width=`${t}px`,this._isReplaceVisible&&(this._replaceInput.width=SC(this._findInput.domNode)),this._findInput.inputBox.layout()})))}updateAccessibilitySupport(){const e=this._codeEditor.getOption(2);this._findInput.setFocusInputOnOptionClick(2!==e)}}Z8.ID="editor.contrib.findWidget";class Y8 extends QI{constructor(e){super(),this._opts=e;let t="button";this._opts.className&&(t=t+" "+this._opts.className),this._opts.icon&&(t=t+" "+ex.asClassName(this._opts.icon)),this._domNode=document.createElement("div"),this._domNode.title=this._opts.label,this._domNode.tabIndex=0,this._domNode.className=t,this._domNode.setAttribute("role","button"),this._domNode.setAttribute("aria-label",this._opts.label),this.onclick(this._domNode,(e=>{this._opts.onTrigger(),e.preventDefault()})),this.onkeydown(this._domNode,(e=>{if(e.equals(10)||e.equals(3))return this._opts.onTrigger(),void e.preventDefault();this._opts.onKeyDown&&this._opts.onKeyDown(e)}))}get domNode(){return this._domNode}isEnabled(){return this._domNode.tabIndex>=0}focus(){this._domNode.focus()}setEnabled(e){this._domNode.classList.toggle("disabled",!e),this._domNode.setAttribute("aria-disabled",String(!e)),this._domNode.tabIndex=e?0:-1}setExpanded(e){this._domNode.setAttribute("aria-expanded",String(!!e)),e?(this._domNode.classList.remove(...ex.asClassNameArray(y8)),this._domNode.classList.add(...ex.asClassNameArray(x8))):(this._domNode.classList.remove(...ex.asClassNameArray(x8)),this._domNode.classList.add(...ex.asClassNameArray(y8)))}}sx(((e,t)=>{const i=(e,i)=>{i&&t.addRule(`.monaco-editor ${e} { background-color: ${i}; }`)};i(".findMatch",e.getColor(Rk)),i(".currentFindMatch",e.getColor(Ok)),i(".findScope",e.getColor(Pk));i(".find-widget",e.getColor(fk));const n=e.getColor(LS);n&&t.addRule(`.monaco-editor .find-widget { box-shadow: 0 0 8px 2px ${n}; }`);const o=e.getColor(Bk);o&&t.addRule(`.monaco-editor .findMatch { border: 1px ${"hc"===e.type?"dotted":"solid"} ${o}; box-sizing: border-box; }`);const s=e.getColor(Fk);s&&t.addRule(`.monaco-editor .currentFindMatch { border: 2px solid ${s}; padding: 1px; box-sizing: border-box; }`);const r=e.getColor(Vk);r&&t.addRule(`.monaco-editor .findScope { border: 1px ${"hc"===e.type?"dashed":"solid"} ${r}; }`);const a=e.getColor(yS);a&&t.addRule(`.monaco-editor .find-widget { border: 1px solid ${a}; }`);const l=e.getColor(_k);l&&t.addRule(`.monaco-editor .find-widget { color: ${l}; }`);const d=e.getColor(bS);d&&t.addRule(`.monaco-editor .find-widget.no-results .matchesCount { color: ${d}; }`);const c=e.getColor(bk);if(c)t.addRule(`.monaco-editor .find-widget .monaco-sash { background-color: ${c}; }`);else{const i=e.getColor(vk);i&&t.addRule(`.monaco-editor .find-widget .monaco-sash { background-color: ${i}; }`)}const h=e.getColor(YD);h&&t.addRule(`\n\t\t.monaco-editor .find-widget .button:not(.disabled):hover,\n\t\t.monaco-editor .find-widget .codicon-find-selection:hover {\n\t\t\tbackground-color: ${h} !important;\n\t\t}\n\t`);const u=e.getColor(CS);u&&t.addRule(`.monaco-editor .find-widget .monaco-inputbox.synthetic-focus { outline-color: ${u}; }`)}));var X8=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},Q8=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}},J8=globalThis&&globalThis.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{l(n.next(e))}catch(t){s(t)}}function a(e){try{l(n.throw(e))}catch(t){s(t)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}l((n=n.apply(e,t||[])).next())}))};function e7(e,t="single",i=!1){if(!e.hasModel())return null;const n=e.getSelection();if("single"===t&&n.startLineNumber===n.endLineNumber||"multiple"===t)if(n.isEmpty()){const t=e.getConfiguredWordAtPosition(n.getStartPosition());if(t&&!1===i)return t.word}else if(e.getModel().getValueLengthInRange(n)<524288)return e.getModel().getValueInRange(n);return null}let t7=class e extends Uo{constructor(e,t,i,n){super(),this._editor=e,this._findWidgetVisible=j4.bindTo(t),this._contextKeyService=t,this._storageService=i,this._clipboardService=n,this._updateHistoryDelayer=new tb(500),this._state=this._register(new v8),this.loadQueryState(),this._register(this._state.onFindReplaceStateChange((e=>this._onStateChanged(e)))),this._model=null,this._register(this._editor.onDidChangeModel((()=>{let e=this._editor.getModel()&&this._state.isRevealed;this.disposeModel(),this._state.change({searchScope:null,matchCase:this._storageService.getBoolean("editor.matchCase",1,!1),wholeWord:this._storageService.getBoolean("editor.wholeWord",1,!1),isRegex:this._storageService.getBoolean("editor.isRegex",1,!1),preserveCase:this._storageService.getBoolean("editor.preserveCase",1,!1)},!1),e&&this._start({forceRevealReplace:!1,seedSearchStringFromSelection:"none",seedSearchStringFromNonEmptySelection:!1,seedSearchStringFromGlobalClipboard:!1,shouldFocus:0,shouldAnimate:!1,updateSearchScope:!1,loop:this._editor.getOption(35).loop})})))}get editor(){return this._editor}static get(t){return t.getContribution(e.ID)}dispose(){this.disposeModel(),super.dispose()}disposeModel(){this._model&&(this._model.dispose(),this._model=null)}_onStateChanged(e){this.saveQueryState(e),e.isRevealed&&(this._state.isRevealed?this._findWidgetVisible.set(!0):(this._findWidgetVisible.reset(),this.disposeModel())),e.searchString&&this.setGlobalBufferTerm(this._state.searchString)}saveQueryState(e){e.isRegex&&this._storageService.store("editor.isRegex",this._state.actualIsRegex,1,0),e.wholeWord&&this._storageService.store("editor.wholeWord",this._state.actualWholeWord,1,0),e.matchCase&&this._storageService.store("editor.matchCase",this._state.actualMatchCase,1,0),e.preserveCase&&this._storageService.store("editor.preserveCase",this._state.actualPreserveCase,1,0)}loadQueryState(){this._state.change({matchCase:this._storageService.getBoolean("editor.matchCase",1,this._state.matchCase),wholeWord:this._storageService.getBoolean("editor.wholeWord",1,this._state.wholeWord),isRegex:this._storageService.getBoolean("editor.isRegex",1,this._state.isRegex),preserveCase:this._storageService.getBoolean("editor.preserveCase",1,this._state.preserveCase)},!1)}isFindInputFocused(){return!!U4.getValue(this._contextKeyService)}getState(){return this._state}closeFindWidget(){this._state.change({isRevealed:!1,searchScope:null},!1),this._editor.focus()}toggleCaseSensitive(){this._state.change({matchCase:!this._state.matchCase},!1),this._state.isRevealed||this.highlightFindOptions()}toggleWholeWords(){this._state.change({wholeWord:!this._state.wholeWord},!1),this._state.isRevealed||this.highlightFindOptions()}toggleRegex(){this._state.change({isRegex:!this._state.isRegex},!1),this._state.isRevealed||this.highlightFindOptions()}togglePreserveCase(){this._state.change({preserveCase:!this._state.preserveCase},!1),this._state.isRevealed||this.highlightFindOptions()}toggleSearchScope(){if(this._state.searchScope)this._state.change({searchScope:null},!0);else if(this._editor.hasModel()){let e=this._editor.getSelections();e.map((e=>(1===e.endColumn&&e.endLineNumber>e.startLineNumber&&(e=e.setEndPosition(e.endLineNumber-1,this._editor.getModel().getLineMaxColumn(e.endLineNumber-1))),e.isEmpty()?null:e))).filter((e=>!!e)),e.length&&this._state.change({searchScope:e},!0)}}setSearchString(e){this._state.isRegex&&(e=Xo(e)),this._state.change({searchString:e},!1)}highlightFindOptions(e=!1){}_start(e,t){return J8(this,void 0,void 0,(function*(){if(this.disposeModel(),!this._editor.hasModel())return;let i=Object.assign(Object.assign({},t),{isRevealed:!0});if("single"===e.seedSearchStringFromSelection){let t=e7(this._editor,e.seedSearchStringFromSelection,e.seedSearchStringFromNonEmptySelection);t&&(this._state.isRegex?i.searchString=Xo(t):i.searchString=t)}else if("multiple"===e.seedSearchStringFromSelection&&!e.updateSearchScope){let t=e7(this._editor,e.seedSearchStringFromSelection);t&&(i.searchString=t)}if(!i.searchString&&e.seedSearchStringFromGlobalClipboard){let e=yield this.getGlobalBufferTerm();if(!this._editor.hasModel())return;e&&(i.searchString=e)}if(e.forceRevealReplace||i.isReplaceRevealed?i.isReplaceRevealed=!0:this._findWidgetVisible.get()||(i.isReplaceRevealed=!1),e.updateSearchScope){let e=this._editor.getSelections();e.some((e=>!e.isEmpty()))&&(i.searchScope=e)}i.loop=e.loop,this._state.change(i,!1),this._model||(this._model=new m8(this._editor,this._state))}))}start(e,t){return this._start(e,t)}moveToNextMatch(){return!!this._model&&(this._model.moveToNextMatch(),!0)}moveToPrevMatch(){return!!this._model&&(this._model.moveToPrevMatch(),!0)}replace(){return!!this._model&&(this._model.replace(),!0)}replaceAll(){return!!this._model&&(this._model.replaceAll(),!0)}selectAllMatches(){return!!this._model&&(this._model.selectAllMatches(),this._editor.focus(),!0)}getGlobalBufferTerm(){return J8(this,void 0,void 0,(function*(){return this._editor.getOption(35).globalFindClipboard&&this._editor.hasModel()&&!this._editor.getModel().isTooLargeForSyncing()?this._clipboardService.readFindText():""}))}setGlobalBufferTerm(e){this._editor.getOption(35).globalFindClipboard&&this._editor.hasModel()&&!this._editor.getModel().isTooLargeForSyncing()&&this._clipboardService.writeFindText(e)}};t7.ID="editor.contrib.findController",t7=X8([Q8(1,$y),Q8(2,bZ),Q8(3,jB)],t7);let i7=class extends t7{constructor(e,t,i,n,o,s,r,a){super(e,i,r,a),this._contextViewService=t,this._keybindingService=n,this._themeService=o,this._notificationService=s,this._widget=null,this._findOptionsWidget=null}_start(e,t){const i=Object.create(null,{_start:{get:()=>super._start}});return J8(this,void 0,void 0,(function*(){this._widget||this._createFindWidget();const n=this._editor.getSelection();let o=!1;switch(this._editor.getOption(35).autoFindInSelection){case"always":o=!0;break;case"never":o=!1;break;case"multiline":o=!!n&&n.startLineNumber!==n.endLineNumber;break}e.updateSearchScope=e.updateSearchScope||o,yield i._start.call(this,e,t),this._widget&&(2===e.shouldFocus?this._widget.focusReplaceInput():1===e.shouldFocus&&this._widget.focusFindInput())}))}highlightFindOptions(e=!1){this._widget||this._createFindWidget(),this._state.isRevealed&&!e?this._widget.highlightFindOptions():this._findOptionsWidget.highlightFindOptions()}_createFindWidget(){this._widget=this._register(new Z8(this._editor,this,this._state,this._contextViewService,this._keybindingService,this._contextKeyService,this._themeService,this._storageService,this._notificationService)),this._findOptionsWidget=this._register(new f8(this._editor,this._state,this._keybindingService,this._themeService))}};i7=X8([Q8(1,VB),Q8(2,$y),Q8(3,kW),Q8(4,Qy),Q8(5,vF),Q8(6,bZ),Q8(7,jB)],i7);Nx(new Sx({id:X4,label:mf(0,"Find"),alias:"Find",precondition:Sy.or(yI.focus,Sy.has("editorIsOpen")),kbOpts:{kbExpr:null,primary:2084,weight:100},menuOpts:{menuId:cx.MenubarEditMenu,group:"3_find",title:mf(0,"&&Find"),order:1}})).addImplementation(0,((e,t,i)=>{const n=t7.get(t);return!!n&&n.start({forceRevealReplace:!1,seedSearchStringFromSelection:"never"!==t.getOption(35).seedSearchStringFromSelection?"single":"none",seedSearchStringFromNonEmptySelection:"selection"===t.getOption(35).seedSearchStringFromSelection,seedSearchStringFromGlobalClipboard:t.getOption(35).globalFindClipboard,shouldFocus:1,shouldAnimate:!0,updateSearchScope:!1,loop:t.getOption(35).loop})}));const n7={description:"Open a new In-Editor Find Widget.",args:[{name:"Open a new In-Editor Find Widget args",schema:{properties:{searchString:{type:"string"},replaceString:{type:"string"},regex:{type:"boolean"},regexOverride:{type:"number",description:mf(0,'Overrides "Use Regular Expression" flag.\nThe flag will not be saved for the future.\n0: Do Nothing\n1: True\n2: False')},wholeWord:{type:"boolean"},wholeWordOverride:{type:"number",description:mf(0,'Overrides "Match Whole Word" flag.\nThe flag will not be saved for the future.\n0: Do Nothing\n1: True\n2: False')},matchCase:{type:"boolean"},matchCaseOverride:{type:"number",description:mf(0,'Overrides "Math Case" flag.\nThe flag will not be saved for the future.\n0: Do Nothing\n1: True\n2: False')},preserveCase:{type:"boolean"},preserveCaseOverride:{type:"number",description:mf(0,'Overrides "Preserve Case" flag.\nThe flag will not be saved for the future.\n0: Do Nothing\n1: True\n2: False')},findInSelection:{type:"boolean"}}}}]};class o7 extends xx{run(e,t){return J8(this,void 0,void 0,(function*(){const e=t7.get(t);e&&!this._run(e)&&(yield e.start({forceRevealReplace:!1,seedSearchStringFromSelection:0===e.getState().searchString.length&&"never"!==t.getOption(35).seedSearchStringFromSelection?"single":"none",seedSearchStringFromNonEmptySelection:"selection"===t.getOption(35).seedSearchStringFromSelection,seedSearchStringFromGlobalClipboard:!0,shouldFocus:0,shouldAnimate:!0,updateSearchScope:!1,loop:t.getOption(35).loop}),this._run(e))}))}}class s7 extends xx{run(e,t){return J8(this,void 0,void 0,(function*(){const e=t7.get(t);if(!e)return;const i="selection"===t.getOption(35).seedSearchStringFromSelection;let n=null;"never"!==t.getOption(35).seedSearchStringFromSelection&&(n=e7(t,"single",i)),n&&e.setSearchString(n),this._run(e)||(yield e.start({forceRevealReplace:!1,seedSearchStringFromSelection:"never"!==t.getOption(35).seedSearchStringFromSelection?"single":"none",seedSearchStringFromNonEmptySelection:i,seedSearchStringFromGlobalClipboard:!1,shouldFocus:0,shouldAnimate:!0,updateSearchScope:!1,loop:t.getOption(35).loop}),this._run(e))}))}}Nx(new Sx({id:o8,label:mf(0,"Replace"),alias:"Replace",precondition:Sy.or(yI.focus,Sy.has("editorIsOpen")),kbOpts:{kbExpr:null,primary:2086,mac:{primary:2596},weight:100},menuOpts:{menuId:cx.MenubarEditMenu,group:"3_find",title:mf(0,"&&Replace"),order:2}})).addImplementation(0,((e,t,i)=>{if(!t.hasModel()||t.getOption(81))return!1;const n=t7.get(t);if(!n)return!1;const o=t.getSelection(),s=n.isFindInputFocused(),r=!o.isEmpty()&&o.startLineNumber===o.endLineNumber&&"never"!==t.getOption(35).seedSearchStringFromSelection&&!s,a=s||r?2:1;return n.start({forceRevealReplace:!0,seedSearchStringFromSelection:r?"single":"none",seedSearchStringFromNonEmptySelection:"selection"===t.getOption(35).seedSearchStringFromSelection,seedSearchStringFromGlobalClipboard:"never"!==t.getOption(35).seedSearchStringFromSelection,shouldFocus:a,shouldAnimate:!0,updateSearchScope:!1,loop:t.getOption(35).loop})})),Ix(t7.ID,i7),Lx(class extends xx{constructor(){super({id:J4,label:mf(0,"Find With Arguments"),alias:"Find With Arguments",precondition:void 0,kbOpts:{kbExpr:null,primary:0,weight:100},description:n7})}run(e,t,i){return J8(this,void 0,void 0,(function*(){const e=t7.get(t);if(e){const n=i?{searchString:i.searchString,replaceString:i.replaceString,isReplaceRevealed:void 0!==i.replaceString,isRegex:i.isRegex,wholeWord:i.matchWholeWord,matchCase:i.isCaseSensitive,preserveCase:i.preserveCase}:{};yield e.start({forceRevealReplace:!1,seedSearchStringFromSelection:0===e.getState().searchString.length&&"never"!==t.getOption(35).seedSearchStringFromSelection?"single":"none",seedSearchStringFromNonEmptySelection:"selection"===t.getOption(35).seedSearchStringFromSelection,seedSearchStringFromGlobalClipboard:!0,shouldFocus:1,shouldAnimate:!0,updateSearchScope:(null==i?void 0:i.findInSelection)||!1,loop:t.getOption(35).loop},n),e.setGlobalBufferTerm(e.getState().searchString)}}))}}),Lx(class extends xx{constructor(){super({id:Q4,label:mf(0,"Find With Selection"),alias:"Find With Selection",precondition:void 0,kbOpts:{kbExpr:null,primary:0,mac:{primary:2083},weight:100}})}run(e,t){return J8(this,void 0,void 0,(function*(){const e=t7.get(t);e&&(yield e.start({forceRevealReplace:!1,seedSearchStringFromSelection:"multiple",seedSearchStringFromNonEmptySelection:!1,seedSearchStringFromGlobalClipboard:!1,shouldFocus:0,shouldAnimate:!0,updateSearchScope:!1,loop:t.getOption(35).loop}),e.setGlobalBufferTerm(e.getState().searchString))}))}}),Lx(class extends o7{constructor(){super({id:e8,label:mf(0,"Find Next"),alias:"Find Next",precondition:void 0,kbOpts:[{kbExpr:yI.focus,primary:61,mac:{primary:2085,secondary:[61]},weight:100},{kbExpr:Sy.and(yI.focus,U4),primary:3,weight:100}]})}_run(e){return!!e.moveToNextMatch()&&(e.editor.pushUndoStop(),!0)}}),Lx(class extends o7{constructor(){super({id:t8,label:mf(0,"Find Previous"),alias:"Find Previous",precondition:void 0,kbOpts:[{kbExpr:yI.focus,primary:1085,mac:{primary:3109,secondary:[1085]},weight:100},{kbExpr:Sy.and(yI.focus,U4),primary:1027,weight:100}]})}_run(e){return e.moveToPrevMatch()}}),Lx(class extends s7{constructor(){super({id:i8,label:mf(0,"Find Next Selection"),alias:"Find Next Selection",precondition:void 0,kbOpts:{kbExpr:yI.focus,primary:2109,weight:100}})}_run(e){return e.moveToNextMatch()}}),Lx(class extends s7{constructor(){super({id:n8,label:mf(0,"Find Previous Selection"),alias:"Find Previous Selection",precondition:void 0,kbOpts:{kbExpr:yI.focus,primary:3133,weight:100}})}_run(e){return e.moveToPrevMatch()}});const r7=yx.bindToContribution(t7.get);Dx(new r7({id:s8,precondition:j4,handler:e=>e.closeFindWidget(),kbOpts:{weight:105,kbExpr:Sy.and(yI.focus,Sy.not("isComposing")),primary:9,secondary:[1033]}})),Dx(new r7({id:r8,precondition:void 0,handler:e=>e.toggleCaseSensitive(),kbOpts:{weight:105,kbExpr:yI.focus,primary:K4.primary,mac:K4.mac,win:K4.win,linux:K4.linux}})),Dx(new r7({id:a8,precondition:void 0,handler:e=>e.toggleWholeWords(),kbOpts:{weight:105,kbExpr:yI.focus,primary:q4.primary,mac:q4.mac,win:q4.win,linux:q4.linux}})),Dx(new r7({id:l8,precondition:void 0,handler:e=>e.toggleRegex(),kbOpts:{weight:105,kbExpr:yI.focus,primary:G4.primary,mac:G4.mac,win:G4.win,linux:G4.linux}})),Dx(new r7({id:d8,precondition:void 0,handler:e=>e.toggleSearchScope(),kbOpts:{weight:105,kbExpr:yI.focus,primary:Z4.primary,mac:Z4.mac,win:Z4.win,linux:Z4.linux}})),Dx(new r7({id:c8,precondition:void 0,handler:e=>e.togglePreserveCase(),kbOpts:{weight:105,kbExpr:yI.focus,primary:Y4.primary,mac:Y4.mac,win:Y4.win,linux:Y4.linux}})),Dx(new r7({id:h8,precondition:j4,handler:e=>e.replace(),kbOpts:{weight:105,kbExpr:yI.focus,primary:3094}})),Dx(new r7({id:h8,precondition:j4,handler:e=>e.replace(),kbOpts:{weight:105,kbExpr:Sy.and(yI.focus,$4),primary:3}})),Dx(new r7({id:u8,precondition:j4,handler:e=>e.replaceAll(),kbOpts:{weight:105,kbExpr:yI.focus,primary:2563}})),Dx(new r7({id:u8,precondition:j4,handler:e=>e.replaceAll(),kbOpts:{weight:105,kbExpr:Sy.and(yI.focus,$4),primary:void 0,mac:{primary:2051}}})),Dx(new r7({id:g8,precondition:j4,handler:e=>e.selectAllMatches(),kbOpts:{weight:105,kbExpr:yI.focus,primary:515}}));const a7=16777215,l7=4278190080;class d7{constructor(e,t,i){if(e.length!==t.length||e.length>65535)throw new Error("invalid startIndexes or endIndexes size");this._startIndexes=e,this._endIndexes=t,this._collapseStates=new Uint32Array(Math.ceil(e.length/32)),this._types=i,this._parentsComputed=!1}ensureParentIndices(){if(!this._parentsComputed){this._parentsComputed=!0;let e=[],t=(t,i)=>{let n=e[e.length-1];return this.getStartLineNumber(n)<=t&&this.getEndLineNumber(n)>=i};for(let i=0,n=this._startIndexes.length;i<n;i++){let n=this._startIndexes[i],o=this._endIndexes[i];if(n>a7||o>a7)throw new Error("startLineNumber or endLineNumber must not exceed 16777215");for(;e.length>0&&!t(n,o);)e.pop();let s=e.length>0?e[e.length-1]:-1;e.push(i),this._startIndexes[i]=n+((255&s)<<24),this._endIndexes[i]=o+((65280&s)<<16)}}}get length(){return this._startIndexes.length}getStartLineNumber(e){return this._startIndexes[e]&a7}getEndLineNumber(e){return this._endIndexes[e]&a7}getType(e){return this._types?this._types[e]:void 0}hasTypes(){return!!this._types}isCollapsed(e){let t=e/32|0,i=e%32;return 0!=(this._collapseStates[t]&1<<i)}setCollapsed(e,t){let i=e/32|0,n=e%32,o=this._collapseStates[i];this._collapseStates[i]=t?o|1<<n:o&~(1<<n)}setCollapsedAllOfType(e,t){let i=!1;if(this._types)for(let n=0;n<this._types.length;n++)this._types[n]===e&&(this.setCollapsed(n,t),i=!0);return i}toRegion(e){return new c7(this,e)}getParentIndex(e){this.ensureParentIndices();let t=((this._startIndexes[e]&l7)>>>24)+((this._endIndexes[e]&l7)>>>16);return 65535===t?-1:t}contains(e,t){return this.getStartLineNumber(e)<=t&&this.getEndLineNumber(e)>=t}findIndex(e){let t=0,i=this._startIndexes.length;if(0===i)return-1;for(;t<i;){let n=Math.floor((t+i)/2);e<this.getStartLineNumber(n)?i=n:t=n+1}return t-1}findRange(e){let t=this.findIndex(e);if(t>=0){if(this.getEndLineNumber(t)>=e)return t;for(t=this.getParentIndex(t);-1!==t;){if(this.contains(t,e))return t;t=this.getParentIndex(t)}}return-1}toString(){let e=[];for(let t=0;t<this.length;t++)e[t]=`[${this.isCollapsed(t)?"+":"-"}] ${this.getStartLineNumber(t)}/${this.getEndLineNumber(t)}`;return e.join(", ")}}class c7{constructor(e,t){this.ranges=e,this.index=t}get startLineNumber(){return this.ranges.getStartLineNumber(this.index)}get endLineNumber(){return this.ranges.getEndLineNumber(this.index)}get regionIndex(){return this.index}get parentIndex(){return this.ranges.getParentIndex(this.index)}get isCollapsed(){return this.ranges.isCollapsed(this.index)}containedBy(e){return e.startLineNumber<=this.startLineNumber&&e.endLineNumber>=this.endLineNumber}containsLine(e){return this.startLineNumber<=e&&e<=this.endLineNumber}}class h7{constructor(e,t){this._updateEventEmitter=new $o,this.onDidChange=this._updateEventEmitter.event,this._textModel=e,this._decorationProvider=t,this._regions=new d7(new Uint32Array(0),new Uint32Array(0)),this._editorDecorationIds=[],this._isInitialized=!1}get regions(){return this._regions}get textModel(){return this._textModel}get isInitialized(){return this._isInitialized}toggleCollapseState(e){if(!e.length)return;e=e.sort(((e,t)=>e.regionIndex-t.regionIndex));const t={};this._decorationProvider.changeDecorations((i=>{let n=0,o=-1,s=-1;const r=e=>{for(;n<e;){const e=this._regions.getEndLineNumber(n),t=this._regions.isCollapsed(n);e<=o&&i.changeDecorationOptions(this._editorDecorationIds[n],this._decorationProvider.getDecorationOption(t,e<=s)),t&&e>s&&(s=e),n++}};for(let a of e){let e=a.regionIndex,i=this._editorDecorationIds[e];if(i&&!t[i]){t[i]=!0,r(e);let n=!this._regions.isCollapsed(e);this._regions.setCollapsed(e,n),o=Math.max(o,this._regions.getEndLineNumber(e))}}r(this._regions.length)})),this._updateEventEmitter.fire({model:this,collapseStateChanged:e})}update(e,t=[]){let i=[],n=-1,o=(o,s)=>{const r=e.getStartLineNumber(o),a=e.getEndLineNumber(o);s||(s=e.isCollapsed(o)),s&&((e,i)=>{for(let n of t)if(e<n&&n<=i)return!0;return!1})(r,a)&&(s=!1),e.setCollapsed(o,s);const l=this._textModel.getLineMaxColumn(r),d={startLineNumber:r,startColumn:Math.max(l-1,1),endLineNumber:r,endColumn:l};i.push({range:d,options:this._decorationProvider.getDecorationOption(s,a<=n)}),s&&a>n&&(n=a)},s=0,r=()=>{for(;s<this._regions.length;){let e=this._regions.isCollapsed(s);if(s++,e)return s-1}return-1},a=0,l=r();for(;-1!==l&&a<e.length;){let t=this._textModel.getDecorationRange(this._editorDecorationIds[l]);if(t){let i=t.startLineNumber;if(t.startColumn===Math.max(t.endColumn-1,1)&&this._textModel.getLineMaxColumn(i)===t.endColumn)for(;a<e.length;){let t=e.getStartLineNumber(a);if(!(i>=t))break;o(a,i===t),a++}}l=r()}for(;a<e.length;)o(a,!1),a++;this._editorDecorationIds=this._decorationProvider.deltaDecorations(this._editorDecorationIds,i),this._regions=e,this._isInitialized=!0,this._updateEventEmitter.fire({model:this})}getMemento(){let e=[];for(let t=0;t<this._regions.length;t++)if(this._regions.isCollapsed(t)){let i=this._textModel.getDecorationRange(this._editorDecorationIds[t]);if(i){let n=i.startLineNumber,o=i.endLineNumber+this._regions.getEndLineNumber(t)-this._regions.getStartLineNumber(t);e.push({startLineNumber:n,endLineNumber:o})}}if(e.length>0)return e}applyMemento(e){if(!Array.isArray(e))return;let t=[];for(let i of e){let e=this.getRegionAtLine(i.startLineNumber);e&&!e.isCollapsed&&t.push(e)}this.toggleCollapseState(t)}dispose(){this._decorationProvider.deltaDecorations(this._editorDecorationIds,[])}getAllRegionsAtLine(e,t){let i=[];if(this._regions){let n=this._regions.findRange(e),o=1;for(;n>=0;){let e=this._regions.toRegion(n);t&&!t(e,o)||i.push(e),o++,n=e.parentIndex}}return i}getRegionAtLine(e){if(this._regions){let t=this._regions.findRange(e);if(t>=0)return this._regions.toRegion(t)}return null}getRegionsInside(e,t){let i=[],n=e?e.regionIndex+1:0,o=e?e.endLineNumber:Number.MAX_VALUE;if(t&&2===t.length){const e=[];for(let s=n,r=this._regions.length;s<r;s++){let n=this._regions.toRegion(s);if(!(this._regions.getStartLineNumber(s)<o))break;for(;e.length>0&&!n.containedBy(e[e.length-1]);)e.pop();e.push(n),t(n,e.length)&&i.push(n)}}else for(let s=n,r=this._regions.length;s<r;s++){let e=this._regions.toRegion(s);if(!(this._regions.getStartLineNumber(s)<o))break;t&&!t(e)||i.push(e)}return i}}function u7(e,t,i=Number.MAX_VALUE,n){let o=[];if(n&&n.length>0)for(let s of n){let n=e.getRegionAtLine(s);if(n&&(n.isCollapsed!==t&&o.push(n),i>1)){let s=e.getRegionsInside(n,((e,n)=>e.isCollapsed!==t&&n<i));o.push(...s)}}else{let n=e.getRegionsInside(null,((e,n)=>e.isCollapsed!==t&&n<i));o.push(...n)}e.toggleCollapseState(o)}function g7(e,t,i,n){let o=[];for(let s of n){let n=e.getAllRegionsAtLine(s,((e,n)=>e.isCollapsed!==t&&n<=i));o.push(...n)}e.toggleCollapseState(o)}function p7(e,t,i){let n=[];for(let s of i){const t=e.getAllRegionsAtLine(s,void 0);t.length>0&&n.push(t[0])}let o=e.getRegionsInside(null,(e=>n.every((t=>!t.containedBy(e)&&!e.containedBy(t)))&&e.isCollapsed!==t));e.toggleCollapseState(o)}function m7(e,t,i){let n=e.textModel,o=e.regions,s=[];for(let r=o.length-1;r>=0;r--)if(i!==o.isCollapsed(r)){let e=o.getStartLineNumber(r);t.test(n.getLineContent(e))&&s.push(o.toRegion(r))}e.toggleCollapseState(s)}function f7(e,t,i){let n=e.regions,o=[];for(let s=n.length-1;s>=0;s--)i!==n.isCollapsed(s)&&t===n.getType(s)&&o.push(n.toRegion(s));e.toggleCollapseState(o)}class _7{constructor(e){this._updateEventEmitter=new $o,this._hasLineChanges=!1,this._foldingModel=e,this._foldingModelListener=e.onDidChange((e=>this.updateHiddenRanges())),this._hiddenRanges=[],e.regions.length&&this.updateHiddenRanges()}get onDidChange(){return this._updateEventEmitter.event}get hiddenRanges(){return this._hiddenRanges}notifyChangeModelContent(e){this._hiddenRanges.length&&!this._hasLineChanges&&(this._hasLineChanges=e.changes.some((e=>e.range.endLineNumber!==e.range.startLineNumber||0!==uP(e.text)[0])))}updateHiddenRanges(){let e=!1,t=[],i=0,n=0,o=Number.MAX_VALUE,s=-1,r=this._foldingModel.regions;for(;i<r.length;i++){if(!r.isCollapsed(i))continue;let a=r.getStartLineNumber(i)+1,l=r.getEndLineNumber(i);o<=a&&l<=s||(!e&&n<this._hiddenRanges.length&&this._hiddenRanges[n].startLineNumber===a&&this._hiddenRanges[n].endLineNumber===l?(t.push(this._hiddenRanges[n]),n++):(e=!0,t.push(new qo(a,1,l,1))),o=a,s=l)}(this._hasLineChanges||e||n<this._hiddenRanges.length)&&this.applyHiddenRanges(t)}applyMemento(e){if(!Array.isArray(e)||0===e.length)return!1;let t=[];for(let i of e){if(!i.startLineNumber||!i.endLineNumber)return!1;t.push(new qo(i.startLineNumber+1,1,i.endLineNumber,1))}return this.applyHiddenRanges(t),!0}getMemento(){return this._hiddenRanges.map((e=>({startLineNumber:e.startLineNumber-1,endLineNumber:e.endLineNumber})))}applyHiddenRanges(e){this._hiddenRanges=e,this._hasLineChanges=!1,this._updateEventEmitter.fire(e)}hasRanges(){return this._hiddenRanges.length>0}isHidden(e){return null!==v7(this._hiddenRanges,e)}adjustSelections(e){let t=!1,i=this._foldingModel.textModel,n=null,o=e=>(n&&function(e,t){return e>=t.startLineNumber&&e<=t.endLineNumber}(e,n)||(n=v7(this._hiddenRanges,e)),n?n.startLineNumber-1:null);for(let s=0,r=e.length;s<r;s++){let n=e[s],r=o(n.startLineNumber);r&&(n=n.setStartPosition(r,i.getLineMaxColumn(r)),t=!0);let a=o(n.endLineNumber);a&&(n=n.setEndPosition(a,i.getLineMaxColumn(a)),t=!0),e[s]=n}return t}dispose(){this.hiddenRanges.length>0&&(this._hiddenRanges=[],this._updateEventEmitter.fire(this._hiddenRanges)),this._foldingModelListener&&(this._foldingModelListener.dispose(),this._foldingModelListener=null)}}function v7(e,t){let i=zl(e,(e=>t<e.startLineNumber))-1;return i>=0&&e[i].endLineNumber>=t?e[i]:null}class b7{constructor(e,t,i){this.editorModel=e,this.languageConfigurationService=t,this.maxFoldingRegions=i,this.id="indent"}dispose(){}compute(e,t){let i=this.languageConfigurationService.getLanguageConfiguration(this.editorModel.getLanguageId()).foldingRules,n=i&&!!i.offSide,o=i&&i.markers;return Promise.resolve(function(e,t,i,n,o){const s=e.getOptions().tabSize;let r,a=new w7(n=null!=n?n:5e3,o);i&&(r=new RegExp(`(${i.start.source})|(?:${i.end.source})`));let l=[],d=e.getLineCount()+1;l.push({indent:-1,endAbove:d,line:d});for(let c=e.getLineCount();c>0;c--){let i,n=e.getLineContent(c),o=yT(n,s),d=l[l.length-1];if(-1!==o){if(r&&(i=n.match(r))){if(!i[1]){l.push({indent:-2,endAbove:c,line:c});continue}{let e=l.length-1;for(;e>0&&-2!==l[e].indent;)e--;if(e>0){l.length=e+1,d=l[e],a.insertFirst(c,d.line,o),d.line=c,d.indent=o,d.endAbove=c;continue}}}if(d.indent>o){do{l.pop(),d=l[l.length-1]}while(d.indent>o);let e=d.endAbove-1;e-c>=1&&a.insertFirst(c,e,o)}d.indent===o?d.endAbove=c:l.push({indent:o,endAbove:c,line:c})}else t&&(d.endAbove=c)}return a.toIndentRanges(e)}(this.editorModel,n,o,this.maxFoldingRegions,t))}}class w7{constructor(e,t){this._notifyTooManyRegions=t,this._startIndexes=[],this._endIndexes=[],this._indentOccurrences=[],this._length=0,this._foldingRangesLimit=e}insertFirst(e,t,i){if(e>a7||t>a7)return;let n=this._length;this._startIndexes[n]=e,this._endIndexes[n]=t,this._length++,i<1e3&&(this._indentOccurrences[i]=(this._indentOccurrences[i]||0)+1)}toIndentRanges(e){if(this._length<=this._foldingRangesLimit){let e=new Uint32Array(this._length),t=new Uint32Array(this._length);for(let i=this._length-1,n=0;i>=0;i--,n++)e[n]=this._startIndexes[i],t[n]=this._endIndexes[i];return new d7(e,t)}{this._notifyTooManyRegions&&this._notifyTooManyRegions(this._foldingRangesLimit);let t=0,i=this._indentOccurrences.length;for(let e=0;e<this._indentOccurrences.length;e++){let n=this._indentOccurrences[e];if(n){if(n+t>this._foldingRangesLimit){i=e;break}t+=n}}const n=e.getOptions().tabSize;let o=new Uint32Array(this._foldingRangesLimit),s=new Uint32Array(this._foldingRangesLimit);for(let r=this._length-1,a=0;r>=0;r--){let l=this._startIndexes[r],d=yT(e.getLineContent(l),n);(d<i||d===i&&t++<this._foldingRangesLimit)&&(o[a]=l,s[a]=this._endIndexes[r],a++)}return new d7(o,s)}}}const C7={},y7="syntax";class x7{constructor(e,t,i,n){this.editorModel=e,this.providers=t,this.limit=n,this.id=y7;for(const o of t)"function"==typeof o.onDidChange&&(this.disposables||(this.disposables=new ws),this.disposables.add(o.onDidChange(i)))}compute(e,t){return function(e,t,i){let n=null,o=e.map(((e,o)=>Promise.resolve(e.provideFoldingRanges(t,C7,i)).then((e=>{if(!i.isCancellationRequested&&Array.isArray(e)){Array.isArray(n)||(n=[]);let i=t.getLineCount();for(let t of e)t.start>0&&t.end>t.start&&t.end<=i&&n.push({start:t.start,end:t.end,rank:o,kind:t.kind})}}),Ta)));return Promise.all(o).then((e=>n))}(this.providers,this.editorModel,e).then((e=>{if(e){return k7(e,this.limit,t)}return null}))}dispose(){var e;null===(e=this.disposables)||void 0===e||e.dispose()}}class S7{constructor(e,t){this._notifyTooManyRegions=t,this._startIndexes=[],this._endIndexes=[],this._nestingLevels=[],this._nestingLevelCounts=[],this._types=[],this._length=0,this._foldingRangesLimit=e}add(e,t,i,n){if(e>a7||t>a7)return;let o=this._length;this._startIndexes[o]=e,this._endIndexes[o]=t,this._nestingLevels[o]=n,this._types[o]=i,this._length++,n<30&&(this._nestingLevelCounts[n]=(this._nestingLevelCounts[n]||0)+1)}toIndentRanges(){if(this._length<=this._foldingRangesLimit){let e=new Uint32Array(this._length),t=new Uint32Array(this._length);for(let i=0;i<this._length;i++)e[i]=this._startIndexes[i],t[i]=this._endIndexes[i];return new d7(e,t,this._types)}{this._notifyTooManyRegions&&this._notifyTooManyRegions(this._foldingRangesLimit);let e=0,t=this._nestingLevelCounts.length;for(let s=0;s<this._nestingLevelCounts.length;s++){let i=this._nestingLevelCounts[s];if(i){if(i+e>this._foldingRangesLimit){t=s;break}e+=i}}let i=new Uint32Array(this._foldingRangesLimit),n=new Uint32Array(this._foldingRangesLimit),o=[];for(let s=0,r=0;s<this._length;s++){let a=this._nestingLevels[s];(a<t||a===t&&e++<this._foldingRangesLimit)&&(i[r]=this._startIndexes[s],n[r]=this._endIndexes[s],o[r]=this._types[s],r++)}return new d7(i,n,o)}}}function k7(e,t,i){let n,o=e.sort(((e,t)=>{let i=e.start-t.start;return 0===i&&(i=e.rank-t.rank),i})),s=new S7(t,i),r=[];for(let a of o)if(n){if(a.start>n.start)if(a.end<=n.end)r.push(n),n=a,s.add(a.start,a.end,a.kind&&a.kind.value,r.length);else{if(a.start>n.end){do{n=r.pop()}while(n&&a.start>n.end);n&&r.push(n),n=a}s.add(a.start,a.end,a.kind&&a.kind.value,r.length)}}else n=a,s.add(a.start,a.end,a.kind&&a.kind.value,r.length);return s.toIndentRanges()}const D7="init";class L7{constructor(e,t,i,n){if(this.editorModel=e,this.id=D7,t.length){let o=t=>({range:{startLineNumber:t.startLineNumber,startColumn:0,endLineNumber:t.endLineNumber,endColumn:e.getLineLength(t.endLineNumber)},options:{description:"folding-initializing-range-provider",stickiness:1}});this.decorationIds=e.deltaDecorations([],t.map(o)),this.timeout=setTimeout(i,n)}}dispose(){this.decorationIds&&(this.editorModel.deltaDecorations(this.decorationIds,[]),this.decorationIds=void 0),"number"==typeof this.timeout&&(clearTimeout(this.timeout),this.timeout=void 0)}compute(e){let t=[];if(this.decorationIds)for(let i of this.decorationIds){let e=this.editorModel.getDecorationRange(i);e&&t.push({start:e.startLineNumber,end:e.endLineNumber,rank:1})}return Promise.resolve(k7(t,Number.MAX_VALUE))}}const N7=CB("folding-expanded",br.chevronDown,mf(0,"Icon for expanded ranges in the editor glyph margin.")),E7=CB("folding-collapsed",br.chevronRight,mf(0,"Icon for collapsed ranges in the editor glyph margin."));class I7{constructor(e){this.editor=e,this.autoHideFoldingControls=!0,this.showFoldingHighlights=!0}getDecorationOption(e,t){return t?I7.HIDDEN_RANGE_DECORATION:e?this.showFoldingHighlights?I7.COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION:I7.COLLAPSED_VISUAL_DECORATION:this.autoHideFoldingControls?I7.EXPANDED_AUTO_HIDE_VISUAL_DECORATION:I7.EXPANDED_VISUAL_DECORATION}deltaDecorations(e,t){return this.editor.deltaDecorations(e,t)}changeDecorations(e){return this.editor.changeDecorations(e)}}I7.COLLAPSED_VISUAL_DECORATION=GP.register({description:"folding-collapsed-visual-decoration",stickiness:1,afterContentClassName:"inline-folded",isWholeLine:!0,firstLineDecorationClassName:ex.asClassName(E7)}),I7.COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION=GP.register({description:"folding-collapsed-highlighted-visual-decoration",stickiness:1,afterContentClassName:"inline-folded",className:"folded-background",isWholeLine:!0,firstLineDecorationClassName:ex.asClassName(E7)}),I7.EXPANDED_AUTO_HIDE_VISUAL_DECORATION=GP.register({description:"folding-expanded-auto-hide-visual-decoration",stickiness:1,isWholeLine:!0,firstLineDecorationClassName:ex.asClassName(N7)}),I7.EXPANDED_VISUAL_DECORATION=GP.register({description:"folding-expanded-visual-decoration",stickiness:1,isWholeLine:!0,firstLineDecorationClassName:"alwaysShowFoldIcons "+ex.asClassName(N7)}),I7.HIDDEN_RANGE_DECORATION=GP.register({description:"folding-hidden-range-decoration",stickiness:1});var T7=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},M7=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};const A7=new Uy("foldingEnabled",!1);let O7=class e extends Uo{constructor(e,t,i,n,o,s){super(),this.contextKeyService=t,this.languageConfigurationService=i,this.languageFeaturesService=s,this._tooManyRegionsNotified=!1,this.localToDispose=this._register(new ws),this.editor=e;const r=this.editor.getOptions();this._isEnabled=r.get(37),this._useFoldingProviders="indentation"!==r.get(38),this._unfoldOnClickAfterEndOfLine=r.get(42),this._restoringViewState=!1,this._currentModelHasFoldedImports=!1,this._foldingImportsByDefault=r.get(40),this._maxFoldingRegions=r.get(41),this.updateDebounceInfo=o.for(s.foldingRangeProvider,"Folding",{min:200}),this.foldingModel=null,this.hiddenRangeModel=null,this.rangeProvider=null,this.foldingRegionPromise=null,this.foldingStateMemento=null,this.foldingModelPromise=null,this.updateScheduler=null,this.cursorChangedScheduler=null,this.mouseDownInfo=null,this.foldingDecorationProvider=new I7(e),this.foldingDecorationProvider.autoHideFoldingControls="mouseover"===r.get(99),this.foldingDecorationProvider.showFoldingHighlights=r.get(39),this.foldingEnabled=A7.bindTo(this.contextKeyService),this.foldingEnabled.set(this._isEnabled),this._notifyTooManyRegions=e=>{this._tooManyRegionsNotified||(n.notify({severity:fF.Warning,sticky:!0,message:mf(0,"The number of foldable regions is limited to a maximum of {0}. Increase configuration option ['Folding Maximum Regions'](command:workbench.action.openSettings?[\"editor.foldingMaximumRegions\"]) to enable more.",e)}),this._tooManyRegionsNotified=!0)},this._register(this.editor.onDidChangeModel((()=>this.onModelChanged()))),this._register(this.editor.onDidChangeConfiguration((e=>{if(e.hasChanged(37)&&(this._isEnabled=this.editor.getOptions().get(37),this.foldingEnabled.set(this._isEnabled),this.onModelChanged()),e.hasChanged(41)&&(this._maxFoldingRegions=this.editor.getOptions().get(41),this._tooManyRegionsNotified=!1,this.onModelChanged()),e.hasChanged(99)||e.hasChanged(39)){const e=this.editor.getOptions();this.foldingDecorationProvider.autoHideFoldingControls="mouseover"===e.get(99),this.foldingDecorationProvider.showFoldingHighlights=e.get(39),this.triggerFoldingModelChanged()}e.hasChanged(38)&&(this._useFoldingProviders="indentation"!==this.editor.getOptions().get(38),this.onFoldingStrategyChanged()),e.hasChanged(42)&&(this._unfoldOnClickAfterEndOfLine=this.editor.getOptions().get(42)),e.hasChanged(40)&&(this._foldingImportsByDefault=this.editor.getOptions().get(40))}))),this.onModelChanged()}static get(t){return t.getContribution(e.ID)}saveViewState(){let e=this.editor.getModel();if(!e||!this._isEnabled||e.isTooLargeForTokenization())return{};if(this.foldingModel){let t=this.foldingModel.isInitialized?this.foldingModel.getMemento():this.hiddenRangeModel.getMemento(),i=this.rangeProvider?this.rangeProvider.id:void 0;return{collapsedRegions:t,lineCount:e.getLineCount(),provider:i,foldedImports:this._currentModelHasFoldedImports}}}restoreViewState(e){let t=this.editor.getModel();if(!t||!this._isEnabled||t.isTooLargeForTokenization()||!this.hiddenRangeModel)return;if(!e||e.lineCount!==t.getLineCount())return;if(this._currentModelHasFoldedImports=!!e.foldedImports,!e.collapsedRegions)return;e.provider!==y7&&e.provider!==D7||(this.foldingStateMemento=e);const i=e.collapsedRegions;if(this.hiddenRangeModel.applyMemento(i)){const e=this.getFoldingModel();e&&e.then((e=>{if(e){this._restoringViewState=!0;try{e.applyMemento(i)}finally{this._restoringViewState=!1}}})).then(void 0,Jo)}}onModelChanged(){this.localToDispose.clear();let e=this.editor.getModel();this._isEnabled&&e&&!e.isTooLargeForTokenization()&&(this._currentModelHasFoldedImports=!1,this.foldingModel=new h7(e,this.foldingDecorationProvider),this.localToDispose.add(this.foldingModel),this.hiddenRangeModel=new _7(this.foldingModel),this.localToDispose.add(this.hiddenRangeModel),this.localToDispose.add(this.hiddenRangeModel.onDidChange((e=>this.onHiddenRangesChanges(e)))),this.updateScheduler=new tb(this.updateDebounceInfo.get(e)),this.cursorChangedScheduler=new lb((()=>this.revealCursor()),200),this.localToDispose.add(this.cursorChangedScheduler),this.localToDispose.add(this.languageFeaturesService.foldingRangeProvider.onDidChange((()=>this.onFoldingStrategyChanged()))),this.localToDispose.add(this.editor.onDidChangeModelLanguageConfiguration((()=>this.onFoldingStrategyChanged()))),this.localToDispose.add(this.editor.onDidChangeModelContent((e=>this.onDidChangeModelContent(e)))),this.localToDispose.add(this.editor.onDidChangeCursorPosition((()=>this.onCursorPositionChanged()))),this.localToDispose.add(this.editor.onMouseDown((e=>this.onEditorMouseDown(e)))),this.localToDispose.add(this.editor.onMouseUp((e=>this.onEditorMouseUp(e)))),this.localToDispose.add({dispose:()=>{this.foldingRegionPromise&&(this.foldingRegionPromise.cancel(),this.foldingRegionPromise=null),this.updateScheduler&&this.updateScheduler.cancel(),this.updateScheduler=null,this.foldingModel=null,this.foldingModelPromise=null,this.hiddenRangeModel=null,this.cursorChangedScheduler=null,this.foldingStateMemento=null,this.rangeProvider&&this.rangeProvider.dispose(),this.rangeProvider=null}}),this.triggerFoldingModelChanged())}onFoldingStrategyChanged(){this.rangeProvider&&this.rangeProvider.dispose(),this.rangeProvider=null,this.triggerFoldingModelChanged()}getRangeProvider(e){if(this.rangeProvider)return this.rangeProvider;if(this.rangeProvider=new b7(e,this.languageConfigurationService,this._maxFoldingRegions),this._useFoldingProviders&&this.foldingModel){let t=this.languageFeaturesService.foldingRangeProvider.ordered(this.foldingModel.textModel);if(0===t.length&&this.foldingStateMemento&&this.foldingStateMemento.collapsedRegions){return this.rangeProvider=new L7(e,this.foldingStateMemento.collapsedRegions,(()=>{this.foldingStateMemento=null,this.onFoldingStrategyChanged()}),3e4)}t.length>0&&(this.rangeProvider=new x7(e,t,(()=>this.triggerFoldingModelChanged()),this._maxFoldingRegions))}return this.foldingStateMemento=null,this.rangeProvider}getFoldingModel(){return this.foldingModelPromise}onDidChangeModelContent(e){var t;null===(t=this.hiddenRangeModel)||void 0===t||t.notifyChangeModelContent(e),this.triggerFoldingModelChanged()}triggerFoldingModelChanged(){this.updateScheduler&&(this.foldingRegionPromise&&(this.foldingRegionPromise.cancel(),this.foldingRegionPromise=null),this.foldingModelPromise=this.updateScheduler.trigger((()=>{const e=this.foldingModel;if(!e)return null;const t=new ps(!0),i=this.getRangeProvider(e.textModel);let n=this.foldingRegionPromise=Xv((e=>i.compute(e,this._notifyTooManyRegions)));return n.then((i=>{if(i&&n===this.foldingRegionPromise){let n;if(this._foldingImportsByDefault&&!this._currentModelHasFoldedImports){const e=i.setCollapsedAllOfType(Tl.Imports.value,!0);e&&(n=hB.capture(this.editor),this._currentModelHasFoldedImports=e)}let o=this.editor.getSelections(),s=o?o.map((e=>e.startLineNumber)):[];e.update(i,s),n&&n.restore(this.editor);const r=this.updateDebounceInfo.update(e.textModel,t.elapsed());this.updateScheduler&&(this.updateScheduler.defaultDelay=r)}return e}))})).then(void 0,(e=>(Jo(e),null))))}onHiddenRangesChanges(e){if(this.hiddenRangeModel&&e.length&&!this._restoringViewState){let e=this.editor.getSelections();e&&this.hiddenRangeModel.adjustSelections(e)&&this.editor.setSelections(e)}this.editor.setHiddenAreas(e)}onCursorPositionChanged(){this.hiddenRangeModel&&this.hiddenRangeModel.hasRanges()&&this.cursorChangedScheduler.schedule()}revealCursor(){const e=this.getFoldingModel();e&&e.then((e=>{if(e){let t=this.editor.getSelections();if(t&&t.length>0){let i=[];for(let n of t){let t=n.selectionStartLineNumber;this.hiddenRangeModel&&this.hiddenRangeModel.isHidden(t)&&i.push(...e.getAllRegionsAtLine(t,(e=>e.isCollapsed&&t>e.startLineNumber)))}i.length&&(e.toggleCollapseState(i),this.reveal(t[0].getPosition()))}}})).then(void 0,Jo)}onEditorMouseDown(e){if(this.mouseDownInfo=null,!this.hiddenRangeModel||!e.target||!e.target.range)return;if(!e.event.leftButton&&!e.event.middleButton)return;const t=e.target.range;let i=!1;switch(e.target.type){case 4:{const t=e.target.detail,n=e.target.element.offsetLeft;if(t.offsetX-n<5)return;i=!0;break}case 7:if(this._unfoldOnClickAfterEndOfLine&&this.hiddenRangeModel.hasRanges()){if(!e.target.detail.isAfterLines)break}return;case 6:if(this.hiddenRangeModel.hasRanges()){let e=this.editor.getModel();if(e&&t.startColumn===e.getLineMaxColumn(t.startLineNumber))break}return;default:return}this.mouseDownInfo={lineNumber:t.startLineNumber,iconClicked:i}}onEditorMouseUp(e){const t=this.getFoldingModel();if(!t||!this.mouseDownInfo||!e.target)return;let i=this.mouseDownInfo.lineNumber,n=this.mouseDownInfo.iconClicked,o=e.target.range;if(o&&o.startLineNumber===i){if(n){if(4!==e.target.type)return}else{let e=this.editor.getModel();if(!e||o.startColumn!==e.getLineMaxColumn(i))return}t.then((t=>{if(t){let o=t.getRegionAtLine(i);if(o&&o.startLineNumber===i){let s=o.isCollapsed;if(n||s){let n=[];if(e.event.altKey){let e=e=>!e.containedBy(o)&&!o.containedBy(e),i=t.getRegionsInside(null,e);for(const t of i)t.isCollapsed&&n.push(t);0===n.length&&(n=i)}else{let i=e.event.middleButton||e.event.shiftKey;if(i)for(const e of t.getRegionsInside(o))e.isCollapsed===s&&n.push(e);!s&&i&&0!==n.length||n.push(o)}t.toggleCollapseState(n),this.reveal({lineNumber:i,column:1})}}}})).then(void 0,Jo)}}reveal(e){this.editor.revealPositionInCenterIfOutsideViewport(e,0)}};O7.ID="editor.contrib.folding",O7=T7([M7(1,$y),M7(2,Rv),M7(3,vF),M7(4,oW),M7(5,Lb)],O7);class R7 extends xx{runEditorCommand(e,t,i){const n=e.get(Rv),o=O7.get(t);if(!o)return;const s=o.getFoldingModel();return s?(this.reportTelemetry(e,t),s.then((e=>{if(e){this.invoke(o,e,t,i,n);const s=t.getSelection();s&&o.reveal(s.getStartPosition())}}))):void 0}getSelectedLines(e){let t=e.getSelections();return t?t.map((e=>e.startLineNumber)):[]}getLineNumbers(e,t){return e&&e.selectionLines?e.selectionLines.map((e=>e+1)):this.getSelectedLines(t)}run(e,t){}}function P7(e){if(!fr(e)){if(!Zs(e))return!1;const t=e;if(!fr(t.levels)&&!vr(t.levels))return!1;if(!fr(t.direction)&&!Gs(t.direction))return!1;if(!(fr(t.selectionLines)||Hl(t.selectionLines)&&t.selectionLines.every(vr)))return!1}return!0}class F7 extends R7{getFoldingLevel(){return parseInt(this.id.substr(F7.ID_PREFIX.length))}invoke(e,t,i){!function(e,t,i,n){let o=e.getRegionsInside(null,((e,o)=>o===t&&e.isCollapsed!==i&&!n.some((t=>e.containsLine(t)))));e.toggleCollapseState(o)}(t,this.getFoldingLevel(),!0,this.getSelectedLines(i))}}F7.ID_PREFIX="editor.foldLevel",F7.ID=e=>F7.ID_PREFIX+e;Ix(O7.ID,O7),Lx(class extends R7{constructor(){super({id:"editor.unfold",label:mf(0,"Unfold"),alias:"Unfold",precondition:A7,kbOpts:{kbExpr:yI.editorTextFocus,primary:3161,mac:{primary:2649},weight:100},description:{description:"Unfold the content in the editor",args:[{name:"Unfold editor argument",description:"Property-value pairs that can be passed through this argument:\n\t\t\t\t\t\t* 'levels': Number of levels to unfold. If not set, defaults to 1.\n\t\t\t\t\t\t* 'direction': If 'up', unfold given number of levels up otherwise unfolds down.\n\t\t\t\t\t\t* 'selectionLines': The start lines (0-based) of the editor selections to apply the unfold action to. If not set, the active selection(s) will be used.\n\t\t\t\t\t\t",constraint:P7,schema:{type:"object",properties:{levels:{type:"number",default:1},direction:{type:"string",enum:["up","down"],default:"down"},selectionLines:{type:"array",items:{type:"number"}}}}}]}})}invoke(e,t,i,n){let o=n&&n.levels||1,s=this.getLineNumbers(n,i);n&&"up"===n.direction?g7(t,!1,o,s):u7(t,!1,o,s)}}),Lx(class extends R7{constructor(){super({id:"editor.unfoldRecursively",label:mf(0,"Unfold Recursively"),alias:"Unfold Recursively",precondition:A7,kbOpts:{kbExpr:yI.editorTextFocus,primary:Ol(2089,2137),weight:100}})}invoke(e,t,i,n){u7(t,!1,Number.MAX_VALUE,this.getSelectedLines(i))}}),Lx(class extends R7{constructor(){super({id:"editor.fold",label:mf(0,"Fold"),alias:"Fold",precondition:A7,kbOpts:{kbExpr:yI.editorTextFocus,primary:3159,mac:{primary:2647},weight:100},description:{description:"Fold the content in the editor",args:[{name:"Fold editor argument",description:"Property-value pairs that can be passed through this argument:\n\t\t\t\t\t\t\t* 'levels': Number of levels to fold.\n\t\t\t\t\t\t\t* 'direction': If 'up', folds given number of levels up otherwise folds down.\n\t\t\t\t\t\t\t* 'selectionLines': The start lines (0-based) of the editor selections to apply the fold action to. If not set, the active selection(s) will be used.\n\t\t\t\t\t\t\tIf no levels or direction is set, folds the region at the locations or if already collapsed, the first uncollapsed parent instead.\n\t\t\t\t\t\t",constraint:P7,schema:{type:"object",properties:{levels:{type:"number"},direction:{type:"string",enum:["up","down"]},selectionLines:{type:"array",items:{type:"number"}}}}}]}})}invoke(e,t,i,n){let o=this.getLineNumbers(n,i);const s=n&&n.levels,r=n&&n.direction;"number"!=typeof s&&"string"!=typeof r?function(e,t,i){let n=[];for(let o of i){let i=e.getAllRegionsAtLine(o,(e=>e.isCollapsed!==t));i.length>0&&n.push(i[0])}e.toggleCollapseState(n)}(t,!0,o):"up"===r?g7(t,!0,s||1,o):u7(t,!0,s||1,o)}}),Lx(class extends R7{constructor(){super({id:"editor.foldRecursively",label:mf(0,"Fold Recursively"),alias:"Fold Recursively",precondition:A7,kbOpts:{kbExpr:yI.editorTextFocus,primary:Ol(2089,2135),weight:100}})}invoke(e,t,i){let n=this.getSelectedLines(i);u7(t,!0,Number.MAX_VALUE,n)}}),Lx(class extends R7{constructor(){super({id:"editor.foldAll",label:mf(0,"Fold All"),alias:"Fold All",precondition:A7,kbOpts:{kbExpr:yI.editorTextFocus,primary:Ol(2089,2069),weight:100}})}invoke(e,t,i){u7(t,!0)}}),Lx(class extends R7{constructor(){super({id:"editor.unfoldAll",label:mf(0,"Unfold All"),alias:"Unfold All",precondition:A7,kbOpts:{kbExpr:yI.editorTextFocus,primary:Ol(2089,2088),weight:100}})}invoke(e,t,i){u7(t,!1)}}),Lx(class extends R7{constructor(){super({id:"editor.foldAllBlockComments",label:mf(0,"Fold All Block Comments"),alias:"Fold All Block Comments",precondition:A7,kbOpts:{kbExpr:yI.editorTextFocus,primary:Ol(2089,2133),weight:100}})}invoke(e,t,i,n,o){if(t.regions.hasTypes())f7(t,Tl.Comment.value,!0);else{const e=i.getModel();if(!e)return;const n=o.getLanguageConfiguration(e.getLanguageId()).comments;if(n&&n.blockCommentStartToken){m7(t,new RegExp("^\\s*"+Xo(n.blockCommentStartToken)),!0)}}}}),Lx(class extends R7{constructor(){super({id:"editor.foldAllMarkerRegions",label:mf(0,"Fold All Regions"),alias:"Fold All Regions",precondition:A7,kbOpts:{kbExpr:yI.editorTextFocus,primary:Ol(2089,2077),weight:100}})}invoke(e,t,i,n,o){if(t.regions.hasTypes())f7(t,Tl.Region.value,!0);else{const e=i.getModel();if(!e)return;const n=o.getLanguageConfiguration(e.getLanguageId()).foldingRules;if(n&&n.markers&&n.markers.start){m7(t,new RegExp(n.markers.start),!0)}}}}),Lx(class extends R7{constructor(){super({id:"editor.unfoldAllMarkerRegions",label:mf(0,"Unfold All Regions"),alias:"Unfold All Regions",precondition:A7,kbOpts:{kbExpr:yI.editorTextFocus,primary:Ol(2089,2078),weight:100}})}invoke(e,t,i,n,o){if(t.regions.hasTypes())f7(t,Tl.Region.value,!1);else{const e=i.getModel();if(!e)return;const n=o.getLanguageConfiguration(e.getLanguageId()).foldingRules;if(n&&n.markers&&n.markers.start){m7(t,new RegExp(n.markers.start),!1)}}}}),Lx(class extends R7{constructor(){super({id:"editor.foldAllExcept",label:mf(0,"Fold All Regions Except Selected"),alias:"Fold All Regions Except Selected",precondition:A7,kbOpts:{kbExpr:yI.editorTextFocus,primary:Ol(2089,2131),weight:100}})}invoke(e,t,i){p7(t,!0,this.getSelectedLines(i))}}),Lx(class extends R7{constructor(){super({id:"editor.unfoldAllExcept",label:mf(0,"Unfold All Regions Except Selected"),alias:"Unfold All Regions Except Selected",precondition:A7,kbOpts:{kbExpr:yI.editorTextFocus,primary:Ol(2089,2129),weight:100}})}invoke(e,t,i){p7(t,!1,this.getSelectedLines(i))}}),Lx(class extends R7{constructor(){super({id:"editor.toggleFold",label:mf(0,"Toggle Fold"),alias:"Toggle Fold",precondition:A7,kbOpts:{kbExpr:yI.editorTextFocus,primary:Ol(2089,2090),weight:100}})}invoke(e,t,i){!function(e,t,i){let n=[];for(let o of i){let i=e.getRegionAtLine(o);if(i){const o=!i.isCollapsed;if(n.push(i),t>1){let s=e.getRegionsInside(i,((e,i)=>e.isCollapsed!==o&&i<t));n.push(...s)}}}e.toggleCollapseState(n)}(t,1,this.getSelectedLines(i))}}),Lx(class extends R7{constructor(){super({id:"editor.gotoParentFold",label:mf(0,"Go to Parent Fold"),alias:"Go to Parent Fold",precondition:A7,kbOpts:{kbExpr:yI.editorTextFocus,weight:100}})}invoke(e,t,i){let n=this.getSelectedLines(i);if(n.length>0){let e=function(e,t){let i=null,n=t.getRegionAtLine(e);if(null!==n&&(i=n.startLineNumber,e===i)){let e=n.parentIndex;i=-1!==e?t.regions.getStartLineNumber(e):null}return i}(n[0],t);null!==e&&i.setSelection({startLineNumber:e,startColumn:1,endLineNumber:e,endColumn:1})}}}),Lx(class extends R7{constructor(){super({id:"editor.gotoPreviousFold",label:mf(0,"Go to Previous Folding Range"),alias:"Go to Previous Folding Range",precondition:A7,kbOpts:{kbExpr:yI.editorTextFocus,weight:100}})}invoke(e,t,i){let n=this.getSelectedLines(i);if(n.length>0){let e=function(e,t){let i=t.getRegionAtLine(e);if(null!==i&&i.startLineNumber===e){if(e!==i.startLineNumber)return i.startLineNumber;{let e=i.parentIndex,n=0;for(-1!==e&&(n=t.regions.getStartLineNumber(i.parentIndex));null!==i;){if(!(i.regionIndex>0))return null;if(i=t.regions.toRegion(i.regionIndex-1),i.startLineNumber<=n)return null;if(i.parentIndex===e)return i.startLineNumber}}}else if(t.regions.length>0)for(i=t.regions.toRegion(t.regions.length-1);null!==i;){if(i.startLineNumber<e)return i.startLineNumber;i=i.regionIndex>0?t.regions.toRegion(i.regionIndex-1):null}return null}(n[0],t);null!==e&&i.setSelection({startLineNumber:e,startColumn:1,endLineNumber:e,endColumn:1})}}}),Lx(class extends R7{constructor(){super({id:"editor.gotoNextFold",label:mf(0,"Go to Next Folding Range"),alias:"Go to Next Folding Range",precondition:A7,kbOpts:{kbExpr:yI.editorTextFocus,weight:100}})}invoke(e,t,i){let n=this.getSelectedLines(i);if(n.length>0){let e=function(e,t){let i=t.getRegionAtLine(e);if(null!==i&&i.startLineNumber===e){let e=i.parentIndex,n=0;if(-1!==e)n=t.regions.getEndLineNumber(i.parentIndex);else{if(0===t.regions.length)return null;n=t.regions.getEndLineNumber(t.regions.length-1)}for(;null!==i;){if(!(i.regionIndex<t.regions.length))return null;if(i=t.regions.toRegion(i.regionIndex+1),i.startLineNumber>=n)return null;if(i.parentIndex===e)return i.startLineNumber}}else if(t.regions.length>0)for(i=t.regions.toRegion(0);null!==i;){if(i.startLineNumber>e)return i.startLineNumber;i=i.regionIndex<t.regions.length?t.regions.toRegion(i.regionIndex+1):null}return null}(n[0],t);null!==e&&i.setSelection({startLineNumber:e,startColumn:1,endLineNumber:e,endColumn:1})}}});for(let e=1;e<=7;e++)Ex(new F7({id:F7.ID(e),label:mf(0,"Fold Level {0}",e),alias:`Fold Level ${e}`,precondition:A7,kbOpts:{kbExpr:yI.editorTextFocus,primary:Ol(2089,2048|21+e),weight:100}}));const B7=_S("editor.foldBackground",{light:yL(Ek,.3),dark:yL(Ek,.3),hc:null},mf(0,"Background color behind folded ranges. The color must not be opaque so as not to hide underlying decorations."),!0),V7=_S("editorGutter.foldingControlForeground",{dark:wS,light:wS,hc:wS},mf(0,"Color of the folding control in the editor gutter."));sx(((e,t)=>{const i=e.getColor(B7);i&&t.addRule(`.monaco-editor .folded-background { background-color: ${i}; }`);const n=e.getColor(V7);n&&t.addRule(`\n\t\t.monaco-editor .cldr${ex.asCSSSelector(N7)},\n\t\t.monaco-editor .cldr${ex.asCSSSelector(E7)} {\n\t\t\tcolor: ${n} !important;\n\t\t}\n\t\t`)}));Lx(class extends xx{constructor(){super({id:"editor.action.fontZoomIn",label:mf(0,"Editor Font Zoom In"),alias:"Editor Font Zoom In",precondition:void 0})}run(e,t){v_.setZoomLevel(v_.getZoomLevel()+1)}}),Lx(class extends xx{constructor(){super({id:"editor.action.fontZoomOut",label:mf(0,"Editor Font Zoom Out"),alias:"Editor Font Zoom Out",precondition:void 0})}run(e,t){v_.setZoomLevel(v_.getZoomLevel()-1)}}),Lx(class extends xx{constructor(){super({id:"editor.action.fontZoomReset",label:mf(0,"Editor Font Zoom Reset"),alias:"Editor Font Zoom Reset",precondition:void 0})}run(e,t){v_.setZoomLevel(0)}});var W7=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},z7=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}},H7=globalThis&&globalThis.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{l(n.next(e))}catch(t){s(t)}}function a(e){try{l(n.throw(e))}catch(t){s(t)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}l((n=n.apply(e,t||[])).next())}))};let j7=class{constructor(e,t,i){this._editor=e,this._languageFeaturesService=t,this._workerService=i,this._disposables=new ws,this._sessionDisposables=new ws,this._disposables.add(t.onTypeFormattingEditProvider.onDidChange(this._update,this)),this._disposables.add(e.onDidChangeModel((()=>this._update()))),this._disposables.add(e.onDidChangeModelLanguage((()=>this._update()))),this._disposables.add(e.onDidChangeConfiguration((e=>{e.hasChanged(49)&&this._update()})))}dispose(){this._disposables.dispose(),this._sessionDisposables.dispose()}_update(){if(this._sessionDisposables.clear(),!this._editor.getOption(49))return;if(!this._editor.hasModel())return;const e=this._editor.getModel(),[t]=this._languageFeaturesService.onTypeFormattingEditProvider.ordered(e);if(!t||!t.autoFormatTriggerCharacters)return;let i=new jl;for(let n of t.autoFormatTriggerCharacters)i.add(n.charCodeAt(0));this._sessionDisposables.add(this._editor.onDidType((e=>{let t=e.charCodeAt(e.length-1);i.has(t)&&this._trigger(String.fromCharCode(t))})))}_trigger(e){if(!this._editor.hasModel())return;if(this._editor.getSelections().length>1||!this._editor.getSelection().isEmpty())return;const t=this._editor.getModel(),i=this._editor.getPosition(),n=new as,o=this._editor.onDidChangeModelContent((e=>{if(e.isFlush)return n.cancel(),void o.dispose();for(let t=0,s=e.changes.length;t<s;t++){if(e.changes[t].range.endLineNumber<=i.lineNumber)return n.cancel(),void o.dispose()}}));FX(this._workerService,this._languageFeaturesService,t,i,e,t.getFormattingOptions(),n.token).then((e=>{n.token.isCancellationRequested||gs(e)&&(DX.execute(this._editor,e,!0),IX(e))})).finally((()=>{o.dispose()}))}};j7.ID="editor.contrib.autoFormat",j7=W7([z7(1,Lb),z7(2,BB)],j7);let U7=class{constructor(e,t,i){this.editor=e,this._languageFeaturesService=t,this._instantiationService=i,this._callOnDispose=new ws,this._callOnModel=new ws,this._callOnDispose.add(e.onDidChangeConfiguration((()=>this._update()))),this._callOnDispose.add(e.onDidChangeModel((()=>this._update()))),this._callOnDispose.add(e.onDidChangeModelLanguage((()=>this._update()))),this._callOnDispose.add(t.documentRangeFormattingEditProvider.onDidChange(this._update,this))}dispose(){this._callOnDispose.dispose(),this._callOnModel.dispose()}_update(){this._callOnModel.clear(),this.editor.getOption(48)&&this.editor.hasModel()&&this._languageFeaturesService.documentRangeFormattingEditProvider.has(this.editor.getModel())&&this._callOnModel.add(this.editor.onDidPaste((({range:e})=>this._trigger(e))))}_trigger(e){this.editor.hasModel()&&(this.editor.getSelections().length>1||this._instantiationService.invokeFunction(AX,this.editor,e,2,UB.None,Ia.None).catch(Jo))}};U7.ID="editor.contrib.formatOnPaste",U7=W7([z7(1,Lb),z7(2,k_)],U7);Ix(j7.ID,j7),Ix(U7.ID,U7),Lx(class extends xx{constructor(){super({id:"editor.action.formatDocument",label:mf(0,"Format Document"),alias:"Format Document",precondition:Sy.and(yI.notInCompositeEditor,yI.writable,yI.hasDocumentFormattingProvider),kbOpts:{kbExpr:yI.editorTextFocus,primary:1572,linux:{primary:3111},weight:100},contextMenuOpts:{group:"1_modification",order:1.3}})}run(e,t){return H7(this,void 0,void 0,(function*(){if(t.hasModel()){const i=e.get(k_),n=e.get($B);yield n.showWhile(i.invokeFunction(RX,t,1,UB.None,Ia.None),250)}}))}}),Lx(class extends xx{constructor(){super({id:"editor.action.formatSelection",label:mf(0,"Format Selection"),alias:"Format Selection",precondition:Sy.and(yI.writable,yI.hasDocumentSelectionFormattingProvider),kbOpts:{kbExpr:yI.editorTextFocus,primary:Ol(2089,2084),weight:100},contextMenuOpts:{when:yI.hasNonEmptySelection,group:"1_modification",order:1.31}})}run(e,t){return H7(this,void 0,void 0,(function*(){if(!t.hasModel())return;const i=e.get(k_),n=t.getModel(),o=t.getSelections().map((e=>e.isEmpty()?new qo(e.startLineNumber,1,e.startLineNumber,n.getLineMaxColumn(e.startLineNumber)):e)),s=e.get($B);yield s.showWhile(i.invokeFunction(AX,t,o,1,UB.None,Ia.None),250)}))}}),Cy.registerCommand("editor.action.format",(e=>H7(void 0,void 0,void 0,(function*(){const t=e.get(N_).getFocusedCodeEditor();if(!t||!t.hasModel())return;const i=e.get(wy);t.getSelection().isEmpty()?yield i.executeCommand("editor.action.formatDocument"):yield i.executeCommand("editor.action.formatSelection")}))));var $7=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},K7=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}},q7=globalThis&&globalThis.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{l(n.next(e))}catch(t){s(t)}}function a(e){try{l(n.throw(e))}catch(t){s(t)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}l((n=n.apply(e,t||[])).next())}))};class G7{remove(){this.parent&&this.parent.children.delete(this.id)}static findId(e,t){let i;"string"==typeof e?i=`${t.id}/${e}`:(i=`${t.id}/${e.name}`,void 0!==t.children.get(i)&&(i=`${t.id}/${e.name}_${e.range.startLineNumber}_${e.range.startColumn}`));let n=i;for(let o=0;void 0!==t.children.get(n);o++)n=`${i}_${o}`;return n}static empty(e){return 0===e.children.size}}class Z7 extends G7{constructor(e,t,i){super(),this.id=e,this.parent=t,this.symbol=i,this.children=new Map}}class Y7 extends G7{constructor(e,t,i,n){super(),this.id=e,this.parent=t,this.label=i,this.order=n,this.children=new Map}}class X7 extends G7{constructor(e){super(),this.uri=e,this.id="root",this.parent=void 0,this._groups=new Map,this.children=new Map,this.id="root",this.parent=void 0}static create(e,t,i){const n=new as(i),o=new X7(t.uri),s=e.ordered(t),r=s.map(((e,i)=>{var s;let r=G7.findId(`provider_${i}`,o),a=new Y7(r,o,null!==(s=e.displayName)&&void 0!==s?s:"Unknown Outline Provider",i);return Promise.resolve(e.provideDocumentSymbols(t,n.token)).then((e=>{for(const t of e||[])X7._makeOutlineElement(t,a);return a}),(e=>(Ta(e),a))).then((e=>{G7.empty(e)?e.remove():o._groups.set(r,e)}))})),a=e.onDidChange((()=>{const i=e.ordered(t);jo(i,s)||n.cancel()}));return Promise.all(r).then((()=>n.token.isCancellationRequested&&!i.isCancellationRequested?X7.create(e,t,i):o._compact())).finally((()=>{a.dispose()}))}static _makeOutlineElement(e,t){let i=G7.findId(e,t),n=new Z7(i,t,e);if(e.children)for(const o of e.children)X7._makeOutlineElement(o,n);t.children.set(n.id,n)}_compact(){let e=0;for(const[t,i]of this._groups)0===i.children.size?this._groups.delete(t):e+=1;if(1!==e)this.children=this._groups;else{let e=Hs.first(this._groups.values());for(let[,t]of e.children)t.parent=this,this.children.set(t.id,t)}return this}getTopLevelSymbols(){const e=[];for(const t of this.children.values())t instanceof Z7?e.push(t.symbol):e.push(...Hs.map(t.children.values(),(e=>e.symbol)));return e.sort(((e,t)=>qo.compareRangesUsingStarts(e.range,t.range)))}asListOfDocumentSymbols(){const e=this.getTopLevelSymbols(),t=[];return X7._flattenDocumentSymbols(t,e,""),t.sort(((e,t)=>er.compare(qo.getStartPosition(e.range),qo.getStartPosition(t.range))||er.compare(qo.getEndPosition(t.range),qo.getEndPosition(e.range))))}static _flattenDocumentSymbols(e,t,i){for(const n of t)e.push({kind:n.kind,tags:n.tags,name:n.name,detail:n.detail,containerName:n.containerName||i,range:n.range,selectionRange:n.selectionRange,children:void 0}),n.children&&X7._flattenDocumentSymbols(e,n.children,n.name)}}const Q7=L_("IOutlineModelService");let J7=class{constructor(e,t,i){this._languageFeaturesService=e,this._disposables=new ws,this._cache=new QV(10,.7),this._debounceInformation=t.for(e.documentSymbolProvider,"DocumentSymbols",{min:350}),this._disposables.add(i.onModelRemoved((e=>{this._cache.delete(e.id)})))}dispose(){this._disposables.dispose()}getOrCreate(e,t){return q7(this,void 0,void 0,(function*(){const i=this._languageFeaturesService.documentSymbolProvider,n=i.ordered(e);let o=this._cache.get(e.id);if(!o||o.versionId!==e.getVersionId()||!jo(o.provider,n)){let t=new as;o={versionId:e.getVersionId(),provider:n,promiseCnt:0,source:t,promise:X7.create(i,e,t.token),model:void 0},this._cache.set(e.id,o);const s=Date.now();o.promise.then((t=>{o.model=t,this._debounceInformation.update(e,Date.now()-s)})).catch((t=>{this._cache.delete(e.id)}))}if(o.model)return o.model;o.promiseCnt+=1;const s=t.onCancellationRequested((()=>{0==--o.promiseCnt&&(o.source.cancel(),this._cache.delete(e.id))}));try{return yield o.promise}finally{s.dispose()}}))}};J7=$7([K7(0,Lb),K7(1,oW),K7(2,Gv)],J7),Iv(Q7,J7,!0);var e9=globalThis&&globalThis.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{l(n.next(e))}catch(t){s(t)}}function a(e){try{l(n.throw(e))}catch(t){s(t)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}l((n=n.apply(e,t||[])).next())}))};Cy.registerCommand("_executeDocumentSymbolProvider",(function(e,...t){return e9(this,void 0,void 0,(function*(){const[i]=t;Js(Ps.isUri(i));const n=e.get(Q7),o=e.get(gy),s=yield o.createModelReference(i);try{return(yield n.getOrCreate(s.object.textEditorModel,Ia.None)).getTopLevelSymbols()}finally{s.dispose()}}))}));const t9="editor.action.inlineSuggest.commit";class i9{constructor(e,t,i=0){this.lineNumber=e,this.parts=t,this.additionalReservedLineCount=i}renderForScreenReader(e){if(0===this.parts.length)return"";const t=this.parts[this.parts.length-1],i=function(e,t){const i=new n9(e),n=t.map((e=>{const t=qo.lift(e.range);return{startOffset:i.getOffset(t.getStartPosition()),endOffset:i.getOffset(t.getEndPosition()),text:e.text}}));n.sort(((e,t)=>t.startOffset-e.startOffset));for(const o of n)e=e.substring(0,o.startOffset)+o.text+e.substring(o.endOffset);return e}(e.substr(0,t.column-1),this.parts.map((e=>({range:{startLineNumber:1,endLineNumber:1,startColumn:e.column,endColumn:e.column},text:e.lines.join("\n")}))));return i.substring(this.parts[0].column-1)}}class n9{constructor(e){this.lineStartOffsetByLineIdx=[],this.lineStartOffsetByLineIdx.push(0);for(let t=0;t<e.length;t++)"\n"===e.charAt(t)&&this.lineStartOffsetByLineIdx.push(t+1)}getOffset(e){return this.lineStartOffsetByLineIdx[e.lineNumber-1]+e.column-1}}class o9{constructor(e,t,i){this.column=e,this.lines=t,this.preview=i}}class s9 extends Uo{constructor(e){super(),this.editor=e,this._expanded=void 0,this.onDidChangeEmitter=new $o,this.onDidChange=this.onDidChangeEmitter.event,this._register(e.onDidChangeConfiguration((e=>{e.hasChanged(106)&&void 0===this._expanded&&this.onDidChangeEmitter.fire()})))}setExpanded(e){this._expanded=!0,this.onDidChangeEmitter.fire()}}function r9(e,t,i,n,o=0){if(e.range.startLineNumber!==e.range.endLineNumber)return;const s=t.getLineContent(e.range.startLineNumber),r=ts(s).length;if(e.range.startColumn-1<=r){const t=ts(e.text).length,i=s.substring(e.range.startColumn-1,r),n=qo.fromPositions(e.range.getStartPosition().delta(0,i.length),e.range.getEndPosition()),o=e.text.startsWith(i)?e.text.substring(i.length):e.text.substring(t);e={range:n,text:o,command:e.command}}const a=t.getValueInRange(e.range),l=function(e,t){if((null==a9?void 0:a9.originalValue)===e&&(null==a9?void 0:a9.newValue)===t)return null==a9?void 0:a9.changes;{const i=function(e,t){if(e.length>5e3||t.length>5e3)return;function i(e){let t=0;for(let i=0,n=e.length;i<n;i++){const n=e.charCodeAt(i);n>t&&(t=n)}return t}const n=Math.max(i(e),i(t));function o(e){if(e<0)throw new Error("unexpected");return n+e+1}function s(e){let t=0,i=0;const n=new Int32Array(e.length);for(let s=0,r=e.length;s<r;s++){const r=100*i+t;"("===e[s]?(n[s]=o(2*r),t++):")"===e[s]?(n[s]=o(2*r+1),1===t&&i++,t=Math.max(t-1,0)):n[s]=e.charCodeAt(s)}return n}const r=s(e),a=s(t);return new za({getElements:()=>r},{getElements:()=>a}).ComputeDiff(!1).changes}(e,t);return a9={originalValue:e,newValue:t,changes:i},i}}(a,e.text);if(!l)return;const d=e.range.startLineNumber,c=new Array;if("prefix"===i){const e=l.filter((e=>0===e.originalLength));if(e.length>1||1===e.length&&e[0].originalStart!==a.length)return}const h=e.text.length-o;for(const u of l){const t=e.range.startColumn+u.originalStart+u.originalLength;if("subwordSmart"===i&&n&&n.lineNumber===e.range.startLineNumber&&t<n.column)return;if(u.originalLength>0)return;if(0===u.modifiedLength)continue;const o=u.modifiedStart+u.modifiedLength,s=Math.max(u.modifiedStart,Math.min(o,h)),r=e.text.substring(u.modifiedStart,s),a=e.text.substring(s,Math.max(u.modifiedStart,o));if(r.length>0){const e=Is(r);c.push(new o9(t,e,!1))}if(a.length>0){const e=Is(a);c.push(new o9(t,e,!0))}}return new i9(d,c,0)}let a9;class l9{constructor(e){this.lines=e}getLineCount(){return this.lines.length}getLineLength(e){return this.lines[e-1].getLineContent().length}getLineTokens(e){return this.lines[e-1]}}var d9=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},c9=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}},h9=globalThis&&globalThis.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{l(n.next(e))}catch(t){s(t)}}function a(e){try{l(n.throw(e))}catch(t){s(t)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}l((n=n.apply(e,t||[])).next())}))};let u9=class extends Uo{constructor(e,t,i,n,o,s){super(),this.editor=e,this.cache=t,this.commandService=i,this.languageConfigurationService=n,this.languageFeaturesService=o,this.debounceService=s,this.onDidChangeEmitter=new $o,this.onDidChange=this.onDidChangeEmitter.event,this.completionSession=this._register(new Rr),this.active=!1,this.disposed=!1,this.debounceValue=this.debounceService.for(this.languageFeaturesService.inlineCompletionsProvider,"InlineCompletionsDebounce",{min:50,max:200}),this._register(i.onDidExecuteCommand((t=>{new Set([TI.Tab.id,TI.DeleteLeft.id,TI.DeleteRight.id,t9,"acceptSelectedSuggestion"]).has(t.commandId)&&e.hasTextFocus()&&this.handleUserInput()}))),this._register(this.editor.onDidType((e=>{this.handleUserInput()}))),this._register(this.editor.onDidChangeCursorPosition((e=>{this.session&&!this.session.isValid&&this.hide()}))),this._register(es((()=>{this.disposed=!0}))),this._register(this.editor.onDidBlurEditorWidget((()=>{this.hide()})))}handleUserInput(){this.session&&!this.session.isValid&&this.hide(),setTimeout((()=>{this.disposed||this.startSessionIfTriggered()}),0)}get session(){return this.completionSession.value}get ghostText(){var e;return null===(e=this.session)||void 0===e?void 0:e.ghostText}get minReservedLineCount(){return this.session?this.session.minReservedLineCount:0}setExpanded(e){var t;null===(t=this.session)||void 0===t||t.setExpanded(e)}setActive(e){var t;this.active=e,e&&(null===(t=this.session)||void 0===t||t.scheduleAutomaticUpdate())}startSessionIfTriggered(){this.editor.getOption(55).enabled&&(this.session&&this.session.isValid||this.trigger(Ul.Automatic))}trigger(e){this.completionSession.value?e===Ul.Explicit&&this.completionSession.value.ensureUpdateWithExplicitContext():(this.completionSession.value=new g9(this.editor,this.editor.getPosition(),(()=>this.active),this.commandService,this.cache,e,this.languageConfigurationService,this.languageFeaturesService.inlineCompletionsProvider,this.debounceValue),this.completionSession.value.takeOwnership(this.completionSession.value.onDidChange((()=>{this.onDidChangeEmitter.fire()}))))}hide(){this.completionSession.clear(),this.onDidChangeEmitter.fire()}commitCurrentSuggestion(){var e;null===(e=this.session)||void 0===e||e.commitCurrentCompletion()}showNext(){var e;null===(e=this.session)||void 0===e||e.showNextInlineCompletion()}showPrevious(){var e;null===(e=this.session)||void 0===e||e.showPreviousInlineCompletion()}hasMultipleInlineCompletions(){var e;return h9(this,void 0,void 0,(function*(){const t=yield null===(e=this.session)||void 0===e?void 0:e.hasMultipleInlineCompletions();return void 0!==t&&t}))}};u9=d9([c9(2,wy),c9(3,Rv),c9(4,Lb),c9(5,oW)],u9);class g9 extends s9{constructor(e,t,i,n,o,s,r,a,l){let d;super(e),this.triggerPosition=t,this.shouldUpdate=i,this.commandService=n,this.cache=o,this.initialTriggerKind=s,this.languageConfigurationService=r,this.registry=a,this.debounce=l,this.minReservedLineCount=0,this.updateOperation=this._register(new Rr),this.updateSoon=this._register(new lb((()=>{let e=this.initialTriggerKind;return this.initialTriggerKind=Ul.Automatic,this.update(e)}),50)),this.currentlySelectedCompletionId=void 0,this._register(this.onDidChange((()=>{const e=this.currentCompletion;if(e&&e.sourceInlineCompletion!==d){d=e.sourceInlineCompletion;const t=e.sourceProvider;t.handleItemDidShow&&t.handleItemDidShow(e.sourceInlineCompletions,d)}}))),this._register(es((()=>{this.cache.clear()}))),this._register(this.editor.onDidChangeCursorPosition((e=>{this.cache.value&&this.onDidChangeEmitter.fire()}))),this._register(this.editor.onDidChangeModelContent((e=>{this.scheduleAutomaticUpdate()}))),this._register(this.registry.onDidChange((()=>{this.updateSoon.schedule(this.debounce.get(this.editor.getModel()))}))),this.scheduleAutomaticUpdate()}fixAndGetIndexOfCurrentSelection(){if(!this.currentlySelectedCompletionId||!this.cache.value)return 0;if(0===this.cache.value.completions.length)return 0;const e=this.cache.value.completions.findIndex((e=>e.semanticId===this.currentlySelectedCompletionId));return-1===e?(this.currentlySelectedCompletionId=void 0,0):e}get currentCachedCompletion(){if(this.cache.value)return this.cache.value.completions[this.fixAndGetIndexOfCurrentSelection()]}showNextInlineCompletion(){var e;return h9(this,void 0,void 0,(function*(){yield this.ensureUpdateWithExplicitContext();const t=(null===(e=this.cache.value)||void 0===e?void 0:e.completions)||[];if(t.length>0){const e=(this.fixAndGetIndexOfCurrentSelection()+1)%t.length;this.currentlySelectedCompletionId=t[e].semanticId}else this.currentlySelectedCompletionId=void 0;this.onDidChangeEmitter.fire()}))}showPreviousInlineCompletion(){var e;return h9(this,void 0,void 0,(function*(){yield this.ensureUpdateWithExplicitContext();const t=(null===(e=this.cache.value)||void 0===e?void 0:e.completions)||[];if(t.length>0){const e=(this.fixAndGetIndexOfCurrentSelection()+t.length-1)%t.length;this.currentlySelectedCompletionId=t[e].semanticId}else this.currentlySelectedCompletionId=void 0;this.onDidChangeEmitter.fire()}))}ensureUpdateWithExplicitContext(){var e;return h9(this,void 0,void 0,(function*(){this.updateOperation.value?this.updateOperation.value.triggerKind===Ul.Explicit?yield this.updateOperation.value.promise:yield this.update(Ul.Explicit):(null===(e=this.cache.value)||void 0===e?void 0:e.triggerKind)!==Ul.Explicit&&(yield this.update(Ul.Explicit))}))}hasMultipleInlineCompletions(){var e;return h9(this,void 0,void 0,(function*(){return yield this.ensureUpdateWithExplicitContext(),((null===(e=this.cache.value)||void 0===e?void 0:e.completions.length)||0)>1}))}get ghostText(){const e=this.currentCompletion,t=this.editor.getOptions().get(55).mode;return e?r9(e,this.editor.getModel(),t,this.editor.getPosition()):void 0}get currentCompletion(){const e=this.currentCachedCompletion;if(e)return e.toLiveInlineCompletion()}get isValid(){return this.editor.getPosition().lineNumber===this.triggerPosition.lineNumber}scheduleAutomaticUpdate(){this.updateOperation.clear(),this.updateSoon.schedule(this.debounce.get(this.editor.getModel()))}update(e){return h9(this,void 0,void 0,(function*(){if(!this.shouldUpdate())return;const t=this.editor.getPosition(),i=new Date,n=Xv((n=>h9(this,void 0,void 0,(function*(){let o;try{o=yield _9(this.registry,t,this.editor.getModel(),{triggerKind:e,selectedSuggestionInfo:void 0},n,this.languageConfigurationService);const s=new Date;this.debounce.update(this.editor.getModel(),s.getTime()-i.getTime())}catch(s){return void Jo(s)}n.isCancellationRequested||(this.cache.setValue(this.editor,o,e),this.onDidChangeEmitter.fire())})))),o=new p9(n,e);this.updateOperation.value=o,yield n,this.updateOperation.value===o&&this.updateOperation.clear()}))}takeOwnership(e){this._register(e)}commitCurrentCompletion(){if(!this.ghostText)return;const e=this.currentCompletion;e&&this.commit(e)}commit(e){const t=this.cache.clearAndLeak();this.editor.executeEdits("inlineSuggestion.accept",[_W.replaceMove(e.range,e.text)]),e.command?this.commandService.executeCommand(e.command.id,...e.command.arguments||[]).finally((()=>{null==t||t.dispose()})).then(void 0,Ta):null==t||t.dispose(),this.onDidChangeEmitter.fire()}}class p9{constructor(e,t){this.promise=e,this.triggerKind=t}dispose(){this.promise.cancel()}}class m9 extends Uo{constructor(e,t,i,n){super(),this.triggerKind=n;const o=e.deltaDecorations([],t.items.map((e=>({range:e.range,options:{description:"inline-completion-tracking-range"}}))));this._register(es((()=>{e.deltaDecorations(o,[])}))),this.completions=t.items.map(((e,t)=>new f9(e,o[t]))),this._register(e.onDidChangeModelContent((()=>{let t=!1;const n=e.getModel();for(const e of this.completions){const i=n.getDecorationRange(e.decorationId);i?e.synchronizedRange.equalsRange(i)||(t=!0,e.synchronizedRange=i):Jo(new Error("Decoration has no range"))}t&&i()}))),this._register(t)}}class f9{constructor(e,t){this.inlineCompletion=e,this.decorationId=t,this.semanticId=JSON.stringify({text:this.inlineCompletion.text,startLine:this.inlineCompletion.range.startLineNumber,startColumn:this.inlineCompletion.range.startColumn,command:this.inlineCompletion.command}),this.synchronizedRange=e.range}toLiveInlineCompletion(){return{text:this.inlineCompletion.text,range:this.synchronizedRange,command:this.inlineCompletion.command,sourceProvider:this.inlineCompletion.sourceProvider,sourceInlineCompletions:this.inlineCompletion.sourceInlineCompletions,sourceInlineCompletion:this.inlineCompletion.sourceInlineCompletion}}}function _9(e,t,i,n,o=Ia.None,s){return h9(this,void 0,void 0,(function*(){const r=function(e,t){const i=t.getWordAtPosition(e),n=t.getLineMaxColumn(e.lineNumber);return i?new qo(e.lineNumber,i.startColumn,e.lineNumber,n):qo.fromPositions(e,e.with(void 0,n))}(t,i),a=e.all(i),l=yield Promise.all(a.map((e=>h9(this,void 0,void 0,(function*(){const s=yield Promise.resolve(e.provideInlineCompletions(i,t,n,o)).catch(Ta);return{completions:s,provider:e,dispose:()=>{s&&e.freeInlineCompletions(s)}}}))))),d=new Map;for(const e of l){const t=e.completions;if(t)for(const n of t.items){const o=n.range?qo.lift(n.range):r;if(o.startLineNumber!==o.endLineNumber)continue;const a=s&&n.completeBracketPairs?v9(n.text,o.getStartPosition(),i,s):n.text,l={text:a,range:o,command:n.command,sourceProvider:e.provider,sourceInlineCompletions:t,sourceInlineCompletion:n};d.set(JSON.stringify({text:a,range:n.range}),l)}}return{items:[...d.values()],dispose:()=>{for(const e of l)e.dispose()}}}))}function v9(e,t,i,n){const o=i.getLineContent(t.lineNumber).substring(0,t.column-1)+e,s=i.tokenizeLineWithEdit(t,o.length-(t.column-1),e),r=null==s?void 0:s.sliceAndInflate(t.column-1,o.length,0);if(!r)return e;const a=function(e,t){const i=new aO,n=new kO(i,(e=>t.getLanguageConfiguration(e))),o=MO(new CO(new l9([e]),n),[],void 0,!0);let s="";const r=e.getLineContent();return function e(t,i){if(2===t.kind)if(e(t.openingBracket,i),i=ZA(i,t.openingBracket.length),t.child&&(e(t.child,i),i=ZA(i,t.child.length)),t.closingBracket)e(t.closingBracket,i),i=ZA(i,t.closingBracket.length);else{const e=n.getSingleLanguageBracketTokens(t.openingBracket.languageId).findClosingTokenText(t.openingBracket.bracketIds);s+=e}else if(3===t.kind);else if(0===t.kind||1===t.kind)s+=r.substring(i,ZA(i,t.length));else if(4===t.kind)for(const n of t.children)e(n,i),i=ZA(i,n.length)}(o,0),s}(r,n);return a}function b9(e,t){if(!t)return t;const i=e.getValueInRange(t.range),n=lr(i,t.text),o=e.getOffsetAt(t.range.getStartPosition())+n,s=e.getPositionAt(o),r=i.substr(n),a=dr(r,t.text),l=e.getPositionAt(Math.max(o,e.getOffsetAt(t.range.getEndPosition())-a));return{range:qo.fromPositions(s,l),text:t.text.substr(n,t.text.length-n-a)}}const w9=new Uint8Array(16),C9=[];for(let e=0;e<256;e++)C9.push(e.toString(16).padStart(2,"0"));let y9;y9="object"==typeof crypto&&"function"==typeof crypto.getRandomValues?crypto.getRandomValues.bind(crypto):function(e){for(let t=0;t<e.length;t++)e[t]=Math.floor(256*Math.random());return e},Object.freeze({CURRENT_YEAR:!0,CURRENT_YEAR_SHORT:!0,CURRENT_MONTH:!0,CURRENT_DATE:!0,CURRENT_HOUR:!0,CURRENT_MINUTE:!0,CURRENT_SECOND:!0,CURRENT_DAY_NAME:!0,CURRENT_DAY_NAME_SHORT:!0,CURRENT_MONTH_NAME:!0,CURRENT_MONTH_NAME_SHORT:!0,CURRENT_SECONDS_UNIX:!0,SELECTION:!0,CLIPBOARD:!0,TM_SELECTED_TEXT:!0,TM_CURRENT_LINE:!0,TM_CURRENT_WORD:!0,TM_LINE_INDEX:!0,TM_LINE_NUMBER:!0,TM_FILENAME:!0,TM_FILENAME_BASE:!0,TM_DIRECTORY:!0,TM_FILEPATH:!0,RELATIVE_FILEPATH:!0,BLOCK_COMMENT_START:!0,BLOCK_COMMENT_END:!0,LINE_COMMENT:!0,WORKSPACE_NAME:!0,WORKSPACE_FOLDER:!0,RANDOM:!0,RANDOM_HEX:!0,UUID:!0});class x9{constructor(e){this._delegates=e}resolve(e){for(const t of this._delegates){let i=t.resolve(e);if(void 0!==i)return i}}}class S9{constructor(e,t,i,n){this._model=e,this._selection=t,this._selectionIdx=i,this._overtypingCapturer=n}resolve(e){const{name:t}=e;if("SELECTION"===t||"TM_SELECTED_TEXT"===t){let t=this._model.getValueInRange(this._selection)||void 0,i=this._selection.startLineNumber!==this._selection.endLineNumber;if(!t&&this._overtypingCapturer){const e=this._overtypingCapturer.getLastOvertypedInfo(this._selectionIdx);e&&(t=e.value,i=e.multiline)}if(t&&i&&e.snippet){const i=this._model.getLineContent(this._selection.startLineNumber),n=ts(i,0,this._selection.startColumn-1);let o=n;e.snippet.walk((t=>t!==e&&(t instanceof p2&&(o=ts(Is(t.value).pop())),!0)));const s=lr(o,n);t=t.replace(/(\r\n|\r|\n)(.*)/g,((e,t,i)=>`${t}${o.substr(s)}${i}`))}return t}if("TM_CURRENT_LINE"===t)return this._model.getLineContent(this._selection.positionLineNumber);if("TM_CURRENT_WORD"===t){const e=this._model.getWordAtPosition({lineNumber:this._selection.positionLineNumber,column:this._selection.positionColumn});return e&&e.word||void 0}return"TM_LINE_INDEX"===t?String(this._selection.positionLineNumber-1):"TM_LINE_NUMBER"===t?String(this._selection.positionLineNumber):void 0}}class k9{constructor(e,t){this._labelService=e,this._model=t}resolve(e){const{name:t}=e;if("TM_FILENAME"===t)return Ca(this._model.uri.fsPath);if("TM_FILENAME_BASE"===t){const e=Ca(this._model.uri.fsPath),t=e.lastIndexOf(".");return t<=0?e:e.slice(0,t)}return"TM_DIRECTORY"===t?"."===Hr(this._model.uri.fsPath)?"":this._labelService.getUriLabel(rR(this._model.uri)):"TM_FILEPATH"===t?this._labelService.getUriLabel(this._model.uri):"RELATIVE_FILEPATH"===t?this._labelService.getUriLabel(this._model.uri,{relative:!0,noPrefix:!0}):void 0}}class D9{constructor(e,t,i,n){this._readClipboardText=e,this._selectionIdx=t,this._selectionCount=i,this._spread=n}resolve(e){if("CLIPBOARD"!==e.name)return;const t=this._readClipboardText();if(t){if(this._spread){const e=t.split(/\r\n|\n|\r/).filter((e=>!qs(e)));if(e.length===this._selectionCount)return e[this._selectionIdx]}return t}}}class L9{constructor(e,t){this._model=e,this._selection=t}resolve(e){const{name:t}=e,i=this._model.getLanguageIdAtPosition(this._selection.selectionStartLineNumber,this._selection.selectionStartColumn),n=Wv.getComments(i);if(n)return"LINE_COMMENT"===t?n.lineCommentToken||void 0:"BLOCK_COMMENT_START"===t?n.blockCommentStartToken||void 0:"BLOCK_COMMENT_END"===t&&n.blockCommentEndToken||void 0}}class N9{constructor(){this._date=new Date}resolve(e){const{name:t}=e;return"CURRENT_YEAR"===t?String(this._date.getFullYear()):"CURRENT_YEAR_SHORT"===t?String(this._date.getFullYear()).slice(-2):"CURRENT_MONTH"===t?String(this._date.getMonth().valueOf()+1).padStart(2,"0"):"CURRENT_DATE"===t?String(this._date.getDate().valueOf()).padStart(2,"0"):"CURRENT_HOUR"===t?String(this._date.getHours().valueOf()).padStart(2,"0"):"CURRENT_MINUTE"===t?String(this._date.getMinutes().valueOf()).padStart(2,"0"):"CURRENT_SECOND"===t?String(this._date.getSeconds().valueOf()).padStart(2,"0"):"CURRENT_DAY_NAME"===t?N9.dayNames[this._date.getDay()]:"CURRENT_DAY_NAME_SHORT"===t?N9.dayNamesShort[this._date.getDay()]:"CURRENT_MONTH_NAME"===t?N9.monthNames[this._date.getMonth()]:"CURRENT_MONTH_NAME_SHORT"===t?N9.monthNamesShort[this._date.getMonth()]:"CURRENT_SECONDS_UNIX"===t?String(Math.floor(this._date.getTime()/1e3)):void 0}}N9.dayNames=[mf(0,"Sunday"),mf(0,"Monday"),mf(0,"Tuesday"),mf(0,"Wednesday"),mf(0,"Thursday"),mf(0,"Friday"),mf(0,"Saturday")],N9.dayNamesShort=[mf(0,"Sun"),mf(0,"Mon"),mf(0,"Tue"),mf(0,"Wed"),mf(0,"Thu"),mf(0,"Fri"),mf(0,"Sat")],N9.monthNames=[mf(0,"January"),mf(0,"February"),mf(0,"March"),mf(0,"April"),mf(0,"May"),mf(0,"June"),mf(0,"July"),mf(0,"August"),mf(0,"September"),mf(0,"October"),mf(0,"November"),mf(0,"December")],N9.monthNamesShort=[mf(0,"Jan"),mf(0,"Feb"),mf(0,"Mar"),mf(0,"Apr"),mf(0,"May"),mf(0,"Jun"),mf(0,"Jul"),mf(0,"Aug"),mf(0,"Sep"),mf(0,"Oct"),mf(0,"Nov"),mf(0,"Dec")];class E9{constructor(e){this._workspaceService=e}resolve(e){if(!this._workspaceService)return;const t=(i=this._workspaceService.getWorkspace()).configuration?{id:i.id,configPath:i.configuration}:1===i.folders.length?{id:i.id,uri:i.folders[0].uri}:void 0;var i;return t?"WORKSPACE_NAME"===e.name?this._resolveWorkspaceName(t):"WORKSPACE_FOLDER"===e.name?this._resoveWorkspacePath(t):void 0:void 0}_resolveWorkspaceName(e){if(VW(e))return Ca(e.uri.path);let t=Ca(e.configPath.path);return t.endsWith(zW)&&(t=t.substr(0,t.length-zW.length-1)),t}_resoveWorkspacePath(e){if(VW(e))return Z1(e.uri.fsPath);let t=Ca(e.configPath.path),i=e.configPath.fsPath;return i.endsWith(t)&&(i=i.substr(0,i.length-t.length-1)),i?Z1(i):"/"}}class I9{resolve(e){const{name:t}=e;return"RANDOM"===t?Math.random().toString().slice(-6):"RANDOM_HEX"===t?Math.random().toString(16).slice(-6):"UUID"===t?function(){y9(w9),w9[6]=15&w9[6]|64,w9[8]=63&w9[8]|128;let e=0,t="";return t+=C9[w9[e++]],t+=C9[w9[e++]],t+=C9[w9[e++]],t+=C9[w9[e++]],t+="-",t+=C9[w9[e++]],t+=C9[w9[e++]],t+="-",t+=C9[w9[e++]],t+=C9[w9[e++]],t+="-",t+=C9[w9[e++]],t+=C9[w9[e++]],t+="-",t+=C9[w9[e++]],t+=C9[w9[e++]],t+=C9[w9[e++]],t+=C9[w9[e++]],t+=C9[w9[e++]],t+=C9[w9[e++]],t}():void 0}}class T9{constructor(e,t,i,n){this._editor=e,this._snippet=t,this._offset=i,this._snippetLineLeadingWhitespace=n,this._nestingLevel=1,this._placeholderGroups=$l(t.placeholders,f2.compareByIndex),this._placeholderGroupsIdx=-1}dispose(){this._placeholderDecorations&&this._editor.deltaDecorations([...this._placeholderDecorations.values()],[]),this._placeholderGroups.length=0}_initDecorations(){if(this._placeholderDecorations)return;this._placeholderDecorations=new Map;const e=this._editor.getModel();this._editor.changeDecorations((t=>{for(const i of this._snippet.placeholders){const n=this._snippet.offset(i),o=this._snippet.fullLen(i),s=qo.fromPositions(e.getPositionAt(this._offset+n),e.getPositionAt(this._offset+n+o)),r=i.isFinalTabstop?T9._decor.inactiveFinal:T9._decor.inactive,a=t.addDecoration(s,r);this._placeholderDecorations.set(i,a)}}))}move(e){if(!this._editor.hasModel())return[];if(this._initDecorations(),this._placeholderGroupsIdx>=0){let e=[];for(const t of this._placeholderGroups[this._placeholderGroupsIdx])if(t.transform){const i=this._placeholderDecorations.get(t),n=this._editor.getModel().getDecorationRange(i),o=this._editor.getModel().getValueInRange(n),s=t.transform.resolve(o).split(/\r\n|\r|\n/);for(let e=1;e<s.length;e++)s[e]=this._editor.getModel().normalizeIndentation(this._snippetLineLeadingWhitespace+s[e]);e.push(_W.replace(n,s.join(this._editor.getModel().getEOL())))}e.length>0&&this._editor.executeEdits("snippet.placeholderTransform",e)}let t=!1;!0===e&&this._placeholderGroupsIdx<this._placeholderGroups.length-1?(this._placeholderGroupsIdx+=1,t=!0):!1===e&&this._placeholderGroupsIdx>0&&(this._placeholderGroupsIdx-=1,t=!0);const i=this._editor.getModel().changeDecorations((e=>{const i=new Set,n=[];for(const o of this._placeholderGroups[this._placeholderGroupsIdx]){const s=this._placeholderDecorations.get(o),r=this._editor.getModel().getDecorationRange(s);n.push(new ar(r.startLineNumber,r.startColumn,r.endLineNumber,r.endColumn)),t=t&&this._hasPlaceholderBeenCollapsed(o),e.changeDecorationOptions(s,o.isFinalTabstop?T9._decor.activeFinal:T9._decor.active),i.add(o);for(const t of this._snippet.enclosingPlaceholders(o)){const n=this._placeholderDecorations.get(t);e.changeDecorationOptions(n,t.isFinalTabstop?T9._decor.activeFinal:T9._decor.active),i.add(t)}}for(const[t,o]of this._placeholderDecorations)i.has(t)||e.changeDecorationOptions(o,t.isFinalTabstop?T9._decor.inactiveFinal:T9._decor.inactive);return n}));return t?this.move(e):null!=i?i:[]}_hasPlaceholderBeenCollapsed(e){let t=e;for(;t;){if(t instanceof f2){const e=this._placeholderDecorations.get(t);if(this._editor.getModel().getDecorationRange(e).isEmpty()&&t.toString().length>0)return!0}t=t.parent}return!1}get isAtFirstPlaceholder(){return this._placeholderGroupsIdx<=0||0===this._placeholderGroups.length}get isAtLastPlaceholder(){return this._placeholderGroupsIdx===this._placeholderGroups.length-1}get hasPlaceholder(){return this._snippet.placeholders.length>0}computePossibleSelections(){const e=new Map;for(const t of this._placeholderGroups){let i;for(const n of t){if(n.isFinalTabstop)break;i||(i=[],e.set(n.index,i));const t=this._placeholderDecorations.get(n),o=this._editor.getModel().getDecorationRange(t);if(!o){e.delete(n.index);break}i.push(o)}}return e}get choice(){return this._placeholderGroups[this._placeholderGroupsIdx][0].choice}merge(e){const t=this._editor.getModel();this._nestingLevel*=10,this._editor.changeDecorations((i=>{for(const n of this._placeholderGroups[this._placeholderGroupsIdx]){const o=e.shift(),s=o._snippet.placeholderInfo.last.index;for(const e of o._snippet.placeholderInfo.all)e.isFinalTabstop?e.index=n.index+(s+1)/this._nestingLevel:e.index=n.index+e.index/this._nestingLevel;this._snippet.replace(n,o._snippet.children);const r=this._placeholderDecorations.get(n);i.removeDecoration(r),this._placeholderDecorations.delete(n);for(const e of o._snippet.placeholders){const n=o._snippet.offset(e),s=o._snippet.fullLen(e),r=qo.fromPositions(t.getPositionAt(o._offset+n),t.getPositionAt(o._offset+n+s)),a=i.addDecoration(r,T9._decor.inactive);this._placeholderDecorations.set(e,a)}}this._placeholderGroups=$l(this._snippet.placeholders,f2.compareByIndex)}))}}T9._decor={active:GP.register({description:"snippet-placeholder-1",stickiness:0,className:"snippet-placeholder"}),inactive:GP.register({description:"snippet-placeholder-2",stickiness:1,className:"snippet-placeholder"}),activeFinal:GP.register({description:"snippet-placeholder-3",stickiness:1,className:"finish-snippet-placeholder"}),inactiveFinal:GP.register({description:"snippet-placeholder-4",stickiness:1,className:"finish-snippet-placeholder"})};const M9={overwriteBefore:0,overwriteAfter:0,adjustWhitespace:!0,clipboardText:void 0,overtypingCapturer:void 0};class A9{constructor(e,t,i=M9){this._templateMerges=[],this._snippets=[],this._editor=e,this._template=t,this._options=i}static adjustWhitespace(e,t,i,n,o){const s=e.getLineContent(t.lineNumber),r=ts(s,0,t.column-1);let a;return i.walk((t=>{if(!(t instanceof p2)||t.parent instanceof _2)return!0;const o=t.value.split(/\r\n|\r|\n/);if(n){const n=i.offset(t);if(0===n)o[0]=e.normalizeIndentation(o[0]);else{a=null!=a?a:i.toString();let t=a.charCodeAt(n-1);10!==t&&13!==t||(o[0]=e.normalizeIndentation(r+o[0]))}for(let t=1;t<o.length;t++)o[t]=e.normalizeIndentation(r+o[t])}const s=o.join(e.getEOL());return s!==t.value&&(t.parent.replace(t,[new p2(s)]),a=void 0),!0})),r}static adjustSelection(e,t,i,n){if(0!==i||0!==n){const{positionLineNumber:o,positionColumn:s}=t,r=s-i,a=s+n,l=e.validateRange({startLineNumber:o,startColumn:r,endLineNumber:o,endColumn:a});t=ar.createWithDirection(l.startLineNumber,l.startColumn,l.endLineNumber,l.endColumn,t.getDirection())}return t}static createEditsAndSnippets(e,t,i,n,o,s,r,a){const l=[],d=[];if(!e.hasModel())return{edits:l,snippets:d};const c=e.getModel(),h=e.invokeWithinContext((e=>e.get(BW))),u=e.invokeWithinContext((e=>new k9(e.get(FW),c))),g=()=>r;let p=0,m=c.getValueInRange(A9.adjustSelection(c,e.getSelection(),i,0)),f=c.getValueInRange(A9.adjustSelection(c,e.getSelection(),0,n)),_=c.getLineFirstNonWhitespaceColumn(e.getSelection().positionLineNumber);const v=e.getSelections().map(((e,t)=>({selection:e,idx:t}))).sort(((e,t)=>qo.compareRangesUsingStarts(e.selection,t.selection)));for(const{selection:b,idx:w}of v){let r=A9.adjustSelection(c,b,i,0),C=A9.adjustSelection(c,b,0,n);m!==c.getValueInRange(r)&&(r=b),f!==c.getValueInRange(C)&&(C=b);const y=b.setStartPosition(r.startLineNumber,r.startColumn).setEndPosition(C.endLineNumber,C.endColumn),x=(new x2).parse(t,!0,o),S=y.getStartPosition(),k=A9.adjustWhitespace(c,S,x,s||w>0&&_!==c.getLineFirstNonWhitespaceColumn(b.positionLineNumber),!0);x.resolveVariables(new x9([u,new D9(g,w,v.length,"spread"===e.getOption(71)),new S9(c,b,w,a),new L9(c,b),new N9,new E9(h),new I9]));const D=c.getOffsetAt(S)+p;p+=x.toString().length-c.getValueLengthInRange(y),l[w]=_W.replace(y,x.toString()),l[w].identifier={major:w,minor:0},d[w]=new T9(e,x,D,k)}return{edits:l,snippets:d}}dispose(){bs(this._snippets)}_logInfo(){return`template="${this._template}", merged_templates="${this._templateMerges.join(" -> ")}"`}insert(){if(!this._editor.hasModel())return;const{edits:e,snippets:t}=A9.createEditsAndSnippets(this._editor,this._template,this._options.overwriteBefore,this._options.overwriteAfter,!1,this._options.adjustWhitespace,this._options.clipboardText,this._options.overtypingCapturer);this._snippets=t,this._editor.executeEdits("snippet",e,(e=>this._snippets[0].hasPlaceholder?this._move(!0):e.filter((e=>!!e.identifier)).map((e=>ar.fromPositions(e.range.getEndPosition()))))),this._editor.revealRange(this._editor.getSelections()[0])}merge(e,t=M9){if(!this._editor.hasModel())return;this._templateMerges.push([this._snippets[0]._nestingLevel,this._snippets[0]._placeholderGroupsIdx,e]);const{edits:i,snippets:n}=A9.createEditsAndSnippets(this._editor,e,t.overwriteBefore,t.overwriteAfter,!0,t.adjustWhitespace,t.clipboardText,t.overtypingCapturer);this._editor.executeEdits("snippet",i,(e=>{for(const t of this._snippets)t.merge(n);return this._snippets[0].hasPlaceholder?this._move(void 0):e.filter((e=>!!e.identifier)).map((e=>ar.fromPositions(e.range.getEndPosition())))}))}next(){const e=this._move(!0);this._editor.setSelections(e),this._editor.revealPositionInCenterIfOutsideViewport(e[0].getPosition())}prev(){const e=this._move(!1);this._editor.setSelections(e),this._editor.revealPositionInCenterIfOutsideViewport(e[0].getPosition())}_move(e){const t=[];for(const i of this._snippets){const n=i.move(e);t.push(...n)}return t}get isAtFirstPlaceholder(){return this._snippets[0].isAtFirstPlaceholder}get isAtLastPlaceholder(){return this._snippets[0].isAtLastPlaceholder}get hasPlaceholder(){return this._snippets[0].hasPlaceholder}get choice(){return this._snippets[0].choice}isSelectionWithinPlaceholders(){if(!this.hasPlaceholder)return!1;const e=this._editor.getSelections();if(e.length<this._snippets.length)return!1;let t=new Map;for(const i of this._snippets){const n=i.computePossibleSelections();if(0===t.size)for(const[i,o]of n){o.sort(qo.compareRangesUsingStarts);for(const n of e)if(o[0].containsRange(n)){t.set(i,[]);break}}if(0===t.size)return!1;t.forEach(((e,t)=>{e.push(...n.get(t))}))}e.sort(qo.compareRangesUsingStarts);for(let[i,n]of t)if(n.length===e.length){n.sort(qo.compareRangesUsingStarts);for(let o=0;o<n.length;o++)n[o].containsRange(e[o])||t.delete(i)}else t.delete(i);return t.size>0}}var O9=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},R9=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};const P9={overwriteBefore:0,overwriteAfter:0,undoStopBefore:!0,undoStopAfter:!0,adjustWhitespace:!0,clipboardText:void 0,overtypingCapturer:void 0};let F9=class e{constructor(t,i,n,o){this._editor=t,this._instantiationService=i,this._logService=n,this._snippetListener=new ws,this._modelVersionId=-1,this._inSnippet=e.InSnippetMode.bindTo(o),this._hasNextTabstop=e.HasNextTabstop.bindTo(o),this._hasPrevTabstop=e.HasPrevTabstop.bindTo(o)}static get(t){return t.getContribution(e.ID)}dispose(){var e;this._inSnippet.reset(),this._hasPrevTabstop.reset(),this._hasNextTabstop.reset(),null===(e=this._session)||void 0===e||e.dispose(),this._snippetListener.dispose()}insert(e,t){try{this._doInsert(e,void 0===t?P9:Object.assign(Object.assign({},P9),t))}catch(i){this.cancel(),this._logService.error(i),this._logService.error("snippet_error"),this._logService.error("insert_template=",e),this._logService.error("existing_template=",this._session?this._session._logInfo():"<no_session>")}}_doInsert(e,t){this._editor.hasModel()&&(this._snippetListener.clear(),t.undoStopBefore&&this._editor.getModel().pushStackElement(),this._session?this._session.merge(e,t):(this._modelVersionId=this._editor.getModel().getAlternativeVersionId(),this._session=new A9(this._editor,e,t),this._session.insert()),t.undoStopAfter&&this._editor.getModel().pushStackElement(),this._updateState(),this._snippetListener.add(this._editor.onDidChangeModelContent((e=>e.isFlush&&this.cancel()))),this._snippetListener.add(this._editor.onDidChangeModel((()=>this.cancel()))),this._snippetListener.add(this._editor.onDidChangeCursorSelection((()=>this._updateState()))))}_updateState(){if(this._session&&this._editor.hasModel()){if(this._modelVersionId===this._editor.getModel().getAlternativeVersionId())return this.cancel();if(!this._session.hasPlaceholder)return this.cancel();if(this._session.isAtLastPlaceholder||!this._session.isSelectionWithinPlaceholders())return this._editor.getModel().pushStackElement(),this.cancel();this._inSnippet.set(!0),this._hasPrevTabstop.set(!this._session.isAtFirstPlaceholder),this._hasNextTabstop.set(!this._session.isAtLastPlaceholder),this._handleChoice()}}_handleChoice(){if(!this._session||!this._editor.hasModel())return void(this._currentChoice=void 0);const{choice:e}=this._session;if(e){if(this._currentChoice!==e){this._currentChoice=e,this._editor.setSelections(this._editor.getSelections().map((e=>ar.fromPositions(e.getStartPosition()))));const[t]=e.options;this._instantiationService.invokeFunction(r6,this._editor,e.options.map(((e,i)=>({kind:13,label:e.value,insertText:e.value,sortText:"a".repeat(i+1),range:qo.fromPositions(this._editor.getPosition(),this._editor.getPosition().delta(0,t.value.length))}))))}}else this._currentChoice=void 0}finish(){for(;this._inSnippet.get();)this.next()}cancel(e=!1){var t;this._inSnippet.reset(),this._hasPrevTabstop.reset(),this._hasNextTabstop.reset(),this._snippetListener.clear(),null===(t=this._session)||void 0===t||t.dispose(),this._session=void 0,this._modelVersionId=-1,e&&this._editor.setSelections([this._editor.getSelection()])}prev(){this._session&&this._session.prev(),this._updateState()}next(){this._session&&this._session.next(),this._updateState()}isInSnippet(){return Boolean(this._inSnippet.get())}};F9.ID="snippetController2",F9.InSnippetMode=new Uy("inSnippetMode",!1,mf(0,"Whether the editor in current in snippet mode")),F9.HasNextTabstop=new Uy("hasNextTabstop",!1,mf(0,"Whether there is a next tab stop when in snippet mode")),F9.HasPrevTabstop=new Uy("hasPrevTabstop",!1,mf(0,"Whether there is a previous tab stop when in snippet mode")),F9=O9([R9(1,k_),R9(2,Cb),R9(3,$y)],F9),Ix(F9.ID,F9);const B9=yx.bindToContribution(F9.get);Dx(new B9({id:"jumpToNextSnippetPlaceholder",precondition:Sy.and(F9.InSnippetMode,F9.HasNextTabstop),handler:e=>e.next(),kbOpts:{weight:130,kbExpr:yI.editorTextFocus,primary:2}})),Dx(new B9({id:"jumpToPrevSnippetPlaceholder",precondition:Sy.and(F9.InSnippetMode,F9.HasPrevTabstop),handler:e=>e.prev(),kbOpts:{weight:130,kbExpr:yI.editorTextFocus,primary:1026}})),Dx(new B9({id:"leaveSnippet",precondition:F9.InSnippetMode,handler:e=>e.cancel(!0),kbOpts:{weight:130,kbExpr:yI.editorTextFocus,primary:9,secondary:[1033]}})),Dx(new B9({id:"acceptSnippet",precondition:F9.InSnippetMode,handler:e=>e.finish()}));var V9=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},W9=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};class z9{constructor(e){this.name=e}select(e,t,i){if(0===i.length)return 0;let n=i[0].score[0];for(let o=0;o<i.length;o++){const{score:e,completion:t}=i[o];if(e[0]!==n)break;if(t.preselect)return o}return 0}}class H9 extends z9{constructor(){super("first")}memorize(e,t,i){}toJSON(){}fromJSON(){}}let j9=class e{constructor(e,t){this._storageService=e,this._configService=t,this._disposables=new ws,this._persistSoon=new lb((()=>this._saveState()),500),this._disposables.add(e.onWillSaveState((e=>{e.reason===wZ.SHUTDOWN&&this._saveState()})))}dispose(){this._disposables.dispose(),this._persistSoon.dispose()}memorize(e,t,i){this._withStrategy(e,t).memorize(e,t,i),this._persistSoon.schedule()}select(e,t,i){return this._withStrategy(e,t).select(e,t,i)}_withStrategy(t,i){var n;const o=this._configService.getValue("editor.suggestSelection",{overrideIdentifier:t.getLanguageIdAtPosition(i.lineNumber,i.column),resource:t.uri});if((null===(n=this._strategy)||void 0===n?void 0:n.name)!==o){this._saveState();const t=e._strategyCtors.get(o)||H9;this._strategy=new t;try{const t=this._configService.getValue("editor.suggest.shareSuggestSelections")?0:1,i=this._storageService.get(`${e._storagePrefix}/${o}`,t);i&&this._strategy.fromJSON(JSON.parse(i))}catch(s){}}return this._strategy}_saveState(){if(this._strategy){const t=this._configService.getValue("editor.suggest.shareSuggestSelections")?0:1,i=JSON.stringify(this._strategy);this._storageService.store(`${e._storagePrefix}/${this._strategy.name}`,i,t,1)}}};j9._strategyCtors=new Map([["recentlyUsedByPrefix",class extends z9{constructor(){super("recentlyUsedByPrefix"),this._trie=GV.forStrings(),this._seq=0}memorize(e,t,i){const{word:n}=e.getWordUntilPosition(t),o=`${e.getLanguageId()}/${n}`;this._trie.set(o,{type:i.completion.kind,insertText:i.completion.insertText,touch:this._seq++})}select(e,t,i){let{word:n}=e.getWordUntilPosition(t);if(!n)return super.select(e,t,i);let o=`${e.getLanguageId()}/${n}`,s=this._trie.get(o);if(s||(s=this._trie.findSubstr(o)),s)for(let r=0;r<i.length;r++){let{kind:e,insertText:t}=i[r].completion;if(e===s.type&&t===s.insertText)return r}return super.select(e,t,i)}toJSON(){let e=[];return this._trie.forEach(((t,i)=>e.push([i,t]))),e.sort(((e,t)=>-(e[1].touch-t[1].touch))).forEach(((e,t)=>e[1].touch=t)),e.slice(0,200)}fromJSON(e){if(this._trie.clear(),e.length>0){this._seq=e[0][1].touch+1;for(const[t,i]of e)i.type="number"==typeof i.type?i.type:Kl.fromString(i.type),this._trie.set(t,i)}}}],["recentlyUsed",class extends z9{constructor(){super("recentlyUsed"),this._cache=new QV(300,.66),this._seq=0}memorize(e,t,i){const n=`${e.getLanguageId()}/${i.textLabel}`;this._cache.set(n,{touch:this._seq++,type:i.completion.kind,insertText:i.completion.insertText})}select(e,t,i){if(0===i.length)return 0;const n=e.getLineContent(t.lineNumber).substr(t.column-10,t.column-1);if(/\s$/.test(n))return super.select(e,t,i);let o=i[0].score[0],s=-1,r=-1,a=-1;for(let l=0;l<i.length&&i[l].score[0]===o;l++){const t=`${e.getLanguageId()}/${i[l].textLabel}`,n=this._cache.peek(t);if(n&&n.touch>a&&n.type===i[l].completion.kind&&n.insertText===i[l].completion.insertText&&(a=n.touch,r=l),i[l].completion.preselect&&-1===s)return l}return-1!==r?r:-1!==s?s:0}toJSON(){return this._cache.toJSON()}fromJSON(e){this._cache.clear();for(const[t,i]of e)i.touch=0,i.type="number"==typeof i.type?i.type:Kl.fromString(i.type),this._cache.set(t,i);this._seq=this._cache.size}}],["first",H9]]),j9._storagePrefix="suggest/memories",j9=V9([W9(0,bZ),W9(1,Cv)],j9);const U9=L_("ISuggestMemories");Iv(U9,j9,!0);var $9=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},K9=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};let q9=class e{constructor(t,i){this._editor=t,this._enabled=!1,this._ckAtEnd=e.AtEnd.bindTo(i),this._configListener=this._editor.onDidChangeConfiguration((e=>e.hasChanged(111)&&this._update())),this._update()}dispose(){var e;this._configListener.dispose(),null===(e=this._selectionListener)||void 0===e||e.dispose(),this._ckAtEnd.reset()}_update(){const e="on"===this._editor.getOption(111);if(this._enabled!==e)if(this._enabled=e,this._enabled){const e=()=>{if(!this._editor.hasModel())return void this._ckAtEnd.set(!1);const e=this._editor.getModel(),t=this._editor.getSelection(),i=e.getWordAtPosition(t.getStartPosition());i?this._ckAtEnd.set(i.endColumn===t.getStartPosition().column):this._ckAtEnd.set(!1)};this._selectionListener=this._editor.onDidChangeCursorSelection(e),e()}else this._selectionListener&&(this._ckAtEnd.reset(),this._selectionListener.dispose(),this._selectionListener=void 0)}};q9.AtEnd=new Uy("atEndOfWord",!1),q9=$9([K9(1,$y)],q9);var G9=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},Z9=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};let Y9=class e{constructor(t,i){this._editor=t,this._index=0,this._ckOtherSuggestions=e.OtherSuggestions.bindTo(i)}dispose(){this.reset()}reset(){var e;this._ckOtherSuggestions.reset(),null===(e=this._listener)||void 0===e||e.dispose(),this._model=void 0,this._acceptNext=void 0,this._ignore=!1}set({model:t,index:i},n){if(0===t.items.length)return void this.reset();e._moveIndex(!0,t,i)!==i?(this._acceptNext=n,this._model=t,this._index=i,this._listener=this._editor.onDidChangeCursorPosition((()=>{this._ignore||this.reset()})),this._ckOtherSuggestions.set(!0)):this.reset()}static _moveIndex(e,t,i){let n=i;for(;n=(n+t.items.length+(e?1:-1))%t.items.length,n!==i&&t.items[n].completion.additionalTextEdits;);return n}next(){this._move(!0)}prev(){this._move(!1)}_move(t){if(this._model)try{this._ignore=!0,this._index=e._moveIndex(t,this._model,this._index),this._acceptNext({index:this._index,item:this._model.items[this._index],model:this._model})}finally{this._ignore=!1}}};Y9.OtherSuggestions=new Uy("hasOtherSuggestions",!1),Y9=G9([Z9(1,$y)],Y9);class X9{constructor(e,t,i){this._disposables=new ws,this._disposables.add(t.onDidShow((()=>this._onItem(t.getFocusedItem())))),this._disposables.add(t.onDidFocus(this._onItem,this)),this._disposables.add(t.onDidHide(this.reset,this)),this._disposables.add(e.onWillType((n=>{if(this._active&&!t.isFrozen()){const t=n.charCodeAt(n.length-1);this._active.acceptCharacters.has(t)&&e.getOption(0)&&i(this._active.item)}})))}_onItem(e){if(!e||!gs(e.item.completion.commitCharacters))return void this.reset();if(this._active&&this._active.item.item===e.item)return;const t=new jl;for(const i of e.item.completion.commitCharacters)i.length>0&&t.add(i.charCodeAt(0));this._active={acceptCharacters:t,item:e}}reset(){this._active=void 0}dispose(){this._disposables.dispose()}}var Q9=globalThis&&globalThis.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{l(n.next(e))}catch(t){s(t)}}function a(e){try{l(n.throw(e))}catch(t){s(t)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}l((n=n.apply(e,t||[])).next())}))};class J9{provideSelectionRanges(e,t){return Q9(this,void 0,void 0,(function*(){const i=[];for(const n of t){const t=[];i.push(t);const o=new Map;yield new Promise((t=>J9._bracketsRightYield(t,0,e,n,o))),yield new Promise((i=>J9._bracketsLeftYield(i,0,e,n,o,t)))}return i}))}static _bracketsRightYield(e,t,i,n,o){const s=new Map,r=Date.now();for(;;){if(t>=J9._maxRounds){e();break}if(!n){e();break}let a=i.bracketPairs.findNextBracket(n);if(!a){e();break}if(Date.now()-r>J9._maxDuration){setTimeout((()=>J9._bracketsRightYield(e,t+1,i,n,o)));break}const l=a.close[0];if(a.isOpen){let e=s.has(l)?s.get(l):0;s.set(l,e+1)}else{let e=s.has(l)?s.get(l):0;if(e-=1,s.set(l,Math.max(0,e)),e<0){let e=o.get(l);e||(e=new zs,o.set(l,e)),e.push(a.range)}}n=a.range.getEndPosition()}}static _bracketsLeftYield(e,t,i,n,o,s){const r=new Map,a=Date.now();for(;;){if(t>=J9._maxRounds&&0===o.size){e();break}if(!n){e();break}let l=i.bracketPairs.findPrevBracket(n);if(!l){e();break}if(Date.now()-a>J9._maxDuration){setTimeout((()=>J9._bracketsLeftYield(e,t+1,i,n,o,s)));break}const d=l.close[0];if(l.isOpen){let e=r.has(d)?r.get(d):0;if(e-=1,r.set(d,Math.max(0,e)),e<0){let e=o.get(d);if(e){let t=e.shift();0===e.size&&o.delete(d);const n=qo.fromPositions(l.range.getEndPosition(),t.getStartPosition()),r=qo.fromPositions(l.range.getStartPosition(),t.getEndPosition());s.push({range:n}),s.push({range:r}),J9._addBracketLeading(i,r,s)}}}else{let e=r.has(d)?r.get(d):0;r.set(d,e+1)}n=l.range.getStartPosition()}}static _addBracketLeading(e,t,i){if(t.startLineNumber===t.endLineNumber)return;const n=t.startLineNumber,o=e.getLineFirstNonWhitespaceColumn(n);0!==o&&o!==t.startColumn&&(i.push({range:qo.fromPositions(new er(n,o),t.getEndPosition())}),i.push({range:qo.fromPositions(new er(n,1),t.getEndPosition())}));const s=n-1;if(s>0){const n=e.getLineFirstNonWhitespaceColumn(s);n===t.startColumn&&n!==e.getLineLastNonWhitespaceColumn(s)&&(i.push({range:qo.fromPositions(new er(s,n),t.getEndPosition())}),i.push({range:qo.fromPositions(new er(s,1),t.getEndPosition())}))}}}J9._maxDuration=30,J9._maxRounds=2;var eee=globalThis&&globalThis.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{l(n.next(e))}catch(t){s(t)}}function a(e){try{l(n.throw(e))}catch(t){s(t)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}l((n=n.apply(e,t||[])).next())}))};class tee{static create(e,t){return eee(this,void 0,void 0,(function*(){if(!t.getOption(106).localityBonus)return tee.None;if(!t.hasModel())return tee.None;const i=t.getModel(),n=t.getPosition();if(!e.canComputeWordRanges(i.uri))return tee.None;const[o]=yield(new J9).provideSelectionRanges(i,[n]);if(0===o.length)return tee.None;const s=yield e.computeWordRanges(i.uri,o[0].range);if(!s)return tee.None;const r=i.getWordUntilPosition(n);return delete s[r.word],new class extends tee{distance(e,i){if(!n.equals(t.getPosition()))return 0;if(17===i.kind)return 2<<20;let r="string"==typeof i.label?i.label:i.label.label,a=s[r];if(Za(a))return 2<<20;let l=Fa(a,qo.fromPositions(e),qo.compareRangesUsingStarts),d=l>=0?a[l]:a[Math.max(0,~l-1)],c=o.length;for(const t of o){if(!qo.containsRange(t.range,d))break;c-=1}return c}}}))}}tee.None=new class extends tee{distance(){return 0}};class iee{constructor(e,t,i,n,o,s,r){this.clipboardText=r,this._snippetCompareFn=iee._compareCompletionItems,this._items=e,this._column=t,this._wordDistance=n,this._options=o,this._refilterKind=1,this._lineContext=i,"top"===s?this._snippetCompareFn=iee._compareCompletionItemsSnippetsUp:"bottom"===s&&(this._snippetCompareFn=iee._compareCompletionItemsSnippetsDown)}get lineContext(){return this._lineContext}set lineContext(e){this._lineContext.leadingLineContent===e.leadingLineContent&&this._lineContext.characterCountDelta===e.characterCountDelta||(this._refilterKind=this._lineContext.characterCountDelta<e.characterCountDelta&&this._filteredItems?2:1,this._lineContext=e)}get items(){return this._ensureCachedState(),this._filteredItems}get allProvider(){return this._ensureCachedState(),this._providerInfo.keys()}get incomplete(){this._ensureCachedState();const e=new Set;for(let[t,i]of this._providerInfo)i&&e.add(t);return e}adopt(e){let t=[];for(let i=0;i<this._items.length;)e.has(this._items[i].provider)?i++:(t.push(this._items[i]),this._items[i]=this._items[this._items.length-1],this._items.pop());return this._refilterKind=1,t}get stats(){return this._ensureCachedState(),this._stats}_ensureCachedState(){0!==this._refilterKind&&this._createCachedState()}_createCachedState(){this._providerInfo=new Map;const e=[],{leadingLineContent:t,characterCountDelta:i}=this._lineContext;let n="",o="";const s=1===this._refilterKind?this._items:this._filteredItems,r=[],a=!this._options.filterGraceful||s.length>2e3?xH:kH;for(let l=0;l<s.length;l++){const d=s[l];if(d.isInvalid)continue;this._providerInfo.set(d.provider,Boolean(d.container.incomplete));const c=d.position.column-d.editStart.column,h=c+i-(d.position.column-this._column);if(n.length!==h&&(n=0===h?"":t.slice(-h),o=n.toLowerCase()),d.word=n,0===h)d.score=yH.Default;else{let e=0;for(;e<c;){const t=n.charCodeAt(e);if(32!==t&&9!==t)break;e+=1}if(e>=h)d.score=yH.Default;else if("string"==typeof d.completion.filterText){let t=a(n,o,e,d.completion.filterText,d.filterTextLow,0,!1);if(!t)continue;0===fa(d.completion.filterText,d.textLabel)?d.score=t:(d.score=dH(n,o,e,d.textLabel,d.labelLow,0),d.score[0]=t[0])}else{let t=a(n,o,e,d.textLabel,d.labelLow,0,!1);if(!t)continue;d.score=t}}d.idx=l,d.distance=this._wordDistance.distance(d.position,d.completion),r.push(d),e.push(d.textLabel.length)}this._filteredItems=r.sort(this._snippetCompareFn),this._refilterKind=0,this._stats={pLabelLen:e.length?ql(e.length-.85,e,((e,t)=>e-t)):0}}static _compareCompletionItems(e,t){return e.score[0]>t.score[0]?-1:e.score[0]<t.score[0]?1:e.distance<t.distance?-1:e.distance>t.distance?1:e.idx<t.idx?-1:e.idx>t.idx?1:0}static _compareCompletionItemsSnippetsDown(e,t){if(e.completion.kind!==t.completion.kind){if(27===e.completion.kind)return 1;if(27===t.completion.kind)return-1}return iee._compareCompletionItems(e,t)}static _compareCompletionItemsSnippetsUp(e,t){if(e.completion.kind!==t.completion.kind){if(27===e.completion.kind)return-1;if(27===t.completion.kind)return 1}return iee._compareCompletionItems(e,t)}}var nee=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},oee=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}},see=globalThis&&globalThis.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{l(n.next(e))}catch(t){s(t)}}function a(e){try{l(n.throw(e))}catch(t){s(t)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}l((n=n.apply(e,t||[])).next())}))};class ree{constructor(e,t,i,n){this.leadingLineContent=e.getLineContent(t.lineNumber).substr(0,t.column-1),this.leadingWord=e.getWordUntilPosition(t),this.lineNumber=t.lineNumber,this.column=t.column,this.auto=i,this.shy=n}static shouldAutoTrigger(e){if(!e.hasModel())return!1;const t=e.getModel(),i=e.getPosition();t.tokenizeIfCheap(i.lineNumber);const n=t.getWordAtPosition(i);return!!n&&(n.endColumn===i.column&&!!isNaN(Number(n.word)))}}let aee=class e{constructor(e,t,i,n,o,s,r,a){this._editor=e,this._editorWorkerService=t,this._clipboardService=i,this._telemetryService=n,this._logService=o,this._contextKeyService=s,this._configurationService=r,this._languageFeaturesService=a,this._toDispose=new ws,this._quickSuggestDelay=10,this._triggerCharacterListener=new ws,this._triggerQuickSuggest=new rb,this._state=0,this._completionDisposables=new ws,this._onDidCancel=new $o,this._onDidTrigger=new $o,this._onDidSuggest=new $o,this.onDidCancel=this._onDidCancel.event,this.onDidTrigger=this._onDidTrigger.event,this.onDidSuggest=this._onDidSuggest.event,this._telemetryGate=0,this._currentSelection=this._editor.getSelection()||new ar(1,1,1,1),this._toDispose.add(this._editor.onDidChangeModel((()=>{this._updateTriggerCharacters(),this.cancel()}))),this._toDispose.add(this._editor.onDidChangeModelLanguage((()=>{this._updateTriggerCharacters(),this.cancel()}))),this._toDispose.add(this._editor.onDidChangeConfiguration((()=>{this._updateTriggerCharacters(),this._updateQuickSuggest()}))),this._toDispose.add(this._languageFeaturesService.completionProvider.onDidChange((()=>{this._updateTriggerCharacters(),this._updateActiveSuggestSession()})));let l=!1;this._toDispose.add(this._editor.onDidCompositionStart((()=>{l=!0}))),this._toDispose.add(this._editor.onDidCompositionEnd((()=>{l=!1,this._onCompositionEnd()}))),this._toDispose.add(this._editor.onDidChangeCursorSelection((e=>{l||this._onCursorChange(e)}))),this._toDispose.add(this._editor.onDidChangeModelContent((()=>{l||this._refilterCompletionItems()}))),this._updateTriggerCharacters(),this._updateQuickSuggest()}dispose(){bs(this._triggerCharacterListener),bs([this._onDidCancel,this._onDidSuggest,this._onDidTrigger,this._triggerQuickSuggest]),this._toDispose.dispose(),this._completionDisposables.dispose(),this.cancel()}_updateQuickSuggest(){this._quickSuggestDelay=this._editor.getOption(80),(isNaN(this._quickSuggestDelay)||!this._quickSuggestDelay&&0!==this._quickSuggestDelay||this._quickSuggestDelay<0)&&(this._quickSuggestDelay=10)}_updateTriggerCharacters(){if(this._triggerCharacterListener.clear(),this._editor.getOption(81)||!this._editor.hasModel()||!this._editor.getOption(109))return;const e=new Map;for(const i of this._languageFeaturesService.completionProvider.all(this._editor.getModel()))for(const t of i.triggerCharacters||[]){let n=e.get(t);n||(n=new Set,n.add(void 0),e.set(t,n)),n.add(i)}const t=t=>{if(!function(e,t,i){if(!Boolean(t.getContextKeyValue("inlineSuggestionVisible")))return!0;const n=i.getValue("editor.inlineSuggest.allowSuggestOnTriggerCharacters");return void 0!==n&&Boolean(n)}(this._editor,this._contextKeyService,this._configurationService))return;if(ree.shouldAutoTrigger(this._editor))return;if(!t){const e=this._editor.getPosition();t=this._editor.getModel().getLineContent(e.lineNumber).substr(0,e.column-1)}let i="";ha(t.charCodeAt(t.length-1))?Go(t.charCodeAt(t.length-2))&&(i=t.substr(t.length-2)):i=t.charAt(t.length-1);const n=e.get(i);if(n){const e=this._completionModel?{items:this._completionModel.adopt(n),clipboardText:this._completionModel.clipboardText}:void 0;this.trigger({auto:!0,shy:!1,triggerCharacter:i},Boolean(this._completionModel),n,e)}};this._triggerCharacterListener.add(this._editor.onDidType(t)),this._triggerCharacterListener.add(this._editor.onDidCompositionEnd((()=>t())))}get state(){return this._state}cancel(e=!1){var t;0!==this._state&&(this._triggerQuickSuggest.cancel(),null===(t=this._requestToken)||void 0===t||t.cancel(),this._requestToken=void 0,this._state=0,this._completionModel=void 0,this._context=void 0,this._onDidCancel.fire({retrigger:e}))}clear(){this._completionDisposables.clear()}_updateActiveSuggestSession(){0!==this._state&&(this._editor.hasModel()&&this._languageFeaturesService.completionProvider.has(this._editor.getModel())?this.trigger({auto:2===this._state,shy:!1},!0):this.cancel())}_onCursorChange(e){if(!this._editor.hasModel())return;const t=this._currentSelection;this._currentSelection=this._editor.getSelection(),!e.selection.isEmpty()||0!==e.reason&&3!==e.reason||"keyboard"!==e.source&&"deleteLeft"!==e.source?this.cancel():0===this._state&&0===e.reason?(t.containsRange(this._currentSelection)||t.getEndPosition().isBeforeOrEqual(this._currentSelection.getPosition()))&&this._doTriggerQuickSuggest():0!==this._state&&3===e.reason&&this._refilterCompletionItems()}_onCompositionEnd(){0===this._state?this._doTriggerQuickSuggest():this._refilterCompletionItems()}_doTriggerQuickSuggest(){var e;!1!==this._editor.getOption(79)&&(this._editor.getOption(106).snippetsPreventQuickSuggestions&&(null===(e=F9.get(this._editor))||void 0===e?void 0:e.isInSnippet())||(this.cancel(),this._triggerQuickSuggest.cancelAndSet((()=>{if(0!==this._state)return;if(!ree.shouldAutoTrigger(this._editor))return;if(!this._editor.hasModel())return;const e=this._editor.getModel(),t=this._editor.getPosition(),i=this._editor.getOption(79);if(!1!==i){if(!0===i);else{e.tokenizeIfCheap(t.lineNumber);const n=e.getLineTokens(t.lineNumber),o=n.getStandardTokenType(n.findTokenIndexAtOffset(Math.max(t.column-1-1,0)));if(!(i.other&&0===o||i.comments&&1===o||i.strings&&2===o))return}(function(e,t,i){if(!Boolean(t.getContextKeyValue("inlineSuggestionVisible")))return!0;const n=i.getValue("editor.inlineSuggest.allowQuickSuggestions");return void 0!==n&&Boolean(n)})(this._editor,this._contextKeyService,this._configurationService)&&this._languageFeaturesService.completionProvider.has(e)&&this.trigger({auto:!0,shy:!1})}}),this._quickSuggestDelay)))}_refilterCompletionItems(){Promise.resolve().then((()=>{if(0===this._state)return;if(!this._editor.hasModel())return;const e=this._editor.getModel(),t=this._editor.getPosition(),i=new ree(e,t,2===this._state,!1);this._onNewContext(i)}))}trigger(t,i=!1,n,o){var s;if(!this._editor.hasModel())return;const r=this._editor.getModel(),a=t.auto,l=new ree(r,this._editor.getPosition(),a,t.shy);this.cancel(i),this._state=a?2:1,this._onDidTrigger.fire({auto:a,shy:t.shy,position:this._editor.getPosition()}),this._context=l;let d={triggerKind:null!==(s=t.triggerKind)&&void 0!==s?s:0};t.triggerCharacter&&(d={triggerKind:1,triggerCharacter:t.triggerCharacter}),this._requestToken=new as;const c=this._editor.getOption(101);let h=1;switch(c){case"top":h=0;break;case"bottom":h=2}const{itemKind:u,showDeprecated:g}=e._createSuggestFilter(this._editor),p=tee.create(this._editorWorkerService,this._editor),m=e6(this._languageFeaturesService.completionProvider,r,this._editor.getPosition(),new Q2(h,u,n,g),d,this._requestToken.token);Promise.all([m,p]).then((([e,i])=>see(this,void 0,void 0,(function*(){var n;if(null===(n=this._requestToken)||void 0===n||n.dispose(),!this._editor.hasModel())return;let s=null==o?void 0:o.clipboardText;if(!s&&e.needsClipboard&&(s=yield this._clipboardService.readText()),0===this._state)return;const r=this._editor.getModel();let l=e.items;if(o){const e=n6(h);l=l.concat(o.items).sort(e)}const d=new ree(r,this._editor.getPosition(),a,t.shy);this._completionModel=new iee(l,this._context.column,{leadingLineContent:d.leadingLineContent,characterCountDelta:d.column-this._context.column},i,this._editor.getOption(106),this._editor.getOption(101),s),this._completionDisposables.add(e.disposable),this._onNewContext(d),this._reportDurationsTelemetry(e.durations)})))).catch(Jo)}_reportDurationsTelemetry(e){this._telemetryGate++%230==0&&setTimeout((()=>{this._telemetryService.publicLog2("suggest.durations.json",{data:JSON.stringify(e)}),this._logService.debug("suggest.durations.json",e)}))}static _createSuggestFilter(e){const t=new Set;"none"===e.getOption(101)&&t.add(27);const i=e.getOption(106);return i.showMethods||t.add(0),i.showFunctions||t.add(1),i.showConstructors||t.add(2),i.showFields||t.add(3),i.showVariables||t.add(4),i.showClasses||t.add(5),i.showStructs||t.add(6),i.showInterfaces||t.add(7),i.showModules||t.add(8),i.showProperties||t.add(9),i.showEvents||t.add(10),i.showOperators||t.add(11),i.showUnits||t.add(12),i.showValues||t.add(13),i.showConstants||t.add(14),i.showEnums||t.add(15),i.showEnumMembers||t.add(16),i.showKeywords||t.add(17),i.showWords||t.add(18),i.showColors||t.add(19),i.showFiles||t.add(20),i.showReferences||t.add(21),i.showColors||t.add(22),i.showFolders||t.add(23),i.showTypeParameters||t.add(24),i.showSnippets||t.add(27),i.showUsers||t.add(25),i.showIssues||t.add(26),{itemKind:t,showDeprecated:i.showDeprecated}}_onNewContext(e){if(this._context)if(e.lineNumber===this._context.lineNumber)if(ts(e.leadingLineContent)===ts(this._context.leadingLineContent)){if(e.column<this._context.column)e.leadingWord.word?this.trigger({auto:this._context.auto,shy:!1},!0):this.cancel();else if(this._completionModel)if(0!==e.leadingWord.word.length&&e.leadingWord.startColumn>this._context.leadingWord.startColumn){const e=new Set(this._languageFeaturesService.completionProvider.all(this._editor.getModel()));for(let i of this._completionModel.allProvider)e.delete(i);const t=this._completionModel.adopt(new Set);this.trigger({auto:this._context.auto,shy:!1},!0,e,{items:t,clipboardText:this._completionModel.clipboardText})}else if(e.column>this._context.column&&this._completionModel.incomplete.size>0&&0!==e.leadingWord.word.length){const{incomplete:e}=this._completionModel,t=this._completionModel.adopt(e);this.trigger({auto:2===this._state,shy:!1,triggerKind:2},!0,e,{items:t,clipboardText:this._completionModel.clipboardText})}else{let t=this._completionModel.lineContext,i=!1;if(this._completionModel.lineContext={leadingLineContent:e.leadingLineContent,characterCountDelta:e.column-this._context.column},0===this._completionModel.items.length){if(ree.shouldAutoTrigger(this._editor)&&this._context.leadingWord.endColumn<e.leadingWord.startColumn)return void this.trigger({auto:this._context.auto,shy:!1},!0);if(this._context.auto)return void this.cancel();if(this._completionModel.lineContext=t,i=this._completionModel.items.length>0,i&&0===e.leadingWord.word.length)return void this.cancel()}this._onDidSuggest.fire({completionModel:this._completionModel,auto:this._context.auto,shy:this._context.shy,isFrozen:i})}}else this.cancel();else this.cancel()}};aee=nee([oee(1,BB),oee(2,jB),oee(3,vx),oee(4,Cb),oee(5,$y),oee(6,Cv),oee(7,Lb)],aee);class lee{constructor(e,t){this._disposables=new ws,this._lastOvertyped=[],this._empty=!0,this._disposables.add(e.onWillType((()=>{if(!this._empty)return;if(!e.hasModel())return;const t=e.getSelections(),i=t.length;let n=!1;for(let e=0;e<i;e++)if(!t[e].isEmpty()){n=!0;break}if(!n)return;this._lastOvertyped=[];const o=e.getModel();for(let e=0;e<i;e++){const i=t[e];if(o.getValueLengthInRange(i)>lee._maxSelectionLength)return;this._lastOvertyped[e]={value:o.getValueInRange(i),multiline:i.startLineNumber!==i.endLineNumber}}this._empty=!1}))),this._disposables.add(t.onDidCancel((e=>{this._empty||e.retrigger||(this._empty=!0)})))}getLastOvertypedInfo(e){if(!this._empty&&e>=0&&e<this._lastOvertyped.length)return this._lastOvertyped[e]}dispose(){this._disposables.dispose()}}lee._maxSelectionLength=51200;var dee=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},cee=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};class hee extends D1{updateLabel(){const e=this._keybindingService.lookupKeybinding(this._action.id,this._contextKeyService);if(!e)return super.updateLabel();this.label&&(this.label.textContent=mf(0,"{0} ({1})",this._action.label,hee.symbolPrintEnter(e)))}static symbolPrintEnter(e){var t;return null===(t=e.getLabel())||void 0===t?void 0:t.replace(/\benter\b/gi,"⏎")}}let uee=class{constructor(e,t,i,n){this._menuService=i,this._contextKeyService=n,this._menuDisposables=new ws,this.element=$C(e,YC(".suggest-status-bar"));const o=e=>e instanceof px?t.createInstance(hee,e,void 0):void 0;this._leftActions=new vB(this.element,{actionViewItemProvider:o}),this._rightActions=new vB(this.element,{actionViewItemProvider:o}),this._leftActions.domNode.classList.add("left"),this._rightActions.domNode.classList.add("right")}dispose(){this._menuDisposables.dispose(),this.element.remove()}show(){const e=this._menuService.createMenu(Y2,this._contextKeyService),t=()=>{const t=[],i=[];for(let[n,o]of e.getActions())"left"===n?t.push(...o):i.push(...o);this._leftActions.clear(),this._leftActions.push(t),this._rightActions.clear(),this._rightActions.push(i)};this._menuDisposables.add(e.onDidChange((()=>t()))),this._menuDisposables.add(e)}hide(){this._menuDisposables.clear()}};uee=dee([cee(1,k_),cee(2,hx),cee(3,$y)],uee);const gee=_S("symbolIcon.arrayForeground",{dark:vS,light:vS,hc:vS},mf(0,"The foreground color for array symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),pee=_S("symbolIcon.booleanForeground",{dark:vS,light:vS,hc:vS},mf(0,"The foreground color for boolean symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),mee=_S("symbolIcon.classForeground",{dark:"#EE9D28",light:"#D67E00",hc:"#EE9D28"},mf(0,"The foreground color for class symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),fee=_S("symbolIcon.colorForeground",{dark:vS,light:vS,hc:vS},mf(0,"The foreground color for color symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),_ee=_S("symbolIcon.constantForeground",{dark:vS,light:vS,hc:vS},mf(0,"The foreground color for constant symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),vee=_S("symbolIcon.constructorForeground",{dark:"#B180D7",light:"#652D90",hc:"#B180D7"},mf(0,"The foreground color for constructor symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),bee=_S("symbolIcon.enumeratorForeground",{dark:"#EE9D28",light:"#D67E00",hc:"#EE9D28"},mf(0,"The foreground color for enumerator symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),wee=_S("symbolIcon.enumeratorMemberForeground",{dark:"#75BEFF",light:"#007ACC",hc:"#75BEFF"},mf(0,"The foreground color for enumerator member symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Cee=_S("symbolIcon.eventForeground",{dark:"#EE9D28",light:"#D67E00",hc:"#EE9D28"},mf(0,"The foreground color for event symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),yee=_S("symbolIcon.fieldForeground",{dark:"#75BEFF",light:"#007ACC",hc:"#75BEFF"},mf(0,"The foreground color for field symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),xee=_S("symbolIcon.fileForeground",{dark:vS,light:vS,hc:vS},mf(0,"The foreground color for file symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),See=_S("symbolIcon.folderForeground",{dark:vS,light:vS,hc:vS},mf(0,"The foreground color for folder symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),kee=_S("symbolIcon.functionForeground",{dark:"#B180D7",light:"#652D90",hc:"#B180D7"},mf(0,"The foreground color for function symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Dee=_S("symbolIcon.interfaceForeground",{dark:"#75BEFF",light:"#007ACC",hc:"#75BEFF"},mf(0,"The foreground color for interface symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Lee=_S("symbolIcon.keyForeground",{dark:vS,light:vS,hc:vS},mf(0,"The foreground color for key symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Nee=_S("symbolIcon.keywordForeground",{dark:vS,light:vS,hc:vS},mf(0,"The foreground color for keyword symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Eee=_S("symbolIcon.methodForeground",{dark:"#B180D7",light:"#652D90",hc:"#B180D7"},mf(0,"The foreground color for method symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Iee=_S("symbolIcon.moduleForeground",{dark:vS,light:vS,hc:vS},mf(0,"The foreground color for module symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Tee=_S("symbolIcon.namespaceForeground",{dark:vS,light:vS,hc:vS},mf(0,"The foreground color for namespace symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Mee=_S("symbolIcon.nullForeground",{dark:vS,light:vS,hc:vS},mf(0,"The foreground color for null symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Aee=_S("symbolIcon.numberForeground",{dark:vS,light:vS,hc:vS},mf(0,"The foreground color for number symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Oee=_S("symbolIcon.objectForeground",{dark:vS,light:vS,hc:vS},mf(0,"The foreground color for object symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Ree=_S("symbolIcon.operatorForeground",{dark:vS,light:vS,hc:vS},mf(0,"The foreground color for operator symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Pee=_S("symbolIcon.packageForeground",{dark:vS,light:vS,hc:vS},mf(0,"The foreground color for package symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Fee=_S("symbolIcon.propertyForeground",{dark:vS,light:vS,hc:vS},mf(0,"The foreground color for property symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Bee=_S("symbolIcon.referenceForeground",{dark:vS,light:vS,hc:vS},mf(0,"The foreground color for reference symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Vee=_S("symbolIcon.snippetForeground",{dark:vS,light:vS,hc:vS},mf(0,"The foreground color for snippet symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Wee=_S("symbolIcon.stringForeground",{dark:vS,light:vS,hc:vS},mf(0,"The foreground color for string symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),zee=_S("symbolIcon.structForeground",{dark:vS,light:vS,hc:vS},mf(0,"The foreground color for struct symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Hee=_S("symbolIcon.textForeground",{dark:vS,light:vS,hc:vS},mf(0,"The foreground color for text symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),jee=_S("symbolIcon.typeParameterForeground",{dark:vS,light:vS,hc:vS},mf(0,"The foreground color for type parameter symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Uee=_S("symbolIcon.unitForeground",{dark:vS,light:vS,hc:vS},mf(0,"The foreground color for unit symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),$ee=_S("symbolIcon.variableForeground",{dark:"#75BEFF",light:"#007ACC",hc:"#75BEFF"},mf(0,"The foreground color for variable symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));sx(((e,t)=>{const i=e.getColor(gee);i&&t.addRule(`${br.symbolArray.cssSelector} { color: ${i}; }`);const n=e.getColor(pee);n&&t.addRule(`${br.symbolBoolean.cssSelector} { color: ${n}; }`);const o=e.getColor(mee);o&&t.addRule(`${br.symbolClass.cssSelector} { color: ${o}; }`);const s=e.getColor(Eee);s&&t.addRule(`${br.symbolMethod.cssSelector} { color: ${s}; }`);const r=e.getColor(fee);r&&t.addRule(`${br.symbolColor.cssSelector} { color: ${r}; }`);const a=e.getColor(_ee);a&&t.addRule(`${br.symbolConstant.cssSelector} { color: ${a}; }`);const l=e.getColor(vee);l&&t.addRule(`${br.symbolConstructor.cssSelector} { color: ${l}; }`);const d=e.getColor(bee);d&&t.addRule(`\n\t\t\t${br.symbolValue.cssSelector},${br.symbolEnum.cssSelector} { color: ${d}; }`);const c=e.getColor(wee);c&&t.addRule(`${br.symbolEnumMember.cssSelector} { color: ${c}; }`);const h=e.getColor(Cee);h&&t.addRule(`${br.symbolEvent.cssSelector} { color: ${h}; }`);const u=e.getColor(yee);u&&t.addRule(`${br.symbolField.cssSelector} { color: ${u}; }`);const g=e.getColor(xee);g&&t.addRule(`${br.symbolFile.cssSelector} { color: ${g}; }`);const p=e.getColor(See);p&&t.addRule(`${br.symbolFolder.cssSelector} { color: ${p}; }`);const m=e.getColor(kee);m&&t.addRule(`${br.symbolFunction.cssSelector} { color: ${m}; }`);const f=e.getColor(Dee);f&&t.addRule(`${br.symbolInterface.cssSelector} { color: ${f}; }`);const _=e.getColor(Lee);_&&t.addRule(`${br.symbolKey.cssSelector} { color: ${_}; }`);const v=e.getColor(Nee);v&&t.addRule(`${br.symbolKeyword.cssSelector} { color: ${v}; }`);const b=e.getColor(Iee);b&&t.addRule(`${br.symbolModule.cssSelector} { color: ${b}; }`);const w=e.getColor(Tee);w&&t.addRule(`${br.symbolNamespace.cssSelector} { color: ${w}; }`);const C=e.getColor(Mee);C&&t.addRule(`${br.symbolNull.cssSelector} { color: ${C}; }`);const y=e.getColor(Aee);y&&t.addRule(`${br.symbolNumber.cssSelector} { color: ${y}; }`);const x=e.getColor(Oee);x&&t.addRule(`${br.symbolObject.cssSelector} { color: ${x}; }`);const S=e.getColor(Ree);S&&t.addRule(`${br.symbolOperator.cssSelector} { color: ${S}; }`);const k=e.getColor(Pee);k&&t.addRule(`${br.symbolPackage.cssSelector} { color: ${k}; }`);const D=e.getColor(Fee);D&&t.addRule(`${br.symbolProperty.cssSelector} { color: ${D}; }`);const L=e.getColor(Bee);L&&t.addRule(`${br.symbolReference.cssSelector} { color: ${L}; }`);const N=e.getColor(Vee);N&&t.addRule(`${br.symbolSnippet.cssSelector} { color: ${N}; }`);const E=e.getColor(Wee);E&&t.addRule(`${br.symbolString.cssSelector} { color: ${E}; }`);const I=e.getColor(zee);I&&t.addRule(`${br.symbolStruct.cssSelector} { color: ${I}; }`);const T=e.getColor(Hee);T&&t.addRule(`${br.symbolText.cssSelector} { color: ${T}; }`);const M=e.getColor(jee);M&&t.addRule(`${br.symbolTypeParameter.cssSelector} { color: ${M}; }`);const A=e.getColor(Uee);A&&t.addRule(`${br.symbolUnit.cssSelector} { color: ${A}; }`);const O=e.getColor($ee);O&&t.addRule(`${br.symbolVariable.cssSelector} { color: ${O}; }`)}));class Kee{constructor(){let e;this._onDidWillResize=new $o,this.onDidWillResize=this._onDidWillResize.event,this._onDidResize=new $o,this.onDidResize=this._onDidResize.event,this._sashListener=new ws,this._size=new wC(0,0),this._minSize=new wC(0,0),this._maxSize=new wC(Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER),this.domNode=document.createElement("div"),this._eastSash=new cB(this.domNode,{getVerticalSashLeft:()=>this._size.width},{orientation:0}),this._westSash=new cB(this.domNode,{getVerticalSashLeft:()=>0},{orientation:0}),this._northSash=new cB(this.domNode,{getHorizontalSashTop:()=>0},{orientation:1,orthogonalEdge:nB.North}),this._southSash=new cB(this.domNode,{getHorizontalSashTop:()=>this._size.height},{orientation:1,orthogonalEdge:nB.South}),this._northSash.orthogonalStartSash=this._westSash,this._northSash.orthogonalEndSash=this._eastSash,this._southSash.orthogonalStartSash=this._westSash,this._southSash.orthogonalEndSash=this._eastSash;let t=0,i=0;this._sashListener.add(ds.any(this._northSash.onDidStart,this._eastSash.onDidStart,this._southSash.onDidStart,this._westSash.onDidStart)((()=>{void 0===e&&(this._onDidWillResize.fire(),e=this._size,t=0,i=0)}))),this._sashListener.add(ds.any(this._northSash.onDidEnd,this._eastSash.onDidEnd,this._southSash.onDidEnd,this._westSash.onDidEnd)((()=>{void 0!==e&&(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(ds.any(this._eastSash.onDidReset,this._westSash.onDidReset)((e=>{this._preferredSize&&(this.layout(this._size.height,this._preferredSize.width),this._onDidResize.fire({dimension:this._size,done:!0}))}))),this._sashListener.add(ds.any(this._northSash.onDidReset,this._southSash.onDidReset)((e=>{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:s}=this._maxSize;e=Math.max(i,Math.min(o,e)),t=Math.max(n,Math.min(s,t));const r=new wC(t,e);wC.equals(r,this._size)||(this.domNode.style.height=e+"px",this.domNode.style.width=t+"px",this._size=r,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}}var qee=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},Gee=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};function Zee(e){return!!e&&Boolean(e.completion.documentation||e.completion.detail&&e.completion.detail!==e.completion.label)}let Yee=class{constructor(e,t){this._editor=e,this._onDidClose=new $o,this.onDidClose=this._onDidClose.event,this._onDidChangeContents=new $o,this.onDidChangeContents=this._onDidChangeContents.event,this._disposables=new ws,this._renderDisposeable=new ws,this._borderWidth=1,this._size=new wC(330,0),this.domNode=YC(".suggest-details"),this.domNode.classList.add("no-docs"),this._markdownRenderer=t.createInstance(x5,{editor:e}),this._body=YC(".body"),this._scrollbar=new fT(this._body,{}),$C(this.domNode,this._scrollbar.getDomNode()),this._disposables.add(this._scrollbar),this._header=$C(this._body,YC(".header")),this._close=$C(this._header,YC("span"+br.close.cssSelector)),this._close.title=mf(0,"Close"),this._type=$C(this._header,YC("p.type")),this._docs=$C(this._body,YC("p.docs")),this._configureFont(),this._disposables.add(this._editor.onDidChangeConfiguration((e=>{e.hasChanged(44)&&this._configureFont()})))}dispose(){this._disposables.dispose(),this._renderDisposeable.dispose()}_configureFont(){const e=this._editor.getOptions(),t=e.get(44),i=t.getMassagedFontFamily(a_?Gf.fontFamily:null),n=e.get(107)||t.fontSize,o=e.get(108)||t.lineHeight,s=t.fontWeight,r=`${n}px`,a=`${o}px`;this.domNode.style.fontSize=r,this.domNode.style.lineHeight=""+o/n,this.domNode.style.fontWeight=s,this.domNode.style.fontFeatureSettings=t.fontFeatureSettings,this._type.style.fontFamily=i,this._close.style.height=a,this._close.style.width=a}getLayoutInfo(){const e=this._editor.getOption(108)||this._editor.getOption(44).lineHeight,t=this._borderWidth;return{lineHeight:e,borderWidth:t,borderHeight:2*t,verticalPadding:22,horizontalPadding:14}}renderLoading(){this._type.textContent=mf(0,"Loading..."),this._docs.textContent="",this.domNode.classList.remove("no-docs","no-type"),this.layout(this.size.width,2*this.getLayoutInfo().lineHeight),this._onDidChangeContents.fire(this)}renderItem(e,t){var i,n;this._renderDisposeable.clear();let{detail:o,documentation:s}=e.completion;if(t){let t="";t+=`score: ${e.score[0]}\n`,t+=`prefix: ${null!==(i=e.word)&&void 0!==i?i:"(no prefix)"}\n`,t+=`word: ${e.completion.filterText?e.completion.filterText+" (filterText)":e.textLabel}\n`,t+=`distance: ${e.distance} (localityBonus-setting)\n`,t+=`index: ${e.idx}, based on ${e.completion.sortText&&`sortText: "${e.completion.sortText}"`||"label"}\n`,t+=`commit_chars: ${null===(n=e.completion.commitCharacters)||void 0===n?void 0:n.join("")}\n`,s=(new RU).appendCodeblock("empty",t),o=`Provider: ${e.provider._debugDisplayName}`}if(t||Zee(e)){if(this.domNode.classList.remove("no-docs","no-type"),o){const e=o.length>1e5?`${o.substr(0,1e5)}…`:o;this._type.textContent=e,this._type.title=e,XC(this._type),this._type.classList.toggle("auto-wrap",!/\r?\n^\s+/gim.test(e))}else eC(this._type),this._type.title="",QC(this._type),this.domNode.classList.add("no-type");if(eC(this._docs),"string"==typeof s)this._docs.classList.remove("markdown-docs"),this._docs.textContent=s;else if(s){this._docs.classList.add("markdown-docs"),eC(this._docs);const e=this._markdownRenderer.render(s);this._docs.appendChild(e.element),this._renderDisposeable.add(e),this._renderDisposeable.add(this._markdownRenderer.onDidRenderAsync((()=>{this.layout(this._size.width,this._type.clientHeight+this._docs.clientHeight),this._onDidChangeContents.fire(this)})))}this.domNode.style.userSelect="text",this.domNode.tabIndex=-1,this._close.onmousedown=e=>{e.preventDefault(),e.stopPropagation()},this._close.onclick=e=>{e.preventDefault(),e.stopPropagation(),this._onDidClose.fire()},this._body.scrollTop=0,this.layout(this._size.width,this._type.clientHeight+this._docs.clientHeight),this._onDidChangeContents.fire(this)}else this.clearContents()}clearContents(){this.domNode.classList.add("no-docs"),this._type.textContent="",this._docs.textContent=""}get size(){return this._size}layout(e,t){const i=new wC(e,t);wC.equals(i,this._size)||(this._size=i,function(e,t,i){"number"==typeof t&&(e.style.width=`${t}px`),"number"==typeof i&&(e.style.height=`${i}px`)}(this.domNode,e,t)),this._scrollbar.scanDomNode()}scrollDown(e=8){this._body.scrollTop+=e}scrollUp(e=8){this._body.scrollTop-=e}scrollTop(){this._body.scrollTop=0}scrollBottom(){this._body.scrollTop=this._body.scrollHeight}pageDown(){this.scrollDown(80)}pageUp(){this.scrollUp(80)}set borderWidth(e){this._borderWidth=e}get borderWidth(){return this._borderWidth}};Yee=qee([Gee(1,k_)],Yee);class Xee{constructor(e,t){let i,n;this.widget=e,this._editor=t,this._disposables=new ws,this._added=!1,this._preferAlignAtTop=!0,this._resizable=new Kee,this._resizable.domNode.classList.add("suggest-details-container"),this._resizable.domNode.appendChild(e.domNode),this._resizable.enableSashes(!1,!0,!0,!1);let o=0,s=0;this._disposables.add(this._resizable.onDidWillResize((()=>{i=this._topLeft,n=this._resizable.size}))),this._disposables.add(this._resizable.onDidResize((e=>{if(i&&n){this.widget.layout(e.dimension.width,e.dimension.height);let t=!1;e.west&&(s=n.width-e.dimension.width,t=!0),e.north&&(o=n.height-e.dimension.height,t=!0),t&&this._applyTopLeft({top:i.top+o,left:i.left+s})}e.done&&(i=void 0,n=void 0,o=0,s=0,this._userSize=e.dimension)}))),this._disposables.add(this.widget.onDidChangeContents((()=>{var e;this._anchorBox&&this._placeAtAnchor(this._anchorBox,null!==(e=this._userSize)&&void 0!==e?e:this.widget.size,this._preferAlignAtTop)})))}dispose(){this._resizable.dispose(),this._disposables.dispose(),this.hide()}getId(){return"suggest.details"}getDomNode(){return this._resizable.domNode}getPosition(){return null}show(){this._added||(this._editor.addOverlayWidget(this),this.getDomNode().style.position="fixed",this._added=!0)}hide(e=!1){this._resizable.clearSashHoverState(),this._added&&(this._editor.removeOverlayWidget(this),this._added=!1,this._anchorBox=void 0,this._topLeft=void 0),e&&(this._userSize=void 0,this.widget.clearContents())}placeAtAnchor(e,t){var i;const n=e.getBoundingClientRect();this._anchorBox=n,this._preferAlignAtTop=t,this._placeAtAnchor(this._anchorBox,null!==(i=this._userSize)&&void 0!==i?i:this.widget.size,t)}_placeAtAnchor(e,t,i){var n;const o=vC(document.body),s=this.widget.getLayoutInfo(),r=new wC(220,2*s.lineHeight),a=e.top,l=function(){const i=o.width-(e.left+e.width+s.borderWidth+s.horizontalPadding),n=-s.borderWidth+e.left+e.width,l=new wC(i,o.height-e.top-s.borderHeight-s.verticalPadding),d=l.with(void 0,e.top+e.height-s.borderHeight-s.verticalPadding);return{top:a,left:n,fit:i-t.width,maxSizeTop:l,maxSizeBottom:d,minSize:r.with(Math.min(i,r.width))}}(),d=[l,function(){const i=e.left-s.borderWidth-s.horizontalPadding,n=Math.max(s.horizontalPadding,e.left-t.width-s.borderWidth),l=new wC(i,o.height-e.top-s.borderHeight-s.verticalPadding),d=l.with(void 0,e.top+e.height-s.borderHeight-s.verticalPadding);return{top:a,left:n,fit:i-t.width,maxSizeTop:l,maxSizeBottom:d,minSize:r.with(Math.min(i,r.width))}}(),function(){const i=e.left,n=-s.borderWidth+e.top+e.height,a=new wC(e.width-s.borderHeight,o.height-e.top-e.height-s.verticalPadding);return{top:n,left:i,fit:a.height-t.height,maxSizeBottom:a,maxSizeTop:a,minSize:r.with(a.width)}}()],c=null!==(n=d.find((e=>e.fit>=0)))&&void 0!==n?n:d.sort(((e,t)=>t.fit-e.fit))[0],h=e.top+e.height-s.borderHeight;let u,g=t.height;const p=Math.max(c.maxSizeTop.height,c.maxSizeBottom.height);let m;g>p&&(g=p),i?g<=c.maxSizeTop.height?(u=!0,m=c.maxSizeTop):(u=!1,m=c.maxSizeBottom):g<=c.maxSizeBottom.height?(u=!1,m=c.maxSizeBottom):(u=!0,m=c.maxSizeTop),this._applyTopLeft({left:c.left,top:u?c.top:h-g}),this.getDomNode().style.position="fixed",this._resizable.enableSashes(!u,c===l,u,c!==l),this._resizable.minSize=c.minSize,this._resizable.maxSize=m,this._resizable.layout(g,Math.min(m.width,t.width)),this.widget.layout(this._resizable.size.width,this._resizable.size.height)}_applyTopLeft(e){this._topLeft=e,this.getDomNode().style.left=`${this._topLeft.left}px`,this.getDomNode().style.top=`${this._topLeft.top}px`}}var Qee;!function(e){e[e.FILE=0]="FILE",e[e.FOLDER=1]="FOLDER",e[e.ROOT_FOLDER=2]="ROOT_FOLDER"}(Qee||(Qee={}));const Jee=/(?:\/|^)(?:([^\/]+)\/)?([^\/]+)$/;function ete(e,t,i,n){const o=n===Qee.ROOT_FOLDER?["rootfolder-icon"]:n===Qee.FOLDER?["folder-icon"]:["file-icon"];if(i){let s;if(i.scheme===Yw.data){s=uR.parseMetaData(i).get(uR.META_DATA_LABEL)}else{const e=i.path.match(Jee);e?(s=tte(e[2].toLowerCase()),e[1]&&o.push(`${tte(e[1].toLowerCase())}-name-dir-icon`)):s=tte(i.authority.toLowerCase())}if(n===Qee.FOLDER)o.push(`${s}-name-folder-icon`);else{if(s){if(o.push(`${s}-name-file-icon`),o.push("name-file-icon"),s.length<=255){const e=s.split(".");for(let t=1;t<e.length;t++)o.push(`${e.slice(t).join(".")}-ext-file-icon`)}o.push("ext-file-icon")}const n=function(e,t,i){if(!i)return null;let n=null;if(i.scheme===Yw.data){const e=uR.parseMetaData(i).get(uR.META_DATA_MIME);e&&(n=t.getLanguageIdByMimeType(e))}else{const t=e.getModel(i);t&&(n=t.getLanguageId())}if(n&&n!==LA)return n;return t.guessLanguageIdByFilepathOrFirstLine(i)}(e,t,i);n&&o.push(`${tte(n)}-lang-file-icon`)}}return o}function tte(e){return e.replace(/[\11\12\14\15\40]/g,"/")}var ite,nte=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},ote=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};function ste(e){return`suggest-aria-id:${e}`}const rte=CB("suggest-more-info",br.chevronRight,mf(0,"Icon for more information in the suggest widget.")),ate=new(ite=class e{extract(t,i){if(t.textLabel.match(e._regexStrict))return i[0]=t.textLabel,!0;if(t.completion.detail&&t.completion.detail.match(e._regexStrict))return i[0]=t.completion.detail,!0;if("string"==typeof t.completion.documentation){const n=e._regexRelaxed.exec(t.completion.documentation);if(n&&(0===n.index||n.index+n[0].length===t.completion.documentation.length))return i[0]=n[0],!0}return!1}},ite._regexRelaxed=/(#([\da-fA-F]{3}){1,2}|(rgb|hsl)a\(\s*(\d{1,3}%?\s*,\s*){3}(1|0?\.\d+)\)|(rgb|hsl)\(\s*\d{1,3}%?(\s*,\s*\d{1,3}%?){2}\s*\))/,ite._regexStrict=new RegExp(`^${ite._regexRelaxed.source}$`,"i"),ite);let lte=class{constructor(e,t,i,n){this._editor=e,this._modelService=t,this._languageService=i,this._themeService=n,this._onDidToggleDetails=new $o,this.onDidToggleDetails=this._onDidToggleDetails.event,this.templateId="suggestion"}dispose(){this._onDidToggleDetails.dispose()}renderTemplate(e){const t=Object.create(null);t.disposables=new ws,t.root=e,t.root.classList.add("show-file-icons"),t.icon=$C(e,YC(".icon")),t.colorspan=$C(t.icon,YC("span.colorspan"));const i=$C(e,YC(".contents")),n=$C(i,YC(".main"));t.iconContainer=$C(n,YC(".icon-label.codicon")),t.left=$C(n,YC("span.left")),t.right=$C(n,YC("span.right")),t.iconLabel=new HU(t.left,{supportHighlights:!0,supportIcons:!0}),t.disposables.add(t.iconLabel),t.parametersLabel=$C(t.left,YC("span.signature-label")),t.qualifierLabel=$C(t.left,YC("span.qualifier-label")),t.detailsLabel=$C(t.right,YC("span.details-label")),t.readMore=$C(t.right,YC("span.readMore"+ex.asCSSSelector(rte))),t.readMore.title=mf(0,"Read More");const o=()=>{const e=this._editor.getOptions(),i=e.get(44),o=i.getMassagedFontFamily(a_?Gf.fontFamily:null),s=i.fontFeatureSettings,r=e.get(107)||i.fontSize,a=e.get(108)||i.lineHeight,l=i.fontWeight,d=`${r}px`,c=`${a}px`;t.root.style.fontSize=d,t.root.style.fontWeight=l,n.style.fontFamily=o,n.style.fontFeatureSettings=s,n.style.lineHeight=c,t.icon.style.height=c,t.icon.style.width=c,t.readMore.style.height=c,t.readMore.style.width=c};return o(),t.disposables.add(this._editor.onDidChangeConfiguration((e=>{(e.hasChanged(44)||e.hasChanged(107)||e.hasChanged(108))&&o()}))),t}renderElement(e,t,i){const{completion:n}=e;i.root.id=ste(t),i.colorspan.style.backgroundColor="";const o={labelEscapeNewLines:!0,matches:cH(e.score)};let s=[];if(19===n.kind&&ate.extract(e,s))i.icon.className="icon customcolor",i.iconContainer.className="icon hide",i.colorspan.style.backgroundColor=s[0];else if(20===n.kind&&this._themeService.getFileIconTheme().hasFileIcons){i.icon.className="icon hide",i.iconContainer.className="icon hide";const t=ete(this._modelService,this._languageService,Ps.from({scheme:"fake",path:e.textLabel}),Qee.FILE),s=ete(this._modelService,this._languageService,Ps.from({scheme:"fake",path:n.detail}),Qee.FILE);o.extraClasses=t.length>s.length?t:s}else 23===n.kind&&this._themeService.getFileIconTheme().hasFolderIcons?(i.icon.className="icon hide",i.iconContainer.className="icon hide",o.extraClasses=ba([ete(this._modelService,this._languageService,Ps.from({scheme:"fake",path:e.textLabel}),Qee.FOLDER),ete(this._modelService,this._languageService,Ps.from({scheme:"fake",path:n.detail}),Qee.FOLDER)])):(i.icon.className="icon hide",i.iconContainer.className="",i.iconContainer.classList.add("suggest-icon",...Ys.asClassNameArray(Kl.toIcon(n.kind))));n.tags&&n.tags.indexOf(1)>=0&&(o.extraClasses=(o.extraClasses||[]).concat(["deprecated"]),o.matches=[]),i.iconLabel.setLabel(e.textLabel,void 0,o),"string"==typeof n.label?(i.parametersLabel.textContent="",i.detailsLabel.textContent=dte(n.detail||""),i.root.classList.add("string-label")):(i.parametersLabel.textContent=dte(n.label.detail||""),i.detailsLabel.textContent=dte(n.label.description||""),i.root.classList.remove("string-label")),this._editor.getOption(106).showInlineDetails?XC(i.detailsLabel):QC(i.detailsLabel),Zee(e)?(i.right.classList.add("can-expand-details"),XC(i.readMore),i.readMore.onmousedown=e=>{e.stopPropagation(),e.preventDefault()},i.readMore.onclick=e=>{e.stopPropagation(),e.preventDefault(),this._onDidToggleDetails.fire()}):(i.right.classList.remove("can-expand-details"),QC(i.readMore),i.readMore.onmousedown=null,i.readMore.onclick=null)}disposeTemplate(e){e.disposables.dispose()}};function dte(e){return e.replace(/\r\n|\r|\n/g,"")}lte=nte([ote(1,Gv),ote(2,Lv),ote(3,Qy)],lte);var cte=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},hte=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}},ute=globalThis&&globalThis.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{l(n.next(e))}catch(t){s(t)}}function a(e){try{l(n.throw(e))}catch(t){s(t)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}l((n=n.apply(e,t||[])).next())}))};_S("editorSuggestWidget.background",{dark:fk,light:fk,hc:fk},mf(0,"Background color of the suggest widget.")),_S("editorSuggestWidget.border",{dark:vk,light:vk,hc:vk},mf(0,"Border color of the suggest widget."));const gte=_S("editorSuggestWidget.foreground",{dark:mk,light:mk,hc:mk},mf(0,"Foreground color of the suggest widget."));_S("editorSuggestWidget.selectedForeground",{dark:WD,light:WD,hc:WD},mf(0,"Foreground color of the selected entry in the suggest widget.")),_S("editorSuggestWidget.selectedIconForeground",{dark:zD,light:zD,hc:zD},mf(0,"Icon foreground color of the selected entry in the suggest widget."));const pte=_S("editorSuggestWidget.selectedBackground",{dark:HD,light:HD,hc:HD},mf(0,"Background color of the selected entry in the suggest widget."));_S("editorSuggestWidget.highlightForeground",{dark:ND,light:ND,hc:ND},mf(0,"Color of the match highlights in the suggest widget.")),_S("editorSuggestWidget.focusHighlightForeground",{dark:ED,light:ED,hc:ED},mf(0,"Color of the match highlights in the suggest widget when an item is focused.")),_S("editorSuggestWidgetStatus.foreground",{dark:yL(gte,.5),light:yL(gte,.5),hc:yL(gte,.5)},mf(0,"Foreground color of the suggest widget status."));class mte{constructor(e,t){this._service=e,this._key=`suggestWidget.size/${t.getEditorType()}/${t instanceof g1}`}restore(){var e;const t=null!==(e=this._service.get(this._key,0))&&void 0!==e?e:"";try{const e=JSON.parse(t);if(wC.is(e))return wC.lift(e)}catch(O3){}}store(e){this._service.store(this._key,JSON.stringify(e),0,1)}reset(){this._service.remove(this._key,0)}}let fte=class e{constructor(e,t,i,n,o){this.editor=e,this._storageService=t,this._state=0,this._isAuto=!1,this._ignoreFocusEvents=!1,this._forceRenderingAbove=!1,this._explainMode=!1,this._showTimeout=new rb,this._disposables=new ws,this._onDidSelect=new $o,this._onDidFocus=new $o,this._onDidHide=new $o,this._onDidShow=new $o,this.onDidSelect=this._onDidSelect.event,this.onDidFocus=this._onDidFocus.event,this.onDidHide=this._onDidHide.event,this.onDidShow=this._onDidShow.event,this._onDetailsKeydown=new $o,this.onDetailsKeyDown=this._onDetailsKeydown.event,this.element=new Kee,this.element.domNode.classList.add("editor-widget","suggest-widget"),this._contentWidget=new _te(this,e),this._persistedSize=new mte(t,e);class s{constructor(e,t,i=!1,n=!1){this.persistedSize=e,this.currentSize=t,this.persistHeight=i,this.persistWidth=n}}let r;this._disposables.add(this.element.onDidWillResize((()=>{this._contentWidget.lockPreference(),r=new s(this._persistedSize.restore(),this.element.size)}))),this._disposables.add(this.element.onDidResize((e=>{var t,i,n,o;if(this._resize(e.dimension.width,e.dimension.height),r&&(r.persistHeight=r.persistHeight||!!e.north||!!e.south,r.persistWidth=r.persistWidth||!!e.east||!!e.west),e.done){if(r){const{itemHeight:e,defaultSize:s}=this.getLayoutInfo(),a=Math.round(e/2);let{width:l,height:d}=this.element.size;(!r.persistHeight||Math.abs(r.currentSize.height-d)<=a)&&(d=null!==(i=null===(t=r.persistedSize)||void 0===t?void 0:t.height)&&void 0!==i?i:s.height),(!r.persistWidth||Math.abs(r.currentSize.width-l)<=a)&&(l=null!==(o=null===(n=r.persistedSize)||void 0===n?void 0:n.width)&&void 0!==o?o:s.width),this._persistedSize.store(new wC(l,d))}this._contentWidget.unlockPreference(),r=void 0}}))),this._messageElement=$C(this.element.domNode,YC(".message")),this._listElement=$C(this.element.domNode,YC(".tree"));const a=o.createInstance(Yee,this.editor);a.onDidClose(this.toggleDetails,this,this._disposables),this._details=new Xee(a,this.editor);const l=()=>this.element.domNode.classList.toggle("no-icons",!this.editor.getOption(106).showIcons);l();const d=o.createInstance(lte,this.editor);this._disposables.add(d),this._disposables.add(d.onDidToggleDetails((()=>this.toggleDetails()))),this._list=new G$("SuggestWidget",this._listElement,{getHeight:e=>this.getLayoutInfo().itemHeight,getTemplateId:e=>"suggestion"},[d],{alwaysConsumeMouseWheel:!0,useShadows:!1,mouseSupport:!1,accessibilityProvider:{getRole:()=>"option",getWidgetAriaLabel:()=>mf(0,"Suggest"),getWidgetRole:()=>"listbox",getAriaLabel:e=>{let t=e.textLabel;if("string"!=typeof e.completion.label){const{detail:i,description:n}=e.completion.label;i&&n?t=mf(0,"{0}{1}, {2}",t,i,n):i?t=mf(0,"{0}{1}",t,i):n&&(t=mf(0,"{0}, {1}",t,n))}if(!e.isResolved||!this._isDetailsVisible())return t;const{documentation:i,detail:n}=e.completion;return mf(0,"{0}, docs: {1}",t,Aa("{0}{1}",n||"",i?"string"==typeof i?i:i.value:""))}}}),this._status=o.createInstance(uee,this.element.domNode);const c=()=>this.element.domNode.classList.toggle("with-status-bar",this.editor.getOption(106).showStatusBar);c(),this._disposables.add($H(this._list,n,{listInactiveFocusBackground:pte,listInactiveFocusOutline:xS})),this._disposables.add(n.onDidColorThemeChange((e=>this._onThemeChange(e)))),this._onThemeChange(n.getColorTheme()),this._disposables.add(this._list.onMouseDown((e=>this._onListMouseDownOrTap(e)))),this._disposables.add(this._list.onTap((e=>this._onListMouseDownOrTap(e)))),this._disposables.add(this._list.onDidChangeSelection((e=>this._onListSelection(e)))),this._disposables.add(this._list.onDidChangeFocus((e=>this._onListFocus(e)))),this._disposables.add(this.editor.onDidChangeCursorSelection((()=>this._onCursorSelectionChanged()))),this._disposables.add(this.editor.onDidChangeConfiguration((e=>{e.hasChanged(106)&&(c(),l())}))),this._ctxSuggestWidgetVisible=Z2.Visible.bindTo(i),this._ctxSuggestWidgetDetailsVisible=Z2.DetailsVisible.bindTo(i),this._ctxSuggestWidgetMultipleSuggestions=Z2.MultipleSuggestions.bindTo(i),this._disposables.add(sC(this._details.widget.domNode,"keydown",(e=>{this._onDetailsKeydown.fire(e)}))),this._disposables.add(this.editor.onMouseDown((e=>this._onEditorMouseDown(e))))}dispose(){var e;this._details.widget.dispose(),this._details.dispose(),this._list.dispose(),this._status.dispose(),this._disposables.dispose(),null===(e=this._loadingTimeout)||void 0===e||e.dispose(),this._showTimeout.dispose(),this._contentWidget.dispose(),this.element.dispose()}_onEditorMouseDown(e){this._details.widget.domNode.contains(e.target.element)?this._details.widget.domNode.focus():this.element.domNode.contains(e.target.element)&&this.editor.focus()}_onCursorSelectionChanged(){0!==this._state&&this._contentWidget.layout()}_onListMouseDownOrTap(e){void 0!==e.element&&void 0!==e.index&&(e.browserEvent.preventDefault(),e.browserEvent.stopPropagation(),this._select(e.element,e.index))}_onListSelection(e){e.elements.length&&this._select(e.elements[0],e.indexes[0])}_select(e,t){const i=this._completionModel;i&&(this._onDidSelect.fire({item:e,index:t,model:i}),this.editor.focus())}_onThemeChange(e){this._details.widget.borderWidth="hc"===e.type?2:1}_onListFocus(e){var t;if(this._ignoreFocusEvents)return;if(!e.elements.length)return this._currentSuggestionDetails&&(this._currentSuggestionDetails.cancel(),this._currentSuggestionDetails=void 0,this._focusedItem=void 0),void this.editor.setAriaOptions({activeDescendant:void 0});if(!this._completionModel)return;const i=e.elements[0],n=e.indexes[0];i!==this._focusedItem&&(null===(t=this._currentSuggestionDetails)||void 0===t||t.cancel(),this._currentSuggestionDetails=void 0,this._focusedItem=i,this._list.reveal(n),this._currentSuggestionDetails=Xv((e=>ute(this,void 0,void 0,(function*(){const t=ob((()=>{this._isDetailsVisible()&&this.showDetails(!0)}),250),n=e.onCancellationRequested((()=>t.dispose())),o=yield i.resolve(e);return t.dispose(),n.dispose(),o})))),this._currentSuggestionDetails.then((()=>{n>=this._list.length||i!==this._list.element(n)||(this._ignoreFocusEvents=!0,this._list.splice(n,1,[i]),this._list.setFocus([n]),this._ignoreFocusEvents=!1,this._isDetailsVisible()?this.showDetails(!1):this.element.domNode.classList.remove("docs-side"),this.editor.setAriaOptions({activeDescendant:ste(n)}))})).catch(Jo)),this._onDidFocus.fire({item:i,index:n,model:this._completionModel})}_setState(t){if(this._state!==t)switch(this._state=t,this.element.domNode.classList.toggle("frozen",4===t),this.element.domNode.classList.remove("message"),t){case 0:QC(this._messageElement,this._listElement,this._status.element),this._details.hide(!0),this._status.hide(),this._contentWidget.hide(),this._ctxSuggestWidgetVisible.reset(),this._ctxSuggestWidgetMultipleSuggestions.reset(),this._showTimeout.cancel(),this.element.domNode.classList.remove("visible"),this._list.splice(0,this._list.length),this._focusedItem=void 0,this._cappedHeight=void 0,this._explainMode=!1;break;case 1:this.element.domNode.classList.add("message"),this._messageElement.textContent=e.LOADING_MESSAGE,QC(this._listElement,this._status.element),XC(this._messageElement),this._details.hide(),this._show(),this._focusedItem=void 0;break;case 2:this.element.domNode.classList.add("message"),this._messageElement.textContent=e.NO_SUGGESTIONS_MESSAGE,QC(this._listElement,this._status.element),XC(this._messageElement),this._details.hide(),this._show(),this._focusedItem=void 0;break;case 3:case 4:QC(this._messageElement),XC(this._listElement,this._status.element),this._show();break;case 5:QC(this._messageElement),XC(this._listElement,this._status.element),this._details.show(),this._show()}}_show(){this._status.show(),this._contentWidget.show(),this._layout(this._persistedSize.restore()),this._ctxSuggestWidgetVisible.set(!0),this._showTimeout.cancelAndSet((()=>{this.element.domNode.classList.add("visible"),this._onDidShow.fire(this)}),100)}showTriggered(e,t){0===this._state&&(this._contentWidget.setPosition(this.editor.getPosition()),this._isAuto=!!e,this._isAuto||(this._loadingTimeout=ob((()=>this._setState(1)),t)))}showSuggestions(e,t,i,n){var o,s;if(this._contentWidget.setPosition(this.editor.getPosition()),null===(o=this._loadingTimeout)||void 0===o||o.dispose(),null===(s=this._currentSuggestionDetails)||void 0===s||s.cancel(),this._currentSuggestionDetails=void 0,this._completionModel!==e&&(this._completionModel=e),i&&2!==this._state&&0!==this._state)return void this._setState(4);const r=this._completionModel.items.length,a=0===r;if(this._ctxSuggestWidgetMultipleSuggestions.set(r>1),a)return this._setState(n?0:2),void(this._completionModel=void 0);this._focusedItem=void 0,this._list.splice(0,this._list.length,this._completionModel.items),this._setState(i?4:3),this._list.reveal(t,0),this._list.setFocus([t]),this._layout(this.element.size),this._details.widget.domNode.classList.remove("focused")}selectNextPage(){switch(this._state){case 0:return!1;case 5:return this._details.widget.pageDown(),!0;case 1:return!this._isAuto;default:return this._list.focusNextPage(),!0}}selectNext(){switch(this._state){case 0:return!1;case 1:return!this._isAuto;default:return this._list.focusNext(1,!0),!0}}selectLast(){switch(this._state){case 0:return!1;case 5:return this._details.widget.scrollBottom(),!0;case 1:return!this._isAuto;default:return this._list.focusLast(),!0}}selectPreviousPage(){switch(this._state){case 0:return!1;case 5:return this._details.widget.pageUp(),!0;case 1:return!this._isAuto;default:return this._list.focusPreviousPage(),!0}}selectPrevious(){switch(this._state){case 0:return!1;case 1:return!this._isAuto;default:return this._list.focusPrevious(1,!0),!1}}selectFirst(){switch(this._state){case 0:return!1;case 5:return this._details.widget.scrollTop(),!0;case 1:return!this._isAuto;default:return this._list.focusFirst(),!0}}getFocusedItem(){if(0!==this._state&&2!==this._state&&1!==this._state&&this._completionModel)return{item:this._list.getFocusedElements()[0],index:this._list.getFocus()[0],model:this._completionModel}}toggleDetailsFocus(){5===this._state?(this._setState(3),this._details.widget.domNode.classList.remove("focused")):3===this._state&&this._isDetailsVisible()&&(this._setState(5),this._details.widget.domNode.classList.add("focused"))}toggleDetails(){this._isDetailsVisible()?(this._ctxSuggestWidgetDetailsVisible.set(!1),this._setDetailsVisible(!1),this._details.hide(),this.element.domNode.classList.remove("shows-details")):!Zee(this._list.getFocusedElements()[0])&&!this._explainMode||3!==this._state&&5!==this._state&&4!==this._state||(this._ctxSuggestWidgetDetailsVisible.set(!0),this._setDetailsVisible(!0),this.showDetails(!1))}showDetails(e){this._details.show(),e?this._details.widget.renderLoading():this._details.widget.renderItem(this._list.getFocusedElements()[0],this._explainMode),this._positionDetails(),this.editor.focus(),this.element.domNode.classList.add("shows-details")}toggleExplainMode(){this._list.getFocusedElements()[0]&&(this._explainMode=!this._explainMode,this._isDetailsVisible()?this.showDetails(!1):this.toggleDetails())}resetPersistedSize(){this._persistedSize.reset()}hideWidget(){var e;null===(e=this._loadingTimeout)||void 0===e||e.dispose(),this._setState(0),this._onDidHide.fire(this),this.element.clearSashHoverState();const t=this._persistedSize.restore(),i=Math.ceil(4.3*this.getLayoutInfo().itemHeight);t&&t.height<i&&this._persistedSize.store(t.with(void 0,i))}isFrozen(){return 4===this._state}_afterRender(e){null!==e?2!==this._state&&1!==this._state&&(this._isDetailsVisible()&&this._details.show(),this._positionDetails()):this._isDetailsVisible()&&this._details.hide()}_layout(e){var t,i,n;if(!this.editor.hasModel())return;if(!this.editor.getDomNode())return;const o=vC(document.body),s=this.getLayoutInfo();e||(e=s.defaultSize);let r=e.height,a=e.width;if(this._status.element.style.lineHeight=`${s.itemHeight}px`,2===this._state||1===this._state)r=s.itemHeight+s.borderHeight,a=s.defaultSize.width/2,this.element.enableSashes(!1,!1,!1,!1),this.element.minSize=this.element.maxSize=new wC(a,r),this._contentWidget.setPreference(2);else{const l=o.width-s.borderHeight-2*s.horizontalPadding;a>l&&(a=l);const d=this._completionModel?this._completionModel.stats.pLabelLen*s.typicalHalfwidthCharacterWidth:a,c=s.statusBarHeight+this._list.contentHeight+s.borderHeight,h=s.itemHeight+s.statusBarHeight,u=yC(this.editor.getDomNode()),g=this.editor.getScrolledVisiblePosition(this.editor.getPosition()),p=u.top+g.top+g.height,m=Math.min(o.height-p-s.verticalPadding,c),f=u.top+g.top-s.verticalPadding,_=Math.min(f,c);let v=Math.min(Math.max(_,m)+s.borderHeight,c);r===(null===(t=this._cappedHeight)||void 0===t?void 0:t.capped)&&(r=this._cappedHeight.wanted),r<h&&(r=h),r>v&&(r=v);const b=150;r>m||this._forceRenderingAbove&&f>b?(this._contentWidget.setPreference(1),this.element.enableSashes(!0,!0,!1,!1),v=_):(this._contentWidget.setPreference(2),this.element.enableSashes(!1,!0,!0,!1),v=m),this.element.preferredSize=new wC(d,s.defaultSize.height),this.element.maxSize=new wC(l,v),this.element.minSize=new wC(220,h),this._cappedHeight=r===c?{wanted:null!==(n=null===(i=this._cappedHeight)||void 0===i?void 0:i.wanted)&&void 0!==n?n:e.height,capped:r}:void 0}this._resize(a,r)}_resize(e,t){const{width:i,height:n}=this.element.maxSize;e=Math.min(i,e),t=Math.min(n,t);const{statusBarHeight:o}=this.getLayoutInfo();this._list.layout(t-o,e),this._listElement.style.height=t-o+"px",this.element.layout(t,e),this._contentWidget.layout(),this._positionDetails()}_positionDetails(){var e;this._isDetailsVisible()&&this._details.placeAtAnchor(this.element.domNode,2===(null===(e=this._contentWidget.getPosition())||void 0===e?void 0:e.preference[0]))}getLayoutInfo(){const e=this.editor.getOption(44),t=JV(this.editor.getOption(108)||e.lineHeight,8,1e3),i=this.editor.getOption(106).showStatusBar&&2!==this._state&&1!==this._state?t:0,n=this._details.widget.borderWidth,o=2*n;return{itemHeight:t,statusBarHeight:i,borderWidth:n,borderHeight:o,typicalHalfwidthCharacterWidth:e.typicalHalfwidthCharacterWidth,verticalPadding:22,horizontalPadding:14,defaultSize:new wC(430,i+12*t+o)}}_isDetailsVisible(){return this._storageService.getBoolean("expandSuggestionDocs",0,!1)}_setDetailsVisible(e){this._storageService.store("expandSuggestionDocs",e,0,0)}forceRenderingAbove(){this._forceRenderingAbove||(this._forceRenderingAbove=!0,this._layout(this._persistedSize.restore()))}stopForceRenderingAbove(){this._forceRenderingAbove=!1}};fte.LOADING_MESSAGE=mf(0,"Loading..."),fte.NO_SUGGESTIONS_MESSAGE=mf(0,"No suggestions."),fte=cte([hte(1,bZ),hte(2,$y),hte(3,Qy),hte(4,k_)],fte);class _te{constructor(e,t){this._widget=e,this._editor=t,this.allowEditorOverflow=!0,this.suppressMouseDown=!1,this._preferenceLocked=!1,this._added=!1,this._hidden=!1}dispose(){this._added&&(this._added=!1,this._editor.removeContentWidget(this))}getId(){return"editor.widget.suggestWidget"}getDomNode(){return this._widget.element.domNode}show(){this._hidden=!1,this._added||(this._added=!0,this._editor.addContentWidget(this))}hide(){this._hidden||(this._hidden=!0,this.layout())}layout(){this._editor.layoutContentWidget(this)}getPosition(){return!this._hidden&&this._position&&this._preference?{position:this._position,preference:[this._preference]}:null}beforeRender(){const{height:e,width:t}=this._widget.element.size,{borderWidth:i,horizontalPadding:n}=this._widget.getLayoutInfo();return new wC(t+2*i+n,e+2*i)}afterRender(e){this._widget._afterRender(e)}setPreference(e){this._preferenceLocked||(this._preference=e)}lockPreference(){this._preferenceLocked=!0}unlockPreference(){this._preferenceLocked=!1}setPosition(e){this._position=e}}var vte=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},bte=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};class wte{constructor(e,t){this._model=e,this._position=t;if(e.getLineMaxColumn(t.lineNumber)!==t.column){const i=e.getOffsetAt(t),n=e.getPositionAt(i+1);this._marker=e.deltaDecorations([],[{range:qo.fromPositions(t,n),options:{description:"suggest-line-suffix",stickiness:1}}])}}dispose(){this._marker&&!this._model.isDisposed()&&this._model.deltaDecorations(this._marker,[])}delta(e){if(this._model.isDisposed()||this._position.lineNumber!==e.lineNumber)return 0;if(this._marker){const t=this._model.getDecorationRange(this._marker[0]);return this._model.getOffsetAt(t.getStartPosition())-this._model.getOffsetAt(e)}return this._model.getLineMaxColumn(e.lineNumber)-e.column}}let Cte=class e{constructor(e,t,i,n,o,s,r){this._memoryService=t,this._commandService=i,this._contextKeyService=n,this._instantiationService=o,this._logService=s,this._telemetryService=r,this._lineSuffix=new Rr,this._toDispose=new ws,this._selectors=new yte((e=>e.priority)),this._telemetryGate=0,this.editor=e,this.model=o.createInstance(aee,this.editor);const a=Z2.InsertMode.bindTo(n);a.set(e.getOption(106).insertMode),this.model.onDidTrigger((()=>a.set(e.getOption(106).insertMode))),this.widget=this._toDispose.add(new cb((()=>{const e=this._instantiationService.createInstance(fte,this.editor);this._toDispose.add(e),this._toDispose.add(e.onDidSelect((e=>this._insertSuggestion(e,0)),this));const t=new X9(this.editor,e,(e=>this._insertSuggestion(e,2)));this._toDispose.add(t),this._toDispose.add(this.model.onDidSuggest((e=>{0===e.completionModel.items.length&&t.reset()})));const i=Z2.MakesTextEdit.bindTo(this._contextKeyService),n=Z2.HasInsertAndReplaceRange.bindTo(this._contextKeyService),o=Z2.CanResolve.bindTo(this._contextKeyService);return this._toDispose.add(es((()=>{i.reset(),n.reset(),o.reset()}))),this._toDispose.add(e.onDidFocus((({item:e})=>{const t=this.editor.getPosition(),s=e.editStart.column,r=t.column;let a=!0;if(!("smart"!==this.editor.getOption(1)||2!==this.model.state||e.completion.additionalTextEdits||4&e.completion.insertTextRules||r-s!==e.completion.insertText.length)){a=this.editor.getModel().getValueInRange({startLineNumber:t.lineNumber,startColumn:s,endLineNumber:t.lineNumber,endColumn:r})!==e.completion.insertText}i.set(a),n.set(!er.equals(e.editInsertEnd,e.editReplaceEnd)),o.set(Boolean(e.provider.resolveCompletionItem)||Boolean(e.completion.documentation)||e.completion.detail!==e.completion.label)}))),this._toDispose.add(e.onDetailsKeyDown((e=>{e.toKeybinding().equals(new Bw(!0,!1,!1,!1,33))||zo&&e.toKeybinding().equals(new Bw(!1,!1,!1,!0,33))?e.stopPropagation():e.toKeybinding().isModifierKey()||this.editor.focus()}))),e}))),this._overtypingCapturer=this._toDispose.add(new cb((()=>this._toDispose.add(new lee(this.editor,this.model))))),this._alternatives=this._toDispose.add(new cb((()=>this._toDispose.add(new Y9(this.editor,this._contextKeyService))))),this._toDispose.add(o.createInstance(q9,e)),this._toDispose.add(this.model.onDidTrigger((e=>{this.widget.value.showTriggered(e.auto,e.shy?250:50),this._lineSuffix.value=new wte(this.editor.getModel(),e.position)}))),this._toDispose.add(this.model.onDidSuggest((e=>{if(!e.shy){let t=-1;for(const i of this._selectors.itemsOrderedByPriorityDesc)if(t=i.select(this.editor.getModel(),this.editor.getPosition(),e.completionModel.items),-1!==t)break;-1===t&&(t=this._memoryService.select(this.editor.getModel(),this.editor.getPosition(),e.completionModel.items)),this.widget.value.showSuggestions(e.completionModel,t,e.isFrozen,e.auto)}}))),this._toDispose.add(this.model.onDidCancel((e=>{e.retrigger||this.widget.value.hideWidget()}))),this._toDispose.add(this.editor.onDidBlurEditorWidget((()=>{this.model.cancel(),this.model.clear()})));let l=Z2.AcceptSuggestionsOnEnter.bindTo(n),d=()=>{const e=this.editor.getOption(1);l.set("on"===e||"smart"===e)};this._toDispose.add(this.editor.onDidChangeConfiguration((()=>d()))),d()}static get(t){return t.getContribution(e.ID)}dispose(){this._alternatives.dispose(),this._toDispose.dispose(),this.widget.dispose(),this.model.dispose(),this._lineSuffix.dispose()}_insertSuggestion(e,t){if(!e||!e.item)return this._alternatives.value.reset(),this.model.cancel(),void this.model.clear();if(!this.editor.hasModel())return;const i=F9.get(this.editor);if(!i)return;const n=this.editor.getModel(),o=n.getAlternativeVersionId(),{item:s}=e,r=[],a=new as;1&t||this.editor.pushUndoStop();const l=this.getOverwriteInfo(s,Boolean(8&t));if(this._memoryService.memorize(n,this.editor.getPosition(),s),Array.isArray(s.completion.additionalTextEdits)){const e=hB.capture(this.editor);this.editor.executeEdits("suggestController.additionalTextEdits.sync",s.completion.additionalTextEdits.map((e=>_W.replace(qo.lift(e.range),e.text)))),e.restoreRelativeVerticalPositionOfCursor(this.editor)}else if(!s.isResolved){const e=new ps(!0);let i;const o=n.onDidChangeContent((e=>{if(e.isFlush)return a.cancel(),void o.dispose();for(let t of e.changes){const e=qo.getEndPosition(t.range);i&&!er.isBefore(e,i)||(i=e)}}));let l=t;t|=2;let d=!1,c=this.editor.onWillType((()=>{c.dispose(),d=!0,2&l||this.editor.pushUndoStop()}));r.push(s.resolve(a.token).then((()=>{if(!s.completion.additionalTextEdits||a.token.isCancellationRequested)return!1;if(i&&s.completion.additionalTextEdits.some((e=>er.isBefore(i,qo.getStartPosition(e.range)))))return!1;d&&this.editor.pushUndoStop();const e=hB.capture(this.editor);return this.editor.executeEdits("suggestController.additionalTextEdits.async",s.completion.additionalTextEdits.map((e=>_W.replace(qo.lift(e.range),e.text)))),e.restoreRelativeVerticalPositionOfCursor(this.editor),!d&&2&l||this.editor.pushUndoStop(),!0})).then((t=>{this._logService.trace("[suggest] async resolving of edits DONE (ms, applied?)",e.elapsed(),t),o.dispose(),c.dispose()})))}let{insertText:d}=s.completion;4&s.completion.insertTextRules||(d=x2.escape(d)),i.insert(d,{overwriteBefore:l.overwriteBefore,overwriteAfter:l.overwriteAfter,undoStopBefore:!1,undoStopAfter:!1,adjustWhitespace:!(1&s.completion.insertTextRules),clipboardText:e.model.clipboardText,overtypingCapturer:this._overtypingCapturer.value}),2&t||this.editor.pushUndoStop(),s.completion.command?s.completion.command.id===xte.id?this.model.trigger({auto:!0,shy:!1},!0):(r.push(this._commandService.executeCommand(s.completion.command.id,...s.completion.command.arguments?[...s.completion.command.arguments]:[]).catch(Jo)),this.model.cancel()):this.model.cancel(),4&t&&this._alternatives.value.set(e,(e=>{for(a.cancel();n.canUndo();){o!==n.getAlternativeVersionId()&&n.undo(),this._insertSuggestion(e,3|(8&t?8:0));break}})),this._alertCompletionItem(s),Promise.all(r).finally((()=>{this._reportSuggestionAcceptedTelemetry(n,e),this.model.clear(),a.dispose()}))}_reportSuggestionAcceptedTelemetry(e,t){var i;if(this._telemetryGate++%100!=0)return;const n=(null!==(i=t.item.provider._debugDisplayName)&&void 0!==i?i:"unknown").split("(",1)[0].toLowerCase();this._telemetryService.publicLog2("suggest.acceptedSuggestion",{providerId:n,basenameHash:Pl(oR(e.uri)).toString(16),languageId:e.getLanguageId(),fileExtension:sR(e.uri)})}getOverwriteInfo(e,t){Js(this.editor.hasModel());let i="replace"===this.editor.getOption(106).insertMode;t&&(i=!i);const n=e.position.column-e.editStart.column,o=(i?e.editReplaceEnd.column:e.editInsertEnd.column)-e.position.column;return{overwriteBefore:n+(this.editor.getPosition().column-e.position.column),overwriteAfter:o+(this._lineSuffix.value?this._lineSuffix.value.delta(this.editor.getPosition()):0)}}_alertCompletionItem(e){if(gs(e.completion.additionalTextEdits)){dy(mf(0,"Accepting '{0}' made {1} additional edits",e.textLabel,e.completion.additionalTextEdits.length))}}triggerSuggest(e,t){this.editor.hasModel()&&(this.model.trigger({auto:null!=t&&t,shy:!1},!1,e),this.editor.revealPosition(this.editor.getPosition(),0),this.editor.focus())}triggerSuggestAndAcceptBest(e){if(!this.editor.hasModel())return;const t=this.editor.getPosition(),i=()=>{t.equals(this.editor.getPosition())&&this._commandService.executeCommand(e.fallback)},n=e=>{if(4&e.completion.insertTextRules||e.completion.additionalTextEdits)return!0;const t=this.editor.getPosition(),i=e.editStart.column,n=t.column;if(n-i!==e.completion.insertText.length)return!0;return this.editor.getModel().getValueInRange({startLineNumber:t.lineNumber,startColumn:i,endLineNumber:t.lineNumber,endColumn:n})!==e.completion.insertText};ds.once(this.model.onDidTrigger)((e=>{let t=[];ds.any(this.model.onDidTrigger,this.model.onDidCancel)((()=>{bs(t),i()}),void 0,t),this.model.onDidSuggest((({completionModel:e})=>{if(bs(t),0===e.items.length)return void i();const o=this._memoryService.select(this.editor.getModel(),this.editor.getPosition(),e.items),s=e.items[o];n(s)?(this.editor.pushUndoStop(),this._insertSuggestion({index:o,item:s,model:e},7)):i()}),void 0,t)})),this.model.trigger({auto:!1,shy:!0}),this.editor.revealPosition(t,0),this.editor.focus()}acceptSelectedSuggestion(e,t){const i=this.widget.value.getFocusedItem();let n=0;e&&(n|=4),t&&(n|=8),this._insertSuggestion(i,n)}acceptNextSuggestion(){this._alternatives.value.next()}acceptPrevSuggestion(){this._alternatives.value.prev()}cancelSuggestWidget(){this.model.cancel(),this.model.clear(),this.widget.value.hideWidget()}selectNextSuggestion(){this.widget.value.selectNext()}selectNextPageSuggestion(){this.widget.value.selectNextPage()}selectLastSuggestion(){this.widget.value.selectLast()}selectPrevSuggestion(){this.widget.value.selectPrevious()}selectPrevPageSuggestion(){this.widget.value.selectPreviousPage()}selectFirstSuggestion(){this.widget.value.selectFirst()}toggleSuggestionDetails(){this.widget.value.toggleDetails()}toggleExplainMode(){this.widget.value.toggleExplainMode()}toggleSuggestionFocus(){this.widget.value.toggleDetailsFocus()}resetWidgetSize(){this.widget.value.resetPersistedSize()}forceRenderingAbove(){this.widget.value.forceRenderingAbove()}stopForceRenderingAbove(){this.widget.isInitialized&&this.widget.value.stopForceRenderingAbove()}registerSelector(e){return this._selectors.register(e)}};Cte.ID="editor.contrib.suggestController",Cte=vte([bte(1,U9),bte(2,wy),bte(3,$y),bte(4,k_),bte(5,Cb),bte(6,vx)],Cte);class yte{constructor(e){this.prioritySelector=e,this._items=new Array}register(e){if(-1!==this._items.indexOf(e))throw new Error("Value is already registered");return this._items.push(e),this._items.sort(((e,t)=>this.prioritySelector(t)-this.prioritySelector(e))),{dispose:()=>{const t=this._items.indexOf(e);t>=0&&this._items.splice(t,1)}}}get itemsOrderedByPriorityDesc(){return this._items}}class xte extends xx{constructor(){super({id:xte.id,label:mf(0,"Trigger Suggest"),alias:"Trigger Suggest",precondition:Sy.and(yI.writable,yI.hasCompletionItemProvider),kbOpts:{kbExpr:yI.textInputFocus,primary:2058,secondary:[2087],mac:{primary:266,secondary:[521,2087]},weight:100}})}run(e,t,i){const n=Cte.get(t);if(!n)return;let o;i&&"object"==typeof i&&!0===i.auto&&(o=!0),n.triggerSuggest(void 0,o)}}xte.id="editor.action.triggerSuggest",Ix(Cte.ID,Cte),Lx(xte);const Ste=190,kte=yx.bindToContribution(Cte.get);Dx(new kte({id:"acceptSelectedSuggestion",precondition:Z2.Visible,handler(e){e.acceptSelectedSuggestion(!0,!1)}})),fx.registerKeybindingRule({id:"acceptSelectedSuggestion",when:Sy.and(Z2.Visible,yI.textInputFocus),primary:2,weight:Ste}),fx.registerKeybindingRule({id:"acceptSelectedSuggestion",when:Sy.and(Z2.Visible,yI.textInputFocus,Z2.AcceptSuggestionsOnEnter,Z2.MakesTextEdit),primary:3,weight:Ste}),ux.appendMenuItem(Y2,{command:{id:"acceptSelectedSuggestion",title:mf(0,"Insert")},group:"left",order:1,when:Z2.HasInsertAndReplaceRange.toNegated()}),ux.appendMenuItem(Y2,{command:{id:"acceptSelectedSuggestion",title:mf(0,"Insert")},group:"left",order:1,when:Sy.and(Z2.HasInsertAndReplaceRange,Z2.InsertMode.isEqualTo("insert"))}),ux.appendMenuItem(Y2,{command:{id:"acceptSelectedSuggestion",title:mf(0,"Replace")},group:"left",order:1,when:Sy.and(Z2.HasInsertAndReplaceRange,Z2.InsertMode.isEqualTo("replace"))}),Dx(new kte({id:"acceptAlternativeSelectedSuggestion",precondition:Sy.and(Z2.Visible,yI.textInputFocus),kbOpts:{weight:Ste,kbExpr:yI.textInputFocus,primary:1027,secondary:[1026]},handler(e){e.acceptSelectedSuggestion(!1,!0)},menuOpts:[{menuId:Y2,group:"left",order:2,when:Sy.and(Z2.HasInsertAndReplaceRange,Z2.InsertMode.isEqualTo("insert")),title:mf(0,"Replace")},{menuId:Y2,group:"left",order:2,when:Sy.and(Z2.HasInsertAndReplaceRange,Z2.InsertMode.isEqualTo("replace")),title:mf(0,"Insert")}]})),Cy.registerCommandAlias("acceptSelectedSuggestionOnEnter","acceptSelectedSuggestion"),Dx(new kte({id:"hideSuggestWidget",precondition:Z2.Visible,handler:e=>e.cancelSuggestWidget(),kbOpts:{weight:Ste,kbExpr:yI.textInputFocus,primary:9,secondary:[1033]}})),Dx(new kte({id:"selectNextSuggestion",precondition:Sy.and(Z2.Visible,Z2.MultipleSuggestions),handler:e=>e.selectNextSuggestion(),kbOpts:{weight:Ste,kbExpr:yI.textInputFocus,primary:18,secondary:[2066],mac:{primary:18,secondary:[2066,300]}}})),Dx(new kte({id:"selectNextPageSuggestion",precondition:Sy.and(Z2.Visible,Z2.MultipleSuggestions),handler:e=>e.selectNextPageSuggestion(),kbOpts:{weight:Ste,kbExpr:yI.textInputFocus,primary:12,secondary:[2060]}})),Dx(new kte({id:"selectLastSuggestion",precondition:Sy.and(Z2.Visible,Z2.MultipleSuggestions),handler:e=>e.selectLastSuggestion()})),Dx(new kte({id:"selectPrevSuggestion",precondition:Sy.and(Z2.Visible,Z2.MultipleSuggestions),handler:e=>e.selectPrevSuggestion(),kbOpts:{weight:Ste,kbExpr:yI.textInputFocus,primary:16,secondary:[2064],mac:{primary:16,secondary:[2064,302]}}})),Dx(new kte({id:"selectPrevPageSuggestion",precondition:Sy.and(Z2.Visible,Z2.MultipleSuggestions),handler:e=>e.selectPrevPageSuggestion(),kbOpts:{weight:Ste,kbExpr:yI.textInputFocus,primary:11,secondary:[2059]}})),Dx(new kte({id:"selectFirstSuggestion",precondition:Sy.and(Z2.Visible,Z2.MultipleSuggestions),handler:e=>e.selectFirstSuggestion()})),Dx(new kte({id:"toggleSuggestionDetails",precondition:Z2.Visible,handler:e=>e.toggleSuggestionDetails(),kbOpts:{weight:Ste,kbExpr:yI.textInputFocus,primary:2058,secondary:[2087],mac:{primary:266,secondary:[2087]}},menuOpts:[{menuId:Y2,group:"right",order:1,when:Sy.and(Z2.DetailsVisible,Z2.CanResolve),title:mf(0,"show less")},{menuId:Y2,group:"right",order:1,when:Sy.and(Z2.DetailsVisible.toNegated(),Z2.CanResolve),title:mf(0,"show more")}]})),Dx(new kte({id:"toggleExplainMode",precondition:Z2.Visible,handler:e=>e.toggleExplainMode(),kbOpts:{weight:100,primary:2133}})),Dx(new kte({id:"toggleSuggestionFocus",precondition:Z2.Visible,handler:e=>e.toggleSuggestionFocus(),kbOpts:{weight:Ste,kbExpr:yI.textInputFocus,primary:2570,mac:{primary:778}}})),Dx(new kte({id:"insertBestCompletion",precondition:Sy.and(yI.textInputFocus,Sy.equals("config.editor.tabCompletion","on"),q9.AtEnd,Z2.Visible.toNegated(),Y9.OtherSuggestions.toNegated(),F9.InSnippetMode.toNegated()),handler:(e,t)=>{e.triggerSuggestAndAcceptBest(Zs(t)?Object.assign({fallback:"tab"},t):{fallback:"tab"})},kbOpts:{weight:Ste,primary:2}})),Dx(new kte({id:"insertNextSuggestion",precondition:Sy.and(yI.textInputFocus,Sy.equals("config.editor.tabCompletion","on"),Y9.OtherSuggestions,Z2.Visible.toNegated(),F9.InSnippetMode.toNegated()),handler:e=>e.acceptNextSuggestion(),kbOpts:{weight:Ste,kbExpr:yI.textInputFocus,primary:2}})),Dx(new kte({id:"insertPrevSuggestion",precondition:Sy.and(yI.textInputFocus,Sy.equals("config.editor.tabCompletion","on"),Y9.OtherSuggestions,Z2.Visible.toNegated(),F9.InSnippetMode.toNegated()),handler:e=>e.acceptPrevSuggestion(),kbOpts:{weight:Ste,kbExpr:yI.textInputFocus,primary:1026}})),Lx(class extends xx{constructor(){super({id:"editor.action.resetSuggestSize",label:mf(0,"Reset Suggest Widget Size"),alias:"Reset Suggest Widget Size",precondition:void 0})}run(e,t){var i;null===(i=Cte.get(t))||void 0===i||i.resetWidgetSize()}});class Dte extends Uo{constructor(e,t){super(),this.editor=e,this.suggestControllerPreselector=t,this.isSuggestWidgetVisible=!1,this.isShiftKeyPressed=!1,this._isActive=!1,this._currentSuggestItemInfo=void 0,this.onDidChangeEmitter=new $o,this.onDidChange=this.onDidChangeEmitter.event,this.setInactiveDelayed=this._register(new lb((()=>{this.isSuggestWidgetVisible||this._isActive&&(this._isActive=!1,this.onDidChangeEmitter.fire())}),100)),this._register(e.onKeyDown((e=>{e.shiftKey&&!this.isShiftKeyPressed&&(this.isShiftKeyPressed=!0,this.update(this._isActive))}))),this._register(e.onKeyUp((e=>{e.shiftKey&&this.isShiftKeyPressed&&(this.isShiftKeyPressed=!1,this.update(this._isActive))})));const i=Cte.get(this.editor);if(i){this._register(i.registerSelector({priority:100,select:(e,t,n)=>{const o=this.editor.getModel(),s=b9(o,this.suggestControllerPreselector());if(!s)return-1;const r=er.lift(t),a=n.map(((e,t)=>{const n=Lte(i,r,e,this.isShiftKeyPressed),a=b9(o,null==n?void 0:n.normalizedInlineCompletion);if(!a)return;var l,d;return{index:t,valid:(l=s.range,(d=a.range).startLineNumber===l.startLineNumber&&d.startColumn===l.startColumn&&(d.endLineNumber<l.endLineNumber||d.endLineNumber===l.endLineNumber&&d.endColumn<=l.endColumn)&&s.text.startsWith(a.text)),prefixLength:a.text.length,suggestItem:e}})).filter((e=>e&&e.valid)),l=Gl(a,Er((e=>e.prefixLength),Zl));return l?l.index:-1}}));let e=!1;const t=()=>{e||(e=!0,this._register(i.widget.value.onDidShow((()=>{this.isSuggestWidgetVisible=!0,this.update(!0)}))),this._register(i.widget.value.onDidHide((()=>{this.isSuggestWidgetVisible=!1,this.setInactiveDelayed.schedule(),this.update(this._isActive)}))),this._register(i.widget.value.onDidFocus((()=>{this.isSuggestWidgetVisible=!0,this.update(!0)}))))};this._register(ds.once(i.model.onDidTrigger)((e=>{t()})))}this.update(this._isActive)}get state(){if(this._isActive)return{selectedItem:this._currentSuggestItemInfo}}update(e){const t=this.getSuggestItemInfo();let i=!1;(function(e,t){if(e===t)return!0;if(!e||!t)return!1;return e.completionItemKind===t.completionItemKind&&e.isSnippetText===t.isSnippetText&&function(e,t){return e===t||!(!e||!t)&&e.range.equalsRange(t.range)&&e.text===t.text&&e.command===t.command}(e.normalizedInlineCompletion,t.normalizedInlineCompletion)})(this._currentSuggestItemInfo,t)||(this._currentSuggestItemInfo=t,i=!0),this._isActive!==e&&(this._isActive=e,i=!0),i&&this.onDidChangeEmitter.fire()}getSuggestItemInfo(){const e=Cte.get(this.editor);if(!e)return;if(!this.isSuggestWidgetVisible)return;const t=e.widget.value.getFocusedItem();return t?Lte(e,this.editor.getPosition(),t.item,this.isShiftKeyPressed):void 0}stopForceRenderingAbove(){const e=Cte.get(this.editor);e&&e.stopForceRenderingAbove()}forceRenderingAbove(){const e=Cte.get(this.editor);e&&e.forceRenderingAbove()}}function Lte(e,t,i,n){if(Array.isArray(i.completion.additionalTextEdits)&&i.completion.additionalTextEdits.length>0)return{completionItemKind:i.completion.kind,isSnippetText:!1,normalizedInlineCompletion:{range:qo.fromPositions(t,t),text:""}};let{insertText:o}=i.completion,s=!1;if(4&i.completion.insertTextRules){const i=(new x2).parse(o),n=e.editor.getModel();if(i.children.length>100)return;A9.adjustWhitespace(n,t,i,!0,!0),o=i.toString(),s=!0}const r=e.getOverwriteInfo(i,n);return{isSnippetText:s,completionItemKind:i.completion.kind,normalizedInlineCompletion:{text:o,range:qo.fromPositions(t.delta(0,-r.overwriteBefore),t.delta(0,Math.max(r.overwriteAfter,0)))}}}var Nte=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},Ete=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}},Ite=globalThis&&globalThis.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{l(n.next(e))}catch(t){s(t)}}function a(e){try{l(n.throw(e))}catch(t){s(t)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}l((n=n.apply(e,t||[])).next())}))};let Tte=class extends s9{constructor(e,t,i){super(e),this.cache=t,this.languageFeaturesService=i,this.suggestionInlineCompletionSource=this._register(new Dte(this.editor,(()=>{var e,t;return null===(t=null===(e=this.cache.value)||void 0===e?void 0:e.completions[0])||void 0===t?void 0:t.toLiveInlineCompletion()}))),this.updateOperation=this._register(new Rr),this.updateCacheSoon=this._register(new lb((()=>this.updateCache()),50)),this.minReservedLineCount=0,this._register(this.suggestionInlineCompletionSource.onDidChange((()=>{this.updateCacheSoon.schedule();this.suggestionInlineCompletionSource.state||(this.minReservedLineCount=0);const e=this.ghostText;var t;e&&(this.minReservedLineCount=Math.max(this.minReservedLineCount,(t=e.parts.map((e=>e.lines.length-1)),t.reduce(((e,t)=>e+t),0)))),this.minReservedLineCount>=1?this.suggestionInlineCompletionSource.forceRenderingAbove():this.suggestionInlineCompletionSource.stopForceRenderingAbove(),this.onDidChangeEmitter.fire()}))),this._register(this.cache.onDidChange((()=>{this.onDidChangeEmitter.fire()}))),this._register(this.editor.onDidChangeCursorPosition((e=>{this.minReservedLineCount=0,this.updateCacheSoon.schedule(),this.onDidChangeEmitter.fire()}))),this._register(es((()=>this.suggestionInlineCompletionSource.stopForceRenderingAbove())))}get isActive(){return void 0!==this.suggestionInlineCompletionSource.state}isSuggestionPreviewEnabled(){return this.editor.getOption(106).preview}updateCache(){return Ite(this,void 0,void 0,(function*(){const e=this.suggestionInlineCompletionSource.state;if(!e||!e.selectedItem)return;const t={text:e.selectedItem.normalizedInlineCompletion.text,range:e.selectedItem.normalizedInlineCompletion.range,isSnippetText:e.selectedItem.isSnippetText,completionKind:e.selectedItem.completionItemKind},i=this.editor.getPosition(),n=Xv((e=>Ite(this,void 0,void 0,(function*(){let n;try{n=yield _9(this.languageFeaturesService.inlineCompletionsProvider,i,this.editor.getModel(),{triggerKind:Ul.Automatic,selectedSuggestionInfo:t},e)}catch(o){return void Jo(o)}e.isCancellationRequested||(this.cache.setValue(this.editor,n,Ul.Automatic),this.onDidChangeEmitter.fire())})))),o=new p9(n,Ul.Automatic);this.updateOperation.value=o,yield n,this.updateOperation.value===o&&this.updateOperation.clear()}))}get ghostText(){var e,t,i;const n=this.isSuggestionPreviewEnabled(),o=b9(this.editor.getModel(),null===(t=null===(e=this.cache.value)||void 0===e?void 0:e.completions[0])||void 0===t?void 0:t.toLiveInlineCompletion()),s=this.suggestionInlineCompletionSource.state,r=b9(this.editor.getModel(),null===(i=null==s?void 0:s.selectedItem)||void 0===i?void 0:i.normalizedInlineCompletion),a=o&&r&&o.text.startsWith(r.text)&&o.range.equalsRange(r.range);if(!n&&!a)return;const l=a?o:r||o,d=a?l.text.length-r.text.length:0;return this.toGhostText(l,d)}toGhostText(e,t){const i=this.editor.getOptions().get(106).previewMode;return e?r9(e,this.editor.getModel(),i,this.editor.getPosition(),t)||new i9(e.range.endLineNumber,[],this.minReservedLineCount):void 0}};Tte=Nte([Ete(2,Lb)],Tte);var Mte=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},Ate=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}},Ote=globalThis&&globalThis.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{l(n.next(e))}catch(t){s(t)}}function a(e){try{l(n.throw(e))}catch(t){s(t)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}l((n=n.apply(e,t||[])).next())}))};class Rte extends Uo{constructor(){super(...arguments),this.onDidChangeEmitter=new $o,this.onDidChange=this.onDidChangeEmitter.event,this.hasCachedGhostText=!1,this.currentModelRef=this._register(new Rr)}get targetModel(){var e;return null===(e=this.currentModelRef.value)||void 0===e?void 0:e.object}setTargetModel(e){var t,i,n;(null===(t=this.currentModelRef.value)||void 0===t?void 0:t.object)!==e&&(this.currentModelRef.clear(),this.currentModelRef.value=e?(i=e,n=e.onDidChange((()=>{this.hasCachedGhostText=!1,this.onDidChangeEmitter.fire()})),{object:i,dispose:()=>null==n?void 0:n.dispose()}):void 0,this.hasCachedGhostText=!1,this.onDidChangeEmitter.fire())}get ghostText(){var e,t;return this.hasCachedGhostText||(this.cachedGhostText=null===(t=null===(e=this.currentModelRef.value)||void 0===e?void 0:e.object)||void 0===t?void 0:t.ghostText,this.hasCachedGhostText=!0),this.cachedGhostText}setExpanded(e){var t;null===(t=this.targetModel)||void 0===t||t.setExpanded(e)}get minReservedLineCount(){return this.targetModel?this.targetModel.minReservedLineCount:0}}let Pte=class extends Rte{constructor(e,t){super(),this.editor=e,this.instantiationService=t,this.sharedCache=this._register(new Fte),this.suggestWidgetAdapterModel=this._register(this.instantiationService.createInstance(Tte,this.editor,this.sharedCache)),this.inlineCompletionsModel=this._register(this.instantiationService.createInstance(u9,this.editor,this.sharedCache)),this._register(this.suggestWidgetAdapterModel.onDidChange((()=>{this.updateModel()}))),this.updateModel()}get activeInlineCompletionsModel(){if(this.targetModel===this.inlineCompletionsModel)return this.inlineCompletionsModel}updateModel(){this.setTargetModel(this.suggestWidgetAdapterModel.isActive?this.suggestWidgetAdapterModel:this.inlineCompletionsModel),this.inlineCompletionsModel.setActive(this.targetModel===this.inlineCompletionsModel)}shouldShowHoverAt(e){var t;const i=null===(t=this.activeInlineCompletionsModel)||void 0===t?void 0:t.ghostText;return!!i&&i.parts.some((t=>e.containsPosition(new er(i.lineNumber,t.column))))}triggerInlineCompletion(){var e;null===(e=this.activeInlineCompletionsModel)||void 0===e||e.trigger(Ul.Explicit)}commitInlineCompletion(){var e;null===(e=this.activeInlineCompletionsModel)||void 0===e||e.commitCurrentSuggestion()}hideInlineCompletion(){var e;null===(e=this.activeInlineCompletionsModel)||void 0===e||e.hide()}showNextInlineCompletion(){var e;null===(e=this.activeInlineCompletionsModel)||void 0===e||e.showNext()}showPreviousInlineCompletion(){var e;null===(e=this.activeInlineCompletionsModel)||void 0===e||e.showPrevious()}hasMultipleInlineCompletions(){var e;return Ote(this,void 0,void 0,(function*(){const t=yield null===(e=this.activeInlineCompletionsModel)||void 0===e?void 0:e.hasMultipleInlineCompletions();return void 0!==t&&t}))}};Pte=Mte([Ate(1,k_)],Pte);class Fte extends Uo{constructor(){super(...arguments),this.onDidChangeEmitter=new $o,this.onDidChange=this.onDidChangeEmitter.event,this.cache=this._register(new Rr)}get value(){return this.cache.value}setValue(e,t,i){this.cache.value=new m9(e,t,(()=>this.onDidChangeEmitter.fire()),i)}clearAndLeak(){return this.cache.clearAndLeak()}clear(){this.cache.clear()}}var Bte,Vte=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},Wte=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};const zte=null===(Bte=window.trustedTypes)||void 0===Bte?void 0:Bte.createPolicy("editorGhostText",{createHTML:e=>e});let Hte=class extends Uo{constructor(e,t,i,n){super(),this.editor=e,this.model=t,this.instantiationService=i,this.languageService=n,this.disposed=!1,this.partsWidget=this._register(this.instantiationService.createInstance(jte,this.editor)),this.additionalLinesWidget=this._register(new Ute(this.editor,this.languageService.languageIdCodec)),this.viewMoreContentWidget=void 0,this._register(this.editor.onDidChangeConfiguration((e=>{(e.hasChanged(29)||e.hasChanged(105)||e.hasChanged(88)||e.hasChanged(83)||e.hasChanged(45)||e.hasChanged(44)||e.hasChanged(59))&&this.update()}))),this._register(es((()=>{var e;this.disposed=!0,this.update(),null===(e=this.viewMoreContentWidget)||void 0===e||e.dispose(),this.viewMoreContentWidget=void 0}))),this._register(t.onDidChange((()=>{this.update()}))),this.update()}shouldShowHoverAtViewZone(e){return this.additionalLinesWidget.viewZoneId===e}update(){var e;const t=this.model.ghostText;if(!this.editor.hasModel()||!t||this.disposed)return this.partsWidget.clear(),void this.additionalLinesWidget.clear();const i=new Array,n=new Array;function o(e,t){if(n.length>0){const i=n[n.length-1];t&&i.decorations.push(new jb(i.content.length+1,i.content.length+1+e[0].length,t,0)),i.content+=e[0],e=e.slice(1)}for(const i of e)n.push({content:i,decorations:t?[new jb(1,i.length+1,t,0)]:[]})}const s=this.editor.getModel().getLineContent(t.lineNumber);let r;this.editor.getModel().getLineTokens(t.lineNumber);let a=0;for(const l of t.parts){let e=l.lines;void 0===r?(i.push({column:l.column,text:e[0],preview:l.preview}),e=e.slice(1)):o([s.substring(a,l.column-1)],void 0),e.length>0&&(o(e,"ghost-text"),void 0===r&&l.column<=s.length&&(r=l.column)),a=l.column-1}void 0!==r&&o([s.substring(a)],void 0),this.partsWidget.setParts(t.lineNumber,i,void 0!==r?{column:r,length:s.length+1-r}:void 0),this.additionalLinesWidget.updateLines(t.lineNumber,n,t.additionalReservedLineCount),t.parts.some((e=>e.lines.length<0))?this.viewMoreContentWidget=this.renderViewMoreLines(new er(t.lineNumber,this.editor.getModel().getLineMaxColumn(t.lineNumber)),"",0):(null===(e=this.viewMoreContentWidget)||void 0===e||e.dispose(),this.viewMoreContentWidget=void 0)}renderViewMoreLines(e,t,i){const n=this.editor.getOption(44),o=document.createElement("div");o.className="suggest-preview-additional-widget",m_(o,n);const s=document.createElement("span");s.className="content-spacer",s.append(t),o.append(s);const r=document.createElement("span");r.className="content-newline suggest-preview-text",r.append("⏎ "),o.append(r);const a=new ws,l=document.createElement("div");return l.className="button suggest-preview-text",l.append(`+${i} lines…`),a.add(sC(l,"mousedown",(e=>{var t;null===(t=this.model)||void 0===t||t.setExpanded(!0),e.preventDefault(),this.editor.focus()}))),o.append(l),new $te(this.editor,e,o,a)}};Hte=Vte([Wte(2,k_),Wte(3,Lv)],Hte);class jte{constructor(e){this.editor=e,this.decorationIds=[],this.disposableStore=new ws}dispose(){this.clear(),this.disposableStore.dispose()}clear(){this.editor.deltaDecorations(this.decorationIds,[]),this.disposableStore.clear()}setParts(e,t,i){this.disposableStore.clear();if(!this.editor.getModel())return;const n=new Array;i&&n.push({range:qo.fromPositions(new er(e,i.column),new er(e,i.column+i.length)),options:{inlineClassName:"ghost-text-hidden",description:"ghost-text-hidden"}}),this.decorationIds=this.editor.deltaDecorations(this.decorationIds,t.map((t=>({range:qo.fromPositions(new er(e,t.column)),options:{description:"ghost-text",after:{content:t.text,inlineClassName:t.preview?"ghost-text-decoration-preview":"ghost-text-decoration"},showIfCollapsed:!0}}))).concat(n))}}class Ute{constructor(e,t){this.editor=e,this.languageIdCodec=t,this._viewZoneId=void 0}get viewZoneId(){return this._viewZoneId}dispose(){this.clear()}clear(){this.editor.changeViewZones((e=>{this._viewZoneId&&(e.removeZone(this._viewZoneId),this._viewZoneId=void 0)}))}updateLines(e,t,i){const n=this.editor.getModel();if(!n)return;const{tabSize:o}=n.getOptions();this.editor.changeViewZones((n=>{this._viewZoneId&&(n.removeZone(this._viewZoneId),this._viewZoneId=void 0);const s=Math.max(t.length,i);if(s>0){const i=document.createElement("div");!function(e,t,i,n,o){const s=n.get(29),r=n.get(105),a="none",l=n.get(83),d=n.get(45),c=n.get(44),h=n.get(59),u=nv(1e4);u.appendASCIIString('<div class="suggest-preview-text">');for(let m=0,f=i.length;m<f;m++){const e=i[m],n=e.content;u.appendASCIIString('<div class="view-line'),u.appendASCIIString('" style="top:'),u.appendASCIIString(String(m*h)),u.appendASCIIString('px;width:1000000px;">');const g=Ds(n),p=Ls(n),f=zb.createEmpty(n,o);Qb(new Gb(c.isMonospace&&!s,c.canUseHalfwidthRightwardsArrow,n,!1,g,p,0,f,e.decorations,t,0,c.spaceWidth,c.middotWidth,c.wsmiddotWidth,r,a,l,d!==Of.OFF,null),u),u.appendASCIIString("</div>")}u.appendASCIIString("</div>"),m_(e,c);const g=u.build(),p=zte?zte.createHTML(g):g;e.innerHTML=p}(i,o,t,this.editor.getOptions(),this.languageIdCodec),this._viewZoneId=n.addZone({afterLineNumber:e,heightInLines:s,domNode:i,afterColumnAffinity:1})}}))}}class $te extends Uo{constructor(e,t,i,n){super(),this.editor=e,this.position=t,this.domNode=i,this.allowEditorOverflow=!1,this.suppressMouseDown=!1,this._register(n),this._register(es((()=>{this.editor.removeContentWidget(this)}))),this.editor.addContentWidget(this)}getId(){return"editor.widget.viewMoreLinesWidget"}getDomNode(){return this.domNode}getPosition(){return{position:this.position,preference:[0]}}}sx(((e,t)=>{const i=e.getColor(cE);i&&(t.addRule(`.monaco-editor .ghost-text-decoration { color: ${i.toString()} !important; }`),t.addRule(`.monaco-editor .ghost-text-decoration-preview { color: ${i.toString()} !important; }`),t.addRule(`.monaco-editor .suggest-preview-text .ghost-text { color: ${i.toString()} !important; }`));const n=e.getColor(hE);n&&(t.addRule(`.monaco-editor .ghost-text-decoration { background-color: ${n.toString()}; }`),t.addRule(`.monaco-editor .ghost-text-decoration-preview { background-color: ${n.toString()}; }`),t.addRule(`.monaco-editor .suggest-preview-text .ghost-text { background-color: ${n.toString()}; }`));const o=e.getColor(dE);o&&(t.addRule(`.monaco-editor .suggest-preview-text .ghost-text { border: 1px solid ${o}; }`),t.addRule(`.monaco-editor .ghost-text-decoration { border: 1px solid ${o}; }`),t.addRule(`.monaco-editor .ghost-text-decoration-preview { border: 1px solid ${o}; }`))}));var Kte=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},qte=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}},Gte=globalThis&&globalThis.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{l(n.next(e))}catch(t){s(t)}}function a(e){try{l(n.throw(e))}catch(t){s(t)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}l((n=n.apply(e,t||[])).next())}))};let Zte=class e extends Uo{constructor(e,t){super(),this.editor=e,this.instantiationService=t,this.triggeredExplicitly=!1,this.activeController=this._register(new Rr),this.activeModelDidChangeEmitter=this._register(new $o),this._register(this.editor.onDidChangeModel((()=>{this.updateModelController()}))),this._register(this.editor.onDidChangeConfiguration((e=>{e.hasChanged(106)&&this.updateModelController(),e.hasChanged(55)&&this.updateModelController()}))),this.updateModelController()}static get(t){return t.getContribution(e.ID)}get activeModel(){var e;return null===(e=this.activeController.value)||void 0===e?void 0:e.model}updateModelController(){const e=this.editor.getOption(106),t=this.editor.getOption(55);this.activeController.value=void 0,this.activeController.value=this.editor.hasModel()&&(e.preview||t.enabled||this.triggeredExplicitly)?this.instantiationService.createInstance(Xte,this.editor):void 0,this.activeModelDidChangeEmitter.fire()}shouldShowHoverAt(e){var t;return(null===(t=this.activeModel)||void 0===t?void 0:t.shouldShowHoverAt(e))||!1}shouldShowHoverAtViewZone(e){var t,i;return(null===(i=null===(t=this.activeController.value)||void 0===t?void 0:t.widget)||void 0===i?void 0:i.shouldShowHoverAtViewZone(e))||!1}trigger(){var e;this.triggeredExplicitly=!0,this.activeController.value||this.updateModelController(),null===(e=this.activeModel)||void 0===e||e.triggerInlineCompletion()}commit(){var e;null===(e=this.activeModel)||void 0===e||e.commitInlineCompletion()}hide(){var e;null===(e=this.activeModel)||void 0===e||e.hideInlineCompletion()}showNextInlineCompletion(){var e;null===(e=this.activeModel)||void 0===e||e.showNextInlineCompletion()}showPreviousInlineCompletion(){var e;null===(e=this.activeModel)||void 0===e||e.showPreviousInlineCompletion()}hasMultipleInlineCompletions(){var e;return Gte(this,void 0,void 0,(function*(){const t=yield null===(e=this.activeModel)||void 0===e?void 0:e.hasMultipleInlineCompletions();return void 0!==t&&t}))}};Zte.inlineSuggestionVisible=new Uy("inlineSuggestionVisible",!1,mf(0,"Whether an inline suggestion is visible")),Zte.inlineSuggestionHasIndentation=new Uy("inlineSuggestionHasIndentation",!1,mf(0,"Whether the inline suggestion starts with whitespace")),Zte.inlineSuggestionHasIndentationLessThanTabSize=new Uy("inlineSuggestionHasIndentationLessThanTabSize",!0,mf(0,"Whether the inline suggestion starts with whitespace that is less than what would be inserted by tab")),Zte.ID="editor.contrib.ghostTextController",Zte=Kte([qte(1,k_)],Zte);class Yte{constructor(e){this.contextKeyService=e,this.inlineCompletionVisible=Zte.inlineSuggestionVisible.bindTo(this.contextKeyService),this.inlineCompletionSuggestsIndentation=Zte.inlineSuggestionHasIndentation.bindTo(this.contextKeyService),this.inlineCompletionSuggestsIndentationLessThanTabSize=Zte.inlineSuggestionHasIndentationLessThanTabSize.bindTo(this.contextKeyService)}}let Xte=class extends Uo{constructor(e,t,i){super(),this.editor=e,this.instantiationService=t,this.contextKeyService=i,this.contextKeys=new Yte(this.contextKeyService),this.model=this._register(this.instantiationService.createInstance(Pte,this.editor)),this.widget=this._register(this.instantiationService.createInstance(Hte,this.editor,this.model)),this._register(es((()=>{this.contextKeys.inlineCompletionVisible.set(!1),this.contextKeys.inlineCompletionSuggestsIndentation.set(!1),this.contextKeys.inlineCompletionSuggestsIndentationLessThanTabSize.set(!0)}))),this._register(this.model.onDidChange((()=>{this.updateContextKeys()}))),this.updateContextKeys()}updateContextKeys(){var e;this.contextKeys.inlineCompletionVisible.set(void 0!==(null===(e=this.model.activeInlineCompletionsModel)||void 0===e?void 0:e.ghostText));let t=!1,i=!0;const n=this.model.inlineCompletionsModel.ghostText;if(this.model.activeInlineCompletionsModel&&n&&n.parts.length>0){const{column:e,lines:o}=n.parts[0],s=o[0];if(e<=this.editor.getModel().getLineIndentColumn(n.lineNumber)){let e=xs(s);-1===e&&(e=s.length-1),t=e>0;const n=this.editor.getModel().getOptions().tabSize;i=dN.visibleColumnFromColumn(s,e+1,n)<n}}this.contextKeys.inlineCompletionSuggestsIndentation.set(t),this.contextKeys.inlineCompletionSuggestsIndentationLessThanTabSize.set(i)}};Xte=Kte([qte(1,k_),qte(2,$y)],Xte);const Qte=yx.bindToContribution(Zte.get),Jte=new Qte({id:t9,precondition:Zte.inlineSuggestionVisible,handler(e){e.commit(),e.editor.focus()}});Dx(Jte),fx.registerKeybindingRule({primary:2,weight:200,id:Jte.id,when:Sy.and(Jte.precondition,yI.tabMovesFocus.toNegated(),Zte.inlineSuggestionHasIndentationLessThanTabSize)}),Dx(new Qte({id:"editor.action.inlineSuggest.hide",precondition:Zte.inlineSuggestionVisible,kbOpts:{weight:100,primary:9},handler(e){e.hide()}}));class eie extends xx{constructor(){super({id:eie.ID,label:mf(0,"Show Next Inline Suggestion"),alias:"Show Next Inline Suggestion",precondition:Sy.and(yI.writable,Zte.inlineSuggestionVisible),kbOpts:{weight:100,primary:601}})}run(e,t){return Gte(this,void 0,void 0,(function*(){const e=Zte.get(t);e&&(e.showNextInlineCompletion(),t.focus())}))}}eie.ID="editor.action.inlineSuggest.showNext";class tie extends xx{constructor(){super({id:tie.ID,label:mf(0,"Show Previous Inline Suggestion"),alias:"Show Previous Inline Suggestion",precondition:Sy.and(yI.writable,Zte.inlineSuggestionVisible),kbOpts:{weight:100,primary:599}})}run(e,t){return Gte(this,void 0,void 0,(function*(){const e=Zte.get(t);e&&(e.showPreviousInlineCompletion(),t.focus())}))}}tie.ID="editor.action.inlineSuggest.showPrevious";var iie=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},nie=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};class oie{constructor(e,t,i){this.owner=e,this.range=t,this.controller=i}isValidForHoverAnchor(e){return 1===e.type&&this.range.startColumn<=e.range.startColumn&&this.range.endColumn>=e.range.endColumn}hasMultipleSuggestions(){return this.controller.hasMultipleInlineCompletions()}}let sie=class{constructor(e,t,i,n,o,s,r){this._editor=e,this._commandService=t,this._menuService=i,this._contextKeyService=n,this._languageService=o,this._openerService=s,this.accessibilityService=r,this.hoverOrdinal=3}suggestHoverAnchor(e){const t=Zte.get(this._editor);if(!t)return null;const i=e.target;if(8===i.type){const e=i.detail;if(t.shouldShowHoverAtViewZone(e.viewZoneId))return new c2(1e3,this,qo.fromPositions(e.positionBefore||e.position,e.positionBefore||e.position))}if(7===i.type&&t.shouldShowHoverAt(i.range))return new c2(1e3,this,i.range);if(6===i.type){if(i.detail.mightBeForeignElement&&t.shouldShowHoverAt(i.range))return new c2(1e3,this,i.range)}return null}computeSync(e,t){const i=Zte.get(this._editor);return i&&i.shouldShowHoverAt(e.range)?[new oie(this,e.range,i)]:[]}renderHoverParts(e,t){const i=new ws,n=t[0];this.accessibilityService.isScreenReaderOptimized()&&this.renderScreenReaderText(e,n,i);const o=i.add(this._menuService.createMenu(cx.InlineCompletionsActions,this._contextKeyService)),s=e.statusBar.addAction({label:mf(0,"Next"),commandId:eie.ID,run:()=>this._commandService.executeCommand(eie.ID)}),r=e.statusBar.addAction({label:mf(0,"Previous"),commandId:tie.ID,run:()=>this._commandService.executeCommand(tie.ID)});e.statusBar.addAction({label:mf(0,"Accept"),commandId:Jte.id,run:()=>this._commandService.executeCommand(Jte.id)});const a=[s,r];for(const l of a)l.setEnabled(!1);n.hasMultipleSuggestions().then((e=>{for(const t of a)t.setEnabled(e)}));for(const[l,d]of o.getActions())for(const t of d)t instanceof px&&e.statusBar.addAction({label:t.label,commandId:t.item.id,run:()=>this._commandService.executeCommand(t.item.id)});return i}renderScreenReaderText(e,t,i){var n,o;const s=YC,r=s("div.hover-row.markdown-hover"),a=$C(r,s("div.hover-contents")),l=i.add(new x5({editor:this._editor},this._languageService,this._openerService)),d=null===(o=null===(n=t.controller.activeModel)||void 0===n?void 0:n.inlineCompletionsModel)||void 0===o?void 0:o.ghostText;if(d){const t=this._editor.getModel().getLineContent(d.lineNumber);(t=>{i.add(l.onDidRenderAsync((()=>{a.className="hover-contents code-hover-contents",e.onContentsChanged()})));const n=mf(0,"Suggestion:"),o=i.add(l.render((new RU).appendText(n).appendCodeblock("text",t)));a.replaceChildren(o.element)})(d.renderForScreenReader(t))}e.fragment.appendChild(r)}};function rie(e,t){let i=0;for(let n=0;n<e.length;n++)"\t"===e.charAt(n)?i+=t:i++;return i}function aie(e,t,i){e=e<0?0:e;let n="";if(!i){let i=Math.floor(e/t);e%=t;for(let e=0;e<i;e++)n+="\t"}for(let o=0;o<e;o++)n+=" ";return n}function lie(e,t,i,n,o){if(1===e.getLineCount()&&1===e.getLineMaxColumn(1))return[];const s=t.getLanguageConfiguration(e.getLanguageId()).indentationRules;if(!s)return[];for(n=Math.min(n,e.getLineCount());i<=n&&s.unIndentedLinePattern;){let t=e.getLineContent(i);if(!s.unIndentedLinePattern.test(t))break;i++}if(i>n-1)return[];const{tabSize:r,indentSize:a,insertSpaces:l}=e.getOptions(),d=(e,t)=>(t=t||1,pI.shiftIndent(e,e.length+t,r,a,l)),c=(e,t)=>(t=t||1,pI.unshiftIndent(e,e.length+t,r,a,l));let h,u=[],g=e.getLineContent(i),p=g;if(null!=o){h=o;let e=ts(g);p=h+g.substring(e.length),s.decreaseIndentPattern&&s.decreaseIndentPattern.test(p)&&(h=c(h),p=h+g.substring(e.length)),g!==p&&u.push(_W.replaceMove(new ar(i,1,i,e.length+1),zE(h,a,l)))}else h=ts(g);let m=h;s.increaseIndentPattern&&s.increaseIndentPattern.test(p)?(m=d(m),h=d(h)):s.indentNextLinePattern&&s.indentNextLinePattern.test(p)&&(m=d(m));for(let f=++i;f<=n;f++){let t=e.getLineContent(f),i=ts(t),n=m+t.substring(i.length);s.decreaseIndentPattern&&s.decreaseIndentPattern.test(n)&&(m=c(m),h=c(h)),i!==m&&u.push(_W.replaceMove(new ar(f,1,f,i.length+1),zE(m,a,l))),s.unIndentedLinePattern&&s.unIndentedLinePattern.test(t)||(s.increaseIndentPattern&&s.increaseIndentPattern.test(n)?(h=d(h),m=h):m=s.indentNextLinePattern&&s.indentNextLinePattern.test(n)?d(m):h)}return u}sie=iie([nie(1,wy),nie(2,hx),nie(3,$y),nie(4,Lv),nie(5,ij),nie(6,$x)],sie),Ix(Zte.ID,Zte),Lx(class extends xx{constructor(){super({id:"editor.action.inlineSuggest.trigger",label:mf(0,"Trigger Inline Suggestion"),alias:"Trigger Inline Suggestion",precondition:yI.writable})}run(e,t){return Gte(this,void 0,void 0,(function*(){const e=Zte.get(t);e&&e.trigger()}))}}),Lx(eie),Lx(tie),h2.register(sie);class die extends xx{constructor(){super({id:die.ID,label:mf(0,"Convert Indentation to Spaces"),alias:"Convert Indentation to Spaces",precondition:yI.writable})}run(e,t){let i=t.getModel();if(!i)return;let n=i.getOptions(),o=t.getSelection();if(!o)return;const s=new vie(o,n.tabSize);t.pushUndoStop(),t.executeCommands(this.id,[s]),t.pushUndoStop(),i.updateOptions({insertSpaces:!0})}}die.ID="editor.action.indentationToSpaces";class cie extends xx{constructor(){super({id:cie.ID,label:mf(0,"Convert Indentation to Tabs"),alias:"Convert Indentation to Tabs",precondition:yI.writable})}run(e,t){let i=t.getModel();if(!i)return;let n=i.getOptions(),o=t.getSelection();if(!o)return;const s=new bie(o,n.tabSize);t.pushUndoStop(),t.executeCommands(this.id,[s]),t.pushUndoStop(),i.updateOptions({insertSpaces:!1})}}cie.ID="editor.action.indentationToTabs";class hie extends xx{constructor(e,t){super(t),this.insertSpaces=e}run(e,t){const i=e.get(iG),n=e.get(Gv);let o=t.getModel();if(!o)return;const s=n.getCreationOptions(o.getLanguageId(),o.uri,o.isForSimpleWidget),r=[1,2,3,4,5,6,7,8].map((e=>({id:e.toString(),label:e.toString(),description:e===s.tabSize?mf(0,"Configured Tab Size"):void 0}))),a=Math.min(o.getOptions().tabSize-1,7);setTimeout((()=>{i.pick(r,{placeHolder:mf(0,"Select Tab Size for Current File"),activeItem:r[a]}).then((e=>{e&&o&&!o.isDisposed()&&o.updateOptions({tabSize:parseInt(e.label,10),insertSpaces:this.insertSpaces})}))}),50)}}class uie extends hie{constructor(){super(!1,{id:uie.ID,label:mf(0,"Indent Using Tabs"),alias:"Indent Using Tabs",precondition:void 0})}}uie.ID="editor.action.indentUsingTabs";class gie extends hie{constructor(){super(!0,{id:gie.ID,label:mf(0,"Indent Using Spaces"),alias:"Indent Using Spaces",precondition:void 0})}}gie.ID="editor.action.indentUsingSpaces";class pie extends xx{constructor(){super({id:pie.ID,label:mf(0,"Detect Indentation from Content"),alias:"Detect Indentation from Content",precondition:void 0})}run(e,t){const i=e.get(Gv);let n=t.getModel();if(!n)return;const o=i.getCreationOptions(n.getLanguageId(),n.uri,n.isForSimpleWidget);n.detectIndentation(o.insertSpaces,o.tabSize)}}pie.ID="editor.action.detectIndentation";class mie{constructor(e,t){this._initialSelection=t,this._edits=[],this._selectionId=null;for(let i of e)i.range&&"string"==typeof i.text&&this._edits.push(i)}getEditOperations(e,t){for(let n of this._edits)t.addEditOperation(qo.lift(n.range),n.text);let i=!1;Array.isArray(this._edits)&&1===this._edits.length&&this._initialSelection.isEmpty()&&(this._edits[0].range.startColumn===this._initialSelection.endColumn&&this._edits[0].range.startLineNumber===this._initialSelection.endLineNumber?(i=!0,this._selectionId=t.trackSelection(this._initialSelection,!0)):this._edits[0].range.endColumn===this._initialSelection.startColumn&&this._edits[0].range.endLineNumber===this._initialSelection.startLineNumber&&(i=!0,this._selectionId=t.trackSelection(this._initialSelection,!1))),i||(this._selectionId=t.trackSelection(this._initialSelection))}computeCursorState(e,t){return t.getTrackedSelection(this._selectionId)}}class fie{constructor(e){this.callOnDispose=new ws,this.callOnModel=new ws,this.editor=e,this.callOnDispose.add(e.onDidChangeConfiguration((()=>this.update()))),this.callOnDispose.add(e.onDidChangeModel((()=>this.update()))),this.callOnDispose.add(e.onDidChangeModelLanguage((()=>this.update())))}update(){this.callOnModel.clear(),this.editor.getOption(9)<4||this.editor.getOption(48)||this.editor.hasModel()&&this.callOnModel.add(this.editor.onDidPaste((({range:e})=>{this.trigger(e)})))}trigger(e){let t=this.editor.getSelections();if(null===t||t.length>1)return;const i=this.editor.getModel();if(!i)return;if(!i.isCheapToTokenize(e.getStartPosition().lineNumber))return;const n=this.editor.getOption(9),{tabSize:o,indentSize:s,insertSpaces:r}=i.getOptions();let a=[],l={shiftIndent:e=>pI.shiftIndent(e,e.length+1,o,s,r),unshiftIndent:e=>pI.unshiftIndent(e,e.length+1,o,s,r)},d=e.startLineNumber;for(;d<=e.endLineNumber&&this.shouldIgnoreLine(i,d);)d++;if(d>e.endLineNumber)return;let c=i.getLineContent(d);if(!/\S/.test(c.substring(0,e.startColumn-1))){const e=Wv.getGoodIndentForLine(n,i,i.getLanguageId(),d,l);if(null!==e){let t=ts(c),n=rie(e,o);if(n!==rie(t,o)){let e=aie(n,o,r);a.push({range:new qo(d,1,d,t.length+1),text:e}),c=e+c.substr(t.length)}else{let e=Wv.getIndentMetadata(i,d);if(0===e||8===e)return}}}const h=d;for(;d<e.endLineNumber&&!/\S/.test(i.getLineContent(d+1));)d++;if(d!==e.endLineNumber){let t={getLineTokens:e=>i.getLineTokens(e),getLanguageId:()=>i.getLanguageId(),getLanguageIdAtPosition:(e,t)=>i.getLanguageIdAtPosition(e,t),getLineContent:e=>e===h?c:i.getLineContent(e)},s=Wv.getGoodIndentForLine(n,t,i.getLanguageId(),d+1,l);if(null!==s){let t=rie(s,o),n=rie(ts(i.getLineContent(d+1)),o);if(t!==n){let s=t-n;for(let t=d+1;t<=e.endLineNumber;t++){let e=i.getLineContent(t),n=ts(e),l=aie(rie(n,o)+s,o,r);l!==n&&a.push({range:new qo(t,1,t,n.length+1),text:l})}}}}if(a.length>0){this.editor.pushUndoStop();let e=new mie(a,this.editor.getSelection());this.editor.executeCommand("autoIndentOnPaste",e),this.editor.pushUndoStop()}}shouldIgnoreLine(e,t){e.forceTokenization(t);let i=e.getLineFirstNonWhitespaceColumn(t);if(0===i)return!0;let n=e.getLineTokens(t);if(n.getCount()>0){let e=n.findTokenIndexAtOffset(i);if(e>=0&&1===n.getStandardTokenType(e))return!0}return!1}dispose(){this.callOnDispose.dispose(),this.callOnModel.dispose()}}function _ie(e,t,i,n){if(1===e.getLineCount()&&1===e.getLineMaxColumn(1))return;let o="";for(let r=0;r<i;r++)o+=" ";let s=new RegExp(o,"gi");for(let r=1,a=e.getLineCount();r<=a;r++){let i=e.getLineFirstNonWhitespaceColumn(r);if(0===i&&(i=e.getLineMaxColumn(r)),1===i)continue;const a=new qo(r,1,r,i),l=e.getValueInRange(a),d=n?l.replace(/\t/gi,o):l.replace(s,"\t");t.addEditOperation(a,d)}}fie.ID="editor.contrib.autoIndentOnPaste";class vie{constructor(e,t){this.selection=e,this.tabSize=t,this.selectionId=null}getEditOperations(e,t){this.selectionId=t.trackSelection(this.selection),_ie(e,t,this.tabSize,!0)}computeCursorState(e,t){return t.getTrackedSelection(this.selectionId)}}class bie{constructor(e,t){this.selection=e,this.tabSize=t,this.selectionId=null}getEditOperations(e,t){this.selectionId=t.trackSelection(this.selection),_ie(e,t,this.tabSize,!1)}computeCursorState(e,t){return t.getTrackedSelection(this.selectionId)}}Ix(fie.ID,fie),Lx(die),Lx(cie),Lx(uie),Lx(gie),Lx(pie),Lx(class extends xx{constructor(){super({id:"editor.action.reindentlines",label:mf(0,"Reindent Lines"),alias:"Reindent Lines",precondition:yI.writable})}run(e,t){const i=e.get(Rv);let n=t.getModel();if(!n)return;let o=lie(n,i,1,n.getLineCount());o.length>0&&(t.pushUndoStop(),t.executeEdits(this.id,o),t.pushUndoStop())}}),Lx(class extends xx{constructor(){super({id:"editor.action.reindentselectedlines",label:mf(0,"Reindent Selected Lines"),alias:"Reindent Selected Lines",precondition:yI.writable})}run(e,t){const i=e.get(Rv);let n=t.getModel();if(!n)return;let o=t.getSelections();if(null===o)return;let s=[];for(let r of o){let e=r.startLineNumber,t=r.endLineNumber;if(e!==t&&1===r.endColumn&&t--,1===e){if(e===t)continue}else e--;let o=lie(n,i,e,t);s.push(...o)}s.length>0&&(t.pushUndoStop(),t.executeEdits(this.id,s),t.pushUndoStop())}});var wie=globalThis&&globalThis.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{l(n.next(e))}catch(t){s(t)}}function a(e){try{l(n.throw(e))}catch(t){s(t)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}l((n=n.apply(e,t||[])).next())}))};class Cie{constructor(e,t){this.range=e,this.direction=t}}class yie{constructor(e,t,i){this.hint=e,this.anchor=t,this.provider=i,this._isResolved=!1}with(e){const t=new yie(this.hint,e.anchor,this.provider);return t._isResolved=this._isResolved,t._currentResolve=this._currentResolve,t}resolve(e){return wie(this,void 0,void 0,(function*(){if("function"==typeof this.provider.resolveInlayHint){if(this._currentResolve){if(yield this._currentResolve,e.isCancellationRequested)return;return this.resolve(e)}this._isResolved||(this._currentResolve=this._doResolve(e).finally((()=>this._currentResolve=void 0))),yield this._currentResolve}}))}_doResolve(e){var t,i;return wie(this,void 0,void 0,(function*(){try{const n=yield Promise.resolve(this.provider.resolveInlayHint(this.hint,e));this.hint.tooltip=null!==(t=null==n?void 0:n.tooltip)&&void 0!==t?t:this.hint.tooltip,this.hint.label=null!==(i=null==n?void 0:n.label)&&void 0!==i?i:this.hint.label,this._isResolved=!0}catch(n){Ta(n),this._isResolved=!1}}))}}class xie{constructor(e,t,i){this._disposables=new ws,this.ranges=e,this.provider=new Set;const n=[];for(const[o,s]of t){this._disposables.add(o),this.provider.add(s);for(const e of o.hints){let t=i.validatePosition(e.position),o="before";const r=xie._getRangeAtPosition(i,t);let a;r.getStartPosition().isBefore(t)?(a=qo.fromPositions(r.getStartPosition(),t),o="after"):(a=qo.fromPositions(t,r.getEndPosition()),o="before"),n.push(new yie(e,new Cie(a,o),s))}}this.items=n.sort(((e,t)=>er.compare(e.hint.position,t.hint.position)))}static create(e,t,i,n){return wie(this,void 0,void 0,(function*(){const o=[],s=e.ordered(t).reverse().map((e=>i.map((i=>wie(this,void 0,void 0,(function*(){try{const s=yield e.provideInlayHints(t,i,n);(null==s?void 0:s.hints.length)&&o.push([s,e])}catch(s){Ta(s)}}))))));if(yield Promise.all(s.flat()),n.isCancellationRequested||t.isDisposed())throw new ls;return new xie(i,o,t)}))}dispose(){this._disposables.dispose()}static _getRangeAtPosition(e,t){const i=t.lineNumber,n=e.getWordAtPosition(t);if(n)return new qo(i,n.startColumn,i,n.endColumn);e.tokenizeIfCheap(i);const o=e.getLineTokens(i),s=t.column-1,r=o.findTokenIndexAtOffset(s);let a=o.getStartOffset(r),l=o.getEndOffset(r);return l-a==1&&(a===s&&r>1?(a=o.getStartOffset(r-1),l=o.getEndOffset(r-1)):l===s&&r<o.getCount()-1&&(a=o.getStartOffset(r+1),l=o.getEndOffset(r+1))),new qo(i,a+1,i,l+1)}}var Sie=globalThis&&globalThis.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{l(n.next(e))}catch(t){s(t)}}function a(e){try{l(n.throw(e))}catch(t){s(t)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}l((n=n.apply(e,t||[])).next())}))};function kie(e,t,i,n){var o;return Sie(this,void 0,void 0,(function*(){const s=e.get(gy),r=e.get(WB),a=e.get(wy),l=e.get(k_),d=e.get(vF);if(yield n.item.resolve(Ia.None),!n.part.location)return;const c=n.part.location,h=[],u=new Set(ux.getMenuItems(cx.EditorContext).map((e=>dx(e)?e.command.id:"")));for(const e of Tx.getEditorActions())e instanceof $3&&u.has(e.id)&&h.push(new my(e.id,e.label,void 0,!0,(()=>Sie(this,void 0,void 0,(function*(){const i=yield s.createModelReference(c.uri);try{yield l.invokeFunction(e.run.bind(e),t,new U3(i.object.textEditorModel,qo.getStartPosition(c.range)))}finally{i.dispose()}})))));if(n.part.command){const{command:e}=n.part;h.push(new _y),h.push(new my(e.id,e.title,void 0,!0,(()=>Sie(this,void 0,void 0,(function*(){var t;try{yield a.executeCommand(e.id,...null!==(t=e.arguments)&&void 0!==t?t:[])}catch(i){d.notify({severity:_F.Error,source:n.item.provider.displayName,message:i})}})))))}const g=t.getOption(115);r.showContextMenu({domForShadowRoot:g&&null!==(o=t.getDomNode())&&void 0!==o?o:void 0,getAnchor:()=>{const e=yC(i);return{x:e.left,y:e.top+e.height+8}},getActions:()=>h,onHide:()=>{t.focus()},autoSelectFirstItem:!0})}))}function Die(e,t,i,n){return Sie(this,void 0,void 0,(function*(){const o=e.get(gy),s=yield o.createModelReference(n.uri);yield i.invokeWithinContext((e=>Sie(this,void 0,void 0,(function*(){const o=t.hasSideBySideModifier,r=e.get($y),a=A1.inPeekEditor.getValue(r),l=!o&&i.getOption(78)&&!a;return new K3({openToSide:o,openInPeek:l,muteMessage:!0},{alias:"",label:"",id:"",precondition:void 0}).run(e,i,{model:s.object.textEditorModel,position:qo.getStartPosition(n.range)})})))),s.dispose()}))}var Lie=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},Nie=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}},Eie=globalThis&&globalThis.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{l(n.next(e))}catch(t){s(t)}}function a(e){try{l(n.throw(e))}catch(t){s(t)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}l((n=n.apply(e,t||[])).next())}))};class Iie{constructor(){this._entries=new QV(50)}get(e){const t=Iie._key(e);return this._entries.get(t)}set(e,t){const i=Iie._key(e);this._entries.set(i,t)}static _key(e){return`${e.uri.toString()}/${e.getVersionId()}`}}const Tie=L_("IInlayHintsCache");Iv(Tie,Iie,!0);class Mie{constructor(e,t){this.item=e,this.index=t}get part(){const e=this.item.hint.label;return"string"==typeof e?{label:e}:e[this.index]}}class Aie{constructor(e,t){this.part=e,this.hasTriggerModifier=t}}let Oie=class e{constructor(e,t,i,n,o,s,r){this._editor=e,this._languageFeaturesService=t,this._inlayHintsCache=n,this._commandService=o,this._notificationService=s,this._instaService=r,this._disposables=new ws,this._sessionDisposables=new ws,this._decorationsMetadata=new Map,this._ruleFactory=new VL(this._editor),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((e=>{e.hasChanged(127)&&this._update()}))),this._update()}static get(t){var i;return null!==(i=t.getContribution(e.ID))&&void 0!==i?i:void 0}dispose(){this._sessionDisposables.dispose(),this._removeAllDecorations(),this._disposables.dispose()}_update(){if(this._sessionDisposables.clear(),this._removeAllDecorations(),!this._editor.getOption(127).enabled)return;const e=this._editor.getModel();if(!e||!this._languageFeaturesService.inlayHintsProvider.has(e))return;const t=this._inlayHintsCache.get(e);let i;t&&this._updateHintsDecorators([e.getFullModelRange()],t),this._sessionDisposables.add(es((()=>{e.isDisposed()||this._cacheHintsForFastRestore(e)})));let n=new Set;const o=new lb((()=>Eie(this,void 0,void 0,(function*(){const t=Date.now();null==i||i.dispose(!0),i=new as;const s=e.onWillDispose((()=>null==i?void 0:i.cancel()));try{const r=i.token,a=yield xie.create(this._languageFeaturesService.inlayHintsProvider,e,this._getHintsRanges(),r);if(o.delay=this._debounceInfo.update(e,Date.now()-t),r.isCancellationRequested)return void a.dispose();for(const e of a.provider)"function"!=typeof e.onDidChangeInlayHints||n.has(e)||(n.add(e),this._sessionDisposables.add(e.onDidChangeInlayHints((()=>{o.isScheduled()||o.schedule()}))));this._sessionDisposables.add(a),this._updateHintsDecorators(a.ranges,a.items),this._cacheHintsForFastRestore(e)}catch(r){Jo(r)}finally{i.dispose(),s.dispose()}}))),this._debounceInfo.get(e));this._sessionDisposables.add(o),this._sessionDisposables.add(es((()=>null==i?void 0:i.dispose(!0)))),o.schedule(0),this._sessionDisposables.add(this._editor.onDidScrollChange((e=>{!e.scrollTopChanged&&o.isScheduled()||o.schedule()}))),this._sessionDisposables.add(this._editor.onDidChangeModelContent((e=>{const t=Math.max(o.delay,1250);o.schedule(t)}))),this._sessionDisposables.add(this._installLinkGesture()),this._sessionDisposables.add(this._installDblClickGesture()),this._sessionDisposables.add(this._installContextMenu())}_installLinkGesture(){const e=new ws,t=e.add(new c1(this._editor)),i=new ws;return e.add(i),e.add(t.onMouseMoveOrRelevantKeyDown((e=>{const[t]=e,n=this._getInlayHintLabelPart(t),o=this._editor.getModel();if(!n||!o)return void i.clear();const s=new as;i.add(es((()=>s.dispose(!0)))),n.item.resolve(s.token),this._activeInlayHintPart=n.part.command||n.part.location?new Aie(n,t.hasTriggerModifier):void 0;const r=n.item.hint.position.lineNumber,a=new qo(r,1,r,o.getLineMaxColumn(r)),l=new Set;for(const i of this._decorationsMetadata.values())a.containsRange(i.item.anchor.range)&&l.add(i.item);this._updateHintsDecorators([a],Array.from(l)),i.add(es((()=>{this._activeInlayHintPart=void 0,this._updateHintsDecorators([a],Array.from(l))})))}))),e.add(t.onCancel((()=>i.clear()))),e.add(t.onExecute((e=>Eie(this,void 0,void 0,(function*(){const t=this._getInlayHintLabelPart(e);if(t){const i=t.part;i.location?this._instaService.invokeFunction(Die,e,this._editor,i.location):Yl.is(i.command)&&(yield this._invokeCommand(i.command,t.item))}}))))),e}_installDblClickGesture(){return this._editor.onMouseUp((e=>Eie(this,void 0,void 0,(function*(){if(2!==e.event.detail)return;const t=this._getInlayHintLabelPart(e);t&&(e.event.preventDefault(),yield t.item.resolve(Ia.None),t.item.hint.command&&(yield this._invokeCommand(t.item.hint.command,t.item)))}))))}_installContextMenu(){return this._editor.onContextMenu((e=>Eie(this,void 0,void 0,(function*(){if(!(e.event.target instanceof HTMLElement))return;const t=this._getInlayHintLabelPart(e);t&&(yield this._instaService.invokeFunction(kie,this._editor,e.event.target,t))}))))}_getInlayHintLabelPart(e){var t;if(6!==e.target.type)return;const i=null===(t=e.target.detail.injectedText)||void 0===t?void 0:t.options;return i instanceof qP&&(null==i?void 0:i.attachedData)instanceof Mie?i.attachedData:void 0}_invokeCommand(e,t){var i;return Eie(this,void 0,void 0,(function*(){try{yield this._commandService.executeCommand(e.id,...null!==(i=e.arguments)&&void 0!==i?i:[])}catch(n){this._notificationService.notify({severity:_F.Error,source:t.provider.displayName,message:n})}}))}_cacheHintsForFastRestore(e){const t=new Map;for(const[i,n]of this._decorationsMetadata){if(t.has(n.item))continue;let o=n.item;const s=e.getDecorationRange(i);if(s){const e=new Cie(s,n.item.anchor.direction);o=n.item.with({anchor:e})}t.set(n.item,o)}this._inlayHintsCache.set(e,Array.from(t.values()))}_getHintsRanges(){const e=this._editor.getModel(),t=this._editor.getVisibleRangesPlusViewportAboveBelow(),i=[];for(const n of t.sort(qo.compareRangesUsingStarts)){const t=e.validateRange(new qo(n.startLineNumber-30,n.startColumn,n.endLineNumber+30,n.endColumn));0!==i.length&&qo.areIntersectingOrTouching(i[i.length-1],t)?i[i.length-1]=qo.plusRange(i[i.length-1],t):i.push(t)}return i}_updateHintsDecorators(t,i){var n,o;const s=[],r=(e,t,i,n,o)=>{s.push({item:e,classNameRef:t,decoration:{range:e.anchor.range,options:{description:"InlayHint",showIfCollapsed:e.anchor.range.isEmpty(),collapseOnReplaceEdit:!e.anchor.range.isEmpty(),stickiness:0,[e.anchor.direction]:{content:i,inlineClassNameAffectsLetterSpacing:!0,inlineClassName:t.className,cursorStops:n,attachedData:o}}}})},a=(e,t)=>{const i=this._ruleFactory.createClassNameRef({width:(l/3|0)+"px",display:"inline-block"});r(e,i," ",t?da.Right:da.None)},{fontSize:l,fontFamily:d}=this._getLayoutInfo(),c="--code-editorInlayHintsFontFamily";this._editor.getContainerDomNode().style.setProperty(c,d);for(const g of i){g.hint.paddingLeft&&a(g,!1);const t="string"==typeof g.hint.label?[{label:g.hint.label}]:g.hint.label;for(let e=0;e<t.length;e++){const i=t[e],o=0===e,s=e===t.length-1,a={fontSize:`${l}px`,fontFamily:`var(${c}), ${Gf.fontFamily}`,verticalAlign:"middle"};g.hint.command&&(a.cursor="pointer"),this._fillInColors(a,g.hint),(i.command||i.location)&&(null===(n=this._activeInlayHintPart)||void 0===n?void 0:n.part.item)===g&&this._activeInlayHintPart.part.index===e&&(a.textDecoration="underline",this._activeInlayHintPart.hasTriggerModifier&&(a.color=tx($k),a.cursor="pointer")),o&&s?(a.padding=`1px ${0|Math.max(1,l/4)}px`,a.borderRadius=(l/4|0)+"px"):o?(a.padding=`1px 0 1px ${0|Math.max(1,l/4)}px`,a.borderRadius=`${l/4|0}px 0 0 ${l/4|0}px`):s?(a.padding=`1px ${0|Math.max(1,l/4)}px 1px 0`,a.borderRadius=`0 ${l/4|0}px ${l/4|0}px 0`):a.padding="1px 0 1px 0",r(g,this._ruleFactory.createClassNameRef(a),Rie(i.label),s&&!g.hint.paddingRight?da.Right:da.None,new Mie(g,e))}if(g.hint.paddingRight&&a(g,!0),s.length>e._MAX_DECORATORS)break}const h=[];for(const e of t)for(const{id:t}of null!==(o=this._editor.getDecorationsInRange(e))&&void 0!==o?o:[]){const e=this._decorationsMetadata.get(t);e&&(h.push(t),e.classNameRef.dispose(),this._decorationsMetadata.delete(t))}const u=this._editor.deltaDecorations(h,s.map((e=>e.decoration)));for(let e=0;e<u.length;e++){const t=s[e];this._decorationsMetadata.set(u[e],{item:t.item,classNameRef:t.classNameRef})}}_fillInColors(e,t){t.kind===Xl.Parameter?(e.backgroundColor=tx(Xk),e.color=tx(Yk)):t.kind===Xl.Type?(e.backgroundColor=tx(Zk),e.color=tx(Gk)):(e.backgroundColor=tx(qk),e.color=tx(Kk))}_getLayoutInfo(){const e=this._editor.getOption(127),t=this._editor.getOption(46);let i=e.fontSize;(!i||i<5||i>t)&&(i=.9*t|0);return{fontSize:i,fontFamily:e.fontFamily||this._editor.getOption(43)}}_removeAllDecorations(){this._editor.deltaDecorations(Array.from(this._decorationsMetadata.keys()),[]);for(let e of this._decorationsMetadata.values())e.classNameRef.dispose();this._decorationsMetadata.clear()}};function Rie(e){return e.replace(/[ \t]/g," ")}Oie.ID="editor.contrib.InlayHints",Oie._MAX_DECORATORS=1500,Oie=Lie([Nie(1,Lb),Nie(2,oW),Nie(3,Tie),Nie(4,wy),Nie(5,vF),Nie(6,k_)],Oie),Cy.registerCommand("_executeInlayHintProvider",((e,...t)=>Eie(void 0,void 0,void 0,(function*(){const[i,n]=t;Js(Ps.isUri(i)),Js(qo.isIRange(n));const{inlayHintsProvider:o}=e.get(Lb),s=yield e.get(gy).createModelReference(i);try{const e=yield xie.create(o,s.object.textEditorModel,[qo.lift(n)],Ia.None),t=e.items.map((e=>e.hint));return setTimeout((()=>e.dispose()),0),t}finally{s.dispose()}}))));var Pie=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},Fie=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}},Bie=globalThis&&globalThis.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{l(n.next(e))}catch(t){s(t)}}function a(e){try{l(n.throw(e))}catch(t){s(t)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}l((n=n.apply(e,t||[])).next())}))},Vie=globalThis&&globalThis.__asyncValues||function(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,i=e[Symbol.asyncIterator];return i?i.call(e):(e="function"==typeof __values?__values(e):e[Symbol.iterator](),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(i){t[i]=e[i]&&function(t){return new Promise((function(n,o){(function(e,t,i,n){Promise.resolve(n).then((function(t){e({value:t,done:i})}),t)})(n,o,(t=e[i](t)).done,t.value)}))}}};class Wie extends c2{constructor(e,t){super(10,t,e.item.anchor.range),this.part=e}}let zie=class extends O5{constructor(e,t,i,n,o,s){super(e,t,i,n,s),this._resolverService=o,this.hoverOrdinal=6}suggestHoverAnchor(e){var t;if(!Oie.get(this._editor))return null;if(6!==e.target.type)return null;const i=null===(t=e.target.detail.injectedText)||void 0===t?void 0:t.options;return i instanceof qP&&i.attachedData instanceof Mie?new Wie(i.attachedData,this):null}computeSync(){return[]}computeAsync(e,t,i){return e instanceof Wie?new pb((t=>Bie(this,void 0,void 0,(function*(){var n,o;const{part:s}=e;if(yield s.item.resolve(i),i.isCancellationRequested)return;let r,a;if("string"==typeof s.item.hint.tooltip?r=(new RU).appendText(s.item.hint.tooltip):s.item.hint.tooltip&&(r=s.item.hint.tooltip),r&&t.emitOne(new A5(this,e.range,[r],0)),"string"==typeof s.part.tooltip?a=(new RU).appendText(s.part.tooltip):s.part.tooltip&&(a=s.part.tooltip),a&&t.emitOne(new A5(this,e.range,[a],1)),s.part.location||s.part.command){let i;const n=mf(0,"altKey"===this._editor.getOption(70)?zo?"cmd + click":"ctrl + click":zo?"option + click":"alt + click");s.part.location&&s.part.command?i=(new RU).appendText(mf(0,"Go to Definition ({0}), right click for more",n)):s.part.location?i=(new RU).appendText(mf(0,"Go to Definition ({0})",n)):s.part.command&&(i=new RU(`[${mf(0,"Execute Command")}](${l=s.part.command,Ps.from({scheme:Yw.command,path:l.id,query:l.arguments&&encodeURIComponent(JSON.stringify(l.arguments))}).toString()} "${s.part.command.title}") (${n})`,{isTrusted:!0})),i&&t.emitOne(new A5(this,e.range,[i],1e4))}var l;const d=yield this._resolveInlayHintLabelPartHover(s,i);try{for(var c,h=Vie(d);!(c=yield h.next()).done;){let e=c.value;t.emitOne(e)}}catch(u){n={error:u}}finally{try{c&&!c.done&&(o=h.return)&&(yield o.call(h))}finally{if(n)throw n.error}}})))):pb.EMPTY}_resolveInlayHintLabelPartHover(e,t){return Bie(this,void 0,void 0,(function*(){if(!e.part.location)return pb.EMPTY;const{uri:i,range:n}=e.part.location,o=yield this._resolverService.createModelReference(i);try{const i=o.object.textEditorModel;return this._languageFeaturesService.hoverProvider.has(i)?E5(this._languageFeaturesService.hoverProvider,i,new er(n.startLineNumber,n.startColumn),t).filter((e=>!PU(e.hover.contents))).map((t=>new A5(this,e.item.anchor.range,t.hover.contents,2+t.ordinal))):pb.EMPTY}finally{o.dispose()}}))}};zie=Pie([Fie(1,Lv),Fie(2,ij),Fie(3,Cv),Fie(4,gy),Fie(5,Lb)],zie),Ix(Oie.ID,Oie),h2.register(zie);class Hie{constructor(e,t,i){this._editRange=e,this._originalSelection=t,this._text=i}getEditOperations(e,t){t.addTrackedEditOperation(this._editRange,this._text)}computeCursorState(e,t){const i=t.getInverseEditOperations()[0].range;return this._originalSelection.isEmpty()?new ar(i.endLineNumber,Math.min(this._originalSelection.positionColumn,i.endColumn),i.endLineNumber,Math.min(this._originalSelection.positionColumn,i.endColumn)):new ar(i.endLineNumber,i.endColumn-this._text.length,i.endLineNumber,i.endColumn)}}var jie=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},Uie=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};let $ie=class e{constructor(e,t){this.decorationIds=[],this.editor=e,this.editorWorkerService=t}static get(t){return t.getContribution(e.ID)}dispose(){}run(t,i){this.currentRequest&&this.currentRequest.cancel();const n=this.editor.getSelection(),o=this.editor.getModel();if(!o||!n)return;let s=n;if(s.startLineNumber!==s.endLineNumber)return;const r=new wX(this.editor,5),a=o.uri;return this.editorWorkerService.canNavigateValueSet(a)?(this.currentRequest=Xv((e=>this.editorWorkerService.navigateValueSet(a,s,i))),this.currentRequest.then((i=>{if(!i||!i.range||!i.value)return;if(!r.validate(this.editor))return;let n=qo.lift(i.range),o=i.range,a=i.value.length-(s.endColumn-s.startColumn);o={startLineNumber:o.startLineNumber,startColumn:o.startColumn,endLineNumber:o.endLineNumber,endColumn:o.startColumn+i.value.length},a>1&&(s=new ar(s.startLineNumber,s.startColumn,s.endLineNumber,s.endColumn+a-1));const l=new Hie(n,s,i.value);this.editor.pushUndoStop(),this.editor.executeCommand(t,l),this.editor.pushUndoStop(),this.decorationIds=this.editor.deltaDecorations(this.decorationIds,[{range:o,options:e.DECORATION}]),this.decorationRemover&&this.decorationRemover.cancel(),this.decorationRemover=nb(350),this.decorationRemover.then((()=>this.decorationIds=this.editor.deltaDecorations(this.decorationIds,[]))).catch(Jo)})).catch(Jo)):Promise.resolve(void 0)}};$ie.ID="editor.contrib.inPlaceReplaceController",$ie.DECORATION=GP.register({description:"in-place-replace",className:"valueSetReplacement"}),$ie=jie([Uie(1,BB)],$ie);Ix($ie.ID,$ie),Lx(class extends xx{constructor(){super({id:"editor.action.inPlaceReplace.up",label:mf(0,"Replace with Previous Value"),alias:"Replace with Previous Value",precondition:yI.writable,kbOpts:{kbExpr:yI.editorTextFocus,primary:3154,weight:100}})}run(e,t){const i=$ie.get(t);return i?i.run(this.id,!0):Promise.resolve(void 0)}}),Lx(class extends xx{constructor(){super({id:"editor.action.inPlaceReplace.down",label:mf(0,"Replace with Next Value"),alias:"Replace with Next Value",precondition:yI.writable,kbOpts:{kbExpr:yI.editorTextFocus,primary:3156,weight:100}})}run(e,t){const i=$ie.get(t);return i?i.run(this.id,!1):Promise.resolve(void 0)}}),sx(((e,t)=>{const i=e.getColor(nE);i&&t.addRule(`.monaco-editor.vs .valueSetReplacement { outline: solid 2px ${i}; }`)}));Lx(class extends xx{constructor(){super({id:"expandLineSelection",label:mf(0,"Expand Line Selection"),alias:"Expand Line Selection",precondition:void 0,kbOpts:{weight:0,kbExpr:yI.textInputFocus,primary:2090}})}run(e,t,i){if(i=i||{},!t.hasModel())return;const n=t._getViewModel();n.model.pushStackElement(),n.setCursorStates(i.source,3,cI.expandLineSelection(n,n.getCursorStates())),n.revealPrimaryCursor(i.source,!0)}});class Kie{constructor(e,t){this._selection=e,this._cursors=t,this._selectionId=null}getEditOperations(e,t){const i=function(e,t){t.sort(((e,t)=>e.lineNumber===t.lineNumber?e.column-t.column:e.lineNumber-t.lineNumber));for(let r=t.length-2;r>=0;r--)t[r].lineNumber===t[r+1].lineNumber&&t.splice(r,1);const i=[];let n=0,o=0;const s=t.length;for(let r=1,a=e.getLineCount();r<=a;r++){const a=e.getLineContent(r),l=a.length+1;let d=0;if(o<s&&t[o].lineNumber===r&&(d=t[o].column,o++,d===l))continue;if(0===a.length)continue;const c=Ss(a);let h=0;if(-1===c)h=1;else{if(c===a.length-1)continue;h=c+2}h=Math.max(d,h),i[n++]=_W.delete(new qo(r,h,r,l))}return i}(e,this._cursors);for(let n=0,o=i.length;n<o;n++){const e=i[n];t.addEditOperation(e.range,e.text)}this._selectionId=t.trackSelection(this._selection)}computeCursorState(e,t){return t.getTrackedSelection(this._selectionId)}}class qie{constructor(e,t,i){this._selection=e,this._isCopyingDown=t,this._noop=i||!1,this._selectionDirection=0,this._selectionId=null,this._startLineNumberDelta=0,this._endLineNumberDelta=0}getEditOperations(e,t){let i=this._selection;this._startLineNumberDelta=0,this._endLineNumberDelta=0,i.startLineNumber<i.endLineNumber&&1===i.endColumn&&(this._endLineNumberDelta=1,i=i.setEndPosition(i.endLineNumber-1,e.getLineMaxColumn(i.endLineNumber-1)));let n=[];for(let s=i.startLineNumber;s<=i.endLineNumber;s++)n.push(e.getLineContent(s));const o=n.join("\n");""===o&&this._isCopyingDown&&(this._startLineNumberDelta++,this._endLineNumberDelta++),this._noop?t.addEditOperation(new qo(i.endLineNumber,e.getLineMaxColumn(i.endLineNumber),i.endLineNumber+1,1),i.endLineNumber===e.getLineCount()?"":"\n"):this._isCopyingDown?t.addEditOperation(new qo(i.startLineNumber,1,i.startLineNumber,1),o+"\n"):t.addEditOperation(new qo(i.endLineNumber,e.getLineMaxColumn(i.endLineNumber),i.endLineNumber,e.getLineMaxColumn(i.endLineNumber)),"\n"+o),this._selectionId=t.trackSelection(i),this._selectionDirection=this._selection.getDirection()}computeCursorState(e,t){let i=t.getTrackedSelection(this._selectionId);if(0!==this._startLineNumberDelta||0!==this._endLineNumberDelta){let e=i.startLineNumber,t=i.startColumn,n=i.endLineNumber,o=i.endColumn;0!==this._startLineNumberDelta&&(e+=this._startLineNumberDelta,t=1),0!==this._endLineNumberDelta&&(n+=this._endLineNumberDelta,o=1),i=ar.createWithDirection(e,t,n,o,this._selectionDirection)}return i}}class Gie{constructor(e,t,i){this._selection=e,this._isMovingDown=t,this._autoIndent=i,this._selectionId=null,this._moveEndLineSelectionShrink=!1}getEditOperations(e,t){let i=e.getLineCount();if(this._isMovingDown&&this._selection.endLineNumber===i)return void(this._selectionId=t.trackSelection(this._selection));if(!this._isMovingDown&&1===this._selection.startLineNumber)return void(this._selectionId=t.trackSelection(this._selection));this._moveEndPositionDown=!1;let n=this._selection;n.startLineNumber<n.endLineNumber&&1===n.endColumn&&(this._moveEndPositionDown=!0,n=n.setEndPosition(n.endLineNumber-1,e.getLineMaxColumn(n.endLineNumber-1)));const{tabSize:o,indentSize:s,insertSpaces:r}=e.getOptions();let a=this.buildIndentConverter(o,s,r),l={getLineTokens:t=>e.getLineTokens(t),getLanguageId:()=>e.getLanguageId(),getLanguageIdAtPosition:(t,i)=>e.getLanguageIdAtPosition(t,i),getLineContent:null};if(n.startLineNumber===n.endLineNumber&&1===e.getLineMaxColumn(n.startLineNumber)){let i=n.startLineNumber,o=this._isMovingDown?i+1:i-1;1===e.getLineMaxColumn(o)?t.addEditOperation(new qo(1,1,1,1),null):(t.addEditOperation(new qo(i,1,i,1),e.getLineContent(o)),t.addEditOperation(new qo(o,1,o,e.getLineMaxColumn(o)),null)),n=new ar(o,1,o,1)}else{let i,s;if(this._isMovingDown){i=n.endLineNumber+1,s=e.getLineContent(i),t.addEditOperation(new qo(i-1,e.getLineMaxColumn(i-1),i,e.getLineMaxColumn(i)),null);let d=s;if(this.shouldAutoIndent(e,n)){let c=this.matchEnterRule(e,a,o,i,n.startLineNumber-1);if(null!==c){let t=aie(c+rie(ts(e.getLineContent(i)),o),o,r);d=t+this.trimLeft(s)}else{l.getLineContent=t=>t===n.startLineNumber?e.getLineContent(i):e.getLineContent(t);let t=Wv.getGoodIndentForLine(this._autoIndent,l,e.getLanguageIdAtPosition(i,1),n.startLineNumber,a);if(null!==t){let n=ts(e.getLineContent(i)),a=rie(t,o);if(a!==rie(n,o)){let e=aie(a,o,r);d=e+this.trimLeft(s)}}}t.addEditOperation(new qo(n.startLineNumber,1,n.startLineNumber,1),d+"\n");let h=this.matchEnterRuleMovingDown(e,a,o,n.startLineNumber,i,d);if(null!==h)0!==h&&this.getIndentEditsOfMovingBlock(e,t,n,o,r,h);else{l.getLineContent=t=>t===n.startLineNumber?d:t>=n.startLineNumber+1&&t<=n.endLineNumber+1?e.getLineContent(t-1):e.getLineContent(t);let s=Wv.getGoodIndentForLine(this._autoIndent,l,e.getLanguageIdAtPosition(i,1),n.startLineNumber+1,a);if(null!==s){const i=ts(e.getLineContent(n.startLineNumber)),a=rie(s,o),l=rie(i,o);if(a!==l){const i=a-l;this.getIndentEditsOfMovingBlock(e,t,n,o,r,i)}}}}else t.addEditOperation(new qo(n.startLineNumber,1,n.startLineNumber,1),d+"\n")}else if(i=n.startLineNumber-1,s=e.getLineContent(i),t.addEditOperation(new qo(i,1,i+1,1),null),t.addEditOperation(new qo(n.endLineNumber,e.getLineMaxColumn(n.endLineNumber),n.endLineNumber,e.getLineMaxColumn(n.endLineNumber)),"\n"+s),this.shouldAutoIndent(e,n)){l.getLineContent=t=>t===i?e.getLineContent(n.startLineNumber):e.getLineContent(t);let s=this.matchEnterRule(e,a,o,n.startLineNumber,n.startLineNumber-2);if(null!==s)0!==s&&this.getIndentEditsOfMovingBlock(e,t,n,o,r,s);else{let s=Wv.getGoodIndentForLine(this._autoIndent,l,e.getLanguageIdAtPosition(n.startLineNumber,1),i,a);if(null!==s){let i=ts(e.getLineContent(n.startLineNumber)),a=rie(s,o),l=rie(i,o);if(a!==l){let i=a-l;this.getIndentEditsOfMovingBlock(e,t,n,o,r,i)}}}}}this._selectionId=t.trackSelection(n)}buildIndentConverter(e,t,i){return{shiftIndent:n=>pI.shiftIndent(n,n.length+1,e,t,i),unshiftIndent:n=>pI.unshiftIndent(n,n.length+1,e,t,i)}}parseEnterResult(e,t,i,n,o){if(o){let s=o.indentation;o.indentAction===A_.None||o.indentAction===A_.Indent?s=o.indentation+o.appendText:o.indentAction===A_.IndentOutdent?s=o.indentation:o.indentAction===A_.Outdent&&(s=t.unshiftIndent(o.indentation)+o.appendText);let r=e.getLineContent(n);if(this.trimLeft(r).indexOf(this.trimLeft(s))>=0){let o=ts(e.getLineContent(n)),r=ts(s),a=Wv.getIndentMetadata(e,n);return null!==a&&2&a&&(r=t.unshiftIndent(r)),rie(r,i)-rie(o,i)}}return null}matchEnterRuleMovingDown(e,t,i,n,o,s){if(Ss(s)>=0){let s=e.getLineMaxColumn(o),r=Wv.getEnterAction(this._autoIndent,e,new qo(o,s,o,s));return this.parseEnterResult(e,t,i,n,r)}{let o=n-1;for(;o>=1;){let t=e.getLineContent(o);if(Ss(t)>=0)break;o--}if(o<1||n>e.getLineCount())return null;let s=e.getLineMaxColumn(o),r=Wv.getEnterAction(this._autoIndent,e,new qo(o,s,o,s));return this.parseEnterResult(e,t,i,n,r)}}matchEnterRule(e,t,i,n,o,s){let r=o;for(;r>=1;){let t;if(t=r===o&&void 0!==s?s:e.getLineContent(r),Ss(t)>=0)break;r--}if(r<1||n>e.getLineCount())return null;let a=e.getLineMaxColumn(r),l=Wv.getEnterAction(this._autoIndent,e,new qo(r,a,r,a));return this.parseEnterResult(e,t,i,n,l)}trimLeft(e){return e.replace(/^\s+/,"")}shouldAutoIndent(e,t){if(this._autoIndent<4)return!1;if(!e.isCheapToTokenize(t.startLineNumber))return!1;let i=e.getLanguageIdAtPosition(t.startLineNumber,1);return i===e.getLanguageIdAtPosition(t.endLineNumber,1)&&null!==Wv.getIndentRulesSupport(i)}getIndentEditsOfMovingBlock(e,t,i,n,o,s){for(let r=i.startLineNumber;r<=i.endLineNumber;r++){let a=e.getLineContent(r),l=ts(a),d=aie(rie(l,n)+s,n,o);d!==l&&(t.addEditOperation(new qo(r,1,r,l.length+1),d),r===i.endLineNumber&&i.endColumn<=l.length+1&&""===d&&(this._moveEndLineSelectionShrink=!0))}}computeCursorState(e,t){let i=t.getTrackedSelection(this._selectionId);return this._moveEndPositionDown&&(i=i.setEndPosition(i.endLineNumber+1,1)),this._moveEndLineSelectionShrink&&i.startLineNumber<i.endLineNumber&&(i=i.setEndPosition(i.endLineNumber,2)),i}}class Zie{constructor(e,t){this.selection=e,this.descending=t,this.selectionId=null}static getCollator(){return Zie._COLLATOR||(Zie._COLLATOR=new Intl.Collator),Zie._COLLATOR}getEditOperations(e,t){let i=function(e,t,i){let n=Yie(e,t,i);if(!n)return null;return _W.replace(new qo(n.startLineNumber,1,n.endLineNumber,e.getLineMaxColumn(n.endLineNumber)),n.after.join("\n"))}(e,this.selection,this.descending);i&&t.addEditOperation(i.range,i.text),this.selectionId=t.trackSelection(this.selection)}computeCursorState(e,t){return t.getTrackedSelection(this.selectionId)}static canRun(e,t,i){if(null===e)return!1;let n=Yie(e,t,i);if(!n)return!1;for(let o=0,s=n.before.length;o<s;o++)if(n.before[o]!==n.after[o])return!0;return!1}}function Yie(e,t,i){let n=t.startLineNumber,o=t.endLineNumber;if(1===t.endColumn&&o--,n>=o)return null;let s=[];for(let a=n;a<=o;a++)s.push(e.getLineContent(a));let r=s.slice(0);return r.sort(Zie.getCollator().compare),!0===i&&(r=r.reverse()),{startLineNumber:n,endLineNumber:o,before:s,after:r}}Zie._COLLATOR=null;class Xie extends xx{constructor(e,t){super(t),this.down=e}run(e,t){if(!t.hasModel())return;const i=t.getSelections().map(((e,t)=>({selection:e,index:t,ignore:!1})));i.sort(((e,t)=>qo.compareRangesUsingStarts(e.selection,t.selection)));let n=i[0];for(let s=1;s<i.length;s++){const e=i[s];n.selection.endLineNumber===e.selection.startLineNumber&&(n.index<e.index?e.ignore=!0:(n.ignore=!0,n=e))}const o=[];for(const s of i)o.push(new qie(s.selection,this.down,s.ignore));t.pushUndoStop(),t.executeCommands(this.id,o),t.pushUndoStop()}}class Qie extends xx{constructor(e,t){super(t),this.down=e}run(e,t){let i=[],n=t.getSelections()||[];const o=t.getOption(9);for(const s of n)i.push(new Gie(s,this.down,o));t.pushUndoStop(),t.executeCommands(this.id,i),t.pushUndoStop()}}class Jie extends xx{constructor(e,t){super(t),this.descending=e}run(e,t){const i=t.getSelections()||[];for(const o of i)if(!Zie.canRun(t.getModel(),o,this.descending))return;let n=[];for(let o=0,s=i.length;o<s;o++)n[o]=new Zie(i[o],this.descending);t.pushUndoStop(),t.executeCommands(this.id,n),t.pushUndoStop()}}class ene extends xx{constructor(){super({id:ene.ID,label:mf(0,"Trim Trailing Whitespace"),alias:"Trim Trailing Whitespace",precondition:yI.writable,kbOpts:{kbExpr:yI.editorTextFocus,primary:Ol(2089,2102),weight:100}})}run(e,t,i){let n=[];"auto-save"===i.reason&&(n=(t.getSelections()||[]).map((e=>new er(e.positionLineNumber,e.positionColumn))));let o=t.getSelection();if(null===o)return;let s=new Kie(o,n);t.pushUndoStop(),t.executeCommands(this.id,[s]),t.pushUndoStop()}}ene.ID="editor.action.trimTrailingWhitespace";class tne extends xx{run(e,t){if(!t.hasModel())return;const i=t.getSelection();let n=this._getRangesToDelete(t),o=[];for(let a=0,l=n.length-1;a<l;a++){let e=n[a],t=n[a+1];null===qo.intersectRanges(e,t)?o.push(e):n[a+1]=qo.plusRange(e,t)}o.push(n[n.length-1]);let s=this._getEndCursorState(i,o),r=o.map((e=>_W.replace(e,"")));t.pushUndoStop(),t.executeEdits(this.id,r,s),t.pushUndoStop()}}class ine extends xx{run(e,t){const i=t.getSelections();if(null===i)return;const n=t.getModel();if(null===n)return;const o=t.getOption(117),s=[];for(const r of i)if(r.isEmpty()){const e=r.getStartPosition(),i=t.getConfiguredWordAtPosition(e);if(!i)continue;const a=new qo(e.lineNumber,i.startColumn,e.lineNumber,i.endColumn),l=n.getValueInRange(a);s.push(_W.replace(a,this._modifyText(l,o)))}else{const e=n.getValueInRange(r);s.push(_W.replace(r,this._modifyText(e,o)))}t.pushUndoStop(),t.executeEdits(this.id,s),t.pushUndoStop()}}class nne{constructor(e,t){this._pattern=e,this._flags=t,this._actual=null,this._evaluated=!1}get(){if(!this._evaluated){this._evaluated=!0;try{this._actual=new RegExp(this._pattern,this._flags)}catch(e){}}return this._actual}isSupported(){return null!==this.get()}}class one extends ine{constructor(){super({id:"editor.action.transformToTitlecase",label:mf(0,"Transform to Title Case"),alias:"Transform to Title Case",precondition:yI.writable})}_modifyText(e,t){const i=one.titleBoundary.get();return i?e.toLocaleLowerCase().replace(i,(e=>e.toLocaleUpperCase())):e}}one.titleBoundary=new nne("(^|[^\\p{L}\\p{N}']|((^|\\P{L})'))\\p{L}","gmu");class sne extends ine{constructor(){super({id:"editor.action.transformToSnakecase",label:mf(0,"Transform to Snake Case"),alias:"Transform to Snake Case",precondition:yI.writable})}_modifyText(e,t){const i=sne.caseBoundary.get(),n=sne.singleLetters.get();return i&&n?e.replace(i,"$1_$2").replace(n,"$1_$2$3").toLocaleLowerCase():e}}sne.caseBoundary=new nne("(\\p{Ll})(\\p{Lu})","gmu"),sne.singleLetters=new nne("(\\p{Lu}|\\p{N})(\\p{Lu})(\\p{Ll})","gmu"),Lx(class extends Xie{constructor(){super(!1,{id:"editor.action.copyLinesUpAction",label:mf(0,"Copy Line Up"),alias:"Copy Line Up",precondition:yI.writable,kbOpts:{kbExpr:yI.editorTextFocus,primary:1552,linux:{primary:3600},weight:100},menuOpts:{menuId:cx.MenubarSelectionMenu,group:"2_line",title:mf(0,"&&Copy Line Up"),order:1}})}}),Lx(class extends Xie{constructor(){super(!0,{id:"editor.action.copyLinesDownAction",label:mf(0,"Copy Line Down"),alias:"Copy Line Down",precondition:yI.writable,kbOpts:{kbExpr:yI.editorTextFocus,primary:1554,linux:{primary:3602},weight:100},menuOpts:{menuId:cx.MenubarSelectionMenu,group:"2_line",title:mf(0,"Co&&py Line Down"),order:2}})}}),Lx(class extends xx{constructor(){super({id:"editor.action.duplicateSelection",label:mf(0,"Duplicate Selection"),alias:"Duplicate Selection",precondition:yI.writable,menuOpts:{menuId:cx.MenubarSelectionMenu,group:"2_line",title:mf(0,"&&Duplicate Selection"),order:5}})}run(e,t,i){if(!t.hasModel())return;const n=[],o=t.getSelections(),s=t.getModel();for(const r of o)if(r.isEmpty())n.push(new qie(r,!0));else{const e=new ar(r.endLineNumber,r.endColumn,r.endLineNumber,r.endColumn);n.push(new eI(e,s.getValueInRange(r)))}t.pushUndoStop(),t.executeCommands(this.id,n),t.pushUndoStop()}}),Lx(class extends Qie{constructor(){super(!1,{id:"editor.action.moveLinesUpAction",label:mf(0,"Move Line Up"),alias:"Move Line Up",precondition:yI.writable,kbOpts:{kbExpr:yI.editorTextFocus,primary:528,linux:{primary:528},weight:100},menuOpts:{menuId:cx.MenubarSelectionMenu,group:"2_line",title:mf(0,"Mo&&ve Line Up"),order:3}})}}),Lx(class extends Qie{constructor(){super(!0,{id:"editor.action.moveLinesDownAction",label:mf(0,"Move Line Down"),alias:"Move Line Down",precondition:yI.writable,kbOpts:{kbExpr:yI.editorTextFocus,primary:530,linux:{primary:530},weight:100},menuOpts:{menuId:cx.MenubarSelectionMenu,group:"2_line",title:mf(0,"Move &&Line Down"),order:4}})}}),Lx(class extends Jie{constructor(){super(!1,{id:"editor.action.sortLinesAscending",label:mf(0,"Sort Lines Ascending"),alias:"Sort Lines Ascending",precondition:yI.writable})}}),Lx(class extends Jie{constructor(){super(!0,{id:"editor.action.sortLinesDescending",label:mf(0,"Sort Lines Descending"),alias:"Sort Lines Descending",precondition:yI.writable})}}),Lx(class extends xx{constructor(){super({id:"editor.action.removeDuplicateLines",label:mf(0,"Delete Duplicate Lines"),alias:"Delete Duplicate Lines",precondition:yI.writable})}run(e,t){if(!t.hasModel())return;let i=t.getModel();if(1===i.getLineCount()&&1===i.getLineMaxColumn(1))return;let n=[],o=[],s=0;for(let r of t.getSelections()){let e=new Set,t=[];for(let n=r.startLineNumber;n<=r.endLineNumber;n++){let o=i.getLineContent(n);e.has(o)||(t.push(o),e.add(o))}let a=new ar(r.startLineNumber,1,r.endLineNumber,i.getLineMaxColumn(r.endLineNumber)),l=r.startLineNumber-s,d=new ar(l,1,l+t.length-1,t[t.length-1].length);n.push(_W.replace(a,t.join("\n"))),o.push(d),s+=r.endLineNumber-r.startLineNumber+1-t.length}t.pushUndoStop(),t.executeEdits(this.id,n,o),t.pushUndoStop()}}),Lx(ene),Lx(class extends xx{constructor(){super({id:"editor.action.deleteLines",label:mf(0,"Delete Line"),alias:"Delete Line",precondition:yI.writable,kbOpts:{kbExpr:yI.textInputFocus,primary:3113,weight:100}})}run(e,t){if(!t.hasModel())return;let i=this._getLinesToRemove(t),n=t.getModel();if(1===n.getLineCount()&&1===n.getLineMaxColumn(1))return;let o=0,s=[],r=[];for(let a=0,l=i.length;a<l;a++){const e=i[a];let t=e.startLineNumber,l=e.endLineNumber,d=1,c=n.getLineMaxColumn(l);l<n.getLineCount()?(l+=1,c=1):t>1&&(t-=1,d=n.getLineMaxColumn(t)),s.push(_W.replace(new ar(t,d,l,c),"")),r.push(new ar(t-o,e.positionColumn,t-o,e.positionColumn)),o+=e.endLineNumber-e.startLineNumber+1}t.pushUndoStop(),t.executeEdits(this.id,s,r),t.pushUndoStop()}_getLinesToRemove(e){let t=e.getSelections().map((e=>{let t=e.endLineNumber;return e.startLineNumber<e.endLineNumber&&1===e.endColumn&&(t-=1),{startLineNumber:e.startLineNumber,selectionStartColumn:e.selectionStartColumn,endLineNumber:t,positionColumn:e.positionColumn}}));t.sort(((e,t)=>e.startLineNumber===t.startLineNumber?e.endLineNumber-t.endLineNumber:e.startLineNumber-t.startLineNumber));let i=[],n=t[0];for(let o=1;o<t.length;o++)n.endLineNumber+1>=t[o].startLineNumber?n.endLineNumber=t[o].endLineNumber:(i.push(n),n=t[o]);return i.push(n),i}}),Lx(class extends xx{constructor(){super({id:"editor.action.indentLines",label:mf(0,"Indent Line"),alias:"Indent Line",precondition:yI.writable,kbOpts:{kbExpr:yI.editorTextFocus,primary:2137,weight:100}})}run(e,t){const i=t._getViewModel();i&&(t.pushUndoStop(),t.executeCommands(this.id,fI.indent(i.cursorConfig,t.getModel(),t.getSelections())),t.pushUndoStop())}}),Lx(class extends xx{constructor(){super({id:"editor.action.outdentLines",label:mf(0,"Outdent Line"),alias:"Outdent Line",precondition:yI.writable,kbOpts:{kbExpr:yI.editorTextFocus,primary:2135,weight:100}})}run(e,t){TI.Outdent.runEditorCommand(e,t,null)}}),Lx(class extends xx{constructor(){super({id:"editor.action.insertLineBefore",label:mf(0,"Insert Line Above"),alias:"Insert Line Above",precondition:yI.writable,kbOpts:{kbExpr:yI.editorTextFocus,primary:3075,weight:100}})}run(e,t){const i=t._getViewModel();i&&(t.pushUndoStop(),t.executeCommands(this.id,fI.lineInsertBefore(i.cursorConfig,t.getModel(),t.getSelections())))}}),Lx(class extends xx{constructor(){super({id:"editor.action.insertLineAfter",label:mf(0,"Insert Line Below"),alias:"Insert Line Below",precondition:yI.writable,kbOpts:{kbExpr:yI.editorTextFocus,primary:2051,weight:100}})}run(e,t){const i=t._getViewModel();i&&(t.pushUndoStop(),t.executeCommands(this.id,fI.lineInsertAfter(i.cursorConfig,t.getModel(),t.getSelections())))}}),Lx(class extends tne{constructor(){super({id:"deleteAllLeft",label:mf(0,"Delete All Left"),alias:"Delete All Left",precondition:yI.writable,kbOpts:{kbExpr:yI.textInputFocus,primary:0,mac:{primary:2049},weight:100}})}_getEndCursorState(e,t){let i=null,n=[],o=0;return t.forEach((t=>{let s;if(1===t.endColumn&&o>0){let e=t.startLineNumber-o;s=new ar(e,t.startColumn,e,t.startColumn)}else s=new ar(t.startLineNumber,t.startColumn,t.startLineNumber,t.startColumn);o+=t.endLineNumber-t.startLineNumber,t.intersectRanges(e)?i=s:n.push(s)})),i&&n.unshift(i),n}_getRangesToDelete(e){let t=e.getSelections();if(null===t)return[];let i=t,n=e.getModel();return null===n?[]:(i.sort(qo.compareRangesUsingStarts),i=i.map((e=>{if(e.isEmpty()){if(1===e.startColumn){let t=Math.max(1,e.startLineNumber-1),i=1===e.startLineNumber?1:n.getLineContent(t).length+1;return new qo(t,i,e.startLineNumber,1)}return new qo(e.startLineNumber,1,e.startLineNumber,e.startColumn)}return new qo(e.startLineNumber,1,e.endLineNumber,e.endColumn)})),i)}}),Lx(class extends tne{constructor(){super({id:"deleteAllRight",label:mf(0,"Delete All Right"),alias:"Delete All Right",precondition:yI.writable,kbOpts:{kbExpr:yI.textInputFocus,primary:0,mac:{primary:297,secondary:[2068]},weight:100}})}_getEndCursorState(e,t){let i=null,n=[];for(let o=0,s=t.length,r=0;o<s;o++){let s=t[o],a=new ar(s.startLineNumber-r,s.startColumn,s.startLineNumber-r,s.startColumn);s.intersectRanges(e)?i=a:n.push(a)}return i&&n.unshift(i),n}_getRangesToDelete(e){let t=e.getModel();if(null===t)return[];let i=e.getSelections();if(null===i)return[];let n=i.map((e=>{if(e.isEmpty()){const i=t.getLineMaxColumn(e.startLineNumber);return e.startColumn===i?new qo(e.startLineNumber,e.startColumn,e.startLineNumber+1,1):new qo(e.startLineNumber,e.startColumn,e.startLineNumber,i)}return e}));return n.sort(qo.compareRangesUsingStarts),n}}),Lx(class extends xx{constructor(){super({id:"editor.action.joinLines",label:mf(0,"Join Lines"),alias:"Join Lines",precondition:yI.writable,kbOpts:{kbExpr:yI.editorTextFocus,primary:0,mac:{primary:296},weight:100}})}run(e,t){let i=t.getSelections();if(null===i)return;let n=t.getSelection();if(null===n)return;i.sort(qo.compareRangesUsingStarts);let o=[],s=i.reduce(((e,t)=>e.isEmpty()?e.endLineNumber===t.startLineNumber?(n.equalsSelection(e)&&(n=t),t):t.startLineNumber>e.endLineNumber+1?(o.push(e),t):new ar(e.startLineNumber,e.startColumn,t.endLineNumber,t.endColumn):t.startLineNumber>e.endLineNumber?(o.push(e),t):new ar(e.startLineNumber,e.startColumn,t.endLineNumber,t.endColumn)));o.push(s);let r=t.getModel();if(null===r)return;let a=[],l=[],d=n,c=0;for(let h=0,u=o.length;h<u;h++){let e,t,i=o[h],s=i.startLineNumber,u=1,g=0,p=r.getLineContent(i.endLineNumber).length-i.endColumn;if(i.isEmpty()||i.startLineNumber===i.endLineNumber){let n=i.getStartPosition();n.lineNumber<r.getLineCount()?(e=s+1,t=r.getLineMaxColumn(e)):(e=n.lineNumber,t=r.getLineMaxColumn(n.lineNumber))}else e=i.endLineNumber,t=r.getLineMaxColumn(e);let m=r.getLineContent(s);for(let n=s+1;n<=e;n++){let e=r.getLineContent(n),t=r.getLineFirstNonWhitespaceColumn(n);if(t>=1){let i=!0;""===m&&(i=!1),!i||" "!==m.charAt(m.length-1)&&"\t"!==m.charAt(m.length-1)||(i=!1,m=m.replace(/[\s\uFEFF\xA0]+$/g," "));let n=e.substr(t-1);m+=(i?" ":"")+n,g=i?n.length+1:n.length}else g=0}let f=new qo(s,u,e,t);if(!f.isEmpty()){let e;i.isEmpty()?(a.push(_W.replace(f,m)),e=new ar(f.startLineNumber-c,m.length-g+1,s-c,m.length-g+1)):i.startLineNumber===i.endLineNumber?(a.push(_W.replace(f,m)),e=new ar(i.startLineNumber-c,i.startColumn,i.endLineNumber-c,i.endColumn)):(a.push(_W.replace(f,m)),e=new ar(i.startLineNumber-c,i.startColumn,i.startLineNumber-c,m.length-p)),null!==qo.intersectRanges(f,n)?d=e:l.push(e)}c+=f.endLineNumber-f.startLineNumber}l.unshift(d),t.pushUndoStop(),t.executeEdits(this.id,a,l),t.pushUndoStop()}}),Lx(class extends xx{constructor(){super({id:"editor.action.transpose",label:mf(0,"Transpose characters around the cursor"),alias:"Transpose characters around the cursor",precondition:yI.writable})}run(e,t){let i=t.getSelections();if(null===i)return;let n=t.getModel();if(null===n)return;let o=[];for(let s=0,r=i.length;s<r;s++){let e=i[s];if(!e.isEmpty())continue;let t=e.getStartPosition(),r=n.getLineMaxColumn(t.lineNumber);if(t.column>=r){if(t.lineNumber===n.getLineCount())continue;let e=new qo(t.lineNumber,Math.max(1,t.column-1),t.lineNumber+1,1),i=n.getValueInRange(e).split("").reverse().join("");o.push(new JE(new ar(t.lineNumber,Math.max(1,t.column-1),t.lineNumber+1,1),i))}else{let e=new qo(t.lineNumber,Math.max(1,t.column-1),t.lineNumber,t.column+1),i=n.getValueInRange(e).split("").reverse().join("");o.push(new nI(e,i,new ar(t.lineNumber,t.column+1,t.lineNumber,t.column+1)))}}t.pushUndoStop(),t.executeCommands(this.id,o),t.pushUndoStop()}}),Lx(class extends ine{constructor(){super({id:"editor.action.transformToUppercase",label:mf(0,"Transform to Uppercase"),alias:"Transform to Uppercase",precondition:yI.writable})}_modifyText(e,t){return e.toLocaleUpperCase()}}),Lx(class extends ine{constructor(){super({id:"editor.action.transformToLowercase",label:mf(0,"Transform to Lowercase"),alias:"Transform to Lowercase",precondition:yI.writable})}_modifyText(e,t){return e.toLocaleLowerCase()}}),sne.caseBoundary.isSupported()&&sne.singleLetters.isSupported()&&Lx(sne),one.titleBoundary.isSupported()&&Lx(one);var rne=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},ane=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}},lne=globalThis&&globalThis.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{l(n.next(e))}catch(t){s(t)}}function a(e){try{l(n.throw(e))}catch(t){s(t)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}l((n=n.apply(e,t||[])).next())}))};const dne=new Uy("LinkedEditingInputVisible",!1),cne="linked-editing-decoration";let hne=class e extends Uo{constructor(e,t,i,n,o){super(),this.languageConfigurationService=n,this._localToDispose=this._register(new ws),this._editor=e,this._providers=i.linkedEditingRangeProvider,this._enabled=!1,this._visibleContextKey=dne.bindTo(t),this._debounceInformation=o.for(this._providers,"Linked Editing",{min:200}),this._currentDecorations=[],this._languageWordPattern=null,this._currentWordPattern=null,this._ignoreChangeEvent=!1,this._localToDispose=this._register(new ws),this._rangeUpdateTriggerPromise=null,this._rangeSyncTriggerPromise=null,this._currentRequest=null,this._currentRequestPosition=null,this._currentRequestModelVersion=null,this._register(this._editor.onDidChangeModel((()=>this.reinitialize(!0)))),this._register(this._editor.onDidChangeConfiguration((e=>{(e.hasChanged(62)||e.hasChanged(82))&&this.reinitialize(!1)}))),this._register(this._providers.onDidChange((()=>this.reinitialize(!1)))),this._register(this._editor.onDidChangeModelLanguage((()=>this.reinitialize(!0)))),this.reinitialize(!0)}static get(t){return t.getContribution(e.ID)}reinitialize(e){const t=this._editor.getModel(),i=null!==t&&(this._editor.getOption(62)||this._editor.getOption(82))&&this._providers.has(t);if(i===this._enabled&&!e)return;if(this._enabled=i,this.clearRanges(),this._localToDispose.clear(),!i||null===t)return;this._localToDispose.add(ds.runAndSubscribe(t.onDidChangeLanguageConfiguration,(()=>{this._languageWordPattern=this.languageConfigurationService.getLanguageConfiguration(t.getLanguageId()).getWordDefinition()})));const n=new tb(this._debounceInformation.get(t)),o=()=>{var e;this._rangeUpdateTriggerPromise=n.trigger((()=>this.updateRanges()),null!==(e=this._debounceDuration)&&void 0!==e?e:this._debounceInformation.get(t))},s=new tb(0),r=e=>{this._rangeSyncTriggerPromise=s.trigger((()=>this._syncRanges(e)))};this._localToDispose.add(this._editor.onDidChangeCursorPosition((()=>{o()}))),this._localToDispose.add(this._editor.onDidChangeModelContent((e=>{if(!this._ignoreChangeEvent&&this._currentDecorations.length>0){const i=t.getDecorationRange(this._currentDecorations[0]);if(i&&e.changes.every((e=>i.intersectRanges(e.range))))return void r(this._currentDecorations)}o()}))),this._localToDispose.add({dispose:()=>{n.dispose(),s.dispose()}}),this.updateRanges()}_syncRanges(e){if(!this._editor.hasModel()||e!==this._currentDecorations||0===e.length)return;const t=this._editor.getModel(),i=t.getDecorationRange(e[0]);if(!i||i.startLineNumber!==i.endLineNumber)return this.clearRanges();const n=t.getValueInRange(i);if(this._currentWordPattern){const e=n.match(this._currentWordPattern);if((e?e[0].length:0)!==n.length)return this.clearRanges()}let o=[];for(let s=1,r=e.length;s<r;s++){const i=t.getDecorationRange(e[s]);if(i)if(i.startLineNumber!==i.endLineNumber)o.push({range:i,text:n});else{let e=t.getValueInRange(i),s=n,r=i.startColumn,a=i.endColumn;const l=lr(e,s);r+=l,e=e.substr(l),s=s.substr(l);const d=dr(e,s);a-=d,e=e.substr(0,e.length-d),s=s.substr(0,s.length-d),r===a&&0===s.length||o.push({range:new qo(i.startLineNumber,r,i.endLineNumber,a),text:s})}}if(0!==o.length)try{this._editor.popUndoStop(),this._ignoreChangeEvent=!0;const e=this._editor._getViewModel().getPrevEditOperationType();this._editor.executeEdits("linkedEditing",o),this._editor._getViewModel().setPrevEditOperationType(e)}finally{this._ignoreChangeEvent=!1}}dispose(){this.clearRanges(),super.dispose()}clearRanges(){this._visibleContextKey.set(!1),this._currentDecorations=this._editor.deltaDecorations(this._currentDecorations,[]),this._currentRequest&&(this._currentRequest.cancel(),this._currentRequest=null,this._currentRequestPosition=null)}updateRanges(t=!1){return lne(this,void 0,void 0,(function*(){if(!this._editor.hasModel())return void this.clearRanges();const i=this._editor.getPosition();if(!this._enabled&&!t||this._editor.getSelections().length>1)return void this.clearRanges();const n=this._editor.getModel(),o=n.getVersionId();if(this._currentRequestPosition&&this._currentRequestModelVersion===o){if(i.equals(this._currentRequestPosition))return;if(this._currentDecorations&&this._currentDecorations.length>0){const e=n.getDecorationRange(this._currentDecorations[0]);if(e&&e.containsPosition(i))return}}this._currentRequestPosition=i,this._currentRequestModelVersion=o;const s=Xv((t=>lne(this,void 0,void 0,(function*(){try{const r=new ps(!1),a=yield une(this._providers,n,i,t);if(this._debounceInformation.update(n,r.elapsed()),s!==this._currentRequest)return;if(this._currentRequest=null,o!==n.getVersionId())return;let l=[];(null==a?void 0:a.ranges)&&(l=a.ranges),this._currentWordPattern=(null==a?void 0:a.wordPattern)||this._languageWordPattern;let d=!1;for(let e=0,t=l.length;e<t;e++)if(qo.containsPosition(l[e],i)){if(d=!0,0!==e){const t=l[e];l.splice(e,1),l.unshift(t)}break}if(!d)return void this.clearRanges();const c=l.map((t=>({range:t,options:e.DECORATION})));this._visibleContextKey.set(!0),this._currentDecorations=this._editor.deltaDecorations(this._currentDecorations,c)}catch(r){Ea(r)||Jo(r),this._currentRequest!==s&&this._currentRequest||this.clearRanges()}}))));return this._currentRequest=s,s}))}};hne.ID="editor.contrib.linkedEditing",hne.DECORATION=GP.register({description:"linked-editing",stickiness:0,className:cne}),hne=rne([ane(1,$y),ane(2,Lb),ane(3,Rv),ane(4,oW)],hne);function une(e,t,i,n){return sb(e.ordered(t).map((e=>()=>lne(this,void 0,void 0,(function*(){try{return yield e.provideLinkedEditingRanges(t,i,n)}catch(o){return void Ta(o)}})))),(e=>!!e&&gs(null==e?void 0:e.ranges)))}Dx(new(yx.bindToContribution(hne.get))({id:"cancelLinkedEditingInput",precondition:dne,handler:e=>e.clearRanges(),kbOpts:{kbExpr:yI.editorTextFocus,weight:199,primary:9,secondary:[1033]}}));const gne=_S("editor.linkedEditingBackground",{dark:hS.fromHex("#f00").transparent(.3),light:hS.fromHex("#f00").transparent(.3),hc:hS.fromHex("#f00").transparent(.3)},mf(0,"Background color when the editor auto renames on type."));sx(((e,t)=>{const i=e.getColor(gne);i&&t.addRule(`.monaco-editor .${cne} { background: ${i}; border-left-color: ${i}; }`)})),kx("_executeLinkedEditingProvider",((e,t,i)=>{const{linkedEditingRangeProvider:n}=e.get(Lb);return une(n,t,i,Ia.None)})),Ix(hne.ID,hne),Lx(class extends xx{constructor(){super({id:"editor.action.linkedEditing",label:mf(0,"Start Linked Editing"),alias:"Start Linked Editing",precondition:Sy.and(yI.writable,yI.hasRenameProvider),kbOpts:{kbExpr:yI.editorTextFocus,primary:3132,weight:100}})}runCommand(e,t){const i=e.get(N_),[n,o]=Array.isArray(t)&&t||[void 0,void 0];return Ps.isUri(n)&&er.isIPosition(o)?i.openCodeEditor({resource:n},i.getActiveCodeEditor()).then((e=>{e&&(e.setPosition(o),e.invokeWithinContext((t=>(this.reportTelemetry(t,e),this.run(t,e)))))}),Jo):super.runCommand(e,t)}run(e,t){const i=hne.get(t);return i?Promise.resolve(i.updateRanges(!0)):Promise.resolve()}});var pne=globalThis&&globalThis.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{l(n.next(e))}catch(t){s(t)}}function a(e){try{l(n.throw(e))}catch(t){s(t)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}l((n=n.apply(e,t||[])).next())}))};class mne{constructor(e,t){this._link=e,this._provider=t}toJSON(){return{range:this.range,url:this.url,tooltip:this.tooltip}}get range(){return this._link.range}get url(){return this._link.url}get tooltip(){return this._link.tooltip}resolve(e){return pne(this,void 0,void 0,(function*(){return this._link.url?this._link.url:"function"==typeof this._provider.resolveLink?Promise.resolve(this._provider.resolveLink(this._link,e)).then((t=>(this._link=t||this._link,this._link.url?this.resolve(e):Promise.reject(new Error("missing"))))):Promise.reject(new Error("missing"))}))}}class fne{constructor(e){this._disposables=new ws;let t=[];for(const[i,n]of e){const e=i.links.map((e=>new mne(e,n)));t=fne._union(t,e),ga(i)&&this._disposables.add(i)}this.links=t}dispose(){this._disposables.dispose(),this.links.length=0}static _union(e,t){let i,n,o,s,r=[];for(i=0,o=0,n=e.length,s=t.length;i<n&&o<s;){const n=e[i],s=t[o];if(qo.areIntersectingOrTouching(n.range,s.range)){i++;continue}qo.compareRangesUsingStarts(n.range,s.range)<0?(r.push(n),i++):(r.push(s),o++)}for(;i<n;i++)r.push(e[i]);for(;o<s;o++)r.push(t[o]);return r}}function _ne(e,t,i){const n=[],o=e.ordered(t).reverse().map(((e,o)=>Promise.resolve(e.provideLinks(t,i)).then((t=>{t&&(n[o]=[t,e])}),Ta)));return Promise.all(o).then((()=>{const e=new fne(Sa(n));return i.isCancellationRequested?(e.dispose(),new fne([])):e}))}Cy.registerCommand("_executeLinkProvider",((e,...t)=>pne(void 0,void 0,void 0,(function*(){let[i,n]=t;Js(i instanceof Ps),"number"!=typeof n&&(n=0);const{linkProvider:o}=e.get(Lb),s=e.get(Gv).getModel(i);if(!s)return[];const r=yield _ne(o,s,Ia.None);if(!r)return[];for(let e=0;e<Math.min(n,r.links.length);e++)yield r.links[e].resolve(Ia.None);const a=r.links.slice(0);return r.dispose(),a}))));var vne=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},bne=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}},wne=globalThis&&globalThis.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{l(n.next(e))}catch(t){s(t)}}function a(e){try{l(n.throw(e))}catch(t){s(t)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}l((n=n.apply(e,t||[])).next())}))};let Cne=class e extends Uo{constructor(e,t,i,n,o){super(),this.editor=e,this.openerService=t,this.notificationService=i,this.languageFeaturesService=n,this.providers=this.languageFeaturesService.linkProvider,this.debounceInformation=o.for(this.providers,"Links",{min:1e3,max:4e3}),this.computeLinks=this._register(new lb((()=>this.computeLinksNow()),1e3)),this.computePromise=null,this.activeLinksList=null,this.currentOccurrences={},this.activeLinkDecorationId=null;const s=this._register(new c1(e));this._register(s.onMouseMoveOrRelevantKeyDown((([e,t])=>{this._onEditorMouseMove(e,t)}))),this._register(s.onExecute((e=>{this.onEditorMouseUp(e)}))),this._register(s.onCancel((e=>{this.cleanUpActiveLinkDecoration()}))),this._register(e.onDidChangeConfiguration((e=>{e.hasChanged(63)&&(this.updateDecorations([]),this.stop(),this.computeLinks.schedule(0))}))),this._register(e.onDidChangeModelContent((e=>{this.editor.hasModel()&&this.computeLinks.schedule(this.debounceInformation.get(this.editor.getModel()))}))),this._register(e.onDidChangeModel((e=>{this.currentOccurrences={},this.activeLinkDecorationId=null,this.stop(),this.computeLinks.schedule(0)}))),this._register(e.onDidChangeModelLanguage((e=>{this.stop(),this.computeLinks.schedule(0)}))),this._register(this.providers.onDidChange((e=>{this.stop(),this.computeLinks.schedule(0)}))),this.computeLinks.schedule(0)}static get(t){return t.getContribution(e.ID)}computeLinksNow(){return wne(this,void 0,void 0,(function*(){if(!this.editor.hasModel()||!this.editor.getOption(63))return;const e=this.editor.getModel();if(this.providers.has(e)){this.activeLinksList&&(this.activeLinksList.dispose(),this.activeLinksList=null),this.computePromise=Xv((t=>_ne(this.providers,e,t)));try{const t=new ps(!1);if(this.activeLinksList=yield this.computePromise,this.debounceInformation.update(e,t.elapsed()),e.isDisposed())return;this.updateDecorations(this.activeLinksList.links)}catch(t){Jo(t)}finally{this.computePromise=null}}}))}updateDecorations(e){const t="altKey"===this.editor.getOption(70),i=[],n=Object.keys(this.currentOccurrences);for(const r of n){const e=this.currentOccurrences[r];i.push(e.decorationId)}const o=[];if(e)for(const r of e)o.push(xne.decoration(r,t));const s=this.editor.deltaDecorations(i,o);this.currentOccurrences={},this.activeLinkDecorationId=null;for(let r=0,a=s.length;r<a;r++){const t=new xne(e[r],s[r]);this.currentOccurrences[t.decorationId]=t}}_onEditorMouseMove(e,t){const i="altKey"===this.editor.getOption(70);if(this.isEnabled(e,t)){this.cleanUpActiveLinkDecoration();const t=this.getLinkOccurrence(e.target.position);t&&this.editor.changeDecorations((e=>{t.activate(e,i),this.activeLinkDecorationId=t.decorationId}))}else this.cleanUpActiveLinkDecoration()}cleanUpActiveLinkDecoration(){const e="altKey"===this.editor.getOption(70);if(this.activeLinkDecorationId){const t=this.currentOccurrences[this.activeLinkDecorationId];t&&this.editor.changeDecorations((i=>{t.deactivate(i,e)})),this.activeLinkDecorationId=null}}onEditorMouseUp(e){if(!this.isEnabled(e))return;const t=this.getLinkOccurrence(e.target.position);t&&this.openLinkOccurrence(t,e.hasSideBySideModifier,!0)}openLinkOccurrence(e,t,i=!1){if(!this.openerService)return;const{link:n}=e;n.resolve(Ia.None).then((e=>{if("string"==typeof e&&this.editor.hasModel()){const t=this.editor.getModel().uri;if(t.scheme===Yw.file&&e.startsWith(`${Yw.file}:`)){const i=Ps.parse(e);if(i.scheme===Yw.file){const n=JO(i);let o=null;n.startsWith("/./")?o=`.${n.substr(1)}`:n.startsWith("//./")&&(o=`.${n.substr(2)}`),o&&(e=aR(t,o))}}}return this.openerService.open(e,{openToSide:t,fromUserGesture:i,allowContributedOpeners:!0,allowCommands:!0})}),(e=>{const t=e instanceof Error?e.message:e;"invalid"===t?this.notificationService.warn(mf(0,"Failed to open this link because it is not well-formed: {0}",n.url.toString())):"missing"===t?this.notificationService.warn(mf(0,"Failed to open this link because its target is missing.")):Jo(e)}))}getLinkOccurrence(e){if(!this.editor.hasModel()||!e)return null;const t=this.editor.getModel().getDecorationsInRange({startLineNumber:e.lineNumber,startColumn:e.column,endLineNumber:e.lineNumber,endColumn:e.column},0,!0);for(const i of t){const e=this.currentOccurrences[i.id];if(e)return e}return null}isEnabled(e,t){return Boolean(6===e.target.type&&(e.hasTriggerModifier||t&&t.keyCodeIsTriggerKey))}stop(){var e;this.computeLinks.cancel(),this.activeLinksList&&(null===(e=this.activeLinksList)||void 0===e||e.dispose(),this.activeLinksList=null),this.computePromise&&(this.computePromise.cancel(),this.computePromise=null)}dispose(){super.dispose(),this.stop()}};Cne.ID="editor.linkDetector",Cne=vne([bne(1,ij),bne(2,vF),bne(3,Lb),bne(4,oW)],Cne);const yne={general:GP.register({description:"detected-link",stickiness:1,collapseOnReplaceEdit:!0,inlineClassName:"detected-link"}),active:GP.register({description:"detected-link-active",stickiness:1,collapseOnReplaceEdit:!0,inlineClassName:"detected-link-active"})};class xne{constructor(e,t){this.link=e,this.decorationId=t}static decoration(e,t){return{range:e.range,options:xne._getOptions(e,t,!1)}}static _getOptions(e,t,i){const n=Object.assign({},i?yne.active:yne.general);return n.hoverMessage=function(e,t){const i=e.url&&/^command:/i.test(e.url.toString()),n=e.tooltip?e.tooltip:mf(0,i?"Execute command":"Follow link"),o=mf(0,t?zo?"cmd + click":"ctrl + click":zo?"option + click":"alt + click");if(e.url){let t="";if(/^command:/i.test(e.url.toString())){const i=e.url.toString().match(/^command:([^?#]+)/);if(i){t=` "${mf(0,"Execute command {0}",i[1])}"`}}return new RU("",!0).appendMarkdown(`[${n}](${e.url.toString(!0).replace(/ /g,"%20")}${t}) (${o})`)}return(new RU).appendText(`${n} (${o})`)}(e,t),n}activate(e,t){e.changeDecorationOptions(this.decorationId,xne._getOptions(this.link,t,!0))}deactivate(e,t){e.changeDecorationOptions(this.decorationId,xne._getOptions(this.link,t,!1))}}Ix(Cne.ID,Cne),Lx(class extends xx{constructor(){super({id:"editor.action.openLink",label:mf(0,"Open Link"),alias:"Open Link",precondition:void 0})}run(e,t){const i=Cne.get(t);if(!i)return;if(!t.hasModel())return;const n=t.getSelections();for(const o of n){const e=i.getLinkOccurrence(o.getEndPosition());e&&i.openLinkOccurrence(e,!1)}}}),sx(((e,t)=>{const i=e.getColor($k);i&&t.addRule(`.monaco-editor .detected-link-active { color: ${i} !important; }`)}));var Sne=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},kne=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};function Dne(e,t){const i=t.filter((t=>!e.find((e=>e.equals(t)))));if(i.length>=1){const e=i.map((e=>`line ${e.viewState.position.lineNumber} column ${e.viewState.position.column}`)).join(", ");cy(1===i.length?mf(0,"Cursor added: {0}",e):mf(0,"Cursors added: {0}",e))}}class Lne{constructor(e,t,i){this.selections=e,this.revealRange=t,this.revealScrollType=i}}class Nne{constructor(e,t,i,n,o,s,r){this._editor=e,this.findController=t,this.isDisconnectedFromFindController=i,this.searchText=n,this.wholeWord=o,this.matchCase=s,this.currentMatch=r}static create(e,t){if(!e.hasModel())return null;const i=t.getState();if(!e.hasTextFocus()&&i.isRevealed&&i.searchString.length>0)return new Nne(e,t,!1,i.searchString,i.wholeWord,i.matchCase,null);let n,o,s=!1;const r=e.getSelections();1===r.length&&r[0].isEmpty()?(s=!0,n=!0,o=!0):(n=i.wholeWord,o=i.matchCase);const a=e.getSelection();let l,d=null;if(a.isEmpty()){const t=e.getConfiguredWordAtPosition(a.getStartPosition());if(!t)return null;l=t.word,d=new ar(a.startLineNumber,t.startColumn,a.startLineNumber,t.endColumn)}else l=e.getModel().getValueInRange(a).replace(/\r\n/g,"\n");return new Nne(e,t,s,l,n,o,d)}addSelectionToNextFindMatch(){if(!this._editor.hasModel())return null;const e=this._getNextMatch();if(!e)return null;const t=this._editor.getSelections();return new Lne(t.concat(e),e,0)}moveSelectionToNextFindMatch(){if(!this._editor.hasModel())return null;const e=this._getNextMatch();if(!e)return null;const t=this._editor.getSelections();return new Lne(t.slice(0,t.length-1).concat(e),e,0)}_getNextMatch(){if(!this._editor.hasModel())return null;if(this.currentMatch){const e=this.currentMatch;return this.currentMatch=null,e}this.findController.highlightFindOptions();const e=this._editor.getSelections(),t=e[e.length-1],i=this._editor.getModel().findNextMatch(this.searchText,t.getEndPosition(),!1,this.matchCase,this.wholeWord?this._editor.getOption(117):null,!1);return i?new ar(i.range.startLineNumber,i.range.startColumn,i.range.endLineNumber,i.range.endColumn):null}addSelectionToPreviousFindMatch(){if(!this._editor.hasModel())return null;const e=this._getPreviousMatch();if(!e)return null;const t=this._editor.getSelections();return new Lne(t.concat(e),e,0)}moveSelectionToPreviousFindMatch(){if(!this._editor.hasModel())return null;const e=this._getPreviousMatch();if(!e)return null;const t=this._editor.getSelections();return new Lne(t.slice(0,t.length-1).concat(e),e,0)}_getPreviousMatch(){if(!this._editor.hasModel())return null;if(this.currentMatch){const e=this.currentMatch;return this.currentMatch=null,e}this.findController.highlightFindOptions();const e=this._editor.getSelections(),t=e[e.length-1],i=this._editor.getModel().findPreviousMatch(this.searchText,t.getStartPosition(),!1,this.matchCase,this.wholeWord?this._editor.getOption(117):null,!1);return i?new ar(i.range.startLineNumber,i.range.startColumn,i.range.endLineNumber,i.range.endColumn):null}selectAll(){return this._editor.hasModel()?(this.findController.highlightFindOptions(),this._editor.getModel().findMatches(this.searchText,!0,!1,this.matchCase,this.wholeWord?this._editor.getOption(117):null,!1,1073741824)):[]}}class Ene extends Uo{constructor(e){super(),this._sessionDispose=this._register(new ws),this._editor=e,this._ignoreSelectionChange=!1,this._session=null}static get(e){return e.getContribution(Ene.ID)}dispose(){this._endSession(),super.dispose()}_beginSessionIfNeeded(e){if(!this._session){const t=Nne.create(this._editor,e);if(!t)return;this._session=t;const i={searchString:this._session.searchText};this._session.isDisconnectedFromFindController&&(i.wholeWordOverride=1,i.matchCaseOverride=1,i.isRegexOverride=2),e.getState().change(i,!1),this._sessionDispose.add(this._editor.onDidChangeCursorSelection((e=>{this._ignoreSelectionChange||this._endSession()}))),this._sessionDispose.add(this._editor.onDidBlurEditorText((()=>{this._endSession()}))),this._sessionDispose.add(e.getState().onFindReplaceStateChange((e=>{(e.matchCase||e.wholeWord)&&this._endSession()})))}}_endSession(){if(this._sessionDispose.clear(),this._session&&this._session.isDisconnectedFromFindController){const e={wholeWordOverride:0,matchCaseOverride:0,isRegexOverride:0};this._session.findController.getState().change(e,!1)}this._session=null}_setSelections(e){this._ignoreSelectionChange=!0,this._editor.setSelections(e),this._ignoreSelectionChange=!1}_expandEmptyToWord(e,t){if(!t.isEmpty())return t;const i=this._editor.getConfiguredWordAtPosition(t.getStartPosition());return i?new ar(t.startLineNumber,i.startColumn,t.startLineNumber,i.endColumn):t}_applySessionResult(e){e&&(this._setSelections(e.selections),e.revealRange&&this._editor.revealRangeInCenterIfOutsideViewport(e.revealRange,e.revealScrollType))}getSession(e){return this._session}addSelectionToNextFindMatch(e){if(this._editor.hasModel()){if(!this._session){const t=this._editor.getSelections();if(t.length>1){const i=e.getState().matchCase;if(!Ane(this._editor.getModel(),t,i)){const e=this._editor.getModel();let i=[];for(let n=0,o=t.length;n<o;n++)i[n]=this._expandEmptyToWord(e,t[n]);return void this._editor.setSelections(i)}}}this._beginSessionIfNeeded(e),this._session&&this._applySessionResult(this._session.addSelectionToNextFindMatch())}}addSelectionToPreviousFindMatch(e){this._beginSessionIfNeeded(e),this._session&&this._applySessionResult(this._session.addSelectionToPreviousFindMatch())}moveSelectionToNextFindMatch(e){this._beginSessionIfNeeded(e),this._session&&this._applySessionResult(this._session.moveSelectionToNextFindMatch())}moveSelectionToPreviousFindMatch(e){this._beginSessionIfNeeded(e),this._session&&this._applySessionResult(this._session.moveSelectionToPreviousFindMatch())}selectAll(e){if(!this._editor.hasModel())return;let t=null;const i=e.getState();if(i.isRevealed&&i.searchString.length>0&&i.isRegex)t=this._editor.getModel().findMatches(i.searchString,!0,i.isRegex,i.matchCase,i.wholeWord?this._editor.getOption(117):null,!1,1073741824);else{if(this._beginSessionIfNeeded(e),!this._session)return;t=this._session.selectAll()}if(i.searchScope){const e=i.searchScope;let n=[];t.forEach((t=>{e.forEach((e=>{t.range.endLineNumber<=e.endLineNumber&&t.range.startLineNumber>=e.startLineNumber&&n.push(t)}))})),t=n}if(t.length>0){const e=this._editor.getSelection();for(let i=0,n=t.length;i<n;i++){const n=t[i];if(n.range.intersectRanges(e)){t[i]=t[0],t[0]=n;break}}this._setSelections(t.map((e=>new ar(e.range.startLineNumber,e.range.startColumn,e.range.endLineNumber,e.range.endColumn))))}}}Ene.ID="editor.contrib.multiCursorController";class Ine extends xx{run(e,t){const i=Ene.get(t);if(!i)return;const n=t7.get(t);if(!n)return;const o=t._getViewModel();if(o){const e=o.getCursorStates();this._run(i,n),Dne(e,o.getCursorStates())}}}class Tne{constructor(e,t,i,n,o){this._model=e,this._searchText=t,this._matchCase=i,this._wordSeparators=n,this._modelVersionId=this._model.getVersionId(),this._cachedFindMatches=null,o&&this._model===o._model&&this._searchText===o._searchText&&this._matchCase===o._matchCase&&this._wordSeparators===o._wordSeparators&&this._modelVersionId===o._modelVersionId&&(this._cachedFindMatches=o._cachedFindMatches)}findMatches(){return null===this._cachedFindMatches&&(this._cachedFindMatches=this._model.findMatches(this._searchText,!0,!1,this._matchCase,this._wordSeparators,!1).map((e=>e.range)),this._cachedFindMatches.sort(qo.compareRangesUsingStarts)),this._cachedFindMatches}}let Mne=class e extends Uo{constructor(e,t){super(),this._languageFeaturesService=t,this.editor=e,this._isEnabled=e.getOption(97),this.decorations=[],this.updateSoon=this._register(new lb((()=>this._update()),300)),this.state=null,this._register(e.onDidChangeConfiguration((t=>{this._isEnabled=e.getOption(97)}))),this._register(e.onDidChangeCursorSelection((e=>{this._isEnabled&&(e.selection.isEmpty()?3===e.reason?(this.state&&this._setState(null),this.updateSoon.schedule()):this._setState(null):this._update())}))),this._register(e.onDidChangeModel((e=>{this._setState(null)}))),this._register(e.onDidChangeModelContent((e=>{this._isEnabled&&this.updateSoon.schedule()})));const i=t7.get(e);i&&this._register(i.getState().onFindReplaceStateChange((e=>{this._update()})))}_update(){this._setState(e._createState(this.state,this._isEnabled,this.editor))}static _createState(e,t,i){if(!t)return null;if(!i.hasModel())return null;const n=i.getSelection();if(n.startLineNumber!==n.endLineNumber)return null;const o=Ene.get(i);if(!o)return null;const s=t7.get(i);if(!s)return null;let r=o.getSession(s);if(!r){const e=i.getSelections();if(e.length>1){const t=s.getState().matchCase;if(!Ane(i.getModel(),e,t))return null}r=Nne.create(i,s)}if(!r)return null;if(r.currentMatch)return null;if(/^[ \t]+$/.test(r.searchText))return null;if(r.searchText.length>200)return null;const a=s.getState(),l=a.matchCase;if(a.isRevealed){let e=a.searchString;l||(e=e.toLowerCase());let t=r.searchText;if(l||(t=t.toLowerCase()),e===t&&r.matchCase===a.matchCase&&r.wholeWord===a.wholeWord&&!a.isRegex)return null}return new Tne(i.getModel(),r.searchText,r.matchCase,r.wholeWord?i.getOption(117):null,e)}_setState(t){if(this.state=t,!this.state)return void(this.decorations=this.editor.deltaDecorations(this.decorations,[]));if(!this.editor.hasModel())return;const i=this.editor.getModel();if(i.isTooLargeForTokenization())return;const n=this.state.findMatches(),o=this.editor.getSelections();o.sort(qo.compareRangesUsingStarts);const s=[];for(let e=0,l=0,d=n.length,c=o.length;e<d;){const t=n[e];if(l>=c)s.push(t),e++;else{const i=qo.compareRangesUsingStarts(t,o[l]);i<0?(!o[l].isEmpty()&&qo.areIntersecting(t,o[l])||s.push(t),e++):(i>0||e++,l++)}}const r=this._languageFeaturesService.documentHighlightProvider.has(i)&&this.editor.getOption(72),a=s.map((t=>({range:t,options:r?e._SELECTION_HIGHLIGHT:e._SELECTION_HIGHLIGHT_OVERVIEW})));this.decorations=this.editor.deltaDecorations(this.decorations,a)}dispose(){this._setState(null),super.dispose()}};function Ane(e,t,i){const n=One(e,t[0],!i);for(let o=1,s=t.length;o<s;o++){const s=t[o];if(s.isEmpty())return!1;if(n!==One(e,s,!i))return!1}return!0}function One(e,t,i){const n=e.getValueInRange(t);return i?n.toLowerCase():n}Mne.ID="editor.contrib.selectionHighlighter",Mne._SELECTION_HIGHLIGHT_OVERVIEW=GP.register({description:"selection-highlight-overview",stickiness:1,className:"selectionHighlight",minimap:{color:tx(lL),position:Dr.Inline},overviewRuler:{color:tx(rL),position:aa.Center}}),Mne._SELECTION_HIGHLIGHT=GP.register({description:"selection-highlight",stickiness:1,className:"selectionHighlight"}),Mne=Sne([kne(1,Lb)],Mne),Ix(Ene.ID,Ene),Ix(Mne.ID,Mne),Lx(class extends xx{constructor(){super({id:"editor.action.insertCursorAbove",label:mf(0,"Add Cursor Above"),alias:"Add Cursor Above",precondition:void 0,kbOpts:{kbExpr:yI.editorTextFocus,primary:2576,linux:{primary:1552,secondary:[3088]},weight:100},menuOpts:{menuId:cx.MenubarSelectionMenu,group:"3_multi",title:mf(0,"&&Add Cursor Above"),order:2}})}run(e,t,i){if(!t.hasModel())return;let n=!0;i&&!1===i.logicalLine&&(n=!1);const o=t._getViewModel();if(o.cursorConfig.readOnly)return;o.model.pushStackElement();const s=o.getCursorStates();o.setCursorStates(i.source,3,cI.addCursorUp(o,s,n)),o.revealTopMostCursor(i.source),Dne(s,o.getCursorStates())}}),Lx(class extends xx{constructor(){super({id:"editor.action.insertCursorBelow",label:mf(0,"Add Cursor Below"),alias:"Add Cursor Below",precondition:void 0,kbOpts:{kbExpr:yI.editorTextFocus,primary:2578,linux:{primary:1554,secondary:[3090]},weight:100},menuOpts:{menuId:cx.MenubarSelectionMenu,group:"3_multi",title:mf(0,"A&&dd Cursor Below"),order:3}})}run(e,t,i){if(!t.hasModel())return;let n=!0;i&&!1===i.logicalLine&&(n=!1);const o=t._getViewModel();if(o.cursorConfig.readOnly)return;o.model.pushStackElement();const s=o.getCursorStates();o.setCursorStates(i.source,3,cI.addCursorDown(o,s,n)),o.revealBottomMostCursor(i.source),Dne(s,o.getCursorStates())}}),Lx(class extends xx{constructor(){super({id:"editor.action.insertCursorAtEndOfEachLineSelected",label:mf(0,"Add Cursors to Line Ends"),alias:"Add Cursors to Line Ends",precondition:void 0,kbOpts:{kbExpr:yI.editorTextFocus,primary:1575,weight:100},menuOpts:{menuId:cx.MenubarSelectionMenu,group:"3_multi",title:mf(0,"Add C&&ursors to Line Ends"),order:4}})}getCursorsForSelection(e,t,i){if(!e.isEmpty()){for(let n=e.startLineNumber;n<e.endLineNumber;n++){let e=t.getLineMaxColumn(n);i.push(new ar(n,e,n,e))}e.endColumn>1&&i.push(new ar(e.endLineNumber,e.endColumn,e.endLineNumber,e.endColumn))}}run(e,t){if(!t.hasModel())return;const i=t.getModel(),n=t.getSelections(),o=t._getViewModel(),s=o.getCursorStates();let r=[];n.forEach((e=>this.getCursorsForSelection(e,i,r))),r.length>0&&t.setSelections(r),Dne(s,o.getCursorStates())}}),Lx(class extends Ine{constructor(){super({id:"editor.action.addSelectionToNextFindMatch",label:mf(0,"Add Selection To Next Find Match"),alias:"Add Selection To Next Find Match",precondition:void 0,kbOpts:{kbExpr:yI.focus,primary:2082,weight:100},menuOpts:{menuId:cx.MenubarSelectionMenu,group:"3_multi",title:mf(0,"Add &&Next Occurrence"),order:5}})}_run(e,t){e.addSelectionToNextFindMatch(t)}}),Lx(class extends Ine{constructor(){super({id:"editor.action.addSelectionToPreviousFindMatch",label:mf(0,"Add Selection To Previous Find Match"),alias:"Add Selection To Previous Find Match",precondition:void 0,menuOpts:{menuId:cx.MenubarSelectionMenu,group:"3_multi",title:mf(0,"Add P&&revious Occurrence"),order:6}})}_run(e,t){e.addSelectionToPreviousFindMatch(t)}}),Lx(class extends Ine{constructor(){super({id:"editor.action.moveSelectionToNextFindMatch",label:mf(0,"Move Last Selection To Next Find Match"),alias:"Move Last Selection To Next Find Match",precondition:void 0,kbOpts:{kbExpr:yI.focus,primary:Ol(2089,2082),weight:100}})}_run(e,t){e.moveSelectionToNextFindMatch(t)}}),Lx(class extends Ine{constructor(){super({id:"editor.action.moveSelectionToPreviousFindMatch",label:mf(0,"Move Last Selection To Previous Find Match"),alias:"Move Last Selection To Previous Find Match",precondition:void 0})}_run(e,t){e.moveSelectionToPreviousFindMatch(t)}}),Lx(class extends Ine{constructor(){super({id:"editor.action.selectHighlights",label:mf(0,"Select All Occurrences of Find Match"),alias:"Select All Occurrences of Find Match",precondition:void 0,kbOpts:{kbExpr:yI.focus,primary:3114,weight:100},menuOpts:{menuId:cx.MenubarSelectionMenu,group:"3_multi",title:mf(0,"Select All &&Occurrences"),order:7}})}_run(e,t){e.selectAll(t)}}),Lx(class extends Ine{constructor(){super({id:"editor.action.changeAll",label:mf(0,"Change All Occurrences"),alias:"Change All Occurrences",precondition:Sy.and(yI.writable,yI.editorTextFocus),kbOpts:{kbExpr:yI.editorTextFocus,primary:2108,weight:100},contextMenuOpts:{group:"1_modification",order:1.2}})}_run(e,t){e.selectAll(t)}}),Lx(class extends xx{constructor(){super({id:"editor.action.addCursorsToBottom",label:mf(0,"Add Cursors To Bottom"),alias:"Add Cursors To Bottom",precondition:void 0})}run(e,t){if(!t.hasModel())return;const i=t.getSelections(),n=t.getModel().getLineCount();let o=[];for(let a=i[0].startLineNumber;a<=n;a++)o.push(new ar(a,i[0].startColumn,a,i[0].endColumn));const s=t._getViewModel(),r=s.getCursorStates();o.length>0&&t.setSelections(o),Dne(r,s.getCursorStates())}}),Lx(class extends xx{constructor(){super({id:"editor.action.addCursorsToTop",label:mf(0,"Add Cursors To Top"),alias:"Add Cursors To Top",precondition:void 0})}run(e,t){if(!t.hasModel())return;const i=t.getSelections();let n=[];for(let r=i[0].startLineNumber;r>=1;r--)n.push(new ar(r,i[0].startColumn,r,i[0].endColumn));const o=t._getViewModel(),s=o.getCursorStates();n.length>0&&t.setSelections(n),Dne(s,o.getCursorStates())}});var Rne=globalThis&&globalThis.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{l(n.next(e))}catch(t){s(t)}}function a(e){try{l(n.throw(e))}catch(t){s(t)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}l((n=n.apply(e,t||[])).next())}))};const Pne={Visible:new Uy("parameterHintsVisible",!1),MultipleSignatures:new Uy("parameterHintsMultipleSignatures",!1)};function Fne(e,t,i,n,o){return Rne(this,void 0,void 0,(function*(){const s=e.ordered(t);for(const e of s)try{const s=yield e.provideSignatureHelp(t,i,o,n);if(s)return s}catch(r){Ta(r)}}))}Cy.registerCommand("_executeSignatureHelpProvider",((e,...t)=>Rne(void 0,void 0,void 0,(function*(){const[i,n,o]=t;Js(Ps.isUri(i)),Js(er.isIPosition(n)),Js("string"==typeof o||!o);const s=e.get(Lb),r=yield e.get(gy).createModelReference(i);try{const e=yield Fne(s.signatureHelpProvider,r.object.textEditorModel,er.lift(n),{triggerKind:Ql.Invoke,isRetrigger:!1,triggerCharacter:o},Ia.None);if(!e)return;return setTimeout((()=>e.dispose()),0),e.value}finally{r.dispose()}}))));var Bne,Vne=globalThis&&globalThis.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{l(n.next(e))}catch(t){s(t)}}function a(e){try{l(n.throw(e))}catch(t){s(t)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}l((n=n.apply(e,t||[])).next())}))};!function(e){e.Default={type:0};e.Pending=class{constructor(e,t){this.request=e,this.previouslyActiveHints=t,this.type=2}};e.Active=class{constructor(e){this.hints=e,this.type=1}}}(Bne||(Bne={}));class Wne extends Uo{constructor(e,t,i=Wne.DEFAULT_DELAY){super(),this._onChangedHints=this._register(new $o),this.onChangedHints=this._onChangedHints.event,this.triggerOnType=!1,this._state=Bne.Default,this._pendingTriggers=[],this._lastSignatureHelpResult=this._register(new Rr),this.triggerChars=new jl,this.retriggerChars=new jl,this.triggerId=0,this.editor=e,this.providers=t,this.throttledDelayer=new tb(i),this._register(this.editor.onDidBlurEditorWidget((()=>this.cancel()))),this._register(this.editor.onDidChangeConfiguration((()=>this.onEditorConfigurationChange()))),this._register(this.editor.onDidChangeModel((e=>this.onModelChanged()))),this._register(this.editor.onDidChangeModelLanguage((e=>this.onModelChanged()))),this._register(this.editor.onDidChangeCursorSelection((e=>this.onCursorChange(e)))),this._register(this.editor.onDidChangeModelContent((e=>this.onModelContentChange()))),this._register(this.providers.onDidChange(this.onModelChanged,this)),this._register(this.editor.onDidType((e=>this.onDidType(e)))),this.onEditorConfigurationChange(),this.onModelChanged()}get state(){return this._state}set state(e){2===this._state.type&&this._state.request.cancel(),this._state=e}cancel(e=!1){this.state=Bne.Default,this.throttledDelayer.cancel(),e||this._onChangedHints.fire(void 0)}trigger(e,t){const i=this.editor.getModel();if(!i||!this.providers.has(i))return;const n=++this.triggerId;this._pendingTriggers.push(e),this.throttledDelayer.trigger((()=>this.doTrigger(n)),t).catch(Jo)}next(){if(1!==this.state.type)return;const e=this.state.hints.signatures.length,t=this.state.hints.activeSignature,i=t%e==e-1,n=this.editor.getOption(76).cycle;!(e<2||i)||n?this.updateActiveSignature(i&&n?0:t+1):this.cancel()}previous(){if(1!==this.state.type)return;const e=this.state.hints.signatures.length,t=this.state.hints.activeSignature,i=0===t,n=this.editor.getOption(76).cycle;!(e<2||i)||n?this.updateActiveSignature(i&&n?e-1:t-1):this.cancel()}updateActiveSignature(e){1===this.state.type&&(this.state=new Bne.Active(Object.assign(Object.assign({},this.state.hints),{activeSignature:e})),this._onChangedHints.fire(this.state.hints))}doTrigger(e){return Vne(this,void 0,void 0,(function*(){const t=1===this.state.type||2===this.state.type,i=this.getLastActiveHints();if(this.cancel(!0),0===this._pendingTriggers.length)return!1;const n=this._pendingTriggers.reduce(zne);this._pendingTriggers=[];const o={triggerKind:n.triggerKind,triggerCharacter:n.triggerCharacter,isRetrigger:t,activeSignatureHelp:i};if(!this.editor.hasModel())return!1;const s=this.editor.getModel(),r=this.editor.getPosition();this.state=new Bne.Pending(Xv((e=>Fne(this.providers,s,r,o,e))),i);try{const t=yield this.state.request;return e!==this.triggerId?(null==t||t.dispose(),!1):t&&t.value.signatures&&0!==t.value.signatures.length?(this.state=new Bne.Active(t.value),this._lastSignatureHelpResult.value=t,this._onChangedHints.fire(this.state.hints),!0):(null==t||t.dispose(),this._lastSignatureHelpResult.clear(),this.cancel(),!1)}catch(a){return e===this.triggerId&&(this.state=Bne.Default),Jo(a),!1}}))}getLastActiveHints(){switch(this.state.type){case 1:return this.state.hints;case 2:return this.state.previouslyActiveHints;default:return}}get isTriggered(){return 1===this.state.type||2===this.state.type||this.throttledDelayer.isTriggered()}onModelChanged(){this.cancel(),this.triggerChars=new jl,this.retriggerChars=new jl;const e=this.editor.getModel();if(e)for(const t of this.providers.ordered(e)){for(const e of t.signatureHelpTriggerCharacters||[])this.triggerChars.add(e.charCodeAt(0)),this.retriggerChars.add(e.charCodeAt(0));for(const e of t.signatureHelpRetriggerCharacters||[])this.retriggerChars.add(e.charCodeAt(0))}}onDidType(e){if(!this.triggerOnType)return;const t=e.length-1,i=e.charCodeAt(t);(this.triggerChars.has(i)||this.isTriggered&&this.retriggerChars.has(i))&&this.trigger({triggerKind:Ql.TriggerCharacter,triggerCharacter:e.charAt(t)})}onCursorChange(e){"mouse"===e.source?this.cancel():this.isTriggered&&this.trigger({triggerKind:Ql.ContentChange})}onModelContentChange(){this.isTriggered&&this.trigger({triggerKind:Ql.ContentChange})}onEditorConfigurationChange(){this.triggerOnType=this.editor.getOption(76).enabled,this.triggerOnType||this.cancel()}dispose(){this.cancel(!0),super.dispose()}}function zne(e,t){switch(t.triggerKind){case Ql.Invoke:return t;case Ql.ContentChange:return e;case Ql.TriggerCharacter:default:return t}}Wne.DEFAULT_DELAY=120;var Hne=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},jne=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};const Une=YC,$ne=CB("parameter-hints-next",br.chevronDown,mf(0,"Icon for show next parameter hint.")),Kne=CB("parameter-hints-previous",br.chevronUp,mf(0,"Icon for show previous parameter hint."));let qne=class e extends Uo{constructor(e,t,i,n,o){super(),this.editor=e,this.renderDisposeables=this._register(new ws),this.visible=!1,this.announcedLabel=null,this.allowEditorOverflow=!0,this.markdownRenderer=this._register(new x5({editor:e},n,i)),this.model=this._register(new Wne(e,o.signatureHelpProvider)),this.keyVisible=Pne.Visible.bindTo(t),this.keyMultipleSignatures=Pne.MultipleSignatures.bindTo(t),this._register(this.model.onChangedHints((e=>{e?(this.show(),this.render(e)):this.hide()})))}createParameterHintDOMNodes(){const e=Une(".editor-widget.parameter-hints-widget"),t=$C(e,Une(".phwrapper"));t.tabIndex=-1;const i=$C(t,Une(".controls")),n=$C(i,Une(".button"+ex.asCSSSelector(Kne))),o=$C(i,Une(".overloads")),s=$C(i,Une(".button"+ex.asCSSSelector($ne)));this._register(nC(n,"click",(e=>{HC(e),this.previous()}))),this._register(nC(s,"click",(e=>{HC(e),this.next()})));const r=Une(".body"),a=new fT(r,{});this._register(a),t.appendChild(a.getDomNode());const l=$C(r,Une(".signature")),d=$C(r,Une(".docs"));e.style.userSelect="text",this.domNodes={element:e,signature:l,overloads:o,docs:d,scrollbar:a},this.editor.addContentWidget(this),this.hide(),this._register(this.editor.onDidChangeCursorSelection((e=>{this.visible&&this.editor.layoutContentWidget(this)})));const c=()=>{if(!this.domNodes)return;const e=this.editor.getOption(44);this.domNodes.element.style.fontSize=`${e.fontSize}px`,this.domNodes.element.style.lineHeight=""+e.lineHeight/e.fontSize};c(),this._register(ds.chain(this.editor.onDidChangeConfiguration.bind(this.editor)).filter((e=>e.hasChanged(44))).on(c,null)),this._register(this.editor.onDidLayoutChange((e=>this.updateMaxHeight()))),this.updateMaxHeight()}show(){this.visible||(this.domNodes||this.createParameterHintDOMNodes(),this.keyVisible.set(!0),this.visible=!0,setTimeout((()=>{this.domNodes&&this.domNodes.element.classList.add("visible")}),100),this.editor.layoutContentWidget(this))}hide(){this.renderDisposeables.clear(),this.visible&&(this.keyVisible.reset(),this.visible=!1,this.announcedLabel=null,this.domNodes&&this.domNodes.element.classList.remove("visible"),this.editor.layoutContentWidget(this))}getPosition(){return this.visible?{position:this.editor.getPosition(),preference:[1,2]}:null}render(e){var t;if(this.renderDisposeables.clear(),!this.domNodes)return;const i=e.signatures.length>1;this.domNodes.element.classList.toggle("multiple",i),this.keyMultipleSignatures.set(i),this.domNodes.signature.innerText="",this.domNodes.docs.innerText="";const n=e.signatures[e.activeSignature];if(!n)return;const o=$C(this.domNodes.signature,Une(".code")),s=this.editor.getOption(44);o.style.fontSize=`${s.fontSize}px`,o.style.fontFamily=s.fontFamily;const r=n.parameters.length>0,a=null!==(t=n.activeParameter)&&void 0!==t?t:e.activeParameter;if(r)this.renderParameters(o,n,a);else{$C(o,Une("span")).textContent=n.label}const l=n.parameters[a];if(null==l?void 0:l.documentation){const e=Une("span.documentation");if("string"==typeof l.documentation)e.textContent=l.documentation;else{const t=this.renderMarkdownDocs(l.documentation);e.appendChild(t.element)}$C(this.domNodes.docs,Une("p",{},e))}if(void 0===n.documentation);else if("string"==typeof n.documentation)$C(this.domNodes.docs,Une("p",{},n.documentation));else{const e=this.renderMarkdownDocs(n.documentation);$C(this.domNodes.docs,e.element)}const d=this.hasDocs(n,l);if(this.domNodes.signature.classList.toggle("has-docs",d),this.domNodes.docs.classList.toggle("empty",!d),this.domNodes.overloads.textContent=String(e.activeSignature+1).padStart(e.signatures.length.toString().length,"0")+"/"+e.signatures.length,l){let e="";const t=n.parameters[a];e=Array.isArray(t.label)?n.label.substring(t.label[0],t.label[1]):t.label,t.documentation&&(e+="string"==typeof t.documentation?`, ${t.documentation}`:`, ${t.documentation.value}`),n.documentation&&(e+="string"==typeof n.documentation?`, ${n.documentation}`:`, ${n.documentation.value}`),this.announcedLabel!==e&&(dy(mf(0,"{0}, hint",e)),this.announcedLabel=e)}this.editor.layoutContentWidget(this),this.domNodes.scrollbar.scanDomNode()}renderMarkdownDocs(e){const t=this.renderDisposeables.add(this.markdownRenderer.render(e,{asyncRenderCallback:()=>{var e;null===(e=this.domNodes)||void 0===e||e.scrollbar.scanDomNode()}}));return t.element.classList.add("markdown-docs"),t}hasDocs(e,t){return!!(t&&"string"==typeof t.documentation&&Jl(t.documentation).length>0)||(!!(t&&"object"==typeof t.documentation&&Jl(t.documentation).value.length>0)||(!!(e.documentation&&"string"==typeof e.documentation&&Jl(e.documentation).length>0)||!!(e.documentation&&"object"==typeof e.documentation&&Jl(e.documentation.value).length>0)))}renderParameters(e,t,i){const[n,o]=this.getParameterLabelOffsets(t,i),s=document.createElement("span");s.textContent=t.label.substring(0,n);const r=document.createElement("span");r.textContent=t.label.substring(n,o),r.className="parameter active";const a=document.createElement("span");a.textContent=t.label.substring(o),$C(e,s,r,a)}getParameterLabelOffsets(e,t){const i=e.parameters[t];if(i){if(Array.isArray(i.label))return i.label;if(i.label.length){const t=new RegExp(`(\\W|^)${Xo(i.label)}(?=\\W|$)`,"g");t.test(e.label);const n=t.lastIndex-i.label.length;return n>=0?[n,t.lastIndex]:[0,0]}return[0,0]}return[0,0]}next(){this.editor.focus(),this.model.next()}previous(){this.editor.focus(),this.model.previous()}cancel(){this.model.cancel()}getDomNode(){return this.domNodes||this.createParameterHintDOMNodes(),this.domNodes.element}getId(){return e.ID}trigger(e){this.model.trigger(e,0)}updateMaxHeight(){if(!this.domNodes)return;const e=`${Math.max(this.editor.getLayoutInfo().height/4,250)}px`;this.domNodes.element.style.maxHeight=e;const t=this.domNodes.element.getElementsByClassName("phwrapper");t.length&&(t[0].style.maxHeight=e)}};qne.ID="editor.widget.parameterHintsWidget",qne=Hne([jne(1,$y),jne(2,ij),jne(3,Lv),jne(4,Lb)],qne);const Gne=_S("editorHoverWidget.highlightForeground",{dark:ND,light:ND,hc:ND},mf(0,"Foreground color of the active item in the parameter hint."));sx(((e,t)=>{const i=e.getColor(jk);if(i){const n=e.type===Xy.HIGH_CONTRAST?2:1;t.addRule(`.monaco-editor .parameter-hints-widget { border: ${n}px solid ${i}; }`),t.addRule(`.monaco-editor .parameter-hints-widget.multiple .body { border-left: 1px solid ${i.transparent(.5)}; }`),t.addRule(`.monaco-editor .parameter-hints-widget .signature.has-docs { border-bottom: 1px solid ${i.transparent(.5)}; }`)}const n=e.getColor(zk);n&&t.addRule(`.monaco-editor .parameter-hints-widget { background-color: ${n}; }`);const o=e.getColor(SS);o&&t.addRule(`.monaco-editor .parameter-hints-widget a { color: ${o}; }`);const s=e.getColor(kS);s&&t.addRule(`.monaco-editor .parameter-hints-widget a:hover { color: ${s}; }`);const r=e.getColor(Hk);r&&t.addRule(`.monaco-editor .parameter-hints-widget { color: ${r}; }`);const a=e.getColor(DS);a&&t.addRule(`.monaco-editor .parameter-hints-widget code { background-color: ${a}; }`);const l=e.getColor(Gne);l&&t.addRule(`.monaco-editor .parameter-hints-widget .parameter.active { color: ${l}}`)}));var Zne=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},Yne=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};let Xne=class e extends Uo{constructor(e,t){super(),this.editor=e,this.widget=this._register(t.createInstance(qne,this.editor))}static get(t){return t.getContribution(e.ID)}cancel(){this.widget.cancel()}previous(){this.widget.previous()}next(){this.widget.next()}trigger(e){this.widget.trigger(e)}};Xne.ID="editor.controller.parameterHints",Xne=Zne([Yne(1,k_)],Xne);Ix(Xne.ID,Xne),Lx(class extends xx{constructor(){super({id:"editor.action.triggerParameterHints",label:mf(0,"Trigger Parameter Hints"),alias:"Trigger Parameter Hints",precondition:yI.hasSignatureHelpProvider,kbOpts:{kbExpr:yI.editorTextFocus,primary:3082,weight:100}})}run(e,t){const i=Xne.get(t);i&&i.trigger({triggerKind:Ql.Invoke})}});const Qne=yx.bindToContribution(Xne.get);Dx(new Qne({id:"closeParameterHints",precondition:Pne.Visible,handler:e=>e.cancel(),kbOpts:{weight:175,kbExpr:yI.focus,primary:9,secondary:[1033]}})),Dx(new Qne({id:"showPrevParameterHint",precondition:Sy.and(Pne.Visible,Pne.MultipleSignatures),handler:e=>e.previous(),kbOpts:{weight:175,kbExpr:yI.focus,primary:16,secondary:[528],mac:{primary:16,secondary:[528,302]}}})),Dx(new Qne({id:"showNextParameterHint",precondition:Sy.and(Pne.Visible,Pne.MultipleSignatures),handler:e=>e.next(),kbOpts:{weight:175,kbExpr:yI.focus,primary:18,secondary:[530],mac:{primary:18,secondary:[530,300]}}}));var Jne=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},eoe=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};const toe=new Uy("renameInputVisible",!1,mf(0,"Whether the rename input widget is visible"));let ioe=class{constructor(e,t,i,n,o){this._editor=e,this._acceptKeybindings=t,this._themeService=i,this._keybindingService=n,this._disposables=new ws,this.allowEditorOverflow=!0,this._visibleContextKey=toe.bindTo(o),this._editor.addContentWidget(this),this._disposables.add(this._editor.onDidChangeConfiguration((e=>{e.hasChanged(44)&&this._updateFont()}))),this._disposables.add(i.onDidColorThemeChange(this._updateStyles,this))}dispose(){this._disposables.dispose(),this._editor.removeContentWidget(this)}getId(){return"__renameInputWidget"}getDomNode(){if(!this._domNode){this._domNode=document.createElement("div"),this._domNode.className="monaco-editor rename-box",this._input=document.createElement("input"),this._input.className="rename-input",this._input.type="text",this._input.setAttribute("aria-label",mf(0,"Rename input. Type new name and press Enter to commit.")),this._domNode.appendChild(this._input),this._label=document.createElement("div"),this._label.className="rename-label",this._domNode.appendChild(this._label);const e=()=>{var e,t;const[i,n]=this._acceptKeybindings;this._keybindingService.lookupKeybinding(i),this._label.innerText=mf(0,"{0} to Rename, {1} to Preview",null===(e=this._keybindingService.lookupKeybinding(i))||void 0===e?void 0:e.getLabel(),null===(t=this._keybindingService.lookupKeybinding(n))||void 0===t?void 0:t.getLabel())};e(),this._disposables.add(this._keybindingService.onDidUpdateKeybindings(e)),this._updateFont(),this._updateStyles(this._themeService.getColorTheme())}return this._domNode}_updateStyles(e){var t,i,n,o;if(!this._input||!this._domNode)return;const s=e.getColor(LS);this._domNode.style.backgroundColor=String(null!==(t=e.getColor(fk))&&void 0!==t?t:""),this._domNode.style.boxShadow=s?` 0 0 8px 2px ${s}`:"",this._domNode.style.color=String(null!==(i=e.getColor(ES))&&void 0!==i?i:""),this._input.style.backgroundColor=String(null!==(n=e.getColor(NS))&&void 0!==n?n:"");const r=e.getColor(IS);this._input.style.borderWidth=r?"1px":"0px",this._input.style.borderStyle=r?"solid":"none",this._input.style.borderColor=null!==(o=null==r?void 0:r.toString())&&void 0!==o?o:"none"}_updateFont(){if(!this._input||!this._label)return;const e=this._editor.getOption(44);this._input.style.fontFamily=e.fontFamily,this._input.style.fontWeight=e.fontWeight,this._input.style.fontSize=`${e.fontSize}px`,this._label.style.fontSize=.8*e.fontSize+"px"}getPosition(){return this._visible?{position:this._position,preference:[2,1]}:null}afterRender(e){e||this.cancelInput(!0)}acceptInput(e){this._currentAcceptInput&&this._currentAcceptInput(e)}cancelInput(e){this._currentCancelInput&&this._currentCancelInput(e)}getInput(e,t,i,n,o,s){this._domNode.classList.toggle("preview",o),this._position=new er(e.startLineNumber,e.startColumn),this._input.value=t,this._input.setAttribute("selectionStart",i.toString()),this._input.setAttribute("selectionEnd",n.toString()),this._input.size=Math.max(1.1*(e.endColumn-e.startColumn),20);const r=new ws;return new Promise((e=>{this._currentCancelInput=t=>(this._currentAcceptInput=void 0,this._currentCancelInput=void 0,e(t),!0),this._currentAcceptInput=i=>{0!==this._input.value.trim().length&&this._input.value!==t?(this._currentAcceptInput=void 0,this._currentCancelInput=void 0,e({newName:this._input.value,wantsPreview:o&&i})):this.cancelInput(!0)},r.add(s.onCancellationRequested((()=>this.cancelInput(!0)))),r.add(this._editor.onDidBlurEditorWidget((()=>this.cancelInput(!1)))),this._show()})).finally((()=>{r.dispose(),this._hide()}))}_show(){this._editor.revealLineInCenterIfOutsideViewport(this._position.lineNumber,0),this._visible=!0,this._visibleContextKey.set(!0),this._editor.layoutContentWidget(this),setTimeout((()=>{this._input.focus(),this._input.setSelectionRange(parseInt(this._input.getAttribute("selectionStart")),parseInt(this._input.getAttribute("selectionEnd")))}),100)}_hide(){this._visible=!1,this._visibleContextKey.reset(),this._editor.layoutContentWidget(this)}};ioe=Jne([eoe(2,Qy),eoe(3,kW),eoe(4,$y)],ioe);var noe=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},ooe=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}},soe=globalThis&&globalThis.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{l(n.next(e))}catch(t){s(t)}}function a(e){try{l(n.throw(e))}catch(t){s(t)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}l((n=n.apply(e,t||[])).next())}))};class roe{constructor(e,t,i){this.model=e,this.position=t,this._providerRenameIdx=0,this._providers=i.ordered(e)}hasProvider(){return this._providers.length>0}resolveRenameLocation(e){return soe(this,void 0,void 0,(function*(){const t=[];for(this._providerRenameIdx=0;this._providerRenameIdx<this._providers.length;this._providerRenameIdx++){const i=this._providers[this._providerRenameIdx];if(!i.resolveRenameLocation)break;let n=yield i.resolveRenameLocation(this.model,this.position,e);if(n){if(!n.rejectReason)return n;t.push(n.rejectReason)}}const i=this.model.getWordAtPosition(this.position);return i?{range:new qo(this.position.lineNumber,i.startColumn,this.position.lineNumber,i.endColumn),text:i.word,rejectReason:t.length>0?t.join("\n"):void 0}:{range:qo.fromPositions(this.position),text:"",rejectReason:t.length>0?t.join("\n"):void 0}}))}provideRenameEdits(e,t){return soe(this,void 0,void 0,(function*(){return this._provideRenameEdits(e,this._providerRenameIdx,[],t)}))}_provideRenameEdits(e,t,i,n){return soe(this,void 0,void 0,(function*(){const o=this._providers[t];if(!o)return{edits:[],rejectReason:i.join("\n")};const s=yield o.provideRenameEdits(this.model,this.position,e,n);return s?s.rejectReason?this._provideRenameEdits(e,t+1,i.concat(s.rejectReason),n):s:this._provideRenameEdits(e,t+1,i.concat(mf(0,"No result.")),n)}))}}let aoe=class e{constructor(e,t,i,n,o,s,r,a){this.editor=e,this._instaService=t,this._notificationService=i,this._bulkEditService=n,this._progressService=o,this._logService=s,this._configService=r,this._languageFeaturesService=a,this._dispoableStore=new ws,this._cts=new as,this._renameInputField=this._dispoableStore.add(new cb((()=>this._dispoableStore.add(this._instaService.createInstance(ioe,this.editor,["acceptRenameInput","acceptRenameInputWithPreview"])))))}static get(t){return t.getContribution(e.ID)}dispose(){this._dispoableStore.dispose(),this._cts.dispose(!0)}run(){var e,t;return soe(this,void 0,void 0,(function*(){if(this._cts.dispose(!0),!this.editor.hasModel())return;const i=this.editor.getPosition(),n=new roe(this.editor.getModel(),i,this._languageFeaturesService.renameProvider);if(!n.hasProvider())return;let o;this._cts=new CX(this.editor,5);try{const e=n.resolveRenameLocation(this._cts.token);this._progressService.showWhile(e,250),o=yield e}catch(h){return void(null===(e=WJ.get(this.editor))||void 0===e||e.showMessage(h||mf(0,"An unknown error occurred while resolving rename location"),i))}if(!o)return;if(o.rejectReason)return void(null===(t=WJ.get(this.editor))||void 0===t||t.showMessage(o.rejectReason,i));if(this._cts.token.isCancellationRequested)return;this._cts.dispose(),this._cts=new CX(this.editor,5,o.range);let s=this.editor.getSelection(),r=0,a=o.text.length;qo.isEmpty(s)||qo.spansMultipleLines(s)||!qo.containsRange(o.range,s)||(r=Math.max(0,s.startColumn-o.range.startColumn),a=Math.min(o.range.endColumn,s.endColumn)-o.range.startColumn);const l=this._bulkEditService.hasPreviewHandler()&&this._configService.getValue(this.editor.getModel().uri,"editor.rename.enablePreview"),d=yield this._renameInputField.value.getInput(o.range,o.text,r,a,l,this._cts.token);if("boolean"==typeof d)return void(d&&this.editor.focus());this.editor.focus();const c=Qv(n.provideRenameEdits(d.newName,this._cts.token),this._cts.token).then((e=>soe(this,void 0,void 0,(function*(){e&&this.editor.hasModel()&&(e.rejectReason?this._notificationService.info(e.rejectReason):(this.editor.setSelection(qo.fromPositions(this.editor.getSelection().getPosition())),this._bulkEditService.apply(dW.convert(e),{editor:this.editor,showPreview:d.wantsPreview,label:mf(0,"Renaming '{0}'",null==o?void 0:o.text),quotableLabel:mf(0,"Renaming {0}",null==o?void 0:o.text)}).then((e=>{e.ariaSummary&&dy(mf(0,"Successfully renamed '{0}' to '{1}'. Summary: {2}",o.text,d.newName,e.ariaSummary))})).catch((e=>{this._notificationService.error(mf(0,"Rename failed to apply edits")),this._logService.error(e)}))))}))),(e=>{this._notificationService.error(mf(0,"Rename failed to compute edits")),this._logService.error(e)}));return this._progressService.showWhile(c,250),c}))}acceptRenameInput(e){this._renameInputField.value.acceptInput(e)}cancelRenameInput(){this._renameInputField.value.cancelInput(!0)}};aoe.ID="editor.contrib.renameController",aoe=noe([ooe(1,k_),ooe(2,vF),ooe(3,lW),ooe(4,$B),ooe(5,Cb),ooe(6,bb),ooe(7,Lb)],aoe);Ix(aoe.ID,aoe),Lx(class extends xx{constructor(){super({id:"editor.action.rename",label:mf(0,"Rename Symbol"),alias:"Rename Symbol",precondition:Sy.and(yI.writable,yI.hasRenameProvider),kbOpts:{kbExpr:yI.editorTextFocus,primary:60,weight:100},contextMenuOpts:{group:"1_modification",order:1.1}})}runCommand(e,t){const i=e.get(N_),[n,o]=Array.isArray(t)&&t||[void 0,void 0];return Ps.isUri(n)&&er.isIPosition(o)?i.openCodeEditor({resource:n},i.getActiveCodeEditor()).then((e=>{e&&(e.setPosition(o),e.invokeWithinContext((t=>(this.reportTelemetry(t,e),this.run(t,e)))))}),Jo):super.runCommand(e,t)}run(e,t){const i=aoe.get(t);return i?i.run():Promise.resolve()}});const loe=yx.bindToContribution(aoe.get);Dx(new loe({id:"acceptRenameInput",precondition:toe,handler:e=>e.acceptRenameInput(!1),kbOpts:{weight:199,kbExpr:yI.focus,primary:3}})),Dx(new loe({id:"acceptRenameInputWithPreview",precondition:Sy.and(toe,Sy.has("config.editor.rename.enablePreview")),handler:e=>e.acceptRenameInput(!0),kbOpts:{weight:199,kbExpr:yI.focus,primary:1027}})),Dx(new loe({id:"cancelRenameInput",precondition:toe,handler:e=>e.cancelRenameInput(),kbOpts:{weight:199,kbExpr:yI.focus,primary:9,secondary:[1033]}})),kx("_executeDocumentRenameProvider",(function(e,t,i,...n){const[o]=n;Js("string"==typeof o);const{renameProvider:s}=e.get(Lb);return function(e,t,i,n){return soe(this,void 0,void 0,(function*(){const o=new roe(t,i,e),s=yield o.resolveRenameLocation(Ia.None);return(null==s?void 0:s.rejectReason)?{edits:[],rejectReason:s.rejectReason}:o.provideRenameEdits(n,Ia.None)}))}(s,t,i,o)})),kx("_executePrepareRename",(function(e,t,i){return soe(this,void 0,void 0,(function*(){const{renameProvider:n}=e.get(Lb),o=new roe(t,i,n),s=yield o.resolveRenameLocation(Ia.None);if(null==s?void 0:s.rejectReason)throw new Error(s.rejectReason);return s}))})),Yy.as(cA).registerConfiguration({id:"editor",properties:{"editor.rename.enablePreview":{scope:5,description:mf(0,"Enable/disable the ability to preview changes before renaming"),default:!0,type:"boolean"}}});class doe{provideSelectionRanges(e,t){const i=[];for(const n of t){const t=[];i.push(t),this._addInWordRanges(t,e,n),this._addWordRanges(t,e,n),this._addWhitespaceLine(t,e,n),t.push({range:e.getFullModelRange()})}return i}_addInWordRanges(e,t,i){const n=t.getWordAtPosition(i);if(!n)return;let{word:o,startColumn:s}=n,r=i.column-s,a=r,l=r,d=0;for(;a>=0;a--){let e=o.charCodeAt(a);if(a!==r&&(95===e||45===e))break;if(pr(e)&&mr(d))break;d=e}for(a+=1;l<o.length;l++){let e=o.charCodeAt(l);if(mr(e)&&pr(d))break;if(95===e||45===e)break;d=e}a<l&&e.push({range:new qo(i.lineNumber,s+a,i.lineNumber,s+l)})}_addWordRanges(e,t,i){const n=t.getWordAtPosition(i);n&&e.push({range:new qo(i.lineNumber,n.startColumn,i.lineNumber,n.endColumn)})}_addWhitespaceLine(e,t,i){t.getLineLength(i.lineNumber)>0&&0===t.getLineFirstNonWhitespaceColumn(i.lineNumber)&&0===t.getLineLastNonWhitespaceColumn(i.lineNumber)&&e.push({range:new qo(i.lineNumber,1,i.lineNumber,t.getLineMaxColumn(i.lineNumber))})}}var coe=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},hoe=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}},uoe=globalThis&&globalThis.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{l(n.next(e))}catch(t){s(t)}}function a(e){try{l(n.throw(e))}catch(t){s(t)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}l((n=n.apply(e,t||[])).next())}))};class goe{constructor(e,t){this.index=e,this.ranges=t}mov(e){let t=this.index+(e?1:-1);if(t<0||t>=this.ranges.length)return this;const i=new goe(t,this.ranges);return i.ranges[t].equalsRange(this.ranges[this.index])?i.mov(e):i}}let poe=class e{constructor(e,t){this._editor=e,this._languageFeaturesService=t,this._ignoreSelection=!1}static get(t){return t.getContribution(e.ID)}dispose(){var e;null===(e=this._selectionListener)||void 0===e||e.dispose()}run(e){return uoe(this,void 0,void 0,(function*(){if(!this._editor.hasModel())return;const t=this._editor.getSelections(),i=this._editor.getModel();if(this._state||(yield foe(this._languageFeaturesService.selectionRangeProvider,i,t.map((e=>e.getPosition())),this._editor.getOption(102),Ia.None).then((e=>{var i;if(gs(e)&&e.length===t.length&&this._editor.hasModel()&&jo(this._editor.getSelections(),t,((e,t)=>e.equalsSelection(t)))){for(let i=0;i<e.length;i++)e[i]=e[i].filter((e=>e.containsPosition(t[i].getStartPosition())&&e.containsPosition(t[i].getEndPosition()))),e[i].unshift(t[i]);this._state=e.map((e=>new goe(0,e))),null===(i=this._selectionListener)||void 0===i||i.dispose(),this._selectionListener=this._editor.onDidChangeCursorPosition((()=>{var e;this._ignoreSelection||(null===(e=this._selectionListener)||void 0===e||e.dispose(),this._state=void 0)}))}}))),!this._state)return;this._state=this._state.map((t=>t.mov(e)));const n=this._state.map((e=>ar.fromPositions(e.ranges[e.index].getStartPosition(),e.ranges[e.index].getEndPosition())));this._ignoreSelection=!0;try{this._editor.setSelections(n)}finally{this._ignoreSelection=!1}}))}};poe.ID="editor.contrib.smartSelectController",poe=coe([hoe(1,Lb)],poe);class moe extends xx{constructor(e,t){super(t),this._forward=e}run(e,t){return uoe(this,void 0,void 0,(function*(){let e=poe.get(t);e&&(yield e.run(this._forward))}))}}Cy.registerCommandAlias("editor.action.smartSelect.grow","editor.action.smartSelect.expand");function foe(e,t,i,n,o){return uoe(this,void 0,void 0,(function*(){const s=e.all(t).concat(new doe);1===s.length&&s.unshift(new J9);let r=[],a=[];for(const e of s)r.push(Promise.resolve(e.provideSelectionRanges(t,i,o)).then((e=>{if(gs(e)&&e.length===i.length)for(let t=0;t<i.length;t++){a[t]||(a[t]=[]);for(const n of e[t])qo.isIRange(n.range)&&qo.containsPosition(n.range,i[t])&&a[t].push(qo.lift(n.range))}}),Ta));return yield Promise.all(r),a.map((e=>{if(0===e.length)return[];e.sort(((e,t)=>er.isBefore(e.getStartPosition(),t.getStartPosition())?1:er.isBefore(t.getStartPosition(),e.getStartPosition())||er.isBefore(e.getEndPosition(),t.getEndPosition())?-1:er.isBefore(t.getEndPosition(),e.getEndPosition())?1:0));let i,o=[];for(const t of e)(!i||qo.containsRange(t,i)&&!qo.equalsRange(t,i))&&(o.push(t),i=t);if(!n.selectLeadingAndTrailingWhitespace)return o;let s=[o[0]];for(let n=1;n<o.length;n++){const e=o[n-1],i=o[n];if(i.startLineNumber!==e.startLineNumber||i.endLineNumber!==e.endLineNumber){const n=new qo(e.startLineNumber,t.getLineFirstNonWhitespaceColumn(e.startLineNumber),e.endLineNumber,t.getLineLastNonWhitespaceColumn(e.endLineNumber));n.containsRange(e)&&!n.equalsRange(e)&&i.containsRange(n)&&!i.equalsRange(n)&&s.push(n);const o=new qo(e.startLineNumber,1,e.endLineNumber,t.getLineMaxColumn(e.endLineNumber));o.containsRange(e)&&!o.equalsRange(n)&&i.containsRange(o)&&!i.equalsRange(o)&&s.push(o)}s.push(i)}return s}))}))}Ix(poe.ID,poe),Lx(class extends moe{constructor(){super(!0,{id:"editor.action.smartSelect.expand",label:mf(0,"Expand Selection"),alias:"Expand Selection",precondition:void 0,kbOpts:{kbExpr:yI.editorTextFocus,primary:1553,mac:{primary:3345,secondary:[1297]},weight:100},menuOpts:{menuId:cx.MenubarSelectionMenu,group:"1_basic",title:mf(0,"&&Expand Selection"),order:2}})}}),Lx(class extends moe{constructor(){super(!1,{id:"editor.action.smartSelect.shrink",label:mf(0,"Shrink Selection"),alias:"Shrink Selection",precondition:void 0,kbOpts:{kbExpr:yI.editorTextFocus,primary:1551,mac:{primary:3343,secondary:[1295]},weight:100},menuOpts:{menuId:cx.MenubarSelectionMenu,group:"1_basic",title:mf(0,"&&Shrink Selection"),order:3}})}}),Cy.registerCommand("_executeSelectionRangeProvider",(function(e,...t){return uoe(this,void 0,void 0,(function*(){const[i,n]=t;Js(Ps.isUri(i));const o=e.get(Lb).selectionRangeProvider,s=yield e.get(gy).createModelReference(i);try{return foe(o,s.object.textEditorModel,n,{selectLeadingAndTrailingWhitespace:!0},Ia.None)}finally{s.dispose()}}))}));Lx(class extends xx{constructor(){super({id:"editor.action.forceRetokenize",label:mf(0,"Developer: Force Retokenize"),alias:"Developer: Force Retokenize",precondition:void 0})}run(e,t){if(!t.hasModel())return;const i=t.getModel();i.resetTokenization();const n=new ps(!0);i.forceTokenization(i.getLineCount()),n.stop()}});class _oe extends xx{constructor(){super({id:_oe.ID,label:mf(0,"Toggle Tab Key Moves Focus"),alias:"Toggle Tab Key Moves Focus",precondition:void 0,kbOpts:{kbExpr:null,primary:2091,mac:{primary:1323},weight:100}})}run(e,t){const i=!Ux.getTabFocusMode();Ux.setTabFocusMode(i),dy(mf(0,i?"Pressing Tab will now move focus to the next focusable element":"Pressing Tab will now insert the tab character"))}}_oe.ID="editor.action.toggleTabFocusMode",Lx(_oe);var voe=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},boe=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};let woe=class extends Uo{constructor(e,t,i={},n){var o;super(),this._link=t,this._enabled=!0,this.el=$C(e,YC("a.monaco-link",{tabIndex:null!==(o=t.tabIndex)&&void 0!==o?o:0,href:t.href,title:t.title},t.label)),this.el.setAttribute("role","button");const s=this._register(new eB(this.el,"click")),r=this._register(new eB(this.el,"keypress")),a=ds.chain(r.event).map((e=>new jw(e))).filter((e=>3===e.keyCode)).event,l=this._register(new eB(this.el,iS.Tap)).event;this._register(oS.addTarget(this.el));const d=ds.any(s.event,a,l);this._register(d((e=>{this.enabled&&(HC(e,!0),(null==i?void 0:i.opener)?i.opener(this._link.href):n.open(this._link.href,{allowCommands:!0}))}))),this.enabled=!0}get enabled(){return this._enabled}set enabled(e){e?(this.el.setAttribute("aria-disabled","false"),this.el.tabIndex=0,this.el.style.pointerEvents="auto",this.el.style.opacity="1",this.el.style.cursor="pointer",this._enabled=!1):(this.el.setAttribute("aria-disabled","true"),this.el.tabIndex=-1,this.el.style.pointerEvents="none",this.el.style.opacity="0.4",this.el.style.cursor="default",this._enabled=!0),this._enabled=e}};woe=voe([boe(3,ij)],woe),sx(((e,t)=>{const i=e.getColor(SS);i&&t.addRule(`.monaco-link { color: ${i}; }`);const n=e.getColor(kS);n&&t.addRule(`.monaco-link:hover { color: ${n}; }`)}));var Coe=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},yoe=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};let xoe=class extends Uo{constructor(e,t){super(),this._editor=e,this.instantiationService=t,this.banner=this._register(this.instantiationService.createInstance(Soe))}hide(){this._editor.setBanner(null,0),this.banner.clear()}show(e){this.banner.show(Object.assign(Object.assign({},e),{onClose:()=>{this.hide(),e.onClose&&e.onClose()}})),this._editor.setBanner(this.banner.element,26)}};xoe=Coe([yoe(1,k_)],xoe);let Soe=class extends Uo{constructor(e){super(),this.instantiationService=e,this.markdownRenderer=this.instantiationService.createInstance(x5,{}),this.element=YC("div.editor-banner"),this.element.tabIndex=0}getAriaLabel(e){return e.ariaLabel?e.ariaLabel:"string"==typeof e.message?e.message:void 0}getBannerMessage(e){if("string"==typeof e){const t=YC("span");return t.innerText=e,t}return this.markdownRenderer.render(e).element}clear(){eC(this.element)}show(e){eC(this.element);const t=this.getAriaLabel(e);t&&this.element.setAttribute("aria-label",t);const i=$C(this.element,YC("div.icon-container"));i.setAttribute("aria-hidden","true"),e.icon&&i.appendChild(YC(`div${ex.asCSSSelector(e.icon)}`));const n=$C(this.element,YC("div.message-container"));if(n.setAttribute("aria-hidden","true"),n.appendChild(this.getBannerMessage(e.message)),this.messageActionsContainer=$C(this.element,YC("div.message-actions-container")),e.actions)for(const s of e.actions)this._register(this.instantiationService.createInstance(woe,this.messageActionsContainer,Object.assign(Object.assign({},s),{tabIndex:-1}),{}));const o=$C(this.element,YC("div.action-container"));this.actionBar=this._register(new vB(o)),this.actionBar.push(this._register(new my("banner.close","Close Banner",ex.asClassName(DB),!0,(()=>{"function"==typeof e.onClose&&e.onClose()}))),{icon:!0,label:!1}),this.actionBar.setFocusable(!1)}};Soe=Coe([yoe(0,k_)],Soe);var koe=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},Doe=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}},Loe=globalThis&&globalThis.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{l(n.next(e))}catch(t){s(t)}}function a(e){try{l(n.throw(e))}catch(t){s(t)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}l((n=n.apply(e,t||[])).next())}))};const Noe=CB("extensions-warning-message",br.warning,mf(0,"Icon shown with a warning message in the extensions editor."));let Eoe=class extends Uo{constructor(e,t,i,n){super(),this._editor=e,this._editorWorkerService=t,this._workspaceTrustService=i,this._highlighter=null,this._bannerClosed=!1,this._updateState=e=>{if(e&&e.hasMore){if(this._bannerClosed)return;const t=Math.max(e.ambiguousCharacterCount,e.nonBasicAsciiCharacterCount,e.invisibleCharacterCount);let i;if(e.nonBasicAsciiCharacterCount>=t)i={message:mf(0,"This document contains many non-basic ASCII unicode characters"),command:new zoe};else if(e.ambiguousCharacterCount>=t)i={message:mf(0,"This document contains many ambiguous unicode characters"),command:new Voe};else{if(!(e.invisibleCharacterCount>=t))throw new Error("Unreachable");i={message:mf(0,"This document contains many invisible unicode characters"),command:new Woe}}this._bannerController.show({id:"unicodeHighlightBanner",message:i.message,icon:Noe,actions:[{label:i.command.shortLabel,href:`command:${i.command.id}`}],onClose:()=>{this._bannerClosed=!0}})}else this._bannerController.hide()},this._bannerController=this._register(n.createInstance(xoe,e)),this._register(this._editor.onDidChangeModel((()=>{this._bannerClosed=!1,this._updateHighlighter()}))),this._options=e.getOption(113),this._register(i.onDidChangeTrust((e=>{this._updateHighlighter()}))),this._register(e.onDidChangeConfiguration((t=>{t.hasChanged(113)&&(this._options=e.getOption(113),this._updateHighlighter())}))),this._updateHighlighter()}dispose(){this._highlighter&&(this._highlighter.dispose(),this._highlighter=null),super.dispose()}_updateHighlighter(){if(this._updateState(null),this._highlighter&&(this._highlighter.dispose(),this._highlighter=null),!this._editor.hasModel())return;const e=function(e,t){return{nonBasicASCII:t.nonBasicASCII===Vf?!e:t.nonBasicASCII,ambiguousCharacters:t.ambiguousCharacters,invisibleCharacters:t.invisibleCharacters,includeComments:t.includeComments===Vf?!e:t.includeComments,includeStrings:t.includeStrings===Vf?!e:t.includeStrings,allowedCharacters:t.allowedCharacters,allowedLocales:t.allowedLocales}}(this._workspaceTrustService.isWorkspaceTrusted(),this._options);if([e.nonBasicASCII,e.ambiguousCharacters,e.invisibleCharacters].every((e=>!1===e)))return;const t={nonBasicASCII:e.nonBasicASCII,ambiguousCharacters:e.ambiguousCharacters,invisibleCharacters:e.invisibleCharacters,includeComments:e.includeComments,includeStrings:e.includeStrings,allowedCodePoints:Object.keys(e.allowedCharacters).map((e=>e.codePointAt(0))),allowedLocales:Object.keys(e.allowedLocales).map((e=>{if("_os"===e){return(new Intl.NumberFormat).resolvedOptions().locale}return"_vscode"===e?ed:e}))};this._editorWorkerService.canComputeUnicodeHighlights(this._editor.getModel().uri)?this._highlighter=new Ioe(this._editor,t,this._updateState,this._editorWorkerService):this._highlighter=new Toe(this._editor,t,this._updateState)}getDecorationInfo(e){return this._highlighter?this._highlighter.getDecorationInfo(e):null}};Eoe.ID="editor.contrib.unicodeHighlighter",Eoe=koe([Doe(1,BB),Doe(2,XW),Doe(3,k_)],Eoe);let Ioe=class extends Uo{constructor(e,t,i,n){super(),this._editor=e,this._options=t,this._updateState=i,this._editorWorkerService=n,this._model=this._editor.getModel(),this._decorationIds=new Set,this._updateSoon=this._register(new lb((()=>this._update()),250)),this._register(this._editor.onDidChangeModelContent((()=>{this._updateSoon.schedule()}))),this._updateSoon.schedule()}dispose(){this._decorationIds=new Set(this._model.deltaDecorations(Array.from(this._decorationIds),[])),super.dispose()}_update(){if(this._model.isDisposed())return;if(!this._model.mightContainNonBasicASCII())return void(this._decorationIds=new Set(this._editor.deltaDecorations(Array.from(this._decorationIds),[])));const e=this._model.getVersionId();this._editorWorkerService.computedUnicodeHighlights(this._model.uri,this._options).then((t=>{if(this._model.isDisposed())return;if(this._model.getVersionId()!==e)return;this._updateState(t);const i=[];if(!t.hasMore)for(const e of t.ranges)i.push({range:e,options:Poe.instance.getDecorationFromOptions(this._options)});this._decorationIds=new Set(this._editor.deltaDecorations(Array.from(this._decorationIds),i))}))}getDecorationInfo(e){if(!this._decorationIds.has(e))return null;const t=this._editor.getModel(),i=t.getDecorationRange(e),n={range:i,options:Poe.instance.getDecorationFromOptions(this._options),id:e,ownerId:0};if(!VA(t,n))return null;return{reason:Roe(t.getValueInRange(i),this._options),inComment:WA(t,n),inString:zA(t,n)}}};Ioe=koe([Doe(3,BB)],Ioe);class Toe extends Uo{constructor(e,t,i){super(),this._editor=e,this._options=t,this._updateState=i,this._model=this._editor.getModel(),this._decorationIds=new Set,this._updateSoon=this._register(new lb((()=>this._update()),250)),this._register(this._editor.onDidLayoutChange((()=>{this._updateSoon.schedule()}))),this._register(this._editor.onDidScrollChange((()=>{this._updateSoon.schedule()}))),this._register(this._editor.onDidChangeHiddenAreas((()=>{this._updateSoon.schedule()}))),this._register(this._editor.onDidChangeModelContent((()=>{this._updateSoon.schedule()}))),this._updateSoon.schedule()}dispose(){this._decorationIds=new Set(this._model.deltaDecorations(Array.from(this._decorationIds),[])),super.dispose()}_update(){if(this._model.isDisposed())return;if(!this._model.mightContainNonBasicASCII())return void(this._decorationIds=new Set(this._editor.deltaDecorations(Array.from(this._decorationIds),[])));const e=this._editor.getVisibleRanges(),t=[],i={ranges:[],ambiguousCharacterCount:0,invisibleCharacterCount:0,nonBasicAsciiCharacterCount:0,hasMore:!1};for(const n of e){const e=td.computeUnicodeHighlights(this._model,this._options,n);for(const t of e.ranges)i.ranges.push(t);i.ambiguousCharacterCount+=i.ambiguousCharacterCount,i.invisibleCharacterCount+=i.invisibleCharacterCount,i.nonBasicAsciiCharacterCount+=i.nonBasicAsciiCharacterCount,i.hasMore=i.hasMore||e.hasMore}if(!i.hasMore)for(const n of i.ranges)t.push({range:n,options:Poe.instance.getDecorationFromOptions(this._options)});this._updateState(i),this._decorationIds=new Set(this._editor.deltaDecorations(Array.from(this._decorationIds),t))}getDecorationInfo(e){if(!this._decorationIds.has(e))return null;const t=this._editor.getModel(),i=t.getDecorationRange(e),n=t.getValueInRange(i),o={range:i,options:Poe.instance.getDecorationFromOptions(this._options),id:e,ownerId:0};return VA(t,o)?{reason:Roe(n,this._options),inComment:WA(t,o),inString:zA(t,o)}:null}}let Moe=class{constructor(e,t,i){this._editor=e,this._languageService=t,this._openerService=i,this.hoverOrdinal=4}computeSync(e,t){if(!this._editor.hasModel()||1!==e.type)return[];const i=this._editor.getModel(),n=this._editor.getContribution(Eoe.ID);if(!n)return[];const o=[];let s=300;for(const r of t){const e=n.getDecorationInfo(r.id);if(!e)continue;const t=i.getValueInRange(r.range).codePointAt(0),a=Ooe(t);let l;switch(e.reason.kind){case 0:l=mf(0,"The character {0} could be confused with the character {1}, which is more common in source code.",a,Ooe(e.reason.confusableWith.codePointAt(0)));break;case 1:l=mf(0,"The character {0} is invisible.",a);break;case 2:l=mf(0,"The character {0} is not a basic ASCII character.",a)}const d={codePoint:t,reason:e.reason,inComment:e.inComment,inString:e.inString},c=[{value:`${l} [${mf(0,"Adjust settings")}](command:${Hoe.ID}?${encodeURIComponent(JSON.stringify(d))})`,isTrusted:!0}];o.push(new A5(this,r.range,c,s++))}return o}renderHoverParts(e,t){return R5(e,t,this._editor,this._languageService,this._openerService)}};function Aoe(e){return`U+${e.toString(16).padStart(4,"0")}`}function Ooe(e){let t=`\`${Aoe(e)}\``;return id.isInvisibleCharacter(e)||(t+=` "${function(e){if(96===e)return"`` ` ``";return"`"+String.fromCodePoint(e)+"`"}(e)}"`),t}function Roe(e,t){return td.computeUnicodeHighlightReason(e,t)}Moe=koe([Doe(1,Lv),Doe(2,ij)],Moe);class Poe{constructor(){this.map=new Map}getDecorationFromOptions(e){return this.getDecoration(!e.includeComments,!e.includeStrings)}getDecoration(e,t){const i=`${e}${t}`;let n=this.map.get(i);return n||(n=GP.createDynamic({description:"unicode-highlight",stickiness:1,className:"unicode-highlight",showIfCollapsed:!0,overviewRuler:null,minimap:null,hideInCommentTokens:e,hideInStringTokens:t}),this.map.set(i,n)),n}}Poe.instance=new Poe;class Foe extends xx{constructor(){super({id:Voe.ID,label:mf(0,"Disable highlighting of characters in comments"),alias:"Disable highlighting of characters in comments",precondition:void 0}),this.shortLabel=mf(0,"Disable Highlight In Comments")}run(e,t,i){return Loe(this,void 0,void 0,(function*(){let t=null==e?void 0:e.get(Cv);t&&this.runAction(t)}))}runAction(e){return Loe(this,void 0,void 0,(function*(){yield e.updateValue(Uf,!1,1)}))}}class Boe extends xx{constructor(){super({id:Voe.ID,label:mf(0,"Disable highlighting of characters in strings"),alias:"Disable highlighting of characters in strings",precondition:void 0}),this.shortLabel=mf(0,"Disable Highlight In Strings")}run(e,t,i){return Loe(this,void 0,void 0,(function*(){let t=null==e?void 0:e.get(Cv);t&&this.runAction(t)}))}runAction(e){return Loe(this,void 0,void 0,(function*(){yield e.updateValue($f,!1,1)}))}}class Voe extends xx{constructor(){super({id:Voe.ID,label:mf(0,"Disable highlighting of ambiguous characters"),alias:"Disable highlighting of ambiguous characters",precondition:void 0}),this.shortLabel=mf(0,"Disable Ambiguous Highlight")}run(e,t,i){return Loe(this,void 0,void 0,(function*(){let t=null==e?void 0:e.get(Cv);t&&this.runAction(t)}))}runAction(e){return Loe(this,void 0,void 0,(function*(){yield e.updateValue(jf,!1,1)}))}}Voe.ID="editor.action.unicodeHighlight.disableHighlightingOfAmbiguousCharacters";class Woe extends xx{constructor(){super({id:Woe.ID,label:mf(0,"Disable highlighting of invisible characters"),alias:"Disable highlighting of invisible characters",precondition:void 0}),this.shortLabel=mf(0,"Disable Invisible Highlight")}run(e,t,i){return Loe(this,void 0,void 0,(function*(){let t=null==e?void 0:e.get(Cv);t&&this.runAction(t)}))}runAction(e){return Loe(this,void 0,void 0,(function*(){yield e.updateValue(zf,!1,1)}))}}Woe.ID="editor.action.unicodeHighlight.disableHighlightingOfInvisibleCharacters";class zoe extends xx{constructor(){super({id:zoe.ID,label:mf(0,"Disable highlighting of non basic ASCII characters"),alias:"Disable highlighting of non basic ASCII characters",precondition:void 0}),this.shortLabel=mf(0,"Disable Non ASCII Highlight")}run(e,t,i){return Loe(this,void 0,void 0,(function*(){let t=null==e?void 0:e.get(Cv);t&&this.runAction(t)}))}runAction(e){return Loe(this,void 0,void 0,(function*(){yield e.updateValue(Hf,!1,1)}))}}zoe.ID="editor.action.unicodeHighlight.disableHighlightingOfNonBasicAsciiCharacters";class Hoe extends xx{constructor(){super({id:Hoe.ID,label:mf(0,"Show Exclude Options"),alias:"Show Exclude Options",precondition:void 0})}run(e,t,i){return Loe(this,void 0,void 0,(function*(){const{codePoint:t,reason:n,inString:o,inComment:s}=i,r=String.fromCodePoint(t),a=e.get(iG),l=e.get(Cv);const d=[];if(0===n.kind)for(const e of n.notAmbiguousInLocales)d.push({label:mf(0,'Allow unicode characters that are more common in the language "{0}".',e),run:()=>Loe(this,void 0,void 0,(function*(){joe(l,[e])}))});if(d.push({label:function(e){return id.isInvisibleCharacter(e)?mf(0,"Exclude {0} (invisible character) from being highlighted",Aoe(e)):mf(0,"Exclude {0} from being highlighted",`${Aoe(e)} "${r}"`)}(t),run:()=>function(e,t){return Loe(this,void 0,void 0,(function*(){const i=e.getValue(Wf);let n;n="object"==typeof i&&i?i:{};for(const e of t)n[String.fromCodePoint(e)]=!0;yield e.updateValue(Wf,n,1)}))}(l,[t])}),s){const e=new Foe;d.push({label:e.label,run:()=>Loe(this,void 0,void 0,(function*(){return e.runAction(l)}))})}else if(o){const e=new Boe;d.push({label:e.label,run:()=>Loe(this,void 0,void 0,(function*(){return e.runAction(l)}))})}if(0===n.kind){const e=new Voe;d.push({label:e.label,run:()=>Loe(this,void 0,void 0,(function*(){return e.runAction(l)}))})}else if(1===n.kind){const e=new Woe;d.push({label:e.label,run:()=>Loe(this,void 0,void 0,(function*(){return e.runAction(l)}))})}else if(2===n.kind){const e=new zoe;d.push({label:e.label,run:()=>Loe(this,void 0,void 0,(function*(){return e.runAction(l)}))})}else!function(e){throw new Error(`Unexpected value: ${e}`)}(n);const c=yield a.pick(d,{title:mf(0,"Configure Unicode Highlight Options")});c&&(yield c.run())}))}}function joe(e,t){var i;return Loe(this,void 0,void 0,(function*(){const n=null===(i=e.inspect(Kf).user)||void 0===i?void 0:i.value;let o;o="object"==typeof n&&n?Object.assign({},n):{};for(const e of t)o[e]=!0;yield e.updateValue(Kf,o,1)}))}Hoe.ID="editor.action.unicodeHighlight.showExcludeOptions",Lx(Voe),Lx(Woe),Lx(zoe),Lx(Hoe),Ix(Eoe.ID,Eoe),h2.register(Moe);var Uoe=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},$oe=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}},Koe=globalThis&&globalThis.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{l(n.next(e))}catch(t){s(t)}}function a(e){try{l(n.throw(e))}catch(t){s(t)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}l((n=n.apply(e,t||[])).next())}))};const qoe="ignoreUnusualLineTerminators";let Goe=class extends Uo{constructor(e,t,i){super(),this._editor=e,this._dialogService=t,this._codeEditorService=i,this._config=this._editor.getOption(114),this._register(this._editor.onDidChangeConfiguration((e=>{e.hasChanged(114)&&(this._config=this._editor.getOption(114),this._checkForUnusualLineTerminators())}))),this._register(this._editor.onDidChangeModel((()=>{this._checkForUnusualLineTerminators()}))),this._register(this._editor.onDidChangeModelContent((e=>{e.isUndoing||this._checkForUnusualLineTerminators()})))}_checkForUnusualLineTerminators(){return Koe(this,void 0,void 0,(function*(){if("off"===this._config)return;if(!this._editor.hasModel())return;const e=this._editor.getModel();if(!e.mightContainUnusualLineTerminators())return;const t=function(e,t){return e.getModelProperty(t.uri,qoe)}(this._codeEditorService,e);if(!0===t)return;if(this._editor.getOption(81))return;if("auto"===this._config)return void e.removeUnusualLineTerminators(this._editor.getSelections());(yield this._dialogService.confirm({title:mf(0,"Unusual Line Terminators"),message:mf(0,"Detected unusual line terminators"),detail:mf(0,"The file '{0}' contains one or more unusual line terminator characters, like Line Separator (LS) or Paragraph Separator (PS).\n\nIt is recommended to remove them from the file. This can be configured via `editor.unusualLineTerminators`.",oR(e.uri)),primaryButton:mf(0,"Remove Unusual Line Terminators"),secondaryButton:mf(0,"Ignore")})).confirmed?e.removeUnusualLineTerminators(this._editor.getSelections()):function(e,t,i){e.setModelProperty(t.uri,qoe,i)}(this._codeEditorService,e,!0)}))}};Goe.ID="editor.contrib.unusualLineTerminatorsDetector",Goe=Uoe([$oe(1,DV),$oe(2,N_)],Goe),Ix(Goe.ID,Goe);var Zoe=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},Yoe=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};let Xoe=class extends Uo{constructor(e,t,i,n,o,s){super(),this._modelService=t,this._themeService=i,this._configurationService=n,this._editor=e,this._provider=s.documentRangeSemanticTokensProvider,this._debounceInformation=o.for(this._provider,"DocumentRangeSemanticTokens",{min:100,max:500}),this._tokenizeViewport=this._register(new lb((()=>this._tokenizeViewportNow()),100)),this._outstandingRequests=[];const r=()=>{this._editor.hasModel()&&this._tokenizeViewport.schedule(this._debounceInformation.get(this._editor.getModel()))};this._register(this._editor.onDidScrollChange((()=>{r()}))),this._register(this._editor.onDidChangeModel((()=>{this._cancelAll(),r()}))),this._register(this._editor.onDidChangeModelContent((e=>{this._cancelAll(),r()}))),this._register(this._provider.onDidChange((()=>{this._cancelAll(),r()}))),this._register(this._configurationService.onDidChangeConfiguration((e=>{e.affectsConfiguration(Kj)&&(this._cancelAll(),r())}))),this._register(this._themeService.onDidColorThemeChange((()=>{this._cancelAll(),r()})))}_cancelAll(){for(const e of this._outstandingRequests)e.cancel();this._outstandingRequests=[]}_removeOutstandingRequest(e){for(let t=0,i=this._outstandingRequests.length;t<i;t++)if(this._outstandingRequests[t]===e)return void this._outstandingRequests.splice(t,1)}_tokenizeViewportNow(){if(!this._editor.hasModel())return;const e=this._editor.getModel();if(e.hasCompleteSemanticTokens())return;if(!qj(e,this._themeService,this._configurationService))return void(e.hasSomeSemanticTokens()&&e.setSemanticTokens(null,!1));if(!function(e,t){return e.has(t)}(this._provider,e))return void(e.hasSomeSemanticTokens()&&e.setSemanticTokens(null,!1));const t=this._editor.getVisibleRangesPlusViewportAboveBelow();this._outstandingRequests=this._outstandingRequests.concat(t.map((t=>this._requestRange(e,t))))}_requestRange(e,t){const i=e.getVersionId(),n=Xv((i=>Promise.resolve(Fj(this._provider,e,t,i)))),o=new ps(!1);return n.then((n=>{if(this._debounceInformation.update(e,o.elapsed()),!n||!n.tokens||e.isDisposed()||e.getVersionId()!==i)return;const{provider:s,tokens:r}=n,a=this._modelService.getSemanticTokensProviderStyling(s);e.setPartialSemanticTokens(t,kj(r,a,e.getLanguageId()))})).then((()=>this._removeOutstandingRequest(n)),(()=>this._removeOutstandingRequest(n))),n}};Xoe.ID="editor.contrib.viewportSemanticTokens",Xoe=Zoe([Yoe(1,Gv),Yoe(2,Qy),Yoe(3,Cv),Yoe(4,oW),Yoe(5,Lb)],Xoe),Ix(Xoe.ID,Xoe);var Qoe=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},Joe=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};const ese=_S("editor.wordHighlightBackground",{dark:"#575757B8",light:"#57575740",hc:null},mf(0,"Background color of a symbol during read-access, like reading a variable. The color must not be opaque so as not to hide underlying decorations."),!0),tse=_S("editor.wordHighlightStrongBackground",{dark:"#004972B8",light:"#0e639c40",hc:null},mf(0,"Background color of a symbol during write-access, like writing to a variable. The color must not be opaque so as not to hide underlying decorations."),!0),ise=_S("editor.wordHighlightBorder",{light:null,dark:null,hc:xS},mf(0,"Border color of a symbol during read-access, like reading a variable.")),nse=_S("editor.wordHighlightStrongBorder",{light:null,dark:null,hc:xS},mf(0,"Border color of a symbol during write-access, like writing to a variable.")),ose=_S("editorOverviewRuler.wordHighlightForeground",{dark:"#A0A0A0CC",light:"#A0A0A0CC",hc:"#A0A0A0CC"},mf(0,"Overview ruler marker color for symbol highlights. The color must not be opaque so as not to hide underlying decorations."),!0),sse=_S("editorOverviewRuler.wordHighlightStrongForeground",{dark:"#C0A0C0CC",light:"#C0A0C0CC",hc:"#C0A0C0CC"},mf(0,"Overview ruler marker color for write-access symbol highlights. The color must not be opaque so as not to hide underlying decorations."),!0),rse=new Uy("hasWordHighlights",!1);function ase(e,t,i,n){return sb(e.ordered(t).map((e=>()=>Promise.resolve(e.provideDocumentHighlights(t,i,n)).then(void 0,Ta))),gs)}class lse{constructor(e,t,i){this._model=e,this._selection=t,this._wordSeparators=i,this._wordRange=this._getCurrentWordRange(e,t),this._result=null}get result(){return this._result||(this._result=Xv((e=>this._compute(this._model,this._selection,this._wordSeparators,e)))),this._result}_getCurrentWordRange(e,t){const i=e.getWordAtPosition(t.getPosition());return i?new qo(t.startLineNumber,i.startColumn,t.startLineNumber,i.endColumn):null}isValid(e,t,i){const n=t.startLineNumber,o=t.startColumn,s=t.endColumn,r=this._getCurrentWordRange(e,t);let a=Boolean(this._wordRange&&this._wordRange.equalsRange(r));for(let l=0,d=i.length;!a&&l<d;l++){let t=e.getDecorationRange(i[l]);t&&t.startLineNumber===n&&t.startColumn<=o&&t.endColumn>=s&&(a=!0)}return a}cancel(){this.result.cancel()}}class dse extends lse{constructor(e,t,i,n){super(e,t,i),this._providers=n}_compute(e,t,i,n){return ase(this._providers,e,t.getPosition(),n).then((e=>e||[]))}}class cse extends lse{constructor(e,t,i){super(e,t,i),this._selectionIsEmpty=t.isEmpty()}_compute(e,t,i,n){return nb(250,n).then((()=>{if(!t.isEmpty())return[];const n=e.getWordAtPosition(t.getPosition());if(!n||n.word.length>1e3)return[];return e.findMatches(n.word,!0,!1,!0,i,!1).map((e=>({range:e.range,kind:nd.Text})))}))}isValid(e,t,i){const n=t.isEmpty();return this._selectionIsEmpty===n&&super.isValid(e,t,i)}}kx("_executeDocumentHighlights",((e,t,i)=>ase(e.get(Lb).documentHighlightProvider,t,i,Ia.None)));class hse{constructor(e,t,i){this.toUnhook=new ws,this.workerRequestTokenId=0,this.workerRequestCompleted=!1,this.workerRequestValue=[],this.lastCursorPositionChangeTime=0,this.renderDecorationsTimer=-1,this.editor=e,this.providers=t,this._hasWordHighlights=rse.bindTo(i),this._ignorePositionChangeEvent=!1,this.occurrencesHighlight=this.editor.getOption(72),this.model=this.editor.getModel(),this.toUnhook.add(e.onDidChangeCursorPosition((e=>{this._ignorePositionChangeEvent||this.occurrencesHighlight&&this._onPositionChanged(e)}))),this.toUnhook.add(e.onDidChangeModelContent((e=>{this._stopAll()}))),this.toUnhook.add(e.onDidChangeConfiguration((e=>{let t=this.editor.getOption(72);this.occurrencesHighlight!==t&&(this.occurrencesHighlight=t,this._stopAll())}))),this._decorationIds=[],this.workerRequestTokenId=0,this.workerRequest=null,this.workerRequestCompleted=!1,this.lastCursorPositionChangeTime=0,this.renderDecorationsTimer=-1}hasDecorations(){return this._decorationIds.length>0}restore(){this.occurrencesHighlight&&this._run()}_getSortedHighlights(){return Sa(this._decorationIds.map((e=>this.model.getDecorationRange(e))).sort(qo.compareRangesUsingStarts))}moveNext(){let e=this._getSortedHighlights(),t=e.findIndex((e=>e.containsPosition(this.editor.getPosition()))),i=(t+1)%e.length,n=e[i];try{this._ignorePositionChangeEvent=!0,this.editor.setPosition(n.getStartPosition()),this.editor.revealRangeInCenterIfOutsideViewport(n);const t=this._getWord();if(t){dy(`${this.editor.getModel().getLineContent(n.startLineNumber)}, ${i+1} of ${e.length} for '${t.word}'`)}}finally{this._ignorePositionChangeEvent=!1}}moveBack(){let e=this._getSortedHighlights(),t=e.findIndex((e=>e.containsPosition(this.editor.getPosition()))),i=(t-1+e.length)%e.length,n=e[i];try{this._ignorePositionChangeEvent=!0,this.editor.setPosition(n.getStartPosition()),this.editor.revealRangeInCenterIfOutsideViewport(n);const t=this._getWord();if(t){dy(`${this.editor.getModel().getLineContent(n.startLineNumber)}, ${i+1} of ${e.length} for '${t.word}'`)}}finally{this._ignorePositionChangeEvent=!1}}_removeDecorations(){this._decorationIds.length>0&&(this._decorationIds=this.editor.deltaDecorations(this._decorationIds,[]),this._hasWordHighlights.set(!1))}_stopAll(){this._removeDecorations(),-1!==this.renderDecorationsTimer&&(clearTimeout(this.renderDecorationsTimer),this.renderDecorationsTimer=-1),null!==this.workerRequest&&(this.workerRequest.cancel(),this.workerRequest=null),this.workerRequestCompleted||(this.workerRequestTokenId++,this.workerRequestCompleted=!0)}_onPositionChanged(e){this.occurrencesHighlight&&3===e.reason?this._run():this._stopAll()}_getWord(){let e=this.editor.getSelection(),t=e.startLineNumber,i=e.startColumn;return this.model.getWordAtPosition({lineNumber:t,column:i})}_run(){let e=this.editor.getSelection();if(e.startLineNumber!==e.endLineNumber)return void this._stopAll();let t=e.startColumn,i=e.endColumn;const n=this._getWord();if(!n||n.startColumn>t||n.endColumn<i)return void this._stopAll();const o=this.workerRequest&&this.workerRequest.isValid(this.model,e,this._decorationIds);if(this.lastCursorPositionChangeTime=(new Date).getTime(),o)this.workerRequestCompleted&&-1!==this.renderDecorationsTimer&&(clearTimeout(this.renderDecorationsTimer),this.renderDecorationsTimer=-1,this._beginRenderDecorations());else{this._stopAll();let e=++this.workerRequestTokenId;this.workerRequestCompleted=!1,this.workerRequest=function(e,t,i,n){return e.has(t)?new dse(t,i,n,e):new cse(t,i,n)}(this.providers,this.model,this.editor.getSelection(),this.editor.getOption(117)),this.workerRequest.result.then((t=>{e===this.workerRequestTokenId&&(this.workerRequestCompleted=!0,this.workerRequestValue=t||[],this._beginRenderDecorations())}),Jo)}}_beginRenderDecorations(){let e=(new Date).getTime(),t=this.lastCursorPositionChangeTime+250;e>=t?(this.renderDecorationsTimer=-1,this.renderDecorations()):this.renderDecorationsTimer=setTimeout((()=>{this.renderDecorations()}),t-e)}renderDecorations(){this.renderDecorationsTimer=-1;let e=[];for(const t of this.workerRequestValue)t.range&&e.push({range:t.range,options:hse._getDecorationOptions(t.kind)});this._decorationIds=this.editor.deltaDecorations(this._decorationIds,e),this._hasWordHighlights.set(this.hasDecorations())}static _getDecorationOptions(e){return e===nd.Write?this._WRITE_OPTIONS:e===nd.Text?this._TEXT_OPTIONS:this._REGULAR_OPTIONS}dispose(){this._stopAll(),this.toUnhook.dispose()}}hse._WRITE_OPTIONS=GP.register({description:"word-highlight-strong",stickiness:1,className:"wordHighlightStrong",overviewRuler:{color:tx(sse),position:aa.Center},minimap:{color:tx(lL),position:Dr.Inline}}),hse._TEXT_OPTIONS=GP.register({description:"selection-highlight",stickiness:1,className:"selectionHighlight",overviewRuler:{color:tx(rL),position:aa.Center},minimap:{color:tx(lL),position:Dr.Inline}}),hse._REGULAR_OPTIONS=GP.register({description:"word-highlight",stickiness:1,className:"wordHighlight",overviewRuler:{color:tx(ose),position:aa.Center},minimap:{color:tx(lL),position:Dr.Inline}});let use=class e extends Uo{constructor(e,t,i){super(),this.wordHighlighter=null;const n=()=>{e.hasModel()&&(this.wordHighlighter=new hse(e,i.documentHighlightProvider,t))};this._register(e.onDidChangeModel((e=>{this.wordHighlighter&&(this.wordHighlighter.dispose(),this.wordHighlighter=null),n()}))),n()}static get(t){return t.getContribution(e.ID)}saveViewState(){return!(!this.wordHighlighter||!this.wordHighlighter.hasDecorations())}moveNext(){this.wordHighlighter&&this.wordHighlighter.moveNext()}moveBack(){this.wordHighlighter&&this.wordHighlighter.moveBack()}restoreViewState(e){this.wordHighlighter&&e&&this.wordHighlighter.restore()}dispose(){this.wordHighlighter&&(this.wordHighlighter.dispose(),this.wordHighlighter=null),super.dispose()}};use.ID="editor.contrib.wordHighlighter",use=Qoe([Joe(1,$y),Joe(2,Lb)],use);class gse extends xx{constructor(e,t){super(t),this._isNext=e}run(e,t){const i=use.get(t);i&&(this._isNext?i.moveNext():i.moveBack())}}Ix(use.ID,use),Lx(class extends gse{constructor(){super(!0,{id:"editor.action.wordHighlight.next",label:mf(0,"Go to Next Symbol Highlight"),alias:"Go to Next Symbol Highlight",precondition:rse,kbOpts:{kbExpr:yI.editorTextFocus,primary:65,weight:100}})}}),Lx(class extends gse{constructor(){super(!1,{id:"editor.action.wordHighlight.prev",label:mf(0,"Go to Previous Symbol Highlight"),alias:"Go to Previous Symbol Highlight",precondition:rse,kbOpts:{kbExpr:yI.editorTextFocus,primary:1089,weight:100}})}}),Lx(class extends xx{constructor(){super({id:"editor.action.wordHighlight.trigger",label:mf(0,"Trigger Symbol Highlight"),alias:"Trigger Symbol Highlight",precondition:rse.toNegated(),kbOpts:{kbExpr:yI.editorTextFocus,primary:0,weight:100}})}run(e,t,i){const n=use.get(t);n&&n.restoreViewState(!0)}}),sx(((e,t)=>{const i=e.getColor(Mk);i&&(t.addRule(`.monaco-editor .focused .selectionHighlight { background-color: ${i}; }`),t.addRule(`.monaco-editor .selectionHighlight { background-color: ${i.transparent(.5)}; }`));const n=e.getColor(ese);n&&t.addRule(`.monaco-editor .wordHighlight { background-color: ${n}; }`);const o=e.getColor(tse);o&&t.addRule(`.monaco-editor .wordHighlightStrong { background-color: ${o}; }`);const s=e.getColor(Ak);s&&t.addRule(`.monaco-editor .selectionHighlight { border: 1px ${"hc"===e.type?"dotted":"solid"} ${s}; box-sizing: border-box; }`);const r=e.getColor(ise);r&&t.addRule(`.monaco-editor .wordHighlight { border: 1px ${"hc"===e.type?"dashed":"solid"} ${r}; box-sizing: border-box; }`);const a=e.getColor(nse);a&&t.addRule(`.monaco-editor .wordHighlightStrong { border: 1px ${"hc"===e.type?"dashed":"solid"} ${a}; box-sizing: border-box; }`)}));class pse extends yx{constructor(e){super(e),this._inSelectionMode=e.inSelectionMode,this._wordNavigationType=e.wordNavigationType}runEditorCommand(e,t,i){if(!t.hasModel())return;const n=cr(t.getOption(117)),o=t.getModel(),s=t.getSelections().map((e=>{const t=new er(e.positionLineNumber,e.positionColumn),i=this._move(n,o,t,this._wordNavigationType);return this._moveTo(e,i,this._inSelectionMode)}));if(o.pushStackElement(),t._getViewModel().setCursorStates("moveWordCommand",3,s.map((e=>KE.fromModelSelection(e)))),1===s.length){const e=new er(s[0].positionLineNumber,s[0].positionColumn);t.revealPosition(e,0)}}_moveTo(e,t,i){return i?new ar(e.selectionStartLineNumber,e.selectionStartColumn,t.lineNumber,t.column):new ar(t.lineNumber,t.column,t.lineNumber,t.column)}}class mse extends pse{_move(e,t,i,n){return aI.moveWordLeft(e,t,i,n)}}class fse extends pse{_move(e,t,i,n){return aI.moveWordRight(e,t,i,n)}}class _se extends yx{constructor(e){super(e),this._whitespaceHeuristics=e.whitespaceHeuristics,this._wordNavigationType=e.wordNavigationType}runEditorCommand(e,t,i){const n=e.get(Rv);if(!t.hasModel())return;const o=cr(t.getOption(117)),s=t.getModel(),r=t.getSelections(),a=t.getOption(5),l=t.getOption(8),d=n.getLanguageConfiguration(s.getLanguageId()).getAutoClosingPairs(),c=t._getViewModel(),h=r.map((e=>{const i=this._delete({wordSeparators:o,model:s,selection:e,whitespaceHeuristics:this._whitespaceHeuristics,autoClosingDelete:t.getOption(6),autoClosingBrackets:a,autoClosingQuotes:l,autoClosingPairs:d,autoClosedCharacters:c.getCursorAutoClosedCharacters()},this._wordNavigationType);return new JE(i,"")}));t.pushUndoStop(),t.executeCommands(this.id,h),t.pushUndoStop()}}class vse extends _se{_delete(e,t){let i=aI.deleteWordLeft(e,t);return i||new qo(1,1,1,1)}}class bse extends _se{_delete(e,t){let i=aI.deleteWordRight(e,t);if(i)return i;const n=e.model.getLineCount(),o=e.model.getLineMaxColumn(n);return new qo(n,o,n,o)}}Dx(new class extends mse{constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:"cursorWordStartLeft",precondition:void 0})}}),Dx(new class extends mse{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordEndLeft",precondition:void 0})}}),Dx(new class extends mse{constructor(){var e;super({inSelectionMode:!1,wordNavigationType:1,id:"cursorWordLeft",precondition:void 0,kbOpts:{kbExpr:Sy.and(yI.textInputFocus,null===(e=Sy.and(Kx,rq))||void 0===e?void 0:e.negate()),primary:2063,mac:{primary:527},weight:100}})}}),Dx(new class extends mse{constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:"cursorWordStartLeftSelect",precondition:void 0})}}),Dx(new class extends mse{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordEndLeftSelect",precondition:void 0})}}),Dx(new class extends mse{constructor(){var e;super({inSelectionMode:!0,wordNavigationType:1,id:"cursorWordLeftSelect",precondition:void 0,kbOpts:{kbExpr:Sy.and(yI.textInputFocus,null===(e=Sy.and(Kx,rq))||void 0===e?void 0:e.negate()),primary:3087,mac:{primary:1551},weight:100}})}}),Dx(new class extends fse{constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:"cursorWordStartRight",precondition:void 0})}}),Dx(new class extends fse{constructor(){var e;super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordEndRight",precondition:void 0,kbOpts:{kbExpr:Sy.and(yI.textInputFocus,null===(e=Sy.and(Kx,rq))||void 0===e?void 0:e.negate()),primary:2065,mac:{primary:529},weight:100}})}}),Dx(new class extends fse{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordRight",precondition:void 0})}}),Dx(new class extends fse{constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:"cursorWordStartRightSelect",precondition:void 0})}}),Dx(new class extends fse{constructor(){var e;super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordEndRightSelect",precondition:void 0,kbOpts:{kbExpr:Sy.and(yI.textInputFocus,null===(e=Sy.and(Kx,rq))||void 0===e?void 0:e.negate()),primary:3089,mac:{primary:1553},weight:100}})}}),Dx(new class extends fse{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordRightSelect",precondition:void 0})}}),Dx(new class extends mse{constructor(){super({inSelectionMode:!1,wordNavigationType:3,id:"cursorWordAccessibilityLeft",precondition:void 0})}_move(e,t,i,n){return super._move(cr(Xf.wordSeparators.defaultValue),t,i,n)}}),Dx(new class extends mse{constructor(){super({inSelectionMode:!0,wordNavigationType:3,id:"cursorWordAccessibilityLeftSelect",precondition:void 0})}_move(e,t,i,n){return super._move(cr(Xf.wordSeparators.defaultValue),t,i,n)}}),Dx(new class extends fse{constructor(){super({inSelectionMode:!1,wordNavigationType:3,id:"cursorWordAccessibilityRight",precondition:void 0})}_move(e,t,i,n){return super._move(cr(Xf.wordSeparators.defaultValue),t,i,n)}}),Dx(new class extends fse{constructor(){super({inSelectionMode:!0,wordNavigationType:3,id:"cursorWordAccessibilityRightSelect",precondition:void 0})}_move(e,t,i,n){return super._move(cr(Xf.wordSeparators.defaultValue),t,i,n)}}),Dx(new class extends vse{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:0,id:"deleteWordStartLeft",precondition:yI.writable})}}),Dx(new class extends vse{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:2,id:"deleteWordEndLeft",precondition:yI.writable})}}),Dx(new class extends vse{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:0,id:"deleteWordLeft",precondition:yI.writable,kbOpts:{kbExpr:yI.textInputFocus,primary:2049,mac:{primary:513},weight:100}})}}),Dx(new class extends bse{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:0,id:"deleteWordStartRight",precondition:yI.writable})}}),Dx(new class extends bse{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:2,id:"deleteWordEndRight",precondition:yI.writable})}}),Dx(new class extends bse{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:2,id:"deleteWordRight",precondition:yI.writable,kbOpts:{kbExpr:yI.textInputFocus,primary:2068,mac:{primary:532},weight:100}})}}),Lx(class extends xx{constructor(){super({id:"deleteInsideWord",precondition:yI.writable,label:mf(0,"Delete Word"),alias:"Delete Word"})}run(e,t,i){if(!t.hasModel())return;const n=cr(t.getOption(117)),o=t.getModel(),s=t.getSelections().map((e=>{const t=aI.deleteInsideWord(n,o,e);return new JE(t,"")}));t.pushUndoStop(),t.executeCommands(this.id,s),t.pushUndoStop()}});class wse extends pse{_move(e,t,i,n){return lI.moveWordPartLeft(e,t,i)}}Cy.registerCommandAlias("cursorWordPartStartLeft","cursorWordPartLeft");Cy.registerCommandAlias("cursorWordPartStartLeftSelect","cursorWordPartLeftSelect");class Cse extends pse{_move(e,t,i,n){return lI.moveWordPartRight(e,t,i)}}Dx(new class extends _se{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:0,id:"deleteWordPartLeft",precondition:yI.writable,kbOpts:{kbExpr:yI.textInputFocus,primary:0,mac:{primary:769},weight:100}})}_delete(e,t){let i=lI.deleteWordPartLeft(e);return i||new qo(1,1,1,1)}}),Dx(new class extends _se{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:2,id:"deleteWordPartRight",precondition:yI.writable,kbOpts:{kbExpr:yI.textInputFocus,primary:0,mac:{primary:788},weight:100}})}_delete(e,t){let i=lI.deleteWordPartRight(e);if(i)return i;const n=e.model.getLineCount(),o=e.model.getLineMaxColumn(n);return new qo(n,o,n,o)}}),Dx(new class extends wse{constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:"cursorWordPartLeft",precondition:void 0,kbOpts:{kbExpr:yI.textInputFocus,primary:0,mac:{primary:783},weight:100}})}}),Dx(new class extends wse{constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:"cursorWordPartLeftSelect",precondition:void 0,kbOpts:{kbExpr:yI.textInputFocus,primary:0,mac:{primary:1807},weight:100}})}}),Dx(new class extends Cse{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordPartRight",precondition:void 0,kbOpts:{kbExpr:yI.textInputFocus,primary:0,mac:{primary:785},weight:100}})}}),Dx(new class extends Cse{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordPartRightSelect",precondition:void 0,kbOpts:{kbExpr:yI.textInputFocus,primary:0,mac:{primary:1809},weight:100}})}});var yse=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},xse=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};const Sse=new Uy("accessibilityHelpWidgetVisible",!1);let kse=class e extends Uo{constructor(e,t){super(),this._editor=e,this._widget=this._register(t.createInstance(Dse,this._editor))}static get(t){return t.getContribution(e.ID)}show(){this._widget.show()}hide(){this._widget.hide()}};kse.ID="editor.contrib.accessibilityHelpController",kse=yse([xse(1,k_)],kse);let Dse=class e extends QI{constructor(e,t,i,n){super(),this._contextKeyService=t,this._keybindingService=i,this._openerService=n,this._editor=e,this._isVisibleKey=Sse.bindTo(this._contextKeyService),this._domNode=p_(document.createElement("div")),this._domNode.setClassName("accessibilityHelpWidget"),this._domNode.setDisplay("none"),this._domNode.setAttribute("role","dialog"),this._domNode.setAttribute("aria-hidden","true"),this._contentDomNode=p_(document.createElement("div")),this._contentDomNode.setAttribute("role","document"),this._domNode.appendChild(this._contentDomNode),this._isVisible=!1,this._register(this._editor.onDidLayoutChange((()=>{this._isVisible&&this._layout()}))),this._register(sC(this._contentDomNode.domNode,"keydown",(e=>{if(this._isVisible&&(e.equals(2083)&&(dy(HW.emergencyConfOn),this._editor.updateOptions({accessibilitySupport:"on"}),eC(this._contentDomNode.domNode),this._buildContent(),this._contentDomNode.domNode.focus(),e.preventDefault(),e.stopPropagation()),e.equals(2086))){dy(HW.openingDocs);let t=this._editor.getRawOptions().accessibilityHelpUrl;void 0===t&&(t="https://go.microsoft.com/fwlink/?linkid=852450"),this._openerService.open(Ps.parse(t)),e.preventDefault(),e.stopPropagation()}}))),this.onblur(this._contentDomNode.domNode,(()=>{this.hide()})),this._editor.addOverlayWidget(this)}dispose(){this._editor.removeOverlayWidget(this),super.dispose()}getId(){return e.ID}getDomNode(){return this._domNode.domNode}getPosition(){return{preference:null}}show(){this._isVisible||(this._isVisible=!0,this._isVisibleKey.set(!0),this._layout(),this._domNode.setDisplay("block"),this._domNode.setAttribute("aria-hidden","false"),this._contentDomNode.domNode.tabIndex=0,this._buildContent(),this._contentDomNode.domNode.focus())}_descriptionForCommand(e,t,i){const n=this._keybindingService.lookupKeybinding(e);return n?Aa(t,n.getAriaLabel()):Aa(i,e)}_buildContent(){const e=this._editor.getOptions(),t=this._editor.getSelections();let i=0;if(t){const e=this._editor.getModel();e&&t.forEach((t=>{i+=e.getValueLengthInRange(t)}))}let n=function(e,t){return e&&0!==e.length?1===e.length?t?Aa(HW.singleSelectionRange,e[0].positionLineNumber,e[0].positionColumn,t):Aa(HW.singleSelection,e[0].positionLineNumber,e[0].positionColumn):t?Aa(HW.multiSelectionRange,e.length,t):e.length>0?Aa(HW.multiSelection,e.length):"":HW.noSelection}(t,i);e.get(54)?e.get(81)?n+=HW.readonlyDiffEditor:n+=HW.editableDiffEditor:e.get(81)?n+=HW.readonlyEditor:n+=HW.editableEditor;const o=zo?HW.changeConfigToOnMac:HW.changeConfigToOnWinLinux;switch(e.get(2)){case 0:n+="\n\n - "+o;break;case 2:n+="\n\n - "+HW.auto_on;break;case 1:n+="\n\n - "+HW.auto_off,n+=" "+o}e.get(130)?n+="\n\n - "+this._descriptionForCommand(_oe.ID,HW.tabFocusModeOnMsg,HW.tabFocusModeOnMsgNoKb):n+="\n\n - "+this._descriptionForCommand(_oe.ID,HW.tabFocusModeOffMsg,HW.tabFocusModeOffMsgNoKb);n+="\n\n - "+(zo?HW.openDocMac:HW.openDocWinLinux),n+="\n\n"+HW.outroMsg,this._contentDomNode.domNode.appendChild(wU(n)),this._contentDomNode.domNode.setAttribute("aria-label",n)}hide(){this._isVisible&&(this._isVisible=!1,this._isVisibleKey.reset(),this._domNode.setDisplay("none"),this._domNode.setAttribute("aria-hidden","true"),this._contentDomNode.domNode.tabIndex=-1,eC(this._contentDomNode.domNode),this._editor.focus())}_layout(){const t=this._editor.getLayoutInfo(),i=Math.max(5,Math.min(e.WIDTH,t.width-40)),n=Math.max(5,Math.min(e.HEIGHT,t.height-40));this._domNode.setWidth(i),this._domNode.setHeight(n);const o=Math.round((t.height-n)/2);this._domNode.setTop(o);const s=Math.round((t.width-i)/2);this._domNode.setLeft(s)}};Dse.ID="editor.contrib.accessibilityHelpWidget",Dse.WIDTH=500,Dse.HEIGHT=300,Dse=yse([xse(1,$y),xse(2,kW),xse(3,ij)],Dse);Ix(kse.ID,kse),Lx(class extends xx{constructor(){super({id:"editor.action.showAccessibilityHelp",label:HW.showAccessibilityHelpAction,alias:"Show Accessibility Help",precondition:void 0,kbOpts:{primary:571,weight:100,linux:{primary:1595,secondary:[571]}}})}run(e,t){const i=kse.get(t);i&&i.show()}});Dx(new(yx.bindToContribution(kse.get))({id:"closeAccessibilityHelp",precondition:Sse,handler:e=>e.hide(),kbOpts:{weight:200,kbExpr:yI.focus,primary:9,secondary:[1033]}})),sx(((e,t)=>{const i=e.getColor(fk);i&&t.addRule(`.monaco-editor .accessibilityHelpWidget { background-color: ${i}; }`);const n=e.getColor(_k);n&&t.addRule(`.monaco-editor .accessibilityHelpWidget { color: ${n}; }`);const o=e.getColor(LS);o&&t.addRule(`.monaco-editor .accessibilityHelpWidget { box-shadow: 0 2px 8px ${o}; }`);const s=e.getColor(yS);s&&t.addRule(`.monaco-editor .accessibilityHelpWidget { border: 2px solid ${s}; }`)}));class Lse extends Uo{constructor(e){super(),this.editor=e,this.widget=null,Vs&&(this._register(e.onDidChangeConfiguration((()=>this.update()))),this.update())}update(){const e=!this.editor.getOption(81);!this.widget&&e?this.widget=new Nse(this.editor):this.widget&&!e&&(this.widget.dispose(),this.widget=null)}dispose(){super.dispose(),this.widget&&(this.widget.dispose(),this.widget=null)}}Lse.ID="editor.contrib.iPadShowKeyboard";class Nse extends Uo{constructor(e){super(),this.editor=e,this._domNode=document.createElement("textarea"),this._domNode.className="iPadShowKeyboard",this._register(nC(this._domNode,"touchstart",(e=>{this.editor.focus()}))),this._register(nC(this._domNode,"focus",(e=>{this.editor.focus()}))),this.editor.addOverlayWidget(this)}dispose(){this.editor.removeOverlayWidget(this),super.dispose()}getId(){return Nse.ID}getDomNode(){return this._domNode}getPosition(){return{preference:1}}}Nse.ID="editor.contrib.ShowKeyboardWidget",Ix(Lse.ID,Lse);var Ese=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},Ise=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};let Tse=class e extends Uo{constructor(e,t,i){super(),this._editor=e,this._languageService=i,this._widget=null,this._register(this._editor.onDidChangeModel((e=>this.stop()))),this._register(this._editor.onDidChangeModelLanguage((e=>this.stop()))),this._register(Ns.onDidChange((e=>this.stop()))),this._register(this._editor.onKeyUp((e=>9===e.keyCode&&this.stop())))}static get(t){return t.getContribution(e.ID)}dispose(){this.stop(),super.dispose()}launch(){this._widget||this._editor.hasModel()&&(this._widget=new Mse(this._editor,this._languageService))}stop(){this._widget&&(this._widget.dispose(),this._widget=null)}};Tse.ID="editor.contrib.inspectTokens",Tse=Ese([Ise(1,RG),Ise(2,Lv)],Tse);class Mse extends Uo{constructor(e,t){super(),this.allowEditorOverflow=!0,this._editor=e,this._languageService=t,this._model=this._editor.getModel(),this._domNode=document.createElement("div"),this._domNode.className="tokens-inspect-widget",this._tokenizationSupport=function(e,t){const i=Ns.get(t);if(i)return i;const n=e.encodeLanguageId(t);return{getInitialState:()=>$v,tokenize:(e,i,n)=>Kv(t,n),tokenizeEncoded:(e,t,i)=>qv(n,i)}}(this._languageService.languageIdCodec,this._model.getLanguageId()),this._compute(this._editor.getPosition()),this._register(this._editor.onDidChangeCursorPosition((e=>this._compute(this._editor.getPosition())))),this._editor.addContentWidget(this)}dispose(){this._editor.removeContentWidget(this),super.dispose()}getId(){return Mse._ID}_compute(e){const t=this._getTokensAtLine(e.lineNumber);let i=0;for(let a=t.tokens1.length-1;a>=0;a--){const n=t.tokens1[a];if(e.column-1>=n.offset){i=a;break}}let n=0;for(let a=t.tokens2.length>>>1;a>=0;a--)if(e.column-1>=t.tokens2[a<<1]){n=a;break}const o=this._model.getLineContent(e.lineNumber);let s="";if(i<t.tokens1.length){const e=t.tokens1[i].offset,n=i+1<t.tokens1.length?t.tokens1[i+1].offset:o.length;s=o.substring(e,n)}KC(this._domNode,YC("h2.tm-token",void 0,function(e){let t="";for(let i=0,n=e.length;i<n;i++){const n=e.charCodeAt(i);switch(n){case 9:t+="→";break;case 32:t+="·";break;default:t+=String.fromCharCode(n)}}return t}(s),YC("span.tm-token-length",void 0,`${s.length} ${1===s.length?"char":"chars"}`))),$C(this._domNode,YC("hr.tokens-inspect-separator",{style:"clear:both"}));const r=1+(n<<1)<t.tokens2.length?this._decodeMetadata(t.tokens2[1+(n<<1)]):null;$C(this._domNode,YC("table.tm-metadata-table",void 0,YC("tbody",void 0,YC("tr",void 0,YC("td.tm-metadata-key",void 0,"language"),YC("td.tm-metadata-value",void 0,`${r?r.languageId:"-?-"}`)),YC("tr",void 0,YC("td.tm-metadata-key",void 0,"token type"),YC("td.tm-metadata-value",void 0,`${r?this._tokenTypeToString(r.tokenType):"-?-"}`)),YC("tr",void 0,YC("td.tm-metadata-key",void 0,"font style"),YC("td.tm-metadata-value",void 0,`${r?this._fontStyleToString(r.fontStyle):"-?-"}`)),YC("tr",void 0,YC("td.tm-metadata-key",void 0,"foreground"),YC("td.tm-metadata-value",void 0,`${r?hS.Format.CSS.formatHex(r.foreground):"-?-"}`)),YC("tr",void 0,YC("td.tm-metadata-key",void 0,"background"),YC("td.tm-metadata-value",void 0,`${r?hS.Format.CSS.formatHex(r.background):"-?-"}`))))),$C(this._domNode,YC("hr.tokens-inspect-separator")),i<t.tokens1.length&&$C(this._domNode,YC("span.tm-token-type",void 0,t.tokens1[i].type)),this._editor.layoutContentWidget(this)}_decodeMetadata(e){const t=Ns.getColorMap(),i=ys.getLanguageId(e),n=ys.getTokenType(e),o=ys.getFontStyle(e),s=ys.getForeground(e),r=ys.getBackground(e);return{languageId:this._languageService.languageIdCodec.decodeLanguageId(i),tokenType:n,fontStyle:o,foreground:t[s],background:t[r]}}_tokenTypeToString(e){switch(e){case 0:return"Other";case 1:return"Comment";case 2:return"String";case 3:return"RegEx";default:return"??"}}_fontStyleToString(e){let t="";return 1&e&&(t+="italic "),2&e&&(t+="bold "),4&e&&(t+="underline "),8&e&&(t+="strikethrough "),0===t.length&&(t="---"),t}_getTokensAtLine(e){const t=this._getStateBeforeLine(e),i=this._tokenizationSupport.tokenize(this._model.getLineContent(e),!0,t),n=this._tokenizationSupport.tokenizeEncoded(this._model.getLineContent(e),!0,t);return{startState:t,tokens1:i.tokens,tokens2:n.tokens,endState:i.endState}}_getStateBeforeLine(e){let t=this._tokenizationSupport.getInitialState();for(let i=1;i<e;i++){t=this._tokenizationSupport.tokenize(this._model.getLineContent(i),!0,t).endState}return t}getDomNode(){return this._domNode}getPosition(){return{position:this._editor.getPosition(),preference:[2,1]}}}Mse._ID="editor.contrib.inspectTokensWidget",Ix(Tse.ID,Tse),Lx(class extends xx{constructor(){super({id:"editor.action.inspectTokens",label:jW.inspectTokensAction,alias:"Developer: Inspect Tokens",precondition:void 0})}run(e,t){const i=Tse.get(t);i&&i.launch()}}),sx(((e,t)=>{const i=e.getColor(jk);if(i){const n=e.type===Xy.HIGH_CONTRAST?2:1;t.addRule(`.monaco-editor .tokens-inspect-widget { border: ${n}px solid ${i}; }`),t.addRule(`.monaco-editor .tokens-inspect-widget .tokens-inspect-separator { background-color: ${i}; }`)}const n=e.getColor(zk);n&&t.addRule(`.monaco-editor .tokens-inspect-widget { background-color: ${n}; }`);const o=e.getColor(Hk);o&&t.addRule(`.monaco-editor .tokens-inspect-widget { color: ${o}; }`)}));var Ase=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},Ose=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};let Rse=class e{constructor(e){this.quickInputService=e,this.registry=Yy.as(tG)}provide(t){const i=new ws;i.add(t.onDidAccept((()=>{const[e]=t.selectedItems;e&&this.quickInputService.quickAccess.show(e.prefix,{preserveValue:!0})}))),i.add(t.onDidChangeValue((t=>{const i=this.registry.getQuickAccessProvider(t.substr(e.PREFIX.length));i&&i.prefix&&i.prefix!==e.PREFIX&&this.quickInputService.quickAccess.show(i.prefix,{preserveValue:!0})})));const{editorProviders:n,globalProviders:o}=this.getQuickAccessProviders();return t.items=0===n.length||0===o.length?[...0===n.length?o:n]:[{label:mf(0,"global commands"),type:"separator"},...o,{label:mf(0,"editor commands"),type:"separator"},...n],i}getQuickAccessProviders(){const t=[],i=[];for(const n of this.registry.getQuickAccessProviders().sort(((e,t)=>e.prefix.localeCompare(t.prefix))))if(n.prefix!==e.PREFIX)for(const e of n.helpEntries){const o=e.prefix||n.prefix,s=o||"…";(e.needsEditor?i:t).push({prefix:o,label:s,ariaLabel:mf(0,"{0}, {1}",s,e.description),description:e.description})}return{editorProviders:i,globalProviders:t}}};Rse.PREFIX="?",Rse=Ase([Ose(0,iG)],Rse),Yy.as(tG).registerQuickAccessProvider({ctor:Rse,prefix:"",helpEntries:[{description:$W.helpQuickAccessActionLabel,needsEditor:!0}]});class Pse{constructor(e){this.options=e,this.rangeHighlightDecorationId=void 0}provide(e,t){var i;const n=new ws;e.canAcceptInBackground=!!(null===(i=this.options)||void 0===i?void 0:i.canAcceptInBackground),e.matchOnLabel=e.matchOnDescription=e.matchOnDetail=e.sortByLabel=!1;const o=n.add(new Rr);return o.value=this.doProvide(e,t),n.add(this.onDidActiveTextEditorControlChange((()=>{o.value=void 0,o.value=this.doProvide(e,t)}))),n}doProvide(e,t){const i=new ws,n=this.activeTextEditorControl;if(n&&this.canProvideWithTextEditor(n)){const o={editor:n},s=kX(n);if(s){let e=Qs(n.saveViewState());i.add(s.onDidChangeCursorPosition((()=>{e=Qs(n.saveViewState())}))),o.restoreViewState=()=>{e&&n===this.activeTextEditorControl&&n.restoreViewState(e)},i.add(kr(t.onCancellationRequested)((()=>{var e;return null===(e=o.restoreViewState)||void 0===e?void 0:e.call(o)})))}i.add(es((()=>this.clearDecorations(n)))),i.add(this.provideWithTextEditor(o,e,t))}else i.add(this.provideWithoutTextEditor(e,t));return i}canProvideWithTextEditor(e){return!0}gotoLocation({editor:e},t){e.setSelection(t.range),e.revealRangeInCenter(t.range,0),t.preserveFocus||e.focus()}getModel(e){var t;return SX(e)?null===(t=e.getModel())||void 0===t?void 0:t.modified:e.getModel()}addDecorations(e,t){e.changeDecorations((e=>{const i=[];this.rangeHighlightDecorationId&&(i.push(this.rangeHighlightDecorationId.overviewRulerDecorationId),i.push(this.rangeHighlightDecorationId.rangeHighlightId),this.rangeHighlightDecorationId=void 0);const n=[{range:t,options:{description:"quick-access-range-highlight",className:"rangeHighlight",isWholeLine:!0}},{range:t,options:{description:"quick-access-range-highlight-overview",overviewRuler:{color:tx(gE),position:aa.Full}}}],[o,s]=e.deltaDecorations(i,n);this.rangeHighlightDecorationId={rangeHighlightId:o,overviewRulerDecorationId:s}}))}clearDecorations(e){const t=this.rangeHighlightDecorationId;t&&(e.changeDecorations((e=>{e.deltaDecorations([t.overviewRulerDecorationId,t.rangeHighlightId],[])})),this.rangeHighlightDecorationId=void 0)}}class Fse extends Pse{constructor(){super({canAcceptInBackground:!0})}provideWithoutTextEditor(e){const t=mf(0,"Open a text editor first to go to a line.");return e.items=[{label:t}],e.ariaLabel=t,Uo.None}provideWithTextEditor(e,t,i){const n=e.editor,o=new ws;o.add(t.onDidAccept((i=>{const[o]=t.selectedItems;if(o){if(!this.isValidLineNumber(n,o.lineNumber))return;this.gotoLocation(e,{range:this.toRange(o.lineNumber,o.column),keyMods:t.keyMods,preserveFocus:i.inBackground}),i.inBackground||t.hide()}})));const s=()=>{const e=this.parsePosition(n,t.value.trim().substr(Fse.PREFIX.length)),i=this.getPickLabel(n,e.lineNumber,e.column);if(t.items=[{lineNumber:e.lineNumber,column:e.column,label:i}],t.ariaLabel=i,!this.isValidLineNumber(n,e.lineNumber))return void this.clearDecorations(n);const o=this.toRange(e.lineNumber,e.column);n.revealRangeInCenter(o,0),this.addDecorations(n,o)};s(),o.add(t.onDidChangeValue((()=>s())));const r=kX(n);if(r){2===r.getOptions().get(60).renderType&&(r.updateOptions({lineNumbers:"on"}),o.add(es((()=>r.updateOptions({lineNumbers:"relative"})))))}return o}toRange(e=1,t=1){return{startLineNumber:e,startColumn:t,endLineNumber:e,endColumn:t}}parsePosition(e,t){const i=t.split(/,|:|#/).map((e=>parseInt(e,10))).filter((e=>!isNaN(e))),n=this.lineCount(e)+1;return{lineNumber:i[0]>0?i[0]:n+i[0],column:i[1]}}getPickLabel(e,t,i){if(this.isValidLineNumber(e,t))return this.isValidColumn(e,t,i)?mf(0,"Go to line {0} and character {1}.",t,i):mf(0,"Go to line {0}.",t);const n=e.getPosition()||{lineNumber:1,column:1},o=this.lineCount(e);return o>1?mf(0,"Current Line: {0}, Character: {1}. Type a line number between 1 and {2} to navigate to.",n.lineNumber,n.column,o):mf(0,"Current Line: {0}, Character: {1}. Type a line number to navigate to.",n.lineNumber,n.column)}isValidLineNumber(e,t){return!(!t||"number"!=typeof t)&&(t>0&&t<=this.lineCount(e))}isValidColumn(e,t,i){if(!i||"number"!=typeof i)return!1;const n=this.getModel(e);if(!n)return!1;const o={lineNumber:t,column:i};return n.validatePosition(o).equals(o)}lineCount(e){var t,i;return null!==(i=null===(t=this.getModel(e))||void 0===t?void 0:t.getLineCount())&&void 0!==i?i:0}}Fse.PREFIX=":";var Bse=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},Vse=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};let Wse=class extends Fse{constructor(e){super(),this.editorService=e,this.onDidActiveTextEditorControlChange=ds.None}get activeTextEditorControl(){return Qs(this.editorService.getFocusedCodeEditor())}};Wse=Bse([Vse(0,N_)],Wse),Yy.as(tG).registerQuickAccessProvider({ctor:Wse,prefix:Wse.PREFIX,helpEntries:[{description:UW.gotoLineActionLabel,needsEditor:!0}]});Lx(class extends xx{constructor(){super({id:"editor.action.gotoLine",label:UW.gotoLineActionLabel,alias:"Go to Line/Column...",precondition:void 0,kbOpts:{kbExpr:yI.focus,primary:2085,mac:{primary:293},weight:100}})}run(e){e.get(iG).quickAccess.show(Wse.PREFIX)}});const zse=[void 0,[]];function Hse(e,t,i=0,n=0){const o=t;return o.values&&o.values.length>1?function(e,t,i,n){let o=0;const s=[];for(const r of t){const[t,a]=jse(e,r,i,n);if("number"!=typeof t)return zse;o+=t,s.push(...a)}return[o,Use(s)]}(e,o.values,i,n):jse(e,t,i,n)}function jse(e,t,i,n){const o=xH(t.original,t.originalLowercase,i,e,e.toLowerCase(),n,!0);return o?[o[0],cH(o)]:zse}function Use(e){const t=e.sort(((e,t)=>e.start-t.start)),i=[];let n;for(const o of t)n&&$se(n,o)?(n.start=Math.min(n.start,o.start),n.end=Math.max(n.end,o.end)):(n=o,i.push(o));return i}function $se(e,t){return!(e.end<t.start)&&!(t.end<e.start)}function Kse(e){return e.startsWith('"')&&e.endsWith('"')}Object.freeze({score:0});function qse(e){"string"!=typeof e&&(e="");const t=e.toLowerCase(),{pathNormalized:i,normalized:n,normalizedLowercase:o}=Gse(e),s=i.indexOf(Fr)>=0,r=Kse(e);let a;const l=e.split(" ");if(l.length>1)for(const d of l){const e=Kse(d),{pathNormalized:t,normalized:i,normalizedLowercase:n}=Gse(d);i&&(a||(a=[]),a.push({original:d,originalLowercase:d.toLowerCase(),pathNormalized:t,normalized:i,normalizedLowercase:n,expectContiguousMatch:e}))}return{original:e,originalLowercase:t,pathNormalized:i,normalized:n,normalizedLowercase:o,values:a,containsPathSeparator:s,expectContiguousMatch:r}}function Gse(e){let t;t=Rs?e.replace(/\//g,Fr):e.replace(/\\/g,Fr);const i=od(t).replace(/\s|"/g,"");return{pathNormalized:t,normalized:i,normalizedLowercase:i.toLowerCase()}}function Zse(e){return Array.isArray(e)?qse(e.map((e=>e.original)).join(" ")):qse(e.original)}var Yse=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},Xse=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}},Qse=globalThis&&globalThis.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{l(n.next(e))}catch(t){s(t)}}function a(e){try{l(n.throw(e))}catch(t){s(t)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}l((n=n.apply(e,t||[])).next())}))};let Jse=class e extends Pse{constructor(e,t,i=Object.create(null)){super(i),this._languageFeaturesService=e,this._outlineModelService=t,this.options=i,this.options.canAcceptInBackground=!0}provideWithoutTextEditor(e){return this.provideLabelPick(e,mf(0,"To go to a symbol, first open a text editor with symbol information.")),Uo.None}provideWithTextEditor(e,t,i){const n=e.editor,o=this.getModel(n);return o?this._languageFeaturesService.documentSymbolProvider.has(o)?this.doProvideWithEditorSymbols(e,o,t,i):this.doProvideWithoutEditorSymbols(e,o,t,i):Uo.None}doProvideWithoutEditorSymbols(e,t,i,n){const o=new ws;return this.provideLabelPick(i,mf(0,"The active text editor does not provide symbol information.")),(()=>{Qse(this,void 0,void 0,(function*(){(yield this.waitForLanguageSymbolRegistry(t,o))&&!n.isCancellationRequested&&o.add(this.doProvideWithEditorSymbols(e,t,i,n))}))})(),o}provideLabelPick(e,t){e.items=[{label:t,index:0,kind:14}],e.ariaLabel=t}waitForLanguageSymbolRegistry(e,t){return Qse(this,void 0,void 0,(function*(){if(this._languageFeaturesService.documentSymbolProvider.has(e))return!0;const i=new hb,n=t.add(this._languageFeaturesService.documentSymbolProvider.onDidChange((()=>{this._languageFeaturesService.documentSymbolProvider.has(e)&&(n.dispose(),i.complete(!0))})));return t.add(es((()=>i.complete(!1)))),i.p}))}doProvideWithEditorSymbols(t,i,n,o){const s=t.editor,r=new ws;r.add(n.onDidAccept((e=>{const[i]=n.selectedItems;i&&i.range&&(this.gotoLocation(t,{range:i.range.selection,keyMods:n.keyMods,preserveFocus:e.inBackground}),e.inBackground||n.hide())}))),r.add(n.onDidTriggerItemButton((({item:e})=>{e&&e.range&&(this.gotoLocation(t,{range:e.range.selection,keyMods:n.keyMods,forceSideBySide:!0}),n.hide())})));const a=this.getDocumentSymbols(i,o);let l;const d=()=>Qse(this,void 0,void 0,(function*(){null==l||l.dispose(!0),n.busy=!1,l=new as(o),n.busy=!0;try{const t=qse(n.value.substr(e.PREFIX.length).trim()),i=yield this.doGetSymbolPicks(a,t,void 0,l.token);if(o.isCancellationRequested)return;i.length>0?n.items=i:t.original.length>0?this.provideLabelPick(n,mf(0,"No matching editor symbols")):this.provideLabelPick(n,mf(0,"No editor symbols"))}finally{o.isCancellationRequested||(n.busy=!1)}}));r.add(n.onDidChangeValue((()=>d()))),d();let c=!0;return r.add(n.onDidChangeActive((()=>{const[e]=n.activeItems;if(e&&e.range){if(c)return void(c=!1);s.revealRangeInCenter(e.range.selection,0),this.addDecorations(s,e.range.decoration)}}))),r}doGetSymbolPicks(t,i,n,o){return Qse(this,void 0,void 0,(function*(){const s=yield t;if(o.isCancellationRequested)return[];const r=0===i.original.indexOf(e.SCOPE_PREFIX),a=r?1:0;let l,d;i.values&&i.values.length>1?(l=Zse(i.values[0]),d=Zse(i.values.slice(1))):l=i;const c=[];for(let g=0;g<s.length;g++){const p=s[g],m=sd(p.name),f=`$(${rd.toIcon(p.kind).id}) ${m}`,_=f.length-m.length;let v,b,w,C,y=p.containerName;if((null==n?void 0:n.extraContainerLabel)&&(y=y?`${n.extraContainerLabel} • ${y}`:n.extraContainerLabel),i.original.length>a){let S=!1;if(l!==i&&([v,b]=Hse(f,Object.assign(Object.assign({},i),{values:void 0}),a,_),"number"==typeof v&&(S=!0)),"number"!=typeof v&&([v,b]=Hse(f,l,a,_),"number"!=typeof v))continue;if(!S&&d){if(y&&d.original.length>0&&([w,C]=Hse(y,d)),"number"!=typeof w)continue;"number"==typeof v&&(v+=w)}}const x=p.tags&&p.tags.indexOf(1)>=0;c.push({index:g,kind:p.kind,score:v,label:f,ariaLabel:m,description:y,highlights:x?void 0:{label:b,description:C},range:{selection:qo.collapseToStart(p.selectionRange),decoration:p.range},strikethrough:x,buttons:(()=>{var e,t;const i=(null===(e=this.options)||void 0===e?void 0:e.openSideBySideDirection)?null===(t=this.options)||void 0===t?void 0:t.openSideBySideDirection():void 0;if(i)return[{iconClass:"right"===i?br.splitHorizontal.classNames:br.splitVertical.classNames,tooltip:mf(0,"right"===i?"Open to the Side":"Open to the Bottom")}]})()})}const h=c.sort(((e,t)=>r?this.compareByKindAndScore(e,t):this.compareByScore(e,t)));let u=[];if(r){let k,D,L=0;function N(){D&&"number"==typeof k&&L>0&&(D.label=Aa(tre[k]||ere,L))}for(const E of h)k!==E.kind?(N(),k=E.kind,L=1,D={type:"separator"},u.push(D)):L++,u.push(E);N()}else h.length>0&&(u=[{label:mf(0,"symbols ({0})",c.length),type:"separator"},...h]);return u}))}compareByScore(e,t){if("number"!=typeof e.score&&"number"==typeof t.score)return 1;if("number"==typeof e.score&&"number"!=typeof t.score)return-1;if("number"==typeof e.score&&"number"==typeof t.score){if(e.score>t.score)return-1;if(e.score<t.score)return 1}return e.index<t.index?-1:e.index>t.index?1:0}compareByKindAndScore(e,t){const i=tre[e.kind]||ere,n=tre[t.kind]||ere,o=i.localeCompare(n);return 0===o?this.compareByScore(e,t):o}getDocumentSymbols(e,t){return Qse(this,void 0,void 0,(function*(){const i=yield this._outlineModelService.getOrCreate(e,t);return t.isCancellationRequested?[]:i.asListOfDocumentSymbols()}))}};Jse.PREFIX="@",Jse.SCOPE_PREFIX=":",Jse.PREFIX_BY_CATEGORY=`${Jse.PREFIX}${Jse.SCOPE_PREFIX}`,Jse=Yse([Xse(0,Lb),Xse(1,Q7)],Jse);const ere=mf(0,"properties ({0})"),tre={5:mf(0,"methods ({0})"),11:mf(0,"functions ({0})"),8:mf(0,"constructors ({0})"),12:mf(0,"variables ({0})"),4:mf(0,"classes ({0})"),22:mf(0,"structs ({0})"),23:mf(0,"events ({0})"),24:mf(0,"operators ({0})"),10:mf(0,"interfaces ({0})"),2:mf(0,"namespaces ({0})"),3:mf(0,"packages ({0})"),25:mf(0,"type parameters ({0})"),1:mf(0,"modules ({0})"),6:mf(0,"properties ({0})"),9:mf(0,"enumerations ({0})"),21:mf(0,"enumeration members ({0})"),14:mf(0,"strings ({0})"),0:mf(0,"files ({0})"),17:mf(0,"arrays ({0})"),15:mf(0,"numbers ({0})"),16:mf(0,"booleans ({0})"),18:mf(0,"objects ({0})"),19:mf(0,"keys ({0})"),7:mf(0,"fields ({0})"),13:mf(0,"constants ({0})")};var ire=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},nre=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};let ore=class extends Jse{constructor(e,t,i){super(t,i),this.editorService=e,this.onDidActiveTextEditorControlChange=ds.None}get activeTextEditorControl(){return Qs(this.editorService.getFocusedCodeEditor())}};ore=ire([nre(0,N_),nre(1,Lb),nre(2,Q7)],ore),Yy.as(tG).registerQuickAccessProvider({ctor:ore,prefix:Jse.PREFIX,helpEntries:[{description:qW.quickOutlineActionLabel,prefix:Jse.PREFIX,needsEditor:!0},{description:qW.quickOutlineByCategoryActionLabel,prefix:Jse.PREFIX_BY_CATEGORY,needsEditor:!0}]});function sre(e,t){return t&&(e.stack||e.stacktrace)?mf(0,"{0}: {1}",are(e),rre(e.stack)||rre(e.stacktrace)):are(e)}function rre(e){return Array.isArray(e)?e.join("\n"):e}function are(e){return"string"==typeof e.code&&"number"==typeof e.errno&&"string"==typeof e.syscall?mf(0,"A system error occurred ({0})",e.message):e.message||mf(0,"An unknown error occurred. Please consult the log for more details.")}function lre(e=null,t=!1){if(!e)return mf(0,"An unknown error occurred. Please consult the log for more details.");if(Array.isArray(e)){const i=Sa(e),n=lre(i[0],t);return i.length>1?mf(0,"{0} ({1} errors in total)",n,i.length):n}if(Gs(e))return e;if(e.detail){const i=e.detail;if(i.error)return sre(i.error,t);if(i.exception)return sre(i.exception,t)}return e.stack?sre(e,t):e.message?e.message:mf(0,"An unknown error occurred. Please consult the log for more details.")}Lx(class extends xx{constructor(){super({id:"editor.action.quickOutline",label:qW.quickOutlineActionLabel,alias:"Go to Symbol...",precondition:yI.hasDocumentSymbolProvider,kbOpts:{kbExpr:yI.focus,primary:3117,weight:100},contextMenuOpts:{group:"navigation",order:3}})}run(e){e.get(iG).quickAccess.show(Jse.PREFIX)}});var dre,cre=globalThis&&globalThis.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{l(n.next(e))}catch(t){s(t)}}function a(e){try{l(n.throw(e))}catch(t){s(t)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}l((n=n.apply(e,t||[])).next())}))};function hre(e){const t=e;return Array.isArray(t.items)}!function(e){e[e.NO_ACTION=0]="NO_ACTION",e[e.CLOSE_PICKER=1]="CLOSE_PICKER",e[e.REFRESH_PICKER=2]="REFRESH_PICKER",e[e.REMOVE_ITEM=3]="REMOVE_ITEM"}(dre||(dre={}));class ure extends Uo{constructor(e,t){super(),this.prefix=e,this.options=t}provide(e,t){var i;const n=new ws;let o;e.canAcceptInBackground=!!(null===(i=this.options)||void 0===i?void 0:i.canAcceptInBackground),e.matchOnLabel=e.matchOnDescription=e.matchOnDetail=e.sortByLabel=!1;const s=n.add(new Rr),r=()=>cre(this,void 0,void 0,(function*(){const i=s.value=new ws;null==o||o.dispose(!0),e.busy=!1,o=new as(t);const n=o.token,r=e.value.substr(this.prefix.length).trim(),a=this._getPicks(r,i,n),l=(t,i)=>{var n;let o,s;if(hre(t)?(o=t.items,s=t.active):o=t,0===o.length){if(i)return!1;r.length>0&&(null===(n=this.options)||void 0===n?void 0:n.noResultsPick)&&(o=[this.options.noResultsPick])}return e.items=o,s&&(e.activeItems=[s]),!0};if(null===a);else if(function(e){const t=e;return!!t.picks&&t.additionalPicks instanceof Promise}(a)){let t=!1,i=!1;yield Promise.all([(()=>cre(this,void 0,void 0,(function*(){yield nb(ure.FAST_PICKS_RACE_DELAY),n.isCancellationRequested||i||(t=l(a.picks,!0))})))(),(()=>cre(this,void 0,void 0,(function*(){e.busy=!0;try{const o=yield a.additionalPicks;if(n.isCancellationRequested)return;let s,r,d,c;if(hre(a.picks)?(s=a.picks.items,r=a.picks.active):s=a.picks,hre(o)?(d=o.items,c=o.active):d=o,d.length>0||!t){let t;if(!r&&!c){const i=e.activeItems[0];i&&-1!==s.indexOf(i)&&(t=i)}l({items:[...s,...d],active:r||c||t})}}finally{n.isCancellationRequested||(e.busy=!1),i=!0}})))()])}else if(a instanceof Promise){e.busy=!0;try{const t=yield a;if(n.isCancellationRequested)return;l(t)}finally{n.isCancellationRequested||(e.busy=!1)}}else l(a)}));return n.add(e.onDidChangeValue((()=>r()))),r(),n.add(e.onDidAccept((t=>{const[i]=e.selectedItems;"function"==typeof(null==i?void 0:i.accept)&&(t.inBackground||e.hide(),i.accept(e.keyMods,t))}))),n.add(e.onDidTriggerItemButton((({button:i,item:n})=>cre(this,void 0,void 0,(function*(){var o,s;if("function"==typeof n.trigger){const a=null!==(s=null===(o=n.buttons)||void 0===o?void 0:o.indexOf(i))&&void 0!==s?s:-1;if(a>=0){const i=n.trigger(a,e.keyMods),o="number"==typeof i?i:yield i;if(t.isCancellationRequested)return;switch(o){case dre.NO_ACTION:break;case dre.CLOSE_PICKER:e.hide();break;case dre.REFRESH_PICKER:r();break;case dre.REMOVE_ITEM:{const t=e.items.indexOf(n);if(-1!==t){const i=e.items.slice(),n=i.splice(t,1),o=e.activeItems.filter((e=>e!==n[0])),s=e.keepScrollPosition;e.keepScrollPosition=!0,e.items=i,o&&(e.activeItems=o),e.keepScrollPosition=s}break}}}}}))))),n}}ure.FAST_PICKS_RACE_DELAY=200;var gre=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},pre=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}},mre=globalThis&&globalThis.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{l(n.next(e))}catch(t){s(t)}}function a(e){try{l(n.throw(e))}catch(t){s(t)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}l((n=n.apply(e,t||[])).next())}))};let fre=class e extends ure{constructor(t,i,n,o,s,r){super(e.PREFIX,t),this.instantiationService=i,this.keybindingService=n,this.commandService=o,this.telemetryService=s,this.dialogService=r,this.commandsHistory=this._register(this.instantiationService.createInstance(_re)),this.options=t}_getPicks(t,i,n){return mre(this,void 0,void 0,(function*(){const o=yield this.getCommandPicks(i,n);if(n.isCancellationRequested)return[];const s=[];for(const i of o){const n=Qs(e.WORD_FILTER(t,i.label)),o=i.commandAlias?Qs(e.WORD_FILTER(t,i.commandAlias)):void 0;n||o?(i.highlights={label:n,detail:this.options.showAlias?o:void 0},s.push(i)):t===i.commandId&&s.push(i)}const r=new Map;for(const e of s){const t=r.get(e.label);t?(e.description=e.commandId,t.description=t.commandId):r.set(e.label,e)}s.sort(((e,t)=>{const i=this.commandsHistory.peek(e.commandId),n=this.commandsHistory.peek(t.commandId);return i&&n?i>n?-1:1:i?-1:n?1:e.label.localeCompare(t.label)}));const a=[];let l=!1;for(let e=0;e<s.length;e++){const t=s[e],i=this.keybindingService.lookupKeybinding(t.commandId),n=i?mf(0,"{0}, {1}",t.label,i.getAriaLabel()):t.label;0===e&&this.commandsHistory.peek(t.commandId)&&(a.push({type:"separator",label:mf(0,"recently used")}),l=!0),0!==e&&l&&!this.commandsHistory.peek(t.commandId)&&(a.push({type:"separator",label:mf(0,"other commands")}),l=!1),a.push(Object.assign(Object.assign({},t),{ariaLabel:n,detail:this.options.showAlias&&t.commandAlias!==t.label?t.commandAlias:void 0,keybinding:i,accept:()=>mre(this,void 0,void 0,(function*(){this.commandsHistory.push(t.commandId),this.telemetryService.publicLog2("workbenchActionExecuted",{id:t.commandId,from:"quick open"});try{yield this.commandService.executeCommand(t.commandId)}catch(e){Ea(e)||this.dialogService.show(fF.Error,mf(0,"Command '{0}' resulted in an error ({1})",t.label,lre(e)))}}))}))}return a}))}};fre.PREFIX=">",fre.WORD_FILTER=zz(Hz,(function(e,t,i=!1){if(!t||0===t.length)return null;let n=null,o=0;for(e=e.toLowerCase(),t=t.toLowerCase();o<t.length&&null===(n=nH(e,t,0,o,i));)o=oH(t,o+1);return n}),Uz),fre=gre([pre(1,k_),pre(2,kW),pre(3,wy),pre(4,vx),pre(5,DV)],fre);let _re=class e extends Uo{constructor(e,t){super(),this.storageService=e,this.configurationService=t,this.configuredCommandsHistoryLength=0,this.updateConfiguration(),this.load(),this.registerListeners()}registerListeners(){this._register(this.configurationService.onDidChangeConfiguration((()=>this.updateConfiguration())))}updateConfiguration(){this.configuredCommandsHistoryLength=e.getConfiguredCommandHistoryLength(this.configurationService),e.cache&&e.cache.limit!==this.configuredCommandsHistoryLength&&(e.cache.limit=this.configuredCommandsHistoryLength,e.saveState(this.storageService))}load(){const t=this.storageService.get(e.PREF_KEY_CACHE,0);let i;if(t)try{i=JSON.parse(t)}catch(o){}const n=e.cache=new QV(this.configuredCommandsHistoryLength,1);if(i){let e;e=i.usesLRU?i.entries:i.entries.sort(((e,t)=>e.value-t.value)),e.forEach((e=>n.set(e.key,e.value)))}e.counter=this.storageService.getNumber(e.PREF_KEY_COUNTER,0,e.counter)}push(t){e.cache&&(e.cache.set(t,e.counter++),e.saveState(this.storageService))}peek(t){var i;return null===(i=e.cache)||void 0===i?void 0:i.peek(t)}static saveState(t){if(!e.cache)return;const i={usesLRU:!0,entries:[]};e.cache.forEach(((e,t)=>i.entries.push({key:t,value:e}))),t.store(e.PREF_KEY_CACHE,JSON.stringify(i),0,0),t.store(e.PREF_KEY_COUNTER,e.counter,0,0)}static getConfiguredCommandHistoryLength(t){var i,n;const o=null===(n=null===(i=t.getValue().workbench)||void 0===i?void 0:i.commandPalette)||void 0===n?void 0:n.history;return"number"==typeof o?o:e.DEFAULT_COMMANDS_HISTORY_LENGTH}};_re.DEFAULT_COMMANDS_HISTORY_LENGTH=50,_re.PREF_KEY_CACHE="commandPalette.mru.cache",_re.PREF_KEY_COUNTER="commandPalette.mru.counter",_re.counter=1,_re=gre([pre(0,bZ),pre(1,Cv)],_re);class vre extends fre{constructor(e,t,i,n,o,s){super(e,t,i,n,o,s)}getCodeEditorCommandPicks(){const e=this.activeTextEditorControl;if(!e)return[];const t=[];for(const i of e.getSupportedActions())t.push({commandId:i.id,commandAlias:i.alias,label:AH(i.label)||i.id});return t}}var bre=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},wre=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}},Cre=globalThis&&globalThis.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{l(n.next(e))}catch(t){s(t)}}function a(e){try{l(n.throw(e))}catch(t){s(t)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}l((n=n.apply(e,t||[])).next())}))};let yre=class extends vre{constructor(e,t,i,n,o,s){super({showAlias:!1},e,i,n,o,s),this.codeEditorService=t}get activeTextEditorControl(){return Qs(this.codeEditorService.getFocusedCodeEditor())}getCommandPicks(){return Cre(this,void 0,void 0,(function*(){return this.getCodeEditorCommandPicks()}))}};yre=bre([wre(0,k_),wre(1,N_),wre(2,kW),wre(3,wy),wre(4,vx),wre(5,DV)],yre),Yy.as(tG).registerQuickAccessProvider({ctor:yre,prefix:yre.PREFIX,helpEntries:[{description:KW.quickCommandHelp,needsEditor:!0}]});Lx(class extends xx{constructor(){super({id:"editor.action.quickCommand",label:KW.quickCommandActionLabel,alias:"Command Palette",precondition:void 0,kbOpts:{kbExpr:yI.focus,primary:59,weight:100},contextMenuOpts:{group:"z_commands",order:1}})}run(e){e.get(iG).quickAccess.show(yre.PREFIX)}});var xre=globalThis&&globalThis.__decorate||function(e,t,i,n){var o,s=arguments.length,r=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,i,r):o(t,i))||r);return s>3&&r&&Object.defineProperty(t,i,r),r},Sre=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};let kre=class extends _3{constructor(e,t,i,n,o,s,r){super(!0,e,t,i,n,o,s,r)}};kre=xre([Sre(1,$y),Sre(2,N_),Sre(3,vF),Sre(4,k_),Sre(5,bZ),Sre(6,Cv)],kre),Ix(_3.ID,kre);function Dre(){return new Worker("/vite-vue3-lowcode/assets/json.worker.997795ea.js",{type:"module"})}function Lre(){return new Worker("/vite-vue3-lowcode/assets/css.worker.88eefdd3.js",{type:"module"})}Lx(class extends xx{constructor(){super({id:"editor.action.toggleHighContrast",label:ZW.toggleHighContrast,alias:"Toggle High Contrast Theme",precondition:void 0}),this._originalThemeName=null}run(e,t){const i=e.get(RG);this._originalThemeName?(i.setTheme(this._originalThemeName),this._originalThemeName=null):(this._originalThemeName=i.getColorTheme().themeName,i.setTheme("hc-black"))}});(globalThis||window).MonacoEnvironment={getWorker:(e,t)=>"json"===t?new Dre:"css"===t||"scss"===t||"less"===t?new Lre:void 0},QX.getLanguages();var Nre="_container_o8w0l_8",Ere="_title_o8w0l_15",Ire="_code_o8w0l_20";let Tre,Mre=!1;var Are=Zi({name:"MonacoEditor",props:{code:{type:String,required:!0},layout:{type:Object,required:!0,default:()=>({})},options:{type:Object,default:()=>({})},vid:[String,Number],onChange:{type:Function},title:{type:String,default:""}},setup(e){const t=ci(null),i=ai(null),n=()=>{window.requestIdleCallback((()=>{t.value.getAction("editor.action.formatDocument").run()}),{timeout:800})};wn((()=>{t.value=XX.create(i.value,{value:e.code,theme:"vs-dark",language:"json",formatOnPaste:!0,tabSize:2,minimap:{enabled:!1},fontFamily:"微软雅黑",overviewRulerBorder:!1,scrollBeyondLastLine:!1,...e.options}),Tre=t.value.onDidChangeModelContent((i=>{var n;Mre||(null===(n=e.onChange)||void 0===n||n.call(e,t.value.getValue(),i))})),n(),t.value.layout(e.layout)})),fn((()=>{Tre&&Tre.dispose()}));return Qn((()=>e.vid),(()=>{if(t.value){const i=t.value,o=i.getModel();o&&e.code!==o.getValue()&&(i.pushUndoStop(),Mre=!0,o.pushEditOperations([],[{range:o.getFullModelRange(),text:e.code}],(()=>null))),i.pushUndoStop(),Mre=!1,n()}}),{immediate:!0}),()=>qi("div",{class:Nre},[e.title&&qi("div",{class:Ere},[qi("span",null,[e.title])]),qi("div",{class:Ire,ref:i},null)])}});const Ore=()=>{const{jsonData:e,updatePage:t,currentPage:i,overrideProject:n}=Ie(),o=si({coverRadio:"current",importJsonValue:""}),s=e=>{o.importJsonValue=e};return[{title:"导入JSON",icon:mt,onClick:()=>{pf({title:"导入JSON",props:{width:642},content:()=>qi(Di,null,[qi(Le,{modelValue:o.coverRadio,"onUpdate:modelValue":e=>o.coverRadio=e},{default:()=>[qi(b,{label:"current"},{default:()=>[Ki("覆盖当前页面")]}),qi(b,{label:"all"},{default:()=>[Ki("覆盖整个项目")]})]}),qi(Are,{onChange:s,code:JSON.stringify(e),layout:{width:600,height:600}},null)]),onConfirm:()=>{const e="current"==o.coverRadio;e?t({oldPath:i.value.path,page:JSON.parse(o.importJsonValue)}):n(JSON.parse(o.importJsonValue)),Pp({showClose:!0,type:"success",duration:2e3,message:e?"成功覆盖当前页面":"成功覆盖整个项目"})}})}},{title:"导出JSON",icon:ft,onClick:()=>{const{copy:t}=Ne({source:JSON.stringify(e)});t().then((()=>Pp.success("复制成功"))).catch((e=>Pp.error(`复制失败:${e}`)))}},{title:"真机预览",icon:_t,onClick:()=>{const e=function(e,t){const i=ai(e),n=ai("");return Qn(i,(async e=>{i.value&&E&&(n.value=await Bp.toDataURL(e,t))}),{immediate:!0}),n}(`${location.origin}/preview`);pf({title:"预览二维码(暂不可用)",props:{width:300},footer:null,content:()=>qi("div",{class:"flex justify-center"},[qi("img",{width:220,height:220,src:e.value},null)])})}},{title:"复制页面",icon:vt,onClick:()=>{Pp({showClose:!0,type:"info",duration:2e3,message:"敬请期待!"})}},{title:"撤销",icon:bt,onClick:()=>{Pp({showClose:!0,type:"info",duration:2e3,message:"敬请期待!"})}},{title:"重做",icon:wt,onClick:()=>{Pp({showClose:!0,type:"info",duration:2e3,message:"敬请期待!"})}},{title:"清空页面",icon:ut,onClick:()=>{Pp({showClose:!0,type:"info",duration:2e3,message:"敬请期待!"})}},{title:"预览",icon:Ct,onClick:()=>{localStorage.setItem(Ee,JSON.stringify(e)),window.open(location.href.replace("/#/","/preview/#/"))}},{title:"反馈",icon:yt,onClick:()=>{window.open("https://github.com/buqiyuan/vite-vue3-lowcode/issues/new")}}]};const Rre=e=>(En("data-v-188f8e00"),e=e(),Ln(),e),Pre=Rre((()=>Wi("div",{class:"logo"},null,-1))),Fre=Rre((()=>Wi("h3",{class:"font-semibold"},"H5低代码",-1))),Bre=["onClick"],Vre={class:"title"},Wre={href:"https://github.com/buqiyuan/vite-vue3-lowcode",target:"_blank"},zre=["src"],Hre={href:"https://gitee.com/buqiyuan/vite-vue3-lowcode",target:"_blank"},jre=["src"],Ure=["src"];var $re=ad(Zi({name:"PageHeader",setup(e){const t=ai(!1),i=Ore(),{jsonData:n}=Ie(),o=()=>{sessionStorage.setItem(Ee,JSON.stringify(n)),localStorage.setItem(Ee,JSON.stringify(n)),t.value=!0};return(e,n)=>{const s=Te,r=w,a=Y,l=R,d=Me,c=Ae;return Dn(),Vi(Di,null,[qi(d,{type:"flex",class:"header"},{default:no((()=>[qi(s,{span:6,class:"flex items-center"},{default:no((()=>[Pre,Fre])),_:1}),qi(s,{class:"flex items-center",span:12},{default:no((()=>[(Dn(!0),Vi(Di,null,Mn(fi(i),((e,t)=>(Dn(),Vi("div",{key:t,class:bi([[`w-1/${fi(i).length}`],"w-1/9"])},[Wi("div",{class:"tool-item flex flex-col items-center cursor-pointer",onClick:e.onClick},[qi(r,null,{default:no((()=>[(Dn(),Fi(Pn(e.icon)))])),_:2},1024),Wi("div",Vre,yi(e.title),1)],8,Bre)],2)))),128))])),_:1}),qi(s,{span:6,class:"right-tools flex flex-row-reverse items-center"},{default:no((()=>[qi(l,{class:"item",effect:"dark",content:"运行",placement:"bottom"},{default:no((()=>[qi(a,{type:"primary",icon:fi(xt),size:"large",circle:"",class:"flex-shrink-0 !p-6px",onClick:o},null,8,["icon"])])),_:1}),qi(c,{placement:"bottom",width:140,trigger:"hover"},{reference:no((()=>[Wi("img",{src:`${fi(gt)}github.svg`,width:"40",height:"40",alt:""},null,8,Ure)])),default:no((()=>[qi(d,{type:"flex",class:"row-bg",justify:"space-around"},{default:no((()=>[qi(s,{span:6},{default:no((()=>[qi(l,{class:"item",effect:"dark",content:"github",placement:"bottom"},{default:no((()=>[Wi("a",Wre,[Wi("img",{src:`${fi(gt)}github.svg`,width:"40",height:"40",alt:""},null,8,zre)])])),_:1})])),_:1}),qi(s,{span:6},{default:no((()=>[qi(l,{class:"item",effect:"dark",content:"gitee",placement:"bottom"},{default:no((()=>[Wi("a",Hre,[Wi("img",{src:`${fi(gt)}gitee.svg`,width:"40",height:"40",alt:""},null,8,jre)])])),_:1})])),_:1})])),_:1})])),_:1})])),_:1})])),_:1}),qi(Fp,{visible:t.value,"onUpdate:visible":n[0]||(n[0]=e=>t.value=e)},null,8,["visible"])],64)}}}),[["__scopeId","data-v-188f8e00"]]);var Kre={"list-group-item":"_list-group-item_12ss1_1",listGroupItem:"_list-group-item_12ss1_1"},qre={exports:{}},Gre=St(dd); |