UNPKG

@mongodb-js/compass-query-bar

Version:

Renders a component for executing MongoDB queries through a GUI.

2 lines 717 kB
/*! For license information please see browser.js.LICENSE.txt */ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.QueryBarPlugin=t():e.QueryBarPlugin=t()}(self,(function(){return(()=>{var e={7181:(e,t,n)=>{"use strict";function r(){return r=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},r.apply(this,arguments)}n.r(t),n.d(t,{activate:()=>ke,configureActions:()=>q,configureStore:()=>Me,deactivate:()=>Ye,default:()=>we,metadata:()=>Le});var i=n(9497),a=n.n(i),s=n(3980),o=n.n(s);const u=require("hadron-react-components");var c=n(6635);const l=require("@mongodb-js/compass-components"),d={filter:{name:"filter",type:"document",placeholder:"Type a query: { field: 'value' }",link:"https://docs.mongodb.com/compass/current/query/filter/"},project:{name:"project",type:"document",placeholder:"{ field: 0 }",link:"https://docs.mongodb.com/manual/tutorial/project-fields-from-query-results/"},sort:{name:"sort",type:"document",placeholder:"{ field: -1 } or [['field', -1]]",link:"https://docs.mongodb.com/manual/reference/method/cursor.sort/"},collation:{name:"collation",type:"document",placeholder:"{ locale: 'simple' }",link:"https://docs.mongodb.com/master/reference/collation/"},skip:{name:"skip",type:"numeric",placeholder:"0",link:"https://docs.mongodb.com/manual/reference/method/cursor.skip/"},limit:{name:"limit",type:"numeric",placeholder:"0",link:"https://docs.mongodb.com/manual/reference/method/cursor.limit/"},maxTimeMS:{name:"maxTimeMS",label:"Max Time MS",type:"numeric",placeholder:"60000",link:"https://docs.mongodb.com/manual/reference/method/cursor.maxTimeMS/"}},h=require("mongodb-ace-autocompleter"),_=(0,l.css)({minWidth:l.spacing[7],border:"1px solid transparent",borderRadius:l.spacing[1],overflow:"visible"}),f=(0,l.css)({borderColor:l.uiColors.red.base,"&:focus-within":{borderColor:l.uiColors.gray.base}}),m={useSoftTabs:!0,minLines:1,maxLines:10,fontSize:12,highlightActiveLine:!1,showGutter:!1};function p(e,t){const n=e.commands.byName[t];n.bindKey=void 0,e.commands.addCommand(n)}const y=e=>{let{hasError:t,id:n,onChange:r,onApply:s,placeholder:o,refreshEditorAction:u,schemaFields:c=[],serverVersion:d="3.6.0",value:y=""}=e;const g=(0,l.useFocusRing)({outer:!0,focusWithin:!0,hover:!0}),v=(0,i.useRef)(new h.QueryAutoCompleter(d,l.EditorTextCompleter,c)),M=(0,i.useRef)(void 0);(0,i.useEffect)((()=>{const e=u.listen((()=>{M.current?.renderer.updateFull()}));return()=>{e()}}),[u]),(0,i.useLayoutEffect)((()=>{v.current.update(c)}),[c]);const L=(0,i.useCallback)((()=>s()),[s]),b=(0,i.useRef)(L);b.current=L;const k=(0,i.useCallback)((e=>{e.renderer.setPadding(l.spacing[2]),M.current=e,M.current.setBehavioursEnabled(!0),p(e,"indent"),p(e,"outdent"),M.current.commands.addCommand({name:"executeQuery",bindKey:{win:"Enter",mac:"Enter"},exec:()=>{b.current()}})}),[]);return a().createElement(l.Editor,{variant:l.EditorVariant.Shell,className:(0,l.cx)(_,g.className,t&&f),theme:"mongodb-query",text:y,onChangeText:e=>r(e),id:n,options:m,completer:v.current,placeholder:o,fontSize:12,scrollMargin:[6,6,0,0],onLoad:k})},g=(0,l.css)({display:"flex",position:"relative",alignItems:"flex-start"}),v=(0,l.css)({flexGrow:1}),M=(0,l.css)({paddingTop:l.spacing[1],marginRight:l.spacing[2]}),L=(0,l.cx)(M,(0,l.css)({minWidth:3*l.spacing[5]})),b=(0,l.css)({minWidth:l.spacing[7],display:"flex",flexGrow:1}),k=(0,l.css)({input:{borderColor:"transparent"}}),Y=(0,l.css)({input:{borderColor:"transparent"}}),w=(0,l.css)({input:{borderColor:l.uiColors.red.base}}),S=(0,l.css)({height:l.spacing[4]+l.spacing[1],textTransform:"capitalize",display:"flex",alignItems:"center"}),D=(0,l.cx)(S,(0,l.css)({minWidth:3*l.spacing[5]})),x=(0,l.withTheme)((e=>{let{darkMode:t,hasError:n,onApply:r,onChange:s,id:o,placeholder:u="",queryOption:c,refreshEditorAction:h,schemaFields:_=[],serverVersion:f,value:m=""}=e;const p=(0,i.useMemo)((()=>"document"===d[c].type),[c]);return a().createElement("div",{className:(0,l.cx)(g,p&&v),"data-testid":`query-bar-option-${c}`},"filter"!==c&&a().createElement("div",{className:p?D:S},a().createElement(l.Label,{htmlFor:o,id:`query-bar-option-input-${c}-label`,className:p?L:M},c)),a().createElement("div",{className:(0,l.cx)(p&&b)},p?a().createElement(y,{hasError:n,id:o,queryOption:c,onApply:r,onChange:s,placeholder:u,refreshEditorAction:h,schemaFields:_,serverVersion:f,value:m}):a().createElement(l.TextInput,{"aria-labelledby":`query-bar-option-input-${c}-label`,id:o,"data-testid":"query-bar-option-input",className:(0,l.cx)(t?Y:k,n&&w),type:"text",sizeVariant:"small",state:n?"error":"none",value:`${m}`,onChange:e=>s(e.target.value),placeholder:u})))})),T=require("@mongodb-js/compass-logging"),{track:j}=(0,T.createLoggerAndTelemetry)("COMPASS-QUERY-BAR-UI"),A=(0,l.cx)((0,l.css)({border:"none",backgroundColor:"transparent",display:"inline-flex",alignItems:"center",padding:l.spacing[2]-2,marginLeft:l.spacing[1],"&:hover":{cursor:"pointer"}}),l.focusRing),E=(0,l.css)({maxHeight:"calc(100vh - 270px)",marginTop:l.spacing[1],display:"flex"}),O=e=>{let{globalAppRegistry:t,localAppRegistry:n}=e;const r=(0,i.useRef)({component:t.getRole("Query.QueryHistory")?.[0].component,store:n.getStore("Query.History"),actions:n.getAction("Query.History.Actions")}),[s,o]=(0,i.useState)(!1),u=(0,i.useCallback)((e=>{e&&j("Query History Opened"),o(e)}),[o]),c=r.current.component;if(!c)return null;const d=e=>{let{onClose:t}=e;return a().createElement(c,{onClose:t,store:r.current?.store,actions:r.current?.actions})};return a().createElement(l.InteractivePopover,{className:E,trigger:e=>{let{onClick:t,ref:n,children:r}=e;return a().createElement(a().Fragment,null,a().createElement("button",{"data-testid":"query-history-button",onClick:t,className:A,"aria-label":"Open query history","aria-haspopup":"true",tabIndex:0,"aria-expanded":!!s||void 0,type:"button",ref:n},a().createElement(l.Icon,{glyph:"Clock"}),a().createElement(l.Icon,{glyph:"CaretDown"})),r)},open:s,setOpen:u},d)},H=(0,l.css)({alignItems:"flex-start",display:"flex",flexGrow:1,position:"relative",gap:l.spacing[2]}),C=e=>{let{queryOptionsLayout:t,onApply:n,onChangeQueryOption:r,queryOptionProps:i,refreshEditorAction:s,schemaFields:o,serverVersion:u}=e;return a().createElement("div",{className:H},"string"==typeof t?a().createElement(x,{hasError:!i[`${t}Valid`],key:`query-option-${t}`,queryOption:t,onChange:e=>r(t,e),onApply:n,placeholder:i[`${t}Placeholder`]||d[t].placeholder,id:`query-bar-option-input-${t}`,refreshEditorAction:s,schemaFields:o,serverVersion:u,value:i[`${t}String`]}):t.map((e=>a().createElement(x,{hasError:!i[`${e}Valid`],key:`query-option-${e}`,queryOption:e,onChange:t=>r(e,t),onApply:n,placeholder:i[`${e}Placeholder`]||d[e].placeholder,id:`query-bar-option-input-${e}`,refreshEditorAction:s,schemaFields:o,serverVersion:u,value:i[`${e}String`]}))))},P=(0,l.css)({display:"flex",flexDirection:"column",flexGrow:1,background:"white",border:`1px solid ${l.uiColors.gray.light2}`,borderRadius:"6px",padding:l.spacing[2]}),I=(0,l.css)({background:l.uiColors.gray.dark3,borderColor:l.uiColors.gray.dark2}),F=(0,l.css)({display:"flex",alignItems:"flex-start",gap:l.spacing[2],paddingLeft:l.spacing[2]}),N=(0,l.css)({flexGrow:1}),R=(0,l.css)({padding:0}),W=(0,l.css)({display:"flex",flexDirection:"column",marginTop:l.spacing[2],padding:`0 ${l.spacing[2]}px`,gap:l.spacing[2]}),$=(0,l.withTheme)((e=>{let{buttonLabel:t="Apply",darkMode:n,expanded:r=!1,globalAppRegistry:s,localAppRegistry:o,onApply:u,onChangeQueryOption:c,onOpenExportToLanguage:h,onReset:_,queryOptionsLayout:f=["project",["sort","maxTimeMS"],["collation","skip","limit"]],queryState:m,refreshEditorAction:p,resultId:y,schemaFields:g,serverVersion:v,showExportToLanguageButton:M=!0,showQueryHistoryButton:L=!0,toggleExpandQueryOptions:b,valid:k,...Y}=e;const w=(0,i.useCallback)((()=>{k&&u()}),[u,k]),S=(0,i.useCallback)((e=>{e.preventDefault(),w()}),[w]),T="query-bar-option-input-filter";return a().createElement("form",{className:(0,l.cx)(P,n&&I),"data-testid":"query-bar",onSubmit:S,noValidate:!0,"data-result-id":y},a().createElement("div",{className:F},a().createElement("div",{className:D},a().createElement(l.Label,{htmlFor:T,id:"query-bar-option-input-filter-label",className:R},a().createElement(l.Link,{href:"https://docs.mongodb.com/compass/current/query/filter/",target:"_blank"},"Filter")),L&&a().createElement(O,{localAppRegistry:o,globalAppRegistry:s})),a().createElement("div",{className:N},a().createElement(x,{hasError:!Y.filterValid,queryOption:"filter",id:T,onChange:e=>c("filter",e),onApply:w,placeholder:Y.filterPlaceholder||d.filter.placeholder,refreshEditorAction:p,schemaFields:g,serverVersion:v,value:Y.filterString})),a().createElement(l.Button,{"aria-label":"Reset query","data-testid":"query-bar-reset-filter-button",onClick:_,disabled:"apply"!==m,size:"small",type:"button"},"Reset"),a().createElement(l.Button,{"data-testid":"query-bar-apply-filter-button",disabled:!k,variant:"primary",size:"small",type:"submit",onClick:S},t),M&&a().createElement(l.Button,{onClick:h,title:"Open export to language","aria-label":"Open export to language","data-testid":"query-bar-open-export-to-language-button",type:"button",size:"small"},a().createElement(l.Icon,{glyph:"Code"})),f&&f.length>0&&a().createElement(l.MoreOptionsToggle,{"aria-controls":"additional-query-options-container","data-testid":"query-bar-options-toggle",isExpanded:r,onToggleOptions:b})),r&&f&&f.length>0&&a().createElement("div",{className:W,id:"additional-query-options-container"},f.map(((e,t)=>a().createElement(C,{queryOptionsLayout:e,key:`query-bar-row-${t}`,queryOptionProps:Y,onChangeQueryOption:c,onApply:w,refreshEditorAction:p,schemaFields:g,serverVersion:v})))))}));function z(e){let{actions:t,onApply:n,onReset:s,store:o,...l}=e;const d=(0,i.useCallback)((()=>{t.apply(),(0,c.isFunction)(n)&&n()}),[n,t]),h=(0,i.useCallback)((()=>{t.reset(),(0,c.isFunction)(s)&&s()}),[s,t]);return a().createElement(u.StoreConnector,{store:o},a().createElement($,r({onApply:d,onReset:h,onChangeQueryOption:t.typeQueryString,onOpenExportToLanguage:t.exportToLanguage,refreshEditorAction:t.refreshEditor,toggleExpandQueryOptions:t.toggleQueryOptions,globalAppRegistry:o.globalAppRegistry,localAppRegistry:o.localAppRegistry},l)))}z.displayName="QueryBarPlugin",z.propTypes={actions:o().object.isRequired,onApply:o().func,onReset:o().func,queryOptions:o().arrayOf(o().string),resultId:o().oneOfType([o().string,o().number]),showExportToLanguageButton:o().bool,showQueryHistoryButton:o().bool,store:o().object.isRequired};const V=z;var B=n(862),U=n.n(B);const q=()=>U().createActions({toggleQueryOptions:{sync:!0},toggleSample:{sync:!0},setQuery:{sync:!0},setQueryString:{sync:!0},typeQueryString:{sync:!0},setValue:{sync:!0},clearValue:{sync:!0},addDistinctValue:{sync:!0},removeDistinctValue:{sync:!0},toggleDistinctValue:{sync:!0},setDistinctValues:{sync:!0},setRangeValues:{sync:!0},setGeoWithinValue:{sync:!0},apply:{sync:!0},reset:{sync:!0},exportToLanguage:{sync:!0},toggleQueryHistory:{sync:!0},refreshEditor:{sync:!0}});var J=n(9837),G=n.n(J),K=n(3347),Q=n.n(K);const Z=require("assert");var X=n.n(Z),ee=n(7776),te=n.n(ee),ne=n(4943);const re=["filter","project","collation","sort","skip","limit","sample","maxTimeMS"],ie=["$geoIntersects","$geoWithin","$near","$nearSphere"];function ae(e){return!!(0,c.isPlainObject)(e)&&0!==(0,c.intersection)(Object.keys(e),ie).length}const se=function(e,t){const n={...e};for(const[e,t]of Object.entries(n))ae(t)&&delete n[e];Array.isArray(n.$or)&&(n.$or=n.$or.filter((e=>!function(e){return!!(0,c.isPlainObject)(e)&&void 0!==Object.values(e).find(ae)}(e))),n.$or.length||delete n.$or);for(const[e,r]of Object.entries(t))ae(r)&&(n[e]=r);return t.$or&&(n.$or=[...Array.isArray(n.$or)?n.$or:[],...t.$or]),n};function oe(e){return null!==e&&"object"==typeof e&&("[object RegExp]"===Object.prototype.toString.call(e)||Object.values(e).some(oe))}var ue=n(1378);const ce="apply",le={},de=n.n(ue)()("1m"),he=1e3,_e="reset",fe=n(5130)("mongodb-compass:stores:query-changed-store"),me=re.concat(["queryState","ns"]),pe=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=U().createStore({mixins:[G().store],init:function(){this.queryBarStore=e.store,this.queryBarStore.listen(this.onQueryBarStoreChanged.bind(this)),this.lastExecutedQuery=this.queryBarStore.state.lastExecutedQuery,this.namespace=e.namespace},getInitialState:()=>(0,c.pick)(e.store.getInitialState(),me),_detectChange(e){const t=!(0,c.isEqual)(this.lastExecutedQuery,e.lastExecutedQuery)||!(0,c.isEqual)(this.namespace,e.ns);return t&&(this.lastExecutedQuery=(0,c.cloneDeep)(e.lastExecutedQuery),this.namespace=e.ns),t},onQueryBarStoreChanged(e){if(this._detectChange(e)){const t={},n=e.lastExecutedQuery||this.getInitialState();for(const e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e]);t.queryState=e.queryState,t.ns=e.ns;const r=this.localAppRegistry,i=this.globalAppRegistry;if(r?r.emit("query-changed",t):fe("Error: AppRegistry not available for query-changed-store"),i){const e=this.queryBarStore.state.isTimeSeries?"time-series":"collection";i.emit("compass:query-bar:query-changed",{...t,collectionType:e})}this.setState(t)}}});return e.localAppRegistry&&(t.localAppRegistry=e.localAppRegistry),e.globalAppRegistry&&(t.globalAppRegistry=e.globalAppRegistry),t},{track:ye,debug:ge}=(0,T.createLoggerAndTelemetry)("COMPASS-QUERY-BAR-UI"),ve="Query.ChangedStore",Me=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=U().createStore({mixins:[G().store],listenables:e.actions,onCollectionChanged(e,t,n){const r=this.getInitialState();r.ns=e,r.isTimeSeries=t,r.isReadonly=n,this.setState(r)},onServerVersionChanged(e){this.setState({serverVersion:e})},exportToLanguage(){this.localAppRegistry.emit("open-query-export-to-language",{filter:this.state.filterString,project:this.state.projectString,sort:this.state.sortString,collation:this.state.collationString,skip:this.state.skipString,limit:this.state.limitString,maxTimeMS:this.state.maxTimeMSString}),this.globalAppRegistry.emit("compass:export-to-language:opened",{source:"Query"})},toggleQueryHistory(){this.localAppRegistry.emit("toggle-query-history")},getInitialState:()=>({filter:le,project:null,sort:null,collation:null,skip:0,limit:0,sample:!1,maxTimeMS:de,filterString:"",projectString:"",sortString:"",collationString:"",skipString:"",limitString:"",maxTimeMSString:"",queryState:_e,valid:!0,filterValid:!0,projectValid:!0,sortValid:!0,collationValid:!0,skipValid:!0,limitValid:!0,sampleValid:!0,maxTimeMSValid:!0,lastExecutedQuery:null,userTyping:!1,autoPopulated:!1,expanded:!1,ns:"",isTimeSeries:!1,isReadonly:!1,serverVersion:"3.6.0",schemaFields:[]}),_stoppedTyping(){this.userTypingTimer=null,this.setState({userTyping:!1})},toggleQueryOptions(e){this.setState({expanded:(0,c.isBoolean)(e)?e:!this.state.expanded})},toggleSample(e){const t={sample:(0,c.isBoolean)(e)?e:!this.state.sample};t.sample&&0===this.state.limit&&(t.limit=he,t.limitString=String(he),t.limitValid=!0),this.setState(t)},typeQueryString(e,t){this.userTypingTimer&&clearTimeout(this.userTypingTimer),this.userTypingTimer=setTimeout(this._stoppedTyping,100),this.setQueryString(e,t,!0)},setQueryString(e,t,n){X()(re.includes(e));const r=this._validateInput(e,t),i={userTyping:Boolean(n)};if(i[`${e}String`]=t,i[`${e}Valid`]=!1!==r,!1!==r){i[e]=r;const t={filter:this.state.filterValid,project:this.state.projectValid,sort:this.state.sortValid,collation:this.state.collationValid,skip:this.state.skipValid,limit:this.state.limitValid,maxTimeMS:this.state.maxTimeMSValid};t[e]=!1!==r,i.valid=(0,c.every)((0,c.values)(t))}else i.valid=!1;i.autoPopulated=!n,this.setState(i)},autoPopulateQuery(e){this.setQuery(e,!0)},handleGeoQueryFromSchema(e){const t=se(this.state.filter,e);this.setQuery({filter:t},!0)},setQuery(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];((0,c.isUndefined)(e)||(0,c.isNull)(e))&&(e=this._getDefaultQuery());const n=(0,c.without)(re,"sample");let r=(0,c.mapValues)((0,c.pick)(e,n),Q().stringify),i=(0,c.mapValues)(r,((e,t)=>!1!==this._validateInput(t,e)));const a=[];Object.keys(i).forEach((e=>{!0===i[e]&&a.push(e)}));const s=(0,c.every)((0,c.values)(Object.assign({filter:this.state.filterValid,project:this.state.projectValid,sort:this.state.sortValid,collation:this.state.collationValid,skip:this.state.skipValid,limit:this.state.limitValid,maxTimeMS:this.state.maxTimeMSValid},i)));r=(0,c.mapKeys)(r,((e,t)=>`${t}String`)),i=(0,c.mapKeys)(i,((e,t)=>`${t}Valid`));const o=Object.assign({},(0,c.pick)(e,a),r,i);(0,c.has)(e,"sample")&&this.toggleSample(e.sample),o.autoPopulated=t,o.valid=s,this.setState(o)},_cloneQuery(){return(0,c.mapValues)((0,c.pick)(this.state,re),c.clone)},_getDefaultQuery(){return(0,c.pick)(this.getInitialState(),re)},_validateInput(e,t){const n=Q().validate(e,t,{validate:!1});return("filter"!==e||""!==n)&&n},_validateQuery(){return!1!==Q().isFilterValid(this.state.filterString,{validate:!1})&&!1!==Q().isProjectValid(this.state.projectString)&&!1!==Q().isSortValid(this.state.sortString)&&!1!==Q().isCollationValid(this.state.collationString)&&!1!==Q().isSkipValid(this.state.skipString)&&!1!==Q().isLimitValid(this.state.limitString)&&!1!==Q().isMaxTimeMSValid(this.state.maxTimeMSString)},setValue(e){const t=(0,c.clone)(this.state.filter);e.unsetIfSet&&(0,c.isEqual)(t[e.field],e.value,ne.bsonEqual)?delete t[e.field]:t[e.field]=e.value,this.setQuery({filter:t},!0)},setDistinctValues(e){const t=(0,c.clone)(this.state.filter);if((0,c.isArray)(e.value))return e.value.length>1?t[e.field]={$in:e.value}:1===e.value.length?t[e.field]=e.value[0]:this.clearValue(e),void this.setQuery({filter:t},!0);t[e.field]=e.value,this.setQuery({filter:t},!0)},clearValue(e){const t=(0,c.clone)(this.state.filter);delete t[e.field],this.setQuery({filter:t},!0)},addDistinctValue(e){const t=(0,c.clone)(this.state.filter),n=(0,c.get)(t,e.field,void 0);if(void 0===n)return t[e.field]=e.value,void this.setQuery({filter:t},!0);if((0,c.isPlainObject)(n)){if((0,c.has)(n,"$in")){const n=t[e.field].$in;return void((0,c.includes)(n,e.value)||(t[e.field].$in.push(e.value),this.setQuery({filter:t},!0)))}return t[e.field]=e.value,void this.setQuery({filter:t},!0)}t[e.field]={$in:[n,e.value]},this.setQuery({filter:t},!0)},removeDistinctValue(e){const t=(0,c.clone)(this.state.filter),n=(0,c.get)(t,e.field,void 0);if(void 0!==n){if((0,c.isPlainObject)(n)&&(0,c.has)(n,"$in")){const n=t[e.field].$in,r=(0,c.pull)(n,e.value);return r.length>1?t[e.field].$in=r:1===r.length?t[e.field]=r[0]:delete t[e.field],void this.setQuery({filter:t},!0)}return(0,c.isEqual)(n,e.value,ne.bsonEqual)?(delete t[e.field],void this.setQuery({filter:t},!0)):void 0}},toggleDistinctValue(e){const t=(0,c.get)(this.state.filter,e.field,void 0);((0,ne.hasDistinctValue)(t,e.value)?this.removeDistinctValue:this.addDistinctValue)(e)},setRangeValues(e){const t=(0,c.clone)(this.state.filter),n={};let r;const i=(0,c.get)(e,"min",void 0),a=(0,c.get)(e,"max",void 0);void 0!==i||void 0!==a?(void 0!==i&&(r=(0,c.get)(e,"minInclusive",!0)?"$gte":"$gt",n[r]=i),void 0!==a&&(r=(0,c.get)(e,"maxInclusive",!1)?"$lte":"$lt",n[r]=a),e.unsetIfSet&&(0,c.isEqual)(t[e.field],n,ne.bsonEqual)?delete t[e.field]:t[e.field]=n,this.setQuery({filter:t},!0)):this.clearValue({field:e.field})},setGeoWithinValue(e){const t=(0,c.clone)(this.state.filter),n={},r=(0,c.get)(e,"radius",0),i=(0,c.get)(e,"center",null);if(r&&i)return n.$geoWithin={$centerSphere:[[i[0],i[1]],r]},t[e.field]=n,void this.setQuery({filter:t},!0);this.clearValue({field:e.field})},apply(){if(this._validateQuery()){ye("Query Executed",{has_projection:!!this.state.project&&Object.keys(this.state.project).length>0,has_skip:this.state.skip>0,has_limit:this.state.limit>0,has_collation:!!this.state.collation,changed_maxtimems:this.state.maxTimeMS!==de,collection_type:this.state.isTimeSeries?"time-series":this.state.isReadonly?"readonly":"collection",used_regex:oe(this.state.filter)});const e=this.localAppRegistry;if(e){const t={filter:this.state.filter,project:this.state.project,sort:this.state.sort,collation:this.state.collation,skip:this.state.skip,limit:this.state.limit,ns:this.state.ns,maxTimeMS:this.state.maxTimeMS};e.emit("query-applied",t)}this.setState({valid:!0,queryState:ce,lastExecutedQuery:this._cloneQuery()})}},reset(){if(!(0,c.isEqual)(this._cloneQuery(),this._getDefaultQuery()))if((0,c.isEqual)(this.state.lastExecutedQuery,this._getDefaultQuery()))this.setQuery();else if(this.state.valid){const e=this.getInitialState();e.ns=this.state.ns,e.isTimeSeries=this.state.isTimeSeries,e.isReadonly=this.state.isReadonly,e.autoPopulated=!0,this.setState((0,c.omit)(e,"expanded"))}},storeDidUpdate(e){ge("query store changed",te()(e,this.state))}});if(e.localAppRegistry){const n=e.localAppRegistry;t.localAppRegistry=n,n.on("auto-populate-query",(e=>{t.autoPopulateQuery(e)})),n.on("fields-changed",(e=>{t.setState({schemaFields:e.aceFields})})),n.on("subtab-changed",(()=>{e.actions.refreshEditor()})),n.on("compass:schema:geo-query",(e=>{t.handleGeoQueryFromSchema(e)})),n.on("compass:query-history:run-query",(e=>{t.setQuery(e,!0)})),n.getStore(ve).onQueryBarStoreChanged||(e.store=t,n.registerStore(ve,pe(e)))}return e.globalAppRegistry&&(t.globalAppRegistry=e.globalAppRegistry),e.namespace&&t.onCollectionChanged(e.namespace,e.isTimeSeries,e.isReadonly),e.serverVersion&&t.onServerVersionChanged(e.serverVersion),e.query&&t.setQuery(e.query,!0),t},Le=JSON.parse('{"name":"@mongodb-js/compass-query-bar","productName":"Query Bar plugin","version":"8.2.0","description":"Renders a component for executing MongoDB queries through a GUI.","homepage":"https://github.com/mongodb-js/compass","license":"SSPL","author":{"name":"MongoDB Inc","email":"compass@mongodb.com"},"bugs":{"url":"https://jira.mongodb.org/projects/COMPASS/issues","email":"compass@mongodb.com"},"publishConfig":{"access":"public"},"repository":{"type":"git","url":"https://github.com/mongodb-js/compass.git"},"files":["dist"],"main":"dist/index.js","compass:main":"src/index.ts","exports":{"browser":"./dist/browser.js","require":"./dist/index.js"},"compass:exports":{".":"./src/index.ts"},"scripts":{"prepublishOnly":"npm run compile && compass-scripts check-exports-exist","compile":"npm run webpack -- --mode production","prewebpack":"rimraf ./dist","webpack":"webpack-compass","analyze":"npm run webpack -- --mode production --analyze","typecheck":"tsc -p tsconfig-lint.json --noEmit","eslint":"eslint","prettier":"prettier","lint":"npm run eslint . && npm run prettier -- --check .","depcheck":"compass-scripts check-peer-deps && depcheck","check":"npm run typecheck && npm run lint && npm run depcheck","check-ci":"npm run check","test":"mocha","test-electron":"xvfb-maybe electron-mocha --no-sandbox","test-cov":"nyc -x \\"**/*.spec.*\\" --reporter=lcov --reporter=text --reporter=html npm run test","test-watch":"npm run test -- --watch","test-ci":"npm run test-cov","test-ci-electron":"npm run test-electron","reformat":"npm run prettier -- --write ."},"peerDependencies":{"@mongodb-js/compass-components":"^1.2.0","@mongodb-js/compass-logging":"^1.1.0","hadron-react-components":"^6.2.0","mongodb-ace-autocompleter":"^1.1.1","react":"^16.14.0"},"devDependencies":{"@mongodb-js/eslint-config-compass":"^1.0.1","@mongodb-js/mocha-config-compass":"^1.0.1","@mongodb-js/prettier-config-compass":"^1.0.0","@mongodb-js/tsconfig-compass":"^1.0.1","@mongodb-js/webpack-config-compass":"^1.0.2","@testing-library/react":"^12.1.4","@testing-library/user-event":"^13.5.0","ace-builds":"^1.4.3","chai":"^4.2.0","debug":"^4.2.0","depcheck":"^1.4.1","electron":"^15.5.7","enzyme":"^3.11.0","eslint":"^7.25.0","hadron-app-registry":"^9.0.1","lodash":"^4.17.15","mocha":"^7.0.1","mongodb-query-parser":"^2.4.6","mongodb-query-util":"^0.2.1","ms":"^2.1.2","nyc":"^15.1.0","object-diff":"0.0.4","prop-types":"^15.7.2","react-dom":"^16.14.0","reflux":"^0.4.1","reflux-state-mixin":"github:mongodb-js/reflux-state-mixin","rimraf":"^3.0.1","sinon":"^9.2.3","xvfb-maybe":"^0.2.1"},"dependencies":{"@mongodb-js/compass-components":"^1.2.0","@mongodb-js/compass-logging":"^1.1.0","hadron-react-components":"^6.2.0","mongodb-ace-autocompleter":"^1.1.1","react":"^16.14.0"},"gitHead":"775735842ab7675c6267fb09c22e61fc9b97cd6d"}'),be={name:"Query Bar",component:V,configureStore:Me,configureActions:q,storeName:"Query.Store",actionName:"Query.Actions"};function ke(e){e.registerRole("Query.QueryBar",be)}function Ye(e){e.deregisterRole("Query.QueryBar",be)}const we=V},3650:(e,t,n)=>{"use strict";var r=n(769),i=n(2489),a=Buffer.from&&Buffer.from!==Uint8Array.from;function s(e,t){return"string"==typeof e?t==e:e&&"function"==typeof e.exec?e.exec(t):"boolean"==typeof e||"object"==typeof e?e:"function"==typeof e&&e(t)}t.parse=function(e,t){var n,o,u=new r,c=i((function(e){"string"==typeof e&&(e=a?Buffer.from(e):new Buffer(e)),u.write(e)}),(function(e){e&&c.write(e),n&&c.emit("header",n),o&&c.emit("footer",o),c.queue(null)}));return"string"==typeof e&&(e=e.split(".").map((function(e){return"$*"===e?{emitKey:!0}:"*"===e||(""===e?{recurse:!0}:e)}))),e&&e.length||(e=null),u.onValue=function(r){if(this.root||(c.root=r),e){for(var i=0,a=0,o=!1,u=!1;i<e.length;){var d,h=e[i];if(a++,h&&!h.recurse){if(!(d=a===this.stack.length?this:this.stack[a]))return;if(!s(h,d.key))return void l(d.key,r);o=!!h.emitKey,u=!!h.emitPath,i++}else{i++;var _=e[i];if(!_)return;for(;;){if(!(d=a===this.stack.length?this:this.stack[a]))return;if(s(_,d.key)){i++,Object.isFrozen(this.stack[a])||(this.stack[a].value=null);break}l(d.key,r),a++}}}if(n&&(c.emit("header",n),n=!1),a===this.stack.length){var f=this.stack.slice(1).map((function(e){return e.key})).concat([this.key]),m=r;for(var p in null!=m&&null!=(m=t?t(m,f):m)&&((o||u)&&(m={value:m},o&&(m.key=this.key),u&&(m.path=f)),c.queue(m)),this.value&&delete this.value[this.key],this.stack)Object.isFrozen(this.stack[p])||(this.stack[p].value=null)}}},u._onToken=u.onToken,u.onToken=function(t,n){u._onToken(t,n),0===this.stack.length&&c.root&&(e||c.queue(c.root),c.root=null)},u.onError=function(e){e.message.indexOf("at position")>-1&&(e.message="Invalid JSON ("+e.message+")"),c.emit("error",e)},c;function l(e,t){!1!==n&&((n=n||{})[e]=t),!1!==o&&!1===n&&((o=o||{})[e]=t)}},t.stringify=function(e,t,n,r){r=r||0,!1===e?(e="",t="\n",n=""):null==e&&(e="[\n",t="\n,\n",n="\n]\n");var a,s=!0,o=!1;return a=i((function(n){o=!0;try{var i=JSON.stringify(n,null,r)}catch(e){return a.emit("error",e)}s?(s=!1,a.queue(e+i)):a.queue(t+i)}),(function(t){o||a.queue(e),a.queue(n),a.queue(null)}))},t.stringifyObject=function(e,t,n,r){r=r||0,!1===e?(e="",t="\n",n=""):null==e&&(e="{\n",t="\n,\n",n="\n}\n");var a=!0,s=!1;return i((function(n){s=!0;var i=JSON.stringify(n[0])+":"+JSON.stringify(n[1],null,r);a?(a=!1,this.queue(e+i)):this.queue(t+i)}),(function(t){s||this.queue(e),this.queue(n),this.queue(null)}))}},5130:(e,t,n)=>{t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const n="color: "+this.color;t.splice(1,0,n,"color: inherit");let r=0,i=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(r++,"%c"===e&&(i=r))})),t.splice(i,0,n)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e},t.useColors=function(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type&&!window.process.__nwjs)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=n(7123)(t);const{formatters:r}=e.exports;r.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}},7123:(e,t,n)=>{e.exports=function(e){function t(e){let n,i=null;function a(...e){if(!a.enabled)return;const r=a,i=Number(new Date),s=i-(n||i);r.diff=s,r.prev=n,r.curr=i,n=i,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let o=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((n,i)=>{if("%%"===n)return"%";o++;const a=t.formatters[i];if("function"==typeof a){const t=e[o];n=a.call(r,t),e.splice(o,1),o--}return n})),t.formatArgs.call(r,e),(r.log||t.log).apply(r,e)}return a.namespace=e,a.useColors=t.useColors(),a.color=t.selectColor(e),a.extend=r,a.destroy=t.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null===i?t.enabled(e):i,set:e=>{i=e}}),"function"==typeof t.init&&t.init(a),a}function r(e,n){const r=t(this.namespace+(void 0===n?":":n)+e);return r.log=this.log,r}function i(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){const e=[...t.names.map(i),...t.skips.map(i).map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){let n;t.save(e),t.names=[],t.skips=[];const r=("string"==typeof e?e:"").split(/[\s,]+/),i=r.length;for(n=0;n<i;n++)r[n]&&("-"===(e=r[n].replace(/\*/g,".*?"))[0]?t.skips.push(new RegExp("^"+e.substr(1)+"$")):t.names.push(new RegExp("^"+e+"$")))},t.enabled=function(e){if("*"===e[e.length-1])return!0;let n,r;for(n=0,r=t.skips.length;n<r;n++)if(t.skips[n].test(e))return!1;for(n=0,r=t.names.length;n<r;n++)if(t.names[n].test(e))return!0;return!1},t.humanize=n(1378),t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach((n=>{t[n]=e[n]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let n=0;for(let t=0;t<e.length;t++)n=(n<<5)-n+e.charCodeAt(t),n|=0;return t.colors[Math.abs(n)%t.colors.length]},t.enable(t.load()),t}},55:(e,t,n)=>{var r=n(6162),i=["write","end","destroy"],a=["resume","pause"],s=["data","close"],o=Array.prototype.slice;function u(e,t){if(e.forEach)return e.forEach(t);for(var n=0;n<e.length;n++)t(e[n],n)}e.exports=function(e,t){var n=new r,c=!1;return u(i,(function(t){n[t]=function(){return e[t].apply(e,arguments)}})),u(a,(function(e){n[e]=function(){n.emit(e);var r=t[e];if(r)return r.apply(t,arguments);t.emit(e)}})),u(s,(function(e){t.on(e,(function(){var t=o.call(arguments);t.unshift(e),n.emit.apply(n,t)}))})),t.on("end",(function(){if(!c){c=!0;var e=o.call(arguments);e.unshift("end"),n.emit.apply(n,e)}})),e.on("drain",(function(){n.emit("drain")})),e.on("error",l),t.on("error",l),n.writable=e.writable,n.readable=t.readable,n;function l(e){n.emit("error",e)}}},1829:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>lt});var r={3:"abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",5:"class enum extends super const export import",6:"enum",strict:"implements interface let package private protected public static yield",strictBind:"eval arguments"},i="break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this",a={5:i,"5module":i+" export import",6:i+" const class extends export import super"},s=/^in(stanceof)?$/,o="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࢠ-ࢴࢶ-ࣇऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲈᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-鿼ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞿꟂ-ꟊꟵ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",u="‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛࣓-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-ໍ໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜔ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠐-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿᫀᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷹᷻-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_",c=new RegExp("["+o+"]"),l=new RegExp("["+o+u+"]");o=u=null;var d=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,157,310,10,21,11,7,153,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,349,41,7,1,79,28,11,0,9,21,107,20,28,22,13,52,76,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,85,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,159,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,230,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,35,56,264,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,190,0,80,921,103,110,18,195,2749,1070,4050,582,8634,568,8,30,114,29,19,47,17,3,32,20,6,18,689,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,43,8,8952,286,50,2,18,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,2357,44,11,6,17,0,370,43,1301,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42717,35,4148,12,221,3,5761,15,7472,3104,541,1507,4938],h=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,370,1,154,10,176,2,54,14,32,9,16,3,46,10,54,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,161,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,193,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,406,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,19306,9,135,4,60,6,26,9,1014,0,2,54,8,3,82,0,12,1,19628,1,5319,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,262,6,10,9,419,13,1495,6,110,6,6,9,4759,9,787719,239];function _(e,t){for(var n=65536,r=0;r<t.length;r+=2){if((n+=t[r])>e)return!1;if((n+=t[r+1])>=e)return!0}}function f(e,t){return e<65?36===e:e<91||(e<97?95===e:e<123||(e<=65535?e>=170&&c.test(String.fromCharCode(e)):!1!==t&&_(e,d)))}function m(e,t){return e<48?36===e:e<58||!(e<65)&&(e<91||(e<97?95===e:e<123||(e<=65535?e>=170&&l.test(String.fromCharCode(e)):!1!==t&&(_(e,d)||_(e,h)))))}var p=function(e,t){void 0===t&&(t={}),this.label=e,this.keyword=t.keyword,this.beforeExpr=!!t.beforeExpr,this.startsExpr=!!t.startsExpr,this.isLoop=!!t.isLoop,this.isAssign=!!t.isAssign,this.prefix=!!t.prefix,this.postfix=!!t.postfix,this.binop=t.binop||null,this.updateContext=null};function y(e,t){return new p(e,{beforeExpr:!0,binop:t})}var g={beforeExpr:!0},v={startsExpr:!0},M={};function L(e,t){return void 0===t&&(t={}),t.keyword=e,M[e]=new p(e,t)}var b={num:new p("num",v),regexp:new p("regexp",v),string:new p("string",v),name:new p("name",v),privateId:new p("privateId",v),eof:new p("eof"),bracketL:new p("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new p("]"),braceL:new p("{",{beforeExpr:!0,startsExpr:!0}),braceR:new p("}"),parenL:new p("(",{beforeExpr:!0,startsExpr:!0}),parenR:new p(")"),comma:new p(",",g),semi:new p(";",g),colon:new p(":",g),dot:new p("."),question:new p("?",g),questionDot:new p("?."),arrow:new p("=>",g),template:new p("template"),invalidTemplate:new p("invalidTemplate"),ellipsis:new p("...",g),backQuote:new p("`",v),dollarBraceL:new p("${",{beforeExpr:!0,startsExpr:!0}),eq:new p("=",{beforeExpr:!0,isAssign:!0}),assign:new p("_=",{beforeExpr:!0,isAssign:!0}),incDec:new p("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new p("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:y("||",1),logicalAND:y("&&",2),bitwiseOR:y("|",3),bitwiseXOR:y("^",4),bitwiseAND:y("&",5),equality:y("==/!=/===/!==",6),relational:y("</>/<=/>=",7),bitShift:y("<</>>/>>>",8),plusMin:new p("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:y("%",10),star:y("*",10),slash:y("/",10),starstar:new p("**",{beforeExpr:!0}),coalesce:y("??",1),_break:L("break"),_case:L("case",g),_catch:L("catch"),_continue:L("continue"),_debugger:L("debugger"),_default:L("default",g),_do:L("do",{isLoop:!0,beforeExpr:!0}),_else:L("else",g),_finally:L("finally"),_for:L("for",{isLoop:!0}),_function:L("function",v),_if:L("if"),_return:L("return",g),_switch:L("switch"),_throw:L("throw",g),_try:L("try"),_var:L("var"),_const:L("const"),_while:L("while",{isLoop:!0}),_with:L("with"),_new:L("new",{beforeExpr:!0,startsExpr:!0}),_this:L("this",v),_super:L("super",v),_class:L("class",v),_extends:L("extends",g),_export:L("export"),_import:L("import",v),_null:L("null",v),_true:L("true",v),_false:L("false",v),_in:L("in",{beforeExpr:!0,binop:7}),_instanceof:L("instanceof",{beforeExpr:!0,binop:7}),_typeof:L("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:L("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:L("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},k=/\r\n?|\n|\u2028|\u2029/,Y=new RegExp(k.source,"g");function w(e){return 10===e||13===e||8232===e||8233===e}var S=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,D=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,x=Object.prototype,T=x.hasOwnProperty,j=x.toString;function A(e,t){return T.call(e,t)}var E=Array.isArray||function(e){return"[object Array]"===j.call(e)};function O(e){return new RegExp("^(?:"+e.replace(/ /g,"|")+")$")}var H=function(e,t){this.line=e,this.column=t};H.prototype.offset=function(e){return new H(this.line,this.column+e)};var C=function(e,t,n){this.start=t,this.end=n,null!==e.sourceFile&&(this.source=e.sourceFile)};function P(e,t){for(var n=1,r=0;;){Y.lastIndex=r;var i=Y.exec(e);if(!(i&&i.index<t))return new H(n,t-r);++n,r=i.index+i[0].length}}var I={ecmaVersion:null,sourceType:"script",onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowAwaitOutsideFunction:null,allowSuperOutsideMethod:null,allowHashBang:!1,locations:!1,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1},F=!1;function N(e,t){return 2|(e?4:0)|(t?8:0)}var R=function(e,t,n){this.options=e=function(e){var t={};for(var n in I)t[n]=e&&A(e,n)?e[n]:I[n];if("latest"===t.ecmaVersion?t.ecmaVersion=1e8:null==t.ecmaVersion?(!F&&"object"==typeof console&&console.warn&&(F=!0,console.warn("Since Acorn 8.0.0, options.ecmaVersion is required.\nDefaulting to 2020, but this will stop working in the future.")),t.ecmaVersion=11):t.ecmaVersion>=2015&&(t.ecmaVersion-=2009),null==t.allowReserved&&(t.allowReserved=t.ecmaVersion<5),E(t.onToken)){var r=t.onToken;t.onToken=function(e){return r.push(e)}}return E(t.onComment)&&(t.onComment=function(e,t){return function(n,r,i,a,s,o){var u={type:n?"Block":"Line",value:r,start:i,end:a};e.locations&&(u.loc=new C(this,s,o)),e.ranges&&(u.range=[i,a]),t.push(u)}}(t,t.onComment)),t}(e),this.sourceFile=e.sourceFile,this.keywords=O(a[e.ecmaVersion>=6?6:"module"===e.sourceType?"5module":5]);var i="";!0!==e.allowReserved&&(i=r[e.ecmaVersion>=6?6:5===e.ecmaVersion?5:3],"module"===e.sourceType&&(i+=" await")),this.reservedWords=O(i);var s=(i?i+" ":"")+r.strict;this.reservedWordsStrict=O(s),this.reservedWordsStrictBind=O(s+" "+r.strictBind),this.input=String(t),this.containsEsc=!1,n?(this.pos=n,this.lineStart=this.input.lastIndexOf("\n",n-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(k).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=b.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=this.initialContext(),this.exprAllowed=!0,this.inModule="module"===e.sourceType,this.strict=this.inModule||this.strictDirective(this.pos),this.potentialArrowAt=-1,this.potentialArrowInForAwait=!1,this.yieldPos=this.awaitPos=this.awaitIdentPos=0,this.labels=[],this.undefinedExports=Object.create(null),0===this.pos&&e.allowHashBang&&"#!"===this.input.slice(0,2)&&this.skipLineComment(2),this.scopeStack=[],this.enterScope(1),this.regexpState=null,this.privateNameStack=[]},W={inFunction:{configurable:!0},inGenerator:{configurable:!0},inAsync:{configurable:!0},canAwait:{configurable:!0},allowSuper:{configurable:!0},allowDirectSuper:{configurable:!0},treatFunctionsAsVar:{configurable:!0},allowNewDotTarget:{configurable:!0},inClassStaticBlock:{configurable:!0}};R.prototype.parse=function(){var e=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(e)},W.inFunction.get=function(){return(2&this.currentVarScope().flags)>0},W.inGenerator.get=function(){return(8&this.currentVarScope().flags)>0&&!this.currentVarScope().inClassFieldInit},W.inAsync.get=function(){return(4&this.currentVarScope().flags)>0&&!this.currentVarScope().inClassFieldInit},W.canAwait.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e];if(t.inClassFieldInit||256&t.flags)return!1;if(2&t.flags)return(4&t.flags)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction},W.allowSuper.get=function(){var e=this.currentThisScope(),t=e.flags,n=e.inClassFieldInit;return(64&t)>0||n||this.options.allowSuperOutsideMethod},W.allowDirectSuper.get=function(){return(128&this.currentThisScope().flags)>0},W.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())},W.allowNewDotTarget.get=function(){var e=this.currentThisScope(),t=e.flags,n=e.inClassFieldInit;return(258&t)>0||n},W.inClassStaticBlock.get=function(){return(256&this.currentVarScope().flags)>0},R.extend=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];for(var n=this,r=0;r<e.length;r++)n=e[r](n);return n},R.parse=function(e,t){return new this(t,e).parse()},R.parseExpressionAt=function(e,t,n){var r=new this(n,e,t);return r.nextToken(),r.parseExpression()},R.tokenizer=function(e,t){return new this(t,e)},Object.defineProperties(R.prototype,W);var $=R.prototype,z=/^(?:'((?:\\.|[^'\\])*?)'|"((?:\\.|[^"\\])*?)")/;function V(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1}$.strictDirective=function(e){for(;;){D.lastIndex=e,e+=D.exec(this.input)[0].length;var t=z.exec(this.input.slice(e));if(!t)return!1;if("use strict"===(t[1]||t[2])){D.lastIndex=e+t[0].length;var n=D.exec(this.input),r=n.index+n[0].length,i=this.input.charAt(r);return";"===i||"}"===i||k.test(n[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(i)||"!"===i&&"="===this.input.charAt(r+1))}e+=t[0].length,D.lastIndex=e,e+=D.exec(this.input)[0].length,";"===this.input[e]&&e++}},$.eat=function(e){return this.type===e&&(this.next(),!0)},$.isContextual=function(e){return this.type===b.name&&this.value===e&&!this.containsEsc},$.eatContextual=function(e){return!!this.isContextual(e)&&(this.next(),!0)},$.expectContextual=function(e){this.eatContextual(e)||this.unexpected()},$.canInsertSemicolon=function(){return this.type===b.eof||this.type===b.braceR||k.test(this.input.slice(this.lastTokEnd,this.start))},$.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0},$.semicolon=function(){this.eat(b.semi)||this.insertSemicolon()||this.unexpected()},$.afterTrailingComma=function(e,t){if(this.type===e)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),t||this.next(),!0},$.expect=function(e){this.eat(e)||this.unexpected()},$.unexpected=function(e){this.raise(null!=e?e:this.start,"Unexpected token")},$.checkPatternErrors=function(e,t){if(e){e.trailingComma>-1&&this.raiseRecoverable(e.trailingComma,"Comma is not permitted after the rest element");var n=t?e.parenthesizedAssign:e.parenthesizedBind;n>-1&&this.raiseRecoverable(n,"Parenthesized pattern")}},$.checkExpressionErrors=function(e,t){if(!e)return!1;var n=e.shorthandAssign,r=e.doubleProto;if(!t)return n>=0||r>=0;n>=0&&this.raise(n,"Shorthand property assignments are valid only in destructuring patterns"),r>=0&&this.raiseRecoverable(r,"Redefinition of __proto__ property")},$.checkYieldAwaitInDefaultParams=function(){this.yieldPos&&(!this.awaitPos||this.yieldPos<this.awaitPos)&&this.raise(this.yieldPos,"Yield expression cannot be a default value"),this.awaitPos&&this.raise(this.awaitPos,"Await expression cannot be a default value")},$.isSimpleAssignTarget=function(e){return"ParenthesizedExpression"===e.type?this.isSimpleAssignTarget(e.expression):"Identifier"===e.type||"MemberExpression"===e.type};var B=R.prototype;B.parseTopLevel=function(e){var t=Object.create(null);for(e.body||(e.body=[]);this.type!==b.eof;){var n=this.parseStatement(null,!0,t);e.body.push(n)}if(this.inModule)for(var r=0,i=Object.keys(this.undefinedExports);r<i.length;r+=1){var a=i[r];this.raiseRecoverable(this.undefinedExports[a].start,"Export '"+a+"' is not defined")}return this.adaptDirectivePrologue(e.body),this.next(),e.sourceType=this.options.sourceType,this.finishNode(e,"Program")};var U={kind:"loop"},q={kind:"switch"};B.isLet=function(e){if(this.options.ecmaVersion<6||!this.isContextual("let"))return!1;D.lastIndex=this.pos;var t=D.exec(this.input),n=this.pos+t[0].length,r=this.input.charCodeAt(n);if(91===r||92===r||r>55295&&r<56320)return!0;if(e)return!1;if(123===r)return!0;if(f(r,!0)){for(var i=n+1;m(r=this.input.charCodeAt(i),!0);)++i;if(92===r||r>55295&&r<56320)return!0;var a=this.input.slice(n,i);if(!s.test(a))return!0}return!1},B.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;D.lastIndex=this.pos;var e,t=D.exec(this.input),n=this.pos+t[0].length;return!(k.test(this.input.slice(this.pos,n))||"function"!==this.input.slice(n,n+8)||n+8!==this.input.length&&(m(e=this.input.charCodeAt(n+8))||e>55295&&e<56320))},B.parseStatement=function(e,t,n){var r,i=this.type,a=this.startNode();switch(this.isLet(e)&&(i=b._var,r="let"),i){case b._break:case b._continue:return this.parseBreakContinueStatement(a,i.keyword);case b._debugger:return this.parseDebuggerStatement(a);case b._do:return this.parseDoStatement(a);case b._for:return this.parseForStatement(a);case b._function:return e&&(this.strict||"if"!==e&&"label"!==e)&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(a,!1,!e);case b._class:return e&&this.unexpected(),this.parseClass(a,!0);case b._if:return this.parseIfStatement(a);case b._return:return this.parseReturnStatement(a);case b._switch:return this.parseSwitchStatement(a);case b._throw:return this.parseThrowStatement(a);case b._try:return this.parseTryStatement(a);case b._const:case b._var:return r=r||this.value,e&&"var"!==r&&this.unexpected(),this.parseVarStatement(a,r);case b._while:return this.parseWhileStatement(a);case b._with:return this.parseWithStatement(a);case b.braceL:return this.parseBlock(!0,a);case b.semi:return this.parseEmptyStatement(a);case b._export:case b._import:if(this.options.ecmaVersion>10&&i===b._import){D.lastIndex=this.pos;var s=D.exec(this.input),o=this.pos+s[0].length,u=this.input.charCodeAt(o);if(40===u||46===u)return this.parseExpressionStatement(a,this.parseExp