|
|
*/var Kc=/["'&<>]/,qc=function(e){var t,i=""+e,n=Kc.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 Gc=function(e){let t=e.target;for(;t&&"HTML"!==t.tagName.toUpperCase();){if("TD"===t.tagName.toUpperCase())return t;t=t.parentNode}return null},Zc=function(e){return null!==e&&"object"==typeof e},Yc=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?ae(i,t):t(i,n,e)))):("$key"!==t&&Zc(i)&&"$value"in i&&(i=i.$value),[Zc(i)?ae(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))},Xc=function(e,t){let i=null;return e.columns.forEach((e=>{e.id===t&&(i=e)})),i},Qc=function(e,t,i){const n=(t.className||"").match(new RegExp(`${i}-table_[^\\s]+`,"gm"));return n?Xc(e,n[0]):null},Jc=(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)},eu=function(e,t){const i={};return(e||[]).forEach(((e,n)=>{i[Jc(e,t)]={row:e,index:n}})),i};function tu(e){return""===e||void 0!==e&&(e=Number.parseInt(e,10),Number.isNaN(e)&&(e="")),e}function iu(e){return""===e||void 0!==e&&(e=tu(e),Number.isNaN(e)&&(e=80)),e}function nu(e){return"number"==typeof e?e:"string"==typeof e?/^\d+(?:px)?$/.test(e)?Number.parseInt(e,10):e:null}function ou(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 su(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 ru;const au=(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}:{}},lu=(e,t,i,n,o)=>{const s=[],{direction:r,start:a}=au(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 du(e,t){return e+(null===t.realWidth||Number.isNaN(t.realWidth)?Number(t.width):t.realWidth)}const hu=(e,t,i,n)=>{const{direction:o,start:s=0}=au(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(du,0):r.right=l.slice(s+1).reverse().reduce(du,0),r},cu=(e,t)=>{e&&(Number.isNaN(e[t])||(e[t]=`${e[t]}px`))};const uu=e=>{const t=[];return e.forEach((e=>{e.children?t.push.apply(t,uu(e.children)):t.push(e)})),t};function gu(){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([]),h=ai([]),c=ai([]),u=ai([]),g=ai([]),p=ai([]),m=ai(0),f=ai(0),_=ai(0),v=ai(!1),b=ai([]),C=ai(!1),w=ai(!1),y=ai(null),S=ai({}),x=ai(null),k=ai(null),L=ai(null),D=ai(null),E=ai(null);Qn(o,(()=>t.state&&I(!1)),{deep:!0});const N=()=>{h.value=a.value.filter((e=>!0===e.fixed||"left"===e.fixed)),c.value=a.value.filter((e=>"right"===e.fixed)),h.value.length>0&&a.value[0]&&"selection"===a.value[0].type&&!a.value[0].fixed&&(a.value[0].fixed=!0,h.value.unshift(a.value[0]));const e=a.value.filter((e=>!e.fixed));l.value=[].concat(h.value).concat(e).concat(c.value);const t=uu(e),i=uu(h.value),n=uu(c.value);m.value=t.length,f.value=i.length,_.value=n.length,d.value=[].concat(i).concat(t).concat(n),r.value=h.value.length>0||c.value.length>0},I=(e,i=!1)=>{e&&N(),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,L.value=t,D.value=i},O=()=>{let e=fi(s);Object.keys(S.value).forEach((t=>{const i=S.value[t];if(!i||0===i.length)return;const n=Xc({columns:d.value},t);n&&n.filterMethod&&(e=e.filter((e=>i.some((t=>n.filterMethod.call(null,t,e,n))))))})),x.value=e},A=()=>{o.value=((e,t)=>{const i=t.sortingColumn;return i&&"string"!=typeof i.sortable?Yc(e,t.sortProp,t.sortOrder,i.sortMethod,i.sortBy):e})(x.value,{sortingColumn:k.value,sortProp:L.value,sortOrder:D.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=eu(n.value,o);n.value=t.reduce(((t,i)=>{const n=Jc(i,o);return e[n]&&t.push(i),t}),[])}else n.value=[]},toggleRowExpansion:(e,i)=>{ou(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=eu(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?!!eu(n.value,i)[Jc(t,i)]:n.value.includes(t)},states:{expandRows:n,defaultExpandAll:i}}}({data:o,rowKey:n}),{updateTreeExpandKeys:W,toggleTreeExpansion:H,updateTreeData:z,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 c(t)})),h=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=Jc(e,t);i.children.push(o),e[r.value]&&!n[o]&&(n[o]={children:[]})})),n[e]=i}})),n):n})),c=t=>{const i=e.rowKey.value,n={};return su(t,((e,t,s)=>{const r=Jc(e,i);Array.isArray(t)?n[r]={children:t.map((e=>Jc(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=h.value,c=Object.keys(r),u={};if(c.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)}};c.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 h=Object.keys(a);o.value&&h.length&&l.length&&h.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((()=>h.value),(()=>{u()}));const g=(t,n)=>{l.store.assertRowKey();const o=e.rowKey.value,s=Jc(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=Jc(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:c,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=>Jc(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=Jc(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:N,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=eu(b.value,n.value),i=eu(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(ou(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=w.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)&&ou(b.value,e,n)&&(s=!0):ou(b.value,e,n)&&(s=!0),r+=T(Jc(e,a))})),s&&t.emit("selection-change",b.value?b.value.slice():[]),t.emit("select-all",b.value)},toggleAllSelection:null,updateSelectionByRowKey:()=>{const e=eu(b.value,n.value);o.value.forEach((t=>{const i=Jc(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=eu(b.value,n.value));let a=!0,l=0,d=0;for(let c=0,u=(o.value||[]).length;c<u;c++){const e=null==(s=null==(i=null==t?void 0:t.store)?void 0:i.states)?void 0:s.rowKey.value,u=c+d,g=o.value[c],p=y.value&&y.value.call(null,g,u);if(h=g,r?r[Jc(h,n.value)]:b.value.includes(h))l++;else if(!y.value||p){a=!1;break}d+=T(Jc(g,e))}var h;0===l&&(a=!1),v.value=a},updateFilters:(e,t)=>{Array.isArray(e)||(e=[e]);const i={};return e.forEach((e=>{S.value[e.id]=t,i[e.columnKey||e.id]=t})),i},updateCurrentRow:K,updateSort:M,execFilter:O,execSort:A,execQuery:e=>{e&&e.filter||O(),A()},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=[])})),S.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):H(e,t)},isRowExpanded:V,updateExpandRows:F,updateCurrentRowData:$,loadOrToggle:j,updateTreeData:z,states:{tableSize:i,rowKey:n,data:o,_data:s,isComplex:r,_columns:a,originColumns:l,columns:d,fixedColumns:h,rightFixedColumns:c,leafColumns:u,fixedLeafColumns:g,rightFixedLeafColumns:p,leafColumnsLength:m,fixedLeafColumnsLength:f,rightFixedLeafColumnsLength:_,isAllSelected:v,selection:b,reserveSelection:C,selectOnIndeterminate:w,selectable:y,filters:S,filteredData:x,sortingColumn:k,sortProp:L,sortOrder:D,hoverRow:E,...B,...U,...G}}}function pu(e,t){return e.map((e=>{var i;return e.id===t.id?t:((null==(i=e.children)?void 0:i.length)&&(e.children=pu(e.children,t)),e)}))}function mu(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)&&mu(e.children)})),e.sort(((e,t)=>e.no-t.no))}function fu(){const e=en(),t=gu();return{ns:n("table"),...t,mutations:{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=pu(o,n)):(o.push(i),s=o),mu(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=pu(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)}},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 _u={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 vu(e,t){if(!e)throw new Error("Table is required.");const i=fu();return i.toggleAllSelection=W(i._toggleAllSelection,10),Object.keys(_u).forEach((e=>{bu(Cu(t,e),e,i)})),function(e,t){Object.keys(_u).forEach((i=>{Qn((()=>Cu(t,i)),(t=>{bu(t,i,e)}))}))}(i,t),i}function bu(e,t,i){let n=e,o=_u[t];"object"==typeof _u[t]&&(o=o.key,n=n||_u[t].default),i.states[o].value=n}function Cu(e,t){if(t.includes(".")){const i=t.split(".");let n=e;return i.forEach((e=>{n=n[e]})),n}return e[t]}class wu{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=nu(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,h=this.headerDisplayNone(d),c=(null==n?void 0:n.offsetHeight)||0,u=this.headerHeight.value=this.showHeader?c:0;if(this.showHeader&&!h&&c>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:yu}=ah,Su=Zi({name:"ElTableFilterPanel",components:{ElCheckbox:ah,ElCheckboxGroup:yu,ElScrollbar:C,ElTooltip:A,ElIcon:b,ArrowDown:Je,ArrowUp:it},directives:{ClickOutside:P},props:{placement:{type:String,default:"bottom-start"},store:{type:Object},column:{type:Object},upDataColumn:{type:Function}},setup(e){const t=en(),{t:i}=w(),o=n("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=>{h.value&&(null!=e?h.value.splice(0,1,e):h.value.splice(0,1))}}),h=Pi({get:()=>e.column&&e.column.filteredValue||[],set(t){e.column&&e.upDataColumn("filteredValue",t)}}),c=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:c,filteredValue:h,filterValue:d,filters:l,handleConfirm:()=>{g(h.value),u()},handleReset:()=>{h.value=[],g(h.value),u()},handleSelect:e=>{d.value=e,g(null!=e?h.value:[]),u()},isActive:e=>e.value===d.value,t:i,ns:o,showFilterPanel:e=>{e.stopPropagation(),r.value=!r.value},hideFilterPanel:()=>{r.value=!1},popperPaneRef:p,tooltip:a}}}),xu={key:0},ku=["disabled"],Lu=["label","onClick"];var Du=s(Su,[["render",function(e,t,i,n,o,s){const r=An("el-checkbox"),a=An("el-checkbox-group"),l=An("el-scrollbar"),d=An("arrow-up"),h=An("arrow-down"),c=An("el-icon"),u=An("el-tooltip"),g=Rn("click-outside");return Ln(),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?(Ln(),Vi("div",xu,[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((()=>[(Ln(!0),Vi(Li,null,Mn(e.filters,(e=>(Ln(),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,ku),Wi("button",{type:"button",onClick:t[2]||(t[2]=(...t)=>e.handleReset&&e.handleReset(...t))},yi(e.t("el.table.resetFilter")),1)],2)])):(Ln(),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),(Ln(!0),Vi(Li,null,Mn(e.filters,(t=>(Ln(),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,Lu)))),128))],2))])),default:no((()=>[so((Ln(),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(c,null,{default:no((()=>[e.column.filterOpened?(Ln(),Fi(d,{key:0})):(Ln(),Fi(h,{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 Eu(e){const t=en();mn((()=>{i.value.addObserver(t)})),Cn((()=>{n(i.value),o(i.value)})),kn((()=>{n(i.value),o(i.value)})),xn((()=>{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 Nu=Symbol("ElTable");const Iu=e=>{const t=[];return e.forEach((e=>{e.children?(t.push(e),t.push.apply(t,Iu(e.children))):t.push(e)})),t};function Tu(e){const t=an(Nu),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 Iu(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 Mu=Zi({name:"ElTableHeader",components:{ElCheckbox:ah},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(),o=an(Nu),s=n("table"),r=ai({}),{onColumnsChange:a,onScrollableChange:l}=Eu(o);Cn((async()=>{await gn(),await gn();const{prop:t,order:i}=e.defaultSort;null==o||o.store.commit("sort",{prop:t,order:i,init:!0})}));const{handleHeaderClick:d,handleHeaderContextMenu:h,handleMouseDown:c,handleMouseMove:u,handleMouseOut:g,handleSortClick:p,handleFilterClick:m}=function(e,t){const i=en(),n=an(Nu),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&&de(r,"noclick"))return void he(r,"noclick");if(!i.sortable)return;const a=e.store.states;let l,d=a.sortProp.value;const h=a.sortingColumn.value;(h!==i||h===i&&null===h.order)&&(h&&(h.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 h=(null==d?void 0:d.vnode.el).getBoundingClientRect().left,c=i.vnode.el.querySelector(`th.${l.id}`),u=c.getBoundingClientRect(),g=u.left-h+30;le(c,"noclick"),a.value={startMouseLeft:o.clientX,startLeft:u.right-h,startColumnLeft:u.left-h,tableLeft:h};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,h=Number.parseInt(p.style.left,10)-i;l.width=l.realWidth=h,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(c,"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",de(n,"is-sortable")&&(n.style.cursor="col-resize"),s.value=i):r.value||(o.cursor="",de(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(Nu),i=n("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:hu(n,s.fixed,e.store,o);return cu(l,"left"),cu(l,"right"),Object.assign({},a,l)},getHeaderCellClass:(n,o,s,r)=>{const a=r.isSubColumn?[]:lu(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:C,toggleAllSelection:w,columnRows:y}=Tu(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:h,handleMouseDown:c,handleMouseMove:u,handleMouseOut:g,handleSortClick:p,handleFilterClick:m,isGroup:C,toggleAllSelection:w}},render(){const{ns:e,isGroup:t,columnRows:i,getHeaderCellStyle:n,getHeaderCellClass:o,getHeaderRowClass:s,getHeaderRowStyle:r,handleHeaderClick:a,handleHeaderContextMenu:l,handleMouseDown:d,handleMouseMove:h,handleSortClick:c,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=>h(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=>c(e,i),class:"caret-wrapper"},[on("i",{onClick:e=>c(e,i,"ascending"),class:"sort-caret ascending"}),on("i",{onClick:e=>c(e,i,"descending"),class:"sort-caret descending"})]),i.filterable&&on(Du,{store:g,placement:i.filterPlacement||"bottom-start",column:i,upDataColumn:(e,t)=>{i[e]=t}})])]))))))))}});function Ou(e){const t=an(Nu),i=ai(""),n=ai(on("div")),o=(i,n,o)=>{var s;const r=t,a=Gc(i);let l;const d=null==(s=null==r?void 0:r.vnode.el)?void 0:s.dataset.prefix;a&&(l=Qc({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)};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:W((t=>{e.store.commit("setHoverRow",t)}),30),handleMouseLeave:W((()=>{e.store.commit("setHoverRow",null)}),30),handleCellMouseEnter:(i,n)=>{var o;const s=t,r=Gc(i),l=null==(o=null==s?void 0:s.vnode.el)?void 0:o.dataset.prefix;if(r){const t=Qc({columns:e.store.states.columns.value},r,l),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(!de(d,`${l}-tooltip`)||!d.childNodes.length)return;const h=document.createRange();h.setStart(d,0),h.setEnd(d,d.childNodes.length);(h.getBoundingClientRect().width+((Number.parseInt(ce(d,"paddingLeft"),10)||0)+(Number.parseInt(ce(d,"paddingRight"),10)||0))>d.offsetWidth||d.scrollWidth>d.offsetWidth)&&function(e,t,i,n,o){const{nextZIndex:s}=se(),r=null==e?void 0:e.dataset.prefix,l=null==e?void 0:e.querySelector(`.${r}-scrollbar__wrap`);function d(){h&&h.update()}ru=()=>{try{h&&h.destroy(),c&&(null==e||e.removeChild(c)),q(t,"mouseenter",d),q(t,"mouseleave",ru),l&&q(l,"scroll",ru),ru=void 0}catch(i){}};let h=null;const c=function(){const t="light"===o,n=document.createElement("div");return n.className=`${r}-popper ${t?"is-light":"is-dark"}`,i=qc(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}();c.appendChild(u),h=re(t,c,{strategy:"absolute",modifiers:[{name:"offset",options:{offset:[0,8]}},{name:"arrow",options:{element:u,padding:10}}],...n}),a(t,"mouseenter",d),a(t,"mouseleave",ru),l&&a(l,"scroll",ru)}(null==t?void 0:t.refs.tableWrapper,r,r.innerText||r.textContent,{placement:"top",strategy:"fixed"},n.tooltipEffect)},handleCellMouseLeave:e=>{if(!Gc(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 Au(e){const t=an(Nu),i=n("table"),{handleDoubleClick:o,handleClick:s,handleContextMenu:r,handleMouseEnter:a,handleMouseLeave:l,handleCellMouseEnter:d,handleCellMouseLeave:h,tooltipContent:c,tooltipTrigger:u}=Ou(e),{getRowStyle:g,getRowClass:p,getCellStyle:m,getCellClass:f,getSpan:_,getColspanRealWidth:v}=function(e){const t=an(Nu),i=n("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:hu(n,null==e?void 0:e.fixed,e.store);return cu(l,"left"),cu(l,"right"),Object.assign({},a,l)},getCellClass:(n,o,s,r)=>{const a=r.isSubColumn?[]:lu(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)))),C=(e,i)=>{const n=t.props.rowKey;return n?Jc(e,n):i},w=(n,c,u,w=!1)=>{const{tooltipEffect:S,store:x}=e,{indent:k,columns:L}=x.states,D=p(n,c);let E=!0;u&&(D.push(i.em("row",`level-${u.level}`)),E=u.display);return on("tr",{style:[E?null:{display:"none"},g(n,c)],class:D,key:C(n,c),onDblclick:e=>o(e,n),onClick:e=>s(e,n),onContextmenu:e=>r(e,n),onMouseenter:()=>a(c),onMouseleave:l},L.value.map(((i,o)=>{const{rowspan:s,colspan:r}=_(n,i,c,o);if(!s||!r)return null;const a={...i};a.realWidth=v(L.value,r,o);const l={store:e.store,_self:e.context||t,column:a,row:n,$index:c,cellIndex:o,expanded:w};o===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=`${c},${o}`,p=a.columnKey||a.rawColumnKey||"",C=y(o,i,l);return on("td",{style:m(c,o,n,i),class:f(c,o,n,i),key:`${p}${g}`,rowspan:s,colspan:r,onMouseenter:e=>d(e,{...n,tooltipEffect:S}),onMouseleave:h},[C])})))},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:h}=o.states,c=o.states.columns.value;if(c.some((({type:e})=>"expand"===e))){const e=s(i),r=w(i,n,void 0,e),a=t.renderExpanded;return e?a?[[r,on("tr",{key:`expanded-row__${r.key}`},[on("td",{colspan:c.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=Jc(i,h.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=[w(i,n,o)];if(t){let o=0;const r=(e,i)=>{e&&e.length&&i&&e.forEach((e=>{const c={display:i.display&&i.expanded,level:i.level+1,expanded:!1,noLazyChildren:!1,loading:!1},u=Jc(e,h.value);if(null==u)throw new Error("For nested data item, row-key is required.");if(t={...a.value[u]},t&&(c.expanded=t.expanded,t.level=t.level||c.level,t.display=!(!t.expanded||!c.display),"boolean"==typeof t.lazy&&("boolean"==typeof t.loaded&&t.loaded&&(c.noLazyChildren=!(t.children&&t.children.length)),c.loading=t.loading)),o++,s.push(w(e,n+o,c)),t){const i=l.value[u]||e[d.value];r(i,t)}}))};t.display=!0;const c=l.value[e]||i[d.value];r(c,t)}return s}return w(i,n,void 0)},tooltipContent:c,tooltipTrigger:u}}var Ru=Zi({name:"ElTableBody",props:{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},setup(e){const t=en(),i=an(Nu),o=n("table"),{wrappedRowRender:s,tooltipContent:r,tooltipTrigger:a}=Au(e),{onColumnsChange:l,onScrollableChange:d}=Eu(i);return Qn(e.store.states.hoverRow,((i,n)=>{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(`.${o.e("row")}`),r=s[n],a=s[i];r&&he(r,"hover-row"),a&&le(a,"hover-row")}))})),xn((()=>{var e;null==(e=ru)||e()})),kn((()=>{var e;null==(e=ru)||e()})),{ns:o,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 Pu(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 Fu(e){const{columns:t}=function(){const e=an(Nu),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=n("table");return{getCellClasses:(t,n)=>{const o=t[n],s=[i.e("cell"),o.id,o.align,o.labelClassName,...lu(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=hu(i,t.fixed,e.store);return cu(n,"left"),cu(n,"right"),n},columns:t}}Pu.props=["columns","tableLayout"];var Bu=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:o}=Fu(e);return{ns:n("table"),getCellClasses:t,getCellStyles:i,columns:o}},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"},[Pu({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 Vu(e,t,i,n){const s=ai(!1),r=ai(null),a=ai(!1),l=ai({width:null,height:null}),d=ai(!1),h=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 c=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=()=>{c.value&&t.updateElsHeight(),t.updateColumnsWidth(),requestAnimationFrame(f)};Cn((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:h.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)},f=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$&&ue(n.refs.scrollBarRef.wrap$,"scroll",f,{passive:!0}),e.fit?H(n.vnode.el,v):ue(window,"resize",v))},v=()=>{if(!n.$ready)return;let t=!1;const i=n.vnode.el,{width:o,height:s}=l.value,r=h.value=i.offsetWidth;o!==r&&(t=!0);const a=i.offsetHeight;(e.height||c.value)&&s!==a&&(t=!0),t&&(l.value={width:r,height:a},g())},b=m(),C=Pi((()=>{const{bodyWidth:e,scrollY:i,gutterWidth:n}=t;return e.value?e.value-(i.value?n:0)+"px":""})),w=Pi((()=>e.maxHeight?"fixed":e.tableLayout));function y(t,i,n){const o=nu(t),s=e.showHeader?n:0;if(null!==o)return No(o)?`calc(${o} - ${i}px - ${s}px)`:o-i-s}const S=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:s,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,s=t.footerHeight.value||0;if(e.height)return{height:n?`${n}px`:""};if(e.maxHeight){const t=y(e.maxHeight,s,i);if(null!==t)return{"max-height":`${t}${o(t)?"px":""}`}}return{}})),height:S,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:h.value?`${h.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=nu(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:C,resizeState:l,doLayout:g,tableBodyStyles:u,tableLayout:w,scrollbarViewStyle:{display:"block",verticalAlign:"middle"}}}var Wu={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 Hu=1;const zu=Zi({name:"ElTable",directives:{Mousewheel:$d},components:{TableHeader:Mu,TableBody:Ru,TableFooter:Bu,ElScrollbar:C,hColgroup:Pu},props:Wu,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}=w(),i=n("table"),s=en();En(Nu,s);const r=vu(s,e);s.store=r;const a=new wu({store:s.store,table:s,fit:e.fit,showHeader:e.showHeader});s.layout=a;const l=Pi((()=>0===(r.states.data.value||[]).length)),{setCurrentRow:d,getSelectionRows:h,toggleRowSelection:c,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:C,isGroup:y,handleMouseLeave:S,handleHeaderFooterMousewheel:x,tableSize:k,bodyHeight:L,height:D,emptyBlockStyle:E,handleFixedMousewheel:N,fixedHeight:I,fixedBodyHeight:T,resizeProxyVisible:M,bodyWidth:O,resizeState:A,doLayout:R,tableBodyStyles:P,tableLayout:F,scrollbarViewStyle:B}=Vu(e,a,r,s),{scrollBarRef:V,scrollTo:H,setScrollLeft:z,setScrollTop:j}=(()=>{const e=ai(),t=(t,i)=>{const n=e.value;n&&o(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=W(R,50),$="el-table_"+Hu++;s.tableId=$,s.state={isGroup:y,resizeState:A,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:x,handleMouseLeave:S,tableId:$,tableSize:k,isHidden:v,isEmpty:l,renderExpanded:b,resizeProxyVisible:M,resizeState:A,isGroup:y,bodyWidth:O,bodyHeight:L,height:D,tableBodyStyles:P,emptyBlockStyle:E,debouncedUpdateLayout:U,handleFixedMousewheel:N,fixedHeight:I,fixedBodyHeight:T,setCurrentRow:d,getSelectionRows:h,toggleRowSelection:c,clearSelection:u,clearFilter:g,toggleAllSelection:p,toggleRowExpansion:m,clearSort:f,doLayout:R,sort:_,t:t,setDragVisible:C,context:s,computedSumText:K,computedEmptyText:q,tableLayout:F,scrollbarViewStyle:B,scrollBarRef:V,scrollTo:H,setScrollLeft:z,setScrollTop:j}}}),ju=["data-prefix"],Uu={ref:"hiddenColumns",class:"hidden-columns"};var $u=s(zu,[["render",function(e,t,i,n,o,s){const r=An("hColgroup"),a=An("table-header"),l=An("table-body"),d=An("el-scrollbar"),h=An("table-footer"),c=Rn("mousewheel");return Ln(),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:wi(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",Uu,[On(e.$slots,"default")],512),e.showHeader&&"fixed"===e.tableLayout?so((Ln(),Vi("div",{key:0,ref:"headerWrapper",class:bi(e.ns.e("header-wrapper"))},[Wi("table",{ref:"tableHeader",class:bi(e.ns.e("header")),style:wi(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)),[[c,e.handleHeaderFooterMousewheel]]):Bi("v-if",!0),Wi("div",{ref:"bodyWrapper",style:wi(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:wi({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?(Ln(),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?(Ln(),Vi("div",{key:0,ref:"emptyBlock",style:wi(e.emptyBlockStyle),class:bi(e.ns.e("empty-block"))},[Wi("span",{class:bi(e.ns.e("empty-text"))},[On(e.$slots,"empty",{},(()=>[Ki(yi(e.computedEmptyText),1)]))],2)],6)):Bi("v-if",!0),e.$slots.append?(Ln(),Vi("div",{key:1,ref:"appendWrapper",class:bi(e.ns.e("append-wrapper"))},[On(e.$slots,"append")],2)):Bi("v-if",!0)])),_:3},8,["height","max-height","view-style","always"])],6),e.border||e.isGroup?(Ln(),Vi("div",{key:1,class:bi(e.ns.e("border-left-patch"))},null,2)):Bi("v-if",!0)],2),e.showSummary?so((Ln(),Vi("div",{key:0,ref:"footerWrapper",class:bi(e.ns.e("footer-wrapper"))},[qi(h,{border:e.border,"default-sort":e.defaultSort,store:e.store,style:wi(e.tableBodyStyles),"sum-text":e.computedSumText,"summary-method":e.summaryMethod},null,8,["border","default-sort","store","style","sum-text","summary-method"])],2)),[[Lo,!e.isEmpty],[c,e.handleHeaderFooterMousewheel]]):Bi("v-if",!0),so(Wi("div",{ref:"resizeProxy",class:bi(e.ns.e("column-resize-proxy"))},null,2),[[Lo,e.resizeProxyVisible]])],46,ju)}],["__file","/home/runner/work/element-plus/element-plus/packages/components/table/src/table.vue"]]);const Ku={selection:"table-column--selection",expand:"table__expand-column"},qu={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:""}},Gu={selection:{renderHeader:({store:e})=>on(ah,{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(ah,{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(b,null,{default:()=>[on(Xe)]})]})},sortable:!1,resizable:!1}};function Zu({row:e,column:t,$index:i}){var n;const o=t.property,s=o&&ge(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 Yu(e,t){return e.reduce(((e,t)=>(e[t]=t,e)),t)}function Xu(e,t,i){const o=en(),s=ai(""),r=ai(!1),a=ai(),l=ai(),d=n("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 h=Pi((()=>{let e=o.vnode.vParent||o.parent;for(;e&&!e.tableId&&!e.columnId;)e=e.vnode.vParent||e.parent;return e})),c=Pi((()=>{const{store:e}=o.parent;if(!e)return!1;const{treeData:t}=e.states,i=t.value;return i&&Object.keys(i).length>0})),u=ai(tu(e.width)),g=ai(iu(e.minWidth));return{columnId:s,realAlign:a,isSubColumn:r,realHeaderAlign:l,columnOrTableParent:h,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=Gu[t]||{};Object.keys(i).forEach((t=>{const n=i[t];"className"!==t&&void 0!==n&&(e[t]=n)}));const n=(e=>Ku[e]||"")(t);if(n){const t=`${fi(d.namespace)}-${n}`;e.className=e.className?`${e.className} ${t}`:t}return e},setColumnRenders:n=>{e.renderHeader||"selection"!==n.type&&(n.renderHeader=e=>{o.columnConfig.value.label;const i=t.header;return i?i(e):n.label});let s=n.renderCell;const r=c.value;return"expand"===n.type?(n.renderCell=e=>on("div",{class:"cell"},[s(e)]),i.value.renderExpanded=e=>t.default?t.default(e):t.default):(s=s||Zu,n.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=Xe;t.loading&&(i=Ye),s.push(on("div",{class:e,onClick:r},{default:()=>[on(b,{class:{[o.is("loading")]:t.loading}},{default:()=>[on(i)]})]}))}return s}(e,r&&0===e.cellIndex),l={class:"cell",style:{}};return n.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=o)}Array.isArray(e)?e.forEach((e=>t(e))):t(e)})(i),on("div",l,[a,i])}),n},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 Qu={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 Ju=1;var eg=Zi({name:"ElTableColumn",components:{ElCheckbox:ah},props:Qu,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=Yu(["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=tu(t)),"minWidth"===s&&"realMinWidth"===o&&(n=iu(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=Yu(["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:h,setColumnWidth:c,setColumnForcedProps:u,setColumnRenders:g,getPropsData:p,getColumnElIndex:m,realAlign:f}=Xu(e,t,o),_=h.value;a.value=`${_.tableId||_.columnId}_column_${Ju++}`,mn((()=>{l.value=o.value!==_;const t=e.type||"default",h=""===e.sortable||e.sortable,m={...qu[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:h,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);v=function(...e){return 0===e.length?e=>e:1===e.length?e[0]:e.reduce(((e,t)=>(...i)=>e(t(...i))))}(g,c,u)(v),n.value=v,s(),r()})),Cn((()=>{var e;const t=h.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===Li&&Array.isArray(e.children)&&e.children.forEach((e=>{1024===(null==e?void 0:e.patchFlag)||No(null==e?void 0:e.children)||o.push(e)}));return on("div",o)}catch(n){return on("div",[])}}});const tg=r($u,{TableColumn:eg}),ig=_(eg);var ng=s(Zi({name:"ElTabBar",props:i({tabs:{type:j(Array),default:()=>U([])}}),setup(e,{expose:t}){const i=e,o=en(),s=an(pd);s||oe("ElTabBar","<el-tabs><el-tab-bar /></el-tabs>");const r=n("tabs"),a=ai(),l=ai(),d=()=>l.value=(()=>{let e=0,t=0;const n=["top","bottom"].includes(s.props.tabPosition)?"width":"height",r="width"===n?"x":"y";return i.tabs.every((s=>{var a,l,d,h;const c=null==(l=null==(a=o.parent)?void 0:a.refs)?void 0:l[`tab-${s.paneName}`];if(!c)return!1;if(!s.active)return!0;t=c[`client${vi(n)}`];const u="x"===r?"left":"top";e=c.getBoundingClientRect()[u]-(null!=(h=null==(d=c.parentElement)?void 0:d.getBoundingClientRect()[u])?h:0);const g=window.getComputedStyle(c);return"width"===n&&(i.tabs.length>1&&(t-=Number.parseFloat(g.paddingLeft)+Number.parseFloat(g.paddingRight)),e+=Number.parseFloat(g.paddingLeft)),!1})),{[n]:`${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)=>(Ln(),Vi("div",{ref_key:"barRef",ref:a,class:bi([fi(r).e("active-bar"),fi(r).is(fi(s).props.tabPosition)]),style:wi(l.value)},null,6))}}),[["__file","/home/runner/work/element-plus/element-plus/packages/components/tabs/src/tab-bar.vue"]]);const og=i({panes:{type:j(Array),default:()=>U([])},currentName:{type:[String,Number],default:""},editable:Boolean,onTabClick:{type:j(Function),default:Oo},onTabRemove:{type:j(Function),default:Oo},type:{type:String,values:["card","border-card",""],default:""},stretch:Boolean}),sg=Zi({name:"ElTabNav",props:og,setup(e,{expose:t}){const i=en(),o=an(pd);o||oe("ElTabNav","<el-tabs><tab-nav /></el-tabs>");const s=n("tabs"),r=pe(),a=me(),l=ai(),d=ai(),h=ai(),c=ai(!1),u=ai(0),g=ai(!1),p=ai(!0),m=Pi((()=>["top","bottom"].includes(o.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},C=async()=>{const e=d.value;if(!(c.value&&h.value&&l.value&&e))return;await gn();const t=h.value.querySelector(".is-active");if(!t)return;const i=l.value,n=["top","bottom"].includes(o.props.tabPosition),s=t.getBoundingClientRect(),r=i.getBoundingClientRect(),a=n?e.offsetWidth-r.width:e.offsetHeight-r.height,g=u.value;let p=g;n?(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)},w=()=>{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;c.value=c.value||{},c.value.prev=i,c.value.next=i+t<e,e-i<t&&(u.value=e-t)}else c.value=!1,i>0&&(u.value=0)},y=e=>{const t=e.code,{up:i,down:n,left:o,right:s}=I;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(),S()},S=()=>{p.value&&(g.value=!0)},x=()=>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(h,w),Cn((()=>setTimeout((()=>C()),0))),kn((()=>w())),t({scrollToActiveTab:C,removeFocus:x}),Qn((()=>e.panes),(()=>i.update()),{flush:"post"}),()=>{const t=c.value?[qi("span",{class:[s.e("nav-prev"),s.is("disabled",!c.value.prev)],onClick:_},[qi(b,null,{default:()=>[qi(at,null,null)]})]),qi("span",{class:[s.e("nav-next"),s.is("disabled",!c.value.next)],onClick:v},[qi(b,null,{default:()=>[qi(Xe,null,null)]})])]:null,i=e.panes.map(((t,i)=>{var n,r,a,l;const d=null!=(r=null!=(n=t.props.name)?n:t.index)?r:`${i}`,h=t.isClosable||e.editable;t.index=`${i}`;const c=h?qi(b,{class:"is-icon-close",onClick:i=>e.onTabRemove(t,i)},{default:()=>[qi(et,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(o.props.tabPosition),s.is("active",t.active),s.is("disabled",t.props.disabled),s.is("closable",h),s.is("focus",g.value)],id:`tab-${d}`,key:`tab-${d}`,"aria-controls":`pane-${d}`,role:"tab","aria-selected":t.active,tabindex:p,onFocus:()=>S(),onBlur:()=>x(),onClick:i=>{x(),e.onTabClick(t,d,i)},onKeydown:i=>{!h||i.code!==I.delete&&i.code!==I.backspace||e.onTabRemove(t,i)}},[u,c])}));return qi("div",{ref:h,class:[s.e("nav-wrap"),s.is("scrollable",!!c.value),s.is(o.props.tabPosition)]},[t,qi("div",{class:s.e("nav-scroll"),ref:l},[qi("div",{class:[s.e("nav"),s.is(o.props.tabPosition),s.is("stretch",e.stretch&&["top","bottom"].includes(o.props.tabPosition))],ref:d,style:f.value,role:"tablist",onKeydown:y},[e.type?null:qi(ng,{tabs:[...e.panes]},null),i])])])}}}),rg=i({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:j(Function),default:()=>!0},stretch:Boolean}),ag=e=>No(e)||o(e);var lg=Zi({name:"ElTabs",props:rg,emits:{[g]:e=>ag(e),"tab-click":(e,t)=>t instanceof Event,"tab-change":e=>ag(e),edit:(e,t)=>["remove","add"].includes(t),"tab-remove":e=>ag(e),"tab-add":()=>!0},setup(e,{emit:t,slots:i,expose:o}){var s,r;const a=n("tabs"),l=ai(),d=si({}),h=ai(null!=(r=null!=(s=e.modelValue)?s:e.activeName)?r:"0"),c=async i=>{var n,o,s;if(h.value!==i&&!x(i))try{!1!==await(null==(n=e.beforeLeave)?void 0:n.call(e,i,h.value))&&((e=>{h.value=e,t(g,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||(c(i),t("tab-click",e,n))},p=(e,i)=>{e.props.disabled||x(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")};ie({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=>c(e))),Qn((()=>e.modelValue),(e=>c(e))),Qn(h,(async()=>{var e;await gn(),null==(e=l.value)||e.scrollToActiveTab()}));En(pd,{props:e,currentName:h,registerPane:e=>d[e.uid]=e,unregisterPane:e=>delete d[e]});return o({currentName:h}),()=>{const t=e.editable||e.addable?qi("span",{class:a.e("new-tab"),tabindex:"0",onClick:m,onKeydown:e=>{e.code===I.enter&&m()}},[qi(b,{class:a.is("icon-plus")},{default:()=>[qi(nt,null,null)]})]):null,n=qi("div",{class:[a.e("header"),a.is(e.tabPosition)]},[t,qi(sg,{ref:l,currentName:h.value,editable:e.editable,type:e.type,panes:Object.values(d),stretch:e.stretch,onTabClick:u,onTabRemove:p},null)]),o=qi("div",{class:a.e("content")},[On(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=i({label:{type:String,default:""},name:{type:[String,Number]},closable:Boolean,disabled:Boolean,lazy:Boolean}),hg=["id","aria-hidden","aria-labelledby"];var cg=s(Zi({name:"ElTabPane",props:dg,setup(e){const t=e,i=en(),o=Gn(),s=an(pd);s||oe("ElTabPane","usage: <el-tabs><el-tab-pane /></el-tabs/>");const r=n("tab-pane"),a=ai(),l=Pi((()=>t.closable||s.props.closable)),d=fe((()=>{var e;return s.currentName.value===(null!=(e=t.name)?e:a.value)})),h=ai(d.value),c=Pi((()=>{var e;return null!=(e=t.name)?e:a.value})),u=fe((()=>!t.lazy||h.value||d.value));Qn(d,(e=>{e&&(h.value=!0)}));const g=si({uid:i.uid,slots:o,props:t,paneName:c,active:d,index:a,isClosable:l});return Cn((()=>{s.registerPane(g)})),xn((()=>{s.unregisterPane(g.uid)})),(e,t)=>fi(u)?so((Ln(),Vi("div",{key:0,id:`pane-${fi(c)}`,class:bi(fi(r).b()),role:"tabpanel","aria-hidden":!fi(d),"aria-labelledby":`tab-${fi(c)}`},[On(e.$slots,"default")],10,hg)),[[Lo,fi(d)]]):Bi("v-if",!0)}}),[["__file","/home/runner/work/element-plus/element-plus/packages/components/tabs/src/tab-pane.vue"]]);const ug=r(lg,{TabPane:cg}),gg=_(cg),pg="$treeNodeId",mg=function(e,t){t&&!t[pg]&&Object.defineProperty(t,pg,{value:e.id,enumerable:!1,configurable:!1,writable:!1})},fg=function(e,t){return e?t[e]:t[pg]},_g=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}},vg=function(e){if(0===e.childNodes.length)return;const{all:t,none:i,half:n}=_g(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||vg(o))},bg=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 Cg=0;class wg{constructor(e){this.id=Cg++,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=bg(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)||mg(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)||mg(this,e),this.data=e,this.childNodes=[],t=0===this.level&&Array.isArray(this.data)?this.data:bg(this,"children")||[];for(let i=0,n=t.length;i<n;i++)this.insertChild({data:t[i]})}get label(){return bg(this,"label")}get key(){const e=this.store.key;return this.data?this.data[e]:null}get disabled(){return bg(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 wg)){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 wg(e)))instanceof wg&&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||vg(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}=_g(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}=_g(i);s||(this.checked=s,this.indeterminate=o)}};if(this.shouldLoadData())return void this.loadData((()=>{s(),vg(this)}),{checked:!1!==e});s()}const o=this.parent;o&&0!==o.level&&(i||vg(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[pg];!!s&&t.findIndex((e=>e[pg]===s))>=0?i[s]={index:o,data:e}:n.push({index:o,data:e})})),this.store.lazy||t.forEach((e=>{i[e[pg]]||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 yg{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 wg({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 wg)return e;const t="object"!=typeof e?e:fg(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))}}var Sg=s(Zi({name:"ElTreeNodeContent",props:{node:{type:Object,required:!0},renderContent:Function},setup(e){const t=n("tree"),i=an("NodeInstance"),o=an("RootTree");return()=>{const n=e.node,{data:s,store:r}=n;return e.renderContent?e.renderContent(on,{_self:i,node:n,data:s,store:r}):o.ctx.slots.default?o.ctx.slots.default({node:n,data:s}):on("span",{class:t.be("node","label")},[n.label])}}}),[["__file","/home/runner/work/element-plus/element-plus/packages/components/tree/src/tree-node-content.vue"]]);function xg(e){const t=an("TreeNodeMap",null),i={treeNodeExpand:t=>{e.node!==t&&e.node.collapse()},children:[]};return t&&t.children.push(i),En("TreeNodeMap",i),{broadcastExpanded:t=>{if(e.accordion)for(const e of i.children)e.treeNodeExpand(t)}}}const kg=Symbol("dragEvents");const Lg=Zi({name:"ElTreeNode",components:{ElCollapseTransition:K,ElCheckbox:ah,NodeContent:Sg,ElIcon:b,Loading:Ye},props:{node:{type:wg,default:()=>({})},props:{type:Object,default:()=>({})},accordion:Boolean,renderContent:Function,renderAfterExpand:Boolean,showCheckbox:{type:Boolean,default:!1}},emits:["node-expand"],setup(e,t){const i=n("tree"),{broadcastExpanded:o}=xg(e),s=an("RootTree"),r=ai(!1),a=ai(!1),l=ai(null),d=ai(null),h=ai(null),c=an(kg),u=en();En("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$:h,tree:s,expanded:r,childNodeRendered:a,oldChecked:l,oldIndeterminate:d,getNodeKey:e=>fg(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 No(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)=>{o(t),s.ctx.emit("node-expand",e,t,i)},handleDragStart:t=>{s.props.draggable&&c.treeNodeDragStart({event:t,treeNode:e})},handleDragOver:t=>{t.preventDefault(),s.props.draggable&&c.treeNodeDragOver({event:t,treeNode:{$el:h.value,node:e.node}})},handleDrop:e=>{e.preventDefault()},handleDragEnd:e=>{s.props.draggable&&c.treeNodeDragEnd(e)},CaretRight:lt}}}),Dg=["aria-expanded","aria-disabled","aria-checked","draggable","data-key"],Eg=["aria-expanded"];var Ng=s(Zi({name:"ElTree",components:{ElTreeNode:s(Lg,[["render",function(e,t,i,n,o,s){const r=An("el-icon"),a=An("el-checkbox"),l=An("loading"),d=An("node-content"),h=An("el-tree-node"),c=An("el-collapse-transition");return so((Ln(),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]=Eo(((...t)=>e.handleClick&&e.handleClick(...t)),["stop"])),onContextmenu:t[2]||(t[2]=(...t)=>e.handleContextMenu&&e.handleContextMenu(...t)),onDragstart:t[3]||(t[3]=Eo(((...t)=>e.handleDragStart&&e.handleDragStart(...t)),["stop"])),onDragover:t[4]||(t[4]=Eo(((...t)=>e.handleDragOver&&e.handleDragOver(...t)),["stop"])),onDragend:t[5]||(t[5]=Eo(((...t)=>e.handleDragEnd&&e.handleDragEnd(...t)),["stop"])),onDrop:t[6]||(t[6]=Eo(((...t)=>e.handleDrop&&e.handleDrop(...t)),["stop"]))},[Wi("div",{class:bi(e.ns.be("node","content")),style:wi({paddingLeft:(e.node.level-1)*e.tree.props.indent+"px"})},[e.tree.props.icon||e.CaretRight?(Ln(),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:Eo(e.handleExpandIconClick,["stop"])},{default:no((()=>[(Ln(),Fi(Pn(e.tree.props.icon||e.CaretRight)))])),_:1},8,["class","onClick"])):Bi("v-if",!0),e.showCheckbox?(Ln(),Fi(a,{key:1,"model-value":e.node.checked,indeterminate:e.node.indeterminate,disabled:!!e.node.disabled,onClick:t[0]||(t[0]=Eo((()=>{}),["stop"])),onChange:e.handleCheckChange},null,8,["model-value","indeterminate","disabled","onChange"])):Bi("v-if",!0),e.node.loading?(Ln(),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(c,null,{default:no((()=>[!e.renderAfterExpand||e.childNodeRendered?so((Ln(),Vi("div",{key:0,class:bi(e.ns.be("node","children")),role:"group","aria-expanded":e.expanded},[(Ln(!0),Vi(Li,null,Mn(e.node.childNodes,(t=>(Ln(),Fi(h,{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,Eg)),[[Lo,e.expanded]]):Bi("v-if",!0)])),_:1})],42,Dg)),[[Lo,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}=w(),o=n("tree"),s=ai(new yg({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),l=ai(null),d=ai(null),h=ai(null),{broadcastExpanded:u}=xg(e),{dragState:g}=function({props:e,ctx:t,el$:i,dropIndicator$:o,store:s}){const r=n("tree"),a=ai({showDropIndicator:!1,draggingNode:null,dropNode:null,allowDrop:!0,dropType:null});return En(kg,{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:n,treeNode:s})=>{const l=s,d=a.value.dropNode;d&&d!==l&&he(d.$el,r.is("drop-inner"));const h=a.value.draggingNode;if(!h||!l)return;let c=!0,u=!0,g=!0,p=!0;"function"==typeof e.allowDrop&&(c=e.allowDrop(h.node,l.node,"prev"),p=u=e.allowDrop(h.node,l.node,"inner"),g=e.allowDrop(h.node,l.node,"next")),n.dataTransfer.dropEffect=u||c||g?"move":"none",(c||u||g)&&d!==l&&(d&&t.emit("node-drag-leave",h.node,d.node,n),t.emit("node-drag-enter",h.node,l.node,n)),(c||u||g)&&(a.value.dropNode=l),l.node.nextSibling===h.node&&(g=!1),l.node.previousSibling===h.node&&(c=!1),l.node.contains(h.node,!1)&&(u=!1),(h.node===l.node||h.node.contains(l.node))&&(c=!1,u=!1,g=!1);const m=l.$el.getBoundingClientRect(),f=i.value.getBoundingClientRect();let _;const v=c?u?.25:g?.45:1:-1,b=g?u?.75:c?.55:0:1;let C=-9999;const w=n.clientY-m.top;_=w<m.height*v?"before":w>m.height*b?"after":u?"inner":"none";const y=l.$el.querySelector(`.${r.be("node","expand-icon")}`).getBoundingClientRect(),S=o.value;"before"===_?C=y.top-f.top:"after"===_&&(C=y.bottom-f.top),S.style.top=`${C}px`,S.style.left=y.right-f.left+"px","inner"===_?le(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",h.node,l.node,n)},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$:h,store:s});!function({el$:e},t){const i=n("tree"),o=hi([]),s=hi([]);Cn((()=>{l(),a(e.value,"keydown",r)})),fn((()=>{q(e.value,"keydown",r)})),kn((()=>{o.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=n=>{const s=n.target;if(!s.className.includes(i.b("node")))return;const r=n.code;o.value=Array.from(e.value.querySelectorAll(`.${i.is("focusable")}[role=treeitem]`));const a=o.value.indexOf(s);let l;if([I.up,I.down].includes(r)){if(n.preventDefault(),r===I.up){l=-1===a?0:0!==a?a-1:o.value.length-1;const e=l;for(;!t.value.getNode(o.value[l].dataset.key).canFocus;){if(l--,l===e){l=-1;break}l<0&&(l=o.value.length-1)}}else{l=-1===a?0:a<o.value.length-1?a+1:0;const e=l;for(;!t.value.getNode(o.value[l].dataset.key).canFocus;){if(l++,l===e){l=-1;break}l>=o.value.length&&(l=0)}}-1!==l&&o.value[l].focus()}[I.left,I.right].includes(r)&&(n.preventDefault(),s.click());const d=s.querySelector('[type="checkbox"]');[I.enter,I.space].includes(r)&&d&&(n.preventDefault(),d.click())},l=()=>{var t;o.value=Array.from(e.value.querySelectorAll(`.${i.is("focusable")}[role=treeitem]`)),s.value=Array.from(e.value.querySelectorAll("input[type=checkbox]"));const n=e.value.querySelectorAll(`.${i.is("checked")}[role=treeitem]`);n.length?n[0].setAttribute("tabindex","0"):null==(t=o.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 En("RootTree",{ctx:t,props:e,store:s,root:r,currentNode:l,instance:en()}),En(c,void 0),{ns:o,store:s,root:r,currentNode:l,dragState:g,el$:d,dropIndicator$:h,isEmpty:p,filter:t=>{if(!e.filterNodeMethod)throw new Error("[Tree] filterNodeMethod is required when filter");s.value.filter(t)},getNodeKey:t=>fg(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)=>{u(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)}}}}),[["render",function(e,t,i,n,o,s){var r;const a=An("el-tree-node");return Ln(),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"},[(Ln(!0),Vi(Li,null,Mn(e.root.childNodes,(t=>(Ln(),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?(Ln(),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),[[Lo,e.dragState.showDropIndicator]])],2)}],["__file","/home/runner/work/element-plus/element-plus/packages/components/tree/src/tree.vue"]]);Ng.install=e=>{e.component(Ng.name,Ng)};const Ig=Ng;class Tg extends Error{constructor(e,t,i,n){super(e),this.name="UploadAjaxError",this.status=t,this.method=i,this.url=n}}function Mg(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 Tg(n,i.status,t.method,e)}const Og=["text","picture","picture-card"];let Ag=1;const Rg=()=>Date.now()+Ag++,Pg=i({action:{type:String,default:"#"},headers:{type:j(Object)},method:{type:String,default:"post"},data:{type:Object,default:()=>U({})},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:j(Array),default:()=>U([])},autoUpload:{type:Boolean,default:!0},listType:{type:String,values:Og,default:"text"},httpRequest:{type:j(Function),default:e=>{"undefined"==typeof XMLHttpRequest&&oe("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(Mg(i,e,t))})),t.addEventListener("load",(()=>{if(t.status<200||t.status>=300)return e.onError(Mg(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))X(r)||t.setRequestHeader(s,String(r));return t.send(n),t}},disabled:Boolean,limit:Number}),Fg=i({...Pg,beforeUpload:{type:j(Function),default:Oo},beforeRemove:{type:j(Function)},onRemove:{type:j(Function),default:Oo},onChange:{type:j(Function),default:Oo},onPreview:{type:j(Function),default:Oo},onSuccess:{type:j(Function),default:Oo},onProgress:{type:j(Function),default:Oo},onError:{type:j(Function),default:Oo},onExceed:{type:j(Function),default:Oo}}),Bg=i({files:{type:j(Array),default:()=>U([])},disabled:{type:Boolean,default:!1},handlePreview:{type:j(Function),default:Oo},listType:{type:String,values:Og,default:"text"}}),Vg=["onKeydown"],Wg=["src"],Hg=["onClick"],zg=["onClick"],jg=["onClick"];var Ug=s(Zi({name:"ElUploadList",props:Bg,emits:{remove:e=>!!e},setup(e,{emit:t}){const i=e,{t:o}=w(),s=n("upload"),r=n("icon"),a=n("list"),l=ai(!1),d=e=>{t("remove",e)};return(e,t)=>(Ln(),Fi(ho,{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((()=>[(Ln(!0),Vi(Li,null,Mn(e.files,(n=>(Ln(),Vi("li",{key:n.uid||n.name,class:bi([fi(s).be("list","item"),fi(s).is(n.status),{focusing:l.value}]),tabindex:"0",onKeydown:Do((t=>!e.disabled&&d(n)),["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)},[On(e.$slots,"default",{file:n},(()=>["picture"===e.listType||"uploading"!==n.status&&"picture-card"===e.listType?(Ln(),Vi("img",{key:0,class:bi(fi(s).be("list","item-thumbnail")),src:n.url,alt:""},null,10,Wg)):Bi("v-if",!0),"picture"===e.listType||"uploading"!==n.status&&"picture-card"===e.listType?Bi("v-if",!0):(Ln(),Vi("div",{key:1,class:bi(fi(s).be("list","item-info"))},[Wi("a",{class:bi(fi(s).be("list","item-name")),onClick:Eo((e=>(e=>{i.handlePreview(e)})(n)),["prevent"])},[qi(fi(b),{class:bi(fi(r).m("document"))},{default:no((()=>[qi(fi(dt))])),_:1},8,["class"]),Wi("span",{class:bi(fi(s).be("list","item-file-name"))},yi(n.name),3)],10,Hg),"uploading"===n.status?(Ln(),Fi(fi(Fc),{key:0,type:"picture-card"===e.listType?"circle":"line","stroke-width":"picture-card"===e.listType?6:2,percentage:Number(n.percentage),style:wi("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?(Ln(),Fi(fi(b),{key:0,class:bi([fi(r).m("upload-success"),fi(r).m("circle-check")])},{default:no((()=>[qi(fi(rt))])),_:1},8,["class"])):["picture-card","picture"].includes(e.listType)?(Ln(),Fi(fi(b),{key:1,class:bi([fi(r).m("upload-success"),fi(r).m("check")])},{default:no((()=>[qi(fi(Ze))])),_:1},8,["class"])):Bi("v-if",!0)],2),e.disabled?Bi("v-if",!0):(Ln(),Fi(fi(b),{key:2,class:bi(fi(r).m("close")),onClick:e=>d(n)},{default:no((()=>[qi(fi(et))])),_: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):(Ln(),Vi("i",{key:3,class:bi(fi(r).m("close-tip"))},yi(fi(o)("el.upload.deleteTip")),3)),"picture-card"===e.listType?(Ln(),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(n)},[qi(fi(b),{class:bi(fi(r).m("zoom-in"))},{default:no((()=>[qi(fi(ht))])),_:1},8,["class"])],10,zg),e.disabled?Bi("v-if",!0):(Ln(),Vi("span",{key:0,class:bi(fi(s).be("list","item-delete")),onClick:e=>d(n)},[qi(fi(b),{class:bi(fi(r).m("delete"))},{default:no((()=>[qi(fi(ct))])),_:1},8,["class"])],10,jg))],2)):Bi("v-if",!0)]))],42,Vg)))),128)),On(e.$slots,"append")])),_:3},8,["class","name"]))}}),[["__file","/home/runner/work/element-plus/element-plus/packages/components/upload/src/upload-list.vue"]]);const $g=i({disabled:{type:Boolean,default:!1}}),Kg=["onDrop","onDragover"];var qg=s(Zi({name:"ElUploadDrag",props:$g,emits:{file:e=>Io(e)},setup(e,{emit:t}){const i=e,o=an(md);o||oe("ElUploadDrag","usage: <el-upload><el-upload-dragger /></el-upload>");const s=n("upload"),r=ai(!1),a=e=>{if(i.disabled)return;r.value=!1;const n=Array.from(e.dataTransfer.files),s=o.accept.value;if(!s)return void t("file",n);const a=n.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)=>(Ln(),Vi("div",{class:bi([fi(s).b("dragger"),fi(s).is("dragover",r.value)]),onDrop:Eo(a,["prevent"]),onDragover:Eo(l,["prevent"]),onDragleave:t[0]||(t[0]=Eo((e=>r.value=!1),["prevent"]))},[On(e.$slots,"default")],42,Kg))}}),[["__file","/home/runner/work/element-plus/element-plus/packages/components/upload/src/upload-dragger.vue"]]);const Gg=i({...Pg,beforeUpload:{type:j(Function),default:Oo},onRemove:{type:j(Function),default:Oo},onStart:{type:j(Function),default:Oo},onSuccess:{type:j(Function),default:Oo},onProgress:{type:j(Function),default:Oo},onError:{type:j(Function),default:Oo},onExceed:{type:j(Function),default:Oo}}),Zg=["onKeydown"],Yg=["name","multiple","accept"];var Xg=s(Zi({name:"ElUploadContent",inheritAttrs:!1,props:Gg,setup(e,{expose:t}){const i=e,o=n("upload"),s=hi({}),r=hi(),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=Rg(),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:h,onError:c,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=>{h(t,e),delete s.value[g]},onError:t=>{c(t,e),delete s.value[g]}},m=u(p);s.value[g]=m,m instanceof Promise&&m.then(p.onSuccess,p.onError)},h=e=>{const t=e.target.files;t&&a(Array.from(t))},c=()=>{i.disabled||(r.value.value="",r.value.click())},u=()=>{c()};return t({abort:e=>{_e(s.value).filter(e?([t])=>String(e.uid)===t:()=>!0).forEach((([e,t])=>{t instanceof XMLHttpRequest&&t.abort(),delete s.value[e]}))},upload:l}),(e,t)=>(Ln(),Vi("div",{class:bi([fi(o).b(),fi(o).m(e.listType),fi(o).is("drag",e.drag)]),tabindex:"0",onClick:c,onKeydown:Do(Eo(u,["self"]),["enter","space"])},[e.drag?(Ln(),Fi(qg,{key:0,disabled:e.disabled,onFile:a},{default:no((()=>[On(e.$slots,"default")])),_:3},8,["disabled"])):On(e.$slots,"default",{key:1}),Wi("input",{ref_key:"inputRef",ref:r,class:bi(fi(o).e("input")),name:e.name,multiple:e.multiple,accept:e.accept,type:"file",onChange:h,onClick:t[0]||(t[0]=Eo((()=>{}),["stop"]))},null,42,Yg)],42,Zg))}}),[["__file","/home/runner/work/element-plus/element-plus/packages/components/upload/src/upload-content.vue"]]);const Qg=(e,t)=>{const i=ve(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=Rg()),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){f("ElUpload",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||oe("ElUpload","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))}))}}};const Jg=r(s(Zi({name:"ElUpload",props:Fg,setup(e,{expose:t}){const i=e,n=Gn(),o=J(),s=hi(),{abort:r,submit:a,clearFiles:l,uploadFiles:d,handleStart:h,handleError:c,handleRemove:u,handleSuccess:g,handleProgress:p}=Qg(i,s),m=Pi((()=>"picture-card"===i.listType)),f=Pi((()=>({...i,onStart:h,onProgress:p,onSuccess:g,onError:c,onRemove:u})));return fn((()=>{d.value.forEach((({url:e})=>{(null==e?void 0:e.startsWith("blob:"))&&URL.revokeObjectURL(e)}))})),En(md,{accept:gi(i,"accept")}),t({abort:r,submit:a,clearFiles:l,handleStart:h,handleRemove:u}),(e,t)=>(Ln(),Vi("div",null,[fi(m)&&e.showFileList?(Ln(),Fi(Ug,{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?(Ln(),Fi(Xg,un({key:0,ref_key:"uploadRef",ref:s},fi(f)),{default:no((()=>[fi(n).trigger?On(e.$slots,"trigger",{key:0}):Bi("v-if",!0),!fi(n).trigger&&fi(n).default?On(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})=>[On(e.$slots,"file",{file:t})]))}:void 0]),1032,["disabled","list-type","files","handle-preview","onRemove"])):Bi("v-if",!0),"picture-card"!==e.listType?(Ln(),Fi(Xg,un({key:1,ref_key:"uploadRef",ref:s},fi(f)),{default:no((()=>[fi(n).trigger?On(e.$slots,"trigger",{key:0}):Bi("v-if",!0),!fi(n).trigger&&fi(n).default?On(e.$slots,"default",{key:1}):Bi("v-if",!0)])),_:3},16)):Bi("v-if",!0),e.$slots.trigger?On(e.$slots,"default",{key:2}):Bi("v-if",!0),On(e.$slots,"tip"),!fi(m)&&e.showFileList?(Ln(),Fi(Ug,{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})=>[On(e.$slots,"file",{file:t})]))}:void 0]),1032,["disabled","list-type","files","handle-preview","onRemove"])):Bi("v-if",!0)]))}}),[["__file","/home/runner/work/element-plus/element-plus/packages/components/upload/src/upload.vue"]])),ep=["success","info","warning","error"],tp=U({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}),ip=i({customClass:{type:String,default:tp.customClass},center:{type:Boolean,default:tp.center},dangerouslyUseHTMLString:{type:Boolean,default:tp.dangerouslyUseHTMLString},duration:{type:Number,default:tp.duration},icon:{type:te,default:tp.icon},id:{type:String,default:tp.id},message:{type:j([String,Object,Function]),default:tp.message},onClose:{type:j(Function),required:!1},showClose:{type:Boolean,default:tp.showClose},type:{type:String,values:ep,default:tp.type},offset:{type:Number,default:tp.offset},zIndex:{type:Number,default:tp.zIndex},grouping:{type:Boolean,default:tp.grouping},repeatNum:{type:Number,default:tp.repeatNum}}),np=li([]),op=e=>{const{prev:t}=(e=>{const t=np.findIndex((t=>t.id===e)),i=np[t];let n;return t>0&&(n=np[t-1]),{current:i,prev:n}})(e);return t?t.vm.exposeProxy.bottom:0},sp=["id"],rp=["innerHTML"];var ap=s(Zi({name:"ElMessage",props:ip,emits:{destroy:()=>!0},setup(e,{expose:t}){const i=e,{Close:o}=Ce,s=n("message"),r=ai(),a=ai(!1),l=ai(0);let d;const h=Pi((()=>i.type?"error"===i.type?"danger":i.type:"info")),c=Pi((()=>{const e=i.type;return{[s.bm("icon",e)]:e&&be[e]}})),u=Pi((()=>i.icon||be[i.type]||"")),g=Pi((()=>op(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}=we((()=>{C()}),i.duration))}function v(){null==d||d()}function C(){a.value=!1}return Cn((()=>{_(),a.value=!0})),Qn((()=>i.repeatNum),(()=>{v(),_()})),ue(document,"keydown",(function({code:e}){e===I.esc&&C()})),H(r,(()=>{l.value=r.value.getBoundingClientRect().height})),t({visible:a,bottom:m,close:C}),(e,t)=>(Ln(),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:wi(fi(f)),role:"alert",onMouseenter:v,onMouseleave:_},[e.repeatNum>1?(Ln(),Fi(fi(vd),{key:0,value:e.repeatNum,type:fi(h),class:bi(fi(s).e("badge"))},null,8,["value","type","class"])):Bi("v-if",!0),fi(u)?(Ln(),Fi(fi(b),{key:1,class:bi([fi(s).e("icon"),fi(c)])},{default:no((()=>[(Ln(),Fi(Pn(fi(u))))])),_:1},8,["class"])):Bi("v-if",!0),On(e.$slots,"default",{},(()=>[e.dangerouslyUseHTMLString?(Ln(),Vi(Li,{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,rp)],2112)):(Ln(),Vi("p",{key:0,class:bi(fi(s).e("content"))},yi(e.message),3))])),e.showClose?(Ln(),Fi(fi(b),{key:2,class:bi(fi(s).e("closeBtn")),onClick:Eo(C,["stop"])},{default:no((()=>[qi(fi(o))])),_:1},8,["class","onClick"])):Bi("v-if",!0)],46,sp),[[Lo,a.value]])])),_:3},8,["name","onBeforeLeave"]))}}),[["__file","/home/runner/work/element-plus/element-plus/packages/components/message/src/message.vue"]]);let lp=1;const dp=e=>{const t=!e||No(e)||hn(e)||Mo(e)?{message:e}:e,i={...tp,...t};if(No(i.appendTo)){let e=document.querySelector(i.appendTo);Se(e)||(e=document.body),i.appendTo=e}return i},hp=({appendTo:e,...t},i)=>{const{nextZIndex:n}=se(),o="message_"+lp++,s=t.onClose,r=document.createElement("div"),a={...t,zIndex:n()+t.zIndex,id:o,onClose:()=>{null==s||s(),(e=>{const t=np.indexOf(e);if(-1===t)return;np.splice(t,1);const{handler:i}=e;i.close()})(c)},onDestroy:()=>{vo(null,r)}},l=qi(ap,a,Mo(a.message)||hn(a.message)?{default:a.message}:null);l.appContext=i||cp._context,vo(l,r),e.appendChild(r.firstElementChild);const d=l.component,h={close:()=>{d.exposeProxy.visible=!1}},c={id:o,vnode:l,vm:d,handler:h,props:l.component.props};return c},cp=(e={},t)=>{if(!E)return{close:()=>{}};if(o(ye.max)&&np.length>=ye.max)return{close:()=>{}};const i=dp(e);if(i.grouping&&np.length){const e=np.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=hp(i,t);return np.push(n),n.handler};ep.forEach((e=>{cp[e]=(t={},i)=>{const n=dp(t);return cp({...n,type:e},i)}})),cp.closeAll=function(e){for(const t of np)e&&e!==t.props.type||t.handler.close()},cp._context=null;const up=xe(cp,"$message");const gp=Zi({name:"Preview",props:{visible:{type:Boolean,default:!1}},emits:["update:visible"],setup(e,{emit:t}){const i=ve(e,"visible",t),n=`${ut}preview/${location.hash}`;return(e,t)=>{const o=ke;return Ln(),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)?(Ln(),Vi("iframe",{key:0,style:{width:"100%",height:"100%"},src:n,frameborder:"0",scrolling:"auto"})):Bi("",!0)])),_:1},8,["modelValue"])}}});var pp={},mp={},fp={};let _p;const vp=[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];fp.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},fp.getSymbolTotalCodewords=function(e){return vp[e]},fp.getBCHDigit=function(e){let t=0;for(;0!==e;)t++,e>>>=1;return t},fp.setToSJISFunction=function(e){if("function"!=typeof e)throw new Error('"toSJISFunc" is not a valid function.');_p=e},fp.isKanjiModeEnabled=function(){return void 0!==_p},fp.toSJIS=function(e){return _p(e)};var bp,Cp={};function wp(){this.buffer=[],this.length=0}(bp=Cp).L={bit:1},bp.M={bit:0},bp.Q={bit:3},bp.H={bit:2},bp.isValid=function(e){return e&&void 0!==e.bit&&e.bit>=0&&e.bit<4},bp.from=function(e,t){if(bp.isValid(e))return e;try{return function(e){if("string"!=typeof e)throw new Error("Param is not a string");switch(e.toLowerCase()){case"l":case"low":return bp.L;case"m":case"medium":return bp.M;case"q":case"quartile":return bp.Q;case"h":case"high":return bp.H;default:throw new Error("Unknown EC Level: "+e)}}(e)}catch(i){return t}},wp.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 yp=wp;function Sp(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)}Sp.prototype.set=function(e,t,i,n){const o=e*this.size+t;this.data[o]=i,n&&(this.reservedBit[o]=!0)},Sp.prototype.get=function(e,t){return this.data[e*this.size+t]},Sp.prototype.xor=function(e,t,i){this.data[e*this.size+t]^=i},Sp.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]};var xp=Sp,kp={};!function(e){const t=fp.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}}(kp);var Lp={};const Dp=fp.getSymbolSize;Lp.getPositions=function(e){const t=Dp(e);return[[0,0],[t-7,0],[0,t-7]]};var Ep={};!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}}(Ep);var Np={};const Ip=Cp,Tp=[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],Mp=[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];Np.getBlocksCount=function(e,t){switch(t){case Ip.L:return Tp[4*(e-1)+0];case Ip.M:return Tp[4*(e-1)+1];case Ip.Q:return Tp[4*(e-1)+2];case Ip.H:return Tp[4*(e-1)+3];default:return}},Np.getTotalCodewordsCount=function(e,t){switch(t){case Ip.L:return Mp[4*(e-1)+0];case Ip.M:return Mp[4*(e-1)+1];case Ip.Q:return Mp[4*(e-1)+2];case Ip.H:return Mp[4*(e-1)+3];default:return}};var Op={},Ap={};const Rp=new Uint8Array(512),Pp=new Uint8Array(256);!function(){let e=1;for(let t=0;t<255;t++)Rp[t]=e,Pp[e]=t,e<<=1,256&e&&(e^=285);for(let t=255;t<512;t++)Rp[t]=Rp[t-255]}(),Ap.log=function(e){if(e<1)throw new Error("log("+e+")");return Pp[e]},Ap.exp=function(e){return Rp[e]},Ap.mul=function(e,t){return 0===e||0===t?0:Rp[Pp[e]+Pp[t]]},function(e){const t=Ap;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}}(Op);const Fp=Op;function Bp(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}Bp.prototype.initialize=function(e){this.degree=e,this.genPoly=Fp.generateECPolynomial(this.degree)},Bp.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=Fp.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 Vp=Bp,Wp={},Hp={},zp={isValid:function(e){return!isNaN(e)&&e>=1&&e<=40}},jp={};let Up="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";Up=Up.replace(/u/g,"\\u");const $p="(?:(?![A-Z0-9 $%*+\\-./:]|"+Up+")(?:.|[\r\n]))+";jp.KANJI=new RegExp(Up,"g"),jp.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),jp.BYTE=new RegExp($p,"g"),jp.NUMERIC=new RegExp("[0-9]+","g"),jp.ALPHANUMERIC=new RegExp("[A-Z $%*+\\-./:]+","g");const Kp=new RegExp("^"+Up+"$"),qp=new RegExp("^[0-9]+$"),Gp=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");jp.testKanji=function(e){return Kp.test(e)},jp.testNumeric=function(e){return qp.test(e)},jp.testAlphanumeric=function(e){return Gp.test(e)},function(e){const t=zp,i=jp;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}}}(Hp),function(e){const t=fp,i=Np,n=Cp,o=Hp,s=zp,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}}(Wp);var Zp={};const Yp=fp,Xp=Yp.getBCHDigit(1335);Zp.getEncodedBits=function(e,t){const i=e.bit<<3|t;let n=i<<10;for(;Yp.getBCHDigit(n)-Xp>=0;)n^=1335<<Yp.getBCHDigit(n)-Xp;return 21522^(i<<10|n)};var Qp={};const Jp=Hp;function em(e){this.mode=Jp.NUMERIC,this.data=e.toString()}em.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)},em.prototype.getLength=function(){return this.data.length},em.prototype.getBitsLength=function(){return em.getBitsLength(this.data.length)},em.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 tm=em;const im=Hp,nm=["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 om(e){this.mode=im.ALPHANUMERIC,this.data=e}om.getBitsLength=function(e){return 11*Math.floor(e/2)+e%2*6},om.prototype.getLength=function(){return this.data.length},om.prototype.getBitsLength=function(){return om.getBitsLength(this.data.length)},om.prototype.write=function(e){let t;for(t=0;t+2<=this.data.length;t+=2){let i=45*nm.indexOf(this.data[t]);i+=nm.indexOf(this.data[t+1]),e.put(i,11)}this.data.length%2&&e.put(nm.indexOf(this.data[t]),6)};var sm=om;const rm=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},am=Hp;function lm(e){this.mode=am.BYTE,this.data=new Uint8Array(rm(e))}lm.getBitsLength=function(e){return 8*e},lm.prototype.getLength=function(){return this.data.length},lm.prototype.getBitsLength=function(){return lm.getBitsLength(this.data.length)},lm.prototype.write=function(e){for(let t=0,i=this.data.length;t<i;t++)e.put(this.data[t],8)};var dm=lm;const hm=Hp,cm=fp;function um(e){this.mode=hm.KANJI,this.data=e}um.getBitsLength=function(e){return 13*e},um.prototype.getLength=function(){return this.data.length},um.prototype.getBitsLength=function(){return um.getBitsLength(this.data.length)},um.prototype.write=function(e){let t;for(t=0;t<this.data.length;t++){let i=cm.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 gm,pm=um,mm={exports:{}};mm.exports=gm={single_source_shortest_paths:function(e,t,i){var n={},o={};o[t]=0;var s,r,a,l,d,h,c,u=gm.PriorityQueue.make();for(u.push(t,0);!u.empty();)for(a in r=(s=u.pop()).value,l=s.cost,d=e[r]||{})d.hasOwnProperty(a)&&(h=l+d[a],c=o[a],(void 0===o[a]||c>h)&&(o[a]=h,u.push(a,h),n[a]=r));if(void 0!==i&&void 0===o[i]){var g=["Could not find a path from ",t," to ",i,"."].join("");throw new Error(g)}return n},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,t,i){var n=gm.single_source_shortest_paths(e,t,i);return gm.extract_shortest_path_from_predecessor_list(n,i)},PriorityQueue:{make:function(e){var t,i=gm.PriorityQueue,n={};for(t in e=e||{},i)i.hasOwnProperty(t)&&(n[t]=i[t]);return n.queue=[],n.sorter=e.sorter||i.default_sorter,n},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}}},function(e){const t=Hp,i=tm,n=sm,o=dm,s=pm,r=jp,a=fp,l=mm.exports;function d(e){return unescape(encodeURIComponent(e)).length}function h(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 c(e){const i=h(r.NUMERIC,t.NUMERIC,e),n=h(r.ALPHANUMERIC,t.ALPHANUMERIC,e);let o,s;a.isKanjiModeEnabled()?(o=h(r.BYTE,t.BYTE,e),s=h(r.KANJI,t.KANJI,e)):(o=h(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}(c(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],h=""+r+e;l.push(h),n[h]={node:d,lastCount:0},o[h]={};for(let e=0;e<s.length;e++){const r=s[e];n[r]&&n[r].node.mode===d.mode?(o[r][h]=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][h]=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"),h=[];for(let e=1;e<r.length-1;e++)h.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)}),[])}(h))},e.rawSplit=function(t){return e.fromArray(c(t,a.isKanjiModeEnabled()))}}(Qp);const fm=fp,_m=Cp,vm=yp,bm=xp,Cm=kp,wm=Lp,ym=Ep,Sm=Np,xm=Vp,km=Wp,Lm=Zp,Dm=Hp,Em=Qp;function Nm(e,t,i){const n=e.size,o=Lm.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 Im(e,t,i){const n=new vm;i.forEach((function(t){n.put(t.mode.bit,4),n.put(t.getLength(),Dm.getCharCountIndicator(t.mode,e)),t.write(n)}));const o=8*(fm.getSymbolTotalCodewords(e)-Sm.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=fm.getSymbolTotalCodewords(t),o=Sm.getTotalCodewordsCount(t,i),s=n-o,r=Sm.getBlocksCount(t,i),a=r-n%r,l=Math.floor(n/r),d=Math.floor(s/r),h=d+1,c=l-d,u=new xm(c);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:h;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,C,w=0;for(b=0;b<f;b++)for(C=0;C<r;C++)b<p[C].length&&(v[w++]=p[C][b]);for(b=0;b<c;b++)for(C=0;C<r;C++)v[w++]=m[C][b];return v}(n,e,t)}function Tm(e,t,i,n){let o;if(Array.isArray(e))o=Em.fromArray(e);else{if("string"!=typeof e)throw new Error("Invalid data");{let n=t;if(!n){const t=Em.rawSplit(e);n=km.getBestVersionForData(t,i)}o=Em.fromString(e,n||40)}}const s=km.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=Im(t,i,o),a=fm.getSymbolSize(t),l=new bm(a);return function(e,t){const i=e.size,n=wm.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=Cm.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),Nm(l,i,0),t>=7&&function(e,t){const i=e.size,n=km.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=ym.getBestMask(l,Nm.bind(null,l,i))),ym.applyMask(n,l),Nm(l,i,n),{modules:l,version:t,errorCorrectionLevel:i,maskPattern:n,segments:o}}mp.create=function(e,t){if(void 0===e||""===e)throw new Error("No input text");let i,n,o=_m.M;return void 0!==t&&(o=_m.from(t.errorCorrectionLevel,_m.M),i=km.from(t.version),n=ym.from(t.maskPattern),t.toSJISFunc&&fm.setToSJISFunction(t.toSJISFunc)),Tm(e,i,o,n)};var Mm={},Om={};!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 h=4*(e*a+i),c=n.color.light;if(e>=l&&i>=l&&e<a-l&&i<a-l){c=d[s[Math.floor((e-l)/r)*o+Math.floor((i-l)/r)]?1:0]}t[h++]=c.r,t[h++]=c.g,t[h++]=c.b,t[h]=c.a}}}(Om),function(e){const t=Om;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)}}(Mm);var Am={};const Rm=Om;function Pm(e,t){const i=e.a/255,n=t+'="'+e.hex+'"';return i<1?n+" "+t+'-opacity="'+i.toFixed(2).slice(1)+'"':n}function Fm(e,t,i){let n=e+t;return void 0!==i&&(n+=" "+i),n}Am.render=function(e,t,i){const n=Rm.getOptions(t),o=e.modules.size,s=e.modules.data,r=o+2*n.margin,a=n.color.light.a?"<path "+Pm(n.color.light,"fill")+' d="M0 0h'+r+"v"+r+'H0z"/>':"",l="<path "+Pm(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?Fm("M",l+i,.5+d+i):Fm("m",o,0),o=0,s=!1),l+1<t&&e[a+1]||(n+=Fm("h",r),r=0)):o++}return n}(s,o,n.margin)+'"/>',d='viewBox="0 0 '+r+" "+r+'"',h='<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,h),h};const Bm=function(){return"function"==typeof Promise&&Promise.prototype&&Promise.prototype.then},Vm=mp,Wm=Mm,Hm=Am;function zm(e,t,i,n,o){const s=[].slice.call(arguments,1),r=s.length,a="function"==typeof s[r-1];if(!a&&!Bm())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=Vm.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=Vm.create(i,n);o(null,e(s,t,n))}catch(l){o(l)}}pp.create=Vm.create,pp.toCanvas=zm.bind(null,Wm.render),pp.toDataURL=zm.bind(null,Wm.renderToDataURL),pp.toString=zm.bind(null,(function(e,t,i){return Hm.render(e,i)}));const jm=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==(t=(e=i.options).onConfirm)?void 0:t.call(e)),n.hide()},onCancel:()=>{var e,t;null==(t=(e=i.options).onCancel)||t.call(e),n.hide()}};return Object.assign(t.proxy,n),()=>qi(ke,un({modelValue:i.visible,"onUpdate:modelValue":e=>i.visible=e,title:i.options.title,destroyOnClose:!0},i.options.props,{onClose:o.onCancel}),{default:()=>hn(i.options.content)?qi(An("content"),null,null):gt(i.options.content)?i.options.content():null,footer:()=>null===i.options.footer?null:qi("div",null,[qi(Z,{onClick:o.onCancel},{default:()=>[Ki("取消")]}),qi(Z,un({type:"primary"},{onClick:o.onConfirm}),{default:()=>[Ki("确定")]})])})}}),Um=(()=>{let e;return t=>{if(e)return e.service(t),e;const i=document.createElement("div");document.body.appendChild(i);const n=uo(jm,{options:t});return e=n.mount(i),e}})();function $m(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 Km={tabSize:4,indentSize:4,insertSpaces:!0,detectIndentation:!0,trimAutoWhitespace:!0,largeFileOptimizations:!0,bracketPairColorizationOptions:{enabled:!1}};class qm{constructor(e){this._values=e}hasChanged(e){return this._values[e]}}class Gm{constructor(){this.stableMinimapLayoutInput=null,this.stableFitMaxMinimapScale=0,this.stableFitRemainingWidth=0}}class Zm{constructor(e,t,i,n){this.id=e,this.name=t,this.defaultValue=i,this.schema=n}applyUpdate(e,t){return Xm(e,t)}compute(e,t,i){return i}}class Ym{constructor(e,t){this.newValue=e,this.didChange=t}}function Xm(e,t){if("object"!=typeof e||"object"!=typeof t||!e||!t)return new Ym(t,e!==t);if(Array.isArray(e)||Array.isArray(t)){const i=Array.isArray(e)&&Array.isArray(t)&&jo(e,t);return new Ym(t,i)}let i=!1;for(const n in t)if(t.hasOwnProperty(n)){const o=Xm(e[n],t[n]);o.didChange&&(e[n]=o.newValue,i=!0)}return new Ym(e,i)}class Qm{constructor(e){this.schema=void 0,this.id=e,this.name="_never_",this.defaultValue=void 0}applyUpdate(e,t){return Xm(e,t)}validate(e){return this.defaultValue}}class Jm{constructor(e,t,i,n){this.id=e,this.name=t,this.defaultValue=i,this.schema=n}applyUpdate(e,t){return Xm(e,t)}validate(e){return void 0===e?this.defaultValue:e}compute(e,t,i){return i}}function ef(e,t){return void 0===e?t:"false"!==e&&Boolean(e)}class tf extends Jm{constructor(e,t,i,n){void 0!==n&&(n.type="boolean",n.default=i),super(e,t,i,n)}validate(e){return ef(e,this.defaultValue)}}function nf(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 of extends Jm{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 nf(e,t,i,n)}validate(e){return of.clampedInt(e,this.defaultValue,this.minimum,this.maximum)}}class sf extends Jm{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(sf.float(e,this.defaultValue))}}class rf extends Jm{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 rf.string(e,this.defaultValue)}}function af(e,t,i){return"string"!=typeof e||-1===i.indexOf(e)?t:e}class lf extends Jm{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 af(e,this.defaultValue,this._allowedValues)}}class df extends Zm{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 hf,cf;(cf=hf||(hf={}))[cf.Line=1]="Line",cf[cf.Block=2]="Block",cf[cf.Underline=3]="Underline",cf[cf.LineThin=4]="LineThin",cf[cf.BlockOutline=5]="BlockOutline",cf[cf.UnderlineThin=6]="UnderlineThin";class uf extends Zm{constructor(){super(45,"fontLigatures",uf.OFF,{anyOf:[{type:"boolean",description:$m(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:$m(0,"Explicit 'font-feature-settings' CSS property. A boolean can be passed instead if one only needs to turn on/off ligatures.")}],description:$m(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?uf.OFF:"true"===e?uf.ON:e:Boolean(e)?uf.ON:uf.OFF}}uf.OFF='"liga" off, "calt" off',uf.ON='"liga" on, "calt" on';class gf extends Zm{constructor(){super(47,"fontWeight",kf.fontWeight,{anyOf:[{type:"number",minimum:gf.MINIMUM_VALUE,maximum:gf.MAXIMUM_VALUE,errorMessage:$m(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:gf.SUGGESTION_VALUES}],default:kf.fontWeight,description:$m(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(of.clampedInt(e,kf.fontWeight,gf.MINIMUM_VALUE,gf.MAXIMUM_VALUE))}}gf.SUGGESTION_VALUES=["normal","bold","100","200","300","400","500","600","700","800","900"],gf.MINIMUM_VALUE=1,gf.MAXIMUM_VALUE=1e3;class pf extends Qm{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,h=e.minimap.renderCharacters;let c=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=h?2:3;let C=Math.floor(o*n);const w=C/o;let y=!1,S=!1,x=b*c,k=c/o,L=1;if("fill"===g||"fit"===g){const{typicalViewportLineCount:i,extraLinesBeyondLastLine:s,desiredRatio:l,minimapLineCount:h}=pf.computeContainedMinimapLineCount({viewLineCount:f,scrollBeyondLastLine:d,height:n,lineHeight:a,pixelRatio:o});if(f/h>1)y=!0,S=!0,c=1,x=1,k=c/o;else{let n=!1,d=c+1;if("fit"===g){const e=Math.ceil((f+s)*x);v&&r&&_<=t.stableFitRemainingWidth?(n=!0,d=t.stableFitMaxMinimapScale):n=e>C}if("fill"===g||n){y=!0;const n=c;x=Math.min(a*o,Math.max(1,Math.floor(1/l))),v&&r&&_<=t.stableFitRemainingWidth&&(d=t.stableFitMaxMinimapScale),c=Math.min(d,Math.max(1,Math.floor(x/b))),c>n&&(L=Math.min(2,c/n)),k=c/o/L,C=Math.ceil(Math.max(i,f+s)*x),v?(t.stableMinimapLayoutInput=e,t.stableFitRemainingWidth=_,t.stableFitMaxMinimapScale=c):(t.stableMinimapLayoutInput=null,t.stableFitRemainingWidth=0)}}}const D=Math.floor(u*k),E=Math.min(D,Math.max(0,Math.floor((_-m-2)*k/(l+k)))+8);let N=Math.floor(o*E);const I=N/o;N=Math.floor(N*L);return{renderMinimap:h?1:2,minimapLeft:"left"===p?0:i-E-m,minimapWidth:E,minimapHeightIsEditorHeight:y,minimapIsSampling:S,minimapScale:c,minimapLineHeight:x,minimapCanvasInnerWidth:N,minimapCanvasInnerHeight:C,minimapCanvasOuterWidth:I,minimapCanvasOuterHeight:w}}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,h=e.get(123),c="inherit"===h?e.get(122):h,u="inherit"===c?e.get(118):c,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),C=e.get(65),w=e.get(92),y=w.verticalScrollbarSize,S=w.verticalHasArrows,x=w.arrowSize,k=w.horizontalScrollbarSize,L=e.get(58),D=e.get(37);let E;if("string"==typeof L&&/^\d+(\.\d+)?ch$/.test(L)){const e=parseFloat(L.substr(0,L.length-2));E=of.clampedInt(e*r,0,0,1e3)}else E=of.clampedInt(L,0,0,1e3);D&&(E+=16);let N=0;if(_){const e=Math.max(s,v);N=Math.round(e*a)}let I=0;f&&(I=o);let T=0,M=T+I,O=M+N,A=O+E;const R=i-I-N-E;let P=!1,F=!1,B=-1;2!==p&&("inherit"===c&&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:C,verticalScrollbarWidth:y,viewLineCount:d,remainingWidth:R,isViewportWrapping:F},t.memory||new Gm);0!==V.renderMinimap&&0===V.minimapLeft&&(T+=V.minimapWidth,M+=V.minimapWidth,O+=V.minimapWidth,A+=V.minimapWidth);const W=R-V.minimapWidth,H=Math.max(1,Math.floor((W-y-2)/r)),z=S?x:0;return F&&(B=Math.max(1,H),"bounded"===u&&(B=Math.min(B,g))),{width:i,height:n,glyphMarginLeft:T,glyphMarginWidth:I,lineNumbersLeft:M,lineNumbersWidth:N,decorationsLeft:O,decorationsWidth:E,contentLeft:A,contentWidth:W,minimap:V,viewportColumn:H,isWordWrapMinified:P,isViewportWrapping:F,wrappingColumn:B,verticalScrollbarWidth:y,horizontalScrollbarHeight:k,overviewRuler:{top:z,width:y,height:n-2*z,right:0}}}}function mf(e){const t=e.get(87);return"editable"===t?e.get(81):"on"!==t}function ff(e,t){if("string"!=typeof e)return t;switch(e){case"hidden":return 2;case"visible":return 3;default:return 1}}const _f="editor.unicodeHighlight.allowedCharacters",vf="editor.unicodeHighlight.invisibleCharacters",bf="editor.unicodeHighlight.nonBasicASCII",Cf="editor.unicodeHighlight.ambiguousCharacters",wf="editor.unicodeHighlight.includeComments",yf="editor.unicodeHighlight.includeStrings",Sf="editor.unicodeHighlight.allowedLocales";function xf(e,t,i){const n=i.indexOf(e);return-1===n?t:i[n]}const kf={fontFamily:Ho?"Menlo, Monaco, 'Courier New', monospace":Vo?"'Droid Sans Mono', 'monospace', monospace":"Consolas, 'Courier New', monospace",fontWeight:"normal",fontSize:Ho?12:14,lineHeight:0,letterSpacing:0},Lf=[];function Df(e){return Lf[e.id]=e,e}const Ef={acceptSuggestionOnCommitCharacter:Df(new tf(0,"acceptSuggestionOnCommitCharacter",!0,{markdownDescription:$m(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:Df(new lf(1,"acceptSuggestionOnEnter","on",["on","smart","off"],{markdownEnumDescriptions:["",$m(0,"Only accept a suggestion with `Enter` when it makes a textual change."),""],markdownDescription:$m(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:Df(new class extends Zm{constructor(){super(2,"accessibilitySupport",0,{type:"string",enum:["auto","on","off"],enumDescriptions:[$m(0,"The editor will use platform APIs to detect when a Screen Reader is attached."),$m(0,"The editor will be permanently optimized for usage with a Screen Reader. Word wrapping will be disabled."),$m(0,"The editor will never be optimized for usage with a Screen Reader.")],default:"auto",description:$m(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:Df(new of(3,"accessibilityPageSize",10,1,1073741824,{description:$m(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:Df(new rf(4,"ariaLabel",$m(0,"Editor content"))),autoClosingBrackets:Df(new lf(5,"autoClosingBrackets","languageDefined",["always","languageDefined","beforeWhitespace","never"],{enumDescriptions:["",$m(0,"Use language configurations to determine when to autoclose brackets."),$m(0,"Autoclose brackets only when the cursor is to the left of whitespace."),""],description:$m(0,"Controls whether the editor should automatically close brackets after the user adds an opening bracket.")})),autoClosingDelete:Df(new lf(6,"autoClosingDelete","auto",["always","auto","never"],{enumDescriptions:["",$m(0,"Remove adjacent closing quotes or brackets only if they were automatically inserted."),""],description:$m(0,"Controls whether the editor should remove adjacent closing quotes or brackets when deleting.")})),autoClosingOvertype:Df(new lf(7,"autoClosingOvertype","auto",["always","auto","never"],{enumDescriptions:["",$m(0,"Type over closing quotes or brackets only if they were automatically inserted."),""],description:$m(0,"Controls whether the editor should type over closing quotes or brackets.")})),autoClosingQuotes:Df(new lf(8,"autoClosingQuotes","languageDefined",["always","languageDefined","beforeWhitespace","never"],{enumDescriptions:["",$m(0,"Use language configurations to determine when to autoclose quotes."),$m(0,"Autoclose quotes only when the cursor is to the left of whitespace."),""],description:$m(0,"Controls whether the editor should automatically close quotes after the user adds an opening quote.")})),autoIndent:Df(new df(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:[$m(0,"The editor will not insert indentation automatically."),$m(0,"The editor will keep the current line's indentation."),$m(0,"The editor will keep the current line's indentation and honor language defined brackets."),$m(0,"The editor will keep the current line's indentation, honor language defined brackets and invoke special onEnterRules defined by languages."),$m(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:$m(0,"Controls whether the editor should automatically adjust the indentation when users type, paste, move or indent lines.")})),automaticLayout:Df(new tf(10,"automaticLayout",!1)),autoSurround:Df(new lf(11,"autoSurround","languageDefined",["languageDefined","quotes","brackets","never"],{enumDescriptions:[$m(0,"Use language configurations to determine when to automatically surround selections."),$m(0,"Surround with quotes but not brackets."),$m(0,"Surround with brackets but not quotes."),""],description:$m(0,"Controls whether the editor should automatically surround selections when typing quotes or brackets.")})),bracketPairColorization:Df(new class extends Zm{constructor(){const e={enabled:Km.bracketPairColorizationOptions.enabled};super(12,"bracketPairColorization",e,{"editor.bracketPairColorization.enabled":{type:"boolean",default:e.enabled,description:$m(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:ef(e.enabled,this.defaultValue.enabled)}}}),bracketPairGuides:Df(new class extends Zm{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:[$m(0,"Enables bracket pair guides."),$m(0,"Enables bracket pair guides only for the active bracket pair."),$m(0,"Disables bracket pair guides.")],default:e.bracketPairs,description:$m(0,"Controls whether bracket pair guides are enabled or not.")},"editor.guides.bracketPairsHorizontal":{type:["boolean","string"],enum:[!0,"active",!1],enumDescriptions:[$m(0,"Enables horizontal guides as addition to vertical bracket pair guides."),$m(0,"Enables horizontal guides only for the active bracket pair."),$m(0,"Disables horizontal bracket pair guides.")],default:e.bracketPairsHorizontal,description:$m(0,"Controls whether horizontal bracket pair guides are enabled or not.")},"editor.guides.highlightActiveBracketPair":{type:"boolean",default:e.highlightActiveBracketPair,description:$m(0,"Controls whether the editor should highlight the active bracket pair.")},"editor.guides.indentation":{type:"boolean",default:e.indentation,description:$m(0,"Controls whether the editor should render indent guides.")},"editor.guides.highlightActiveIndentation":{type:"boolean",default:e.highlightActiveIndentation,description:$m(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:xf(t.bracketPairs,this.defaultValue.bracketPairs,[!0,!1,"active"]),bracketPairsHorizontal:xf(t.bracketPairsHorizontal,this.defaultValue.bracketPairsHorizontal,[!0,!1,"active"]),highlightActiveBracketPair:ef(t.highlightActiveBracketPair,this.defaultValue.highlightActiveBracketPair),indentation:ef(t.indentation,this.defaultValue.indentation),highlightActiveIndentation:ef(t.highlightActiveIndentation,this.defaultValue.highlightActiveIndentation)}}}),stickyTabStops:Df(new tf(104,"stickyTabStops",!1,{description:$m(0,"Emulate selection behavior of tab characters when using spaces for indentation. Selection will stick to tab stops.")})),codeLens:Df(new tf(14,"codeLens",!0,{description:$m(0,"Controls whether the editor shows CodeLens.")})),codeLensFontFamily:Df(new rf(15,"codeLensFontFamily","",{description:$m(0,"Controls the font family for CodeLens.")})),codeLensFontSize:Df(new of(16,"codeLensFontSize",0,0,100,{type:"number",default:0,minimum:0,maximum:100,markdownDescription:$m(0,"Controls the font size in pixels for CodeLens. When set to `0`, 90% of `#editor.fontSize#` is used.")})),colorDecorators:Df(new tf(17,"colorDecorators",!0,{description:$m(0,"Controls whether the editor should render the inline color decorators and color picker.")})),columnSelection:Df(new tf(18,"columnSelection",!1,{description:$m(0,"Enable that the selection with the mouse and keys is doing column selection.")})),comments:Df(new class extends Zm{constructor(){const e={insertSpace:!0,ignoreEmptyLines:!0};super(19,"comments",e,{"editor.comments.insertSpace":{type:"boolean",default:e.insertSpace,description:$m(0,"Controls whether a space character is inserted when commenting.")},"editor.comments.ignoreEmptyLines":{type:"boolean",default:e.ignoreEmptyLines,description:$m(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:ef(t.insertSpace,this.defaultValue.insertSpace),ignoreEmptyLines:ef(t.ignoreEmptyLines,this.defaultValue.ignoreEmptyLines)}}}),contextmenu:Df(new tf(20,"contextmenu",!0)),copyWithSyntaxHighlighting:Df(new tf(21,"copyWithSyntaxHighlighting",!0,{description:$m(0,"Controls whether syntax highlighting should be copied into the clipboard.")})),cursorBlinking:Df(new df(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:$m(0,"Control the cursor animation style.")})),cursorSmoothCaretAnimation:Df(new tf(23,"cursorSmoothCaretAnimation",!1,{description:$m(0,"Controls whether the smooth caret animation should be enabled.")})),cursorStyle:Df(new df(24,"cursorStyle",hf.Line,"line",["line","block","underline","line-thin","block-outline","underline-thin"],(function(e){switch(e){case"line":return hf.Line;case"block":return hf.Block;case"underline":return hf.Underline;case"line-thin":return hf.LineThin;case"block-outline":return hf.BlockOutline;case"underline-thin":return hf.UnderlineThin}}),{description:$m(0,"Controls the cursor style.")})),cursorSurroundingLines:Df(new of(25,"cursorSurroundingLines",0,0,1073741824,{description:$m(0,"Controls the minimal number of visible leading and trailing lines surrounding the cursor. Known as 'scrollOff' or 'scrollOffset' in some other editors.")})),cursorSurroundingLinesStyle:Df(new lf(26,"cursorSurroundingLinesStyle","default",["default","all"],{enumDescriptions:[$m(0,"`cursorSurroundingLines` is enforced only when triggered via the keyboard or API."),$m(0,"`cursorSurroundingLines` is enforced always.")],description:$m(0,"Controls when `cursorSurroundingLines` should be enforced.")})),cursorWidth:Df(new of(27,"cursorWidth",0,0,1073741824,{markdownDescription:$m(0,"Controls the width of the cursor when `#editor.cursorStyle#` is set to `line`.")})),disableLayerHinting:Df(new tf(28,"disableLayerHinting",!1)),disableMonospaceOptimizations:Df(new tf(29,"disableMonospaceOptimizations",!1)),domReadOnly:Df(new tf(30,"domReadOnly",!1)),dragAndDrop:Df(new tf(31,"dragAndDrop",!0,{description:$m(0,"Controls whether the editor should allow moving selections via drag and drop.")})),emptySelectionClipboard:Df(new class extends tf{constructor(){super(32,"emptySelectionClipboard",!0,{description:$m(0,"Controls whether copying without a selection copies the current line.")})}compute(e,t,i){return i&&e.emptySelectionClipboard}}),extraEditorClassName:Df(new rf(33,"extraEditorClassName","")),fastScrollSensitivity:Df(new sf(34,"fastScrollSensitivity",5,(e=>e<=0?5:e),{markdownDescription:$m(0,"Scrolling speed multiplier when pressing `Alt`.")})),find:Df(new class extends Zm{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:$m(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:[$m(0,"Never seed search string from the editor selection."),$m(0,"Always seed search string from the editor selection, including word at cursor position."),$m(0,"Only seed search string from the editor selection.")],description:$m(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:[$m(0,"Never turn on Find in Selection automatically (default)."),$m(0,"Always turn on Find in Selection automatically."),$m(0,"Turn on Find in Selection automatically when multiple lines of content are selected.")],description:$m(0,"Controls the condition for turning on Find in Selection automatically.")},"editor.find.globalFindClipboard":{type:"boolean",default:e.globalFindClipboard,description:$m(0,"Controls whether the Find Widget should read or modify the shared find clipboard on macOS."),included:Ho},"editor.find.addExtraSpaceOnTop":{type:"boolean",default:e.addExtraSpaceOnTop,description:$m(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:$m(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:ef(t.cursorMoveOnType,this.defaultValue.cursorMoveOnType),seedSearchStringFromSelection:"boolean"==typeof e.seedSearchStringFromSelection?e.seedSearchStringFromSelection?"always":"never":af(t.seedSearchStringFromSelection,this.defaultValue.seedSearchStringFromSelection,["never","always","selection"]),autoFindInSelection:"boolean"==typeof e.autoFindInSelection?e.autoFindInSelection?"always":"never":af(t.autoFindInSelection,this.defaultValue.autoFindInSelection,["never","always","multiline"]),globalFindClipboard:ef(t.globalFindClipboard,this.defaultValue.globalFindClipboard),addExtraSpaceOnTop:ef(t.addExtraSpaceOnTop,this.defaultValue.addExtraSpaceOnTop),loop:ef(t.loop,this.defaultValue.loop)}}}),fixedOverflowWidgets:Df(new tf(36,"fixedOverflowWidgets",!1)),folding:Df(new tf(37,"folding",!0,{description:$m(0,"Controls whether the editor has code folding enabled.")})),foldingStrategy:Df(new lf(38,"foldingStrategy","auto",["auto","indentation"],{enumDescriptions:[$m(0,"Use a language-specific folding strategy if available, else the indentation-based one."),$m(0,"Use the indentation-based folding strategy.")],description:$m(0,"Controls the strategy for computing folding ranges.")})),foldingHighlight:Df(new tf(39,"foldingHighlight",!0,{description:$m(0,"Controls whether the editor should highlight folded ranges.")})),foldingImportsByDefault:Df(new tf(40,"foldingImportsByDefault",!1,{description:$m(0,"Controls whether the editor automatically collapses import ranges.")})),foldingMaximumRegions:Df(new of(41,"foldingMaximumRegions",5e3,10,65e3,{description:$m(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:Df(new tf(42,"unfoldOnClickAfterEndOfLine",!1,{description:$m(0,"Controls whether clicking on the empty content after a folded line will unfold the line.")})),fontFamily:Df(new rf(43,"fontFamily",kf.fontFamily,{description:$m(0,"Controls the font family.")})),fontInfo:Df(new class extends Qm{constructor(){super(44)}compute(e,t,i){return e.fontInfo}}),fontLigatures2:Df(new uf),fontSize:Df(new class extends Jm{constructor(){super(46,"fontSize",kf.fontSize,{type:"number",minimum:6,maximum:100,default:kf.fontSize,description:$m(0,"Controls the font size in pixels.")})}validate(e){const t=sf.float(e,this.defaultValue);return 0===t?kf.fontSize:sf.clamp(t,6,100)}compute(e,t,i){return e.fontInfo.fontSize}}),fontWeight:Df(new gf),formatOnPaste:Df(new tf(48,"formatOnPaste",!1,{description:$m(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:Df(new tf(49,"formatOnType",!1,{description:$m(0,"Controls whether the editor should automatically format the line after typing.")})),glyphMargin:Df(new tf(50,"glyphMargin",!0,{description:$m(0,"Controls whether the editor should render the vertical glyph margin. Glyph margin is mostly used for debugging.")})),gotoLocation:Df(new class extends Zm{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:[$m(0,"Show peek view of the results (default)"),$m(0,"Go to the primary result and show a peek view"),$m(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:$m(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:$m(0,"Controls the behavior the 'Go to Definition'-command when multiple target locations exist.")},t),"editor.gotoLocation.multipleTypeDefinitions":Object.assign({description:$m(0,"Controls the behavior the 'Go to Type Definition'-command when multiple target locations exist.")},t),"editor.gotoLocation.multipleDeclarations":Object.assign({description:$m(0,"Controls the behavior the 'Go to Declaration'-command when multiple target locations exist.")},t),"editor.gotoLocation.multipleImplementations":Object.assign({description:$m(0,"Controls the behavior the 'Go to Implementations'-command when multiple target locations exist.")},t),"editor.gotoLocation.multipleReferences":Object.assign({description:$m(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:$m(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:$m(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:$m(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:$m(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:$m(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:af(r.multiple,this.defaultValue.multiple,["peek","gotoAndPeek","goto"]),multipleDefinitions:null!==(t=r.multipleDefinitions)&&void 0!==t?t:af(r.multipleDefinitions,"peek",["peek","gotoAndPeek","goto"]),multipleTypeDefinitions:null!==(i=r.multipleTypeDefinitions)&&void 0!==i?i:af(r.multipleTypeDefinitions,"peek",["peek","gotoAndPeek","goto"]),multipleDeclarations:null!==(n=r.multipleDeclarations)&&void 0!==n?n:af(r.multipleDeclarations,"peek",["peek","gotoAndPeek","goto"]),multipleImplementations:null!==(o=r.multipleImplementations)&&void 0!==o?o:af(r.multipleImplementations,"peek",["peek","gotoAndPeek","goto"]),multipleReferences:null!==(s=r.multipleReferences)&&void 0!==s?s:af(r.multipleReferences,"peek",["peek","gotoAndPeek","goto"]),alternativeDefinitionCommand:rf.string(r.alternativeDefinitionCommand,this.defaultValue.alternativeDefinitionCommand),alternativeTypeDefinitionCommand:rf.string(r.alternativeTypeDefinitionCommand,this.defaultValue.alternativeTypeDefinitionCommand),alternativeDeclarationCommand:rf.string(r.alternativeDeclarationCommand,this.defaultValue.alternativeDeclarationCommand),alternativeImplementationCommand:rf.string(r.alternativeImplementationCommand,this.defaultValue.alternativeImplementationCommand),alternativeReferenceCommand:rf.string(r.alternativeReferenceCommand,this.defaultValue.alternativeReferenceCommand)}}}),hideCursorInOverviewRuler:Df(new tf(52,"hideCursorInOverviewRuler",!1,{description:$m(0,"Controls whether the cursor should be hidden in the overview ruler.")})),hover:Df(new class extends Zm{constructor(){const e={enabled:!0,delay:300,sticky:!0,above:!0};super(53,"hover",e,{"editor.hover.enabled":{type:"boolean",default:e.enabled,description:$m(0,"Controls whether the hover is shown.")},"editor.hover.delay":{type:"number",default:e.delay,minimum:0,maximum:1e4,description:$m(0,"Controls the delay in milliseconds after which the hover is shown.")},"editor.hover.sticky":{type:"boolean",default:e.sticky,description:$m(0,"Controls whether the hover should remain visible when mouse is moved over it.")},"editor.hover.above":{type:"boolean",default:e.above,description:$m(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:ef(t.enabled,this.defaultValue.enabled),delay:of.clampedInt(t.delay,this.defaultValue.delay,0,1e4),sticky:ef(t.sticky,this.defaultValue.sticky),above:ef(t.above,this.defaultValue.above)}}}),inDiffEditor:Df(new tf(54,"inDiffEditor",!1)),letterSpacing:Df(new sf(56,"letterSpacing",kf.letterSpacing,(e=>sf.clamp(e,-5,20)),{description:$m(0,"Controls the letter spacing in pixels.")})),lightbulb:Df(new class extends Zm{constructor(){const e={enabled:!0};super(57,"lightbulb",e,{"editor.lightbulb.enabled":{type:"boolean",default:e.enabled,description:$m(0,"Enables the code action lightbulb in the editor.")}})}validate(e){if(!e||"object"!=typeof e)return this.defaultValue;return{enabled:ef(e.enabled,this.defaultValue.enabled)}}}),lineDecorationsWidth:Df(new Jm(58,"lineDecorationsWidth",10)),lineHeight:Df(new class extends sf{constructor(){super(59,"lineHeight",kf.lineHeight,(e=>sf.clamp(e,0,150)),{markdownDescription:$m(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:Df(new class extends Zm{constructor(){super(60,"lineNumbers",{renderType:1,renderFn:null},{type:"string",enum:["off","on","relative","interval"],enumDescriptions:[$m(0,"Line numbers are not rendered."),$m(0,"Line numbers are rendered as absolute number."),$m(0,"Line numbers are rendered as distance in lines to cursor position."),$m(0,"Line numbers are rendered every 10 lines.")],default:"on",description:$m(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:Df(new of(61,"lineNumbersMinChars",5,1,300)),linkedEditing:Df(new tf(62,"linkedEditing",!1,{description:$m(0,"Controls whether the editor has linked editing enabled. Depending on the language, related symbols, e.g. HTML tags, are updated while editing.")})),links:Df(new tf(63,"links",!0,{description:$m(0,"Controls whether the editor should detect links and make them clickable.")})),matchBrackets:Df(new lf(64,"matchBrackets","always",["always","near","never"],{description:$m(0,"Highlight matching brackets.")})),minimap:Df(new class extends Zm{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:$m(0,"Controls whether the minimap is shown.")},"editor.minimap.size":{type:"string",enum:["proportional","fill","fit"],enumDescriptions:[$m(0,"The minimap has the same size as the editor contents (and might scroll)."),$m(0,"The minimap will stretch or shrink as necessary to fill the height of the editor (no scrolling)."),$m(0,"The minimap will shrink as necessary to never be larger than the editor (no scrolling).")],default:e.size,description:$m(0,"Controls the size of the minimap.")},"editor.minimap.side":{type:"string",enum:["left","right"],default:e.side,description:$m(0,"Controls the side where to render the minimap.")},"editor.minimap.showSlider":{type:"string",enum:["always","mouseover"],default:e.showSlider,description:$m(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:$m(0,"Scale of content drawn in the minimap: 1, 2 or 3.")},"editor.minimap.renderCharacters":{type:"boolean",default:e.renderCharacters,description:$m(0,"Render the actual characters on a line as opposed to color blocks.")},"editor.minimap.maxColumn":{type:"number",default:e.maxColumn,description:$m(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:ef(t.enabled,this.defaultValue.enabled),size:af(t.size,this.defaultValue.size,["proportional","fill","fit"]),side:af(t.side,this.defaultValue.side,["right","left"]),showSlider:af(t.showSlider,this.defaultValue.showSlider,["always","mouseover"]),renderCharacters:ef(t.renderCharacters,this.defaultValue.renderCharacters),scale:of.clampedInt(t.scale,1,1,3),maxColumn:of.clampedInt(t.maxColumn,this.defaultValue.maxColumn,1,1e4)}}}),mouseStyle:Df(new lf(66,"mouseStyle","text",["text","default","copy"])),mouseWheelScrollSensitivity:Df(new sf(67,"mouseWheelScrollSensitivity",1,(e=>0===e?1:e),{markdownDescription:$m(0,"A multiplier to be used on the `deltaX` and `deltaY` of mouse wheel scroll events.")})),mouseWheelZoom:Df(new tf(68,"mouseWheelZoom",!1,{markdownDescription:$m(0,"Zoom the font of the editor when using mouse wheel and holding `Ctrl`.")})),multiCursorMergeOverlapping:Df(new tf(69,"multiCursorMergeOverlapping",!0,{description:$m(0,"Merge multiple cursors when they are overlapping.")})),multiCursorModifier:Df(new df(70,"multiCursorModifier","altKey","alt",["ctrlCmd","alt"],(function(e){return"ctrlCmd"===e?Ho?"metaKey":"ctrlKey":"altKey"}),{markdownEnumDescriptions:[$m(0,"Maps to `Control` on Windows and Linux and to `Command` on macOS."),$m(0,"Maps to `Alt` on Windows and Linux and to `Option` on macOS.")],markdownDescription:$m(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:Df(new lf(71,"multiCursorPaste","spread",["spread","full"],{markdownEnumDescriptions:[$m(0,"Each cursor pastes a single line of the text."),$m(0,"Each cursor pastes the full text.")],markdownDescription:$m(0,"Controls pasting when the line count of the pasted text matches the cursor count.")})),occurrencesHighlight:Df(new tf(72,"occurrencesHighlight",!0,{description:$m(0,"Controls whether the editor should highlight semantic symbol occurrences.")})),overviewRulerBorder:Df(new tf(73,"overviewRulerBorder",!0,{description:$m(0,"Controls whether a border should be drawn around the overview ruler.")})),overviewRulerLanes:Df(new of(74,"overviewRulerLanes",3,0,3)),padding:Df(new class extends Zm{constructor(){super(75,"padding",{top:0,bottom:0},{"editor.padding.top":{type:"number",default:0,minimum:0,maximum:1e3,description:$m(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:$m(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:of.clampedInt(t.top,0,0,1e3),bottom:of.clampedInt(t.bottom,0,0,1e3)}}}),parameterHints:Df(new class extends Zm{constructor(){const e={enabled:!0,cycle:!1};super(76,"parameterHints",e,{"editor.parameterHints.enabled":{type:"boolean",default:e.enabled,description:$m(0,"Enables a pop-up that shows parameter documentation and type information as you type.")},"editor.parameterHints.cycle":{type:"boolean",default:e.cycle,description:$m(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:ef(t.enabled,this.defaultValue.enabled),cycle:ef(t.cycle,this.defaultValue.cycle)}}}),peekWidgetDefaultFocus:Df(new lf(77,"peekWidgetDefaultFocus","tree",["tree","editor"],{enumDescriptions:[$m(0,"Focus the tree when opening peek"),$m(0,"Focus the editor when opening peek")],description:$m(0,"Controls whether to focus the inline editor or the tree in the peek widget.")})),definitionLinkOpensInPeek:Df(new tf(78,"definitionLinkOpensInPeek",!1,{description:$m(0,"Controls whether the Go to Definition mouse gesture always opens the peek widget.")})),quickSuggestions:Df(new class extends Zm{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:$m(0,"Enable quick suggestions inside strings.")},comments:{type:"boolean",default:e.comments,description:$m(0,"Enable quick suggestions inside comments.")},other:{type:"boolean",default:e.other,description:$m(0,"Enable quick suggestions outside of strings and comments.")}}}],default:e,description:$m(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:ef(t.other,this.defaultValue.other),comments:ef(t.comments,this.defaultValue.comments),strings:ef(t.strings,this.defaultValue.strings)};return!!(i.other&&i.comments&&i.strings)||!!(i.other||i.comments||i.strings)&&i}return this.defaultValue}}),quickSuggestionsDelay:Df(new of(80,"quickSuggestionsDelay",10,0,1073741824,{description:$m(0,"Controls the delay in milliseconds after which quick suggestions will show up.")})),readOnly:Df(new tf(81,"readOnly",!1)),renameOnType:Df(new tf(82,"renameOnType",!1,{description:$m(0,"Controls whether the editor auto renames on type."),markdownDeprecationMessage:$m(0,"Deprecated, use `editor.linkedEditing` instead.")})),renderControlCharacters:Df(new tf(83,"renderControlCharacters",!0,{description:$m(0,"Controls whether the editor should render control characters."),restricted:!0})),renderFinalNewline:Df(new tf(84,"renderFinalNewline",!0,{description:$m(0,"Render last line number when the file ends with a newline.")})),renderLineHighlight:Df(new lf(85,"renderLineHighlight","line",["none","gutter","line","all"],{enumDescriptions:["","","",$m(0,"Highlights both the gutter and the current line.")],description:$m(0,"Controls how the editor should render the current line highlight.")})),renderLineHighlightOnlyWhenFocus:Df(new tf(86,"renderLineHighlightOnlyWhenFocus",!1,{description:$m(0,"Controls if the editor should render the current line highlight only when the editor is focused.")})),renderValidationDecorations:Df(new lf(87,"renderValidationDecorations","editable",["editable","on","off"])),renderWhitespace:Df(new lf(88,"renderWhitespace","selection",["none","boundary","selection","trailing","all"],{enumDescriptions:["",$m(0,"Render whitespace characters except for single spaces between words."),$m(0,"Render whitespace characters only on selected text."),$m(0,"Render only trailing whitespace characters."),""],description:$m(0,"Controls how the editor should render whitespace characters.")})),revealHorizontalRightPadding:Df(new of(89,"revealHorizontalRightPadding",30,0,1e3)),roundedSelection:Df(new tf(90,"roundedSelection",!0,{description:$m(0,"Controls whether selections should have rounded corners.")})),rulers:Df(new class extends Zm{constructor(){const e=[],t={type:"number",description:$m(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:$m(0,"Color of this editor ruler."),format:"color-hex"}}}]},default:e,description:$m(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:of.clampedInt(i,0,0,1e4),color:null});else if(i&&"object"==typeof i){const e=i;t.push({column:of.clampedInt(e.column,0,0,1e4),color:e.color})}return t.sort(((e,t)=>e.column-t.column)),t}return this.defaultValue}}),scrollbar:Df(new class extends Zm{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:[$m(0,"The vertical scrollbar will be visible only when necessary."),$m(0,"The vertical scrollbar will always be visible."),$m(0,"The vertical scrollbar will always be hidden.")],default:"auto",description:$m(0,"Controls the visibility of the vertical scrollbar.")},"editor.scrollbar.horizontal":{type:"string",enum:["auto","visible","hidden"],enumDescriptions:[$m(0,"The horizontal scrollbar will be visible only when necessary."),$m(0,"The horizontal scrollbar will always be visible."),$m(0,"The horizontal scrollbar will always be hidden.")],default:"auto",description:$m(0,"Controls the visibility of the horizontal scrollbar.")},"editor.scrollbar.verticalScrollbarSize":{type:"number",default:e.verticalScrollbarSize,description:$m(0,"The width of the vertical scrollbar.")},"editor.scrollbar.horizontalScrollbarSize":{type:"number",default:e.horizontalScrollbarSize,description:$m(0,"The height of the horizontal scrollbar.")},"editor.scrollbar.scrollByPage":{type:"boolean",default:e.scrollByPage,description:$m(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=of.clampedInt(t.horizontalScrollbarSize,this.defaultValue.horizontalScrollbarSize,0,1e3),n=of.clampedInt(t.verticalScrollbarSize,this.defaultValue.verticalScrollbarSize,0,1e3);return{arrowSize:of.clampedInt(t.arrowSize,this.defaultValue.arrowSize,0,1e3),vertical:ff(t.vertical,this.defaultValue.vertical),horizontal:ff(t.horizontal,this.defaultValue.horizontal),useShadows:ef(t.useShadows,this.defaultValue.useShadows),verticalHasArrows:ef(t.verticalHasArrows,this.defaultValue.verticalHasArrows),horizontalHasArrows:ef(t.horizontalHasArrows,this.defaultValue.horizontalHasArrows),handleMouseWheel:ef(t.handleMouseWheel,this.defaultValue.handleMouseWheel),alwaysConsumeMouseWheel:ef(t.alwaysConsumeMouseWheel,this.defaultValue.alwaysConsumeMouseWheel),horizontalScrollbarSize:i,horizontalSliderSize:of.clampedInt(t.horizontalSliderSize,i,0,1e3),verticalScrollbarSize:n,verticalSliderSize:of.clampedInt(t.verticalSliderSize,n,0,1e3),scrollByPage:ef(t.scrollByPage,this.defaultValue.scrollByPage)}}}),scrollBeyondLastColumn:Df(new of(93,"scrollBeyondLastColumn",5,0,1073741824,{description:$m(0,"Controls the number of extra characters beyond which the editor will scroll horizontally.")})),scrollBeyondLastLine:Df(new tf(94,"scrollBeyondLastLine",!0,{description:$m(0,"Controls whether the editor will scroll beyond the last line.")})),scrollPredominantAxis:Df(new tf(95,"scrollPredominantAxis",!0,{description:$m(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:Df(new tf(96,"selectionClipboard",!0,{description:$m(0,"Controls whether the Linux primary clipboard should be supported."),included:Vo})),selectionHighlight:Df(new tf(97,"selectionHighlight",!0,{description:$m(0,"Controls whether the editor should highlight matches similar to the selection.")})),selectOnLineNumbers:Df(new tf(98,"selectOnLineNumbers",!0)),showFoldingControls:Df(new lf(99,"showFoldingControls","mouseover",["always","mouseover"],{enumDescriptions:[$m(0,"Always show the folding controls."),$m(0,"Only show the folding controls when the mouse is over the gutter.")],description:$m(0,"Controls when the folding controls on the gutter are shown.")})),showUnused:Df(new tf(100,"showUnused",!0,{description:$m(0,"Controls fading out of unused code.")})),showDeprecated:Df(new tf(126,"showDeprecated",!0,{description:$m(0,"Controls strikethrough deprecated variables.")})),inlayHints:Df(new class extends Zm{constructor(){const e={enabled:!0,fontSize:0,fontFamily:""};super(127,"inlayHints",e,{"editor.inlayHints.enabled":{type:"boolean",default:e.enabled,description:$m(0,"Enables the inlay hints in the editor.")},"editor.inlayHints.fontSize":{type:"number",default:e.fontSize,markdownDescription:$m(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:$m(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:ef(t.enabled,this.defaultValue.enabled),fontSize:of.clampedInt(t.fontSize,this.defaultValue.fontSize,0,100),fontFamily:rf.string(t.fontFamily,this.defaultValue.fontFamily)}}}),snippetSuggestions:Df(new lf(101,"snippetSuggestions","inline",["top","bottom","inline","none"],{enumDescriptions:[$m(0,"Show snippet suggestions on top of other suggestions."),$m(0,"Show snippet suggestions below other suggestions."),$m(0,"Show snippets suggestions with other suggestions."),$m(0,"Do not show snippet suggestions.")],description:$m(0,"Controls whether snippets are shown with other suggestions and how they are sorted.")})),smartSelect:Df(new class extends Zm{constructor(){super(102,"smartSelect",{selectLeadingAndTrailingWhitespace:!0},{"editor.smartSelect.selectLeadingAndTrailingWhitespace":{description:$m(0,"Whether leading and trailing whitespace should always be selected."),default:!0,type:"boolean"}})}validate(e){return e&&"object"==typeof e?{selectLeadingAndTrailingWhitespace:ef(e.selectLeadingAndTrailingWhitespace,this.defaultValue.selectLeadingAndTrailingWhitespace)}:this.defaultValue}}),smoothScrolling:Df(new tf(103,"smoothScrolling",!1,{description:$m(0,"Controls whether the editor will scroll using an animation.")})),stopRenderingLineAfter:Df(new of(105,"stopRenderingLineAfter",1e4,-1,1073741824)),suggest:Df(new class extends Zm{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:[$m(0,"Insert suggestion without overwriting text right of the cursor."),$m(0,"Insert suggestion and overwrite text right of the cursor.")],default:e.insertMode,description:$m(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:$m(0,"Controls whether filtering and sorting suggestions accounts for small typos.")},"editor.suggest.localityBonus":{type:"boolean",default:e.localityBonus,description:$m(0,"Controls whether sorting favors words that appear close to the cursor.")},"editor.suggest.shareSuggestSelections":{type:"boolean",default:e.shareSuggestSelections,markdownDescription:$m(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:$m(0,"Controls whether an active snippet prevents quick suggestions.")},"editor.suggest.showIcons":{type:"boolean",default:e.showIcons,description:$m(0,"Controls whether to show or hide icons in suggestions.")},"editor.suggest.showStatusBar":{type:"boolean",default:e.showStatusBar,description:$m(0,"Controls the visibility of the status bar at the bottom of the suggest widget.")},"editor.suggest.preview":{type:"boolean",default:e.preview,description:$m(0,"Controls whether to preview the suggestion outcome in the editor.")},"editor.suggest.showInlineDetails":{type:"boolean",default:e.showInlineDetails,description:$m(0,"Controls whether suggest details show inline with the label or only in the details widget")},"editor.suggest.maxVisibleSuggestions":{type:"number",deprecationMessage:$m(0,"This setting is deprecated. The suggest widget can now be resized.")},"editor.suggest.filteredTypes":{type:"object",deprecationMessage:$m(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:$m(0,"When enabled IntelliSense shows `method`-suggestions.")},"editor.suggest.showFunctions":{type:"boolean",default:!0,markdownDescription:$m(0,"When enabled IntelliSense shows `function`-suggestions.")},"editor.suggest.showConstructors":{type:"boolean",default:!0,markdownDescription:$m(0,"When enabled IntelliSense shows `constructor`-suggestions.")},"editor.suggest.showDeprecated":{type:"boolean",default:!0,markdownDescription:$m(0,"When enabled IntelliSense shows `deprecated`-suggestions.")},"editor.suggest.showFields":{type:"boolean",default:!0,markdownDescription:$m(0,"When enabled IntelliSense shows `field`-suggestions.")},"editor.suggest.showVariables":{type:"boolean",default:!0,markdownDescription:$m(0,"When enabled IntelliSense shows `variable`-suggestions.")},"editor.suggest.showClasses":{type:"boolean",default:!0,markdownDescription:$m(0,"When enabled IntelliSense shows `class`-suggestions.")},"editor.suggest.showStructs":{type:"boolean",default:!0,markdownDescription:$m(0,"When enabled IntelliSense shows `struct`-suggestions.")},"editor.suggest.showInterfaces":{type:"boolean",default:!0,markdownDescription:$m(0,"When enabled IntelliSense shows `interface`-suggestions.")},"editor.suggest.showModules":{type:"boolean",default:!0,markdownDescription:$m(0,"When enabled IntelliSense shows `module`-suggestions.")},"editor.suggest.showProperties":{type:"boolean",default:!0,markdownDescription:$m(0,"When enabled IntelliSense shows `property`-suggestions.")},"editor.suggest.showEvents":{type:"boolean",default:!0,markdownDescription:$m(0,"When enabled IntelliSense shows `event`-suggestions.")},"editor.suggest.showOperators":{type:"boolean",default:!0,markdownDescription:$m(0,"When enabled IntelliSense shows `operator`-suggestions.")},"editor.suggest.showUnits":{type:"boolean",default:!0,markdownDescription:$m(0,"When enabled IntelliSense shows `unit`-suggestions.")},"editor.suggest.showValues":{type:"boolean",default:!0,markdownDescription:$m(0,"When enabled IntelliSense shows `value`-suggestions.")},"editor.suggest.showConstants":{type:"boolean",default:!0,markdownDescription:$m(0,"When enabled IntelliSense shows `constant`-suggestions.")},"editor.suggest.showEnums":{type:"boolean",default:!0,markdownDescription:$m(0,"When enabled IntelliSense shows `enum`-suggestions.")},"editor.suggest.showEnumMembers":{type:"boolean",default:!0,markdownDescription:$m(0,"When enabled IntelliSense shows `enumMember`-suggestions.")},"editor.suggest.showKeywords":{type:"boolean",default:!0,markdownDescription:$m(0,"When enabled IntelliSense shows `keyword`-suggestions.")},"editor.suggest.showWords":{type:"boolean",default:!0,markdownDescription:$m(0,"When enabled IntelliSense shows `text`-suggestions.")},"editor.suggest.showColors":{type:"boolean",default:!0,markdownDescription:$m(0,"When enabled IntelliSense shows `color`-suggestions.")},"editor.suggest.showFiles":{type:"boolean",default:!0,markdownDescription:$m(0,"When enabled IntelliSense shows `file`-suggestions.")},"editor.suggest.showReferences":{type:"boolean",default:!0,markdownDescription:$m(0,"When enabled IntelliSense shows `reference`-suggestions.")},"editor.suggest.showCustomcolors":{type:"boolean",default:!0,markdownDescription:$m(0,"When enabled IntelliSense shows `customcolor`-suggestions.")},"editor.suggest.showFolders":{type:"boolean",default:!0,markdownDescription:$m(0,"When enabled IntelliSense shows `folder`-suggestions.")},"editor.suggest.showTypeParameters":{type:"boolean",default:!0,markdownDescription:$m(0,"When enabled IntelliSense shows `typeParameter`-suggestions.")},"editor.suggest.showSnippets":{type:"boolean",default:!0,markdownDescription:$m(0,"When enabled IntelliSense shows `snippet`-suggestions.")},"editor.suggest.showUsers":{type:"boolean",default:!0,markdownDescription:$m(0,"When enabled IntelliSense shows `user`-suggestions.")},"editor.suggest.showIssues":{type:"boolean",default:!0,markdownDescription:$m(0,"When enabled IntelliSense shows `issues`-suggestions.")}})}validate(e){if(!e||"object"!=typeof e)return this.defaultValue;const t=e;return{insertMode:af(t.insertMode,this.defaultValue.insertMode,["insert","replace"]),filterGraceful:ef(t.filterGraceful,this.defaultValue.filterGraceful),snippetsPreventQuickSuggestions:ef(t.snippetsPreventQuickSuggestions,this.defaultValue.filterGraceful),localityBonus:ef(t.localityBonus,this.defaultValue.localityBonus),shareSuggestSelections:ef(t.shareSuggestSelections,this.defaultValue.shareSuggestSelections),showIcons:ef(t.showIcons,this.defaultValue.showIcons),showStatusBar:ef(t.showStatusBar,this.defaultValue.showStatusBar),preview:ef(t.preview,this.defaultValue.preview),previewMode:af(t.previewMode,this.defaultValue.previewMode,["prefix","subword","subwordSmart"]),showInlineDetails:ef(t.showInlineDetails,this.defaultValue.showInlineDetails),showMethods:ef(t.showMethods,this.defaultValue.showMethods),showFunctions:ef(t.showFunctions,this.defaultValue.showFunctions),showConstructors:ef(t.showConstructors,this.defaultValue.showConstructors),showDeprecated:ef(t.showDeprecated,this.defaultValue.showDeprecated),showFields:ef(t.showFields,this.defaultValue.showFields),showVariables:ef(t.showVariables,this.defaultValue.showVariables),showClasses:ef(t.showClasses,this.defaultValue.showClasses),showStructs:ef(t.showStructs,this.defaultValue.showStructs),showInterfaces:ef(t.showInterfaces,this.defaultValue.showInterfaces),showModules:ef(t.showModules,this.defaultValue.showModules),showProperties:ef(t.showProperties,this.defaultValue.showProperties),showEvents:ef(t.showEvents,this.defaultValue.showEvents),showOperators:ef(t.showOperators,this.defaultValue.showOperators),showUnits:ef(t.showUnits,this.defaultValue.showUnits),showValues:ef(t.showValues,this.defaultValue.showValues),showConstants:ef(t.showConstants,this.defaultValue.showConstants),showEnums:ef(t.showEnums,this.defaultValue.showEnums),showEnumMembers:ef(t.showEnumMembers,this.defaultValue.showEnumMembers),showKeywords:ef(t.showKeywords,this.defaultValue.showKeywords),showWords:ef(t.showWords,this.defaultValue.showWords),showColors:ef(t.showColors,this.defaultValue.showColors),showFiles:ef(t.showFiles,this.defaultValue.showFiles),showReferences:ef(t.showReferences,this.defaultValue.showReferences),showFolders:ef(t.showFolders,this.defaultValue.showFolders),showTypeParameters:ef(t.showTypeParameters,this.defaultValue.showTypeParameters),showSnippets:ef(t.showSnippets,this.defaultValue.showSnippets),showUsers:ef(t.showUsers,this.defaultValue.showUsers),showIssues:ef(t.showIssues,this.defaultValue.showIssues)}}}),inlineSuggest:Df(new class extends Zm{constructor(){const e={enabled:!0,mode:"subwordSmart"};super(55,"inlineSuggest",e,{"editor.inlineSuggest.enabled":{type:"boolean",default:e.enabled,description:$m(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:ef(t.enabled,this.defaultValue.enabled),mode:af(t.mode,this.defaultValue.mode,["prefix","subword","subwordSmart"])}}}),suggestFontSize:Df(new of(107,"suggestFontSize",0,0,1e3,{markdownDescription:$m(0,"Font size for the suggest widget. When set to `0`, the value of `#editor.fontSize#` is used.")})),suggestLineHeight:Df(new of(108,"suggestLineHeight",0,0,1e3,{markdownDescription:$m(0,"Line height for the suggest widget. When set to `0`, the value of `#editor.lineHeight#` is used. The minimum value is 8.")})),suggestOnTriggerCharacters:Df(new tf(109,"suggestOnTriggerCharacters",!0,{description:$m(0,"Controls whether suggestions should automatically show up when typing trigger characters.")})),suggestSelection:Df(new lf(110,"suggestSelection","first",["first","recentlyUsed","recentlyUsedByPrefix"],{markdownEnumDescriptions:[$m(0,"Always select the first suggestion."),$m(0,"Select recent suggestions unless further typing selects one, e.g. `console.| -> console.log` because `log` has been completed recently."),$m(0,"Select suggestions based on previous prefixes that have completed those suggestions, e.g. `co -> console` and `con -> const`.")],description:$m(0,"Controls how suggestions are pre-selected when showing the suggest list.")})),tabCompletion:Df(new lf(111,"tabCompletion","off",["on","off","onlySnippets"],{enumDescriptions:[$m(0,"Tab complete will insert the best matching suggestion when pressing tab."),$m(0,"Disable tab completions."),$m(0,"Tab complete snippets when their prefix match. Works best when 'quickSuggestions' aren't enabled.")],description:$m(0,"Enables tab completions.")})),tabIndex:Df(new of(112,"tabIndex",0,-1,1073741824)),unicodeHighlight:Df(new class extends Zm{constructor(){const e={nonBasicASCII:"inUntrustedWorkspace",invisibleCharacters:!0,ambiguousCharacters:!0,includeComments:"inUntrustedWorkspace",includeStrings:!0,allowedCharacters:{},allowedLocales:{_os:!0,_vscode:!0}};super(113,"unicodeHighlight",e,{[bf]:{restricted:!0,type:["boolean","string"],enum:[!0,!1,"inUntrustedWorkspace"],default:e.nonBasicASCII,description:$m(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.")},[vf]:{restricted:!0,type:"boolean",default:e.invisibleCharacters,description:$m(0,"Controls whether characters that just reserve space or have no width at all are highlighted.")},[Cf]:{restricted:!0,type:"boolean",default:e.ambiguousCharacters,description:$m(0,"Controls whether characters are highlighted that can be confused with basic ASCII characters, except those that are common in the current user locale.")},[wf]:{restricted:!0,type:["boolean","string"],enum:[!0,!1,"inUntrustedWorkspace"],default:e.includeComments,description:$m(0,"Controls whether characters in comments should also be subject to unicode highlighting.")},[yf]:{restricted:!0,type:["boolean","string"],enum:[!0,!1,"inUntrustedWorkspace"],default:e.includeStrings,description:$m(0,"Controls whether characters in strings should also be subject to unicode highlighting.")},[_f]:{restricted:!0,type:"object",default:e.allowedCharacters,description:$m(0,"Defines allowed characters that are not being highlighted."),additionalProperties:{type:"boolean"}},[Sf]:{restricted:!0,type:"object",additionalProperties:{type:"boolean"},default:e.allowedLocales,description:$m(0,"Unicode characters that are common in allowed locales are not being highlighted.")}})}applyUpdate(e,t){let i=!1;t.allowedCharacters&&(zo(e.allowedCharacters,t.allowedCharacters)||(e=Object.assign(Object.assign({},e),{allowedCharacters:t.allowedCharacters}),i=!0)),t.allowedLocales&&(zo(e.allowedLocales,t.allowedLocales)||(e=Object.assign(Object.assign({},e),{allowedLocales:t.allowedLocales}),i=!0));const n=super.applyUpdate(e,t);return i?new Ym(n.newValue,!0):n}validate(e){if(!e||"object"!=typeof e)return this.defaultValue;const t=e;return{nonBasicASCII:xf(t.nonBasicASCII,"inUntrustedWorkspace",[!0,!1,"inUntrustedWorkspace"]),invisibleCharacters:ef(t.invisibleCharacters,this.defaultValue.invisibleCharacters),ambiguousCharacters:ef(t.ambiguousCharacters,this.defaultValue.ambiguousCharacters),includeComments:xf(t.includeComments,"inUntrustedWorkspace",[!0,!1,"inUntrustedWorkspace"]),includeStrings:xf(t.includeStrings,"inUntrustedWorkspace",[!0,!1,"inUntrustedWorkspace"]),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:Df(new lf(114,"unusualLineTerminators","prompt",["auto","off","prompt"],{enumDescriptions:[$m(0,"Unusual line terminators are automatically removed."),$m(0,"Unusual line terminators are ignored."),$m(0,"Unusual line terminators prompt to be removed.")],description:$m(0,"Remove unusual line terminators that might cause problems.")})),useShadowDOM:Df(new tf(115,"useShadowDOM",!0)),useTabStops:Df(new tf(116,"useTabStops",!0,{description:$m(0,"Inserting and deleting whitespace follows tab stops.")})),wordSeparators:Df(new rf(117,"wordSeparators",Wo,{description:$m(0,"Characters that will be used as word separators when doing word related navigations or operations.")})),wordWrap:Df(new lf(118,"wordWrap","off",["off","on","wordWrapColumn","bounded"],{markdownEnumDescriptions:[$m(0,"Lines will never wrap."),$m(0,"Lines will wrap at the viewport width."),$m(0,"Lines will wrap at `#editor.wordWrapColumn#`."),$m(0,"Lines will wrap at the minimum of viewport and `#editor.wordWrapColumn#`.")],description:$m(0,"Controls how lines should wrap.")})),wordWrapBreakAfterCharacters:Df(new rf(119,"wordWrapBreakAfterCharacters"," \t})]?|/&.,;¢°′″‰℃、。。、¢,.:;?!%・・ゝゞヽヾーァィゥェォッャュョヮヵヶぁぃぅぇぉっゃゅょゎゕゖㇰㇱㇲㇳㇴㇵㇶㇷㇸㇹㇺㇻㇼㇽㇾㇿ々〻ァィゥェォャュョッー”〉》」』】〕)]}」")),wordWrapBreakBeforeCharacters:Df(new rf(120,"wordWrapBreakBeforeCharacters","([{‘“〈《「『【〔([{「£¥$£¥++")),wordWrapColumn:Df(new of(121,"wordWrapColumn",80,1,1073741824,{markdownDescription:$m(0,"Controls the wrapping column of the editor when `#editor.wordWrap#` is `wordWrapColumn` or `bounded`.")})),wordWrapOverride1:Df(new lf(122,"wordWrapOverride1","inherit",["off","on","inherit"])),wordWrapOverride2:Df(new lf(123,"wordWrapOverride2","inherit",["off","on","inherit"])),wrappingIndent:Df(new df(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:[$m(0,"No indentation. Wrapped lines begin at column 1."),$m(0,"Wrapped lines get the same indentation as the parent."),$m(0,"Wrapped lines get +1 indentation toward the parent."),$m(0,"Wrapped lines get +2 indentation toward the parent.")],description:$m(0,"Controls the indentation of wrapped lines.")})),wrappingStrategy:Df(new lf(125,"wrappingStrategy","simple",["simple","advanced"],{enumDescriptions:[$m(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."),$m(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:$m(0,"Controls the algorithm that computes wrapping points.")})),editorClassName:Df(new class extends Qm{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:Df(new class extends Qm{constructor(){super(129)}compute(e,t,i){return e.pixelRatio}}),tabFocusMode:Df(new class extends Qm{constructor(){super(130)}compute(e,t,i){return!!t.get(81)||e.tabFocusMode}}),layoutInfo:Df(new pf),wrappingInfo:Df(new class extends Qm{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 Nf{constructor(){this._zoomFactor=1}getZoomFactor(){return this._zoomFactor}}Nf.INSTANCE=new Nf;class If 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 Tf extends Uo{constructor(){super(),this._onDidChange=this._register(new $o),this.onDidChange=this._onDidChange.event,this._value=this._getPixelRatio();const e=this._register(new If);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 Mf=new class{constructor(){this._pixelRatioMonitor=null}_getOrCreatePixelRatioMonitor(){return this._pixelRatioMonitor||(this._pixelRatioMonitor=new Tf),this._pixelRatioMonitor}get value(){return this._getOrCreatePixelRatioMonitor().value}get onDidChange(){return this._getOrCreatePixelRatioMonitor().onDidChange}};function Of(){return Nf.INSTANCE.getZoomFactor()}const Af=navigator.userAgent,Rf=Af.indexOf("Firefox")>=0,Pf=Af.indexOf("AppleWebKit")>=0,Ff=Af.indexOf("Chrome")>=0,Bf=!Ff&&Af.indexOf("Safari")>=0,Vf=!Ff&&!Bf&&Pf,Wf=Af.indexOf("Electron/")>=0,Hf=Af.indexOf("Android")>=0,zf=window.matchMedia&&window.matchMedia("(display-mode: standalone)").matches;var jf=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",PixelRatio:Mf,getZoomFactor:Of,isFirefox:Rf,isWebKit:Pf,isChrome:Ff,isSafari:Bf,isWebkitWebView:Vf,isElectron:Wf,isAndroid:Hf,isStandalone:zf});class Uf{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 $f(e){return new Uf(e)}function Kf(e,t){e instanceof Uf?(e.setFontFamily(t.getMassagedFontFamily(Bf?kf.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(Bf?kf.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 qf{constructor(e,t){this.chr=e,this.type=t,this.width=0}fulfill(e){this.width=e}}class Gf{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");Kf(t,this._bareFontInfo),e.appendChild(t);const i=document.createElement("div");Kf(i,this._bareFontInfo),i.style.fontWeight="bold",e.appendChild(i);const n=document.createElement("div");Kf(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");Gf._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 Zf=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))}},Yf=Ho?1.5:1.35;class Xf{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 Xf._create(n,o,s,r,a,l,t,i)}static _create(e,t,i,n,o,s,r,a){0===o?o=Yf*i:o<8&&(o*=i),(o=Math.round(o))<8&&(o=8);const l=1+(a?0:.1*Zf.getZoomLevel());return new Xf({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=Xf._wrapInQuotes(this.fontFamily);return e&&this.fontFamily!==e?`${t}, ${e}`:t}static _wrapInQuotes(e){return/[,"']/.test(e)?e:/[+ ]/.test(e)?`"${e}"`:e}}class Qf extends Xf{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 Jf{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 e_=new class extends Uo{constructor(){super(),this._onDidChange=this._register(new $o),this.onDidChange=this._onDidChange.event,this._cache=new Jf,this._evictUntrustedReadingsTimeout=-1}dispose(){-1!==this._evictUntrustedReadingsTimeout&&(window.clearTimeout(this._evictUntrustedReadingsTimeout),this._evictUntrustedReadingsTimeout=-1),super.dispose()}clearAllFontInfos(){this._cache=new Jf,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 Qf({pixelRatio:Mf.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 qf(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),h=this._createRequest("4",0,t,i),c=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),C="|/-_ilm%";for(let k=0,L=C.length;k<L;k++)this._createRequest(C.charAt(k),0,t,i),this._createRequest(C.charAt(k),1,t,i),this._createRequest(C.charAt(k),2,t,i);!function(e,t){new Gf(e,t).read()}(e,t);const w=Math.max(r.width,a.width,l.width,d.width,h.width,c.width,u.width,g.width,p.width,m.width);let y=e.fontFeatureSettings===uf.OFF;const S=i[0].width;for(let k=1,L=i.length;y&&k<L;k++){const e=S-i[k].width;if(e<-.001||e>.001){y=!1;break}}let x=!0;return y&&_.width!==S&&(x=!1),_.width>f.width&&(x=!1),new Qf({pixelRatio:Mf.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:x,spaceWidth:s.width,middotWidth:v.width,wsmiddotWidth:b.width,maxDigitWidth:w},!0)}};var t_,i_;(i_=t_||(t_={})).serviceIds=new Map,i_.DI_TARGET="$di$target",i_.DI_DEPENDENCIES="$di$dependencies",i_.getServiceDependencies=function(e){return e[i_.DI_DEPENDENCIES]||[]};const n_=s_("instantiationService");function o_(e,t,i){t[t_.DI_TARGET]===t?t[t_.DI_DEPENDENCIES].push({id:e,index:i}):(t[t_.DI_DEPENDENCIES]=[{id:e,index:i}],t[t_.DI_TARGET]=t)}function s_(e){if(t_.serviceIds.has(e))return t_.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");o_(t,e,n)};return t.toString=()=>e,t_.serviceIds.set(e,t),t}const r_=s_("codeEditorService");function a_(e,t){if(!e)throw new Error(t?`Assertion failed (${t})`:"Assertion Failed")}const l_={followsCaret:!0,ignoreCharChanges:!0,alwaysRevealFirst:!0};class d_ extends Uo{constructor(e,t={}){super(),this._onDidUpdate=this._register(new $o),this._editor=e,this._options=Ko(t,l_,!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(a_(!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 h_={ICodeEditor:"vs.editor.ICodeEditor",IDiffEditor:"vs.editor.IDiffEditor"};var c_,u_;(u_=c_||(c_={}))[u_.None=0]="None",u_[u_.Indent=1]="Indent",u_[u_.IndentOutdent=2]="IndentOutdent",u_[u_.Outdent=3]="Outdent";class g_{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 p_{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)m_(this.autoClosingPairsOpenByStart,t.open.charAt(0),t),m_(this.autoClosingPairsOpenByEnd,t.open.charAt(t.open.length-1),t),m_(this.autoClosingPairsCloseByStart,t.close.charAt(0),t),m_(this.autoClosingPairsCloseByEnd,t.close.charAt(t.close.length-1),t),1===t.close.length&&1===t.open.length&&m_(this.autoClosingPairsCloseSingleChar,t.close,t)}}function m_(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 __(e,o,r,s+1,e.getStartOffset(r),e.getEndOffset(s))}class __{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 b_{constructor(e){if(e.autoClosingPairs?this._autoClosingPairs=e.autoClosingPairs.map((e=>new g_(e))):e.brackets?this._autoClosingPairs=e.brackets.map((e=>new g_({open:e[0],close:e[1]}))):this._autoClosingPairs=[],e.colorizedBracketPairs?this._colorizedBracketPairs=C_(e.colorizedBracketPairs.map((e=>[e[0],e[1]]))):e.brackets?this._colorizedBracketPairs=C_(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 g_({open:t.open,close:t.close||""}))}this._autoCloseBefore="string"==typeof e.autoCloseBefore?e.autoCloseBefore:b_.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 C_(e){return e.filter((([e,t])=>""!==e&&""!==t))}b_.DEFAULT_AUTOCLOSE_BEFORE_LANGUAGE_DEFINED=";:.,=}])> \n\t";const w_="undefined"!=typeof Buffer;let y_,S_,x_,k_;class L_{constructor(e){this.buffer=e,this.byteLength=this.buffer.byteLength}static wrap(e){return w_&&!Buffer.isBuffer(e)&&(e=Buffer.from(e.buffer,e.byteOffset,e.byteLength)),new L_(e)}toString(){return w_?this.buffer.toString():(y_||(y_=new TextDecoder),y_.decode(this.buffer))}}function D_(e,t){return e[t+0]<<0>>>0|e[t+1]<<8>>>0}function E_(e,t,i){e[i+0]=255&t,t>>>=8,e[i+1]=255&t}function N_(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 I_(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 T_(e,t){return e[t]}function M_(e,t,i){e[i]=t}function O_(){return S_||(S_=new TextDecoder("UTF-16LE")),S_}function A_(){return k_||(k_=Zo()?O_():(x_||(x_=new TextDecoder("UTF-16BE")),x_)),k_}const R_="undefined"!=typeof TextDecoder;let P_,F_;function B_(e,t,i){const n=[];let o=0;for(let s=0;s<i;s++){const i=D_(e,t);t+=2,n[o++]=String.fromCharCode(i)}return n.join("")}R_?(P_=e=>new V_(e),F_=function(e,t,i){const n=new Uint16Array(e.buffer,t,i);if(i>0&&(65279===n[0]||65534===n[0]))return B_(e,t,i);return O_().decode(n)}):(P_=e=>new W_,F_=B_);class V_{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 A_().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 W_{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 H_{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=H_._toSet(this.open),this._closeSet=H_._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 z_{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 H_(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++)j_(o[s],i,n,o);return o=$_(o),o.sort(U_),o.reverse(),q_(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++)j_(o[s],i,n,o);return o=$_(o),o.sort(U_),o.reverse(),q_(o.map(G_))}(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=$_(t),q_(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=$_(t),q_(t.map(G_))}(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 j_(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 U_(e,t){return e.length-t.length}function $_(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 K_(e){const t=/^[\w ]+$/.test(e);return e=Xo(e),t?`\\b${e}\\b`:e}function q_(e){const t=`(${e.map(K_).join(")|(")})`;return Yo(t,!0)}const G_=function(){let e=null,t=null;return function(i){return e!==i&&(e=i,t=function(e){if(R_){const t=new Uint16Array(e.length);let i=0;for(let n=e.length-1;n>=0;n--)t[i++]=e.charCodeAt(n);return A_().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 Z_{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=G_(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 Y_{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=Z_.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 X_(e){return e.global&&(e.lastIndex=0),!0}class Q_{constructor(e){this._indentationRules=e}shouldIncrease(e){return!!(this._indentationRules&&this._indentationRules.increaseIndentPattern&&X_(this._indentationRules.increaseIndentPattern)&&this._indentationRules.increaseIndentPattern.test(e))}shouldDecrease(e){return!!(this._indentationRules&&this._indentationRules.decreaseIndentPattern&&X_(this._indentationRules.decreaseIndentPattern)&&this._indentationRules.decreaseIndentPattern.test(e))}shouldIndentNextLine(e){return!!(this._indentationRules&&this._indentationRules.indentNextLinePattern&&X_(this._indentationRules.indentNextLinePattern)&&this._indentationRules.indentNextLinePattern.test(e))}shouldIgnore(e){return!!(this._indentationRules&&this._indentationRules.unIndentedLinePattern&&X_(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 J_{constructor(e){(e=e||{}).brackets=e.brackets||[["(",")"],["{","}"],["[","]"]],this._brackets=[],e.brackets.forEach((e=>{const t=J_._createOpenBracketRegExp(e[0]),i=J_._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:c_.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:c_.Indent}}return null}static _createOpenBracketRegExp(e){let t=Xo(e);return/\B/.test(t.charAt(0))||(t="\\b"+t),t+="\\s*$",J_._safeRegExp(t)}static _createCloseBracketRegExp(e){let t=Xo(e);return/\B/.test(t.charAt(t.length-1))||(t+="\\b"),t="^\\s*"+t,J_._safeRegExp(t)}static _safeRegExp(e){try{return new RegExp(e)}catch(t){return Jo(t),null}}}const ev=s_("configurationService");function tv(e,t){const i=Object.create(null);for(let n in e)iv(i,n,e[n],t);return i}function iv(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 nv(e,t){ov(e,t.split("."))}function ov(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)||(ov(n,t),0===Object.keys(n).length&&delete e[i])}}else delete e[i]}function sv(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 rv=s_("languageService");class av{constructor(e,t=[],i=!1){this.ctor=e,this.staticArguments=t,this.supportsDelayedInstantiation=i}}const lv=[];function dv(e,t,i){t instanceof av||(t=new av(t,[],i)),lv.push([e,t])}function hv(){return lv}var cv=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},uv=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};class gv{constructor(e){this.languageId=e}affects(e){return!this.languageId||this.languageId===e}}const pv=s_("languageConfigurationService");let mv=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 gv(void 0));else for(const i of n)this.languageService.isRegisteredLanguageId(i)&&(this.configurations.delete(i),this.onDidChangeEmitter.fire(new gv(i)))}))),this._register(bv.onDidChange((e=>{this.configurations.delete(e.languageId),this.onDidChangeEmitter.fire(new gv(e.languageId))})))}getLanguageConfiguration(e){let t=this.configurations.get(e);return t||(t=function(e,t,i){let n=bv.getLanguageConfiguration(e);if(!n){if(!i.isRegisteredLanguageId(e))throw new Error(`Language id "${e}" is not configured nor known`);n=new Sv(e,{})}const o=function(e,t){const i=t.getValue(fv.brackets,{overrideIdentifier:e}),n=t.getValue(fv.colorizedBracketPairs,{overrideIdentifier:e});return{brackets:_v(i),colorizedBracketPairs:_v(n)}}(n.languageId,t),s=wv([n.underlyingConfig,o]);return new Sv(n.languageId,s)}(e,this.configurationService,this.languageService),this.configurations.set(e,t)),t}};mv=cv([uv(0,ev),uv(1,rv)],mv);const fv={brackets:"editor.language.brackets",colorizedBracketPairs:"editor.language.colorizedBracketPairs"};function _v(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 bv=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 Cv(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:c_.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:c_.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===c_.Indent||n.indentAction===c_.IndentOutdent?e=o.shiftIndent(e):n.indentAction===c_.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===c_.Indent?a.indentation:o.unshiftIndent(a.indentation):a.action===c_.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 h=this.getIndentRulesSupport(s.languageId);if(!h)return null;const c=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?c: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===c_.Indent&&(f=n.shiftIndent(f)),h.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!==c_.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 h=d.indentAction;let c=d.appendText;const u=d.removeText||0;c?h===c_.Indent&&(c="\t"+c):c=h===c_.Indent||h===c_.IndentOutdent?"\t":"";let g=this.getIndentationAtPosition(t,i.startLineNumber,i.startColumn);return u&&(g=g.substring(0,g.length-u)),{indentAction:h,appendText:c,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 Cv{constructor(e){this.languageId=e,this._resolved=null,this._entries=[],this._order=0,this._resolved=null}register(e,t){const i=new yv(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 Sv(this.languageId,e))}return this._resolved}_resolve(){return 0===this._entries.length?null:(this._entries.sort(yv.cmp),wv(this._entries.map((e=>e.configuration))))}}function wv(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 yv{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 Sv{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 J_(this.underlyingConfig):null,this.comments=Sv._handleComments(this.underlyingConfig),this.characterPair=new b_(this.underlyingConfig),this.wordDefinition=this.underlyingConfig.wordPattern||is,this.indentationRules=this.underlyingConfig.indentationRules,this.underlyingConfig.indentationRules?this.indentRulesSupport=new Q_(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 z_(this.languageId,this.underlyingConfig.brackets)),this._brackets}get electricCharacter(){return this._electricCharacter||(this._electricCharacter=new Y_(this.brackets)),this._electricCharacter}onEnter(e,t,i,n){return this._onEnterSupport?this._onEnterSupport.onEnter(e,t,i,n):null}getAutoClosingPairs(){return new p_(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}}dv(pv,mv);const xv=new class{clone(){return this}equals(e){return this===e}};function kv(e,t){return new ss([new rs(0,"",e)],t)}function Lv(e,t){const i=new Uint32Array(2);return i[0]=0,i[1]=(16384|e<<0|2<<23)>>>0,new os(i,null===t?xv:t)}const Dv=s_("modelService");var 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())}))},Nv=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 Iv(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 Tv(e,t,i){return new Promise(((n,o)=>{const s=t.onCancellationRequested((()=>{s.dispose(),n(i)}));e.then(n,o).finally((()=>s.dispose()))}))}class Mv{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 Ov=Symbol("MicrotaskDelay");class Av{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===Ov?(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 Rv{constructor(e){this.delayer=new Av(e),this.throttler=new Mv}trigger(e,t){return this.delayer.trigger((()=>this.throttler.queue(e)),t)}dispose(){this.delayer.dispose()}}function Pv(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)}))})):Iv((t=>Pv(e,t)))}function Fv(e,t=0){const i=setTimeout(e,t);return es((()=>clearTimeout(i)))}function Bv(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 Vv{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 Wv{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 Hv{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 zv;zv="function"!=typeof requestIdleCallback||"function"!=typeof cancelIdleCallback?e=>{hs((()=>{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 jv{constructor(e){this._didRun=!1,this._executor=()=>{try{this._value=e()}catch(t){this._error=t}finally{this._didRun=!0}},this._handle=zv((()=>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 Uv{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 $v,Kv,qv;(Kv=$v||($v={})).settled=function(e){return Ev(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}))},Kv.withAsyncBody=function(e){return new Promise(((t,i)=>Ev(this,void 0,void 0,(function*(){try{yield e(t,i)}catch(n){i(n)}}))))};class Gv{constructor(e){this._state=0,this._results=[],this._error=null,this._onStateChanged=new $o,queueMicrotask((()=>Ev(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 Gv((t=>{t.emitMany(e)}))}static fromPromise(e){return new Gv((t=>Ev(this,void 0,void 0,(function*(){t.emitMany(yield e)}))))}static fromPromises(e){return new Gv((t=>Ev(this,void 0,void 0,(function*(){yield Promise.all(e.map((e=>Ev(this,void 0,void 0,(function*(){return t.emitOne(yield e)})))))}))))}static merge(e){return new Gv((t=>Ev(this,void 0,void 0,(function*(){yield Promise.all(e.map((e=>{var i,n;return Ev(this,void 0,void 0,(function*(){var o,s;try{for(i=Nv(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:()=>Ev(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 Gv((i=>Ev(this,void 0,void 0,(function*(){var n,o;try{for(var s,r=Nv(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 Gv.map(this,e)}static filter(e,t){return new Gv((i=>Ev(this,void 0,void 0,(function*(){var n,o;try{for(var s,r=Nv(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 Gv.filter(this,e)}static coalesce(e){return Gv.filter(e,(e=>!!e))}coalesce(){return Gv.coalesce(this)}static toPromise(e){var t,i,n,o;return Ev(this,void 0,void 0,(function*(){const s=[];try{for(t=Nv(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 Gv.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())}}Gv.EMPTY=Gv.fromArray([]);class Zv extends Gv{constructor(e,t){super(t),this._source=e}cancel(){this._source.cancel()}}const Yv=null===(qv=window.trustedTypes)||void 0===qv?void 0:qv.createPolicy("defaultWorkerFactory",{createScriptURL:e=>e});class Xv{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(Yv?Yv.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 Qv{constructor(e){this._label=e,this._webWorkerFailedBeforeError=!1}create(e,t,i){let n=++Qv.LAST_WORKER_ID;if(this._webWorkerFailedBeforeError)throw this._webWorkerFailedBeforeError;return new Xv(e,n,this._label||"anonymous"+n,t,(e=>{cs(e),this._webWorkerFailedBeforeError=e,i(e)}))}}Qv.LAST_WORKER_ID=0;const Jv=s_("textResourceConfigurationService"),eb=s_("textResourcePropertiesService"),tb=s_("logService");var ib,nb;(nb=ib||(ib={}))[nb.Trace=0]="Trace",nb[nb.Debug=1]="Debug",nb[nb.Info=2]="Info",nb[nb.Warning=3]="Warning",nb[nb.Error=4]="Error",nb[nb.Critical=5]="Critical",nb[nb.Off=6]="Off";const ob=ib.Info;class sb extends Uo{constructor(){super(...arguments),this.level=ob,this._onDidChangeLogLevel=this._register(new $o)}setLevel(e){this.level!==e&&(this.level=e,this._onDidChangeLogLevel.fire(this.level))}getLevel(){return this.level}}class rb extends sb{constructor(e=ob){super(),this.setLevel(e)}trace(e,...t){this.getLevel(),ib.Trace}debug(e,...t){this.getLevel(),ib.Debug}info(e,...t){this.getLevel(),ib.Info}error(e,...t){this.getLevel(),ib.Error}dispose(){}}class ab 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=s_("ILanguageFeaturesService");var db=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},hb=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}},cb=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 ub(e,t){const i=e.getModel(t);return!!i&&!i.isTooLargeForSyncing()}let gb=class extends Uo{constructor(e,t,i,n,o){super(),this._modelService=e,this._workerManager=this._register(new mb(this._modelService,n)),this._logService=i,this._register(o.linkProvider.register({language:"*",hasAccessToAllModels:!0},{provideLinks:(e,t)=>ub(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 pb(this._workerManager,t,this._modelService,n)))}dispose(){super.dispose()}canComputeUnicodeHighlights(e){return ub(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(!ub(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,Pv(1e3).then((()=>t))])}return Promise.resolve(void 0)}canNavigateValueSet(e){return ub(this._modelService,e)}navigateValueSet(e,t,i){return this._workerManager.withWorker().then((n=>n.navigateValueSet(e,t,i)))}canComputeWordRanges(e){return ub(this._modelService,e)}computeWordRanges(e,t){return this._workerManager.withWorker().then((i=>i.computeWordRanges(e,t)))}};gb=db([hb(0,Dv),hb(1,Jv),hb(2,tb),hb(3,pv),hb(4,lb)],gb);class pb{constructor(e,t,i,n){this.languageConfigurationService=n,this._debugDisplayName="wordbasedCompletions",this._workerManager=e,this._configurationService=t,this._modelService=i}provideCompletionItems(e,t){return cb(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)ub(this._modelService,e.uri)&&n.push(e.uri);else for(const t of this._modelService.getModels())ub(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 mb extends Uo{constructor(e,t){super(),this.languageConfigurationService=t,this._modelService=e,this._editorWorkerClient=null,this._lastWorkerUsedTime=(new Date).getTime();this._register(new Wv).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>3e5&&(this._editorWorkerClient.dispose(),this._editorWorkerClient=null)}withWorker(){return this._lastWorkerUsedTime=(new Date).getTime(),this._editorWorkerClient||(this._editorWorkerClient=new bb(this._modelService,!1,"editorWorkerService",this.languageConfigurationService)),Promise.resolve(this._editorWorkerClient)}}class fb 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 Wv;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 Cs;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 _b{constructor(e){this._instance=e,this._proxyObj=Promise.resolve(this._instance)}dispose(){this._instance.dispose()}getProxyObject(){return this._proxyObj}}class vb{constructor(e){this._workerClient=e}fhr(e,t){return this._workerClient.fhr(e,t)}}class bb extends Uo{constructor(e,t,i,n){super(),this.languageConfigurationService=n,this._disposed=!1,this._modelService=e,this._keepIdleModels=t,this._workerFactory=new Qv(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 vb(this)))}catch(e){cs(e),this._worker=new _b(new fs(new vb(this),null))}return this._worker}_getProxy(){return this._getOrCreateWorker().getProxyObject().then(void 0,(e=>(cs(e),this._worker=new _b(new fs(new vb(this),null)),this._getOrCreateWorker().getProxyObject())))}_getOrCreateModelManager(e){return this._modelManager||(this._modelManager=this._register(new fb(e,this._modelService,this._keepIdleModels))),this._modelManager}_withSyncedResources(e,t=!1){return cb(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 cb(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 Cb extends bb{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?ws(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 wb{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=wb.defaultTokenMetadata,n=new Uint32Array(2);return n[0]=e.length,n[1]=i,new wb(n,e,t)}equals(e){return e instanceof wb&&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 wb.findIndexInTokensArray(this._tokens,e)}inflate(){return this}sliceAndInflate(e,t,i){return new yb(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 wb(new Uint32Array(o),n,this._languageIdCodec)}}wb.defaultTokenMetadata=16793600;class yb{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 yb&&(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 Sb{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(!Sb._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 Sb(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,h=l.endLineNumber===t?l.endColumn:n;o[s++]=new Sb(d,h,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=Sb._typeCompare(e.type,t.type);return 0!==i?i:e.className!==t.className?e.className<t.className?-1:1:0}}class xb{constructor(e,t,i,n){this.startOffset=e,this.endOffset=t,this.className=i,this.metadata=n}}class kb{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 xb(t,this.stopOffsets[e],this.classNames.join(" "),kb._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 xb(t,e-1,this.classNames.join(" "),kb._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 Lb{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 Db{constructor(e,t){this.startOffset=e,this.endOffset=t}equals(e){return this.startOffset===e.startOffset&&this.endOffset===e.endOffset}}class Eb{constructor(e,t,i,n,o,s,r,a,l,d,h,c,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(Sb.compare),this.tabSize=d,this.startVisibleColumn=h,this.spaceWidth=c,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-c)<Math.abs(u-c)?(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&&Sb.equalsArr(this.lineDecorations,e.lineDecorations)&&this.lineTokens.equals(e.lineTokens)&&this.sameSelection(e.selectionsOnLine)}}class Nb{constructor(e,t){this.partIndex=e,this.charIndex=t}}class Ib{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=Ib.getPartIndex(t),n=Ib.getCharIndex(t);return new Nb(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=Ib.getPartIndex(r),d=Ib.getCharIndex(r);let h;h=l!==Ib.getPartIndex(a)?t:Ib.getCharIndex(a);return i-d<=h-i?o:s}}class Tb{constructor(e,t,i){this._renderLineOutputBrand=void 0,this.characterMapping=e,this.containsRTL=t,this.containsForeignElements=i}}function Mb(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 Ib(1,i+n);return s.setColumnInfo(1,i,0,0),new Tb(s,!1,o)}return t.appendASCIIString("<span><span></span></span>"),new Tb(new Ib(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,h=e.tabSize,c=e.startVisibleColumn,u=e.containsRTL,g=e.spaceWidth,p=e.renderSpaceCharCode,m=e.renderWhitespace,f=e.renderControlCharacters,_=new Ib(r+1,l.length);let v=!1,b=0,C=c,w=0,y=0,S=0,x=0;u?t.appendASCIIString('<span dir="ltr">'):t.appendASCIIString("<span>");for(let k=0,L=l.length;k<L;k++){x+=S;const e=l[k],a=e.endIndex,c=e.type,u=0!==m&&e.isWhitespace(),L=u&&!i&&("mtkw"===c||!o),D=b===a&&e.isPseudoAfter();if(w=0,t.appendASCIIString('<span class="'),t.appendASCIIString(L?"mtkz":c),t.appendASCII(34),u){let e=0;{let t=b,i=C;for(;t<a;t++){const n=0|(9===s.charCodeAt(t)?h-i%h:1);e+=n,t>=d&&(i+=n)}}for(L&&(t.appendASCIIString(' style="width:'),t.appendASCIIString(String(g*e)),t.appendASCIIString('px"')),t.appendASCII(62);b<a;b++){_.setColumnInfo(b+1,k-y,w,x),y=0;let e;if(9===s.charCodeAt(b)){e=h-C%h|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);w+=e,b>=d&&(C+=e)}S=e}else{let e=0;for(t.appendASCII(62);b<a;b++){_.setColumnInfo(b+1,k-y,w,x),y=0;const i=s.charCodeAt(b);let n=1,o=1;switch(i){case 9:n=h-C%h,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&&Pb(i)?(t.appendASCIIString("[U+"),t.appendASCIIString(Fb(i)),t.appendASCIIString("]"),n=8):t.write1(i)}w+=n,e+=n,b>=d&&(C+=o)}S=e}D?y++:y=0,b>=r&&!v&&e.isPseudoAfter()&&(v=!0,_.setColumnInfo(b+1,k,w,x)),t.appendASCIIString("</span>")}v||_.setColumnInfo(r+1,l.length-1,w,x);a&&t.appendASCIIString("<span>…</span>");return t.appendASCIIString("</span>"),new Tb(_,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 Lb(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 Lb(i,a,0);break}n[o++]=new Lb(r,a,0)}return n}(e.lineTokens,e.fauxIndentLength,n);e.renderControlCharacters&&!e.isBasicASCII&&(o=function(e,t){const i=[];let n=new Lb(0,"",0),o=0;for(const s of t){const t=s.endIndex;for(;o<t;o++){Pb(e.charCodeAt(o))&&(o>n.endIndex&&(n=new Lb(o,s.type,s.metadata),i.push(n)),n=new Lb(o+1,"mtkcontrol",s.metadata),i.push(n))}o>n.endIndex&&(n=new Lb(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,h=1===e.renderWhitespace,c=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,C=!1,w=Ss(t);-1===w?(C=!0,w=i,b=i):b=xs(t);let y=!1,S=0,x=d&&d[S],k=a%r;for(let D=s;D<i;D++){const e=t.charCodeAt(D);let o;if(x&&D>=x.endOffset&&(S++,x=d&&d[S]),D<w||D>b)o=!0;else if(9===e)o=!0;else if(32===e)if(h)if(y)o=!0;else{const e=D+1<i?t.charCodeAt(D+1):0;o=32===e||9===e}else o=!0;else o=!1;if(o&&d&&(o=!!x&&x.startOffset<=D&&x.endOffset>D),o&&c&&(o=C||D>b),y){if(!o||!l&&k>=r){if(u){for(let e=(p>0?g[p-1].endIndex:s)+1;e<=D;e++)g[p++]=new Lb(e,"mtkw",1)}else g[p++]=new Lb(D,"mtkw",1);k%=r}}else(D===_||o&&D>s)&&(g[p++]=new Lb(D,f,0),k%=r);for(9===e?k=r:ks(e)?k+=2:k++,y=o;D===_&&(m++,m<v);)f=n[m].type,_=n[m].endIndex}let L=!1;if(y)if(o&&h){const e=i>0?t.charCodeAt(i-1):0,n=i>1?t.charCodeAt(i-2):0;32===e&&32!==n&&9!==n||(L=!0)}else L=!0;if(L)if(u){for(let e=(p>0?g[p-1].endIndex:s)+1;e<=i;e++)g[p++]=new Lb(e,"mtkw",1)}else g[p++]=new Lb(i,"mtkw",1);else g[p++]=new Lb(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(Sb.compare);const o=class{static normalize(e,t){if(0===t.length)return[];const i=[],n=new kb;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,h=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 c=a-1,u=l-2;o=n.consumeLowerThan(c,o,i),0===n.count&&(o=c),n.insert(u,d,h)}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 c=0,u=i.length;c<u;c++){const e=i[c],t=e.endIndex,n=e.type,h=e.metadata;for(;r<s&&o[r].startOffset<t;){const e=o[r];if(e.startOffset>d&&(d=e.startOffset,a[l++]=new Lb(d,n,h)),!(e.endOffset+1<=t)){d=t,a[l++]=new Lb(d,n+" "+e.className,h|e.metadata);break}d=e.endOffset+1,a[l++]=new Lb(d,n+" "+e.className,h|e.metadata),r++}t>d&&(d=t,a[l++]=new Lb(d,n,h))}const h=i[i.length-1].endIndex;if(r<s&&o[r].startOffset===h)for(;r<s&&o[r].startOffset===h;){const e=o[r];a[l++]=new Lb(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 Lb(l+1,t,r),d=l+1,l=-1);d!==a&&(o[s++]=new Lb(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 Lb(i,t,r)}o[s++]=new Lb(i,t,r)}else o[s++]=e;n=i}return o}(t,o,!e.isBasicASCII||e.fontLigatures));return new Rb(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 Ob{constructor(e,t,i,n){this.characterMapping=e,this.html=t,this.containsRTL=i,this.containsForeignElements=n}}function Ab(e){const t=P_(1e4),i=Mb(e,t);return new Ob(i.characterMapping,t.build(),i.containsRTL,i.containsForeignElements)}class Rb{constructor(e,t,i,n,o,s,r,a,l,d,h,c,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=h,this.spaceWidth=c,this.renderSpaceCharCode=u,this.renderWhitespace=g,this.renderControlCharacters=p}}function Pb(e){return e<32?9!==e:127===e||(e>=8234&&e<=8238||e>=8294&&e<=8297||e>=8206&&e<=8207||1564===e)}function Fb(e){return e.toString(16).toUpperCase().padStart(4,"0")}class Bb{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 Vb{constructor(e,t){this.tabSize=e,this.data=t}}class Wb{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 Hb{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=Hb.isBasicASCII(i,s),this.containsRTL=Hb.containsRTL(i,this.isBasicASCII,o),this.tokens=r,this.inlineDecorations=a,this.tabSize=l,this.startVisibleColumn=d}static isBasicASCII(e,t){return!t||Ls(e)}static containsRTL(e,t,i){return!(t||!i)&&Ds(e)}}class zb{constructor(e,t,i){this.range=e,this.inlineClassName=t,this.type=i}}class jb{constructor(e,t,i,n){this.startOffset=e,this.endOffset=t,this.inlineClassName=i,this.inlineClassNameAffectsLetterSpacing=n}toInlineDecoration(e){return new zb(new qo(e,this.startOffset+1,e,this.endOffset+1),this.inlineClassName,this.inlineClassNameAffectsLetterSpacing?3:0)}}class Ub{constructor(e,t){this._viewModelDecorationBrand=void 0,this.range=e,this.options=t}}class $b{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 Kb(e){return!function(e){return Array.isArray(e)}(e)}function qb(e){return"string"==typeof e}function Gb(e){return!qb(e)}function Zb(e){return!e}function Yb(e,t){return e.ignoreCase&&t?t.toLowerCase():t}function Xb(e){return e.replace(/[&<>'"_]/g,"-")}function Qb(e,t){return new Error(`${e.languageId}: ${t}`)}function Jb(e,t,i,n,o){let s=null;return t.replace(/\$((\$)|(#)|(\d\d?)|[sS](\d\d?)|@(\w+))/g,(function(t,r,a,l,d,h,c,u,g){return Zb(a)?Zb(l)?!Zb(d)&&d<n.length?Yb(e,n[d]):!Zb(c)&&e&&"string"==typeof e[c]?e[c]:(null===s&&(s=o.split("."),s.unshift(o)),!Zb(h)&&h<s.length?Yb(e,s[h]):""):Yb(e,i):"$"}))}function eC(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 tC{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 iC(e,t);let i=iC.getStackElementId(e);i.length>0&&(i+="|"),i+=t;let n=this._entries[i];return n||(n=new iC(e,t),this._entries[i]=n,n)}}tC._INSTANCE=new tC(5);class iC{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 iC._equals(this,e)}push(e){return tC.create(this,e)}pop(){return this.parent}popall(){let e=this;for(;e.parent;)e=e.parent;return e}switchTo(e){return tC.create(this.parent,e)}}class nC{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 nC(this.languageId,this.state)}}class oC{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 sC(e,t);if(null!==e&&e.depth>=this._maxCacheDepth)return new sC(e,t);const i=iC.getStackElementId(e);let n=this._entries[i];return n||(n=new sC(e,null),this._entries[i]=n,n)}}oC._INSTANCE=new oC(5);class sC{constructor(e,t){this.stack=e,this.embeddedLanguageData=t}clone(){return(this.embeddedLanguageData?this.embeddedLanguageData.clone():null)===this.embeddedLanguageData?this:oC.create(this.stack,this.embeddedLanguageData)}equals(e){return e instanceof sC&&(!!this.stack.equals(e.stack)&&(null===this.embeddedLanguageData&&null===e.embeddedLanguageData||null!==this.embeddedLanguageData&&null!==e.embeddedLanguageData&&this.embeddedLanguageData.equals(e.embeddedLanguageData)))}}class rC{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=Es.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 aC{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=Es.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=aC._merge(this._prependTokens,this._tokens,a.tokens),this._tokens=[],this._currentLanguageId=0,this._lastTokenMetadata=0,a.endState}finalize(e){return new os(aC._merge(this._prependTokens,this._tokens,null),e)}}class lC{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=Es.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,Es.fire([this._languageId]),o=!1)}))}dispose(){this._tokenizationRegistryListener.dispose()}getLoadStatus(){const e=[];for(let t in this._embeddedLanguages){const i=Es.get(t);if(i){if(i instanceof lC){const t=i.getLoadStatus();!1===t.loaded&&e.push(t.promise)}}else Es.isResolved(t)||e.push(Es.getOrCreate(t))}return 0===e.length?{loaded:!0}:{loaded:!1,promise:Promise.all(e).then((e=>{}))}}getInitialState(){const e=tC.create(null,this._lexer.start);return oC.create(e,null)}tokenize(e,t,i){const n=new rC,o=this._tokenize(e,t,i,n);return n.finalize(o)}tokenizeEncoded(e,t,i){const n=new aC(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=eC(this._lexer,t.stack.state),!i))throw Qb(this._lexer,"tokenizer state is not defined: "+t.stack.state);let n=-1,o=!1;for(const s of i){if(!Gb(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 Qb(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 oC.create(i.stack,new nC(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,h=0,c=null,u=!0;for(;u||h<a;){const i=h,g=d.depth,p=c?c.groups.length:0,m=d.state;let f=null,_=null,v=null,b=null,C=null;if(c){f=c.matches;const e=c.groups.shift();_=e.matched,v=e.action,b=c.rule,0===c.groups.length&&(c=null)}else{if(!u&&h>=a)break;u=!1;let e=this._lexer.tokenizer[m];if(!e&&(e=eC(this._lexer,m),!e))throw Qb(this._lexer,"tokenizer state is not defined: "+m);let t=r.substr(h);for(const i of e)if((0===h||!i.matchOnlyAtLineStart)&&(f=t.match(i.regex),f)){_=f[0],v=i.action;break}}if(f||(f=[""],_=""),v||(h<a&&(f=[r.charAt(h)],_=f[0]),v=this._lexer.defaultToken),null===_)break;for(h+=_.length;Kb(v)&&Gb(v)&&v.test;)v=v.test(_,f,m,h===a);let w=null;if("string"==typeof v||Array.isArray(v))w=v;else if(v.group)w=v.group;else if(null!==v.token&&void 0!==v.token){if(w=v.tokenSubst?Jb(this._lexer,v.token,_,f,m):v.token,v.nextEmbedded)if("@pop"===v.nextEmbedded){if(!l)throw Qb(this._lexer,"cannot pop embedded language if not inside one");l=null}else{if(l)throw Qb(this._lexer,"cannot enter embedded language from within an embedded language");C=Jb(this._lexer,v.nextEmbedded,_,f,m)}if(v.goBack&&(h=Math.max(0,h-v.goBack)),v.switchTo&&"string"==typeof v.switchTo){let e=Jb(this._lexer,v.switchTo,_,f,m);if("@"===e[0]&&(e=e.substr(1)),!eC(this._lexer,e))throw Qb(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 Qb(this._lexer,"action.transform not supported");if(v.next)if("@push"===v.next){if(d.depth>=this._lexer.maxStack)throw Qb(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 Qb(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=Jb(this._lexer,v.next,_,f,m);if("@"===e[0]&&(e=e.substr(1)),!eC(this._lexer,e))throw Qb(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,Jb(this._lexer,v.log,_,f,m))}if(null===w)throw Qb(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(h<a){const i=e.substr(h);return this._nestedTokenize(i,t,oC.create(d,r),n+h,o)}return oC.create(d,r)};if(Array.isArray(w)){if(c&&c.groups.length>0)throw Qb(this._lexer,"groups cannot be nested: "+this._safeRuleName(b));if(f.length!==w.length+1)throw Qb(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 Qb(this._lexer,"with groups, all characters should be matched in consecutive groups in rule: "+this._safeRuleName(b));c={rule:b,matches:f,groups:[]};for(let t=0;t<w.length;t++)c.groups[t]={action:w[t],matched:f[t+1]};h-=_.length}else{{if("@rematch"===w&&(h-=_.length,_="",f=null,w="",null!==C))return y(C);if(0===_.length){if(0===a||g!==d.depth||m!==d.state||(c?c.groups.length:0)!==p)continue;throw Qb(this._lexer,"no progress in tokenizer in rule: "+this._safeRuleName(b))}let e=null;if(qb(w)&&0===w.indexOf("@brackets")){const t=w.substr("@brackets".length),i=dC(this._lexer,_);if(!i)throw Qb(this._lexer,"@brackets token returned but no bracket defined as: "+_);e=Xb(i.token+t)}else{e=Xb(""===w?"":w+this._lexer.tokenPostfix)}i<s&&o.emit(i+n,e)}if(null!==C)return y(C)}}return oC.create(d,l)}_getNestedEmbeddedLanguageData(e){if(!this._languageService.isRegisteredLanguageId(e))return new nC(e,xv);e!==this._languageId&&(Es.getOrCreate(e),this._embeddedLanguages[e]=!0);const t=Es.get(e);return new nC(e,t?t.getInitialState():xv)}}function dC(e,t){if(!t)return null;t=Yb(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 hC,cC=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 uC=null===(hC=window.trustedTypes)||void 0===hC?void 0:hC.createPolicy("standaloneColorizer",{createHTML:e=>e});class gC{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==uC?void 0:uC.createHTML(e))&&void 0!==t?t:e;i.innerHTML=n}),(e=>{}))}static colorize(e,t,i,n){return cC(this,void 0,void 0,(function*(){const o=e.languageIdCodec;let s=4;n&&"number"==typeof n.tabSize&&(s=n.tabSize),Ns(t)&&(t=t.substr(1));const r=Is(t);if(!e.isRegisteredLanguageId(i))return pC(r,s,o);const a=yield Es.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);wb.convertToEndOffset(l.tokens,a.length);const d=new wb(l.tokens,a,n),h=Hb.isBasicASCII(a,!0),c=Hb.containsRTL(a,h,!0),u=Ab(new Eb(!1,!0,a,!1,h,c,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 lC){const e=i.getLoadStatus();if(!1===e.loaded)return void e.promise.then(r,s)}o(a)};r()}))}(r,s,a,o):pC(r,s,o)}))}static colorizeLine(e,t,i,n,o=4){const s=Hb.isBasicASCII(e,t),r=Hb.containsRTL(e,s,i);return Ab(new Eb(!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 pC(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 wb(o,r,i),l=Hb.isBasicASCII(r,!0),d=Hb.containsRTL(r,l,!0),h=Ab(new Eb(!1,!0,r,!1,l,d,0,a,[],t,0,0,0,0,-1,"none",!1,!1,null));n=n.concat(h.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||zf||navigator.keyboard,"ontouchstart"in window||navigator.maxTouchPoints;const mC=window.PointerEvent&&("ontouchstart"in window||window.navigator.maxTouchPoints>0||navigator.maxTouchPoints>0);function fC(e,t){if(0===e)return null;const i=(65535&e)>>>0,n=(4294901760&e)>>>16;return new bC(0!==n?[_C(i,t),_C(n,t)]:[_C(i,t)])}function _C(e,t){const i=!!(2048&e),n=!!(256&e);return new vC(2===t?n:i,!!(1024&e),!!(512&e),2===t?i:n,255&e)}class vC{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 bC([this])}isDuplicateModifierCase(){return this.ctrlKey&&5===this.keyCode||this.shiftKey&&4===this.keyCode||this.altKey&&6===this.keyCode||this.metaKey&&57===this.keyCode}}class bC{constructor(e){if(0===e.length)throw Ms("parts");this.parts=e}}class CC{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 wC=Ho?256:2048,yC=Ho?2048:256;class SC{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 Os.fromString(t)}const t=e.keyCode;if(3===t)return 7;if(Rf){if(59===t)return 80;if(107===t)return 81;if(109===t)return 83;if(Ho&&224===t)return 57}else if(Pf){if(91===t)return 57;if(Ho&&93===t)return 57;if(!Ho&&92===t)return 57}return As[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|=wC),this.altKey&&(t|=512),this.shiftKey&&(t|=1024),this.metaKey&&(t|=yC),t|=e,t}_computeRuntimeKeybinding(){let e=0;return 5!==this.keyCode&&4!==this.keyCode&&6!==this.keyCode&&57!==this.keyCode&&(e=this.keyCode),new vC(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}}let xC=!1,kC=null;function LC(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 xC=!0,null}catch(t){return xC=!0,null}return e.parent}class DC{static getSameOriginWindowChain(){if(!kC){kC=[];let e,t=window;do{e=LC(t),e?kC.push({window:t,iframeElement:t.frameElement||null}):kC.push({window:t,iframeElement:null}),t=e}while(t)}return kC.slice(0)}static hasDifferentOriginAncestor(){return kC||this.getSameOriginWindowChain(),xC}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 EC{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=DC.getPositionOfChildWindowRelativeToAncestorWindow(self,e.view);this.posx-=t.left,this.posy-=t.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}}class NC{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=Rf&&!Ho?-e.deltaY/3:-e.deltaY:this.deltaY=-e.deltaY/40}if(void 0!==t.wheelDeltaX)this.deltaX=Bf&&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=Rf&&!Ho?-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 IC,TC;(TC=IC||(IC={})).inMemory="inmemory",TC.vscode="vscode",TC.internal="private",TC.walkThrough="walkThrough",TC.walkThroughSnippet="walkThroughSnippet",TC.http="http",TC.https="https",TC.file="file",TC.mailto="mailto",TC.untitled="untitled",TC.data="data",TC.command="command",TC.vscodeRemote="vscode-remote",TC.vscodeRemoteResource="vscode-remote-resource",TC.userData="vscode-userdata",TC.vscodeCustomEditor="vscode-custom-editor",TC.vscodeNotebook="vscode-notebook",TC.vscodeNotebookCell="vscode-notebook-cell",TC.vscodeNotebookCellMetadata="vscode-notebook-cell-metadata",TC.vscodeNotebookCellOutput="vscode-notebook-cell-output",TC.vscodeInteractive="vscode-interactive",TC.vscodeInteractiveInput="vscode-interactive-input",TC.vscodeSettings="vscode-settings",TC.vscodeWorkspaceTrust="vscode-workspace-trust",TC.vscodeTerminal="vscode-terminal",TC.webviewPanel="webview-panel",TC.vscodeWebview="vscode-webview",TC.extension="extension",TC.vscodeFileResource="vscode-file",TC.tmp="tmp",TC.vsls="vsls";const MC=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:IC.vscodeRemoteResource,authority:`${i}:${n}`,path:"/vscode-remote-resource",query:s})}};class OC{asBrowserUri(e,t){const i=this.toUri(e,t);return i.scheme===IC.vscodeRemote?MC.rewrite(i):i.scheme===IC.file&&(Ts||Bs&&us.origin===`${IC.vscodeFileResource}://${OC.FALLBACK_AUTHORITY}`)?i.with({scheme:IC.vscodeFileResource,authority:i.authority||OC.FALLBACK_AUTHORITY,query:null,fragment:null}):i}toUri(e,t){return Ps.isUri(e)?e:Ps.parse(t.toUrl(e))}}OC.FALLBACK_AUTHORITY="vscode-app";const AC=new OC;function RC(e){for(;e.firstChild;)e.firstChild.remove()}function PC(e){var t;return null!==(t=null==e?void 0:e.isConnected)&&void 0!==t&&t}class FC{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 BC(e,t,i,n){return new FC(e,t,i,n)}function VC(e){return function(t){return e(new EC(t))}}let WC=function(e,t,i,n){let o=i;return"click"===t||"mousedown"===t?o=VC(i):"keydown"!==t&&"keypress"!==t&&"keyup"!==t||(o=function(e){return function(t){return e(new SC(t))}}(i)),BC(e,t,o,n)};function HC(e,t,i){return BC(e,Vs&&mC?yw.POINTER_DOWN:yw.MOUSE_DOWN,t,i)}function zC(e,t,i){return BC(e,Vs&&mC?yw.POINTER_UP:yw.MOUSE_UP,t,i)}function jC(e,t){return BC(e,"mouseout",(i=>{let n=i.relatedTarget;for(;n&&n!==e;)n=n.parentNode;n!==e&&t(i)}))}function UC(e,t,i){let n=null;const o=e=>s.fire(e),s=new $o({onFirstListenerAdd:()=>{n||(n=new FC(e,t,o,i))},onLastListenerRemove:()=>{n&&(n.dispose(),n=null)}});return s}let $C,KC,qC=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};KC=(t,n=0)=>{let s=new GC(t,n);return e.push(s),i||(i=!0,function(e){if(!qC){const e=e=>setTimeout((()=>e((new Date).getTime())),0);qC=self.requestAnimationFrame||self.msRequestAnimationFrame||self.webkitRequestAnimationFrame||self.mozRequestAnimationFrame||self.oRequestAnimationFrame||e}qC.call(self,e)}(o)),s},$C=(e,i)=>{if(n){let n=new GC(e,i);return t.push(n),n}return KC(e,i)}}();const ZC=function(e,t){return t};class YC extends Uo{constructor(e,t,i,n=ZC,o=8){super();let s=null,r=0,a=this._register(new Vv),l=()=>{r=(new Date).getTime(),i(s),s=null};this._register(BC(e,t,(e=>{s=n(s,e);let t=(new Date).getTime()-r;t>=o?(a.cancel(),l()):a.setIfNotSet(l,o-t)})))}}function XC(e,t,i,n,o){return new YC(e,t,i,n,o)}function QC(e){return document.defaultView.getComputedStyle(e,null)}function JC(e){if(e!==document.body)return new tw(e.clientWidth,e.clientHeight);if(Vs&&window.visualViewport)return new tw(window.visualViewport.width,window.visualViewport.height);if(window.innerWidth&&window.innerHeight)return new tw(window.innerWidth,window.innerHeight);if(document.body&&document.body.clientWidth&&document.body.clientHeight)return new tw(document.body.clientWidth,document.body.clientHeight);if(document.documentElement&&document.documentElement.clientWidth&&document.documentElement.clientHeight)return new tw(document.documentElement.clientWidth,document.documentElement.clientHeight);throw new Error("Unable to figure out browser width and height")}class ew{static convertToPixels(e,t){return parseFloat(t)||0}static getDimension(e,t,i){let n=QC(e),o="0";return n&&(o=n.getPropertyValue?n.getPropertyValue(t):n.getAttribute(i)),ew.convertToPixels(e,o)}static getBorderLeftWidth(e){return ew.getDimension(e,"border-left-width","borderLeftWidth")}static getBorderRightWidth(e){return ew.getDimension(e,"border-right-width","borderRightWidth")}static getBorderTopWidth(e){return ew.getDimension(e,"border-top-width","borderTopWidth")}static getBorderBottomWidth(e){return ew.getDimension(e,"border-bottom-width","borderBottomWidth")}static getPaddingLeft(e){return ew.getDimension(e,"padding-left","paddingLeft")}static getPaddingRight(e){return ew.getDimension(e,"padding-right","paddingRight")}static getPaddingTop(e){return ew.getDimension(e,"padding-top","paddingTop")}static getPaddingBottom(e){return ew.getDimension(e,"padding-bottom","paddingBottom")}static getMarginLeft(e){return ew.getDimension(e,"margin-left","marginLeft")}static getMarginTop(e){return ew.getDimension(e,"margin-top","marginTop")}static getMarginRight(e){return ew.getDimension(e,"margin-right","marginRight")}static getMarginBottom(e){return ew.getDimension(e,"margin-bottom","marginBottom")}}class tw{constructor(e,t){this.width=e,this.height=t}with(e=this.width,t=this.height){return e!==this.width||t!==this.height?new tw(e,t):this}static is(e){return"object"==typeof e&&"number"==typeof e.height&&"number"==typeof e.width}static lift(e){return e instanceof tw?e:new tw(e.width,e.height)}static equals(e,t){return e===t||!(!e||!t)&&(e.width===t.width&&e.height===t.height)}}function iw(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=uw(e)?null:QC(e);o&&(n-="rtl"!==o.direction?e.scrollLeft:-e.scrollLeft),e===t&&(n+=ew.getBorderLeftWidth(e),i+=ew.getBorderTopWidth(e),i+=e.offsetTop,n+=e.offsetLeft,t=e.offsetParent)}return{left:n,top:i}}function nw(e){let t=e.getBoundingClientRect();return{left:t.left+ow.scrollX,top:t.top+ow.scrollY,width:t.width,height:t.height}}tw.None=new tw(0,0);const ow=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 sw(e){let t=ew.getMarginLeft(e)+ew.getMarginRight(e);return e.offsetWidth+t}function rw(e){let t=ew.getBorderLeftWidth(e)+ew.getBorderRightWidth(e),i=ew.getPaddingLeft(e)+ew.getPaddingRight(e);return e.offsetWidth-t-i}function aw(e){let t=ew.getBorderTopWidth(e)+ew.getBorderBottomWidth(e),i=ew.getPaddingTop(e)+ew.getPaddingBottom(e);return e.offsetHeight-t-i}function lw(e){let t=ew.getMarginTop(e)+ew.getMarginBottom(e);return e.offsetHeight+t}function dw(e,t){for(;e;){if(e===t)return!0;e=e.parentNode}return!1}function hw(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 cw(e,t,i){return!!hw(e,t,i)}function uw(e){return e&&!!e.host&&!!e.mode}function gw(e){return!!pw(e)}function pw(e){for(;e.parentNode;){if(e===document.body)return null;e=e.parentNode}return uw(e)?e:null}function mw(){let e=document.activeElement;for(;null==e?void 0:e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function fw(e=document.getElementsByTagName("head")[0]){let t=document.createElement("style");return t.type="text/css",t.media="screen",e.appendChild(t),t}let _w=null;function vw(){return _w||(_w=fw()),_w}function bw(e,t,i=vw()){i&&t&&i.sheet.insertRule(e+"{"+t+"}",0)}function Cw(e,t=vw()){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 ww(e){return"object"==typeof HTMLElement?e instanceof HTMLElement:e&&"object"==typeof e&&1===e.nodeType&&"string"==typeof e.nodeName}const yw={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:Pf?"webkitAnimationStart":"animationstart",ANIMATION_END:Pf?"webkitAnimationEnd":"animationend",ANIMATION_ITERATION:Pf?"webkitAnimationIteration":"animationiteration"},Sw=function(e,t){e.preventDefault?e.preventDefault():e.returnValue=!1,t&&(e.stopPropagation?e.stopPropagation():e.cancelBubble=!0)};class xw 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=xw.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=()=>{xw.hasFocusWithin(e)!==t&&(t?o():n())},this._register(BC(e,yw.FOCUS,n,!0)),this._register(BC(e,yw.BLUR,o,!0)),this._register(BC(e,yw.FOCUS_IN,(()=>this._refreshStateHandler()))),this._register(BC(e,yw.FOCUS_OUT,(()=>this._refreshStateHandler())))}static hasFocusWithin(e){const t=pw(e);return dw(t?t.activeElement:document.activeElement,e)}}function kw(e){return new xw(e)}function Lw(e,...t){if(e.append(...t),1===t.length&&"string"!=typeof t[0])return t[0]}function Dw(e,...t){e.innerText="",Lw(e,...t)}const Ew=/([\w\-]+)?(#([\w\-]+))?((\.([\w\-]+))*)/;var Nw,Iw;function Tw(e,t,i,...n){let o=Ew.exec(t);if(!o)throw new Error("Bad use of emmet");i=Object.assign({},i||{});let s,r=o[1]||"div";return s=e!==Nw.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 Mw(e,t,...i){return Tw(Nw.HTML,e,t,...i)}function Ow(...e){for(let t of e)t.style.display="",t.removeAttribute("aria-hidden")}function Aw(...e){for(let t of e)t.style.display="none",t.setAttribute("aria-hidden","true")}function Rw(e){const t=window.devicePixelRatio*e;return Math.max(1,Math.floor(t))/window.devicePixelRatio}function Pw(e){window.open(e,"_blank","noopener")}function Fw(e){return e?`url('${AC.asBrowserUri(e).toString(!0).replace(/'/g,"%27")}')`:"url('')"}function Bw(e){return`'${e.replace(/'/g,"%27")}'`}(Iw=Nw||(Nw={})).HTML="http://www.w3.org/1999/xhtml",Iw.SVG="http://www.w3.org/2000/svg",Mw.SVG=function(e,t,...i){return Tw(Nw.SVG,e,t,...i)},MC.setPreferredWebSchema(/^https:/.test(window.location.href)?"https":"http");class Vw extends $o{constructor(){super(),this._subscriptions=new Cs,this._keyStatus={altKey:!1,shiftKey:!1,ctrlKey:!1,metaKey:!1},this._subscriptions.add(BC(window,"keydown",(e=>{if(e.defaultPrevented)return;const t=new SC(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(BC(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(BC(document.body,"mousedown",(()=>{this._keyStatus.lastKeyPressed=void 0}),!0)),this._subscriptions.add(BC(document.body,"mouseup",(()=>{this._keyStatus.lastKeyPressed=void 0}),!0)),this._subscriptions.add(BC(document.body,"mousemove",(e=>{e.buttons&&(this._keyStatus.lastKeyPressed=void 0)}),!0)),this._subscriptions.add(BC(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 Vw.instance||(Vw.instance=new Vw),Vw.instance}dispose(){super.dispose(),this._subscriptions.dispose()}}let Ww,Hw,zw,jw,Uw;function $w(e){Ww&&(Hw.textContent!==e?(RC(zw),qw(Hw,e)):(RC(Hw),qw(zw,e)))}function Kw(e){Ww&&(Ho?$w(e):jw.textContent!==e?(RC(Uw),qw(jw,e)):(RC(jw),qw(Uw,e)))}function qw(e,t){RC(e),t.length>2e4&&(t=t.substr(0,2e4)),e.textContent=t,e.style.visibility="hidden",e.style.visibility="visible"}const Gw=s_("markerDecorationsService"),Zw=s_("textModelService");var Yw=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 Xw 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 Yw(this,void 0,void 0,(function*(){this._actionCallback&&(yield this._actionCallback(e))}))}}class Qw 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 Yw(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 Yw(this,void 0,void 0,(function*(){yield e.run(t)}))}}class Jw extends Xw{constructor(e){super(Jw.ID,e,e?"separator text":"separator"),this.checked=!1,this.enabled=!1}}Jw.ID="vs.actions.separator";class ey{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 Yw(this,void 0,void 0,(function*(){}))}}class ty extends Xw{constructor(){super(ty.ID,$m(0,"(empty)"),void 0,!1)}}ty.ID="vs.actions.empty";const iy=s_("commandService"),ny=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 Hs,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 ny.registerCommand(e,((e,...i)=>e.get(iy).executeCommand(t,...i)))}getCommand(e){const t=this._commands.get(e);if(t&&!t.isEmpty())return zs.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}};ny.registerCommand("noop",(()=>{}));const oy=new Map;oy.set("false",!1),oy.set("true",!0),oy.set("isMac",Ho),oy.set("isLinux",Vo),oy.set("isWindows",Rs),oy.set("isWeb",Fs),oy.set("isMacNative",Ho&&!Fs),oy.set("isEdge",js),oy.set("isFirefox",Us),oy.set("isChrome",$s),oy.set("isSafari",Ks);const sy=Object.prototype.hasOwnProperty;class ry{static has(e){return hy.create(e)}static equals(e,t){return cy.create(e,t)}static regex(e,t){return wy.create(e,t)}static not(e){return my.create(e)}static and(...e){return xy.create(e,null)}static or(...e){return ky.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 ky.create(i.map((e=>this._deserializeAndExpression(e,t))),null,!0)}static _deserializeAndExpression(e,t){let i=e.split("&&");return xy.create(i.map((e=>this._deserializeOne(e,t))),null)}static _deserializeOne(e,t){if((e=e.trim()).indexOf("!=")>=0){let i=e.split("!=");return py.create(i[0].trim(),this._deserializeValue(i[1],t))}if(e.indexOf("==")>=0){let i=e.split("==");return cy.create(i[0].trim(),this._deserializeValue(i[1],t))}if(e.indexOf("=~")>=0){let i=e.split("=~");return wy.create(i[0].trim(),this._deserializeRegexValue(i[1],t))}if(e.indexOf(" in ")>=0){let t=e.split(" in ");return uy.create(t[0].trim(),t[1].trim())}if(/^[^<=>]+>=[^<=>]+$/.test(e)){const t=e.split(">=");return vy.create(t[0].trim(),t[1].trim())}if(/^[^<=>]+>[^<=>]+$/.test(e)){const t=e.split(">");return _y.create(t[0].trim(),t[1].trim())}if(/^[^<=>]+<=[^<=>]+$/.test(e)){const t=e.split("<=");return Cy.create(t[0].trim(),t[1].trim())}if(/^[^<=>]+<[^<=>]+$/.test(e)){const t=e.split("<");return by.create(t[0].trim(),t[1].trim())}return/^\!\s*/.test(e)?my.create(e.substr(1).trim()):hy.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 ay(e,t){return e.cmp(t)}class ly{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 dy.INSTANCE}}ly.INSTANCE=new ly;class dy{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 ly.INSTANCE}}dy.INSTANCE=new dy;class hy{constructor(e,t){this.key=e,this.negated=t,this.type=2}static create(e,t=null){const i=oy.get(e);return"boolean"==typeof i?i?dy.INSTANCE:ly.INSTANCE:new hy(e,t)}cmp(e){return e.type!==this.type?this.type-e.type:Ey(this.key,e.key)}equals(e){return e.type===this.type&&this.key===e.key}substituteConstants(){const e=oy.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=my.create(this.key,this)),this.negated}}class cy{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?hy.create(e,i):my.create(e,i);const n=oy.get(e);if("boolean"==typeof n){return t===(n?"true":"false")?dy.INSTANCE:ly.INSTANCE}return new cy(e,t,i)}cmp(e){return e.type!==this.type?this.type-e.type:Ny(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=oy.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=py.create(this.key,this.value,this)),this.negated}}class uy{constructor(e,t){this.key=e,this.valueKey=t,this.type=10,this.negated=null}static create(e,t){return new uy(e,t)}cmp(e){return e.type!==this.type?this.type-e.type:Ny(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&&sy.call(t,i)}serialize(){return`${this.key} in '${this.valueKey}'`}keys(){return[this.key,this.valueKey]}negate(){return this.negated||(this.negated=gy.create(this)),this.negated}}class gy{constructor(e){this._actual=e,this.type=11}static create(e){return new gy(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 py{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?my.create(e,i):hy.create(e,i);const n=oy.get(e);if("boolean"==typeof n){return t===(n?"true":"false")?ly.INSTANCE:dy.INSTANCE}return new py(e,t,i)}cmp(e){return e.type!==this.type?this.type-e.type:Ny(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=oy.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=cy.create(this.key,this.value,this)),this.negated}}class my{constructor(e,t){this.key=e,this.negated=t,this.type=3}static create(e,t=null){const i=oy.get(e);return"boolean"==typeof i?i?ly.INSTANCE:dy.INSTANCE:new my(e,t)}cmp(e){return e.type!==this.type?this.type-e.type:Ey(this.key,e.key)}equals(e){return e.type===this.type&&this.key===e.key}substituteConstants(){const e=oy.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=hy.create(this.key,this)),this.negated}}function fy(e,t){if("string"==typeof e){const t=parseFloat(e);isNaN(t)||(e=t)}return"string"==typeof e||"number"==typeof e?t(e):ly.INSTANCE}class _y{constructor(e,t,i){this.key=e,this.value=t,this.negated=i,this.type=12}static create(e,t,i=null){return fy(t,(t=>new _y(e,t,i)))}cmp(e){return e.type!==this.type?this.type-e.type:Ny(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=Cy.create(this.key,this.value,this)),this.negated}}class vy{constructor(e,t,i){this.key=e,this.value=t,this.negated=i,this.type=13}static create(e,t,i=null){return fy(t,(t=>new vy(e,t,i)))}cmp(e){return e.type!==this.type?this.type-e.type:Ny(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 by{constructor(e,t,i){this.key=e,this.value=t,this.negated=i,this.type=14}static create(e,t,i=null){return fy(t,(t=>new by(e,t,i)))}cmp(e){return e.type!==this.type?this.type-e.type:Ny(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=vy.create(this.key,this.value,this)),this.negated}}class Cy{constructor(e,t,i){this.key=e,this.value=t,this.negated=i,this.type=15}static create(e,t,i=null){return fy(t,(t=>new Cy(e,t,i)))}cmp(e){return e.type!==this.type?this.type-e.type:Ny(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=_y.create(this.key,this.value,this)),this.negated}}class wy{constructor(e,t){this.key=e,this.regexp=t,this.type=7,this.negated=null}static create(e,t){return new wy(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=yy.create(this)),this.negated}}class yy{constructor(e){this._actual=e,this.type=8}static create(e){return new yy(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 Sy(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 xy{constructor(e,t){this.expr=e,this.negated=t,this.type=6}static create(e,t){return xy._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=ay(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=Sy(this.expr);return e===this.expr?this:xy.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 ly.INSTANCE;6!==o.type?i.push(o):i.push(...o.expr)}else n=!0;if(0===i.length&&n)return dy.INSTANCE;if(0!==i.length){if(1===i.length)return i[0];i.sort(ay);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=ky.create(e.expr.map((e=>xy.create([e,t],null))),null,n);o&&(i.push(o),i.sort(ay))}return 1===i.length?i[0]:new xy(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=ky.create(e,this,!0)}return this.negated}}class ky{constructor(e,t){this.expr=e,this.negated=t,this.type=9}static create(e,t,i){return ky._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=ay(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=Sy(this.expr);return e===this.expr?this:ky.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 dy.INSTANCE;9!==i.type?n.push(i):n=n.concat(i.expr)}else o=!0}if(0===n.length&&o)return ly.INSTANCE;n.sort(ay)}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++)Iy(n[e],n[t])&&(n.splice(t,1),t--);if(1===n.length)return n[0]}return new ky(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 Ty(t))for(const t of Ty(i))n.push(xy.create([e,t],null));const o=0===e.length;e.unshift(ky.create(n,null,o))}this.negated=e[0]}return this.negated}}class Ly extends hy{constructor(e,t,i){super(e,null),this._defaultValue=t,"object"==typeof i?Ly._info.push(Object.assign(Object.assign({},i),{key:e})):!0!==i&&Ly._info.push({key:e,description:i,type:null!=t?typeof t:void 0})}static all(){return Ly._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 cy.create(this.key,e)}}Ly._info=[];const Dy=s_("contextKeyService");function Ey(e,t){return e<t?-1:e>t?1:0}function Ny(e,t,i,n){return e<i?-1:e>i?1:t<n?-1:t>n?1:0}function Iy(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=Ty(e.negate()).concat(Ty(t));i.sort(ay);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 Ty(e){return 9===e.type?e.expr:[e]}const My=new class{constructor(){this.data=new Map}add(e,t){a_(Gs(e)),a_(Zs(t)),a_(!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 Oy,Ay;(Ay=Oy||(Oy={})).DARK="dark",Ay.LIGHT="light",Ay.HIGH_CONTRAST="hc";const Ry=s_("themeService");var Py,Fy;function By(e){return{id:e}}function Vy(e){switch(e){case Oy.DARK:return"vs-dark";case Oy.HIGH_CONTRAST:return"hc-black";default:return"vs"}}(Py||(Py={})).isThemeColor=function(e){return e&&"object"==typeof e&&"string"==typeof e.id},function(e){e.isThemeIcon=function(e){return e&&"object"==typeof e&&"string"==typeof e.id&&(void 0===e.color||Py.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?By(t):void 0}},e.asClassNameArray=Ys.asClassNameArray,e.asClassName=Ys.asClassName,e.asCSSSelector=Ys.asCSSSelector}(Fy||(Fy={}));const Wy="base.contributions.theming";let Hy=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 zy(e){return Hy.onColorThemeChange(e)}My.add(Wy,Hy);class jy 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 Uy=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},$y=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};function Ky(e){return void 0!==e.command}class qy{constructor(e){this.id=qy._idPool++,this._debugName=e}}qy._idPool=0,qy.CommandPalette=new qy("CommandPalette"),qy.DebugBreakpointsContext=new qy("DebugBreakpointsContext"),qy.DebugCallStackContext=new qy("DebugCallStackContext"),qy.DebugConsoleContext=new qy("DebugConsoleContext"),qy.DebugVariablesContext=new qy("DebugVariablesContext"),qy.DebugWatchContext=new qy("DebugWatchContext"),qy.DebugToolBar=new qy("DebugToolBar"),qy.EditorContext=new qy("EditorContext"),qy.SimpleEditorContext=new qy("SimpleEditorContext"),qy.EditorContextCopy=new qy("EditorContextCopy"),qy.EditorContextPeek=new qy("EditorContextPeek"),qy.EditorTitle=new qy("EditorTitle"),qy.EditorTitleRun=new qy("EditorTitleRun"),qy.EditorTitleContext=new qy("EditorTitleContext"),qy.EmptyEditorGroup=new qy("EmptyEditorGroup"),qy.EmptyEditorGroupContext=new qy("EmptyEditorGroupContext"),qy.ExplorerContext=new qy("ExplorerContext"),qy.ExtensionContext=new qy("ExtensionContext"),qy.GlobalActivity=new qy("GlobalActivity"),qy.LayoutControlMenuSubmenu=new qy("LayoutControlMenuSubmenu"),qy.LayoutControlMenu=new qy("LayoutControlMenu"),qy.MenubarMainMenu=new qy("MenubarMainMenu"),qy.MenubarAppearanceMenu=new qy("MenubarAppearanceMenu"),qy.MenubarDebugMenu=new qy("MenubarDebugMenu"),qy.MenubarEditMenu=new qy("MenubarEditMenu"),qy.MenubarCopy=new qy("MenubarCopy"),qy.MenubarFileMenu=new qy("MenubarFileMenu"),qy.MenubarGoMenu=new qy("MenubarGoMenu"),qy.MenubarHelpMenu=new qy("MenubarHelpMenu"),qy.MenubarLayoutMenu=new qy("MenubarLayoutMenu"),qy.MenubarNewBreakpointMenu=new qy("MenubarNewBreakpointMenu"),qy.MenubarPanelAlignmentMenu=new qy("MenubarPanelAlignmentMenu"),qy.MenubarPanelPositionMenu=new qy("MenubarPanelPositionMenu"),qy.MenubarPreferencesMenu=new qy("MenubarPreferencesMenu"),qy.MenubarRecentMenu=new qy("MenubarRecentMenu"),qy.MenubarSelectionMenu=new qy("MenubarSelectionMenu"),qy.MenubarSwitchEditorMenu=new qy("MenubarSwitchEditorMenu"),qy.MenubarSwitchGroupMenu=new qy("MenubarSwitchGroupMenu"),qy.MenubarTerminalMenu=new qy("MenubarTerminalMenu"),qy.MenubarViewMenu=new qy("MenubarViewMenu"),qy.MenubarHomeMenu=new qy("MenubarHomeMenu"),qy.OpenEditorsContext=new qy("OpenEditorsContext"),qy.ProblemsPanelContext=new qy("ProblemsPanelContext"),qy.SCMChangeContext=new qy("SCMChangeContext"),qy.SCMResourceContext=new qy("SCMResourceContext"),qy.SCMResourceFolderContext=new qy("SCMResourceFolderContext"),qy.SCMResourceGroupContext=new qy("SCMResourceGroupContext"),qy.SCMSourceControl=new qy("SCMSourceControl"),qy.SCMTitle=new qy("SCMTitle"),qy.SearchContext=new qy("SearchContext"),qy.StatusBarWindowIndicatorMenu=new qy("StatusBarWindowIndicatorMenu"),qy.StatusBarRemoteIndicatorMenu=new qy("StatusBarRemoteIndicatorMenu"),qy.TestItem=new qy("TestItem"),qy.TestItemGutter=new qy("TestItemGutter"),qy.TestPeekElement=new qy("TestPeekElement"),qy.TestPeekTitle=new qy("TestPeekTitle"),qy.TouchBarContext=new qy("TouchBarContext"),qy.TitleBarContext=new qy("TitleBarContext"),qy.TunnelContext=new qy("TunnelContext"),qy.TunnelPrivacy=new qy("TunnelPrivacy"),qy.TunnelProtocol=new qy("TunnelProtocol"),qy.TunnelPortInline=new qy("TunnelInline"),qy.TunnelTitle=new qy("TunnelTitle"),qy.TunnelLocalAddressInline=new qy("TunnelLocalAddressInline"),qy.TunnelOriginInline=new qy("TunnelOriginInline"),qy.ViewItemContext=new qy("ViewItemContext"),qy.ViewContainerTitle=new qy("ViewContainerTitle"),qy.ViewContainerTitleContext=new qy("ViewContainerTitleContext"),qy.ViewTitle=new qy("ViewTitle"),qy.ViewTitleContext=new qy("ViewTitleContext"),qy.CommentThreadTitle=new qy("CommentThreadTitle"),qy.CommentThreadActions=new qy("CommentThreadActions"),qy.CommentTitle=new qy("CommentTitle"),qy.CommentActions=new qy("CommentActions"),qy.InteractiveToolbar=new qy("InteractiveToolbar"),qy.InteractiveCellTitle=new qy("InteractiveCellTitle"),qy.InteractiveCellExecute=new qy("InteractiveCellExecute"),qy.InteractiveInputExecute=new qy("InteractiveInputExecute"),qy.NotebookToolbar=new qy("NotebookToolbar"),qy.NotebookCellTitle=new qy("NotebookCellTitle"),qy.NotebookCellInsert=new qy("NotebookCellInsert"),qy.NotebookCellBetween=new qy("NotebookCellBetween"),qy.NotebookCellListTop=new qy("NotebookCellTop"),qy.NotebookCellExecute=new qy("NotebookCellExecute"),qy.NotebookCellExecutePrimary=new qy("NotebookCellExecutePrimary"),qy.NotebookDiffCellInputTitle=new qy("NotebookDiffCellInputTitle"),qy.NotebookDiffCellMetadataTitle=new qy("NotebookDiffCellMetadataTitle"),qy.NotebookDiffCellOutputsTitle=new qy("NotebookDiffCellOutputsTitle"),qy.NotebookOutputToolbar=new qy("NotebookOutputToolbar"),qy.NotebookEditorLayoutConfigure=new qy("NotebookEditorLayoutConfigure"),qy.BulkEditTitle=new qy("BulkEditTitle"),qy.BulkEditContext=new qy("BulkEditContext"),qy.TimelineItemContext=new qy("TimelineItemContext"),qy.TimelineTitle=new qy("TimelineTitle"),qy.TimelineTitleContext=new qy("TimelineTitleContext"),qy.AccountsContext=new qy("AccountsContext"),qy.PanelTitle=new qy("PanelTitle"),qy.AuxiliaryBarTitle=new qy("AuxiliaryBarTitle"),qy.TerminalInstanceContext=new qy("TerminalInstanceContext"),qy.TerminalEditorInstanceContext=new qy("TerminalEditorInstanceContext"),qy.TerminalNewDropdownContext=new qy("TerminalNewDropdownContext"),qy.TerminalTabContext=new qy("TerminalTabContext"),qy.TerminalTabEmptyAreaContext=new qy("TerminalTabEmptyAreaContext"),qy.TerminalInlineTabContext=new qy("TerminalInlineTabContext"),qy.WebviewContext=new qy("WebviewContext"),qy.InlineCompletionsActions=new qy("InlineCompletionsActions"),qy.NewFile=new qy("NewFile");const Gy=s_("menuService"),Zy=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===qy.CommandPalette}}addCommand(e){return this.addCommands(zs.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(zs.single({id:e,item:t}))}appendMenuItems(e){const t=new Set,i=new Hs;for(const{id:n,item:o}of e){let e=this._menuItems.get(n);e||(e=new Hs,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===qy.CommandPalette&&this._appendImplicitItems(t),t}_appendImplicitItems(e){const t=new Set;for(const i of e)Ky(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 Yy extends ey{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 Jw));return e.length&&e.pop(),e}}let Xy=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,Fy.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)}};Xy=Uy([$y(3,Dy),$y(4,iy)],Xy);class Qy{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=Qy.bindToCurrentPlatform(e);if(t&&t.primary){const i=fC(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=fC(t.secondary[i],Xs);n&&this._registerDefaultKeybinding(n,e.id,e.args,e.weight,-i-1,e.when)}}registerCommandAndKeybindingRule(e){this.registerKeybindingRule(e),ny.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&&Qy._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(eS)),this._cachedMergedKeybindings.slice(0)}}const Jy=new Qy;function eS(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}My.add("platform.keybindingsRegistry",Jy);const tS=s_("telemetryService");class iS{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?ry.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};Jy.registerKeybindingRule(i)}}ny.registerCommand({id:this.id,handler:(e,t)=>this.runCommand(e,t),description:this._description})}_registerMenuItem(e){Zy.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 nS extends iS{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(tb);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 oS extends iS{constructor(e,t){super(t),this.command=e}runCommand(e,t){return this.command.runCommand(e,t)}}class sS extends iS{static bindToContribution(e){return class extends sS{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(r_),n=i.getFocusedCodeEditor()||i.getActiveCodeEditor();if(n)return n.invokeWithinContext((e=>{if(e.get(Dy).contextMatchesRules(Qs(this.precondition)))return this.runEditorCommand(e,n,t)}))}}class rS extends sS{constructor(e){super(rS.convertOptions(e)),this.label=e.label,this.alias=e.alias}static convertOptions(e){let t;function i(t){return t.menuId||(t.menuId=qy.EditorContext),t.title||(t.title=e.label),t.when=ry.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(tS).publicLog2("editorActionInvoked",{name:this.label,id:this.id})}}class aS extends rS{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 lS(e,t){ny.registerCommand(e,(function(e,...i){const n=e.get(n_),[o,s]=i;Js(Ps.isUri(o)),Js(er.isIPosition(s));const r=e.get(Dv).getModel(o);if(r){const e=er.lift(s);return n.invokeFunction(t,r,e,...i.slice(2))}return e.get(Zw).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 dS(e){return fS.INSTANCE.registerEditorCommand(e),e}function hS(e){const t=new e;return fS.INSTANCE.registerEditorAction(t),t}function cS(e){return fS.INSTANCE.registerEditorAction(e),e}function uS(e){fS.INSTANCE.registerEditorAction(e)}function gS(e,t){fS.INSTANCE.registerEditorContribution(e,t)}var pS,mS;(mS=pS||(pS={})).getEditorCommand=function(e){return fS.INSTANCE.getEditorCommand(e)},mS.getEditorActions=function(){return fS.INSTANCE.getEditorActions()},mS.getEditorContributions=function(){return fS.INSTANCE.getEditorContributions()},mS.getSomeEditorContributions=function(e){return fS.INSTANCE.getEditorContributions().filter((t=>e.indexOf(t.id)>=0))},mS.getDiffEditorContributions=function(){return fS.INSTANCE.getDiffEditorContributions()};class fS{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 _S(e){return e.register(),e}fS.INSTANCE=new fS,My.add("editor.contributions",fS.INSTANCE);const vS=_S(new nS({id:"undo",precondition:void 0,kbOpts:{weight:0,primary:2104},menuOpts:[{menuId:qy.MenubarEditMenu,group:"1_do",title:$m(0,"&&Undo"),order:1},{menuId:qy.CommandPalette,group:"",title:$m(0,"Undo"),order:1}]}));_S(new oS(vS,{id:"default:undo",precondition:void 0}));const bS=_S(new nS({id:"redo",precondition:void 0,kbOpts:{weight:0,primary:2103,secondary:[3128],mac:{primary:3128}},menuOpts:[{menuId:qy.MenubarEditMenu,group:"1_do",title:$m(0,"&&Redo"),order:2},{menuId:qy.CommandPalette,group:"",title:$m(0,"Redo"),order:1}]}));_S(new oS(bS,{id:"default:redo",precondition:void 0}));const CS=_S(new nS({id:"editor.action.selectAll",precondition:void 0,kbOpts:{weight:0,kbExpr:null,primary:2079},menuOpts:[{menuId:qy.MenubarSelectionMenu,group:"1_basic",title:$m(0,"&&Select All"),order:1},{menuId:qy.CommandPalette,group:"",title:$m(0,"Select All"),order:1}]}));var wS=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},yS=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};let SS=class{constructor(e,t){}dispose(){}};SS.ID="editor.contrib.markerDecorations",SS=wS([yS(1,Gw)],SS),gS(SS.ID,SS);class xS 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 kS=Object.prototype.hasOwnProperty;class LS{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 DS(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(kS.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 h=e.autoIndent;!0===h?e.autoIndent="full":!1===h&&(e.autoIndent="advanced");const c=e.matchBrackets;!0===c?e.matchBrackets="always":!1===c&&(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 ES=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))}},NS=s_("accessibilityService"),IS=new Ly("accessibilityModeEnabled",!1);var TS=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},MS=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};let OS=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 Gm,this.isSimpleWidget=e,this._containerObserver=this._register(new xS(i,t.dimension)),this._rawOptions=BS(t),this._validatedOptions=FS.validateOptions(this._rawOptions),this.options=this._computeOptions(),this.options.get(10)&&this._containerObserver.startObserving(),this._register(Zf.onDidChangeZoomLevel((()=>this._recomputeOptions()))),this._register(ES.onDidChangeTabFocus((()=>this._recomputeOptions()))),this._register(this._containerObserver.onDidChange((()=>this._recomputeOptions()))),this._register(e_.onDidChange((()=>this._recomputeOptions()))),this._register(Mf.onDidChange((()=>this._recomputeOptions()))),this._register(this._accessibilityService.onDidChangeScreenReaderOptimized((()=>this._recomputeOptions())))}_recomputeOptions(){const e=this._computeOptions(),t=FS.checkEquals(this.options,e);null!==t&&(this.options=e,this._onDidChangeFast.fire(t),this._onDidChange.fire(t))}_computeOptions(){const e=this._readEnvConfiguration(),t=Xf.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:ES.getTabFocusMode(),accessibilitySupport:e.accessibilitySupport};return FS.computeOptions(this._validatedOptions,n)}_readEnvConfiguration(){return{extraEditorClassName:AS(),outerWidth:this._containerObserver.getWidth(),outerHeight:this._containerObserver.getHeight(),emptySelectionClipboard:Pf||Rf,pixelRatio:Mf.value,accessibilitySupport:this._accessibilityService.isScreenReaderOptimized()?2:this._accessibilityService.getAccessibilitySupport()}}_readFontInfo(e){return e_.readFontInfo(e)}getRawOptions(){return this._rawOptions}updateOptions(e){const t=BS(e);FS.applyUpdate(this._rawOptions,t)&&(this._validatedOptions=FS.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 AS(){let e="";return Bf||Vf||(e+="no-user-select "),Bf&&(e+="no-minimap-shadow "),Ho&&(e+="mac "),e}OS=TS([MS(3,NS)],OS);class RS{constructor(){this._values=[]}_read(e){return this._values[e]}get(e){return this._values[e]}_write(e,t){this._values[e]=t}}class PS{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 FS{static validateOptions(e){const t=new RS;for(const i of Lf){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 PS;for(const n of Lf)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(!FS._deepEquals(e[i],t[i]))return!1;return!0}static checkEquals(e,t){const i=[];let n=!1;for(const o of Lf){const s=!FS._deepEquals(e._read(o.id),t._read(o.id));i[o.id]=s,s&&(n=!0)}return n?new qm(i):null}static applyUpdate(e,t){let i=!1;for(const n of Lf)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 BS(e){const t=tr(e);return DS(t),t}function VS(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 WS,HS,zS,jS,US=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};(HS=WS||(WS={})).Tap="-monaco-gesturetap",HS.Change="-monaco-gesturechange",HS.Start="-monaco-gesturestart",HS.End="-monaco-gesturesend",HS.Contextmenu="-monaco-gesturecontextmenu";class $S extends Uo{constructor(){super(),this.dispatched=!1,this.activeTouches={},this.handle=null,this.targets=[],this.ignoreTargets=[],this._lastSetTapCountTime=0,this._register(BC(document,"touchstart",(e=>this.onTouchStart(e)),{passive:!1})),this._register(BC(document,"touchend",(e=>this.onTouchEnd(e)))),this._register(BC(document,"touchmove",(e=>this.onTouchMove(e)),{passive:!1}))}static addTarget(e){return $S.isTouchDevice()?($S.INSTANCE||($S.INSTANCE=new $S),$S.INSTANCE.targets.push(e),{dispose:()=>{$S.INSTANCE.targets=$S.INSTANCE.targets.filter((t=>t!==e))}}):Uo.None}static ignoreTarget(e){return $S.isTouchDevice()?($S.INSTANCE||($S.INSTANCE=new $S),$S.INSTANCE.ignoreTargets.push(e),{dispose:()=>{$S.INSTANCE.ignoreTargets=$S.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(WS.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<$S.HOLD_DELAY&&Math.abs(s.initialPageX-ir(s.rollingPageX))<30&&Math.abs(s.initialPageY-ir(s.rollingPageY))<30){let e=this.newGestureEvent(WS.Tap,s.initialTarget);e.pageX=ir(s.rollingPageX),e.pageY=ir(s.rollingPageY),this.dispatchEvent(e)}else if(r>=$S.HOLD_DELAY&&Math.abs(s.initialPageX-ir(s.rollingPageX))<30&&Math.abs(s.initialPageY-ir(s.rollingPageY))<30){let e=this.newGestureEvent(WS.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(WS.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===WS.Tap){const t=(new Date).getTime();let i=0;i=t-this._lastSetTapCountTime>$S.CLEAR_TAP_COUNT_TIME?1:2,this._lastSetTapCountTime=t,e.tapCount=i}else e.type!==WS.Change&&e.type!==WS.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=KC((()=>{let l=Date.now(),d=l-t,h=0,c=0,u=!0;i+=$S.SCROLL_FRICTION*d,s+=$S.SCROLL_FRICTION*d,i>0&&(u=!1,h=n*i*d),s>0&&(u=!1,c=r*s*d);let g=this.newGestureEvent(WS.Change);g.translationX=h,g.translationY=c,e.forEach((e=>e.dispatchEvent(g))),u||this.inertia(e,l,i,n,o+h,s,r,a+c)}))}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(WS.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 KS(e,t){let i=new EC(t);return i.preventDefault(),{leftButton:i.leftButton,buttons:i.buttons,posx:i.posx,posy:i.posy}}$S.SCROLL_FRICTION=-.005,$S.HOLD_DELAY=700,$S.CLEAR_TAP_COUNT_TIME=400,US([VS],$S,"isTouchDevice",null);class qS{constructor(){this._hooks=new Cs,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=DC.getSameOriginWindowChain(),r=Vs?"pointermove":"mousemove",a=s.map((e=>e.window.document)),l=pw(e);l&&a.unshift(l);for(const d of a)this._hooks.add(XC(d,r,(e=>{e.buttons===t?this._mouseMoveCallback(e):this.stopMonitoring(!0)}),((e,t)=>this._mouseMoveEventMerger(e,t)))),this._hooks.add(BC(d,"mouseup",(e=>this.stopMonitoring(!0))));if(DC.hasDifferentOriginAncestor()){let e=s[s.length-1];this._hooks.add(BC(e.window.document,"mouseout",(e=>{"html"===new EC(e).target.tagName.toLowerCase()&&this.stopMonitoring(!0)}))),this._hooks.add(BC(e.window.document,"mouseover",(e=>{"html"===new EC(e).target.tagName.toLowerCase()&&this.stopMonitoring(!0)}))),this._hooks.add(BC(e.window.document.body,"mouseleave",(e=>{this.stopMonitoring(!0)})))}}}function GS(e,t){const i=Math.pow(10,t);return Math.round(e*i)/i}class ZS{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=GS(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 YS{constructor(e,t,i,n){this._hslaBrand=void 0,this.h=0|Math.max(Math.min(360,e),0),this.s=GS(Math.max(Math.min(1,t),0),3),this.l=GS(Math.max(Math.min(1,i),0),3),this.a=GS(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,h=s-r;if(h>0){switch(l=Math.min(d<=.5?h/(2*d):h/(2-2*d),1),s){case t:a=(i-n)/h+(i<n?6:0);break;case i:a=(n-t)/h+2;break;case n:a=(t-i)/h+4}a*=60,a=Math.round(a)}return new YS(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=YS._hue2rgb(o,e,t+1/3),r=YS._hue2rgb(o,e,t),a=YS._hue2rgb(o,e,t-1/3)}return new ZS(Math.round(255*s),Math.round(255*r),Math.round(255*a),o)}}class XS{constructor(e,t,i,n){this._hsvaBrand=void 0,this.h=0|Math.max(Math.min(360,e),0),this.s=GS(Math.max(Math.min(1,t),0),3),this.v=GS(Math.max(Math.min(1,i),0),3),this.a=GS(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 XS(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,h]=[0,0,0];return t<60?(l=s,d=r):t<120?(l=r,d=s):t<180?(d=s,h=r):t<240?(d=r,h=s):t<300?(l=r,h=s):t<=360&&(l=s,h=r),l=Math.round(255*(l+a)),d=Math.round(255*(d+a)),h=Math.round(255*(h+a)),new ZS(l,d,h,o)}}class QS{constructor(e){if(!e)throw new Error("Color needs a value");if(e instanceof ZS)this.rgba=e;else if(e instanceof YS)this._hsla=e,this.rgba=YS.toRGBA(e);else{if(!(e instanceof XS))throw new Error("Invalid color ctor argument");this._hsva=e,this.rgba=XS.toRGBA(e)}}static fromHex(e){return QS.Format.CSS.parseHex(e)||QS.red}get hsla(){return this._hsla?this._hsla:YS.fromRGBA(this.rgba)}get hsva(){return this._hsva?this._hsva:XS.fromRGBA(this.rgba)}equals(e){return!!e&&ZS.equals(this.rgba,e.rgba)&&YS.equals(this.hsla,e.hsla)&&XS.equals(this.hsva,e.hsva)}getRelativeLuminance(){return GS(.2126*QS._relativeLuminanceForComponent(this.rgba.r)+.7152*QS._relativeLuminanceForComponent(this.rgba.g)+.0722*QS._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 QS(new YS(this.hsla.h,this.hsla.s,this.hsla.l+this.hsla.l*e,this.hsla.a))}darken(e){return new QS(new YS(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 QS(new ZS(t,i,n,o*e))}isTransparent(){return 0===this.rgba.a}isOpaque(){return 1===this.rgba.a}opposite(){return new QS(new ZS(255-this.rgba.r,255-this.rgba.g,255-this.rgba.b,this.rgba.a))}toString(){return this._toString||(this._toString=QS.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)}}QS.white=new QS(new ZS(255,255,255,1)),QS.black=new QS(new ZS(0,0,0,1)),QS.red=new QS(new ZS(255,0,0,1)),QS.blue=new QS(new ZS(0,0,255,1)),QS.green=new QS(new ZS(0,255,0,1)),QS.cyan=new QS(new ZS(0,255,255,1)),QS.lightgrey=new QS(new ZS(211,211,211,1)),QS.transparent=new QS(new ZS(0,0,0,0)),zS=QS||(QS={}),function(e){function t(e){const t=e.toString(16);return 2!==t.length?"0"+t:t}function i(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}e.formatRGB=function(e){return 1===e.rgba.a?`rgb(${e.rgba.r}, ${e.rgba.g}, ${e.rgba.b})`:zS.Format.CSS.formatRGBA(e)},e.formatRGBA=function(e){return`rgba(${e.rgba.r}, ${e.rgba.g}, ${e.rgba.b}, ${+e.rgba.a.toFixed(2)})`},e.formatHSL=function(e){return 1===e.hsla.a?`hsl(${e.hsla.h}, ${(100*e.hsla.s).toFixed(2)}%, ${(100*e.hsla.l).toFixed(2)}%)`:zS.Format.CSS.formatHSLA(e)},e.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)})`},e.formatHex=function(e){return`#${t(e.rgba.r)}${t(e.rgba.g)}${t(e.rgba.b)}`},e.formatHexA=function(e,i=!1){return i&&1===e.rgba.a?zS.Format.CSS.formatHex(e):`#${t(e.rgba.r)}${t(e.rgba.g)}${t(e.rgba.b)}${t(Math.round(255*e.rgba.a))}`},e.format=function(e){return e.isOpaque()?zS.Format.CSS.formatHex(e):zS.Format.CSS.formatRGBA(e)},e.parseHex=function(e){const t=e.length;if(0===t)return null;if(35!==e.charCodeAt(0))return null;if(7===t){const t=16*i(e.charCodeAt(1))+i(e.charCodeAt(2)),n=16*i(e.charCodeAt(3))+i(e.charCodeAt(4)),o=16*i(e.charCodeAt(5))+i(e.charCodeAt(6));return new zS(new ZS(t,n,o,1))}if(9===t){const t=16*i(e.charCodeAt(1))+i(e.charCodeAt(2)),n=16*i(e.charCodeAt(3))+i(e.charCodeAt(4)),o=16*i(e.charCodeAt(5))+i(e.charCodeAt(6)),s=16*i(e.charCodeAt(7))+i(e.charCodeAt(8));return new zS(new ZS(t,n,o,s/255))}if(4===t){const t=i(e.charCodeAt(1)),n=i(e.charCodeAt(2)),o=i(e.charCodeAt(3));return new zS(new ZS(16*t+t,16*n+n,16*o+o))}if(5===t){const t=i(e.charCodeAt(1)),n=i(e.charCodeAt(2)),o=i(e.charCodeAt(3)),s=i(e.charCodeAt(4));return new zS(new ZS(16*t+t,16*n+n,16*o+o,(16*s+s)/255))}return null}}((jS=zS.Format||(zS.Format={})).CSS||(jS.CSS={}));const JS="base.contributions.json";const ex=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 tx(e){return`--vscode-${e.replace(/\./g,"-")}`}My.add(JS,ex);const ix="base.contributions.colors";const nx=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 cD(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 ox(e,t,i,n,o){return nx.registerColor(e,t,i,n,o)}My.add(ix,nx);const sx=ox("foreground",{dark:"#CCCCCC",light:"#616161",hc:"#FFFFFF"},$m(0,"Overall foreground color. This color is only used if not overridden by a component.")),rx=ox("errorForeground",{dark:"#F48771",light:"#A1260D",hc:"#F48771"},$m(0,"Overall foreground color for error messages. This color is only used if not overridden by a component."));ox("descriptionForeground",{light:"#717171",dark:lD(sx,.7),hc:lD(sx,.7)},$m(0,"Foreground color for description text providing additional information, for example for a label."));const ax=ox("icon.foreground",{dark:"#C5C5C5",light:"#424242",hc:"#FFFFFF"},$m(0,"The default color for icons in the workbench.")),lx=ox("focusBorder",{dark:"#007FD4",light:"#0090F1",hc:"#F38518"},$m(0,"Overall border color for focused elements. This color is only used if not overridden by a component.")),dx=ox("contrastBorder",{light:null,dark:null,hc:"#6FC3DF"},$m(0,"An extra border around elements to separate them from others for greater contrast.")),hx=ox("contrastActiveBorder",{light:null,dark:null,hc:lx},$m(0,"An extra border around active elements to separate them from others for greater contrast."));ox("selection.background",{light:null,dark:null,hc:null},$m(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.")),ox("textSeparator.foreground",{light:"#0000002e",dark:"#ffffff2e",hc:QS.black},$m(0,"Color for text separators."));const cx=ox("textLink.foreground",{light:"#006AB1",dark:"#3794FF",hc:"#3794FF"},$m(0,"Foreground color for links in text.")),ux=ox("textLink.activeForeground",{light:"#006AB1",dark:"#3794FF",hc:"#3794FF"},$m(0,"Foreground color for links in text when clicked on and on mouse hover."));ox("textPreformat.foreground",{light:"#A31515",dark:"#D7BA7D",hc:"#D7BA7D"},$m(0,"Foreground color for preformatted text segments.")),ox("textBlockQuote.background",{light:"#7f7f7f1a",dark:"#7f7f7f1a",hc:null},$m(0,"Background color for block quotes in text.")),ox("textBlockQuote.border",{light:"#007acc80",dark:"#007acc80",hc:QS.white},$m(0,"Border color for block quotes in text."));const gx=ox("textCodeBlock.background",{light:"#dcdcdc66",dark:"#0a0a0a66",hc:QS.black},$m(0,"Background color for code blocks in text.")),px=ox("widget.shadow",{dark:lD(QS.black,.36),light:lD(QS.black,.16),hc:null},$m(0,"Shadow color of widgets such as find/replace inside the editor.")),mx=ox("input.background",{dark:"#3C3C3C",light:QS.white,hc:QS.black},$m(0,"Input box background.")),fx=ox("input.foreground",{dark:sx,light:sx,hc:sx},$m(0,"Input box foreground.")),_x=ox("input.border",{dark:null,light:null,hc:dx},$m(0,"Input box border.")),vx=ox("inputOption.activeBorder",{dark:"#007ACC00",light:"#007ACC00",hc:dx},$m(0,"Border color of activated options in input fields."));ox("inputOption.hoverBackground",{dark:"#5a5d5e80",light:"#b8b8b850",hc:null},$m(0,"Background color of activated options in input fields."));const bx=ox("inputOption.activeBackground",{dark:lD(lx,.4),light:lD(lx,.2),hc:QS.transparent},$m(0,"Background hover color of options in input fields.")),Cx=ox("inputOption.activeForeground",{dark:QS.white,light:QS.black,hc:null},$m(0,"Foreground color of activated options in input fields."));ox("input.placeholderForeground",{light:lD(sx,.5),dark:lD(sx,.5),hc:lD(sx,.7)},$m(0,"Input box foreground color for placeholder text."));const wx=ox("inputValidation.infoBackground",{dark:"#063B49",light:"#D6ECF2",hc:QS.black},$m(0,"Input validation background color for information severity.")),yx=ox("inputValidation.infoForeground",{dark:null,light:null,hc:null},$m(0,"Input validation foreground color for information severity.")),Sx=ox("inputValidation.infoBorder",{dark:"#007acc",light:"#007acc",hc:dx},$m(0,"Input validation border color for information severity.")),xx=ox("inputValidation.warningBackground",{dark:"#352A05",light:"#F6F5D2",hc:QS.black},$m(0,"Input validation background color for warning severity.")),kx=ox("inputValidation.warningForeground",{dark:null,light:null,hc:null},$m(0,"Input validation foreground color for warning severity.")),Lx=ox("inputValidation.warningBorder",{dark:"#B89500",light:"#B89500",hc:dx},$m(0,"Input validation border color for warning severity.")),Dx=ox("inputValidation.errorBackground",{dark:"#5A1D1D",light:"#F2DEDE",hc:QS.black},$m(0,"Input validation background color for error severity.")),Ex=ox("inputValidation.errorForeground",{dark:null,light:null,hc:null},$m(0,"Input validation foreground color for error severity.")),Nx=ox("inputValidation.errorBorder",{dark:"#BE1100",light:"#BE1100",hc:dx},$m(0,"Input validation border color for error severity.")),Ix=ox("dropdown.background",{dark:"#3C3C3C",light:QS.white,hc:QS.black},$m(0,"Dropdown background."));ox("dropdown.listBackground",{dark:null,light:null,hc:QS.black},$m(0,"Dropdown list background."));const Tx=ox("dropdown.foreground",{dark:"#F0F0F0",light:null,hc:QS.white},$m(0,"Dropdown foreground.")),Mx=ox("dropdown.border",{dark:Ix,light:"#CECECE",hc:dx},$m(0,"Dropdown border."));ox("checkbox.background",{dark:Ix,light:Ix,hc:Ix},$m(0,"Background color of checkbox widget.")),ox("checkbox.foreground",{dark:Tx,light:Tx,hc:Tx},$m(0,"Foreground color of checkbox widget.")),ox("checkbox.border",{dark:Mx,light:Mx,hc:Mx},$m(0,"Border color of checkbox widget."));const Ox=ox("button.foreground",{dark:QS.white,light:QS.white,hc:QS.white},$m(0,"Button foreground color.")),Ax=ox("button.background",{dark:"#0E639C",light:"#007ACC",hc:null},$m(0,"Button background color.")),Rx=ox("button.hoverBackground",{dark:aD(Ax,.2),light:rD(Ax,.2),hc:null},$m(0,"Button background color when hovering."));ox("button.border",{dark:dx,light:dx,hc:dx},$m(0,"Button border color.")),ox("button.secondaryForeground",{dark:QS.white,light:QS.white,hc:QS.white},$m(0,"Secondary button foreground color."));const Px=ox("button.secondaryBackground",{dark:"#3A3D41",light:"#5F6A79",hc:null},$m(0,"Secondary button background color."));ox("button.secondaryHoverBackground",{dark:aD(Px,.2),light:rD(Px,.2),hc:null},$m(0,"Secondary button background color when hovering."));const Fx=ox("badge.background",{dark:"#4D4D4D",light:"#C4C4C4",hc:QS.black},$m(0,"Badge background color. Badges are small information labels, e.g. for search results count.")),Bx=ox("badge.foreground",{dark:QS.white,light:"#333",hc:QS.white},$m(0,"Badge foreground color. Badges are small information labels, e.g. for search results count.")),Vx=ox("scrollbar.shadow",{dark:"#000000",light:"#DDDDDD",hc:null},$m(0,"Scrollbar shadow to indicate that the view is scrolled.")),Wx=ox("scrollbarSlider.background",{dark:QS.fromHex("#797979").transparent(.4),light:QS.fromHex("#646464").transparent(.4),hc:lD(dx,.6)},$m(0,"Scrollbar slider background color.")),Hx=ox("scrollbarSlider.hoverBackground",{dark:QS.fromHex("#646464").transparent(.7),light:QS.fromHex("#646464").transparent(.7),hc:lD(dx,.8)},$m(0,"Scrollbar slider background color when hovering.")),zx=ox("scrollbarSlider.activeBackground",{dark:QS.fromHex("#BFBFBF").transparent(.4),light:QS.fromHex("#000000").transparent(.6),hc:dx},$m(0,"Scrollbar slider background color when clicked on.")),jx=ox("progressBar.background",{dark:QS.fromHex("#0E70C0"),light:QS.fromHex("#0E70C0"),hc:dx},$m(0,"Background color of the progress bar that can show for long running operations.")),Ux=ox("editorError.background",{dark:null,light:null,hc:null},$m(0,"Background color of error text in the editor. The color must not be opaque so as not to hide underlying decorations."),!0),$x=ox("editorError.foreground",{dark:"#F14C4C",light:"#E51400",hc:null},$m(0,"Foreground color of error squigglies in the editor.")),Kx=ox("editorError.border",{dark:null,light:null,hc:QS.fromHex("#E47777").transparent(.8)},$m(0,"Border color of error boxes in the editor.")),qx=ox("editorWarning.background",{dark:null,light:null,hc:null},$m(0,"Background color of warning text in the editor. The color must not be opaque so as not to hide underlying decorations."),!0),Gx=ox("editorWarning.foreground",{dark:"#CCA700",light:"#BF8803",hc:null},$m(0,"Foreground color of warning squigglies in the editor.")),Zx=ox("editorWarning.border",{dark:null,light:null,hc:QS.fromHex("#FFCC00").transparent(.8)},$m(0,"Border color of warning boxes in the editor.")),Yx=ox("editorInfo.background",{dark:null,light:null,hc:null},$m(0,"Background color of info text in the editor. The color must not be opaque so as not to hide underlying decorations."),!0),Xx=ox("editorInfo.foreground",{dark:"#3794FF",light:"#1a85ff",hc:"#3794FF"},$m(0,"Foreground color of info squigglies in the editor.")),Qx=ox("editorInfo.border",{dark:null,light:null,hc:QS.fromHex("#3794FF").transparent(.8)},$m(0,"Border color of info boxes in the editor.")),Jx=ox("editorHint.foreground",{dark:QS.fromHex("#eeeeee").transparent(.7),light:"#6c6c6c",hc:null},$m(0,"Foreground color of hint squigglies in the editor.")),ek=ox("editorHint.border",{dark:null,light:null,hc:QS.fromHex("#eeeeee").transparent(.8)},$m(0,"Border color of hint boxes in the editor."));ox("sash.hoverBorder",{dark:lx,light:lx,hc:lx},$m(0,"Border color of active sashes."));const tk=ox("editor.background",{light:"#fffffe",dark:"#1E1E1E",hc:QS.black},$m(0,"Editor background color.")),ik=ox("editor.foreground",{light:"#333333",dark:"#BBBBBB",hc:QS.white},$m(0,"Editor default foreground color.")),nk=ox("editorWidget.background",{dark:"#252526",light:"#F3F3F3",hc:"#0C141F"},$m(0,"Background color of editor widgets, such as find/replace.")),ok=ox("editorWidget.foreground",{dark:sx,light:sx,hc:sx},$m(0,"Foreground color of editor widgets, such as find/replace.")),sk=ox("editorWidget.border",{dark:"#454545",light:"#C8C8C8",hc:dx},$m(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.")),rk=ox("editorWidget.resizeBorder",{light:null,dark:null,hc:null},$m(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.")),ak=ox("quickInput.background",{dark:nk,light:nk,hc:nk},$m(0,"Quick picker background color. The quick picker widget is the container for pickers like the command palette.")),lk=ox("quickInput.foreground",{dark:ok,light:ok,hc:ok},$m(0,"Quick picker foreground color. The quick picker widget is the container for pickers like the command palette.")),dk=ox("quickInputTitle.background",{dark:new QS(new ZS(255,255,255,.105)),light:new QS(new ZS(0,0,0,.06)),hc:"#000000"},$m(0,"Quick picker title background color. The quick picker widget is the container for pickers like the command palette.")),hk=ox("pickerGroup.foreground",{dark:"#3794FF",light:"#0066BF",hc:QS.white},$m(0,"Quick picker color for grouping labels.")),ck=ox("pickerGroup.border",{dark:"#3F3F46",light:"#CCCEDB",hc:QS.white},$m(0,"Quick picker color for grouping borders.")),uk=ox("keybindingLabel.background",{dark:new QS(new ZS(128,128,128,.17)),light:new QS(new ZS(221,221,221,.4)),hc:QS.transparent},$m(0,"Keybinding label background color. The keybinding label is used to represent a keyboard shortcut.")),gk=ox("keybindingLabel.foreground",{dark:QS.fromHex("#CCCCCC"),light:QS.fromHex("#555555"),hc:QS.white},$m(0,"Keybinding label foreground color. The keybinding label is used to represent a keyboard shortcut.")),pk=ox("keybindingLabel.border",{dark:new QS(new ZS(51,51,51,.6)),light:new QS(new ZS(204,204,204,.4)),hc:new QS(new ZS(111,195,223))},$m(0,"Keybinding label border color. The keybinding label is used to represent a keyboard shortcut.")),mk=ox("keybindingLabel.bottomBorder",{dark:new QS(new ZS(68,68,68,.6)),light:new QS(new ZS(187,187,187,.4)),hc:new QS(new ZS(111,195,223))},$m(0,"Keybinding label border bottom color. The keybinding label is used to represent a keyboard shortcut.")),fk=ox("editor.selectionBackground",{light:"#ADD6FF",dark:"#264F78",hc:"#f3f518"},$m(0,"Color of the editor selection.")),_k=ox("editor.selectionForeground",{light:null,dark:null,hc:"#000000"},$m(0,"Color of the selected text for high contrast.")),vk=ox("editor.inactiveSelectionBackground",{light:lD(fk,.5),dark:lD(fk,.5),hc:lD(fk,.5)},$m(0,"Color of the selection in an inactive editor. The color must not be opaque so as not to hide underlying decorations."),!0),bk=ox("editor.selectionHighlightBackground",{light:hD(fk,tk,.3,.6),dark:hD(fk,tk,.3,.6),hc:null},$m(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),Ck=ox("editor.selectionHighlightBorder",{light:null,dark:null,hc:hx},$m(0,"Border color for regions with the same content as the selection.")),wk=ox("editor.findMatchBackground",{light:"#A8AC94",dark:"#515C6A",hc:null},$m(0,"Color of the current search match.")),yk=ox("editor.findMatchHighlightBackground",{light:"#EA5C0055",dark:"#EA5C0055",hc:null},$m(0,"Color of the other search matches. The color must not be opaque so as not to hide underlying decorations."),!0),Sk=ox("editor.findRangeHighlightBackground",{dark:"#3a3d4166",light:"#b4b4b44d",hc:null},$m(0,"Color of the range limiting the search. The color must not be opaque so as not to hide underlying decorations."),!0),xk=ox("editor.findMatchBorder",{light:null,dark:null,hc:hx},$m(0,"Border color of the current search match.")),kk=ox("editor.findMatchHighlightBorder",{light:null,dark:null,hc:hx},$m(0,"Border color of the other search matches.")),Lk=ox("editor.findRangeHighlightBorder",{dark:null,light:null,hc:lD(hx,.4)},$m(0,"Border color of the range limiting the search. The color must not be opaque so as not to hide underlying decorations."),!0);ox("searchEditor.findMatchBackground",{light:lD(yk,.66),dark:lD(yk,.66),hc:yk},$m(0,"Color of the Search Editor query matches.")),ox("searchEditor.findMatchBorder",{light:lD(kk,.66),dark:lD(kk,.66),hc:kk},$m(0,"Border color of the Search Editor query matches."));const Dk=ox("editor.hoverHighlightBackground",{light:"#ADD6FF26",dark:"#264f7840",hc:"#ADD6FF26"},$m(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),Ek=ox("editorHoverWidget.background",{light:nk,dark:nk,hc:nk},$m(0,"Background color of the editor hover.")),Nk=ox("editorHoverWidget.foreground",{light:ok,dark:ok,hc:ok},$m(0,"Foreground color of the editor hover.")),Ik=ox("editorHoverWidget.border",{light:sk,dark:sk,hc:sk},$m(0,"Border color of the editor hover.")),Tk=ox("editorHoverWidget.statusBarBackground",{dark:aD(Ek,.2),light:rD(Ek,.05),hc:nk},$m(0,"Background color of the editor hover status bar.")),Mk=ox("editorLink.activeForeground",{dark:"#4E94CE",light:QS.blue,hc:QS.cyan},$m(0,"Color of active links.")),Ok=ox("editorInlayHint.foreground",{dark:lD(Bx,.8),light:lD(Bx,.8),hc:Bx},$m(0,"Foreground color of inline hints")),Ak=ox("editorInlayHint.background",{dark:lD(Fx,.6),light:lD(Fx,.3),hc:Fx},$m(0,"Background color of inline hints")),Rk=ox("editorInlayHint.typeForeground",{dark:Ok,light:Ok,hc:Ok},$m(0,"Foreground color of inline hints for types")),Pk=ox("editorInlayHint.typeBackground",{dark:Ak,light:Ak,hc:Ak},$m(0,"Background color of inline hints for types")),Fk=ox("editorInlayHint.parameterForeground",{dark:Ok,light:Ok,hc:Ok},$m(0,"Foreground color of inline hints for parameters")),Bk=ox("editorInlayHint.parameterBackground",{dark:Ak,light:Ak,hc:Ak},$m(0,"Background color of inline hints for parameters")),Vk=ox("editorLightBulb.foreground",{dark:"#FFCC00",light:"#DDB100",hc:"#FFCC00"},$m(0,"The color used for the lightbulb actions icon.")),Wk=ox("editorLightBulbAutoFix.foreground",{dark:"#75BEFF",light:"#007ACC",hc:"#75BEFF"},$m(0,"The color used for the lightbulb auto fix actions icon.")),Hk=new QS(new ZS(155,185,85,.2)),zk=new QS(new ZS(255,0,0,.2)),jk=ox("diffEditor.insertedTextBackground",{dark:Hk,light:Hk,hc:null},$m(0,"Background color for text that got inserted. The color must not be opaque so as not to hide underlying decorations."),!0),Uk=ox("diffEditor.removedTextBackground",{dark:zk,light:zk,hc:null},$m(0,"Background color for text that got removed. The color must not be opaque so as not to hide underlying decorations."),!0),$k=ox("diffEditor.insertedLineBackground",{dark:null,light:null,hc:null},$m(0,"Background color for lines that got inserted. The color must not be opaque so as not to hide underlying decorations."),!0),Kk=ox("diffEditor.removedLineBackground",{dark:null,light:null,hc:null},$m(0,"Background color for lines that got removed. The color must not be opaque so as not to hide underlying decorations."),!0),qk=ox("diffEditorGutter.insertedLineBackground",{dark:null,light:null,hc:null},$m(0,"Background color for the margin where lines got inserted.")),Gk=ox("diffEditorGutter.removedLineBackground",{dark:null,light:null,hc:null},$m(0,"Background color for the margin where lines got removed.")),Zk=ox("diffEditorOverview.insertedForeground",{dark:null,light:null,hc:null},$m(0,"Diff overview ruler foreground for inserted content.")),Yk=ox("diffEditorOverview.removedForeground",{dark:null,light:null,hc:null},$m(0,"Diff overview ruler foreground for removed content.")),Xk=ox("diffEditor.insertedTextBorder",{dark:null,light:null,hc:"#33ff2eff"},$m(0,"Outline color for the text that got inserted.")),Qk=ox("diffEditor.removedTextBorder",{dark:null,light:null,hc:"#FF008F"},$m(0,"Outline color for text that got removed.")),Jk=ox("diffEditor.border",{dark:null,light:null,hc:dx},$m(0,"Border color between the two text editors.")),eL=ox("diffEditor.diagonalFill",{dark:"#cccccc33",light:"#22222233",hc:null},$m(0,"Color of the diff editor's diagonal fill. The diagonal fill is used in side-by-side diff views.")),tL=ox("list.focusBackground",{dark:null,light:null,hc:null},$m(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.")),iL=ox("list.focusForeground",{dark:null,light:null,hc:null},$m(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.")),nL=ox("list.focusOutline",{dark:lx,light:lx,hc:hx},$m(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.")),oL=ox("list.activeSelectionBackground",{dark:"#094771",light:"#0060C0",hc:null},$m(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.")),sL=ox("list.activeSelectionForeground",{dark:QS.white,light:QS.white,hc:null},$m(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.")),rL=ox("list.activeSelectionIconForeground",{dark:null,light:null,hc:null},$m(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.")),aL=ox("list.inactiveSelectionBackground",{dark:"#37373D",light:"#E4E6F1",hc:null},$m(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.")),lL=ox("list.inactiveSelectionForeground",{dark:null,light:null,hc:null},$m(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.")),dL=ox("list.inactiveSelectionIconForeground",{dark:null,light:null,hc:null},$m(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.")),hL=ox("list.inactiveFocusBackground",{dark:null,light:null,hc:null},$m(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.")),cL=ox("list.inactiveFocusOutline",{dark:null,light:null,hc:null},$m(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.")),uL=ox("list.hoverBackground",{dark:"#2A2D2E",light:"#F0F0F0",hc:null},$m(0,"List/Tree background when hovering over items using the mouse.")),gL=ox("list.hoverForeground",{dark:null,light:null,hc:null},$m(0,"List/Tree foreground when hovering over items using the mouse.")),pL=ox("list.dropBackground",{dark:"#062F4A",light:"#D6EBFF",hc:null},$m(0,"List/Tree drag and drop background when moving items around using the mouse.")),mL=ox("list.highlightForeground",{dark:"#18A3FF",light:"#0066BF",hc:lx},$m(0,"List/Tree foreground color of the match highlights when searching inside the list/tree.")),fL=ox("list.focusHighlightForeground",{dark:mL,light:(_L=oL,vL=mL,bL="#9DDDFF",{op:5,if:_L,then:vL,else:bL}),hc:mL},$m(0,"List/Tree foreground color of the match highlights on actively focused items when searching inside the list/tree."));var _L,vL,bL;ox("list.invalidItemForeground",{dark:"#B89500",light:"#B89500",hc:"#B89500"},$m(0,"List/Tree foreground color for invalid items, for example an unresolved root in explorer.")),ox("list.errorForeground",{dark:"#F88070",light:"#B01011",hc:null},$m(0,"Foreground color of list items containing errors.")),ox("list.warningForeground",{dark:"#CCA700",light:"#855F00",hc:null},$m(0,"Foreground color of list items containing warnings."));const CL=ox("listFilterWidget.background",{light:"#efc1ad",dark:"#653723",hc:QS.black},$m(0,"Background color of the type filter widget in lists and trees.")),wL=ox("listFilterWidget.outline",{dark:QS.transparent,light:QS.transparent,hc:"#f38518"},$m(0,"Outline color of the type filter widget in lists and trees.")),yL=ox("listFilterWidget.noMatchesOutline",{dark:"#BE1100",light:"#BE1100",hc:dx},$m(0,"Outline color of the type filter widget in lists and trees, when there are no matches."));ox("list.filterMatchBackground",{dark:yk,light:yk,hc:null},$m(0,"Background color of the filtered match.")),ox("list.filterMatchBorder",{dark:kk,light:kk,hc:dx},$m(0,"Border color of the filtered match."));const SL=ox("tree.indentGuidesStroke",{dark:"#585858",light:"#a9a9a9",hc:"#a9a9a9"},$m(0,"Tree stroke color for the indentation guides.")),xL=ox("tree.tableColumnsBorder",{dark:"#CCCCCC20",light:"#61616120",hc:null},$m(0,"Table border color between columns.")),kL=ox("tree.tableOddRowsBackground",{dark:lD(sx,.04),light:lD(sx,.04),hc:null},$m(0,"Background color for odd table rows."));ox("list.deemphasizedForeground",{dark:"#8C8C8C",light:"#8E8E90",hc:"#A7A8A9"},$m(0,"List/Tree foreground color for items that are deemphasized. "));const LL=ox("quickInput.list.focusBackground",{dark:null,light:null,hc:null},"",void 0,$m(0,"Please use quickInputList.focusBackground instead")),DL=ox("quickInputList.focusForeground",{dark:sL,light:sL,hc:sL},$m(0,"Quick picker foreground color for the focused item.")),EL=ox("quickInputList.focusIconForeground",{dark:rL,light:rL,hc:rL},$m(0,"Quick picker icon foreground color for the focused item.")),NL=ox("quickInputList.focusBackground",{dark:dD(LL,oL),light:dD(LL,oL),hc:null},$m(0,"Quick picker background color for the focused item.")),IL=ox("menu.border",{dark:null,light:null,hc:dx},$m(0,"Border color of menus.")),TL=ox("menu.foreground",{dark:Tx,light:sx,hc:Tx},$m(0,"Foreground color of menu items.")),ML=ox("menu.background",{dark:Ix,light:Ix,hc:Ix},$m(0,"Background color of menu items.")),OL=ox("menu.selectionForeground",{dark:sL,light:sL,hc:sL},$m(0,"Foreground color of the selected menu item in menus.")),AL=ox("menu.selectionBackground",{dark:oL,light:oL,hc:oL},$m(0,"Background color of the selected menu item in menus.")),RL=ox("menu.selectionBorder",{dark:null,light:null,hc:hx},$m(0,"Border color of the selected menu item in menus.")),PL=ox("menu.separatorBackground",{dark:"#BBBBBB",light:"#888888",hc:dx},$m(0,"Color of a separator menu item in menus.")),FL=ox("toolbar.hoverBackground",{dark:"#5a5d5e50",light:"#b8b8b850",hc:null},$m(0,"Toolbar background when hovering over actions using the mouse"));ox("toolbar.hoverOutline",{dark:null,light:null,hc:hx},$m(0,"Toolbar outline when hovering over actions using the mouse")),ox("toolbar.activeBackground",{dark:aD(FL,.1),light:rD(FL,.1),hc:null},$m(0,"Toolbar background when holding the mouse over actions")),ox("editor.snippetTabstopHighlightBackground",{dark:new QS(new ZS(124,124,124,.3)),light:new QS(new ZS(10,50,100,.2)),hc:new QS(new ZS(124,124,124,.3))},$m(0,"Highlight background color of a snippet tabstop.")),ox("editor.snippetTabstopHighlightBorder",{dark:null,light:null,hc:null},$m(0,"Highlight border color of a snippet tabstop.")),ox("editor.snippetFinalTabstopHighlightBackground",{dark:null,light:null,hc:null},$m(0,"Highlight background color of the final tabstop of a snippet.")),ox("editor.snippetFinalTabstopHighlightBorder",{dark:"#525252",light:new QS(new ZS(10,50,100,.5)),hc:"#525252"},$m(0,"Highlight border color of the final tabstop of a snippet.")),ox("breadcrumb.foreground",{light:lD(sx,.8),dark:lD(sx,.8),hc:lD(sx,.8)},$m(0,"Color of focused breadcrumb items.")),ox("breadcrumb.background",{light:tk,dark:tk,hc:tk},$m(0,"Background color of breadcrumb items.")),ox("breadcrumb.focusForeground",{light:rD(sx,.2),dark:aD(sx,.1),hc:aD(sx,.1)},$m(0,"Color of focused breadcrumb items.")),ox("breadcrumb.activeSelectionForeground",{light:rD(sx,.2),dark:aD(sx,.1),hc:aD(sx,.1)},$m(0,"Color of selected breadcrumb items.")),ox("breadcrumbPicker.background",{light:nk,dark:nk,hc:nk},$m(0,"Background color of breadcrumb item picker."));const BL=QS.fromHex("#40C8AE").transparent(.5),VL=QS.fromHex("#40A6FF").transparent(.5),WL=QS.fromHex("#606060").transparent(.4),HL=ox("merge.currentHeaderBackground",{dark:BL,light:BL,hc:null},$m(0,"Current header background in inline merge-conflicts. The color must not be opaque so as not to hide underlying decorations."),!0);ox("merge.currentContentBackground",{dark:lD(HL,.4),light:lD(HL,.4),hc:lD(HL,.4)},$m(0,"Current content background in inline merge-conflicts. The color must not be opaque so as not to hide underlying decorations."),!0);const zL=ox("merge.incomingHeaderBackground",{dark:VL,light:VL,hc:null},$m(0,"Incoming header background in inline merge-conflicts. The color must not be opaque so as not to hide underlying decorations."),!0);ox("merge.incomingContentBackground",{dark:lD(zL,.4),light:lD(zL,.4),hc:lD(zL,.4)},$m(0,"Incoming content background in inline merge-conflicts. The color must not be opaque so as not to hide underlying decorations."),!0);const jL=ox("merge.commonHeaderBackground",{dark:WL,light:WL,hc:null},$m(0,"Common ancestor header background in inline merge-conflicts. The color must not be opaque so as not to hide underlying decorations."),!0);ox("merge.commonContentBackground",{dark:lD(jL,.4),light:lD(jL,.4),hc:lD(jL,.4)},$m(0,"Common ancestor content background in inline merge-conflicts. The color must not be opaque so as not to hide underlying decorations."),!0);const UL=ox("merge.border",{dark:null,light:null,hc:"#C3DF6F"},$m(0,"Border color on headers and the splitter in inline merge-conflicts."));ox("editorOverviewRuler.currentContentForeground",{dark:lD(HL,1),light:lD(HL,1),hc:UL},$m(0,"Current overview ruler foreground for inline merge-conflicts.")),ox("editorOverviewRuler.incomingContentForeground",{dark:lD(zL,1),light:lD(zL,1),hc:UL},$m(0,"Incoming overview ruler foreground for inline merge-conflicts.")),ox("editorOverviewRuler.commonContentForeground",{dark:lD(jL,1),light:lD(jL,1),hc:UL},$m(0,"Common ancestor overview ruler foreground for inline merge-conflicts."));const $L=ox("editorOverviewRuler.findMatchForeground",{dark:"#d186167e",light:"#d186167e",hc:"#AB5A00"},$m(0,"Overview ruler marker color for find matches. The color must not be opaque so as not to hide underlying decorations."),!0),KL=ox("editorOverviewRuler.selectionHighlightForeground",{dark:"#A0A0A0CC",light:"#A0A0A0CC",hc:"#A0A0A0CC"},$m(0,"Overview ruler marker color for selection highlights. The color must not be opaque so as not to hide underlying decorations."),!0),qL=ox("minimap.findMatchHighlight",{light:"#d18616",dark:"#d18616",hc:"#AB5A00"},$m(0,"Minimap marker color for find matches."),!0),GL=ox("minimap.selectionOccurrenceHighlight",{light:"#c9c9c9",dark:"#676767",hc:"#ffffff"},$m(0,"Minimap marker color for repeating editor selections."),!0),ZL=ox("minimap.selectionHighlight",{light:"#ADD6FF",dark:"#264F78",hc:"#ffffff"},$m(0,"Minimap marker color for the editor selection."),!0),YL=ox("minimap.errorHighlight",{dark:new QS(new ZS(255,18,18,.7)),light:new QS(new ZS(255,18,18,.7)),hc:new QS(new ZS(255,50,50,1))},$m(0,"Minimap marker color for errors.")),XL=ox("minimap.warningHighlight",{dark:Gx,light:Gx,hc:Zx},$m(0,"Minimap marker color for warnings.")),QL=ox("minimap.background",{dark:null,light:null,hc:null},$m(0,"Minimap background color.")),JL=ox("minimap.foregroundOpacity",{dark:QS.fromHex("#000f"),light:QS.fromHex("#000f"),hc:QS.fromHex("#000f")},$m(0,'Opacity of foreground elements rendered in the minimap. For example, "#000000c0" will render the elements with 75% opacity.')),eD=ox("minimapSlider.background",{light:lD(Wx,.5),dark:lD(Wx,.5),hc:lD(Wx,.5)},$m(0,"Minimap slider background color.")),tD=ox("minimapSlider.hoverBackground",{light:lD(Hx,.5),dark:lD(Hx,.5),hc:lD(Hx,.5)},$m(0,"Minimap slider background color when hovering.")),iD=ox("minimapSlider.activeBackground",{light:lD(zx,.5),dark:lD(zx,.5),hc:lD(zx,.5)},$m(0,"Minimap slider background color when clicked on.")),nD=ox("problemsErrorIcon.foreground",{dark:$x,light:$x,hc:$x},$m(0,"The color used for the problems error icon.")),oD=ox("problemsWarningIcon.foreground",{dark:Gx,light:Gx,hc:Gx},$m(0,"The color used for the problems warning icon.")),sD=ox("problemsInfoIcon.foreground",{dark:Xx,light:Xx,hc:Xx},$m(0,"The color used for the problems info icon."));function rD(e,t){return{op:0,value:e,factor:t}}function aD(e,t){return{op:1,value:e,factor:t}}function lD(e,t){return{op:2,value:e,factor:t}}function dD(...e){return{op:3,values:e}}function hD(e,t,i,n){return{op:4,value:e,background:t,factor:i,transparency:n}}function cD(e,t){if(null!==e)return"string"==typeof e?"#"===e[0]?QS.fromHex(e):t.getColor(e):e instanceof QS?e:"object"==typeof e?function(e,t){var i,n,o;switch(e.op){case 0:return null===(i=cD(e.value,t))||void 0===i?void 0:i.darken(e.factor);case 1:return null===(n=cD(e.value,t))||void 0===n?void 0:n.lighten(e.factor);case 2:return null===(o=cD(e.value,t))||void 0===o?void 0:o.transparent(e.factor);case 3:for(const i of e.values){const e=cD(i,t);if(e)return e}return;case 5:return cD(t.defines(e.if)?e.then:e.else,t);case 4:{const i=cD(e.value,t);if(!i)return;const n=cD(e.background,t);return n?i.isDarkerThan(n)?QS.getLighterColor(i,n,e.factor).transparent(e.transparency):QS.getDarkerColor(i,n,e.factor).transparent(e.transparency):i.transparent(e.factor*e.transparency)}default:throw nr()}}(e,t):void 0}ox("charts.foreground",{dark:sx,light:sx,hc:sx},$m(0,"The foreground color used in charts.")),ox("charts.lines",{dark:lD(sx,.5),light:lD(sx,.5),hc:lD(sx,.5)},$m(0,"The color used for horizontal lines in charts.")),ox("charts.red",{dark:$x,light:$x,hc:$x},$m(0,"The red color used in chart visualizations.")),ox("charts.blue",{dark:Xx,light:Xx,hc:Xx},$m(0,"The blue color used in chart visualizations.")),ox("charts.yellow",{dark:Gx,light:Gx,hc:Gx},$m(0,"The yellow color used in chart visualizations.")),ox("charts.orange",{dark:qL,light:qL,hc:qL},$m(0,"The orange color used in chart visualizations.")),ox("charts.green",{dark:"#89D185",light:"#388A34",hc:"#89D185"},$m(0,"The green color used in chart visualizations.")),ox("charts.purple",{dark:"#B180D7",light:"#652D90",hc:"#B180D7"},$m(0,"The purple color used in chart visualizations."));let uD=My.as(JS);uD.registerSchema("vscode://schemas/workbench-colors",nx.getColorSchema());const gD=new Hv((()=>uD.notifySchemaChanged("vscode://schemas/workbench-colors")),200);nx.onDidChangeSchema((()=>{gD.isScheduled()||gD.schedule()}));class pD{constructor(e,t){this.x=e,this.y=t,this._pageCoordinatesBrand=void 0}toClientCoordinates(){return new mD(this.x-ow.scrollX,this.y-ow.scrollY)}}class mD{constructor(e,t){this.clientX=e,this.clientY=t,this._clientCoordinatesBrand=void 0}toPageCoordinates(){return new pD(this.clientX+ow.scrollX,this.clientY+ow.scrollY)}}class fD{constructor(e,t,i,n){this.x=e,this.y=t,this.width=i,this.height=n,this._editorPagePositionBrand=void 0}}class _D{constructor(e,t){this.x=e,this.y=t,this._positionRelativeToEditorBrand=void 0}}function vD(e){const t=nw(e);return new fD(t.left,t.top,t.width,t.height)}function bD(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 _D(s,r)}class CD extends EC{constructor(e,t){super(e),this._editorMouseEventBrand=void 0,this.pos=new pD(this.posx,this.posy),this.editorPos=vD(t),this.relativePos=bD(t,this.editorPos,this.pos)}}class wD{constructor(e){this._editorViewDomNode=e}_create(e){return new CD(e,this._editorViewDomNode)}onContextMenu(e,t){return BC(e,"contextmenu",(e=>{t(this._create(e))}))}onMouseUp(e,t){return BC(e,"mouseup",(e=>{t(this._create(e))}))}onMouseDown(e,t){return BC(e,"mousedown",(e=>{t(this._create(e))}))}onMouseLeave(e,t){return jC(e,(e=>{t(this._create(e))}))}onMouseMoveThrottled(e,t,i,n){return XC(e,"mousemove",t,((e,t)=>i(e,this._create(t))),n)}}class yD{constructor(e){this._editorViewDomNode=e}_create(e){return new CD(e,this._editorViewDomNode)}onPointerUp(e,t){return BC(e,"pointerup",(e=>{t(this._create(e))}))}onPointerDown(e,t){return BC(e,"pointerdown",(e=>{t(this._create(e))}))}onPointerLeave(e,t){return n=e=>{t(this._create(e))},BC(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 XC(e,"pointermove",t,((e,t)=>i(e,this._create(t))),n)}}class SD extends Uo{constructor(e){super(),this._editorViewDomNode=e,this._globalMouseMoveMonitor=this._register(new qS),this._keydownListener=null}startMonitoring(e,t,i,n,o){this._keydownListener=WC(document,"keydown",(e=>{e.toKeybinding().isModifierKey()||this._globalMouseMoveMonitor.stopMonitoring(!0,e.browserEvent)}),!0);this._globalMouseMoveMonitor.startMonitoring(e,t,((e,t)=>i(e,new CD(t,this._editorViewDomNode))),n,(e=>{this._keydownListener.dispose(),o(e)}))}stopMonitoring(){this._globalMouseMoveMonitor.stopMonitoring(!0)}}class xD{constructor(e){this._editor=e,this._instanceId=++xD._idPool,this._counter=0,this._rules=new Map,this._garbageCollectionScheduler=new Hv((()=>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 kD(t,`dyn-rule-${this._instanceId}-${n}`,gw(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())}}xD._idPool=0;class kD{constructor(e,t,i,n){this.key=e,this.className=t,this.properties=n,this._referenceCount=0,this._styleElement=fw(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(${tx(e.id)})`:e;i+=`\n\t${LD(n)}: ${o};`}return i+="\n}",i}dispose(){this._styleElement.remove()}increaseRefCount(){this._referenceCount++}decreaseRefCount(){this._referenceCount--}hasReferences(){return this._referenceCount>0}}function LD(e){return e.replace(/(^[A-Z])/,(([e])=>e.toLowerCase())).replace(/([A-Z])/g,(([e])=>`-${e.toLowerCase()}`))}class DD 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 ED extends DD{constructor(e){super(),this._context=e,this._context.addEventHandler(this)}dispose(){this._context.removeEventHandler(this),super.dispose()}}class ND{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 ID 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 TD{constructor(e,t,i){this.outsideRenderedLine=e,this.lineNumber=t,this.ranges=i}}class MD{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 MD(n.left,n.width)}return t}toString(){return`[${this.left},${this.width}]`}}class OD{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 AD{constructor(e,t){this.outsideRenderedLine=e,this.originalLeft=t,this.left=Math.round(this.originalLeft)}}class RD{constructor(e,t){this.outsideRenderedLine=e,this.ranges=t}}class PD{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(OD.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 OD(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,h=e.children[n].firstChild;if(d&&h||(!d&&0===i&&t>0&&(d=e.children[t-1].firstChild,i=1073741824),!h&&0===o&&n>0&&(h=e.children[n-1].firstChild,o=1073741824)),!d||!h)return null;i=Math.min(d.textContent.length,Math.max(0,i)),o=Math.min(h.textContent.length,Math.max(0,o));const c=this._readClientRects(d,i,h,o,a);return this._createHorizontalRangesFromClientRects(c,s,r)}}const FD=!!Ts||!(Vo||Rf||Bf);let BD=!0;class VD{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 WD{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 HD{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=$f(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===Oy.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=Sb.filter(o.inlineDecorations,e,o.minColumn,o.maxColumn);let a=null;if(s.themeType===Oy.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===Oy.HIGH_CONTRAST||"selection"!==this._options.renderWhitespace?r.push(new Sb(t,n,"inline-selected-text",0)):(a||(a=[]),a.push(new Db(t-1,n-1))))}}const l=new Eb(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!==uf.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(HD.CLASS_NAME),n.appendASCIIString('">');const d=Mb(l,n);n.appendASCIIString("</div>");let h=null;return BD&&FD&&o.isBasicASCII&&s.useMonospaceOptimizations&&0===d.containsForeignElements&&o.content.length<300&&l.lineTokens.getCount()<100&&(h=new zD(this._renderedViewLine?this._renderedViewLine.domNode:null,l,d.characterMapping)),h||(h=$D(this._renderedViewLine?this._renderedViewLine.domNode:null,l,d.characterMapping,d.containsRTL,d.containsForeignElements)),this._renderedViewLine=h,!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 zD}monospaceAssumptionsAreValid(){return this._renderedViewLine&&this._renderedViewLine instanceof zD?this._renderedViewLine.monospaceAssumptionsAreValid():BD}onMonospaceAssumptionsInvalidated(){this._renderedViewLine&&this._renderedViewLine instanceof zD&&(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 RD(s,r):null}getColumnOfNodeOffset(e,t,i){return this._renderedViewLine?this._renderedViewLine.getColumnOfNodeOffset(e,t,i):1}}HD.CLASS_NAME="view-line";class zD{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 BD;const e=this.getWidth(),t=this.domNode.domNode.firstChild.offsetWidth;return Math.abs(e-t)>=2&&(BD=!1),BD}toSlowRenderedLine(){return $D(this.domNode,this.input,this._characterMapping,!1,0)}getVisibleRangesForRange(e,t,i,n){const o=this._getCharPosition(t),s=this._getCharPosition(i);return[new OD(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 Nb(o,i),n)}}class jD{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 OD(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 OD(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=PD.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=PD.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 OD(0,this.getWidth())];const o=this._characterMapping.getDomPosition(t),s=this._characterMapping.getDomPosition(i);return PD.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 Nb(o,i),n)}}class UD extends jD{_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 $D=Pf?KD:qD;function KD(e,t,i,n,o){return new UD(e,t,i,n,o)}function qD(e,t,i,n,o){return new jD(e,t,i,n,o)}class GD{static _nextVisibleColumn(e,t,i){return 9===e?GD.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 ZD{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=GD.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]=ZD.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=GD.nextRenderTabStop(t,i);break;default:return-1}}return t===r+i?s:-1}const d=GD.nextRenderTabStop(a,i);let h=a;for(let c=t;c<o;c++){if(h===d)return c;switch(e.charCodeAt(c)){case 32:h+=1;break;case 9:h=GD.nextRenderTabStop(h,i);break;default:return-1}}return h===d?o:-1}}class YD{constructor(e=null){this.hitTarget=e,this.type=0}}class XD{constructor(e,t,i){this.position=e,this.spanNode=t,this.injectedText=i,this.type=1}}var QD;(QD||(QD={})).createFromDOMInfo=function(e,t,i){const n=e.getPositionFromDOMInfo(t,i);return n?new XD(n,t,null):new YD(t)};class JD{constructor(e,t){this.lastViewCursorsRenderData=e,this.lastTextareaPosition=t}}class eE{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 tE{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 iE{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 iE.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 iE._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 nE 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,rE._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=ND.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)?GD.visibleColumnFromColumn(this._ctx.viewModel.getLineContent(e.lineNumber),e.column,this._ctx.viewModel.model.getOptions().tabSize)+1:this.mouseColumn}fulfillUnknown(e=null){return eE.createUnknown(this.target,this._getMouseColumn(e),e)}fulfillTextarea(){return eE.createTextarea(this.target,this._getMouseColumn())}fulfillMargin(e,t,i,n){return eE.createMargin(e,this.target,this._getMouseColumn(t),t,i,n)}fulfillViewZone(e,t,i){return eE.createViewZone(e,this.target,this._getMouseColumn(t),t,i)}fulfillContentText(e,t,i){return eE.createContentText(this.target,this._getMouseColumn(e),e,t,i)}fulfillContentEmpty(e,t){return eE.createContentEmpty(this.target,this._getMouseColumn(e),e,t)}fulfillContentWidget(e){return eE.createContentWidget(this.target,this._getMouseColumn(),e)}fulfillScrollbar(e){return eE.createScrollbar(this.target,this._getMouseColumn(e),e)}fulfillOverlayWidget(e){return eE.createOverlayWidget(this.target,this._getMouseColumn(),e)}withTarget(e){return new nE(this._ctx,this.editorPos,this.pos,this.relativePos,e)}}const oE={isAfterLines:!0};function sE(e){return{isAfterLines:!1,horizontalDistanceToText:e}}class rE{constructor(e,t){this._context=e,this._viewHelper=t}mouseTargetIsWidget(e){const t=e.target,i=ND.collect(t,this._viewHelper.viewDomNode);return!(!tE.isChildOfContentWidgets(i)&&!tE.isChildOfOverflowingContentWidgets(i))||!!tE.isChildOfOverlayWidgets(i)}createMouseTarget(e,t,i,n,o){const s=new iE(this._context,this._viewHelper,e),r=new nE(s,t,i,n,o);try{return rE._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=rE._doHitTest(e,t);return 1===n.type?rE.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||rE._hitTestContentWidget(e,n),o=o||rE._hitTestOverlayWidget(e,n),o=o||rE._hitTestMinimap(e,n),o=o||rE._hitTestScrollbarSlider(e,n),o=o||rE._hitTestViewZone(e,n),o=o||rE._hitTestMargin(e,n),o=o||rE._hitTestViewCursor(e,n),o=o||rE._hitTestTextArea(e,n),o=o||rE._hitTestViewLines(e,n,i),o=o||rE._hitTestScrollbar(e,n),o||t.fulfillUnknown()}static _hitTestContentWidget(e,t){if(tE.isChildOfContentWidgets(t.targetPath)||tE.isChildOfOverflowingContentWidgets(t.targetPath)){const i=e.findAttribute(t.target,"widgetId");return i?t.fulfillContentWidget(i):t.fulfillUnknown()}return null}static _hitTestOverlayWidget(e,t){if(tE.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 tE.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(!tE.isChildOfViewLines(t.targetPath))return null;if(e.isInTopPadding(t.mouseVerticalOffset))return t.fulfillContentEmpty(new er(1,1),oE);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),oE)}if(i){if(tE.isStrictChildOfViewLines(t.targetPath)){const i=e.getLineNumberAtVerticalOffset(t.mouseVerticalOffset);if(0===e.viewModel.getLineLength(i)){const n=e.getLineWidth(i),o=sE(t.mouseContentHorizontalOffset-n);return t.fulfillContentEmpty(new er(i,1),o)}const n=e.getLineWidth(i);if(t.mouseContentHorizontalOffset>=n){const o=sE(t.mouseContentHorizontalOffset-n),s=new er(i,e.viewModel.getLineMaxColumn(i));return t.fulfillContentEmpty(s,o)}}return t.fulfillUnknown()}const n=rE._doHitTest(e,t);return 1===n.type?rE.createMouseTargetFromHitTestPosition(e,t,n.spanNode,n.position,n.injectedText):this._createMouseTarget(e,t.withTarget(n.hitTarget),!0)}static _hitTestMinimap(e,t){if(tE.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(tE.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(tE.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 rE._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=sE(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 h=[];if(h.push({offset:l.left,column:r}),r>1){const t=e.visibleRangeForPosition(s,r-1);t&&h.push({offset:t.left,column:r-1})}if(r<e.viewModel.getLineMaxColumn(s)){const t=e.visibleRangeForPosition(s,r+1);t&&h.push({offset:t.left,column:r+1})}h.sort(((e,t)=>e.offset-t.offset));const c=t.pos.toClientCoordinates(),u=i.getBoundingClientRect(),g=u.left<=c.clientX&&c.clientX<=u.right;for(let p=1;p<h.length;p++){const e=h[p-1],i=h[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 pD(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=pw(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=aE.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 YD;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)===HD.CLASS_NAME?QD.createFromDOMInfo(e,t,n.startOffset):new YD(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)===HD.CLASS_NAME?QD.createFromDOMInfo(e,o,o.textContent.length):new YD(o)}return new YD}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)===HD.CLASS_NAME?QD.createFromDOMInfo(e,i.offsetNode.parentNode,i.offset):new YD(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===HD.CLASS_NAME){const t=i.offsetNode.childNodes[Math.min(i.offset,i.offsetNode.childNodes.length-1)];if(t)return QD.createFromDOMInfo(e,t,0)}else if(s===HD.CLASS_NAME)return QD.createFromDOMInfo(e,i.offsetNode,0)}return new YD(i.offsetNode)}static _snapToSoftTabBoundary(e,t){const i=t.getLineContent(e.lineNumber),{tabSize:n}=t.model.getOptions(),o=ZD.atomicPosition(i,e.column-1,n,2);return-1!==o?new er(e.lineNumber,o+1):e}static _doHitTest(e,t){let i=new YD;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 XD(n,i.spanNode,t))}return 1===i.type&&e.stickyTabStops&&(i=new XD(this._snapToSoftTabBoundary(i.position,e.viewModel),i.spanNode,i.injectedText)),i}}class aE{constructor(){this._cache={},this._canvas=document.createElement("canvas")}static getInstance(){return aE._INSTANCE||(aE._INSTANCE=new aE),aE._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 lE(e){return function(t,i){let n=!1;return e&&(n=e.mouseTargetIsWidget(i)),n||i.preventDefault(),i}}aE._INSTANCE=null;class dE extends DD{constructor(e,t,i){super(),this._context=e,this.viewController=t,this.viewHelper=i,this.mouseTargetFactory=new rE(this._context,i),this._mouseDownOperation=this._register(new hE(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 wD(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)),lE(this.mouseTargetFactory),dE.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(BC(this.viewHelper.viewDomNode,yw.MOUSE_WHEEL,(e=>{if(this.viewController.emitMouseWheel(e),!this._context.configuration.options.get(68))return;const t=new NC(e);if(Ho?(e.metaKey||e.ctrlKey)&&!e.shiftKey&&!e.altKey:e.ctrlKey&&!e.metaKey&&!e.shiftKey&&!e.altKey){const e=Zf.getZoomLevel(),i=t.deltaY>0?1:-1;Zf.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 mD(e,t).toPageCoordinates(),n=vD(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=bD(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=pw(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;Ho&&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})}}dE.MOUSE_MOVE_MINIMUM_TIME=100;class hE 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 SD(this._viewHelper.viewDomNode)),this._onScrollTimeout=this._register(new Vv),this._mouseState=new cE,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,lE(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,lE(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=iE.getZoneAtCoord(this._context,i);if(s){const e=this._helpPositionJumpOverViewZone(s);if(e)return eE.createOutsideEditor(o,e)}const r=n.getLineNumberAtVerticalOffset(i);return eE.createOutsideEditor(o,new er(r,1))}if(e.posy>t.y+t.height){const t=n.getCurrentScrollTop()+e.relativePos.y,s=iE.getZoneAtCoord(this._context,t);if(s){const e=this._helpPositionJumpOverViewZone(s);if(e)return eE.createOutsideEditor(o,e)}const r=n.getLineNumberAtVerticalOffset(t);return eE.createOutsideEditor(o,new er(r,i.getLineMaxColumn(r)))}const s=n.getLineNumberAtVerticalOffset(n.getCurrentScrollTop()+e.relativePos.y);return e.posx<t.x?eE.createOutsideEditor(o,new er(s,1)):e.posx>t.x+t.width?eE.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 eE.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 cE{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>cE.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 uE,gE,pE;cE.CLEAR_MOUSE_DOWN_COUNT_TIME=400,(gE=uE||(uE={})).text="text/plain",gE.binary="application/octet-stream",gE.unknown="application/unknown",gE.markdown="text/markdown",gE.latex="text/latex",gE.uriList="text/uri-list";class mE{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 mE(e.getValue(),e.getSelectionStart(),e.getSelectionEnd(),null,null)}collapseSelection(){return new mE(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}}}mE.EMPTY=new mE("",0,0,null,null);class fE{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=fE._getPageOfLine(i.startLineNumber,n),r=fE._getRangeForPage(s,n),a=fE._getPageOfLine(i.endLineNumber,n),l=fE._getRangeForPage(a,n),d=r.intersectRanges(new qo(1,1,i.startLineNumber,i.startColumn));let h=t.getValueInRange(d,1);const c=t.getLineCount(),u=t.getLineMaxColumn(c),g=l.intersectRanges(new qo(i.endLineNumber,i.endColumn,c,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;h.length>e&&(h=h.substring(h.length-e,h.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 mE(h+p+m,h.length,h.length+p.length,new er(i.startLineNumber,i.startColumn),new er(i.endLineNumber,i.endColumn))}}(pE||(pE={})).Tap="-monaco-textarea-synthetic-tap";const _E={forceCopyWithSyntaxHighlighting:!1};class vE{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)}}vE.INSTANCE=new vE;class bE{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 CE 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 Hv((()=>this._onCut.fire()),0)),this._asyncFocusGainWriteScreenReaderContent=this._register(new Hv((()=>this.writeScreenReaderContent("asyncFocusGain")),0)),this._textAreaState=mE.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 SC(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 SC(e);this._onKeyUp.fire(t)}))),this._register(this._textArea.onCompositionStart((e=>{const t=new bE;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=mE.readFromTextArea(this._textArea),i=mE.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=mE.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=mE.readFromTextArea(this._textArea),t=mE.deduceAndroidCompositionInput(this._textAreaState,e);return this._textAreaState=e,this._onType.fire(t),void this._onCompositionEnd.fire()}const i=t.handleCompositionUpdate(e.data);this._textAreaState=mE.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=mE.readFromTextArea(this._textArea),i=mE.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]=wE.getTextData(e.clipboardData);t&&(i=i||vE.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 BC(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]),h=this._textAreaState.deduceEditorPosition(a),c=this._host.deduceModelPosition(h[0],h[1],h[2]),u=new ar(d.lineNumber,d.column,c.lineNumber,c.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};vE.INSTANCE.set(this._browser.isFirefox?t.text.replace(/\r\n/g,"\n"):t.text,i),e.preventDefault(),e.clipboardData&&wE.setTextData(e.clipboardData,t.text,t.html,i)}}class wE{static getTextData(e){const t=e.getData(uE.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(uE.text,t),"string"==typeof i&&e.setData("text/html",i),e.setData("vscode-editor-data",JSON.stringify(n))}}class yE extends Uo{constructor(e){super(),this._actual=e,this.onKeyDown=this._register(UC(this._actual,"keydown")).event,this.onKeyUp=this._register(UC(this._actual,"keyup")).event,this.onCompositionStart=this._register(UC(this._actual,"compositionstart")).event,this.onCompositionUpdate=this._register(UC(this._actual,"compositionupdate")).event,this.onCompositionEnd=this._register(UC(this._actual,"compositionend")).event,this.onInput=this._register(UC(this._actual,"input")).event,this.onCut=this._register(UC(this._actual,"cut")).event,this.onCopy=this._register(UC(this._actual,"copy")).event,this.onPaste=this._register(UC(this._actual,"paste")).event,this.onFocus=this._register(UC(this._actual,"focus")).event,this.onBlur=this._register(UC(this._actual,"blur")).event,this._onSyntheticTap=this._register(new $o),this.onSyntheticTap=this._onSyntheticTap.event,this._ignoreSelectionChangeTime=0,this._register(BC(this._actual,pE.Tap,(()=>this._onSyntheticTap.fire())))}hasFocus(){const e=pw(this._actual);return e?e.activeElement===this._actual:!!PC(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=pw(n);o=s?s.activeElement:document.activeElement;const r=o===n,a=n.selectionStart,l=n.selectionEnd;if(r&&a===t&&l===i)Rf&&window.parent!==window&&n.focus();else{if(r)return this.setIgnoreSelectionChangeTime("setSelectionRange"),n.setSelectionRange(t,i),void(Rf&&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 SE extends dE{constructor(e,t,i){super(e,t,i),this._register($S.addTarget(this.viewHelper.linesContentDomNode)),this._register(BC(this.viewHelper.linesContentDomNode,WS.Tap,(e=>this.onTap(e)))),this._register(BC(this.viewHelper.linesContentDomNode,WS.Change,(e=>this.onChange(e)))),this._register(BC(this.viewHelper.linesContentDomNode,WS.Contextmenu,(e=>this._onContextMenu(new CD(e,this.viewHelper.viewDomNode),!1)))),this._lastPointerType="mouse",this._register(BC(this.viewHelper.linesContentDomNode,"pointerdown",(e=>{const t=e.pointerType;this._lastPointerType="mouse"!==t?"touch"===t?"touch":"pen":"mouse"})));const n=new yD(this.viewHelper.viewDomNode);this._register(n.onPointerMoveThrottled(this.viewHelper.viewDomNode,(e=>this._onMouseMove(e)),lE(this.mouseTargetFactory),dE.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 CD(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 xE extends dE{constructor(e,t,i){super(e,t,i),this._register($S.addTarget(this.viewHelper.linesContentDomNode)),this._register(BC(this.viewHelper.linesContentDomNode,WS.Tap,(e=>this.onTap(e)))),this._register(BC(this.viewHelper.linesContentDomNode,WS.Change,(e=>this.onChange(e)))),this._register(BC(this.viewHelper.linesContentDomNode,WS.Contextmenu,(e=>this._onContextMenu(new CD(e,this.viewHelper.viewDomNode),!1))))}onTap(e){e.preventDefault(),this.viewHelper.focusTextArea();const t=this._createMouseTarget(new CD(e,this.viewHelper.viewDomNode),!1);if(t.position){const e=document.createEvent("CustomEvent");e.initEvent(pE.Tap,!1,!0),this.viewHelper.dispatchTextAreaEvent(e),this.viewController.moveTo(t.position)}}onChange(e){this._context.viewModel.viewLayout.deltaScrollNow(-e.translationX,-e.translationY)}}class kE extends Uo{constructor(e,t,i){super(),Vs&&mC?this.handler=this._register(new SE(e,t,i)):window.TouchEvent?this.handler=this._register(new xE(e,t,i)):this.handler=this._register(new dE(e,t,i))}getTargetAtClientPoint(e,t){return this.handler.getTargetAtClientPoint(e,t)}}class LE extends DD{}const DE=ox("editor.lineHighlightBackground",{dark:null,light:null,hc:null},$m(0,"Background color for the highlight of line at the cursor position.")),EE=ox("editor.lineHighlightBorder",{dark:"#282828",light:"#eeeeee",hc:"#f38518"},$m(0,"Background color for the border around the line at the cursor position.")),NE=ox("editor.rangeHighlightBackground",{dark:"#ffffff0b",light:"#fdff0033",hc:null},$m(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),IE=ox("editor.rangeHighlightBorder",{dark:null,light:null,hc:hx},$m(0,"Background color of the border around highlighted ranges."),!0),TE=ox("editor.symbolHighlightBackground",{dark:yk,light:yk,hc:null},$m(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),ME=ox("editor.symbolHighlightBorder",{dark:null,light:null,hc:hx},$m(0,"Background color of the border around highlighted symbols."),!0),OE=ox("editorCursor.foreground",{dark:"#AEAFAD",light:QS.black,hc:QS.white},$m(0,"Color of the editor cursor.")),AE=ox("editorCursor.background",null,$m(0,"The background color of the editor cursor. Allows customizing the color of a character overlapped by a block cursor.")),RE=ox("editorWhitespace.foreground",{dark:"#e3e4e229",light:"#33333333",hc:"#e3e4e229"},$m(0,"Color of whitespace characters in the editor.")),PE=ox("editorIndentGuide.background",{dark:RE,light:RE,hc:RE},$m(0,"Color of the editor indentation guides.")),FE=ox("editorIndentGuide.activeBackground",{dark:RE,light:RE,hc:RE},$m(0,"Color of the active editor indentation guides.")),BE=ox("editorLineNumber.foreground",{dark:"#858585",light:"#237893",hc:QS.white},$m(0,"Color of editor line numbers.")),VE=ox("editorActiveLineNumber.foreground",{dark:"#c6c6c6",light:"#0B216F",hc:hx},$m(0,"Color of editor active line number"),!1,$m(0,"Id is deprecated. Use 'editorLineNumber.activeForeground' instead.")),WE=ox("editorLineNumber.activeForeground",{dark:VE,light:VE,hc:VE},$m(0,"Color of editor active line number")),HE=ox("editorRuler.foreground",{dark:"#5A5A5A",light:QS.lightgrey,hc:QS.white},$m(0,"Color of the editor rulers."));ox("editorCodeLens.foreground",{dark:"#999999",light:"#919191",hc:"#999999"},$m(0,"Foreground color of editor CodeLens"));const zE=ox("editorBracketMatch.background",{dark:"#0064001a",light:"#0064001a",hc:"#0064001a"},$m(0,"Background color behind matching brackets")),jE=ox("editorBracketMatch.border",{dark:"#888",light:"#B9B9B9",hc:dx},$m(0,"Color for matching brackets boxes")),UE=ox("editorOverviewRuler.border",{dark:"#7f7f7f4d",light:"#7f7f7f4d",hc:"#7f7f7f4d"},$m(0,"Color of the overview ruler border.")),$E=ox("editorOverviewRuler.background",null,$m(0,"Background color of the editor overview ruler. Only used when the minimap is enabled and placed on the right side of the editor.")),KE=ox("editorGutter.background",{dark:tk,light:tk,hc:tk},$m(0,"Background color of the editor gutter. The gutter contains the glyph margins and the line numbers.")),qE=ox("editorUnnecessaryCode.border",{dark:null,light:null,hc:QS.fromHex("#fff").transparent(.8)},$m(0,"Border color of unnecessary (unused) source code in the editor.")),GE=ox("editorUnnecessaryCode.opacity",{dark:QS.fromHex("#000a"),light:QS.fromHex("#0007"),hc:null},$m(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.")),ZE=ox("editorGhostText.border",{dark:null,light:null,hc:QS.fromHex("#fff").transparent(.8)},$m(0,"Border color of ghost text in the editor.")),YE=ox("editorGhostText.foreground",{dark:QS.fromHex("#ffffff56"),light:QS.fromHex("#0007"),hc:null},$m(0,"Foreground color of the ghost text in the editor.")),XE=ox("editorGhostText.background",{dark:null,light:null,hc:null},$m(0,"Background color of the ghost text in the editor.")),QE=new QS(new ZS(0,122,204,.6)),JE=ox("editorOverviewRuler.rangeHighlightForeground",{dark:QE,light:QE,hc:QE},$m(0,"Overview ruler marker color for range highlights. The color must not be opaque so as not to hide underlying decorations."),!0),eN=ox("editorOverviewRuler.errorForeground",{dark:new QS(new ZS(255,18,18,.7)),light:new QS(new ZS(255,18,18,.7)),hc:new QS(new ZS(255,50,50,1))},$m(0,"Overview ruler marker color for errors.")),tN=ox("editorOverviewRuler.warningForeground",{dark:Gx,light:Gx,hc:Zx},$m(0,"Overview ruler marker color for warnings.")),iN=ox("editorOverviewRuler.infoForeground",{dark:Xx,light:Xx,hc:Qx},$m(0,"Overview ruler marker color for infos.")),nN=ox("editorBracketHighlight.foreground1",{dark:"#FFD700",light:"#0431FAFF",hc:"#FFD700"},$m(0,"Foreground color of brackets (1). Requires enabling bracket pair colorization.")),oN=ox("editorBracketHighlight.foreground2",{dark:"#DA70D6",light:"#319331FF",hc:"#DA70D6"},$m(0,"Foreground color of brackets (2). Requires enabling bracket pair colorization.")),sN=ox("editorBracketHighlight.foreground3",{dark:"#179FFF",light:"#7B3814FF",hc:"#87CEFA"},$m(0,"Foreground color of brackets (3). Requires enabling bracket pair colorization.")),rN=ox("editorBracketHighlight.foreground4",{dark:"#00000000",light:"#00000000",hc:"#00000000"},$m(0,"Foreground color of brackets (4). Requires enabling bracket pair colorization.")),aN=ox("editorBracketHighlight.foreground5",{dark:"#00000000",light:"#00000000",hc:"#00000000"},$m(0,"Foreground color of brackets (5). Requires enabling bracket pair colorization.")),lN=ox("editorBracketHighlight.foreground6",{dark:"#00000000",light:"#00000000",hc:"#00000000"},$m(0,"Foreground color of brackets (6). Requires enabling bracket pair colorization.")),dN=ox("editorBracketHighlight.unexpectedBracket.foreground",{dark:new QS(new ZS(255,18,18,.8)),light:new QS(new ZS(255,18,18,.8)),hc:new QS(new ZS(255,50,50,1))},$m(0,"Foreground color of unexpected brackets.")),hN=ox("editorBracketPairGuide.background1",{dark:"#00000000",light:"#00000000",hc:"#00000000"},$m(0,"Background color of inactive bracket pair guides (1). Requires enabling bracket pair guides.")),cN=ox("editorBracketPairGuide.background2",{dark:"#00000000",light:"#00000000",hc:"#00000000"},$m(0,"Background color of inactive bracket pair guides (2). Requires enabling bracket pair guides.")),uN=ox("editorBracketPairGuide.background3",{dark:"#00000000",light:"#00000000",hc:"#00000000"},$m(0,"Background color of inactive bracket pair guides (3). Requires enabling bracket pair guides.")),gN=ox("editorBracketPairGuide.background4",{dark:"#00000000",light:"#00000000",hc:"#00000000"},$m(0,"Background color of inactive bracket pair guides (4). Requires enabling bracket pair guides.")),pN=ox("editorBracketPairGuide.background5",{dark:"#00000000",light:"#00000000",hc:"#00000000"},$m(0,"Background color of inactive bracket pair guides (5). Requires enabling bracket pair guides.")),mN=ox("editorBracketPairGuide.background6",{dark:"#00000000",light:"#00000000",hc:"#00000000"},$m(0,"Background color of inactive bracket pair guides (6). Requires enabling bracket pair guides.")),fN=ox("editorBracketPairGuide.activeBackground1",{dark:"#00000000",light:"#00000000",hc:"#00000000"},$m(0,"Background color of active bracket pair guides (1). Requires enabling bracket pair guides.")),_N=ox("editorBracketPairGuide.activeBackground2",{dark:"#00000000",light:"#00000000",hc:"#00000000"},$m(0,"Background color of active bracket pair guides (2). Requires enabling bracket pair guides.")),vN=ox("editorBracketPairGuide.activeBackground3",{dark:"#00000000",light:"#00000000",hc:"#00000000"},$m(0,"Background color of active bracket pair guides (3). Requires enabling bracket pair guides.")),bN=ox("editorBracketPairGuide.activeBackground4",{dark:"#00000000",light:"#00000000",hc:"#00000000"},$m(0,"Background color of active bracket pair guides (4). Requires enabling bracket pair guides.")),CN=ox("editorBracketPairGuide.activeBackground5",{dark:"#00000000",light:"#00000000",hc:"#00000000"},$m(0,"Background color of active bracket pair guides (5). Requires enabling bracket pair guides.")),wN=ox("editorBracketPairGuide.activeBackground6",{dark:"#00000000",light:"#00000000",hc:"#00000000"},$m(0,"Background color of active bracket pair guides (6). Requires enabling bracket pair guides."));ox("editorUnicodeHighlight.border",{dark:"#BD9B03",light:"#CEA33D",hc:"#ff0000"},$m(0,"Border color used to highlight unicode characters.")),zy(((e,t)=>{const i=e.getColor(tk);i&&t.addRule(`.monaco-editor, .monaco-editor-background, .monaco-editor .inputarea.ime-input { background-color: ${i}; }`);const n=e.getColor(ik);n&&t.addRule(`.monaco-editor, .monaco-editor .inputarea.ime-input { color: ${n}; }`);const o=e.getColor(KE);o&&t.addRule(`.monaco-editor .margin { background-color: ${o}; }`);const s=e.getColor(NE);s&&t.addRule(`.monaco-editor .rangeHighlight { background-color: ${s}; }`);const r=e.getColor(IE);r&&t.addRule(`.monaco-editor .rangeHighlight { border: 1px ${"hc"===e.type?"dotted":"solid"} ${r}; }`);const a=e.getColor(TE);a&&t.addRule(`.monaco-editor .symbolHighlight { background-color: ${a}; }`);const l=e.getColor(ME);l&&t.addRule(`.monaco-editor .symbolHighlight { border: 1px ${"hc"===e.type?"dotted":"solid"} ${l}; }`);const d=e.getColor(RE);d&&(t.addRule(`.monaco-editor .mtkw { color: ${d} !important; }`),t.addRule(`.monaco-editor .mtkz { color: ${d} !important; }`))}));class yN extends LE{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="'+yN.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 '+yN.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]}}yN.CLASS_NAME="line-numbers",zy(((e,t)=>{const i=e.getColor(BE);i&&t.addRule(`.monaco-editor .line-numbers { color: ${i}; }`);const n=e.getColor(WE);n&&t.addRule(`.monaco-editor .line-numbers.active-line-number { color: ${n}; }`)}));class SN extends ED{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=$f(document.createElement("div")),this._domNode.setClassName(SN.OUTER_CLASS_NAME),this._domNode.setPosition("absolute"),this._domNode.setAttribute("role","presentation"),this._domNode.setAttribute("aria-hidden","true"),this._glyphMarginBackgroundDomNode=$f(document.createElement("div")),this._glyphMarginBackgroundDomNode.setClassName(SN.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)}}SN.CLASS_NAME="glyph-margin",SN.OUTER_CLASS_NAME="margin";class xN{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 kN=Rf;class LN extends ED{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=$f(document.createElement("textarea")),ND.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",$m(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=$f(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(_E.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(Ho){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 mE(i,i.length,i.length,t,t)}}return mE.EMPTY}if(Hf){const e=this._selections[0];if(e.isEmpty()){const t=e.getStartPosition(),[i,n]=this._getAndroidWordAtPosition(t);if(i.length>0)return new mE(i,n,n,t,t)}return mE.EMPTY}return fE.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 yE(this.textArea.domNode));this._textAreaInput=this._register(new CE(r,a,Xs,jf)),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);return{distanceToModelLineStart:a.column-1-l,widthOfHiddenTextBefore: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");Kf(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)}})(),{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 xN(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=hr('`~!@#$%^&*()-=+[{]}\\|;:",.<>/?');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=hr(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)?$m(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===Ef.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),h=d.tokens.findTokenIndexAtOffset(i.column-1),c=h===d.tokens.findTokenIndexAtOffset(n.column-1),u=this._visibleTextArea.definePresentation(c?d.tokens.getPresentation(h):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:(Es.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(Ho){this._doRender({lastRenderPosition:this._primaryCursorPosition,top:t,left:e,width:kN?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:kN?0:1,height:kN?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:kN?0:1,height:kN?0:1,useCover:!0})}_doRender(e){this._lastRenderPosition=e.lastRenderPosition;const t=this.textArea,i=this.textAreaCover;Kf(t,this._fontInfo),t.setTop(e.top),t.setLeft(e.left),t.setWidth(e.width),t.setHeight(e.height),t.setColor(e.color?QS.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 "+SN.OUTER_CLASS_NAME):0!==n.get(60).renderType?i.setClassName("monaco-editor-background textAreaCover "+yN.CLASS_NAME):i.setClassName("monaco-editor-background textAreaCover")}}function DN(e,t,i){let n=Ss(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 EN=()=>!0,NN=()=>!1,IN=e=>" "===e||"\t"===e;class TN{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 DN(e,this.indentSize,this.insertSpaces)}_getShouldAutoClose(e,t){switch(t){case"beforeWhitespace":return IN;case"languageDefined":return this._getLanguageDefinedShouldAutoClose(e);case"always":return EN;case"never":return NN}}_getLanguageDefinedShouldAutoClose(e){const t=this.languageConfigurationService.getLanguageConfiguration(e).getAutoCloseBeforeSet();return e=>-1!==t.indexOf(e)}visibleColumnFromColumn(e,t){return GD.visibleColumnFromColumn(e.getLineContent(t.lineNumber),t.column,this.tabSize)}columnFromVisibleColumn(e,t,i){const n=GD.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 MN{constructor(e,t){this._cursorStateBrand=void 0,this.modelState=e,this.viewState=t}static fromModelState(e){return new ON(e)}static fromViewState(e){return new AN(e)}static fromModelSelection(e){const t=ar.liftSelection(e),i=new RN(qo.fromPositions(t.getSelectionStart()),0,t.getPosition(),0);return MN.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 ON{constructor(e){this.modelState=e,this.viewState=null}}class AN{constructor(e){this.modelState=null,this.viewState=e}}class RN{constructor(e,t,i,n){this._singleCursorStateBrand=void 0,this.selectionStart=e,this.selectionStartLeftoverVisibleColumns=t,this.position=i,this.leftoverVisibleColumns=n,this.selection=RN._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 RN(this.selectionStart,this.selectionStartLeftoverVisibleColumns,new er(t,i),n):new RN(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 PN{constructor(e,t,i){this._editOperationResultBrand=void 0,this.type=e,this.commands=t,this.shouldPushStackElementBefore=i.shouldPushStackElementBefore,this.shouldPushStackElementAfter=i.shouldPushStackElementAfter}}function FN(e){return"'"===e||'"'===e||"`"===e}class BN{static columnSelect(e,t,i,n,o,s){const r=Math.abs(o-i)+1,a=i>o,l=n>s,d=n<s,h=[];for(let c=0;c<r;c++){const o=i+(a?-c:c),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}h.push(new RN(new qo(o,r,o,r),0,new er(o,u),0))}if(0===h.length)for(let c=0;c<r;c++){const e=i+(a?-c:c),n=t.getLineMaxColumn(e);h.push(new RN(new qo(e,n,e,n),0,new er(e,n),0))}return{viewStates:h,reversed:a,fromLineNumber:i,fromVisualColumn:n,toLineNumber:o,toVisualColumn:s}}static columnSelectLeft(e,t,i){let n=i.toViewVisualColumn;return n>0&&n--,BN.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 VN{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 WN{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 HN{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 zN{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 jN{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 UN{constructor(e,t,i){this._cursorPositionBrand=void 0,this.lineNumber=e,this.column=t,this.leftoverVisibleColumns=i}}class $N{static leftPosition(e,t){if(t.column>e.getLineMinColumn(t.lineNumber))return t.delta(void 0,-cr(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=ZD.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?$N.leftPositionAtomicSoftTabs(t,i,e.tabSize):$N.leftPosition(t,i);return new UN(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($N.clipPositionColumn(n,t),0),l=$N.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,$N.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=ZD.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?$N.rightPositionAtomicSoftTabs(t,i.lineNumber,i.column,e.tabSize,e.indentSize):$N.rightPosition(t,i.lineNumber,i.column);return new UN(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($N.clipPositionColumn(n,t),1),l=$N.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=GD.visibleColumnFromColumn(t.getLineContent(i),n,e.tabSize)+o,d=t.getLineCount(),h=1===i&&1===n,c=i===d&&n===t.getLineMaxColumn(i),u=s<i?h:c;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-GD.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 UN(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=$N.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=$N.down(e,t,n.selectionStartLineNumber,n.selectionStartColumn,i.selectionStartLeftoverVisibleColumns,1,!1),s=$N.down(e,t,n.positionLineNumber,n.positionColumn,i.leftoverVisibleColumns,1,!1);return new RN(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=$N.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=$N.up(e,t,n.selectionStartLineNumber,n.selectionStartColumn,i.selectionStartLeftoverVisibleColumns,1,!1),s=$N.up(e,t,n.positionLineNumber,n.positionColumn,i.leftoverVisibleColumns,1,!1);return new RN(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 KN{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=$N.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 VN(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 h=o.getLineContent(d.lineNumber);if(d.column<2||d.column>=h.length+1)return!1;const c=h.charAt(d.column-2),u=n.get(c);if(!u)return!1;if(FN(c)){if("never"===i)return!1}else if("never"===t)return!1;const g=h.charAt(d.column-1);let p=!1;for(const e of u)e.open===c&&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 VN(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=KN.getDeleteRange(n[a],i,t);e.isEmpty()?s[a]=null:(e.startLineNumber!==e.endLineNumber&&(r=!0),s[a]=new VN(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=Ss(e),s=-1===o?e.length+1:o+1;if(n.column<=s){const e=i.visibleColumnFromColumn(t,n),o=GD.prevIndentTabStop(e,i.indentSize),s=i.columnFromVisibleColumn(t,n.lineNumber,o);return new qo(n.lineNumber,s,n.lineNumber,n.column)}}return qo.fromPositions(KN.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 h=new qo(i,a,l,d);o=h,h.isEmpty()?n[s]=null:n[s]=new VN(h,"")}else n[s]=null;else n[s]=new VN(r,"")}return new PN(0,n,{shouldPushStackElementBefore:!0,shouldPushStackElementAfter:!0})}}class qN{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=qN._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=qN._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=qN._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=qN._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=qN._findNextWordOnLine(e,t,new er(o,s));if(2===n)a&&2===a.wordType&&a.end-a.start==1&&0===a.nextCharClass&&(a=qN._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=qN._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=qN._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=xs(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(KN.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=qN._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=qN._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=qN._findPreviousWordOnLine(e,t,i);if(l&&s(l))return a(l);const d=qN._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=qN._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(),h=n.getLineMaxColumn(a);if(a===d&&l===h)return null;if(s){const e=this._deleteWordRightWhitespace(n,r);if(e)return e}let c=qN._findNextWordOnLine(i,n,r);return 2===t?c?l=c.end+1:l<h||a===d?l=h:(a++,c=qN._findNextWordOnLine(i,n,new er(a,1)),l=c?c.start+1:n.getLineMaxColumn(a)):(c&&l>=c.start+1&&(c=qN._findNextWordOnLine(i,n,new er(a,c.end+1))),c?l=c.start+1:l<h||a===d?l=h:(a++,c=qN._findNextWordOnLine(i,n,new er(a,1)),l=c?c.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=qN._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=hr(t),o=qN._findPreviousWordOnLine(n,e,i);if(o&&1===o.wordType&&o.start<=i.column-1&&i.column-1<=o.end)return qN._createWordAtPosition(e,i.lineNumber,o);const s=qN._findNextWordOnLine(n,e,i);return s&&1===s.wordType&&s.start<=i.column-1&&i.column-1<=s.end?qN._createWordAtPosition(e,i.lineNumber,s):null}static word(e,t,i,n,o){const s=hr(e.wordSeparators),r=qN._findPreviousWordOnLine(s,t,o),a=qN._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 RN(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 h=o.lineNumber;let c;if(i.selectionStart.containsPosition(o))c=i.selectionStart.endColumn;else if(o.isBeforeOrEqual(i.selectionStart.getStartPosition())){c=l;const e=new er(h,c);i.selectionStart.containsPosition(e)&&(c=i.selectionStart.endColumn)}else{c=d;const e=new er(h,c);i.selectionStart.containsPosition(e)&&(c=i.selectionStart.startColumn)}return i.move(!0,h,c,0)}}class GN extends qN{static deleteWordPartLeft(e){const t=ZN([qN.deleteWordLeft(e,0),qN.deleteWordLeft(e,2),qN._deleteWordPartLeft(e.model,e.selection)]);return t.sort(qo.compareRangesUsingEnds),t[2]}static deleteWordPartRight(e){const t=ZN([qN.deleteWordRight(e,0),qN.deleteWordRight(e,2),qN._deleteWordPartRight(e.model,e.selection)]);return t.sort(qo.compareRangesUsingStarts),t[0]}static moveWordPartLeft(e,t,i){const n=ZN([qN.moveWordLeft(e,t,i,0),qN.moveWordLeft(e,t,i,2),qN._moveWordPartLeft(t,i)]);return n.sort(er.compare),n[2]}static moveWordPartRight(e,t,i){const n=ZN([qN.moveWordRight(e,t,i,0),qN.moveWordRight(e,t,i,2),qN._moveWordPartRight(t,i)]);return n.sort(er.compare),n[0]}}function ZN(e){return e.filter((e=>Boolean(e)))}class YN{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 MN(r.modelState,r.viewState),n[o++]=i?MN.fromModelState($N.translateDown(e.cursorConfig,e.model,r.modelState)):MN.fromViewState($N.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 MN(r.modelState,r.viewState),n[o++]=i?MN.fromModelState($N.translateUp(e.cursorConfig,e.model,r.modelState)):MN.fromViewState($N.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 MN.fromViewState($N.moveToBeginningOfLine(e.cursorConfig,e,t.viewState,i))}static _moveToLineStartByModel(e,t,i){return MN.fromModelState($N.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 MN.fromViewState($N.moveToEndOfLine(e.cursorConfig,e,t.viewState,i,n))}static _moveToLineEndByModel(e,t,i,n){return MN.fromModelState($N.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]=MN.fromModelState(new RN(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]=MN.fromModelState($N.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]=MN.fromModelState($N.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 MN.fromModelState(new RN(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)),MN.fromModelState(new RN(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 MN.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)),MN.fromViewState(t.viewState.move(t.modelState.hasSelection(),n,o,0))}{const e=t.modelState.selectionStart.getEndPosition();return MN.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 MN.fromModelState(qN.word(e.cursorConfig,e.model,t.modelState,i,o))}static cancelSelection(e,t){if(!t.modelState.hasSelection())return new MN(t.modelState,t.viewState);const i=t.viewState.position.lineNumber,n=t.viewState.position.column;return MN.fromViewState(new RN(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 MN.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=>MN.fromViewState($N.moveToPrevBlankLine(e.cursorConfig,e,t.viewState,n)))):t.map((t=>MN.fromModelState($N.moveToPrevBlankLine(e.cursorConfig,e.model,t.modelState,n))));case 5:return 2===s?t.map((t=>MN.fromViewState($N.moveToNextBlankLine(e.cursorConfig,e,t.viewState,n)))):t.map((t=>MN.fromModelState($N.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 MN(t.modelState,t.viewState);{let s;s=o>i.endLineNumber-1?i.endLineNumber-1:o<i.startLineNumber?i.startLineNumber:o;const r=$N.vertical(e.cursorConfig,e,o,t.viewState.position.column,t.viewState.leftoverVisibleColumns,s,!1);return MN.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=>MN.fromViewState($N.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]=MN.fromViewState($N.moveLeft(e.cursorConfig,e,s.viewState,i,a))}return n}static _moveRight(e,t,i,n){return t.map((t=>MN.fromViewState($N.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]=MN.fromViewState($N.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]=MN.fromViewState($N.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]=MN.fromModelState($N.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]=MN.fromViewState($N.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]=MN.fromModelState($N.moveUp(e.cursorConfig,e.model,r.modelState,i,n))}return o}static _moveToViewPosition(e,t,i,n,o){return MN.fromViewState(t.viewState.move(i,n,o,0))}static _moveToModelPosition(e,t,i,n,o){return MN.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 XN,QN;(QN=XN||(XN={})).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}}}}]},QN.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"},QN.RawUnit={Line:"line",WrappedLine:"wrappedLine",Character:"character",HalfLine:"halfLine"},QN.parse=function(e){if(!e.to)return null;let t;switch(e.to){case QN.RawDirection.Left:t=0;break;case QN.RawDirection.Right:t=1;break;case QN.RawDirection.Up:t=2;break;case QN.RawDirection.Down:t=3;break;case QN.RawDirection.PrevBlankLine:t=4;break;case QN.RawDirection.NextBlankLine:t=5;break;case QN.RawDirection.WrappedLineStart:t=6;break;case QN.RawDirection.WrappedLineFirstNonWhitespaceCharacter:t=7;break;case QN.RawDirection.WrappedLineColumnCenter:t=8;break;case QN.RawDirection.WrappedLineEnd:t=9;break;case QN.RawDirection.WrappedLineLastNonWhitespaceCharacter:t=10;break;case QN.RawDirection.ViewPortTop:t=11;break;case QN.RawDirection.ViewPortBottom:t=13;break;case QN.RawDirection.ViewPortCenter:t=12;break;case QN.RawDirection.ViewPortIfOutside:t=14;break;default:return null}let i=0;switch(e.by){case QN.RawUnit.Line:i=1;break;case QN.RawUnit.WrappedLine:i=2;break;case QN.RawUnit.Character:i=3;break;case QN.RawUnit.HalfLine:i=4}return{direction:t,unit:i,select:!!e.select,value:e.value||1}};const JN=Object.create(null);function eI(e,t){if(t<=0)return"";JN[e]||(JN[e]=["",e]);const i=JN[e];for(let n=i.length;n<=t;n++)i[n]=i[n-1]+e;return i[t]}class tI{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=GD.visibleColumnFromColumn(e,t,i);if(o){const e=eI(" ",n);return eI(e,GD.prevIndentTabStop(s,n)/n)}return eI("\t",GD.prevRenderTabStop(s,i)/i)}static shiftIndent(e,t,i,n,o){const s=GD.visibleColumnFromColumn(e,t,i);if(o){const e=eI(" ",n);return eI(e,GD.nextIndentTabStop(s,n)/n)}return eI("\t",GD.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 h=i;h<=n;h++,l=d){d=0;const n=e.getLineContent(h);let c,u=Ss(n);if((!this._opts.isUnshift||0!==n.length&&0!==u)&&(a||this._opts.isUnshift||0!==n.length)){if(-1===u&&(u=n.length),h>1){if(GD.visibleColumnFromColumn(n,u+1,o)%s!=0&&e.isCheapToTokenize(h-1)){const t=bv.getEnterAction(this._opts.autoIndent,e,new qo(h-1,e.getLineMaxColumn(h-1),h-1,e.getLineMaxColumn(h-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||(c=this._opts.isUnshift?tI.unshiftIndent(n,u+1,o,s,r):tI.shiftIndent(n,u+1,o,s,r),this._addEditOperation(t,new qo(h,1,h,u+1),c),h!==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?eI(" ",s):"\t";for(let r=i;r<=n;r++){const n=e.getLineContent(r);let l=Ss(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 iI{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 nI{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 tI(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 tI(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,tI.shiftIndent(t,t.length+i,e.tabSize,e.indentSize,e.insertSpaces)}static unshiftIndent(e,t,i){return i=i||1,tI.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 VN(i[s],n[s]);return new PN(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 jN(i,n,e,!0)}else s[r]=new VN(e,n)}return new PN(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=bv.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(xs(e)>=0)break}if(n<1)return null;const s=t.getLineMaxColumn(n),r=bv.getEnterAction(e.autoIndent,t,new qo(n,s,n,s));r&&(o=r.indentation+r.appendText)}return n&&(n===c_.Indent&&(o=nI.shiftIndent(e,o)),n===c_.Outdent&&(o=nI.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 VN(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 VN(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 tI(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 PN(4,l,{shouldPushStackElementBefore:rI(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 zN(d,i,0,s)}static _typeCommand(e,t,i){return i?new HN(e,t,!0):new VN(e,t,!0)}static _enter(e,t,i,n){if(0===e.autoIndent)return nI._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 nI._typeCommand(n,"\n"+e.normalizeIndentation(s),i)}const o=bv.getEnterAction(e.autoIndent,t,n);if(o){if(o.indentAction===c_.None)return nI._typeCommand(n,"\n"+e.normalizeIndentation(o.indentation+o.appendText),i);if(o.indentAction===c_.Indent)return nI._typeCommand(n,"\n"+e.normalizeIndentation(o.indentation+o.appendText),i);if(o.indentAction===c_.IndentOutdent){const t=e.normalizeIndentation(o.indentation),s=e.normalizeIndentation(o.indentation+o.appendText),r="\n"+s+"\n"+t;return i?new HN(n,r,!0):new zN(n,r,-1,s.length-t.length,!0)}if(o.indentAction===c_.Outdent){const t=nI.unshiftIndent(e,o.indentation);return nI._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=bv.getIndentForEnter(e.autoIndent,t,n,{unshiftIndent:t=>nI.unshiftIndent(e,t),shiftIndent:t=>nI.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=Ss(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 HN(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 zN(n,"\n"+e.normalizeIndentation(o.afterEnter),0,t,!0)}}}return nI._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=bv.getIndentationAtPosition(t,i.startLineNumber,i.startColumn),s=bv.getIndentActionForType(e.autoIndent,t,i,n,{shiftIndent:t=>nI.shiftIndent(e,t),unshiftIndent:t=>nI.unshiftIndent(e,t)});if(null===s)return null;if(s!==e.normalizeIndentation(o)){const o=t.getLineFirstNonWhitespaceColumn(i.startLineNumber);return 0===o?nI._typeCommand(new qo(i.startLineNumber,1,i.endLineNumber,i.endColumn),e.normalizeIndentation(s)+n,!1):nI._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=FN(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 VN(t,o)}return new PN(4,s,{shouldPushStackElementBefore:rI(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=FN(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 h=this._findContainedAutoClosingPair(e,d),c=h?h.close:"";let u=!0;for(const g of l){const{lineNumber:i,beforeColumn:o,afterColumn:s}=g,l=t.getLineContent(i),h=l.substring(0,o-1),p=l.substring(s-1);if(p.startsWith(c)||(u=!1),p.length>0){const t=p.charAt(0);if(!nI._isBeforeClosingBrace(e,p)&&!a(t))return null}if(1===d.open.length&&("'"===n||'"'===n)&&"always"!==r){const t=hr(e.wordSeparators);if(h.length>0){const e=h.charCodeAt(h.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-c.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 oI(e,o,!s,r)}return new PN(4,a,{shouldPushStackElementBefore:!0,shouldPushStackElementAfter:!1})}static _shouldSurroundChar(e,t){return FN(t)?"quotes"===e.autoSurround||"languageDefined"===e.autoSurround:"brackets"===e.autoSurround||"languageDefined"===e.autoSurround}static _isSurroundSelectionType(e,t,i,n){if(!nI._shouldSurroundChar(e,n)||!e.surroundingPairs.hasOwnProperty(n))return!1;const o=FN(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(FN(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 iI(e,o,i)}return new PN(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),h=i.getLineFirstNonWhitespaceColumn(s.lineNumber)||s.column,c=a+d.substring(h-1,s.column-1)+o,u=new qo(s.lineNumber,1,s.lineNumber,s.column),g=new VN(u,c);return new PN(sI(c,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 VN(new qo(e.positionLineNumber,e.positionColumn,e.positionLineNumber,e.positionColumn+1),"",!1)));return new PN(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]=nI._enter(i,n,!1,o[t]);return new PN(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 PN(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,h=o.length;d<h;d++)a[d]=new VN(o[d],r);const l=sI(r,t);return new PN(l,a,{shouldPushStackElementBefore:rI(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 VN(n[a],o);const r=sI(o,e);return new PN(r,s,{shouldPushStackElementBefore:rI(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 HN(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 oI extends zN{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 sI(e,t){return" "===e?5===t||6===t?6:5:4}function rI(e,t){return!(!lI(e)||lI(t))||5!==e&&aI(e)!==aI(t)}function aI(e){return 6===e||5===e?"space":e}function lI(e){return 4===e||5===e||6===e}var dI,hI;(hI=dI||(dI={})).editorSimpleInput=new Ly("editorSimpleInput",!1,!0),hI.editorTextFocus=new Ly("editorTextFocus",!1,$m(0,"Whether the editor text has focus (cursor is blinking)")),hI.focus=new Ly("editorFocus",!1,$m(0,"Whether the editor or an editor widget has focus (e.g. focus is in the find widget)")),hI.textInputFocus=new Ly("textInputFocus",!1,$m(0,"Whether an editor or a rich text input has focus (cursor is blinking)")),hI.readOnly=new Ly("editorReadonly",!1,$m(0,"Whether the editor is read only")),hI.inDiffEditor=new Ly("inDiffEditor",!1,$m(0,"Whether the context is a diff editor")),hI.columnSelection=new Ly("editorColumnSelection",!1,$m(0,"Whether `editor.columnSelection` is enabled")),hI.writable=hI.readOnly.toNegated(),hI.hasNonEmptySelection=new Ly("editorHasSelection",!1,$m(0,"Whether the editor has text selected")),hI.hasOnlyEmptySelection=hI.hasNonEmptySelection.toNegated(),hI.hasMultipleSelections=new Ly("editorHasMultipleSelections",!1,$m(0,"Whether the editor has multiple selections")),hI.hasSingleSelection=hI.hasMultipleSelections.toNegated(),hI.tabMovesFocus=new Ly("editorTabMovesFocus",!1,$m(0,"Whether `Tab` will move focus out of the editor")),hI.tabDoesNotMoveFocus=hI.tabMovesFocus.toNegated(),hI.isInWalkThroughSnippet=new Ly("isInEmbeddedEditor",!1,!0),hI.canUndo=new Ly("canUndo",!1,!0),hI.canRedo=new Ly("canRedo",!1,!0),hI.hoverVisible=new Ly("editorHoverVisible",!1,$m(0,"Whether the editor hover is visible")),hI.inCompositeEditor=new Ly("inCompositeEditor",void 0,$m(0,"Whether the editor is part of a larger editor (e.g. notebooks)")),hI.notInCompositeEditor=hI.inCompositeEditor.toNegated(),hI.languageId=new Ly("editorLangId","",$m(0,"The language identifier of the editor")),hI.hasCompletionItemProvider=new Ly("editorHasCompletionItemProvider",!1,$m(0,"Whether the editor has a completion item provider")),hI.hasCodeActionsProvider=new Ly("editorHasCodeActionsProvider",!1,$m(0,"Whether the editor has a code actions provider")),hI.hasCodeLensProvider=new Ly("editorHasCodeLensProvider",!1,$m(0,"Whether the editor has a code lens provider")),hI.hasDefinitionProvider=new Ly("editorHasDefinitionProvider",!1,$m(0,"Whether the editor has a definition provider")),hI.hasDeclarationProvider=new Ly("editorHasDeclarationProvider",!1,$m(0,"Whether the editor has a declaration provider")),hI.hasImplementationProvider=new Ly("editorHasImplementationProvider",!1,$m(0,"Whether the editor has an implementation provider")),hI.hasTypeDefinitionProvider=new Ly("editorHasTypeDefinitionProvider",!1,$m(0,"Whether the editor has a type definition provider")),hI.hasHoverProvider=new Ly("editorHasHoverProvider",!1,$m(0,"Whether the editor has a hover provider")),hI.hasDocumentHighlightProvider=new Ly("editorHasDocumentHighlightProvider",!1,$m(0,"Whether the editor has a document highlight provider")),hI.hasDocumentSymbolProvider=new Ly("editorHasDocumentSymbolProvider",!1,$m(0,"Whether the editor has a document symbol provider")),hI.hasReferenceProvider=new Ly("editorHasReferenceProvider",!1,$m(0,"Whether the editor has a reference provider")),hI.hasRenameProvider=new Ly("editorHasRenameProvider",!1,$m(0,"Whether the editor has a rename provider")),hI.hasSignatureHelpProvider=new Ly("editorHasSignatureHelpProvider",!1,$m(0,"Whether the editor has a signature help provider")),hI.hasInlayHintsProvider=new Ly("editorHasInlayHintsProvider",!1,$m(0,"Whether the editor has an inline hints provider")),hI.hasDocumentFormattingProvider=new Ly("editorHasDocumentFormattingProvider",!1,$m(0,"Whether the editor has a document formatting provider")),hI.hasDocumentSelectionFormattingProvider=new Ly("editorHasDocumentSelectionFormattingProvider",!1,$m(0,"Whether the editor has a document selection formatting provider")),hI.hasMultipleDocumentFormattingProvider=new Ly("editorHasMultipleDocumentFormattingProvider",!1,$m(0,"Whether the editor has multiple document formatting providers")),hI.hasMultipleDocumentSelectionFormattingProvider=new Ly("editorHasMultipleDocumentSelectionFormattingProvider",!1,$m(0,"Whether the editor has multiple document selection formatting providers"));class cI extends sS{runEditorCommand(e,t,i){const n=t._getViewModel();n&&this.runCoreEditorCommand(n,i||{})}}var uI,gI,pI,mI,fI;(gI=uI||(uI={})).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"}}}}]},gI.RawDirection={Up:"up",Down:"down"},gI.RawUnit={Line:"line",WrappedLine:"wrappedLine",Page:"page",HalfPage:"halfPage"},gI.parse=function(e){let t,i;switch(e.to){case gI.RawDirection.Up:t=1;break;case gI.RawDirection.Down:t=2;break;default:return null}switch(e.by){case gI.RawUnit.Line:i=1;break;case gI.RawUnit.WrappedLine:i=2;break;case gI.RawUnit.Page:i=3;break;case gI.RawUnit.HalfPage:i=4;break;default:i=2}return{direction:t,unit:i,value:Math.floor(e.value||1),revealCursor:!!e.revealCursor,select:!!e.select}},(mI=pI||(pI={})).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"]}}}}]},mI.RawAtArgument={Top:"top",Center:"center",Bottom:"bottom"};class _I{constructor(e){e.addImplementation(1e4,"code-editor",((e,t)=>{const i=e.get(r_).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(r_).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 cI{constructor(e){super(e),this._minimalReveal=e.minimalReveal,this._inSelectionMode=e.inSelectionMode}runCoreEditorCommand(e,t){e.model.pushStackElement();e.setCursorStates(t.source,3,[YN.moveTo(e,e.getPrimaryCursorState(),this._inSelectionMode,t.position,t.viewPosition)])&&e.revealPrimaryCursor(t.source,!0,this._minimalReveal)}}e.MoveTo=dS(new t({id:"_moveTo",minimalReveal:!0,inSelectionMode:!1,precondition:void 0})),e.MoveToSelect=dS(new t({id:"_moveToSelect",minimalReveal:!1,inSelectionMode:!0,precondition:void 0}));class i extends cI{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=>MN.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=dS(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 BN.columnSelect(e.cursorConfig,e,r,a,s.lineNumber,n.mouseColumn-1)}}),e.CursorColumnSelectLeft=dS(new class extends i{constructor(){super({id:"cursorColumnSelectLeft",precondition:void 0,kbOpts:{weight:0,kbExpr:dI.textInputFocus,primary:3599,linux:{primary:0}}})}_getColumnSelectResult(e,t,i,n){return BN.columnSelectLeft(e.cursorConfig,e,i)}}),e.CursorColumnSelectRight=dS(new class extends i{constructor(){super({id:"cursorColumnSelectRight",precondition:void 0,kbOpts:{weight:0,kbExpr:dI.textInputFocus,primary:3601,linux:{primary:0}}})}_getColumnSelectResult(e,t,i,n){return BN.columnSelectRight(e.cursorConfig,e,i)}});class n extends i{constructor(e){super(e),this._isPaged=e.isPaged}_getColumnSelectResult(e,t,i,n){return BN.columnSelectUp(e.cursorConfig,e,i,this._isPaged)}}e.CursorColumnSelectUp=dS(new n({isPaged:!1,id:"cursorColumnSelectUp",precondition:void 0,kbOpts:{weight:0,kbExpr:dI.textInputFocus,primary:3600,linux:{primary:0}}})),e.CursorColumnSelectPageUp=dS(new n({isPaged:!0,id:"cursorColumnSelectPageUp",precondition:void 0,kbOpts:{weight:0,kbExpr:dI.textInputFocus,primary:3595,linux:{primary:0}}}));class o extends i{constructor(e){super(e),this._isPaged=e.isPaged}_getColumnSelectResult(e,t,i,n){return BN.columnSelectDown(e.cursorConfig,e,i,this._isPaged)}}e.CursorColumnSelectDown=dS(new o({isPaged:!1,id:"cursorColumnSelectDown",precondition:void 0,kbOpts:{weight:0,kbExpr:dI.textInputFocus,primary:3602,linux:{primary:0}}})),e.CursorColumnSelectPageDown=dS(new o({isPaged:!0,id:"cursorColumnSelectPageDown",precondition:void 0,kbOpts:{weight:0,kbExpr:dI.textInputFocus,primary:3596,linux:{primary:0}}}));class s extends cI{constructor(){super({id:"cursorMove",precondition:void 0,description:XN.description})}runCoreEditorCommand(e,t){const i=XN.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 YN.simpleMove(e,t,i.direction,n,o,i.unit);case 11:case 13:case 12:case 14:return YN.viewportMove(e,t,i.direction,n,o);default:return null}}}e.CursorMoveImpl=s,e.CursorMove=dS(new s);class r extends cI{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,YN.simpleMove(e,e.getCursorStates(),i.direction,i.select,i.value,i.unit)),e.revealPrimaryCursor(t.source,!0)}}e.CursorLeft=dS(new r({args:{direction:0,unit:0,select:!1,value:1},id:"cursorLeft",precondition:void 0,kbOpts:{weight:0,kbExpr:dI.textInputFocus,primary:15,mac:{primary:15,secondary:[288]}}})),e.CursorLeftSelect=dS(new r({args:{direction:0,unit:0,select:!0,value:1},id:"cursorLeftSelect",precondition:void 0,kbOpts:{weight:0,kbExpr:dI.textInputFocus,primary:1039}})),e.CursorRight=dS(new r({args:{direction:1,unit:0,select:!1,value:1},id:"cursorRight",precondition:void 0,kbOpts:{weight:0,kbExpr:dI.textInputFocus,primary:17,mac:{primary:17,secondary:[292]}}})),e.CursorRightSelect=dS(new r({args:{direction:1,unit:0,select:!0,value:1},id:"cursorRightSelect",precondition:void 0,kbOpts:{weight:0,kbExpr:dI.textInputFocus,primary:1041}})),e.CursorUp=dS(new r({args:{direction:2,unit:2,select:!1,value:1},id:"cursorUp",precondition:void 0,kbOpts:{weight:0,kbExpr:dI.textInputFocus,primary:16,mac:{primary:16,secondary:[302]}}})),e.CursorUpSelect=dS(new r({args:{direction:2,unit:2,select:!0,value:1},id:"cursorUpSelect",precondition:void 0,kbOpts:{weight:0,kbExpr:dI.textInputFocus,primary:1040,secondary:[3088],mac:{primary:1040},linux:{primary:1040}}})),e.CursorPageUp=dS(new r({args:{direction:2,unit:2,select:!1,value:-1},id:"cursorPageUp",precondition:void 0,kbOpts:{weight:0,kbExpr:dI.textInputFocus,primary:11}})),e.CursorPageUpSelect=dS(new r({args:{direction:2,unit:2,select:!0,value:-1},id:"cursorPageUpSelect",precondition:void 0,kbOpts:{weight:0,kbExpr:dI.textInputFocus,primary:1035}})),e.CursorDown=dS(new r({args:{direction:3,unit:2,select:!1,value:1},id:"cursorDown",precondition:void 0,kbOpts:{weight:0,kbExpr:dI.textInputFocus,primary:18,mac:{primary:18,secondary:[300]}}})),e.CursorDownSelect=dS(new r({args:{direction:3,unit:2,select:!0,value:1},id:"cursorDownSelect",precondition:void 0,kbOpts:{weight:0,kbExpr:dI.textInputFocus,primary:1042,secondary:[3090],mac:{primary:1042},linux:{primary:1042}}})),e.CursorPageDown=dS(new r({args:{direction:3,unit:2,select:!1,value:-1},id:"cursorPageDown",precondition:void 0,kbOpts:{weight:0,kbExpr:dI.textInputFocus,primary:12}})),e.CursorPageDownSelect=dS(new r({args:{direction:3,unit:2,select:!0,value:-1},id:"cursorPageDownSelect",precondition:void 0,kbOpts:{weight:0,kbExpr:dI.textInputFocus,primary:1036}})),e.CreateCursor=dS(new class extends cI{constructor(){super({id:"createCursor",precondition:void 0})}runCoreEditorCommand(e,t){let i;i=t.wholeLine?YN.line(e,e.getPrimaryCursorState(),!1,t.position,t.viewPosition):YN.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=dS(new class extends cI{constructor(){super({id:"_lastCursorMoveToSelect",precondition:void 0})}runCoreEditorCommand(e,t){const i=e.getLastAddedCursorIndex(),n=e.getCursorStates(),o=n.slice(0);o[i]=YN.moveTo(e,n[i],!0,t.position,t.viewPosition),e.model.pushStackElement(),e.setCursorStates(t.source,3,o)}});class a extends cI{constructor(e){super(e),this._inSelectionMode=e.inSelectionMode}runCoreEditorCommand(e,t){e.model.pushStackElement(),e.setCursorStates(t.source,3,YN.moveToBeginningOfLine(e,e.getCursorStates(),this._inSelectionMode)),e.revealPrimaryCursor(t.source,!0)}}e.CursorHome=dS(new a({inSelectionMode:!1,id:"cursorHome",precondition:void 0,kbOpts:{weight:0,kbExpr:dI.textInputFocus,primary:14,mac:{primary:14,secondary:[2063]}}})),e.CursorHomeSelect=dS(new a({inSelectionMode:!0,id:"cursorHomeSelect",precondition:void 0,kbOpts:{weight:0,kbExpr:dI.textInputFocus,primary:1038,mac:{primary:1038,secondary:[3087]}}}));class l extends cI{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]=MN.fromModelState(n.modelState.move(this._inSelectionMode,o,1,0))}return t}}e.CursorLineStart=dS(new l({inSelectionMode:!1,id:"cursorLineStart",precondition:void 0,kbOpts:{weight:0,kbExpr:dI.textInputFocus,primary:0,mac:{primary:287}}})),e.CursorLineStartSelect=dS(new l({inSelectionMode:!0,id:"cursorLineStartSelect",precondition:void 0,kbOpts:{weight:0,kbExpr:dI.textInputFocus,primary:0,mac:{primary:1311}}}));class d extends cI{constructor(e){super(e),this._inSelectionMode=e.inSelectionMode}runCoreEditorCommand(e,t){e.model.pushStackElement(),e.setCursorStates(t.source,3,YN.moveToEndOfLine(e,e.getCursorStates(),this._inSelectionMode,t.sticky||!1)),e.revealPrimaryCursor(t.source,!0)}}e.CursorEnd=dS(new d({inSelectionMode:!1,id:"cursorEnd",precondition:void 0,kbOpts:{args:{sticky:!1},weight:0,kbExpr:dI.textInputFocus,primary:13,mac:{primary:13,secondary:[2065]}},description:{description:"Go to End",args:[{name:"args",schema:{type:"object",properties:{sticky:{description:$m(0,"Stick to the end even when going to longer lines"),type:"boolean",default:!1}}}}]}})),e.CursorEndSelect=dS(new d({inSelectionMode:!0,id:"cursorEndSelect",precondition:void 0,kbOpts:{args:{sticky:!1},weight:0,kbExpr:dI.textInputFocus,primary:1037,mac:{primary:1037,secondary:[3089]}},description:{description:"Select to End",args:[{name:"args",schema:{type:"object",properties:{sticky:{description:$m(0,"Stick to the end even when going to longer lines"),type:"boolean",default:!1}}}}]}}));class h extends cI{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]=MN.fromModelState(o.modelState.move(this._inSelectionMode,s,r,0))}return i}}e.CursorLineEnd=dS(new h({inSelectionMode:!1,id:"cursorLineEnd",precondition:void 0,kbOpts:{weight:0,kbExpr:dI.textInputFocus,primary:0,mac:{primary:291}}})),e.CursorLineEndSelect=dS(new h({inSelectionMode:!0,id:"cursorLineEndSelect",precondition:void 0,kbOpts:{weight:0,kbExpr:dI.textInputFocus,primary:0,mac:{primary:1315}}}));class c extends cI{constructor(e){super(e),this._inSelectionMode=e.inSelectionMode}runCoreEditorCommand(e,t){e.model.pushStackElement(),e.setCursorStates(t.source,3,YN.moveToBeginningOfBuffer(e,e.getCursorStates(),this._inSelectionMode)),e.revealPrimaryCursor(t.source,!0)}}e.CursorTop=dS(new c({inSelectionMode:!1,id:"cursorTop",precondition:void 0,kbOpts:{weight:0,kbExpr:dI.textInputFocus,primary:2062,mac:{primary:2064}}})),e.CursorTopSelect=dS(new c({inSelectionMode:!0,id:"cursorTopSelect",precondition:void 0,kbOpts:{weight:0,kbExpr:dI.textInputFocus,primary:3086,mac:{primary:3088}}}));class u extends cI{constructor(e){super(e),this._inSelectionMode=e.inSelectionMode}runCoreEditorCommand(e,t){e.model.pushStackElement(),e.setCursorStates(t.source,3,YN.moveToEndOfBuffer(e,e.getCursorStates(),this._inSelectionMode)),e.revealPrimaryCursor(t.source,!0)}}e.CursorBottom=dS(new u({inSelectionMode:!1,id:"cursorBottom",precondition:void 0,kbOpts:{weight:0,kbExpr:dI.textInputFocus,primary:2061,mac:{primary:2066}}})),e.CursorBottomSelect=dS(new u({inSelectionMode:!0,id:"cursorBottomSelect",precondition:void 0,kbOpts:{weight:0,kbExpr:dI.textInputFocus,primary:3085,mac:{primary:3090}}}));class g extends cI{constructor(){super({id:"editorScroll",precondition:void 0,description:uI.description})}runCoreEditorCommand(e,t){const i=uI.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,[YN.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=dS(new g),e.ScrollLineUp=dS(new class extends cI{constructor(){super({id:"scrollLineUp",precondition:void 0,kbOpts:{weight:0,kbExpr:dI.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=dS(new class extends cI{constructor(){super({id:"scrollPageUp",precondition:void 0,kbOpts:{weight:0,kbExpr:dI.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=dS(new class extends cI{constructor(){super({id:"scrollLineDown",precondition:void 0,kbOpts:{weight:0,kbExpr:dI.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=dS(new class extends cI{constructor(){super({id:"scrollPageDown",precondition:void 0,kbOpts:{weight:0,kbExpr:dI.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 cI{constructor(e){super(e),this._inSelectionMode=e.inSelectionMode}runCoreEditorCommand(e,t){e.model.pushStackElement(),e.setCursorStates(t.source,3,[YN.word(e,e.getPrimaryCursorState(),this._inSelectionMode,t.position)]),e.revealPrimaryCursor(t.source,!0)}}e.WordSelect=dS(new p({inSelectionMode:!1,id:"_wordSelect",precondition:void 0})),e.WordSelectDrag=dS(new p({inSelectionMode:!0,id:"_wordSelectDrag",precondition:void 0})),e.LastCursorWordSelect=dS(new class extends cI{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]=YN.word(e,s,s.modelState.hasSelection(),t.position),e.model.pushStackElement(),e.setCursorStates(t.source,3,o)}});class m extends cI{constructor(e){super(e),this._inSelectionMode=e.inSelectionMode}runCoreEditorCommand(e,t){e.model.pushStackElement(),e.setCursorStates(t.source,3,[YN.line(e,e.getPrimaryCursorState(),this._inSelectionMode,t.position,t.viewPosition)]),e.revealPrimaryCursor(t.source,!1)}}e.LineSelect=dS(new m({inSelectionMode:!1,id:"_lineSelect",precondition:void 0})),e.LineSelectDrag=dS(new m({inSelectionMode:!0,id:"_lineSelectDrag",precondition:void 0}));class f extends cI{constructor(e){super(e),this._inSelectionMode=e.inSelectionMode}runCoreEditorCommand(e,t){const i=e.getLastAddedCursorIndex(),n=e.getCursorStates(),o=n.slice(0);o[i]=YN.line(e,n[i],this._inSelectionMode,t.position,t.viewPosition),e.model.pushStackElement(),e.setCursorStates(t.source,3,o)}}e.LastCursorLineSelect=dS(new f({inSelectionMode:!1,id:"lastCursorLineSelect",precondition:void 0})),e.LastCursorLineSelectDrag=dS(new f({inSelectionMode:!0,id:"lastCursorLineSelectDrag",precondition:void 0})),e.CancelSelection=dS(new class extends cI{constructor(){super({id:"cancelSelection",precondition:dI.hasNonEmptySelection,kbOpts:{weight:0,kbExpr:dI.textInputFocus,primary:9,secondary:[1033]}})}runCoreEditorCommand(e,t){e.model.pushStackElement(),e.setCursorStates(t.source,3,[YN.cancelSelection(e,e.getPrimaryCursorState())]),e.revealPrimaryCursor(t.source,!0)}}),e.RemoveSecondaryCursors=dS(new class extends cI{constructor(){super({id:"removeSecondaryCursors",precondition:dI.hasMultipleSelections,kbOpts:{weight:1,kbExpr:dI.textInputFocus,primary:9,secondary:[1033]}})}runCoreEditorCommand(e,t){e.model.pushStackElement(),e.setCursorStates(t.source,3,[e.getPrimaryCursorState()]),e.revealPrimaryCursor(t.source,!0),Kw($m(0,"Removed secondary cursors"))}}),e.RevealLine=dS(new class extends cI{constructor(){super({id:"revealLine",precondition:void 0,description:pI.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 pI.RawAtArgument.Top:a=3;break;case pI.RawAtArgument.Center:a=1;break;case pI.RawAtArgument.Bottom:a=4}const l=e.coordinatesConverter.convertModelRangeToViewRange(r);e.revealRange(t.source,!1,l,a,0)}}),e.SelectAll=new class extends _I{constructor(){super(CS)}runDOMCommand(){Rf&&(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,[YN.selectAll(e,e.getPrimaryCursorState())])}},e.SetSelection=dS(new class extends cI{constructor(){super({id:"setSelection",precondition:void 0})}runCoreEditorCommand(e,t){e.model.pushStackElement(),e.setCursorStates(t.source,3,[MN.fromModelSelection(t.selection)])}})}(fI||(fI={}));const vI=ry.and(dI.textInputFocus,dI.columnSelection);function bI(e,t){Jy.registerKeybindingRule({id:e,primary:t,when:vI,weight:1})}function CI(e){return e.register(),e}var wI,yI;bI(fI.CursorColumnSelectLeft.id,1039),bI(fI.CursorColumnSelectRight.id,1041),bI(fI.CursorColumnSelectUp.id,1040),bI(fI.CursorColumnSelectPageUp.id,1035),bI(fI.CursorColumnSelectDown.id,1042),bI(fI.CursorColumnSelectPageDown.id,1036),function(e){class t extends sS{runEditorCommand(e,t,i){const n=t._getViewModel();n&&this.runCoreEditingCommand(t,n,i||{})}}e.CoreEditingCommand=t,e.LineBreakInsert=dS(new class extends t{constructor(){super({id:"lineBreakInsert",precondition:dI.writable,kbOpts:{weight:0,kbExpr:dI.textInputFocus,primary:0,mac:{primary:301}}})}runCoreEditingCommand(e,t,i){e.pushUndoStop(),e.executeCommands(this.id,nI.lineBreakInsert(t.cursorConfig,t.model,t.getCursorStates().map((e=>e.modelState.selection))))}}),e.Outdent=dS(new class extends t{constructor(){super({id:"outdent",precondition:dI.writable,kbOpts:{weight:0,kbExpr:ry.and(dI.editorTextFocus,dI.tabDoesNotMoveFocus),primary:1026}})}runCoreEditingCommand(e,t,i){e.pushUndoStop(),e.executeCommands(this.id,nI.outdent(t.cursorConfig,t.model,t.getCursorStates().map((e=>e.modelState.selection)))),e.pushUndoStop()}}),e.Tab=dS(new class extends t{constructor(){super({id:"tab",precondition:dI.writable,kbOpts:{weight:0,kbExpr:ry.and(dI.editorTextFocus,dI.tabDoesNotMoveFocus),primary:2}})}runCoreEditingCommand(e,t,i){e.pushUndoStop(),e.executeCommands(this.id,nI.tab(t.cursorConfig,t.model,t.getCursorStates().map((e=>e.modelState.selection)))),e.pushUndoStop()}}),e.DeleteLeft=dS(new class extends t{constructor(){super({id:"deleteLeft",precondition:void 0,kbOpts:{weight:0,kbExpr:dI.textInputFocus,primary:1,secondary:[1025],mac:{primary:1,secondary:[1025,294,257]}}})}runCoreEditingCommand(e,t,i){const[n,o]=KN.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=dS(new class extends t{constructor(){super({id:"deleteRight",precondition:void 0,kbOpts:{weight:0,kbExpr:dI.textInputFocus,primary:20,mac:{primary:20,secondary:[290,276]}}})}runCoreEditingCommand(e,t,i){const[n,o]=KN.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 _I{constructor(){super(vS)}runDOMCommand(){document.execCommand("undo")}runEditorCommand(e,t,i){if(t.hasModel()&&!0!==t.getOption(81))return t.getModel().undo()}},e.Redo=new class extends _I{constructor(){super(bS)}runDOMCommand(){document.execCommand("redo")}runEditorCommand(e,t,i){if(t.hasModel()&&!0!==t.getOption(81))return t.getModel().redo()}}}(wI||(wI={}));class SI extends iS{constructor(e,t,i){super({id:e,precondition:void 0,description:i}),this._handlerId=t}runCommand(e,t){const i=e.get(r_).getFocusedCodeEditor();i&&i.trigger("keyboard",this._handlerId,t)}}function xI(e,t){CI(new SI("default:"+e,e)),CI(new SI(e,e,t))}xI("type",{description:"Type",args:[{name:"args",schema:{type:"object",required:["text"],properties:{text:{type:"string"}}}}]}),xI("replacePreviousChar"),xI("compositionType"),xI("compositionStart"),xI("compositionEnd"),xI("paste"),xI("cut");class kI{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){fI.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){fI.MoveTo.runCoreEditorCommand(this.viewModel,this._usualArgs(e))}_moveToSelect(e){fI.MoveToSelect.runCoreEditorCommand(this.viewModel,this._usualArgs(e))}_columnSelect(e,t,i){e=this._validateViewColumn(e),fI.ColumnSelect.runCoreEditorCommand(this.viewModel,{source:"mouse",position:this._convertViewToModelPosition(e),viewPosition:e,mouseColumn:t,doColumnSelect:i})}_createCursor(e,t){e=this._validateViewColumn(e),fI.CreateCursor.runCoreEditorCommand(this.viewModel,{source:"mouse",position:this._convertViewToModelPosition(e),viewPosition:e,wholeLine:t})}_lastCursorMoveToSelect(e){fI.LastCursorMoveToSelect.runCoreEditorCommand(this.viewModel,this._usualArgs(e))}_wordSelect(e){fI.WordSelect.runCoreEditorCommand(this.viewModel,this._usualArgs(e))}_wordSelectDrag(e){fI.WordSelectDrag.runCoreEditorCommand(this.viewModel,this._usualArgs(e))}_lastCursorWordSelect(e){fI.LastCursorWordSelect.runCoreEditorCommand(this.viewModel,this._usualArgs(e))}_lineSelect(e){fI.LineSelect.runCoreEditorCommand(this.viewModel,this._usualArgs(e))}_lineSelectDrag(e){fI.LineSelectDrag.runCoreEditorCommand(this.viewModel,this._usualArgs(e))}_lastCursorLineSelect(e){fI.LastCursorLineSelect.runCoreEditorCommand(this.viewModel,this._usualArgs(e))}_lastCursorLineSelectDrag(e){fI.LastCursorLineSelectDrag.runCoreEditorCommand(this.viewModel,this._usualArgs(e))}_selectAll(){fI.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 LI{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 LI.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 DI{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 h=0;h<i;h++)s[h]=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 EI{constructor(e){this._host=e,this.domNode=this._createDomNode(),this._linesCollection=new DI((()=>this._host.createVisibleLine()))}_createDomNode(){const e=$f(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 NI(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 NI{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){NI._ttPolicy&&(i=NI._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");NI._ttPolicy&&(t=NI._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=NI._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)}}}NI._ttPolicy=null===(yI=window.trustedTypes)||void 0===yI?void 0:yI.createPolicy("editorViewLayer",{createHTML:e=>e}),NI._sb=P_(1e5);class II extends ED{constructor(e){super(e),this._visibleLines=new EI(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 TI(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 TI{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=$f(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 MI extends II{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 OI extends II{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),Kf(this.domNode,t.get(44))}onConfigurationChanged(e){const t=this._context.configuration.options;Kf(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 AI{constructor(e,t){this._coordinateBrand=void 0,this.top=e,this.left=t}}class RI extends ED{constructor(e,t){super(e),this._viewDomNode=t,this._widgets={},this.domNode=$f(document.createElement("div")),ND.write(this.domNode,1),this.domNode.setClassName("contentWidgets"),this.domNode.setPosition("absolute"),this.domNode.setTop(0),this.overflowingContentWidgetsDomNode=$f(document.createElement("div")),ND.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 PI(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 PI{constructor(e,t,i){this._context=e,this._viewDomNode=t,this._actual=i,this.domNode=$f(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,h=a,c=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:c,belowTop:h,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-ow.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=nw(this._viewDomNode.domNode),l=a.top+s-ow.scrollY,d=a.top+r-ow.scrollY,h=JC(document.body),[c,u]=this._layoutHorizontalSegmentInPage(h,a,e.left-o.scrollLeft+this._contentLeft,i),[g,p]=this._layoutHorizontalSegmentInPage(h,a,t.left-o.scrollLeft+this._contentLeft,i),m=l>=22,f=d+n<=h.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:c,fitsBelow:f,belowTop:r,belowLeft:g}}_prepareRenderWidgetAtExactPositionOverflowing(e){return new AI(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 AI(r,o),l=e.getVerticalOffsetForLineNumber(n.lineNumber)-e.scrollTop;return[a,new AI(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=FI(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 AI(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 AI(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&&FI(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&&FI(this._actual.afterRender,this._actual,this._renderData.position)}}function FI(e,t,...i){try{return e.call(t,...i)}catch(n){return null}}class BI extends LE{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 VI extends BI{_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 WI extends BI{_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()}}zy(((e,t)=>{const i=e.getColor(DE);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(EE)){const i=e.getColor(EE);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 HI extends LE{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 h=d.options.className,c=Boolean(d.options.showIfCollapsed);let u=d.range;c&&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===h&&r===c&&qo.areIntersectingOrTouching(a,u)?a=qo.plusRange(a,u):(null!==s&&this._renderNormalDecoration(e,a,s,r,n,o,i),s=h,r=c,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 MD(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 zI extends Uo{onclick(e,t){this._register(BC(e,yw.CLICK,(e=>t(new EC(e)))))}onmousedown(e,t){this._register(BC(e,yw.MOUSE_DOWN,(e=>t(new EC(e)))))}onmouseover(e,t){this._register(BC(e,yw.MOUSE_OVER,(e=>t(new EC(e)))))}onnonbubblingmouseout(e,t){this._register(jC(e,(e=>t(new EC(e)))))}onkeydown(e,t){this._register(BC(e,yw.KEY_DOWN,(e=>t(new SC(e)))))}onkeyup(e,t){this._register(BC(e,yw.KEY_UP,(e=>t(new SC(e)))))}oninput(e,t){this._register(BC(e,yw.INPUT,t))}onblur(e,t){this._register(BC(e,yw.BLUR,t))}onfocus(e,t){this._register(BC(e,yw.FOCUS,t))}ignoreGesture(e){$S.ignoreTarget(e)}}class jI extends zI{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 qS),this.onmousedown(this.bgDomNode,(e=>this._arrowMouseDown(e))),this.onmousedown(this.domNode,(e=>this._arrowMouseDown(e))),this._mousedownRepeatTimer=this._register(new Wv),this._mousedownScheduleRepeatTimer=this._register(new Vv)}_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,KS,(e=>{}),(()=>{this._mousedownRepeatTimer.cancel(),this._mousedownScheduleRepeatTimer.cancel()})),e.preventDefault()}}class UI 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 Vv)}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 $I extends zI{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 UI(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._mouseMoveMonitor=this._register(new qS),this._shouldRender=!0,this.domNode=$f(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 jI(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,i,n){this.slider=$f(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=nw(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,KS,(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 KI{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 KI(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),h=o*d;return{computedAvailableSize:Math.round(s),computedIsNeeded:a,computedSliderSize:Math.round(l),computedSliderRatio:d,computedSliderPosition:Math.round(h)}}_refreshComputedValues(){const e=KI._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 qI extends $I{constructor(e,t,i){const n=e.getScrollDimensions(),o=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:i,scrollbarState:new KI(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-11)/2,i=(t.horizontalScrollbarSize-11)/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 NC(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 NC(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 GI extends $I{constructor(e,t,i){const n=e.getScrollDimensions(),o=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:i,scrollbarState:new KI(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-11)/2,i=(t.verticalScrollbarSize-11)/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 NC(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 NC(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 ZI{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 ZI(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 ZI(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 YI 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 ZI(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 JI(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=JI.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 XI{constructor(e,t,i){this.scrollLeft=e,this.scrollTop=t,this.isDone=i}}function QI(e,t){const i=t-e;return function(t){return e+i*(1-function(e){return Math.pow(e,3)}(1-t))}}class JI{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 r,a;return e<t?(r=e+.75*i,a=t-.75*i):(r=e-.75*i,a=t+.75*i),n=QI(e,r),o=QI(a,t),s=.33,function(e){return e<s?n(e/s):o((e-s)/(1-s))}}var n,o,s;return QI(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 XI(e,i,!1)}return new XI(this.to.scrollLeft,this.to.scrollTop,!0)}combine(e,t,i){return JI.start(e,t,i)}static start(e,t,i){i+=10;const n=Date.now()-10;return new JI(e,t,n,i)}}class eT{constructor(e,t,i){this.timestamp=e,this.deltaX=t,this.deltaY=i,this.score=0}}class tT{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 eT(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}}tT.INSTANCE=new tT;class iT extends zI{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,Ho&&(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 GI(this._scrollable,this._options,n)),this._horizontalScrollbar=this._register(new qI(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=$f(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=$f(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=$f(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 Vv),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,Ho&&(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 NC(e))};this._mouseWheelToDispose.push(BC(this._listenOnDomNode,yw.MOUSE_WHEEL,e,{passive:!1}))}}_onMouseWheel(e){const t=tT.INSTANCE;{const i=window.devicePixelRatio/Of();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=!Ho&&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 nT extends iT{constructor(e,t){(t=t||{}).mouseWheelSmoothScroll=!1;const i=new YI({forceIntegerValues:!0,smoothScrollDuration:0,scheduleAtNextAnimationFrame:e=>KC(e)});super(e,t,i),this._register(i)}setScrollPosition(e){this._scrollable.setScrollPositionNow(e)}}class oT extends iT{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 sT extends iT{constructor(e,t){(t=t||{}).mouseWheelSmoothScroll=!1;const i=new YI({forceIntegerValues:!1,smoothScrollDuration:0,scheduleAtNextAnimationFrame:e=>KC(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 rT extends ED{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 "+Vy(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 oT(t.domNode,d,this._context.viewLayout.getScrollable())),ND.write(this.scrollbar.getDomNode(),5),this.scrollbarDomNode=$f(this.scrollbar.getDomNode()),this.scrollbarDomNode.setPosition("absolute"),this._setLayout();const h=(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(BC(i.domNode,"scroll",(e=>h(i.domNode,!0,!0)))),this._register(BC(t.domNode,"scroll",(e=>h(t.domNode,!0,!1)))),this._register(BC(n.domNode,"scroll",(e=>h(n.domNode,!0,!1)))),this._register(BC(this.scrollbarDomNode.domNode,"scroll",(e=>h(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 "+Vy(this._context.theme.type)),!0}prepareRender(e){}render(e){this.scrollbar.renderNow()}}zy(((e,t)=>{const i=e.getColor(Vx);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(Wx);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(Hx);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(zx);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 aT{constructor(e,t,i){this._decorationToRenderBrand=void 0,this.startLineNumber=+e,this.endLineNumber=+t,this.className=String(i)}}class lT extends LE{_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 h=Math.min(a.endLineNumber,t)-e;o===l?(d=Math.max(s+1,d),s=Math.max(s,h)):(o=l,s=h);for(let e=d;e<=s;e++)n[e].push(o)}return n}}class dT extends lT{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 aT(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 hT,cT;function uT(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}(cT=hT||(hT={}))[cT.Disabled=0]="Disabled",cT[cT.EnabledForActive=1]="EnabledForActive",cT[cT.Enabled=2]="Enabled";class gT{constructor(e,t,i){this.visibleColumn=e,this.className=t,this.horizontalLine=i}}class pT{constructor(e,t){this.top=e,this.endColumn=t}}class mT 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 uT(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 h=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 c=-2,u=-1,g=-2,p=-1;const m=e=>{if(-2===c){c=-1,u=-1;for(let t=e-2;t>=0;t--){const e=this._computeIndentLevel(t);if(e>=0){c=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,C=0,w=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)):(h(o),g=this._getIndentLevelForWhitespaceLine(s,a,d))}let S=-1;if(b&&r<=n){const e=this._computeIndentLevel(r-1);e>=0?(c=r-1,u=e,S=Math.ceil(e/this.textModel.getOptions().indentSize)):(m(r),S=this._getIndentLevelForWhitespaceLine(s,u,p))}if(0!==y){if(1===y){if(r<=n&&S>=0&&w+1===S){_=!1,f=r,v=r,C=S;continue}if(o>=1&&g>=0&&g-1===w){b=!1,f=o,v=o,C=g;continue}if(f=e,v=e,C=w,0===C)return{startLineNumber:f,endLineNumber:v,indent:C}}_&&(g>=C?f=o:_=!1),b&&(S>=C?v=r:b=!1)}else w=g}return{startLineNumber:f,endLineNumber:v,indent:C}}getLinesBracketGuides(e,t,i,n){var o,s,r,a,l;const d=[],h=this.textModel.bracketPairs.getBracketPairsInRangeWithMinIndentation(new qo(e,1,t,this.textModel.getLineMaxColumn(t)));let c;if(i&&h.length>0){const n=e<=i.lineNumber&&i.lineNumber<=t?h.filter((e=>qo.strictContainsPosition(e.range,i))):this.textModel.bracketPairs.getBracketPairsInRange(qo.fromPositions(i));c=null===(o=Cr(n,(e=>e.range.startLineNumber!==e.range.endLineNumber)))||void 0===o?void 0:o.range}const u=new wr(h),g=new Array,p=new Array,m=new fT;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){Ss(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=c&&i.bracketPair.range.equalsRange(c),o=m.getInlineClassNameOfLevel(i.nestingLevel)+(n.highlightActive&&t?" "+m.activeClassName:"");(t&&n.horizontalGuides!==hT.Disabled||n.includeInactive&&n.horizontalGuides===hT.Enabled)&&(i.start.lineNumber===f&&i.guideVisibleColumn<i.visibleStartColumn&&e.push(new gT(i.guideVisibleColumn,o,new pT(!1,i.start.column))),i.end.lineNumber===f+1&&i.guideVisibleColumn<i.visibleEndColumn&&p.push(new gT(i.guideVisibleColumn,o,new pT(!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&&c&&o.bracketPair.range.equalsRange(c),r=m.getInlineClassNameOfLevel(o.nestingLevel)+(s?" "+m.activeClassName:"");(s||n.includeInactive)&&o.renderHorizontalEndLineAtTheBottom&&o.end.lineNumber===f+1&&p.push(new gT(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 gT(o.guideVisibleColumn,r,null))))}e.sort(((e,t)=>e.visibleColumn-t.visibleColumn))}return d}getVisibleColumnFromPosition(e){return GD.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,h=-1;for(let c=e;c<=t;c++){const t=c-e,o=this._computeIndentLevel(c-1);if(o>=0)a=c-1,l=o,r[t]=Math.ceil(o/n.indentSize);else{if(-2===a){a=-1,l=-1;for(let e=c-2;e>=0;e--){const t=this._computeIndentLevel(e);if(t>=0){a=e,l=t;break}}}if(-1!==d&&(-2===d||d<c-1)){d=-1,h=-1;for(let e=c;e<i;e++){const t=this._computeIndentLevel(e);if(t>=0){d=e,h=t;break}}}r[t]=this._getIndentLevelForWhitespaceLine(s,l,h)}}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 fT{constructor(){this.activeClassName="indent-active"}getInlineClassNameOfLevel(e){return"bracket-indent-guide lvl-"+e%30}}class _T extends LE{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,h=this.getGuidesByLine(s,r,d),c=[];for(let u=s;u<=r;u++){const r=u-s,d=h[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>`}c[r]=g}this._renderResult=c}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?hT.Enabled:"active"===this._bracketPairGuideOptions.bracketPairsHorizontal?hT.EnabledForActive:hT.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 h=e;h<=t;h++){const t=new Array;d.push(t);const i=n?n[h-e]:[],c=new wr(i),u=o?o[h-e]:[];for(let e=1;e<=u;e++){const n=(e-1)*l+1,o=0===i.length&&s<=h&&h<=r&&e===a;t.push(...c.takeWhile((e=>e.visibleColumn<n))||[]);const d=c.peek();d&&d.visibleColumn===n&&!d.horizontalLine||t.push(new gT(n,o?"core-guide-indent-active":"core-guide-indent",null))}t.push(...c.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 vT(e){if(!e||!e.isTransparent())return e}zy(((e,t)=>{const i=e.getColor(PE);i&&t.addRule(`.monaco-editor .lines-content .core-guide-indent { box-shadow: 1px 0 0 0 ${i} inset; }`);const n=e.getColor(FE)||i;n&&t.addRule(`.monaco-editor .lines-content .core-guide-indent-active { box-shadow: 1px 0 0 0 ${n} inset; }`);const o=[{bracketColor:nN,guideColor:hN,guideColorActive:fN},{bracketColor:oN,guideColor:cN,guideColorActive:_N},{bracketColor:sN,guideColor:uN,guideColorActive:vN},{bracketColor:rN,guideColor:gN,guideColorActive:bN},{bracketColor:aN,guideColor:pN,guideColorActive:CN},{bracketColor:lN,guideColor:mN,guideColorActive:wN}],s=new fT,r=o.map((t=>{var i,n;const o=e.getColor(t.bracketColor),s=e.getColor(t.guideColor),r=e.getColor(t.guideColorActive),a=vT(null!==(i=vT(s))&&void 0!==i?i:null==o?void 0:o.transparent(.3)),l=vT(null!==(n=vT(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 bT{constructor(){this._currentVisibleRange=new qo(1,1,1,1)}getCurrentVisibleRange(){return this._currentVisibleRange}setCurrentVisibleRange(e){this._currentVisibleRange=e}}class CT{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 wT{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 yT extends ED{constructor(e,t){super(e),this._linesContent=t,this._textRangeRestingSpot=document.createElement("div"),this._visibleLines=new EI(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 WD(i,this._context.theme.type),ND.write(this.domNode,7),this.domNode.setClassName("view-lines monaco-mouse-cursor-text"),Kf(this.domNode,o),this._maxLineWidth=0,this._asyncUpdateLineWidths=new Hv((()=>{this._updateLineWidthsSlow()}),200),this._asyncCheckMonospaceFontAssumptions=new Hv((()=>{this._checkMonospaceFontAssumptions()}),2e3),this._lastRenderedData=new bT,this._horizontalRevealRequest=null}dispose(){this._asyncUpdateLineWidths.dispose(),this._asyncCheckMonospaceFontAssumptions.dispose(),super.dispose()}getDomNode(){return this.domNode}createVisibleLine(){return new HD(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),Kf(this.domNode,i),this._onOptionsMaybeChanged(),e.hasChanged(131)&&(this._maxLineWidth=0),!0}_onOptionsMaybeChanged(){const e=this._context.configuration,t=new WD(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 CT(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 wT(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===HD.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 VD(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 h=n.startLineNumber;h<=n.endLineNumber;h++){if(h<l||h>d)continue;const e=h===n.startLineNumber?n.startColumn:1,c=h===n.endLineNumber?n.endColumn:this._context.viewModel.getLineMaxColumn(h),u=this._visibleLines.getVisibleLine(h).getVisibleRangesForRange(h,e,c,r);if(u){if(t&&h<i){const e=a;a=this._context.viewModel.coordinatesConverter.convertViewPositionToModelPosition(new er(h+1,1)).lineNumber,e!==a&&(u.ranges[u.ranges.length-1].width+=this._typicalHalfwidthCharacterWidth)}o[s++]=new TD(u.outsideRenderedLine,h,MD.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 VD(this.domNode.domNode,this._textRangeRestingSpot))}visibleRangeForPosition(e){const t=this._visibleRangesForLineRange(e.lineNumber,e.column,e.column);return t?new AD(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,h,c;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,h=this._context.viewLayout.getVerticalOffsetForLineNumber(e),c=this._context.viewLayout.getVerticalOffsetForLineNumber(t)+this._lineHeight}else{if(!n)return-1;d=!0,h=this._context.viewLayout.getVerticalOffsetForLineNumber(n.startLineNumber),c=this._context.viewLayout.getVerticalOffsetForLineNumber(n.endLineNumber)+this._lineHeight}if(("mouse"===t||i)&&"default"===this._cursorSurroundingLinesStyle)i||(h-=this._lineHeight);else{const e=Math.min(a/this._lineHeight/2,this._cursorSurroundingLines);h-=e*this._lineHeight,c+=Math.max(0,e-1)*this._lineHeight}let u;if(0!==s&&4!==s||(c+=i?this._horizontalScrollbarHeight:this._lineHeight),c-h>a){if(!d)return-1;u=h}else if(5===s||6===s)if(6===s&&r<=h&&c<=l)u=r;else{const e=h-Math.max(5*this._lineHeight,.2*a),t=c-a;u=Math.max(t,e)}else if(1===s||2===s)if(2===s&&r<=h&&c<=l)u=r;else{const e=(h+c)/2;u=Math.max(0,e-a/2)}else u=this._computeMinimumScrolling(r,l,h,c,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-yT.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}}yT.HORIZONTAL_EXTRA_PX=30;class ST extends lT{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 aT(e.range.startLineNumber,e.range.endLineNumber,s));const r=e.options.firstLineDecorationClassName;r&&(i[n++]=new aT(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 xT extends lT{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 aT(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 kT{constructor(e,t,i,n){this._rgba8Brand=void 0,this.r=kT._clamp(e),this.g=kT._clamp(t),this.b=kT._clamp(i),this.a=kT._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}}kT.Empty=new kT(0,0,0,0);class LT extends Uo{constructor(){super(),this._onDidChange=new $o,this.onDidChange=this._onDidChange.event,this._updateColorMap(),this._register(Es.onDidChange((e=>{e.changedColorMap&&this._updateColorMap()})))}static getInstance(){return this._INSTANCE||(this._INSTANCE=Sr(new LT)),this._INSTANCE}_updateColorMap(){const e=Es.getColorMap();if(!e)return this._colors=[kT.Empty],void(this._backgroundIsLight=!0);this._colors=[kT.Empty];for(let i=1;i<e.length;i++){const t=e[i].rgba;this._colors[i]=new kT(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}}LT._INSTANCE=null;const DT=(()=>{const e=[];for(let t=32;t<=126;t++)e.push(t);return e.push(65533),e})();class ET{constructor(e,t){this.scale=t,this._minimapCharRendererBrand=void 0,this.charDataNormal=ET.soften(e,.8),this.charDataLight=ET.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]=xr(e[n]*t);return i}renderChar(e,t,i,n,o,s,r,a,l,d,h){const c=1*this.scale,u=2*this.scale,g=h?1:u;if(t+c>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,C=o.r-_,w=o.g-v,y=o.b-b,S=Math.max(s,a),x=e.data;let k=m*c*u,L=i*f+4*t;for(let D=0;D<g;D++){let e=L;for(let t=0;t<c;t++){const t=p[k++]/255*(s/255);x[e++]=_+C*t,x[e++]=v+w*t,x[e++]=b+y*t,x[e++]=S}L+=f}}blockRenderChar(e,t,i,n,o,s,r,a){const l=1*this.scale,d=2*this.scale,h=a?1:d;if(t+l>e.width||i+h>e.height)return;const c=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),C=e.data;let w=i*c+4*t;for(let y=0;y<h;y++){let e=w;for(let t=0;t<l;t++)C[e++]=f,C[e++]=_,C[e++]=v,C[e++]=b;w+=c}}}const NT={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},IT=e=>{const t=new Uint8ClampedArray(e.length/2);for(let i=0;i<e.length;i+=2)t[i>>1]=NT[e[i]]<<4|15&NT[e[i+1]];return t},TT={1:kr((()=>IT("0000511D6300CF609C709645A78432005642574171487021003C451900274D35D762755E8B629C5BA856AF57BA649530C167D1512A272A3F6038604460398526BCA2A968DB6F8957C768BE5FBE2FB467CF5D8D5B795DC7625B5DFF50DE64C466DB2FC47CD860A65E9A2EB96CB54CE06DA763AB2EA26860524D3763536601005116008177A8705E53AB738E6A982F88BAA35B5F5B626D9C636B449B737E5B7B678598869A662F6B5B8542706C704C80736A607578685B70594A49715A4522E792"))),2:kr((()=>IT("000000000000000055394F383D2800008B8B1F210002000081B1CBCBCC820000847AAF6B9AAF2119BE08B8881AD60000A44FD07DCCF107015338130C00000000385972265F390B406E2437634B4B48031B12B8A0847000001E15B29A402F0000000000004B33460B00007A752C2A0000000000004D3900000084394B82013400ABA5CFC7AD9C0302A45A3E5A98AB000089A43382D97900008BA54AA087A70A0248A6A7AE6DBE0000BF6F94987EA40A01A06DCFA7A7A9030496C32F77891D0000A99FB1A0AFA80603B29AB9CA75930D010C0948354D3900000C0948354F37460D0028BE673D8400000000AF9D7B6E00002B007AA8933400007AA642675C2700007984CFB9C3985B768772A8A6B7B20000CAAECAAFC4B700009F94A6009F840009D09F9BA4CA9C0000CC8FC76DC87F0000C991C472A2000000A894A48CA7B501079BA2C9C69BA20000B19A5D3FA89000005CA6009DA2960901B0A7F0669FB200009D009E00B7890000DAD0F5D092820000D294D4C48BD10000B5A7A4A3B1A50402CAB6CBA6A2000000B5A7A4A3B1A8044FCDADD19D9CB00000B7778F7B8AAE0803C9AB5D3F5D3F00009EA09EA0BAB006039EA0989A8C7900009B9EF4D6B7C00000A9A7816CACA80000ABAC84705D3F000096DA635CDC8C00006F486F266F263D4784006124097B00374F6D2D6D2D6D4A3A95872322000000030000000000008D8939130000000000002E22A5C9CBC70600AB25C0B5C9B400061A2DB04CA67001082AA6BEBEBFC606002321DACBC19E03087AA08B6768380000282FBAC0B8CA7A88AD25BBA5A29900004C396C5894A6000040485A6E356E9442A32CD17EADA70000B4237923628600003E2DE9C1D7B500002F25BBA5A2990000231DB6AFB4A804023025C0B5CAB588062B2CBDBEC0C706882435A75CA20000002326BD6A82A908048B4B9A5A668000002423A09CB4BB060025259C9D8A7900001C1FCAB2C7C700002A2A9387ABA200002626A4A47D6E9D14333163A0C87500004B6F9C2D643A257049364936493647358A34438355497F1A0000A24C1D590000D38DFFBDD4CD3126")))};class MT{static create(e,t){if(this.lastCreated&&e===this.lastCreated.scale&&t===this.lastFontFamily)return this.lastCreated;let i;return i=TT[e]?new ET(TT[e](),e):MT.createFromSampleData(MT.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 DT)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=MT._downsample(e,t);return new ET(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,h=(r+1)/s*10;let c=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<h;t++){const i=1-(t-Math.floor(t)),s=n+4*Math.floor(t),r=i*o;u+=r,c+=e[s]*e[s+3]/255*r}}const g=c/u;l=Math.max(l,g),i[a++]=xr(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 OT{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((()=>MT.create(this.fontScale,a.fontFamily))),this.defaultBackgroundColor=i.getColor(2),this.backgroundColor=OT._getMinimapBackground(t,this.defaultBackgroundColor),this.foregroundAlpha=OT._getMinimapForegroundOpacity(t)}static _getMinimapBackground(e,t){const i=e.getColor(QL);return i?new kT(i.rgba.r,i.rgba.g,i.rgba.b,Math.round(255*i.rgba.a)):t}static _getMinimapForegroundOpacity(e){const t=e.getColor(JL);return t?kT._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 AT{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,h){const c=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),h=l*s,c=n>0,u=Math.floor(e.canvasInnerHeight/e.minimapLineHeight);return new AT(l,d,c,s,h,i,1,Math.min(r,u))}let m,f;if(s&&i!==r){const e=i-t+1;m=Math.floor(e*u/c)}else{const e=o/p;m=Math.floor(e*u/c)}f=e.scrollBeyondLastLine?(r-1)*u/c:Math.max(0,r*u/c-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 AT(l,d,f>0,_,v,m,1,r)}{let e=Math.max(1,Math.floor(t-v*c/u));h&&h.scrollHeight===d&&(h.scrollTop>l&&(e=Math.min(e,h.startLineNumber)),h.scrollTop<l&&(e=Math.max(e,h.startLineNumber)));const i=Math.min(r,e+g-1);return new AT(l,d,!0,_,(t-e+(l-n)/p)*u/c,m,e,i)}}}class RT{constructor(e){this.dy=e}onContentChanged(){this.dy=-1}onTokensChanged(){this.dy=-1}}RT.INVALID=new RT(-1);class PT{constructor(e,t,i){this.renderedLayout=e,this._imageData=t,this._renderedLines=new DI((()=>RT.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 FT{constructor(e,t,i,n){this._backgroundFillData=FT._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 BT{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 BT(a,e),[]]}const d=i.minimapLines,h=d.length,c=[];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<h&&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<h&&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++}c[_]=n,p=n}if(m.length<10)for(;u<h;){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 BT(a,c),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 VT extends ED{constructor(e){super(e),this.tokensColorTracker=LT.getInstance(),this._selections=[],this._minimapSelections=null,this.options=new OT(this._context.configuration,this._context.theme,this.tokensColorTracker);const[t]=BT.compute(this.options,this._context.viewModel.getLineCount(),null);this._samplingState=t,this._shouldCheckSampling=!1,this._actual=new WT(e.theme,this)}dispose(){this._actual.dispose(),super.dispose()}getDomNode(){return this._actual.getDomNode()}_onOptionsMaybeChanged(){const e=new OT(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]=BT.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 Ub(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 WT 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(ZL),this._domNode=$f(document.createElement("div")),ND.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=$f(document.createElement("div")),this._shadow.setClassName("minimap-shadow-hidden"),this._domNode.appendChild(this._shadow),this._canvas=$f(document.createElement("canvas")),this._canvas.setPosition("absolute"),this._canvas.setLeft(0),this._domNode.appendChild(this._canvas),this._decorationsCanvas=$f(document.createElement("canvas")),this._decorationsCanvas.setPosition("absolute"),this._decorationsCanvas.setClassName("minimap-decorations-layer"),this._decorationsCanvas.setLeft(0),this._domNode.appendChild(this._decorationsCanvas),this._slider=$f(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=$f(document.createElement("div")),this._sliderHorizontal.setPosition("absolute"),this._sliderHorizontal.setClassName("minimap-slider-horizontal"),this._slider.appendChild(this._sliderHorizontal),this._applyLayout(),this._mouseDownListener=WC(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=nw(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 qS,this._sliderMouseDownListener=WC(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=$S.addTarget(this._domNode.domNode),this._sliderTouchStartListener=BC(this._domNode.domNode,WS.Start,(e=>{e.preventDefault(),e.stopPropagation(),this._lastRenderData&&(this._slider.toggleClassName("active",!0),this._gestureInProgress=!0,this.scrollDueToTouchEvent(e))}),{passive:!1}),this._sliderTouchMoveListener=BC(this._domNode.domNode,WS.Change,(e=>{e.preventDefault(),e.stopPropagation(),this._lastRenderData&&this._gestureInProgress&&this.scrollDueToTouchEvent(e)}),{passive:!1}),this._sliderTouchEndListener=WC(this._domNode.domNode,WS.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,KS,(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 FT(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(ZL),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=AT.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 HT(e.startLineNumber,e.endLineNumber,!1);this._renderSelectionLineHighlights(l,t,d,e,s),this._renderDecorationsLineHighlights(l,i,d,e,s);const h=new HT(e.startLineNumber,e.endLineNumber,null);this._renderSelectionsHighlights(l,t,h,e,s,a,r,n),this._renderDecorationsHighlights(l,i,h,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,h=(l-n.startLineNumber)*o+o;r>=d||(r>s&&e.fillRect(8,s,e.canvas.width,r-s),s=d),r=h}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!==Lr.Inline)continue;const d=Math.max(n.startLineNumber,a.range.startLineNumber),h=Math.min(n.endLineNumber,a.range.endLineNumber);if(d>h)continue;const c=l.getColor(this._theme.value);if(!c||c.isTransparent())continue;let u=s.get(c.toString());u||(u=c.transparent(.5).toString(),s.set(c.toString(),u)),e.fillStyle=u;for(let t=d;t<=h;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 h=t;h<=d;h++)this.renderDecorationOnLine(e,i,l,this._selectionColor,n,h,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),h=Math.min(n.endLineNumber,l.range.endLineNumber);if(d>h)continue;const c=t.getColor(this._theme.value);if(c&&!c.isTransparent())for(let u=d;u<=h;u++)switch(t.position){case Lr.Inline:this.renderDecorationOnLine(e,i,l.range,c,n,u,o,o,s,r,a);continue;case Lr.Gutter:{const t=(u-n.startLineNumber)*o,i=2;this.renderDecoration(e,c,i,t,2,o);continue}}}}renderDecorationOnLine(e,t,i,n,o,s,r,a,l,d,h){const c=(s-o.startLineNumber)*a;if(c+r<0||c>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,h),_=this.getXOffsetForPosition(t,s,m,l,d,h);this.renderDecoration(e,n,f,c,_-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 PT(e,t.imageData,t.lines)}const o=this._getBuffer();if(!o)return null;const[s,r,a]=WT._renderUntouchedLines(o,t,i,n,this._lastRenderData),l=this._model.getMinimapLinesRenderingData(t,i,a),d=this._model.getOptions().tabSize,h=this._model.options.defaultBackgroundColor,c=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)*_,C=n>b?Math.floor((n-b)/2):0,w=c.a/255,y=new kT(Math.round((c.r-h.r)*w+h.r),Math.round((c.g-h.g)*w+h.g),Math.round((c.b-h.b)*w+h.b),255);let S=0;const x=[];for(let D=0,E=i-t+1;D<E;D++)a[D]&&WT._renderLine(o,y,c.a,p,m,v,g,u,f,S,C,d,l[D],_,n),x[D]=new RT(S),S+=n;const k=-1===s?0:s,L=(-1===r?o.height:r)-k;return this._canvas.domNode.getContext("2d").putImageData(o,0,0,0,k,o.width,L),new PT(e,o,x)}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,h=d.length,c=e.width,u=e.data,g=(i-t+1)*n*c*4;let p=-1,m=-1,f=-1,_=-1,v=-1,b=-1,C=0;for(let w=t;w<=i;w++){const e=w-t,i=w-l,o=i>=0&&i<h?d[i].dy:-1;if(-1===o){s[e]=!0,C+=n;continue}const r=o*c*4,y=(o+n)*c*4,S=C*c*4,x=(C+n)*c*4;_===r&&b===S?(_=y,b=x):(-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=S,b=x),s[e]=!1,C+=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*c),-1===m?-1:m/(4*c),s]}static _renderLine(e,t,i,n,o,s,r,a,l,d,h,c,u,g,p){const m=u.content,f=u.tokens,_=e.width-s,v=1===p;let b=8,C=0,w=0;for(let y=0,S=f.getCount();y<S;y++){const u=f.getEndOffset(y),p=f.getForeground(y),S=r.getColor(p);for(;C<u;C++){if(b>_)return;const r=m.charCodeAt(C);if(9===r){const e=c-(C+w)%c;w+=e-1,b+=e*s}else if(32===r)b+=s;else{const c=ks(r)?2:1;for(let u=0;u<c;u++)if(2===o?l.blockRenderChar(e,b,d+h,S,a,t,i,v):l.renderChar(e,b,d+h,r,S,a,t,i,g,n,v),b+=s,b>_)return}}}}}class HT{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]}}zy(((e,t)=>{const i=e.getColor(eD);i&&t.addRule(`.monaco-editor .minimap-slider .minimap-slider-horizontal { background: ${i}; }`);const n=e.getColor(tD);n&&t.addRule(`.monaco-editor .minimap-slider:hover .minimap-slider-horizontal { background: ${n}; }`);const o=e.getColor(iD);o&&t.addRule(`.monaco-editor .minimap-slider.active .minimap-slider-horizontal { background: ${o}; }`);const s=e.getColor(Vx);s&&t.addRule(`.monaco-editor .minimap-shadow-visible { box-shadow: ${s} -6px 0 6px -6px inset; }`)}));class zT extends ED{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=$f(document.createElement("div")),ND.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=$f(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(UE);this.borderColor=n?n.toString():null,this.hideCursor=i.get(52);const o=t.getColor(OE);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($E)||Es.getDefaultBackground():null;this.backgroundColor=null===l||"left"===a?null:QS.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[h,c]=this._initLanes(1,this.canvasWidth,this.overviewRulerLanes);this.x=h,this.w=c}_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 UT extends ED{constructor(e){super(e),this._domNode=$f(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=Es.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,h=this._settings.w;s.sort($b.cmp);for(const c of s){const e=c.color,s=c.data;l.fillStyle=e;let u=0,g=0,p=0;for(let c=0,m=s.length/3;c<m;c++){const e=s[3*c],m=s[3*c+1],f=s[3*c+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!==c&&l.fillRect(d[u],g,h[u],p-g),u=e,g=_,p=v):v>p&&(p=v)}l.fillRect(d[u],g,h[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 h=0,c=this._cursorPositions.length;h<c;h++){const c=this._cursorPositions[h];let u=n.getVerticalOffsetForLineNumber(c.lineNumber)*o|0;u<i?u=i:u+i>t&&(u=t-i);const g=u-i,p=g+e;g>d+1?(0!==h&&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 $T{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 KT{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 qT{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(KT.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,h=Math.floor(n*l),c=Math.floor(n*d);let u=Math.floor((h+c)/2),g=c-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 $T(u-g,u+g,m);a.setColorZone(f),s.push(f)}return this._colorZonesInvalid=!1,s.sort($T.compare),s}}class GT extends DD{constructor(e,t){super(),this._context=e;const i=this._context.configuration.options;this._domNode=$f(document.createElement("canvas")),this._domNode.setClassName(t),this._domNode.setPosition("absolute"),this._domNode.setLayerHinting(!0),this._domNode.setContain("strict"),this._zoneManager=new qT((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 ZT extends ED{constructor(e){super(e),this.domNode=$f(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=$f(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)}}}zy(((e,t)=>{const i=e.getColor(HE);i&&t.addRule(`.monaco-editor .view-ruler { box-shadow: 1px 0 0 0 ${i} inset; }`)}));class YT extends ED{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=$f(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":"")}}zy(((e,t)=>{const i=e.getColor(Vx);i&&t.addRule(`.monaco-editor .scroll-decoration { box-shadow: ${i} 0 6px 6px -6px inset; }`)}));class XT{constructor(e){this.left=e.left,this.width=e.width,this.startStyle=null,this.endStyle=null}}class QT{constructor(e,t){this.lineNumber=e,this.ranges=t}}function JT(e){return new XT(e)}function eM(e){return new QT(e.lineNumber,e.ranges.map(JT))}class tM extends LE{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},h={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;iM(i-e)<n?d.top=2:i>e&&(d.top=1),iM(l-o)<n?h.top=2:e<l&&l<o&&(h.top=1)}else o&&(d.top=o.startStyle.top,h.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;iM(i-e)<n?d.bottom=2:e<i&&i<o&&(d.bottom=1),iM(l-o)<n?h.bottom=2:l<o&&(h.bottom=1)}else s&&(d.bottom=s.startStyle.bottom,h.bottom=s.endStyle.bottom);e.startStyle=d,e.endStyle=h}}_getVisibleRangesWithStyle(e,t,i){const n=(t.linesVisibleRangesForRange(e,!0)||[]).map(eM);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,h=n.length;d<h;d++){const h=n[d],c=h.lineNumber,u=c-t,g=i&&(c===l||c===a)?r:s,p=i&&c===a?1:0;let m="",f="";for(let e=0,t=h.ranges.length;e<t;e++){const t=h.ranges[e];if(o){const e=t.startStyle,i=t.endStyle;if(1===e.top||1===e.bottom){m+=this._createSelectionPiece(p,g,tM.SELECTION_CLASS_NAME,t.left-tM.ROUNDED_PIECE_WIDTH,tM.ROUNDED_PIECE_WIDTH);let i=tM.EDITOR_BACKGROUND_CLASS_NAME;1===e.top&&(i+=" "+tM.SELECTION_TOP_RIGHT),1===e.bottom&&(i+=" "+tM.SELECTION_BOTTOM_RIGHT),m+=this._createSelectionPiece(p,g,i,t.left-tM.ROUNDED_PIECE_WIDTH,tM.ROUNDED_PIECE_WIDTH)}if(1===i.top||1===i.bottom){m+=this._createSelectionPiece(p,g,tM.SELECTION_CLASS_NAME,t.left+t.width,tM.ROUNDED_PIECE_WIDTH);let e=tM.EDITOR_BACKGROUND_CLASS_NAME;1===i.top&&(e+=" "+tM.SELECTION_TOP_LEFT),1===i.bottom&&(e+=" "+tM.SELECTION_BOTTOM_LEFT),m+=this._createSelectionPiece(p,g,e,t.left+t.width,tM.ROUNDED_PIECE_WIDTH)}}let i=tM.SELECTION_CLASS_NAME;if(o){const e=t.startStyle,n=t.endStyle;0===e.top&&(i+=" "+tM.SELECTION_TOP_LEFT),0===e.bottom&&(i+=" "+tM.SELECTION_BOTTOM_LEFT),0===n.top&&(i+=" "+tM.SELECTION_TOP_RIGHT),0===n.bottom&&(i+=" "+tM.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 iM(e){return e<0?-e:e}tM.SELECTION_CLASS_NAME="selected-text",tM.SELECTION_TOP_LEFT="top-left-radius",tM.SELECTION_BOTTOM_LEFT="bottom-left-radius",tM.SELECTION_TOP_RIGHT="top-right-radius",tM.SELECTION_BOTTOM_RIGHT="bottom-right-radius",tM.EDITOR_BACKGROUND_CLASS_NAME="monaco-editor-background",tM.ROUNDED_PIECE_WIDTH=10,zy(((e,t)=>{const i=e.getColor(fk);i&&t.addRule(`.monaco-editor .focused .selected-text { background-color: ${i}; }`);const n=e.getColor(vk);n&&t.addRule(`.monaco-editor .selected-text { background-color: ${n}; }`);const o=e.getColor(_k);o&&!o.isTransparent()&&t.addRule(`.monaco-editor .view-line span.inline-selected-text { color: ${o}; }`)}));class nM{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 oM{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=$f(document.createElement("div")),this._domNode.setClassName("cursor monaco-mouse-cursor-text"),this._domNode.setHeight(this._lineHeight),this._domNode.setTop(0),this._domNode.setLeft(0),Kf(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),Kf(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]=Dr(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===hf.Line||this._cursorStyle===hf.LineThin){const o=e.visibleRangeForPosition(i);if(!o||o.outsideRenderedLine)return null;let s;this._cursorStyle===hf.Line?(s=Rw(this._lineCursorWidth>0?this._lineCursorWidth:2),s>2&&(t=n)):s=Rw(1);let r=o.left;s>=2&&r>=1&&(r-=1);const a=e.getVerticalOffsetForLineNumber(i.lineNumber)-e.bigNumbersDelta;return new nM(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===hf.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,h=this._lineHeight;return this._cursorStyle!==hf.Underline&&this._cursorStyle!==hf.UnderlineThin||(d+=this._lineHeight-2,h=2),new nM(d,r.left,a,h,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 sM extends ED{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 oM(this._context),this._secondaryCursors=[],this._renderData=[],this._domNode=$f(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 Vv,this._cursorFlatBlinkInterval=new Wv,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 oM(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()}),sM.BLINK_INTERVAL):this._startCursorBlinkAnimation.setIfNotSet((()=>{this._blinkingEnabled=!0,this._updateDomClassName()}),sM.BLINK_INTERVAL))}_updateDomClassName(){this._domNode.setClassName(this._getClassName())}_getClassName(){let e="cursors-layer";switch(this._selectionIsEmpty||(e+=" has-selection"),this._cursorStyle){case hf.Line:e+=" cursor-line-style";break;case hf.Block:e+=" cursor-block-style";break;case hf.Underline:e+=" cursor-underline-style";break;case hf.LineThin:e+=" cursor-line-thin-style";break;case hf.BlockOutline:e+=" cursor-block-outline-style";break;case hf.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}}sM.BLINK_INTERVAL=500,zy(((e,t)=>{const i=e.getColor(OE);if(i){let n=e.getColor(AE);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 rM=()=>{throw new Error("Invalid change accessor")};class aM extends ED{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=$f(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=$f(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=rM,n.removeZone=rM,n.layoutZone=rM})),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:$f(t.domNode),marginDomNode:t.marginDomNode?$f(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 lM{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 dM{constructor(e,t,i){this.configuration=e,this.theme=new lM(t),this.viewModel=i,this.viewLayout=i.viewLayout}addEventHandler(e){this.viewModel.addViewEventHandler(e)}removeEventHandler(e){this.viewModel.removeViewEventHandler(e)}}class hM{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 DD{constructor(e,t,i,n,o,s){super(),this._selections=[new ar(1,1,1,1)],this._renderAnimationFrame=null;const r=new kI(t,n,o,e);this._context=new dM(t,i,n),this._context.addEventHandler(this),this._viewParts=[],this._textAreaHandler=new LN(this._context,r,this._createTextAreaHandlerHelper()),this._viewParts.push(this._textAreaHandler),this._linesContent=$f(document.createElement("div")),this._linesContent.setClassName("lines-content monaco-editor-background"),this._linesContent.setPosition("absolute"),this.domNode=$f(document.createElement("div")),this.domNode.setClassName(this._getEditorClassName()),this.domNode.setAttribute("role","code"),this._overflowGuardContainer=$f(document.createElement("div")),ND.write(this._overflowGuardContainer,3),this._overflowGuardContainer.setClassName("overflow-guard"),this._scrollbar=new rT(this._context,this._linesContent,this.domNode,this._overflowGuardContainer),this._viewParts.push(this._scrollbar),this._viewLines=new yT(this._context,this._linesContent),this._viewZones=new aM(this._context),this._viewParts.push(this._viewZones);const a=new UT(this._context);this._viewParts.push(a);const l=new YT(this._context);this._viewParts.push(l);const d=new MI(this._context);this._viewParts.push(d),d.addDynamicOverlay(new VI(this._context)),d.addDynamicOverlay(new tM(this._context)),d.addDynamicOverlay(new _T(this._context)),d.addDynamicOverlay(new HI(this._context));const h=new OI(this._context);this._viewParts.push(h),h.addDynamicOverlay(new WI(this._context)),h.addDynamicOverlay(new dT(this._context)),h.addDynamicOverlay(new xT(this._context)),h.addDynamicOverlay(new ST(this._context)),h.addDynamicOverlay(new yN(this._context));const c=new SN(this._context);c.getDomNode().appendChild(this._viewZones.marginDomNode),c.getDomNode().appendChild(h.getDomNode()),this._viewParts.push(c),this._contentWidgets=new RI(this._context,this.domNode),this._viewParts.push(this._contentWidgets),this._viewCursors=new sM(this._context),this._viewParts.push(this._viewCursors),this._overlayWidgets=new zT(this._context),this._viewParts.push(this._overlayWidgets);const u=new ZT(this._context);this._viewParts.push(u);const g=new VT(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(c.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 kE(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 JD(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)+" "+Vy(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=$C(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(!PC(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 hM(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 ID(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?LI.convertViewToModelMouseTarget(i,this._context.viewModel.coordinatesConverter):null}createOverviewRuler(e){return new GT(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 uM{constructor(e){this._selTrackedRange=null,this._trackSelection=!0,this._setState(e,new RN(new qo(1,1,1,1),0,new er(1,1),0),new RN(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 MN(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 RN(qo.fromPositions(r,a),t.selectionStartLeftoverVisibleColumns+n.column-r.column,s,t.leftoverVisibleColumns+i.column-s.column)}_setState(e,t,i){if(i&&(i=uM._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 RN(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 RN(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 RN(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 RN(s,t.selectionStartLeftoverVisibleColumns,r,t.leftoverVisibleColumns)}this.modelState=t,this.viewState=i,this._updateTrackedRange(e)}}class gM{constructor(e){this.context=e,this.cursors=[new uM(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 Er(this.cursors,Nr((e=>e.viewState.position),er.compare)).viewState.position}getBottomMostViewPosition(){return Ir(this.cursors,Nr((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(MN.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 uM(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(Nr((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,h=t[s].selection;if(!d.equalsSelection(h)){const i=d.plusRange(h),n=d.selectionStartLineNumber===d.startLineNumber&&d.selectionStartColumn===d.startColumn,o=h.selectionStartLineNumber===h.startLineNumber&&h.selectionStartColumn===h.startColumn;let r,c;a===this.lastAddedCursorIndex?(r=n,this.lastAddedCursorIndex=l):r=o,c=r?new ar(i.startLineNumber,i.startColumn,i.endLineNumber,i.endColumn):new ar(i.endLineNumber,i.endColumn,i.startLineNumber,i.startColumn),t[s].selection=c;const u=MN.fromModelSelection(c);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 pM{constructor(e,t,i,n){this._cursorContextBrand=void 0,this.model=e,this.viewModel=t,this.coordinatesConverter=i,this.cursorConfig=n}}class mM{constructor(){this.changeType=1}}class fM{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 fM(i.ownerId,i.range.startLineNumber,i.range.startColumn,i.options.before,0)),i.options.after&&i.options.after.content.length>0&&t.push(new fM(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 _M{constructor(e,t,i){this.changeType=2,this.lineNumber=e,this.detail=t,this.injectedText=i}}class vM{constructor(e,t){this.changeType=3,this.fromLineNumber=e,this.toLineNumber=t}}class bM{constructor(e,t,i,n){this.changeType=4,this.injectedTexts=n,this.fromLineNumber=e,this.toLineNumber=t,this.detail=i}}class CM{constructor(){this.changeType=5}}class wM{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 wM(i,n,o,s)}}class yM{constructor(e){this.changes=e}}class SM{constructor(e,t){this.rawContentChangedEvent=e,this.contentChangedEvent=t}merge(e){const t=wM.merge(this.rawContentChangedEvent,e.rawContentChangedEvent),i=SM._mergeChangeEvents(this.contentChangedEvent,e.contentChangedEvent);return new SM(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 xM{constructor(){this.type=0}}class kM{constructor(){this.type=1}}class LM{constructor(e){this.type=2,this._source=e}hasChanged(e){return this._source.hasChanged(e)}}class DM{constructor(e,t){this.type=3,this.selections=e,this.modelSelections=t}}class EM{constructor(e){this.type=4,e?(this.affectsMinimap=e.affectsMinimap,this.affectsOverviewRuler=e.affectsOverviewRuler):(this.affectsMinimap=!0,this.affectsOverviewRuler=!0)}}class NM{constructor(){this.type=5}}class IM{constructor(e){this.type=6,this.isFocused=e}}class TM{constructor(){this.type=7}}class MM{constructor(){this.type=8}}class OM{constructor(e,t){this.type=9,this.fromLineNumber=e,this.toLineNumber=t}}class AM{constructor(e,t){this.type=10,this.fromLineNumber=e,this.toLineNumber=t}}class RM{constructor(e,t){this.type=11,this.fromLineNumber=e,this.toLineNumber=t}}class PM{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 FM{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 BM{constructor(e){this.theme=e,this.type=14}}class VM{constructor(e){this.type=15,this.ranges=e}}class WM{constructor(){this.type=16}}class HM{constructor(){this.type=17}}class zM 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 UM{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 UM(this._oldContentWidth,this._oldContentHeight,e.contentWidth,e.contentHeight)}}class $M{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 $M(this.oldHasFocus,e.hasFocus)}}class KM{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 KM(this._oldScrollWidth,this._oldScrollLeft,this._oldScrollHeight,this._oldScrollTop,e.scrollWidth,e.scrollLeft,e.scrollHeight,e.scrollTop)}}class qM{constructor(){this.kind=3}isNoOp(){return!1}merge(e){return this}}class GM{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 GM._selectionsAreEqual(this.oldSelections,this.selections)&&this.oldModelVersionId===this.modelVersionId}merge(e){return 6!==e.kind?this:new GM(this.oldSelections,e.selections,this.oldModelVersionId,e.modelVersionId,e.source,e.reason,this.reachedMaxCursorCount||e.reachedMaxCursorCount)}}class ZM{constructor(){this.kind=5}isNoOp(){return!1}merge(e){return this}}class YM 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 pM(this._model,this._viewModel,this._coordinatesConverter,n),this._cursors=new gM(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 pM(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>YM.MAX_CURSOR_COUNT&&(n=n.slice(0,YM.MAX_CURSOR_COUNT),o=!0);const s=XM.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 PM(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,MN.fromModelSelections(i)),this.revealPrimary(e,"restoreState",!1,0,!0,1)}onModelContentChanged(e,t){if(t instanceof yM){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 gM(this.context),this._validateAutoClosedActions(),this._emitStateChangedIfNecessary(e,"model",1,null,!1);else if(this._hasFocus&&t.resultingSelection&&t.resultingSelection.length>0){const i=MN.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,MN.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,MN.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 QM(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={addEditOperation:s,addTrackedEditOperation:a,trackSelection:(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()}};try{i.getEditOperations(e.model,l)}catch(d){return Jo(d),{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 oI&&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=XM.from(this._model,this);if(s.equals(n))return!1;const r=this._cursors.getSelections(),a=this._cursors.getViewSelections();if(e.emitViewEvent(new DM(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 GM(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,h=a.range.startColumn-1+n;s.push(new qo(l,h+1,l,h+2)),r.push(new qo(l,d+1,l,h+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=XM.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 QM.getAllAutoClosedCharacters(this._autoClosedActions)}startComposition(e){this._selectionsWhenCompositionStarted=this.getSelections().slice(0)}endComposition(e,t){this._executeEdit((()=>{"keyboard"===t&&(this._executeEditOperation(nI.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(nI.typeWithInterceptors(this._isDoingComposition,this._prevEditOperationType,this.context.cursorConfig,this._model,this.getSelections(),this.getAutoClosedCharacters(),n)),i+=e}}else this._executeEditOperation(nI.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(nI.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(nI.paste(this.context.cursorConfig,this._model,this.getSelections(),t,i,n||[]))}),e,o,4)}cut(e,t){this._executeEdit((()=>{this._executeEditOperation(KN.cut(this.context.cursorConfig,this._model,this.getSelections()))}),e,t)}executeCommand(e,t,i){this._executeEdit((()=>{this._cursors.killSecondaryCursors(),this._executeEditOperation(new PN(0,[t],{shouldPushStackElementBefore:!1,shouldPushStackElementAfter:!1}))}),e,i)}executeCommands(e,t,i){this._executeEdit((()=>{this._executeEditOperation(new PN(0,t,{shouldPushStackElementBefore:!1,shouldPushStackElementAfter:!1}))}),e,i)}}YM.MAX_CURSOR_COUNT=1e4;class XM{constructor(e,t){this.modelVersionId=e,this.cursorState=t}static from(e,t){return new XM(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 QM{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 JM{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 eO="base.contributions.configuration",tO={properties:{},patternProperties:{}},iO={properties:{},patternProperties:{}},nO={properties:{},patternProperties:{}},oO={properties:{},patternProperties:{}},sO={properties:{},patternProperties:{}},rO={properties:{},patternProperties:{}},aO=My.as(JS);const lO=new RegExp("\\[([^\\]]+)\\]","g"),dO="^(\\[([^\\]]+)\\])+$",hO=new RegExp(dO);function cO(e){const t=[];if(hO.test(e)){let i=lO.exec(e);for(;null==i?void 0:i.length;){const n=i[1].trim();n&&t.push(n),i=lO.exec(e)}}return Qo(t)}const uO=new class{constructor(){this.overrideIdentifiers=new Set,this._onDidSchemaChange=new $o,this._onDidUpdateConfiguration=new $o,this.configurationDefaultsOverrides=new Map,this.defaultLanguageConfigurationOverridesNode={id:"defaultOverrides",title:$m(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={},aO.registerSchema("vscode://schemas/settings/resourceLanguage",this.resourceLanguageSettingsSchema),this.registerOverridePropertyPatternKey()}registerConfiguration(e,t=!0){this.registerConfigurations([e],t)}registerConfigurations(e,t=!0){const i=this.doRegisterConfigurations(e,t);aO.registerSchema("vscode://schemas/settings/resourceLanguage",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),hO.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:$m(0,"Configure settings to be overridden for {0} language.",e),$ref:"vscode://schemas/settings/resourceLanguage",defaultDefaultValue:i,source:Gs(s)?void 0:s};n.push(...cO(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&&gO(l)){delete r[l];continue}const e=r[l];e.source=i,e.defaultDefaultValue=r[l].default,this.updatePropertyDefaultValue(l,e),hO.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(tO.properties[e]=t,t.scope){case 1:iO.properties[e]=t;break;case 2:nO.properties[e]=t;break;case 6:oO.properties[e]=t;break;case 3:sO.properties[e]=t;break;case 4:rO.properties[e]=t;break;case 5:rO.properties[e]=t,this.resourceLanguageSettingsSchema.properties[e]=t}}updateOverridePropertyPatternKey(){for(const e of this.overrideIdentifiers.values()){const t=`[${e}]`,i={type:"object",description:$m(0,"Configure editor settings to be overridden for a language."),errorMessage:$m(0,"This setting does not support per-language configuration."),$ref:"vscode://schemas/settings/resourceLanguage"};this.updatePropertyDefaultValue(t,i),tO.properties[t]=i,iO.properties[t]=i,nO.properties[t]=i,oO.properties[t]=i,sO.properties[t]=i,rO.properties[t]=i}this._onDidSchemaChange.fire()}registerOverridePropertyPatternKey(){const e={type:"object",description:$m(0,"Configure editor settings to be overridden for a language."),errorMessage:$m(0,"This setting does not support per-language configuration."),$ref:"vscode://schemas/settings/resourceLanguage"};tO.patternProperties[dO]=e,iO.patternProperties[dO]=e,nO.patternProperties[dO]=e,oO.patternProperties[dO]=e,sO.patternProperties[dO]=e,rO.patternProperties[dO]=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 gO(e){return e.trim()?hO.test(e)?$m(0,"Cannot register '{0}'. This matches property pattern '\\\\[.*\\\\]$' for describing language specific editor settings. Use 'configurationDefaults' contribution.",e):void 0!==uO.getConfigurationProperties()[e]?$m(0,"Cannot register '{0}'. This property is already registered.",e):null:$m(0,"Cannot register an empty property")}My.add(eO,uO);const pO=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}};My.add("editor.modesRegistry",pO);pO.registerLanguage({id:"plaintext",extensions:[".txt"],aliases:[$m(0,"Plain Text"),"text"],mimetypes:[uE.text]}),bv.register("plaintext",{brackets:[["(",")"],["[","]"],["{","}"]],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:"<",close:">"},{open:'"',close:'"'},{open:"'",close:"'"},{open:"`",close:"`"}],colorizedBracketPairs:[],folding:{offSide:!0}},0),My.as(eO).registerDefaultConfigurations([{overrides:{"[plaintext]":{"editor.unicodeHighlight.ambiguousCharacters":!1,"editor.unicodeHighlight.invisibleCharacters":!1}}}]);var mO=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 fO={getInitialState:()=>xv,tokenizeEncoded:(e,t,i)=>Lv(0,i)};function _O(e,t,i,n,o,s,r){let a="<div>",l=n,d=0,h=!0;for(let c=0,u=t.getCount();c<u;c++){const u=t.getEndOffset(c);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&&h?(g+=" ",h=!1):(g+=" ",h=!0),e--;break}case 60:g+="<",h=!1;break;case 62:g+=">",h=!1;break;case 38:g+="&",h=!1;break;case 0:g+="�",h=!1;break;case 65279:case 8232:case 8233:case 133:g+="<EFBFBD>",h=!1;break;case 13:g+="​",h=!1;break;case 32:r&&h?(g+=" ",h=!1):(g+=" ",h=!0);break;default:g+=String.fromCharCode(t),h=!1}}if(a+=`<span style="${t.getInlineStyle(c,i)}">${g}</span>`,u>o||l>=o)break}return a+="</div>",a}function vO(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);wb.convertToEndOffset(a.tokens,e.length);const l=new wb(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 bO{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 CO{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 wO{constructor(e,t,i,n){this._instanceId=Or(++wO.INSTANCE_COUNT),this._pendingChanges=new bO,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 CO(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=wO.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 h=o,c=h;const u=5e5;let g=0;o>=u&&(g=Math.floor(o/u)*u,g=Math.floor(g/i)*i,c-=g);const p=[],m=e+(t-e)/2;let f=-1;for(let C=n;C<=s;C++){if(-1===f){const e=h,t=h+i;(e<=m&&m<t||e>m)&&(f=C)}for(h+=i,p[C-n]=c,c+=i;d===C;)c+=l,h+=l,r++,r>=a?d=s+1:(d=0|this.getAfterLineNumberForWhitespaceIndex(r),l=0|this.getHeightForWhitespaceIndex(r));if(h>=t){s=C;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}}wO.INSTANCE_COUNT=0;class yO{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 SO extends Uo{constructor(e,t){super(),this._onDidContentSizeChange=this._register(new $o),this.onDidContentSizeChange=this._onDidContentSizeChange.event,this._dimensions=new yO(0,0,0,0),this._scrollable=this._register(new YI({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 UM(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 xO 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 wO(t,n.get(59),s.top,s.bottom),this._scrollable=this._register(new SO(0,i)),this._configureSmoothScrollDuration(),this._scrollable.setScrollDimensions(new yO(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 yO(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 yO(t,e.contentWidth,i,this._getContentHeight(t,i,n)))}getCurrentViewport(){const e=this._scrollable.getScrollDimensions(),t=this._scrollable.getCurrentScrollPosition();return new Bb(t.scrollTop,t.scrollLeft,e.width,e.height)}getFutureViewport(){const e=this._scrollable.getScrollDimensions(),t=this._scrollable.getFutureScrollPosition();return new Bb(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 yO(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 kO{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 Ub(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,mf(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(!LO(this.model,e))continue;const d=this._getOrCreateViewModelDecoration(e),h=d.range;if(o[s++]=d,l.inlineClassName){const e=new zb(h,l.inlineClassName,l.inlineClassNameAffectsLetterSpacing?3:0),t=Math.max(i,h.startLineNumber),o=Math.min(n,h.endLineNumber);for(let n=t;n<=o;n++)r[n-i].push(e)}if(l.beforeContentClassName&&i<=h.startLineNumber&&h.startLineNumber<=n){const e=new zb(new qo(h.startLineNumber,h.startColumn,h.startLineNumber,h.startColumn),l.beforeContentClassName,1);r[h.startLineNumber-i].push(e)}if(l.afterContentClassName&&i<=h.endLineNumber&&h.endLineNumber<=n){const e=new zb(new qo(h.endLineNumber,h.endColumn,h.endLineNumber,h.endColumn),l.afterContentClassName,2);r[h.endLineNumber-i].push(e)}}return{decorations:o,inlineDecorations:r}}}function LO(e,t){return(!t.options.hideInCommentTokens||!DO(e,t))&&(!t.options.hideInStringTokens||!EO(e,t))}function DO(e,t){return NO(e,t.range,(e=>1===e))}function EO(e,t){return NO(e,t.range,(e=>2===e))}function NO(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 IO{constructor(e,t,i){this.range=e,this.nestingLevel=t,this.isInvalid=i}}class TO 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 MO{constructor(e,t){this.lineCount=e,this.columnCount=t}toString(){return`${this.lineCount},${this.columnCount}`}}MO.zero=new MO(0,0);const OO=Math.pow(2,26);function AO(e,t){return e*OO+t}function RO(e){const t=e,i=Math.floor(t/OO);return new MO(i,t-i*OO)}function PO(e,t){return t<OO?e+t:e-e%OO+t}function FO(e,t){return e<t}function BO(e,t){return e<=t}function VO(e,t){return e>=t}function WO(e){return AO(e.lineNumber-1,e.column-1)}function HO(e,t){const i=e,n=Math.floor(i/OO),o=i-n*OO,s=t,r=Math.floor(s/OO);return new qo(n+1,o+1,r+1,s-r*OO+1)}class zO{constructor(e,t,i){this.startOffset=e,this.endOffset=t,this.newLength=i}}class jO{constructor(e,t){this.documentLength=t,this.nextEditIdx=0,this.deltaOldToNewLineCount=0,this.deltaOldToNewColumnCount=0,this.deltaLineIdxInOld=-1,this.edits=e.map((e=>UO.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/OO),s=Math.floor(n/OO),r=n-s*OO;if(o===s)return AO(0,r-(i-o*OO));return AO(s-o,r)}(e,t?this.translateOldToCur(t.offsetObj):this.documentLength)}translateOldToCur(e){return e.lineCount===this.deltaLineIdxInOld?AO(e.lineCount+this.deltaOldToNewLineCount,e.columnCount+this.deltaOldToNewColumnCount):AO(e.lineCount+this.deltaOldToNewLineCount,e.columnCount)}translateCurToOld(e){const t=RO(e);return t.lineCount-this.deltaOldToNewLineCount===this.deltaLineIdxInOld?AO(t.lineCount-this.deltaOldToNewLineCount,t.columnCount-this.deltaOldToNewColumnCount):AO(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(!BO(i,e))break;{this.nextEditIdx++;const e=RO(i),n=RO(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 UO{constructor(e,t,i){this.endOffsetBeforeObj=RO(t),this.endOffsetAfterObj=RO(PO(e,i)),this.offsetObj=RO(e)}static from(e){return new UO(e.startOffset,e.endOffset,e.newLength)}}const $O=new Array;class KO{constructor(e,t){this.items=e,this.additionalItems=t}static create(e,t){if(e<=128&&0===t.length){let i=KO.cache[e];return i||(i=new KO(e,t),KO.cache[e]=i),i}return new KO(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:KO.create(e,this.additionalItems)}n--;const o=this.additionalItems.slice(0);for(;o.length<n;)o.push(0);return o[n]|=1<<(31&i),KO.create(this.items,o)}merge(e){const t=this.items|e.items;if(this.additionalItems===$O&&e.additionalItems===$O)return t===this.items?this:t===e.items?e:KO.create(t,$O);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 KO.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}}KO.cache=new Array(129),KO.empty=KO.create(0,$O);const qO={getKey:e=>e};class GO{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 ZO{constructor(e){this._length=e}get length(){return this._length}}class YO extends ZO{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=PO(n,t.length)),i&&(n=PO(n,i.length)),new YO(n,e,t,i,t?t.missingOpeningBracketIds:KO.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 YO(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(PO(e,this.openingBracket.length),t):Number.MAX_SAFE_INTEGER}}class XO extends ZO{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=PO(o,t.length),s=s.merge(t.missingOpeningBracketIds),i){if(e.listHeight!==i.listHeight)throw new Error("Invalid list heights");o=PO(o,i.length),s=s.merge(i.missingOpeningBracketIds)}return n?new JO(o,e.listHeight+1,e,t,i,s):new QO(o,e.listHeight+1,e,t,i,s)}static getEmpty(){return new tA(0,0,[],KO.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=PO(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=PO(n,e.length))}return this.cachedMinIndentation=i,i}}class QO extends XO{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 QO(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 JO extends QO{toMutable(){return new QO(this.length,this.listHeight,this.item1,this.item2,this.item3,this.missingOpeningBracketIds)}throwIfImmutable(){throw new Error("this instance is immutable")}}class eA extends XO{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 eA(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 tA extends eA{toMutable(){return new eA(this.length,this.listHeight,[...this.children],this.missingOpeningBracketIds)}throwIfImmutable(){throw new Error("this instance is immutable")}}const iA=[];class nA extends ZO{get listHeight(){return 0}get childrenLength(){return 0}getChild(e){return null}get children(){return iA}deepClone(){return this}}class oA extends nA{get kind(){return 0}get missingOpeningBracketIds(){return KO.getEmpty()}canBeReused(e){return!0}computeMinIndentation(e,t){const i=RO(e),n=(0===i.columnCount?i.lineCount:i.lineCount+1)+1,o=(s=PO(e,this.length),Math.floor(s/OO)+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=GD.visibleColumnFromColumn(i,e,t.getOptions().tabSize);r=Math.min(r,n)}return r}}class sA extends nA{constructor(e,t,i){super(e),this.languageId=t,this.bracketIds=i}static create(e,t,i){return new sA(e,t,i)}get kind(){return 1}get missingOpeningBracketIds(){return KO.getEmpty()}canBeReused(e){return!1}computeMinIndentation(e,t){return Number.MAX_SAFE_INTEGER}}class rA extends nA{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 aA{constructor(e,t,i,n,o){this.length=e,this.kind=t,this.bracketId=i,this.bracketIds=n,this.astNode=o}}class lA{constructor(e,t){this.textModel=e,this.bracketTokens=t,this.reader=new dA(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 AO(this.textBufferLineCount,this.textBufferLastLineLength)}skip(e){this.didPeek=!1,this._offset=PO(this._offset,e);const t=RO(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=PO(this._offset,e.length)),e}peek(){return this.didPeek||(this.peeked=this.reader.read(),this.didPeek=!0),this.peeked}}class dA{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?AO(r-o,a):AO(0,a-s));var o,s,r,a;return new aA(n,0,-1,KO.getEmpty(),new oA(n))}}class hA{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 aA(AO(0,u),0,-1,KO.getEmpty(),new oA(AO(0,u))));const h=new Array;for(let u=0;u<60;u++)h.push(new aA(AO(1,u),0,-1,KO.getEmpty(),new oA(AO(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=AO(0,i);t=new aA(e,0,-1,KO.getEmpty(),new oA(e))}}else{const i=s-l,n=e-r;if(1===i&&n<h.length)t=h[n];else{const e=AO(i,n);t=new aA(e,0,-1,KO.getEmpty(),new oA(e))}}n.push(t)}n.push(t.getToken(i)),a=e+i.length,l=s}}const c=e.length;if(a!==c){const e=l===s?AO(0,c-a):AO(s-l,c-r);n.push(new aA(e,0,-1,KO.getEmpty(),new oA(e)))}this.length=AO(s,c-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 Ar}}class cA{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:KO.getEmpty(),first:n},o.set(l,t)),t.openingBrackets=t.openingBrackets.add(n,qO)}const r=new Map;for(const[a,l]of o){const t=AO(0,a.length);r.set(a,new aA(t,2,l.first,l.openingBrackets,sA.create(t,e.languageId,l.openingBrackets)))}for(const a of s){const t=AO(0,a.length),n=i(e.languageId,a),o=KO.getEmpty().add(n,qO);r.set(a,new aA(t,1,n,o,sA.create(t,e.languageId,o)))}return new cA(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 uA{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=cA.createFromLanguage(this.getLanguageConfiguration(e),this.denseKeyProvider).getRegExpStr();return t.getRegExpStr()!==i}getSingleLanguageBracketTokens(e){let t=this.languageIdToBracketTokens.get(e);return t||(t=cA.createFromLanguage(this.getLanguageConfiguration(e),this.denseKeyProvider),this.languageIdToBracketTokens.set(e,t)),t}}function gA(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]=XO.create23(e[n],e[n+1],n+3===i?e[n+2]:null,t)}i=n}return XO.create23(e[0],e[1],i>=3?e[2]:null,t)}function pA(e,t){return Math.abs(e.listHeight-t.listHeight)}function mA(e,t){return e.listHeight===t.listHeight?XO.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=XO.create23(e.unappendChild(),o,null,!1):(e.appendChildOfSameHeight(o),o=void 0):e.handleChildrenChanged()}return o?XO.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=XO.create23(o,e.unprependChild(),null,!1):(e.prependChildOfSameHeight(o),o=void 0):e.handleChildrenChanged()}return o?XO.create23(o,e,null,!1):e}(t,e)}class fA{constructor(e){this.lastOffset=0,this.nextNodes=[e],this.offsets=[0],this.idxs=[]}readLongestNodeAt(e,t){if(FO(e,this.lastOffset))throw new Error("Invalid offset");for(this.lastOffset=e;;){const i=vA(this.nextNodes);if(!i)return;const n=vA(this.offsets);if(FO(e,n))return;if(FO(n,e))if(PO(n,i.length)<=e)this.nextNodeAfterCurrent();else{const e=_A(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=_A(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=vA(this.offsets),t=vA(this.nextNodes);if(this.nextNodes.pop(),this.offsets.pop(),0===this.idxs.length)break;const i=vA(this.nextNodes),n=_A(i,this.idxs[this.idxs.length-1]);if(-1!==n){this.nextNodes.push(i.getChild(n)),this.offsets.push(PO(e,t.length)),this.idxs[this.idxs.length-1]=n;break}this.idxs.pop()}}}function _A(e,t=-1){for(;;){if(++t>=e.childrenLength)return-1;if(e.getChild(t))return t}}function vA(e){return e.length>0?e[e.length-1]:void 0}function bA(e,t,i,n){return new CA(e,t,i,n).parseDocument()}class CA{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 fA(i):void 0,this.positionMapper=new jO(t,e.length)}parseDocument(){this._itemsConstructed=0,this._itemsFromCache=0;let e=this.parseList(KO.getEmpty());return e||(e=XO.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?gA(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())pA(n,o)<=pA(o,s)?(n=mA(n,o),o=s):o=mA(o,s);return mA(n,o)}(t):gA(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(!FO(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 rA(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(),YO.create(t.astNode,n,o.astNode)):YO.create(t.astNode,n,null)}default:throw new Error("unexpected")}}}class wA extends Uo{constructor(e,t){if(super(),this.textModel=e,this.getLanguageConfiguration=t,this.didChangeEmitter=new $o,this.denseKeyProvider=new GO,this.brackets=new uA(this.denseKeyProvider,this.getLanguageConfiguration),this.onDidChange=this.didChangeEmitter.event,0===e.backgroundTokenizationState){const e=this.brackets.getSingleLanguageBracketTokens(this.textModel.getLanguageId()),t=new hA(this.textModel.getValue(),e);this.initialAstWithoutTokens=bA(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 zO(AO(e.fromLineNumber-1,0),AO(e.toLineNumber,0),AO(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 zO(WO(t.getStartPosition()),WO(t.getEndPosition()),function(e){const t=Is(e);return AO(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 bA(new lA(this.textModel,this.brackets),e,n,i)}getBracketsInRange(e){const t=AO(e.startLineNumber-1,e.startColumn-1),i=AO(e.endLineNumber-1,e.endColumn-1),n=new Array,o=this.initialAstWithoutTokens||this.astWithTokens;return yA(o,0,o.length,t,i,n),n}getBracketPairsInRange(e,t){const i=new Array,n=WO(e.getStartPosition()),o=WO(e.getEndPosition()),s=this.initialAstWithoutTokens||this.astWithTokens,r=new SA(i,t,this.textModel);return xA(s,0,s.length,n,o,r),i}}function yA(e,t,i,n,o,s,r=0){if(4===e.kind)for(const a of e.children)i=PO(t,a.length),BO(t,o)&&VO(i,n)&&yA(a,t,i,n,o,s,r),t=i;else if(2===e.kind){r++;if(i=PO(t,e.openingBracket.length),BO(t,o)&&VO(i,n)){const n=HO(t,i);s.push(new IO(n,r-1,!e.closingBracket))}t=i;if(e.child){const a=e.child;i=PO(t,a.length),BO(t,o)&&VO(i,n)&&yA(a,t,i,n,o,s,r),t=i}if(e.closingBracket){if(i=PO(t,e.closingBracket.length),BO(t,o)&&VO(i,n)){const e=HO(t,i);s.push(new IO(e,r-1,!1))}t=i}}else if(3===e.kind){const e=HO(t,i);s.push(new IO(e,r-1,!0))}else if(1===e.kind){const e=HO(t,i);s.push(new IO(e,r-1,!1))}}class SA{constructor(e,t,i){this.result=e,this.includeMinIndentation=t,this.textModel=i}}function xA(e,t,i,n,o,s,r=0){var a;if(2===e.kind){const n=PO(t,e.openingBracket.length);let o=-1;s.includeMinIndentation&&(o=e.computeMinIndentation(t,s.textModel)),s.result.push(new TO(HO(t,i),HO(t,n),e.closingBracket?HO(PO(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=PO(l,d.length),BO(e,o)&&BO(n,l)&&xA(d,e,l,n,o,s,r)}}class kA 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 Cs;this.bracketPairsTree.value=(e=i.add(new wA(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?EA(this._findMatchingBracketUp(a,o,LA(i))):null}matchBracket(e,t){const i=LA(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=Z_.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 DA)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=Z_.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 DA?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 DA?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 DA.INSTANCE;const d=Z_.findPrevBracketInRange(o,t,n,a,l);if(!d)break;const h=n.substring(d.startColumn-1,d.endColumn-1).toLowerCase();if(e.isOpen(h)?s++:e.isClose(h)&&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 h=!0;for(;s>=0;s--){const t=e.getLanguageId(s)===n&&!v_(e.getStandardTokenType(s));if(t)h?r=e.getStartOffset(s):(r=e.getStartOffset(s),d=e.getEndOffset(s));else if(h&&r!==d){const e=a(l,o,r,d);if(e)return e}h=t}if(h&&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 DA.INSTANCE;const d=Z_.findNextBracketInRange(o,t,n,a,l);if(!d)break;const h=n.substring(d.startColumn-1,d.endColumn-1).toLowerCase();if(e.isOpen(h)?s++:e.isClose(h)&&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 h=!0;for(;s<i;s++){const t=e.getLanguageId(s)===n&&!v_(e.getStandardTokenType(s));if(t)h||(r=e.getStartOffset(s)),l=e.getEndOffset(s);else if(h&&r!==l){const e=a(d,o,r,l);if(e)return e}h=t}if(h&&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 h=!0;for(;a>=0;a--){const t=e.getLanguageId(a);if(i!==t){if(n&&h&&l!==d){const e=Z_.findPrevBracketInRange(n.reversedRegex,o,r,l,d);if(e)return this._toFoundBracket(n,e);h=!1}i=t,n=this.languageConfigurationService.getLanguageConfiguration(i).brackets}const s=!!n&&!v_(e.getStandardTokenType(a));if(s)h?l=e.getStartOffset(a):(l=e.getStartOffset(a),d=e.getEndOffset(a));else if(n&&h&&l!==d){const e=Z_.findPrevBracketInRange(n.reversedRegex,o,r,l,d);if(e)return this._toFoundBracket(n,e)}h=s}if(n&&h&&l!==d){const e=Z_.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 h=!0;for(;a<i;a++){const t=e.getLanguageId(a);if(n!==t){if(o&&h&&l!==d){const e=Z_.findNextBracketInRange(o.forwardRegex,s,r,l,d);if(e)return this._toFoundBracket(o,e);h=!1}n=t,o=this.languageConfigurationService.getLanguageConfiguration(n).brackets}const i=!!o&&!v_(e.getStandardTokenType(a));if(i)h||(l=e.getStartOffset(a)),d=e.getEndOffset(a);else if(o&&h&&l!==d){const e=Z_.findNextBracketInRange(o.forwardRegex,s,r,l,d);if(e)return this._toFoundBracket(o,e)}h=i}if(o&&h&&l!==d){const e=Z_.findNextBracketInRange(o.forwardRegex,s,r,l,d);if(e)return this._toFoundBracket(o,e)}}return null}findEnclosingBrackets(e,t){const i=LA(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 DA.INSTANCE;const a=Z_.findNextBracketInRange(e.forwardRegex,t,n,o,s);if(!a)break;const d=n.substring(a.startColumn-1,a.endColumn-1).toLowerCase(),h=e.textIsBracket[d];if(h&&(h.isOpen(d)?r[h.index]++:h.isClose(d)&&r[h.index]--,-1===r[h.index]))return this._matchFoundBracket(a,h,!1,i);o=a.endColumn-1}return null};let h=null,c=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);h!==t&&(h=t,c=this.languageConfigurationService.getLanguageConfiguration(h).brackets,a(h,c))}let l=!0;for(;o<t;o++){const t=e.getLanguageId(o);if(h!==t){if(c&&l&&s!==r){const e=d(c,u,i,s,r);if(e)return EA(e);l=!1}h=t,c=this.languageConfigurationService.getLanguageConfiguration(h).brackets,a(h,c)}const n=!!c&&!v_(e.getStandardTokenType(o));if(n)l||(s=e.getStartOffset(o)),r=e.getEndOffset(o);else if(c&&l&&s!==r){const e=d(c,u,i,s,r);if(e)return EA(e)}l=n}if(c&&l&&s!==r){const e=d(c,u,i,s,r);if(e)return EA(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 LA(e){if(void 0===e)return()=>!0;{const t=Date.now();return()=>Date.now()-t<=e}}class DA{constructor(){this._searchCanceledBrand=void 0}}function EA(e){return e instanceof DA?null:e}DA.INSTANCE=new DA;class NA extends Uo{constructor(e){super(),this.textModel=e,this.colorProvider=new IA,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 IA{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 TA(e){return e.replace(/\n/g,"\\n").replace(/\r/g,"\\r")}zy(((e,t)=>{const i=[nN,oN,sN,rN,aN,lN],n=new IA;t.addRule(`.monaco-editor .${n.unexpectedClosingBracketClassName} { color: ${e.getColor(dN)}; }`);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 MA{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} "${TA(this.newText)}")`:0===this.newText.length?`(delete@${this.oldPosition} "${TA(this.oldText)}")`:`(replace@${this.oldPosition} "${TA(this.oldText)}" with "${TA(this.newText)}")`}static _writeStringSize(e){return 4+2*e.length}static _writeString(e,t,i){const n=t.length;I_(e,n,i),i+=4;for(let o=0;o<n;o++)E_(e,t.charCodeAt(o),i),i+=2;return i}static _readString(e,t){const i=N_(e,t);return F_(e,t+=4,i)}writeSize(){return 8+MA._writeStringSize(this.oldText)+MA._writeStringSize(this.newText)}write(e,t){return I_(e,this.oldPosition,t),t+=4,I_(e,this.newPosition,t),t+=4,t=MA._writeString(e,this.oldText,t),t=MA._writeString(e,this.newText,t)}static read(e,t,i){const n=N_(e,t),o=N_(e,t+=4);t+=4;const s=MA._readString(e,t);t+=MA._writeStringSize(s);const r=MA._readString(e,t);return t+=MA._writeStringSize(r),i.push(new MA(n,s,o,r)),t}}class OA{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]=OA._splitCurr(n,i.newPosition-n.oldPosition);this._acceptCurr(e),n=t;continue}if(i.newPosition<n.oldPosition){const[e,t]=OA._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]=OA._splitPrev(i,n.oldLength);o=e,s=n,i=r,n=this._getCurr(++t)}else{const[t,r]=OA._splitCurr(n,i.newLength);o=i,s=t,i=this._getPrev(++e),n=r}this._result[this._resultLen++]=new MA(o.oldPosition,o.oldText,s.newPosition,s.newText),this._prevDeltaOffset+=o.newLength-o.oldLength,this._currDeltaOffset+=s.newLength-s.oldLength}const o=OA._merge(this._result);return OA._removeNoOps(o)}_acceptCurr(e){this._result[this._resultLen++]=OA._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++]=OA._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 MA(t.oldPosition-e,t.oldText,t.newPosition,t.newText)}static _rebasePrev(e,t){return new MA(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 MA(e.oldPosition,e.oldText,e.newPosition,i),new MA(e.oldEnd,"",e.newPosition+t,n)]}static _splitCurr(e,t){const i=e.oldText.substr(0,t),n=e.oldText.substr(t);return[new MA(e.oldPosition,i,e.newPosition,e.newText),new MA(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 MA(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 AA(e){return 47===e||92===e}function RA(e){return e.replace(/[\\/]/g,Pr.sep)}function PA(e,t=Pr.sep){if(!e)return"";const i=e.length,n=e.charCodeAt(0);if(AA(n)){if(AA(e.charCodeAt(1))&&!AA(e.charCodeAt(2))){let n=3;const o=n;for(;n<i&&!AA(e.charCodeAt(n));n++);if(o!==n&&!AA(e.charCodeAt(n+1)))for(n+=1;n<i;n++)if(AA(e.charCodeAt(n)))return e.slice(0,n+1).replace(/[\\/]/g,t)}return t}if(BA(n)&&58===e.charCodeAt(1))return AA(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(AA(e.charCodeAt(o)))return e.slice(0,o+1);return""}function FA(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 BA(e){return e>=65&&e<=90||e>=97&&e<=122}function VA(e,t){return!!(void 0!==t?t:Rs)&&(BA(e.charCodeAt(0))&&58===e.charCodeAt(1))}function WA(e){return Wr(e,!0)}class HA{constructor(e){this._ignorePathCasing=e}compare(e,t,i=!1){return e===t?0:Hr(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===IC.file)return FA(WA(e),WA(t),this._ignorePathCasing(e))&&e.query===t.query&&(i||e.fragment===t.fragment);if(XA(e.authority,t.authority))return FA(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 $A(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===IC.file?t=Ps.file(zr(WA(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===IC.file?Ps.file(Vr(WA(e))).path:Pr.normalize(e.path),e.with({path:t})}relativePath(e,t){if(e.scheme!==t.scheme||!XA(e.authority,t.authority))return;if(e.scheme===IC.file){const i=jr(WA(e),WA(t));return Rs?RA(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===IC.file){const i=Ps.file(Ur(WA(e),t));return e.with({authority:i.authority,path:i.path})}var i;return-1===(i=t).indexOf("/")&&(i=RA(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===IC.file){const i=WA(e);return i.length>PA(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 QA(e,t)?e.with({path:e.path.substr(0,e.path.length-1)}):e}addTrailingPathSeparator(e,t=Fr){let i=!1;if(e.scheme===IC.file){const n=WA(e);i=void 0!==n&&n.length===PA(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||QA(e,t)?e:e.with({path:e.path+"/"})}}const zA=new HA((()=>!1));new HA((e=>e.scheme!==IC.file||!Vo)),new HA((e=>!0));const jA=zA.isEqual.bind(zA);zA.isEqualOrParent.bind(zA),zA.getComparisonKey.bind(zA);const UA=zA.basenameOrAuthority.bind(zA),$A=zA.basename.bind(zA),KA=zA.extname.bind(zA),qA=zA.dirname.bind(zA),GA=zA.joinPath.bind(zA),ZA=zA.normalizePath.bind(zA);zA.relativePath.bind(zA);const YA=zA.resolvePath.bind(zA);zA.isAbsolutePath.bind(zA);const XA=zA.isEqualAuthority.bind(zA),QA=zA.hasTrailingPathSeparator.bind(zA);var JA,eR;function tR(e){return e.toString()}zA.removeTrailingPathSeparator.bind(zA),zA.addTrailingPathSeparator.bind(zA),(eR=JA||(JA={})).META_DATA_LABEL="label",eR.META_DATA_DESCRIPTION="description",eR.META_DATA_SIZE="size",eR.META_DATA_MIME="mime",eR.parseMetaData=function(e){const t=new Map;e.path.substring(e.path.indexOf(";")+1,e.path.lastIndexOf(";")).split(";").forEach((e=>{const[i,n]=e.split(":");i&&n&&t.set(i,n)}));const i=e.path.substring(0,e.path.indexOf(";"));return i&&t.set(eR.META_DATA_MIME,i),t};class iR{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=oR(e);return new iR(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 OA(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(I_(e,t?t.length:0,i),i+=4,t)for(const n of t)I_(e,n.selectionStartLineNumber,i),i+=4,I_(e,n.selectionStartColumn,i),i+=4,I_(e,n.positionLineNumber,i),i+=4,I_(e,n.positionColumn,i),i+=4;return i}static _readSelections(e,t,i){const n=N_(e,t);t+=4;for(let o=0;o<n;o++){const n=N_(e,t),o=N_(e,t+=4),s=N_(e,t+=4),r=N_(e,t+=4);t+=4,i.push(new ar(n,o,s,r))}return t}serialize(){let e=10+iR._writeSelectionsSize(this.beforeCursorState)+iR._writeSelectionsSize(this.afterCursorState)+4;for(const n of this.changes)e+=n.writeSize();const t=new Uint8Array(e);let i=0;I_(t,this.beforeVersionId,i),i+=4,I_(t,this.afterVersionId,i),i+=4,M_(t,this.beforeEOL,i),i+=1,M_(t,this.afterEOL,i),i+=1,i=iR._writeSelections(t,this.beforeCursorState,i),i=iR._writeSelections(t,this.afterCursorState,i),I_(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=N_(t,i);i+=4;const o=N_(t,i);i+=4;const s=T_(t,i);i+=1;const r=T_(t,i);i+=1;const a=[];i=iR._readSelections(t,i,a);const l=[];i=iR._readSelections(t,i,l);const d=N_(t,i);i+=4;const h=[];for(let c=0;c<d;c++)i=MA.read(t,i,h);return new iR(n,o,s,r,a,l,h)}}class nR{constructor(e,t){this.model=e,this._data=iR.create(e,t)}get type(){return 0}get resource(){return Ps.isUri(this.model)?this.model:this.model.uri}get label(){return $m(0,"Typing")}toString(){return(this._data instanceof iR?this._data:iR.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 iR}append(e,t,i,n,o){this._data instanceof iR&&this._data.append(e,t,i,n,o)}close(){this._data instanceof iR&&(this._data=this._data.serialize())}open(){this._data instanceof iR||(this._data=iR.deserialize(this._data))}undo(){if(Ps.isUri(this.model))throw new Error("Invalid SingleModelEditStackElement");this._data instanceof iR&&(this._data=this._data.serialize());const e=iR.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 iR&&(this._data=this._data.serialize());const e=iR.deserialize(this._data);this.model._applyRedo(e.changes,e.afterEOL,e.afterVersionId,e.afterCursorState)}heapSize(){return this._data instanceof iR&&(this._data=this._data.serialize()),this._data.byteLength+168}}function oR(e){return"\n"===e.getEOL()?0:1}function sR(e){return!!e&&(e instanceof nR||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=tR(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=tR(e);return this._editStackElementsMap.has(t)}setModel(e){const t=tR(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=tR(e.uri);return!!this._editStackElementsMap.has(t)&&this._editStackElementsMap.get(t).canAppend(e)}append(e,t,i,n,o){const s=tR(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=tR(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(`${$A(t.resource)}: ${t}`);return`{${e.join(", ")}}`}})}class rR{constructor(e,t){this._model=e,this._undoRedoService=t}pushStackElement(){const e=this._undoRedoService.getLastElement(this._model.uri);sR(e)&&e.close()}popStackElement(){const e=this._undoRedoService.getLastElement(this._model.uri);sR(e)&&e.open()}clear(){this._undoRedoService.removeElements(this._model.uri)}_getOrCreateEditStackElement(e){const t=this._undoRedoService.getLastElement(this._model.uri);if(sR(t)&&t.canAppend(this._model))return t;const i=new nR(this._model,e);return this._undoRedoService.pushElement(i),i}pushEOL(e){const t=this._getOrCreateEditStackElement(null);this._model.setEOL(e),t.append(this._model,[],oR(this._model),this._model.getAlternativeVersionId(),null)}pushEditOperation(e,t,i){const n=this._getOrCreateEditStackElement(e),o=this._model.applyEdits(t,!0),s=rR._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)),oR(this._model),this._model.getAlternativeVersionId(),s),s}static _computeCursorState(e,t){try{return e?e(t):null}catch(i){return Jo(i),null}}}class aR{constructor(){this.spacesDiff=0,this.looksLikeAlignment=!1}}function lR(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 h=Math.abs(a-d),c=Math.abs(r-l);if(0===h)return o.spacesDiff=c,void(c>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));c%h!=0||(o.spacesDiff=c/h)}function dR(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],h=new aR;for(let g=1;g<=n;g++){const n=e.getLineLength(g),l=e.getLineContent(g),c=n<=65536;let u=!1,p=0,m=0,f=0;for(let t=0,i=n;t<i;t++){const i=c?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++,lR(r,a,l,p,h),h.looksLikeAlignment&&(!i||t!==h.spacesDiff))continue;const _=h.spacesDiff;_<=8&&d[_]++,r=l,a=p}let c=i;o!==s&&(c=o<s);let u=t;if(c){let e=c?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:c,tabSize:u}}function hR(e){return(1&e.metadata)>>>0}function cR(e,t){e.metadata=254&e.metadata|t<<0}function uR(e){return(2&e.metadata)>>>1==1}function gR(e,t){e.metadata=253&e.metadata|(t?1:0)<<1}function pR(e){return(4&e.metadata)>>>2==1}function mR(e,t){e.metadata=251&e.metadata|(t?1:0)<<2}function fR(e,t){e.metadata=231&e.metadata|t<<3}function _R(e,t){e.metadata=223&e.metadata|(t?1:0)<<5}class vR{constructor(e,t,i){this.metadata=0,this.parent=this,this.left=this,this.right=this,cR(this,1),this.start=t,this.end=i,this.delta=0,this.maxEnd=i,this.id=e,this.ownerId=0,this.options=null,mR(this,!1),fR(this,1),_R(this,!1),this.cachedVersionId=0,this.cachedAbsoluteStart=t,this.cachedAbsoluteEnd=i,this.range=null,gR(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;mR(this,"squiggly-error"===t||"squiggly-warning"===t||"squiggly-info"===t),fR(this,this.options.stickiness),_R(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 bR=new vR(null,0,0);bR.parent=bR,bR.left=bR,bR.right=bR,cR(bR,0);class CR{constructor(){this.root=bR,this.requestNormalizeDelta=!1}intervalSearch(e,t,i,n,o){return this.root===bR?[]:function(e,t,i,n,o,s){let r=e.root,a=0,l=0,d=0,h=0;const c=[];let u=0;for(;r!==bR;)if(uR(r))gR(r.left,!1),gR(r.right,!1),r===r.parent.right&&(a-=r.parent.delta),r=r.parent;else{if(!uR(r.left)){if(l=a+r.maxEnd,l<t){gR(r,!0);continue}if(r.left!==bR){r=r.left;continue}}if(d=a+r.start,d>i)gR(r,!0);else{if(h=a+r.end,h>=t){r.setCachedOffsets(d,h,s);let e=!0;n&&r.ownerId&&r.ownerId!==n&&(e=!1),o&&pR(r)&&(e=!1),e&&(c[u++]=r)}gR(r,!0),r.right===bR||uR(r.right)||(a+=r.delta,r=r.right)}}return gR(e.root,!1),c}(this,e,t,i,n,o)}search(e,t,i){return this.root===bR?[]:function(e,t,i,n){let o=e.root,s=0,r=0,a=0;const l=[];let d=0;for(;o!==bR;){if(uR(o)){gR(o.left,!1),gR(o.right,!1),o===o.parent.right&&(s-=o.parent.delta),o=o.parent;continue}if(o.left!==bR&&!uR(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&&pR(o)&&(e=!1),e&&(l[d++]=o),gR(o,!0),o.right===bR||uR(o.right)||(s+=o.delta,o=o.right)}return gR(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!==bR;)uR(i)?(gR(i.left,!1),gR(i.right,!1),i=i.parent):i.left===bR||uR(i.left)?(i.ownerId===t&&(n[o++]=i),gR(i,!0),i.right===bR||uR(i.right)||(i=i.right)):i=i.left;return gR(e.root,!1),n}(this,e)}collectNodesPostOrder(){return function(e){let t=e.root;const i=[];let n=0;for(;t!==bR;)uR(t)?(gR(t.left,!1),gR(t.right,!1),t=t.parent):t.left===bR||uR(t.left)?t.right===bR||uR(t.right)?(i[n++]=t,gR(t,!0)):t=t.right:t=t.left;return gR(e.root,!1),i}(this)}insert(e){SR(this,e),this._normalizeDeltaIfNecessary()}delete(e){xR(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!==bR;)if(uR(n))gR(n.left,!1),gR(n.right,!1),n===n.parent.right&&(o-=n.parent.delta),n=n.parent;else{if(!uR(n.left)){if(s=o+n.maxEnd,s<t){gR(n,!0);continue}if(n.left!==bR){n=n.left;continue}}r=o+n.start,r>i?gR(n,!0):(a=o+n.end,a>=t&&(n.setCachedOffsets(r,a,0),l[d++]=n),gR(n,!0),n.right===bR||uR(n.right)||(o+=n.delta,n=n.right))}return gR(e.root,!1),l}(this,e,e+t);for(let s=0,r=o.length;s<r;s++){xR(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!==bR;)if(uR(o))gR(o.left,!1),gR(o.right,!1),o===o.parent.right&&(s-=o.parent.delta),NR(o),o=o.parent;else{if(!uR(o.left)){if(r=s+o.maxEnd,r<t){gR(o,!0);continue}if(o.left!==bR){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),gR(o,!0)):(gR(o,!0),o.right===bR||uR(o.right)||(s+=o.delta,o=o.right))}gR(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,yR(r,e,e+t,i,n),r.maxEnd=r.end,SR(this,r)}this._normalizeDeltaIfNecessary()}_normalizeDeltaIfNecessary(){this.requestNormalizeDelta&&(this.requestNormalizeDelta=!1,function(e){let t=e.root,i=0;for(;t!==bR;)t.left===bR||uR(t.left)?t.right===bR||uR(t.right)?(t.start=i+t.start,t.end=i+t.end,t.delta=0,NR(t),gR(t,!0),gR(t.left,!1),gR(t.right,!1),t===t.parent.right&&(i-=t.parent.delta),t=t.parent):(i+=t.delta,t=t.right):t=t.left;gR(e.root,!1)}(this))}}function wR(e,t,i,n){return e<i||!(e>i)&&(1!==n&&(2===n||t))}function yR(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,h=Math.min(l,d),c=e.start;let u=!1;const g=e.end;let p=!1;t<=c&&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&&wR(c,r,t,e)&&(u=!0),!p&&wR(g,a,t,e)&&(p=!0)}if(h>0&&!o){const e=l>d?2:0;!u&&wR(c,r,t+h,e)&&(u=!0),!p&&wR(g,a,t+h,e)&&(p=!0)}{const n=o?1:0;!u&&wR(c,r,i,n)&&(e.start=t+d,u=!0),!p&&wR(g,a,i,n)&&(e.end=t+d,p=!0)}const m=d-l;u||(e.start=Math.max(0,c+m)),p||(e.end=Math.max(0,g+m)),e.start>e.end&&(e.end=e.start)}function SR(e,t){if(e.root===bR)return t.parent=bR,t.left=bR,t.right=bR,cR(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(TR(o,s,n.start+i,n.end+i)<0){if(n.left===bR){t.start-=i,t.end-=i,t.maxEnd-=i,n.left=t;break}n=n.left}else{if(n.right===bR){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=bR,t.right=bR,cR(t,1)}(e,t),IR(t.parent);let i=t;for(;i!==e.root&&1===hR(i.parent);)if(i.parent===i.parent.parent.left){const t=i.parent.parent.right;1===hR(t)?(cR(i.parent,0),cR(t,0),cR(i.parent.parent,1),i=i.parent.parent):(i===i.parent.right&&(i=i.parent,LR(e,i)),cR(i.parent,0),cR(i.parent.parent,1),DR(e,i.parent.parent))}else{const t=i.parent.parent.left;1===hR(t)?(cR(i.parent,0),cR(t,0),cR(i.parent.parent,1),i=i.parent.parent):(i===i.parent.left&&(i=i.parent,DR(e,i)),cR(i.parent,0),cR(i.parent.parent,1),LR(e,i.parent.parent))}return cR(e.root,0),t}function xR(e,t){let i,n;if(t.left===bR?(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===bR?(i=t.left,n=t):(n=function(e){for(;e.left!==bR;)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,cR(i,0),t.detach(),kR(),NR(i),void(e.root.parent=bR);const o=1===hR(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,cR(n,hR(t)),t===e.root?e.root=n:t===t.parent.left?t.parent.left=n:t.parent.right=n,n.left!==bR&&(n.left.parent=n),n.right!==bR&&(n.right.parent=n)),t.detach(),o)return IR(i.parent),n!==t&&(IR(n),IR(n.parent)),void kR();let s;for(IR(i),IR(i.parent),n!==t&&(IR(n),IR(n.parent));i!==e.root&&0===hR(i);)i===i.parent.left?(s=i.parent.right,1===hR(s)&&(cR(s,0),cR(i.parent,1),LR(e,i.parent),s=i.parent.right),0===hR(s.left)&&0===hR(s.right)?(cR(s,1),i=i.parent):(0===hR(s.right)&&(cR(s.left,0),cR(s,1),DR(e,s),s=i.parent.right),cR(s,hR(i.parent)),cR(i.parent,0),cR(s.right,0),LR(e,i.parent),i=e.root)):(s=i.parent.left,1===hR(s)&&(cR(s,0),cR(i.parent,1),DR(e,i.parent),s=i.parent.left),0===hR(s.left)&&0===hR(s.right)?(cR(s,1),i=i.parent):(0===hR(s.left)&&(cR(s.right,0),cR(s,1),LR(e,s),s=i.parent.left),cR(s,hR(i.parent)),cR(i.parent,0),cR(s.left,0),DR(e,i.parent),i=e.root));cR(i,0),kR()}function kR(){bR.parent=bR,bR.delta=0,bR.start=0,bR.end=0}function LR(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!==bR&&(i.left.parent=t),i.parent=t.parent,t.parent===bR?e.root=i:t===t.parent.left?t.parent.left=i:t.parent.right=i,i.left=t,t.parent=i,NR(t),NR(i)}function DR(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!==bR&&(i.right.parent=t),i.parent=t.parent,t.parent===bR?e.root=i:t===t.parent.right?t.parent.right=i:t.parent.left=i,i.right=t,t.parent=i,NR(t),NR(i)}function ER(e){let t=e.end;if(e.left!==bR){const i=e.left.maxEnd;i>t&&(t=i)}if(e.right!==bR){const i=e.right.maxEnd+e.delta;i>t&&(t=i)}return t}function NR(e){e.maxEnd=ER(e)}function IR(e){for(;e!==bR;){const t=ER(e);if(e.maxEnd===t)return;e.maxEnd=t,e=e.parent}}function TR(e,t,i,n){return e===i?t-n:e-i}class MR{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!==OR)return AR(this.right);let e=this;for(;e.parent!==OR&&e.parent.left!==e;)e=e.parent;return e.parent===OR?OR:e.parent}prev(){if(this.left!==OR)return RR(this.left);let e=this;for(;e.parent!==OR&&e.parent.right!==e;)e=e.parent;return e.parent===OR?OR:e.parent}detach(){this.parent=null,this.left=null,this.right=null}}const OR=new MR(null,0);function AR(e){for(;e.left!==OR;)e=e.left;return e}function RR(e){for(;e.right!==OR;)e=e.right;return e}function PR(e){return e===OR?0:e.size_left+e.piece.length+PR(e.right)}function FR(e){return e===OR?0:e.lf_left+e.piece.lineFeedCnt+FR(e.right)}function BR(){OR.parent=OR}function VR(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!==OR&&(i.left.parent=t),i.parent=t.parent,t.parent===OR?e.root=i:t.parent.left===t?t.parent.left=i:t.parent.right=i,i.left=t,t.parent=i}function WR(e,t){const i=t.left;t.left=i.right,i.right!==OR&&(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===OR?e.root=i:t===t.parent.right?t.parent.right=i:t.parent.left=i,i.right=t,t.parent=i}function HR(e,t){let i,n;if(t.left===OR?(n=t,i=n.right):t.right===OR?(n=t,i=n.left):(n=AR(t.right),i=n.right),n===e.root)return e.root=i,i.color=0,t.detach(),BR(),void(e.root.parent=OR);const o=1===n.color;if(n===n.parent.left?n.parent.left=i:n.parent.right=i,n===t?(i.parent=n.parent,UR(e,i)):(n.parent===t?i.parent=n:i.parent=n.parent,UR(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!==OR&&(n.left.parent=n),n.right!==OR&&(n.right.parent=n),n.size_left=t.size_left,n.lf_left=t.lf_left,UR(e,n)),t.detach(),i.parent.left===i){const t=PR(i),n=FR(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,jR(e,i.parent,o,s)}}if(UR(e,i.parent),o)return void BR();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,VR(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,WR(e,s),s=i.parent.right),s.color=i.parent.color,i.parent.color=0,s.right.color=0,VR(e,i.parent),i=e.root)):(s=i.parent.left,1===s.color&&(s.color=0,i.parent.color=1,WR(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,VR(e,s),s=i.parent.left),s.color=i.parent.color,i.parent.color=0,s.left.color=0,WR(e,i.parent),i=e.root));i.color=0,BR()}function zR(e,t){for(UR(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&&VR(e,t=t.parent),t.parent.color=0,t.parent.parent.color=1,WR(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&&WR(e,t=t.parent),t.parent.color=0,t.parent.parent.color=1,VR(e,t.parent.parent))}e.root.color=0}function jR(e,t,i,n){for(;t!==e.root&&t!==OR;)t.parent.left===t&&(t.parent.size_left+=i,t.parent.lf_left+=n),t=t.parent}function UR(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=PR((t=t.parent).left)-t.size_left,n=FR(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}}OR.parent=OR,OR.left=OR,OR.right=OR,OR.color=0;function $R(e){let t;return t=e[e.length-1]<65536?new Uint16Array(e.length):new Uint32Array(e.length),t.set(e,0),t}class KR{constructor(e,t,i,n,o){this.lineStarts=e,this.cr=t,this.lf=i,this.crlf=n,this.isBasicASCII=o}}function qR(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?$R(i):i}class GR{constructor(e,t,i,n,o){this.bufferIndex=e,this.start=t,this.end=i,this.lineFeedCnt=n,this.length=o}}class ZR{constructor(e,t){this.buffer=e,this.lineStarts=t}}class YR{constructor(e,t){this._pieces=[],this._tree=e,this._BOM=t,this._index=0,e.root!==OR&&e.iterate(e.root,(e=>(e!==OR&&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 XR{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 QR{constructor(e,t,i){this.create(e,t,i)}create(e,t,i){this._buffers=[new ZR("",[0])],this._lastChangeBufferPos={line:0,column:0},this.root=OR,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=qR(e[o].buffer));const t=new GR(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 XR(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 ZR(d,qR(d))),n=a,o=l,!0})),o>0){const t=n.replace(/\r\n|\r|\n/g,e);s.push(new ZR(t,qR(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 YR(this,e)}getOffsetAt(e,t){let i=0,n=this.root;for(;n!==OR;)if(n.left!==OR&&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!==OR;)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===OR){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!==OR;){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===OR)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,h=s.end.line;let c=l[d]+s.start.column;if(n&&(10===a.charCodeAt(c)&&(c++,r--),e[t++]=i,i="",n=!1,0===r))return!0;if(d===h)return this._EOLNormalized||13!==a.charCodeAt(c+r-1)?i+=a.substr(c,r):(n=!0,i+=a.substr(c,r-1)),!0;i+=this._EOLNormalized?a.substring(c,Math.max(c,l[d+1]-this._EOLLength)):a.substring(c,l[d+1]).replace(/(\r\n|\r|\n)$/,""),e[t++]=i;for(let n=d+1;n<h;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[h]+s.end.column-1)?i=a.substr(l[h],s.end.column):(n=!0,0===s.end.column?t--:i=a.substr(l[h],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,h){const c=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?(_=c.buffer.substring(g,p),v=e=>e+g,t.reset(0)):(_=c.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(h[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 h=this.positionInBuffer(l.node,l.remainder);if(a.node===l.node)return this.findMatchesInNode(a.node,r,e.startLineNumber,e.startColumn,d,h,t,i,n,s,o),o;let c=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,h=this.offsetInBuffer(u.piece.bufferIndex,u.piece.start),g=a[d.line+l],p=c===e.startLineNumber?e.startColumn:1;if(s=this.findMatchesInNode(u,r,c,p,d,this.positionInBuffer(u,g-h),t,i,n,s,o),s>=n)return o;c+=l}const h=c===e.startLineNumber?e.startColumn-1:0;if(c===e.endLineNumber){const a=this.getLineContent(c).substring(h,e.endColumn-1);return s=this._findMatchesInLine(t,r,a,e.endLineNumber,h,s,o,i,n),o}if(s=this._findMatchesInLine(t,r,this.getLineContent(c).substr(h),c,h,s,o,i,n),s>=n)return o;c++,a=this.nodeAt2(c,1),u=a.node,d=this.positionInBuffer(a.node,a.remainder)}if(c===e.endLineNumber){const a=c===e.startLineNumber?e.startColumn-1:0,l=this.getLineContent(c).substring(a,e.endColumn-1);return s=this._findMatchesInLine(t,r,l,e.endLineNumber,a,s,o,i,n),o}const g=c===e.startLineNumber?e.startColumn:1;return s=this.findMatchesInNode(l.node,r,c,g,d,h,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,h=i.length;let c=-a;for(;-1!==(c=i.indexOf(t,c+a));)if((!d||Gr(d,i,h,c,a))&&(r[s++]=new Zr(new qo(n,c+1+o,n,c+1+a+o),null),s>=l))return s;return s}let h;t.reset(0);do{if(h=t.next(i),h&&(r[s++]=Kr(new qo(n,h.index+1+o,n,h.index+1+h[0].length+o),h,a),s>=l))return s}while(h);return s}insert(e,t,i=!1){if(this._EOLNormalized=this._EOLNormalized&&i,this._lastVisitedLine.lineNumber=0,this._lastVisitedLine.value="",this.root!==OR){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<65535)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 GR(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 GR(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===OR)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 HR(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 h=o.next();h!==OR&&h!==s;h=h.next())r.push(h);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 GR(n.bufferIndex,o,n.end,this.getLineFeedCnt(n.bufferIndex,o,n.end),n.length-1);t.piece=s,e+="\n",jR(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,h=0,c=0;for(;a<=l&&(d=a+(l-a)/2|0,c=s[d],d!==l);)if(h=s[d+1],r<c)l=d-1;else{if(!(r>=h))break;a=d+1}return i?(i.line=d,i.column=r-c,null):{line:d,column:r-c}}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++)HR(this,e[t])}createNewPieces(e){if(e.length>65535){const t=[];for(;e.length>65535;){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,65535),e=e.substring(65535));const o=qR(n);t.push(new GR(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 ZR(n,o))}const i=qR(e);return t.push(new GR(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 ZR(e,i)),t}let t=this._buffers[0].buffer.length;const i=qR(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 GR(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!==OR;)if(i.left!==OR&&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!==OR;){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!==OR;)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,h=i.length+d;e.piece=new GR(i.bufferIndex,i.start,s,a,h),jR(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 GR(i.bufferIndex,s,i.end,r,d),jR(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),h=this.offsetInBuffer(n.bufferIndex,t)-this.offsetInBuffer(n.bufferIndex,o);e.piece=new GR(n.bufferIndex,n.start,l,d,h),jR(this,e,h-r,d-a);const c=new GR(n.bufferIndex,i,s,this.getLineFeedCnt(n.bufferIndex,i,s),this.offsetInBuffer(n.bufferIndex,s)-this.offsetInBuffer(n.bufferIndex,i)),u=this.rbInsertRight(e,c);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=qR(t,!1);for(let c=0;c<o.length;c++)o[c]+=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),h=d-l;e.piece=new GR(e.piece.bufferIndex,e.piece.start,r,d,a),this._lastChangeBufferPos=r,jR(this,e,t.length,h)}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!==OR;)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!==OR;)if(i.left!==OR&&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!==OR;){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===OR||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!==OR&&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 GR(e.piece.bufferIndex,e.piece.start,o,r,s),jR(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 GR(t.piece.bufferIndex,a,t.piece.end,d,l),jR(this,t,-1,-1),0===t.piece.length&&i.push(t);const h=this.createNewPieces("\r\n");this.rbInsertRight(e,h[0]);for(let c=0;c<i.length;c++)HR(this,i[c])}adjustCarriageReturnFromNext(e,t){if(this.shouldCheckCRLF()&&this.endWithCR(e)){const i=t.next();if(this.startWithLF(i)){if(e+="\n",1===i.piece.length)HR(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 GR(e.bufferIndex,t,e.end,o,n),jR(this,i,-1,-1)}return!0}}return!1}iterate(e,t){if(e===OR)return t(OR);const i=this.iterate(e.left,t);return i?t(e)&&this.iterate(e.right,t):i}getNodeContent(e){if(e===OR)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 MR(t,1);i.left=OR,i.right=OR,i.parent=OR,i.size_left=0,i.lf_left=0;if(this.root===OR)this.root=i,i.color=0;else if(e.right===OR)e.right=i,i.parent=e;else{const t=AR(e.right);t.left=i,i.parent=t}return zR(this,i),i}rbInsertLeft(e,t){const i=new MR(t,1);if(i.left=OR,i.right=OR,i.parent=OR,i.size_left=0,i.lf_left=0,this.root===OR)this.root=i,i.color=0;else if(e.left===OR)e.left=i,i.parent=e;else{const t=RR(e.left);t.right=i,i.parent=t}return zR(this,i),i}}function JR(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 eP 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 QR(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=Ss(this.getLineContent(e));return-1===t?0:t+1}getLineLastNonWhitespaceColumn(e){const t=xs(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=!Ls(t.text),s=e),!n&&e&&(n=Ds(t.text)),!o&&e&&(o=Yr(t.text))}let l="",d=0,h=0,c=0;if(t.text){let e;[d,h,c,e]=JR(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:h,lastLineLength:c,forceMoveMarkers:Boolean(t.forceMoveMarkers),isAutoWhitespaceEdit:t.isAutoWhitespaceEdit||!1}}a.sort(eP._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?eP._getInverseEditRanges(a):[],h=[];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!==Ss(n))||h.push({lineNumber:i,oldContent:n})}}let c=null;if(i){let e=0;c=[];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,c[t]={sortIndex:i.sortIndex,identifier:i.identifier,range:n,text:o,textChange:new MA(i.rangeOffset,o,s,i.text)}}l||c.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&&h.length>0){h.sort(((e,t)=>t.lineNumber-e.lineNumber)),g=[];for(let e=0,t=h.length;e<t;e++){const t=h[e].lineNumber;if(e>0&&h[e-1].lineNumber===t)continue;const i=h[e].oldContent,n=this.getLineContent(t);0!==n.length&&n!==i&&-1===Ss(n)&&g.push(t)}}return this._onDidChangeContent.fire(),new Xr(c,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,h,c]=JR(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:h,lastLineLength:c,forceMoveMarkers:t,isAutoWhitespaceEdit:!1}}_doApplyEdits(e){e.sort(eP._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 tP{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=qR(e);i[o]=new ZR(e,n)}const n=new eP(i,this._bom,t,this._containsRTL,this._containsUnusualLineTerminators,this._isBasicASCII,this._normalizeEOL);return{textBuffer:n,disposable:n}}}class iP{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&&Ns(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 KR($R(e),n,o,s,r);return e.length=0,a}(this._tmpLineStarts,e);this.chunks.push(new ZR(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=Ds(e)),this.isBasicASCII||this.containsUnusualLineTerminators||(this.containsUnusualLineTerminators=Yr(e))}finish(e=!0){return this._finish(),new tP(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=qR(e.buffer);e.lineStarts=t,13===this._previousChar&&this.cr++}}}class nP{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 oP{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 nP(e,[t]))}finalize(){return this._tokens}}class sP{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 rP{constructor(e,t){this.tokenizationSupport=e,this.initialState=t,this._lineBeginState=new sP(null),this._lineNeedsTokenization=new sP(!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 aP extends Uo{constructor(e,t){super(),this._textModel=e,this._languageIdCodec=t,this._isScheduled=!1,this._isDisposed=!1,this._tokenizationStateStore=null,this._register(Es.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]=JR(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=Es.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 rP(e,t):null,this._beginBackgroundTokenization()}_beginBackgroundTokenization(){!this._isScheduled&&this._textModel.isAttachedToEditor()&&this._hasLinesToTokenize()&&(this._isScheduled=!0,zv((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?hs(i):this._beginBackgroundTokenization())};i()}_backgroundTokenizeForAtLeast1ms(){const e=this._textModel.getLineCount(),t=new oP,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 oP;this._tokenizeViewport(i,e,t),this._textModel.setTokens(i.finalize(),!this._hasLinesToTokenize())}reset(){this._resetTokenizationState(),this._textModel.clearTokens()}forceTokenization(e){const t=new oP;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=lP(this._languageIdCodec,n,this._tokenizationStateStore.tokenizationSupport,s,!0,i),a=new wb(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=lP(this._languageIdCodec,l,this._tokenizationStateStore.tokenizationSupport,a,!0,s);return new wb(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=lP(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=lP(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=lP(this._languageIdCodec,r,this._tokenizationStateStore.tokenizationSupport,t,!0,a);e.add(l,i.tokens),this._tokenizationStateStore.markMustBeTokenized(l-1),a=i.endState}}}function lP(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=Lv(e.encodeLanguageId(t),s)),wb.convertToEndOffset(r.tokens,n.length),r}const dP=new Uint32Array(0).buffer;class hP{static deleteBeginning(e,t){return null===e||e===dP?e:hP.delete(e,0,t)}static deleteEnding(e,t){if(null===e||e===dP)return e;const i=cP(e),n=i[i.length-2];return hP.delete(e,t,n)}static delete(e,t,i){if(null===e||e===dP||t===i)return e;const n=cP(e),o=n.length>>>1;if(0===t&&n[n.length-2]===i)return dP;const s=wb.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 c=s+1;c<o;c++){const e=n[c<<1]-d;e>l&&(n[a++]=e,n[a++]=n[1+(c<<1)],l=e)}if(a===n.length)return e;const h=new Uint32Array(a);return h.set(n.subarray(0,a),0),h.buffer}static append(e,t){if(t===dP)return e;if(e===dP)return t;if(null===e)return e;if(null===t)return null;const i=cP(e),n=cP(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===dP)return e;const n=cP(e),o=n.length>>>1;let s=wb.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 cP(e){return e instanceof Uint32Array?e:new Uint32Array(e)}class uP{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!==dP)return new wb(cP(n),i,this._languageIdCodec);const o=new Uint32Array(2);return o[0]=i.length,o[1]=gP(this._languageIdCodec.encodeLanguageId(e)),new wb(o,i,this._languageIdCodec)}static _massageTokens(e,t,i){const n=i?cP(i):null;if(0===t){let t=!1;if(n&&n.length>1&&(t=ys.getLanguageId(n[1])!==e),!t)return dP}if(!n||0===n.length){const i=new Uint32Array(2);return i[0]=t,i[1]=gP(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=uP._massageTokens(this._languageIdCodec.encodeLanguageId(e),i,n);this._ensureLine(t);const r=this._lineTokens[t];return this._lineTokens[t]=s,!!o&&!uP._equals(r,s)}static _equals(e,t){if(!e||!t)return!e&&!t;const i=cP(e),n=cP(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]=hP.delete(this._lineTokens[t],e.startColumn-1,e.endColumn-1))}this._lineTokens[t]=hP.deleteEnding(this._lineTokens[t],e.startColumn-1);const i=e.endLineNumber-1;let n=null;i<this._len&&(n=hP.deleteBeginning(this._lineTokens[i],e.endColumn-1)),this._lineTokens[t]=hP.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]=hP.deleteEnding(this._lineTokens[n],e.column-1),this._lineTokens[n]=hP.insert(this._lineTokens[n],e.column-1,i),this._insertLines(e.lineNumber,t)):this._lineTokens[n]=hP.insert(this._lineTokens[n],e.column-1,i))}}function gP(e){return(16384|e<<0|2<<23)>>>0}class pP{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[pP._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 h=(e,t)=>{e!==d&&(d=e,a[l++]=e,a[l++]=t)};for(let c=0;c<s;c++){const e=n.getStartCharacter(c),i=n.getEndCharacter(c),s=n.getMetadata(c),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;)h(t.getEndOffset(r),t.getMetadata(r)),r++;for(r<o&&t.getStartOffset(r)<e&&h(e,t.getMetadata(r));r<o&&t.getEndOffset(r)<i;)h(t.getEndOffset(r),t.getMetadata(r)&l|s&a),r++;if(r<o)h(i,t.getMetadata(r)&l|s&a),t.getEndOffset(r)===i&&r++;else{const e=Math.min(Math.max(0,r-1),o-1);h(i,t.getMetadata(e)&l|s&a)}}for(;r<o;)h(t.getEndOffset(r),t.getMetadata(r)),r++;return new wb(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 mP=s_("undoRedoService");class fP{constructor(e,t){this.resource=e,this.elements=t}}class _P{constructor(){this.id=_P._ID++,this.order=1}nextOrder(){return 0===this.id?0:this.order++}}_P._ID=0,_P.None=new _P;class vP{constructor(){this.id=vP._ID++,this.order=1}nextOrder(){return 0===this.id?0:this.order++}}vP._ID=0,vP.None=new vP;var bP=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},CP=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};function wP(e){const t=new iP;return t.acceptChunk(e),t.finish()}function yP(e,t){return("string"==typeof e?wP(e):e).create(t)}let SP=0;class xP{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 kP=()=>{throw new Error("Invalid change accessor")};let LP=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 BP((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 VP),this._backgroundTokenizationState=0,this._onBackgroundTokenizationStateChanged=this._register(new $o),SP++,this.id="$model"+SP,this.isForSimpleWidget=n.isForSimpleWidget,this._associatedResource=null==o?Ps.parse("inmemory://model/"+SP):o,this._attachedEditorCount=0;const{textBuffer:l,disposable:d}=yP(t,n.defaultEOL);this._buffer=l,this._bufferDisposable=d,this._options=e.resolveOptions(this._buffer,n);const h=this._buffer.getLineCount(),c=this._buffer.getValueLengthInRange(new qo(1,1,h,this._buffer.getLineLength(h)+1),0);n.largeFileOptimizations?this._isTooLargeForTokenization=c>e.LARGE_FILE_SIZE_THRESHOLD||h>e.LARGE_FILE_LINE_COUNT_THRESHOLD:this._isTooLargeForTokenization=!1,this._isTooLargeForSyncing=c>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=Or(SP),this._lastDecorationId=0,this._decorations=Object.create(null),this._decorationsTree=new NP,this._commandManager=new rR(this,this._undoRedoService),this._isUndoing=!1,this._isRedoing=!1,this._trimAutoWhitespaceLines=null,this._tokens=new uP(this._languageService.languageIdCodec),this._semanticTokens=new pP(this._languageService.languageIdCodec),this._tokenization=new aP(this,this._languageService.languageIdCodec),this._bracketPairColorizer=this._register(new kA(this,this._languageConfigurationService)),this._guidesTextModelPart=this._register(new mT(this,this._languageConfigurationService)),this._decorationProvider=this._register(new NA(this)),this._register(this._decorationProvider.onDidChange((()=>{this._onDidChangeDecorations.beginDeferredEmit(),this._onDidChangeDecorations.fire(),this._onDidChangeDecorations.endDeferredEmit()})))}static resolveOptions(e,t){if(t.detectIndentation){const i=dR(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 eP([],"","\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 SM(e,t)))}setValue(e){if(this._assertNotDisposed(),null===e)return;const{textBuffer:t,disposable:i}=yP(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 NP,this._commandManager.clear(),this._trimAutoWhitespaceLines=null,this._emitContentChangedEvent(new wM([new mM],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 wM([new CM],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,NR(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=dR(this._buffer,t,e);this.updateOptions({insertSpaces:i.insertSpaces,tabSize:i.tabSize,indentSize:i.tabSize})}normalizeIndentation(e){return this._assertNotDisposed(),DN(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 xP(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]=JR(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]=JR(n.text);this._onDidChangeDecorations.fire();const a=n.range.startLineNumber,l=n.range.endLineNumber,d=l-a,h=r,c=Math.min(d,h),u=h-d,g=o-t-u+a,p=g,m=g+h,f=this._decorationsTree.getInjectedTextInInterval(this,this.getOffsetAt(new er(p,1)),this.getOffsetAt(new er(m,this.getLineMaxColumn(m))),0),_=fM.fromDecorations(f),v=new wr(_);for(let t=c;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 _M(i,this.getLineContent(n),o))}if(c<d){const t=a+c;e.push(new vM(t+1,l))}if(c<h){const i=new wr(_),n=a+c,s=h-c,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 bM(n+1,a+h,d,l))}t+=u}this._emitContentChangedEvent(new wM(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 _M(e,this.getLineContent(e),this._getInjectedTextInLine(e))));this._onDidChangeInjectedText.fire(new yM(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,FP(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=kP,i.changeDecoration=kP,i.changeDecorationOptions=kP,i.removeDecoration=kP,i.deltaDecorations=kP,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:PP[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(PP[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 fM.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 vR(t,0,0),this._decorations[t]=d}const t=i[a],o=this._validateRangeRelaxedNoAllocations(t.range),s=FP(t.options),r=this._buffer.getOffsetAt(o.startLineNumber,o.startColumn),h=this._buffer.getOffsetAt(o.endLineNumber,o.endColumn);d.ownerId=e,d.reset(n,r,h,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 DP(e){return!(!e.options.overviewRuler||!e.options.overviewRuler.color)}function EP(e){return!!e.options.after||!!e.options.before}LP.MODEL_SYNC_LIMIT=52428800,LP.LARGE_FILE_SIZE_THRESHOLD=20971520,LP.LARGE_FILE_LINE_COUNT_THRESHOLD=3e5,LP.DEFAULT_CREATION_OPTIONS={isForSimpleWidget:!1,tabSize:Km.tabSize,indentSize:Km.indentSize,insertSpaces:Km.insertSpaces,detectIndentation:!1,defaultEOL:1,trimAutoWhitespace:Km.trimAutoWhitespace,largeFileOptimizations:Km.largeFileOptimizations,bracketPairColorizationOptions:Km.bracketPairColorizationOptions},LP=bP([CP(4,mP),CP(5,rv),CP(6,pv)],LP);class NP{constructor(){this._decorationsTree0=new CR,this._decorationsTree1=new CR,this._injectedTextDecorationsTree=new CR}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){EP(e)?this._injectedTextDecorationsTree.insert(e):DP(e)?this._decorationsTree1.insert(e):this._decorationsTree0.insert(e)}delete(e){EP(e)?this._injectedTextDecorationsTree.delete(e):DP(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){EP(e)?this._injectedTextDecorationsTree.resolveNode(e,t):DP(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 IP(e){return e.replace(/[^a-z0-9\-_]/gi," ")}class TP{constructor(e){this.color=e.color||"",this.darkColor=e.darkColor||""}}class MP extends TP{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 OP extends TP{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?QS.fromHex(e):t.getColor(e.id)}}class AP{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 AP?e:new AP(e)}}class RP{constructor(e){var t,i;this.description=e.description,this.stickiness=e.stickiness||0,this.zIndex=e.zIndex||0,this.className=e.className?IP(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 MP(e.overviewRuler):null,this.minimap=e.minimap?new OP(e.minimap):null,this.glyphMarginClassName=e.glyphMarginClassName?IP(e.glyphMarginClassName):null,this.linesDecorationsClassName=e.linesDecorationsClassName?IP(e.linesDecorationsClassName):null,this.firstLineDecorationClassName=e.firstLineDecorationClassName?IP(e.firstLineDecorationClassName):null,this.marginClassName=e.marginClassName?IP(e.marginClassName):null,this.inlineClassName=e.inlineClassName?IP(e.inlineClassName):null,this.inlineClassNameAffectsLetterSpacing=e.inlineClassNameAffectsLetterSpacing||!1,this.beforeContentClassName=e.beforeContentClassName?IP(e.beforeContentClassName):null,this.afterContentClassName=e.afterContentClassName?IP(e.afterContentClassName):null,this.after=e.after?AP.from(e.after):null,this.before=e.before?AP.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 RP(e)}static createDynamic(e){return new RP(e)}}RP.EMPTY=RP.register({description:"empty"});const PP=[RP.register({description:"tracked-range-always-grows-when-typing-at-edges",stickiness:0}),RP.register({description:"tracked-range-never-grows-when-typing-at-edges",stickiness:1}),RP.register({description:"tracked-range-grows-only-when-typing-before",stickiness:2}),RP.register({description:"tracked-range-grows-only-when-typing-after",stickiness:3})];function FP(e){return e instanceof RP?e:RP.createDynamic(e)}class BP 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 VP 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 WP(e,t){return null===e?t?zP.INSTANCE:jP.INSTANCE:new HP(e,t)}class HP{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 fM(0,0,e+1,this._projectionData.injectionOptions[t],0)));s=fM.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=$P(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 h,c=null;if(l){c=[];let e=0,t=0;for(let i=0;i<a.getOutputLineCount();i++){const n=new Array;c[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,h=l[t]+e,c=h+r;if(h>s)break;if(o<c){const e=d[t];if(e.inlineClassName){const t=i>0?a.wrappedTextIndentLength:0,r=t+Math.max(h-o,0),l=t+Math.min(c-o,s);r!==l&&n.push(new jb(r,l,e.inlineClassName,e.inlineClassNameAffectsLetterSpacing))}}if(!(c<=s))break;e+=r,t++}}}h=l?e.getLineTokens(t).withInserted(l.map(((e,t)=>({offset:e,text:d[t].content,tokenMetadata:wb.defaultTokenMetadata})))):e.getLineTokens(t);for(let u=i;u<i+n;u++){const e=o+u-i;s[e]?r[e]=this._getViewLineData(h,c?c[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=$P(n.wrappedTextIndentLength)+l);const d=this._projectionData.getMinOutputOffset(i)+1,h=l.length+1,c=i+1<this.getViewLineCount(),u=0===i?0:n.breakOffsetsVisibleColumn[i-1];return new Wb(l,c,d,h,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 zP{constructor(){}isVisible(){return!0}setVisible(e){return e?this:jP.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 Wb(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}}zP.INSTANCE=new zP;class jP{constructor(){}isVisible(){return!1}setVisible(e){return e?zP.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")}}jP.INSTANCE=new jP;let UP=[""];function $P(e){if(e>=UP.length)for(let t=1;t<=e;t++)UP[t]=KP(t);return UP[e]}function KP(e){return new Array(e+1).join(" ")}class qP{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 YP(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 wr(fM.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 h=1,c=0,u=-1,g=u+1<d.length?c+1:o+2;for(let p=0;p<o;p++){const e=p+1;e===g&&(u++,h=d[u].startLineNumber,c=d[u].endLineNumber,g=u+1<d.length?c+1:o+2);const t=e>=h&&e<=c,i=WP(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:RP.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 h=0;h<this.modelLineProjections.length;h++){const e=h+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[h].isVisible()&&(this.modelLineProjections[h]=this.modelLineProjections[h].setVisible(!1),t=!0):(d=!0,this.modelLineProjections[h].isVisible()||(this.modelLineProjections[h]=this.modelLineProjections[h].setVisible(!0),t=!0)),t){const e=this.modelLineProjections[h].getViewLineCount();this.projectedModelLineLineCounts.setValue(h,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 AM(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,h=n.length;d<h;d++){const e=WP(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 RM(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=WP(i,this.modelLineProjections[n].isVisible());this.modelLineProjections[n]=s;const r=this.modelLineProjections[n].getViewLineCount();let a=!1,l=0,d=-1,h=0,c=-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,h=d+1,c=h+(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 OM(l,d):null,h<=c?new RM(h,c):null,u<=g?new AM(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 GP(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 GP(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 ZP(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 ZP(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 gT(e.visibleColumn,e.className,new pT(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 h=t-e+1,c=new Array(h);let u=0;for(let g=0,p=o.length;g<p;g++){let e=o[g];const t=Math.min(h-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),c[u++]=e}return c}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 h=n.getViewLineCount()-d,c=!1;if(o+h>t&&(c=!0,h=t-o+1),n.getViewLinesData(this.model,l+1,d,h,o-e,i,a),o+=h,c)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=[],h=0,c=null;for(const u of s){const e=u.id;c!==e&&(c=e,d[h++]=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 GP{constructor(e,t){this.modelLineNumber=e,this.modelLineWrappedLineIdx=t}get isWrappedLineContinuation(){return this.modelLineWrappedLineIdx>0}}class ZP{constructor(e,t){this.modelRange=e,this.viewLines=t}}class YP{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 XP{constructor(e){this.model=e}dispose(){}createCoordinatesConverter(){return new QP(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 AM(t,i)}onModelLinesInserted(e,t,i,n){return new RM(t,i)}onModelLineChanged(e,t,i){return[!1,new OM(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 Wb(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 QP{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 JP 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 zM,this.onEvent=this._eventDispatcher.onEvent,this.cursorConfig=new TN(this.model.getLanguageId(),this.model.getOptions(),this._configuration,this.languageConfigurationService),this._tokenizeViewportSoon=this._register(new Hv((()=>this.tokenizeViewport()),50)),this._updateConfigurationViewLineCount=this._register(new Hv((()=>this._updateConfigurationViewLineCountNow()),0)),this._hasFocus=!1,this._viewportStartLine=-1,this._viewportStartLineTrackedRange=null,this._viewportStartLineDelta=0,this.model.isTooLargeForTokenization())this._lines=new XP(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 qP(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 YM(i,this,this.coordinatesConverter,this.cursorConfig)),this.viewLayout=this._register(new xO(this._configuration,this.getLineCount(),s)),this._register(this.viewLayout.onDidScroll((e=>{e.scrollTopChanged&&this._tokenizeViewportSoon.schedule(),this._eventDispatcher.emitSingleViewEvent(new FM(e)),this._eventDispatcher.emitOutgoingEvent(new KM(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 kO(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(LT.getInstance().onDidChange((()=>{this._eventDispatcher.emitSingleViewEvent(new WM)}))),this._register(this._themeService.onDidColorThemeChange((e=>{this._invalidateDecorationsColorCache(),this._eventDispatcher.emitSingleViewEvent(new BM(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 IM(e)),this._eventDispatcher.emitOutgoingEvent(new $M(!e,e))}onCompositionStart(){this._eventDispatcher.emitSingleViewEvent(new xM)}onCompositionEnd(){this._eventDispatcher.emitSingleViewEvent(new kM)}_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 NM),e.emitViewEvent(new MM),e.emitViewEvent(new EM(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 EM(null))),e.emitViewEvent(new LM(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)}TN.shouldRecreate(t)&&(this.cursorConfig=new TN(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 wM?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 wr(a);for(const e of o)switch(e.changeType){case 1:this._lines.onModelFlushed(),t.emitViewEvent(new NM),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 MM),t.emitViewEvent(new EM(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 VM(t)),e.tokenizationSupportChanged&&this._tokenizeViewportSoon.schedule()}))),this._register(this.model.onDidChangeLanguageConfiguration((e=>{this._eventDispatcher.emitSingleViewEvent(new TM),this.cursorConfig=new TN(this.model.getLanguageId(),this.model.getOptions(),this._configuration,this.languageConfigurationService),this._cursor.updateConfiguration(this.cursorConfig)}))),this._register(this.model.onDidChangeLanguage((e=>{this.cursorConfig=new TN(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 NM),e.emitViewEvent(new MM),e.emitViewEvent(new EM(null)),this._cursor.onLineMappingChanged(e),this._decorations.onLineMappingChanged(),this.viewLayout.onFlushed(this.getLineCount())}finally{this._eventDispatcher.endEmitViewEvents()}this._updateConfigurationViewLineCount.schedule()}this.cursorConfig=new TN(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 EM(e))})))}setHiddenAreas(e){let t=!1;try{const i=this._eventDispatcher.beginEmitViewEvents();t=this._lines.setHiddenAreas(e),t&&(i.emitViewEvent(new NM),i.emitViewEvent(new MM),i.emitViewEvent(new EM(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 qM)}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,h=i.length;d<h;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=Ss(this.getLineContent(e));return-1===t?0:t+1}getLineLastNonWhitespaceColumn(e){const t=xs(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 Hb(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 Vb(this.getTabSize(),n)}getAllOverviewRulerDecorations(e){const t=this.model.getOverviewRulerDecorations(this._editorId,mf(this._configuration.options)),i=new eF;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("plaintext"===i)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===kf.fontFamily)r=kf.fontFamily;else{r=o.fontFamily,r=r.replace(/"/g,"'");if(!/[,']/.test(r)){/[+ ]/.test(r)&&(r=`'${r}'`)}r=`${r}, ${kf.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(),h=l===i?n-1:0,c=l===o?s-1:d.length;a+=""===d?"<br>":_O(d,e.inflate(),t,h,c,r,Rs)}return a}_getColorMap(){const e=Es.getColorMap(),t=["#000000"];if(e)for(let i=1,n=e.length;i<n;i++)t[i]=QS.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 ZM):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 PM(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 PM(e,!1,i,null,0,!0,0))))}revealRange(e,t,i,n,o){this._withViewEventsCollector((s=>s.emitViewEvent(new PM(e,!1,i,null,n,t,o))))}changeWhitespace(e){this.viewLayout.changeWhitespace(e)&&(this._eventDispatcher.emitSingleViewEvent(new HM),this._eventDispatcher.emitOutgoingEvent(new qM))}_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 eF{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 $b(e,t,[o,i,n]);this._asMap[e]=s,this.asArray.push(s)}}}class tF{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 iF,nF;(nF=iF||(iF={}))[nF.Ignore=0]="Ignore",nF[nF.Info=1]="Info",nF[nF.Warning=2]="Warning",nF[nF.Error=3]="Error",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"}}}(iF||(iF={}));var oF=iF,sF=oF;const rF=s_("notificationService");class aF{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 hF(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 hF(e-1,this.getMaxOutputOffset(e-1))}else if(1===i){if(e<this.getOutputLineCount()-1&&t===this.getMaxOutputOffset(e))return new hF(e+1,this.getMinOutputOffset(e+1))}return new hF(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&&lF(this.injectionOptions[i.injectedTextIndex].cursorStops))return i.offsetInInputWithInjections+i.length;{let e=i.offsetInInputWithInjections;if(dF(this.injectionOptions[i.injectedTextIndex].cursorStops))return e;let t=i.injectedTextIndex-1;for(;t>=0&&this.injectionOffsets[t]===this.injectionOffsets[i.injectedTextIndex]&&!lF(this.injectionOptions[t].cursorStops)&&(e-=this.injectionOptions[t].content.length,!dF(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 lF(e){return null==e||(e===da.Right||e===da.Both)}function dF(e){return null==e||(e===da.Left||e===da.Both)}class hF{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 cF{constructor(e,t){this.classifier=new uF(e,t)}static create(e){return new cF(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],h=r[e];!h||h.injectionOptions||d?l[e]=fF(this.classifier,o[e],d,t,i,a,n):l[e]=mF(this.classifier,h,o[e],t,i,a,n)}return gF.length=0,pF.length=0,l}}}}class uF extends ha{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 gF=[],pF=[];function mF(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,h=CF(i,n,o,s,r),c=o-h,u=gF,g=pF;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,h=0,C=0,w=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=_F(a,f,n,s)),t>m&&bF(v,b,a,l)&&(r=t,h=f),f+=d,f>_){t>m?(C=t,w=f-d):(C=o+1,w=f),f-h>c&&(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(ca(o)?(n--,g=0,p=2):(g=e.get(o),p=ks(o)?s:1),a<=_){if(0===C&&(C=t,w=a),a<=_-c)break;if(bF(o,g,l,d)){r=t,h=a;break}}a-=p,l=o,d=g}if(0!==r){const e=c-(w-h);if(e<=n){const t=i.charCodeAt(C);let o;o=Go(t)?2:_F(t,w,n,s),e-o<0&&(r=0)}}if(u){b--;continue}}if(0===r&&(r=C,h=w),r<=m){const e=i.charCodeAt(m);Go(e)?(r=m+2,h=f+2):(r=m+1,h=f+_F(e,f,n,s))}for(m=r,u[p]=r,f=h,g[p]=h,p++,_=h+c;b<0||b<v&&d[b]<h;)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,gF=t.breakOffsets,pF=t.breakOffsetsVisibleColumn,t.breakOffsets=u,t.breakOffsetsVisibleColumn=g,t.wrappedTextIndentLength=h,t)}function fF(e,t,i,n,o,s,r){const a=fM.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 aF(d,l,[a.length],[],0):null;const h=a.length;if(h<=1)return l?new aF(d,l,[a.length],[],0):null;const c=CF(a,n,o,s,r),u=o-c,g=[],p=[];let m=0,f=0,_=0,v=o,b=a.charCodeAt(0),C=e.get(b),w=_F(b,0,n,s),y=1;Go(b)&&(w+=1,b=a.charCodeAt(1),C=e.get(b),y++);for(let S=y;S<h;S++){const t=S,i=a.charCodeAt(S);let o,r;Go(i)?(S++,o=0,r=2):(o=e.get(i),r=_F(i,w,n,s)),bF(b,C,i,o)&&(f=t,_=w),w+=r,w>v&&((0===f||w-_>u)&&(f=t,_=w-r),g[m]=f,p[m]=_,m++,v=_+u,f=0),b=i,C=o}return 0!==m||i&&0!==i.length?(g[m]=h,p[m]=w,new aF(d,l,g,p,c)):null}function _F(e,t,i,n){return 9===e?i-t%i:ks(e)||e<32?n:1}function vF(e,t){return t-e%t}function bF(e,t,i,n){return 32!==i&&(2===t||3===t&&2!==n||1===n||3===n&&1!==t)}function CF(e,t,i,n,o){let s=0;if(0!==o){const r=Ss(e);if(-1!==r){for(let i=0;i<r;i++){s+=9===e.charCodeAt(i)?vF(s,t):1}const a=3===o?2:2===o?1:0;for(let e=0;e<a;e++){s+=vF(s,t)}s+n>i&&(s=0)}}return s}var wF;const yF=null===(wF=window.trustedTypes)||void 0===wF?void 0:wF.createPolicy("domLineBreaksComputer",{createHTML:e=>e});class SF{static create(){return new SF}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=fM.applyInjectedText(e[t],i),o=i.map((e=>e.options)),s=i.map((e=>e.column-1));return new aF(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,h=Math.round(i*d),c=Math.ceil(t.spaceWidth*h),u=document.createElement("div");Kf(u,t);const g=P_(1e4),p=[],m=[],f=[],_=[],v=[];for(let x=0;x<e.length;x++){const n=fM.applyInjectedText(e[x],s[x]);let r=0,a=0,d=l;if(0!==o)if(r=Ss(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 h=n.substr(r),u=xF(h,a,i,d,g,c);p[x]=r,m[x]=a,f[x]=h,_[x]=u[0],v[x]=u[1]}const b=g.build(),C=null!==(r=null==yF?void 0:yF.createHTML(b))&&void 0!==r?r:b;u.innerHTML=C,u.style.position="absolute",u.style.top="10000",u.style.wordWrap="break-word",document.body.appendChild(u);const w=document.createRange(),y=Array.prototype.slice.call(u.children,0),S=[];for(let x=0;x<e.length;x++){const e=kF(w,y[x],f[x],_[x]);if(null===e){S[x]=a(x);continue}const t=p[x],i=m[x]+h,n=v[x],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[x];d?(r=d.map((e=>e.options)),l=d.map((e=>e.column-1))):(r=null,l=null),S[x]=new aF(l,r,e,o,i)}return document.body.removeChild(u),S}(o,e,t,i,n,s)}}}function xF(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=[],h=[];let c=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,h[u]=a;const t=c;c=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===c?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,h[e.length]=a,o.appendASCIIString("</div>"),[d,h]}function kF(e,t,i,n){if(i.length<=1)return null;const o=Array.prototype.slice.call(t.children,0),s=[];try{LF(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 LF(e,t,i,n,o,s,r,a){if(n===s)return;if(o=o||DF(e,t,i[n],i[n+1]),r=r||DF(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=DF(e,t,i[l],i[l+1]);LF(e,t,i,n,o,l,d,a),LF(e,t,i,l,d,s,r,a)}function DF(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 EF=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},NF=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};let IF=0;class TF{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 MF=class e extends Uo{constructor(e,t,i,n,o,s,r,a,l,d,h,c){super(),this.languageConfigurationService=h,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 OF),this.onDidFocusEditorText=this._editorTextFocus.onDidChangeToTrue,this.onDidBlurEditorText=this._editorTextFocus.onDidChangeToFalse,this._editorWidgetFocus=this._register(new OF),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=++IF,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 AF(this,this._contextKeyService)),this._register(new RF(this,this._contextKeyService,c)),this._instantiationService=n.createChild(new tF([Dy,this._contextKeyService])),this._modelData=null,this._contributions={},this._actions={},this._focusTracker=new PF(e),this._register(this._focusTracker.onChange((()=>{this._editorWidgetFocus.setValue(this._focusTracker.hasFocus())}))),this._contentWidgets={},this._overlayWidgets={},g=Array.isArray(i.contributions)?i.contributions:pS.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)}pS.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 JM(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 OS(e,t,this._domElement,i)}getId(){return this.getEditorType()+":"+this._id}getEditorType(){return h_.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?qN.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 GD.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=pS.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,mf(this._configuration.options)):null}getDecorationsInRange(e){return this._modelData?this._modelData.model.getDecorationsInRange(e,this._id,mf(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){Kf(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 JP(this._id,this._configuration,e,SF.create(),cF.create(this._configuration.options),(e=>KC(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($m(0,"The number of cursors has been limited to {0}.",YM.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 TF(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 LI(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}};MF=EF([NF(3,n_),NF(4,r_),NF(5,iy),NF(6,Dy),NF(7,Ry),NF(8,rF),NF(9,NS),NF(10,pv),NF(11,lb)],MF);class OF 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 AF extends Uo{constructor(e,t){super(),this._editor=e,t.createKey("editorId",e.getId()),this._editorSimpleInput=dI.editorSimpleInput.bindTo(t),this._editorFocus=dI.focus.bindTo(t),this._textInputFocus=dI.textInputFocus.bindTo(t),this._editorTextFocus=dI.editorTextFocus.bindTo(t),this._editorTabMovesFocus=dI.tabMovesFocus.bindTo(t),this._editorReadonly=dI.readOnly.bindTo(t),this._inDiffEditor=dI.inDiffEditor.bindTo(t),this._editorColumnSelection=dI.columnSelection.bindTo(t),this._hasMultipleSelections=dI.hasMultipleSelections.bindTo(t),this._hasNonEmptySelection=dI.hasNonEmptySelection.bindTo(t),this._canUndo=dI.canUndo.bindTo(t),this._canRedo=dI.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 RF extends Uo{constructor(e,t,i){super(),this._editor=e,this._contextKeyService=t,this._languageFeaturesService=i,this._langId=dI.languageId.bindTo(t),this._hasCompletionItemProvider=dI.hasCompletionItemProvider.bindTo(t),this._hasCodeActionsProvider=dI.hasCodeActionsProvider.bindTo(t),this._hasCodeLensProvider=dI.hasCodeLensProvider.bindTo(t),this._hasDefinitionProvider=dI.hasDefinitionProvider.bindTo(t),this._hasDeclarationProvider=dI.hasDeclarationProvider.bindTo(t),this._hasImplementationProvider=dI.hasImplementationProvider.bindTo(t),this._hasTypeDefinitionProvider=dI.hasTypeDefinitionProvider.bindTo(t),this._hasHoverProvider=dI.hasHoverProvider.bindTo(t),this._hasDocumentHighlightProvider=dI.hasDocumentHighlightProvider.bindTo(t),this._hasDocumentSymbolProvider=dI.hasDocumentSymbolProvider.bindTo(t),this._hasReferenceProvider=dI.hasReferenceProvider.bindTo(t),this._hasRenameProvider=dI.hasRenameProvider.bindTo(t),this._hasSignatureHelpProvider=dI.hasSignatureHelpProvider.bindTo(t),this._hasInlayHintsProvider=dI.hasInlayHintsProvider.bindTo(t),this._hasDocumentFormattingProvider=dI.hasDocumentFormattingProvider.bindTo(t),this._hasDocumentSelectionFormattingProvider=dI.hasDocumentSelectionFormattingProvider.bindTo(t),this._hasMultipleDocumentFormattingProvider=dI.hasMultipleDocumentFormattingProvider.bindTo(t),this._hasMultipleDocumentSelectionFormattingProvider=dI.hasMultipleDocumentSelectionFormattingProvider.bindTo(t),this._isInWalkThrough=dI.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===IC.walkThroughSnippet)})):this.reset()}}class PF extends Uo{constructor(e){super(),this._onChange=this._register(new $o),this.onChange=this._onChange.event,this._hasFocus=!1,this._domFocusTracker=this._register(kw(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 FF=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='"),BF=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 VF(e){return FF+encodeURIComponent(e.toString())+BF}const WF=encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" height="3" width="12"><g fill="'),HF=encodeURIComponent('"><circle cx="1" cy="1" r="1"/><circle cx="5" cy="1" r="1"/><circle cx="9" cy="1" r="1"/></g></svg>');zy(((e,t)=>{const i=e.getColor(Kx);i&&t.addRule(`.monaco-editor .squiggly-error { border-bottom: 4px double ${i}; }`);const n=e.getColor($x);n&&t.addRule(`.monaco-editor .squiggly-error { background: url("data:image/svg+xml,${VF(n)}") repeat-x bottom left; }`);const o=e.getColor(Ux);o&&t.addRule(`.monaco-editor .squiggly-error::before { display: block; content: ''; width: 100%; height: 100%; background: ${o}; }`);const s=e.getColor(Zx);s&&t.addRule(`.monaco-editor .squiggly-warning { border-bottom: 4px double ${s}; }`);const r=e.getColor(Gx);r&&t.addRule(`.monaco-editor .squiggly-warning { background: url("data:image/svg+xml,${VF(r)}") repeat-x bottom left; }`);const a=e.getColor(qx);a&&t.addRule(`.monaco-editor .squiggly-warning::before { display: block; content: ''; width: 100%; height: 100%; background: ${a}; }`);const l=e.getColor(Qx);l&&t.addRule(`.monaco-editor .squiggly-info { border-bottom: 4px double ${l}; }`);const d=e.getColor(Xx);d&&t.addRule(`.monaco-editor .squiggly-info { background: url("data:image/svg+xml,${VF(d)}") repeat-x bottom left; }`);const h=e.getColor(Yx);h&&t.addRule(`.monaco-editor .squiggly-info::before { display: block; content: ''; width: 100%; height: 100%; background: ${h}; }`);const c=e.getColor(ek);c&&t.addRule(`.monaco-editor .squiggly-hint { border-bottom: 2px dotted ${c}; }`);const u=e.getColor(Jx);var g;u&&t.addRule(`.monaco-editor .squiggly-hint { background: url("data:image/svg+xml,${g=u,WF+encodeURIComponent(g.toString())+HF}") no-repeat bottom left; }`);const p=e.getColor(GE);p&&t.addRule(`.monaco-editor.showUnused .squiggly-inline-unnecessary { opacity: ${p.rgba.a}; }`);const m=e.getColor(qE);m&&t.addRule(`.monaco-editor.showUnused .squiggly-unnecessary { border-bottom: 2px dashed ${m}; }`);const f=e.getColor(ik)||"inherit";t.addRule(`.monaco-editor.showDeprecated .squiggly-inline-deprecated { text-decoration: line-through; text-decoration-color: ${f}}`)}));class zF{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 jF(e){return e.preventDefault(),e.stopPropagation(),e}var UF=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 $F,KF;(KF=$F||($F={})).North="north",KF.South="south",KF.East="east",KF.West="west";const qF=new $o;const GF=new $o;class ZF{constructor(){this.disposables=new Cs}get onPointerMove(){return this.disposables.add(new zF(window,"mousemove")).event}get onPointerUp(){return this.disposables.add(new zF(window,"mouseup")).event}dispose(){this.disposables.dispose()}}UF([VS],ZF.prototype,"onPointerMove",null),UF([VS],ZF.prototype,"onPointerUp",null);class YF{constructor(e){this.el=e,this.disposables=new Cs}get onPointerMove(){return this.disposables.add(new zF(this.el,WS.Change)).event}get onPointerUp(){return this.disposables.add(new zF(this.el,WS.End)).event}dispose(){this.disposables.dispose()}}UF([VS],YF.prototype,"onPointerMove",null),UF([VS],YF.prototype,"onPointerUp",null);class XF{constructor(e){this.factory=e}get onPointerMove(){return this.factory.onPointerMove}get onPointerUp(){return this.factory.onPointerUp}dispose(){}}UF([VS],XF.prototype,"onPointerMove",null),UF([VS],XF.prototype,"onPointerUp",null);class QF extends Uo{constructor(e,t,i){super(),this.hoverDelay=300,this.hoverDelayer=this._register(new Av(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 Cs),this.orthogonalStartDragHandleDisposables=this._register(new Cs),this.orthogonalEndSashDisposables=this._register(new Cs),this.orthogonalEndDragHandleDisposables=this._register(new Cs),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=Lw(e,Mw(".monaco-sash")),i.orthogonalEdge&&this.el.classList.add(`orthogonal-edge-${i.orthogonalEdge}`),Ho&&this.el.classList.add("mac");const n=this._register(new zF(this.el,"mousedown")).event;this._register(n((e=>this.onPointerStart(e,new ZF)),this));const o=this._register(new zF(this.el,"dblclick")).event;this._register(o(this.onPointerDoublePress,this));const s=this._register(new zF(this.el,"mouseenter")).event;this._register(s((()=>QF.onMouseEnter(this))));const r=this._register(new zF(this.el,"mouseleave")).event;this._register(r((()=>QF.onMouseLeave(this)))),this._register($S.addTarget(this.el));const a=ds.map(this._register(new zF(this.el,WS.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 YF(this.el))),this));const l=this._register(new zF(this.el,WS.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(qF.event((e=>{this.size=e,this.layout()})))),this._register(GF.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=Lw(this.el,Mw(".orthogonal-drag-handle.start")),this.orthogonalStartDragHandleDisposables.add(es((()=>this._orthogonalStartDragHandle.remove()))),this.orthogonalStartDragHandleDisposables.add(new zF(this._orthogonalStartDragHandle,"mouseenter")).event((()=>QF.onMouseEnter(e)),void 0,this.orthogonalStartDragHandleDisposables),this.orthogonalStartDragHandleDisposables.add(new zF(this._orthogonalStartDragHandle,"mouseleave")).event((()=>QF.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=Lw(this.el,Mw(".orthogonal-drag-handle.end")),this.orthogonalEndDragHandleDisposables.add(es((()=>this._orthogonalEndDragHandle.remove()))),this.orthogonalEndDragHandleDisposables.add(new zF(this._orthogonalEndDragHandle,"mouseenter")).event((()=>QF.onMouseEnter(e)),void 0,this.orthogonalEndDragHandleDisposables),this.orthogonalEndDragHandleDisposables.add(new zF(this._orthogonalEndDragHandle,"mouseleave")).event((()=>QF.onMouseLeave(e)),void 0,this.orthogonalEndDragHandleDisposables))};this.orthogonalEndSashDisposables.add(e.onDidEnablementChange.event(t,this)),t(e.state)}this._orthogonalEndSash=e}onPointerStart(e,t){Sw(e);let i=!1;if(!e.__orthogonalSashEvent){const n=this.getOrthogonalSash(e);n&&(i=!0,e.__orthogonalSashEvent=!0,n.onPointerStart(e,new XF(t)))}if(this.linkedSash&&!e.__linkedSashEvent&&(e.__linkedSashEvent=!0,this.linkedSash.onPointerStart(e,new XF(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("pointer-events-disabled");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=fw(this.el),h=()=>{let e="";e=i?"all-scroll":1===this.orientation?1===this.state?"s-resize":2===this.state?"n-resize":Ho?"row-resize":"ns-resize":1===this.state?"e-resize":2===this.state?"w-resize":Ho?"col-resize":"ew-resize",d.textContent=`* { cursor: ${e} !important; }`},c=new Cs;h(),i||this.onDidEnablementChange.event(h,null,c);t.onPointerMove((e=>{Sw(e,!1);const t={startX:s,currentX:e.pageX,startY:r,currentY:e.pageY,altKey:a};this._onDidChange.fire(t)}),null,c),t.onPointerUp((e=>{Sw(e,!1),this.el.removeChild(d),this.el.classList.remove("active"),this._onDidEnd.fire(),c.dispose();for(const t of n)t.classList.remove("pointer-events-disabled")}),null,c),c.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&&QF.onMouseEnter(e.linkedSash,!0)}static onMouseLeave(e,t=!1){e.hoverDelayer.cancel(),e.el.classList.remove("hover"),!t&&e.linkedSash&&QF.onMouseLeave(e.linkedSash,!0)}clearSashHoverState(){QF.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 JF{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 JF(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 eB={RESOURCES:"ResourceURLs",DOWNLOAD_URL:"DownloadURL",FILES:"Files",TEXT:uE.text,TERMINALS:"Terminals"};class tB{constructor(e){this.data=e}update(){}getData(){return this.data}}const iB={CurrentDragAndDropData:void 0};class nB extends Uo{constructor(e,t,i={}){super(),this.options=i,this._context=e||this,this._action=t,t instanceof Xw&&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 Qw)),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($S.addTarget(e));const i=this.options&&this.options.draggable;i&&(e.draggable=!0,Rf&&this._register(BC(e,yw.DRAG_START,(e=>{var t;return null===(t=e.dataTransfer)||void 0===t?void 0:t.setData(eB.TEXT,this._action.label)})))),this._register(BC(t,WS.Tap,(e=>this.onClick(e,!0)))),this._register(BC(t,yw.MOUSE_DOWN,(e=>{i||Sw(e,!0),this._action.enabled&&0===e.button&&t.classList.add("active")}))),Ho&&this._register(BC(t,yw.CONTEXT_MENU,(e=>{0===e.button&&!0===e.ctrlKey&&this.onClick(e)}))),this._register(BC(t,yw.CLICK,(e=>{Sw(e,!0),this.options&&this.options.isMenu||this.onClick(e)}))),this._register(BC(t,yw.DBLCLICK,(e=>{Sw(e,!0)}))),[yw.MOUSE_UP,yw.MOUSE_OUT].forEach((e=>{this._register(BC(t,e,(e=>{Sw(e),t.classList.remove("active")})))}))}onClick(e,t=!1){var i;Sw(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 oB extends nB{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=Lw(this.element,Mw("a.action-label"))),this.label&&(this._action.id===Jw.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&&(Lw(this.element,Mw("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=$m(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 sB=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 rB 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 Qw,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(BC(this.domNode,yw.KEY_DOWN,(e=>{const t=new SC(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 nB&&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(BC(this.domNode,yw.KEY_UP,(e=>{const t=new SC(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(kw(this.domNode)),this._register(this.focusTracker.onDidBlur((()=>{mw()!==this.domNode&&dw(mw(),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 nB&&e.isEnabled()));e instanceof nB&&e.setFocusable(!0)}else this.viewItems.forEach((e=>{e instanceof nB&&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(dw(mw(),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(BC(i,yw.CONTEXT_MENU,(e=>{Sw(e,!0)}))),this.options.actionViewItemProvider&&(o=this.options.actionViewItemProvider(e)),o||(o=new oB(this.context,e,t)),o.actionRunner=this._actionRunner,o.setActionContext(this.context),o.render(i),this.focusable&&o instanceof nB&&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=[],RC(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 nB){const i=null===t._context||void 0===t._context?e:t._context;this.run(t._action,i)}}run(e,t){return sB(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 aB;(aB||(aB={})).getDefinition=function(e,t){let i=e.defaults;for(;Fy.isThemeIcon(i);){const e=lB.getIcon(i.id);if(!e)return;i=e.defaults}return i};const lB=new class{constructor(){this._onDidChange=new $o,this.onDidChange=this._onDidChange.event,this.iconSchema={definitions:{icons:{type:"object",properties:{fontId:{type:"string",description:$m(0,"The id of the font to use. If not set, the font that is defined first is used.")},fontCharacter:{type:"string",description:$m(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(;Fy.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}|${Fy.isThemeIcon(o.defaults)?o.defaults.id:o.id}|${o.description||""}|`);i.push("| preview | identifier "),i.push("| ----------- | --------------------------------- |");for(const o of n.filter((e=>!Fy.isThemeIcon(e.defaults))).sort(e))i.push(`|<i class="${t(o)}"></i>|${o.id}|`);return i.join("\n")}};function dB(e,t,i,n){return lB.registerIcon(e,t,i,n)}function hB(){return lB}My.add("base.contributions.icons",lB),function(){for(const e of br.getAll())lB.registerIcon(e.id,e.definition,e.description)}();let cB=My.as(JS);cB.registerSchema("vscode://schemas/icons",lB.getIconSchema());const uB=new Hv((()=>cB.notifySchemaChanged("vscode://schemas/icons")),200);lB.onDidChange((()=>{uB.isScheduled()||uB.schedule()}));const gB=dB("widget-close",br.close,$m(0,"Icon for the close action in widgets."));dB("goto-previous-location",br.arrowUp,$m(0,"Icon for goto previous editor location.")),dB("goto-next-location",br.arrowDown,$m(0,"Icon for goto next editor location.")),Fy.modify(br.sync,"spin"),Fy.modify(br.loading,"spin");var pB,mB=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},fB=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}},_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{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 bB{constructor(e){this.entries=e}}const CB=dB("diff-review-insert",br.add,$m(0,"Icon for 'Insert' in diff review.")),wB=dB("diff-review-remove",br.remove,$m(0,"Icon for 'Remove' in diff review.")),yB=dB("diff-review-close",br.close,$m(0,"Icon for 'Close' in diff review."));let SB=class e extends Uo{constructor(e,t){super(),this._languageService=t,this._width=0,this._diffEditor=e,this._isVisible=!1,this.shadow=$f(document.createElement("div")),this.shadow.setClassName("diff-review-shadow"),this.actionBarContainer=$f(document.createElement("div")),this.actionBarContainer.setClassName("diff-review-actions"),this._actionBar=this._register(new rB(this.actionBarContainer.domNode)),this._actionBar.push(new Xw("diffreview.close",$m(0,"Close"),"close-diff-review "+Fy.asClassName(yB),!0,(()=>_B(this,void 0,void 0,(function*(){return this.hide()})))),{label:!1,icon:!0}),this.domNode=$f(document.createElement("div")),this.domNode.setClassName("diff-review monaco-editor-background"),this._content=$f(document.createElement("div")),this._content.setClassName("diff-review-content"),this._content.setAttribute("role","code"),this.scrollbar=this._register(new sT(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(WC(this.domNode.domNode,"click",(e=>{e.preventDefault();const t=hw(e.target,"diff-review-row");t&&this._goToRow(t)}))),this._register(WC(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,h=s.modifiedStartLineNumber,c=s.modifiedEndLineNumber,u=[];let g=0;{const t=0===a?r:r-1,i=0===c?h:h-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 vB(s,t,d,i)}0!==a&&(u[g++]=new vB(r,a,0,0)),0!==c&&(u[g++]=new vB(0,0,h,c));{const n=0===a?r+1:a+1,o=0===c?h+1:c+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 vB(n,m,o,f)}n[o++]=new bB(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 vB(t.originalLineStart,i.originalLineEnd,t.modifiedLineStart,i.modifiedLineEnd),s=s.concat(e.slice(1))):(r[a++]=new bB(s),s=e)}return r[a++]=new bB(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 RC(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'),Kf(d,i.get(44));let h=0,c=0,u=0,g=0;for(let e=0,S=l.length;e<S;e++){const t=l[e],i=t.originalLineStart,n=t.originalLineEnd,o=t.modifiedLineStart,s=t.modifiedLineEnd;0!==i&&(0===h||i<h)&&(h=i),0!==n&&(0===c||n>c)&&(c=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=c-h+1,_=g-u+1;m.appendChild(document.createTextNode(`${a+1}/${this._diffs.length}: @@ -${h},${f} +${u},${_} @@`)),p.setAttribute("data-line",String(u));const v=e=>0===e?$m(0,"no lines changed"):1===e?$m(0,"1 line changed"):$m(0,"{0} lines changed",e),b=v(f),C=v(_);p.setAttribute("aria-label",$m(0,"Difference {0} of {1}: original line {2}, {3}, modified line {4}, {5}",a+1,this._diffs.length,h,b,u,C)),p.appendChild(m),p.setAttribute("role","listitem"),d.appendChild(p);const w=i.get(59);let y=u;for(let S=0,x=l.length;S<x;S++){const a=l[S];e._renderSection(d,a,y,w,this._width,t,n,s,i,o,r,this._languageService.languageIdCodec),0!==a.modifiedLineStart&&(y=a.modifiedLineEnd)}RC(this._content.domNode),this._content.domNode.appendChild(d),this.scrollbar.scanDomNode()}static _renderSection(t,i,n,o,s,r,a,l,d,h,c,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=CB;break;case 2:p="diff-review-row line-delete",m=" char-delete",f=wB}const _=i.originalLineStart,v=i.originalLineEnd,b=i.modifiedLineStart,C=i.modifiedLineEnd,w=Math.max(C-b,v-_),y=r.get(131),S=y.glyphMarginWidth+y.lineNumbersWidth,x=d.get(131),k=10+x.glyphMarginWidth+x.lineNumbersWidth;for(let L=0;L<=w;L++){const i=0===_?0:_+L,v=0===b?0:b+L,C=document.createElement("div");C.style.minWidth=s+"px",C.className=p,C.setAttribute("role","listitem"),0!==v&&(n=v),C.setAttribute("data-line",String(n));const w=document.createElement("div");w.className="diff-review-cell",w.style.height=`${o}px`,C.appendChild(w);const y=document.createElement("span");y.style.width=S+"px",y.style.minWidth=S+"px",y.className="diff-review-line-number"+m,0!==i?y.appendChild(document.createTextNode(String(i))):y.innerText=" ",w.appendChild(y);const x=document.createElement("span");x.style.width=k+"px",x.style.minWidth=k+"px",x.style.paddingRight="10px",x.className="diff-review-line-number"+m,0!==v?x.appendChild(document.createTextNode(String(v))):x.innerText=" ",w.appendChild(x);const D=document.createElement("span");if(D.className="diff-review-spacer",f){const e=document.createElement("span");e.className=Fy.asClassName(f),e.innerText=" ",D.appendChild(e)}else D.innerText=" ";let E;if(w.appendChild(D),0!==v){let t=this._renderLine(h,d,c.tabSize,v,u);e._ttPolicy&&(t=e._ttPolicy.createHTML(t)),w.insertAdjacentHTML("beforeend",t),E=h.getLineContent(v)}else{let t=this._renderLine(a,r,l.tabSize,i,u);e._ttPolicy&&(t=e._ttPolicy.createHTML(t)),w.insertAdjacentHTML("beforeend",t),E=a.getLineContent(i)}0===E.length&&(E=$m(0,"blank"));let N="";switch(g){case 0:N=i===v?$m(0,"{0} unchanged line {1}",E,i):$m(0,"{0} original line {1} modified line {2}",E,i,v);break;case 1:N=$m(0,"+ {0} modified line {1}",E,v);break;case 2:N=$m(0,"- {0} original line {1}",E,i)}C.setAttribute("aria-label",N),t.appendChild(C)}}static _renderLine(e,t,i,n,o){const s=e.getLineContent(n),r=t.get(44),a=wb.createEmpty(s,o),l=Hb.isBasicASCII(s,e.mightContainNonBasicASCII()),d=Hb.containsRTL(s,l,e.mightContainRTL());return Ab(new Eb(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)!==uf.OFF,null)).html}};SB._ttPolicy=null===(pB=window.trustedTypes)||void 0===pB?void 0:pB.createPolicy("diffReview",{createHTML:e=>e}),SB=mB([fB(1,rv)],SB),zy(((e,t)=>{const i=e.getColor(BE);i&&t.addRule(`.monaco-diff-editor .diff-review-line-number { color: ${i}; }`);const n=e.getColor(Vx);n&&t.addRule(`.monaco-diff-editor .diff-review-shadow { box-shadow: ${n} 0 -6px 6px -6px inset; }`)}));function xB(e){const t=e.get(r_),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}hS(class extends rS{constructor(){super({id:"editor.action.diffReview.next",label:$m(0,"Go to Next Difference"),alias:"Go to Next Difference",precondition:ry.has("isInDiffEditor"),kbOpts:{kbExpr:null,primary:65,weight:100}})}run(e,t){const i=xB(e);i&&i.diffReviewNext()}}),hS(class extends rS{constructor(){super({id:"editor.action.diffReview.prev",label:$m(0,"Go to Previous Difference"),alias:"Go to Previous Difference",precondition:ry.has("isInDiffEditor"),kbOpts:{kbExpr:null,primary:1089,weight:100}})}run(e,t){const i=xB(e);i&&i.diffReviewPrev()}});const kB=s_("editorWorkerService"),LB=s_("contextViewService"),DB=s_("contextMenuService");var EB=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 NB 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 Xw("diff.clipboard.copyDeletedContent",d?n.originalEndLineNumber>n.modifiedStartLineNumber?$m(0,"Copy deleted lines"):$m(0,"Copy deleted line"):n.originalEndLineNumber>n.modifiedStartLineNumber?$m(0,"Copy changed lines"):$m(0,"Copy changed line"),void 0,!0,(()=>EB(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 h,c=0;n.originalEndLineNumber>n.modifiedStartLineNumber&&(h=new Xw("diff.clipboard.copyDeletedLineContent",$m(0,d?"Copy deleted line ({0})":"Copy changed line ({0})",n.originalStartLineNumber),void 0,!0,(()=>EB(this,void 0,void 0,(function*(){const e=n.originalModel.getLineContent(n.originalStartLineNumber+c);if(""===e){const e=n.originalModel.getEndOfLineSequence();yield this._clipboardService.writeText(0===e?"\n":"\r\n")}else yield this._clipboardService.writeText(e)})))),l.push(h));i.getOption(81)||l.push(new Xw("diff.inline.revertChange",$m(0,"Revert this change"),void 0,!0,(()=>EB(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:()=>(h&&(h.label=$m(0,d?"Copy deleted line ({0})":"Copy changed line ({0})",n.originalStartLineNumber+c)),l),autoSelectFirstItem:!0})};this._register(WC(this._diffActions,"mousedown",(e=>{const{top:t,height:i}=nw(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,c=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(),c=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}=nw(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 IB=s_("clipboardService");Object.freeze({total(){},worked(){},done(){}});class TB{constructor(e){this.callback=e}report(e){this._value=e,this.callback(this._value)}}TB.None=Object.freeze({report(){}});const MB=s_("editorProgressService");var OB,AB=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},RB=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};class PB{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?JF.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 NB(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 FB=0;const BB=dB("diff-insert",br.add,$m(0,"Line decoration for inserts in the diff editor.")),VB=dB("diff-remove",br.remove,$m(0,"Line decoration for removals in the diff editor.")),WB=null===(OB=window.trustedTypes)||void 0===OB?void 0:OB.createPolicy("diffEditorWidget",{createHTML:e=>e});let HB=class e extends Uo{constructor(t,i,n,o,s,r,a,l,d,h,c,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 tF([Dy,this._contextKeyService])),this._contextKeyService.createKey("isInDiffEditor",!0),this._themeService=d,this._notificationService=h,this._id=++FB,this._state=0,this._updatingDiffProgress=null,this._domElement=t,i=i||{},this._options=tV(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 Hv((()=>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=$f(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(WC(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 PB(c,o),this._modifiedEditorState=new PB(c,o),this._isVisible=!0,this._isHandlingScrollEvent=!1,this._elementSizeObserver=this._register(new xS(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(SB,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 qB(this._createDataSource(),this._options.enableSplitViewResizing)):this._setStrategy(new ZB(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=pS.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+=Vy(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(MF,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 h_.IDiffEditor}getLineChanges(){return this._diffComputationResult?this._diffComputationResult.changes:null}getOriginalEditor(){return this._originalEditor}getModifiedEditor(){return this._modifiedEditor}updateOptions(t){const i=tV(t,this._options),n=(o=this._options,s=i,{enableSplitViewResizing:o.enableSplitViewResizing!==s.enableSplitViewResizing,renderSideBySide:o.renderSideBySide!==s.renderSideBySide,maxComputationTime:o.maxComputationTime!==s.maxComputationTime,maxFileSize:o.maxFileSize!==s.maxFileSize,ignoreTrimWhitespace:o.ignoreTrimWhitespace!==s.ignoreTrimWhitespace,renderIndicators:o.renderIndicators!==s.renderIndicators,originalEditable:o.originalEditable!==s.originalEditable,diffCodeLens:o.diffCodeLens!==s.diffCodeLens,renderOverviewRuler:o.renderOverviewRuler!==s.renderOverviewRuler,diffWordWrap:o.diffWordWrap!==s.diffWordWrap});var o,s;this._options=i;const r=n.ignoreTrimWhitespace||n.renderIndicators,a=this._isVisible&&(n.maxComputationTime||n.maxFileSize);r?this._beginUpdateDecorations():a&&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 qB(this._createDataSource(),this._options.enableSplitViewResizing)):this._setStrategy(new ZB(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($m(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=Ef.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}};HB.ONE_OVERVIEW_WIDTH=15,HB.ENTIRE_DIFF_OVERVIEW_WIDTH=30,HB.UPDATE_DIFF_DECORATIONS_DELAY=200,HB=AB([RB(3,IB),RB(4,kB),RB(5,Dy),RB(6,n_),RB(7,r_),RB(8,Ry),RB(9,rF),RB(10,DB),RB(11,MB)],HB);class zB extends Uo{constructor(e){super(),this._dataSource=e,this._insertColor=null,this._removeColor=null}applyColors(e){const t=e.getColor(Zk)||(e.getColor(jk)||Hk).transparent(2),i=e.getColor(Yk)||(e.getColor(Uk)||zk).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 jB{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 UB{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=eV(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 h=0,c=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 jB(this._modifiedForeignVZ),b=new jB(this._originalForeignVZ);let C=1,w=1;for(let y=0,S=this._lineChanges.length;y<=S;y++){const i=y<S?this._lineChanges[y]:null;null!==i?(u=i.originalStartLineNumber+(i.originalEndLineNumber>0?-1:0),g=i.modifiedStartLineNumber+(i.modifiedEndLineNumber>0?-1:0),c=i.originalEndLineNumber>0?UB._getViewLineCount(this._originalEditor,i.originalStartLineNumber,i.originalEndLineNumber):0,h=i.modifiedEndLineNumber>0?UB._getViewLineCount(this._modifiedEditor,i.modifiedStartLineNumber,i.modifiedEndLineNumber):0,p=Math.max(i.originalStartLineNumber,i.originalEndLineNumber),m=Math.max(i.modifiedStartLineNumber,i.modifiedEndLineNumber)):(u+=1e7+c,g+=1e7+h,p=u,m=g);let n=[],x=[];if(o){let e;e=i?i.originalEndLineNumber>0?i.originalStartLineNumber-C:i.modifiedStartLineNumber-w:s.getLineCount()-C+1;for(let t=0;t<e;t++){const e=C+t,i=w+t,o=r.getModelLineViewLineCount(e),s=a.getModelLineViewLineCount(i);o<s?n.push({afterLineNumber:e,heightInLines:s-o,domNode:null,marginDomNode:null}):o>s&&x.push({afterLineNumber:i,heightInLines:o-s,domNode:null,marginDomNode:null})}i&&(C=(i.originalEndLineNumber>0?i.originalEndLineNumber:i.originalStartLineNumber)+1,w=(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,x.push({afterLineNumber:t,heightInLines:b.current.height/e,domNode:null}),b.advance()}if(null!==i&&XB(i)){const e=this._produceOriginalFromDiff(i,c,h);e&&n.push(e)}if(null!==i&&QB(i)){const e=this._produceModifiedFromDiff(i,c,h);e&&x.push(e)}let k=0,L=0;for(n=n.sort(f),x=x.sort(f);k<n.length&&L<x.length;){const e=n[k],t=x[L],i=e.afterLineNumber-u,o=t.afterLineNumber-g;i<o?(_(l,e),k++):o<i?(_(d,t),L++):e.shouldNotShrink?(_(l,e),k++):t.shouldNotShrink?(_(d,t),L++):e.heightInLines>=t.heightInLines?(e.heightInLines-=t.heightInLines,L++):(t.heightInLines-=e.heightInLines,k++)}for(;k<n.length;)_(l,n[k]),k++;for(;L<x.length;)_(d,x[L]),L++}return{original:UB._ensureDomNodes(l),modified:UB._ensureDomNodes(d)}}static _ensureDomNodes(e){return e.map((e=>(e.domNode||(e.domNode=JB()),e)))}}function $B(e,t,i,n,o){return{range:new qo(e,t,i,n),options:o}}const KB={charDelete:RP.register({description:"diff-editor-char-delete",className:"char-delete"}),charDeleteWholeLine:RP.register({description:"diff-editor-char-delete-whole-line",className:"char-delete",isWholeLine:!0}),charInsert:RP.register({description:"diff-editor-char-insert",className:"char-insert"}),charInsertWholeLine:RP.register({description:"diff-editor-char-insert-whole-line",className:"char-insert",isWholeLine:!0}),lineInsert:RP.register({description:"diff-editor-line-insert",className:"line-insert",marginClassName:"gutter-insert",isWholeLine:!0}),lineInsertWithSign:RP.register({description:"diff-editor-line-insert-with-sign",className:"line-insert",linesDecorationsClassName:"insert-sign "+Fy.asClassName(BB),marginClassName:"gutter-insert",isWholeLine:!0}),lineDelete:RP.register({description:"diff-editor-line-delete",className:"line-delete",marginClassName:"gutter-delete",isWholeLine:!0}),lineDeleteWithSign:RP.register({description:"diff-editor-line-delete-with-sign",className:"line-delete",linesDecorationsClassName:"delete-sign "+Fy.asClassName(VB),marginClassName:"gutter-delete",isWholeLine:!0}),lineDeleteMargin:RP.register({description:"diff-editor-line-delete-margin",marginClassName:"gutter-delete"})};class qB extends zB{constructor(e,t){super(e),this._disableSash=!1===t,this._sashRatio=null,this._sashPosition=null,this._startSashPosition=null,this._sash=this._register(new QF(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?HB.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*qB.MINIMUM_EDITOR_WIDTH?(i<qB.MINIMUM_EDITOR_WIDTH&&(i=qB.MINIMUM_EDITOR_WIDTH),i>t-qB.MINIMUM_EDITOR_WIDTH&&(i=t-qB.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?HB.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 GB(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(QB(d)){r.decorations.push({range:new qo(d.originalStartLineNumber,1,d.originalEndLineNumber,1073741824),options:n?KB.lineDeleteWithSign:KB.lineDelete}),XB(d)&&d.charChanges||r.decorations.push($B(d.originalStartLineNumber,1,d.originalEndLineNumber,1073741824,KB.charDeleteWholeLine));const e=eV(a,l,d.originalStartLineNumber,d.originalEndLineNumber);if(r.overviewZones.push(new KT(e.startLineNumber,e.endLineNumber,0,s)),d.charChanges)for(const t of d.charChanges)if(QB(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($B(e,i,e,n,KB.charDelete))}else r.decorations.push($B(t.originalStartLineNumber,t.originalStartColumn,t.originalEndLineNumber,t.originalEndColumn,KB.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(XB(d)){r.decorations.push({range:new qo(d.modifiedStartLineNumber,1,d.modifiedEndLineNumber,1073741824),options:n?KB.lineInsertWithSign:KB.lineInsert}),QB(d)&&d.charChanges||r.decorations.push($B(d.modifiedStartLineNumber,1,d.modifiedEndLineNumber,1073741824,KB.charInsertWholeLine));const e=eV(a,l,d.modifiedStartLineNumber,d.modifiedEndLineNumber);if(r.overviewZones.push(new KT(e.startLineNumber,e.endLineNumber,0,s)),d.charChanges)for(const t of d.charChanges)if(XB(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($B(e,i,e,n,KB.charInsert))}else r.decorations.push($B(t.modifiedStartLineNumber,t.modifiedStartColumn,t.modifiedEndLineNumber,t.modifiedEndColumn,KB.charInsert))}return r}}qB.MINIMUM_EDITOR_WIDTH=100;class GB extends UB{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 ZB extends zB{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 YB(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 h of t)if(QB(h)){for(s.decorations.push({range:new qo(h.originalStartLineNumber,1,h.originalEndLineNumber,1073741824),options:KB.lineDeleteMargin});d<e.modified.length;){const t=e.modified[d];if(t.diff&&t.diff.originalStartLineNumber>=h.originalStartLineNumber)break;d++}let t=0;if(d<e.modified.length){const i=e.modified[d];i.diff&&i.diff.originalStartLineNumber===h.originalStartLineNumber&&i.diff.originalEndLineNumber===h.originalEndLineNumber&&i.diff.modifiedStartLineNumber===h.modifiedStartLineNumber&&i.diff.modifiedEndLineNumber===h.modifiedEndLineNumber&&(t=i.heightInLines)}const i=eV(a,l,h.originalStartLineNumber,h.originalEndLineNumber);s.overviewZones.push(new KT(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(XB(d)){r.decorations.push({range:new qo(d.modifiedStartLineNumber,1,d.modifiedEndLineNumber,1073741824),options:n?KB.lineInsertWithSign:KB.lineInsert});const e=eV(a,l,d.modifiedStartLineNumber,d.modifiedEndLineNumber);if(r.overviewZones.push(new KT(e.startLineNumber,e.endLineNumber,0,s)),d.charChanges){for(const t of d.charChanges)if(XB(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($B(e,i,e,n,KB.charInsert))}else r.decorations.push($B(t.modifiedStartLineNumber,t.modifiedStartColumn,t.modifiedEndLineNumber,t.modifiedEndColumn,KB.charInsert))}else r.decorations.push($B(d.modifiedStartLineNumber,1,d.modifiedEndLineNumber,1073741824,KB.charInsertWholeLine))}return r}layout(){return Math.max(5,this._decorationsLeft)}}class YB extends UB{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),h=t.get(131).decorationsWidth,c=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;Kf(b,n);const C=v.marginDomNode;Kf(C,n);const w=[];if(t.charChanges)for(const e of t.charChanges)QB(e)&&w.push(new zb(new qo(e.originalStartLineNumber,e.originalStartColumn,e.originalEndLineNumber,e.originalEndColumn),"char-delete",0));const y=w.length>0,S=P_(1e4);let x=0,k=0,L=null;for(let s=t.originalStartLineNumber;s<=t.originalEndLineNumber;s++){const r=s-t.originalStartLineNumber,_=this._originalModel.getLineTokens(s),b=_.getLineContent(),D=m[f++],E=Sb.filter(w,s,1,b.length+1);if(D){let t=0;for(const e of D.breakOffsets){const s=_.sliceAndInflate(t,e,0),r=b.substring(t,e);x=Math.max(x,this._renderOriginalLine(k++,r,s,Sb.extractWrapped(E,t,e),y,a,l,n,o,d,h,c,u,g,p,i,S,C)),t=e}for(L||(L=[]);L.length<r;)L[L.length]=1;L[r]=D.breakOffsets.length,v.heightInLines+=D.breakOffsets.length-1;const m=document.createElement("div");m.className="gutter-delete",e.original.push({afterLineNumber:s,afterColumn:0,heightInLines:D.breakOffsets.length-1,domNode:JB(),marginDomNode:m})}else x=Math.max(x,this._renderOriginalLine(k++,b,_,E,y,a,l,n,o,d,h,c,u,g,p,i,S,C))}x+=r;const D=S.build(),E=WB?WB.createHTML(D):D;if(b.innerHTML=E,v.minWidthInPx=x*s,L){const e=t.originalEndLineNumber-t.originalStartLineNumber;for(;L.length<=e;)L[L.length]=1}v.diff.viewLineCounts=L}e.original.sort(((e,t)=>e.afterLineNumber-t.afterLineNumber))}_renderOriginalLine(e,t,i,n,o,s,r,a,l,d,h,c,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=Hb.isBasicASCII(t,s),b=Hb.containsRTL(t,v,r),C=Mb(new Eb(a.isMonospace&&!l,a.canUseHalfwidthRightwardsArrow,t,!1,v,b,0,i,n,m,0,a.spaceWidth,a.middotWidth,a.wsmiddotWidth,c,u,g,p!==uf.OFF,null),f);if(f.appendASCIIString("</div>"),this._renderIndicators){const t=document.createElement("div");t.className=`delete-sign ${Fy.asClassName(VB)}`,t.setAttribute("style",`position:absolute;top:${e*d}px;width:${h}px;height:${d}px;right:0;`),_.appendChild(t)}return C.characterMapping.getAbsoluteOffset(C.characterMapping.length)}}function XB(e){return e.modifiedEndLineNumber>0}function QB(e){return e.originalEndLineNumber>0}function JB(){const e=document.createElement("div");return e.className="diagonal-fill",e}function eV(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 tV(e,t){return{enableSplitViewResizing:ef(e.enableSplitViewResizing,t.enableSplitViewResizing),renderSideBySide:ef(e.renderSideBySide,t.renderSideBySide),maxComputationTime:nf(e.maxComputationTime,t.maxComputationTime,0,1073741824),maxFileSize:nf(e.maxFileSize,t.maxFileSize,0,1073741824),ignoreTrimWhitespace:ef(e.ignoreTrimWhitespace,t.ignoreTrimWhitespace),renderIndicators:ef(e.renderIndicators,t.renderIndicators),originalEditable:ef(e.originalEditable,t.originalEditable),diffCodeLens:ef(e.diffCodeLens,t.diffCodeLens),renderOverviewRuler:ef(e.renderOverviewRuler,t.renderOverviewRuler),diffWordWrap:(i=e.diffWordWrap,n=t.diffWordWrap,af(i,n,["off","on","inherit"]))};var i,n}zy(((e,t)=>{const i=e.getColor(jk);i&&t.addRule(`.monaco-editor .char-insert, .monaco-diff-editor .char-insert { background-color: ${i}; }`);const n=e.getColor($k)||i;n&&t.addRule(`.monaco-editor .line-insert, .monaco-diff-editor .line-insert { background-color: ${n}; }`);const o=e.getColor(qk)||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(Uk);s&&t.addRule(`.monaco-editor .char-delete, .monaco-diff-editor .char-delete { background-color: ${s}; }`);const r=e.getColor(Kk)||s;r&&t.addRule(`.monaco-editor .line-delete, .monaco-diff-editor .line-delete { background-color: ${r}; }`);const a=e.getColor(Gk)||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(Xk);l&&t.addRule(`.monaco-editor .line-insert, .monaco-editor .char-insert { border: 1px ${"hc"===e.type?"dashed":"solid"} ${l}; }`);const d=e.getColor(Qk);d&&t.addRule(`.monaco-editor .line-delete, .monaco-editor .char-delete { border: 1px ${"hc"===e.type?"dashed":"solid"} ${d}; }`);const h=e.getColor(Vx);h&&t.addRule(`.monaco-diff-editor.side-by-side .editor.modified { box-shadow: -6px 0 5px -5px ${h}; }`);const c=e.getColor(Jk);c&&t.addRule(`.monaco-diff-editor.side-by-side .editor.modified { border-left: 1px solid ${c}; }`);const u=e.getColor(Wx);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(Hx);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(zx);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(eL);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 iV=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)}};let oV=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)}}};oV=iV([nV(0,Ry)],oV);var sV=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},rV=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};let aV=class extends oV{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===IC.http||i===IC.https)return Pw(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}};aV=sV([rV(0,Dy),rV(1,Ry)],aV),dv(r_,aV);const lV=s_("layoutService");var dV=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},hV=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};let cV=class{constructor(e){this._codeEditorService=e,this.onDidLayout=ds.None}get dimension(){return this._dimension||(this._dimension=JC(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()}};cV=dV([hV(0,r_)],cV);let uV=class extends cV{constructor(e,t){super(t),this._container=e}get hasContainer(){return!1}get container(){return this._container}};uV=dV([hV(1,r_)],uV),dv(lV,cV);const gV=s_("dialogService");var pV=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},mV=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}},fV=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 _V(e){return e.scheme===IC.file?e.fsPath:e.path}let vV=0;class bV{constructor(e,t,i,n,o,s,r){this.id=++vV,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 CV{constructor(e,t){this.resourceLabel=e,this.reason=t}}class wV{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($m(0,"The following files have been closed and modified on disk: {0}.",e.join(", "))),t.length>0&&i.push($m(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 yV{constructor(e,t,i,n,o,s,r){this.id=++vV,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 wV),this.removedResources.has(t)||this.removedResources.set(t,new CV(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 wV),this.invalidatedResources.has(t)||this.invalidatedResources.set(t,new CV(e,0)))}toString(){return`[id:${this.id}] [group:${this.groupId}] [${this.invalidatedResources?"INVALID":" VALID"}] ${this.actual.constructor.name} - ${this.actual}`}}class SV{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 fP(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 xV{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 kV=new SV("","");kV.locked=!0;let LV=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=_P.None,i=vP.None){if(0===e.type){const n=_V(e.resource),o=this.getUriComparisonKey(e.resource);this._pushElement(new bV(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=_V(t),i=this.getUriComparisonKey(t);n.has(i)||(n.add(i),o.push(e),s.push(i))}1===o.length?this._pushElement(new bV(e,o[0],s[0],t.id,t.nextOrder(),i.id,i.nextOrder())):this._pushElement(new yV(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 SV(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=_V(o.resource),t=this.getUriComparisonKey(o.resource),i=new bV(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=_V(o.resource),t=this.getUriComparisonKey(o.resource),i=new bV(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 fP(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 vP){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 fV(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)||kV);return new xV(t)}_tryToSplitAndUndo(e,t,i,n){if(t.canSplit())return this._splitPastWorkspaceElement(t,i),this._notificationService.warn(n),new DV(this._undo(e,0,!0));for(const o of t.strResources)this.removeElements(o);return this._notificationService.warn(n),new DV}_checkWorkspaceUndo(e,t,i,n){if(t.removedResources)return this._tryToSplitAndUndo(e,t,t.removedResources,$m(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,$m(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,$m(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,$m(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,$m(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 fV(this,void 0,void 0,(function*(){if(t.canSplit()&&!this._isPartOfUndoGroup(t)){const o=yield this._dialogService.show(oF.Info,$m(0,"Would you like to undo '{0}' across all files?",t.label),[$m(0,"Undo in {0} Files",i.editStacks.length),$m(0,"Undo this File"),$m(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 xV([e]),n,(()=>this._continueUndoInGroup(t.groupId,i))))));{const e=$m(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 vP){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 fV(this,void 0,void 0,(function*(){if(1!==(yield this._dialogService.show(oF.Info,$m(0,"Would you like to undo '{0}'?",i.label),[$m(0,"Yes"),$m(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 vP){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 DV(this._redo(e));for(const o of t.strResources)this.removeElements(o);return this._notificationService.warn(n),new DV}_checkWorkspaceRedo(e,t,i,n){if(t.removedResources)return this._tryToSplitAndRedo(e,t,t.removedResources,$m(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,$m(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,$m(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,$m(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,$m(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 fV(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 xV([e]),i,(()=>this._continueRedoInGroup(t.groupId))))));{const e=$m(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 vP){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{}}}};LV=pV([mV(0,gV),mV(1,rF)],LV);class DV{constructor(e){this.returnValue=e}}var EV,NV;dv(mP,LV);class IV{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 TV{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 MV{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 OV{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 MV(!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 Hr(e,this._value.query);if(5===this._states[this._stateIdx])return Hr(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 AV{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 RV{constructor(e){this._iter=e}static forUris(e=(()=>!1)){return new RV(new OV(e))}static forStrings(){return new RV(new IV)}static forConfigKeys(){return new RV(new TV)}clear(){this._root=void 0}set(e,t){const i=this._iter.reset(e);let n;this._root||(this._root=new AV,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 AV,n.left.segment=i.value()),o.push([-1,n]),n=n.left;else if(e<0)n.right||(n.right=new AV,n.right.segment=i.value()),o.push([1,n]),n=n.right;else{if(!i.hasNext())break;i.next(),n.mid||(n.mid=new AV,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 PV{constructor(e,t){this.uri=e,this.value=t}}class FV{constructor(e,t){this[EV]="ResourceMap",e instanceof FV?(this.map=new Map(e.map),this.toKey=null!=t?t:FV.defaultToKey):(this.map=new Map,this.toKey=null!=e?e:FV.defaultToKey)}set(e,t){return this.map.set(this.toKey(e),new PV(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]}*[(EV=Symbol.toStringTag,Symbol.iterator)](){for(let[,e]of this.map)yield[e.uri,e.value]}}FV.defaultToKey=e=>e.toString();class BV{constructor(){this[NV]="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}[(NV=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 VV extends BV{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 WV(e,t,i){return Math.min(Math.max(e,t),i)}class HV{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 zV{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 jV=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},UV=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};const $V=s_("ILanguageFeatureDebounceService");var KV;!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}}(KV||(KV={}));class qV{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 VV(50,.7)}_key(e){return e.id+this._registry.all(e).reduce(((e,t)=>_a(KV.of(t),e)),0)}get(e){const t=this._key(e),i=this._cache.get(t);return i?WV(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 zV(6),this._cache.set(i,n));const o=WV(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 HV;for(const[,t]of this._cache)e.update(t.value);return e.value}default(){return WV(0|this._overall()||this._default,this._min,this._max)}}let GV=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=`${KV.of(e)},${r}${l?","+l:""}`;let h=this._data.get(d);return h||(h=new qV(this._logService,t,e,0|this._overallAverage()||1.5*r,r,a),this._data.set(d,h)),h}_overallAverage(){let e=new HV;for(let t of this._data.values())e.update(t.default());return e.value}};GV=jV([UV(0,tb)],GV),dv($V,GV,!0);const ZV=s_("IWorkspaceEditService");class YV{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 XV(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 QV(e.oldUri,e.newUri,e.options,e.metadata);throw new Error("Unsupported edit")}))}}class XV extends YV{constructor(e,t,i,n){super(n),this.resource=e,this.textEdit=t,this.versionId=i}}class QV extends YV{constructor(e,t,i,n){super(n),this.oldResource=e,this.newResource=t,this.options=i}}const JV=Object.freeze({id:"editor",order:5,type:"object",title:$m(0,"Editor"),scope:5}),eW=Object.assign(Object.assign({},JV),{properties:{"editor.tabSize":{type:"number",default:Km.tabSize,minimum:1,markdownDescription:$m(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:Km.insertSpaces,markdownDescription:$m(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:Km.detectIndentation,markdownDescription:$m(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:Km.trimAutoWhitespace,description:$m(0,"Remove trailing auto inserted whitespace.")},"editor.largeFileOptimizations":{type:"boolean",default:Km.largeFileOptimizations,description:$m(0,"Special handling for large files to disable certain memory intensive features.")},"editor.wordBasedSuggestions":{type:"boolean",default:!0,description:$m(0,"Controls whether completions should be computed based on words in the document.")},"editor.wordBasedSuggestionsMode":{enum:["currentDocument","matchingDocuments","allDocuments"],default:"matchingDocuments",enumDescriptions:[$m(0,"Only suggest words from the active document."),$m(0,"Suggest words from all open documents of the same language."),$m(0,"Suggest words from all open documents.")],description:$m(0,"Controls from which documents word based completions are computed.")},"editor.semanticHighlighting.enabled":{enum:[!0,!1,"configuredByTheme"],enumDescriptions:[$m(0,"Semantic highlighting enabled for all color themes."),$m(0,"Semantic highlighting disabled for all color themes."),$m(0,"Semantic highlighting is configured by the current color theme's `semanticHighlighting` setting.")],default:"configuredByTheme",description:$m(0,"Controls whether the semanticHighlighting is shown for the languages that support it.")},"editor.stablePeek":{type:"boolean",default:!1,markdownDescription:$m(0,"Keep peek editors open even when double clicking their content or when hitting `Escape`.")},"editor.maxTokenizationLineLength":{type:"integer",default:2e4,description:$m(0,"Lines above this length will not be tokenized for performance reasons")},"editor.language.brackets":{type:"array",default:!1,description:$m(0,"Defines the bracket symbols that increase or decrease the indentation."),items:{type:"array",items:[{type:"string",description:$m(0,"The opening bracket character or string sequence.")},{type:"string",description:$m(0,"The closing bracket character or string sequence.")}]}},"editor.language.colorizedBracketPairs":{type:"array",default:!1,description:$m(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:$m(0,"The opening bracket character or string sequence.")},{type:"string",description:$m(0,"The closing bracket character or string sequence.")}]}},"diffEditor.maxComputationTime":{type:"number",default:5e3,description:$m(0,"Timeout in milliseconds after which diff computation is cancelled. Use 0 for no timeout.")},"diffEditor.maxFileSize":{type:"number",default:50,description:$m(0,"Maximum file size in MB for which to compute diffs. Use 0 for no limit.")},"diffEditor.renderSideBySide":{type:"boolean",default:!0,description:$m(0,"Controls whether the diff editor shows the diff side by side or inline.")},"diffEditor.ignoreTrimWhitespace":{type:"boolean",default:!0,description:$m(0,"When enabled, the diff editor ignores changes in leading or trailing whitespace.")},"diffEditor.renderIndicators":{type:"boolean",default:!0,description:$m(0,"Controls whether the diff editor shows +/- indicators for added/removed changes.")},"diffEditor.codeLens":{type:"boolean",default:!1,description:$m(0,"Controls whether the editor shows CodeLens.")},"diffEditor.wordWrap":{type:"string",enum:["off","on","inherit"],default:"inherit",markdownEnumDescriptions:[$m(0,"Lines will never wrap."),$m(0,"Lines will wrap at the viewport width."),$m(0,"Lines will wrap according to the `#editor.wordWrap#` setting.")]}}});for(const _he of Lf){const e=_he.schema;if(void 0!==e)if(void 0!==(tW=e).type||void 0!==tW.anyOf)eW.properties[`editor.${_he.name}`]=e;else for(const t in e)Object.hasOwnProperty.call(e,t)&&(eW.properties[t]=e[t])}var tW;let iW=null;function nW(){return null===iW&&(iW=Object.create(null),Object.keys(eW.properties).forEach((e=>{iW[e]=!0}))),iW}My.as(eO).registerConfiguration(eW);class oW{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 sW{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?sv(this.contents,e):this.contents}getOverrideValue(e,t){const i=this.getContentsForOverrideIdentifer(t);return i?e?sv(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 sW(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 sW(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),iv(this.contents,e,t,(e=>{throw new Error(e)}))}removeValue(e){this.removeKey(e)&&nv(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 rW extends sW{constructor(e={}){const t=My.as(eO).getConfigurationProperties(),i=Object.keys(t),n=Object.create(null),o=[];for(const s in t){const i=e[s];iv(n,s,void 0!==i?i:t[s].default,(e=>{}))}for(const s of Object.keys(n))hO.test(s)&&o.push({identifiers:cO(s),keys:Object.keys(n[s]),contents:tv(n[s],(e=>{}))});super(n,i,o)}}class aW{constructor(e,t,i=new sW,n=new sW,o=new FV,s=new sW,r=new FV,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 FV,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 sW,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),h=i?t.overrideIdentifier?this._workspaceConfiguration.freeze().override(t.overrideIdentifier).getValue(e):this._workspaceConfiguration.freeze().getValue(e):void 0,c=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:h,workspaceFolderValue:c,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!==h?{value:this._workspaceConfiguration.freeze().getValue(e),override:t.overrideIdentifier?this._workspaceConfiguration.freeze().getOverrideValue(e,t.overrideIdentifier):void 0}:void 0,workspaceFolder:void 0!==c?{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 FV);return new aW(t,i,new sW,n,o,new sW,new FV,!1)}static parseConfigurationModel(e){return new sW(e.contents,e.keys,e.overrides).freeze()}}class lW{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 sW;this.affectedKeys.forEach((e=>s.setValue(e,{}))),this.affectedKeysTree=s.contents}get previousConfiguration(){return!this._previousConfiguration&&this.previous&&(this._previousConfiguration=aW.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!zo(n,o)}return!0}return!1}doesAffectedKeysTreeContains(e,t){let i,n=tv({[t]:!0},(()=>{}));for(;"object"==typeof n&&(i=Object.keys(n)[0]);){if(!(e=e[i]))return!1;n=n[i]}return!0}}const dW=/^(cursor|delete)/;class hW 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 Wv,this._currentChordStatusMessage=null,this._ignoreSingleModifiers=cW.EMPTY,this._currentSingleModifier=null,this._currentSingleModifierClearTimeout=new Vv,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($m(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=cW.EMPTY,this._currentSingleModifierClearTimeout.cancel(),this._currentSingleModifier=null,!1):(this._ignoreSingleModifiers=cW.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 cW(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($m(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))),dW.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 cW{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}}}cW.EMPTY=new cW(null);const uW=s_("keybindingService");class gW{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=gW.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]||gW.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)&&Iy(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: ${pW(o.when)}, source: ${mW(o)}.`),{enterChord:!0,leaveChord:!1,commandId:null,commandArgs:null,bubble:!1}):(this._log(`\\ From ${n.length} keybinding entries, matched ${o.command}, when: ${pW(o.when)}, source: ${mW(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(gW._contextMatchesRules(e,n.when))return n}return null}static _contextMatchesRules(e,t){return!t||t.evaluate(e)}}function pW(e){return e?`${e.serialize()}`:"no when condition"}function mW(e){return e.extensionId?e.isBuiltinExtension?`built-in extension ${e.extensionId}`:`user extension ${e.extensionId}`:e.isDefault?"built-in":"user"}class fW{constructor(e,t,i,n,o,s,r){this._resolvedKeybindingItemBrand=void 0,this.resolvedKeybinding=e,this.keypressParts=e?_W(e.getDispatchParts()):[],e&&0===this.keypressParts.length&&(this.keypressParts=_W(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 _W(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 vW{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]=yW(s,r,this.modifierLabels[e])}return n.join(" ")}}const bW=new vW({ctrlKey:"⌃",shiftKey:"⇧",altKey:"⌥",metaKey:"⌘",separator:""},{ctrlKey:$m(0,"Ctrl"),shiftKey:$m(0,"Shift"),altKey:$m(0,"Alt"),metaKey:$m(0,"Windows"),separator:"+"},{ctrlKey:$m(0,"Ctrl"),shiftKey:$m(0,"Shift"),altKey:$m(0,"Alt"),metaKey:$m(0,"Super"),separator:"+"}),CW=new vW({ctrlKey:$m(0,"Control"),shiftKey:$m(0,"Shift"),altKey:$m(0,"Option"),metaKey:$m(0,"Command"),separator:"+"},{ctrlKey:$m(0,"Control"),shiftKey:$m(0,"Shift"),altKey:$m(0,"Alt"),metaKey:$m(0,"Windows"),separator:"+"},{ctrlKey:$m(0,"Control"),shiftKey:$m(0,"Shift"),altKey:$m(0,"Alt"),metaKey:$m(0,"Super"),separator:"+"}),wW=new vW({ctrlKey:"Ctrl",shiftKey:"Shift",altKey:"Alt",metaKey:"Cmd",separator:"+"},{ctrlKey:"Ctrl",shiftKey:"Shift",altKey:"Alt",metaKey:"Super",separator:"+"});function yW(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 vW({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 SW extends class extends class{}{constructor(e,t){if(super(),0===t.length)throw Ms("parts");this._os=e,this._parts=t}getLabel(){return bW.toLabel(this._os,this._parts,(e=>this._getLabel(e)))}getAriaLabel(){return CW.toLabel(this._os,this._parts,(e=>this._getAriaLabel(e)))}getElectronAccelerator(){return this._parts.length>1||this._parts[0].isDuplicateModifierCase()?null:wW.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 CC(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 Os.toString(e)}_getLabel(e){return e.isDuplicateModifierCase()?"":this._keyCodeToUILabel(e.keyCode)}_getAriaLabel(e){return e.isDuplicateModifierCase()?"":Os.toString(e.keyCode)}_getElectronAccelerator(e){return Os.toElectronAccelerator(e.keyCode)}_getDispatchPart(e){return SW.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+=Os.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=Ca[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 vC)return e;const t=this._scanCodeToKeyCode(e.scanCode);return 0===t?null:new vC(e.ctrlKey,e.shiftKey,e.altKey,e.metaKey,t)}static resolveUserBinding(e,t){const i=_W(e.map((e=>this._resolveSimpleUserBinding(e))));return i.length>0?[new SW(new bC(i),t)]:[]}}const xW=s_("labelService"),kW=s_("contextService");function LW(e){const t=e;return"string"==typeof(null==t?void 0:t.id)&&Ps.isUri(t.uri)}class DW{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}}}var EW,NW,IW,TW,MW,OW,AW,RW,PW,FW,BW,VW,WW;$m(0,"Code Workspace"),(NW=EW||(EW={})).noSelection=$m(0,"No selection"),NW.singleSelectionRange=$m(0,"Line {0}, Column {1} ({2} selected)"),NW.singleSelection=$m(0,"Line {0}, Column {1}"),NW.multiSelectionRange=$m(0,"{0} selections ({1} characters selected)"),NW.multiSelection=$m(0,"{0} selections"),NW.emergencyConfOn=$m(0,"Now changing the setting `accessibilitySupport` to 'on'."),NW.openingDocs=$m(0,"Now opening the Editor Accessibility documentation page."),NW.readonlyDiffEditor=$m(0," in a read-only pane of a diff editor."),NW.editableDiffEditor=$m(0," in a pane of a diff editor."),NW.readonlyEditor=$m(0," in a read-only code editor"),NW.editableEditor=$m(0," in a code editor"),NW.changeConfigToOnMac=$m(0,"To configure the editor to be optimized for usage with a Screen Reader press Command+E now."),NW.changeConfigToOnWinLinux=$m(0,"To configure the editor to be optimized for usage with a Screen Reader press Control+E now."),NW.auto_on=$m(0,"The editor is configured to be optimized for usage with a Screen Reader."),NW.auto_off=$m(0,"The editor is configured to never be optimized for usage with a Screen Reader, which is not the case at this time."),NW.tabFocusModeOnMsg=$m(0,"Pressing Tab in the current editor will move focus to the next focusable element. Toggle this behavior by pressing {0}."),NW.tabFocusModeOnMsgNoKb=$m(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."),NW.tabFocusModeOffMsg=$m(0,"Pressing Tab in the current editor will insert the tab character. Toggle this behavior by pressing {0}."),NW.tabFocusModeOffMsgNoKb=$m(0,"Pressing Tab in the current editor will insert the tab character. The command {0} is currently not triggerable by a keybinding."),NW.openDocMac=$m(0,"Press Command+H now to open a browser window with more information related to editor accessibility."),NW.openDocWinLinux=$m(0,"Press Control+H now to open a browser window with more information related to editor accessibility."),NW.outroMsg=$m(0,"You can dismiss this tooltip and return to the editor by pressing Escape or Shift+Escape."),NW.showAccessibilityHelpAction=$m(0,"Show Accessibility Help"),(IW||(IW={})).inspectTokensAction=$m(0,"Developer: Inspect Tokens"),(TW||(TW={})).gotoLineActionLabel=$m(0,"Go to Line/Column..."),(MW||(MW={})).helpQuickAccessActionLabel=$m(0,"Show all Quick Access Providers"),(AW=OW||(OW={})).quickCommandActionLabel=$m(0,"Command Palette"),AW.quickCommandHelp=$m(0,"Show And Run Commands"),(PW=RW||(RW={})).quickOutlineActionLabel=$m(0,"Go to Symbol..."),PW.quickOutlineByCategoryActionLabel=$m(0,"Go to Symbol by Category..."),(BW=FW||(FW={})).editorViewAccessibleLabel=$m(0,"Editor content"),BW.accessibilityHelpMessage=$m(0,"Press Alt+F1 for Accessibility Options."),(VW||(VW={})).toggleHighContrast=$m(0,"Toggle High Contrast Theme"),(WW||(WW={})).bulkEditServiceSummary=$m(0,"Made {0} edits in {1} files");const HW=s_("workspaceTrustManagementService");var zW;!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}}(zW||(zW={}));var jW,UW;function $W(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}(UW=jW||(jW={}))[UW.AVOID=0]="AVOID",UW[UW.ALIGN=1]="ALIGN";class KW 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=Mw(".context-view"),this.useFixedPosition=!1,this.useShadowDOM=!1,Aw(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=Mw(".shadow-root-host"),this.container.appendChild(this.shadowRootHostElement),this.shadowRoot=this.shadowRootHostElement.attachShadow({mode:"open"});const e=document.createElement("style");e.textContent=qW,this.shadowRoot.appendChild(e),this.shadowRoot.appendChild(this.view),this.shadowRoot.appendChild(Mw("slot"))}else this.container.appendChild(this.view);const i=new Cs;KW.BUBBLE_UP_EVENTS.forEach((e=>{i.add(WC(this.container,e,(e=>{this.onDOMEvent(e,!1)})))})),KW.BUBBLE_DOWN_EVENTS.forEach((e=>{i.add(WC(this.container,e,(e=>{this.onDOMEvent(e,!0)}),!0))})),this.toDisposeOnSetContainer=i}}show(e){this.isVisible()&&this.hide(),RC(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",Ow(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&&mC?(this.delegate.layout&&this.delegate.layout(),this.doLayout()):this.hide())}doLayout(){if(!this.isVisible())return;let e,t=this.delegate.getAnchor();if(ww(t)){let i=nw(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=sw(this.view),n=lw(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=$W(window.innerHeight,n,t)+window.pageYOffset,zW.intersects({start:r,end:r+n},{start:t.offset,end:t.offset+t.size})&&(l.mode=jW.AVOID),a=$W(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=$W(window.innerWidth,i,t),zW.intersects({start:a,end:a+i},{start:t.offset,end:t.offset+t.size})&&(l.mode=jW.AVOID),r=$W(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=nw(this.container);this.view.style.top=r-(this.useFixedPosition?nw(this.view).top:l.top)+"px",this.view.style.left=a-(this.useFixedPosition?nw(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(),Aw(this.view)}isVisible(){return!!this.delegate}onDOMEvent(e,t){this.delegate&&(this.delegate.onDOMEvent?this.delegate.onDOMEvent(e,document.activeElement):t&&!dw(e.target,this.container)&&this.hide())}dispose(){this.hide(),super.dispose()}}KW.BUBBLE_UP_EVENTS=["click","keydown","focus","blur"],KW.BUBBLE_DOWN_EVENTS=["click"];let qW='\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 GW=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},ZW=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};let YW=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 KW(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)}};YW=GW([ZW(0,lV)],YW);const XW=/\//g;function QW(e){switch(e){case 0:return"";case 1:return"[^/\\\\]*?";default:return"(?:[/\\\\]|[^/\\\\]+[/\\\\]|[/\\\\][^/\\\\]+)*?"}}function JW(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 eH(e){if(!e)return"";let t="";const i=JW(e,"/");if(i.every((e=>"**"===e)))t=".*";else{let e=!1;i.forEach(((n,o)=>{if("**"===n)return void(e||(t+=QW(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=`(?:${JW(r,",").map((e=>eH(e))).join("|")})`;t+=e,s=!1,r="";break}case"]":t+="["+l+"]",a=!1,l="";break;case"?":t+="[^/\\\\]";continue;case"*":t+=QW(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]||o+2<i.length)&&(t+="[/\\\\]"),e=!1}))}return t}const tH=/^\*\*\/\*\.[\w\.-]+$/,iH=/^\*\*\/([\w\.-]+)\/?$/,nH=/^{\*\*\/\*?[\w\.-]+\/?(,\*\*\/\*?[\w\.-]+\/?)*}$/,oH=/^{\*\*\/\*?[\w\.-]+(\/(\*\*)?)?(,\*\*\/\*?[\w\.-]+(\/(\*\*)?)?)*}$/,sH=/^\*\*((\/[\w\.-]+)+)\/?$/,rH=/^([\w\.-]+(\/[\w\.-]+)*)\/?$/,aH=new VV(1e4),lH=function(){return!1},dH=function(){return null};function hH(e,t){if(!e)return dH;let i;i="string"!=typeof e?e.pattern:e,i=i.trim();const n=`${i}_${!!t.trimForExclusions}`;let o,s=aH.get(n);if(s)return cH(s,e);if(tH.test(i)){const e=i.substr(4);s=function(t,n){return"string"==typeof t&&t.endsWith(e)?i:null}}else s=(o=iH.exec(uH(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?oH:nH).test(i)?function(e,t){const i=mH(e.slice(1,-1).split(",").map((e=>hH(e,t))).filter((e=>e!==dH)),e),n=i.length;if(!n)return dH;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=sH.exec(uH(i,t)))?gH(o[1].substr(1),i,!0):(o=rH.exec(uH(i,t)))?gH(o[1],i,!1):function(e){try{const t=new RegExp(`^${eH(e)}$`);return function(i){return t.lastIndex=0,"string"==typeof i&&t.test(i)?e:null}}catch(t){return dH}}(i);return aH.set(n,s),cH(s,e)}function cH(e,t){return"string"==typeof t?e:function(i,n){return FA(i,t.base,!Vo)?e(i.substr(t.base.length+1),n):null}}function uH(e,t){return t.trimForExclusions&&e.endsWith("/**")?e.substr(0,e.length-2):e}function gH(e,t,i){const n=Fr===Pr.sep,o=n?e:e.replace(XW,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 pH(e,t={}){if(!e)return lH;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=hH(e,t);if(i===dH)return lH;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=mH(Object.getOwnPropertyNames(e).map((i=>function(e,t,i){if(!1===t)return dH;const n=hH(e,i);if(n===dH)return dH;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!==dH))),n=i.length;if(!n)return dH;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=wa(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 mH(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 fH=[],_H=[],vH=[];function bH(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?pH(e.filepattern.toLowerCase()):void 0,filepatternOnPath:!!e.filepattern&&e.filepattern.indexOf(Pr.sep)>=0}}(e,t);fH.push(n),n.userConfigured?vH.push(n):_H.push(n);i&&!n.userConfigured&&fH.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 CH(e,t){let i;if(e)switch(e.scheme){case IC.file:i=e.fsPath;break;case IC.data:i=JA.parseMetaData(e).get(JA.META_DATA_LABEL);break;default:i=e.path}if(!i)return[uE.unknown];i=i.toLowerCase();const n=wa(i),o=wH(i,n,vH);if(o)return[o,uE.text];const s=wH(i,n,_H);if(s)return[s,uE.text];if(t){const e=function(e){Ns(e)&&(e=e.substr(1));if(e.length>0)for(let t=fH.length-1;t>=0;t--){const i=fH[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,uE.text]}return[uE.unknown]}function wH(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 yH=Object.prototype.hasOwnProperty;bv.register("vs.editor.nullLanguage",{});class SH{constructor(){this._languageIdToLanguage=[],this._languageToLanguageId=new Map,this._register("vs.editor.nullLanguage",0),this._register("plaintext",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]||"vs.editor.nullLanguage"}}class xH extends Uo{constructor(e=!0,t=!1){super(),this._onDidChange=this._register(new $o),this.onDidChange=this._onDidChange.event,xH.instanceCount++,this._warnOnOverwrite=t,this.languageIdCodec=new SH,this._dynamicLanguages=[],this._languages={},this._mimeTypesMap={},this._nameMap={},this._lowercaseNameMap={},e&&(this._initializeFromRegistry(),this._register(pO.onDidChangeLanguages((e=>{this._initializeFromRegistry()}))))}dispose(){xH.instanceCount--,super.dispose()}_initializeFromRegistry(){this._languages={},this._mimeTypesMap={},this._nameMap={},this._lowercaseNameMap={},fH=fH.filter((e=>e.userConfigured)),_H=[];const e=[].concat(pO.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}))})),My.as(eO).registerOverrideIdentifiers(this.getRegisteredLanguageIds()),this._onDidChange.fire()}_registerLanguage(e){const t=e.id;let i;yH.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)bH({id:i,mime:n,extension:e},this._warnOnOverwrite)}if(Array.isArray(t.filenames))for(let a of t.filenames)bH({id:i,mime:n,filename:a},this._warnOnOverwrite),e.filenames.push(a);if(Array.isArray(t.filenamePatterns))for(let a of t.filenamePatterns)bH({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);Sa(t)||bH({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&&yH.call(this._languages,e)}getRegisteredLanguageIds(){return Object.keys(this._languages)}getLanguageIdByLanguageName(e){const t=e.toLowerCase();return yH.call(this._lowercaseNameMap,t)?this._lowercaseNameMap[t]:null}getLanguageIdByMimeType(e){return e&&yH.call(this._mimeTypesMap,e)?this._mimeTypesMap[e]:null}guessLanguageIdByFilepathOrFirstLine(e,t){if(!e&&!t)return[];const i=CH(e,t);return xa(i.map((e=>this.getLanguageIdByMimeType(e))))}}xH.instanceCount=0;class kH 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,kH.instanceCount++,this._encounteredLanguages=new Set,this._registry=this._register(new xH(!0,e)),this.languageIdCodec=this._registry.languageIdCodec,this._register(this._registry.onDidChange((()=>this._onDidChange.fire())))}dispose(){kH.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 LH(this.onDidChange,(()=>this._createAndGetLanguageIdentifier(e)))}createByFilepathOrFirstLine(e,t){return new LH(this.onDidChange,(()=>{const i=this.guessLanguageIdByFilepathOrFirstLine(e,t);return this._createAndGetLanguageIdentifier(i)}))}_createAndGetLanguageIdentifier(e){return e&&this.isRegisteredLanguageId(e)||(e="plaintext"),this._encounteredLanguages.has(e)||(this._encounteredLanguages.add(e),Es.getOrCreate(e),this._onDidEncounterLanguage.fire(e)),e}}kH.instanceCount=0;class LH{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 DH(e){let t=e.definition;for(;t instanceof br;)t=t.definition;return`.codicon-${e.id}:before { content: '${t.fontCharacter}'; }`}function EH(...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}}IH.bind(void 0,!1);const NH=IH.bind(void 0,!0);function IH(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 TH(e,t){const i=t.toLowerCase().indexOf(e.toLowerCase());return-1===i?null:[{start:i,end:i+e.length}]}function MH(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=MH(e,t,i+1,n+1))?WH({start:n,end:n+1},o):null}return MH(e,t,i,n+1)}function OH(e){return 97<=e&&e<=122}function AH(e){return 65<=e&&e<=90}function RH(e){return 48<=e&&e<=57}function PH(e){return 32===e||9===e||10===e||13===e}const FH=new Set;function BH(e){return PH(e)||FH.has(e)}function VH(e){return OH(e)||AH(e)||RH(e)}function WH(e,t){return 0===t.length?t=[e]:e.end===t[0].start?t[0].start=e.start:t.unshift(e),t}function HH(e,t){for(let i=t;i<e.length;i++){const t=e.charCodeAt(i);if(AH(t)||RH(t)||i>0&&!VH(e.charCodeAt(i-1)))return i}return e.length}function zH(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=zH(e,t,i+1,n+1);!o&&(s=HH(t,s))<t.length;)o=zH(e,t,i+1,s),s++;return null===o?null:WH({start:n,end:n+1},o)}}function jH(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),AH(n)&&t++,OH(n)&&i++,PH(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),AH(s)&&t++,OH(s)&&i++,VH(s)&&n++,RH(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=zH(e,t,0,o));)o=HH(t,o+1);return n}function UH(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||BH(s)&&BH(r)){let s=null,r=n+1;if(s=UH(e,t,i+1,n+1,o),!o)for(;!s&&(r=$H(t,r))<t.length;)s=UH(e,t,i+1,r,o),r++;return null===s?null:WH({start:n,end:n+1},s)}return null;var s,r}function $H(e,t){for(let i=t;i<e.length;i++)if(BH(e.charCodeAt(i))||i>0&&BH(e.charCodeAt(i-1)))return i;return e.length}"()[]{}<>`'\"-/;:,.?!".split("").forEach((e=>FH.add(e.charCodeAt(0))));const KH=EH(NH,jH,TH),qH=EH(NH,jH,(function(e,t){return MH(e.toLowerCase(),t.toLowerCase(),0,0)})),GH=new VV(1e4);function ZH(e,t,i=!1){if("string"!=typeof e||"string"!=typeof t)return null;let n=GH.get(e);n||(n=new RegExp(La(e),"i"),GH.set(e,n));const o=n.exec(t);return o?[{start:o.index,end:o.index+o[0].length}]:i?qH(e,t):KH(e,t)}function YH(e,t,i,n,o,s){const r=Math.min(13,e.length);for(;i<r;i++){const r=hz(e,t,i,n,o,s,!1);if(r)return r}return[0,s]}function XH(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}function QH(){const e=[],t=[];for(let i=0;i<=128;i++)t[i]=0;for(let i=0;i<=128;i++)e.push(t.slice(0));return e}function JH(e){const t=[];for(let i=0;i<=e;i++)t[i]=0;return t}const ez=JH(256),tz=JH(256),iz=QH(),nz=QH(),oz=QH();function sz(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 rz(e,t){if(t<0||t>=e.length)return!1;switch(e.charCodeAt(t)){case 32:case 9:return!0;default:return!1}}function az(e,t,i){return t[e]!==i[e]}var lz,dz;function hz(e,t,i,n,o,s,r){const a=e.length>128?128:e.length,l=n.length>128?128: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&&(ez[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]&&(tz[r]=a,r--),a--}(a,l,i,s,t,o);let d=1,h=1,c=i,u=s;const g=[!1];for(d=1,c=i;c<a;d++,c++){const r=ez[c],p=tz[c],m=c+1<a?tz[c+1]:l;for(h=r-s+1,u=r;u<m;h++,u++){let a=Number.MIN_SAFE_INTEGER,m=!1;u<=p&&(a=cz(e,t,c,i,n,o,u,l,s,0===iz[d-1][h-1],g));let f=0;a!==Number.MAX_SAFE_INTEGER&&(m=!0,f=a+nz[d-1][h-1]);const _=u>r,v=_?nz[d][h-1]+(iz[d][h-1]>0?-5:0):0,b=u>r+1&&iz[d][h-1]>0,C=b?nz[d][h-2]+(iz[d][h-2]>0?-5:0):0;if(b&&(!_||C>=v)&&(!m||C>=f))nz[d][h]=C,oz[d][h]=3,iz[d][h]=0;else if(_&&(!m||v>=f))nz[d][h]=v,oz[d][h]=2,iz[d][h]=0;else{if(!m)throw new Error("not possible");nz[d][h]=f,oz[d][h]=1,iz[d][h]=iz[d-1][h-1]+1}}}if(!g[0]&&!r)return;d--,h--;const p=[nz[d][h],s];let m=0,f=0;for(;d>=1;){let e=h;do{const t=oz[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+h-1]&&!az(e+s-1,n,o)&&m+1>iz[d][e]&&(e=h),e===h?m++:m=1,f||(f=e),d--,h=e-1,p.push(h)}l===a&&(p[0]+=2);const _=f-a;return p[0]-=_,p}function cz(e,t,i,n,o,s,r,a,l,d,h){if(t[i]!==s[r])return Number.MIN_SAFE_INTEGER;let c=1,u=!1;return r===i-n?c=e[i]===o[r]?7:5:!az(r,o,s)||0!==r&&az(r-1,o,s)?!sz(s,r)||0!==r&&sz(s,r-1)?(sz(s,r-1)||rz(s,r-1))&&(c=5,u=!0):c=5:(c=e[i]===o[r]?7:5,u=!0),c>1&&i===n&&(h[0]=!0),u||(u=az(r,o,s)||sz(s,r-1)||rz(s,r-1)),i===n?r>l&&(c-=u?3:5):c+=d?u?2:0:u?0:1,r+1===a&&(c-=u?3:5),c}function uz(e,t,i,n,o,s,r){return function(e,t,i,n,o,s,r,a){let l=hz(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=gz(e,r);if(t){const e=hz(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 gz(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}(dz=lz||(lz={})).Default=[-100,0],dz.isDefault=function(e){return!e||2===e.length&&-100===e[0]&&0===e[1]};const pz=new RegExp(`\\$\\(${Ys.iconNameExpression}(?:${Ys.iconModifierExpression})?\\)`,"g"),mz=new RegExp(Ys.iconNameCharacter),fz=new RegExp(`(\\\\)?${pz.source}`,"g");const _z=new RegExp(`\\\\${pz.source}`,"g");const vz=new RegExp(`(\\s)?(\\\\)?${pz.source}(\\s)?`,"g");function bz(e){return-1===e.indexOf("$(")?e:e.replace(vz,((e,t,i,n)=>i?e:t||n||""))}function Cz(e){const t=e.indexOf("$(");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,h=t;const c=e.length;o(e.substr(0,t));for(;h<c;){if(s=e[h],r=e[h+1],s==="$("[0]&&r==="$("[1])a=h,o(l),l="$(",h++;else if(")"===s&&-1!==a){d+=h-a+1,a=-1,l=""}else-1!==a?mz.test(s)?l+=s:(o(l),a=-1,l=""):o(s);h++}return o(l),{text:n,iconOffsets:i}}(e,t)}function wz(e,t,i=!1){const{text:n,iconOffsets:o}=t;if(!o||0===o.length)return ZH(e,n,i);const s=Da(n," "),r=n.length-s.length,a=ZH(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 yz=/\(&([^\s&])\)|(^|[^&])&([^\s&])/,Sz=/(&)?(&)([^\s&])/g;var xz,kz;(kz=xz||(xz={}))[kz.Right=0]="Right",kz[kz.Left=1]="Left";class Lz extends rB{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,...Ho||Vo?[10]:[]],keyDown:!0}}),this.menuElement=n,this.actionsList.setAttribute("role","menu"),this.actionsList.tabIndex=0,this.menuDisposables=this._register(new Cs),this.initializeOrUpdateStyleSheet(e,{}),this._register($S.addTarget(n)),BC(n,yw.KEY_DOWN,(e=>{new SC(e).equals(2)&&e.preventDefault()})),i.enableMnemonics&&this.menuDisposables.add(BC(n,yw.KEY_DOWN,(e=>{const t=e.key.toLocaleLowerCase();if(this.mnemonics.has(t)){Sw(e,!0);const i=this.mnemonics.get(t);if(1===i.length&&(i[0]instanceof Ez&&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(BC(n,yw.KEY_DOWN,(e=>{const t=new SC(e);t.equals(14)||t.equals(11)?(this.focusedItem=this.viewItems.length-1,this.focusNext(),Sw(e,!0)):(t.equals(13)||t.equals(12))&&(this.focusedItem=0,this.focusPrevious(),Sw(e,!0))}))),this._register(BC(this.domNode,yw.MOUSE_OUT,(e=>{dw(e.relatedTarget,this.domNode)||(this.focusedItem=void 0,this.updateFocus(),e.stopPropagation())}))),this._register(BC(this.actionsList,yw.MOUSE_OVER,(e=>{let t=e.target;if(t&&dw(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($S.addTarget(this.actionsList)),this._register(BC(this.actionsList,WS.Tap,(e=>{let t=e.initialTarget;if(t&&dw(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 sT(n,{alwaysConsumeMouseWheel:!0,horizontal:2,vertical:3,verticalScrollbarSize:7,handleMouseWheel:!0,useShadows:!0}));const s=this.scrollableElement.getDomNode();s.style.position="",this._register(BC(n,WS.Change,(e=>{Sw(e,!0);const t=this.scrollableElement.getScrollPosition().scrollTop;this.scrollableElement.setScrollPosition({scrollTop:t-e.translationY})}))),this._register(BC(s,yw.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 Nz))).forEach(((e,t,i)=>{e.updatePositionInSet(t+1,i.length)}))}initializeOrUpdateStyleSheet(e,t){this.styleSheet||(gw(e)?this.styleSheet=fw(e):(Lz.globalStyleSheet||(Lz.globalStyleSheet=fw()),this.styleSheet=Lz.globalStyleSheet)),this.styleSheet.textContent=function(e,t){let i=`\n.monaco-menu {\n\tfont-size: 13px;\n\n}\n\n${DH(br.menuSelection)}\n${DH(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,gw(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 Dz||t instanceof Nz)&&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 Jw)return new Nz(t.context,e,{icon:!0});if(e instanceof ey){const n=new Ez(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 Dz(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 Dz extends nB{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=yz.exec(e);t&&(this.mnemonic=(t[1]?t[1]:t[3]).toLocaleLowerCase())}}this.runOnceToEnableMouseUp=new Hv((()=>{this.element&&(this._register(BC(this.element,yw.MOUSE_UP,(e=>{if(Sw(e,!0),Rf){if(new EC(e).rightButton)return;this.onClick(e)}else setTimeout((()=>{this.onClick(e)}),0)}))),this._register(BC(this.element,yw.CONTEXT_MENU,(e=>{Sw(e,!0)}))))}),100),this._register(this.runOnceToEnableMouseUp)}render(e){super.render(e),this.element&&(this.container=e,this.item=Lw(this.element,Mw("a.action-menu-item")),this._action.id===Jw.ID?this.item.setAttribute("role","presentation"):(this.item.setAttribute("role","menuitem"),this.mnemonic&&this.item.setAttribute("aria-keyshortcuts",`${this.mnemonic}`)),this.check=Lw(this.item,Mw("span.menu-item-check"+br.menuSelection.cssSelector)),this.check.setAttribute("role","none"),this.label=Lw(this.item,Mw("span.action-label")),this.options.label&&this.options.keybinding&&(Lw(this.item,Mw("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){RC(this.label);let e=bz(this.getAction().label);if(e){const t=function(e){const t=yz,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=yz.exec(e);if(i){e=Mr(e),Sz.lastIndex=0;let t=Sz.exec(e);for(;t&&t[1];)t=Sz.exec(e);const n=e=>e.replace(/&&/g,"&");t?this.label.append(Da(n(e.substr(0,t.index))," "),Mw("u",{"aria-hidden":"true"},t[3]),Ea(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 Ez extends Dz{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 Cs),this.mouseOver=!1,this.expandDirection=n&&void 0!==n.expandDirection?n.expandDirection:xz.Right,this.showScheduler=new Hv((()=>{this.mouseOver&&(this.cleanupExistingSubmenu(!1),this.createSubmenu(!1))}),250),this.hideScheduler=new Hv((()=>{this.element&&!dw(mw(),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=Lw(this.item,Mw("span.submenu-indicator"+br.menuSubmenu.cssSelector)),this.submenuIndicator.setAttribute("aria-hidden","true")),this._register(BC(this.element,yw.KEY_UP,(e=>{let t=new SC(e);(t.equals(17)||t.equals(3))&&(Sw(e,!0),this.createSubmenu(!0))}))),this._register(BC(this.element,yw.KEY_DOWN,(e=>{let t=new SC(e);mw()===this.item&&(t.equals(17)||t.equals(3))&&Sw(e,!0)}))),this._register(BC(this.element,yw.MOUSE_OVER,(e=>{this.mouseOver||(this.mouseOver=!0,this.showScheduler.schedule())}))),this._register(BC(this.element,yw.MOUSE_LEAVE,(e=>{this.mouseOver=!1}))),this._register(BC(this.element,yw.FOCUS_OUT,(e=>{this.element&&!dw(mw(),this.element)&&this.hideScheduler.schedule()}))),this._register(this.parentData.parent.onScroll((()=>{this.parentData.parent.focus(!1),this.cleanupExistingSubmenu(!1)}))))}updateEnabled(){}onClick(e){Sw(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(t){}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=$W(e.width,t.width,{position:n===xz.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=$W(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=Lw(this.element,Mw("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 Lz(this.submenuContainer,this.submenuActions.length?this.submenuActions:[new ty],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 tw(window.innerWidth,window.innerHeight),tw.lift(s),o,this.expandDirection);this.submenuContainer.style.left=a-s.left+"px",this.submenuContainer.style.top=r-s.top+"px",this.submenuDisposables.add(BC(this.submenuContainer,yw.KEY_UP,(e=>{new SC(e).equals(15)&&(Sw(e,!0),this.parentData.parent.focus(),this.cleanupExistingSubmenu(!0))}))),this.submenuDisposables.add(BC(this.submenuContainer,yw.KEY_DOWN,(e=>{new SC(e).equals(15)&&Sw(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 Nz extends oB{style(e){this.label&&(this.label.style.borderBottomColor=e.separatorColor?`${e.separatorColor}`:"")}}function Iz(e,t){const i=Object.create(null);for(let n in t){const o=t[n];o&&(i[n]=cD(o,e))}return i}function Tz(e,t,i){function n(){const n=Iz(e.getColorTheme(),t);"function"==typeof i?i(n):i.style(n)}return n(),e.onDidColorThemeChange(n)}function Mz(e,t,i){return Tz(t,Object.assign(Object.assign({},Oz),i||{}),e)}const Oz={listFocusBackground:tL,listFocusForeground:iL,listFocusOutline:nL,listActiveSelectionBackground:oL,listActiveSelectionForeground:sL,listActiveSelectionIconForeground:rL,listFocusAndSelectionBackground:oL,listFocusAndSelectionForeground:sL,listInactiveSelectionBackground:aL,listInactiveSelectionIconForeground:dL,listInactiveSelectionForeground:lL,listInactiveFocusBackground:hL,listInactiveFocusOutline:cL,listHoverBackground:uL,listHoverForeground:gL,listDropBackground:pL,listSelectionOutline:hx,listHoverOutline:hx,listFilterWidgetBackground:CL,listFilterWidgetOutline:wL,listFilterWidgetNoMatchesOutline:yL,listMatchesShadow:px,treeIndentGuidesStroke:SL,tableColumnsBorder:xL,tableOddRowsBackgroundColor:kL},Az={shadowColor:px,borderColor:IL,foregroundColor:TL,backgroundColor:ML,selectionForegroundColor:OL,selectionBackgroundColor:AL,selectionBorderColor:RL,separatorColor:PL,scrollbarShadow:Vx,scrollbarSliderBackground:Wx,scrollbarSliderHoverBackground:Hx,scrollbarSliderActiveBackground:zx};class Rz{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=ww(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(Mw(".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",BC(this.block,yw.MOUSE_DOWN,(e=>e.stopPropagation())));const s=new Cs,r=e.actionRunner||new Qw;var a,l;return r.onBeforeRun(this.onActionRun,this,s),r.onDidRun(this.onDidActionRun,this,s),i=new Lz(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,Tz(this.themeService,Object.assign(Object.assign({},Az),l),a))),i.onDidCancel((()=>this.contextViewService.hideContextView(!0)),null,s),i.onDidBlur((()=>this.contextViewService.hideContextView(!0)),null,s),s.add(BC(window,yw.BLUR,(()=>this.contextViewService.hideContextView(!0)))),s.add(BC(window,yw.MOUSE_DOWN,(e=>{if(e.defaultPrevented)return;let t=new EC(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&&!Na(e.error)&&this.notificationService.error(e.error)}}var Pz=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},Fz=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};let Bz=class extends Uo{constructor(e,t,i,n,o){super(),this._onDidShowContextMenu=new $o,this._onDidHideContextMenu=new $o,this.contextMenuHandler=new Rz(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()}})),Vw.getInstance().resetKeyStatus(),this._onDidShowContextMenu.fire()}};function Vz(e){let t=JSON.parse(e);return t=Wz(t),t}function Wz(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 L_||e instanceof Uint8Array)return e;if(Array.isArray(e))for(let i=0;i<e.length;++i)e[i]=Wz(e[i],t+1);else for(const i in e)Object.hasOwnProperty.call(e,i)&&(e[i]=Wz(e[i],t+1))}return e}var Hz,zz;Bz=Pz([Fz(0,tS),Fz(1,rF),Fz(2,LB),Fz(3,uW),Fz(4,Ry)],Bz),(zz=Hz||(Hz={}))[zz.API=0]="API",zz[zz.USER=1]="USER";var jz=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 Uz=s_("openerService"),$z=Object.freeze({_serviceBrand:void 0,registerOpener:()=>Uo.None,registerValidator:()=>Uo.None,registerExternalUriResolver:()=>Uo.None,setDefaultExternalOpener(){},registerExternalOpener:()=>Uo.None,open(){return jz(this,void 0,void 0,(function*(){return!1}))},resolveExternalUri(e){return jz(this,void 0,void 0,(function*(){return{resolved:e,dispose(){}}}))}});function Kz(e,t){return Ps.isUri(e)?$r(e.scheme,t):Br(e,t+":")}function qz(e,...t){return t.some((t=>Kz(e,t)))}var Gz=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},Zz=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}},Yz=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 Xz=class{constructor(e){this._commandService=e}open(e,t){return Yz(this,void 0,void 0,(function*(){if(!Kz(e,IC.command))return!1;if(!(null==t?void 0:t.allowCommands))return!0;"string"==typeof e&&(e=Ps.parse(e));let i=[];try{i=Vz(decodeURIComponent(e.query))}catch(n){try{i=Vz(e.query)}catch(o){}}return Array.isArray(i)||(i=[i]),yield this._commandService.executeCommand(e.path,...i),!0}))}};Xz=Gz([Zz(0,iy)],Xz);let Qz=class{constructor(e){this._editorService=e}open(e,t){return Yz(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===IC.file&&(e=ZA(e)),yield this._editorService.openCodeEditor({resource:e,options:Object.assign({selection:i,source:(null==t?void 0:t.fromUserGesture)?Hz.USER:Hz.API},null==t?void 0:t.editorOptions)},this._editorService.getFocusedCodeEditor(),null==t?void 0:t.openToSide),!0}))}};Qz=Gz([Zz(0,r_)],Qz);let Jz=class{constructor(e,t){this._openers=new Hs,this._validators=new Hs,this._resolvers=new Hs,this._resolvedUriTargets=new FV((e=>e.with({path:null,fragment:null,query:null}).toString())),this._externalOpeners=new Hs,this._defaultExternalOpener={openExternal:e=>Yz(this,void 0,void 0,(function*(){return qz(e,IC.http,IC.https)?Pw(e):window.location.href=e,!0}))},this._openers.push({open:(e,t)=>Yz(this,void 0,void 0,(function*(){return!(!(null==t?void 0:t.openExternal)&&!qz(e,IC.mailto,IC.http,IC.https,IC.vsls))&&(yield this._doOpenExternal(e,t),!0)}))}),this._openers.push(new Xz(t)),this._openers.push(new Qz(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 Yz(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 Yz(this,void 0,void 0,(function*(){for(const n of this._resolvers)try{const i=yield n.resolveExternalUri(e,t);if(i)return this._resolvedUriTargets.has(i.resolved)||this._resolvedUriTargets.set(i.resolved,e),i}catch(i){}throw new Error("Could not resolve external URI: "+e.toString())}))}_doOpenExternal(e,t){return Yz(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(s){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 ej,tj,ij;Jz=Gz([Zz(0,r_),Zz(1,iy)],Jz),(tj=ej||(ej={}))[tj.Hint=1]="Hint",tj[tj.Info=2]="Info",tj[tj.Warning=4]="Warning",tj[tj.Error=8]="Error",function(e){e.compare=function(e,t){return t-e};const t=Object.create(null);t[e.Error]=$m(0,"Error"),t[e.Warning]=$m(0,"Warning"),t[e.Info]=$m(0,"Info"),e.toString=function(e){return t[e]||""},e.fromSeverity=function(t){switch(t){case oF.Error:return e.Error;case oF.Warning:return e.Warning;case oF.Info:return e.Info;case oF.Ignore:return e.Hint}},e.toSeverity=function(t){switch(t){case e.Error:return oF.Error;case e.Warning:return oF.Warning;case e.Info:return oF.Info;case e.Hint:return oF.Ignore}}}(ej||(ej={})),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(ej.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}(ij||(ij={}));const nj=s_("markerService");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)}};class rj 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 aj=class extends Uo{constructor(e,t){super(),this._markerService=t,this._onDidChangeMarker=this._register(new $o),this._markerDecorations=new FV,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 rj(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!==IC.inMemory&&e.uri.scheme!==IC.internal&&e.uri.scheme!==IC.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!==ej.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 ej.Hint:t=this._hasMarkerTag(e,2)?void 0:this._hasMarkerTag(e,1)?"squiggly-unnecessary":"squiggly-hint",n=0;break;case ej.Warning:t="squiggly-warning",i=By(tN),n=20,s={color:By(XL),position:Lr.Inline};break;case ej.Info:t="squiggly-info",i=By(iN),n=10;break;case ej.Error:default:t="squiggly-error",i=By(eN),n=30,s={color:By(YL),position:Lr.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}};aj=oj([sj(0,Dv),sj(1,nj)],aj);class lj{constructor(e,t){this._startLineNumber=e,this._tokens=t,this._endLineNumber=this._startLineNumber+this._tokens.getMaxDeltaLine()}static create(e,t){return new lj(e,new dj(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 lj(this._startLineNumber,n),new lj(this._startLineNumber+s,o)]}applyEdit(e,t){const[i,n,o]=JR(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 dj{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 hj(this._tokens.subarray(4*o,4*s+4))}i=n-1}}return this._getDeltaLine(t)===e?new hj(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,h=o[s],c=o[s+1],u=o[s+2],g=o[s+3];if((h>e||h===e&&u>=t)&&(h<i||h===i&&c<=n))a=!0;else{if(0===r&&(l=h),a){const e=4*r;o[e]=h-l,o[e+1]=c,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,h=0;for(let c=0;c<s;c++){const s=4*c,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,h=r)}l[d++]=r-h,l[d++]=u,l[d++]=g,l[d++]=p}return[new dj(new Uint32Array(r)),new dj(new Uint32Array(a)),h]}acceptDeleteRange(e,t,i,n,o){const s=this._tokens,r=this._tokenCount,a=n-t;let l=0,d=!1;for(let h=0;h<r;h++){const c=4*h;let u=s[c],g=s[c+1],p=s[c+2];const m=s[c+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],h=a[s+1],c=a[s+2];if(!(l<e||l===e&&c<t)){if(l===e&&c===t){if(!r)continue;c+=1}else if(l===e&&h<t&&t<c)0===i?c+=n:c=t;else{if(l===e&&h===t&&r)continue;if(l===e)if(l+=i,0===i)h+=n,c+=n;else{const e=c-h;h=o+(h-t),c=h+e}else l+=i}a[s]=l,a[s+1]=h,a[s+2]=c}}}}class hj{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 cj=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},uj=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};let gj=class{constructor(e,t,i,n){this._legend=e,this._themeService=t,this._languageService=i,this._logService=n,this._hashTable=new fj,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()===ib.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()===ib.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()===ib.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()===ib.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 pj(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 h=Math.min(e+s,o);if(h<o){let t=h;for(;t-1>e&&0===n[5*t];)t--;if(t-1===e){let e=h;for(;e+1<o&&0===n[5*e];)e++;h=e}else h=t}let c=new Uint32Array(4*(h-e)),u=0,g=0,p=0,m=0,f=0;for(;a<h;){const e=5*a,o=n[e],s=n[e+1],r=l+o|0,h=0===o?d+s|0:s,_=n[e+2],v=n[e+3],b=n[e+4],C=t.getMetadata(v,b,i);2147483647!==C&&(0===g&&(g=r),p===r&&f>h&&(t.warnOverlappingSemanticTokens(r,h+1),m<h?c[u-4+2]=h:u-=4),c[u]=r-g,c[u+1]=h,c[u+2]=h+_,c[u+3]=C,u+=4,p=r,m=h,f=h+_),l=r,d=h,a++}u!==c.length&&(c=c.subarray(0,u));const _=lj.create(g,c);r.push(_)}return r}gj=cj([uj(1,Ry),uj(2,rv),uj(3,tb)],gj);class mj{constructor(e,t,i,n){this.tokenTypeIndex=e,this.tokenModifierSet=t,this.languageId=i,this.metadata=n,this.next=null}}class fj{constructor(){this._elementsCount=0,this._currentLengthIndex=0,this._currentLength=fj._SIZES[this._currentLengthIndex],this._growCount=Math.round(this._currentLengthIndex+1<fj._SIZES.length?2/3*this._currentLength:0),this._elements=[],fj._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=fj._SIZES[this._currentLengthIndex],this._growCount=Math.round(this._currentLengthIndex+1<fj._SIZES.length?2/3*this._currentLength:0),this._elements=[],fj._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 mj(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 _j(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),L_.wrap(t)}(t)}fj._SIZES=[3,7,13,31,61,127,251,509,1021,2039,4093,8191,16381,32749,65521,131071,262139,524287,1048573,2097143];var vj=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 bj(e){return e&&!!e.data}function Cj(e){return e&&Array.isArray(e.edits)}class wj{constructor(e,t,i){this.provider=e,this.tokens=t,this.error=i}}function yj(e,t){return e.has(t)}function Sj(e,t,i,n,o){return vj(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=>vj(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&&(bj(s)||Cj(s))||(s=null),new wj(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 xj{constructor(e,t){this.provider=e,this.tokens=t}}function kj(e,t){const i=e.orderedGroups(t);return i.length>0?i[0]:[]}function Lj(e,t,i,n){return vj(this,void 0,void 0,(function*(){const o=kj(e,t),s=yield Promise.all(o.map((e=>vj(this,void 0,void 0,(function*(){let o;try{o=yield e.provideDocumentRangeSemanticTokens(t,i,n)}catch(s){Ta(s),o=null}return o&&bj(o)||(o=null),new xj(e,o)})))));for(const e of s)if(e.tokens)return e;return s.length>0?s[0]:null}))}ny.registerCommand("_provideDocumentSemanticTokensLegend",((e,...t)=>vj(void 0,void 0,void 0,(function*(){const[i]=t;Js(i instanceof Ps);const n=e.get(Dv).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(iy).executeCommand("_provideDocumentRangeSemanticTokensLegend",i)})))),ny.registerCommand("_provideDocumentSemanticTokens",((e,...t)=>vj(void 0,void 0,void 0,(function*(){const[i]=t;Js(i instanceof Ps);const n=e.get(Dv).getModel(i);if(!n)return;const{documentSemanticTokensProvider:o}=e.get(lb);if(!yj(o,n))return e.get(iy).executeCommand("_provideDocumentRangeSemanticTokens",i,n.getFullModelRange());const s=yield Sj(o,n,null,null,Ia.None);if(!s)return;const{provider:r,tokens:a}=s;if(!a||!bj(a))return;const l=_j({id:0,type:"full",data:a.data});return a.resultId&&r.releaseDocumentSemanticTokens(a.resultId),l})))),ny.registerCommand("_provideDocumentRangeSemanticTokensLegend",((e,...t)=>vj(void 0,void 0,void 0,(function*(){const[i,n]=t;Js(i instanceof Ps);const o=e.get(Dv).getModel(i);if(!o)return;const{documentRangeSemanticTokensProvider:s}=e.get(lb),r=kj(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 Lj(s,o,qo.lift(n),Ia.None);return a?a.provider.getLegend():void 0})))),ny.registerCommand("_provideDocumentRangeSemanticTokens",((e,...t)=>vj(void 0,void 0,void 0,(function*(){const[i,n]=t;Js(i instanceof Ps),Js(qo.isIRange(n));const o=e.get(Dv).getModel(i);if(!o)return;const{documentRangeSemanticTokensProvider:s}=e.get(lb),r=yield Lj(s,o,qo.lift(n),Ia.None);return r&&r.tokens?_j({id:0,type:"full",data:r.tokens.data}):void 0}))));var Dj=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},Ej=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};function Nj(e){return e.toString()}function Ij(e){const t=new Ma,i=e.createSnapshot();let n;for(;n=i.read();)t.update(n);return t.digest()}class Tj{constructor(e,t,i){this._modelEventListeners=new Cs,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 Mj=Vo||Ho?1:2;class Oj{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 Aj=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 Fj(this._themeService,this._languageService,this._logService)),this._register(this._configurationService.onDidChangeConfiguration((()=>this._updateModelOptions()))),this._updateModelOptions(),this._register(new Pj(this._semanticStyling,this,this._themeService,this._configurationService,this._languageFeatureDebounceService,l))}static _readModelOptions(e,t){var i;let n=Km.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=Km.insertSpaces;e.editor&&void 0!==e.editor.insertSpaces&&(s="false"!==e.editor.insertSpaces&&Boolean(e.editor.insertSpaces));let r=Mj;const a=e.eol;"\r\n"===a?r=2:"\n"===a&&(r=1);let l=Km.trimAutoWhitespace;e.editor&&void 0!==e.editor.trimAutoWhitespace&&(l="false"!==e.editor.trimAutoWhitespace&&Boolean(e.editor.trimAutoWhitespace));let d=Km.detectIndentation;e.editor&&void 0!==e.editor.detectIndentation&&(d="false"!==e.editor.detectIndentation&&Boolean(e.editor.detectIndentation));let h=Km.largeFileOptimizations;e.editor&&void 0!==e.editor.largeFileOptimizations&&(h="false"!==e.editor.largeFileOptimizations&&Boolean(e.editor.largeFileOptimizations));let c=Km.bracketPairColorizationOptions;return(null===(i=e.editor)||void 0===i?void 0:i.bracketPairColorization)&&"object"==typeof e.editor.bracketPairColorization&&(c={enabled:!!e.editor.bracketPairColorization.enabled}),{isForSimpleWidget:t,tabSize:n,indentSize:o,insertSpaces:s,detectIndentation:d,defaultEOL:r,trimAutoWhitespace:l,largeFileOptimizations:h,bracketPairColorizationOptions:c}}_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&&zo(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(Nj(e.uri),e),this._disposedModelsHeapSize+=e.heapSize}_removeDisposedModel(e){const t=this._disposedModels.get(Nj(e));return t&&(this._disposedModelsHeapSize-=t.heapSize),this._disposedModels.delete(Nj(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 LP(e,t,o,i,this._undoRedoService,this._languageService,this._languageConfigurationService);if(i&&this._disposedModels.has(Nj(i))){const e=this._removeDisposedModel(i),t=this._undoRedoService.getElements(i),n=Ij(s)===e.sha1;if(n||e.sharesUndoRedoStack){for(const e of t.past)sR(e)&&e.matchesResource(i)&&e.setModel(s);for(const e of t.future)sR(e)&&e.matchesResource(i)&&e.setModel(s);this._undoRedoService.setElementsValidFlag(i,!0,(e=>sR(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=Nj(s.uri);if(this._models[r])throw new Error("ModelService: Cannot add model because it already exists!");const a=new Tj(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,"plaintext",i,n),this._onModelAdded.fire(o.model),o.model}setMode(e,t){if(!t)return;const i=this._models[Nj(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=Nj(e),i=this._models[t];return i?i.model:null}getSemanticTokensProviderStyling(e){return this._semanticStyling.get(e)}_schemaShouldMaintainUndoRedoElements(e){return e.scheme===IC.file||e.scheme===IC.vscodeRemote||e.scheme===IC.userData||e.scheme===IC.vscodeNotebookCell||"fake-fs"===e.scheme}_onWillDispose(t){const i=Nj(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)sR(i)&&i.matchesResource(t.uri)&&(s=!0,r+=i.heapSize(t.uri),i.setModel(t.uri));for(const i of e.future)sR(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=>sR(e)&&e.matchesResource(t.uri))),this._insertDisposedModel(new Oj(t.uri,n.model.getInitialUndoRedoSnapshot(),Date.now(),o,r,Ij(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})}};Aj.MAX_MEMORY_FOR_CLOSED_FILES_UNDO_STACK=20971520,Aj=Dj([Ej(0,ev),Ej(1,eb),Ej(2,Ry),Ej(3,tb),Ej(4,mP),Ej(5,rv),Ej(6,pv),Ej(7,$V),Ej(8,lb)],Aj);function Rj(e,t,i){var n;const o=null===(n=i.getValue("editor.semanticHighlighting",{overrideIdentifier:e.getLanguageId(),resource:e.uri}))||void 0===n?void 0:n.enabled;return"boolean"==typeof o?o:t.getColorTheme().semanticHighlighting}let Pj=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 Vj(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()];Rj(e,i,n)?t||r(e):t&&a(e,t)}};this._register(t.onModelAdded((e=>{Rj(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("editor.semanticHighlighting")&&l()}))),this._register(i.onDidColorThemeChange(l))}};Pj=Dj([Ej(1,Dv),Ej(2,Ry),Ej(3,ev),Ej(4,$V),Ej(5,lb)],Pj);class Fj 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 gj(e.getLegend(),this._themeService,this._languageService,this._logService)),this._caches.get(e)}}class Bj{constructor(e,t,i){this.provider=e,this.resultId=t,this.data=i}dispose(){this.provider.releaseDocumentSemanticTokens(this.resultId)}}let Vj=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 Hv((()=>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(!yj(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=Sj(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&&(Na(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(Cj(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(bj(i)){this._currentDocumentResponse=new Bj(t,i.resultId,i.data);const e=pj(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)}};Vj.REQUEST_MIN_DELAY=300,Vj.REQUEST_MAX_DELAY=2e3,Vj=Dj([Ej(2,Ry),Ej(3,$V),Ej(4,lb)],Vj);const Wj=new RegExp(`(\\\\)?\\$\\((${Ys.iconNameExpression}(?:${Ys.iconModifierExpression})?)\\)`,"g");function Hj(e){const t=new Array;let i,n=0,o=0;for(;null!==(i=Wj.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})`:zj({id:r}))}return n<e.length&&t.push(e.substring(n)),t}function zj(e){const t=Mw("span");return t.classList.add(...Ys.asClassNameArray(e)),t}const jj={buttonBackground:QS.fromHex("#0E639C"),buttonHoverBackground:QS.fromHex("#006BB3"),buttonForeground:QS.white};class Uj extends Uo{constructor(e,t){super(),this._onDidClick=this._register(new $o),this.options=t||Object.create(null),Ko(this.options,jj,!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($S.addTarget(this._element)),[yw.CLICK,WS.Tap].forEach((e=>{this._register(BC(this._element,e,(e=>{this.enabled?this._onDidClick.fire(e):Sw(e)})))})),this._register(BC(this._element,yw.KEY_DOWN,(e=>{const t=new SC(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&&Sw(t,!0)}))),this._register(BC(this._element,yw.MOUSE_OVER,(e=>{this._element.classList.contains("disabled")||this.setHoverBackground()}))),this._register(BC(this._element,yw.MOUSE_OUT,(e=>{this.applyStyles()}))),this.focusTracker=this._register(kw(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?Dw(this._element,...Hj(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 $j={badgeBackground:QS.fromHex("#4D4D4D"),badgeForeground:QS.fromHex("#FFFFFF")};class Kj{constructor(e,t){this.count=0,this.options=t||Object.create(null),Ko(this.options,$j,!1),this.badgeBackground=this.options.badgeBackground,this.badgeForeground=this.options.badgeForeground,this.badgeBorder=this.options.badgeBorder,this.element=Lw(e,Mw(".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=Oa(this.countFormat,this.count),this.element.title=Oa(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 qj={progressBarBackground:QS.fromHex("#0E70C0")};class Gj extends Uo{constructor(e,t){super(),this.options=t||Object.create(null),Ko(this.options,qj,!1),this.workedVal=0,this.progressBarBackground=this.options.progressBarBackground,this.showDelayedScheduler=this._register(new Hv((()=>Ow(this.element)),0)),this.longRunningScheduler=this._register(new Hv((()=>this.infiniteLongRunning()),Gj.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("active","infinite","infinite-long-running","discrete"),this.workedVal=0,this.totalWork=void 0,this.longRunningScheduler.cancel()}stop(){return this.doDone(!1)}doDone(e){return this.element.classList.add("done"),this.element.classList.contains("infinite")?(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("discrete","done","infinite-long-running"),this.element.classList.add("active","infinite"),this.longRunningScheduler.schedule(),this}infiniteLongRunning(){this.element.classList.add("infinite-long-running")}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}}}Gj.LONG_RUNNING_INFINITE_THRESHOLD=1e4;class Zj{constructor(e){this._prefix=e,this._lastId=0}nextId(){return this._prefix+ ++this._lastId}}const Yj=new Zj("id#");const Xj={},Qj=new Zj("quick-input-button-icon-");function Jj(e){if(!e)return;let t;const i=e.dark.toString();return Xj[i]?t=Xj[i]:(t=Qj.nextId(),bw(`.${t}`,`background-image: ${Fw(e.light||e.dark)}`),bw(`.vs-dark .${t}, .hc-black .${t}`,`background-image: ${Fw(e.dark)}`),Xj[i]=t),t}const eU={ctrlCmd:!1,alt:!1};var tU,iU,nU,oU;function sU(e,t={}){const i=rU(t);return lU(i,function(e,t){const i={type:1,children:[]};let n=0,o=i;const s=[],r=new aU(e);for(;!r.eos();){let e=r.next();const i="\\"===e&&0!==hU(r.peek(),t);if(i&&(e=r.next()),!i&&dU(e,t)&&e===r.peek()){r.advance(),2===o.type&&(o=s.pop());const i=hU(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 rU(e){const t=e.inline?"span":"div",i=document.createElement(t);return e.className&&(i.className=e.className),i}(iU=tU||(tU={}))[iU.Blur=1]="Blur",iU[iU.Gesture=2]="Gesture",iU[iU.Other=3]="Other",(oU=nU||(nU={}))[oU.NONE=0]="NONE",oU[oU.FIRST=1]="FIRST",oU[oU.SECOND=2]="SECOND",oU[oU.LAST=3]="LAST";class aU{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 lU(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(WC(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=>{lU(o,e,i,n)}))}function dU(e,t){return 0!==hU(e,t)}function hU(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 cU{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 uU{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 cU(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 gU=Mw,pU={inputBackground:QS.fromHex("#3C3C3C"),inputForeground:QS.fromHex("#CCCCCC"),inputValidationInfoBorder:QS.fromHex("#55AAFF"),inputValidationInfoBackground:QS.fromHex("#063B49"),inputValidationWarningBorder:QS.fromHex("#B89500"),inputValidationWarningBackground:QS.fromHex("#352A05"),inputValidationErrorBorder:QS.fromHex("#BE1100"),inputValidationErrorBackground:QS.fromHex("#5A1D1D")};class mU extends zI{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,pU,!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=Lw(e,gU(".monaco-inputbox.idle"));let o=this.options.flexibleHeight?"textarea":"input",s=Lw(this.element,gU(".ibwrapper"));if(this.input=Lw(s,gU(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=Lw(s,gU("div.mirror")),this.mirror.innerText=" ",this.scrollableElement=new nT(this.element,{vertical:1}),this.options.flexibleWidth&&(this.input.setAttribute("wrap","off"),this.mirror.style.whiteSpace="pre",this.mirror.style.wordWrap="initial"),Lw(e,this.scrollableElement.getDomNode()),this._register(this.scrollableElement),this._register(this.scrollableElement.onScroll((e=>this.input.scrollTop=e.scrollTop)));const t=this._register(new zF(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 rB(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:lw(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 sw(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=sw(this.element)+"px";this.contextViewProvider.showContextView({getAnchor:()=>this.element,anchorAlignment:1,render:t=>{if(!this.message)return null;e=Lw(t,gU(".monaco-inputbox-container")),i();const n={inline:!0,className:"monaco-inputbox-message"},o=this.message.formatContent?sU(this.message.content,n):function(e,t={}){const i=rU(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}`:"",Lw(e,o),null},onHide:()=>{this.state="closed"},layout:i}),t=3===this.message.type?$m(0,"Error: {0}",this.message.content):2===this.message.type?$m(0,"Warning: {0}",this.message.content):$m(0,"Info: {0}",this.message.content),$w(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=lw(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 fU extends mU{constructor(e,t,i){const n=$m(0,"for history"),o=` or ⇅ ${n}`,s=` (⇅ ${n})`;super(e,t,i),this.history=new uU(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,Kw(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,Kw(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 _U=Mw;class vU extends Uo{constructor(e){super(),this.parent=e,this.onKeyDown=e=>BC(this.inputBox.inputElement,yw.KEY_DOWN,(t=>{e(new SC(t))})),this.onMouseDown=e=>BC(this.inputBox.inputElement,yw.MOUSE_DOWN,(t=>{e(new EC(t))})),this.onDidChange=e=>this.inputBox.onDidChange(e),this.container=Lw(this.parent,_U(".quick-input-box")),this.inputBox=this._register(new mU(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===oF.Ignore?this.inputBox.hideMessage():this.inputBox.showMessage({type:e===oF.Info?1:e===oF.Warning?2:3,content:""})}stylesForType(e){return this.inputBox.stylesForType(e===oF.Info?1:e===oF.Warning?2:3)}setFocus(){this.inputBox.focus()}layout(){this.inputBox.layout()}style(e){this.inputBox.style(e)}}class bU{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=Lw(e,Mw("span.monaco-highlighted-label"))}get element(){return this.domNode}set(e,t=[],i="",n){e||(e=""),n&&(e=bU.escapeNewLines(e,t)),this.didEverRender&&this.text===e&&this.title===i&&zo(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(Mw("span",void 0,...this.supportIcons?Hj(n):[n])),t=i.end}const n=this.text.substring(i.start,i.end),o=Mw("span.highlight",void 0,...this.supportIcons?Hj(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(Mw("span",void 0,...this.supportIcons?Hj(i):[i]))}Dw(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 CU{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){var i;return this.value+=function(e){return e.replace(/[\\`*_{}[\]()#+\-!]/g,"\\$&")}(this.supportThemeIcons?(i=e,i.replace(fz,((e,t)=>t?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 wU(e){return yU(e)?!e.value:!Array.isArray(e)||e.every(wU)}function yU(e){return e instanceof CU||!(!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 SU(e){return e?e.replace(/\\([\\`*_{}[\]()#+\-.!])/g,"$1"):e}var xU=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 kU{constructor(e,t,i){this.hoverDelegate=e,this.target=t,this.fadeInAnimation=i}update(e,t){var i;return xU(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($m(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&&(!yU(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 LU{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 DU extends Uo{constructor(e,t){super(),this.customHovers=new Map,this.domNode=this._register(new LU(Lw(e,Mw(".monaco-icon-label")))),this.labelContainer=Lw(this.domNode.element,Mw(".monaco-icon-label-container"));const i=Lw(this.labelContainer,Mw("span.monaco-icon-name-container"));this.descriptionContainer=this._register(new LU(Lw(this.labelContainer,Mw("span.monaco-icon-description-container")))),(null==t?void 0:t.supportHighlights)||(null==t?void 0:t.supportIcons)?this.nameNode=new NU(i,!!t.supportIcons):this.nameNode=new EU(i),(null==t?void 0:t.supportDescriptionHighlights)?this.descriptionNodeFactory=()=>new bU(Lw(this.descriptionContainer.element,Mw("span.label-description")),{supportIcons:!!t.supportIcons}):this.descriptionNodeFactory=()=>this._register(new LU(Lw(this.descriptionContainer.element,Mw("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 bU?(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 Vv((()=>xU(this,void 0,void 0,(function*(){o&&!o.isDisposed||(o=new kU(e,r||t,n>0),yield o.update(i,s))}))),n),a=BC(t,yw.MOUSE_OVER,(()=>{if(n)return;const i=new Cs;i.add(BC(t,yw.MOUSE_LEAVE,(e=>s(!1,e.fromElement===t)),!0)),i.add(BC(t,yw.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(BC(t,yw.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=>xU(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=bz(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 EU{constructor(e){this.container=e,this.label=void 0,this.singleLabel=void 0}setLabel(e,t){if(this.label!==e||!zo(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=Lw(this.container,Mw("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}`;Lw(this.container,Mw("a.label-name",{id:o,"data-icon-label-count":e.length,"data-icon-label-index":i,role:"treeitem"},n)),i<e.length-1&&Lw(this.container,Mw("span.label-separator",void 0,(null==t?void 0:t.separator)||"/"))}}}}class NU{constructor(e,t){this.container=e,this.supportIcons=t,this.label=void 0,this.singleLabel=void 0}setLabel(e,t){if(this.label!==e||!zo(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 bU(Lw(this.container,Mw("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=>zW.intersect(o,e))).filter((e=>!zW.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=Mw("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 bU(Lw(this.container,a),{supportIcons:this.supportIcons}).set(s,r,void 0,null==t?void 0:t.labelEscapeNewLines),o<e.length-1&&Lw(a,Mw("span.label-separator",void 0,i))}}}}const IU=Mw;class TU{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=Lw(e,IU(".monaco-keybinding")),this.didEverRender=!1,e.appendChild(this.domNode)}get element(){return this.domNode}set(e,t){this.didEverRender&&this.keybinding===e&&TU.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&&(Lw(this.domNode,IU("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(){RC(this.domNode),this.keyElements.clear()}renderPart(e,t,i){const n=bW.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){Lw(e,this.createKeyElement(t,i?".highlight":"")),n&&Lw(e,IU("span.monaco-keybinding-key-separator",void 0,n))}renderUnbound(e){Lw(e,this.createKeyElement($m(0,"Unbound")))}createKeyElement(e,t=""){const i=IU("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&&zo(e.firstPart,t.firstPart)&&zo(e.chordPart,t.chordPart)}}const MU=new jv((()=>{const e=new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"});return{collator:e,collatorIsNumeric:e.resolvedOptions().numeric}}));function OU(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=MU.value.collator.compare(n,o);return MU.value.collatorIsNumeric&&0===s&&n!==o?n<o?-1:1:s}(n,o);return 0!==a?a:n.localeCompare(o)}new jv((()=>({collator:new Intl.Collator(void 0,{numeric:!0})}))),new jv((()=>({collator:new Intl.Collator(void 0,{numeric:!0,sensitivity:"accent"})})));var AU=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},RU=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 PU=Mw;class FU{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 BU{get templateId(){return BU.ID}renderTemplate(e){const t=Object.create(null);t.toDisposeElement=[],t.toDisposeTemplate=[],t.entry=Lw(e,PU(".quick-input-list-entry"));const i=Lw(t.entry,PU("label.quick-input-list-label"));t.toDisposeTemplate.push(WC(i,yw.CLICK,(e=>{t.checkbox.offsetParent||e.preventDefault()}))),t.checkbox=Lw(i,PU("input.quick-input-list-checkbox")),t.checkbox.type="checkbox",t.toDisposeTemplate.push(WC(t.checkbox,yw.CHANGE,(e=>{t.element.checked=t.checkbox.checked})));const n=Lw(i,PU(".quick-input-list-rows")),o=Lw(n,PU(".quick-input-list-row")),s=Lw(n,PU(".quick-input-list-row"));t.label=new DU(o,{supportHighlights:!0,supportDescriptionHighlights:!0,supportIcons:!0});const r=Lw(o,PU(".quick-input-list-entry-keybinding"));t.keybinding=new TU(r,Xs);const a=Lw(s,PU(".quick-input-list-label-meta"));return t.detail=new DU(a,{supportHighlights:!0,supportIcons:!0}),t.separator=Lw(t.entry,PU(".quick-input-list-separator")),t.actionBar=new rB(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?Jj(t.iconPath):void 0);t.alwaysVisible&&(n=n?`${n} always-visible`:"always-visible");const o=new Xw(`id-${i}`,"",n,!0,(()=>RU(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)}}BU.ID="listelement";class VU{getHeight(e){return e.saneDetail?44:22}getTemplateId(e){return BU.ID}}var WU,HU;(HU=WU||(WU={}))[HU.First=1]="First",HU[HU.Second=2]="Second",HU[HU.Last=3]="Last",HU[HU.Next=4]="Next",HU[HU.Previous=5]="Previous",HU[HU.NextPage=6]="NextPage",HU[HU.PreviousPage=7]="PreviousPage";class zU{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=Lw(this.parent,PU(".quick-input-list"));const n=new VU,o=new jU;this.list=i.createList("QuickInput",this.container,n,[new BU],{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 SC(e);switch(t.keyCode){case 10:this.toggleCheckbox();break;case 31:(Ho?e.metaKey:e.ctrlKey)&&this.list.setFocus(Aa(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(BC(this.container,yw.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," "),h=n.meta&&n.meta.replace(/\r?\n/g," "),c=n.description&&n.description.replace(/\r?\n/g," "),u=n.detail&&n.detail.replace(/\r?\n/g," "),g=n.ariaLabel||[d,c,u].map((e=>Ra(e))).filter((e=>!!e)).join(", "),p=this.parent.classList.contains("show-checkboxes");i.push(new FU({hasCheckbox:p,index:o,item:n,saneLabel:d,saneMeta:h,saneAriaLabel:g,saneDescription:c,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===WU.Next&&this.list.getFocus()[0]===this.list.length-1&&(e=WU.First),e===WU.Previous&&0===this.list.getFocus()[0]&&(e=WU.Last),e===WU.Second&&this.list.length<2&&(e=WU.First),e){case WU.First:this.list.focusFirst();break;case WU.Second:this.list.focusNth(1);break;case WU.Last:this.list.focusLast();break;case WU.Next:this.list.focusNext();break;case WU.Previous:this.list.focusPrevious();break;case WU.NextPage:this.list.focusNextPage();break;case WU.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(wz(e,Cz(i.saneLabel))):void 0,o=this.matchOnDescription?Qs(wz(e,Cz(i.saneDescription||""))):void 0,s=this.matchOnDetail?Qs(wz(e,Cz(i.saneDetail||""))):void 0,r=this.matchOnMeta?Qs(wz(e,Cz(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 OU(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)}}AU([VS],zU.prototype,"onDidChangeFocus",null),AU([VS],zU.prototype,"onDidChangeSelection",null);class jU{getWidgetAriaLabel(){return $m(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 UU=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 $U=Mw,KU={iconClass:br.quickInputBack.classNames,tooltip:$m(0,"Back"),handle:-1};class qU extends Uo{constructor(e){super(),this.ui=e,this.visible=!1,this._enabled=!0,this._busy=!1,this._ignoreFocusOut=!1,this._buttons=[],this.noValidationMessage=qU.noPromptMessage,this._severity=oF.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 Cs),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=tU.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 Vv,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===KU));this.ui.leftActionBar.push(e.map(((e,t)=>{const i=new Xw(`id-${t}`,"",e.iconClass||Jj(e.iconPath),!0,(()=>UU(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!==KU));this.ui.rightActionBar.push(t.map(((e,t)=>{const i=new Xw(`id-${t}`,"",e.iconClass||Jj(e.iconPath),!0,(()=>UU(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,Dw(this.ui.message,...Hj(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?$m(0,"{0}/{1}",this.step,this.totalSteps):this.step?String(this.step):""}showMessageDecoration(e){if(this.ui.inputBox.showDecoration(e),e!==oF.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()}}qU.noPromptMessage=$m(0,"Press 'Enter' to confirm your input or 'Escape' to cancel");class GU extends qU{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()?nU.NONE:nU.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?eU: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(WU.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(WU.Next),this.canSelectMany&&this.ui.list.domFocus(),Sw(e,!0);break;case 16:this.ui.list.getFocusedElements().length?this.ui.list.focus(WU.Previous):this.ui.list.focus(WU.Last),this.canSelectMany&&this.ui.list.domFocus(),Sw(e,!0);break;case 12:this.ui.list.focus(WU.NextPage),this.canSelectMany&&this.ui.list.domFocus(),Sw(e,!0);break;case 11:this.ui.list.focus(WU.PreviousPage),this.canSelectMany&&this.ui.list.domFocus(),Sw(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(WU.First),Sw(e,!0));break;case 13:!e.ctrlKey&&!e.metaKey||e.shiftKey||e.altKey||(this.ui.list.focus(WU.Last),Sw(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 BC(this.ui.container,yw.KEY_UP,(e=>{if(this.canSelectMany||!this._quickNavigate)return;const t=new SC(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||GU.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 nU.NONE:this._itemActivation=nU.FIRST;break;case nU.SECOND:this.ui.list.focus(WU.Second),this._itemActivation=nU.FIRST;break;case nU.LAST:this.ui.list.focus(WU.Last),this._itemActivation=nU.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(WU.First)),this.keepScrollPosition&&(this.scrollTop=e)}}GU.DEFAULT_ARIA_LABEL=$m(0,"Type to narrow down results.");class ZU 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(BC(window,yw.KEY_DOWN,e,!0)),this._register(BC(window,yw.KEY_UP,e,!0)),this._register(BC(window,yw.MOUSE_DOWN,e,!0))}getUI(){if(this.ui)return this.ui;const e=Lw(this.parentElement,$U(".quick-input-widget.show-file-icons"));e.tabIndex=-1,e.style.display="none";const t=fw(e),i=Lw(e,$U(".quick-input-titlebar")),n=this._register(new rB(i));n.domNode.classList.add("quick-input-left-action-bar");const o=Lw(i,$U(".quick-input-title")),s=this._register(new rB(i));s.domNode.classList.add("quick-input-right-action-bar");const r=Lw(e,$U(".quick-input-description")),a=Lw(e,$U(".quick-input-header")),l=Lw(a,$U("input.quick-input-check-all"));l.type="checkbox",this._register(WC(l,yw.CHANGE,(e=>{const t=l.checked;y.setAllVisibleChecked(t)}))),this._register(BC(l,yw.CLICK,(e=>{(e.x||e.y)&&u.setFocus()})));const d=Lw(a,$U(".quick-input-description")),h=Lw(a,$U(".quick-input-and-message")),c=Lw(h,$U(".quick-input-filter")),u=this._register(new vU(c));u.setAttribute("aria-describedby",`${this.idPrefix}message`);const g=Lw(c,$U(".quick-input-visible-count"));g.setAttribute("aria-live","polite"),g.setAttribute("aria-atomic","true");const p=new Kj(g,{countFormat:$m(0,"{0} Results")}),m=Lw(c,$U(".quick-input-count"));m.setAttribute("aria-live","polite");const f=new Kj(m,{countFormat:$m(0,"{0} Selected")}),_=Lw(a,$U(".quick-input-action")),v=new Uj(_);v.label=$m(0,"OK"),this._register(v.onDidClick((e=>{this.onDidAcceptEmitter.fire()})));const b=Lw(a,$U(".quick-input-action")),C=new Uj(b);C.label=$m(0,"Custom"),this._register(C.onDidClick((e=>{this.onDidCustomEmitter.fire()})));const w=Lw(h,$U(`#${this.idPrefix}message.quick-input-message`)),y=this._register(new zU(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 GU&&this.controller.canSelectMany&&y.clearFocus()}),0)}))),this._register(y.onDidChangeFocus((()=>{this.comboboxAccessibility&&this.getUI().inputBox.setAttribute("aria-activedescendant",this.getUI().list.getActiveDescendant()||"")})));const S=new Gj(e);S.getContainer().classList.add("quick-input-progress");const x=kw(e);return this._register(x),this._register(BC(e,yw.FOCUS,(e=>{this.previousFocusElement=e.relatedTarget instanceof HTMLElement?e.relatedTarget:void 0}),!0)),this._register(x.onDidBlur((()=>{this.getUI().ignoreFocusOut||this.options.ignoreFocusOut()||this.hide(tU.Blur),this.previousFocusElement=void 0}))),this._register(BC(e,yw.FOCUS,(e=>{u.setFocus()}))),this._register(BC(e,yw.KEY_DOWN,(t=>{const i=new SC(t);switch(i.keyCode){case 3:Sw(t,!0),this.onDidAcceptEmitter.fire();break;case 9:Sw(t,!0),this.hide(tU.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]?(Sw(t,!0),o[o.length-1].focus()):i.shiftKey||i.target!==o[o.length-1]||(Sw(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:c,inputBox:u,visibleCountContainer:g,visibleCount:p,countContainer:m,count:f,okContainer:_,ok:v,message:w,customButtonContainer:b,customButton:C,list:y,progressBar:S,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 GU(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(oF.Ignore),t.visibleCount.setCount(0),t.count.setCount(0),Dw(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();KU.tooltip=n?$m(0,"Back ({0})",n):$m(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,ZU.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)}}}ZU.MAX_WIDTH=600;class YU{constructor(e){this.spliceables=e}splice(e,t,i){this.spliceables.forEach((n=>n.splice(e,t,i)))}}class XU extends Error{constructor(e,t){super(`ListError [${e}] ${t}`)}}function QU(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=zW.intersect(e,n.range);zW.isEmpty(t)||i.push({range:t,size:n.size})}return i}function JU({start:e,end:t},i){return{start:e+i,end:t+i}}class e${constructor(){this.groups=[],this._size=0}splice(e,t,i=[]){const n=i.length-t,o=QU({start:0,end:e},this.groups),s=QU({start:e+t,end:Number.POSITIVE_INFINITY},this.groups).map((e=>({range:JU(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 t${constructor(e){this.renderers=e,this.cache=new Map}alloc(e){let t=this.getTemplateCache(e).pop();if(!t){const i=Mw(".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 i$=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 n$={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 o${constructor(e){this.elements=e}update(){}getData(){return this.elements}}class s${constructor(e){this.elements=e}update(){}getData(){return this.elements}}class r${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 a${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 l${constructor(e,t,i,n=n$){if(this.virtualDelegate=t,this.domId="list_id_"+ ++l$.InstanceCount,this.renderers=new Map,this.renderWidth=0,this._scrollHeight=0,this.scrollableElementUpdateDisposable=null,this.scrollableElementWidthDelayer=new Av(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 Cs,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 e$;for(const o of i)this.renderers.set(o.templateId,o);this.cache=this.disposables.add(new t$(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),n$.horizontalScrolling),this.domNode.classList.toggle("horizontal-scrolling",this._horizontalScrolling),this.additionalScrollHeight=void 0===n.additionalScrollHeight?0:n.additionalScrollHeight,this.accessibilityProvider=new a$(n.accessibilityProvider),this.rowsContainer=document.createElement("div"),this.rowsContainer.className="monaco-list-rows";Pa(n,(e=>e.transformOptimization),n$.transformOptimization)&&(this.rowsContainer.style.transform="translate3d(0px, 0px, 0px)"),this.disposables.add($S.addTarget(this.rowsContainer)),this.scrollable=new YI({forceIntegerValues:!0,smoothScrollDuration:Pa(n,(e=>e.smoothScrolling),!1)?125:0,scheduleAtNextAnimationFrame:e=>KC(e)}),this.scrollableElement=this.disposables.add(new oT(this.rowsContainer,{alwaysConsumeMouseWheel:Pa(n,(e=>e.alwaysConsumeMouseWheel),n$.alwaysConsumeMouseWheel),horizontal:1,vertical:Pa(n,(e=>e.verticalScrollMode),n$.verticalScrollMode),useShadows:Pa(n,(e=>e.useShadows),n$.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(BC(this.rowsContainer,WS.Change,(e=>this.onTouchChange(e)))),this.disposables.add(BC(this.scrollableElement.getDomNode(),"scroll",(e=>e.target.scrollTop=0))),this.disposables.add(BC(this.domNode,"dragover",(e=>this.onDragOver(this.toDragEvent(e))))),this.disposables.add(BC(this.domNode,"drop",(e=>this.onDrop(this.toDragEvent(e))))),this.disposables.add(BC(this.domNode,"dragleave",(e=>this.onDragLeave(this.toDragEvent(e))))),this.disposables.add(BC(this.domNode,"dragend",(e=>this.onDragEnd(e)))),this.setRowLineHeight=Pa(n,(e=>e.setRowLineHeight),n$.setRowLineHeight),this.setRowHeight=Pa(n,(e=>e.setRowHeight),n$.setRowHeight),this.supportDynamicHeights=Pa(n,(e=>e.supportDynamicHeights),n$.supportDynamicHeights),this.dnd=Pa(n,(e=>e.dnd),n$.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:rw(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=zW.intersect(n,o),r=new Map;for(let C=s.end-1;C>=s.start;C--){const e=this.items[C];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,C,e.row.templateData,e.size),t.push(e.row)}e.row=null}const a={start:e+t,end:this.items.length},l=zW.intersect(a,n),d=zW.relativeComplement(a,n),h=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 c;0===e&&t>=this.items.length?(this.rangeMap=new e$,this.rangeMap.splice(0,0,h),c=this.items,this.items=h):(this.rangeMap.splice(e,t,h),c=this.items.splice(e,t,...h));const u=i.length-t,g=this.getRenderRange(this.lastRenderTop,this.lastRenderHeight),p=JU(l,u),m=zW.intersect(g,p);for(let C=m.start;C<m.end;C++)this.updateItemInDOM(this.items[C],C);const f=zW.relativeComplement(p,g);for(const C of f)for(let e=C.start;e<C.end;e++)this.removeItemFromDOM(e);const _=d.map((e=>JU(e,u))),v=[{start:e,end:e+i.length},..._].map((e=>zW.intersect(g,e))),b=this.getNextToLastElement(v);for(const C of v)for(let e=C.start;e<C.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 C of r.values())for(const e of C)this.cache.release(e);return this.eventuallyUpdateScrollDimensions(),this.supportDynamicHeights&&this._rerender(this.scrollTop,this.renderHeight),c.map((e=>e.element))}eventuallyUpdateScrollDimensions(){this._scrollHeight=this.contentHeight,this.rowsContainer.style.height=`${this._scrollHeight}px`,this.scrollableElementUpdateDisposable||(this.scrollableElementUpdateDisposable=KC((()=>{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:aw(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:rw(this.domNode)})}render(e,t,i,n,o,s=!1){const r=this.getRenderRange(t,i),a=zW.relativeComplement(r,e),l=zW.relativeComplement(e,r),d=this.getNextToLastElement(a);if(s){const t=zW.intersect(e,r);for(let e=t.start;e<t.end;e++)this.updateItemInDOM(this.items[e],e)}for(const h of a)for(let e=h.start;e<h.end;e++)this.insertItemInDOM(e,d);for(const h of l)for(let e=h.start;e<h.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=BC(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=Rf?"-moz-fit-content":"fit-content",e.width=rw(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 zF(this.domNode,"click")).event,(e=>this.toMouseEvent(e)))}get onMouseDblClick(){return ds.map(this.disposables.add(new zF(this.domNode,"dblclick")).event,(e=>this.toMouseEvent(e)))}get onMouseMiddleClick(){return ds.filter(ds.map(this.disposables.add(new zF(this.domNode,"auxclick")).event,(e=>this.toMouseEvent(e))),(e=>1===e.browserEvent.button))}get onMouseDown(){return ds.map(this.disposables.add(new zF(this.domNode,"mousedown")).event,(e=>this.toMouseEvent(e)))}get onContextMenu(){return ds.any(ds.map(this.disposables.add(new zF(this.domNode,"contextmenu")).event,(e=>this.toMouseEvent(e))),ds.map(this.disposables.add(new zF(this.domNode,WS.Contextmenu)).event,(e=>this.toGestureEvent(e))))}get onTouchStart(){return ds.map(this.disposables.add(new zF(this.domNode,"touchstart")).event,(e=>this.toTouchEvent(e)))}get onTap(){return ds.map(this.disposables.add(new zF(this.rowsContainer,WS.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(eB.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=Mw(".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 o$(n),iB.CurrentDragAndDropData=new s$(n),this.dnd.onDragStart&&this.dnd.onDragStart(this.currentDragData,i)}onDragOver(e){if(e.browserEvent.preventDefault(),this.onDragLeaveTimeout.dispose(),iB.CurrentDragAndDropData&&"vscode-ui"===iB.CurrentDragAndDropData.getData())return!1;if(this.setupDragAndDropScrollTopAnimation(e.browserEvent),!e.browserEvent.dataTransfer)return!1;if(!this.currentDragData)if(iB.CurrentDragAndDropData)this.currentDragData=iB.CurrentDragAndDropData;else{if(!e.browserEvent.dataTransfer.types)return!1;this.currentDragData=new r$}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=Fv((()=>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,iB.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,iB.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=iw(this.domNode).top;this.dragOverAnimationDisposable=function(e){const t=()=>{e(),i=KC(t)};let i=KC(t);return es((()=>i.dispose()))}(this.animateDragAndDropScrollTop.bind(this,e))}this.dragOverAnimationStopDisposable.dispose(),this.dragOverAnimationStopDisposable=Fv((()=>{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=zW.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=zW.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)}}l$.InstanceCount=0,i$([VS],l$.prototype,"onMouseClick",null),i$([VS],l$.prototype,"onMouseDblClick",null),i$([VS],l$.prototype,"onMouseMiddleClick",null),i$([VS],l$.prototype,"onMouseDown",null),i$([VS],l$.prototype,"onContextMenu",null),i$([VS],l$.prototype,"onTouchStart",null),i$([VS],l$.prototype,"onTap",null);var d$,h$,c$=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},u$=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 g${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 p${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 g$(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(T$),t)}_set(e,t,i){const n=this.indexes,o=this.sortedIndexes;this.indexes=e,this.sortedIndexes=t;const s=I$(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,T$)>=0}dispose(){bs(this._onChange)}}c$([VS],p$.prototype,"renderer",null);class m$ extends p${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 f${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 _$(e){return"INPUT"===e.tagName||"TEXTAREA"===e.tagName}function v$(e){return!!e.classList.contains("monaco-editor")||!e.classList.contains("monaco-list")&&(!!e.parentElement&&v$(e.parentElement))}class b${constructor(e,t,i){this.list=e,this.view=t,this.disposables=new Cs,this.multipleSelectionDisposables=new Cs,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=>(Ho?e.metaKey:e.ctrlKey)&&31===e.keyCode)).on(this.onCtrlA,this,this.multipleSelectionDisposables)}get onKeyDown(){return ds.chain(this.disposables.add(new zF(this.view.domNode,"keydown")).event).filter((e=>!_$(e.target))).map((e=>new SC(e)))}updateOptions(e){void 0!==e.multipleSelectionSupport&&(this.multipleSelectionDisposables.clear(),e.multipleSelectionSupport&&this.onKeyDown.filter((e=>(Ho?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(Aa(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()}}c$([VS],b$.prototype,"onKeyDown",null),(h$=d$||(d$={}))[h$.Idle=0]="Idle",h$[h$.Typing=1]="Typing";const C$=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 w${constructor(e,t,i,n){this.list=e,this.view=t,this.keyboardNavigationLabelProvider=i,this.delegate=n,this.enabled=!1,this.state=d$.Idle,this.automaticKeyboardNavigation=!0,this.triggered=!1,this.previouslyFocused=-1,this.enabledDisposables=new Cs,this.disposables=new Cs,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 zF(this.view.domNode,"keydown")).event).filter((e=>!_$(e.target))).filter((()=>this.automaticKeyboardNavigation||this.triggered)).map((e=>new SC(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&&$w(i)}this.previouslyFocused=-1}onInput(e){if(!e)return this.state=d$.Idle,void(this.triggered=!1);const t=this.list.getFocus(),i=t.length>0?t[0]:0,n=this.state===d$.Idle?1:0;this.state=d$.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||NH(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 y${constructor(e,t){this.list=e,this.view=t,this.disposables=new Cs;ds.chain(this.disposables.add(new zF(t.domNode,"keydown")).event).filter((e=>!_$(e.target))).map((e=>new SC(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 S$(e){return Ho?e.browserEvent.metaKey:e.browserEvent.ctrlKey}function x$(e){return e.browserEvent.shiftKey}const k$={isSelectionSingleChangeEvent:S$,isSelectionRangeChangeEvent:x$};class L${constructor(e){this.list=e,this.disposables=new Cs,this._onPointer=new $o,this.onPointer=this._onPointer.event,!1!==e.options.multipleSelectionSupport&&(this.multipleSelectionController=this.list.options.multipleSelectionController||k$),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($S.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||k$))}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){v$(e.browserEvent.target)||document.activeElement!==e.browserEvent.target&&this.list.domFocus()}onContextMenu(e){if(v$(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(_$(e.browserEvent.target)||v$(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(_$(e.browserEvent.target)||v$(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=Aa(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}(I$(r,[i]),i);if(0===a.length)return;const l=I$(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 D${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 E$={listFocusBackground:QS.fromHex("#7FB0D0"),listActiveSelectionBackground:QS.fromHex("#0E639C"),listActiveSelectionForeground:QS.fromHex("#FFFFFF"),listActiveSelectionIconForeground:QS.fromHex("#FFFFFF"),listFocusAndSelectionBackground:QS.fromHex("#094771"),listFocusAndSelectionForeground:QS.fromHex("#FFFFFF"),listInactiveSelectionBackground:QS.fromHex("#3F3F46"),listInactiveSelectionIconForeground:QS.fromHex("#FFFFFF"),listHoverBackground:QS.fromHex("#2A2D2E"),listDropBackground:QS.fromHex("#383B3D"),treeIndentGuidesStroke:QS.fromHex("#a9a9a9"),tableColumnsBorder:QS.fromHex("#cccccc").transparent(.2),tableOddRowsBackgroundColor:QS.fromHex("#cccccc").transparent(.04)},N$={keyboardSupport:!0,mouseSupport:!0,multipleSelectionSupport:!0,dnd:{getDragURI:()=>null,onDragStart(){},onDragOver:()=>!1,drop(){}}};function I$(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 T$=(e,t)=>e-t;class M${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 O${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 A${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 R${constructor(e,t,i,n,o=N$){var s;this.user=e,this._options=o,this.focus=new p$("focused"),this.anchor=new p$("anchor"),this.eventBufferer=new Ba,this._ariaLabel="",this.disposables=new Cs,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 m$("listbox"!==r),Ko(o,E$,!1);const a=[this.focus.renderer,this.selection.renderer];this.accessibilityProvider=o.accessibilityProvider,this.accessibilityProvider&&(a.push(new O$(this.accessibilityProvider)),this.accessibilityProvider.onDidChangeActiveDescendant&&this.accessibilityProvider.onDidChangeActiveDescendant(this.onDidChangeActiveDescendant,this,this.disposables)),n=n.map((e=>new M$(e.templateId,[...a,e])));const l=Object.assign(Object.assign({},o),{dnd:o.dnd&&new A$(this,o.dnd)});if(this.view=new l$(t,i,n,l),this.view.domNode.setAttribute("role",r),o.styleController)this.styleController=o.styleController(this.view.domId);else{const e=fw(this.view.domNode);this.styleController=new D$(e,this.view.domId)}if(this.spliceable=new YU([new f$(this.focus,this.view,o.identityProvider),new f$(this.selection,this.view,o.identityProvider),new f$(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 y$(this,this.view)),("boolean"!=typeof o.keyboardSupport||o.keyboardSupport)&&(this.keyboardController=new b$(this,this.view,o),this.disposables.add(this.keyboardController)),o.keyboardNavigationLabelProvider){const e=o.keyboardNavigationDelegate||C$;this.typeLabelController=new w$(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 zF(this.view.domNode,"keydown")).event).map((e=>new SC(e))).filter((t=>e=58===t.keyCode||t.shiftKey&&68===t.keyCode)).map(jF).filter((()=>!1)).event,i=ds.chain(this.disposables.add(new zF(this.view.domNode,"keyup")).event).forEach((()=>e=!1)).map((e=>new SC(e))).filter((e=>58===e.keyCode||e.shiftKey&&68===e.keyCode)).map(jF).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 zF(this.view.domNode,"keydown")).event}get onDidFocus(){return ds.signal(this.disposables.add(new zF(this.view.domNode,"focus",!0)).event)}createMouseController(e){return new L$(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 XU(this.user,`Invalid start index: ${e}`);if(t<0)throw new XU(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 XU(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 XU(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 XU(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 u$(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 Pv(0),yield this.focusNextPage(e,t))}}))}focusPreviousPage(e,t){return u$(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 Pv(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 XU(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*WV(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 XU(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()}}c$([VS],R$.prototype,"onDidChangeFocus",null),c$([VS],R$.prototype,"onDidChangeSelection",null),c$([VS],R$.prototype,"onContextMenu",null),c$([VS],R$.prototype,"onKeyDown",null),c$([VS],R$.prototype,"onDidFocus",null);class P${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 F${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 B$={separatorBorder:QS.transparent};class V${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=WV(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 W$ extends V${layoutContainer(e){this.container.style.top=`${e}px`,this.container.style.height=`${this.size}px`}}class H$ extends V${layoutContainer(e){this.container.style.left=`${e}px`,this.container.style.width=`${this.size}px`}}var z$,j$,U$,$$;(j$=z$||(z$={}))[j$.Idle=0]="Idle",j$[j$.Busy=1]="Busy",($$=U$||(U$={})).Distribute={type:"distribute"},$$.Split=function(e){return{type:"split",index:e}},$$.Invisible=function(e){return{type:"invisible",cachedVisibleSize:e}};class K$ 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=z$.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=Lw(this.el,Mw(".sash-container")),this.viewContainer=Mw(".split-view-container"),this.scrollable=new YI({forceIntegerValues:!0,smoothScrollDuration:125,scheduleAtNextAnimationFrame:KC}),this.scrollableElement=this._register(new oT(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}))),Lw(this.el,this.scrollableElement.getDomNode()),this.style(t.styles||B$),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=WV(Math.round(this.proportions[n]*e),t.minimumSize,t.maximumSize)}else{const t=Aa(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(BC(document.body,"keydown",(e=>s(this.sashDragState.current,e.altKey))),BC(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=Aa(n,-1),t=Aa(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),h=Math.max(o,d),c=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?h-t:h+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?c+t:c-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,h=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,-h,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=WV(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!==z$.Idle)throw new Error("Cant modify splitview");if(this.state=z$.Busy,e<0||e>=this.viewItems.length)return;const i=Aa(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=WV(t=Math.round(t),s.minimumSize,Math.min(s.maximumSize,this.size)),s.size=t,this.relayout(n,o),this.state=z$.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=WV(i,r.minimumSize,r.maximumSize);const n=Aa(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!==z$.Idle)throw new Error("Cant modify splitview");this.state=z$.Busy;const o=Mw(".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 W$(o,e,l,a):new H$(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 QF(this.sashContainer,{getHorizontalSashTop:e=>this.getSashPosition(e),getHorizontalSashWidth:this.getSashOrthogonalSize},Object.assign(Object.assign({},e),{orientation:1})):new QF(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))))(this.onSashEnd,this),a=t.onDidReset((()=>{const e=this.sashItems.findIndex((e=>e.sash===t)),i=Aa(e,-1),n=Aa(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)})),l=ta(o,s,r,a,t),d={sash:t,disposable:l};this.sashItems.splice(i-1,0,d)}let h;o.appendChild(e.element),"number"!=typeof t&&"split"===t.type&&(h=[t.index]),n||this.relayout([i],h),this.state=z$.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=Aa(e,-1),h=Aa(e+1,this.viewItems.length);if(o)for(const y of o)Va(d,y),Va(h,y);if(n)for(const y of n)Wa(d,y),Wa(h,y);const c=d.map((e=>this.viewItems[e])),u=d.map((e=>i[e])),g=h.map((e=>this.viewItems[e])),p=h.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===h.length?Number.POSITIVE_INFINITY:h.reduce(((e,t)=>e+(i[t]-this.viewItems[t].minimumSize)),0),v=0===h.length?Number.NEGATIVE_INFINITY:h.reduce(((e,t)=>e+(i[t]-this.viewItems[t].maximumSize)),0),b=Math.max(m,v,s),C=Math.min(_,f,r);let w=!1;if(a){const e=this.viewItems[a.index],i=t>=a.limitDelta;w=i!==e.visible,e.setVisible(i,a.size)}if(!w&&l){const e=this.viewItems[l.index],i=t<l.limitDelta;w=i!==e.visible,e.setVisible(i,l.size)}if(w)return this.resize(e,t,i,n,o,s,r);for(let y=0,S=t=WV(t,b,C);y<c.length;y++){const e=c[y],t=WV(u[y]+S,e.minimumSize,e.maximumSize);S-=t-u[y],e.size=t}for(let y=0,S=t;y<g.length;y++){const e=g[y],t=WV(p[y]-S,e.minimumSize,e.maximumSize);S+=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=Aa(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=WV(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=Aa(a,-1),n=Aa(a+1,this.viewItems.length),s=this.findFirstSnapIndex(i),l=this.findFirstSnapIndex(n),d="number"==typeof s&&!this.viewItems[s].visible,h="number"==typeof l&&!this.viewItems[l].visible;d&&o[a]&&(r>0||this.startSnappingEnabled)?e.state=1:h&&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 q$,G$;class Z${constructor(e,t,i){this.columns=e,this.getColumnSize=i,this.templateId=Z$.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=Lw(e,Mw(".monaco-table-tr")),i=[],n=[];for(let s=0;s<this.columns.length;s++){const e=this.renderers[s],o=Lw(t,Mw(".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])}RC(e.container),this.renderedTemplates.delete(e)}layoutColumn(e,t){for(const{cellContainers:i}of this.renderedTemplates)i[e].style.width=`${t}px`}}Z$.TemplateId="row";class Y${constructor(e,t){this.column=e,this.index=t,this._onDidLayout=new $o,this.onDidLayout=this._onDidLayout.event,this.element=Mw(".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 X${constructor(e,t,i,n,o,s){this.virtualDelegate=i,this.domId="table_id_"+ ++X$.InstanceCount,this.disposables=new Cs,this.cachedWidth=0,this.cachedHeight=0,this.domNode=Lw(t,Mw(`.monaco-table.${this.domId}`));const r=n.map(((e,t)=>new Y$(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 K$(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 Z$(n,o,(e=>this.splitview.getViewSize(e)));var d;this.list=this.disposables.add(new R$(e,this.domNode,(d=i,{getHeight:e=>d.getHeight(e),getTemplateId:()=>Z$.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=fw(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()}}X$.InstanceCount=0,(G$=q$||(q$={}))[G$.Unknown=0]="Unknown",G$[G$.Twistie=1]="Twistie",G$[G$.Element=2]="Element";class Q$ extends Error{constructor(e,t){super(`TreeError [${e}] ${t}`)}}class J${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 eK(e){return"object"==typeof e&&"visibility"in e&&"data"in e}function tK(e){switch(e){case!0:return 1;case!1:return 0;default:return e}}function iK(e){return"boolean"==typeof e.collapsible}class nK{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 Av(Ov),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=zs.empty(),n={}){if(0===e.length)throw new Q$(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=zs.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],h=new Ha({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(h.quitEarly)return a.lastDiffIds=void 0,this.spliceSimple(t,i,l,o);const c=t.slice(0,-1),u=(t,i,n)=>{if(s>0)for(let r=0;r<n;r++)t--,i--,this.spliceSmart(e,[...c,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 h.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([...c,g],m.originalLength,zs.slice(l,p,p+m.modifiedLength),o);u(g,p,g)}spliceSimple(e,t,i=zs.empty(),{onDidCreateNode:n,onDidDeleteNode:o,diffIdentityProvider:s}){const{parentNode:r,listIndex:a,revealed:l,visible:d}=this.getParentNodeWithListIndex(e),h=[],c=zs.map(i,(e=>this.createTreeNode(e,r,r.visible?1:0,l,h,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 c)m.push(y),_+=y.renderNodeCount,y.visible&&(y.visibleChildIndex=p+f++);const v=za(r.children,u,t,m);s?r.lastDiffIds?za(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,h)}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 C=r.children.length>0;g!==C&&this.setCollapsible(e.slice(0,-1),C);let w=r;for(;w;){if(2===w.visibility){this.refilterDelayer.trigger((()=>this.refilter()));break}w=w.parent}}rerender(e){if(0===e.length)throw new Q$(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&&!iK(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:(iK(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})),!iK(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||zs.empty(),d=n&&0!==a&&!r.collapsed,h=zs.map(l,(e=>this.createTreeNode(e,r,a,d,o,s)));let c=0,u=1;for(const g of h)r.children.push(g),u+=g.renderNodeCount,g.visible&&(g.visibleChildIndex=c++);return r.collapsible=r.collapsible||r.children.length>0,r.visibleChildrenCount=c,r.visible=2===a?c>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):eK(i)?(e.filterData=i.data,tK(i.visibility)):(e.filterData=void 0,tK(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 Q$(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 Q$(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 Q$(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 oK,sK;class rK extends o${constructor(e){super(e.elements.map((e=>e.element))),this.data=e}}function aK(e){return e instanceof o$?new rK(e):e}class lK{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(aK(e),t)}onDragOver(e,t,i,n,o=!0){const s=this.dnd.onDragOver(aK(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=Fv((()=>{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),h=a.getListRenderCount(l);return Object.assign(Object.assign({},s),{feedback:Aa(d,d+h)})}drop(e,t,i,n){this.autoExpandDisposable.dispose(),this.autoExpandNode=void 0,this.dnd.drop(aK(e),t&&t.element,i,n)}onDragEnd(e){this.dnd.onDragEnd&&this.dnd.onDragEnd(e)}}class dK{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)}}(sK=oK||(oK={})).None="none",sK.OnHover="onHover",sK.Always="always";class hK{constructor(e,t=[]){this._elements=t,this.onDidChange=ds.forEach(e,(e=>this._elements=e))}get elements(){return this._elements}}class cK{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=cK.DefaultIndent,this.hideTwistiesOfChildlessElements=!1,this.shouldRenderIndentGuides=!1,this.renderedIndentGuides=new LS,this.activeIndentNodes=new Set,this.indentGuidesDisposable=Uo.None,this.disposables=new Cs,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=WV(e.indent,0,40)),void 0!==e.renderIndentGuides){const t=e.renderIndentGuides!==oK.None;if(t!==this.shouldRenderIndentGuides&&(this.shouldRenderIndentGuides=t,this.indentGuidesDisposable.dispose(),t)){const e=new Cs;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=Lw(e,Mw(".monaco-tl-row")),i=Lw(t,Mw(".monaco-tl-indent")),n=Lw(t,Mw(".monaco-tl-twistie")),o=Lw(t,Mw(".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=cK.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(RC(t.indent),t.indentGuidesDisposable.dispose(),!this.shouldRenderIndentGuides)return;const i=new Cs,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=Mw(".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(o){}})),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)}}cK.DefaultIndent=8;class uK{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 Cs,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:eK(i)?tK(i.visibility):i,0===n)return!1}if(this._totalCount++,this.tree.options.simpleKeyboardNavigation||!this._pattern)return this._matchCount++,{data:lz.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:lz.Default,visibility:!0};const t=hz(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:lz.Default,visibility:!0}}reset(){this._totalCount=0,this._matchCount=0}dispose(){bs(this.disposables)}}class gK{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 Cs,this.disposables=new Cs,this.domNode=Mw(`.monaco-list-type-filter.${this.positionClassName}`),this.domNode.draggable=!0,this.disposables.add(BC(this.domNode,"dragstart",(()=>this.onDragStart()))),this.messageDomNode=Lw(i.getHTMLElement(),Mw(".monaco-list-type-filter-message")),this.labelDomNode=Lw(this.domNode,Mw("span.label"));const s=Lw(this.domNode,Mw(".controls"));this._filterOnType=!!e.options.filterOnType,this.filterOnTypeDomNode=Lw(s,Mw("input.filter")),this.filterOnTypeDomNode.type="checkbox",this.filterOnTypeDomNode.checked=this._filterOnType,this.filterOnTypeDomNode.tabIndex=-1,this.updateFilterOnTypeTitleAndIcon(),this.disposables.add(BC(this.filterOnTypeDomNode,"input",(()=>this.onDidChangeFilterOnType()))),this.clearDomNode=Lw(s,Mw("button.clear"+br.treeFilterClear.cssSelector)),this.clearDomNode.tabIndex=-1,this.clearDomNode.title=$m(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 zF(this.view.getHTMLElement(),"keydown")),t=ds.chain(e.event).filter((e=>!_$(e.target)||e.target===this.filterOnTypeDomNode)).filter((e=>"Dead"!==e.key&&!/^Media/.test(e.key))).map((e=>new SC(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&&(Ho?e.altKey&&!e.metaKey:e.ctrlKey)&&!e.shiftKey)).forEach((e=>{e.stopPropagation(),e.preventDefault()})).event,i=this.enabledDisposables.add(new zF(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&&(Ho?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=>!lz.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}=nw(e),i=e.clientWidth,n=i/2,o=this.domNode.clientWidth,s=new Cs;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(BC(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(BC(this.domNode,"dragend",(()=>l()))),iB.CurrentDragAndDropData=new tB("vscode-ui"),s.add(es((()=>iB.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=$m(0,"Disable Filter on Type")):(this.filterOnTypeDomNode.classList.remove(...br.treeFilterOnTypeOn.classNamesArray),this.filterOnTypeDomNode.classList.add(...br.treeFilterOnTypeOff.classNamesArray),this.filterOnTypeDomNode.title=$m(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=$m(0,"No elements found"),this._empty=!0):(this.messageDomNode.innerText="",this._empty=!1),this.domNode.classList.toggle("no-matches",e),this.domNode.title=$m(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||!lz.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 pK(e){let t=q$.Unknown;return cw(e.browserEvent.target,"monaco-tl-twistie","monaco-tl-row")?t=q$.Twistie:cw(e.browserEvent.target,"monaco-tl-contents","monaco-tl-row")&&(t=q$.Element),{browserEvent:e.browserEvent,element:e.element?e.element.element:null,target:t}}function mK(e,t){t(e),e.children.forEach((e=>mK(e,t)))}class fK{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=>mK(e,i))),void this.set([...e.values()])}const i=new Set,n=e=>i.add(this.identityProvider.getId(e.element).toString());t.forEach((e=>mK(e,n)));const o=new Map,s=e=>o.set(this.identityProvider.getId(e.element).toString(),e);e.forEach((e=>mK(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 _K extends L${constructor(e,t){super(e),this.tree=t}onViewPointer(e){if(_$(e.browserEvent.target)||v$(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 vK extends R${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 _K(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 bK{constructor(e,t,i,n,o={}){this._user=e,this._options=o,this.eventBufferer=new Ba,this.disposables=new Cs,this._onWillRefilter=new $o,this.onWillRefilter=this._onWillRefilter.event,this._onDidUpdateOptions=new $o;const s=new dK(i),r=new Ua,a=new Ua,l=new hK(a.event);this.renderers=n.map((e=>new cK(e,(()=>this.model),r.event,l,o)));for(let g of this.renderers)this.disposables.add(g);let d;var h,c;o.keyboardNavigationLabelProvider&&(d=new uK(this,o.keyboardNavigationLabelProvider,o.filter),o=Object.assign(Object.assign({},o),{filter:d}),this.disposables.add(d)),this.focus=new fK((()=>this.view.getFocusedElements()[0]),o.identityProvider),this.selection=new fK((()=>this.view.getSelectedElements()[0]),o.identityProvider),this.anchor=new fK((()=>this.view.getAnchorElement()),o.identityProvider),this.view=new vK(e,t,s,this.renderers,this.focus,this.selection,this.anchor,Object.assign(Object.assign({},(h=()=>this.model,(c=o)&&Object.assign(Object.assign({},c),{identityProvider:c.identityProvider&&{getId:e=>c.identityProvider.getId(e.element)},dnd:c.dnd&&new lK(h,c.dnd),multipleSelectionController:c.multipleSelectionController&&{isSelectionSingleChangeEvent:e=>c.multipleSelectionController.isSelectionSingleChangeEvent(Object.assign(Object.assign({},e),{element:e.element})),isSelectionRangeChangeEvent:e=>c.multipleSelectionController.isSelectionRangeChangeEvent(Object.assign(Object.assign({},e),{element:e.element}))},accessibilityProvider:c.accessibilityProvider&&Object.assign(Object.assign({},c.accessibilityProvider),{getSetSize(e){const t=h(),i=t.getNodeLocation(e),n=t.getParentNodeLocation(i);return t.getNode(n).visibleChildrenCount},getPosInSet:e=>e.visibleChildIndex+1,isChecked:c.accessibilityProvider&&c.accessibilityProvider.isChecked?e=>c.accessibilityProvider.isChecked(e.element):void 0,getRole:c.accessibilityProvider&&c.accessibilityProvider.getRole?e=>c.accessibilityProvider.getRole(e.element):()=>"treeitem",getAriaLabel:e=>c.accessibilityProvider.getAriaLabel(e.element),getWidgetAriaLabel:()=>c.accessibilityProvider.getWidgetAriaLabel(),getWidgetRole:c.accessibilityProvider&&c.accessibilityProvider.getWidgetRole?()=>c.accessibilityProvider.getWidgetRole():()=>"tree",getAriaLevel:c.accessibilityProvider&&c.accessibilityProvider.getAriaLevel?e=>c.accessibilityProvider.getAriaLevel(e.element):e=>e.depth,getActiveDescendantId:c.accessibilityProvider.getActiveDescendantId&&(e=>c.accessibilityProvider.getActiveDescendantId(e.element))}),keyboardNavigationLabelProvider:c.keyboardNavigationLabelProvider&&Object.assign(Object.assign({},c.keyboardNavigationLabelProvider),{getKeyboardNavigationLabel:e=>c.keyboardNavigationLabelProvider.getKeyboardNavigationLabel(e.element)}),enableKeyboardNavigation:c.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=>!_$(e.target))).map((e=>new SC(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||C$;this.typeFilterController=new gK(this,this.model,this.view,d,e),this.focusNavigationFilter=e=>this.typeFilterController.shouldAllowFocus(e),this.disposables.add(this.typeFilterController)}this.styleElement=fw(this.view.getHTMLElement()),this.getHTMLElement().classList.toggle("always",this._options.renderIndentGuides===oK.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,pK)}get onPointer(){return ds.map(this.view.onPointer,pK)}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===oK.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 CK{constructor(e,t,i={}){this.user=e,this.rootRef=null,this.nodes=new Map,this.nodesByIdentity=new Map,this.model=new nK(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=zs.empty(),i={}){const n=this.getElementLocation(e);this._setChildren(n,this.preserveCollapseState(t),i)}_setChildren(e,t=zs.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=zs.empty()){return this.sorter&&(e=[...e].sort(this.sorter.compare.bind(this.sorter))),zs.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 Q$(this.user,`Tree element not found: ${e}`);return t}getNodeLocation(e){return e.element}getParentNodeLocation(e){if(null===e)throw new Q$(this.user,"Invalid getParentNodeLocation call");const t=this.nodes.get(e);if(!t)throw new Q$(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 Q$(this.user,`Tree element not found: ${e}`);return this.model.getNodeLocation(t)}}function wK(e){return{element:{elements:[e.element],incompressible:e.incompressible||!1},children:zs.map(zs.from(e.children),wK),collapsible:e.collapsible,collapsed:e.collapsed}}function yK(e){const t=[e.element],i=e.incompressible||!1;let n,o;for(;[o,n]=zs.consume(zs.from(e.children),2),1===o.length&&!o[0].incompressible;)e=o[0],t.push(e.element);return{element:{elements:t,incompressible:i},children:zs.map(zs.concat(o,n),yK),collapsible:e.collapsible,collapsed:e.collapsed}}function SK(e,t=0){let i;return i=t<e.element.elements.length-1?[SK(e,t+1)]:zs.map(zs.from(e.children),(e=>SK(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 xK(e){return SK(e,0)}function kK(e,t,i){return e.element===t?Object.assign(Object.assign({},e),{children:i}):Object.assign(Object.assign({},e),{children:zs.map(zs.from(e.children),(e=>kK(e,t,i)))})}class LK{constructor(e,t,i={}){this.user=e,this.rootRef=null,this.nodes=new Map,this.model=new CK(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=zs.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=zs.map(t,this.enabled?yK:wK);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=kK(xK(r),e,t),h=(this.enabled?yK:wK)(d),c=l.children.map((e=>e===r?h:e));this._setChildren(l.element,c,{diffIdentityProvider:n,diffDepth:r.depth-l.depth})}setCompressionEnabled(e){if(e===this.enabled)return;this.enabled=e;const t=this.model.getNode().children,i=zs.map(t,xK),n=zs.map(i,e?yK:wK);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 Q$(this.user,`Tree element not found: ${e}`);return t}}const DK=e=>e[e.length-1];class EK{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 EK(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 NK{constructor(e,t,i={}){this.rootRef=null,this.elementMapper=i.elementMapper||DK;const n=e=>this.elementMapper(e.elements);this.nodeMapper=new J$((e=>new EK(n,e))),this.model=new LK(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=zs.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 IK=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 TK extends bK{constructor(e,t,i,n,o={}){super(e,t,i,n,o),this.user=e}get onDidChangeCollapseState(){return this.model.onDidChangeCollapseState}setChildren(e,t=zs.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 CK(e,t,i)}}class MK{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)}}IK([VS],MK.prototype,"compressedTreeNodeProvider",null);class OK extends TK{constructor(e,t,i,n,o={}){const s=()=>this;super(e,t,i,n.map((e=>new MK(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(o){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=zs.empty(),i){this.model.setChildren(e,t,i)}createModel(e,t,i){return new NK(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 AK=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 RK(e){return Object.assign(Object.assign({},e),{children:[],refreshPromise:void 0,stale:!0,slow:!1,collapsedByDefault:void 0})}function PK(e,t){return!!t.parent&&(t.parent===e||PK(e,t.parent))}class FK{constructor(e){this.node=e}get element(){return this.node.element.element}get children(){return this.node.children.map((e=>new FK(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.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 VK(e){return{browserEvent:e.browserEvent,elements:e.elements.map((e=>e.element))}}function WK(e){return{browserEvent:e.browserEvent,element:e.element&&e.element.element,target:e.target}}class HK extends o${constructor(e){super(e.elements.map((e=>e.element))),this.data=e}}function zK(e){return e instanceof o$?new HK(e):e}class jK{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(zK(e),t)}onDragOver(e,t,i,n,o=!0){return this.dnd.onDragOver(zK(e),t&&t.element,i,n)}drop(e,t,i,n){this.dnd.drop(zK(e),t&&t.element,i,n)}onDragEnd(e){this.dnd.onDragEnd&&this.dnd.onDragEnd(e)}}function UK(e){return e&&Object.assign(Object.assign({},e),{collapseByDefault:!0,identityProvider:e.identityProvider&&{getId:t=>e.identityProvider.getId(t.element)},dnd:e.dnd&&new jK(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 $K(e,t){t(e),e.children.forEach((e=>$K(e,t)))}class KK{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 J$((e=>new FK(e))),this.disposables=new Cs,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=RK({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,VK)}get onDidChangeSelection(){return ds.map(this.tree.onDidChangeSelection,VK)}get onMouseDblClick(){return ds.map(this.tree.onMouseDblClick,WK)}get onPointer(){return ds.map(this.tree.onPointer,WK)}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 dK(i),r=n.map((e=>new BK(e,this.nodeMapper,this._onDidChangeNodeSlowState.event))),a=UK(o)||{};return new TK(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 AK(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 AK(this,void 0,void 0,(function*(){if(void 0===this.root.element)throw new Q$(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(r){}}))}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 AK(this,void 0,void 0,(function*(){if(void 0===this.root.element)throw new Q$(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 Q$(this.user,`Data tree node not found: ${e}`);return t}refreshAndRenderNode(e,t,i,n){return AK(this,void 0,void 0,(function*(){yield this.refreshNode(e,t,i),this.render(e,i,n)}))}refreshNode(e,t,i){return AK(this,void 0,void 0,(function*(){let n;return this.subTreeRefreshPromises.forEach(((o,s)=>{!n&&function(e,t){return e===t||PK(e,t)||PK(t,e)}(s,e)&&(n=o.then((()=>this.refreshNode(e,t,i))))})),n||this.doRefreshSubTree(e,t,i)}))}doRefreshSubTree(e,t,i){return AK(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 $v.settled(o.map((e=>this.doRefreshSubTree(e,t,i))))}finally{n()}}))}doRefreshNode(e,t,i){return AK(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=Pv(800);i.then((()=>{e.slow=!0,this._onDidChangeNodeSlowState.fire(e)}),(e=>null)),n=t.finally((()=>i.cancel()))}}else n=Promise.resolve(zs.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),Na(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=Iv((()=>AK(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=RK({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=>$K(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 h=RK({element:t,parent:e,id:l,hasChildren:o});return n&&n.viewState.focus&&n.viewState.focus.indexOf(l)>-1&&n.focus.push(h),n&&n.viewState.selection&&n.viewState.selection.indexOf(l)>-1&&n.selection.push(h),n&&n.viewState.expanded&&n.viewState.expanded.indexOf(l)>-1?a.push(h):o&&this.collapseByDefault&&!this.collapseByDefault(t)&&(h.collapsedByDefault=!1,a.push(h)),h}));for(const d of s.values())$K(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?zs.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 qK{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 qK(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 GK{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 ZK extends KK{constructor(e,t,i,n,o,s,r={}){super(e,t,i,o,s,r),this.compressionDelegate=n,this.compressibleNodeMapper=new J$((e=>new qK(e))),this.filter=r.filter}createTree(e,t,i,n,o){const s=new dK(i),r=n.map((e=>new GK(e,this.nodeMapper,(()=>this.compressibleNodeMapper),this._onDidChangeNodeSlowState.event))),a=function(e){const t=e&&UK(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 OK(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 h=e=>{const t=e.element;if(t)for(let n=0;n<t.elements.length;n++){const e=i(t.elements[n].element),h=t.elements[t.elements.length-1].element;o.has(e)&&-1===r.indexOf(h)&&(r.push(h),a=!0),s.has(e)&&-1===l.indexOf(h)&&(l.push(h),d=!0)}e.children.forEach(h)};h(this.tree.getCompressedTreeNode(e===this.root?null:e)),a&&this.setSelection(r),d&&this.setFocus(l)}processChildren(e){return this.filter&&(e=zs.filter(e,(e=>{const t=this.filter.filter(e,1),i="boolean"==typeof(n=t)?n?1:0:eK(n)?tK(n.visibility):tK(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 YK extends bK{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 CK(e,t,i)}}new Ly("isMac",Ho,$m(0,"Whether the operating system is macOS")),new Ly("isLinux",Vo,$m(0,"Whether the operating system is Linux"));const XK=new Ly("isWindows",Rs,$m(0,"Whether the operating system is Windows"));new Ly("isWeb",Fs,$m(0,"Whether the platform is a web browser")),new Ly("isMacNative",Ho&&!Fs,$m(0,"Whether the operating system is macOS on a non-browser platform")),new Ly("isIOS",Vs,$m(0,"Whether the operating system is iOS")),new Ly("isDevelopment",!1,!0);new Ly("inputFocus",!1,$m(0,"Whether keyboard focus is inside an input box"));var QK=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},JK=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};const eq=s_("listService");let tq=class{constructor(e){this._themeService=e,this.disposables=new Cs,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 D$(fw(),"");this.disposables.add(Mz(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()}};tq=QK([JK(0,Ry)],tq);const iq=new Ly("listFocus",!0),nq=new Ly("listSupportsMultiselect",!0),oq=ry.and(iq,ry.not("inputFocus")),sq=new Ly("listHasSelectionOrFocus",!1),rq=new Ly("listDoubleSelection",!1),aq=new Ly("listMultiSelection",!1),lq=new Ly("listSelectionNavigation",!1),dq=new Ly("treeElementCanCollapse",!1),hq=new Ly("treeElementHasParent",!1),cq=new Ly("treeElementCanExpand",!1),uq=new Ly("treeElementHasChild",!1);function gq(e,t){const i=e.createScoped(t.getHTMLElement());return iq.bindTo(i),i}const pq="workbench.list.horizontalScrolling",mq="workbench.tree.indent",fq="workbench.list.smoothScrolling",_q="workbench.list.mouseWheelScrollSensitivity",vq="workbench.list.fastScrollSensitivity",bq="workbench.tree.expandMode";function Cq(e){return"alt"===e.getValue("workbench.list.multiSelectModifier")}class wq extends Uo{constructor(e){super(),this.configurationService=e,this.useAltAsMultipleSelectionModifier=Cq(e),this.registerListeners()}registerListeners(){this._register(this.configurationService.onDidChangeConfiguration((e=>{e.affectsConfiguration("workbench.list.multiSelectModifier")&&(this.useAltAsMultipleSelectionModifier=Cq(this.configurationService))})))}isSelectionSingleChangeEvent(e){return this.useAltAsMultipleSelectionModifier?e.browserEvent.altKey:S$(e)}isSelectionRangeChangeEvent(e){return x$(e)}}function yq(e,t,i){var n;const o=new Cs;return[Object.assign(Object.assign({},e),{keyboardNavigationDelegate:{mightProducePrintableCharacter:e=>i.mightProducePrintableCharacter(e)},smoothScrolling:Boolean(t.getValue(fq)),mouseWheelScrollSensitivity:t.getValue(_q),fastScrollSensitivity:t.getValue(vq),multipleSelectionController:null!==(n=e.multipleSelectionController)&&void 0!==n?n:o.add(new wq(t))}),o]}let Sq=class extends R${constructor(e,t,i,n,o,s,r,a,l,d){const h=void 0!==o.horizontalScrolling?o.horizontalScrolling:Boolean(l.getValue(pq)),[c,u]=yq(o,l,d);super(e,t,i,n,Object.assign(Object.assign(Object.assign({keyboardSupport:!1},Iz(a.getColorTheme(),Oz)),c),{horizontalScrolling:h})),this.disposables.add(u),this.contextKeyService=gq(s,this),this.themeService=a,this.listSupportsMultiSelect=nq.bindTo(this.contextKeyService),this.listSupportsMultiSelect.set(!1!==o.multipleSelectionSupport);lq.bindTo(this.contextKeyService).set(Boolean(o.selectionNavigation)),this.listHasSelectionOrFocus=sq.bindTo(this.contextKeyService),this.listDoubleSelection=rq.bindTo(this.contextKeyService),this.listMultiSelection=aq.bindTo(this.contextKeyService),this.horizontalScrolling=o.horizontalScrolling,this._useAltAsMultipleSelectionModifier=Cq(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("workbench.list.multiSelectModifier")&&(this._useAltAsMultipleSelectionModifier=Cq(l));let t={};if(e.affectsConfiguration(pq)&&void 0===this.horizontalScrolling){const e=Boolean(l.getValue(pq));t=Object.assign(Object.assign({},t),{horizontalScrolling:e})}if(e.affectsConfiguration(fq)){const e=Boolean(l.getValue(fq));t=Object.assign(Object.assign({},t),{smoothScrolling:e})}if(e.affectsConfiguration(_q)){const e=l.getValue(_q);t=Object.assign(Object.assign({},t),{mouseWheelScrollSensitivity:e})}if(e.affectsConfiguration(vq)){const e=l.getValue(vq);t=Object.assign(Object.assign({},t),{fastScrollSensitivity:e})}Object.keys(t).length>0&&this.updateOptions(t)}))),this.navigator=new Dq(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=Mz(this,this.themeService,e)}dispose(){var e;null===(e=this._styler)||void 0===e||e.dispose(),super.dispose()}};Sq=QK([JK(5,Dy),JK(6,eq),JK(7,Ry),JK(8,ev),JK(9,uW)],Sq);let xq=class extends class{constructor(e,t,i,n,o={}){const s=()=>this.model,r=n.map((e=>new P$(e,s)));this.list=new R$(e,t,i,r,function(e,t){return Object.assign(Object.assign({},t),{accessibilityProvider:t.accessibilityProvider&&new F$(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,Aa(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 h=void 0!==o.horizontalScrolling?o.horizontalScrolling:Boolean(l.getValue(pq)),[c,u]=yq(o,l,d);super(e,t,i,n,Object.assign(Object.assign(Object.assign({keyboardSupport:!1},Iz(a.getColorTheme(),Oz)),c),{horizontalScrolling:h})),this.disposables=new Cs,this.disposables.add(u),this.contextKeyService=gq(s,this),this.themeService=a,this.horizontalScrolling=o.horizontalScrolling,this.listSupportsMultiSelect=nq.bindTo(this.contextKeyService),this.listSupportsMultiSelect.set(!1!==o.multipleSelectionSupport);lq.bindTo(this.contextKeyService).set(Boolean(o.selectionNavigation)),this._useAltAsMultipleSelectionModifier=Cq(l),this.disposables.add(this.contextKeyService),this.disposables.add(r.register(this)),o.overrideStyles&&this.updateStyles(o.overrideStyles),o.overrideStyles&&this.disposables.add(Mz(this,a,o.overrideStyles)),this.disposables.add(l.onDidChangeConfiguration((e=>{e.affectsConfiguration("workbench.list.multiSelectModifier")&&(this._useAltAsMultipleSelectionModifier=Cq(l));let t={};if(e.affectsConfiguration(pq)&&void 0===this.horizontalScrolling){const e=Boolean(l.getValue(pq));t=Object.assign(Object.assign({},t),{horizontalScrolling:e})}if(e.affectsConfiguration(fq)){const e=Boolean(l.getValue(fq));t=Object.assign(Object.assign({},t),{smoothScrolling:e})}if(e.affectsConfiguration(_q)){const e=l.getValue(_q);t=Object.assign(Object.assign({},t),{mouseWheelScrollSensitivity:e})}if(e.affectsConfiguration(vq)){const e=l.getValue(vq);t=Object.assign(Object.assign({},t),{fastScrollSensitivity:e})}Object.keys(t).length>0&&this.updateOptions(t)}))),this.navigator=new Dq(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=Mz(this,this.themeService,e)}dispose(){var e;null===(e=this._styler)||void 0===e||e.dispose(),this.disposables.dispose(),super.dispose()}};xq=QK([JK(5,Dy),JK(6,eq),JK(7,Ry),JK(8,ev),JK(9,uW)],xq);let kq=class extends X${constructor(e,t,i,n,o,s,r,a,l,d,h){const c=void 0!==s.horizontalScrolling?s.horizontalScrolling:Boolean(d.getValue(pq)),[u,g]=yq(s,d,h);super(e,t,i,n,o,Object.assign(Object.assign(Object.assign({keyboardSupport:!1},Iz(l.getColorTheme(),Oz)),u),{horizontalScrolling:c})),this.disposables.add(g),this.contextKeyService=gq(r,this),this.themeService=l,this.listSupportsMultiSelect=nq.bindTo(this.contextKeyService),this.listSupportsMultiSelect.set(!1!==s.multipleSelectionSupport);lq.bindTo(this.contextKeyService).set(Boolean(s.selectionNavigation)),this.listHasSelectionOrFocus=sq.bindTo(this.contextKeyService),this.listDoubleSelection=rq.bindTo(this.contextKeyService),this.listMultiSelection=aq.bindTo(this.contextKeyService),this.horizontalScrolling=s.horizontalScrolling,this._useAltAsMultipleSelectionModifier=Cq(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("workbench.list.multiSelectModifier")&&(this._useAltAsMultipleSelectionModifier=Cq(d));let t={};if(e.affectsConfiguration(pq)&&void 0===this.horizontalScrolling){const e=Boolean(d.getValue(pq));t=Object.assign(Object.assign({},t),{horizontalScrolling:e})}if(e.affectsConfiguration(fq)){const e=Boolean(d.getValue(fq));t=Object.assign(Object.assign({},t),{smoothScrolling:e})}if(e.affectsConfiguration(_q)){const e=d.getValue(_q);t=Object.assign(Object.assign({},t),{mouseWheelScrollSensitivity:e})}if(e.affectsConfiguration(vq)){const e=d.getValue(vq);t=Object.assign(Object.assign({},t),{fastScrollSensitivity:e})}Object.keys(t).length>0&&this.updateOptions(t)}))),this.navigator=new Eq(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=Mz(this,this.themeService,e)}dispose(){var e;null===(e=this._styler)||void 0===e||e.dispose(),this.disposables.dispose(),super.dispose()}};kq=QK([JK(6,Dy),JK(7,eq),JK(8,Ry),JK(9,ev),JK(10,uW)],kq);class Lq 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("workbench.list.openMode")),this._register(null==t?void 0:t.configurationService.onDidChangeConfiguration((()=>{this.openOnSingleClick="doubleClick"!==(null==t?void 0:t.configurationService.getValue("workbench.list.openMode"))})))):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 Dq extends Lq{constructor(e,t){super(e,t),this.widget=e}getSelectedElement(){return this.widget.getSelectedElements()[0]}}class Eq extends Lq{constructor(e,t){super(e,t)}getSelectedElement(){return this.widget.getSelectedElements()[0]}}class Nq extends Lq{constructor(e,t){super(e,t)}getSelectedElement(){var e;return null!==(e=this.widget.getSelection()[0])&&void 0!==e?e:void 0}}function Iq(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 Tq=class extends TK{constructor(e,t,i,n,o,s,r,a,l,d,h){const{options:c,getAutomaticKeyboardNavigation:u,disposable:g}=Pq(t,o,s,l,d,h);super(e,t,i,n,c),this.disposables.add(g),this.internals=new Fq(this,o,u,o.overrideStyles,s,r,a,l,h),this.disposables.add(this.internals)}updateOptions(e){super.updateOptions(e),this.internals.updateOptions(e)}};Tq=QK([JK(5,Dy),JK(6,eq),JK(7,Ry),JK(8,ev),JK(9,uW),JK(10,NS)],Tq);let Mq=class extends OK{constructor(e,t,i,n,o,s,r,a,l,d,h){const{options:c,getAutomaticKeyboardNavigation:u,disposable:g}=Pq(t,o,s,l,d,h);super(e,t,i,n,c),this.disposables.add(g),this.internals=new Fq(this,o,u,o.overrideStyles,s,r,a,l,h),this.disposables.add(this.internals)}updateOptions(e={}){super.updateOptions(e),e.overrideStyles&&this.internals.updateStyleOverrides(e.overrideStyles),this.internals.updateOptions(e)}};Mq=QK([JK(5,Dy),JK(6,eq),JK(7,Ry),JK(8,ev),JK(9,uW),JK(10,NS)],Mq);let Oq=class extends YK{constructor(e,t,i,n,o,s,r,a,l,d,h,c){const{options:u,getAutomaticKeyboardNavigation:g,disposable:p}=Pq(t,s,r,d,h,c);super(e,t,i,n,o,u),this.disposables.add(p),this.internals=new Fq(this,s,g,s.overrideStyles,r,a,l,d,c),this.disposables.add(this.internals)}updateOptions(e={}){super.updateOptions(e),e.overrideStyles&&this.internals.updateStyleOverrides(e.overrideStyles),this.internals.updateOptions(e)}};Oq=QK([JK(6,Dy),JK(7,eq),JK(8,Ry),JK(9,ev),JK(10,uW),JK(11,NS)],Oq);let Aq=class extends KK{constructor(e,t,i,n,o,s,r,a,l,d,h,c){const{options:u,getAutomaticKeyboardNavigation:g,disposable:p}=Pq(t,s,r,d,h,c);super(e,t,i,n,o,u),this.disposables.add(p),this.internals=new Fq(this,s,g,s.overrideStyles,r,a,l,d,c),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)}};Aq=QK([JK(6,Dy),JK(7,eq),JK(8,Ry),JK(9,ev),JK(10,uW),JK(11,NS)],Aq);let Rq=class extends ZK{constructor(e,t,i,n,o,s,r,a,l,d,h,c,u){const{options:g,getAutomaticKeyboardNavigation:p,disposable:m}=Pq(t,r,a,h,c,u);super(e,t,i,n,o,s,g),this.disposables.add(m),this.internals=new Fq(this,r,p,r.overrideStyles,a,l,d,h,u),this.disposables.add(this.internals)}updateOptions(e){super.updateOptions(e),this.internals.updateOptions(e)}};function Pq(e,t,i,n,o,s){var r;const a=()=>{let e=Boolean(i.getContextKeyValue("listAutomaticKeyboardNavigation"));return e&&(e=Boolean(n.getValue("workbench.list.automaticKeyboardNavigation"))),e},l=s.isScreenReaderOptimized(),d=t.simpleKeyboardNavigation||l?"simple":n.getValue("workbench.list.keyboardNavigation"),h=void 0!==t.horizontalScrolling?t.horizontalScrolling:Boolean(n.getValue(pq)),[c,u]=yq(t,n,o),g=t.additionalScrollHeight;return{getAutomaticKeyboardNavigation:a,disposable:u,options:Object.assign(Object.assign({keyboardSupport:!1},c),{indent:"number"==typeof n.getValue(mq)?n.getValue(mq):void 0,renderIndentGuides:n.getValue("workbench.tree.renderIndentGuides"),smoothScrolling:Boolean(n.getValue(fq)),automaticKeyboardNavigation:a(),simpleKeyboardNavigation:"simple"===d,filterOnType:"filter"===d,horizontalScrolling:h,keyboardNavigationEventFilter:Iq(e,o),additionalScrollHeight:g,hideTwistiesOfChildlessElements:t.hideTwistiesOfChildlessElements,expandOnlyOnTwistieClick:null!==(r=t.expandOnlyOnTwistieClick)&&void 0!==r?r:"doubleClick"===n.getValue(bq)})}}Rq=QK([JK(7,Dy),JK(8,eq),JK(9,Ry),JK(10,ev),JK(11,uW),JK(12,NS)],Rq);let Fq=class{constructor(e,t,i,n,o,s,r,a,l){this.tree=e,this.themeService=r,this.disposables=[],this.contextKeyService=gq(o,e),this.listSupportsMultiSelect=nq.bindTo(this.contextKeyService),this.listSupportsMultiSelect.set(!1!==t.multipleSelectionSupport);lq.bindTo(this.contextKeyService).set(Boolean(t.selectionNavigation)),this.hasSelectionOrFocus=sq.bindTo(this.contextKeyService),this.hasDoubleSelection=rq.bindTo(this.contextKeyService),this.hasMultiSelection=aq.bindTo(this.contextKeyService),this.treeElementCanCollapse=dq.bindTo(this.contextKeyService),this.treeElementHasParent=hq.bindTo(this.contextKeyService),this.treeElementCanExpand=cq.bindTo(this.contextKeyService),this.treeElementHasChild=uq.bindTo(this.contextKeyService),this._useAltAsMultipleSelectionModifier=Cq(a);const d=new Set;d.add("listAutomaticKeyboardNavigation");const h=()=>{const t=l.isScreenReaderOptimized()?"simple":a.getValue("workbench.list.keyboardNavigation");e.updateOptions({simpleKeyboardNavigation:"simple"===t,filterOnType:"filter"===t})};this.updateStyleOverrides(n);const c=()=>{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),c()})),e.onDidChangeCollapseState(c),e.onDidChangeModel(c),a.onDidChangeConfiguration((n=>{let o={};if(n.affectsConfiguration("workbench.list.multiSelectModifier")&&(this._useAltAsMultipleSelectionModifier=Cq(a)),n.affectsConfiguration(mq)){const e=a.getValue(mq);o=Object.assign(Object.assign({},o),{indent:e})}if(n.affectsConfiguration("workbench.tree.renderIndentGuides")){const e=a.getValue("workbench.tree.renderIndentGuides");o=Object.assign(Object.assign({},o),{renderIndentGuides:e})}if(n.affectsConfiguration(fq)){const e=Boolean(a.getValue(fq));o=Object.assign(Object.assign({},o),{smoothScrolling:e})}if(n.affectsConfiguration("workbench.list.keyboardNavigation")&&h(),n.affectsConfiguration("workbench.list.automaticKeyboardNavigation")&&(o=Object.assign(Object.assign({},o),{automaticKeyboardNavigation:i()})),n.affectsConfiguration(pq)&&void 0===t.horizontalScrolling){const e=Boolean(a.getValue(pq));o=Object.assign(Object.assign({},o),{horizontalScrolling:e})}if(n.affectsConfiguration(bq)&&void 0===t.expandOnlyOnTwistieClick&&(o=Object.assign(Object.assign({},o),{expandOnlyOnTwistieClick:"doubleClick"===a.getValue(bq)})),n.affectsConfiguration(_q)){const e=a.getValue(_q);o=Object.assign(Object.assign({},o),{mouseWheelScrollSensitivity:e})}if(n.affectsConfiguration(vq)){const e=a.getValue(vq);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((()=>h()))),this.navigator=new Nq(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?Mz(this.tree,this.themeService,e):Uo.None}dispose(){this.disposables=bs(this.disposables),bs(this.styler),this.styler=void 0}};Fq=QK([JK(4,Dy),JK(5,eq),JK(6,Ry),JK(7,ev),JK(8,NS)],Fq);var Bq,Vq;My.as(eO).registerConfiguration({id:"workbench",order:7,title:$m(0,"Workbench"),type:"object",properties:{"workbench.list.multiSelectModifier":{type:"string",enum:["ctrlCmd","alt"],enumDescriptions:[$m(0,"Maps to `Control` on Windows and Linux and to `Command` on macOS."),$m(0,"Maps to `Alt` on Windows and Linux and to `Option` on macOS.")],default:"ctrlCmd",description:$m(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.")},"workbench.list.openMode":{type:"string",enum:["singleClick","doubleClick"],default:"singleClick",description:$m(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.")},[pq]:{type:"boolean",default:!1,description:$m(0,"Controls whether lists and trees support horizontal scrolling in the workbench. Warning: turning on this setting has a performance implication.")},[mq]:{type:"number",default:8,minimum:4,maximum:40,description:$m(0,"Controls tree indentation in pixels.")},"workbench.tree.renderIndentGuides":{type:"string",enum:["none","onHover","always"],default:"onHover",description:$m(0,"Controls whether the tree should render indent guides.")},[fq]:{type:"boolean",default:!1,description:$m(0,"Controls whether lists and trees have smooth scrolling.")},[_q]:{type:"number",default:1,description:$m(0,"A multiplier to be used on the `deltaX` and `deltaY` of mouse wheel scroll events.")},[vq]:{type:"number",default:5,description:$m(0,"Scrolling speed multiplier when pressing `Alt`.")},"workbench.list.keyboardNavigation":{type:"string",enum:["simple","highlight","filter"],enumDescriptions:[$m(0,"Simple keyboard navigation focuses elements which match the keyboard input. Matching is done only on prefixes."),$m(0,"Highlight keyboard navigation highlights elements which match the keyboard input. Further up and down navigation will traverse only the highlighted elements."),$m(0,"Filter keyboard navigation will filter out and hide all the elements which do not match the keyboard input.")],default:"highlight",description:$m(0,"Controls the keyboard navigation style for lists and trees in the workbench. Can be simple, highlight and filter.")},"workbench.list.automaticKeyboardNavigation":{type:"boolean",default:!0,markdownDescription:$m(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.")},[bq]:{type:"string",enum:["singleClick","doubleClick"],default:"singleClick",description:$m(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.")}}}),(Vq=Bq||(Bq={}))[Vq.PRESERVE=0]="PRESERVE",Vq[Vq.LAST=1]="LAST";const Wq="workbench.contributions.quickaccess";My.add(Wq,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 xa([this.defaultProvider,...this.providers])}getQuickAccessProvider(e){return e&&this.providers.find((t=>e.startsWith(t.prefix)))||void 0||this.defaultProvider}});const Hq=s_("quickInputService");var zq=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},jq=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};let Uq=class extends Uo{constructor(e,t){super(),this.quickInputService=e,this.instantiationService=t,this.registry=My.as(Wq),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===Bq.LAST?t=this.lastAcceptedPickerValues.get(s):"string"==typeof e&&(t=`${s.prefix}${e}`)}"string"==typeof t&&(e=t)}const l=new Cs,d=l.add(this.quickInputService.createQuickPick());let h;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:nU.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&&(h=new Uv,l.add(kr(d.onWillAccept)((e=>{e.veto(),d.hide()})))),l.add(this.registerPickerListeners(d,o,s,e));const c=l.add(new as);return o&&l.add(o.provide(d,c.token)),kr(d.onDidHide)((()=>{0===d.selectedItems.length&&c.cancel(),l.dispose(),null==h||h.complete(d.selectedItems.slice(0))})),d.show(),t?null==h?void 0:h.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 Cs,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]}};Uq=zq([jq(0,Hq),jq(1,n_)],Uq);var $q=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},Kq=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};let qq=class extends jy{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(Uq))),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(Sq,e,t,i,n,o),styles:this.computeStyles()},s=this._register(new ZU(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 Ly(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({},Iz(this.theme,{quickInputBackground:ak,quickInputForeground:lk,quickInputTitleBackground:dk,contrastBorder:dx,widgetShadow:px})),inputBox:Iz(this.theme,{inputForeground:fx,inputBackground:mx,inputBorder:_x,inputValidationInfoBackground:wx,inputValidationInfoForeground:yx,inputValidationInfoBorder:Sx,inputValidationWarningBackground:xx,inputValidationWarningForeground:kx,inputValidationWarningBorder:Lx,inputValidationErrorBackground:Dx,inputValidationErrorForeground:Ex,inputValidationErrorBorder:Nx}),countBadge:Iz(this.theme,{badgeBackground:Fx,badgeForeground:Bx,badgeBorder:dx}),button:Iz(this.theme,{buttonForeground:Ox,buttonBackground:Ax,buttonHoverBackground:Rx,buttonBorder:dx}),progressBar:Iz(this.theme,{progressBarBackground:jx}),keybindingLabel:Iz(this.theme,{keybindingLabelBackground:uk,keybindingLabelForeground:gk,keybindingLabelBorder:pk,keybindingLabelBottomBorder:mk,keybindingLabelShadow:px}),list:Iz(this.theme,{listBackground:ak,listInactiveFocusForeground:DL,listInactiveSelectionIconForeground:EL,listInactiveFocusBackground:NL,listFocusOutline:hx,listInactiveFocusOutline:hx,pickerGroupBorder:ck,pickerGroupForeground:hk})}}};qq=$q([Kq(0,n_),Kq(1,Dy),Kq(2,Ry),Kq(3,NS),Kq(4,lV)],qq);var Gq=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},Zq=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};let Yq=class extends qq{constructor(e,t,i,n,o,s){super(t,i,n,o,new uV(e.getContainerDomNode(),s)),this.host=void 0;const r=Qq.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)}};Yq=Gq([Zq(1,n_),Zq(2,Dy),Zq(3,Ry),Zq(4,NS),Zq(5,r_)],Yq);let Xq=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(Yq,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()}};Xq=Gq([Zq(0,n_),Zq(1,r_)],Xq);class Qq{constructor(e){this.editor=e,this.widget=new Jq(this.editor)}static get(e){return e.getContribution(Qq.ID)}dispose(){this.widget.dispose()}}Qq.ID="editor.controller.quickInput";class Jq{constructor(e){this.codeEditor=e,this.domNode=document.createElement("div"),this.codeEditor.addOverlayWidget(this)}getId(){return Jq.ID}getDomNode(){return this.domNode}getPosition(){return{preference:2}}dispose(){this.codeEditor.removeOverlayWidget(this)}}Jq.ID="editor.contrib.quickInputWidget",gS(Qq.ID,Qq);class eG{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 tG=/^#?([0-9A-Fa-f]{6})([0-9A-Fa-f]{2})?$/;class iG{constructor(){this._lastColorId=0,this._id2color=[],this._color2id=new Map}getId(e){if(null===e)return 0;const t=e.match(tG);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]=QS.fromHex("#"+e),i)}getColorMap(){return this._id2color.slice(0)}}class nG{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 eG(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 iG;for(let h of t)s.getId(h);const r=s.getId(n),a=s.getId(o),l=new sG(i,r,a),d=new rG(l);for(let h=0,c=e.length;h<c;h++){const t=e[h];d.insert(t.token,t.fontStyle,s.getId(t.foreground),s.getId(t.background))}return new nG(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(oG);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 oG=/\b(comment|string|regex|regexp)\b/;class sG{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 sG(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 rG{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 rG(this._mainRule.clone()),this._children.set(s,a)),a.insert(r,t,i,n)}}const aG={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:{[tk]:"#FFFFFE",[ik]:"#000000",[vk]:"#E5EBF1",[PE]:"#D3D3D3",[FE]:"#939393",[bk]:"#ADD6FF4D"}},lG={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:{[tk]:"#1E1E1E",[ik]:"#D4D4D4",[vk]:"#3A3D41",[PE]:"#404040",[FE]:"#707070",[bk]:"#ADD6FF26"}},dG={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:{[tk]:"#000000",[ik]:"#FFFFFF",[PE]:"#FFFFFF",[FE]:"#FFFFFF"}};class hG{getIcon(e){const t=hB();let i=e.defaults;for(;Fy.isThemeIcon(i);){const e=t.getIcon(i.id);if(!e)return;i=e.defaults}return i}}const cG=My.as(ix),uG=My.as(Wy);class gG{constructor(e,t){this.semanticHighlighting=!1,this.themeData=t;const i=t.base;e.length>0?(pG(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,QS.fromHex(this.themeData.colors[t]));if(this.themeData.inherit){const t=mG(this.themeData.base);for(let i in t.colors)e.has(i)||e.set(i,QS.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=cG.resolveDefaultColor(e,this),this.defaultColors[e]=t,t)}defines(e){return Object.prototype.hasOwnProperty.call(this.getColors(),e)}get type(){switch(this.base){case"vs":return Oy.LIGHT;case"hc-black":return Oy.HIGH_CONTRAST;default:return Oy.DARK}}get tokenTheme(){if(!this._tokenTheme){let e=[],t=[];if(this.themeData.inherit){const i=mG(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=nG.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 pG(e){return"vs"===e||"vs-dark"===e||"hc-black"===e}function mG(e){switch(e){case"vs":return aG;case"vs-dark":return lG;case"hc-black":return dG}}function fG(e){const t=mG(e);return new gG(e,t)}const _G=s_("themeService");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},bG=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};let CG=class extends Uo{constructor(e,t){super(),this._contextKeyService=e,this._configurationService=t,this._accessibilitySupport=0,this._onDidChangeScreenReaderOptimized=new $o,this._accessibilityModeEnabledContext=IS.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}};CG=vG([bG(0,Dy),bG(1,ev)],CG);var wG=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},yG=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};let SG=class{constructor(e){this._commandService=e}createMenu(e,t,i){return new xG(e,Object.assign({emitEventsForSubmenuChanges:!1,eventDebounceDelay:50},i),this._commandService,t,this)}};SG=wG([yG(0,iy)],SG);let xG=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 Cs,this._menuGroups=[],this._contextKeys=new Set,this._build();const s=new Hv((()=>{this._build(),this._onDidChange.fire(this)}),t.eventDebounceDelay);this._disposables.add(s),this._disposables.add(Zy.onDidChangeMenu((t=>{t.has(e)&&s.schedule()})));const r=this._disposables.add(new Cs);this._onDidChange=new $o({onFirstListenerAdd:()=>{const e=new Hv((()=>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=Zy.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),Ky(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&&Zy.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=Ky(t)?new Xy(t.command,t.alt,e,this._contextKeyService,this._commandService):new Yy(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(Ky(t)?t.command.title:t.title,Ky(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)}};xG=wG([yG(2,iy),yG(3,Dy),yG(4,Gy)],xG);var kG=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},LG=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}},DG=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 EG=class extends Uo{constructor(e,t){super(),this.layoutService=e,this.logService=t,this.mapTextToType=new Map,this.findText="",(Bf||Vf)&&this.installWebKitWriteTextWorkaround()}installWebKitWriteTextWorkaround(){const e=()=>{const e=new Uv;this.webKitPendingClipboardWritePromise&&!this.webKitPendingClipboardWritePromise.isSettled&&this.webKitPendingClipboardWritePromise.cancel(),this.webKitPendingClipboardWritePromise=e,navigator.clipboard.write([new ClipboardItem({"text/plain":e.p})]).catch((t=>DG(this,void 0,void 0,(function*(){t instanceof Error&&"NotAllowedError"===t.name&&e.isRejected||this.logService.error(t)}))))};this.layoutService.hasContainer&&(this._register(BC(this.layoutService.container,"click",e)),this._register(BC(this.layoutService.container,"keydown",e)))}writeText(e,t){return DG(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(Mw("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 DG(this,void 0,void 0,(function*(){if(e)return this.mapTextToType.get(e)||"";try{return yield navigator.clipboard.readText()}catch(t){return""}}))}readFindText(){return DG(this,void 0,void 0,(function*(){return this.findText}))}writeFindText(e){return DG(this,void 0,void 0,(function*(){this.findText=e}))}};EG=kG([LG(0,lV),LG(1,tb)],EG);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},IG=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};class TG{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 MG extends TG{constructor(){super(-1,null)}setValue(e,t){return!1}removeValue(e){return!1}getValue(e){}}MG.INSTANCE=new MG;class OG extends TG{constructor(e,t,i){super(e,null),this._configurationService=t,this._values=RV.forConfigKeys(),this._listener=this._configurationService.onDidChangeConfiguration((e=>{if(6===e.source){const e=Array.from(zs.map(this._values,(([e])=>e)));this._values.clear(),i.fire(new PG(e))}else{const t=[];for(const i of e.affectedKeys){const e=`config.${i}`,n=this._values.findSuperstr(e);void 0!==n&&(t.push(...zs.map(n,(([e])=>e))),this._values.deleteSuperstr(e)),this._values.has(e)&&(t.push(e),this._values.delete(e))}i.fire(new PG(t))}}))}dispose(){this._listener.dispose()}getValue(e){if(0!==e.indexOf(OG._keyPrefix))return super.getValue(e);if(this._values.has(e))return this._values.get(e);const t=e.substr(OG._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)}}OG._keyPrefix="config.";class AG{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 RG{constructor(e){this.key=e}affectsSome(e){return e.has(this.key)}}class PG{constructor(e){this.keys=e}affectsSome(e){for(const t of this.keys)if(e.has(t))return!0;return!1}}class FG{constructor(e){this.events=e}affectsSome(e){for(const t of this.events)if(t.affectsSome(e))return!0;return!1}}class BG{constructor(e){this._onDidChangeContext=new Ka({merge:e=>new FG(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 AG(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 WG(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 RG(e))}removeContext(e){this._isDisposed||this.getContextValuesContainer(this._myContextId).removeValue(e)&&this._onDidChangeContext.fire(new RG(e))}getContext(e){return this._isDisposed?MG.INSTANCE:this.getContextValuesContainer(function(e){for(;e;){if(e.hasAttribute("data-keybinding-context")){const t=e.getAttribute("data-keybinding-context");return t?parseInt(t,10):NaN}e=e.parentElement}return 0}(e))}}let VG=class extends BG{constructor(e){super(0),this._contexts=new Map,this._toDispose=new Cs,this._lastContextId=0;const t=new OG(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?MG.INSTANCE:this._contexts.get(e)||MG.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 TG(t,this.getContextValuesContainer(e))),t}disposeContext(e){this._isDisposed||this._contexts.delete(e)}};VG=NG([IG(0,ev)],VG);class WG extends BG{constructor(e,t){if(super(e.createChildContext()),this._parentChangeListener=new Rr,this._parent=e,this._updateParentChangeListener(),this._domNode=t,this._domNode.hasAttribute("data-keybinding-context")){let e="";this._domNode.classList&&(e=Array.from(this._domNode.classList.values()).join(", "))}this._domNode.setAttribute("data-keybinding-context",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("data-keybinding-context"),this._isDisposed=!0)}getContextValuesContainer(e){return this._isDisposed?MG.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)}}ny.registerCommand("setContext",(function(e,t,i){e.get(Dy).createKey(String(t),i)})),ny.registerCommand({id:"getContextKeyInfo",handler:()=>[...Ly.all()].sort(((e,t)=>e.key.localeCompare(t.key))),description:{description:$m(0,"A command that returns information about context keys"),args:[]}}),ny.registerCommand("_generateContextKeyInfo",(function(){const e=[],t=new Set;for(let i of Ly.all())t.has(i.key)||(t.add(i.key),e.push(i));e.sort(((e,t)=>e.key.localeCompare(t.key)))}));class HG{constructor(e){this.incoming=new Map,this.outgoing=new Map,this.data=e}}class zG{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 HG(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 jG 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 UG{constructor(e=new tF,t=!1,i){this._activeInstantiations=new Set,this._services=e,this._strict=t,this._parent=i,this._services.set(n_,this)}createChild(e){return new UG(e,this._strict,this)}invokeFunction(e,...t){let i=$G.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 av?(i=$G.traceCreation(e.ctor),n=this._createInstance(e.ctor,e.staticArguments.concat(t),i)):(i=$G.traceCreation(e),n=this._createInstance(e,t,i)),i.stop(),n}_createInstance(e,t=[],i){let n=t_.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 av)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 av?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 zG((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 jG(n);for(let i of t_.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 av){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 jG(n);break}for(const{data:t}of e){if(this._getServiceInstanceOrDescriptor(t.id)instanceof av){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 av)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 jv((()=>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 $G{constructor(e,t){this.type=e,this.name=t,this._start=Date.now(),this._dep=[]}static traceInvocation(e){return $G._None}static traceCreation(e){return $G._None}branch(e,t){let i=new $G(2,e.toString());return this._dep.push([e,t,i]),i}stop(){let e=Date.now()-this._start;$G._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),$G._totals.toFixed(2)}}$G._None=new class extends $G{constructor(){super(-1,null)}stop(){}branch(){return this}},$G._totals=0;class KG{constructor(){this._byResource=new FV,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 FV,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:zs.empty():Ps.isUri(e)?null!==(o=null===(n=this._byResource.get(e))||void 0===n?void 0:n.values())&&void 0!==o?o:zs.empty():zs.map(zs.concat(...this._byOwner.values()),(e=>e[1]))}}class qG{constructor(e){this.errors=0,this.infos=0,this.warnings=0,this.unknowns=0,this._data=new FV,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===IC.inMemory||e.scheme===IC.walkThrough||e.scheme===IC.walkThroughSnippet)return t;for(const{severity:i}of this._service.read({resource:e}))i===ej.Error?t.errors+=1:i===ej.Warning?t.warnings+=1:i===ej.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 GG{constructor(){this._onMarkerChanged=new Ga({delay:0,merge:GG._merge}),this.onMarkerChanged=this._onMarkerChanged.event,this._data=new KG,this._stats=new qG(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=GG._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:h,relatedInformation:c,tags:u}=i;if(s)return a=a>0?a:1,l=l>0?l:1,d=d>=a?d:a,h=h>0?h:l,{resource:t,owner:e,code:n,severity:o,message:s,source:r,startLineNumber:a,startColumn:l,endLineNumber:d,endColumn:h,relatedInformation:c,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(GG._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(GG._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(GG._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 FV;for(let i of e)for(let e of i)t.set(e,!0);return Array.from(t.keys())}}var ZG,YG,XG=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())}))};(YG=ZG||(ZG={}))[YG.None=0]="None",YG[YG.Initialized=1]="Initialized",YG[YG.Closed=2]="Closed";class QG 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=ZG.None,this.cache=new Map,this.flushDelayer=new Rv(QG.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===ZG.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 XG(this,void 0,void 0,(function*(){if(this.state===ZG.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 XG(this,void 0,void 0,(function*(){if(this.state===ZG.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 XG(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 XG(this,void 0,void 0,(function*(){return this.flushDelayer.trigger((()=>this.flushPending()),e)}))}dispose(){this.flushDelayer.dispose(),super.dispose()}}QG.DEFAULT_FLUSH_DELAY=100;class JG{constructor(){this.onDidChangeItemsExternal=ds.None,this.items=new Map}updateItems(e){return XG(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 eZ="__$__targetStorageMarker",tZ=s_("storageService");var iZ,nZ;(nZ=iZ||(iZ={}))[nZ.NONE=0]="NONE",nZ[nZ.SHUTDOWN=1]="SHUTDOWN";class oZ extends Uo{constructor(e={flushInterval:oZ.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===eZ?(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(eZ,JSON.stringify(s))):"number"==typeof s[e]&&(delete s[e],null===(o=this.getStorage(t))||void 0===o||o.set(eZ,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(eZ,e);if(t)try{return JSON.parse(t)}catch(i){}return Object.create(null)}}oZ.DEFAULT_FLUSH_INTERVAL=6e4;function sZ(e,t,i,n,o){if(Array.isArray(e)){let s=0;for(const r of e){const e=sZ(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:h,hasAccessToAllModels:c,notebookType:u}=e;if(!n&&!c)return 0;let g=0;if(h)if(h===t.scheme)g=10;else{if("*"!==h)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||!pH(s)(r,void 0,a)))return 0;g=10}return g}return 0;var s,r,a}function rZ(e){return"string"!=typeof e&&(Array.isArray(e)?e.every(rZ):!!e.exclusive)}class aZ{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=sZ(t.selector,e.uri,e.getLanguageId(),Ya(e),i),rZ(t.selector)&&t._score>0){for(let e of this._entries)e._score=0;t._score=1e3;break}this._entries.sort(aZ._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}}dv(lb,class{constructor(){this.referenceProvider=new aZ(this._score.bind(this)),this.renameProvider=new aZ(this._score.bind(this)),this.codeActionProvider=new aZ(this._score.bind(this)),this.definitionProvider=new aZ(this._score.bind(this)),this.typeDefinitionProvider=new aZ(this._score.bind(this)),this.declarationProvider=new aZ(this._score.bind(this)),this.implementationProvider=new aZ(this._score.bind(this)),this.documentSymbolProvider=new aZ(this._score.bind(this)),this.inlayHintsProvider=new aZ(this._score.bind(this)),this.colorProvider=new aZ(this._score.bind(this)),this.codeLensProvider=new aZ(this._score.bind(this)),this.documentFormattingEditProvider=new aZ(this._score.bind(this)),this.documentRangeFormattingEditProvider=new aZ(this._score.bind(this)),this.onTypeFormattingEditProvider=new aZ(this._score.bind(this)),this.signatureHelpProvider=new aZ(this._score.bind(this)),this.hoverProvider=new aZ(this._score.bind(this)),this.documentHighlightProvider=new aZ(this._score.bind(this)),this.selectionRangeProvider=new aZ(this._score.bind(this)),this.foldingRangeProvider=new aZ(this._score.bind(this)),this.linkProvider=new aZ(this._score.bind(this)),this.inlineCompletionsProvider=new aZ(this._score.bind(this)),this.completionProvider=new aZ(this._score.bind(this)),this.linkedEditingRangeProvider=new aZ(this._score.bind(this)),this.documentRangeSemanticTokensProvider=new aZ(this._score.bind(this)),this.documentSemanticTokensProvider=new aZ(this._score.bind(this))}_score(e){var t;return null===(t=this._notebookTypeResolver)||void 0===t?void 0:t.call(this,e)}},!0);var lZ=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)}},hZ=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 cZ{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 uZ=class{constructor(e){this.modelService=e}createModelReference(e){const t=this.modelService.getModel(e);return t?Promise.resolve(new Xa(new cZ(t))):Promise.reject(new Error("Model not found"))}};uZ=lZ([dZ(0,Dv)],uZ);class gZ{show(){return gZ.NULL_PROGRESS_RUNNER}showWhile(e,t){return hZ(this,void 0,void 0,(function*(){yield e}))}}gZ.NULL_PROGRESS_RUNNER={done:()=>{},total:()=>{},worked:()=>{}};class pZ{info(e){return this.notify({severity:oF.Info,message:e})}warn(e){return this.notify({severity:oF.Warning,message:e})}error(e){return this.notify({severity:oF.Error,message:e})}notify(e){switch(e.severity){case oF.Error:case oF.Warning:}return pZ.NO_OP}status(e,t){return Uo.None}}pZ.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=ny.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=lZ([dZ(0,n_)],mZ);let fZ=class extends hW{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 Cs;t.add(BC(e,yw.KEY_DOWN,(e=>{const t=new SC(e);this._dispatch(t,t.target)&&(t.preventDefault(),t.stopPropagation())}))),t.add(BC(e,yw.KEY_UP,(e=>{const t=new SC(e);this._singleModifierDispatch(t,t.target)&&t.preventDefault()}))),this._domNodeListeners.push(new _Z(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=fC(t,Xs),s=new Cs;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(ny.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(Jy.getDefaultKeybindings(),!0),t=this._toNormalizedKeybindingItems(this._dynamicKeybindings,!1);this._cachedResolver=new gW(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=SW.resolveUserBinding(s,Xs);for(const s of r)i[n++]=new fW(s,o.command,o.commandArgs,e,t,null,!1)}else i[n++]=new fW(void 0,o.command,o.commandArgs,e,t,null,!1)}return i}resolveKeyboardEvent(e){const t=new vC(e.ctrlKey,e.shiftKey,e.altKey,e.metaKey,e.keyCode).toChord();return new SW(t,Xs)}};fZ=lZ([dZ(0,Dy),dZ(1,iy),dZ(2,tS),dZ(3,rF),dZ(4,tb),dZ(5,r_)],fZ);class _Z extends Uo{constructor(e,t){super(),this.domNode=e,this._register(t)}}function vZ(e){return e&&"object"==typeof e&&(!e.overrideIdentifier||"string"==typeof e.overrideIdentifier)&&(!e.resource||e.resource instanceof Ps)}class bZ{constructor(){this._onDidChangeConfiguration=new $o,this.onDidChangeConfiguration=this._onDidChangeConfiguration.event,this._configuration=new aW(new rW,new sW)}getValue(e,t){const i="string"==typeof e?e:void 0,n=vZ(e)?e:vZ(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 lW({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 CZ=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)}};CZ=lZ([dZ(0,ev)],CZ);let wZ=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||Ho?"\n":"\r\n"}};wZ=lZ([dZ(0,ev)],wZ);class yZ{constructor(){const e=Ps.from({scheme:yZ.SCHEME,authority:"model",path:"/"});this.workspace={id:"4064f6ec-cb38-4ad0-af64-ee6467e63c82",folders:[new DW({uri:e,name:"",index:0})]}}getWorkspace(){return this.workspace}}function SZ(e,t,i){if(!t)return;if(!(e instanceof bZ))return;const n=[];Object.keys(t).forEach((e=>{(function(e){return nW()[`editor.${e}`]||!1})(e)&&n.push([`editor.${e}`,t[e]]),i&&function(e){return nW()[`diffEditor.${e}`]||!1}(e)&&n.push([`diffEditor.${e}`,t[e]])})),n.length>0&&e.updateValues(n)}yZ.SCHEME="inmemory";let xZ=class{constructor(e){this._modelService=e}hasPreviewHandler(){return!1}apply(e,t){return hZ(this,void 0,void 0,(function*(){const t=new Map;for(let o of e){if(!(o instanceof XV))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(oW.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:Oa(WW.bulkEditServiceSummary,i,n)}}))}};xZ=lZ([dZ(0,Dv)],xZ);let kZ=class extends YW{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)}};kZ=lZ([dZ(0,lV),dZ(1,r_)],kZ);let LZ=class extends Bz{constructor(e,t,i,n,o){super(e,t,i,n,o),this.configure({blockMouse:!1})}};var DZ;LZ=lZ([dZ(0,tS),dZ(1,rF),dZ(2,LB),dZ(3,uW),dZ(4,Ry)],LZ),dv(ev,bZ),dv(Jv,CZ),dv(eb,wZ),dv(kW,yZ),dv(xW,class{getUriLabel(e,t){return"file"===e.scheme?e.fsPath:e.path}}),dv(tS,class{publicLog(e,t){return Promise.resolve(void 0)}publicLog2(e,t){return this.publicLog(e,t)}}),dv(gV,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})}}),dv(rF,pZ),dv(nj,GG),dv(rv,class extends kH{constructor(){super()}}),dv(_G,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 hG,this._autoDetectHighContrast=!0,this._knownThemes=new Map,this._knownThemes.set("vs",fG("vs")),this._knownThemes.set("vs-dark",fG("vs-dark")),this._knownThemes.set("hc-black",fG("hc-black"));const e=function(e){const t=new $o,i=hB();return i.onDidChange((()=>t.fire())),null==e||e.onDidProductIconThemeChange((()=>t.fire())),{onDidChange:t.event,getCSS(){const t=e?e.getProductIconTheme():new hG,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: ${Bw(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=>`${Fw(e.location)} format('${e.format}')`)).join(", ");s.push(`@font-face { src: ${r}; font-family: ${Bw(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("vs"),e.onDidChange((()=>{this._codiconCSS=e.getCSS(),this._updateCSS()})),t="(forced-colors: active)",i=()=>{this._updateActualTheme()},window.matchMedia(t).addEventListener("change",i)}registerEditorContainer(e){return gw(e)?this._registerShadowDomContainer(e):this._registerRegularEditorContainer()}_registerRegularEditorContainer(){return this._globalStyleElement||(this._globalStyleElement=fw(),this._globalStyleElement.className="monaco-colors",this._globalStyleElement.textContent=this._allCSS,this._styleElements.push(this._globalStyleElement)),Uo.None}_registerShadowDomContainer(e){const t=fw(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(!pG(t.base)&&!pG(e))throw new Error("Illegal theme base!");this._knownThemes.set(e,new gG(e,t)),pG(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("vs"),this._desiredTheme=t,this._updateActualTheme()}_updateActualTheme(){const e=this._autoDetectHighContrast&&window.matchMedia("(forced-colors: active)").matches?this._knownThemes.get("hc-black"):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)}};uG.getThemingParticipants().forEach((e=>e(this._theme,i,this._environment)));const n=[];for(const s of cG.getColors()){const e=this._theme.getColor(s.id,!0);e&&n.push(`${tx(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(),Es.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}}),dv(tb,class extends ab{constructor(){super(new rb)}}),dv(Dv,Aj),dv(Gw,aj),dv(Dy,VG),dv(MB,gZ),dv(tZ,class extends oZ{constructor(){super(),this.globalStorage=this._register(new QG(new JG)),this.workspaceStorage=this._register(new QG(new JG)),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}}),dv(kB,gb),dv(ZV,xZ),dv(HW,class{constructor(){this._neverEmitter=new $o,this.onDidChangeTrust=this._neverEmitter.event}isWorkspaceTrusted(){return!0}}),dv(Zw,uZ),dv(NS,CG),dv(eq,tq),dv(iy,mZ),dv(uW,fZ),dv(Hq,Xq),dv(LB,kZ),dv(Uz,Jz),dv(IB,EG),dv(DB,LZ),dv(Gy,SG),function(e){const t=new tF;for(const[o,s]of hv())t.set(o,s);const i=new UG(t,!0);t.set(n_,i),e.get=function(e){const n=t.get(e);if(!n)throw new Error("Missing service "+e);return n instanceof av?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 hv())t.get(i)||t.set(i,n);for(const i in e)if(e.hasOwnProperty(i)){const n=s_(i);t.get(n)instanceof av&&t.set(n,e[i])}return i}}(DZ||(DZ={}));var EZ=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},NZ=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};let IZ=0,TZ=!1;function MZ(e){if(!e){if(TZ)return;TZ=!0}!function(e){Ww=document.createElement("div"),Ww.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"),Ww.appendChild(e),e};Hw=t(),zw=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"),Ww.appendChild(e),e};jw=i(),Uw=i(),e.appendChild(Ww)}(e||document.body)}let OZ=class extends MF{constructor(e,t,i,n,o,s,r,a,l,d,h,c){const u=Object.assign({},t);u.ariaLabel=u.ariaLabel||FW.editorViewAccessibleLabel,u.ariaLabel=u.ariaLabel+";"+FW.accessibilityHelpMessage,super(e,u,{},i,n,o,s,a,l,d,h,c),this._standaloneKeybindingService=r instanceof fZ?r:null,MZ(u.ariaContainerElement)}addCommand(e,t,i){if(!this._standaloneKeybindingService)return null;const n="DYNAMIC_"+ ++IZ,o=ry.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=ry.and(ry.equals("editorId",this.getId()),ry.deserialize(e.precondition)),o=e.keybindings,s=ry.and(n,ry.deserialize(e.keybindingContext)),r=e.contextMenuGroupId||null,a=e.contextMenuOrder||0,l=(t,...i)=>Promise.resolve(e.run(this,...i)),d=new Cs,h=this.getId()+":"+t;if(d.add(ny.registerCommand(h,l)),r){const e={command:{id:h,title:i},when:n,group:r,order:a};d.add(Zy.appendMenuItem(qy.EditorContext,e))}if(Array.isArray(o))for(const u of o)d.add(this._standaloneKeybindingService.addDynamicKeybinding(h,u,l,s));const c=new JM(h,i,i,n,l,this._contextKeyService);return this._actions[t]=c,d.add(es((()=>{delete this._actions[t]}))),d}_triggerCommand(e,t){if(this._codeEditorService instanceof aV)try{this._codeEditorService.setActiveCodeEditor(this),super._triggerCommand(e,t)}finally{this._codeEditorService.setActiveCodeEditor(null)}else super._triggerCommand(e,t)}};OZ=EZ([NZ(2,n_),NZ(3,r_),NZ(4,iy),NZ(5,Dy),NZ(6,uW),NZ(7,Ry),NZ(8,rF),NZ(9,NS),NZ(10,pv),NZ(11,lb)],OZ);let AZ=class extends OZ{constructor(e,t,i,n,o,s,r,a,l,d,h,c,u,g,p){const m=Object.assign({},t);SZ(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,h,g,p),this._configurationService=d,this._standaloneThemeService=a,this._register(f),void 0===_){const e=u.getLanguageIdByMimeType(m.language)||m.language||"plaintext";v=PZ(c,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){SZ(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)}};AZ=EZ([NZ(2,n_),NZ(3,r_),NZ(4,iy),NZ(5,Dy),NZ(6,uW),NZ(7,_G),NZ(8,rF),NZ(9,ev),NZ(10,NS),NZ(11,Dv),NZ(12,rv),NZ(13,pv),NZ(14,lb)],AZ);let RZ=class extends HB{constructor(e,t,i,n,o,s,r,a,l,d,h,c){const u=Object.assign({},t);SZ(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,{},c,o,n,i,s,r,a,d,h),this._configurationService=l,this._standaloneThemeService=r,this._register(g)}dispose(){super.dispose()}updateOptions(e){SZ(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(OZ,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 PZ(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)),FZ(e,i,t.createByFilepathOrFirstLine(o||null,s),o)}return FZ(e,i,t.createById(n),o)}function FZ(e,t,i,n){return e.createModel(t,i,n)}function BZ(e,t,i){return DZ.initialize(i||{}).createInstance(AZ,e,t)}function VZ(e){return DZ.get(r_).onCodeEditorAdd((t=>{e(t)}))}function WZ(e,t,i){return DZ.initialize(i||{}).createInstance(RZ,e,t)}function HZ(e,t){return new d_(e,t)}function zZ(e,t,i){const n=DZ.get(rv),o=n.getLanguageIdByMimeType(t)||t;return PZ(DZ.get(Dv),n,e,o,i)}function jZ(e,t){const i=DZ.get(rv);DZ.get(Dv).setMode(e,i.createById(t))}function UZ(e,t,i){if(e){DZ.get(nj).changeOne(t,e.uri,i)}}function $Z(e){return DZ.get(nj).read(e)}function KZ(e){return DZ.get(nj).onMarkerChanged(e)}function qZ(e){return DZ.get(Dv).getModel(e)}function GZ(){return DZ.get(Dv).getModels()}function ZZ(e){return DZ.get(Dv).onModelAdded(e)}function YZ(e){return DZ.get(Dv).onModelRemoved(e)}function XZ(e){return DZ.get(Dv).onModelLanguageChanged((t=>{e({model:t.model,oldLanguage:t.oldLanguageId})}))}function QZ(e){return function(e,t,i){return new Cb(e,t,i)}(DZ.get(Dv),DZ.get(pv),e)}function JZ(e,t){const i=DZ.get(rv),n=DZ.get(_G);return n.registerEditorContainer(e),gC.colorizeElement(n,i,e,t)}function eY(e,t,i){const n=DZ.get(rv);return DZ.get(_G).registerEditorContainer(document.body),gC.colorize(n,e,t,i)}function tY(e,t,i=4){return DZ.get(_G).registerEditorContainer(document.body),gC.colorizeModelLine(e,t,i)}function iY(e,t){Es.getOrCreate(t);const i=(n=t,Es.get(n)||{getInitialState:()=>xv,tokenize:(e,t,i)=>kv(n,i)});var n;const o=Is(e),s=[];let r=i.getInitialState();for(let a=0,l=o.length;a<l;a++){const e=o[a],t=i.tokenize(e,!0,r);s[a]=t.tokens,r=t.endState}return s}function nY(e,t){DZ.get(_G).defineTheme(e,t)}function oY(e){DZ.get(_G).setTheme(e)}function sY(){e_.clearAllFontInfos()}function rY(e,t){return ny.registerCommand({id:e,handler:t})}function aY(e,t){return"boolean"==typeof e?e:t}function lY(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 hY(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]?Qb(e,"language definition does not contain attribute '"+o+"', used at: "+t):Qb(e,"attribute reference '"+o+"' must be a string, used at: "+t);s=e[o].source}return Zb(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 cY(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 Qb(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 Qb(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=hY(e,"^"+d+"$");a=function(e){return"~"===l?t.test(e):!t.test(e)}}else a=function(t,i,n,o){return hY(e,"^"+Jb(e,d,i,n,o)+"$").test(t)};else if(d.indexOf("$")<0){const t=Yb(e,d);a=function(e){return"=="===l?e===t:e!==t}}else{const t=Yb(e,d);a=function(i,n,o,s,r){const a=Jb(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 uY(e,t,i){if(i){if("string"==typeof i)return i;if(i.token||""===i.token){if("string"!=typeof i.token)throw Qb(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 Qb(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 Qb(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,Jb(e,o,"",[],""))))throw Qb(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]=uY(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=uY(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(cY(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 Qb(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:""}}RZ=EZ([NZ(2,n_),NZ(3,Dy),NZ(4,kB),NZ(5,r_),NZ(6,_G),NZ(7,rF),NZ(8,ev),NZ(9,DB),NZ(10,MB),NZ(11,IB)],RZ);class gY{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 Qb(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=hY(e,"^(?:"+(this.matchOnlyAtLineStart?i.substr(1):i)+")")}setAction(e,t){this.action=uY(e,this.name,t)}}function pY(e,t){if(!t||"object"!=typeof t)throw new Error("Monarch: expecting a language definition object");const i={};i.languageId=e,i.includeLF=aY(t.includeLF,!1),i.noThrow=!1,i.maxStack=100,i.start="string"==typeof t.start?t.start:null,i.ignoreCase=aY(t.ignoreCase,!1),i.unicode=aY(t.unicode,!1),i.tokenPostfix=lY(t.tokenPostfix,"."+i.languageId),i.defaultToken=lY(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 Qb(i,"an 'include' attribute must be a string at: "+e);if("@"===r[0]&&(r=r.substr(1)),!t.tokenizer[r])throw Qb(i,"include target '"+r+"' is not defined at: "+e);o(e+"."+r,s,t.tokenizer[r])}else{const t=new gY(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 Qb(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 Qb(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=aY(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 Qb(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 Qb(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 Qb(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 Qb(i,"every element in the 'brackets' array must be a '{open,close,token}' object or array");s.push({token:e.token+i.tokenPostfix,open:Yb(i,e.open),close:Yb(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 fY(e){pO.registerLanguage(e)}function _Y(){let e=[];return e=e.concat(pO.getLanguages()),e}function vY(e){return DZ.get(rv).languageIdCodec.encodeLanguageId(e)}function bY(e,t){const i=DZ.get(rv).onDidEncounterLanguage((n=>{n===e&&(i.dispose(),t())}));return i}function CY(e,t){if(!DZ.get(rv).isRegisteredLanguageId(e))throw new Error(`Cannot set configuration for unknown language ${e}`);return bv.register(e,t,100)}class wY{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 yY.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 yY{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=yY._toClassicTokens(o.tokens,e);let r;return r=o.endState.equals(n)?n:o.endState,new ss(s,r)}tokenize(e,t,i){return yY.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 SY(e){return e&&"function"==typeof e.then}function xY(e){const t=DZ.get(_G);if(e){const i=[null];for(let t=1,n=e.length;t<n;t++)i[t]=QS.fromHex(e[t]);t.setColorMapOverride(i)}else t.setColorMapOverride(null)}function kY(e,t){return function(e){return"tokenizeEncoded"in e}(t)?new wY(e,t):new yY(e,t,DZ.get(rv),DZ.get(_G))}function LY(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?kY(e,i):new lC(DZ.get(rv),DZ.get(_G),e,pY(e,i)):null}))};return Es.registerFactory(e,i)}function DY(e,t){if(!DZ.get(rv).isRegisteredLanguageId(e))throw new Error(`Cannot set tokens provider for unknown language ${e}`);return SY(t)?LY(e,{create:()=>t}):Es.register(e,kY(e,t))}function EY(e,t){return SY(t)?LY(e,{create:()=>t}):Es.register(e,(i=t,new lC(DZ.get(rv),DZ.get(_G),e,pY(e,i))));var i}function NY(e,t){return DZ.get(lb).referenceProvider.register(e,t)}function IY(e,t){return DZ.get(lb).renameProvider.register(e,t)}function TY(e,t){return DZ.get(lb).signatureHelpProvider.register(e,t)}function MY(e,t){return DZ.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 OY(e,t){return DZ.get(lb).documentSymbolProvider.register(e,t)}function AY(e,t){return DZ.get(lb).documentHighlightProvider.register(e,t)}function RY(e,t){return DZ.get(lb).linkedEditingRangeProvider.register(e,t)}function PY(e,t){return DZ.get(lb).definitionProvider.register(e,t)}function FY(e,t){return DZ.get(lb).implementationProvider.register(e,t)}function BY(e,t){return DZ.get(lb).typeDefinitionProvider.register(e,t)}function VY(e,t){return DZ.get(lb).codeLensProvider.register(e,t)}function WY(e,t,i){return DZ.get(lb).codeActionProvider.register(e,{providedCodeActionKinds:null==i?void 0:i.providedCodeActionKinds,provideCodeActions:(e,i,n,o)=>{const s=DZ.get(nj).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 HY(e,t){return DZ.get(lb).documentFormattingEditProvider.register(e,t)}function zY(e,t){return DZ.get(lb).documentRangeFormattingEditProvider.register(e,t)}function jY(e,t){return DZ.get(lb).onTypeFormattingEditProvider.register(e,t)}function UY(e,t){return DZ.get(lb).linkProvider.register(e,t)}function $Y(e,t){return DZ.get(lb).completionProvider.register(e,t)}function KY(e,t){return DZ.get(lb).colorProvider.register(e,t)}function qY(e,t){return DZ.get(lb).foldingRangeProvider.register(e,t)}function GY(e,t){return DZ.get(lb).declarationProvider.register(e,t)}function ZY(e,t){return DZ.get(lb).selectionRangeProvider.register(e,t)}function YY(e,t){return DZ.get(lb).documentSemanticTokensProvider.register(e,t)}function XY(e,t){return DZ.get(lb).documentRangeSemanticTokensProvider.register(e,t)}function QY(e,t){return DZ.get(lb).inlineCompletionsProvider.register(e,t)}function JY(e,t){return DZ.get(lb).inlayHintsProvider.register(e,t)}const eX=s_("IEditorCancelService"),tX=new Ly("cancellableOperation",!1,$m(0,"Whether the editor runs a cancellable operation, e.g. like 'Peek References'"));dv(eX,class{constructor(){this._tokens=new WeakMap}add(e,t){let i,n=this._tokens.get(e);return n||(n=e.invokeWithinContext((e=>({key:tX.bindTo(e.get(Dy)),tokens:new Hs}))),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 iX extends as{constructor(e,t){super(t),this.editor=e,this._unregister=e.invokeWithinContext((t=>t.get(eX).add(e,this)))}dispose(){this._unregister(),super.dispose()}}dS(new class extends sS{constructor(){super({id:"editor.cancelOperation",kbOpts:{weight:100,primary:9},precondition:tX})}runEditorCommand(e,t){e.get(eX).cancel(t)}});class nX{constructor(e,t){if(this.flags=t,0!=(1&this.flags)){const t=e.getModel();this.modelVersionId=t?Oa("{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 nX))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 nX(e,this.flags))}}class oX extends iX{constructor(e,t,i,n){super(e,n),this._listener=new Cs,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 sX extends as{constructor(e,t){super(t),this._listener=e.onDidChangeContent((()=>this.cancel()))}dispose(){this._listener.dispose(),super.dispose()}}function rX(e){return!(!e||"function"!=typeof e.getEditorType)&&e.getEditorType()===h_.ICodeEditor}function aX(e){return!(!e||"function"!=typeof e.getEditorType)&&e.getEditorType()===h_.IDiffEditor}function lX(e){return rX(e)?e:aX(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=>oW.replace(qo.lift(e.range),e.text)))):e.executeEdits("formatEditsCommand",n.map((e=>oW.replaceMove(qo.lift(e.range),e.text)))),i&&e.pushUndoStop()}}class hX{constructor(e){this.value=e,this._lower=e.toLowerCase()}static toKey(e){return"string"==typeof e?e.toLowerCase():e._lower}}var cX,uX=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 gX(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?$w($m(0,"Made 1 formatting edit on line {0}",i)):$w($m(0,"Made {0} formatting edits on line {1}",e.length,i)):1===e.length?$w($m(0,"Made 1 formatting edit between lines {0} and {1}",i,n)):$w($m(0,"Made {0} formatting edits between lines {1} and {2}",e.length,i,n))}function pX(e,t,i){const n=[],o=new Set,s=e.ordered(i);for(const a of s)n.push(a),a.extensionId&&o.add(hX.toKey(a.extensionId));const r=t.ordered(i);for(const a of r){if(a.extensionId){if(o.has(hX.toKey(a.extensionId)))continue;o.add(hX.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 uX(this,void 0,void 0,(function*(){if(0===e.length)return;const n=zs.first(mX._selectors);return n?yield n(e,t,i):void 0}))}}function fX(e,t,i,n,o,s){return uX(this,void 0,void 0,(function*(){const r=e.get(n_),{documentRangeFormattingEditProvider:a}=e.get(lb),l=rX(t)?t.getModel():t,d=a.ordered(l),h=yield mX.select(d,l,n);h&&(o.report(h),yield r.invokeFunction(_X,h,t,i,s))}))}function _X(e,t,i,n,o){return uX(this,void 0,void 0,(function*(){const s=e.get(kB);let r,a;rX(i)?(r=i.getModel(),a=new oX(i,5,void 0,o)):(r=i,a=new sX(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 h=e=>uX(this,void 0,void 0,(function*(){return(yield t.provideDocumentRangeFormattingEdits(r,e,r.getFormattingOptions(),a.token))||[]})),c=(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 h(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(c(g[e],g[t])){const i=qo.plusRange(l[e],l[t]),n=yield h(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(rX(i))dX.execute(i,u,!0),gX(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 vX(e,t,i,n,o){return uX(this,void 0,void 0,(function*(){const s=e.get(n_),r=e.get(lb),a=rX(t)?t.getModel():t,l=pX(r.documentFormattingEditProvider,r.documentRangeFormattingEditProvider,a),d=yield mX.select(l,a,i);d&&(n.report(d),yield s.invokeFunction(bX,d,t,i,o))}))}function bX(e,t,i,n,o){return uX(this,void 0,void 0,(function*(){const s=e.get(kB);let r,a,l;rX(i)?(r=i.getModel(),a=new oX(i,5,void 0,o)):(r=i,a=new sX(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(rX(i))dX.execute(i,l,2!==n),2!==n&&(gX(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 CX(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 Hs,ny.registerCommand("_executeFormatRangeProvider",(function(e,...t){return uX(this,void 0,void 0,(function*(){const[i,n,o]=t;Js(Ps.isUri(i)),Js(qo.isIRange(n));const s=e.get(Zw),r=e.get(kB),a=e.get(lb),l=yield s.createModelReference(i);try{return function(e,t,i,n,o,s){return uX(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()}}))})),ny.registerCommand("_executeFormatDocumentProvider",(function(e,...t){return uX(this,void 0,void 0,(function*(){const[i,n]=t;Js(Ps.isUri(i));const o=e.get(Zw),s=e.get(kB),r=e.get(lb),a=yield o.createModelReference(i);try{return function(e,t,i,n,o){return uX(this,void 0,void 0,(function*(){const s=pX(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()}}))})),ny.registerCommand("_executeFormatOnTypeProvider",(function(e,...t){return uX(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(Zw),a=e.get(kB),l=e.get(lb),d=yield r.createModelReference(i);try{return CX(a,l,d.object.textEditorModel,er.lift(n),o,s,Ia.None)}finally{d.dispose()}}))})),Ef.wrappingIndent.defaultValue=0,Ef.glyphMargin.defaultValue=!1,Ef.autoIndent.defaultValue=3,Ef.overviewRulerLanes.defaultValue=2,mX.setFormatterSelector(((e,t,i)=>Promise.resolve(e[0])));const wX=Ol();wX.editor={create:BZ,onDidCreateEditor:VZ,createDiffEditor:WZ,createDiffNavigator:HZ,createModel:zZ,setModelLanguage:jZ,setModelMarkers:UZ,getModelMarkers:$Z,onDidChangeMarkers:KZ,getModels:GZ,getModel:qZ,onDidCreateModel:ZZ,onWillDisposeModel:YZ,onDidChangeModelLanguage:XZ,createWebWorker:QZ,colorizeElement:JZ,colorize:eY,colorizeModelLine:tY,tokenize:iY,defineTheme:nY,setTheme:oY,remeasureFonts:sY,registerCommand:rY,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:hl,RenderMinimap:cl,ScrollbarVisibility:ul,ScrollType:gl,TextEditorCursorBlinkingStyle:pl,TextEditorCursorStyle:ml,TrackedRangeStickiness:fl,WrappingIndent:_l,InjectedTextCursorStops:vl,PositionAffinity:bl,ConfigurationChangedEvent:qm,BareFontInfo:Xf,FontInfo:Qf,TextModelResolvedOptions:ea,FindMatch:Zr,ApplyUpdateResult:Ym,EditorType:h_,EditorOptions:Ef},wX.languages={register:fY,getLanguages:_Y,onLanguage:bY,getEncodedLanguageId:vY,setLanguageConfiguration:CY,setColorMap:xY,registerTokensProviderFactory:LY,setTokensProvider:DY,setMonarchTokensProvider:EY,registerReferenceProvider:NY,registerRenameProvider:IY,registerCompletionItemProvider:$Y,registerSignatureHelpProvider:TY,registerHoverProvider:MY,registerDocumentSymbolProvider:OY,registerDocumentHighlightProvider:AY,registerLinkedEditingRangeProvider:RY,registerDefinitionProvider:PY,registerImplementationProvider:FY,registerTypeDefinitionProvider:BY,registerCodeLensProvider:VY,registerCodeActionProvider:WY,registerDocumentFormattingEditProvider:HY,registerDocumentRangeFormattingEditProvider:zY,registerOnTypeFormattingEditProvider:jY,registerLinkProvider:UY,registerColorProvider:KY,registerFoldingRangeProvider:qY,registerDeclarationProvider:GY,registerSelectionRangeProvider:ZY,registerDocumentSemanticTokensProvider:YY,registerDocumentRangeSemanticTokensProvider:XY,registerInlineCompletionsProvider:QY,registerInlayHintsProvider:JY,DocumentHighlightKind:Cl,CompletionItemKind:wl,CompletionItemTag:yl,CompletionItemInsertTextRule:Sl,SymbolKind:xl,SymbolTag:kl,IndentAction:Ll,CompletionTriggerKind:Dl,SignatureHelpTriggerKind:El,InlayHintKind:Nl,InlineCompletionTriggerKind:Il,FoldingRangeKind:Tl};const yX=wX.CancellationTokenSource,SX=wX.Emitter,xX=wX.KeyCode,kX=wX.KeyMod,LX=wX.Position,DX=wX.Range,EX=wX.Selection,NX=wX.SelectionDirection,IX=wX.MarkerSeverity,TX=wX.MarkerTag,MX=wX.Uri,OX=wX.Token,AX=wX.editor,RX=wX.languages;((null===(cX=us.MonacoEnvironment)||void 0===cX?void 0:cX.globalAPI)||"function"==typeof define&&define.amd)&&(self.monaco=wX),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 PX=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",CancellationTokenSource:yX,Emitter:SX,KeyCode:xX,KeyMod:kX,Position:LX,Range:DX,Selection:EX,SelectionDirection:NX,MarkerSeverity:IX,MarkerTag:TX,Uri:MX,Token:OX,editor:AX,languages:RX}),FX=Object.defineProperty,BX=Object.getOwnPropertyDescriptor,VX=Object.getOwnPropertyNames,WX=Object.prototype.hasOwnProperty,HX={}; |
|
|
/*! @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 j3=Object.hasOwnProperty,U3=Object.setPrototypeOf,$3=Object.isFrozen,K3=Object.getPrototypeOf,q3=Object.getOwnPropertyDescriptor,G3=Object.freeze,Z3=Object.seal,Y3=Object.create,X3="undefined"!=typeof Reflect&&Reflect,Q3=X3.apply,J3=X3.construct;Q3||(Q3=function(e,t,i){return e.apply(t,i)}),G3||(G3=function(e){return e}),Z3||(Z3=function(e){return e}),J3||(J3=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 e5,t5=c5(Array.prototype.forEach),i5=c5(Array.prototype.pop),n5=c5(Array.prototype.push),o5=c5(String.prototype.toLowerCase),s5=c5(String.prototype.match),r5=c5(String.prototype.replace),a5=c5(String.prototype.indexOf),l5=c5(String.prototype.trim),d5=c5(RegExp.prototype.test),h5=(e5=TypeError,function(){for(var e=arguments.length,t=Array(e),i=0;i<e;i++)t[i]=arguments[i];return J3(e5,t)});function c5(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 Q3(e,t,n)}}function u5(e,t){U3&&U3(e,null);for(var i=t.length;i--;){var n=t[i];if("string"==typeof n){var o=o5(n);o!==n&&($3(t)||(t[i]=o),n=o)}e[n]=!0}return e}function g5(e){var t=Y3(null),i=void 0;for(i in e)Q3(j3,e,[i])&&(t[i]=e[i]);return t}function p5(e,t){for(;null!==e;){var i=q3(e,t);if(i){if(i.get)return c5(i.get);if("function"==typeof i.value)return c5(i.value)}e=K3(e)}return function(e){return null}}var m5=G3(["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"]),f5=G3(["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"]),_5=G3(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),v5=G3(["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"]),b5=G3(["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"]),C5=G3(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),w5=G3(["#text"]),y5=G3(["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"]),S5=G3(["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"]),x5=G3(["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"]),k5=G3(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),L5=Z3(/\{\{[\s\S]*|[\s\S]*\}\}/gm),D5=Z3(/<%[\s\S]*|[\s\S]*%>/gm),E5=Z3(/^data-[\-\w.\u00B7-\uFFFF]/),N5=Z3(/^aria-[\-\w]+$/),I5=Z3(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),T5=Z3(/^(?:\w+script|data):/i),M5=Z3(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),O5="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 R5=function(){return"undefined"==typeof window?null:window},P5=function(e,t){if("object"!==(void 0===e?"undefined":O5(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(s){return null}};var F5=function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:R5(),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,h=t.NamedNodeMap,c=void 0===h?t.NamedNodeMap||t.MozNamedAttrMap:h,u=t.Text,g=t.Comment,p=t.DOMParser,m=t.trustedTypes,f=l.prototype,_=p5(f,"cloneNode"),v=p5(f,"nextSibling"),b=p5(f,"childNodes"),C=p5(f,"parentNode");if("function"==typeof r){var w=o.createElement("template");w.content&&w.content.ownerDocument&&(o=w.content.ownerDocument)}var y=P5(m,n),S=y&&te?y.createHTML(""):"",x=o,k=x.implementation,L=x.createNodeIterator,D=x.createDocumentFragment,E=x.getElementsByTagName,N=n.importNode,I={};try{I=g5(o).documentMode?o.documentMode:{}}catch(Pe){}var T={};i.isSupported="function"==typeof C&&k&&void 0!==k.createHTMLDocument&&9!==I;var M=L5,O=D5,A=E5,R=N5,P=T5,F=M5,B=I5,V=null,W=u5({},[].concat(A5(m5),A5(f5),A5(_5),A5(b5),A5(w5))),H=null,z=u5({},[].concat(A5(y5),A5(S5),A5(x5),A5(k5))),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=u5({},["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=u5({},["audio","video","img","source","image","track"]),he=null,ce=u5({},["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":O5(e))||(e={}),e=g5(e),V="ALLOWED_TAGS"in e?u5({},e.ALLOWED_TAGS):W,H="ALLOWED_ATTR"in e?u5({},e.ALLOWED_ATTR):z,he="ADD_URI_SAFE_ATTR"in e?u5(g5(ce),e.ADD_URI_SAFE_ATTR):ce,le="ADD_DATA_URI_TAGS"in e?u5(g5(de),e.ADD_DATA_URI_TAGS):de,re="FORBID_CONTENTS"in e?u5({},e.FORBID_CONTENTS):ae,j="FORBID_TAGS"in e?u5({},e.FORBID_TAGS):{},U="FORBID_ATTR"in e?u5({},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=u5({},[].concat(A5(w5))),H=[],!0===se.html&&(u5(V,m5),u5(H,y5)),!0===se.svg&&(u5(V,f5),u5(H,S5),u5(H,k5)),!0===se.svgFilters&&(u5(V,_5),u5(H,S5),u5(H,k5)),!0===se.mathMl&&(u5(V,b5),u5(H,x5),u5(H,k5))),e.ADD_TAGS&&(V===W&&(V=g5(V)),u5(V,e.ADD_TAGS)),e.ADD_ATTR&&(H===z&&(H=g5(H)),u5(H,e.ADD_ATTR)),e.ADD_URI_SAFE_ATTR&&u5(he,e.ADD_URI_SAFE_ATTR),e.FORBID_CONTENTS&&(re===ae&&(re=g5(re)),u5(re,e.FORBID_CONTENTS)),ne&&(V["#text"]=!0),Z&&u5(V,["html","head","body"]),V.table&&(u5(V,["tbody"]),delete j.tbody),G3&&G3(e),_e=e)},Ce=u5({},["mi","mo","mn","ms","mtext"]),we=u5({},["foreignobject","desc","title","annotation-xml"]),ye=u5({},f5);u5(ye,_5),u5(ye,v5);var Se=u5({},b5);u5(Se,C5);var xe=function(e){var t=C(e);t&&t.tagName||(t={namespaceURI:pe,tagName:"template"});var i=o5(e.tagName),n=o5(t.tagName);if(e.namespaceURI===ge)return t.namespaceURI===pe?"svg"===i:t.namespaceURI===ue?"svg"===i&&("annotation-xml"===n||Ce[n]):Boolean(ye[i]);if(e.namespaceURI===ue)return t.namespaceURI===pe?"math"===i:t.namespaceURI===ge?"math"===i&&we[n]:Boolean(Se[i]);if(e.namespaceURI===pe){if(t.namespaceURI===ge&&!we[n])return!1;if(t.namespaceURI===ue&&!Ce[n])return!1;var o=u5({},["title","style","font","a","script"]);return!Se[i]&&(o[i]||!ye[i])}return!1},ke=function(e){n5(i.removed,{element:e});try{e.parentNode.removeChild(e)}catch(Pe){try{e.outerHTML=S}catch(t){e.remove()}}},Le=function(e,t){try{n5(i.removed,{attribute:t.getAttributeNode(e),from:t})}catch(Pe){n5(i.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e&&!H[e])if(Q||J)try{ke(t)}catch(Pe){}else try{t.setAttribute(e,"")}catch(Pe){}},De=function(e){var t=void 0,i=void 0;if(X)e="<remove></remove>"+e;else{var n=s5(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(Pe){}if(!t||!t.documentElement){t=k.createDocument(me,"template",null);try{t.documentElement.innerHTML=fe?"":s}catch(Pe){}}var r=t.body||t.documentElement;return e&&i&&r.insertBefore(o.createTextNode(i),r.childNodes[0]||null),me===pe?E.call(t,Z?"html":"body")[0]:Z?t.documentElement:r},Ee=function(e){return L.call(e.ownerDocument||e,e,d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT,null,!1)},Ne=function(e){return!(e instanceof u||e instanceof g)&&!("string"==typeof e.nodeName&&"string"==typeof e.textContent&&"function"==typeof e.removeChild&&e.attributes instanceof c&&"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":O5(a))?e instanceof a:e&&"object"===(void 0===e?"undefined":O5(e))&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName},Te=function(e,t,n){T[e]&&t5(T[e],(function(e){e.call(i,t,n,_e)}))},Me=function(e){var t=void 0;if(Te("beforeSanitizeElements",e,null),Ne(e))return ke(e),!0;if(s5(e.nodeName,/[\u0080-\uFFFF]/))return ke(e),!0;var n=o5(e.nodeName);if(Te("uponSanitizeElement",e,{tagName:n,allowedTags:V}),!Ie(e.firstElementChild)&&(!Ie(e.content)||!Ie(e.content.firstElementChild))&&d5(/<[/\w]/g,e.innerHTML)&&d5(/<[/\w]/g,e.textContent))return ke(e),!0;if("select"===n&&d5(/<template/i,e.innerHTML))return ke(e),!0;if(!V[n]||j[n]){if(ne&&!re[n]){var o=C(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&&!xe(e)?(ke(e),!0):"noscript"!==n&&"noembed"!==n||!d5(/<\/no(script|embed)/i,e.innerHTML)?(G&&3===e.nodeType&&(t=e.textContent,t=r5(t,M," "),t=r5(t,O," "),e.textContent!==t&&(n5(i.removed,{element:e.cloneNode()}),e.textContent=t)),Te("afterSanitizeElements",e,null),!1):(ke(e),!0)},Oe=function(e,t,i){if(ie&&("id"===t||"name"===t)&&(i in o||i in ve))return!1;if(K&&!U[t]&&d5(A,t));else if($&&d5(R,t));else{if(!H[t]||U[t])return!1;if(he[t]);else if(d5(B,r5(i,F,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==a5(i,"data:")||!le[e]){if(q&&!d5(P,r5(i,F,"")));else if(i)return!1}else;}return!0},Ae=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:H};for(s=r.length;s--;){var l=t=r[s],d=l.name,h=l.namespaceURI;if(n=l5(t.value),o=o5(d),a.attrName=o,a.attrValue=n,a.keepAttr=!0,a.forceKeepAttr=void 0,Te("uponSanitizeAttribute",e,a),n=a.attrValue,!a.forceKeepAttr&&(Le(d,e),a.keepAttr))if(d5(/\/>/i,n))Le(d,e);else{G&&(n=r5(n,M," "),n=r5(n,O," "));var c=e.nodeName.toLowerCase();if(Oe(c,o,n))try{h?e.setAttributeNS(h,d,n):e.setAttribute(d,n),i5(i.removed)}catch(Pe){}}}Te("afterSanitizeAttributes",e,null)}},Re=function e(t){var i=void 0,n=Ee(t);for(Te("beforeSanitizeShadowDOM",t,null);i=n.nextNode();)Te("uponSanitizeShadowNode",i,null),Me(i)||(i.content instanceof s&&e(i.content),Ae(i));Te("afterSanitizeShadowDOM",t,null)};return i.sanitize=function(e,o){var r=void 0,l=void 0,d=void 0,h=void 0,c=void 0;if((fe=!e)&&(e="\x3c!--\x3e"),"string"!=typeof e&&!Ie(e)){if("function"!=typeof e.toString)throw h5("toString is not a function");if("string"!=typeof(e=e.toString()))throw h5("dirty is not a string, aborting")}if(!i.isSupported){if("object"===O5(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=De("\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=De(e)))return Q?null:S}r&&X&&ke(r.firstChild);for(var u=Ee(oe?e:r);d=u.nextNode();)3===d.nodeType&&d===h||Me(d)||(d.content instanceof s&&Re(d.content),Ae(d),h=d);if(h=null,oe)return e;if(Q){if(J)for(c=D.call(r.ownerDocument);r.firstChild;)c.appendChild(r.firstChild);else c=r;return ee&&(c=N.call(n,c,!0)),c}var g=Z?r.outerHTML:r.innerHTML;return G&&(g=r5(g,M," "),g=r5(g,O," ")),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=o5(e),o=o5(t);return Oe(n,o,i)},i.addHook=function(e,t){"function"==typeof t&&(T[e]=T[e]||[],n5(T[e],t))},i.removeHook=function(e){T[e]&&i5(T[e])},i.removeHooks=function(e){T[e]&&(T[e]=[])},i.removeAllHooks=function(){T={}},i}();F5.version,F5.isSupported;const B5=F5.sanitize;F5.setConfig,F5.clearConfig,F5.isValidAttribute;const V5=F5.addHook,W5=F5.removeHook;F5.removeHooks,F5.removeAllHooks;let H5={};!function(){function e(e,t){t(H5)}var t,i;e.amd=!0,t=this,i=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={"&":"&","<":"<",">":">",'"':""","'":"'"},h=function(e){return d[e]};function c(e,t){if(t){if(s.test(e))return e.replace(r,h)}else if(a.test(e))return e.replace(l,h);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]||(C.test(e)?b[" "+e]=e+"/":b[" "+e]=L(e,"/",!0));var i=-1===(e=b[" "+e]).indexOf(":");return"//"===t.substring(0,2)?i?t:e.replace(w,"$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={},C=/^[^:]+:\/*[^/]*$/,w=/^([^:]+:)[\s\S]*$/,y=/^([^:]+:\/*[^/]*)[\s\S]*$/,S={exec:function(){}};function x(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 L(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 D(e){e&&e.sanitize&&e.silent}function E(e,t){if(t<1)return"";for(var i="";t>1;)1&t&&(i+=e),t>>=1,e+=e;return i+e}function N(e,t,i,n){var o=t.href,s=t.title?c(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:c(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:L(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=L(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,h,c,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),h=t[2].split("\n",1)[0],c=e.split("\n",1)[0],this.options.pedantic?(r=2,g=h.trimLeft()):(r=(r=t[2].search(/[^ ]/))>4?1:r,g=h.slice(r),r+=t[1].length),l=!1,!h&&/^ *$/.test(c)&&(i+=c+"\n",e=e.substring(c.length+1),p=!0),!p)for(var b=new RegExp("^ {0,"+Math.min(3,r-1)+"}(?:[*+-]|\\d{1,9}[.)])");e&&(h=u=e.split("\n",1)[0],this.options.pedantic&&(h=h.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),!b.test(h));){if(h.search(/[^ ]/)>=r||!h.trim())g+="\n"+h.slice(r);else{if(l)break;g+="\n"+h}l||h.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 C=_.items.length;for(a=0;a<C;a++){this.lexer.state.top=!1,_.items[a].tokens=this.lexer.blockTokens(_.items[a].text,[]);var w=_.items[a].tokens.filter((function(e){return"space"===e.type})),y=w.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&&w.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]):c(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:c(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]):c(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=L(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)),N(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 N(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,h="*"===n[0][0]?this.rules.inline.emStrong.rDelimAst:this.rules.inline.emStrong.rDelimUnd;for(h.lastIndex=0,t=t.slice(-1*e.length+a);null!=(n=h.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 c=e.slice(1,a+n.index+r);return{type:"em",raw:e.slice(0,a+n.index+r+1),text:c,tokens:this.lexer.inlineTokens(c,[])}}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=c(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=c(this.options.mangle?t(o[1]):o[1])):i=c(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=c(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=c(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]):c(n[0]):n[0]:c(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:S,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=x({},T),T.gfm=x({},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=x({},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:S,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:S,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:S,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,punctuation:/^([\spunctuation])/};function O(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 A(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=x({},M),M.pedantic=x({},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=x({},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=x({},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 h=Object.keys(this.tokens.links);if(h.length>0)for(;null!=(r=this.tokenizer.rules.inline.reflinkSearch.exec(d));)h.includes(r[0].slice(r[0].lastIndexOf("[")+1,-1))&&(d=d.slice(0,r.index)+"["+E("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)+"["+E("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,A))e=e.substring(i.raw.length),t.push(i);else if(this.state.inLink||!(i=this.tokenizer.url(e,A))){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,O))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 c="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent)break;throw new Error(c)}}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+c(n,!0)+'">'+(i?e:c(e,!0))+"</code></pre>\n":"<pre><code>"+(i?e:c(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="'+c(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,h,c,u,p,m,f,_,v,b,C,w,y="",S=e.length;for(i=0;i<S;i++)if(c=e[i],!(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[c.type])||!1===(w=this.options.extensions.renderers[c.type].call({parser:this},c))&&["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(c.type))switch(c.type){case"space":continue;case"hr":y+=this.renderer.hr();continue;case"heading":y+=this.renderer.heading(this.parseInline(c.tokens),c.depth,g(this.parseInline(c.tokens,this.textRenderer)),this.slugger);continue;case"code":y+=this.renderer.code(c.text,c.lang,c.escaped);continue;case"table":for(d="",l="",s=c.header.length,n=0;n<s;n++)l+=this.renderer.tablecell(this.parseInline(c.header[n].tokens),{header:!0,align:c.align[n]});for(d+=this.renderer.tablerow(l),h="",s=c.rows.length,n=0;n<s;n++){for(l="",r=(a=c.rows[n]).length,o=0;o<r;o++)l+=this.renderer.tablecell(this.parseInline(a[o].tokens),{header:!1,align:c.align[o]});h+=this.renderer.tablerow(l)}y+=this.renderer.table(d,h);continue;case"blockquote":h=this.parse(c.tokens),y+=this.renderer.blockquote(h);continue;case"list":for(u=c.ordered,p=c.start,m=c.loose,s=c.items.length,h="",n=0;n<s;n++)v=(_=c.items[n]).checked,b=_.task,f="",_.task&&(C=this.renderer.checkbox(v),m?_.tokens.length>0&&"paragraph"===_.tokens[0].type?(_.tokens[0].text=C+" "+_.tokens[0].text,_.tokens[0].tokens&&_.tokens[0].tokens.length>0&&"text"===_.tokens[0].tokens[0].type&&(_.tokens[0].tokens[0].text=C+" "+_.tokens[0].tokens[0].text)):_.tokens.unshift({type:"text",text:C}):f+=C),f+=this.parse(_.tokens,m),h+=this.renderer.listitem(f,b,v);y+=this.renderer.list(h,u,p);continue;case"html":y+=this.renderer.html(c.text);continue;case"paragraph":y+=this.renderer.paragraph(this.parseInline(c.tokens));continue;case"text":for(h=c.tokens?this.parseInline(c.tokens):c.text;i+1<S&&"text"===e[i+1].type;)h+="\n"+((c=e[++i]).tokens?this.parseInline(c.tokens):c.text);y+=t?this.renderer.paragraph(h):h;continue;default:var x='Token with "'+c.type+'" type was not found.';if(this.options.silent)return;throw new Error(x)}else y+=w||"";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),D(t=x({},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>"+c(l.message+"",!0)+"</pre>";throw l}}W.options=W.setOptions=function(t){var i;return x(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=x.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,h=n(a.value);!(d=h()).done;){var c=d.value;W.walkTokens(c.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");D(t=x({},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>"+c(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 H=W.options,z=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=H,e.parse=K,e.parseInline=$,e.parser=q,e.setOptions=z,e.use=j,e.walkTokens=U,Object.defineProperty(e,"__esModule",{value:!0})},"object"==typeof exports&&"undefined"!=typeof module?i(exports):e.amd?e(0,i):i((t="undefined"!=typeof globalThis?globalThis:t||self).marked={})}();var z5=H5||exports;function j5(e,t={},i={}){var n;const o=new Cs;let s=!1;const r=o.add(new as),a=rU(t),l=function(t){let i;try{i=Vz(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(IC.data+":")?t:(o||(o=Ps.parse(t)),AC.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 h;const c=new Promise((e=>h=e)),u=new z5.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=SU(n)),t=d(t,!1),e.baseUri&&(t=U5(Ps.from(e.baseUri),t)),i="string"==typeof i?SU(i):"",!(t=SU(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=Yj.nextId();return Tv(Promise.all([n,c]),r.token).then((e=>{var i;if(!s&&e){const n=a.querySelector(`div[data-code="${o}"]`);n&&Dw(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 zF(a,"click")),n=t.actionHandler.disposables.add(new zF(a,"auxclick"));t.actionHandler.disposables.add(ds.any(i.event,n.event)((i=>{const n=new EC(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=U5(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=g.replace(_z,(e=>`\\${e}`)));let p=z5.parse(g,i);if(e.supportThemeIcons){p=Hj(p).map((e=>"string"==typeof e?e:e.outerHTML)).join("")}const m=(new DOMParser).parseFromString($5(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=U5(Ps.from(e.baseUri),o))}catch(n){}t.src=d(o,!0)}})),a.innerHTML=$5(e,m.body.innerHTML),h(),t.asyncRenderCallback)for(const f of a.getElementsByTagName("img")){const e=o.add(BC(f,"load",(()=>{e.dispose(),t.asyncRenderCallback()})))}return{element:a,dispose:()=>{s=!0,r.cancel(),o.dispose()}}}function U5(e,t){return/^\w[\w\d+.-]*:/.test(t)?t:e.path.endsWith("/")?YA(e,t).toString():YA(qA(e),t).toString()}function $5(e,t){const{config:i,allowedSchemes:n}=function(e){const t=[IC.http,IC.https,IC.mailto,IC.data,IC.file,IC.vscodeFileResource,IC.vscodeRemote,IC.vscodeRemoteResource];e.isTrusted&&t.push(IC.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);V5("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");V5("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 B5(t,Object.assign(Object.assign({},i),{RETURN_TRUSTED_TYPE:!0}))}finally{W5("uponSanitizeAttribute"),W5("afterSanitizeAttributes")}}var K5,q5=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},G5=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}},Z5=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 Y5=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 Cs;return{element:n.add(j5(e,Object.assign(Object.assign({},this._getRenderOptions(e,n)),t),i)).element,dispose:()=>n.dispose()}}_getRenderOptions(t,i){return{codeBlockRenderer:(t,i)=>Z5(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="plaintext");const a=yield function(e,t,i){return mO(this,void 0,void 0,(function*(){if(!i)return vO(t,e.languageIdCodec,fO);const n=yield Es.getOrCreate(i);return vO(t,e.languageIdCodec,n||fO)}))}(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){Kf(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}}}};Y5._ttpTokenizer=null===(K5=window.trustedTypes)||void 0===K5?void 0:K5.createPolicy("tokenizeToString",{createHTML:e=>e}),Y5=q5([G5(1,rv),G5(2,Uz)],Y5);const X5=Mw;class Q5 extends Uo{constructor(e,t,i=$z){super(),this._renderDisposeables=this._register(new Cs),this._editor=e,this._isVisible=!1,this._messages=[],this._hover=this._register(new O2),this._hover.containerDomNode.classList.toggle("hidden",!this._isVisible),this._markdownRenderer=this._register(new Y5({editor:this._editor},t,i)),this._computer=new J5(this._editor),this._hoverOperation=this._register(new B2(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 Q5.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=X5("div.hover-row.markdown-hover"),t=Lw(e,X5("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`}}Q5.ID="editor.contrib.modesGlyphHoverWidget";class J5{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&&!wU(t)&&i.push(...Ml(t).map(e))}return i}}var e4=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 t4{constructor(e,t,i){this.provider=e,this.hover=t,this.ordinal=i}}function i4(e,t,i,n){const o=e.ordered(t).map(((e,o)=>function(e,t,i,n,o){return e4(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 t4(e,s,t)}catch(s){Ta(s)}}))}(e,o,t,i,n)));return Gv.fromPromises(o).coalesce()}lS("_executeHoverProvider",((e,t,i)=>function(e,t,i,n){return i4(e,t,i,n).map((e=>e.hover)).toPromise()}(e.get(lb).hoverProvider,t,i,Ia.None)));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)}};const s4=Mw;class r4{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 a4=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 r4(this,e.range,[(new CU).appendText($m(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 r4(this,e.range,[{value:$m(0,"Tokenization is skipped for long lines for performance reasons. This can be configured via `editor.maxTokenizationLineLength`.")}],r++));for(const h of t){const t=h.range.startLineNumber===n?h.range.startColumn:1,i=h.range.endLineNumber===n?h.range.endColumn:o,a=h.options.hoverMessage;if(!a||wU(a))continue;const l=new qo(e.range.startLineNumber,t,e.range.startLineNumber,i);s.push(new r4(this,l,Ml(a),r++))}return s}computeAsync(e,t,i){if(!this._editor.hasModel()||1!==e.type)return Gv.EMPTY;const n=this._editor.getModel();if(!this._languageFeaturesService.hoverProvider.has(n))return Gv.EMPTY;const o=new er(e.range.startLineNumber,e.range.startColumn);return i4(this._languageFeaturesService.hoverProvider,n,o,i).filter((e=>!wU(e.hover.contents))).map((t=>{const i=t.hover.range?qo.lift(t.hover.range):e.range;return new r4(this,i,t.hover.contents,t.ordinal)}))}renderHoverParts(e,t){return l4(e,t,this._editor,this._languageService,this._openerService)}};function l4(e,t,i,n,o){t.sort(((e,t)=>e.ordinal-t.ordinal));const s=new Cs;for(const r of t)for(const t of r.contents){if(wU(t))continue;const r=s4("div.hover-row.markdown-hover"),a=Lw(r,s4("div.hover-contents")),l=s.add(new Y5({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}a4=n4([o4(1,rv),o4(2,Uz),o4(3,ev),o4(4,lb)],a4);var d4=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},h4=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};class c4{constructor(e,t,i){this.marker=e,this.index=t,this.total=i}}let u4=class{constructor(e,t,i){this._markerService=t,this._configService=i,this._onDidChange=new $o,this.onDidChange=this._onDidChange.event,this._dispoables=new Cs,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=Hr(e.resource.toString(),t.resource.toString());return 0===i&&(i="position"===n?qo.compareRangesUsingStarts(e,t)||ej.compare(e.severity,t.severity):ej.compare(e.severity,t.severity)||qo.compareRangesUsingStarts(e,t)),i},s=()=>{this._markers=this._markerService.read({resource:Ps.isUri(e)?e:void 0,severities:ej.Error|ej.Warning|ej.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 c4(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)=>Hr(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 c4(this._markers[i],i+1,this._markers.length)}};u4=d4([h4(1,nj),h4(2,ev)],u4);const g4=s_("IMarkerNavigationService");let p4=class{constructor(e,t){this._markerService=e,this._configService=t,this._provider=new Hs}getMarkerList(e){for(let t of this._provider){const i=t.getMarkerList(e);if(i)return i}return new u4(e,this._markerService,this._configService)}};p4=d4([h4(0,nj),h4(1,ev)],p4),dv(g4,p4,!0);var m4;(m4||(m4={})).className=function(e){switch(e){case oF.Ignore:return"severity-ignore "+br.info.classNames;case oF.Info:return br.info.classNames;case oF.Warning:return br.warning.classNames;case oF.Error:return br.error.classNames;default:return""}},zy(((e,t)=>{const i=e.getColor(nD);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(oD);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(sD);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 f4=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},_4=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};class v4{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 Cs,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(WC(this._relatedBlock,"click",(e=>{e.preventDefault();const t=this._relatedDiagnostics.get(e.target);t&&i(t)}))),this._scrollable=new nT(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 c of r)this._longestLineLength=Math.max(c.length+s,this._longestLineLength);RC(this._messageBlock),this._messageBlock.setAttribute("aria-label",this.getAriaLabel(e)),this._editor.applyFontInfo(this._messageBlock);let a=this._messageBlock;for(const c of r)a=document.createElement("div"),a.innerText=c,""===c&&(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=Mw("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()};Lw(this._codeLink,Mw("span")).innerText=o.value,e.appendChild(this._codeLink)}}if(RC(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=`${x1(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),h=l.lineHeight*this._lines;this._scrollable.setScrollDimensions({scrollWidth:d,scrollHeight:h})}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 ej.Error:t=$m(0,"Error");break;case ej.Warning:t=$m(0,"Warning");break;case ej.Info:t=$m(0,"Info");break;case ej.Hint:t=$m(0,"Hint")}let i=$m(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 b4=class e extends u1{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 Cs,this._onDidSelectRelatedInformation=new $o,this.onDidSelectRelatedInformation=this._onDidSelectRelatedInformation.event,this._severity=ej.Warning,this._backgroundColor=QS.white,this._applyTheme(t.getColorTheme()),this._callOnDispose.add(t.onDidColorThemeChange(this._applyTheme.bind(this))),this.create()}_applyTheme(e){this._backgroundColor=e.getColor(N4);let t=S4,i=x4;this._severity===ej.Warning?(t=k4,i=L4):this._severity===ej.Info&&(t=D4,i=E4);const n=e.getColor(t),o=e.getColor(i);this.style({arrowColor:n,frameColor:n,headerBackgroundColor:o,primaryHeadingColor:e.getColor(p1),secondaryHeadingColor:e.getColor(m1)})}_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);e1(n,void 0,i),this._actionbarWidget.push(i,{label:!1,icon:!0,index:0}),n.dispose()}_fillTitleIcon(e){this._icon=Lw(e,Mw(""))}_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 v4(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=$m(0,i>1?"{0} of {1} problems":"{0} of {1} problem",t,i);this.setTitle($A(r.uri),e)}this._icon.className=`codicon ${m4.className(ej.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()}};b4.TitleMenu=new qy("gotoErrorTitleMenu"),b4=f4([_4(1,Ry),_4(2,Uz),_4(3,Gy),_4(4,n_),_4(5,Dy),_4(6,xW)],b4);let C4=dD($x,Kx),w4=dD(Gx,Zx),y4=dD(Xx,Qx);const S4=ox("editorMarkerNavigationError.background",{dark:C4,light:C4,hc:dx},$m(0,"Editor marker navigation widget error color.")),x4=ox("editorMarkerNavigationError.headerBackground",{dark:lD(S4,.1),light:lD(S4,.1),hc:null},$m(0,"Editor marker navigation widget error heading background.")),k4=ox("editorMarkerNavigationWarning.background",{dark:w4,light:w4,hc:dx},$m(0,"Editor marker navigation widget warning color.")),L4=ox("editorMarkerNavigationWarning.headerBackground",{dark:lD(k4,.1),light:lD(k4,.1),hc:"#0C141F"},$m(0,"Editor marker navigation widget warning heading background.")),D4=ox("editorMarkerNavigationInfo.background",{dark:y4,light:y4,hc:dx},$m(0,"Editor marker navigation widget info color.")),E4=ox("editorMarkerNavigationInfo.headerBackground",{dark:lD(D4,.1),light:lD(D4,.1),hc:null},$m(0,"Editor marker navigation widget info heading background.")),N4=ox("editorMarkerNavigation.background",{dark:tk,light:tk,hc:tk},$m(0,"Editor marker navigation widget background."));var I4=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},T4=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}},M4=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 O4=class e{constructor(e,t,i,n,o){this._markerNavigationService=t,this._contextKeyService=i,this._editorService=n,this._instantiationService=o,this._sessionDispoables=new Cs,this._editor=e,this._widgetVisible=F4.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(b4,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 M4(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)}}))}};O4.ID="editor.contrib.markerController",O4=I4([T4(1,g4),T4(2,Dy),T4(3,r_),T4(4,n_)],O4);class A4 extends rS{constructor(e,t,i){super(i),this._next=e,this._multiFile=t}run(e,t){var i;return M4(this,void 0,void 0,(function*(){t.hasModel()&&(null===(i=O4.get(t))||void 0===i||i.nagivate(this._next,this._multiFile))}))}}class R4 extends A4{constructor(){super(!0,!1,{id:R4.ID,label:R4.LABEL,alias:"Go to Next Problem (Error, Warning, Info)",precondition:void 0,kbOpts:{kbExpr:dI.focus,primary:578,weight:100},menuOpts:{menuId:b4.TitleMenu,title:R4.LABEL,icon:dB("marker-navigation-next",br.arrowDown,$m(0,"Icon for goto next marker.")),group:"navigation",order:1}})}}R4.ID="editor.action.marker.next",R4.LABEL=$m(0,"Go to Next Problem (Error, Warning, Info)");class P4 extends A4{constructor(){super(!1,!1,{id:P4.ID,label:P4.LABEL,alias:"Go to Previous Problem (Error, Warning, Info)",precondition:void 0,kbOpts:{kbExpr:dI.focus,primary:1602,weight:100},menuOpts:{menuId:b4.TitleMenu,title:P4.LABEL,icon:dB("marker-navigation-previous",br.arrowUp,$m(0,"Icon for goto previous marker.")),group:"navigation",order:2}})}}P4.ID="editor.action.marker.prev",P4.LABEL=$m(0,"Go to Previous Problem (Error, Warning, Info)");gS(O4.ID,O4),hS(R4),hS(P4),hS(class extends A4{constructor(){super(!0,!0,{id:"editor.action.marker.nextInFiles",label:$m(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:dI.focus,primary:66,weight:100},menuOpts:{menuId:qy.MenubarGoMenu,title:$m(0,"Next &&Problem"),group:"6_problem_nav",order:1}})}}),hS(class extends A4{constructor(){super(!1,!0,{id:"editor.action.marker.prevInFiles",label:$m(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:dI.focus,primary:1090,weight:100},menuOpts:{menuId:qy.MenubarGoMenu,title:$m(0,"Previous &&Problem"),group:"6_problem_nav",order:2}})}});const F4=new Ly("markersNavigationVisible",!1);dS(new(sS.bindToContribution(O4.get))({id:"closeMarkersNavigation",precondition:F4,handler:e=>e.close(),kbOpts:{weight:150,kbExpr:dI.focus,primary:9,secondary:[1033]}}));var B4=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)}};const W4=Mw;class H4{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 z4={type:1,filter:{include:sJ.QuickFix}};let j4=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 H4(this,d,l))}return s}renderHoverParts(e,t){if(!t.length)return Uo.None;const i=new Cs;t.forEach((t=>e.fragment.appendChild(this.renderMarkerHover(t,i))));const n=1===t.length?t[0]:t.sort(((e,t)=>ej.compare(e.marker.severity,t.marker.severity)))[0];return this.renderMarkerStatusbar(e,n,i),i}renderMarkerHover(e,t){const i=W4("div.hover-row"),n=Lw(i,W4("div.marker.hover-contents")),{source:o,message:s,code:r,relatedInformation:a}=e.marker;this._editor.applyFontInfo(n);const l=Lw(n,W4("span"));if(l.style.whiteSpace="pre-wrap",l.innerText=s,o||r)if(r&&"string"!=typeof r){const e=W4("span");if(o){Lw(e,W4("span")).innerText=o}const i=Lw(e,W4("a.code-link"));i.setAttribute("href",r.target.toString()),t.add(BC(i,"click",(e=>{this._openerService.open(r.target,{allowCommands:!0}),e.preventDefault(),e.stopPropagation()})));Lw(i,W4("span")).innerText=r.value;const s=Lw(n,e);s.style.opacity="0.6",s.style.paddingLeft="6px"}else{const e=Lw(n,W4("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:h,startLineNumber:c,startColumn:u}of a){const e=Lw(n,W4("div"));e.style.marginTop="8px";const i=Lw(e,W4("a"));i.innerText=`${$A(h)}(${c}, ${u}): `,i.style.cursor="pointer",t.add(BC(i,"click",(e=>{e.stopPropagation(),e.preventDefault(),this._openerService&&this._openerService.open(h,{fromUserGesture:!0,editorOptions:{selection:{startLineNumber:c,startColumn:u}}}).catch(Jo)})));const o=Lw(e,W4("span"));o.innerText=d,this._editor.applyFontInfo(o)}return i}renderMarkerStatusbar(e,t,i){if(t.marker.severity!==ej.Error&&t.marker.severity!==ej.Warning&&t.marker.severity!==ej.Info||e.statusBar.addAction({label:$m(0,"View Problem"),commandId:R4.ID,run:()=>{var i;e.hide(),null===(i=O4.get(this._editor))||void 0===i||i.showAtMarker(t.marker),this._editor.focus()}}),!this._editor.getOption(81)){const n=e.statusBar.append(W4("div"));this.recentMarkerCodeActionsInfo&&(ij.makeKey(this.recentMarkerCodeActionsInfo.marker)===ij.makeKey(t.marker)?this.recentMarkerCodeActionsInfo.hasCodeActions||(n.textContent=$m(0,"No quick fixes available")):this.recentMarkerCodeActionsInfo=void 0);const o=this.recentMarkerCodeActionsInfo&&!this.recentMarkerCodeActionsInfo.hasCodeActions?Uo.None:i.add(Fv((()=>n.textContent=$m(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=$m(0,"No quick fixes available"));n.style.display="none";let r=!1;i.add(es((()=>{r||s.dispose()}))),e.statusBar.addAction({label:$m(0,"Quick Fix..."),commandId:YJ.Id,run:t=>{r=!0;const i=qJ.get(this._editor),n=nw(t);e.hide(),null==i||i.showCodeActions(z4,s,{x:n.left+6,y:n.top+n.height+6})}})}),Jo)}}getCodeActions(e){return Iv((t=>uJ(this._languageFeaturesService.codeActionProvider,this._editor.getModel(),new qo(e.startLineNumber,e.startColumn,e.endLineNumber,e.endColumn),z4,TB.None,t)))}};j4=B4([V4(1,Gw),V4(2,Uz),V4(3,lb)],j4),zy(((e,t)=>{const i=e.getColor(cx);i&&t.addRule(`.monaco-hover .hover-contents a.code-link span { color: ${i}; }`);const n=e.getColor(ux);n&&t.addRule(`.monaco-hover .hover-contents a.code-link span:hover { color: ${n}; }`)}));var U4=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},$4=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};let K4=class e{constructor(e,t,i,n,o){this._editor=e,this._instantiationService=t,this._openerService=i,this._languageService=n,this._toUnhook=new Cs,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!==W3.ID?12===t.type&&t.detail===Q5.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===W3.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===W3.ID&&(null===(n=this._contentWidget)||void 0===n?void 0:n.isColorPickerVisible()))return;if(this._isHoverSticky&&12===r.type&&r.detail===Q5.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 Q5(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(F3,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()}};K4.ID="editor.contrib.hover",K4=U4([$4(1,n_),$4(2,Uz),$4(3,rv),$4(4,Dy)],K4);gS(K4.ID,K4),hS(class extends rS{constructor(){super({id:"editor.action.showHover",label:$m(0,"Show Hover"),alias:"Show Hover",precondition:void 0,kbOpts:{kbExpr:dI.editorTextFocus,primary:Al(2089,2087),weight:100}})}run(e,t){if(!t.hasModel())return;let i=K4.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)}}),hS(class extends rS{constructor(){super({id:"editor.action.showDefinitionPreviewHover",label:$m(0,"Show Definition Preview Hover"),alias:"Show Definition Preview Hover",precondition:void 0})}run(e,t){const i=K4.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(a4),H2.register(j4),zy(((e,t)=>{const i=e.getColor(Dk);i&&t.addRule(`.monaco-editor .hoverHighlight { background-color: ${i}; }`);const n=e.getColor(Ek);n&&t.addRule(`.monaco-editor .monaco-hover { background-color: ${n}; }`);const o=e.getColor(Ik);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(cx);s&&t.addRule(`.monaco-editor .monaco-hover a { color: ${s}; }`);const r=e.getColor(ux);r&&t.addRule(`.monaco-editor .monaco-hover a:hover { color: ${r}; }`);const a=e.getColor(Nk);a&&t.addRule(`.monaco-editor .monaco-hover { color: ${a}; }`);const l=e.getColor(Tk);l&&t.addRule(`.monaco-editor .monaco-hover .hover-row .actions { background-color: ${l}; }`);const d=e.getColor(gx);d&&t.addRule(`.monaco-editor .monaco-hover code { background-color: ${d}; }`)}));class q4 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!==v0)return;if(!t.range)return;const i=this._editor.getContribution(K4.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)}}}q4.ID="editor.contrib.colorContribution",gS(q4.ID,q4),H2.register(O0);class G4{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,h=o.getLineContent(r),c=o.getLineContent(l);let u,g=h.lastIndexOf(t,a-1+t.length),p=c.indexOf(i,d-1-i.length);if(-1!==g&&-1!==p)if(r===l){h.substring(g+t.length,p).indexOf(i)>=0&&(g=-1,p=-1)}else{const e=h.substring(g+t.length),n=c.substring(0,p);(e.indexOf(i)>=0||n.indexOf(i)>=0)&&(g=-1,p=-1)}-1!==g&&-1!==p?(n&&g+t.length<h.length&&32===h.charCodeAt(g+t.length)&&(t+=" "),n&&p>0&&32===c.charCodeAt(p-1)&&(i=" "+i,p-=1),u=G4._createRemoveBlockCommentOperations(new qo(r,g+t.length+1,l,p+1),t,i)):(u=G4._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(oW.delete(new qo(e.startLineNumber,e.startColumn-t.length,e.endLineNumber,e.endColumn+i.length))):(n.push(oW.delete(new qo(e.startLineNumber,e.startColumn-t.length,e.startLineNumber,e.startColumn))),n.push(oW.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(oW.replace(new qo(e.startLineNumber,e.startColumn,e.endLineNumber,e.endColumn),t+" "+i)):(o.push(oW.insert(new er(e.startLineNumber,e.startColumn),t+(n?" ":""))),o.push(oW.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 Z4{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 h=0,c=n.length;h<c;h++){const a=n[h],c=o+h;if(c===o&&r){a.ignore=!0;continue}const u=i.getLineContent(c),g=Ss(u);if(-1!==g){if(d=!1,a.ignore=!1,a.commentStrOffset=g,l&&!G4._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=Z4._gatherPreflightCommentStrings(i,n,o,a);return null===l?{supported:!1}:Z4._analyzeLines(e,t,i,l,n,s,r,a)}_executeLineComments(e,t,i,n){let o;i.shouldRemoveComments?o=Z4._createRemoveLineCommentsOperations(i.lines,n.startLineNumber):(Z4._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?G4._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=bv.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=Ss(t);-1===n&&(n=t.length),a=G4._createAddBlockCommentOperations(new qo(i.startLineNumber,n+1,i.startLineNumber,t.length+1),s,r,this._insertSpace)}else a=G4._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=Z4._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(oW.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(oW.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=Z4.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=Z4.nextVisibleColumn(d,n,9===l.charCodeAt(o),1);t[a].commentStrOffset=d>r?o-1:o}}}class Y4 extends rS{constructor(e,t){super(t),this._type=e}run(e,t){const i=e.get(pv);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 Z4(i,l.selection,o.tabSize,this._type,s.insertSpace,s.ignoreEmptyLines,l.ignoreFirstLine));t.pushUndoStop(),t.executeCommands(this.id,n),t.pushUndoStop()}}hS(class extends Y4{constructor(){super(0,{id:"editor.action.commentLine",label:$m(0,"Toggle Line Comment"),alias:"Toggle Line Comment",precondition:dI.writable,kbOpts:{kbExpr:dI.editorTextFocus,primary:2133,weight:100},menuOpts:{menuId:qy.MenubarEditMenu,group:"5_insert",title:$m(0,"&&Toggle Line Comment"),order:1}})}}),hS(class extends Y4{constructor(){super(1,{id:"editor.action.addCommentLine",label:$m(0,"Add Line Comment"),alias:"Add Line Comment",precondition:dI.writable,kbOpts:{kbExpr:dI.editorTextFocus,primary:Al(2089,2081),weight:100}})}}),hS(class extends Y4{constructor(){super(2,{id:"editor.action.removeCommentLine",label:$m(0,"Remove Line Comment"),alias:"Remove Line Comment",precondition:dI.writable,kbOpts:{kbExpr:dI.editorTextFocus,primary:Al(2089,2099),weight:100}})}}),hS(class extends rS{constructor(){super({id:"editor.action.blockComment",label:$m(0,"Toggle Block Comment"),alias:"Toggle Block Comment",precondition:dI.writable,kbOpts:{kbExpr:dI.editorTextFocus,primary:1567,linux:{primary:3103},weight:100},menuOpts:{menuId:qy.MenubarEditMenu,group:"5_insert",title:$m(0,"Toggle &&Block Comment"),order:2}})}run(e,t){const i=e.get(pv);if(!t.hasModel())return;const n=t.getOption(19),o=[],s=t.getSelections();for(const r of s)o.push(new G4(r,n.insertSpace,i));t.pushUndoStop(),t.executeCommands(this.id,o),t.pushUndoStop()}});var X4=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},Q4=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};let J4=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 Cs,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&&pw(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?qy.SimpleEditorContext:qy.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 Yy){const t=this._getMenuActions(e,o.item.submenu);t.length>0&&(i.push(new ey(o.id,o.label,t)),n++)}else i.push(o),n++;n&&i.push(new Jw)}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=nw(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 oB(e,e,{label:!0,keybinding:t.getLabel(),isMenu:!0});const i=e;return"function"==typeof i.getActionViewItem?i.getActionViewItem():new oB(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()}};J4.ID="editor.contrib.contextmenu",J4=X4([Q4(1,DB),Q4(2,LB),Q4(3,Dy),Q4(4,uW),Q4(5,Gy)],J4);gS(J4.ID,J4),hS(class extends rS{constructor(){super({id:"editor.action.showContextMenu",label:$m(0,"Show Editor Context Menu"),alias:"Show Editor Context Menu",precondition:void 0,kbOpts:{kbExpr:dI.textInputFocus,primary:1092,weight:100}})}run(e,t){var i;null===(i=J4.get(t))||void 0===i||i.showContextMenu()}});class e6{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 t6{constructor(e,t,i){this.cursorState=e,this.scrollTop=t,this.scrollLeft=i}}class i6 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 e6(t.oldSelections);this._undoStack.length>0&&this._undoStack[this._undoStack.length-1].cursorState.equals(i)||(this._undoStack.push(new t6(i,e.getScrollTop(),e.getScrollLeft())),this._redoStack=[],this._undoStack.length>50&&this._undoStack.shift())})))}static get(e){return e.getContribution(i6.ID)}cursorUndo(){this._editor.hasModel()&&0!==this._undoStack.length&&(this._redoStack.push(new t6(new e6(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 t6(new e6(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}}i6.ID="editor.contrib.cursorUndoRedoController";gS(i6.ID,i6),hS(class extends rS{constructor(){super({id:"cursorUndo",label:$m(0,"Cursor Undo"),alias:"Cursor Undo",precondition:void 0,kbOpts:{kbExpr:dI.textInputFocus,primary:2099,weight:100}})}run(e,t,i){var n;null===(n=i6.get(t))||void 0===n||n.cursorUndo()}}),hS(class extends rS{constructor(){super({id:"cursorRedo",label:$m(0,"Cursor Redo"),alias:"Cursor Redo",precondition:void 0})}run(e,t,i){var n;null===(n=i6.get(t))||void 0===n||n.cursorRedo()}});class n6{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 o6(e){return Ho?e.altKey:e.ctrlKey}class s6 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)&&(o6(e)&&(this._modifierPressed=!0),this._mouseDown&&o6(e)&&this._editor.updateOptions({mouseStyle:"copy"}))}onEditorKeyUp(e){this._editor.getOption(31)&&!this._editor.getOption(18)&&(o6(e)&&(this._modifierPressed=!1),this._mouseDown&&e.keyCode===s6.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]}o6(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)||(o6(e.event)||this._modifierPressed)&&(this._dragSelection.getEndPosition().equals(t)||this._dragSelection.getStartPosition().equals(t)))&&(this._editor.pushUndoStop(),this._editor.executeCommand(s6.ID,new n6(this._dragSelection,t,o6(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:s6._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()}}s6.ID="editor.contrib.dragAndDrop",s6.TRIGGER_KEY_VALUE=Ho?6:5,s6._DECORATION_OPTIONS=RP.register({description:"dnd-target",className:"dnd-target"}),gS(s6.ID,s6);class r6{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===r6._FIND_MATCH_DECORATION||e===r6._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,r6._FIND_MATCH_DECORATION),this._highlightedDecorationId=null),null!==t&&(this._highlightedDecorationId=t,e.changeDecorationOptions(this._highlightedDecorationId,r6._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,r6._RANGE_HIGHLIGHT_DECORATION)}})),i}set(e,t){this._editor.changeDecorations((i=>{let n=r6._FIND_MATCH_DECORATION,o=[];if(e.length>1e3){n=r6._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:r6._FIND_MATCH_ONLY_OVERVIEW_DECORATION}),r=t.startLineNumber,a=t.endLineNumber)}o.push({range:new qo(r,1,a,1),options:r6._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,r6._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}}r6._CURRENT_FIND_MATCH_DECORATION=RP.register({description:"current-find-match",stickiness:1,zIndex:13,className:"currentFindMatch",showIfCollapsed:!0,overviewRuler:{color:By($L),position:aa.Center},minimap:{color:By(qL),position:Lr.Inline}}),r6._FIND_MATCH_DECORATION=RP.register({description:"find-match",stickiness:1,zIndex:10,className:"findMatch",showIfCollapsed:!0,overviewRuler:{color:By($L),position:aa.Center},minimap:{color:By(qL),position:Lr.Inline}}),r6._FIND_MATCH_NO_OVERVIEW_DECORATION=RP.register({description:"find-match-no-overview",stickiness:1,className:"findMatch",showIfCollapsed:!0}),r6._FIND_MATCH_ONLY_OVERVIEW_DECORATION=RP.register({description:"find-match-only-overview",stickiness:1,overviewRuler:{color:By($L),position:aa.Center}}),r6._RANGE_HIGHLIGHT_DECORATION=RP.register({description:"find-range-highlight",stickiness:1,className:"rangeHighlight",isWholeLine:!0}),r6._FIND_SCOPE_DECORATION=RP.register({description:"find-scope",className:"findScope",isWholeLine:!0});class a6{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 l6(e,t){if(e&&""!==e[0]){const i=d6(e,t,"-"),n=d6(e,t,"_");return i&&!n?h6(e,t,"-"):!i&&n?h6(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 d6(e,t,i){return-1!==e[0].indexOf(i)&&-1!==t.indexOf(i)&&e[0].split(i).length===t.split(i).length}function h6(e,t,i){const n=t.split(i),o=e[0].split(i);let s="";return n.forEach(((e,t)=>{s+=l6([o[t]],e)+i})),s.slice(0,-1)}class c6{constructor(e){this.staticValue=e,this.kind=0}}class u6{constructor(e){this.pieces=e,this.kind=1}}class g6{constructor(e){e&&0!==e.length?1===e.length&&null!==e[0].staticValue?this._state=new c6(e[0].staticValue):this._state=new u6(e):this._state=new c6("")}static fromStaticValue(e){return new g6([p6.staticValue(e)])}get hasReplacementPatterns(){return 1===this._state.kind}buildReplaceString(e,t){if(0===this._state.kind)return t?l6(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=g6._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 p6{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 p6(e,-1,null)}static caseOps(e,t){return new p6(null,e,t)}}class m6{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++]=p6.staticValue(this._currentStaticPiece),this._currentStaticPiece=""),this._result[this._resultLen++]=p6.caseOps(e,i),this._lastCharIndex=t}finalize(){return this.emitUnchanged(this._source.length),0!==this._currentStaticPiece.length&&(this._result[this._resultLen++]=p6.staticValue(this._currentStaticPiece),this._currentStaticPiece=""),new g6(this._result)}}const f6=new Ly("findWidgetVisible",!1);f6.toNegated();const _6=new Ly("findInputFocussed",!1),v6=new Ly("replaceInputFocussed",!1),b6={primary:545,mac:{primary:2593}},C6={primary:565,mac:{primary:2613}},w6={primary:560,mac:{primary:2608}},y6={primary:554,mac:{primary:2602}},S6={primary:558,mac:{primary:2606}},x6="actions.find",k6="actions.findWithSelection",L6="editor.actions.findWithArgs",D6="editor.action.nextMatchFindAction",E6="editor.action.previousMatchFindAction",N6="editor.action.nextSelectionMatchFindAction",I6="editor.action.previousSelectionMatchFindAction",T6="editor.action.startFindReplaceAction",M6="closeFindWidget",O6="toggleFindCaseSensitive",A6="toggleFindWholeWord",R6="toggleFindRegex",P6="toggleFindInSelection",F6="togglePreserveCase",B6="editor.action.replaceOne",V6="editor.action.replaceAll",W6="editor.action.selectAllMatches";class H6{constructor(e,t){this._toDispose=new Cs,this._editor=e,this._state=t,this._isDisposed=!1,this._startSearchingTimer=new Vv,this._decorations=new r6(e),this._toDispose.add(this._decorations),this._updateDecorationsScheduler=new Hv((()=>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,19999);this._decorations.set(n,i);const o=this._editor.getSelection();let s=this._decorations.getCurrentMatchesPosition(o);if(0===s&&n.length>0){const e=Hl(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()<19999){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=H6._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()<19999){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=H6._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),h=l.findNextMatch(this._state.searchString,d,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(117):null,t);return i&&h&&h.range.isEmpty()&&h.range.getStartPosition().equals(d)&&(d=this._nextSearchPosition(d),h=l.findNextMatch(this._state.searchString,d,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(117):null,t)),h?n||s.containsRange(h.range)?h:this._getNextMatch(h.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 g6(null);let t=[],i=new m6(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):g6.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 VN(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=>H6._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>=19999?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 jN(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 a6(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 z6 extends zI{constructor(e,t,i,n){super(),this._hideSoon=this._register(new Hv((()=>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(vx),s=n.getColorTheme().getColor(Cx),r=n.getColorTheme().getColor(bx);this.caseSensitive=this._register(new s3({appendTitle:this._keybindingLabelFor(O6),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 r3({appendTitle:this._keybindingLabelFor(A6),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 a3({appendTitle:this._keybindingLabelFor(R6),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(jC(this._domNode,(e=>this._onMouseOut()))),this._register(BC(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 z6.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(vx),inputActiveOptionForeground:e.getColor(Cx),inputActiveOptionBackground:e.getColor(bx)};this.caseSensitive.style(t),this.wholeWords.style(t),this.regex.style(t)}}function j6(e,t){return 1===e||2!==e&&t}z6.ID="editor.contrib.findOptionsWidget",zy(((e,t)=>{const i=e.getColor(nk);i&&t.addRule(`.monaco-editor .findOptionsWidget { background-color: ${i}; }`);const n=e.getColor(ok);n&&t.addRule(`.monaco-editor .findOptionsWidget { color: ${n}; }`);const o=e.getColor(px);o&&t.addRule(`.monaco-editor .findOptionsWidget { box-shadow: 0 0 8px 2px ${o}; }`);const s=e.getColor(dx);s&&t.addRule(`.monaco-editor .findOptionsWidget { border: 2px solid ${s}; }`)}));class U6 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 j6(this._isRegexOverride,this._isRegex)}get wholeWord(){return j6(this._wholeWordOverride,this._wholeWord)}get matchCase(){return j6(this._matchCaseOverride,this._matchCase)}get preserveCase(){return j6(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>=19999}}function $6(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 K6=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 q6=dB("find-selection",br.selection,$m(0,"Icon for 'Find in Selection' in the editor find widget.")),G6=dB("find-collapsed",br.chevronRight,$m(0,"Icon to indicate that the editor find widget is collapsed.")),Z6=dB("find-expanded",br.chevronDown,$m(0,"Icon to indicate that the editor find widget is expanded.")),Y6=dB("find-replace",br.replace,$m(0,"Icon for 'Replace' in the editor find widget.")),X6=dB("find-replace-all",br.replaceAll,$m(0,"Icon for 'Replace All' in the editor find widget.")),Q6=dB("find-previous-match",br.arrowUp,$m(0,"Icon for 'Find Previous' in the editor find widget.")),J6=dB("find-next-match",br.arrowDown,$m(0,"Icon for 'Find Next' in the editor find widget.")),e8=$m(0,"Find"),t8=$m(0,"Find"),i8=$m(0,"Previous Match"),n8=$m(0,"Next Match"),o8=$m(0,"Find in Selection"),s8=$m(0,"Close"),r8=$m(0,"Replace"),a8=$m(0,"Replace"),l8=$m(0,"Replace"),d8=$m(0,"Replace All"),h8=$m(0,"Toggle Replace"),c8=$m(0,"Only the first {0} results are highlighted, but all find operations work on the entire text.",19999),u8=$m(0,"{0} of {1}"),g8=$m(0,"No results");let p8=69;const m8=Ho?256:2048;class f8{constructor(e){this.afterLineNumber=e,this.heightInPx=33,this.suppressMouseDown=!1,this.domNode=document.createElement("div"),this.domNode.className="dock-find-viewzone"}}function _8(e,t,i){const n=!!t.match(/\n/);i&&n&&i.selectionStart>0&&e.stopPropagation()}function v8(e,t,i){const n=!!t.match(/\n/);i&&n&&i.selectionEnd<i.value.length&&e.stopPropagation()}class b8 extends zI{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("ctrlEnterReplaceAll.windows.donotask",0),this._isVisible=!1,this._isReplaceVisible=!1,this._ignoreChangeEvent=!1,this._updateHistoryDelayer=new Av(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 f8(0),this._showViewZone()),!e&&this._viewZone&&this._removeViewZone()}}))),this.updateAccessibilitySupport(),this._register(this._codeEditor.onDidChangeCursorSelection((()=>{this._isVisible&&this._updateToggleSelectionFindButton()}))),this._register(this._codeEditor.onDidFocusEditorWidget((()=>K6(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=_6.bindTo(s),this._findFocusTracker=this._register(kw(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=v6.bindTo(s),this._replaceFocusTracker=this._register(kw(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 f8(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 b8.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=sw(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=p8+"px",this._state.matchesCount>=19999?this._matchesCount.title=c8: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>=19999&&(t+="+");let i=String(this._state.matchesPosition);"0"===i&&(i="?"),e=Oa(u8,i,t)}else e=g8;this._matchesCount.appendChild(document.createTextNode(e)),$w(this._getAriaLabel(e,this._state.currentMatch,this._state.searchString)),p8=Math.max(p8,this._matchesCount.clientWidth)}_getAriaLabel(e,t,i){if(e===g8)return""===i?$m(0,"{0} found",e):$m(0,"{0} found for '{1}'",e,i);if(t){const n=$m(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 $m(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=nw(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=iw(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 f8(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(vx),inputActiveOptionBackground:e.getColor(bx),inputActiveOptionForeground:e.getColor(Cx),inputBackground:e.getColor(mx),inputForeground:e.getColor(fx),inputBorder:e.getColor(_x),inputValidationInfoBackground:e.getColor(wx),inputValidationInfoForeground:e.getColor(yx),inputValidationInfoBorder:e.getColor(Sx),inputValidationWarningBackground:e.getColor(xx),inputValidationWarningForeground:e.getColor(kx),inputValidationWarningBorder:e.getColor(Lx),inputValidationErrorBackground:e.getColor(Dx),inputValidationErrorForeground:e.getColor(Ex),inputValidationErrorBorder:e.getColor(Nx)};this._findInput.style(t),this._replaceInput.style(t),this._toggleSelectionFind.style(t)}_tryUpdateWidgetWidth(){if(!this._isVisible)return;if(!PC(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(sw(this._domNode)>419)return this._domNode.style.maxWidth=t-28-i-15+"px",void(this._replaceInput.width=sw(this._findInput.domNode))}if(447+i>=t&&(o=!0),447+i-p8>=t&&(s=!0),447+i-p8>=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=sw(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|m8)?(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)?_8(e,this._findInput.getValue(),this._findInput.domNode.querySelector("textarea")):e.equals(18)?v8(e,this._findInput.getValue(),this._findInput.domNode.querySelector("textarea")):void 0}_onReplaceInputKeyDown(e){return e.equals(3|m8)?(this._keybindingService.dispatchEvent(e,e.target)||(Rs&&Ts&&!this._ctrlEnterReplaceAllWarningPrompted&&(this._notificationService.info($m(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("ctrlEnterReplaceAll.windows.donotask",!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)?_8(e,this._replaceInput.inputBox.value,this._replaceInput.inputBox.element.querySelector("textarea")):e.equals(18)?v8(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 b3(null,this._contextViewProvider,{width:221,label:e8,placeholder:t8,appendCaseSensitiveLabel:this._keybindingLabelFor(O6),appendWholeWordsLabel:this._keybindingLabelFor(A6),appendRegexLabel:this._keybindingLabelFor(R6),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:()=>$6(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 C8({label:i8+this._keybindingLabelFor(E6),icon:Q6,onTrigger:()=>{this._codeEditor.getAction(E6).run().then(void 0,Jo)}})),this._nextBtn=this._register(new C8({label:n8+this._keybindingLabelFor(D6),icon:J6,onTrigger:()=>{this._codeEditor.getAction(D6).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 t3({icon:q6,title:o8+this._keybindingLabelFor(P6),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 C8({label:s8+this._keybindingLabelFor(M6),icon:gB,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 C3(null,void 0,{label:r8,placeholder:a8,appendPreserveCaseLabel:this._keybindingLabelFor(F6),history:[],flexibleHeight:true,flexibleWidth:true,flexibleMaxHeight:118,showHistoryHint:()=>$6(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 C8({label:l8+this._keybindingLabelFor(B6),icon:Y6,onTrigger:()=>{this._controller.replace()},onKeyDown:e=>{e.equals(1026)&&(this._closeBtn.focus(),e.preventDefault())}})),this._replaceAllBtn=this._register(new C8({label:d8+this._keybindingLabelFor(V6),icon:X6,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 C8({label:h8,className:"codicon toggle left",onTrigger:()=>{this._state.change({isReplaceRevealed:!this._isReplaceVisible},!1),this._isReplaceVisible&&(this._replaceInput.width=sw(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 QF(this._domNode,this,{orientation:0,size:2}),this._resized=!1;let o=419;this._register(this._resizeSash.onDidStart((()=>{o=sw(this._domNode)}))),this._register(this._resizeSash.onDidChange((e=>{this._resized=!0;let t=o+e.startX-e.currentX;if(t<419)return;t>(parseFloat(QC(this._domNode).maxWidth)||0)||(this._domNode.style.width=`${t}px`,this._isReplaceVisible&&(this._replaceInput.width=sw(this._findInput.domNode)),this._findInput.inputBox.layout(),this._tryUpdateHeight())}))),this._register(this._resizeSash.onDidReset((()=>{const e=sw(this._domNode);if(e<419)return;let t=419;if(!this._resized||419===e){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=sw(this._findInput.domNode)),this._findInput.inputBox.layout()})))}updateAccessibilitySupport(){const e=this._codeEditor.getOption(2);this._findInput.setFocusInputOnOptionClick(2!==e)}}b8.ID="editor.contrib.findWidget";class C8 extends zI{constructor(e){super(),this._opts=e;let t="button";this._opts.className&&(t=t+" "+this._opts.className),this._opts.icon&&(t=t+" "+Fy.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(...Fy.asClassNameArray(G6)),this._domNode.classList.add(...Fy.asClassNameArray(Z6))):(this._domNode.classList.remove(...Fy.asClassNameArray(Z6)),this._domNode.classList.add(...Fy.asClassNameArray(G6)))}}zy(((e,t)=>{const i=(e,i)=>{i&&t.addRule(`.monaco-editor ${e} { background-color: ${i}; }`)};i(".findMatch",e.getColor(yk)),i(".currentFindMatch",e.getColor(wk)),i(".findScope",e.getColor(Sk));i(".find-widget",e.getColor(nk));const n=e.getColor(px);n&&t.addRule(`.monaco-editor .find-widget { box-shadow: 0 0 8px 2px ${n}; }`);const o=e.getColor(kk);o&&t.addRule(`.monaco-editor .findMatch { border: 1px ${"hc"===e.type?"dotted":"solid"} ${o}; box-sizing: border-box; }`);const s=e.getColor(xk);s&&t.addRule(`.monaco-editor .currentFindMatch { border: 2px solid ${s}; padding: 1px; box-sizing: border-box; }`);const r=e.getColor(Lk);r&&t.addRule(`.monaco-editor .findScope { border: 1px ${"hc"===e.type?"dashed":"solid"} ${r}; }`);const a=e.getColor(dx);a&&t.addRule(`.monaco-editor .find-widget { border: 1px solid ${a}; }`);const l=e.getColor(ok);l&&t.addRule(`.monaco-editor .find-widget { color: ${l}; }`);const d=e.getColor(rx);d&&t.addRule(`.monaco-editor .find-widget.no-results .matchesCount { color: ${d}; }`);const h=e.getColor(rk);if(h)t.addRule(`.monaco-editor .find-widget .monaco-sash { background-color: ${h}; }`);else{const i=e.getColor(sk);i&&t.addRule(`.monaco-editor .find-widget .monaco-sash { background-color: ${i}; }`)}const c=e.getColor(FL);c&&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: ${c} !important;\n\t\t}\n\t`);const u=e.getColor(lx);u&&t.addRule(`.monaco-editor .find-widget .monaco-inputbox.synthetic-focus { outline-color: ${u}; }`)}));var w8=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},y8=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}},S8=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 x8(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 k8=class e extends Uo{constructor(e,t,i,n){super(),this._editor=e,this._findWidgetVisible=f6.bindTo(t),this._contextKeyService=t,this._storageService=i,this._clipboardService=n,this._updateHistoryDelayer=new Av(500),this._state=this._register(new U6),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!!_6.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 S8(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=x8(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=x8(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 H6(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 S8(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)}};k8.ID="editor.contrib.findController",k8=w8([y8(1,Dy),y8(2,tZ),y8(3,IB)],k8);let L8=class extends k8{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 S8(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 b8(this._editor,this,this._state,this._contextViewService,this._keybindingService,this._contextKeyService,this._themeService,this._storageService,this._notificationService)),this._findOptionsWidget=this._register(new z6(this._editor,this._state,this._keybindingService,this._themeService))}};L8=w8([y8(1,LB),y8(2,Dy),y8(3,uW),y8(4,Ry),y8(5,rF),y8(6,tZ),y8(7,IB)],L8);cS(new aS({id:x6,label:$m(0,"Find"),alias:"Find",precondition:ry.or(dI.focus,ry.has("editorIsOpen")),kbOpts:{kbExpr:null,primary:2084,weight:100},menuOpts:{menuId:qy.MenubarEditMenu,group:"3_find",title:$m(0,"&&Find"),order:1}})).addImplementation(0,((e,t,i)=>{const n=k8.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 D8={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:$m(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:$m(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:$m(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:$m(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 E8 extends rS{run(e,t){return S8(this,void 0,void 0,(function*(){const e=k8.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 N8 extends rS{run(e,t){return S8(this,void 0,void 0,(function*(){const e=k8.get(t);if(!e)return;const i="selection"===t.getOption(35).seedSearchStringFromSelection;let n=null;"never"!==t.getOption(35).seedSearchStringFromSelection&&(n=x8(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))}))}}cS(new aS({id:T6,label:$m(0,"Replace"),alias:"Replace",precondition:ry.or(dI.focus,ry.has("editorIsOpen")),kbOpts:{kbExpr:null,primary:2086,mac:{primary:2596},weight:100},menuOpts:{menuId:qy.MenubarEditMenu,group:"3_find",title:$m(0,"&&Replace"),order:2}})).addImplementation(0,((e,t,i)=>{if(!t.hasModel()||t.getOption(81))return!1;const n=k8.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})})),gS(k8.ID,L8),hS(class extends rS{constructor(){super({id:L6,label:$m(0,"Find With Arguments"),alias:"Find With Arguments",precondition:void 0,kbOpts:{kbExpr:null,primary:0,weight:100},description:D8})}run(e,t,i){return S8(this,void 0,void 0,(function*(){const e=k8.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)}}))}}),hS(class extends rS{constructor(){super({id:k6,label:$m(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 S8(this,void 0,void 0,(function*(){const e=k8.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))}))}}),hS(class extends E8{constructor(){super({id:D6,label:$m(0,"Find Next"),alias:"Find Next",precondition:void 0,kbOpts:[{kbExpr:dI.focus,primary:61,mac:{primary:2085,secondary:[61]},weight:100},{kbExpr:ry.and(dI.focus,_6),primary:3,weight:100}]})}_run(e){return!!e.moveToNextMatch()&&(e.editor.pushUndoStop(),!0)}}),hS(class extends E8{constructor(){super({id:E6,label:$m(0,"Find Previous"),alias:"Find Previous",precondition:void 0,kbOpts:[{kbExpr:dI.focus,primary:1085,mac:{primary:3109,secondary:[1085]},weight:100},{kbExpr:ry.and(dI.focus,_6),primary:1027,weight:100}]})}_run(e){return e.moveToPrevMatch()}}),hS(class extends N8{constructor(){super({id:N6,label:$m(0,"Find Next Selection"),alias:"Find Next Selection",precondition:void 0,kbOpts:{kbExpr:dI.focus,primary:2109,weight:100}})}_run(e){return e.moveToNextMatch()}}),hS(class extends N8{constructor(){super({id:I6,label:$m(0,"Find Previous Selection"),alias:"Find Previous Selection",precondition:void 0,kbOpts:{kbExpr:dI.focus,primary:3133,weight:100}})}_run(e){return e.moveToPrevMatch()}});const I8=sS.bindToContribution(k8.get);dS(new I8({id:M6,precondition:f6,handler:e=>e.closeFindWidget(),kbOpts:{weight:105,kbExpr:ry.and(dI.focus,ry.not("isComposing")),primary:9,secondary:[1033]}})),dS(new I8({id:O6,precondition:void 0,handler:e=>e.toggleCaseSensitive(),kbOpts:{weight:105,kbExpr:dI.focus,primary:b6.primary,mac:b6.mac,win:b6.win,linux:b6.linux}})),dS(new I8({id:A6,precondition:void 0,handler:e=>e.toggleWholeWords(),kbOpts:{weight:105,kbExpr:dI.focus,primary:C6.primary,mac:C6.mac,win:C6.win,linux:C6.linux}})),dS(new I8({id:R6,precondition:void 0,handler:e=>e.toggleRegex(),kbOpts:{weight:105,kbExpr:dI.focus,primary:w6.primary,mac:w6.mac,win:w6.win,linux:w6.linux}})),dS(new I8({id:P6,precondition:void 0,handler:e=>e.toggleSearchScope(),kbOpts:{weight:105,kbExpr:dI.focus,primary:y6.primary,mac:y6.mac,win:y6.win,linux:y6.linux}})),dS(new I8({id:F6,precondition:void 0,handler:e=>e.togglePreserveCase(),kbOpts:{weight:105,kbExpr:dI.focus,primary:S6.primary,mac:S6.mac,win:S6.win,linux:S6.linux}})),dS(new I8({id:B6,precondition:f6,handler:e=>e.replace(),kbOpts:{weight:105,kbExpr:dI.focus,primary:3094}})),dS(new I8({id:B6,precondition:f6,handler:e=>e.replace(),kbOpts:{weight:105,kbExpr:ry.and(dI.focus,v6),primary:3}})),dS(new I8({id:V6,precondition:f6,handler:e=>e.replaceAll(),kbOpts:{weight:105,kbExpr:dI.focus,primary:2563}})),dS(new I8({id:V6,precondition:f6,handler:e=>e.replaceAll(),kbOpts:{weight:105,kbExpr:ry.and(dI.focus,v6),primary:void 0,mac:{primary:2051}}})),dS(new I8({id:W6,precondition:f6,handler:e=>e.selectAllMatches(),kbOpts:{weight:105,kbExpr:dI.focus,primary:515}}));class T8{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>16777215||o>16777215)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 16777215&this._startIndexes[e]}getEndLineNumber(e){return 16777215&this._endIndexes[e]}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 M8(this,e)}getParentIndex(e){this.ensureParentIndices();let t=((4278190080&this._startIndexes[e])>>>24)+((4278190080&this._endIndexes[e])>>>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 M8{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 O8{constructor(e,t){this._updateEventEmitter=new $o,this.onDidChange=this._updateEventEmitter.event,this._textModel=e,this._decorationProvider=t,this._regions=new T8(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 A8(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 R8(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 P8(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 F8(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 B8(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 V8{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!==JR(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!==W8(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=W8(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 W8(e,t){let i=Hl(e,(e=>t<e.startLineNumber))-1;return i>=0&&e[i].endLineNumber>=t?e[i]:null}class H8{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 z8(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 h=e.getLineCount();h>0;h--){let i,n=e.getLineContent(h),o=uT(n,s),d=l[l.length-1];if(-1!==o){if(r&&(i=n.match(r))){if(!i[1]){l.push({indent:-2,endAbove:h,line:h});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(h,d.line,o),d.line=h,d.indent=o,d.endAbove=h;continue}}}if(d.indent>o){do{l.pop(),d=l[l.length-1]}while(d.indent>o);let e=d.endAbove-1;e-h>=1&&a.insertFirst(h,e,o)}d.indent===o?d.endAbove=h:l.push({indent:o,endAbove:h,line:h})}else t&&(d.endAbove=h)}return a.toIndentRanges(e)}(this.editorModel,n,o,this.maxFoldingRegions,t))}}class z8{constructor(e,t){this._notifyTooManyRegions=t,this._startIndexes=[],this._endIndexes=[],this._indentOccurrences=[],this._length=0,this._foldingRangesLimit=e}insertFirst(e,t,i){if(e>16777215||t>16777215)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 T8(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=uT(e.getLineContent(l),n);(d<i||d===i&&t++<this._foldingRangesLimit)&&(o[a]=l,s[a]=this._endIndexes[r],a++)}return new T8(o,s)}}}const j8={};class U8{constructor(e,t,i,n){this.editorModel=e,this.providers=t,this.limit=n,this.id="syntax";for(const o of t)"function"==typeof o.onDidChange&&(this.disposables||(this.disposables=new Cs),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,j8,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 K8(e,this.limit,t)}return null}))}dispose(){var e;null===(e=this.disposables)||void 0===e||e.dispose()}}class $8{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>16777215||t>16777215)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 T8(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 T8(i,n,o)}}}function K8(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 $8(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()}class q8{constructor(e,t,i,n){if(this.editorModel=e,this.id="init",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(K8(t,Number.MAX_VALUE))}}const G8=dB("folding-expanded",br.chevronDown,$m(0,"Icon for expanded ranges in the editor glyph margin.")),Z8=dB("folding-collapsed",br.chevronRight,$m(0,"Icon for collapsed ranges in the editor glyph margin."));class Y8{constructor(e){this.editor=e,this.autoHideFoldingControls=!0,this.showFoldingHighlights=!0}getDecorationOption(e,t){return t?Y8.HIDDEN_RANGE_DECORATION:e?this.showFoldingHighlights?Y8.COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION:Y8.COLLAPSED_VISUAL_DECORATION:this.autoHideFoldingControls?Y8.EXPANDED_AUTO_HIDE_VISUAL_DECORATION:Y8.EXPANDED_VISUAL_DECORATION}deltaDecorations(e,t){return this.editor.deltaDecorations(e,t)}changeDecorations(e){return this.editor.changeDecorations(e)}}Y8.COLLAPSED_VISUAL_DECORATION=RP.register({description:"folding-collapsed-visual-decoration",stickiness:1,afterContentClassName:"inline-folded",isWholeLine:!0,firstLineDecorationClassName:Fy.asClassName(Z8)}),Y8.COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION=RP.register({description:"folding-collapsed-highlighted-visual-decoration",stickiness:1,afterContentClassName:"inline-folded",className:"folded-background",isWholeLine:!0,firstLineDecorationClassName:Fy.asClassName(Z8)}),Y8.EXPANDED_AUTO_HIDE_VISUAL_DECORATION=RP.register({description:"folding-expanded-auto-hide-visual-decoration",stickiness:1,isWholeLine:!0,firstLineDecorationClassName:Fy.asClassName(G8)}),Y8.EXPANDED_VISUAL_DECORATION=RP.register({description:"folding-expanded-visual-decoration",stickiness:1,isWholeLine:!0,firstLineDecorationClassName:"alwaysShowFoldIcons "+Fy.asClassName(G8)}),Y8.HIDDEN_RANGE_DECORATION=RP.register({description:"folding-hidden-range-decoration",stickiness:1});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)}};const J8=new Ly("foldingEnabled",!1);let e9=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 Cs),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 Y8(e),this.foldingDecorationProvider.autoHideFoldingControls="mouseover"===r.get(99),this.foldingDecorationProvider.showFoldingHighlights=r.get(39),this.foldingEnabled=J8.bindTo(this.contextKeyService),this.foldingEnabled.set(this._isEnabled),this._notifyTooManyRegions=e=>{this._tooManyRegionsNotified||(n.notify({severity:oF.Warning,sticky:!0,message:$m(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;"syntax"!==e.provider&&"init"!==e.provider||(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 O8(e,this.foldingDecorationProvider),this.localToDispose.add(this.foldingModel),this.hiddenRangeModel=new V8(this.foldingModel),this.localToDispose.add(this.hiddenRangeModel),this.localToDispose.add(this.hiddenRangeModel.onDidChange((e=>this.onHiddenRangesChanges(e)))),this.updateScheduler=new Av(this.updateDebounceInfo.get(e)),this.cursorChangedScheduler=new Hv((()=>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 H8(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 q8(e,this.foldingStateMemento.collapsedRegions,(()=>{this.foldingStateMemento=null,this.onFoldingStrategyChanged()}),3e4)}t.length>0&&(this.rangeProvider=new U8(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=Iv((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=JF.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)}};e9.ID="editor.contrib.folding",e9=X8([Q8(1,Dy),Q8(2,pv),Q8(3,rF),Q8(4,$V),Q8(5,lb)],e9);class t9 extends rS{runEditorCommand(e,t,i){const n=e.get(pv),o=e9.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 i9(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)||zl(t.selectionLines)&&t.selectionLines.every(vr)))return!1}return!0}class n9 extends t9{getFoldingLevel(){return parseInt(this.id.substr(n9.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))}}n9.ID_PREFIX="editor.foldLevel",n9.ID=e=>n9.ID_PREFIX+e;gS(e9.ID,e9),hS(class extends t9{constructor(){super({id:"editor.unfold",label:$m(0,"Unfold"),alias:"Unfold",precondition:J8,kbOpts:{kbExpr:dI.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:i9,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?R8(t,!1,o,s):A8(t,!1,o,s)}}),hS(class extends t9{constructor(){super({id:"editor.unfoldRecursively",label:$m(0,"Unfold Recursively"),alias:"Unfold Recursively",precondition:J8,kbOpts:{kbExpr:dI.editorTextFocus,primary:Al(2089,2137),weight:100}})}invoke(e,t,i,n){A8(t,!1,Number.MAX_VALUE,this.getSelectedLines(i))}}),hS(class extends t9{constructor(){super({id:"editor.fold",label:$m(0,"Fold"),alias:"Fold",precondition:J8,kbOpts:{kbExpr:dI.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:i9,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?R8(t,!0,s||1,o):A8(t,!0,s||1,o)}}),hS(class extends t9{constructor(){super({id:"editor.foldRecursively",label:$m(0,"Fold Recursively"),alias:"Fold Recursively",precondition:J8,kbOpts:{kbExpr:dI.editorTextFocus,primary:Al(2089,2135),weight:100}})}invoke(e,t,i){let n=this.getSelectedLines(i);A8(t,!0,Number.MAX_VALUE,n)}}),hS(class extends t9{constructor(){super({id:"editor.foldAll",label:$m(0,"Fold All"),alias:"Fold All",precondition:J8,kbOpts:{kbExpr:dI.editorTextFocus,primary:Al(2089,2069),weight:100}})}invoke(e,t,i){A8(t,!0)}}),hS(class extends t9{constructor(){super({id:"editor.unfoldAll",label:$m(0,"Unfold All"),alias:"Unfold All",precondition:J8,kbOpts:{kbExpr:dI.editorTextFocus,primary:Al(2089,2088),weight:100}})}invoke(e,t,i){A8(t,!1)}}),hS(class extends t9{constructor(){super({id:"editor.foldAllBlockComments",label:$m(0,"Fold All Block Comments"),alias:"Fold All Block Comments",precondition:J8,kbOpts:{kbExpr:dI.editorTextFocus,primary:Al(2089,2133),weight:100}})}invoke(e,t,i,n,o){if(t.regions.hasTypes())B8(t,Tl.Comment.value,!0);else{const e=i.getModel();if(!e)return;const n=o.getLanguageConfiguration(e.getLanguageId()).comments;if(n&&n.blockCommentStartToken){F8(t,new RegExp("^\\s*"+Xo(n.blockCommentStartToken)),!0)}}}}),hS(class extends t9{constructor(){super({id:"editor.foldAllMarkerRegions",label:$m(0,"Fold All Regions"),alias:"Fold All Regions",precondition:J8,kbOpts:{kbExpr:dI.editorTextFocus,primary:Al(2089,2077),weight:100}})}invoke(e,t,i,n,o){if(t.regions.hasTypes())B8(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){F8(t,new RegExp(n.markers.start),!0)}}}}),hS(class extends t9{constructor(){super({id:"editor.unfoldAllMarkerRegions",label:$m(0,"Unfold All Regions"),alias:"Unfold All Regions",precondition:J8,kbOpts:{kbExpr:dI.editorTextFocus,primary:Al(2089,2078),weight:100}})}invoke(e,t,i,n,o){if(t.regions.hasTypes())B8(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){F8(t,new RegExp(n.markers.start),!1)}}}}),hS(class extends t9{constructor(){super({id:"editor.foldAllExcept",label:$m(0,"Fold All Regions Except Selected"),alias:"Fold All Regions Except Selected",precondition:J8,kbOpts:{kbExpr:dI.editorTextFocus,primary:Al(2089,2131),weight:100}})}invoke(e,t,i){P8(t,!0,this.getSelectedLines(i))}}),hS(class extends t9{constructor(){super({id:"editor.unfoldAllExcept",label:$m(0,"Unfold All Regions Except Selected"),alias:"Unfold All Regions Except Selected",precondition:J8,kbOpts:{kbExpr:dI.editorTextFocus,primary:Al(2089,2129),weight:100}})}invoke(e,t,i){P8(t,!1,this.getSelectedLines(i))}}),hS(class extends t9{constructor(){super({id:"editor.toggleFold",label:$m(0,"Toggle Fold"),alias:"Toggle Fold",precondition:J8,kbOpts:{kbExpr:dI.editorTextFocus,primary:Al(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))}}),hS(class extends t9{constructor(){super({id:"editor.gotoParentFold",label:$m(0,"Go to Parent Fold"),alias:"Go to Parent Fold",precondition:J8,kbOpts:{kbExpr:dI.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})}}}),hS(class extends t9{constructor(){super({id:"editor.gotoPreviousFold",label:$m(0,"Go to Previous Folding Range"),alias:"Go to Previous Folding Range",precondition:J8,kbOpts:{kbExpr:dI.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})}}}),hS(class extends t9{constructor(){super({id:"editor.gotoNextFold",label:$m(0,"Go to Next Folding Range"),alias:"Go to Next Folding Range",precondition:J8,kbOpts:{kbExpr:dI.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 _he=1;_he<=7;_he++)uS(new n9({id:n9.ID(_he),label:$m(0,"Fold Level {0}",_he),alias:`Fold Level ${_he}`,precondition:J8,kbOpts:{kbExpr:dI.editorTextFocus,primary:Al(2089,2048|21+_he),weight:100}}));const o9=ox("editor.foldBackground",{light:lD(fk,.3),dark:lD(fk,.3),hc:null},$m(0,"Background color behind folded ranges. The color must not be opaque so as not to hide underlying decorations."),!0),s9=ox("editorGutter.foldingControlForeground",{dark:ax,light:ax,hc:ax},$m(0,"Color of the folding control in the editor gutter."));zy(((e,t)=>{const i=e.getColor(o9);i&&t.addRule(`.monaco-editor .folded-background { background-color: ${i}; }`);const n=e.getColor(s9);n&&t.addRule(`\n\t\t.monaco-editor .cldr${Fy.asCSSSelector(G8)},\n\t\t.monaco-editor .cldr${Fy.asCSSSelector(Z8)} {\n\t\t\tcolor: ${n} !important;\n\t\t}\n\t\t`)}));hS(class extends rS{constructor(){super({id:"editor.action.fontZoomIn",label:$m(0,"Editor Font Zoom In"),alias:"Editor Font Zoom In",precondition:void 0})}run(e,t){Zf.setZoomLevel(Zf.getZoomLevel()+1)}}),hS(class extends rS{constructor(){super({id:"editor.action.fontZoomOut",label:$m(0,"Editor Font Zoom Out"),alias:"Editor Font Zoom Out",precondition:void 0})}run(e,t){Zf.setZoomLevel(Zf.getZoomLevel()-1)}}),hS(class extends rS{constructor(){super({id:"editor.action.fontZoomReset",label:$m(0,"Editor Font Zoom Reset"),alias:"Editor Font Zoom Reset",precondition:void 0})}run(e,t){Zf.setZoomLevel(0)}});var r9=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},a9=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}},l9=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 d9=class{constructor(e,t,i){this._editor=e,this._languageFeaturesService=t,this._workerService=i,this._disposables=new Cs,this._sessionDisposables=new Cs,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()}}));CX(this._workerService,this._languageFeaturesService,t,i,e,t.getFormattingOptions(),n.token).then((e=>{n.token.isCancellationRequested||gs(e)&&(dX.execute(this._editor,e,!0),gX(e))})).finally((()=>{o.dispose()}))}};d9.ID="editor.contrib.autoFormat",d9=r9([a9(1,lb),a9(2,kB)],d9);let h9=class{constructor(e,t,i){this.editor=e,this._languageFeaturesService=t,this._instantiationService=i,this._callOnDispose=new Cs,this._callOnModel=new Cs,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(fX,this.editor,e,2,TB.None,Ia.None).catch(Jo))}};h9.ID="editor.contrib.formatOnPaste",h9=r9([a9(1,lb),a9(2,n_)],h9);gS(d9.ID,d9),gS(h9.ID,h9),hS(class extends rS{constructor(){super({id:"editor.action.formatDocument",label:$m(0,"Format Document"),alias:"Format Document",precondition:ry.and(dI.notInCompositeEditor,dI.writable,dI.hasDocumentFormattingProvider),kbOpts:{kbExpr:dI.editorTextFocus,primary:1572,linux:{primary:3111},weight:100},contextMenuOpts:{group:"1_modification",order:1.3}})}run(e,t){return l9(this,void 0,void 0,(function*(){if(t.hasModel()){const i=e.get(n_),n=e.get(MB);yield n.showWhile(i.invokeFunction(vX,t,1,TB.None,Ia.None),250)}}))}}),hS(class extends rS{constructor(){super({id:"editor.action.formatSelection",label:$m(0,"Format Selection"),alias:"Format Selection",precondition:ry.and(dI.writable,dI.hasDocumentSelectionFormattingProvider),kbOpts:{kbExpr:dI.editorTextFocus,primary:Al(2089,2084),weight:100},contextMenuOpts:{when:dI.hasNonEmptySelection,group:"1_modification",order:1.31}})}run(e,t){return l9(this,void 0,void 0,(function*(){if(!t.hasModel())return;const i=e.get(n_),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(MB);yield s.showWhile(i.invokeFunction(fX,t,o,1,TB.None,Ia.None),250)}))}}),ny.registerCommand("editor.action.format",(e=>l9(void 0,void 0,void 0,(function*(){const t=e.get(r_).getFocusedCodeEditor();if(!t||!t.hasModel())return;const i=e.get(iy);t.getSelection().isEmpty()?yield i.executeCommand("editor.action.formatDocument"):yield i.executeCommand("editor.action.formatSelection")}))));var c9=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},u9=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}},g9=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 p9{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 m9 extends p9{constructor(e,t,i){super(),this.id=e,this.parent=t,this.symbol=i,this.children=new Map}}class f9 extends p9{constructor(e,t,i,n){super(),this.id=e,this.parent=t,this.label=i,this.order=n,this.children=new Map}}class _9 extends p9{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 _9(t.uri),s=e.ordered(t),r=s.map(((e,i)=>{var s;let r=p9.findId(`provider_${i}`,o),a=new f9(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||[])_9._makeOutlineElement(t,a);return a}),(e=>(Ta(e),a))).then((e=>{p9.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?_9.create(e,t,i):o._compact())).finally((()=>{a.dispose()}))}static _makeOutlineElement(e,t){let i=p9.findId(e,t),n=new m9(i,t,e);if(e.children)for(const o of e.children)_9._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=zs.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 m9?e.push(t.symbol):e.push(...zs.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 _9._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&&_9._flattenDocumentSymbols(e,n.children,n.name)}}const v9=s_("IOutlineModelService");let b9=class{constructor(e,t,i){this._languageFeaturesService=e,this._disposables=new Cs,this._cache=new VV(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 g9(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:_9.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()}}))}};b9=c9([u9(0,lb),u9(1,$V),u9(2,Dv)],b9),dv(v9,b9,!0);var C9=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())}))};ny.registerCommand("_executeDocumentSymbolProvider",(function(e,...t){return C9(this,void 0,void 0,(function*(){const[i]=t;Js(Ps.isUri(i));const n=e.get(v9),o=e.get(Zw),s=yield o.createModelReference(i);try{return(yield n.getOrCreate(s.object.textEditorModel,Ia.None)).getTopLevelSymbols()}finally{s.dispose()}}))}));class w9{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];return function(e,t){const i=new y9(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")})))).substring(this.parts[0].column-1)}}class y9{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 S9{constructor(e,t,i){this.column=e,this.lines=t,this.preview=i}}class x9 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 k9(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==L9?void 0:L9.originalValue)===e&&(null==L9?void 0:L9.newValue)===t)return null==L9?void 0:L9.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 Ha({getElements:()=>r},{getElements:()=>a}).ComputeDiff(!1).changes}(e,t);return L9={originalValue:e,newValue:t,changes:i},i}}(a,e.text);if(!l)return;const d=e.range.startLineNumber,h=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 c=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,c)),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);h.push(new S9(t,e,!1))}if(a.length>0){const e=Is(a);h.push(new S9(t,e,!0))}}return new w9(d,h,0)}let L9;class D9{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 E9=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},N9=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}},I9=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 T9=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([wI.Tab.id,wI.DeleteLeft.id,wI.DeleteRight.id,"editor.action.inlineSuggest.commit","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 M9(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 I9(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}))}};T9=E9([N9(2,iy),N9(3,pv),N9(4,lb),N9(5,$V)],T9);class M9 extends x9{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 Hv((()=>{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 I9(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 I9(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 I9(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 I9(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?k9(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 I9(this,void 0,void 0,(function*(){if(!this.shouldUpdate())return;const t=this.editor.getPosition(),i=new Date,n=Iv((n=>I9(this,void 0,void 0,(function*(){let o;try{o=yield P9(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 O9(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",[oW.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 O9{constructor(e,t){this.promise=e,this.triggerKind=t}dispose(){this.promise.cancel()}}class A9 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 R9(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 R9{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 P9(e,t,i,n,o=Ia.None,s){return I9(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=>I9(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?F9(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 F9(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 GO,n=new uA(i,(e=>t.getLanguageConfiguration(e))),o=bA(new lA(new D9([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=PO(i,t.openingBracket.length),t.child&&(e(t.child,i),i=PO(i,t.child.length)),t.closingBracket)e(t.closingBracket,i),i=PO(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,PO(i,t.length));else if(4===t.kind)for(const n of t.children)e(n,i),i=PO(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 V9=new Uint8Array(16),W9=[];for(let _he=0;_he<256;_he++)W9.push(_he.toString(16).padStart(2,"0"));let H9;H9="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 z9{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 j9{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 U2&&(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 U9{constructor(e,t){this._labelService=e,this._model=t}resolve(e){const{name:t}=e;if("TM_FILENAME"===t)return wa(this._model.uri.fsPath);if("TM_FILENAME_BASE"===t){const e=wa(this._model.uri.fsPath),t=e.lastIndexOf(".");return t<=0?e:e.slice(0,t)}return"TM_DIRECTORY"===t?"."===zr(this._model.uri.fsPath)?"":this._labelService.getUriLabel(qA(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 $9{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 K9{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=bv.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 q9{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?q9.dayNames[this._date.getDay()]:"CURRENT_DAY_NAME_SHORT"===t?q9.dayNamesShort[this._date.getDay()]:"CURRENT_MONTH_NAME"===t?q9.monthNames[this._date.getMonth()]:"CURRENT_MONTH_NAME_SHORT"===t?q9.monthNamesShort[this._date.getMonth()]:"CURRENT_SECONDS_UNIX"===t?String(Math.floor(this._date.getTime()/1e3)):void 0}}q9.dayNames=[$m(0,"Sunday"),$m(0,"Monday"),$m(0,"Tuesday"),$m(0,"Wednesday"),$m(0,"Thursday"),$m(0,"Friday"),$m(0,"Saturday")],q9.dayNamesShort=[$m(0,"Sun"),$m(0,"Mon"),$m(0,"Tue"),$m(0,"Wed"),$m(0,"Thu"),$m(0,"Fri"),$m(0,"Sat")],q9.monthNames=[$m(0,"January"),$m(0,"February"),$m(0,"March"),$m(0,"April"),$m(0,"May"),$m(0,"June"),$m(0,"July"),$m(0,"August"),$m(0,"September"),$m(0,"October"),$m(0,"November"),$m(0,"December")],q9.monthNamesShort=[$m(0,"Jan"),$m(0,"Feb"),$m(0,"Mar"),$m(0,"Apr"),$m(0,"May"),$m(0,"Jun"),$m(0,"Jul"),$m(0,"Aug"),$m(0,"Sep"),$m(0,"Oct"),$m(0,"Nov"),$m(0,"Dec")];class G9{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(LW(e))return wa(e.uri.path);let t=wa(e.configPath.path);return t.endsWith("code-workspace")&&(t=t.substr(0,t.length-"code-workspace".length-1)),t}_resoveWorkspacePath(e){if(LW(e))return k1(e.uri.fsPath);let t=wa(e.configPath.path),i=e.configPath.fsPath;return i.endsWith(t)&&(i=i.substr(0,i.length-t.length-1)),i?k1(i):"/"}}class Z9{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(){H9(V9),V9[6]=15&V9[6]|64,V9[8]=63&V9[8]|128;let e=0,t="";return t+=W9[V9[e++]],t+=W9[V9[e++]],t+=W9[V9[e++]],t+=W9[V9[e++]],t+="-",t+=W9[V9[e++]],t+=W9[V9[e++]],t+="-",t+=W9[V9[e++]],t+=W9[V9[e++]],t+="-",t+=W9[V9[e++]],t+=W9[V9[e++]],t+="-",t+=W9[V9[e++]],t+=W9[V9[e++]],t+=W9[V9[e++]],t+=W9[V9[e++]],t+=W9[V9[e++]],t+=W9[V9[e++]],t}():void 0}}class Y9{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,K2.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?Y9._decor.inactiveFinal:Y9._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(oW.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?Y9._decor.activeFinal:Y9._decor.active),i.add(o);for(const t of this._snippet.enclosingPlaceholders(o)){const n=this._placeholderDecorations.get(t);e.changeDecorationOptions(n,t.isFinalTabstop?Y9._decor.activeFinal:Y9._decor.active),i.add(t)}}for(const[t,o]of this._placeholderDecorations)i.has(t)||e.changeDecorationOptions(o,t.isFinalTabstop?Y9._decor.inactiveFinal:Y9._decor.inactive);return n}));return t?this.move(e):null!=i?i:[]}_hasPlaceholderBeenCollapsed(e){let t=e;for(;t;){if(t instanceof K2){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,Y9._decor.inactive);this._placeholderDecorations.set(e,a)}}this._placeholderGroups=$l(this._snippet.placeholders,K2.compareByIndex)}))}}Y9._decor={active:RP.register({description:"snippet-placeholder-1",stickiness:0,className:"snippet-placeholder"}),inactive:RP.register({description:"snippet-placeholder-2",stickiness:1,className:"snippet-placeholder"}),activeFinal:RP.register({description:"snippet-placeholder-3",stickiness:1,className:"finish-snippet-placeholder"}),inactiveFinal:RP.register({description:"snippet-placeholder-4",stickiness:1,className:"finish-snippet-placeholder"})};const X9={overwriteBefore:0,overwriteAfter:0,adjustWhitespace:!0,clipboardText:void 0,overtypingCapturer:void 0};class Q9{constructor(e,t,i=X9){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 U2)||t.parent instanceof q2)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 U2(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 h=e.getModel(),c=e.invokeWithinContext((e=>e.get(kW))),u=e.invokeWithinContext((e=>new U9(e.get(xW),h))),g=()=>r;let p=0,m=h.getValueInRange(Q9.adjustSelection(h,e.getSelection(),i,0)),f=h.getValueInRange(Q9.adjustSelection(h,e.getSelection(),0,n)),_=h.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:C}of v){let r=Q9.adjustSelection(h,b,i,0),w=Q9.adjustSelection(h,b,0,n);m!==h.getValueInRange(r)&&(r=b),f!==h.getValueInRange(w)&&(w=b);const y=b.setStartPosition(r.startLineNumber,r.startColumn).setEndPosition(w.endLineNumber,w.endColumn),S=(new J2).parse(t,!0,o),x=y.getStartPosition(),k=Q9.adjustWhitespace(h,x,S,s||C>0&&_!==h.getLineFirstNonWhitespaceColumn(b.positionLineNumber),!0);S.resolveVariables(new z9([u,new $9(g,C,v.length,"spread"===e.getOption(71)),new j9(h,b,C,a),new K9(h,b),new q9,new G9(c),new Z9]));const L=h.getOffsetAt(x)+p;p+=S.toString().length-h.getValueLengthInRange(y),l[C]=oW.replace(y,S.toString()),l[C].identifier={major:C,minor:0},d[C]=new Y9(e,S,L,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}=Q9.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=X9){if(!this._editor.hasModel())return;this._templateMerges.push([this._snippets[0]._nestingLevel,this._snippets[0]._placeholderGroupsIdx,e]);const{edits:i,snippets:n}=Q9.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 J9=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},e7=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};const t7={overwriteBefore:0,overwriteAfter:0,undoStopBefore:!0,undoStopAfter:!0,adjustWhitespace:!0,clipboardText:void 0,overtypingCapturer:void 0};let i7=class e{constructor(t,i,n,o){this._editor=t,this._instantiationService=i,this._logService=n,this._snippetListener=new Cs,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?t7:Object.assign(Object.assign({},t7),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 Q9(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(O3,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())}};i7.ID="snippetController2",i7.InSnippetMode=new Ly("inSnippetMode",!1,$m(0,"Whether the editor in current in snippet mode")),i7.HasNextTabstop=new Ly("hasNextTabstop",!1,$m(0,"Whether there is a next tab stop when in snippet mode")),i7.HasPrevTabstop=new Ly("hasPrevTabstop",!1,$m(0,"Whether there is a previous tab stop when in snippet mode")),i7=J9([e7(1,n_),e7(2,tb),e7(3,Dy)],i7),gS(i7.ID,i7);const n7=sS.bindToContribution(i7.get);dS(new n7({id:"jumpToNextSnippetPlaceholder",precondition:ry.and(i7.InSnippetMode,i7.HasNextTabstop),handler:e=>e.next(),kbOpts:{weight:130,kbExpr:dI.editorTextFocus,primary:2}})),dS(new n7({id:"jumpToPrevSnippetPlaceholder",precondition:ry.and(i7.InSnippetMode,i7.HasPrevTabstop),handler:e=>e.prev(),kbOpts:{weight:130,kbExpr:dI.editorTextFocus,primary:1026}})),dS(new n7({id:"leaveSnippet",precondition:i7.InSnippetMode,handler:e=>e.cancel(!0),kbOpts:{weight:130,kbExpr:dI.editorTextFocus,primary:9,secondary:[1033]}})),dS(new n7({id:"acceptSnippet",precondition:i7.InSnippetMode,handler:e=>e.finish()}));var o7=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},s7=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};class r7{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 a7 extends r7{constructor(){super("first")}memorize(e,t,i){}toJSON(){}fromJSON(){}}let l7=class e{constructor(e,t){this._storageService=e,this._configService=t,this._disposables=new Cs,this._persistSoon=new Hv((()=>this._saveState()),500),this._disposables.add(e.onWillSaveState((e=>{e.reason===iZ.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)||a7;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)}}};l7._strategyCtors=new Map([["recentlyUsedByPrefix",class extends r7{constructor(){super("recentlyUsedByPrefix"),this._trie=RV.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 r7{constructor(){super("recentlyUsed"),this._cache=new VV(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",a7]]),l7._storagePrefix="suggest/memories",l7=o7([s7(0,tZ),s7(1,ev)],l7);const d7=s_("ISuggestMemories");dv(d7,l7,!0);var h7=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},c7=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};let u7=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)}};u7.AtEnd=new Ly("atEndOfWord",!1),u7=h7([c7(1,Dy)],u7);var g7=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},p7=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};let m7=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}}};m7.OtherSuggestions=new Ly("hasOtherSuggestions",!1),m7=g7([p7(1,Dy)],m7);class f7{constructor(e,t,i){this._disposables=new Cs,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 _7=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 v7{provideSelectionRanges(e,t){return _7(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=>v7._bracketsRightYield(t,0,e,n,o))),yield new Promise((i=>v7._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>=v7._maxRounds){e();break}if(!n){e();break}let a=i.bracketPairs.findNextBracket(n);if(!a){e();break}if(Date.now()-r>v7._maxDuration){setTimeout((()=>v7._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 Hs,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>=v7._maxRounds&&0===o.size){e();break}if(!n){e();break}let l=i.bracketPairs.findPrevBracket(n);if(!l){e();break}if(Date.now()-a>v7._maxDuration){setTimeout((()=>v7._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}),v7._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())}))}}}v7._maxDuration=30,v7._maxRounds=2;var b7=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 C7{static create(e,t){return b7(this,void 0,void 0,(function*(){if(!t.getOption(106).localityBonus)return C7.None;if(!t.hasModel())return C7.None;const i=t.getModel(),n=t.getPosition();if(!e.canComputeWordRanges(i.uri))return C7.None;const[o]=yield(new v7).provideSelectionRanges(i,[n]);if(0===o.length)return C7.None;const s=yield e.computeWordRanges(i.uri,o[0].range);if(!s)return C7.None;const r=i.getWordUntilPosition(n);return delete s[r.word],new class extends C7{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)],h=o.length;for(const t of o){if(!qo.containsRange(t.range,d))break;h-=1}return h}}}))}}C7.None=new class extends C7{distance(){return 0}};class w7{constructor(e,t,i,n,o,s,r){this.clipboardText=r,this._snippetCompareFn=w7._compareCompletionItems,this._items=e,this._column=t,this._wordDistance=n,this._options=o,this._refilterKind=1,this._lineContext=i,"top"===s?this._snippetCompareFn=w7._compareCompletionItemsSnippetsUp:"bottom"===s&&(this._snippetCompareFn=w7._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?hz:uz;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 h=d.position.column-d.editStart.column,c=h+i-(d.position.column-this._column);if(n.length!==c&&(n=0===c?"":t.slice(-c),o=n.toLowerCase()),d.word=n,0===c)d.score=lz.Default;else{let e=0;for(;e<h;){const t=n.charCodeAt(e);if(32!==t&&9!==t)break;e+=1}if(e>=c)d.score=lz.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=YH(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 w7._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 w7._compareCompletionItems(e,t)}}var y7=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},S7=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}},x7=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 k7{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 L7=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 Cs,this._quickSuggestDelay=10,this._triggerCharacterListener=new Cs,this._triggerQuickSuggest=new Vv,this._state=0,this._completionDisposables=new Cs,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(k7.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="";ca(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=i7.get(this._editor))||void 0===e?void 0:e.isInSnippet())||(this.cancel(),this._triggerQuickSuggest.cancelAndSet((()=>{if(0!==this._state)return;if(!k7.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 k7(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 k7(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 h=this._editor.getOption(101);let c=1;switch(h){case"top":c=0;break;case"bottom":c=2}const{itemKind:u,showDeprecated:g}=e._createSuggestFilter(this._editor),p=C7.create(this._editorWorkerService,this._editor),m=D3(this._languageFeaturesService.completionProvider,r,this._editor.getPosition(),new k3(c,u,n,g),d,this._requestToken.token);Promise.all([m,p]).then((([e,i])=>x7(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=I3(c);l=l.concat(o.items).sort(e)}const d=new k7(r,this._editor.getPosition(),a,t.shy);this._completionModel=new w7(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(k7.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()}};L7=y7([S7(1,kB),S7(2,IB),S7(3,tS),S7(4,tb),S7(5,Dy),S7(6,ev),S7(7,lb)],L7);class D7{constructor(e,t){this._disposables=new Cs,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)>D7._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()}}D7._maxSelectionLength=51200;var E7=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},N7=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};class I7 extends t1{updateLabel(){const e=this._keybindingService.lookupKeybinding(this._action.id,this._contextKeyService);if(!e)return super.updateLabel();this.label&&(this.label.textContent=$m(0,"{0} ({1})",this._action.label,I7.symbolPrintEnter(e)))}static symbolPrintEnter(e){var t;return null===(t=e.getLabel())||void 0===t?void 0:t.replace(/\benter\b/gi,"⏎")}}let T7=class{constructor(e,t,i,n){this._menuService=i,this._contextKeyService=n,this._menuDisposables=new Cs,this.element=Lw(e,Mw(".suggest-status-bar"));const o=e=>e instanceof Xy?t.createInstance(I7,e,void 0):void 0;this._leftActions=new rB(this.element,{actionViewItemProvider:o}),this._rightActions=new rB(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(S3,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()}};T7=E7([N7(1,n_),N7(2,Gy),N7(3,Dy)],T7);const M7=ox("symbolIcon.arrayForeground",{dark:sx,light:sx,hc:sx},$m(0,"The foreground color for array symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),O7=ox("symbolIcon.booleanForeground",{dark:sx,light:sx,hc:sx},$m(0,"The foreground color for boolean symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),A7=ox("symbolIcon.classForeground",{dark:"#EE9D28",light:"#D67E00",hc:"#EE9D28"},$m(0,"The foreground color for class symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),R7=ox("symbolIcon.colorForeground",{dark:sx,light:sx,hc:sx},$m(0,"The foreground color for color symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),P7=ox("symbolIcon.constantForeground",{dark:sx,light:sx,hc:sx},$m(0,"The foreground color for constant symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),F7=ox("symbolIcon.constructorForeground",{dark:"#B180D7",light:"#652D90",hc:"#B180D7"},$m(0,"The foreground color for constructor symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),B7=ox("symbolIcon.enumeratorForeground",{dark:"#EE9D28",light:"#D67E00",hc:"#EE9D28"},$m(0,"The foreground color for enumerator symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),V7=ox("symbolIcon.enumeratorMemberForeground",{dark:"#75BEFF",light:"#007ACC",hc:"#75BEFF"},$m(0,"The foreground color for enumerator member symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),W7=ox("symbolIcon.eventForeground",{dark:"#EE9D28",light:"#D67E00",hc:"#EE9D28"},$m(0,"The foreground color for event symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),H7=ox("symbolIcon.fieldForeground",{dark:"#75BEFF",light:"#007ACC",hc:"#75BEFF"},$m(0,"The foreground color for field symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),z7=ox("symbolIcon.fileForeground",{dark:sx,light:sx,hc:sx},$m(0,"The foreground color for file symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),j7=ox("symbolIcon.folderForeground",{dark:sx,light:sx,hc:sx},$m(0,"The foreground color for folder symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),U7=ox("symbolIcon.functionForeground",{dark:"#B180D7",light:"#652D90",hc:"#B180D7"},$m(0,"The foreground color for function symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),$7=ox("symbolIcon.interfaceForeground",{dark:"#75BEFF",light:"#007ACC",hc:"#75BEFF"},$m(0,"The foreground color for interface symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),K7=ox("symbolIcon.keyForeground",{dark:sx,light:sx,hc:sx},$m(0,"The foreground color for key symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),q7=ox("symbolIcon.keywordForeground",{dark:sx,light:sx,hc:sx},$m(0,"The foreground color for keyword symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),G7=ox("symbolIcon.methodForeground",{dark:"#B180D7",light:"#652D90",hc:"#B180D7"},$m(0,"The foreground color for method symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Z7=ox("symbolIcon.moduleForeground",{dark:sx,light:sx,hc:sx},$m(0,"The foreground color for module symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Y7=ox("symbolIcon.namespaceForeground",{dark:sx,light:sx,hc:sx},$m(0,"The foreground color for namespace symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),X7=ox("symbolIcon.nullForeground",{dark:sx,light:sx,hc:sx},$m(0,"The foreground color for null symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Q7=ox("symbolIcon.numberForeground",{dark:sx,light:sx,hc:sx},$m(0,"The foreground color for number symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),J7=ox("symbolIcon.objectForeground",{dark:sx,light:sx,hc:sx},$m(0,"The foreground color for object symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),eee=ox("symbolIcon.operatorForeground",{dark:sx,light:sx,hc:sx},$m(0,"The foreground color for operator symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),tee=ox("symbolIcon.packageForeground",{dark:sx,light:sx,hc:sx},$m(0,"The foreground color for package symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),iee=ox("symbolIcon.propertyForeground",{dark:sx,light:sx,hc:sx},$m(0,"The foreground color for property symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),nee=ox("symbolIcon.referenceForeground",{dark:sx,light:sx,hc:sx},$m(0,"The foreground color for reference symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),oee=ox("symbolIcon.snippetForeground",{dark:sx,light:sx,hc:sx},$m(0,"The foreground color for snippet symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),see=ox("symbolIcon.stringForeground",{dark:sx,light:sx,hc:sx},$m(0,"The foreground color for string symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),ree=ox("symbolIcon.structForeground",{dark:sx,light:sx,hc:sx},$m(0,"The foreground color for struct symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),aee=ox("symbolIcon.textForeground",{dark:sx,light:sx,hc:sx},$m(0,"The foreground color for text symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),lee=ox("symbolIcon.typeParameterForeground",{dark:sx,light:sx,hc:sx},$m(0,"The foreground color for type parameter symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),dee=ox("symbolIcon.unitForeground",{dark:sx,light:sx,hc:sx},$m(0,"The foreground color for unit symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),hee=ox("symbolIcon.variableForeground",{dark:"#75BEFF",light:"#007ACC",hc:"#75BEFF"},$m(0,"The foreground color for variable symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));zy(((e,t)=>{const i=e.getColor(M7);i&&t.addRule(`${br.symbolArray.cssSelector} { color: ${i}; }`);const n=e.getColor(O7);n&&t.addRule(`${br.symbolBoolean.cssSelector} { color: ${n}; }`);const o=e.getColor(A7);o&&t.addRule(`${br.symbolClass.cssSelector} { color: ${o}; }`);const s=e.getColor(G7);s&&t.addRule(`${br.symbolMethod.cssSelector} { color: ${s}; }`);const r=e.getColor(R7);r&&t.addRule(`${br.symbolColor.cssSelector} { color: ${r}; }`);const a=e.getColor(P7);a&&t.addRule(`${br.symbolConstant.cssSelector} { color: ${a}; }`);const l=e.getColor(F7);l&&t.addRule(`${br.symbolConstructor.cssSelector} { color: ${l}; }`);const d=e.getColor(B7);d&&t.addRule(`\n\t\t\t${br.symbolValue.cssSelector},${br.symbolEnum.cssSelector} { color: ${d}; }`);const h=e.getColor(V7);h&&t.addRule(`${br.symbolEnumMember.cssSelector} { color: ${h}; }`);const c=e.getColor(W7);c&&t.addRule(`${br.symbolEvent.cssSelector} { color: ${c}; }`);const u=e.getColor(H7);u&&t.addRule(`${br.symbolField.cssSelector} { color: ${u}; }`);const g=e.getColor(z7);g&&t.addRule(`${br.symbolFile.cssSelector} { color: ${g}; }`);const p=e.getColor(j7);p&&t.addRule(`${br.symbolFolder.cssSelector} { color: ${p}; }`);const m=e.getColor(U7);m&&t.addRule(`${br.symbolFunction.cssSelector} { color: ${m}; }`);const f=e.getColor($7);f&&t.addRule(`${br.symbolInterface.cssSelector} { color: ${f}; }`);const _=e.getColor(K7);_&&t.addRule(`${br.symbolKey.cssSelector} { color: ${_}; }`);const v=e.getColor(q7);v&&t.addRule(`${br.symbolKeyword.cssSelector} { color: ${v}; }`);const b=e.getColor(Z7);b&&t.addRule(`${br.symbolModule.cssSelector} { color: ${b}; }`);const C=e.getColor(Y7);C&&t.addRule(`${br.symbolNamespace.cssSelector} { color: ${C}; }`);const w=e.getColor(X7);w&&t.addRule(`${br.symbolNull.cssSelector} { color: ${w}; }`);const y=e.getColor(Q7);y&&t.addRule(`${br.symbolNumber.cssSelector} { color: ${y}; }`);const S=e.getColor(J7);S&&t.addRule(`${br.symbolObject.cssSelector} { color: ${S}; }`);const x=e.getColor(eee);x&&t.addRule(`${br.symbolOperator.cssSelector} { color: ${x}; }`);const k=e.getColor(tee);k&&t.addRule(`${br.symbolPackage.cssSelector} { color: ${k}; }`);const L=e.getColor(iee);L&&t.addRule(`${br.symbolProperty.cssSelector} { color: ${L}; }`);const D=e.getColor(nee);D&&t.addRule(`${br.symbolReference.cssSelector} { color: ${D}; }`);const E=e.getColor(oee);E&&t.addRule(`${br.symbolSnippet.cssSelector} { color: ${E}; }`);const N=e.getColor(see);N&&t.addRule(`${br.symbolString.cssSelector} { color: ${N}; }`);const I=e.getColor(ree);I&&t.addRule(`${br.symbolStruct.cssSelector} { color: ${I}; }`);const T=e.getColor(aee);T&&t.addRule(`${br.symbolText.cssSelector} { color: ${T}; }`);const M=e.getColor(lee);M&&t.addRule(`${br.symbolTypeParameter.cssSelector} { color: ${M}; }`);const O=e.getColor(dee);O&&t.addRule(`${br.symbolUnit.cssSelector} { color: ${O}; }`);const A=e.getColor(hee);A&&t.addRule(`${br.symbolVariable.cssSelector} { color: ${A}; }`)}));class cee{constructor(){let e;this._onDidWillResize=new $o,this.onDidWillResize=this._onDidWillResize.event,this._onDidResize=new $o,this.onDidResize=this._onDidResize.event,this._sashListener=new Cs,this._size=new tw(0,0),this._minSize=new tw(0,0),this._maxSize=new tw(Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER),this.domNode=document.createElement("div"),this._eastSash=new QF(this.domNode,{getVerticalSashLeft:()=>this._size.width},{orientation:0}),this._westSash=new QF(this.domNode,{getVerticalSashLeft:()=>0},{orientation:0}),this._northSash=new QF(this.domNode,{getHorizontalSashTop:()=>0},{orientation:1,orthogonalEdge:$F.North}),this._southSash=new QF(this.domNode,{getHorizontalSashTop:()=>this._size.height},{orientation:1,orthogonalEdge:$F.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 tw(t,e);tw.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 uee=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 pee(e){return!!e&&Boolean(e.completion.documentation||e.completion.detail&&e.completion.detail!==e.completion.label)}let mee=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 Cs,this._renderDisposeable=new Cs,this._borderWidth=1,this._size=new tw(330,0),this.domNode=Mw(".suggest-details"),this.domNode.classList.add("no-docs"),this._markdownRenderer=t.createInstance(Y5,{editor:e}),this._body=Mw(".body"),this._scrollbar=new sT(this._body,{}),Lw(this.domNode,this._scrollbar.getDomNode()),this._disposables.add(this._scrollbar),this._header=Lw(this._body,Mw(".header")),this._close=Lw(this._header,Mw("span"+br.close.cssSelector)),this._close.title=$m(0,"Close"),this._type=Lw(this._header,Mw("p.type")),this._docs=Lw(this._body,Mw("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(Bf?kf.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=$m(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 CU).appendCodeblock("empty",t),o=`Provider: ${e.provider._debugDisplayName}`}if(t||pee(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,Ow(this._type),this._type.classList.toggle("auto-wrap",!/\r?\n^\s+/gim.test(e))}else RC(this._type),this._type.title="",Aw(this._type),this.domNode.classList.add("no-type");if(RC(this._docs),"string"==typeof s)this._docs.classList.remove("markdown-docs"),this._docs.textContent=s;else if(s){this._docs.classList.add("markdown-docs"),RC(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 tw(e,t);tw.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}};mee=uee([gee(1,n_)],mee);class fee{constructor(e,t){let i,n;this.widget=e,this._editor=t,this._disposables=new Cs,this._added=!1,this._preferAlignAtTop=!0,this._resizable=new cee,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=JC(document.body),s=this.widget.getLayoutInfo(),r=new tw(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 tw(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 tw(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 tw(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)}}()],h=null!==(n=d.find((e=>e.fit>=0)))&&void 0!==n?n:d.sort(((e,t)=>t.fit-e.fit))[0],c=e.top+e.height-s.borderHeight;let u,g=t.height;const p=Math.max(h.maxSizeTop.height,h.maxSizeBottom.height);let m;g>p&&(g=p),i?g<=h.maxSizeTop.height?(u=!0,m=h.maxSizeTop):(u=!1,m=h.maxSizeBottom):g<=h.maxSizeBottom.height?(u=!1,m=h.maxSizeBottom):(u=!0,m=h.maxSizeTop),this._applyTopLeft({left:h.left,top:u?h.top:c-g}),this.getDomNode().style.position="fixed",this._resizable.enableSashes(!u,h===l,u,h!==l),this._resizable.minSize=h.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 _ee,vee;(vee=_ee||(_ee={}))[vee.FILE=0]="FILE",vee[vee.FOLDER=1]="FOLDER",vee[vee.ROOT_FOLDER=2]="ROOT_FOLDER";const bee=/(?:\/|^)(?:([^\/]+)\/)?([^\/]+)$/;function Cee(e,t,i,n){const o=n===_ee.ROOT_FOLDER?["rootfolder-icon"]:n===_ee.FOLDER?["folder-icon"]:["file-icon"];if(i){let s;if(i.scheme===IC.data){s=JA.parseMetaData(i).get(JA.META_DATA_LABEL)}else{const e=i.path.match(bee);e?(s=wee(e[2].toLowerCase()),e[1]&&o.push(`${wee(e[1].toLowerCase())}-name-dir-icon`)):s=wee(i.authority.toLowerCase())}if(n===_ee.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===IC.data){const e=JA.parseMetaData(i).get(JA.META_DATA_MIME);e&&(n=t.getLanguageIdByMimeType(e))}else{const t=e.getModel(i);t&&(n=t.getLanguageId())}if(n&&"plaintext"!==n)return n;return t.guessLanguageIdByFilepathOrFirstLine(i)}(e,t,i);n&&o.push(`${wee(n)}-lang-file-icon`)}}return o}function wee(e){return e.replace(/[\11\12\14\15\40]/g,"/")}var yee,See=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},xee=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};function kee(e){return`suggest-aria-id:${e}`}const Lee=dB("suggest-more-info",br.chevronRight,$m(0,"Icon for more information in the suggest widget.")),Dee=new((yee=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}})._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*\))/,yee._regexStrict=new RegExp(`^${yee._regexRelaxed.source}$`,"i"),yee);let Eee=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 Cs,t.root=e,t.root.classList.add("show-file-icons"),t.icon=Lw(e,Mw(".icon")),t.colorspan=Lw(t.icon,Mw("span.colorspan"));const i=Lw(e,Mw(".contents")),n=Lw(i,Mw(".main"));t.iconContainer=Lw(n,Mw(".icon-label.codicon")),t.left=Lw(n,Mw("span.left")),t.right=Lw(n,Mw("span.right")),t.iconLabel=new DU(t.left,{supportHighlights:!0,supportIcons:!0}),t.disposables.add(t.iconLabel),t.parametersLabel=Lw(t.left,Mw("span.signature-label")),t.qualifierLabel=Lw(t.left,Mw("span.qualifier-label")),t.detailsLabel=Lw(t.right,Mw("span.details-label")),t.readMore=Lw(t.right,Mw("span.readMore"+Fy.asCSSSelector(Lee))),t.readMore.title=$m(0,"Read More");const o=()=>{const e=this._editor.getOptions(),i=e.get(44),o=i.getMassagedFontFamily(Bf?kf.fontFamily:null),s=i.fontFeatureSettings,r=e.get(107)||i.fontSize,a=e.get(108)||i.lineHeight,l=i.fontWeight,d=`${r}px`,h=`${a}px`;t.root.style.fontSize=d,t.root.style.fontWeight=l,n.style.fontFamily=o,n.style.fontFeatureSettings=s,n.style.lineHeight=h,t.icon.style.height=h,t.icon.style.width=h,t.readMore.style.height=h,t.readMore.style.width=h};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=kee(t),i.colorspan.style.backgroundColor="";const o={labelEscapeNewLines:!0,matches:XH(e.score)};let s=[];if(19===n.kind&&Dee.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=Cee(this._modelService,this._languageService,Ps.from({scheme:"fake",path:e.textLabel}),_ee.FILE),s=Cee(this._modelService,this._languageService,Ps.from({scheme:"fake",path:n.detail}),_ee.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([Cee(this._modelService,this._languageService,Ps.from({scheme:"fake",path:e.textLabel}),_ee.FOLDER),Cee(this._modelService,this._languageService,Ps.from({scheme:"fake",path:n.detail}),_ee.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=Nee(n.detail||""),i.root.classList.add("string-label")):(i.parametersLabel.textContent=Nee(n.label.detail||""),i.detailsLabel.textContent=Nee(n.label.description||""),i.root.classList.remove("string-label")),this._editor.getOption(106).showInlineDetails?Ow(i.detailsLabel):Aw(i.detailsLabel),pee(e)?(i.right.classList.add("can-expand-details"),Ow(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"),Aw(i.readMore),i.readMore.onmousedown=null,i.readMore.onclick=null)}disposeTemplate(e){e.disposables.dispose()}};function Nee(e){return e.replace(/\r\n|\r|\n/g,"")}Eee=See([xee(1,Dv),xee(2,rv),xee(3,Ry)],Eee);var Iee=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},Tee=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}},Mee=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())}))};ox("editorSuggestWidget.background",{dark:nk,light:nk,hc:nk},$m(0,"Background color of the suggest widget.")),ox("editorSuggestWidget.border",{dark:sk,light:sk,hc:sk},$m(0,"Border color of the suggest widget."));const Oee=ox("editorSuggestWidget.foreground",{dark:ik,light:ik,hc:ik},$m(0,"Foreground color of the suggest widget."));ox("editorSuggestWidget.selectedForeground",{dark:DL,light:DL,hc:DL},$m(0,"Foreground color of the selected entry in the suggest widget.")),ox("editorSuggestWidget.selectedIconForeground",{dark:EL,light:EL,hc:EL},$m(0,"Icon foreground color of the selected entry in the suggest widget."));const Aee=ox("editorSuggestWidget.selectedBackground",{dark:NL,light:NL,hc:NL},$m(0,"Background color of the selected entry in the suggest widget."));ox("editorSuggestWidget.highlightForeground",{dark:mL,light:mL,hc:mL},$m(0,"Color of the match highlights in the suggest widget.")),ox("editorSuggestWidget.focusHighlightForeground",{dark:fL,light:fL,hc:fL},$m(0,"Color of the match highlights in the suggest widget when an item is focused.")),ox("editorSuggestWidgetStatus.foreground",{dark:lD(Oee,.5),light:lD(Oee,.5),hc:lD(Oee,.5)},$m(0,"Foreground color of the suggest widget status."));class Ree{constructor(e,t){this._service=e,this._key=`suggestWidget.size/${t.getEditorType()}/${t instanceof z0}`}restore(){var e;const t=null!==(e=this._service.get(this._key,0))&&void 0!==e?e:"";try{const e=JSON.parse(t);if(tw.is(e))return tw.lift(e)}catch(i){}}store(e){this._service.store(this._key,JSON.stringify(e),0,1)}reset(){this._service.remove(this._key,0)}}let Pee=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 Vv,this._disposables=new Cs,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 cee,this.element.domNode.classList.add("editor-widget","suggest-widget"),this._contentWidget=new Fee(this,e),this._persistedSize=new Ree(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 tw(l,d))}this._contentWidget.unlockPreference(),r=void 0}}))),this._messageElement=Lw(this.element.domNode,Mw(".message")),this._listElement=Lw(this.element.domNode,Mw(".tree"));const a=o.createInstance(mee,this.editor);a.onDidClose(this.toggleDetails,this,this._disposables),this._details=new fee(a,this.editor);const l=()=>this.element.domNode.classList.toggle("no-icons",!this.editor.getOption(106).showIcons);l();const d=o.createInstance(Eee,this.editor);this._disposables.add(d),this._disposables.add(d.onDidToggleDetails((()=>this.toggleDetails()))),this._list=new R$("SuggestWidget",this._listElement,{getHeight:e=>this.getLayoutInfo().itemHeight,getTemplateId:e=>"suggestion"},[d],{alwaysConsumeMouseWheel:!0,useShadows:!1,mouseSupport:!1,accessibilityProvider:{getRole:()=>"option",getWidgetAriaLabel:()=>$m(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=$m(0,"{0}{1}, {2}",t,i,n):i?t=$m(0,"{0}{1}",t,i):n&&(t=$m(0,"{0}, {1}",t,n))}if(!e.isResolved||!this._isDetailsVisible())return t;const{documentation:i,detail:n}=e.completion;return $m(0,"{0}, docs: {1}",t,Oa("{0}{1}",n||"",i?"string"==typeof i?i:i.value:""))}}}),this._status=o.createInstance(T7,this.element.domNode);const h=()=>this.element.domNode.classList.toggle("with-status-bar",this.editor.getOption(106).showStatusBar);h(),this._disposables.add(Mz(this._list,n,{listInactiveFocusBackground:Aee,listInactiveFocusOutline:hx})),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)&&(h(),l())}))),this._ctxSuggestWidgetVisible=y3.Visible.bindTo(i),this._ctxSuggestWidgetDetailsVisible=y3.DetailsVisible.bindTo(i),this._ctxSuggestWidgetMultipleSuggestions=y3.MultipleSuggestions.bindTo(i),this._disposables.add(WC(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=Iv((e=>Mee(this,void 0,void 0,(function*(){const t=Fv((()=>{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:kee(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:Aw(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,Aw(this._listElement,this._status.element),Ow(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,Aw(this._listElement,this._status.element),Ow(this._messageElement),this._details.hide(),this._show(),this._focusedItem=void 0;break;case 3:case 4:Aw(this._messageElement),Ow(this._listElement,this._status.element),this._show();break;case 5:Aw(this._messageElement),Ow(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=Fv((()=>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")):!pee(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=JC(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 tw(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,h=s.statusBarHeight+this._list.contentHeight+s.borderHeight,c=s.itemHeight+s.statusBarHeight,u=nw(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,h),f=u.top+g.top-s.verticalPadding,_=Math.min(f,h);let v=Math.min(Math.max(_,m)+s.borderHeight,h);r===(null===(t=this._cappedHeight)||void 0===t?void 0:t.capped)&&(r=this._cappedHeight.wanted),r<c&&(r=c),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 tw(d,s.defaultSize.height),this.element.maxSize=new tw(l,v),this.element.minSize=new tw(220,c),this._cappedHeight=r===h?{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=WV(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 tw(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}};Pee.LOADING_MESSAGE=$m(0,"Loading..."),Pee.NO_SUGGESTIONS_MESSAGE=$m(0,"No suggestions."),Pee=Iee([Tee(1,tZ),Tee(2,Dy),Tee(3,Ry),Tee(4,n_)],Pee);class Fee{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 tw(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 Bee=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},Vee=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};class Wee{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 Hee=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 Cs,this._selectors=new zee((e=>e.priority)),this._telemetryGate=0,this.editor=e,this.model=o.createInstance(L7,this.editor);const a=y3.InsertMode.bindTo(n);a.set(e.getOption(106).insertMode),this.model.onDidTrigger((()=>a.set(e.getOption(106).insertMode))),this.widget=this._toDispose.add(new jv((()=>{const e=this._instantiationService.createInstance(Pee,this.editor);this._toDispose.add(e),this._toDispose.add(e.onDidSelect((e=>this._insertSuggestion(e,0)),this));const t=new f7(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=y3.MakesTextEdit.bindTo(this._contextKeyService),n=y3.HasInsertAndReplaceRange.bindTo(this._contextKeyService),o=y3.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 vC(!0,!1,!1,!1,33))||Ho&&e.toKeybinding().equals(new vC(!1,!1,!1,!0,33))?e.stopPropagation():e.toKeybinding().isModifierKey()||this.editor.focus()}))),e}))),this._overtypingCapturer=this._toDispose.add(new jv((()=>this._toDispose.add(new D7(this.editor,this.model))))),this._alternatives=this._toDispose.add(new jv((()=>this._toDispose.add(new m7(this.editor,this._contextKeyService))))),this._toDispose.add(o.createInstance(u7,e)),this._toDispose.add(this.model.onDidTrigger((e=>{this.widget.value.showTriggered(e.auto,e.shy?250:50),this._lineSuffix.value=new Wee(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=y3.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=i7.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=JF.capture(this.editor);this.editor.executeEdits("suggestController.additionalTextEdits.sync",s.completion.additionalTextEdits.map((e=>oW.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,h=this.editor.onWillType((()=>{h.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=JF.capture(this.editor);return this.editor.executeEdits("suggestController.additionalTextEdits.async",s.completion.additionalTextEdits.map((e=>oW.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(),h.dispose()})))}let{insertText:d}=s.completion;4&s.completion.insertTextRules||(d=J2.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===jee.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($A(e.uri)).toString(16),languageId:e.getLanguageId(),fileExtension:KA(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)){$w($m(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)}};Hee.ID="editor.contrib.suggestController",Hee=Bee([Vee(1,d7),Vee(2,iy),Vee(3,Dy),Vee(4,n_),Vee(5,tb),Vee(6,tS)],Hee);class zee{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 jee extends rS{constructor(){super({id:jee.id,label:$m(0,"Trigger Suggest"),alias:"Trigger Suggest",precondition:ry.and(dI.writable,dI.hasCompletionItemProvider),kbOpts:{kbExpr:dI.textInputFocus,primary:2058,secondary:[2087],mac:{primary:266,secondary:[521,2087]},weight:100}})}run(e,t,i){const n=Hee.get(t);if(!n)return;let o;i&&"object"==typeof i&&!0===i.auto&&(o=!0),n.triggerSuggest(void 0,o)}}jee.id="editor.action.triggerSuggest",gS(Hee.ID,Hee),hS(jee);const Uee=sS.bindToContribution(Hee.get);dS(new Uee({id:"acceptSelectedSuggestion",precondition:y3.Visible,handler(e){e.acceptSelectedSuggestion(!0,!1)}})),Jy.registerKeybindingRule({id:"acceptSelectedSuggestion",when:ry.and(y3.Visible,dI.textInputFocus),primary:2,weight:190}),Jy.registerKeybindingRule({id:"acceptSelectedSuggestion",when:ry.and(y3.Visible,dI.textInputFocus,y3.AcceptSuggestionsOnEnter,y3.MakesTextEdit),primary:3,weight:190}),Zy.appendMenuItem(S3,{command:{id:"acceptSelectedSuggestion",title:$m(0,"Insert")},group:"left",order:1,when:y3.HasInsertAndReplaceRange.toNegated()}),Zy.appendMenuItem(S3,{command:{id:"acceptSelectedSuggestion",title:$m(0,"Insert")},group:"left",order:1,when:ry.and(y3.HasInsertAndReplaceRange,y3.InsertMode.isEqualTo("insert"))}),Zy.appendMenuItem(S3,{command:{id:"acceptSelectedSuggestion",title:$m(0,"Replace")},group:"left",order:1,when:ry.and(y3.HasInsertAndReplaceRange,y3.InsertMode.isEqualTo("replace"))}),dS(new Uee({id:"acceptAlternativeSelectedSuggestion",precondition:ry.and(y3.Visible,dI.textInputFocus),kbOpts:{weight:190,kbExpr:dI.textInputFocus,primary:1027,secondary:[1026]},handler(e){e.acceptSelectedSuggestion(!1,!0)},menuOpts:[{menuId:S3,group:"left",order:2,when:ry.and(y3.HasInsertAndReplaceRange,y3.InsertMode.isEqualTo("insert")),title:$m(0,"Replace")},{menuId:S3,group:"left",order:2,when:ry.and(y3.HasInsertAndReplaceRange,y3.InsertMode.isEqualTo("replace")),title:$m(0,"Insert")}]})),ny.registerCommandAlias("acceptSelectedSuggestionOnEnter","acceptSelectedSuggestion"),dS(new Uee({id:"hideSuggestWidget",precondition:y3.Visible,handler:e=>e.cancelSuggestWidget(),kbOpts:{weight:190,kbExpr:dI.textInputFocus,primary:9,secondary:[1033]}})),dS(new Uee({id:"selectNextSuggestion",precondition:ry.and(y3.Visible,y3.MultipleSuggestions),handler:e=>e.selectNextSuggestion(),kbOpts:{weight:190,kbExpr:dI.textInputFocus,primary:18,secondary:[2066],mac:{primary:18,secondary:[2066,300]}}})),dS(new Uee({id:"selectNextPageSuggestion",precondition:ry.and(y3.Visible,y3.MultipleSuggestions),handler:e=>e.selectNextPageSuggestion(),kbOpts:{weight:190,kbExpr:dI.textInputFocus,primary:12,secondary:[2060]}})),dS(new Uee({id:"selectLastSuggestion",precondition:ry.and(y3.Visible,y3.MultipleSuggestions),handler:e=>e.selectLastSuggestion()})),dS(new Uee({id:"selectPrevSuggestion",precondition:ry.and(y3.Visible,y3.MultipleSuggestions),handler:e=>e.selectPrevSuggestion(),kbOpts:{weight:190,kbExpr:dI.textInputFocus,primary:16,secondary:[2064],mac:{primary:16,secondary:[2064,302]}}})),dS(new Uee({id:"selectPrevPageSuggestion",precondition:ry.and(y3.Visible,y3.MultipleSuggestions),handler:e=>e.selectPrevPageSuggestion(),kbOpts:{weight:190,kbExpr:dI.textInputFocus,primary:11,secondary:[2059]}})),dS(new Uee({id:"selectFirstSuggestion",precondition:ry.and(y3.Visible,y3.MultipleSuggestions),handler:e=>e.selectFirstSuggestion()})),dS(new Uee({id:"toggleSuggestionDetails",precondition:y3.Visible,handler:e=>e.toggleSuggestionDetails(),kbOpts:{weight:190,kbExpr:dI.textInputFocus,primary:2058,secondary:[2087],mac:{primary:266,secondary:[2087]}},menuOpts:[{menuId:S3,group:"right",order:1,when:ry.and(y3.DetailsVisible,y3.CanResolve),title:$m(0,"show less")},{menuId:S3,group:"right",order:1,when:ry.and(y3.DetailsVisible.toNegated(),y3.CanResolve),title:$m(0,"show more")}]})),dS(new Uee({id:"toggleExplainMode",precondition:y3.Visible,handler:e=>e.toggleExplainMode(),kbOpts:{weight:100,primary:2133}})),dS(new Uee({id:"toggleSuggestionFocus",precondition:y3.Visible,handler:e=>e.toggleSuggestionFocus(),kbOpts:{weight:190,kbExpr:dI.textInputFocus,primary:2570,mac:{primary:778}}})),dS(new Uee({id:"insertBestCompletion",precondition:ry.and(dI.textInputFocus,ry.equals("config.editor.tabCompletion","on"),u7.AtEnd,y3.Visible.toNegated(),m7.OtherSuggestions.toNegated(),i7.InSnippetMode.toNegated()),handler:(e,t)=>{e.triggerSuggestAndAcceptBest(Zs(t)?Object.assign({fallback:"tab"},t):{fallback:"tab"})},kbOpts:{weight:190,primary:2}})),dS(new Uee({id:"insertNextSuggestion",precondition:ry.and(dI.textInputFocus,ry.equals("config.editor.tabCompletion","on"),m7.OtherSuggestions,y3.Visible.toNegated(),i7.InSnippetMode.toNegated()),handler:e=>e.acceptNextSuggestion(),kbOpts:{weight:190,kbExpr:dI.textInputFocus,primary:2}})),dS(new Uee({id:"insertPrevSuggestion",precondition:ry.and(dI.textInputFocus,ry.equals("config.editor.tabCompletion","on"),m7.OtherSuggestions,y3.Visible.toNegated(),i7.InSnippetMode.toNegated()),handler:e=>e.acceptPrevSuggestion(),kbOpts:{weight:190,kbExpr:dI.textInputFocus,primary:1026}})),hS(class extends rS{constructor(){super({id:"editor.action.resetSuggestSize",label:$m(0,"Reset Suggest Widget Size"),alias:"Reset Suggest Widget Size",precondition:void 0})}run(e,t){var i;null===(i=Hee.get(t))||void 0===i||i.resetWidgetSize()}});class $ee 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 Hv((()=>{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=Hee.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=Kee(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,Nr((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=Hee.get(this.editor);if(!e)return;if(!this.isSuggestWidgetVisible)return;const t=e.widget.value.getFocusedItem();return t?Kee(e,this.editor.getPosition(),t.item,this.isShiftKeyPressed):void 0}stopForceRenderingAbove(){const e=Hee.get(this.editor);e&&e.stopForceRenderingAbove()}forceRenderingAbove(){const e=Hee.get(this.editor);e&&e.forceRenderingAbove()}}function Kee(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 J2).parse(o),n=e.editor.getModel();if(i.children.length>100)return;Q9.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 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)}},Zee=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 Yee=class extends x9{constructor(e,t,i){super(e),this.cache=t,this.languageFeaturesService=i,this.suggestionInlineCompletionSource=this._register(new $ee(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 Hv((()=>this.updateCache()),50)),this.minReservedLineCount=0,this._register(this.suggestionInlineCompletionSource.onDidChange((()=>{this.updateCacheSoon.schedule();this.suggestionInlineCompletionSource.state||(this.minReservedLineCount=0);const e=this.ghostText;e&&(this.minReservedLineCount=Math.max(this.minReservedLineCount,e.parts.map((e=>e.lines.length-1)).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 Zee(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=Iv((e=>Zee(this,void 0,void 0,(function*(){let n;try{n=yield P9(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 O9(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?k9(e,this.editor.getModel(),i,this.editor.getPosition(),t)||new w9(e.range.endLineNumber,[],this.minReservedLineCount):void 0}};Yee=qee([Gee(2,lb)],Yee);var Xee=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},Qee=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}},Jee=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 ete 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 tte=class extends ete{constructor(e,t){super(),this.editor=e,this.instantiationService=t,this.sharedCache=this._register(new ite),this.suggestWidgetAdapterModel=this._register(this.instantiationService.createInstance(Yee,this.editor,this.sharedCache)),this.inlineCompletionsModel=this._register(this.instantiationService.createInstance(T9,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 Jee(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}))}};tte=Xee([Qee(1,n_)],tte);class ite 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 A9(e,t,(()=>this.onDidChangeEmitter.fire()),i)}clearAndLeak(){return this.cache.clearAndLeak()}clear(){this.cache.clear()}}var nte,ote=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},ste=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};const rte=null===(nte=window.trustedTypes)||void 0===nte?void 0:nte.createPolicy("editorGhostText",{createHTML:e=>e});let ate=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(lte,this.editor)),this.additionalLinesWidget=this._register(new dte(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 Sb(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 Sb(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",Kf(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 Cs,l=document.createElement("div");return l.className="button suggest-preview-text",l.append(`+${i} lines…`),a.add(WC(l,"mousedown",(e=>{var t;null===(t=this.model)||void 0===t||t.setExpanded(!0),e.preventDefault(),this.editor.focus()}))),o.append(l),new hte(this.editor,e,o,a)}};ate=ote([ste(2,n_),ste(3,rv)],ate);class lte{constructor(e){this.editor=e,this.decorationIds=[],this.disposableStore=new Cs}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 dte{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),h=n.get(44),c=n.get(59),u=P_(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*c)),u.appendASCIIString('px;width:1000000px;">');const g=Ls(n),p=Ds(n),f=wb.createEmpty(n,o);Mb(new Eb(h.isMonospace&&!s,h.canUseHalfwidthRightwardsArrow,n,!1,g,p,0,f,e.decorations,t,0,h.spaceWidth,h.middotWidth,h.wsmiddotWidth,r,a,l,d!==uf.OFF,null),u),u.appendASCIIString("</div>")}u.appendASCIIString("</div>"),Kf(e,h);const g=u.build(),p=rte?rte.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 hte 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]}}}zy(((e,t)=>{const i=e.getColor(YE);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(XE);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(ZE);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 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},ute=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 pte=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(fte,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}))}};pte.inlineSuggestionVisible=new Ly("inlineSuggestionVisible",!1,$m(0,"Whether an inline suggestion is visible")),pte.inlineSuggestionHasIndentation=new Ly("inlineSuggestionHasIndentation",!1,$m(0,"Whether the inline suggestion starts with whitespace")),pte.inlineSuggestionHasIndentationLessThanTabSize=new Ly("inlineSuggestionHasIndentationLessThanTabSize",!0,$m(0,"Whether the inline suggestion starts with whitespace that is less than what would be inserted by tab")),pte.ID="editor.contrib.ghostTextController",pte=cte([ute(1,n_)],pte);class mte{constructor(e){this.contextKeyService=e,this.inlineCompletionVisible=pte.inlineSuggestionVisible.bindTo(this.contextKeyService),this.inlineCompletionSuggestsIndentation=pte.inlineSuggestionHasIndentation.bindTo(this.contextKeyService),this.inlineCompletionSuggestsIndentationLessThanTabSize=pte.inlineSuggestionHasIndentationLessThanTabSize.bindTo(this.contextKeyService)}}let fte=class extends Uo{constructor(e,t,i){super(),this.editor=e,this.instantiationService=t,this.contextKeyService=i,this.contextKeys=new mte(this.contextKeyService),this.model=this._register(this.instantiationService.createInstance(tte,this.editor)),this.widget=this._register(this.instantiationService.createInstance(ate,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=Ss(s);-1===e&&(e=s.length-1),t=e>0;const n=this.editor.getModel().getOptions().tabSize;i=GD.visibleColumnFromColumn(s,e+1,n)<n}}this.contextKeys.inlineCompletionSuggestsIndentation.set(t),this.contextKeys.inlineCompletionSuggestsIndentationLessThanTabSize.set(i)}};fte=cte([ute(1,n_),ute(2,Dy)],fte);const _te=sS.bindToContribution(pte.get),vte=new _te({id:"editor.action.inlineSuggest.commit",precondition:pte.inlineSuggestionVisible,handler(e){e.commit(),e.editor.focus()}});dS(vte),Jy.registerKeybindingRule({primary:2,weight:200,id:vte.id,when:ry.and(vte.precondition,dI.tabMovesFocus.toNegated(),pte.inlineSuggestionHasIndentationLessThanTabSize)}),dS(new _te({id:"editor.action.inlineSuggest.hide",precondition:pte.inlineSuggestionVisible,kbOpts:{weight:100,primary:9},handler(e){e.hide()}}));class bte extends rS{constructor(){super({id:bte.ID,label:$m(0,"Show Next Inline Suggestion"),alias:"Show Next Inline Suggestion",precondition:ry.and(dI.writable,pte.inlineSuggestionVisible),kbOpts:{weight:100,primary:601}})}run(e,t){return gte(this,void 0,void 0,(function*(){const e=pte.get(t);e&&(e.showNextInlineCompletion(),t.focus())}))}}bte.ID="editor.action.inlineSuggest.showNext";class Cte extends rS{constructor(){super({id:Cte.ID,label:$m(0,"Show Previous Inline Suggestion"),alias:"Show Previous Inline Suggestion",precondition:ry.and(dI.writable,pte.inlineSuggestionVisible),kbOpts:{weight:100,primary:599}})}run(e,t){return gte(this,void 0,void 0,(function*(){const e=pte.get(t);e&&(e.showPreviousInlineCompletion(),t.focus())}))}}Cte.ID="editor.action.inlineSuggest.showPrevious";var wte=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},yte=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};class Ste{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 xte=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=pte.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 W2(1e3,this,qo.fromPositions(e.positionBefore||e.position,e.positionBefore||e.position))}if(7===i.type&&t.shouldShowHoverAt(i.range))return new W2(1e3,this,i.range);if(6===i.type){if(i.detail.mightBeForeignElement&&t.shouldShowHoverAt(i.range))return new W2(1e3,this,i.range)}return null}computeSync(e,t){const i=pte.get(this._editor);return i&&i.shouldShowHoverAt(e.range)?[new Ste(this,e.range,i)]:[]}renderHoverParts(e,t){const i=new Cs,n=t[0];this.accessibilityService.isScreenReaderOptimized()&&this.renderScreenReaderText(e,n,i);const o=i.add(this._menuService.createMenu(qy.InlineCompletionsActions,this._contextKeyService)),s=e.statusBar.addAction({label:$m(0,"Next"),commandId:bte.ID,run:()=>this._commandService.executeCommand(bte.ID)}),r=e.statusBar.addAction({label:$m(0,"Previous"),commandId:Cte.ID,run:()=>this._commandService.executeCommand(Cte.ID)});e.statusBar.addAction({label:$m(0,"Accept"),commandId:vte.id,run:()=>this._commandService.executeCommand(vte.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 Xy&&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=Mw,r=s("div.hover-row.markdown-hover"),a=Lw(r,s("div.hover-contents")),l=i.add(new Y5({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=$m(0,"Suggestion:"),o=i.add(l.render((new CU).appendText(n).appendCodeblock("text",t)));a.replaceChildren(o.element)})(d.renderForScreenReader(t))}e.fragment.appendChild(r)}};function kte(e,t){let i=0;for(let n=0;n<e.length;n++)"\t"===e.charAt(n)?i+=t:i++;return i}function Lte(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 Dte(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,tI.shiftIndent(e,e.length+t,r,a,l)),h=(e,t)=>(t=t||1,tI.unshiftIndent(e,e.length+t,r,a,l));let c,u=[],g=e.getLineContent(i),p=g;if(null!=o){c=o;let e=ts(g);p=c+g.substring(e.length),s.decreaseIndentPattern&&s.decreaseIndentPattern.test(p)&&(c=h(c),p=c+g.substring(e.length)),g!==p&&u.push(oW.replaceMove(new ar(i,1,i,e.length+1),DN(c,a,l)))}else c=ts(g);let m=c;s.increaseIndentPattern&&s.increaseIndentPattern.test(p)?(m=d(m),c=d(c)):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=h(m),c=h(c)),i!==m&&u.push(oW.replaceMove(new ar(f,1,f,i.length+1),DN(m,a,l))),s.unIndentedLinePattern&&s.unIndentedLinePattern.test(t)||(s.increaseIndentPattern&&s.increaseIndentPattern.test(n)?(c=d(c),m=c):m=s.indentNextLinePattern&&s.indentNextLinePattern.test(n)?d(m):c)}return u}xte=wte([yte(1,iy),yte(2,Gy),yte(3,Dy),yte(4,rv),yte(5,Uz),yte(6,NS)],xte),gS(pte.ID,pte),hS(class extends rS{constructor(){super({id:"editor.action.inlineSuggest.trigger",label:$m(0,"Trigger Inline Suggestion"),alias:"Trigger Inline Suggestion",precondition:dI.writable})}run(e,t){return gte(this,void 0,void 0,(function*(){const e=pte.get(t);e&&e.trigger()}))}}),hS(bte),hS(Cte),H2.register(xte);class Ete extends rS{constructor(){super({id:Ete.ID,label:$m(0,"Convert Indentation to Spaces"),alias:"Convert Indentation to Spaces",precondition:dI.writable})}run(e,t){let i=t.getModel();if(!i)return;let n=i.getOptions(),o=t.getSelection();if(!o)return;const s=new Fte(o,n.tabSize);t.pushUndoStop(),t.executeCommands(this.id,[s]),t.pushUndoStop(),i.updateOptions({insertSpaces:!0})}}Ete.ID="editor.action.indentationToSpaces";class Nte extends rS{constructor(){super({id:Nte.ID,label:$m(0,"Convert Indentation to Tabs"),alias:"Convert Indentation to Tabs",precondition:dI.writable})}run(e,t){let i=t.getModel();if(!i)return;let n=i.getOptions(),o=t.getSelection();if(!o)return;const s=new Bte(o,n.tabSize);t.pushUndoStop(),t.executeCommands(this.id,[s]),t.pushUndoStop(),i.updateOptions({insertSpaces:!1})}}Nte.ID="editor.action.indentationToTabs";class Ite extends rS{constructor(e,t){super(t),this.insertSpaces=e}run(e,t){const i=e.get(Hq),n=e.get(Dv);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?$m(0,"Configured Tab Size"):void 0}))),a=Math.min(o.getOptions().tabSize-1,7);setTimeout((()=>{i.pick(r,{placeHolder:$m(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 Tte extends Ite{constructor(){super(!1,{id:Tte.ID,label:$m(0,"Indent Using Tabs"),alias:"Indent Using Tabs",precondition:void 0})}}Tte.ID="editor.action.indentUsingTabs";class Mte extends Ite{constructor(){super(!0,{id:Mte.ID,label:$m(0,"Indent Using Spaces"),alias:"Indent Using Spaces",precondition:void 0})}}Mte.ID="editor.action.indentUsingSpaces";class Ote extends rS{constructor(){super({id:Ote.ID,label:$m(0,"Detect Indentation from Content"),alias:"Detect Indentation from Content",precondition:void 0})}run(e,t){const i=e.get(Dv);let n=t.getModel();if(!n)return;const o=i.getCreationOptions(n.getLanguageId(),n.uri,n.isForSimpleWidget);n.detectIndentation(o.insertSpaces,o.tabSize)}}Ote.ID="editor.action.detectIndentation";class Ate{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 Rte{constructor(e){this.callOnDispose=new Cs,this.callOnModel=new Cs,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=>tI.shiftIndent(e,e.length+1,o,s,r),unshiftIndent:e=>tI.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 h=i.getLineContent(d);if(!/\S/.test(h.substring(0,e.startColumn-1))){const e=bv.getGoodIndentForLine(n,i,i.getLanguageId(),d,l);if(null!==e){let t=ts(h),n=kte(e,o);if(n!==kte(t,o)){let e=Lte(n,o,r);a.push({range:new qo(d,1,d,t.length+1),text:e}),h=e+h.substr(t.length)}else{let e=bv.getIndentMetadata(i,d);if(0===e||8===e)return}}}const c=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===c?h:i.getLineContent(e)},s=bv.getGoodIndentForLine(n,t,i.getLanguageId(),d+1,l);if(null!==s){let t=kte(s,o),n=kte(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=Lte(kte(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 Ate(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 Pte(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)}}Rte.ID="editor.contrib.autoIndentOnPaste";class Fte{constructor(e,t){this.selection=e,this.tabSize=t,this.selectionId=null}getEditOperations(e,t){this.selectionId=t.trackSelection(this.selection),Pte(e,t,this.tabSize,!0)}computeCursorState(e,t){return t.getTrackedSelection(this.selectionId)}}class Bte{constructor(e,t){this.selection=e,this.tabSize=t,this.selectionId=null}getEditOperations(e,t){this.selectionId=t.trackSelection(this.selection),Pte(e,t,this.tabSize,!1)}computeCursorState(e,t){return t.getTrackedSelection(this.selectionId)}}gS(Rte.ID,Rte),hS(Ete),hS(Nte),hS(Tte),hS(Mte),hS(Ote),hS(class extends rS{constructor(){super({id:"editor.action.reindentlines",label:$m(0,"Reindent Lines"),alias:"Reindent Lines",precondition:dI.writable})}run(e,t){const i=e.get(pv);let n=t.getModel();if(!n)return;let o=Dte(n,i,1,n.getLineCount());o.length>0&&(t.pushUndoStop(),t.executeEdits(this.id,o),t.pushUndoStop())}}),hS(class extends rS{constructor(){super({id:"editor.action.reindentselectedlines",label:$m(0,"Reindent Selected Lines"),alias:"Reindent Selected Lines",precondition:dI.writable})}run(e,t){const i=e.get(pv);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=Dte(n,i,e,t);s.push(...o)}s.length>0&&(t.pushUndoStop(),t.executeEdits(this.id,s),t.pushUndoStop())}});var Vte=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 Wte{constructor(e,t){this.range=e,this.direction=t}}class Hte{constructor(e,t,i){this.hint=e,this.anchor=t,this.provider=i,this._isResolved=!1}with(e){const t=new Hte(this.hint,e.anchor,this.provider);return t._isResolved=this._isResolved,t._currentResolve=this._currentResolve,t}resolve(e){return Vte(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 Vte(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 zte{constructor(e,t,i){this._disposables=new Cs,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=zte._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 Hte(e,new Wte(a,o),s))}}this.items=n.sort(((e,t)=>er.compare(e.hint.position,t.hint.position)))}static create(e,t,i,n){return Vte(this,void 0,void 0,(function*(){const o=[],s=e.ordered(t).reverse().map((e=>i.map((i=>Vte(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 zte(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 jte=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 Ute(e,t,i,n){var o;return jte(this,void 0,void 0,(function*(){const s=e.get(Zw),r=e.get(DB),a=e.get(iy),l=e.get(n_),d=e.get(rF);if(yield n.item.resolve(Ia.None),!n.part.location)return;const h=n.part.location,c=[],u=new Set(Zy.getMenuItems(qy.EditorContext).map((e=>Ky(e)?e.command.id:"")));for(const e of pS.getEditorActions())e instanceof w2&&u.has(e.id)&&c.push(new Xw(e.id,e.label,void 0,!0,(()=>jte(this,void 0,void 0,(function*(){const i=yield s.createModelReference(h.uri);try{yield l.invokeFunction(e.run.bind(e),t,new C2(i.object.textEditorModel,qo.getStartPosition(h.range)))}finally{i.dispose()}})))));if(n.part.command){const{command:e}=n.part;c.push(new Jw),c.push(new Xw(e.id,e.title,void 0,!0,(()=>jte(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:sF.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=nw(i);return{x:e.left,y:e.top+e.height+8}},getActions:()=>c,onHide:()=>{t.focus()},autoSelectFirstItem:!0})}))}function $te(e,t,i,n){return jte(this,void 0,void 0,(function*(){const o=e.get(Zw),s=yield o.createModelReference(n.uri);yield i.invokeWithinContext((e=>jte(this,void 0,void 0,(function*(){const o=t.hasSideBySideModifier,r=e.get(Dy),a=l1.inPeekEditor.getValue(r),l=!o&&i.getOption(78)&&!a;return new y2({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 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())}))};class Zte{constructor(){this._entries=new VV(50)}get(e){const t=Zte._key(e);return this._entries.get(t)}set(e,t){const i=Zte._key(e);this._entries.set(i,t)}static _key(e){return`${e.uri.toString()}/${e.getVersionId()}`}}const Yte=s_("IInlayHintsCache");dv(Yte,Zte,!0);class Xte{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 Qte{constructor(e,t){this.part=e,this.hasTriggerModifier=t}}let Jte=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 Cs,this._sessionDisposables=new Cs,this._decorationsMetadata=new Map,this._ruleFactory=new xD(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 Hv((()=>Gte(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 zte.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 Cs,t=e.add(new V0(this._editor)),i=new Cs;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 Qte(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=>Gte(this,void 0,void 0,(function*(){const t=this._getInlayHintLabelPart(e);if(t){const i=t.part;i.location?this._instaService.invokeFunction($te,e,this._editor,i.location):Yl.is(i.command)&&(yield this._invokeCommand(i.command,t.item))}}))))),e}_installDblClickGesture(){return this._editor.onMouseUp((e=>Gte(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=>Gte(this,void 0,void 0,(function*(){if(!(e.event.target instanceof HTMLElement))return;const t=this._getInlayHintLabelPart(e);t&&(yield this._instaService.invokeFunction(Ute,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 AP&&(null==i?void 0:i.attachedData)instanceof Xte?i.attachedData:void 0}_invokeCommand(e,t){var i;return Gte(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:sF.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 Wte(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(),h="--code-editorInlayHintsFontFamily";this._editor.getContainerDomNode().style.setProperty(h,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(${h}), ${kf.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=By(Mk),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),eie(i.label),s&&!g.hint.paddingRight?da.Right:da.None,new Xte(g,e))}if(g.hint.paddingRight&&a(g,!0),s.length>e._MAX_DECORATORS)break}const c=[];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&&(c.push(t),e.classNameRef.dispose(),this._decorationsMetadata.delete(t))}const u=this._editor.deltaDecorations(c,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=By(Bk),e.color=By(Fk)):t.kind===Xl.Type?(e.backgroundColor=By(Pk),e.color=By(Rk)):(e.backgroundColor=By(Ak),e.color=By(Ok))}_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 eie(e){return e.replace(/[ \t]/g," ")}Jte.ID="editor.contrib.InlayHints",Jte._MAX_DECORATORS=1500,Jte=Kte([qte(1,lb),qte(2,$V),qte(3,Yte),qte(4,iy),qte(5,rF),qte(6,n_)],Jte),ny.registerCommand("_executeInlayHintProvider",((e,...t)=>Gte(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(Zw).createModelReference(i);try{const e=yield zte.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 tie=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},iie=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}},nie=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())}))},oie=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 sie extends W2{constructor(e,t){super(10,t,e.item.anchor.range),this.part=e}}let rie=class extends a4{constructor(e,t,i,n,o,s){super(e,t,i,n,s),this._resolverService=o,this.hoverOrdinal=6}suggestHoverAnchor(e){var t;if(!Jte.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 AP&&i.attachedData instanceof Xte?new sie(i.attachedData,this):null}computeSync(){return[]}computeAsync(e,t,i){return e instanceof sie?new Gv((t=>nie(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 CU).appendText(s.item.hint.tooltip):s.item.hint.tooltip&&(r=s.item.hint.tooltip),r&&t.emitOne(new r4(this,e.range,[r],0)),"string"==typeof s.part.tooltip?a=(new CU).appendText(s.part.tooltip):s.part.tooltip&&(a=s.part.tooltip),a&&t.emitOne(new r4(this,e.range,[a],1)),s.part.location||s.part.command){let i;const n=$m(0,"altKey"===this._editor.getOption(70)?Ho?"cmd + click":"ctrl + click":Ho?"option + click":"alt + click");s.part.location&&s.part.command?i=(new CU).appendText($m(0,"Go to Definition ({0}), right click for more",n)):s.part.location?i=(new CU).appendText($m(0,"Go to Definition ({0})",n)):s.part.command&&(i=new CU(`[${$m(0,"Execute Command")}](${l=s.part.command,Ps.from({scheme:IC.command,path:l.id,query:l.arguments&&encodeURIComponent(JSON.stringify(l.arguments))}).toString()} "${s.part.command.title}") (${n})`,{isTrusted:!0})),i&&t.emitOne(new r4(this,e.range,[i],1e4))}var l;const d=yield this._resolveInlayHintLabelPartHover(s,i);try{for(var h,c=oie(d);!(h=yield c.next()).done;){let e=h.value;t.emitOne(e)}}catch(u){n={error:u}}finally{try{h&&!h.done&&(o=c.return)&&(yield o.call(c))}finally{if(n)throw n.error}}})))):Gv.EMPTY}_resolveInlayHintLabelPartHover(e,t){return nie(this,void 0,void 0,(function*(){if(!e.part.location)return Gv.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)?i4(this._languageFeaturesService.hoverProvider,i,new er(n.startLineNumber,n.startColumn),t).filter((e=>!wU(e.hover.contents))).map((t=>new r4(this,e.item.anchor.range,t.hover.contents,2+t.ordinal))):Gv.EMPTY}finally{o.dispose()}}))}};rie=tie([iie(1,rv),iie(2,Uz),iie(3,ev),iie(4,Zw),iie(5,lb)],rie),gS(Jte.ID,Jte),H2.register(rie);class aie{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 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},die=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};let hie=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 nX(this.editor,5),a=o.uri;return this.editorWorkerService.canNavigateValueSet(a)?(this.currentRequest=Iv((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 aie(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=Pv(350),this.decorationRemover.then((()=>this.decorationIds=this.editor.deltaDecorations(this.decorationIds,[]))).catch(Jo)})).catch(Jo)):Promise.resolve(void 0)}};hie.ID="editor.contrib.inPlaceReplaceController",hie.DECORATION=RP.register({description:"in-place-replace",className:"valueSetReplacement"}),hie=lie([die(1,kB)],hie);gS(hie.ID,hie),hS(class extends rS{constructor(){super({id:"editor.action.inPlaceReplace.up",label:$m(0,"Replace with Previous Value"),alias:"Replace with Previous Value",precondition:dI.writable,kbOpts:{kbExpr:dI.editorTextFocus,primary:3154,weight:100}})}run(e,t){const i=hie.get(t);return i?i.run(this.id,!0):Promise.resolve(void 0)}}),hS(class extends rS{constructor(){super({id:"editor.action.inPlaceReplace.down",label:$m(0,"Replace with Next Value"),alias:"Replace with Next Value",precondition:dI.writable,kbOpts:{kbExpr:dI.editorTextFocus,primary:3156,weight:100}})}run(e,t){const i=hie.get(t);return i?i.run(this.id,!1):Promise.resolve(void 0)}}),zy(((e,t)=>{const i=e.getColor(jE);i&&t.addRule(`.monaco-editor.vs .valueSetReplacement { outline: solid 2px ${i}; }`)}));hS(class extends rS{constructor(){super({id:"expandLineSelection",label:$m(0,"Expand Line Selection"),alias:"Expand Line Selection",precondition:void 0,kbOpts:{weight:0,kbExpr:dI.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,YN.expandLineSelection(n,n.getCursorStates())),n.revealPrimaryCursor(i.source,!0)}});class cie{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 h=xs(a);let c=0;if(-1===h)c=1;else{if(h===a.length-1)continue;c=h+2}c=Math.max(d,c),i[n++]=oW.delete(new qo(r,c,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 uie{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 h=this.matchEnterRule(e,a,o,i,n.startLineNumber-1);if(null!==h){let t=Lte(h+kte(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=bv.getGoodIndentForLine(this._autoIndent,l,e.getLanguageIdAtPosition(i,1),n.startLineNumber,a);if(null!==t){let n=ts(e.getLineContent(i)),a=kte(t,o);if(a!==kte(n,o)){let e=Lte(a,o,r);d=e+this.trimLeft(s)}}}t.addEditOperation(new qo(n.startLineNumber,1,n.startLineNumber,1),d+"\n");let c=this.matchEnterRuleMovingDown(e,a,o,n.startLineNumber,i,d);if(null!==c)0!==c&&this.getIndentEditsOfMovingBlock(e,t,n,o,r,c);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=bv.getGoodIndentForLine(this._autoIndent,l,e.getLanguageIdAtPosition(i,1),n.startLineNumber+1,a);if(null!==s){const i=ts(e.getLineContent(n.startLineNumber)),a=kte(s,o),l=kte(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=bv.getGoodIndentForLine(this._autoIndent,l,e.getLanguageIdAtPosition(n.startLineNumber,1),i,a);if(null!==s){let i=ts(e.getLineContent(n.startLineNumber)),a=kte(s,o),l=kte(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=>tI.shiftIndent(n,n.length+1,e,t,i),unshiftIndent:n=>tI.unshiftIndent(n,n.length+1,e,t,i)}}parseEnterResult(e,t,i,n,o){if(o){let s=o.indentation;o.indentAction===c_.None||o.indentAction===c_.Indent?s=o.indentation+o.appendText:o.indentAction===c_.IndentOutdent?s=o.indentation:o.indentAction===c_.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=bv.getIndentMetadata(e,n);return null!==a&&2&a&&(r=t.unshiftIndent(r)),kte(r,i)-kte(o,i)}}return null}matchEnterRuleMovingDown(e,t,i,n,o,s){if(xs(s)>=0){let s=e.getLineMaxColumn(o),r=bv.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(xs(t)>=0)break;o--}if(o<1||n>e.getLineCount())return null;let s=e.getLineMaxColumn(o),r=bv.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),xs(t)>=0)break;r--}if(r<1||n>e.getLineCount())return null;let a=e.getLineMaxColumn(r),l=bv.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!==bv.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=Lte(kte(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 pie{constructor(e,t){this.selection=e,this.descending=t,this.selectionId=null}static getCollator(){return pie._COLLATOR||(pie._COLLATOR=new Intl.Collator),pie._COLLATOR}getEditOperations(e,t){let i=function(e,t,i){let n=mie(e,t,i);if(!n)return null;return oW.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=mie(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 mie(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(pie.getCollator().compare),!0===i&&(r=r.reverse()),{startLineNumber:n,endLineNumber:o,before:s,after:r}}pie._COLLATOR=null;class fie extends rS{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 uie(s.selection,this.down,s.ignore));t.pushUndoStop(),t.executeCommands(this.id,o),t.pushUndoStop()}}class _ie extends rS{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 vie extends rS{constructor(e,t){super(t),this.descending=e}run(e,t){const i=t.getSelections()||[];for(const o of i)if(!pie.canRun(t.getModel(),o,this.descending))return;let n=[];for(let o=0,s=i.length;o<s;o++)n[o]=new pie(i[o],this.descending);t.pushUndoStop(),t.executeCommands(this.id,n),t.pushUndoStop()}}class bie extends rS{constructor(){super({id:bie.ID,label:$m(0,"Trim Trailing Whitespace"),alias:"Trim Trailing Whitespace",precondition:dI.writable,kbOpts:{kbExpr:dI.editorTextFocus,primary:Al(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 cie(o,n);t.pushUndoStop(),t.executeCommands(this.id,[s]),t.pushUndoStop()}}bie.ID="editor.action.trimTrailingWhitespace";class Cie extends rS{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=>oW.replace(e,"")));t.pushUndoStop(),t.executeEdits(this.id,r,s),t.pushUndoStop()}}class wie extends rS{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(oW.replace(a,this._modifyText(l,o)))}else{const e=n.getValueInRange(r);s.push(oW.replace(r,this._modifyText(e,o)))}t.pushUndoStop(),t.executeEdits(this.id,s),t.pushUndoStop()}}class yie{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 Sie extends wie{constructor(){super({id:"editor.action.transformToTitlecase",label:$m(0,"Transform to Title Case"),alias:"Transform to Title Case",precondition:dI.writable})}_modifyText(e,t){const i=Sie.titleBoundary.get();return i?e.toLocaleLowerCase().replace(i,(e=>e.toLocaleUpperCase())):e}}Sie.titleBoundary=new yie("(^|[^\\p{L}\\p{N}']|((^|\\P{L})'))\\p{L}","gmu");class xie extends wie{constructor(){super({id:"editor.action.transformToSnakecase",label:$m(0,"Transform to Snake Case"),alias:"Transform to Snake Case",precondition:dI.writable})}_modifyText(e,t){const i=xie.caseBoundary.get(),n=xie.singleLetters.get();return i&&n?e.replace(i,"$1_$2").replace(n,"$1_$2$3").toLocaleLowerCase():e}}xie.caseBoundary=new yie("(\\p{Ll})(\\p{Lu})","gmu"),xie.singleLetters=new yie("(\\p{Lu}|\\p{N})(\\p{Lu})(\\p{Ll})","gmu"),hS(class extends fie{constructor(){super(!1,{id:"editor.action.copyLinesUpAction",label:$m(0,"Copy Line Up"),alias:"Copy Line Up",precondition:dI.writable,kbOpts:{kbExpr:dI.editorTextFocus,primary:1552,linux:{primary:3600},weight:100},menuOpts:{menuId:qy.MenubarSelectionMenu,group:"2_line",title:$m(0,"&&Copy Line Up"),order:1}})}}),hS(class extends fie{constructor(){super(!0,{id:"editor.action.copyLinesDownAction",label:$m(0,"Copy Line Down"),alias:"Copy Line Down",precondition:dI.writable,kbOpts:{kbExpr:dI.editorTextFocus,primary:1554,linux:{primary:3602},weight:100},menuOpts:{menuId:qy.MenubarSelectionMenu,group:"2_line",title:$m(0,"Co&&py Line Down"),order:2}})}}),hS(class extends rS{constructor(){super({id:"editor.action.duplicateSelection",label:$m(0,"Duplicate Selection"),alias:"Duplicate Selection",precondition:dI.writable,menuOpts:{menuId:qy.MenubarSelectionMenu,group:"2_line",title:$m(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 uie(r,!0));else{const e=new ar(r.endLineNumber,r.endColumn,r.endLineNumber,r.endColumn);n.push(new WN(e,s.getValueInRange(r)))}t.pushUndoStop(),t.executeCommands(this.id,n),t.pushUndoStop()}}),hS(class extends _ie{constructor(){super(!1,{id:"editor.action.moveLinesUpAction",label:$m(0,"Move Line Up"),alias:"Move Line Up",precondition:dI.writable,kbOpts:{kbExpr:dI.editorTextFocus,primary:528,linux:{primary:528},weight:100},menuOpts:{menuId:qy.MenubarSelectionMenu,group:"2_line",title:$m(0,"Mo&&ve Line Up"),order:3}})}}),hS(class extends _ie{constructor(){super(!0,{id:"editor.action.moveLinesDownAction",label:$m(0,"Move Line Down"),alias:"Move Line Down",precondition:dI.writable,kbOpts:{kbExpr:dI.editorTextFocus,primary:530,linux:{primary:530},weight:100},menuOpts:{menuId:qy.MenubarSelectionMenu,group:"2_line",title:$m(0,"Move &&Line Down"),order:4}})}}),hS(class extends vie{constructor(){super(!1,{id:"editor.action.sortLinesAscending",label:$m(0,"Sort Lines Ascending"),alias:"Sort Lines Ascending",precondition:dI.writable})}}),hS(class extends vie{constructor(){super(!0,{id:"editor.action.sortLinesDescending",label:$m(0,"Sort Lines Descending"),alias:"Sort Lines Descending",precondition:dI.writable})}}),hS(class extends rS{constructor(){super({id:"editor.action.removeDuplicateLines",label:$m(0,"Delete Duplicate Lines"),alias:"Delete Duplicate Lines",precondition:dI.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(oW.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()}}),hS(bie),hS(class extends rS{constructor(){super({id:"editor.action.deleteLines",label:$m(0,"Delete Line"),alias:"Delete Line",precondition:dI.writable,kbOpts:{kbExpr:dI.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,h=n.getLineMaxColumn(l);l<n.getLineCount()?(l+=1,h=1):t>1&&(t-=1,d=n.getLineMaxColumn(t)),s.push(oW.replace(new ar(t,d,l,h),"")),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}}),hS(class extends rS{constructor(){super({id:"editor.action.indentLines",label:$m(0,"Indent Line"),alias:"Indent Line",precondition:dI.writable,kbOpts:{kbExpr:dI.editorTextFocus,primary:2137,weight:100}})}run(e,t){const i=t._getViewModel();i&&(t.pushUndoStop(),t.executeCommands(this.id,nI.indent(i.cursorConfig,t.getModel(),t.getSelections())),t.pushUndoStop())}}),hS(class extends rS{constructor(){super({id:"editor.action.outdentLines",label:$m(0,"Outdent Line"),alias:"Outdent Line",precondition:dI.writable,kbOpts:{kbExpr:dI.editorTextFocus,primary:2135,weight:100}})}run(e,t){wI.Outdent.runEditorCommand(e,t,null)}}),hS(class extends rS{constructor(){super({id:"editor.action.insertLineBefore",label:$m(0,"Insert Line Above"),alias:"Insert Line Above",precondition:dI.writable,kbOpts:{kbExpr:dI.editorTextFocus,primary:3075,weight:100}})}run(e,t){const i=t._getViewModel();i&&(t.pushUndoStop(),t.executeCommands(this.id,nI.lineInsertBefore(i.cursorConfig,t.getModel(),t.getSelections())))}}),hS(class extends rS{constructor(){super({id:"editor.action.insertLineAfter",label:$m(0,"Insert Line Below"),alias:"Insert Line Below",precondition:dI.writable,kbOpts:{kbExpr:dI.editorTextFocus,primary:2051,weight:100}})}run(e,t){const i=t._getViewModel();i&&(t.pushUndoStop(),t.executeCommands(this.id,nI.lineInsertAfter(i.cursorConfig,t.getModel(),t.getSelections())))}}),hS(class extends Cie{constructor(){super({id:"deleteAllLeft",label:$m(0,"Delete All Left"),alias:"Delete All Left",precondition:dI.writable,kbOpts:{kbExpr:dI.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)}}),hS(class extends Cie{constructor(){super({id:"deleteAllRight",label:$m(0,"Delete All Right"),alias:"Delete All Right",precondition:dI.writable,kbOpts:{kbExpr:dI.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}}),hS(class extends rS{constructor(){super({id:"editor.action.joinLines",label:$m(0,"Join Lines"),alias:"Join Lines",precondition:dI.writable,kbOpts:{kbExpr:dI.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,h=0;for(let c=0,u=o.length;c<u;c++){let e,t,i=o[c],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(oW.replace(f,m)),e=new ar(f.startLineNumber-h,m.length-g+1,s-h,m.length-g+1)):i.startLineNumber===i.endLineNumber?(a.push(oW.replace(f,m)),e=new ar(i.startLineNumber-h,i.startColumn,i.endLineNumber-h,i.endColumn)):(a.push(oW.replace(f,m)),e=new ar(i.startLineNumber-h,i.startColumn,i.startLineNumber-h,m.length-p)),null!==qo.intersectRanges(f,n)?d=e:l.push(e)}h+=f.endLineNumber-f.startLineNumber}l.unshift(d),t.pushUndoStop(),t.executeEdits(this.id,a,l),t.pushUndoStop()}}),hS(class extends rS{constructor(){super({id:"editor.action.transpose",label:$m(0,"Transpose characters around the cursor"),alias:"Transpose characters around the cursor",precondition:dI.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 VN(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 jN(e,i,new ar(t.lineNumber,t.column+1,t.lineNumber,t.column+1)))}}t.pushUndoStop(),t.executeCommands(this.id,o),t.pushUndoStop()}}),hS(class extends wie{constructor(){super({id:"editor.action.transformToUppercase",label:$m(0,"Transform to Uppercase"),alias:"Transform to Uppercase",precondition:dI.writable})}_modifyText(e,t){return e.toLocaleUpperCase()}}),hS(class extends wie{constructor(){super({id:"editor.action.transformToLowercase",label:$m(0,"Transform to Lowercase"),alias:"Transform to Lowercase",precondition:dI.writable})}_modifyText(e,t){return e.toLocaleLowerCase()}}),xie.caseBoundary.isSupported()&&xie.singleLetters.isSupported()&&hS(xie),Sie.titleBoundary.isSupported()&&hS(Sie);var kie=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},Lie=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}},Die=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 Eie=new Ly("LinkedEditingInputVisible",!1);let Nie=class e extends Uo{constructor(e,t,i,n,o){super(),this.languageConfigurationService=n,this._localToDispose=this._register(new Cs),this._editor=e,this._providers=i.linkedEditingRangeProvider,this._enabled=!1,this._visibleContextKey=Eie.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 Cs),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 Av(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 Av(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 Die(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=Iv((t=>Die(this,void 0,void 0,(function*(){try{const r=new ps(!1),a=yield Iie(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 h=l.map((t=>({range:t,options:e.DECORATION})));this._visibleContextKey.set(!0),this._currentDecorations=this._editor.deltaDecorations(this._currentDecorations,h)}catch(r){Na(r)||Jo(r),this._currentRequest!==s&&this._currentRequest||this.clearRanges()}}))));return this._currentRequest=s,s}))}};Nie.ID="editor.contrib.linkedEditing",Nie.DECORATION=RP.register({description:"linked-editing",stickiness:0,className:"linked-editing-decoration"}),Nie=kie([Lie(1,Dy),Lie(2,lb),Lie(3,pv),Lie(4,$V)],Nie);function Iie(e,t,i,n){return Bv(e.ordered(t).map((e=>()=>Die(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)))}dS(new(sS.bindToContribution(Nie.get))({id:"cancelLinkedEditingInput",precondition:Eie,handler:e=>e.clearRanges(),kbOpts:{kbExpr:dI.editorTextFocus,weight:199,primary:9,secondary:[1033]}}));const Tie=ox("editor.linkedEditingBackground",{dark:QS.fromHex("#f00").transparent(.3),light:QS.fromHex("#f00").transparent(.3),hc:QS.fromHex("#f00").transparent(.3)},$m(0,"Background color when the editor auto renames on type."));zy(((e,t)=>{const i=e.getColor(Tie);i&&t.addRule(`.monaco-editor .linked-editing-decoration { background: ${i}; border-left-color: ${i}; }`)})),lS("_executeLinkedEditingProvider",((e,t,i)=>{const{linkedEditingRangeProvider:n}=e.get(lb);return Iie(n,t,i,Ia.None)})),gS(Nie.ID,Nie),hS(class extends rS{constructor(){super({id:"editor.action.linkedEditing",label:$m(0,"Start Linked Editing"),alias:"Start Linked Editing",precondition:ry.and(dI.writable,dI.hasRenameProvider),kbOpts:{kbExpr:dI.editorTextFocus,primary:3132,weight:100}})}runCommand(e,t){const i=e.get(r_),[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=Nie.get(t);return i?Promise.resolve(i.updateRanges(!0)):Promise.resolve()}});var Mie=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 Oie{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 Mie(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 Aie{constructor(e){this._disposables=new Cs;let t=[];for(const[i,n]of e){const e=i.links.map((e=>new Oie(e,n)));t=Aie._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 Rie(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 Aie(xa(n));return i.isCancellationRequested?(e.dispose(),new Aie([])):e}))}ny.registerCommand("_executeLinkProvider",((e,...t)=>Mie(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(Dv).getModel(i);if(!s)return[];const r=yield Rie(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 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())}))};let Vie=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 Hv((()=>this.computeLinksNow()),1e3)),this.computePromise=null,this.activeLinksList=null,this.currentOccurrences={},this.activeLinkDecorationId=null;const s=this._register(new V0(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 Bie(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=Iv((t=>Rie(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(Hie.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 Hie(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===IC.file&&e.startsWith(`${IC.file}:`)){const i=Ps.parse(e);if(i.scheme===IC.file){const n=WA(i);let o=null;n.startsWith("/./")?o=`.${n.substr(1)}`:n.startsWith("//./")&&(o=`.${n.substr(2)}`),o&&(e=GA(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($m(0,"Failed to open this link because it is not well-formed: {0}",n.url.toString())):"missing"===t?this.notificationService.warn($m(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()}};Vie.ID="editor.linkDetector",Vie=Pie([Fie(1,Uz),Fie(2,rF),Fie(3,lb),Fie(4,$V)],Vie);const Wie={general:RP.register({description:"detected-link",stickiness:1,collapseOnReplaceEdit:!0,inlineClassName:"detected-link"}),active:RP.register({description:"detected-link-active",stickiness:1,collapseOnReplaceEdit:!0,inlineClassName:"detected-link-active"})};class Hie{constructor(e,t){this.link=e,this.decorationId=t}static decoration(e,t){return{range:e.range,options:Hie._getOptions(e,t,!1)}}static _getOptions(e,t,i){const n=Object.assign({},i?Wie.active:Wie.general);return n.hoverMessage=function(e,t){const i=e.url&&/^command:/i.test(e.url.toString()),n=e.tooltip?e.tooltip:$m(0,i?"Execute command":"Follow link"),o=$m(0,t?Ho?"cmd + click":"ctrl + click":Ho?"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=` "${$m(0,"Execute command {0}",i[1])}"`}}return new CU("",!0).appendMarkdown(`[${n}](${e.url.toString(!0).replace(/ /g,"%20")}${t}) (${o})`)}return(new CU).appendText(`${n} (${o})`)}(e,t),n}activate(e,t){e.changeDecorationOptions(this.decorationId,Hie._getOptions(this.link,t,!0))}deactivate(e,t){e.changeDecorationOptions(this.decorationId,Hie._getOptions(this.link,t,!1))}}gS(Vie.ID,Vie),hS(class extends rS{constructor(){super({id:"editor.action.openLink",label:$m(0,"Open Link"),alias:"Open Link",precondition:void 0})}run(e,t){const i=Vie.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)}}}),zy(((e,t)=>{const i=e.getColor(Mk);i&&t.addRule(`.monaco-editor .detected-link-active { color: ${i} !important; }`)}));var zie=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},jie=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};function Uie(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(", ");Kw(1===i.length?$m(0,"Cursor added: {0}",e):$m(0,"Cursors added: {0}",e))}}class $ie{constructor(e,t,i){this.selections=e,this.revealRange=t,this.revealScrollType=i}}class Kie{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 Kie(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 Kie(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 $ie(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 $ie(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 $ie(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 $ie(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 qie extends Uo{constructor(e){super(),this._sessionDispose=this._register(new Cs),this._editor=e,this._ignoreSelectionChange=!1,this._session=null}static get(e){return e.getContribution(qie.ID)}dispose(){this._endSession(),super.dispose()}_beginSessionIfNeeded(e){if(!this._session){const t=Kie.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(!Xie(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))))}}}qie.ID="editor.contrib.multiCursorController";class Gie extends rS{run(e,t){const i=qie.get(t);if(!i)return;const n=k8.get(t);if(!n)return;const o=t._getViewModel();if(o){const e=o.getCursorStates();this._run(i,n),Uie(e,o.getCursorStates())}}}class Zie{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 Yie=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 Hv((()=>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=k8.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=qie.get(i);if(!o)return null;const s=k8.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(!Xie(i.getModel(),e,t))return null}r=Kie.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 Zie(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,h=o.length;e<d;){const t=n[e];if(l>=h)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 Xie(e,t,i){const n=Qie(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!==Qie(e,s,!i))return!1}return!0}function Qie(e,t,i){const n=e.getValueInRange(t);return i?n.toLowerCase():n}Yie.ID="editor.contrib.selectionHighlighter",Yie._SELECTION_HIGHLIGHT_OVERVIEW=RP.register({description:"selection-highlight-overview",stickiness:1,className:"selectionHighlight",minimap:{color:By(GL),position:Lr.Inline},overviewRuler:{color:By(KL),position:aa.Center}}),Yie._SELECTION_HIGHLIGHT=RP.register({description:"selection-highlight",stickiness:1,className:"selectionHighlight"}),Yie=zie([jie(1,lb)],Yie),gS(qie.ID,qie),gS(Yie.ID,Yie),hS(class extends rS{constructor(){super({id:"editor.action.insertCursorAbove",label:$m(0,"Add Cursor Above"),alias:"Add Cursor Above",precondition:void 0,kbOpts:{kbExpr:dI.editorTextFocus,primary:2576,linux:{primary:1552,secondary:[3088]},weight:100},menuOpts:{menuId:qy.MenubarSelectionMenu,group:"3_multi",title:$m(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,YN.addCursorUp(o,s,n)),o.revealTopMostCursor(i.source),Uie(s,o.getCursorStates())}}),hS(class extends rS{constructor(){super({id:"editor.action.insertCursorBelow",label:$m(0,"Add Cursor Below"),alias:"Add Cursor Below",precondition:void 0,kbOpts:{kbExpr:dI.editorTextFocus,primary:2578,linux:{primary:1554,secondary:[3090]},weight:100},menuOpts:{menuId:qy.MenubarSelectionMenu,group:"3_multi",title:$m(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,YN.addCursorDown(o,s,n)),o.revealBottomMostCursor(i.source),Uie(s,o.getCursorStates())}}),hS(class extends rS{constructor(){super({id:"editor.action.insertCursorAtEndOfEachLineSelected",label:$m(0,"Add Cursors to Line Ends"),alias:"Add Cursors to Line Ends",precondition:void 0,kbOpts:{kbExpr:dI.editorTextFocus,primary:1575,weight:100},menuOpts:{menuId:qy.MenubarSelectionMenu,group:"3_multi",title:$m(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),Uie(s,o.getCursorStates())}}),hS(class extends Gie{constructor(){super({id:"editor.action.addSelectionToNextFindMatch",label:$m(0,"Add Selection To Next Find Match"),alias:"Add Selection To Next Find Match",precondition:void 0,kbOpts:{kbExpr:dI.focus,primary:2082,weight:100},menuOpts:{menuId:qy.MenubarSelectionMenu,group:"3_multi",title:$m(0,"Add &&Next Occurrence"),order:5}})}_run(e,t){e.addSelectionToNextFindMatch(t)}}),hS(class extends Gie{constructor(){super({id:"editor.action.addSelectionToPreviousFindMatch",label:$m(0,"Add Selection To Previous Find Match"),alias:"Add Selection To Previous Find Match",precondition:void 0,menuOpts:{menuId:qy.MenubarSelectionMenu,group:"3_multi",title:$m(0,"Add P&&revious Occurrence"),order:6}})}_run(e,t){e.addSelectionToPreviousFindMatch(t)}}),hS(class extends Gie{constructor(){super({id:"editor.action.moveSelectionToNextFindMatch",label:$m(0,"Move Last Selection To Next Find Match"),alias:"Move Last Selection To Next Find Match",precondition:void 0,kbOpts:{kbExpr:dI.focus,primary:Al(2089,2082),weight:100}})}_run(e,t){e.moveSelectionToNextFindMatch(t)}}),hS(class extends Gie{constructor(){super({id:"editor.action.moveSelectionToPreviousFindMatch",label:$m(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)}}),hS(class extends Gie{constructor(){super({id:"editor.action.selectHighlights",label:$m(0,"Select All Occurrences of Find Match"),alias:"Select All Occurrences of Find Match",precondition:void 0,kbOpts:{kbExpr:dI.focus,primary:3114,weight:100},menuOpts:{menuId:qy.MenubarSelectionMenu,group:"3_multi",title:$m(0,"Select All &&Occurrences"),order:7}})}_run(e,t){e.selectAll(t)}}),hS(class extends Gie{constructor(){super({id:"editor.action.changeAll",label:$m(0,"Change All Occurrences"),alias:"Change All Occurrences",precondition:ry.and(dI.writable,dI.editorTextFocus),kbOpts:{kbExpr:dI.editorTextFocus,primary:2108,weight:100},contextMenuOpts:{group:"1_modification",order:1.2}})}_run(e,t){e.selectAll(t)}}),hS(class extends rS{constructor(){super({id:"editor.action.addCursorsToBottom",label:$m(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),Uie(r,s.getCursorStates())}}),hS(class extends rS{constructor(){super({id:"editor.action.addCursorsToTop",label:$m(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),Uie(s,o.getCursorStates())}});var Jie=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 ene={Visible:new Ly("parameterHintsVisible",!1),MultipleSignatures:new Ly("parameterHintsMultipleSignatures",!1)};function tne(e,t,i,n,o){return Jie(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)}}))}ny.registerCommand("_executeSignatureHelpProvider",((e,...t)=>Jie(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(Zw).createModelReference(i);try{const e=yield tne(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 ine,nne=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}}}(ine||(ine={}));class one extends Uo{constructor(e,t,i=one.DEFAULT_DELAY){super(),this._onChangedHints=this._register(new $o),this.onChangedHints=this._onChangedHints.event,this.triggerOnType=!1,this._state=ine.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 Av(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=ine.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 ine.Active(Object.assign(Object.assign({},this.state.hints),{activeSignature:e})),this._onChangedHints.fire(this.state.hints))}doTrigger(e){return nne(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(sne);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 ine.Pending(Iv((e=>tne(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 ine.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=ine.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 sne(e,t){switch(t.triggerKind){case Ql.Invoke:return t;case Ql.ContentChange:return e;case Ql.TriggerCharacter:default:return t}}one.DEFAULT_DELAY=120;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)}};const lne=Mw,dne=dB("parameter-hints-next",br.chevronDown,$m(0,"Icon for show next parameter hint.")),hne=dB("parameter-hints-previous",br.chevronUp,$m(0,"Icon for show previous parameter hint."));let cne=class e extends Uo{constructor(e,t,i,n,o){super(),this.editor=e,this.renderDisposeables=this._register(new Cs),this.visible=!1,this.announcedLabel=null,this.allowEditorOverflow=!0,this.markdownRenderer=this._register(new Y5({editor:e},n,i)),this.model=this._register(new one(e,o.signatureHelpProvider)),this.keyVisible=ene.Visible.bindTo(t),this.keyMultipleSignatures=ene.MultipleSignatures.bindTo(t),this._register(this.model.onChangedHints((e=>{e?(this.show(),this.render(e)):this.hide()})))}createParameterHintDOMNodes(){const e=lne(".editor-widget.parameter-hints-widget"),t=Lw(e,lne(".phwrapper"));t.tabIndex=-1;const i=Lw(t,lne(".controls")),n=Lw(i,lne(".button"+Fy.asCSSSelector(hne))),o=Lw(i,lne(".overloads")),s=Lw(i,lne(".button"+Fy.asCSSSelector(dne)));this._register(BC(n,"click",(e=>{Sw(e),this.previous()}))),this._register(BC(s,"click",(e=>{Sw(e),this.next()})));const r=lne(".body"),a=new sT(r,{});this._register(a),t.appendChild(a.getDomNode());const l=Lw(r,lne(".signature")),d=Lw(r,lne(".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 h=()=>{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};h(),this._register(ds.chain(this.editor.onDidChangeConfiguration.bind(this.editor)).filter((e=>e.hasChanged(44))).on(h,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=Lw(this.domNodes.signature,lne(".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{Lw(o,lne("span")).textContent=n.label}const l=n.parameters[a];if(null==l?void 0:l.documentation){const e=lne("span.documentation");if("string"==typeof l.documentation)e.textContent=l.documentation;else{const t=this.renderMarkdownDocs(l.documentation);e.appendChild(t.element)}Lw(this.domNodes.docs,lne("p",{},e))}if(void 0===n.documentation);else if("string"==typeof n.documentation)Lw(this.domNodes.docs,lne("p",{},n.documentation));else{const e=this.renderMarkdownDocs(n.documentation);Lw(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&&($w($m(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),Lw(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)}};cne.ID="editor.widget.parameterHintsWidget",cne=rne([ane(1,Dy),ane(2,Uz),ane(3,rv),ane(4,lb)],cne);const une=ox("editorHoverWidget.highlightForeground",{dark:mL,light:mL,hc:mL},$m(0,"Foreground color of the active item in the parameter hint."));zy(((e,t)=>{const i=e.getColor(Ik);if(i){const n=e.type===Oy.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(Ek);n&&t.addRule(`.monaco-editor .parameter-hints-widget { background-color: ${n}; }`);const o=e.getColor(cx);o&&t.addRule(`.monaco-editor .parameter-hints-widget a { color: ${o}; }`);const s=e.getColor(ux);s&&t.addRule(`.monaco-editor .parameter-hints-widget a:hover { color: ${s}; }`);const r=e.getColor(Nk);r&&t.addRule(`.monaco-editor .parameter-hints-widget { color: ${r}; }`);const a=e.getColor(gx);a&&t.addRule(`.monaco-editor .parameter-hints-widget code { background-color: ${a}; }`);const l=e.getColor(une);l&&t.addRule(`.monaco-editor .parameter-hints-widget .parameter.active { color: ${l}}`)}));var gne=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},pne=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};let mne=class e extends Uo{constructor(e,t){super(),this.editor=e,this.widget=this._register(t.createInstance(cne,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)}};mne.ID="editor.controller.parameterHints",mne=gne([pne(1,n_)],mne);gS(mne.ID,mne),hS(class extends rS{constructor(){super({id:"editor.action.triggerParameterHints",label:$m(0,"Trigger Parameter Hints"),alias:"Trigger Parameter Hints",precondition:dI.hasSignatureHelpProvider,kbOpts:{kbExpr:dI.editorTextFocus,primary:3082,weight:100}})}run(e,t){const i=mne.get(t);i&&i.trigger({triggerKind:Ql.Invoke})}});const fne=sS.bindToContribution(mne.get);dS(new fne({id:"closeParameterHints",precondition:ene.Visible,handler:e=>e.cancel(),kbOpts:{weight:175,kbExpr:dI.focus,primary:9,secondary:[1033]}})),dS(new fne({id:"showPrevParameterHint",precondition:ry.and(ene.Visible,ene.MultipleSignatures),handler:e=>e.previous(),kbOpts:{weight:175,kbExpr:dI.focus,primary:16,secondary:[528],mac:{primary:16,secondary:[528,302]}}})),dS(new fne({id:"showNextParameterHint",precondition:ry.and(ene.Visible,ene.MultipleSignatures),handler:e=>e.next(),kbOpts:{weight:175,kbExpr:dI.focus,primary:18,secondary:[530],mac:{primary:18,secondary:[530,300]}}}));var _ne=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},vne=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};const bne=new Ly("renameInputVisible",!1,$m(0,"Whether the rename input widget is visible"));let Cne=class{constructor(e,t,i,n,o){this._editor=e,this._acceptKeybindings=t,this._themeService=i,this._keybindingService=n,this._disposables=new Cs,this.allowEditorOverflow=!0,this._visibleContextKey=bne.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",$m(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=$m(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(px);this._domNode.style.backgroundColor=String(null!==(t=e.getColor(nk))&&void 0!==t?t:""),this._domNode.style.boxShadow=s?` 0 0 8px 2px ${s}`:"",this._domNode.style.color=String(null!==(i=e.getColor(fx))&&void 0!==i?i:""),this._input.style.backgroundColor=String(null!==(n=e.getColor(mx))&&void 0!==n?n:"");const r=e.getColor(_x);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 Cs;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)}};Cne=_ne([vne(2,Ry),vne(3,uW),vne(4,Dy)],Cne);var wne=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)}},Sne=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 xne{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 Sne(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 Sne(this,void 0,void 0,(function*(){return this._provideRenameEdits(e,this._providerRenameIdx,[],t)}))}_provideRenameEdits(e,t,i,n){return Sne(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($m(0,"No result.")),n)}))}}let kne=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 Cs,this._cts=new as,this._renameInputField=this._dispoableStore.add(new jv((()=>this._dispoableStore.add(this._instaService.createInstance(Cne,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 Sne(this,void 0,void 0,(function*(){if(this._cts.dispose(!0),!this.editor.hasModel())return;const i=this.editor.getPosition(),n=new xne(this.editor.getModel(),i,this._languageFeaturesService.renameProvider);if(!n.hasProvider())return;let o;this._cts=new oX(this.editor,5);try{const e=n.resolveRenameLocation(this._cts.token);this._progressService.showWhile(e,250),o=yield e}catch(c){return void(null===(e=mJ.get(this.editor))||void 0===e||e.showMessage(c||$m(0,"An unknown error occurred while resolving rename location"),i))}if(!o)return;if(o.rejectReason)return void(null===(t=mJ.get(this.editor))||void 0===t||t.showMessage(o.rejectReason,i));if(this._cts.token.isCancellationRequested)return;this._cts.dispose(),this._cts=new oX(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 h=Tv(n.provideRenameEdits(d.newName,this._cts.token),this._cts.token).then((e=>Sne(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(YV.convert(e),{editor:this.editor,showPreview:d.wantsPreview,label:$m(0,"Renaming '{0}'",null==o?void 0:o.text),quotableLabel:$m(0,"Renaming {0}",null==o?void 0:o.text)}).then((e=>{e.ariaSummary&&$w($m(0,"Successfully renamed '{0}' to '{1}'. Summary: {2}",o.text,d.newName,e.ariaSummary))})).catch((e=>{this._notificationService.error($m(0,"Rename failed to apply edits")),this._logService.error(e)}))))}))),(e=>{this._notificationService.error($m(0,"Rename failed to compute edits")),this._logService.error(e)}));return this._progressService.showWhile(h,250),h}))}acceptRenameInput(e){this._renameInputField.value.acceptInput(e)}cancelRenameInput(){this._renameInputField.value.cancelInput(!0)}};kne.ID="editor.contrib.renameController",kne=wne([yne(1,n_),yne(2,rF),yne(3,ZV),yne(4,MB),yne(5,tb),yne(6,Jv),yne(7,lb)],kne);gS(kne.ID,kne),hS(class extends rS{constructor(){super({id:"editor.action.rename",label:$m(0,"Rename Symbol"),alias:"Rename Symbol",precondition:ry.and(dI.writable,dI.hasRenameProvider),kbOpts:{kbExpr:dI.editorTextFocus,primary:60,weight:100},contextMenuOpts:{group:"1_modification",order:1.1}})}runCommand(e,t){const i=e.get(r_),[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=kne.get(t);return i?i.run():Promise.resolve()}});const Lne=sS.bindToContribution(kne.get);dS(new Lne({id:"acceptRenameInput",precondition:bne,handler:e=>e.acceptRenameInput(!1),kbOpts:{weight:199,kbExpr:dI.focus,primary:3}})),dS(new Lne({id:"acceptRenameInputWithPreview",precondition:ry.and(bne,ry.has("config.editor.rename.enablePreview")),handler:e=>e.acceptRenameInput(!0),kbOpts:{weight:199,kbExpr:dI.focus,primary:1027}})),dS(new Lne({id:"cancelRenameInput",precondition:bne,handler:e=>e.cancelRenameInput(),kbOpts:{weight:199,kbExpr:dI.focus,primary:9,secondary:[1033]}})),lS("_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 Sne(this,void 0,void 0,(function*(){const o=new xne(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)})),lS("_executePrepareRename",(function(e,t,i){return Sne(this,void 0,void 0,(function*(){const{renameProvider:n}=e.get(lb),o=new xne(t,i,n),s=yield o.resolveRenameLocation(Ia.None);if(null==s?void 0:s.rejectReason)throw new Error(s.rejectReason);return s}))})),My.as(eO).registerConfiguration({id:"editor",properties:{"editor.rename.enablePreview":{scope:5,description:$m(0,"Enable/disable the ability to preview changes before renaming"),default:!0,type:"boolean"}}});class Dne{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 Ene=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},Nne=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}},Ine=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 Tne{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 Tne(t,this.ranges);return i.ranges[t].equalsRange(this.ranges[this.index])?i.mov(e):i}}let Mne=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 Ine(this,void 0,void 0,(function*(){if(!this._editor.hasModel())return;const t=this._editor.getSelections(),i=this._editor.getModel();if(this._state||(yield Ane(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 Tne(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}}))}};Mne.ID="editor.contrib.smartSelectController",Mne=Ene([Nne(1,lb)],Mne);class One extends rS{constructor(e,t){super(t),this._forward=e}run(e,t){return Ine(this,void 0,void 0,(function*(){let e=Mne.get(t);e&&(yield e.run(this._forward))}))}}ny.registerCommandAlias("editor.action.smartSelect.grow","editor.action.smartSelect.expand");function Ane(e,t,i,n,o){return Ine(this,void 0,void 0,(function*(){const s=e.all(t).concat(new Dne);1===s.length&&s.unshift(new v7);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}))}))}gS(Mne.ID,Mne),hS(class extends One{constructor(){super(!0,{id:"editor.action.smartSelect.expand",label:$m(0,"Expand Selection"),alias:"Expand Selection",precondition:void 0,kbOpts:{kbExpr:dI.editorTextFocus,primary:1553,mac:{primary:3345,secondary:[1297]},weight:100},menuOpts:{menuId:qy.MenubarSelectionMenu,group:"1_basic",title:$m(0,"&&Expand Selection"),order:2}})}}),hS(class extends One{constructor(){super(!1,{id:"editor.action.smartSelect.shrink",label:$m(0,"Shrink Selection"),alias:"Shrink Selection",precondition:void 0,kbOpts:{kbExpr:dI.editorTextFocus,primary:1551,mac:{primary:3343,secondary:[1295]},weight:100},menuOpts:{menuId:qy.MenubarSelectionMenu,group:"1_basic",title:$m(0,"&&Shrink Selection"),order:3}})}}),ny.registerCommand("_executeSelectionRangeProvider",(function(e,...t){return Ine(this,void 0,void 0,(function*(){const[i,n]=t;Js(Ps.isUri(i));const o=e.get(lb).selectionRangeProvider,s=yield e.get(Zw).createModelReference(i);try{return Ane(o,s.object.textEditorModel,n,{selectLeadingAndTrailingWhitespace:!0},Ia.None)}finally{s.dispose()}}))}));hS(class extends rS{constructor(){super({id:"editor.action.forceRetokenize",label:$m(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 Rne extends rS{constructor(){super({id:Rne.ID,label:$m(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=!ES.getTabFocusMode();ES.setTabFocusMode(i),$w($m(0,i?"Pressing Tab will now move focus to the next focusable element":"Pressing Tab will now insert the tab character"))}}Rne.ID="editor.action.toggleTabFocusMode",hS(Rne);var Pne=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},Fne=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};let Bne=class extends Uo{constructor(e,t,i={},n){var o;super(),this._link=t,this._enabled=!0,this.el=Lw(e,Mw("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 zF(this.el,"click")),r=this._register(new zF(this.el,"keypress")),a=ds.chain(r.event).map((e=>new SC(e))).filter((e=>3===e.keyCode)).event,l=this._register(new zF(this.el,WS.Tap)).event;this._register($S.addTarget(this.el));const d=ds.any(s.event,a,l);this._register(d((e=>{this.enabled&&(Sw(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}};Bne=Pne([Fne(3,Uz)],Bne),zy(((e,t)=>{const i=e.getColor(cx);i&&t.addRule(`.monaco-link { color: ${i}; }`);const n=e.getColor(ux);n&&t.addRule(`.monaco-link:hover { color: ${n}; }`)}));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},Wne=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};let Hne=class extends Uo{constructor(e,t){super(),this._editor=e,this.instantiationService=t,this.banner=this._register(this.instantiationService.createInstance(zne))}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)}};Hne=Vne([Wne(1,n_)],Hne);let zne=class extends Uo{constructor(e){super(),this.instantiationService=e,this.markdownRenderer=this.instantiationService.createInstance(Y5,{}),this.element=Mw("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=Mw("span");return t.innerText=e,t}return this.markdownRenderer.render(e).element}clear(){RC(this.element)}show(e){RC(this.element);const t=this.getAriaLabel(e);t&&this.element.setAttribute("aria-label",t);const i=Lw(this.element,Mw("div.icon-container"));i.setAttribute("aria-hidden","true"),e.icon&&i.appendChild(Mw(`div${Fy.asCSSSelector(e.icon)}`));const n=Lw(this.element,Mw("div.message-container"));if(n.setAttribute("aria-hidden","true"),n.appendChild(this.getBannerMessage(e.message)),this.messageActionsContainer=Lw(this.element,Mw("div.message-actions-container")),e.actions)for(const s of e.actions)this._register(this.instantiationService.createInstance(Bne,this.messageActionsContainer,Object.assign(Object.assign({},s),{tabIndex:-1}),{}));const o=Lw(this.element,Mw("div.action-container"));this.actionBar=this._register(new rB(o)),this.actionBar.push(this._register(new Xw("banner.close","Close Banner",Fy.asClassName(gB),!0,(()=>{"function"==typeof e.onClose&&e.onClose()}))),{icon:!0,label:!1}),this.actionBar.setFocusable(!1)}};zne=Vne([Wne(0,n_)],zne);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},Une=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}},$ne=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 Kne=dB("extensions-warning-message",br.warning,$m(0,"Icon shown with a warning message in the extensions editor."));let qne=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:$m(0,"This document contains many non-basic ASCII unicode characters"),command:new soe};else if(e.ambiguousCharacterCount>=t)i={message:$m(0,"This document contains many ambiguous unicode characters"),command:new noe};else{if(!(e.invisibleCharacterCount>=t))throw new Error("Unreachable");i={message:$m(0,"This document contains many invisible unicode characters"),command:new ooe}}this._bannerController.show({id:"unicodeHighlightBanner",message:i.message,icon:Kne,actions:[{label:i.command.shortLabel,href:`command:${i.command.id}`}],onClose:()=>{this._bannerClosed=!0}})}else this._bannerController.hide()},this._bannerController=this._register(n.createInstance(Hne,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:"inUntrustedWorkspace"===t.nonBasicASCII?!e:t.nonBasicASCII,ambiguousCharacters:t.ambiguousCharacters,invisibleCharacters:t.invisibleCharacters,includeComments:"inUntrustedWorkspace"===t.includeComments?!e:t.includeComments,includeStrings:"inUntrustedWorkspace"===t.includeStrings?!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 Gne(this._editor,t,this._updateState,this._editorWorkerService):this._highlighter=new Zne(this._editor,t,this._updateState)}getDecorationInfo(e){return this._highlighter?this._highlighter.getDecorationInfo(e):null}};qne.ID="editor.contrib.unicodeHighlighter",qne=jne([Une(1,kB),Une(2,HW),Une(3,n_)],qne);let Gne=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 Hv((()=>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:eoe.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:eoe.instance.getDecorationFromOptions(this._options),id:e,ownerId:0};if(!LO(t,n))return null;return{reason:Jne(t.getValueInRange(i),this._options),inComment:DO(t,n),inString:EO(t,n)}}};Gne=jne([Une(3,kB)],Gne);class Zne 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 Hv((()=>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:eoe.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:eoe.instance.getDecorationFromOptions(this._options),id:e,ownerId:0};return LO(t,o)?{reason:Jne(n,this._options),inComment:DO(t,o),inString:EO(t,o)}:null}}let Yne=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(qne.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=Qne(t);let l;switch(e.reason.kind){case 0:l=$m(0,"The character {0} could be confused with the character {1}, which is more common in source code.",a,Qne(e.reason.confusableWith.codePointAt(0)));break;case 1:l=$m(0,"The character {0} is invisible.",a);break;case 2:l=$m(0,"The character {0} is not a basic ASCII character.",a)}const d={codePoint:t,reason:e.reason,inComment:e.inComment,inString:e.inString},h=[{value:`${l} [${$m(0,"Adjust settings")}](command:${roe.ID}?${encodeURIComponent(JSON.stringify(d))})`,isTrusted:!0}];o.push(new r4(this,r.range,h,s++))}return o}renderHoverParts(e,t){return l4(e,t,this._editor,this._languageService,this._openerService)}};function Xne(e){return`U+${e.toString(16).padStart(4,"0")}`}function Qne(e){let t=`\`${Xne(e)}\``;return id.isInvisibleCharacter(e)||(t+=` "${function(e){if(96===e)return"`` ` ``";return"`"+String.fromCodePoint(e)+"`"}(e)}"`),t}function Jne(e,t){return td.computeUnicodeHighlightReason(e,t)}Yne=jne([Une(1,rv),Une(2,Uz)],Yne);class eoe{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=RP.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}}eoe.instance=new eoe;class toe extends rS{constructor(){super({id:noe.ID,label:$m(0,"Disable highlighting of characters in comments"),alias:"Disable highlighting of characters in comments",precondition:void 0}),this.shortLabel=$m(0,"Disable Highlight In Comments")}run(e,t,i){return $ne(this,void 0,void 0,(function*(){let t=null==e?void 0:e.get(ev);t&&this.runAction(t)}))}runAction(e){return $ne(this,void 0,void 0,(function*(){yield e.updateValue(wf,!1,1)}))}}class ioe extends rS{constructor(){super({id:noe.ID,label:$m(0,"Disable highlighting of characters in strings"),alias:"Disable highlighting of characters in strings",precondition:void 0}),this.shortLabel=$m(0,"Disable Highlight In Strings")}run(e,t,i){return $ne(this,void 0,void 0,(function*(){let t=null==e?void 0:e.get(ev);t&&this.runAction(t)}))}runAction(e){return $ne(this,void 0,void 0,(function*(){yield e.updateValue(yf,!1,1)}))}}class noe extends rS{constructor(){super({id:noe.ID,label:$m(0,"Disable highlighting of ambiguous characters"),alias:"Disable highlighting of ambiguous characters",precondition:void 0}),this.shortLabel=$m(0,"Disable Ambiguous Highlight")}run(e,t,i){return $ne(this,void 0,void 0,(function*(){let t=null==e?void 0:e.get(ev);t&&this.runAction(t)}))}runAction(e){return $ne(this,void 0,void 0,(function*(){yield e.updateValue(Cf,!1,1)}))}}noe.ID="editor.action.unicodeHighlight.disableHighlightingOfAmbiguousCharacters";class ooe extends rS{constructor(){super({id:ooe.ID,label:$m(0,"Disable highlighting of invisible characters"),alias:"Disable highlighting of invisible characters",precondition:void 0}),this.shortLabel=$m(0,"Disable Invisible Highlight")}run(e,t,i){return $ne(this,void 0,void 0,(function*(){let t=null==e?void 0:e.get(ev);t&&this.runAction(t)}))}runAction(e){return $ne(this,void 0,void 0,(function*(){yield e.updateValue(vf,!1,1)}))}}ooe.ID="editor.action.unicodeHighlight.disableHighlightingOfInvisibleCharacters";class soe extends rS{constructor(){super({id:soe.ID,label:$m(0,"Disable highlighting of non basic ASCII characters"),alias:"Disable highlighting of non basic ASCII characters",precondition:void 0}),this.shortLabel=$m(0,"Disable Non ASCII Highlight")}run(e,t,i){return $ne(this,void 0,void 0,(function*(){let t=null==e?void 0:e.get(ev);t&&this.runAction(t)}))}runAction(e){return $ne(this,void 0,void 0,(function*(){yield e.updateValue(bf,!1,1)}))}}soe.ID="editor.action.unicodeHighlight.disableHighlightingOfNonBasicAsciiCharacters";class roe extends rS{constructor(){super({id:roe.ID,label:$m(0,"Show Exclude Options"),alias:"Show Exclude Options",precondition:void 0})}run(e,t,i){return $ne(this,void 0,void 0,(function*(){const{codePoint:t,reason:n,inString:o,inComment:s}=i,r=String.fromCodePoint(t),a=e.get(Hq),l=e.get(ev);const d=[];if(0===n.kind)for(const e of n.notAmbiguousInLocales)d.push({label:$m(0,'Allow unicode characters that are more common in the language "{0}".',e),run:()=>$ne(this,void 0,void 0,(function*(){aoe(l,[e])}))});var h;if(d.push({label:(h=t,id.isInvisibleCharacter(h)?$m(0,"Exclude {0} (invisible character) from being highlighted",Xne(h)):$m(0,"Exclude {0} from being highlighted",`${Xne(h)} "${r}"`)),run:()=>function(e,t){return $ne(this,void 0,void 0,(function*(){const i=e.getValue(_f);let n;n="object"==typeof i&&i?i:{};for(const e of t)n[String.fromCodePoint(e)]=!0;yield e.updateValue(_f,n,1)}))}(l,[t])}),s){const e=new toe;d.push({label:e.label,run:()=>$ne(this,void 0,void 0,(function*(){return e.runAction(l)}))})}else if(o){const e=new ioe;d.push({label:e.label,run:()=>$ne(this,void 0,void 0,(function*(){return e.runAction(l)}))})}if(0===n.kind){const e=new noe;d.push({label:e.label,run:()=>$ne(this,void 0,void 0,(function*(){return e.runAction(l)}))})}else if(1===n.kind){const e=new ooe;d.push({label:e.label,run:()=>$ne(this,void 0,void 0,(function*(){return e.runAction(l)}))})}else if(2===n.kind){const e=new soe;d.push({label:e.label,run:()=>$ne(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:$m(0,"Configure Unicode Highlight Options")});c&&(yield c.run())}))}}function aoe(e,t){var i;return $ne(this,void 0,void 0,(function*(){const n=null===(i=e.inspect(Sf).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(Sf,o,1)}))}roe.ID="editor.action.unicodeHighlight.showExcludeOptions",hS(noe),hS(ooe),hS(soe),hS(roe),gS(qne.ID,qne),H2.register(Yne);var loe=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)}},hoe=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 coe=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 hoe(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,"ignoreUnusualLineTerminators")}(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:$m(0,"Unusual Line Terminators"),message:$m(0,"Detected unusual line terminators"),detail:$m(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`.",$A(e.uri)),primaryButton:$m(0,"Remove Unusual Line Terminators"),secondaryButton:$m(0,"Ignore")})).confirmed?e.removeUnusualLineTerminators(this._editor.getSelections()):function(e,t,i){e.setModelProperty(t.uri,"ignoreUnusualLineTerminators",i)}(this._codeEditorService,e,!0)}))}};coe.ID="editor.contrib.unusualLineTerminatorsDetector",coe=loe([doe(1,gV),doe(2,r_)],coe),gS(coe.ID,coe);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},goe=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};let poe=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 Hv((()=>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("editor.semanticHighlighting")&&(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(!Rj(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=Iv((i=>Promise.resolve(Lj(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,pj(r,a,e.getLanguageId()))})).then((()=>this._removeOutstandingRequest(n)),(()=>this._removeOutstandingRequest(n))),n}};poe.ID="editor.contrib.viewportSemanticTokens",poe=uoe([goe(1,Dv),goe(2,Ry),goe(3,ev),goe(4,$V),goe(5,lb)],poe),gS(poe.ID,poe);var moe=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},foe=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};const _oe=ox("editor.wordHighlightBackground",{dark:"#575757B8",light:"#57575740",hc:null},$m(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),voe=ox("editor.wordHighlightStrongBackground",{dark:"#004972B8",light:"#0e639c40",hc:null},$m(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),boe=ox("editor.wordHighlightBorder",{light:null,dark:null,hc:hx},$m(0,"Border color of a symbol during read-access, like reading a variable.")),Coe=ox("editor.wordHighlightStrongBorder",{light:null,dark:null,hc:hx},$m(0,"Border color of a symbol during write-access, like writing to a variable.")),woe=ox("editorOverviewRuler.wordHighlightForeground",{dark:"#A0A0A0CC",light:"#A0A0A0CC",hc:"#A0A0A0CC"},$m(0,"Overview ruler marker color for symbol highlights. The color must not be opaque so as not to hide underlying decorations."),!0),yoe=ox("editorOverviewRuler.wordHighlightStrongForeground",{dark:"#C0A0C0CC",light:"#C0A0C0CC",hc:"#C0A0C0CC"},$m(0,"Overview ruler marker color for write-access symbol highlights. The color must not be opaque so as not to hide underlying decorations."),!0),Soe=new Ly("hasWordHighlights",!1);function xoe(e,t,i,n){return Bv(e.ordered(t).map((e=>()=>Promise.resolve(e.provideDocumentHighlights(t,i,n)).then(void 0,Ta))),gs)}class koe{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=Iv((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 Loe extends koe{constructor(e,t,i,n){super(e,t,i),this._providers=n}_compute(e,t,i,n){return xoe(this._providers,e,t.getPosition(),n).then((e=>e||[]))}}class Doe extends koe{constructor(e,t,i){super(e,t,i),this._selectionIsEmpty=t.isEmpty()}_compute(e,t,i,n){return Pv(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)}}lS("_executeDocumentHighlights",((e,t,i)=>xoe(e.get(lb).documentHighlightProvider,t,i,Ia.None)));class Eoe{constructor(e,t,i){this.toUnhook=new Cs,this.workerRequestTokenId=0,this.workerRequestCompleted=!1,this.workerRequestValue=[],this.lastCursorPositionChangeTime=0,this.renderDecorationsTimer=-1,this.editor=e,this.providers=t,this._hasWordHighlights=Soe.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 xa(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())))+1)%e.length,i=e[t];try{this._ignorePositionChangeEvent=!0,this.editor.setPosition(i.getStartPosition()),this.editor.revealRangeInCenterIfOutsideViewport(i);const n=this._getWord();if(n){$w(`${this.editor.getModel().getLineContent(i.startLineNumber)}, ${t+1} of ${e.length} for '${n.word}'`)}}finally{this._ignorePositionChangeEvent=!1}}moveBack(){let e=this._getSortedHighlights(),t=(e.findIndex((e=>e.containsPosition(this.editor.getPosition())))-1+e.length)%e.length,i=e[t];try{this._ignorePositionChangeEvent=!0,this.editor.setPosition(i.getStartPosition()),this.editor.revealRangeInCenterIfOutsideViewport(i);const n=this._getWord();if(n){$w(`${this.editor.getModel().getLineContent(i.startLineNumber)}, ${t+1} of ${e.length} for '${n.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=(s=this.providers,r=this.model,a=this.editor.getSelection(),l=this.editor.getOption(117),s.has(r)?new Loe(r,a,l,s):new Doe(r,a,l)),this.workerRequest.result.then((t=>{e===this.workerRequestTokenId&&(this.workerRequestCompleted=!0,this.workerRequestValue=t||[],this._beginRenderDecorations())}),Jo)}var s,r,a,l}_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:Eoe._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()}}Eoe._WRITE_OPTIONS=RP.register({description:"word-highlight-strong",stickiness:1,className:"wordHighlightStrong",overviewRuler:{color:By(yoe),position:aa.Center},minimap:{color:By(GL),position:Lr.Inline}}),Eoe._TEXT_OPTIONS=RP.register({description:"selection-highlight",stickiness:1,className:"selectionHighlight",overviewRuler:{color:By(KL),position:aa.Center},minimap:{color:By(GL),position:Lr.Inline}}),Eoe._REGULAR_OPTIONS=RP.register({description:"word-highlight",stickiness:1,className:"wordHighlight",overviewRuler:{color:By(woe),position:aa.Center},minimap:{color:By(GL),position:Lr.Inline}});let Noe=class e extends Uo{constructor(e,t,i){super(),this.wordHighlighter=null;const n=()=>{e.hasModel()&&(this.wordHighlighter=new Eoe(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()}};Noe.ID="editor.contrib.wordHighlighter",Noe=moe([foe(1,Dy),foe(2,lb)],Noe);class Ioe extends rS{constructor(e,t){super(t),this._isNext=e}run(e,t){const i=Noe.get(t);i&&(this._isNext?i.moveNext():i.moveBack())}}gS(Noe.ID,Noe),hS(class extends Ioe{constructor(){super(!0,{id:"editor.action.wordHighlight.next",label:$m(0,"Go to Next Symbol Highlight"),alias:"Go to Next Symbol Highlight",precondition:Soe,kbOpts:{kbExpr:dI.editorTextFocus,primary:65,weight:100}})}}),hS(class extends Ioe{constructor(){super(!1,{id:"editor.action.wordHighlight.prev",label:$m(0,"Go to Previous Symbol Highlight"),alias:"Go to Previous Symbol Highlight",precondition:Soe,kbOpts:{kbExpr:dI.editorTextFocus,primary:1089,weight:100}})}}),hS(class extends rS{constructor(){super({id:"editor.action.wordHighlight.trigger",label:$m(0,"Trigger Symbol Highlight"),alias:"Trigger Symbol Highlight",precondition:Soe.toNegated(),kbOpts:{kbExpr:dI.editorTextFocus,primary:0,weight:100}})}run(e,t,i){const n=Noe.get(t);n&&n.restoreViewState(!0)}}),zy(((e,t)=>{const i=e.getColor(bk);i&&(t.addRule(`.monaco-editor .focused .selectionHighlight { background-color: ${i}; }`),t.addRule(`.monaco-editor .selectionHighlight { background-color: ${i.transparent(.5)}; }`));const n=e.getColor(_oe);n&&t.addRule(`.monaco-editor .wordHighlight { background-color: ${n}; }`);const o=e.getColor(voe);o&&t.addRule(`.monaco-editor .wordHighlightStrong { background-color: ${o}; }`);const s=e.getColor(Ck);s&&t.addRule(`.monaco-editor .selectionHighlight { border: 1px ${"hc"===e.type?"dotted":"solid"} ${s}; box-sizing: border-box; }`);const r=e.getColor(boe);r&&t.addRule(`.monaco-editor .wordHighlight { border: 1px ${"hc"===e.type?"dashed":"solid"} ${r}; box-sizing: border-box; }`);const a=e.getColor(Coe);a&&t.addRule(`.monaco-editor .wordHighlightStrong { border: 1px ${"hc"===e.type?"dashed":"solid"} ${a}; box-sizing: border-box; }`)}));class Toe extends sS{constructor(e){super(e),this._inSelectionMode=e.inSelectionMode,this._wordNavigationType=e.wordNavigationType}runEditorCommand(e,t,i){if(!t.hasModel())return;const n=hr(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=>MN.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 Moe extends Toe{_move(e,t,i,n){return qN.moveWordLeft(e,t,i,n)}}class Ooe extends Toe{_move(e,t,i,n){return qN.moveWordRight(e,t,i,n)}}class Aoe extends sS{constructor(e){super(e),this._whitespaceHeuristics=e.whitespaceHeuristics,this._wordNavigationType=e.wordNavigationType}runEditorCommand(e,t,i){const n=e.get(pv);if(!t.hasModel())return;const o=hr(t.getOption(117)),s=t.getModel(),r=t.getSelections(),a=t.getOption(5),l=t.getOption(8),d=n.getLanguageConfiguration(s.getLanguageId()).getAutoClosingPairs(),h=t._getViewModel(),c=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:h.getCursorAutoClosedCharacters()},this._wordNavigationType);return new VN(i,"")}));t.pushUndoStop(),t.executeCommands(this.id,c),t.pushUndoStop()}}class Roe extends Aoe{_delete(e,t){let i=qN.deleteWordLeft(e,t);return i||new qo(1,1,1,1)}}class Poe extends Aoe{_delete(e,t){let i=qN.deleteWordRight(e,t);if(i)return i;const n=e.model.getLineCount(),o=e.model.getLineMaxColumn(n);return new qo(n,o,n,o)}}dS(new class extends Moe{constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:"cursorWordStartLeft",precondition:void 0})}}),dS(new class extends Moe{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordEndLeft",precondition:void 0})}}),dS(new class extends Moe{constructor(){var e;super({inSelectionMode:!1,wordNavigationType:1,id:"cursorWordLeft",precondition:void 0,kbOpts:{kbExpr:ry.and(dI.textInputFocus,null===(e=ry.and(IS,XK))||void 0===e?void 0:e.negate()),primary:2063,mac:{primary:527},weight:100}})}}),dS(new class extends Moe{constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:"cursorWordStartLeftSelect",precondition:void 0})}}),dS(new class extends Moe{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordEndLeftSelect",precondition:void 0})}}),dS(new class extends Moe{constructor(){var e;super({inSelectionMode:!0,wordNavigationType:1,id:"cursorWordLeftSelect",precondition:void 0,kbOpts:{kbExpr:ry.and(dI.textInputFocus,null===(e=ry.and(IS,XK))||void 0===e?void 0:e.negate()),primary:3087,mac:{primary:1551},weight:100}})}}),dS(new class extends Ooe{constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:"cursorWordStartRight",precondition:void 0})}}),dS(new class extends Ooe{constructor(){var e;super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordEndRight",precondition:void 0,kbOpts:{kbExpr:ry.and(dI.textInputFocus,null===(e=ry.and(IS,XK))||void 0===e?void 0:e.negate()),primary:2065,mac:{primary:529},weight:100}})}}),dS(new class extends Ooe{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordRight",precondition:void 0})}}),dS(new class extends Ooe{constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:"cursorWordStartRightSelect",precondition:void 0})}}),dS(new class extends Ooe{constructor(){var e;super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordEndRightSelect",precondition:void 0,kbOpts:{kbExpr:ry.and(dI.textInputFocus,null===(e=ry.and(IS,XK))||void 0===e?void 0:e.negate()),primary:3089,mac:{primary:1553},weight:100}})}}),dS(new class extends Ooe{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordRightSelect",precondition:void 0})}}),dS(new class extends Moe{constructor(){super({inSelectionMode:!1,wordNavigationType:3,id:"cursorWordAccessibilityLeft",precondition:void 0})}_move(e,t,i,n){return super._move(hr(Ef.wordSeparators.defaultValue),t,i,n)}}),dS(new class extends Moe{constructor(){super({inSelectionMode:!0,wordNavigationType:3,id:"cursorWordAccessibilityLeftSelect",precondition:void 0})}_move(e,t,i,n){return super._move(hr(Ef.wordSeparators.defaultValue),t,i,n)}}),dS(new class extends Ooe{constructor(){super({inSelectionMode:!1,wordNavigationType:3,id:"cursorWordAccessibilityRight",precondition:void 0})}_move(e,t,i,n){return super._move(hr(Ef.wordSeparators.defaultValue),t,i,n)}}),dS(new class extends Ooe{constructor(){super({inSelectionMode:!0,wordNavigationType:3,id:"cursorWordAccessibilityRightSelect",precondition:void 0})}_move(e,t,i,n){return super._move(hr(Ef.wordSeparators.defaultValue),t,i,n)}}),dS(new class extends Roe{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:0,id:"deleteWordStartLeft",precondition:dI.writable})}}),dS(new class extends Roe{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:2,id:"deleteWordEndLeft",precondition:dI.writable})}}),dS(new class extends Roe{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:0,id:"deleteWordLeft",precondition:dI.writable,kbOpts:{kbExpr:dI.textInputFocus,primary:2049,mac:{primary:513},weight:100}})}}),dS(new class extends Poe{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:0,id:"deleteWordStartRight",precondition:dI.writable})}}),dS(new class extends Poe{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:2,id:"deleteWordEndRight",precondition:dI.writable})}}),dS(new class extends Poe{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:2,id:"deleteWordRight",precondition:dI.writable,kbOpts:{kbExpr:dI.textInputFocus,primary:2068,mac:{primary:532},weight:100}})}}),hS(class extends rS{constructor(){super({id:"deleteInsideWord",precondition:dI.writable,label:$m(0,"Delete Word"),alias:"Delete Word"})}run(e,t,i){if(!t.hasModel())return;const n=hr(t.getOption(117)),o=t.getModel(),s=t.getSelections().map((e=>{const t=qN.deleteInsideWord(n,o,e);return new VN(t,"")}));t.pushUndoStop(),t.executeCommands(this.id,s),t.pushUndoStop()}});class Foe extends Toe{_move(e,t,i,n){return GN.moveWordPartLeft(e,t,i)}}ny.registerCommandAlias("cursorWordPartStartLeft","cursorWordPartLeft");ny.registerCommandAlias("cursorWordPartStartLeftSelect","cursorWordPartLeftSelect");class Boe extends Toe{_move(e,t,i,n){return GN.moveWordPartRight(e,t,i)}}dS(new class extends Aoe{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:0,id:"deleteWordPartLeft",precondition:dI.writable,kbOpts:{kbExpr:dI.textInputFocus,primary:0,mac:{primary:769},weight:100}})}_delete(e,t){let i=GN.deleteWordPartLeft(e);return i||new qo(1,1,1,1)}}),dS(new class extends Aoe{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:2,id:"deleteWordPartRight",precondition:dI.writable,kbOpts:{kbExpr:dI.textInputFocus,primary:0,mac:{primary:788},weight:100}})}_delete(e,t){let i=GN.deleteWordPartRight(e);if(i)return i;const n=e.model.getLineCount(),o=e.model.getLineMaxColumn(n);return new qo(n,o,n,o)}}),dS(new class extends Foe{constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:"cursorWordPartLeft",precondition:void 0,kbOpts:{kbExpr:dI.textInputFocus,primary:0,mac:{primary:783},weight:100}})}}),dS(new class extends Foe{constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:"cursorWordPartLeftSelect",precondition:void 0,kbOpts:{kbExpr:dI.textInputFocus,primary:0,mac:{primary:1807},weight:100}})}}),dS(new class extends Boe{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordPartRight",precondition:void 0,kbOpts:{kbExpr:dI.textInputFocus,primary:0,mac:{primary:785},weight:100}})}}),dS(new class extends Boe{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordPartRightSelect",precondition:void 0,kbOpts:{kbExpr:dI.textInputFocus,primary:0,mac:{primary:1809},weight:100}})}});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},Woe=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};const Hoe=new Ly("accessibilityHelpWidgetVisible",!1);let zoe=class e extends Uo{constructor(e,t){super(),this._editor=e,this._widget=this._register(t.createInstance(joe,this._editor))}static get(t){return t.getContribution(e.ID)}show(){this._widget.show()}hide(){this._widget.hide()}};zoe.ID="editor.contrib.accessibilityHelpController",zoe=Voe([Woe(1,n_)],zoe);let joe=class e extends zI{constructor(e,t,i,n){super(),this._contextKeyService=t,this._keybindingService=i,this._openerService=n,this._editor=e,this._isVisibleKey=Hoe.bindTo(this._contextKeyService),this._domNode=$f(document.createElement("div")),this._domNode.setClassName("accessibilityHelpWidget"),this._domNode.setDisplay("none"),this._domNode.setAttribute("role","dialog"),this._domNode.setAttribute("aria-hidden","true"),this._contentDomNode=$f(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(WC(this._contentDomNode.domNode,"keydown",(e=>{if(this._isVisible&&(e.equals(2083)&&($w(EW.emergencyConfOn),this._editor.updateOptions({accessibilitySupport:"on"}),RC(this._contentDomNode.domNode),this._buildContent(),this._contentDomNode.domNode.focus(),e.preventDefault(),e.stopPropagation()),e.equals(2086))){$w(EW.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?Oa(t,n.getAriaLabel()):Oa(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?Oa(EW.singleSelectionRange,e[0].positionLineNumber,e[0].positionColumn,t):Oa(EW.singleSelection,e[0].positionLineNumber,e[0].positionColumn):t?Oa(EW.multiSelectionRange,e.length,t):e.length>0?Oa(EW.multiSelection,e.length):"":EW.noSelection}(t,i);e.get(54)?e.get(81)?n+=EW.readonlyDiffEditor:n+=EW.editableDiffEditor:e.get(81)?n+=EW.readonlyEditor:n+=EW.editableEditor;const o=Ho?EW.changeConfigToOnMac:EW.changeConfigToOnWinLinux;switch(e.get(2)){case 0:n+="\n\n - "+o;break;case 2:n+="\n\n - "+EW.auto_on;break;case 1:n+="\n\n - "+EW.auto_off,n+=" "+o}e.get(130)?n+="\n\n - "+this._descriptionForCommand(Rne.ID,EW.tabFocusModeOnMsg,EW.tabFocusModeOnMsgNoKb):n+="\n\n - "+this._descriptionForCommand(Rne.ID,EW.tabFocusModeOffMsg,EW.tabFocusModeOffMsgNoKb);n+="\n\n - "+(Ho?EW.openDocMac:EW.openDocWinLinux),n+="\n\n"+EW.outroMsg,this._contentDomNode.domNode.appendChild(sU(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,RC(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)}};joe.ID="editor.contrib.accessibilityHelpWidget",joe.WIDTH=500,joe.HEIGHT=300,joe=Voe([Woe(1,Dy),Woe(2,uW),Woe(3,Uz)],joe);gS(zoe.ID,zoe),hS(class extends rS{constructor(){super({id:"editor.action.showAccessibilityHelp",label:EW.showAccessibilityHelpAction,alias:"Show Accessibility Help",precondition:void 0,kbOpts:{primary:571,weight:100,linux:{primary:1595,secondary:[571]}}})}run(e,t){const i=zoe.get(t);i&&i.show()}});dS(new(sS.bindToContribution(zoe.get))({id:"closeAccessibilityHelp",precondition:Hoe,handler:e=>e.hide(),kbOpts:{weight:200,kbExpr:dI.focus,primary:9,secondary:[1033]}})),zy(((e,t)=>{const i=e.getColor(nk);i&&t.addRule(`.monaco-editor .accessibilityHelpWidget { background-color: ${i}; }`);const n=e.getColor(ok);n&&t.addRule(`.monaco-editor .accessibilityHelpWidget { color: ${n}; }`);const o=e.getColor(px);o&&t.addRule(`.monaco-editor .accessibilityHelpWidget { box-shadow: 0 2px 8px ${o}; }`);const s=e.getColor(dx);s&&t.addRule(`.monaco-editor .accessibilityHelpWidget { border: 2px solid ${s}; }`)}));class Uoe 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 $oe(this.editor):this.widget&&!e&&(this.widget.dispose(),this.widget=null)}dispose(){super.dispose(),this.widget&&(this.widget.dispose(),this.widget=null)}}Uoe.ID="editor.contrib.iPadShowKeyboard";class $oe extends Uo{constructor(e){super(),this.editor=e,this._domNode=document.createElement("textarea"),this._domNode.className="iPadShowKeyboard",this._register(BC(this._domNode,"touchstart",(e=>{this.editor.focus()}))),this._register(BC(this._domNode,"focus",(e=>{this.editor.focus()}))),this.editor.addOverlayWidget(this)}dispose(){this.editor.removeOverlayWidget(this),super.dispose()}getId(){return $oe.ID}getDomNode(){return this._domNode}getPosition(){return{preference:1}}}$oe.ID="editor.contrib.ShowKeyboardWidget",gS(Uoe.ID,Uoe);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},qoe=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};let Goe=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(Es.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 Zoe(this._editor,this._languageService))}stop(){this._widget&&(this._widget.dispose(),this._widget=null)}};Goe.ID="editor.contrib.inspectTokens",Goe=Koe([qoe(1,_G),qoe(2,rv)],Goe);class Zoe 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=Es.get(t);if(i)return i;const n=e.encodeLanguageId(t);return{getInitialState:()=>xv,tokenize:(e,i,n)=>kv(t,n),tokenizeEncoded:(e,t,i)=>Lv(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 Zoe._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)}Dw(this._domNode,Mw("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),Mw("span.tm-token-length",void 0,`${s.length} ${1===s.length?"char":"chars"}`))),Lw(this._domNode,Mw("hr.tokens-inspect-separator",{style:"clear:both"}));const r=1+(n<<1)<t.tokens2.length?this._decodeMetadata(t.tokens2[1+(n<<1)]):null;Lw(this._domNode,Mw("table.tm-metadata-table",void 0,Mw("tbody",void 0,Mw("tr",void 0,Mw("td.tm-metadata-key",void 0,"language"),Mw("td.tm-metadata-value",void 0,`${r?r.languageId:"-?-"}`)),Mw("tr",void 0,Mw("td.tm-metadata-key",void 0,"token type"),Mw("td.tm-metadata-value",void 0,`${r?this._tokenTypeToString(r.tokenType):"-?-"}`)),Mw("tr",void 0,Mw("td.tm-metadata-key",void 0,"font style"),Mw("td.tm-metadata-value",void 0,`${r?this._fontStyleToString(r.fontStyle):"-?-"}`)),Mw("tr",void 0,Mw("td.tm-metadata-key",void 0,"foreground"),Mw("td.tm-metadata-value",void 0,`${r?QS.Format.CSS.formatHex(r.foreground):"-?-"}`)),Mw("tr",void 0,Mw("td.tm-metadata-key",void 0,"background"),Mw("td.tm-metadata-value",void 0,`${r?QS.Format.CSS.formatHex(r.background):"-?-"}`))))),Lw(this._domNode,Mw("hr.tokens-inspect-separator")),i<t.tokens1.length&&Lw(this._domNode,Mw("span.tm-token-type",void 0,t.tokens1[i].type)),this._editor.layoutContentWidget(this)}_decodeMetadata(e){const t=Es.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]}}}Zoe._ID="editor.contrib.inspectTokensWidget",gS(Goe.ID,Goe),hS(class extends rS{constructor(){super({id:"editor.action.inspectTokens",label:IW.inspectTokensAction,alias:"Developer: Inspect Tokens",precondition:void 0})}run(e,t){const i=Goe.get(t);i&&i.launch()}}),zy(((e,t)=>{const i=e.getColor(Ik);if(i){const n=e.type===Oy.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(Ek);n&&t.addRule(`.monaco-editor .tokens-inspect-widget { background-color: ${n}; }`);const o=e.getColor(Nk);o&&t.addRule(`.monaco-editor .tokens-inspect-widget { color: ${o}; }`)}));var Yoe=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},Xoe=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};let Qoe=class e{constructor(e){this.quickInputService=e,this.registry=My.as(Wq)}provide(t){const i=new Cs;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:$m(0,"global commands"),type:"separator"},...o,{label:$m(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:$m(0,"{0}, {1}",s,e.description),description:e.description})}return{editorProviders:i,globalProviders:t}}};Qoe.PREFIX="?",Qoe=Yoe([Xoe(0,Hq)],Qoe),My.as(Wq).registerQuickAccessProvider({ctor:Qoe,prefix:"",helpEntries:[{description:MW.helpQuickAccessActionLabel,needsEditor:!0}]});class Joe{constructor(e){this.options=e,this.rangeHighlightDecorationId=void 0}provide(e,t){var i;const n=new Cs;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 Cs,n=this.activeTextEditorControl;if(n&&this.canProvideWithTextEditor(n)){const o={editor:n},s=lX(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 aX(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:By(JE),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 ese extends Joe{constructor(){super({canAcceptInBackground:!0})}provideWithoutTextEditor(e){const t=$m(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 Cs;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(ese.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=lX(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)?$m(0,"Go to line {0} and character {1}.",t,i):$m(0,"Go to line {0}.",t);const n=e.getPosition()||{lineNumber:1,column:1},o=this.lineCount(e);return o>1?$m(0,"Current Line: {0}, Character: {1}. Type a line number between 1 and {2} to navigate to.",n.lineNumber,n.column,o):$m(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}}ese.PREFIX=":";var tse=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 nse=class extends ese{constructor(e){super(),this.editorService=e,this.onDidActiveTextEditorControlChange=ds.None}get activeTextEditorControl(){return Qs(this.editorService.getFocusedCodeEditor())}};nse=tse([ise(0,r_)],nse),My.as(Wq).registerQuickAccessProvider({ctor:nse,prefix:nse.PREFIX,helpEntries:[{description:TW.gotoLineActionLabel,needsEditor:!0}]});hS(class extends rS{constructor(){super({id:"editor.action.gotoLine",label:TW.gotoLineActionLabel,alias:"Go to Line/Column...",precondition:void 0,kbOpts:{kbExpr:dI.focus,primary:2085,mac:{primary:293},weight:100}})}run(e){e.get(Hq).quickAccess.show(nse.PREFIX)}});const ose=[void 0,[]];function sse(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]=rse(e,r,i,n);if("number"!=typeof t)return ose;o+=t,s.push(...a)}return[o,ase(s)]}(e,o.values,i,n):rse(e,t,i,n)}function rse(e,t,i,n){const o=hz(t.original,t.originalLowercase,i,e,e.toLowerCase(),n,!0);return o?[o[0],XH(o)]:ose}function ase(e){const t=e.sort(((e,t)=>e.start-t.start)),i=[];let n;for(const o of t)n&&lse(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 lse(e,t){return!(e.end<t.start)&&!(t.end<e.start)}function dse(e){return e.startsWith('"')&&e.endsWith('"')}Object.freeze({score:0});function hse(e){"string"!=typeof e&&(e="");const t=e.toLowerCase(),{pathNormalized:i,normalized:n,normalizedLowercase:o}=cse(e),s=i.indexOf(Fr)>=0,r=dse(e);let a;const l=e.split(" ");if(l.length>1)for(const d of l){const e=dse(d),{pathNormalized:t,normalized:i,normalizedLowercase:n}=cse(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 cse(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 use(e){return Array.isArray(e)?hse(e.map((e=>e.original)).join(" ")):hse(e.original)}var gse=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},pse=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}},mse=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 fse=class e extends Joe{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,$m(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 Cs;return this.provideLabelPick(i,$m(0,"The active text editor does not provide symbol information.")),(()=>{mse(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 mse(this,void 0,void 0,(function*(){if(this._languageFeaturesService.documentSymbolProvider.has(e))return!0;const i=new Uv,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 Cs;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=()=>mse(this,void 0,void 0,(function*(){null==l||l.dispose(!0),n.busy=!1,l=new as(o),n.busy=!0;try{const t=hse(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,$m(0,"No matching editor symbols")):this.provideLabelPick(n,$m(0,"No editor symbols"))}finally{o.isCancellationRequested||(n.busy=!1)}}));r.add(n.onDidChangeValue((()=>d()))),d();let h=!0;return r.add(n.onDidChangeActive((()=>{const[e]=n.activeItems;if(e&&e.range){if(h)return void(h=!1);s.revealRangeInCenter(e.range.selection,0),this.addDecorations(s,e.range.decoration)}}))),r}doGetSymbolPicks(t,i,n,o){return mse(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=use(i.values[0]),d=use(i.values.slice(1))):l=i;const h=[];for(let e=0;e<s.length;e++){const t=s[e],o=sd(t.name),r=`$(${rd.toIcon(t.kind).id}) ${o}`,c=r.length-o.length;let u,g,p,m,f=t.containerName;if((null==n?void 0:n.extraContainerLabel)&&(f=f?`${n.extraContainerLabel} • ${f}`:n.extraContainerLabel),i.original.length>a){let e=!1;if(l!==i&&([u,g]=sse(r,Object.assign(Object.assign({},i),{values:void 0}),a,c),"number"==typeof u&&(e=!0)),"number"!=typeof u&&([u,g]=sse(r,l,a,c),"number"!=typeof u))continue;if(!e&&d){if(f&&d.original.length>0&&([p,m]=sse(f,d)),"number"!=typeof p)continue;"number"==typeof u&&(u+=p)}}const _=t.tags&&t.tags.indexOf(1)>=0;h.push({index:e,kind:t.kind,score:u,label:r,ariaLabel:o,description:f,highlights:_?void 0:{label:g,description:m},range:{selection:qo.collapseToStart(t.selectionRange),decoration:t.range},strikethrough:_,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:$m(0,"right"===i?"Open to the Side":"Open to the Bottom")}]})()})}const c=h.sort(((e,t)=>r?this.compareByKindAndScore(e,t):this.compareByScore(e,t)));let u=[];if(r){let e,t,i=function(){t&&"number"==typeof e&&n>0&&(t.label=Oa(vse[e]||_se,n))},n=0;for(const o of c)e!==o.kind?(i(),e=o.kind,n=1,t={type:"separator"},u.push(t)):n++,u.push(o);i()}else c.length>0&&(u=[{label:$m(0,"symbols ({0})",h.length),type:"separator"},...c]);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=vse[e.kind]||_se,n=vse[t.kind]||_se,o=i.localeCompare(n);return 0===o?this.compareByScore(e,t):o}getDocumentSymbols(e,t){return mse(this,void 0,void 0,(function*(){const i=yield this._outlineModelService.getOrCreate(e,t);return t.isCancellationRequested?[]:i.asListOfDocumentSymbols()}))}};fse.PREFIX="@",fse.SCOPE_PREFIX=":",fse.PREFIX_BY_CATEGORY=`${fse.PREFIX}${fse.SCOPE_PREFIX}`,fse=gse([pse(0,lb),pse(1,v9)],fse);const _se=$m(0,"properties ({0})"),vse={5:$m(0,"methods ({0})"),11:$m(0,"functions ({0})"),8:$m(0,"constructors ({0})"),12:$m(0,"variables ({0})"),4:$m(0,"classes ({0})"),22:$m(0,"structs ({0})"),23:$m(0,"events ({0})"),24:$m(0,"operators ({0})"),10:$m(0,"interfaces ({0})"),2:$m(0,"namespaces ({0})"),3:$m(0,"packages ({0})"),25:$m(0,"type parameters ({0})"),1:$m(0,"modules ({0})"),6:$m(0,"properties ({0})"),9:$m(0,"enumerations ({0})"),21:$m(0,"enumeration members ({0})"),14:$m(0,"strings ({0})"),0:$m(0,"files ({0})"),17:$m(0,"arrays ({0})"),15:$m(0,"numbers ({0})"),16:$m(0,"booleans ({0})"),18:$m(0,"objects ({0})"),19:$m(0,"keys ({0})"),7:$m(0,"fields ({0})"),13:$m(0,"constants ({0})")};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},Cse=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};let wse=class extends fse{constructor(e,t,i){super(t,i),this.editorService=e,this.onDidActiveTextEditorControlChange=ds.None}get activeTextEditorControl(){return Qs(this.editorService.getFocusedCodeEditor())}};wse=bse([Cse(0,r_),Cse(1,lb),Cse(2,v9)],wse),My.as(Wq).registerQuickAccessProvider({ctor:wse,prefix:fse.PREFIX,helpEntries:[{description:RW.quickOutlineActionLabel,prefix:fse.PREFIX,needsEditor:!0},{description:RW.quickOutlineByCategoryActionLabel,prefix:fse.PREFIX_BY_CATEGORY,needsEditor:!0}]});function yse(e,t){return t&&(e.stack||e.stacktrace)?$m(0,"{0}: {1}",xse(e),Sse(e.stack)||Sse(e.stacktrace)):xse(e)}function Sse(e){return Array.isArray(e)?e.join("\n"):e}function xse(e){return"string"==typeof e.code&&"number"==typeof e.errno&&"string"==typeof e.syscall?$m(0,"A system error occurred ({0})",e.message):e.message||$m(0,"An unknown error occurred. Please consult the log for more details.")}function kse(e=null,t=!1){if(!e)return $m(0,"An unknown error occurred. Please consult the log for more details.");if(Array.isArray(e)){const i=xa(e),n=kse(i[0],t);return i.length>1?$m(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 yse(i.error,t);if(i.exception)return yse(i.exception,t)}return e.stack?yse(e,t):e.message?e.message:$m(0,"An unknown error occurred. Please consult the log for more details.")}hS(class extends rS{constructor(){super({id:"editor.action.quickOutline",label:RW.quickOutlineActionLabel,alias:"Go to Symbol...",precondition:dI.hasDocumentSymbolProvider,kbOpts:{kbExpr:dI.focus,primary:3117,weight:100},contextMenuOpts:{group:"navigation",order:3}})}run(e){e.get(Hq).quickAccess.show(fse.PREFIX)}});var Lse,Dse,Ese=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 Nse(e){const t=e;return Array.isArray(t.items)}(Dse=Lse||(Lse={}))[Dse.NO_ACTION=0]="NO_ACTION",Dse[Dse.CLOSE_PICKER=1]="CLOSE_PICKER",Dse[Dse.REFRESH_PICKER=2]="REFRESH_PICKER",Dse[Dse.REMOVE_ITEM=3]="REMOVE_ITEM";class Ise extends Uo{constructor(e,t){super(),this.prefix=e,this.options=t}provide(e,t){var i;const n=new Cs;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=()=>Ese(this,void 0,void 0,(function*(){const i=s.value=new Cs;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(Nse(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([(()=>Ese(this,void 0,void 0,(function*(){yield Pv(Ise.FAST_PICKS_RACE_DELAY),n.isCancellationRequested||i||(t=l(a.picks,!0))})))(),(()=>Ese(this,void 0,void 0,(function*(){e.busy=!0;try{const o=yield a.additionalPicks;if(n.isCancellationRequested)return;let s,r,d,h;if(Nse(a.picks)?(s=a.picks.items,r=a.picks.active):s=a.picks,Nse(o)?(d=o.items,h=o.active):d=o,d.length>0||!t){let t;if(!r&&!h){const i=e.activeItems[0];i&&-1!==s.indexOf(i)&&(t=i)}l({items:[...s,...d],active:r||h||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})=>Ese(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 Lse.NO_ACTION:break;case Lse.CLOSE_PICKER:e.hide();break;case Lse.REFRESH_PICKER:r();break;case Lse.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}}Ise.FAST_PICKS_RACE_DELAY=200;var Tse=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},Mse=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}},Ose=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 Ase=class e extends Ise{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(Rse)),this.options=t}_getPicks(t,i,n){return Ose(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?$m(0,"{0}, {1}",t.label,i.getAriaLabel()):t.label;0===e&&this.commandsHistory.peek(t.commandId)&&(a.push({type:"separator",label:$m(0,"recently used")}),l=!0),0!==e&&l&&!this.commandsHistory.peek(t.commandId)&&(a.push({type:"separator",label:$m(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:()=>Ose(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){Na(e)||this.dialogService.show(oF.Error,$m(0,"Command '{0}' resulted in an error ({1})",t.label,kse(e)))}}))}))}return a}))}};Ase.PREFIX=">",Ase.WORD_FILTER=EH(NH,(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=UH(e,t,0,o,i));)o=$H(t,o+1);return n}),TH),Ase=Tse([Mse(1,n_),Mse(2,uW),Mse(3,iy),Mse(4,tS),Mse(5,gV)],Ase);let Rse=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 VV(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}};Rse.DEFAULT_COMMANDS_HISTORY_LENGTH=50,Rse.PREF_KEY_CACHE="commandPalette.mru.cache",Rse.PREF_KEY_COUNTER="commandPalette.mru.counter",Rse.counter=1,Rse=Tse([Mse(0,tZ),Mse(1,ev)],Rse);class Pse extends Ase{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:bz(i.label)||i.id});return t}}var Fse=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},Bse=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}},Vse=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 Wse=class extends Pse{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 Vse(this,void 0,void 0,(function*(){return this.getCodeEditorCommandPicks()}))}};Wse=Fse([Bse(0,n_),Bse(1,r_),Bse(2,uW),Bse(3,iy),Bse(4,tS),Bse(5,gV)],Wse),My.as(Wq).registerQuickAccessProvider({ctor:Wse,prefix:Wse.PREFIX,helpEntries:[{description:OW.quickCommandHelp,needsEditor:!0}]});hS(class extends rS{constructor(){super({id:"editor.action.quickCommand",label:OW.quickCommandActionLabel,alias:"Command Palette",precondition:void 0,kbOpts:{kbExpr:dI.focus,primary:59,weight:100},contextMenuOpts:{group:"z_commands",order:1}})}run(e){e.get(Hq).quickAccess.show(Wse.PREFIX)}});var Hse=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},zse=globalThis&&globalThis.__param||function(e,t){return function(i,n){t(i,n,e)}};let jse=class extends q1{constructor(e,t,i,n,o,s,r){super(!0,e,t,i,n,o,s,r)}};jse=Hse([zse(1,Dy),zse(2,r_),zse(3,rF),zse(4,n_),zse(5,tZ),zse(6,ev)],jse),gS(q1.ID,jse);function Use(){return new Worker("/vite-vue3-lowcode/assets/json.worker.997795ea.js",{type:"module"})}function $se(){return new Worker("/vite-vue3-lowcode/assets/css.worker.88eefdd3.js",{type:"module"})}hS(class extends rS{constructor(){super({id:"editor.action.toggleHighContrast",label:VW.toggleHighContrast,alias:"Toggle High Contrast Theme",precondition:void 0}),this._originalThemeName=null}run(e,t){const i=e.get(_G);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 Use:"css"===t||"scss"===t||"less"===t?new $se:void 0},RX.getLanguages();var Kse="_container_o8w0l_8",qse="_title_o8w0l_15",Gse="_code_o8w0l_20";let Zse,Yse=!1;var Xse=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=hi(null),i=ai(null),n=()=>{window.requestIdleCallback((()=>{t.value.getAction("editor.action.formatDocument").run()}),{timeout:800})};Cn((()=>{t.value=AX.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}),Zse=t.value.onDidChangeModelContent((i=>{var n;Yse||null==(n=e.onChange)||n.call(e,t.value.getValue(),i)})),n(),t.value.layout(e.layout)})),fn((()=>{Zse&&Zse.dispose()}));return Qn((()=>e.vid),(()=>{if(t.value){const i=t.value,o=i.getModel();o&&e.code!==o.getValue()&&(i.pushUndoStop(),Yse=!0,o.pushEditOperations([],[{range:o.getFullModelRange(),text:e.code}],(()=>null))),i.pushUndoStop(),Yse=!1,n()}}),{immediate:!0}),()=>qi("div",{class:Kse},[e.title&&qi("div",{class:qse},[qi("span",null,[e.title])]),qi("div",{class:Gse,ref:i},null)])}});const Qse=()=>{const{jsonData:e,updatePage:t,currentPage:i,overrideProject:n}=Ne(),o=si({coverRadio:"current",importJsonValue:""}),s=e=>{o.importJsonValue=e};return[{title:"导入JSON",icon:pt,onClick:()=>{Um({title:"导入JSON",props:{width:642},content:()=>qi(Li,null,[qi(Le,{modelValue:o.coverRadio,"onUpdate:modelValue":e=>o.coverRadio=e},{default:()=>[qi(v,{label:"current"},{default:()=>[Ki("覆盖当前页面")]}),qi(v,{label:"all"},{default:()=>[Ki("覆盖整个项目")]})]}),qi(Xse,{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)),up({showClose:!0,type:"success",duration:2e3,message:e?"成功覆盖当前页面":"成功覆盖整个项目"})}})}},{title:"导出JSON",icon:mt,onClick:()=>{const{copy:t}=De({source:JSON.stringify(e)});t().then((()=>up.success("复制成功"))).catch((e=>up.error(`复制失败:${e}`)))}},{title:"真机预览",icon:ft,onClick:()=>{const e=function(e,t){const i=ai(e),n=ai("");return Qn(i,(async e=>{i.value&&E&&(n.value=await pp.toDataURL(e,t))}),{immediate:!0}),n}(`${location.origin}/preview`);Um({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:_t,onClick:()=>{up({showClose:!0,type:"info",duration:2e3,message:"敬请期待!"})}},{title:"撤销",icon:vt,onClick:()=>{up({showClose:!0,type:"info",duration:2e3,message:"敬请期待!"})}},{title:"重做",icon:bt,onClick:()=>{up({showClose:!0,type:"info",duration:2e3,message:"敬请期待!"})}},{title:"清空页面",icon:ct,onClick:()=>{up({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:wt,onClick:()=>{window.open("https://github.com/buqiyuan/vite-vue3-lowcode/issues/new")}}]};const Jse=e=>(Nn("data-v-188f8e00"),e=e(),Dn(),e),ere=Jse((()=>Wi("div",{class:"logo"},null,-1))),tre=Jse((()=>Wi("h3",{class:"font-semibold"},"H5低代码",-1))),ire=["onClick"],nre={class:"title"},ore={href:"https://github.com/buqiyuan/vite-vue3-lowcode",target:"_blank"},sre=["src"],rre={href:"https://gitee.com/buqiyuan/vite-vue3-lowcode",target:"_blank"},are=["src"],lre=["src"];var dre=ad(Zi({name:"PageHeader",setup(e){const t=ai(!1),i=Qse(),{jsonData:n}=Ne(),o=()=>{sessionStorage.setItem(Ee,JSON.stringify(n)),localStorage.setItem(Ee,JSON.stringify(n)),t.value=!0};return(e,n)=>{const s=Ie,r=b,a=Z,l=A,d=Te,h=Me;return Ln(),Vi(Li,null,[qi(d,{type:"flex",class:"header"},{default:no((()=>[qi(s,{span:6,class:"flex items-center"},{default:no((()=>[ere,tre])),_:1}),qi(s,{class:"flex items-center",span:12},{default:no((()=>[(Ln(!0),Vi(Li,null,Mn(fi(i),((e,t)=>(Ln(),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((()=>[(Ln(),Fi(Pn(e.icon)))])),_:2},1024),Wi("div",nre,yi(e.title),1)],8,ire)],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(yt),size:"large",circle:"",class:"flex-shrink-0 !p-6px",onClick:o},null,8,["icon"])])),_:1}),qi(h,{placement:"bottom",width:140,trigger:"hover"},{reference:no((()=>[Wi("img",{src:`${fi(ut)}github.svg`,width:"40",height:"40",alt:""},null,8,lre)])),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",ore,[Wi("img",{src:`${fi(ut)}github.svg`,width:"40",height:"40",alt:""},null,8,sre)])])),_:1})])),_:1}),qi(s,{span:6},{default:no((()=>[qi(l,{class:"item",effect:"dark",content:"gitee",placement:"bottom"},{default:no((()=>[Wi("a",rre,[Wi("img",{src:`${fi(ut)}gitee.svg`,width:"40",height:"40",alt:""},null,8,are)])])),_:1})])),_:1})])),_:1})])),_:1})])),_:1})])),_:1}),qi(gp,{visible:t.value,"onUpdate:visible":n[0]||(n[0]=e=>t.value=e)},null,8,["visible"])],64)}}}),[["__scopeId","data-v-188f8e00"]]);var hre={"list-group-item":"_list-group-item_12ss1_1",listGroupItem:"_list-group-item_12ss1_1"},cre={exports:{}},ure=St(dd); |