@arcgis/coding-components 5.1.0-next.105 → 5.1.0-next.107

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/dist/cdn/2CBDII2T.js +2 -0
  2. package/dist/cdn/3LHMOBGC.js +2 -0
  3. package/dist/cdn/{363GMMQ6.js → 5S2GF6U4.js} +1 -1
  4. package/dist/cdn/{TCLNQ7Z6.js → 66CFQA7G.js} +1 -1
  5. package/dist/cdn/{TSZHSRGH.js → 6DAYEZO3.js} +1 -1
  6. package/dist/cdn/{GZ6HZKQZ.js → AZR47E7L.js} +1 -1
  7. package/dist/cdn/CK7ERP6J.js +2 -0
  8. package/dist/cdn/{NWLOXWV6.js → DWYZXGBU.js} +1 -1
  9. package/dist/cdn/{GPIFJKPY.js → DX64LARM.js} +1 -1
  10. package/dist/cdn/E5OXH2IV.js +2 -0
  11. package/dist/cdn/{CHTL74L2.js → ETVSINLC.js} +1 -1
  12. package/dist/cdn/{G56LJGLK.js → HLDSPJ74.js} +1 -1
  13. package/dist/cdn/HUJVXIUS.js +2 -0
  14. package/dist/cdn/{PPV6RAZ3.js → IC45T3XF.js} +1 -1
  15. package/dist/cdn/{GHTOL7NB.js → KV35R64B.js} +1 -1
  16. package/dist/cdn/{GVMVHGSK.js → LT4IXMHV.js} +1 -1
  17. package/dist/cdn/MNHNQABP.js +4 -0
  18. package/dist/cdn/{OGS4AWC2.js → NMT25LRW.js} +1 -1
  19. package/dist/cdn/{NOHSS7JG.js → Q7MSRF5V.js} +1 -1
  20. package/dist/cdn/{P7I5ATMN.js → UN7LGHT2.js} +1 -1
  21. package/dist/cdn/{SATQDL5P.js → XDJFQDE6.js} +1 -1
  22. package/dist/cdn/{WL2QW4SI.js → ZSFJLQXB.js} +1 -1
  23. package/dist/cdn/assets/arcade-editor/t9n/messages.en.json +1 -1
  24. package/dist/cdn/assets/code-editor/arcade.worker.js +2 -5
  25. package/dist/cdn/assets/code-editor/sql-expr.worker.js +2440 -2410
  26. package/dist/cdn/index.js +1 -1
  27. package/dist/chunks/arcade-mode.js +174 -142
  28. package/dist/chunks/sql-expr-defaults.js +97 -75
  29. package/dist/components/arcgis-arcade-coding-assistant/customElement.js +24 -13
  30. package/dist/components/arcgis-arcade-editor/customElement.d.ts +33 -1
  31. package/dist/components/arcgis-arcade-editor/customElement.js +311 -184
  32. package/dist/components/arcgis-code-editor/customElement.js +1 -1
  33. package/dist/docs/api.json +1 -1
  34. package/dist/docs/docs.json +1 -1
  35. package/dist/docs/vscode.html-custom-data.json +1 -1
  36. package/dist/docs/web-types.json +1 -1
  37. package/dist/loader.js +4 -4
  38. package/dist/types/lumina.d.ts +1 -1
  39. package/dist/types/preact.d.ts +1 -1
  40. package/dist/types/react.d.ts +1 -1
  41. package/dist/types/stencil.d.ts +1 -1
  42. package/dist/utils/arcade-executor.d.ts +44 -1
  43. package/package.json +5 -5
  44. package/dist/cdn/BWQEBSSL.js +0 -4
  45. package/dist/cdn/JQQBQXPD.js +0 -2
  46. package/dist/cdn/SKTKTWIV.js +0 -2
  47. package/dist/cdn/WP6BSOSW.js +0 -2
  48. package/dist/cdn/YJW6NUWX.js +0 -2
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
+ import c from"./AZR47E7L.js";import a from"./ZHZFKZA7.js";import{b as y,c as h,d as b}from"./HLDSPJ74.js";import{b as f}from"./GS2ISVXJ.js";import{L as u}from"./REL6OK2I.js";export default $arcgis.t(([{i:m,n:l},{l:g,o:F,p:M}])=>{var T={allowAllRootBinaryOperators:!1,requiresPredicateRootNode:!1},w={"field-calculation":T,"where-clause":{allowAllRootBinaryOperators:!0,requiresPredicateRootNode:!0}};function I(i){return i&&i in w?w[i]:void 0}var L=i=>{let r=i.variables[0],e=r?.type==="featureSet"?_(r):void 0,{apiVersion:t,bundles:a,hiddenApiItems:o}=i.toEditorProfileDefinition();return{apiVersion:t,bundles:a,variables:e?[e]:[],hiddenApiItems:o?.map(s=>s.toLowerCase())}};function _(i){let{name:r}=i,e=i.getDescription(),{definition:t}=i.toProfileVariableDefinition(),a={label:r,detail:r,insertText:r,insertTextMode:b.asIs,insertTextFormat:h.PlainText,kind:y.Field},o={name:r,description:e,type:"dictionary",properties:[],completion:a};if(!t||!("fields"in t))return o;let[s,n]=g(t.fields,e);return o.properties=s,a.documentation={kind:"markdown",value:n},o}var v=[{name:"$layer",type:"featureSet",description:"The layer being calculated."}],q={"field-calculation":{id:"field-calculation",variables:v},"where-clause":{id:"where-clause",variables:v}};function E(i){return q[i]??null}function R(i){if(!l(i))return;let r=E(i.id);if(!r)return;let e={variables:[],hiddenApiItems:i.hiddenApiItems?.map(t=>t.toLowerCase())};return r.variables.forEach(t=>{if(i.disabledVariables?.includes(t.name))return;let a=i.definitions[t.name];if(t.type==="featureSet")return m(a)?e.variables.push({...t,type:t.type,definition:a}):void 0;throw Error(`sdkVariable type not supported (yet) type: ${t.type}`)}),e}var x="arcgis-sql-expression",p=class extends M{constructor(){super(x,{apiPath:"./assets/sql-language/api",apiPrefix:"sql-api.t9n."}),this._languageId=x,this._layerMap=new Map}updateFeatureLayerForModel(r,e){let t=this._getApiKey(r);this._layerMap.set(t,e)}getFeatureLayerForModel(r){let e=this._getApiKey(r);return this._layerMap.get(e)}async setProfileForModel(r,e,t={locale:"en"}){let a=l(e)?I(e.id):void 0;l(e)&&(e=R(e));let o=await f(t.locale,u("./assets/editor-profile/t9n"),"messages.");if(!o)throw new Error(`Failed to load the language bundle for ${t.locale}`);this.disposeForModel(r);let s=this._getApiKey(r),n=new F(e,o);this._modelToProfileMap.set(s,n);let A=L(n);this.updateApiContextForModel(r,{locale:t.locale,profile:A,...a?{profilePolicy:a}:{}});let c=e?.variables?.find(P=>P.name==="$layer");c&&this.updateFeatureLayerForModel(r,c.definition)}},d=new p,K={setProfileForModel:d.setProfileForModel.bind(d),getApiLibraryForModel:d.getApiLibraryForModel.bind(d)};async function B(){return await import("./3LHMOBGC.js").then(m=>m.default)}return{a:d,b:B}},a,c)
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
+ import d from"./ETVSINLC.js";import c from"./2CBDII2T.js";import b from"./AZR47E7L.js";import a from"./ZHZFKZA7.js";import"./UN7LGHT2.js";import"./HLDSPJ74.js";import"./ER2MKLVA.js";import"./IFNCCZ7O.js";import"./GS2ISVXJ.js";import"./6G5URSC7.js";import"./MP6Z45SA.js";import"./6C52UOYL.js";import"./REL6OK2I.js";import"./Y3KOWWO5.js";import"./B3UMUBOI.js";import"./CF3TERM3.js";import"./Z5ZZ36DQ.js";import"./LLPQEURF.js";import"./3TTFCHAA.js";export default $arcgis.t(([,,,{a:a,b:b,c:c}])=>{return{getSqlExprDiagnosticService:b,getSqlExprWorker:a,setupMode:c}},a,b,c,d)
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import j from"./7Z4V2ZOD.js";import i from"./TNA5F36E.js";import"./HPZZVB4X.js";import"./MP6Z45SA.js";import"./IFNCCZ7O.js";import h from"./GLJQQLP2.js";import{a as x}from"./SB3MM5EM.js";import"./KCU2C44H.js";import"./GS2ISVXJ.js";import{c as b,e as $}from"./6G5URSC7.js";import{E as c,F as o,G as v,H as r,K as f,h as g,j as e,n as d,p as s,u as a}from"./REL6OK2I.js";import"./Y3KOWWO5.js";import"./3TTFCHAA.js";export default $arcgis.t(([{b:R},{c:y,d:w,e:u,g:P,h:m,i:k,j:S},{a:l,b:T,c:C,d:L,e:M,f:I}])=>{var _=g`:host{display:flex;flex-direction:column;width:100%;background-color:var(--calcite-color-foreground-1);color:var(--calcite-color-text-2);.flex-adjustable{flex:1 1 auto;overflow:hidden}.flex-row{display:flex;flex-direction:row;overflow:hidden}.flex-column{display:flex;flex-direction:column;overflow:hidden;min-height:0}.y-scrollable-container{overflow-y:auto;block-size:100%;background-color:var(--calcite-color-foreground-1)}header{border-bottom:1px solid var(--calcite-color-border-3);flex:0 0 auto}.ltr-container{direction:ltr}calcite-action-bar{calcite-action-group{padding-inline-end:var(--calcite-spacing-sm);calcite-action{padding-inline-end:var(--calcite-spacing-sm)}calcite-action:not(:first-child){padding-inline-start:var(--calcite-spacing-sm)}}calcite-action-group:last-child{border-inline-end-width:0px}calcite-action-group:not(:first-child){padding-inline-start:var(--calcite-spacing-sm)}}.notice-container{margin:var(--calcite-spacing-xxs);padding:var(--calcite-spacing-sm);background-color:var(--calcite-color-foreground-1)}.color-info{color:var(--calcite-color-status-info)}.color-error{color:var(--calcite-color-status-danger)}.color-success{color:var(--calcite-color-status-success)}[class*=result-value-]{font-size:var(--calcite-font-size--2);line-height:1.25rem;background-color:var(--calcite-color-foreground-1);margin:var(--calcite-spacing-md)}.console-logs-container{background-color:var(--calcite-color-foreground-1);padding:0 var(--calcite-spacing-md);font-family:var(--calcite-code-family);font-size:var(--calcite-font-size--2);font-weight:var(--calcite-font-weight-normal)}.result-value-table{display:flex;flex-direction:column;min-height:0;.table-scroll{overflow:auto;flex:1 1 auto;min-height:0;max-width:100%;background-color:var(--calcite-color-foreground-1)}table{min-width:max-content;border-spacing:0;border-collapse:collapse;text-align:start;white-space:nowrap;thead{background-color:var(--calcite-color-foreground-2)}tr{border-top:1px solid var(--calcite-color-border-3);border-bottom:1px solid var(--calcite-color-border-3)}th,td{border-inline-start:1px solid var(--calcite-color-border-3);border-inline-end:1px solid var(--calcite-color-border-3);text-align:start;padding:var(--calcite-spacing-xxs);.string-value{white-space:pre}}th{font-weight:var(--calcite-font-weight-medium)}}}}`,n={onClick:p=>{let t=p.currentTarget;t.expanded=!t.expanded}},h=class extends v{constructor(){super(...arguments),this.messages=x(),this.outputRef=c(),this.consoleRef=c(),this.logRef=c(),this.openedResultPanel="output",this.hideHeader=!1,this.arcgisInternalClosePanel=d({bubbles:!1,composed:!1}),this.arcgisInternalOpenedResultPanelChange=d({bubbles:!1,composed:!1})}static{this.properties={consoleLogs:0,loading:5,openedResultPanel:3,result:0,hideHeader:5}}static{this.styles=[_,k(),S]}load(){this.manager.onLifecycle(()=>{let t=b(this.el,["class"],this.updateTheme.bind(this));return this.updateTheme(),()=>t()})}loaded(){this.hideHeader||this.openedResultPanel&&(this.openedResultPanel==="output"&&this.outputRef.value?this.outputRef.value.setFocus():this.openedResultPanel==="console"&&this.consoleRef.value?this.consoleRef.value.setFocus():this.openedResultPanel==="log"&&this.logRef.value&&this.logRef.value.setFocus())}updateResultPanel(t){this.openedResultPanel=t,this.arcgisInternalOpenedResultPanelChange.emit()}_switchResultPanel(t){let i=t.currentTarget.dataset.panelName;i&&this.updateResultPanel(i)}_emitClose(){this.arcgisInternalClosePanel.emit()}updateTheme(){$(this.el)==="dark"?this.elementInternals.states.add(m):this.elementInternals.states.delete(m)}renderConsolePanel(){return this.openedResultPanel!=="console"?null:this.loading&&!this.consoleLogs?.length?e`<calcite-loader scale=s type=indeterminate .label=${this.messages.loading??"loading"}></calcite-loader>`:e`<div class="console-logs-container ltr-container">${this.consoleLogs?.length?this.consoleLogs.map(t=>e`<p>${t}</p>`):e`<p>${this.messages.consolemessage}</p>`}</div>`}renderLogPanel(){if(this.openedResultPanel!=="log")return null;if(this.loading)return e`<calcite-loader scale=s type=indeterminate .label=${this.messages.loading??"loading"}></calcite-loader>`;let t=this.result?.type==="error"?"color-error":"color-success";return e`<calcite-list .label=${this.messages.results??"Results"}>${this.result?e`<calcite-list-item .label=${a(this.messages.lastexecutionformat,{timeStamp:new Intl.DateTimeFormat(this.messages._t9nLocale,{dateStyle:"medium",timeStyle:"medium"}).format(this.result.timeStamp)})}><calcite-icon slot=content-start icon=information scale=s class=${r(t)}></calcite-icon></calcite-list-item><calcite-list-item .label=${a(this.messages.compilationtimeformat,{time:new Intl.NumberFormat(this.messages._t9nLocale,{style:"unit",unit:"millisecond",maximumFractionDigits:2}).format(this.result.compilationTime??0)})}><calcite-icon slot=content-start icon=information scale=s class=${r(t)}></calcite-icon></calcite-list-item><calcite-list-item .label=${a(this.messages.executiontimeformat,{time:new Intl.NumberFormat(this.messages._t9nLocale,{style:"unit",unit:"millisecond",maximumFractionDigits:2}).format(this.result.executionTime??0)})}><calcite-icon slot=content-start icon=information scale=s class=${r(t)}></calcite-icon></calcite-list-item>`:e`<calcite-list-item .label=${this.messages.runscriptmessage}><calcite-icon slot=content-start icon=information scale=s class="color-info"></calcite-icon></calcite-list-item>`}</calcite-list>`}renderOutputPanel(){if(this.openedResultPanel!=="output")return null;if(this.loading)return e`<calcite-loader scale=s type=indeterminate .label=${this.messages.loading??"loading"}></calcite-loader>`;switch(this.result?.type){case"error":return e`<div class="result-value-simple flex-adjustable">${a(this.messages.executionerrorformat??"",{message:this.result.value})}</div>`;case"null":case"unknown":return e`<div class="result-value-simple ltr-container">${u({type:this.result.type,value:s(this.result.type)})}</div>`;case"text":case"number":case"date":case"dateOnly":case"time":case"boolean":{let{type:t,value:i}=P(this.result);return e`<div class="result-value-simple ltr-container"><span class="value-type">${s(this.result.type)}:&nbsp;</span>${u({type:t,value:i})}</div>`}case"array":{let t=(this.result.value??[]).slice(0,R);return e`<div class="result-value-simple ltr-container"><calcite-tree .lines=${l.lines} .selectionMode=${l.selectionMode} .scale=${l.scale} @calciteTreeSelect=${l.oncalciteTreeSelect}><calcite-tree-item expanded @click=${n.onClick}><div class="tree-item-label">${T({arcadeResult:this.result,t9nStrings:this.messages})}</div>${M({items:t,subtree:!0,t9nStrings:this.messages})}</calcite-tree-item></calcite-tree></div>`}case"geometry":return e`<div class="result-value-simple ltr-container"><calcite-tree .lines=${l.lines} .selectionMode=${l.selectionMode} .scale=${l.scale} @calciteTreeSelect=${l.oncalciteTreeSelect}><calcite-tree-item expanded @click=${n.onClick}><div class="tree-item-label">${s(this.result.type)}</div>${w({value:this.result.value,subtree:!0})}</calcite-tree-item></calcite-tree></div>`;case"attachment":return e`<div class="result-value-simple ltr-container"><calcite-tree .lines=${l.lines} .selectionMode=${l.selectionMode} .scale=${l.scale} @calciteTreeSelect=${l.oncalciteTreeSelect}><calcite-tree-item expanded @click=${n.onClick}><div class="tree-item-label">${s(this.result.type)}</div>${y({obj:this.result.value.castAsJson(),subtree:!0})}</calcite-tree-item></calcite-tree></div>`;case"feature":case"dictionary":case"portal":return e`<div class="result-value-simple ltr-container"><calcite-tree .lines=${l.lines} .selectionMode=${l.selectionMode} .scale=${l.scale} @calciteTreeSelect=${l.oncalciteTreeSelect}><calcite-tree-item expanded @click=${n.onClick}><div class="tree-item-label">${s(this.result.type)}</div>${C({value:this.result.value,subtree:!0,t9nStrings:this.messages})}</calcite-tree-item></calcite-tree></div>`;case"featureSet":return e`<div class="result-value-table ltr-container">${L({arcadeResult:this.result,t9nStrings:this.messages})}${I({arcadeResult:this.result})}</div>`;case"knowledgeGraph":return e`<div class="result-value-simple ltr-container"><span class="value-type">${s(this.result.type)}:&nbsp;</span><span class="string-value">${this.result.value.url}</span></div>`;default:return e`<div class="result-value-simple flex-adjustable ltr-container">${this.messages.runscriptmessage}</div>`}}render(){return e`${this.hideHeader?null:e`<header class="flex-row"><calcite-action-bar class="flex-adjustable" layout=horizontal scale=s expanded expand-disabled><calcite-action-group scale=s><calcite-action .active=${this.openedResultPanel==="output"} .text=${this.messages.output??""} text-enabled scale=s icon=list-show-all icon-flip-rtl @click=${this._switchResultPanel} data-panel-name=output ${o(this.outputRef)}></calcite-action><calcite-action .active=${this.openedResultPanel==="console"} .text=${this.messages.console??""} text-enabled scale=s icon=console icon-flip-rtl @click=${this._switchResultPanel} data-panel-name=console ${o(this.consoleRef)}></calcite-action><calcite-action .active=${this.openedResultPanel==="log"} .text=${this.messages.log??""} text-enabled scale=s icon=list icon-flip-rtl @click=${this._switchResultPanel} data-panel-name=log ${o(this.logRef)}></calcite-action></calcite-action-group></calcite-action-bar><calcite-action scale=s icon=x .text=${this.messages.close??""} @click=${this._emitClose}></calcite-action></header>`}<article class="flex-adjustable">${this.loading?e`<calcite-loader scale=s type=indeterminate .label=${this.messages.loading??"Loading"}></calcite-loader>`:e`<div class="flex-column y-scrollable-container">${this.renderOutputPanel()}${this.renderConsolePanel()}${this.renderLogPanel()}</div>`}</article>`}};f("arcgis-arcade-results",h);return h},h,i,j)
2
+ import j from"./7Z4V2ZOD.js";import i from"./TNA5F36E.js";import"./HPZZVB4X.js";import"./IFNCCZ7O.js";import h from"./GLJQQLP2.js";import{a as x}from"./SB3MM5EM.js";import"./KCU2C44H.js";import"./GS2ISVXJ.js";import{c as b,e as $}from"./6G5URSC7.js";import"./MP6Z45SA.js";import{E as c,F as o,G as v,H as r,K as f,h as g,j as e,n as d,p as s,u as a}from"./REL6OK2I.js";import"./Y3KOWWO5.js";import"./3TTFCHAA.js";export default $arcgis.t(([{b:R},{c:y,d:w,e:u,g:P,h:m,i:k,j:S},{a:l,b:T,c:C,d:L,e:M,f:I}])=>{var _=g`:host{display:flex;flex-direction:column;width:100%;background-color:var(--calcite-color-foreground-1);color:var(--calcite-color-text-2);.flex-adjustable{flex:1 1 auto;overflow:hidden}.flex-row{display:flex;flex-direction:row;overflow:hidden}.flex-column{display:flex;flex-direction:column;overflow:hidden;min-height:0}.y-scrollable-container{overflow-y:auto;block-size:100%;background-color:var(--calcite-color-foreground-1)}header{border-bottom:1px solid var(--calcite-color-border-3);flex:0 0 auto}.ltr-container{direction:ltr}calcite-action-bar{calcite-action-group{padding-inline-end:var(--calcite-spacing-sm);calcite-action{padding-inline-end:var(--calcite-spacing-sm)}calcite-action:not(:first-child){padding-inline-start:var(--calcite-spacing-sm)}}calcite-action-group:last-child{border-inline-end-width:0px}calcite-action-group:not(:first-child){padding-inline-start:var(--calcite-spacing-sm)}}.notice-container{margin:var(--calcite-spacing-xxs);padding:var(--calcite-spacing-sm);background-color:var(--calcite-color-foreground-1)}.color-info{color:var(--calcite-color-status-info)}.color-error{color:var(--calcite-color-status-danger)}.color-success{color:var(--calcite-color-status-success)}[class*=result-value-]{font-size:var(--calcite-font-size--2);line-height:1.25rem;background-color:var(--calcite-color-foreground-1);margin:var(--calcite-spacing-md)}.console-logs-container{background-color:var(--calcite-color-foreground-1);padding:0 var(--calcite-spacing-md);font-family:var(--calcite-code-family);font-size:var(--calcite-font-size--2);font-weight:var(--calcite-font-weight-normal)}.result-value-table{display:flex;flex-direction:column;min-height:0;.table-scroll{overflow:auto;flex:1 1 auto;min-height:0;max-width:100%;background-color:var(--calcite-color-foreground-1)}table{min-width:max-content;border-spacing:0;border-collapse:collapse;text-align:start;white-space:nowrap;thead{background-color:var(--calcite-color-foreground-2)}tr{border-top:1px solid var(--calcite-color-border-3);border-bottom:1px solid var(--calcite-color-border-3)}th,td{border-inline-start:1px solid var(--calcite-color-border-3);border-inline-end:1px solid var(--calcite-color-border-3);text-align:start;padding:var(--calcite-spacing-xxs);.string-value{white-space:pre}}th{font-weight:var(--calcite-font-weight-medium)}}}}`,n={onClick:p=>{let t=p.currentTarget;t.expanded=!t.expanded}},h=class extends v{constructor(){super(...arguments),this.messages=x(),this.outputRef=c(),this.consoleRef=c(),this.logRef=c(),this.openedResultPanel="output",this.hideHeader=!1,this.arcgisInternalClosePanel=d({bubbles:!1,composed:!1}),this.arcgisInternalOpenedResultPanelChange=d({bubbles:!1,composed:!1})}static{this.properties={consoleLogs:0,loading:5,openedResultPanel:3,result:0,hideHeader:5}}static{this.styles=[_,k(),S]}load(){this.manager.onLifecycle(()=>{let t=b(this.el,["class"],this.updateTheme.bind(this));return this.updateTheme(),()=>t()})}loaded(){this.hideHeader||this.openedResultPanel&&(this.openedResultPanel==="output"&&this.outputRef.value?this.outputRef.value.setFocus():this.openedResultPanel==="console"&&this.consoleRef.value?this.consoleRef.value.setFocus():this.openedResultPanel==="log"&&this.logRef.value&&this.logRef.value.setFocus())}updateResultPanel(t){this.openedResultPanel=t,this.arcgisInternalOpenedResultPanelChange.emit()}_switchResultPanel(t){let i=t.currentTarget.dataset.panelName;i&&this.updateResultPanel(i)}_emitClose(){this.arcgisInternalClosePanel.emit()}updateTheme(){$(this.el)==="dark"?this.elementInternals.states.add(m):this.elementInternals.states.delete(m)}renderConsolePanel(){return this.openedResultPanel!=="console"?null:this.loading&&!this.consoleLogs?.length?e`<calcite-loader scale=s type=indeterminate .label=${this.messages.loading??"loading"}></calcite-loader>`:e`<div class="console-logs-container ltr-container">${this.consoleLogs?.length?this.consoleLogs.map(t=>e`<p>${t}</p>`):e`<p>${this.messages.consolemessage}</p>`}</div>`}renderLogPanel(){if(this.openedResultPanel!=="log")return null;if(this.loading)return e`<calcite-loader scale=s type=indeterminate .label=${this.messages.loading??"loading"}></calcite-loader>`;let t=this.result?.type==="error"?"color-error":"color-success";return e`<calcite-list .label=${this.messages.results??"Results"}>${this.result?e`<calcite-list-item .label=${a(this.messages.lastexecutionformat,{timeStamp:new Intl.DateTimeFormat(this.messages._t9nLocale,{dateStyle:"medium",timeStyle:"medium"}).format(this.result.timeStamp)})}><calcite-icon slot=content-start icon=information scale=s class=${r(t)}></calcite-icon></calcite-list-item><calcite-list-item .label=${a(this.messages.compilationtimeformat,{time:new Intl.NumberFormat(this.messages._t9nLocale,{style:"unit",unit:"millisecond",maximumFractionDigits:2}).format(this.result.compilationTime??0)})}><calcite-icon slot=content-start icon=information scale=s class=${r(t)}></calcite-icon></calcite-list-item><calcite-list-item .label=${a(this.messages.executiontimeformat,{time:new Intl.NumberFormat(this.messages._t9nLocale,{style:"unit",unit:"millisecond",maximumFractionDigits:2}).format(this.result.executionTime??0)})}><calcite-icon slot=content-start icon=information scale=s class=${r(t)}></calcite-icon></calcite-list-item>`:e`<calcite-list-item .label=${this.messages.runscriptmessage}><calcite-icon slot=content-start icon=information scale=s class="color-info"></calcite-icon></calcite-list-item>`}</calcite-list>`}renderOutputPanel(){if(this.openedResultPanel!=="output")return null;if(this.loading)return e`<calcite-loader scale=s type=indeterminate .label=${this.messages.loading??"loading"}></calcite-loader>`;switch(this.result?.type){case"error":return e`<div class="result-value-simple flex-adjustable">${a(this.messages.executionerrorformat??"",{message:this.result.value})}</div>`;case"null":case"unknown":return e`<div class="result-value-simple ltr-container">${u({type:this.result.type,value:s(this.result.type)})}</div>`;case"text":case"number":case"date":case"dateOnly":case"time":case"boolean":{let{type:t,value:i}=P(this.result);return e`<div class="result-value-simple ltr-container"><span class="value-type">${s(this.result.type)}:&nbsp;</span>${u({type:t,value:i})}</div>`}case"array":{let t=(this.result.value??[]).slice(0,R);return e`<div class="result-value-simple ltr-container"><calcite-tree .lines=${l.lines} .selectionMode=${l.selectionMode} .scale=${l.scale} @calciteTreeSelect=${l.oncalciteTreeSelect}><calcite-tree-item expanded @click=${n.onClick}><div class="tree-item-label">${T({arcadeResult:this.result,t9nStrings:this.messages})}</div>${M({items:t,subtree:!0,t9nStrings:this.messages})}</calcite-tree-item></calcite-tree></div>`}case"geometry":return e`<div class="result-value-simple ltr-container"><calcite-tree .lines=${l.lines} .selectionMode=${l.selectionMode} .scale=${l.scale} @calciteTreeSelect=${l.oncalciteTreeSelect}><calcite-tree-item expanded @click=${n.onClick}><div class="tree-item-label">${s(this.result.type)}</div>${w({value:this.result.value,subtree:!0})}</calcite-tree-item></calcite-tree></div>`;case"attachment":return e`<div class="result-value-simple ltr-container"><calcite-tree .lines=${l.lines} .selectionMode=${l.selectionMode} .scale=${l.scale} @calciteTreeSelect=${l.oncalciteTreeSelect}><calcite-tree-item expanded @click=${n.onClick}><div class="tree-item-label">${s(this.result.type)}</div>${y({obj:this.result.value.castAsJson(),subtree:!0})}</calcite-tree-item></calcite-tree></div>`;case"feature":case"dictionary":case"portal":return e`<div class="result-value-simple ltr-container"><calcite-tree .lines=${l.lines} .selectionMode=${l.selectionMode} .scale=${l.scale} @calciteTreeSelect=${l.oncalciteTreeSelect}><calcite-tree-item expanded @click=${n.onClick}><div class="tree-item-label">${s(this.result.type)}</div>${C({value:this.result.value,subtree:!0,t9nStrings:this.messages})}</calcite-tree-item></calcite-tree></div>`;case"featureSet":return e`<div class="result-value-table ltr-container">${L({arcadeResult:this.result,t9nStrings:this.messages})}${I({arcadeResult:this.result})}</div>`;case"knowledgeGraph":return e`<div class="result-value-simple ltr-container"><span class="value-type">${s(this.result.type)}:&nbsp;</span><span class="string-value">${this.result.value.url}</span></div>`;default:return e`<div class="result-value-simple flex-adjustable ltr-container">${this.messages.runscriptmessage}</div>`}}render(){return e`${this.hideHeader?null:e`<header class="flex-row"><calcite-action-bar class="flex-adjustable" layout=horizontal scale=s expanded expand-disabled><calcite-action-group scale=s><calcite-action .active=${this.openedResultPanel==="output"} .text=${this.messages.output??""} text-enabled scale=s icon=list-show-all icon-flip-rtl @click=${this._switchResultPanel} data-panel-name=output ${o(this.outputRef)}></calcite-action><calcite-action .active=${this.openedResultPanel==="console"} .text=${this.messages.console??""} text-enabled scale=s icon=console icon-flip-rtl @click=${this._switchResultPanel} data-panel-name=console ${o(this.consoleRef)}></calcite-action><calcite-action .active=${this.openedResultPanel==="log"} .text=${this.messages.log??""} text-enabled scale=s icon=list icon-flip-rtl @click=${this._switchResultPanel} data-panel-name=log ${o(this.logRef)}></calcite-action></calcite-action-group></calcite-action-bar><calcite-action scale=s icon=x .text=${this.messages.close??""} @click=${this._emitClose}></calcite-action></header>`}<article class="flex-adjustable">${this.loading?e`<calcite-loader scale=s type=indeterminate .label=${this.messages.loading??"Loading"}></calcite-loader>`:e`<div class="flex-column y-scrollable-container">${this.renderOutputPanel()}${this.renderConsolePanel()}${this.renderLogPanel()}</div>`}</article>`}};f("arcgis-arcade-results",h);return h},h,i,j)
@@ -1,5 +1,5 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import b from"./GZ6HZKQZ.js";import a from"./ZHZFKZA7.js";import{b as P}from"./GS2ISVXJ.js";import{L as I}from"./REL6OK2I.js";export default $arcgis.t(([N,{B:S},{a:q,d:F,e:T,f:g,g:h,h:C,i:$,j:x,n:L,o:_,p:D}])=>{function b(t){for(let e of t){if(e instanceof L)return e;if(e.isCollection&&"variables"in e){let n=b(e.variables.filter(a=>a.type!=="group"));if(n)return n}}}function A(t,e){return`${t}:${e}`}function V(t){if(t){for(let e of t)if(e.type==="dataCatalogDatastore")return e.definition}}async function B(t){let e=new N({url:t.portal.url});return await e.load(),new q({itemId:t.id,serviceUrl:t.serviceUrl,portal:e})}async function E(t){return S(t)?await B(t):t}function K(t,e,n){let a=`**${t}**`;return e.type&&(a+=`
2
+ import b from"./AZR47E7L.js";import a from"./ZHZFKZA7.js";import{b as P}from"./GS2ISVXJ.js";import{L as I}from"./REL6OK2I.js";export default $arcgis.t(([N,{B:S},{a:q,d:F,e:T,f:g,g:h,h:C,i:$,j:x,n:L,o:_,p:D}])=>{function b(t){for(let e of t){if(e instanceof L)return e;if(e.isCollection&&"variables"in e){let n=b(e.variables.filter(a=>a.type!=="group"));if(n)return n}}}function A(t,e){return`${t}:${e}`}function V(t){if(t){for(let e of t)if(e.type==="dataCatalogDatastore")return e.definition}}async function B(t){let e=new N({url:t.portal.url});return await e.load(),new q({itemId:t.id,serviceUrl:t.serviceUrl,portal:e})}async function E(t){return S(t)?await B(t):t}function K(t,e,n){let a=`**${t}**`;return e.type&&(a+=`
3
3
  ${e.type}`),n&&(a+=`
4
4
  Datastore: ${n}`),{value:a}}function z(t,e){let n=`**${t.name}**`;return t.serverType&&(n+=`
5
5
  ${t.serverType}`),n+=`
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{a as O,c as u,d as k}from"./SMAQD57G.js";import i from"./OGS4AWC2.js";import h from"./YJW6NUWX.js";import e from"./NOHSS7JG.js";import d from"./GPIFJKPY.js";import c from"./GZ6HZKQZ.js";import a from"./ZHZFKZA7.js";import"./P7I5ATMN.js";import"./G56LJGLK.js";import{a as N}from"./ER2MKLVA.js";import"./HPZZVB4X.js";import{a as C}from"./MP6Z45SA.js";import"./IFNCCZ7O.js";import{a as E}from"./KCU2C44H.js";import"./GS2ISVXJ.js";import{a as S,c as T,e as w}from"./6G5URSC7.js";import"./6C52UOYL.js";import{G as v,K as b,L as y,h as g,i as f,j as n}from"./REL6OK2I.js";import{b as _}from"./Y3KOWWO5.js";import"./B3UMUBOI.js";import"./CF3TERM3.js";import"./Z5ZZ36DQ.js";import"./LLPQEURF.js";import"./3TTFCHAA.js";export default $arcgis.t(([,,,{a:L},,{b:c,d:m}])=>{var x=Symbol(),l=class{get taskComplete(){return this.t||(this.i===1?this.t=new Promise(((t,e)=>{this.o=t,this.h=e})):this.i===3?this.t=Promise.reject(this.l):this.t=Promise.resolve(this.u)),this.t}constructor(t,e,s){this.p=0,this.i=0,(this._=t).addController(this);let i=typeof e=="object"?e:{task:e,args:s};this.v=i.task,this.j=i.args,this.m=i.argsEqual??M,this.k=i.onComplete,this.A=i.onError,this.autoRun=i.autoRun??!0,"initialValue"in i&&(this.u=i.initialValue,this.i=2,this.O=this.T?.())}hostUpdate(){this.autoRun===!0&&this.S()}hostUpdated(){this.autoRun==="afterUpdate"&&this.S()}T(){if(this.j===void 0)return;let t=this.j();if(!Array.isArray(t))throw Error("The args function must return an array");return t}async S(){let t=this.T(),e=this.O;this.O=t,t===e||t===void 0||e!==void 0&&this.m(e,t)||await this.run(t)}async run(t){let e,s;t??=this.T(),this.O=t,this.i===1?this.q?.abort():(this.t=void 0,this.o=void 0,this.h=void 0),this.i=1,this.autoRun==="afterUpdate"?queueMicrotask((()=>this._.requestUpdate())):this._.requestUpdate();let i=++this.p;this.q=new AbortController;let r=!1;try{e=await this.v(t,{signal:this.q.signal})}catch(d){r=!0,s=d}if(this.p===i){if(e===x)this.i=0;else{if(r===!1){try{this.k?.(e)}catch{}this.i=2,this.o?.(e)}else{try{this.A?.(s)}catch{}this.i=3,this.h?.(s)}this.u=e,this.l=s}this._.requestUpdate()}}abort(t){this.i===1&&this.q?.abort(t)}get value(){return this.u}get error(){return this.l}get status(){return this.i}render(t){switch(this.i){case 0:return t.initial?.();case 1:return t.pending?.();case 2:return t.complete?.(this.value);case 3:return t.error?.(this.error);default:throw Error("Unexpected status: "+this.i)}}},M=(h,t)=>h===t||h.length===t.length&&h.every(((e,s)=>!f(e,t[s])));var $=g`:host{display:block}.arcgis-code-viewer-container{display:flex;align-items:stretch;background-color:var(--calcite-color-foreground-2)}.arcgis-code-viewer__gutter{display:flex;min-width:var(--calcite-spacing-md);padding:0 var(--calcite-spacing-xs) 0 var(--calcite-spacing-sm);border-inline-end:1px solid var(--calcite-color-border-3);color:var(--calcite-color-text-3);font-size:var(--calcite-font-size--2);font-family:var(--calcite-font-family-code);user-select:none;justify-items:center;font-variant-numeric:tabular-nums}.arcgis-code-viewer__line-number{display:flex;align-items:center}pre.arcgis-code-viewer{display:flex;direction:ltr;overflow-x:auto;margin:0;padding:var(--calcite-spacing-sm);white-space:pre-line;code{font-size:var(--calcite-font-size--2);font-family:var(--calcite-font-family-code)}}:host([round]){.arcgis-code-viewer-container{border-radius:var(--calcite-corner-radius-round)}}`,p=class extends v{constructor(){super(...arguments),this._monacoEditor=E(N),this.#e=Promise.withResolvers(),this.#t="",this._slotContentObservers=[],this._onDefaultSlotChange=async t=>{S(t)||(this._codeFromSlot="");let e=t.target instanceof HTMLSlotElement?t.target:null,s=e?this._computeSlotText(e):"";e&&this._observeAssignedSlotNodes(e),s!==this._codeFromSlot&&(this._codeFromSlot=s),this.#e.resolve()},this._colorizeTask=new l(this,{task:async([t,e],{signal:s})=>{if(await this.#e.promise,s.aborted)return this.#t;if(await c(e),s.aborted)return this.#t;let i=await O(t,e);return s.aborted?this.#t:(this.#t=i,i)},args:()=>[this._codeFromSlot,this.language]}),this._codeFromSlot="",this.language="arcade",this.round=!1,this.lineNumbers="off"}static{this.properties={_codeFromSlot:16,language:1,round:7,lineNumbers:1}}static{this.styles=$}#e;#t;async load(){L(y("./assets")),await m(this.language),await c(this.language),this._applyColorizeStyles(u()),this.manager.onLifecycle(()=>(this._themeObserver=T(this.el,["class"],()=>this.updateTheme()),this._themeChangedListener=k(()=>{this._applyColorizeStyles(u())}),this.updateTheme(),()=>{this._themeObserver?.(),this._themeObserver=void 0,this._themeChangedListener?.dispose(),this._themeChangedListener=void 0}))}loaded(){this.el.hasChildNodes()||this.#e.resolve()}willUpdate(t){t.has("language")&&m(this.language).then(()=>c(this.language)).catch(_(this))}disconnectedCallback(){super.disconnectedCallback(),this._disposeSlotObservers()}_disposeSlotObservers(){this._slotContentObservers.length&&(this._slotContentObservers.forEach(t=>t.disconnect()),this._slotContentObservers=[])}_observeAssignedSlotNodes(t){this._disposeSlotObservers();let e=t.assignedNodes({flatten:!0});if(!e.length)return;let s=new Set;for(let o of e)o.nodeType===Node.ELEMENT_NODE?s.add(o):o.nodeType===Node.TEXT_NODE&&o.parentElement&&s.add(o.parentElement);let i={characterData:!0,childList:!0,subtree:!0},r=C(()=>{let o=this._computeSlotText(t);o!==this._codeFromSlot&&(this._codeFromSlot=o)},100),d=o=>{if(o.some(a=>a.type==="childList")){let a=this._computeSlotText(t);a!==this._codeFromSlot&&(this._codeFromSlot=a);return}r()};s.forEach(o=>{let a=new MutationObserver(d);a.observe(o,i),this._slotContentObservers.push(a)})}_computeSlotText(t){let e=t.assignedNodes({flatten:!0}).filter(s=>s.nodeType!==Node.COMMENT_NODE);if(this.language==="html"&&e.length){let s=e.find(r=>r.nodeType===Node.ELEMENT_NODE&&r.tagName==="TEMPLATE");if(s)return(s.innerHTML??"").trim();let i=e.map(r=>r.nodeType===Node.ELEMENT_NODE?r.outerHTML:r.nodeType===Node.TEXT_NODE?r.textContent??"":"").join("").trim();return i}return e.map(s=>s.textContent??"").join("").trim()}updateTheme(){let t=w(this.el)==="light"?"vs":"vs-dark";t!==this._currentTheme&&(this._currentTheme=t,this._monacoEditor.setTheme(t))}_applyColorizeStyles(t){if(!this._colorizeSheet){this._colorizeSheet=new CSSStyleSheet;let e=this.renderRoot;e.adoptedStyleSheets=[...e.adoptedStyleSheets,this._colorizeSheet]}this._colorizeSheet.replaceSync(t)}_showLineNumbers(){return typeof this.lineNumbers=="function"||this.lineNumbers==="on"}_getLineNumberLabel(t){return typeof this.lineNumbers=="function"?this.lineNumbers(t):`${t}`}_getRenderedLineNumbers(){if(!this._showLineNumbers())return[];let t=Math.max(this._codeFromSlot.split(/\r\n|\r|\n/u).length,1);return Array.from({length:t},(e,s)=>this._getLineNumberLabel(s+1))}render(){let t=this._getRenderedLineNumbers();return n`<div class=${`arcgis-code-viewer-container${t.length?" arcgis-code-viewer-container--with-line-numbers":""}`}><slot @slotchange=${this._onDefaultSlotChange} style="display:none" aria-hidden=true></slot>${t.length?n`<div class="arcgis-code-viewer__gutter" aria-hidden=true>${t.map(e=>n`<span class="arcgis-code-viewer__line-number">${e}</span>`)}</div>`:null}<pre class="arcgis-code-viewer" aria-label=${`${this.language} code snippet`}>${this._colorizeTask.render({error:()=>null,pending:()=>n`<code class=${`language-${this.language}`}></code>`,complete:e=>n`<code class=${`language-${this.language}`} .innerHTML=${e??""}></code>`})}</pre></div>`}};b("arcgis-code-viewer",p);return p},a,c,d,e,h,i)
2
+ import{a as O,c as u,d as k}from"./SMAQD57G.js";import i from"./NMT25LRW.js";import h from"./2CBDII2T.js";import e from"./Q7MSRF5V.js";import d from"./DX64LARM.js";import c from"./AZR47E7L.js";import a from"./ZHZFKZA7.js";import"./UN7LGHT2.js";import"./HLDSPJ74.js";import{a as N}from"./ER2MKLVA.js";import"./HPZZVB4X.js";import"./IFNCCZ7O.js";import{a as E}from"./KCU2C44H.js";import"./GS2ISVXJ.js";import{a as S,c as T,e as w}from"./6G5URSC7.js";import{a as C}from"./MP6Z45SA.js";import"./6C52UOYL.js";import{G as v,K as b,L as y,h as g,i as f,j as n}from"./REL6OK2I.js";import{b as _}from"./Y3KOWWO5.js";import"./B3UMUBOI.js";import"./CF3TERM3.js";import"./Z5ZZ36DQ.js";import"./LLPQEURF.js";import"./3TTFCHAA.js";export default $arcgis.t(([,,,{a:L},,{b:c,d:m}])=>{var x=Symbol(),l=class{get taskComplete(){return this.t||(this.i===1?this.t=new Promise(((t,e)=>{this.o=t,this.h=e})):this.i===3?this.t=Promise.reject(this.l):this.t=Promise.resolve(this.u)),this.t}constructor(t,e,s){this.p=0,this.i=0,(this._=t).addController(this);let i=typeof e=="object"?e:{task:e,args:s};this.v=i.task,this.j=i.args,this.m=i.argsEqual??M,this.k=i.onComplete,this.A=i.onError,this.autoRun=i.autoRun??!0,"initialValue"in i&&(this.u=i.initialValue,this.i=2,this.O=this.T?.())}hostUpdate(){this.autoRun===!0&&this.S()}hostUpdated(){this.autoRun==="afterUpdate"&&this.S()}T(){if(this.j===void 0)return;let t=this.j();if(!Array.isArray(t))throw Error("The args function must return an array");return t}async S(){let t=this.T(),e=this.O;this.O=t,t===e||t===void 0||e!==void 0&&this.m(e,t)||await this.run(t)}async run(t){let e,s;t??=this.T(),this.O=t,this.i===1?this.q?.abort():(this.t=void 0,this.o=void 0,this.h=void 0),this.i=1,this.autoRun==="afterUpdate"?queueMicrotask((()=>this._.requestUpdate())):this._.requestUpdate();let i=++this.p;this.q=new AbortController;let r=!1;try{e=await this.v(t,{signal:this.q.signal})}catch(d){r=!0,s=d}if(this.p===i){if(e===x)this.i=0;else{if(r===!1){try{this.k?.(e)}catch{}this.i=2,this.o?.(e)}else{try{this.A?.(s)}catch{}this.i=3,this.h?.(s)}this.u=e,this.l=s}this._.requestUpdate()}}abort(t){this.i===1&&this.q?.abort(t)}get value(){return this.u}get error(){return this.l}get status(){return this.i}render(t){switch(this.i){case 0:return t.initial?.();case 1:return t.pending?.();case 2:return t.complete?.(this.value);case 3:return t.error?.(this.error);default:throw Error("Unexpected status: "+this.i)}}},M=(h,t)=>h===t||h.length===t.length&&h.every(((e,s)=>!f(e,t[s])));var $=g`:host{display:block}.arcgis-code-viewer-container{display:flex;align-items:stretch;background-color:var(--calcite-color-foreground-2)}.arcgis-code-viewer__gutter{display:flex;min-width:var(--calcite-spacing-md);padding:0 var(--calcite-spacing-xs) 0 var(--calcite-spacing-sm);border-inline-end:1px solid var(--calcite-color-border-3);color:var(--calcite-color-text-3);font-size:var(--calcite-font-size--2);font-family:var(--calcite-font-family-code);user-select:none;justify-items:center;font-variant-numeric:tabular-nums}.arcgis-code-viewer__line-number{display:flex;align-items:center}pre.arcgis-code-viewer{display:flex;direction:ltr;overflow-x:auto;margin:0;padding:var(--calcite-spacing-sm);white-space:pre-line;code{font-size:var(--calcite-font-size--2);font-family:var(--calcite-font-family-code)}}:host([round]){.arcgis-code-viewer-container{border-radius:var(--calcite-corner-radius-round)}}`,p=class extends v{constructor(){super(...arguments),this._monacoEditor=E(N),this.#e=Promise.withResolvers(),this.#t="",this._slotContentObservers=[],this._onDefaultSlotChange=async t=>{S(t)||(this._codeFromSlot="");let e=t.target instanceof HTMLSlotElement?t.target:null,s=e?this._computeSlotText(e):"";e&&this._observeAssignedSlotNodes(e),s!==this._codeFromSlot&&(this._codeFromSlot=s),this.#e.resolve()},this._colorizeTask=new l(this,{task:async([t,e],{signal:s})=>{if(await this.#e.promise,s.aborted)return this.#t;if(await c(e),s.aborted)return this.#t;let i=await O(t,e);return s.aborted?this.#t:(this.#t=i,i)},args:()=>[this._codeFromSlot,this.language]}),this._codeFromSlot="",this.language="arcade",this.round=!1,this.lineNumbers="off"}static{this.properties={_codeFromSlot:16,language:1,round:7,lineNumbers:1}}static{this.styles=$}#e;#t;async load(){L(y("./assets")),await m(this.language),await c(this.language),this._applyColorizeStyles(u()),this.manager.onLifecycle(()=>(this._themeObserver=T(this.el,["class"],()=>this.updateTheme()),this._themeChangedListener=k(()=>{this._applyColorizeStyles(u())}),this.updateTheme(),()=>{this._themeObserver?.(),this._themeObserver=void 0,this._themeChangedListener?.dispose(),this._themeChangedListener=void 0}))}loaded(){this.el.hasChildNodes()||this.#e.resolve()}willUpdate(t){t.has("language")&&m(this.language).then(()=>c(this.language)).catch(_(this))}disconnectedCallback(){super.disconnectedCallback(),this._disposeSlotObservers()}_disposeSlotObservers(){this._slotContentObservers.length&&(this._slotContentObservers.forEach(t=>t.disconnect()),this._slotContentObservers=[])}_observeAssignedSlotNodes(t){this._disposeSlotObservers();let e=t.assignedNodes({flatten:!0});if(!e.length)return;let s=new Set;for(let o of e)o.nodeType===Node.ELEMENT_NODE?s.add(o):o.nodeType===Node.TEXT_NODE&&o.parentElement&&s.add(o.parentElement);let i={characterData:!0,childList:!0,subtree:!0},r=C(()=>{let o=this._computeSlotText(t);o!==this._codeFromSlot&&(this._codeFromSlot=o)},100),d=o=>{if(o.some(a=>a.type==="childList")){let a=this._computeSlotText(t);a!==this._codeFromSlot&&(this._codeFromSlot=a);return}r()};s.forEach(o=>{let a=new MutationObserver(d);a.observe(o,i),this._slotContentObservers.push(a)})}_computeSlotText(t){let e=t.assignedNodes({flatten:!0}).filter(s=>s.nodeType!==Node.COMMENT_NODE);if(this.language==="html"&&e.length){let s=e.find(r=>r.nodeType===Node.ELEMENT_NODE&&r.tagName==="TEMPLATE");if(s)return(s.innerHTML??"").trim();let i=e.map(r=>r.nodeType===Node.ELEMENT_NODE?r.outerHTML:r.nodeType===Node.TEXT_NODE?r.textContent??"":"").join("").trim();return i}return e.map(s=>s.textContent??"").join("").trim()}updateTheme(){let t=w(this.el)==="light"?"vs":"vs-dark";t!==this._currentTheme&&(this._currentTheme=t,this._monacoEditor.setTheme(t))}_applyColorizeStyles(t){if(!this._colorizeSheet){this._colorizeSheet=new CSSStyleSheet;let e=this.renderRoot;e.adoptedStyleSheets=[...e.adoptedStyleSheets,this._colorizeSheet]}this._colorizeSheet.replaceSync(t)}_showLineNumbers(){return typeof this.lineNumbers=="function"||this.lineNumbers==="on"}_getLineNumberLabel(t){return typeof this.lineNumbers=="function"?this.lineNumbers(t):`${t}`}_getRenderedLineNumbers(){if(!this._showLineNumbers())return[];let t=Math.max(this._codeFromSlot.split(/\r\n|\r|\n/u).length,1);return Array.from({length:t},(e,s)=>this._getLineNumberLabel(s+1))}render(){let t=this._getRenderedLineNumbers();return n`<div class=${`arcgis-code-viewer-container${t.length?" arcgis-code-viewer-container--with-line-numbers":""}`}><slot @slotchange=${this._onDefaultSlotChange} style="display:none" aria-hidden=true></slot>${t.length?n`<div class="arcgis-code-viewer__gutter" aria-hidden=true>${t.map(e=>n`<span class="arcgis-code-viewer__line-number">${e}</span>`)}</div>`:null}<pre class="arcgis-code-viewer" aria-label=${`${this.language} code snippet`}>${this._colorizeTask.render({error:()=>null,pending:()=>n`<code class=${`language-${this.language}`}></code>`,complete:e=>n`<code class=${`language-${this.language}`} .innerHTML=${e??""}></code>`})}</pre></div>`}};b("arcgis-code-viewer",p);return p},a,c,d,e,h,i)
@@ -1,5 +1,5 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import a from"./ZHZFKZA7.js";import{b as De}from"./P7I5ATMN.js";import{b as P,c as M,d as $,e as we}from"./G56LJGLK.js";import{a as ve}from"./ER2MKLVA.js";import{a as R,b as Se,c as k,d as b,e as g}from"./IFNCCZ7O.js";import{d as ae}from"./GS2ISVXJ.js";import{L as se,s as re,u as A}from"./REL6OK2I.js";import{a as c}from"./Y3KOWWO5.js";import{Qk as G,Zk as W}from"./LLPQEURF.js";export default $arcgis.t(([Ee,Ae,Le,B,{getDeclaredVoxelMembers:Ue,getDeclaredPixelMembers:Ne},qe,Oe,{A:q,B:y,F:be,H:O,I:ge,a:L,b:ne,c:oe,d:le,e:pe,k:U,l:T,m:ce,o:u,p:he,q:ue,r:x,s:N,t:m,u:de,v:fe,w:_e,y:me,z:ye}])=>{var w=s=>s!==void 0,_=s=>s!==null;function Re(s){switch(s){case"esriFieldTypeOID":return"oid";case"esriFieldTypeSmallInteger":return"small-integer";case"esriFieldTypeInteger":return"integer";case"esriFieldTypeBigInteger":return"big-integer";case"esriFieldTypeSingle":return"single";case"esriFieldTypeDouble":return"double";case"esriFieldTypeDate":return"date";case"esriFieldTypeDateOnly":return"date-only";case"esriFieldTypeTimeOnly":return"time-only";case"esriFieldTypeTimestampOffset":return"timestamp-offset";case"esriFieldTypeGUID":return"guid";case"esriFieldTypeGlobalID":return"global-id";case"esriFieldTypeString":return"string";case"esriFieldTypeGeometry":return"geometry";case"esriFieldTypeBlob":return"blob";case"esriFieldTypeRaster":return"raster";case"esriFieldTypeXML":return"xml";default:return"string"}}function ke(s){return{fields:s.fields.map(e=>({name:e.name,type:Re(e.type),serverType:e.type,nullable:e.nullable}))}}function Ce(s){return typeof s?.query=="object"&&s.query?s.query:{}}var H=class{constructor(e){this.itemId=e.itemId,this.portal=e.portal,this.serviceUrl=e.serviceUrl,this._requestOptions=e.requestOptions}fetchInfo(e){return this.portal.request(this._datastoreUrl,this._createRequestOptions(e))}async fetchDatasets(e){return(await this.portal.request(z(this._datastoreUrl,"datasets"),this._createRequestOptions(e))).datasets}async fetchTableDescription(e,t){if(!e)throw new qe("portal:invalid-parameter",'The "tableName" parameter must be provided.');let i=await this.portal.request(z(this._datastoreUrl,"tableDescription"),{...this._createRequestOptions(t),query:{...Ce(this._requestOptions),...Ce(t),tableName:e}});return ke(i)}get _datastoreUrl(){return z(this.serviceUrl,"datastores",encodeURIComponent(this.itemId))}_createRequestOptions(e){return{...this._requestOptions,...e}}};function z(s,...e){let t=s.replaceAll(/\/+$/gu,""),i=e.filter(r=>!!r).map(r=>r.replaceAll(/^\/+|\/+$/gu,""));return[t,...i].join("/")}var Ge={id:"ansi",keywords:[],functions:[],operators:[],specialChars:{likeWildcardAny:"%",likeWildcardOne:"_",identifierQuote:{start:'"',end:'"'},escapeKey:{start:null,end:null},escapeClause:{keyword:"ESCAPE",suffix:null}}},Fe=new Map,We={ansi:async()=>await Promise.resolve(Ge),bigquery:async()=>(await import("./FLNLMLTL.js")).bigqueryDialect,postgres:async()=>(await import("./VPP77CFW.js")).postgresDialect,sqlServer:async()=>(await import("./DGFH2WPL.js")).sqlServerDialect};async function ze(s){let e=Fe.get(s);if(e)return await e;let t=We[s]();return Fe.set(s,t),await t}var Be=["SELECT","FROM","WHERE","GROUP","BY","HAVING","ORDER","LIMIT","DISTINCT","AS","JOIN","LEFT","RIGHT","FULL","INNER","OUTER","CROSS","ON","USING","AND","OR","NOT","IN","IS","LIKE","BETWEEN","NULL","TRUE","FALSE","ASC","DESC"],He=["<=",">=","<>","!=","=","<",">","+","-","*","/","%","||"],Ke=(s,e={})=>{let t=new Set(e.baseKeywords??Be);for(let r of s.keywords)t.add(r.toUpperCase());let i=new Set(e.baseOperators??He);for(let r of s.operators)i.add(r);return{keywords:Array.from(t),functions:s.functions,operators:Array.from(i),specialChars:s.specialChars}},D={sqlServer:"sql-layer-sql-server",postgres:"sql-layer-postgres",bigquery:"sql-layer-bigquery"},Ie=D.postgres,je={[D.sqlServer]:"sqlServer",[D.postgres]:"postgres",[D.bigquery]:"bigquery"};function Qe(s){return je[s]}async function Je(s){return Ke(await ze(Qe(s)))}var Ze=/^[A-Za-z_][A-Za-z0-9_$]*$/u;function Xe(s){return s==="esriDBMS_PostgreSQL"?Ie:s==="esriDBMS_SQLServer"?D.sqlServer:Ie}function It(s){return s.trim().toLowerCase()}function Ye(s){return s.specialChars.identifierQuote}function et(s,e){let t=s.trim();return t?Ze.test(t)?e.keywords.includes(t.toUpperCase()):!0:!1}function $e(s,e){let t=s.trim();if(!t||!et(t,e))return t;let i=Ye(e),r=t.replaceAll(i.end,`${i.end}${i.end}`);return`${i.start}${r}${i.end}`}function tt(s,e){return s.split(".").map(t=>$e(t,e)).join(".")}function Tt(s){return s.split(".").at(-1)??s}function it(s){return Je(Xe(s))}async function rt(s,e){let t=new B({url:`${s.url}/${e.relatedTableId}`});return await t.load(),t}function ee(s){return(e,t)=>{if(e.type==="oid")return-1;if(t.type==="oid")return 1;if(m(s)){if(e.name===s.subtypeField)return-1;if(t.name===s.subtypeField)return 1}if(x(s)){if(e.name===s.typeIdField)return-1;if(t.name===s.typeIdField)return 1}return e.name.localeCompare(t.name,"en",{sensitivity:"base"})}}function Te(s,e){return s?.every(t=>t.domains?.[e.name]?.type==="inherited")??!1}var st=/^[a-z_$][a-z0-9_$]*$/giu;function te(s,e=!0){return s.match(st)?`${e?".":""}${s}`:`["${s}"]`}function Ve(s,e){return s?`${s}${te(e)}`:e}function xe(s){return fe(s)?s.portalItem:null}function xt(s,e,t=!1){let i=e,r=[],n=[];return b(s).forEach(a=>{i&&(i+=`
2
+ import a from"./ZHZFKZA7.js";import{b as De}from"./UN7LGHT2.js";import{b as P,c as M,d as $,e as we}from"./HLDSPJ74.js";import{a as ve}from"./ER2MKLVA.js";import{a as R,b as Se,c as k,d as b,e as g}from"./IFNCCZ7O.js";import{d as ae}from"./GS2ISVXJ.js";import{L as se,s as re,u as A}from"./REL6OK2I.js";import{a as c}from"./Y3KOWWO5.js";import{Qk as G,Zk as W}from"./LLPQEURF.js";export default $arcgis.t(([Ee,Ae,Le,B,{getDeclaredVoxelMembers:Ue,getDeclaredPixelMembers:Ne},qe,Oe,{A:q,B:y,F:be,H:O,I:ge,a:L,b:ne,c:oe,d:le,e:pe,k:U,l:T,m:ce,o:u,p:he,q:ue,r:x,s:N,t:m,u:de,v:fe,w:_e,y:me,z:ye}])=>{var w=s=>s!==void 0,_=s=>s!==null;function Re(s){switch(s){case"esriFieldTypeOID":return"oid";case"esriFieldTypeSmallInteger":return"small-integer";case"esriFieldTypeInteger":return"integer";case"esriFieldTypeBigInteger":return"big-integer";case"esriFieldTypeSingle":return"single";case"esriFieldTypeDouble":return"double";case"esriFieldTypeDate":return"date";case"esriFieldTypeDateOnly":return"date-only";case"esriFieldTypeTimeOnly":return"time-only";case"esriFieldTypeTimestampOffset":return"timestamp-offset";case"esriFieldTypeGUID":return"guid";case"esriFieldTypeGlobalID":return"global-id";case"esriFieldTypeString":return"string";case"esriFieldTypeGeometry":return"geometry";case"esriFieldTypeBlob":return"blob";case"esriFieldTypeRaster":return"raster";case"esriFieldTypeXML":return"xml";default:return"string"}}function ke(s){return{fields:s.fields.map(e=>({name:e.name,type:Re(e.type),serverType:e.type,nullable:e.nullable}))}}function Ce(s){return typeof s?.query=="object"&&s.query?s.query:{}}var H=class{constructor(e){this.itemId=e.itemId,this.portal=e.portal,this.serviceUrl=e.serviceUrl,this._requestOptions=e.requestOptions}fetchInfo(e){return this.portal.request(this._datastoreUrl,this._createRequestOptions(e))}async fetchDatasets(e){return(await this.portal.request(z(this._datastoreUrl,"datasets"),this._createRequestOptions(e))).datasets}async fetchTableDescription(e,t){if(!e)throw new qe("portal:invalid-parameter",'The "tableName" parameter must be provided.');let i=await this.portal.request(z(this._datastoreUrl,"tableDescription"),{...this._createRequestOptions(t),query:{...Ce(this._requestOptions),...Ce(t),tableName:e}});return ke(i)}get _datastoreUrl(){return z(this.serviceUrl,"datastores",encodeURIComponent(this.itemId))}_createRequestOptions(e){return{...this._requestOptions,...e}}};function z(s,...e){let t=s.replaceAll(/\/+$/gu,""),i=e.filter(r=>!!r).map(r=>r.replaceAll(/^\/+|\/+$/gu,""));return[t,...i].join("/")}var Ge={id:"ansi",keywords:[],functions:[],operators:[],specialChars:{likeWildcardAny:"%",likeWildcardOne:"_",identifierQuote:{start:'"',end:'"'},escapeKey:{start:null,end:null},escapeClause:{keyword:"ESCAPE",suffix:null}}},Fe=new Map,We={ansi:async()=>await Promise.resolve(Ge),bigquery:async()=>(await import("./FLNLMLTL.js")).bigqueryDialect,postgres:async()=>(await import("./VPP77CFW.js")).postgresDialect,sqlServer:async()=>(await import("./DGFH2WPL.js")).sqlServerDialect};async function ze(s){let e=Fe.get(s);if(e)return await e;let t=We[s]();return Fe.set(s,t),await t}var Be=["SELECT","FROM","WHERE","GROUP","BY","HAVING","ORDER","LIMIT","DISTINCT","AS","JOIN","LEFT","RIGHT","FULL","INNER","OUTER","CROSS","ON","USING","AND","OR","NOT","IN","IS","LIKE","BETWEEN","NULL","TRUE","FALSE","ASC","DESC"],He=["<=",">=","<>","!=","=","<",">","+","-","*","/","%","||"],Ke=(s,e={})=>{let t=new Set(e.baseKeywords??Be);for(let r of s.keywords)t.add(r.toUpperCase());let i=new Set(e.baseOperators??He);for(let r of s.operators)i.add(r);return{keywords:Array.from(t),functions:s.functions,operators:Array.from(i),specialChars:s.specialChars}},D={sqlServer:"sql-layer-sql-server",postgres:"sql-layer-postgres",bigquery:"sql-layer-bigquery"},Ie=D.postgres,je={[D.sqlServer]:"sqlServer",[D.postgres]:"postgres",[D.bigquery]:"bigquery"};function Qe(s){return je[s]}async function Je(s){return Ke(await ze(Qe(s)))}var Ze=/^[A-Za-z_][A-Za-z0-9_$]*$/u;function Xe(s){return s==="esriDBMS_PostgreSQL"?Ie:s==="esriDBMS_SQLServer"?D.sqlServer:Ie}function It(s){return s.trim().toLowerCase()}function Ye(s){return s.specialChars.identifierQuote}function et(s,e){let t=s.trim();return t?Ze.test(t)?e.keywords.includes(t.toUpperCase()):!0:!1}function $e(s,e){let t=s.trim();if(!t||!et(t,e))return t;let i=Ye(e),r=t.replaceAll(i.end,`${i.end}${i.end}`);return`${i.start}${r}${i.end}`}function tt(s,e){return s.split(".").map(t=>$e(t,e)).join(".")}function Tt(s){return s.split(".").at(-1)??s}function it(s){return Je(Xe(s))}async function rt(s,e){let t=new B({url:`${s.url}/${e.relatedTableId}`});return await t.load(),t}function ee(s){return(e,t)=>{if(e.type==="oid")return-1;if(t.type==="oid")return 1;if(m(s)){if(e.name===s.subtypeField)return-1;if(t.name===s.subtypeField)return 1}if(x(s)){if(e.name===s.typeIdField)return-1;if(t.name===s.typeIdField)return 1}return e.name.localeCompare(t.name,"en",{sensitivity:"base"})}}function Te(s,e){return s?.every(t=>t.domains?.[e.name]?.type==="inherited")??!1}var st=/^[a-z_$][a-z0-9_$]*$/giu;function te(s,e=!0){return s.match(st)?`${e?".":""}${s}`:`["${s}"]`}function Ve(s,e){return s?`${s}${te(e)}`:e}function xe(s){return fe(s)?s.portalItem:null}function xt(s,e,t=!1){let i=e,r=[],n=[];return b(s).forEach(a=>{i&&(i+=`
3
3
 
4
4
  `),i+=`**${a.name}** (${a.alias})
5
5
  ${a.type}`,a.description&&(i+=`
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
+ import f from"./Q7MSRF5V.js";import e from"./DX64LARM.js";import d from"./AZR47E7L.js";import c from"./ZHZFKZA7.js";import{e as te}from"./UN7LGHT2.js";import b from"./4B64NBIM.js";import{a as oe,b as re,c as y}from"./HUJVXIUS.js";import"./HLDSPJ74.js";import{a as ae}from"./ER2MKLVA.js";import"./IFNCCZ7O.js";import a from"./GLJQQLP2.js";import{a as ee}from"./SB3MM5EM.js";import{a as Z}from"./KCU2C44H.js";import"./GS2ISVXJ.js";import"./6G5URSC7.js";import"./MP6Z45SA.js";import"./6C52UOYL.js";import{E as L,F as M,G as X,H as S,K as Y,L as J,h as V,j as l,l as I,n as T,t as Q}from"./REL6OK2I.js";import{a as W,b as u}from"./Y3KOWWO5.js";import"./B3UMUBOI.js";import"./CF3TERM3.js";import"./Z5ZZ36DQ.js";import{Rk as se,Uk as F,Zk as ie}from"./LLPQEURF.js";import"./3TTFCHAA.js";export default $arcgis.t(([he,{watch:O},m,{property:r,subclass:x},{a:ne,h:P,i:U},{b:N},,,A,{a:ce,b:de}])=>{var _e=V`:host{height:100%}calcite-tooltip:not([calcite-hydrated])>*{display:none}.main-action-bar{calcite-action-group{padding-inline-end:var(--calcite-spacing-sm)}calcite-action-group calcite-action{padding-inline-end:var(--calcite-spacing-sm)}calcite-action-group calcite-action:not(:first-child){padding-inline-start:var(--calcite-spacing-sm)}calcite-action-group:last-child{border-inline-end-width:0px}calcite-action-group:not(:first-child){padding-inline-start:var(--calcite-spacing-sm)}}.bottom-action-bar.is-collapsed{border-bottom:0}`,le="https://services6.arcgis.com/HXHga6CfMLMBOlBX/ArcGIS/rest/services/survey123_6e349a50b4504ca6b6107216d568db5f_form/FeatureServer/0",p=(t,e)=>{W(t,"Arcade Assistant",e)},ge=["orgAiAssistantsEnabled","betaAppsAllowed","serviceUrlAvailable","userHasUseAiAssistantsPrivilege"],me=ge,ue=(t,e)=>e.every(s=>t[s]===!0),xe=t=>{let{aiAssistantsEnabled:e}=t;return e===void 0?(p("warn","`areAiAssistantsEnabled` is not defined in the organizations settings."),!1):e},Se=t=>!(!t||!("id"in t)),Ae=async t=>(await he.getCredential(t,{oAuthPopupConfirmation:!1})).token,Pe=async t=>{try{return!!await he.checkSignInStatus(t)}catch{return p("warn","User is not signed in."),!1}};async function fe({portalUrl:t,profile:e}){if(!Se(e))return p("warn","Addon initialization failed. Reason: unsupported profile."),{shouldRender:!1};let s=t.replace(/\/sharing\/rest(\/.*)?$/iu,"").replace(/\/$/u,"");if(!await Pe(s))return{shouldRender:!1};let i=await Ae(t),a=`${s}/sharing/rest/portals/self?f=json&token=${i}`,o=`${s}/sharing/rest/portals/self/settings?f=json&token=${i}`,n=`${s}/sharing/rest/portals/self/signinSettings?f=json&token=${i}`,c=await Promise.allSettled([fetch(a,{credentials:"include"}).then(v=>v.json()),fetch(o,{credentials:"include"}).then(v=>v.json()),fetch(n,{credentials:"include"}).then(v=>v.json())]),[R,C,B]=c,f=R.status==="fulfilled"?R.value:(p("warn",`Failed to fetch selfUrl. Reason: ${R.reason}.`),{}),K=C.status==="fulfilled"?C.value:(p("warn",`Failed to fetch settingsUrl. Reason: ${C.reason}.`),{}),be=B.status==="fulfilled"?B.value:(p("warn",`Failed to fetch signinSettingsUrl. Reason: ${B.reason}.`),{});if(f.isPortal)return{shouldRender:!1};let j=f.helpBase||"";if(!K)return p("warn","Settings response is not available."),{shouldRender:!1};let D={orgAiAssistantsEnabled:xe(K),betaAppsAllowed:be.blockBetaApps!==!0,serviceUrlAvailable:!!f?.helperServices?.aiAssistantServices?.url,userHasUseAiAssistantsPrivilege:f?.user?.privileges?.includes("portal:user:useAIAssistants")===!0};D.betaAppsAllowed||p("warn","Arcade Assistant is blocked by the organization settings. To enable it, do not block beta apps in the organization settings."),D.userHasUseAiAssistantsPrivilege||p("warn","User does not have the required privileges to use AI Assistants.");let H=ue(D,me),q=ue(D,ge),G=f?.helperServices?.aiAssistantServices?.url;return G?{shouldRender:!0,availableFeatures:{codeActions:H,prompting:q},serviceUrl:G,helpBase:j,feedbackServiceUrl:le}:{shouldRender:!0,availableFeatures:{codeActions:H,prompting:q},helpBase:j,feedbackServiceUrl:le}}var ve=Object.defineProperty,ye=Object.getOwnPropertyDescriptor,_=(t,e,s,i)=>{for(var a=i>1?void 0:i?ye(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&ve(e,s,a),a},pe=100,h=class extends m{constructor(t){super(t),this.collectionItems=[],this.errorMessage="",this.expanded=!1,this.requestId=0,this.status="idle",this.visibleChildCount=pe}};_([r()],h.prototype,"collectionItems",2);_([r()],h.prototype,"errorMessage",2);_([r()],h.prototype,"expanded",2);_([r()],h.prototype,"requestId",2);_([r()],h.prototype,"schemaValue",2);_([r()],h.prototype,"status",2);_([r()],h.prototype,"visibleChildCount",2);h=_([x("ArcadeDebuggerLazyTreeNodeState")],h);var w=class extends m{constructor(t){super(t),this.generation=0,this.nodes=new Map}reset(){this.generation+=1,this.destroyNodes()}ensureNode(t,e=!1,s){let i=this.nodes.get(t);if(i)return i;let a=new h;return a.expanded=e,this.nodes.set(t,a),e&&s&&this.loadNode(t,s),a}setExpanded(t,e,s){let i=this.ensureNode(t,e,s);if(i.expanded===e){e&&s&&this.loadNode(t,s);return}i.expanded=e,e&&s&&this.loadNode(t,s)}showMore(t,e){let s=this.ensureNode(t);s.visibleChildCount>=e||(s.visibleChildCount=Math.min(e,s.visibleChildCount+pe))}loadNode(t,e){switch(e.kind){case"collection":this.runLoad(t,e.load,(s,i)=>{s.collectionItems=i});return;case"schema":this.runLoad(t,e.load,(s,i)=>{s.schemaValue=i});return}}runLoad(t,e,s){let i=this.nodes.get(t);if(!i||i.status==="loading"||i.status==="loaded")return;let a=this.generation,o=i.requestId+1;i.requestId=o,i.status="loading",i.errorMessage="",i.schemaValue=void 0,i.collectionItems=[],e().then(n=>{let c=this.nodes.get(t);!c||this.generation!==a||c.requestId!==o||(s(c,n),c.status="loaded")}).catch(()=>{let n=this.nodes.get(t);!n||this.generation!==a||n.requestId!==o||(n.status="error")})}destroyNodes(){for(let t of this.nodes.values())t.destroy();this.nodes.clear()}};w=_([x("ArcadeDebuggerLazyTreeState")],w);var $e=Object.defineProperty,Ee=Object.getOwnPropertyDescriptor,d=(t,e,s,i)=>{for(var a=i>1?void 0:i?Ee(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&$e(e,s,a),a},b=class extends m{constructor(t){super(t),this.phase="idle",this.sessionId=0,this.consoleLogs=[],this.hasExecuted=!1}get isExecuting(){return this.phase==="running"||this.phase==="debug-running"||this.phase==="debug-paused"}get isDebugging(){return this.phase==="debug-running"||this.phase==="debug-paused"}get isPaused(){return this.phase==="debug-paused"}get runResult(){return this.result?.resultType==="run"?this.result.result:void 0}get debugResult(){return this.result?.resultType==="debug"?this.result.result:void 0}addConsoleLog(t){this.consoleLogs=[...this.consoleLogs,t]}};d([r()],b.prototype,"phase",2);d([r()],b.prototype,"mode",2);d([r()],b.prototype,"sessionId",2);d([r()],b.prototype,"result",2);d([r()],b.prototype,"consoleLogs",2);d([r()],b.prototype,"hasExecuted",2);b=d([x("ArcadeDebuggerExecutionModel")],b);var k=class extends m{constructor(t){super(t),this.breakpoints=[]}setBreakpoints(t){this.breakpoints=Array.from(new Set(t)).sort((e,s)=>e-s)}toggleBreakpoint(t){let e=new Set(this.breakpoints);e.has(t)?e.delete(t):e.add(t),this.setBreakpoints(e)}clearBreakpoints(){this.breakpoints=[]}};d([r()],k.prototype,"breakpoints",2);k=d([x("ArcadeDebuggerSessionModel")],k);var $=class extends m{constructor(t){super(t),this.openedPanel="output",this.showPanel=!1}};d([r()],$.prototype,"openedPanel",2);d([r()],$.prototype,"showPanel",2);$=d([x("ArcadeDebuggerUiModel")],$);var E=class extends m{constructor(t){super(t)}get line(){return this.pausedState?.line}clearPausedState(){this.lastPausedState=this.pausedState,this.pausedState=void 0}reset(){this.pausedState=void 0,this.lastPausedState=void 0}setPausedState(t){this.pausedState=t,this.lastPausedState=t}};d([r()],E.prototype,"pausedState",2);d([r()],E.prototype,"lastPausedState",2);E=d([x("ArcadeDebuggerPausedFrameModel")],E);var g=class extends m{constructor(t){super(t),this.execution=new b,this.lazyTreeState=new w,this.pausedFrame=new E,this.previewTabsState=new N,this.session=new k,this.ui=new $}get breakpoints(){return this.session.breakpoints}get debuggerBreakpoints(){return this.session.breakpoints.map(t=>({line:t}))}get consoleLogs(){return this.execution.consoleLogs}get debug(){if(!(!this.pausedFrame.pausedState&&!this.pausedFrame.lastPausedState))return{pausedState:this.pausedFrame.pausedState,lastPausedState:this.pausedFrame.lastPausedState}}get debugResult(){return this.execution.debugResult}get debuggerLine(){return this.pausedFrame.pausedState?.line}get executionState(){return this.pausedFrame.pausedState}get hasExecuted(){return this.execution.hasExecuted}get isDebugging(){return this.execution.isDebugging}get isExecuting(){return this.execution.isExecuting}get isPaused(){return this.execution.isPaused}get mode(){return this.execution.mode}get openedPanel(){return this.ui.openedPanel}get outputRenderer(){if(this.execution.result)return this.execution.result.resultType==="debug"?"debugger":"legacy"}get phase(){return this.execution.phase}get result(){return this.execution.result}get runResult(){return this.execution.runResult}get sessionId(){return this.execution.sessionId}get showPanel(){return this.ui.showPanel}addConsoleLog(t){this.execution.addConsoleLog(t)}clearBreakpoints(){this.session.clearBreakpoints()}clearForMissingTestData(){this.stopDebug({hidePanel:!0}),this.execution.hasExecuted=!1,this.execution.result=void 0}closePanel(){this.ui.showPanel=!1}completeDebug(t){this.execution.mode="debug",this.execution.result={resultType:"debug",result:t},this.execution.phase="completed",this.ui.openedPanel="output",this.pausedFrame.reset(),this.resetTransientDebuggerState()}completeRun(t,e={}){this.execution.mode="run",!e.useDebugRenderer&&P(t)?this.execution.result={resultType:"run",result:t}:e.useDebugRenderer&&!P(t)&&(this.execution.result={resultType:"debug",result:t}),this.execution.phase="completed",this.pausedFrame.reset(),this.resetTransientDebuggerState()}continueDebug(){let t=this.pausedFrame.pausedState?.continue;t&&(this.execution.phase="debug-running",this.pausedFrame.clearPausedState(),t.resolve())}disableDebugger(){this.stopDebug({hidePanel:!0}),this.clearBreakpoints()}fail(t){this.completeRun(t)}pauseDebug(t){let e=this.pausedFrame.pausedState??this.pausedFrame.lastPausedState;this.syncPausedState(e,t),this.pausedFrame.setPausedState(t),this.execution.phase="debug-paused"}reset(){this.execution.phase="idle",this.execution.mode=void 0,this.execution.result=void 0,this.execution.consoleLogs=[],this.execution.hasExecuted=!1,this.execution.sessionId=0,this.ui.openedPanel="output",this.ui.showPanel=!1,this.pausedFrame.reset(),this.session.clearBreakpoints(),this.replaceTransientDebuggerState()}resetDebug(){this.stopDebug({hidePanel:!1}),this.execution.result=void 0,this.execution.consoleLogs=[],this.ui.openedPanel="debug-console"}disconnect(){this.stopDebug({hidePanel:!0})}setBreakpoints(t){this.session.setBreakpoints(t)}setPanel(t){this.execution.hasExecuted&&(this.ui.openedPanel=t,this.ui.showPanel=!0)}startDebug(){return this.execution.mode="debug",this.execution.phase="debug-running",this.execution.hasExecuted=!0,this.execution.result=void 0,this.execution.consoleLogs=[],this.ui.openedPanel="debug-console",this.ui.showPanel=!0,this.execution.sessionId+=1,this.pausedFrame.reset(),this.replaceTransientDebuggerState(),this.execution.sessionId}startRun(){return this.execution.mode="run",this.execution.phase="running",this.execution.hasExecuted=!0,this.execution.result=void 0,this.execution.consoleLogs=[],this.ui.openedPanel="output",this.ui.showPanel=!0,this.execution.sessionId+=1,this.pausedFrame.reset(),this.replaceTransientDebuggerState(),this.execution.sessionId}stopDebug({hidePanel:t=!0,invalidateSession:e=!0}={}){let s=this.pausedFrame.pausedState?.continue;e&&(this.execution.sessionId+=1),this.execution.phase=this.execution.hasExecuted?"completed":"idle",this.pausedFrame.reset(),this.resetTransientDebuggerState(),t&&(this.ui.showPanel=!1),this.ui.openedPanel==="debug-console"&&(this.ui.openedPanel="output"),s?.resolve()}syncPausedState(t,e){this.lazyTreeState.reset(),t&&e&&t!==e&&this.previewTabsState.invalidateAll(),this.pausedLine=e?.line}toggleBreakpoint(t){this.session.toggleBreakpoint(t)}togglePanel(t){if(this.execution.hasExecuted){if(t==null){this.ui.showPanel=!this.ui.showPanel;return}if(this.ui.openedPanel===t&&this.ui.showPanel){this.ui.showPanel=!1;return}this.setPanel(t)}}resetTransientDebuggerState(){this.pausedLine=void 0,this.lazyTreeState.reset(),this.previewTabsState.clear()}replaceTransientDebuggerState(){this.pausedLine=void 0,this.lazyTreeState=new w,this.previewTabsState=new N}};d([r()],g.prototype,"execution",2);d([r()],g.prototype,"lazyTreeState",2);d([r()],g.prototype,"pausedLine",2);d([r()],g.prototype,"pausedFrame",2);d([r()],g.prototype,"previewTabsState",2);d([r()],g.prototype,"session",2);d([r()],g.prototype,"ui",2);g=d([x("ArcadeDebuggerStore")],g);var De={glyphMargin:!0,lineNumbersMinChars:1},z=class extends X{constructor(){super(...arguments),this._codeEditorElt=L(),this._arcadeAssistantElt=L(),this._componentReadyDefer=Promise.withResolvers(),this._disposables=[],this._editorProfilePromise=Promise.resolve(void 0),this._debuggerState=new g,this.messages=ee(),this._modelId=Q(),this._openArcadeHelp=()=>{window.open(ne,"Arcade Help")},this._decorations=void 0,this._monacoEditor=Z(ae),this._editorOptions={},this._toggleSidePanel=e=>{e.currentTarget instanceof HTMLElement&&this._setOpenedSidePanel(e.currentTarget.dataset.panelName??"none")},this._closeSidePanel=()=>{this._setOpenedSidePanel("none")},this._updateBreakpointsDecorations=()=>{let e=this.editorInstance;if(!e)return;let s=this._debuggerState.breakpoints.map(i=>({range:new F(i,1,i,1),options:{isWholeLine:!0,glyphMarginClassName:"arcgis-code-editor__breakpoint-glyph"}}));this._decorations?.clear(),this._decorations=e.createDecorationsCollection(s)},this._clearDebuggerDecorations=()=>{this._decorations?.clear(),this._decorations=void 0,this._debuggerPausedLineDecoration?.clear(),this._debuggerPausedLineDecoration=void 0},this._debuggerPausedLineDecoration=void 0,this._preparingArcade=!1,this._arcadeAssistantRemoteState={shouldRender:!1},this._diagnostics=[],this.enableDebugger=!1,this.hideDocumentationActions=!1,this.hideSideBar=!1,this.openedSidePanel="none",this.script="",this.sideActionBarExpanded=!1,this.arcgisDiagnosticsChange=T({bubbles:!1}),this.arcgisScriptChange=T({bubbles:!1})}static{this.properties={_apiLibrary:16,_editorProfile:16,_preparingArcade:16,_arcadeAssistantRemoteState:16,_diagnostics:16,editorInstance:32,editorOptions:0,enableDebugger:5,hideDocumentationActions:5,hideSideBar:5,messageOverrides:0,openedSidePanel:3,profile:0,script:1,sideActionBarExpanded:7,snippets:0,suggestions:0,testData:0,customPanels:0,arcadeAssistant:0,externalExecutor:0}}static{this.styles=[_e]}get _usesBottomExecutionDrawer(){return this.enableDebugger&&!!this.testData}get editorInstance(){return this._codeEditorElt.value?.editorInstance}get editorOptions(){return{...De,...this._editorOptions}}set editorOptions(e){this._editorOptions=e??{}}async getTestResult(){if(!this.testData)return{type:"error",value:"Missing test data",error:null};let e=await this._editorProfilePromise;if(!e)return{type:"error",value:"Missing editor profile",error:null};await this._componentReadyDefer.promise;let s=this._codeEditorElt.value?.value,i=await U(e.definition,s,this.testData,{mode:"run"});return P(i)?i:{type:"error",value:"Unexpected debug result",error:null}}async setFocus(){await this._componentReadyDefer.promise,await this._codeEditorElt.value?.setFocus()}async openArcadeAssistant(e){if(!this._arcadeAssistantRemoteState.shouldRender)return!1;if(this.openedSidePanel="arcade-assistant",await this.updateComplete,!this._canPromptWithArcadeAssistant())return!0;let s=this._arcadeAssistantElt.value;return e?.prompt&&await s?.openPrompt(e.prompt),!0}async load(){let e=J("./assets");ce(e),await this._updateDataModelDeps(),await this._updateArcadeAssistantRemoteState(),this.manager.onLifecycle(()=>(this.hasUpdated&&this._connectMonacoCustomizations().catch(u(this)),()=>{for(this._askAiBindingKey&&(y(this._askAiBindingKey,void 0),this._askAiBindingKey=void 0);this._disposables.length;)this._disposables.pop()?.dispose();this._abortExternalExecution(),this._connectMonacoCustomizationsPromise=void 0,this._executeScriptAction=void 0,this._clearDebuggerDecorations(),this._debuggerState.disconnect()}))}willUpdate(e){(e.has("messages")||e.has("profile"))&&this._updateDataModelDeps(),e.has("testData")&&this._testDataChanged(),e.has("enableDebugger")&&!this.enableDebugger&&this._debuggerState.disableDebugger(),e.has("snippets")&&A.updateApiContextForModel(this._modelId,{snippets:this.snippets}),e.has("arcadeAssistant")&&this._updateArcadeAssistantRemoteState()}async loaded(){await this._connectMonacoCustomizations(),this._componentReadyDefer.resolve(),await this._codeEditorElt.value?.setFocus()}_setOpenedSidePanel(e){this.openedSidePanel=e===this.openedSidePanel?"none":e}async _connectMonacoCustomizations(){if(this._connectMonacoCustomizationsPromise)return await this._connectMonacoCustomizationsPromise;this._connectMonacoCustomizationsPromise=(async()=>{if(!this.isConnected)return;let e=await de();this._disposables.push(e.onDiagnosticsChange(c=>{this._preparingArcade||(this._diagnostics=c.diagnostics,this.arcgisDiagnosticsChange.emit(c.diagnostics))})),this.testData&&!this._executeScriptAction&&this._addExecuteScriptAction(),this._syncAskAiAction();let s=O(()=>this._debuggerState.breakpoints,()=>this._updateBreakpointsDecorations(),{sync:!0}),i=O(()=>this._debuggerState.debuggerLine,()=>this._updateDebuggerPausedLineDecoration(),{sync:!0}),a=O(()=>this._debuggerState.consoleLogs.length,()=>this.requestUpdate(),{sync:!0});this._disposables.push({dispose:()=>s.remove()},{dispose:()=>i.remove()},{dispose:()=>a.remove()});let o=this.editorInstance?.onMouseDown(c=>this._onEditorMouseDown(c));o&&this._disposables.push(o);let n=this.editorInstance?.onDidChangeModelContent(c=>this._onEditorModelContentChange(c));n&&this._disposables.push(n),this._updateBreakpointsDecorations(),this._updateDebuggerPausedLineDecoration()})();try{await this._connectMonacoCustomizationsPromise}finally{this._connectMonacoCustomizationsPromise=void 0}}_onEditorMouseDown(e){if(!this.enableDebugger||![this._monacoEditor.MouseTargetType.GUTTER_GLYPH_MARGIN,this._monacoEditor.MouseTargetType.GUTTER_LINE_NUMBERS,this._monacoEditor.MouseTargetType.GUTTER_LINE_DECORATIONS].includes(e.target.type))return;let s=e.target.position?.lineNumber;s&&this._debuggerState.toggleBreakpoint(s)}_onEditorModelContentChange(e){if(!this.enableDebugger||!this._debuggerState.breakpoints.length||e.isFlush)return;let s=te(this._debuggerState.breakpoints,e.changes);s.length===this._debuggerState.breakpoints.length&&s.every((i,a)=>i===this._debuggerState.breakpoints[a])||this._debuggerState.setBreakpoints(s)}_updateDebuggerPausedLineDecoration(){let e=this.editorInstance;if(!e)return;this._debuggerPausedLineDecoration?.clear();let s=this._debuggerState.debuggerLine;s!=null?this._debuggerPausedLineDecoration=e.createDecorationsCollection([{range:new F(s,1,s,1),options:{isWholeLine:!0,className:"arcgis-code-editor__debugger-paused-line",glyphMarginClassName:"arcgis-code-editor__debugger-paused-glyph",marginClassName:"arcgis-code-editor__debugger-paused-line arcgis-code-editor__debugger-paused-margin"}}]):this._debuggerPausedLineDecoration=void 0}_continueDebugSession(){this._debuggerState.continueDebug()}_abortExternalExecution(){this._externalExecutionAbortController?.abort(),this._externalExecutionAbortController=void 0}_stopDebugSession({hideExecutionPanel:e=!0}={}){this._abortExternalExecution(),this._debuggerState.stopDebug({hidePanel:e})}_resetDebugSession(){this._abortExternalExecution(),this._debuggerState.resetDebug(),this._executeScript("debug").catch(u(this))}async _handleDebugPause(e,s,i){if(!this._debuggerState.isDebugging||e!==this._debuggerState.sessionId)return;let a=Promise.withResolvers();return this._debuggerState.pauseDebug({line:s.line,result:i,continue:a}),await a.promise}async _updateDataModelDeps(){await this._updateEditorProfile(),await this._updateApiLibrary()}async _executeWithExternalExecutor(e,s,i){if(!this.externalExecutor)return{type:"error",value:"Missing external executor",error:null};let a=new AbortController;this._abortExternalExecution(),this._externalExecutionAbortController=a;let o=i.console??(()=>{});try{if(e==="debug"){let{breakpoints:n,onDebugPause:c}=i;if(!n||!c)throw new Error("Missing debug execution options");return await this.externalExecutor.execute({mode:"debug",script:s,console:o,signal:a.signal,breakpoints:n,onDebugPause:c})}return await this.externalExecutor.execute({mode:"run",script:s,console:o,signal:a.signal})}catch(n){return{type:"error",value:"Execution failed",error:n instanceof Error?n:new Error(String(n))}}finally{this._externalExecutionAbortController===a&&(this._externalExecutionAbortController=void 0)}}_testDataChanged(){!this.testData&&this._executeScriptAction&&(this._disposeSafely(this._executeScriptAction),this._executeScriptAction=void 0),this.testData&&!this._executeScriptAction&&this._addExecuteScriptAction(),!this.testData&&this.enableDebugger&&this._debuggerState.clearForMissingTestData(),this._debuggerState.showPanel&&this._executeScript("run").catch(u(this))}async _updateEditorProfile(){this._preparingArcade=!0;try{await A.setProfileForModel(this._modelId,this.profile,{locale:this.messages._t9nLocale,snippets:this.snippets}),this._editorProfile=A.getEditorProfileForModel(this._modelId)}catch{this._editorProfile=void 0}finally{this._editorProfilePromise=Promise.resolve(this._editorProfile),this._preparingArcade=!1}}async _updateApiLibrary(){this._apiLibrary=await A.getApiLibraryForModel(this._modelId)}_setExecutionPanel(e){this._debuggerState.togglePanel(e)}async _executeScript(e){let s=this.testData;if(!this._codeEditorElt.value||!s)return;let i=e==="debug"?this._debuggerState.startDebug():this._debuggerState.startRun();setTimeout(()=>{(async()=>{let a=this._codeEditorElt.value?.value??this.script,o={mode:e,console:c=>this._debuggerState.addConsoleLog(c),breakpoints:e==="debug"?this._debuggerState.debuggerBreakpoints:void 0};e==="debug"&&(o.onDebugPause=this._handleDebugPause.bind(this,i));let n;if(this.externalExecutor)n=await this._executeWithExternalExecutor(e,a,o);else{let c=await this._editorProfilePromise;if(!c){this._debuggerState.fail({type:"error",value:"Missing editor profile",error:null});return}n=await U(c.definition,a,s,o)}if(i===this._debuggerState.sessionId){if(e==="debug"){if(P(n)){this._debuggerState.fail(n);return}this._debuggerState.completeDebug(n);return}P(n)?this._debuggerState.completeRun(n):this.externalExecutor?this._debuggerState.completeRun(n,{useDebugRenderer:!0}):this._debuggerState.fail({type:"error",value:"Unexpected debug result",error:null})}})()},0)}_toggleShowExecutionPanel(){this._debuggerState.togglePanel()}_toggleSideActionBarExpanded(){this.sideActionBarExpanded=!this.sideActionBarExpanded}_onCodeEditorValueChange(e){e.stopPropagation(),this.script=e.detail,this.arcgisScriptChange.emit(e.detail)}_insertAsSnippet(e){this._codeEditorElt.value?.insertSnippet(e.detail).catch(u(this))}_insertAsText(e){this._insertText(e.detail)}_insertText(e){this._codeEditorElt.value?.insertText(e).catch(u(this))}_onResultPanelChange(e){let s=e.currentTarget;this._debuggerState.setPanel(s.openedResultPanel)}_onExecutionPanelClose(){this._debuggerState.closePanel()}_addExecuteScriptAction(){let e=this.editorInstance?.addAction({id:"run-script",label:"Run Arcade Expression",keybindings:[se.F5],contextMenuGroupId:"code",contextMenuOrder:1,run:()=>{this.testData&&this._executeScript("run").catch(u(this))}});e&&(this._executeScriptAction=e,this._disposables.push(e))}_getAskAiBindingKey(){return ie.parse(this._modelId).toString()}_canRenderAskAiCodeActions(){let e=this._arcadeAssistantRemoteState;return e.shouldRender?e.availableFeatures.codeActions:!1}_canPromptWithArcadeAssistant(){let e=this._arcadeAssistantRemoteState;return e.shouldRender?e.availableFeatures.prompting:!1}_getAskAiCodeActions(e){if(!this._canRenderAskAiCodeActions())return[];if(!e.markers.length)return[];let s=this.messages.askarcadeassistant??"Ask Arcade Assistant",i=this._getAskAiBindingKey();return[{title:s,kind:oe,diagnostics:e.markers,isPreferred:!1,isAI:!1,command:{id:re,title:s,arguments:[i,this.messages.askarcadeassistantprompt??"Fix the errors in my script"]}}]}_syncAskAiAction(){if(!this.editorInstance)return;let e=this._getAskAiBindingKey();if(!this._arcadeAssistantRemoteState.shouldRender){this._askAiBindingKey&&(y(this._askAiBindingKey,void 0),this._askAiBindingKey=void 0);return}this._askAiBindingKey&&this._askAiBindingKey!==e&&y(this._askAiBindingKey,void 0),y(e,{provideCodeActions:({context:s})=>this._getAskAiCodeActions(s),run:s=>{this.openArcadeAssistant({prompt:s??this.messages.askarcadeassistantprompt??"Fix the errors in my script"}).catch(u(this))}}),this._askAiBindingKey=e}_disposeSafely(e){let s=this._disposables.indexOf(e);s!==-1&&this._disposables.splice(s,1),e.dispose()}async _updateArcadeAssistantRemoteState(){this.arcadeAssistant?this._arcadeAssistantRemoteState=await fe({...this.arcadeAssistant,profile:this.profile}):this._arcadeAssistantRemoteState={shouldRender:!1},this._syncAskAiAction()}renderMainActionBar(){return this.enableDebugger||!this.testData?null:l`<calcite-action-bar class="main-action-bar" layout=horizontal scale=s expanded expand-disabled slot=top-action-bar><calcite-action-group scale=s><calcite-action .text=${this.messages.run??""} text-enabled icon=play scale=s .loading=${this._preparingArcade} @click=${()=>{this._executeScript("run").catch(u(this))}}></calcite-action>${this._debuggerState.result?l`<calcite-action .text=${this.messages.lastresults??""} .active=${this._debuggerState.showPanel} text-enabled icon=access-string-results icon-flip-rtl scale=s @click=${this._toggleShowExecutionPanel}></calcite-action>`:null}</calcite-action-group></calcite-action-bar>`}renderMainPanel(){return l`<arcgis-code-editor slot=editor .editorOptions=${this.editorOptions} .language=${A.languageId} .value=${this.script??""} .modelId=${this._modelId} @arcgisValueChange=${this._onCodeEditorValueChange} ${M(this._codeEditorElt)}></arcgis-code-editor>`}renderAction({id:e,label:s,icon:i,active:a,panelName:o,iconFlipRtl:n=!1,onClick:c=this._toggleSidePanel}){return l`<calcite-action id=${e??I} .text=${s} .textEnabled=${this.sideActionBarExpanded} .icon=${i} .active=${a} @click=${c} data-panel-name=${o??I} .iconFlipRtl=${n}></calcite-action>${!this.sideActionBarExpanded&&l`<calcite-tooltip .referenceElement=${e}><span>${s}</span></calcite-tooltip>`||""}`}renderSideActionBar(){return this.hideSideBar?null:l`<calcite-action-bar slot=side-action-bar class="side-action-bar" .expanded=${this.sideActionBarExpanded} position=end @calciteActionBarToggle=${this._toggleSideActionBarExpanded}><calcite-action-group>${this.renderAction({id:"profile-variables-action",label:this.messages.profilevariables??"",icon:"profile-variables",active:this.openedSidePanel==="variables",panelName:"variables"})}${this.renderAction({id:"function-action",label:this.messages.constantsandfunctions??"",icon:"function",active:this.openedSidePanel==="api",panelName:"api"})}${this.suggestions?.length?this.renderAction({id:"suggestions-action",label:this.messages.suggestions??"",icon:"lightbulb",active:this.openedSidePanel==="suggestions",panelName:"suggestions"}):null}${this._arcadeAssistantRemoteState.shouldRender&&this.renderAction({id:"arcade-assistant-action",label:this.messages.arcadeassistant??"Arcade assistant",icon:"effects",active:this.openedSidePanel==="arcade-assistant",panelName:"arcade-assistant"})||""}${this.customPanels?.map(e=>e.enabled===!1?null:this.renderAction({id:e.id,label:e.name,icon:e.icon,active:this.openedSidePanel===e.id,panelName:e.id}))}${this.hideDocumentationActions?null:this.renderAction({id:"developer-website-action",label:this.messages.help??"",icon:"question",active:!1,panelName:"none",iconFlipRtl:this.messages._lang==="ar",onClick:this._openArcadeHelp})}</calcite-action-group></calcite-action-bar>`}renderSidePanel(){if(this.hideSideBar)return null;let{openedSidePanel:e}=this;return l`<arcgis-language-api-panel slot=side-panel class=${S(e==="api"?"":"hidden")} .loading=${this._preparingArcade} .apiLibrary=${this._apiLibrary} .hideDocumentationActions=${this.hideDocumentationActions} @arcgisInternalItemSelected=${this._insertAsSnippet} @arcgisInternalClosePanel=${this._closeSidePanel} data-panel-name=none .closed=${e!=="api"}></arcgis-language-api-panel><arcgis-editor-variables slot=side-panel class=${S(e==="variables"?"":"hidden")} .loading=${this._preparingArcade} .modelId=${this._modelId} @arcgisInternalItemSelected=${this._insertAsText} @arcgisInternalClosePanel=${this._closeSidePanel} data-panel-name=none .variable=${this._editorProfile} .closed=${e!=="variables"} .messageOverrides=${{profileempty:this.messages.profileempty}}></arcgis-editor-variables>${this.suggestions?.length&&l`<arcgis-arcade-suggestions slot=side-panel class=${S(e==="suggestions"?"":"hidden")} .closed=${e!=="suggestions"} .suggestions=${this.suggestions} @arcgisInternalItemSelected=${this._insertAsText} @arcgisInternalClosePanel=${this._closeSidePanel} data-panel-name=none></arcgis-arcade-suggestions>`||""}${this.arcadeAssistant&&this._arcadeAssistantRemoteState.shouldRender&&l`<arcgis-arcade-coding-assistant slot=side-panel class=${S(e==="arcade-assistant"?"":"hidden")} .closed=${e!=="arcade-assistant"} .insertText=${this._insertText.bind(this)} .closePanel=${this._closeSidePanel} .portalUrl=${this.arcadeAssistant.portalUrl} .serviceUrl=${"serviceUrl"in this._arcadeAssistantRemoteState?this._arcadeAssistantRemoteState.serviceUrl:void 0} .helpBase=${this._arcadeAssistantRemoteState.helpBase} .promptingEnabled=${this._canPromptWithArcadeAssistant()} .feedbackServiceUrl=${this._arcadeAssistantRemoteState.feedbackServiceUrl} .editorRef=${this.el} .appVersion=${this.arcadeAssistant.appVersion} .disableQuestionAnswerLogging=${this.arcadeAssistant.disableQuestionAnswerLogging} .diagnostics=${this._diagnostics} ${M(this._arcadeAssistantElt)}></arcgis-arcade-coding-assistant>`||""}${this.customPanels?.map(s=>l`<calcite-flow slot=side-panel class=${S(e===s.id?"":"hidden")}>${s?.useFlows?s.renderer?.({closePanel:this._toggleSidePanel,insertText:this._insertText.bind(this),closed:e!==s.id,editorRef:this.el}):l`<calcite-flow-item .heading=${s.name} heading-level=2 closable .closed=${e!==s.id} @calciteFlowItemClose=${this._toggleSidePanel} .description=${s.description}>${s.renderer?.({closePanel:this._toggleSidePanel,insertText:this._insertText.bind(this),closed:e!==s.id,editorRef:this.el})}</calcite-flow-item>`}</calcite-flow>`)}`}renderResultsPanel(){if(this._usesBottomExecutionDrawer)return this.renderBottomExecutionBody();if(!this._debuggerState.showPanel)return null;let e=this._debuggerState.openedPanel==="debug-console"?"output":this._debuggerState.openedPanel;return l`<arcgis-arcade-results slot=results-panel .openedResultPanel=${e} .loading=${this._debuggerState.isExecuting} .result=${this._debuggerState.runResult} .consoleLogs=${this._debuggerState.consoleLogs} @arcgisInternalOpenedResultPanelChange=${this._onResultPanelChange} @arcgisInternalClosePanel=${this._onExecutionPanelClose}></arcgis-arcade-results>`}renderBottomExecutionBody(){let{showPanel:e,openedPanel:s,debugResult:i,isExecuting:a,mode:o}=this._debuggerState;return e?s==="debug-console"?l`<arcgis-arcade-debugger-console slot=results-panel .modelId=${this._modelId} .debuggerStore=${this._debuggerState}></arcgis-arcade-debugger-console>`:s==="output"&&(o==="debug"||i)?l`<arcgis-arcade-debugger-output slot=results-panel .debuggerStore=${this._debuggerState} .result=${i}></arcgis-arcade-debugger-output>`:l`<arcgis-arcade-results slot=results-panel class="bottom-results" .openedResultPanel=${s} .loading=${s==="console"&&this._debuggerState.isPaused?!1:a} .result=${this._debuggerState.runResult} .consoleLogs=${this._debuggerState.consoleLogs} hide-header @arcgisInternalOpenedResultPanelChange=${this._onResultPanelChange}></arcgis-arcade-results>`:null}renderBottomActionBar(){if(!this._usesBottomExecutionDrawer)return null;let{showPanel:e,hasExecuted:s,openedPanel:i,isDebugging:a,isPaused:o,isExecuting:n}=this._debuggerState;return l`<calcite-action-bar slot=bottom-action-bar class=${`main-action-bar bottom-action-bar ${e?"":"is-collapsed"}`} layout=horizontal scale=s expand-disabled><calcite-action-group scale=s>${a?l`<calcite-action .text=${this.messages.continue??"Continue"} icon=forward scale=s .disabled=${!o} @click=${this._continueDebugSession}></calcite-action><calcite-action .text=${this.messages.reset??"Reset"} icon=reset scale=s @click=${this._resetDebugSession}></calcite-action><calcite-action .text=${this.messages.stop??"Stop"} icon=circle-stop scale=s @click=${()=>this._stopDebugSession()}></calcite-action>`:l`<calcite-action .text=${this.messages.run??""} text-enabled icon=play scale=s .loading=${this._preparingArcade||n} @click=${()=>{this._executeScript("run").catch(u(this))}}></calcite-action><calcite-action .text=${this.messages.runanddebug??"Run and Debug"} text-enabled icon=debug-script scale=s .loading=${this._preparingArcade||n} @click=${()=>{this._executeScript("debug").catch(u(this))}}></calcite-action>`}</calcite-action-group>${s?l`<calcite-action-group scale=s><calcite-action .active=${i==="output"&&e} .text=${this.messages.output??"Output"} text-enabled scale=s icon=list-show-all icon-flip-rtl @click=${()=>this._setExecutionPanel("output")}></calcite-action><calcite-action .active=${i==="console"&&e} .text=${this.messages.console??"Console"} text-enabled scale=s icon=console icon-flip-rtl @click=${()=>this._setExecutionPanel("console")}></calcite-action><calcite-action .active=${i==="log"&&e} .text=${this.messages.log??"Log"} text-enabled scale=s icon=list icon-flip-rtl @click=${()=>this._setExecutionPanel("log")}></calcite-action><calcite-action .active=${i==="debug-console"&&e} .text=${this.messages.debugconsole??"Debug Console"} text-enabled scale=s icon=debug-script icon-flip-rtl .disabled=${this._debuggerState.mode!=="debug"} @click=${()=>this._setExecutionPanel("debug-console")}></calcite-action></calcite-action-group>`:null}${e?l`<calcite-action-group scale=s><calcite-action .text=${this.messages.close??"Close"} scale=s icon=x icon-flip-rtl @click=${this._onExecutionPanelClose}></calcite-action></calcite-action-group>`:null}</calcite-action-bar>`}render(){return l`<arcgis-code-editor-shell>${this.renderMainActionBar()}${this.renderMainPanel()}${this.renderBottomActionBar()}${this.renderResultsPanel()}${this.renderSidePanel()}${this.renderSideActionBar()}</arcgis-code-editor-shell>`}};Y("arcgis-arcade-editor",z);return z},"identity/IdentityManager","core/reactiveUtils","core/Accessor","core/accessorSupport/decorators",a,b,c,d,e,f)
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{a as n}from"./6TBGTZVD.js";import{a as g}from"./P7I5ATMN.js";import"./G56LJGLK.js";import{a as f}from"./SB3MM5EM.js";import"./KCU2C44H.js";import"./GS2ISVXJ.js";import{g as p,h as u}from"./6G5URSC7.js";import{F as a,G as d,K as h,h as m,j as s,n as c,s as o}from"./REL6OK2I.js";import"./Y3KOWWO5.js";import"./3TTFCHAA.js";var b=m`:host{background-color:var(--calcite-color-foreground-1);.notice-container{margin:var(--calcite-spacing-xxs);padding:var(--calcite-spacing-sm);background-color:var(--calcite-color-foreground-1)}.sticky{position:sticky;top:0;z-index:10}calcite-flow{height:100%}calcite-block{p:first-of-type{margin-top:0}}calcite-list-item-group{background-color:var(--calcite-color-foreground-2)}calcite-flow{[slot=footer]{word-break:break-word}}}`,r=class extends d{constructor(){super(...arguments),this.messages=f(),this._unselectItem=async()=>{this._selectedApiItem=void 0},this._filterValue="",this.languageId="arcade",this.hideDocumentationActions=!1,this.loading=!1,this.closed=!1,this.arcgisInternalClosePanel=c({bubbles:!1,composed:!1}),this.arcgisInternalItemSelected=c({bubbles:!1,composed:!1})}static{this.properties={_filterValue:16,_selectedApiItem:16,languageId:1,apiLibrary:0,hideDocumentationActions:5,loading:5,closed:5}}static{this.styles=b}willUpdate(e){if(e.has("apiLibrary")){if(!this._selectedApiItem)return;for(let i of this.apiLibrary??[])for(let t of i.items)if(t.name===this._selectedApiItem.name){this._selectedApiItem=t;return}this._selectedApiItem=void 0}}disconnectedCallback(){super.disconnectedCallback(),this._flowObserver?.disconnect()}flowFocusHandler(e){if(!e){this._flowObserver?.disconnect(),this._flowObserver=void 0;return}this._flowObserver||(this._flowObserver=new MutationObserver(()=>{u(e.querySelector("calcite-flow-item:last-child"),"calcite-input")}),this._flowObserver.observe(e,{attributes:!0,attributeFilter:["id"],childList:!0}))}_emitItemSelected(e,i){if(!i)return;let t=e;(!t.key||t.key==="Enter")&&(e.preventDefault(),this.arcgisInternalItemSelected.emit(i.completion.insertText??""))}_emitClose(){this.arcgisInternalClosePanel.emit()}_emitItemSelectedAndClose(e,i){let t=e;(!t.key||t.key==="Enter")&&(e.preventDefault(),this.arcgisInternalItemSelected.emit(i.completion.insertText??""))}_selectItem(e,i){e.stopPropagation(),this._selectedApiItem=i}_updateFilterValue(e){this._filterValue=e.currentTarget.value??""}_elementToMarkdown(e){e!==void 0&&(e.innerHTML=n(this._selectedApiItem.examples))}renderApiCategory(e){let i=g(e.items,"name",this._filterValue);return i.length?s`<calcite-list-item-group .heading=${e.title}>${i.map(t=>s`<calcite-list-item .label=${o(t.completion.detail)} @calciteListItemSelect=${l=>this._emitItemSelected(l,t)} @keydown=${l=>this._emitItemSelected(l,t)}><calcite-action slot=actions-end .text=${this.messages.expand??""} icon=chevron-right icon-flip-rtl scale=s @click=${l=>this._selectItem(l,t)}></calcite-action></calcite-list-item>`)}</calcite-list-item-group>`:null}renderApiItemFlowItem(){let e=this._selectedApiItem;return e?s`<calcite-flow-item heading-level=2 .heading=${this.messages.constantsandfunctions} .beforeBack=${this._unselectItem} closable @calciteFlowItemClose=${this._emitClose} selected>${this.hideDocumentationActions?null:s`<calcite-button width=half slot=footer appearance=outline kind=brand scale=s .href=${e.link} target=Help icon-start=information>${this.messages.moreinformation}</calcite-button>`}<calcite-button .width=${this.hideDocumentationActions?"full":"half"} slot=footer appearance=outline kind=brand icon-start=code scale=s @click=${i=>this._emitItemSelectedAndClose(i,e)} ${a(p)}>${this.messages.insert}</calcite-button><calcite-block expanded .heading=${o(e.completion.detail)}><div .innerHTML=${n(e.completion.documentation)??""}></div>${e.examples?s`<div ${a(this._elementToMarkdown)}></div>`:null}</calcite-block></calcite-flow-item>`:null}render(){if(this.closed)return null;let e=(this.apiLibrary??[]).map(t=>this.renderApiCategory(t)),i=e.every(t=>!t);return s`<calcite-flow ${a(this.flowFocusHandler)}><calcite-flow-item heading-level=2 .heading=${this.messages.constantsandfunctions} closable @calciteFlowItemClose=${this._emitClose} .selected=${!this._selectedApiItem}><calcite-input .value=${this._filterValue} icon=magnifying-glass clearable @calciteInputInput=${this._updateFilterValue} class="sticky" scale=m></calcite-input>${this.loading?s`<calcite-loader scale=s type=indeterminate .label=${this.messages.loading??"Loading"}></calcite-loader>`:s`<calcite-list .label=${this.messages.api??"API"}>${i?s`<div class="notice-container">${this.messages.noitems}</div>`:e}</calcite-list>`}</calcite-flow-item>${this.renderApiItemFlowItem()}</calcite-flow>`}};h("arcgis-language-api-panel",r);export{r as ArcgisLanguageApiPanel};
2
+ import{a as n}from"./6TBGTZVD.js";import{a as g}from"./UN7LGHT2.js";import"./HLDSPJ74.js";import{a as f}from"./SB3MM5EM.js";import"./KCU2C44H.js";import"./GS2ISVXJ.js";import{g as p,h as u}from"./6G5URSC7.js";import{F as a,G as d,K as h,h as m,j as s,n as c,s as o}from"./REL6OK2I.js";import"./Y3KOWWO5.js";import"./3TTFCHAA.js";var b=m`:host{background-color:var(--calcite-color-foreground-1);.notice-container{margin:var(--calcite-spacing-xxs);padding:var(--calcite-spacing-sm);background-color:var(--calcite-color-foreground-1)}.sticky{position:sticky;top:0;z-index:10}calcite-flow{height:100%}calcite-block{p:first-of-type{margin-top:0}}calcite-list-item-group{background-color:var(--calcite-color-foreground-2)}calcite-flow{[slot=footer]{word-break:break-word}}}`,r=class extends d{constructor(){super(...arguments),this.messages=f(),this._unselectItem=async()=>{this._selectedApiItem=void 0},this._filterValue="",this.languageId="arcade",this.hideDocumentationActions=!1,this.loading=!1,this.closed=!1,this.arcgisInternalClosePanel=c({bubbles:!1,composed:!1}),this.arcgisInternalItemSelected=c({bubbles:!1,composed:!1})}static{this.properties={_filterValue:16,_selectedApiItem:16,languageId:1,apiLibrary:0,hideDocumentationActions:5,loading:5,closed:5}}static{this.styles=b}willUpdate(e){if(e.has("apiLibrary")){if(!this._selectedApiItem)return;for(let i of this.apiLibrary??[])for(let t of i.items)if(t.name===this._selectedApiItem.name){this._selectedApiItem=t;return}this._selectedApiItem=void 0}}disconnectedCallback(){super.disconnectedCallback(),this._flowObserver?.disconnect()}flowFocusHandler(e){if(!e){this._flowObserver?.disconnect(),this._flowObserver=void 0;return}this._flowObserver||(this._flowObserver=new MutationObserver(()=>{u(e.querySelector("calcite-flow-item:last-child"),"calcite-input")}),this._flowObserver.observe(e,{attributes:!0,attributeFilter:["id"],childList:!0}))}_emitItemSelected(e,i){if(!i)return;let t=e;(!t.key||t.key==="Enter")&&(e.preventDefault(),this.arcgisInternalItemSelected.emit(i.completion.insertText??""))}_emitClose(){this.arcgisInternalClosePanel.emit()}_emitItemSelectedAndClose(e,i){let t=e;(!t.key||t.key==="Enter")&&(e.preventDefault(),this.arcgisInternalItemSelected.emit(i.completion.insertText??""))}_selectItem(e,i){e.stopPropagation(),this._selectedApiItem=i}_updateFilterValue(e){this._filterValue=e.currentTarget.value??""}_elementToMarkdown(e){e!==void 0&&(e.innerHTML=n(this._selectedApiItem.examples))}renderApiCategory(e){let i=g(e.items,"name",this._filterValue);return i.length?s`<calcite-list-item-group .heading=${e.title}>${i.map(t=>s`<calcite-list-item .label=${o(t.completion.detail)} @calciteListItemSelect=${l=>this._emitItemSelected(l,t)} @keydown=${l=>this._emitItemSelected(l,t)}><calcite-action slot=actions-end .text=${this.messages.expand??""} icon=chevron-right icon-flip-rtl scale=s @click=${l=>this._selectItem(l,t)}></calcite-action></calcite-list-item>`)}</calcite-list-item-group>`:null}renderApiItemFlowItem(){let e=this._selectedApiItem;return e?s`<calcite-flow-item heading-level=2 .heading=${this.messages.constantsandfunctions} .beforeBack=${this._unselectItem} closable @calciteFlowItemClose=${this._emitClose} selected>${this.hideDocumentationActions?null:s`<calcite-button width=half slot=footer appearance=outline kind=brand scale=s .href=${e.link} target=Help icon-start=information>${this.messages.moreinformation}</calcite-button>`}<calcite-button .width=${this.hideDocumentationActions?"full":"half"} slot=footer appearance=outline kind=brand icon-start=code scale=s @click=${i=>this._emitItemSelectedAndClose(i,e)} ${a(p)}>${this.messages.insert}</calcite-button><calcite-block expanded .heading=${o(e.completion.detail)}><div .innerHTML=${n(e.completion.documentation)??""}></div>${e.examples?s`<div ${a(this._elementToMarkdown)}></div>`:null}</calcite-block></calcite-flow-item>`:null}render(){if(this.closed)return null;let e=(this.apiLibrary??[]).map(t=>this.renderApiCategory(t)),i=e.every(t=>!t);return s`<calcite-flow ${a(this.flowFocusHandler)}><calcite-flow-item heading-level=2 .heading=${this.messages.constantsandfunctions} closable @calciteFlowItemClose=${this._emitClose} .selected=${!this._selectedApiItem}><calcite-input .value=${this._filterValue} icon=magnifying-glass clearable @calciteInputInput=${this._updateFilterValue} class="sticky" scale=m></calcite-input>${this.loading?s`<calcite-loader scale=s type=indeterminate .label=${this.messages.loading??"Loading"}></calcite-loader>`:s`<calcite-list .label=${this.messages.api??"API"}>${i?s`<div class="notice-container">${this.messages.noitems}</div>`:e}</calcite-list>`}</calcite-flow-item>${this.renderApiItemFlowItem()}</calcite-flow>`}};h("arcgis-language-api-panel",r);export{r as ArcgisLanguageApiPanel};
@@ -1,5 +1,5 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import b from"./GZ6HZKQZ.js";import a from"./ZHZFKZA7.js";import{b as f,c as p,d as c}from"./G56LJGLK.js";import{a as v,b as T}from"./GS2ISVXJ.js";import{L as m}from"./REL6OK2I.js";export default $arcgis.t(([{getDeclaredPixelMembers:$},{G:w,f:M,g:F,h:P,i:k,j:A,n:b},{k:I,l:L,m:V,o:C,p:D}])=>{async function K(e){let{apiVersion:i,bundles:t,hiddenApiItems:n}=e.toEditorProfileDefinition(),o=await j(e.dictionaryVariables.filter(w));return{apiVersion:i,bundles:t,variables:o,hiddenApiItems:n?.map(s=>s.toLowerCase())}}async function j(e,i=f.Variable){return await Promise.all(e.map(async t=>{switch(t.type){case"dictionary":return await q(t,i);case"pixel":return await O(t,i);case"voxel":case"feature":return await B(t,i);default:return _(t,i)}}))}function _(e,i){let{name:t,type:n}=e,o=e.getDescription(),s=i===f.Field?I(t,!1):t;return{name:t,description:o,type:n,completion:{label:t,detail:t,insertText:s,insertTextMode:c.asIs,insertTextFormat:p.PlainText,kind:i,documentation:{kind:"markdown",value:o}}}}async function B(e,i){let t=await e.loadSource(),{name:n}=e,o=e.getDescription(),s={label:n,detail:n,insertText:n,insertTextMode:c.asIs,insertTextFormat:p.PlainText,kind:i},a={name:n,description:o,type:"dictionary",properties:[],completion:s};if(!t)return a;let[r,l]=L(t.fields,o,!0);return a.properties=r,s.documentation={kind:"markdown",value:l},a}async function O(e,i){let t=await e.loadSource(),n=e.toProfileVariableDefinition();if(n.type!=="pixel")throw new Error("Incorrect definition passed to pixel variable");let{name:o}=e,s=e.getDescription(),a={label:o,detail:o,insertText:o,insertTextMode:c.asIs,insertTextFormat:p.PlainText,kind:i},r={name:o,description:s,type:"dictionary",properties:[],completion:a};if(!t||!n.definition)return r;let l=await $(t),[d,u]=V(l,s);return r.properties=d,a.documentation={kind:"markdown",value:u},r}async function q(e,i){let{name:t,dictionaryVariables:n}=e,o=e.getDescription(),s=n.reduce((a,r)=>{a!==""&&(a+=`
2
+ import b from"./AZR47E7L.js";import a from"./ZHZFKZA7.js";import{b as f,c as p,d as c}from"./HLDSPJ74.js";import{a as v,b as T}from"./GS2ISVXJ.js";import{L as m}from"./REL6OK2I.js";export default $arcgis.t(([{getDeclaredPixelMembers:$},{G:w,f:M,g:F,h:P,i:k,j:A,n:b},{k:I,l:L,m:V,o:C,p:D}])=>{async function K(e){let{apiVersion:i,bundles:t,hiddenApiItems:n}=e.toEditorProfileDefinition(),o=await j(e.dictionaryVariables.filter(w));return{apiVersion:i,bundles:t,variables:o,hiddenApiItems:n?.map(s=>s.toLowerCase())}}async function j(e,i=f.Variable){return await Promise.all(e.map(async t=>{switch(t.type){case"dictionary":return await q(t,i);case"pixel":return await O(t,i);case"voxel":case"feature":return await B(t,i);default:return _(t,i)}}))}function _(e,i){let{name:t,type:n}=e,o=e.getDescription(),s=i===f.Field?I(t,!1):t;return{name:t,description:o,type:n,completion:{label:t,detail:t,insertText:s,insertTextMode:c.asIs,insertTextFormat:p.PlainText,kind:i,documentation:{kind:"markdown",value:o}}}}async function B(e,i){let t=await e.loadSource(),{name:n}=e,o=e.getDescription(),s={label:n,detail:n,insertText:n,insertTextMode:c.asIs,insertTextFormat:p.PlainText,kind:i},a={name:n,description:o,type:"dictionary",properties:[],completion:s};if(!t)return a;let[r,l]=L(t.fields,o,!0);return a.properties=r,s.documentation={kind:"markdown",value:l},a}async function O(e,i){let t=await e.loadSource(),n=e.toProfileVariableDefinition();if(n.type!=="pixel")throw new Error("Incorrect definition passed to pixel variable");let{name:o}=e,s=e.getDescription(),a={label:o,detail:o,insertText:o,insertTextMode:c.asIs,insertTextFormat:p.PlainText,kind:i},r={name:o,description:s,type:"dictionary",properties:[],completion:a};if(!t||!n.definition)return r;let l=await $(t),[d,u]=V(l,s);return r.properties=d,a.documentation={kind:"markdown",value:u},r}async function q(e,i){let{name:t,dictionaryVariables:n}=e,o=e.getDescription(),s=n.reduce((a,r)=>{a!==""&&(a+=`
3
3
 
4
4
  `),a+=`**${r.name}**
5
5
  ${r.type}`;let l=r.getDescription();return l&&(a+=`
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
+ import{a,b,c,d,e,f}from"./HUJVXIUS.js";import"./HLDSPJ74.js";import"./ER2MKLVA.js";import"./MP6Z45SA.js";import"./6C52UOYL.js";import"./Y3KOWWO5.js";import"./B3UMUBOI.js";import"./CF3TERM3.js";import"./Z5ZZ36DQ.js";import"./LLPQEURF.js";import"./3TTFCHAA.js";export{b as arcadeAskAiCommandId,a as arcadeQuickFixKind,e as getArcadeDiagnosticService,d as getArcadeWorker,c as setArcadeAskAiBinding,f as setupMode};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import a from"./YJW6NUWX.js";import{a as h}from"./ER2MKLVA.js";import{a as I}from"./MP6Z45SA.js";import{b as l}from"./Y3KOWWO5.js";import{Qk as T,al as u}from"./LLPQEURF.js";export default $arcgis.t(([{a:g,b:f}])=>{var m=Promise.withResolvers(),p=class{constructor(e){this._defaults=e,this._worker=null,this._client=null,this._configChangeListener=this._defaults.onDidChange(()=>this.stopWorker())}dispose(){this._configChangeListener.dispose(),this.stopWorker()}stopWorker(){this._worker&&(this._worker.dispose(),this._worker=null,m=Promise.withResolvers()),this._client=null}static async waitForWorker(){return await m.promise}async _getClientProxy(){let e=await h();if(!this._client){let{languageId:t}=this._defaults,o=window.MonacoEnvironment?.getWorker;if(!o)throw new Error("MonacoEnvironment.getWorker is not configured. Call setupMonacoEnvironment(...) before creating SQL Expression workers.");this._worker=e.createWebWorker({worker:o("SqlExprWorker",t),host:this._defaults.workerHost}),m.resolve(this._worker),this._client=this._worker.getProxy()}return await this._client}async getLanguageServiceWorker(...e){let t=await this._getClientProxy();return await this._worker?.withSyncedResources(e),t}},L=["AND","AS","BOTH","CASE","CAST","CURRENT_DATE","CURRENT_TIME","CURRENT_TIMESTAMP","DATE","DAY","DOY","DOW","ELSE","END","ESCAPE","FALSE","FLOAT","FOR","FROM","HOUR","IN","INT","INTEGER","INTERVAL","LEADING","LIKE","MINUTE","MONTH","POSITION","REAL","SECOND","SMALLINT","THEN","TIME","TIMESTAMP","TIMEZONE_HOUR","TIMEZONE_MINUTE","TO","TRAILING","TRIM","TRUE","VARCHAR","WEEK","WHEN","WITH","YEAR","ZONE"],M=["AND","BETWEEN","LIKE","NOT","OR","IS","NULL"],b=["CAST","EXTRACT","CURRENT_DATE","CURRENT_TIME","CURRENT_TIMESTAMP","CURRENT_USER","ABS","ACOS","ASIN","ATAN","CEILING","COS","FLOOR","LOG","LOG10","MOD","NULLIF","POWER","ROUND","SIGN","SIN","TAN","TRUNCATE","CHAR_LENGTH","COALESCE","CONCAT","LOWER","POSITION","SUBSTRING","TRIM","UPPER"],O={comments:{lineComment:"--",blockComment:["/*","*/"]},brackets:[["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}]},D={defaultToken:"",tokenPostfix:".arcgis",ignoreCase:!0,brackets:[{open:"[",close:"]",token:"delimiter.square"},{open:"(",close:")",token:"delimiter.parenthesis"}],keywords:L,operators:M,builtinFunctions:b,builtinVariables:[],tokenizer:{root:[{include:"@comments"},{include:"@whitespace"},{include:"@numbers"},{include:"@strings"},{include:"@complexIdentifiers"},{include:"@scopes"},[/[;,.]/,"delimiter"],[/[()]/,"@brackets"],[/[\w@#$]+/,{cases:{"@operators":"operator","@builtinVariables":"predefined","@builtinFunctions":"predefined","@keywords":"keyword","@default":"identifier"}}],[/[<>=!%&+\-*/|~^]/,"operator"]],whitespace:[[/\s+/,"white"]],comments:[[/--+.*/,"comment"],[/\/\*/,{token:"comment.quote",next:"@comment"}]],comment:[[/[^*/]+/,"comment"],[/\*\//,{token:"comment.quote",next:"@pop"}],[/./,"comment"]],numbers:[[/0[xX][0-9a-fA-F]*/,"number"],[/[$][+-]*\d*(\.\d*)?/,"number"],[/((\d+(\.\d*)?)|(\.\d+))([eE][\-+]?\d+)?/,"number"]],strings:[[/N'/,{token:"string",next:"@string"}],[/'/,{token:"string",next:"@string"}]],string:[[/[^']+/,"string"],[/''/,"string"],[/'/,{token:"string",next:"@pop"}]],complexIdentifiers:[[/"/,{token:"identifier.quote",next:"@quotedIdentifier"}]],quotedIdentifier:[[/[^"]+/,"identifier"],[/""/,"identifier"],[/"/,{token:"identifier.quote",next:"@pop"}]],scopes:[[/(BEGIN|CASE)\b/i,{token:"keyword.block"}],[/END\b/i,{token:"keyword.block"}],[/WHEN\b/i,{token:"keyword.choice"}],[/THEN\b/i,{token:"keyword.choice"}]]}},_=class{constructor(e,t){this._worker=e,this._defaults=t}async provideCompletionItems(e,t){try{let o=await this._worker(e.uri),r=e.getWordUntilPosition(t),n={startLineNumber:t.lineNumber,endLineNumber:t.lineNumber,startColumn:r.startColumn,endColumn:r.endColumn},c=this._defaults.getApiContextForModel(e.uri);return await o.doComplete(e.uri.toString(),n,t,c)}catch(o){return l("SqlExprCompletionProvider")(o),{suggestions:[]}}}},k=class{constructor(e,t,{defaults:o,diagnosticService:r}){this._languageId=e,this._worker=t,this._disposables=[],this._modelListeners=new Map,this._diagnosticsService=r,this._defaults=o,h().then(n=>{let c=i=>{let s=i.getLanguageId();if(s!==this._languageId)return;let d=I(()=>{this._doValidate(i,s).catch(R=>{throw R})}),S=i.onDidChangeContent(d),A=i.onDidChangeAttached(d);this._modelListeners.set(i.uri.toString(),[S,A]),this._doValidate(i,s).catch(l("SqlExprDiagnosticsAdapter"))},E=i=>{let s=i.uri.toString();n.setModelMarkers(i,this._languageId,[]);let d=this._modelListeners.get(s);if(d){for(;d.length;)d.pop()?.dispose();this._modelListeners.delete(s)}};this._disposables.push(n.onDidCreateModel(c)),this._disposables.push(n.onWillDisposeModel(i=>E(i))),this._disposables.push(n.onDidChangeModelLanguage(i=>{E(i.model),c(i.model)})),this._disposables.push(o.onDidChange(()=>{n.getModels().forEach(i=>{i.getLanguageId()===this._languageId&&(E(i),c(i))})})),this._disposables.push(o.onModelContextDidChange(i=>{n.getModels().forEach(s=>{s.getLanguageId()===this._languageId&&s.uri.toString()===i&&this._doValidate(s,this._languageId).catch(l("SqlExprDiagnosticsAdapter"))})})),this._disposables.push({dispose:()=>{this._modelListeners.forEach(i=>i.forEach(s=>s.dispose())),this._modelListeners.clear()}}),n.getModels().forEach(c)})}async _doValidate(e,t){let o=await h();if(e.isAttachedToEditor())try{let r=await this._worker(e.uri),n=this._defaults.getApiContextForModel(e.uri),c=await r.doValidation(e.uri.toString(),n);this._diagnosticsService.fireDiagnosticsChange(e.uri,c),o.setModelMarkers(e,t,c)}catch(r){l("SqlExprDiagnosticsAdapter")(r)}}},w;async function Z(...a){return await p.waitForWorker(),await new Promise((e,t)=>{if(!w){t(new Error("sql expression worker not registered!"));return}e(w(...a))})}var C=class{constructor(){this._onDiagnosticsChange=new T}get onDiagnosticsChange(){return this._onDiagnosticsChange.event}fireDiagnosticsChange(e,t){this._onDiagnosticsChange.fire({uri:e,diagnostics:t})}},N=new C;async function K(){return await f(),N}function X(a){let e=new p(a),t=async(...r)=>await e.getLanguageServiceWorker(...r);w=t,u.setMonarchTokensProvider(g.languageId,D),u.setLanguageConfiguration(g.languageId,O);let o=new _(t,g);u.registerCompletionItemProvider(g.languageId,o),new k(a.languageId,t,{defaults:a,diagnosticService:N})}return{a:Z,b:K,c:X}},a)
2
+ import a from"./2CBDII2T.js";import{a as h}from"./ER2MKLVA.js";import{a as I}from"./MP6Z45SA.js";import{b as l}from"./Y3KOWWO5.js";import{Qk as T,al as u}from"./LLPQEURF.js";export default $arcgis.t(([{a:g,b:f}])=>{var m=Promise.withResolvers(),p=class{constructor(e){this._defaults=e,this._worker=null,this._client=null,this._configChangeListener=this._defaults.onDidChange(()=>this.stopWorker())}dispose(){this._configChangeListener.dispose(),this.stopWorker()}stopWorker(){this._worker&&(this._worker.dispose(),this._worker=null,m=Promise.withResolvers()),this._client=null}static async waitForWorker(){return await m.promise}async _getClientProxy(){let e=await h();if(!this._client){let{languageId:t}=this._defaults,o=window.MonacoEnvironment?.getWorker;if(!o)throw new Error("MonacoEnvironment.getWorker is not configured. Call setupMonacoEnvironment(...) before creating SQL Expression workers.");this._worker=e.createWebWorker({worker:o("SqlExprWorker",t),host:this._defaults.workerHost}),m.resolve(this._worker),this._client=this._worker.getProxy()}return await this._client}async getLanguageServiceWorker(...e){let t=await this._getClientProxy();return await this._worker?.withSyncedResources(e),t}},L=["AND","AS","BOTH","CASE","CAST","CURRENT_DATE","CURRENT_TIME","CURRENT_TIMESTAMP","DATE","DAY","DOY","DOW","ELSE","END","ESCAPE","FALSE","FLOAT","FOR","FROM","HOUR","IN","INT","INTEGER","INTERVAL","LEADING","LIKE","MINUTE","MONTH","POSITION","REAL","SECOND","SMALLINT","THEN","TIME","TIMESTAMP","TIMEZONE_HOUR","TIMEZONE_MINUTE","TO","TRAILING","TRIM","TRUE","VARCHAR","WEEK","WHEN","WITH","YEAR","ZONE"],M=["AND","BETWEEN","LIKE","NOT","OR","IS","NULL"],b=["CAST","EXTRACT","CURRENT_DATE","CURRENT_TIME","CURRENT_TIMESTAMP","CURRENT_USER","ABS","ACOS","ASIN","ATAN","CEILING","COS","FLOOR","LOG","LOG10","MOD","NULLIF","POWER","ROUND","SIGN","SIN","TAN","TRUNCATE","CHAR_LENGTH","COALESCE","CONCAT","LOWER","POSITION","SUBSTRING","TRIM","UPPER"],O={comments:{lineComment:"--",blockComment:["/*","*/"]},brackets:[["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}]},D={defaultToken:"",tokenPostfix:".arcgis",ignoreCase:!0,brackets:[{open:"[",close:"]",token:"delimiter.square"},{open:"(",close:")",token:"delimiter.parenthesis"}],keywords:L,operators:M,builtinFunctions:b,builtinVariables:[],tokenizer:{root:[{include:"@comments"},{include:"@whitespace"},{include:"@numbers"},{include:"@strings"},{include:"@complexIdentifiers"},{include:"@scopes"},[/[;,.]/,"delimiter"],[/[()]/,"@brackets"],[/[\w@#$]+/,{cases:{"@operators":"operator","@builtinVariables":"predefined","@builtinFunctions":"predefined","@keywords":"keyword","@default":"identifier"}}],[/[<>=!%&+\-*/|~^]/,"operator"]],whitespace:[[/\s+/,"white"]],comments:[[/--+.*/,"comment"],[/\/\*/,{token:"comment.quote",next:"@comment"}]],comment:[[/[^*/]+/,"comment"],[/\*\//,{token:"comment.quote",next:"@pop"}],[/./,"comment"]],numbers:[[/0[xX][0-9a-fA-F]*/,"number"],[/[$][+-]*\d*(\.\d*)?/,"number"],[/((\d+(\.\d*)?)|(\.\d+))([eE][\-+]?\d+)?/,"number"]],strings:[[/N'/,{token:"string",next:"@string"}],[/'/,{token:"string",next:"@string"}]],string:[[/[^']+/,"string"],[/''/,"string"],[/'/,{token:"string",next:"@pop"}]],complexIdentifiers:[[/"/,{token:"identifier.quote",next:"@quotedIdentifier"}]],quotedIdentifier:[[/[^"]+/,"identifier"],[/""/,"identifier"],[/"/,{token:"identifier.quote",next:"@pop"}]],scopes:[[/(BEGIN|CASE)\b/i,{token:"keyword.block"}],[/END\b/i,{token:"keyword.block"}],[/WHEN\b/i,{token:"keyword.choice"}],[/THEN\b/i,{token:"keyword.choice"}]]}},_=class{constructor(e,t){this._worker=e,this._defaults=t}async provideCompletionItems(e,t){try{let o=await this._worker(e.uri),r=e.getWordUntilPosition(t),n={startLineNumber:t.lineNumber,endLineNumber:t.lineNumber,startColumn:r.startColumn,endColumn:r.endColumn},c=this._defaults.getApiContextForModel(e.uri);return await o.doComplete(e.uri.toString(),n,t,c)}catch(o){return l("SqlExprCompletionProvider")(o),{suggestions:[]}}}},k=class{constructor(e,t,{defaults:o,diagnosticService:r}){this._languageId=e,this._worker=t,this._disposables=[],this._modelListeners=new Map,this._diagnosticsService=r,this._defaults=o,h().then(n=>{let c=i=>{let s=i.getLanguageId();if(s!==this._languageId)return;let d=I(()=>{this._doValidate(i,s).catch(R=>{throw R})}),S=i.onDidChangeContent(d),A=i.onDidChangeAttached(d);this._modelListeners.set(i.uri.toString(),[S,A]),this._doValidate(i,s).catch(l("SqlExprDiagnosticsAdapter"))},E=i=>{let s=i.uri.toString();n.setModelMarkers(i,this._languageId,[]);let d=this._modelListeners.get(s);if(d){for(;d.length;)d.pop()?.dispose();this._modelListeners.delete(s)}};this._disposables.push(n.onDidCreateModel(c)),this._disposables.push(n.onWillDisposeModel(i=>E(i))),this._disposables.push(n.onDidChangeModelLanguage(i=>{E(i.model),c(i.model)})),this._disposables.push(o.onDidChange(()=>{n.getModels().forEach(i=>{i.getLanguageId()===this._languageId&&(E(i),c(i))})})),this._disposables.push(o.onModelContextDidChange(i=>{n.getModels().forEach(s=>{s.getLanguageId()===this._languageId&&s.uri.toString()===i&&this._doValidate(s,this._languageId).catch(l("SqlExprDiagnosticsAdapter"))})})),this._disposables.push({dispose:()=>{this._modelListeners.forEach(i=>i.forEach(s=>s.dispose())),this._modelListeners.clear()}}),n.getModels().forEach(c)})}async _doValidate(e,t){let o=await h();if(e.isAttachedToEditor())try{let r=await this._worker(e.uri),n=this._defaults.getApiContextForModel(e.uri),c=await r.doValidation(e.uri.toString(),n);this._diagnosticsService.fireDiagnosticsChange(e.uri,c),o.setModelMarkers(e,t,c)}catch(r){l("SqlExprDiagnosticsAdapter")(r)}}},w;async function Z(...a){return await p.waitForWorker(),await new Promise((e,t)=>{if(!w){t(new Error("sql expression worker not registered!"));return}e(w(...a))})}var C=class{constructor(){this._onDiagnosticsChange=new T}get onDiagnosticsChange(){return this._onDiagnosticsChange.event}fireDiagnosticsChange(e,t){this._onDiagnosticsChange.fire({uri:e,diagnostics:t})}},N=new C;async function K(){return await f(),N}function X(a){let e=new p(a),t=async(...r)=>await e.getLanguageServiceWorker(...r);w=t,u.setMonarchTokensProvider(g.languageId,D),u.setLanguageConfiguration(g.languageId,O);let o=new _(t,g);u.registerCompletionItemProvider(g.languageId,o),new k(a.languageId,t,{defaults:a,diagnosticService:N})}return{a:Z,b:K,c:X}},a)
@@ -18,7 +18,7 @@ var et;(function(i){function e(t){return typeof t=="string"}i.is=e})(et||(et={})
18
18
  `]:[`
19
19
  `]}nextPos(e,t=!1){let n=Math.max(e.line,0);return Math.max(e.column,0)<this.getLineLength(n)?(e.column+=1,t?!!this.skipSpaces(e):!0):n<this.length?(e.line+=1,e.column=0,t?!!this.skipSpaces(e):!0):!1}prevPos(e,t=!1){let n=e.line,r=e.column;if(r<1){if(n-=1,n<1)return!1;r=this.getLineLength(n)}else r=Math.min(r-1,this.getLineLength(n));return e.line=n,e.column=r,t?!!this.skipSpaces(e,!0):!0}firstPos(){return{line:1,column:0}}lastPos(){return{line:this.length,column:this.getLineLength(this.length)}}skipSpaces(e,t=!1){if(t){for(;this.prevPos(e);)if(!ie(this.charAt(e))&&this.nextPos(e))return e;return null}else{for(;ie(this.charAt(e));)if(!this.nextPos(e))return null;return e}}slice(e,t){if(!t&&!e)return this;if(t??=this.lastPos(),!e)throw new Error("cannot slice with end but not start");let n=this.lineRecords.slice(e.line-1,t.line);return e.line===t.line?n[0]=V(n[0],e.column,t.column):(n[0]=V(n[0],e.column),n.push(V(n.pop()??n[0],0,t.column))),new i(n)}sliceString(e=this.firstPos(),t=this.lastPos()){let n=[];for(let r=e.line;r<=t.line;r++){let s=this.lineRecords[r-1];r===e.line?r===t.line?s=V(s,e.column,t.column):s=V(s,e.column):r===t.line&&(s=V(s,0,t.column));let u="",c=Math.max(s.indentation,0);c>0&&(u+=new Array(c+1).join(" ")),u+=s.line.slice(s.sliceStart,s.sliceEnd),n.push(u)}return n.join(`
20
20
  `)}};function Oi(i,e=2){let t=0,n=i.length;for(let r=0;r<n;r++)switch(i.charCodeAt(r)){case 9:{let s=Math.ceil(t/e)*e;s===t?t+=e:t=s;break}case 11:case 12:case 13:case 65279:break;default:t+=1;break}return t}function V(i,e,t){let n=i.sliceStart,r=i.sliceEnd,s=Math.max(i.indentation,0),u=s+r-n;return t??=u,e=Math.max(e,0),t=Math.min(t,u),t=Math.max(t,e),t<s?(s=t,r=n):r-=u-t,e<s?s-=e:(e-=s,s=0,n+=e),i.indentation===s&&i.sliceStart===n&&i.sliceEnd===r?i:{line:i.line,indentation:s,sliceStart:n,sliceEnd:r}}function ci(i,e,t){return!i&&!t?"":i?t?`${i}${e}${t}`:i:t}var zi=/\u000D\u000A|\u000D(?!\u000A)|\u000A|\u2028|\u2029/u,p=class i{constructor(e=[]){this.lines=e}static fromString(e){return new i(e.split(zi))}static appendLines(e=[]){let t=new i;return e.forEach(n=>{n!=null&&(typeof n=="string"?t.lines.push(n):t.lines.push(...n.lines))}),t}static joinLines(e=[],t=""){let n=new i;return e.forEach(r=>{if(r==null)return;let s=n.lines.pop()??"";typeof r=="string"?n.lines.push(ci(s,t,r)):(n.lines.push(ci(s,t,r.lines.slice(0)[0])),n.lines.push(...r.lines.slice(1)))}),n}static aggregateLines(e,t,n,r,s){if(n.isEmpty)return e;if(!t||e.isEmpty)return n.indentFirstLine(s);let u=r.start.line-t.end.line;if(u===0)return i.joinLines([e," ",n]);let c=u===1?void 0:"";return i.appendLines([e,c,n.indentFirstLine(s)])}get isEmpty(){return this.lines.length===0||this.lines.length===1&&this.lines[0].length===0}get maxLineLength(){return this.lines.reduce((e,t)=>Math.max(e,t.length),0)}get firstLineLength(){return(this.lines[0]??"").length}get lastLineLength(){return(this.lines[this.lines.length-1]??"").length}surroundWith(e="",t=""){return!e&&!t?this:this.isEmpty?new i([e+t]):this.lines.length===1?new i([e+this.lines[0]+t]):i.joinLines([e,this,t])}indentFirstLine(e=""){return this.isEmpty?this:(this.lines[0]=e+this.lines[0],this)}suffixWith(e){return this.surroundWith("",e)}toString(e=`
21
- `){return this.lines.join(e)}};function Ze(i,e){return i*(e.indentWidth??2)}function M(i=0,e){let{indentWidth:t=2}=Ye(e);return new Array(i*t+1).join(" ")}function ne(i){return i.replace(/['"]/gu,e=>e==='"'?"'":'"')}function Vi(i,e){switch(i.type){case a.UnaryExpression:return(ti(e)||Ii(e))&&e.object===i;case a.BinaryExpression:case a.LogicalExpression:switch(e.type){case a.UnaryExpression:return!0;case a.MemberExpression:case a.SafeMemberExpression:return e.object===i;case a.BinaryExpression:case a.LogicalExpression:return re[e.operator]>re[i.operator];default:return!1}case a.Literal:return ti(e)&&typeof i.value=="number"&&e.object===i;case a.AssignmentExpression:switch(e.type){case a.UnaryExpression:case a.BinaryExpression:case a.LogicalExpression:case a.ReturnStatement:return!0;case a.MemberExpression:case a.SafeMemberExpression:return e.object===i;default:return!1}case a.MemberAccessChainExpression:switch(e.type){case a.MemberExpression:case a.SafeMemberExpression:return e.object===i;default:return!1}default:return!1}}function C(i,e,t){switch(i?.type){case a.BinaryExpression:case a.LogicalExpression:return $i(i,e,t);case a.AssignmentExpression:return new X(i,e,t);case a.MemberExpression:case a.SafeMemberExpression:return new $e(i,e,t);case a.Identifier:return new G(i,e,t);case a.CallExpression:return new Ve(i,e,t);case a.ObjectExpression:return U(i,e,t);case a.ArrayExpression:return U(i,e,t);case a.Literal:return new G(i,e,t);case a.UpdateExpression:case a.UnaryExpression:case a.MemberAccessChainExpression:return new oe(i,e,t);case a.TemplateLiteral:return new We(i,e,t);case a.VariableDeclaration:return new K(i,e,t);default:throw new Error(`unknown type: ${JSON.stringify(i)}`)}}function U(i,e,t){let n=new R(i,e,t);switch(i.type){case a.ArrayExpression:return n.setupCollection(i.elements.map(r=>C(r,i,t)),"SquareBrackets"),n;case a.ObjectExpression:return n.setupCollection(i.properties.map(r=>new Re(r,i,t)),"CurlyBrackets"),n;case a.VariableDeclaration:return n.prefix="var ",n.setupCollection(i.declarations.map(r=>gi(r,i,t)),"None"),n;case a.FunctionDeclaration:return n.prefix=`function ${i.id.name}`,n.setupCollection(i.params.map(r=>C(r,i,t)),"Parentheses"),n;case a.ForStatement:return n.prefix="for ",n.setupCollection([C(i.init,i,t),C(i.test,i,t),C(i.update,i,t)],"Parentheses",";"),n;case a.ForInStatement:case a.ForOfStatement:return n.prefix="for ",n.setupCollection([new X(i,e,t)],"Parentheses",""),n;case a.IfStatement:return n.prefix="if ",n.setupCollection([C(i.test,i,t)],"Parentheses",""),n;case a.WhileStatement:return n.prefix="while ",n.setupCollection([C(i.test,i,t)],"Parentheses",""),n;default:return n}}function gi(i,e,t){return i.init?new X(i,e,t):new G(i.id,e,t)}function $i(i,e,t){let n=[...ae(i.left,i.operator),...ae(i.right,i.operator)].map(s=>C(s,i,t)),r=new R(i,e,t);return r.setupCollection(n,"None",` ${i.operator}`),r}function ae(i,e){return i.type!==a.BinaryExpression&&i.type!==a.LogicalExpression?[i]:i.operator!==e?[i]:[...ae(i.left,e),...ae(i.right,e)]}var v=class{constructor(e,t,n){this.node=e,this.parent=t,this.options=n,this.prefix="",this.suffix="",this.groupingParentheses=!1,this.groupingParentheses=Vi(e,t)}get openingParenthesis(){return this.groupingParentheses?"(":""}get closingParenthesis(){return this.groupingParentheses?")":""}get leadingString(){return[this.prefix,this.openingParenthesis].join("")}get trailingString(){return[this.closingParenthesis,this.suffix].join("")}finalize(e){return typeof e=="string"&&(e=p.fromString(e)),e.surroundWith(this.leadingString,this.trailingString)}},R=class extends v{constructor(e,t,n){super(e,t,n),this.node=e,this.parent=t,this.options=n,this.type="CollectionPrinter",this.bracketsType="None",this.separator=",",this.printers=[]}setupCollection(e=[],t="None",n){return this.bracketsType=t,this.separator=n??this.separator,this.printers=e,this}getOpeningBracket(e=!1,t="singleLine"){if(this.bracketsType==="None")return"";if(this.bracketsType==="CurlyBrackets")return`{${e||t==="multiline"?"":" "}`;switch(this.bracketsType){case"Parentheses":return"(";case"SquareBrackets":return"[";default:return""}}getClosingBracket(e=!1,t="singleLine"){if(this.bracketsType==="None")return"";if(this.bracketsType==="CurlyBrackets")return`${e||t==="multiline"?"":" "}}`;switch(this.bracketsType){case"Parentheses":return")";case"SquareBrackets":return"]";default:return""}}getLinesLevel(e=0){return this.bracketsType!=="None"||wi(this.parent)||mi(this.parent)||(Ne(this.node)||Pe(this.node))&&(Ne(this.parent)||Pe(this.parent))?e+1:e}finalize(e,t="singleLine",n=0){if(this.bracketsType==="None")return super.finalize(e);let r=this.getOpeningBracket(e.isEmpty,t),s=this.getClosingBracket(e.isEmpty,t);if(t==="singleLine")return super.finalize(e.surroundWith(r,s));let u=M(n,this.options);return super.finalize(p.appendLines([r,e,u+s]))}singleLineFormat(e=0){let t=this.printers.length-1;return p.joinLines(this.printers.map((n,r)=>n.format("singleLine",e).suffixWith(r<t?this.separator:""))," ")}optimizedPrinterFormat(e,t,n=0){let r=this.getLinesLevel(n),s=M(r,this.options),u=this.bracketsType==="None"&&t===0?"":s,c=t<this.printers.length-1?this.separator:"",l=e.format("singleLine",r).suffixWith(c);return l.maxLineLength+s.length<=this.options.wrapColumn?l.indentFirstLine(u):e.format("multiline",r).suffixWith(c).indentFirstLine(u)}multilineFormat(e=0){return p.appendLines(this.printers.map((t,n)=>this.optimizedPrinterFormat(t,n,e)))}format(e="singleLine",t=0){if(this.printers.length===0){let r=this.getOpeningBracket(!0,e),s=this.getClosingBracket(!0,e);return super.finalize(p.fromString(r+s))}if(e==="singleLine"){let r=this.singleLineFormat(t);return this.finalize(r,e,t)}let n=this.multilineFormat(t);return this.finalize(n,e,t)}},Ri=/^[a-zA-Z_$][a-zA-Z_$0-9]*$/u,G=class extends v{constructor(e,t,n){super(e,t,n),this.node=e,this.parent=t,this.options=n,this.type="StringPrinter"}format(){if(Qe(this.node))return this.finalize(this.node.name);if(typeof this.node.value!="string")return this.finalize(this.node.raw);if(Si(this.parent)&&this.parent.key===this.node&&fi(this.node)&&typeof this.node.value=="string"&&Ri.test(this.node.value))return this.finalize(this.node.value);switch(this.options.quote){case"auto":{let e=JSON.stringify(this.node.value),t=ne(JSON.stringify(ne(this.node.value)));return this.finalize(e.length>t.length?t:e)}case"single":return this.finalize(ne(JSON.stringify(ne(this.node.value))));default:return this.finalize(JSON.stringify(this.node.value))}}},oe=class extends v{constructor(e,t,n){super(e,t,n),this.node=e,this.parent=t,this.options=n,this.type="SingleExpressionPrinter";let r=vi(e),s=Li(e);if(r||s){this.prefix=r?e.operator:"",this.suffix=s&&!e.prefix?e.operator:"",this.printer=C(e.argument,e,this.options);return}if(ki(e)){this.printer=C(e.expression,e,this.options);return}this.printer=C(e,t,this.options)}format(e="singleLine",t=0){return this.finalize(this.printer.format(e,t))}},K=class extends v{constructor(e,t,n){super(e,t,n),this.node=e,this.parent=t,this.options=n,this.type="VariableDeclaratorsPrinter",e.declarations.length===1?(this.printer=gi(e.declarations[0],e,this.options),this.printer.prefix="var "):this.printer=U(e,t,this.options)}format(e="singleLine",t=0){return this.finalize(this.printer.format(e,t))}},Ve=class extends v{constructor(e,t,n){super(e,t,n),this.node=e,this.parent=t,this.options=n,this.type="CallExpressionPrinter",this.argumentsPrinter=new R(e,t,n),this.argumentsPrinter.setupCollection(e.arguments.map(r=>C(r,e,n)),"Parentheses"),Qe(e.callee)?this.argumentsPrinter.prefix=e.callee.name:this.calleePrinter=C(e.callee,t,n)}format(e="singleLine",t=0){if(!this.calleePrinter)return this.finalize(this.argumentsPrinter.format(e,t));let n=this.calleePrinter.format("singleLine",t),r=this.argumentsPrinter.format("singleLine",t);if(e==="singleLine")return this.finalize(p.joinLines([n,r]));let s=Ze(t,this.options)+this.leadingString.length+n.firstLineLength;return s+1<this.options.wrapColumn?(r=this.argumentsPrinter.format("multiline",t),this.finalize(p.joinLines([n,r]))):(n=this.calleePrinter.format("multiline",t),s=n.lastLineLength,s+r.maxLineLength>this.options.wrapColumn&&(r=this.argumentsPrinter.format("multiline",t+1)),this.finalize(p.joinLines([n,r])))}},$e=class extends v{constructor(e,t,n){if(super(e,t,n),this.node=e,this.parent=t,this.options=n,this.type="MemberExpressionPrinter",this.objectPrinter=C(e.object,e,this.options),e.computed){let r=new R(e.property,e,this.options);r.setupCollection([C(e.property,e,this.options)],"SquareBrackets"),r.prefix=e.type==="SafeMemberExpression"?N:"",this.propertyPrinter=r}else{let r=new oe(e.property,e,this.options);r.prefix=e.type==="SafeMemberExpression"?N:".",this.propertyPrinter=r}}format(e="singleLine",t=0){let n=this.objectPrinter.format("singleLine",t),r=this.propertyPrinter.format("singleLine",t);if(e==="singleLine")return this.finalize(p.joinLines([n,r]));let s=Ze(t,this.options)+this.leadingString.length+n.firstLineLength;s>this.options.wrapColumn&&(n=this.objectPrinter.format("multiline",t),s=n.lastLineLength);let u=r.firstLineLength+this.trailingString.length;if(s+u<this.options.wrapColumn)return this.finalize(p.joinLines([n,r]));if(this.node.computed)return this.finalize(p.joinLines([n,this.propertyPrinter.format("multiline",t)]));let c=t+1,l=M(c,this.options);return r=this.propertyPrinter.format("singleLine",t),u=l.length+r.lastLineLength+this.trailingString.length,u>this.options.wrapColumn&&(r=this.propertyPrinter.format("multiline",c)),this.finalize(p.appendLines([n,r.indentFirstLine(l)]))}},Re=class extends v{constructor(e,t,n){super(e,t,n),this.node=e,this.parent=t,this.options=n,this.type="PropertyPrinter",this.key=C(e.key,e,this.options),e.shorthand||(this.key.suffix=":",this.value=C(e.value,e,this.options))}format(e="singleLine",t=0){if(this.node.shorthand||!this.value)return this.finalize(this.key.format(e,t));let n=this.key.format("singleLine",t);if(e==="singleLine"){let u=this.value.format("singleLine",t);return this.finalize(p.joinLines([n,u]," "))}if(se(this.node.value)||se(this.node.value)){let u=this.value.format("multiline",t);return this.finalize(p.joinLines([n,u]," "))}let r=M(t+1,this.options),s=this.value.format("singleLine",t+1).indentFirstLine(r);return s.maxLineLength+this.trailingString.length+1<=this.options.wrapColumn?this.finalize(p.appendLines([n,s])):(s=this.value.format("multiline",t+1).indentFirstLine(r),this.finalize(p.appendLines([n,s])))}},X=class extends v{constructor(e,t,n){switch(super(e,t,n),this.node=e,this.parent=t,this.options=n,this.type="OperationPrinter",this.operator="",this.noNewLineWrapping=!1,e.type){case a.AssignmentExpression:this.leftPrinter=C(e.left,e,this.options),this.operator=` ${e.operator}`,this.rightPrinter=C(e.right,e,this.options),this.noNewLineWrapping=(Qe(e.left)||fi(e.left))&&(se(e.right)||ei(e.right));return;case a.VariableDeclarator:this.leftPrinter=C(e.id,e,this.options),e.init&&(this.operator=" =",this.rightPrinter=C(e.init,e,this.options)),this.noNewLineWrapping=se(e.init)||ei(e.init);return;case a.ForInStatement:case a.ForOfStatement:this.leftPrinter=C(e.left,e,this.options),this.operator=e.type==="ForInStatement"?" in":" of",this.rightPrinter=C(e.right,e,this.options);return;case a.BinaryExpression:case a.LogicalExpression:this.leftPrinter=C(e.left,e,this.options),this.operator=` ${e.operator}`,this.rightPrinter=C(e.right,e,this.options);return}}format(e="singleLine",t=0){if(!this.rightPrinter)return this.finalize(this.leftPrinter.format(e,t));let n=this.leftPrinter.format("singleLine",t).suffixWith(this.operator),r=this.rightPrinter.format("singleLine",t);if(e==="singleLine")return this.finalize(p.joinLines([n,r]," "));let s=Ze(t,this.options)+this.leadingString.length+n.maxLineLength+1;s>this.options.wrapColumn&&(n=this.leftPrinter.format("multiline",t).suffixWith(this.operator),s=n.lastLineLength+1);let u=r.firstLineLength+this.trailingString.length+1;if(s+u<this.options.wrapColumn)return this.finalize(p.joinLines([n,r]," "));let c=this.rightPrinter.format("multiline",t);return c.firstLineLength+this.trailingString.length+1+s<this.options.wrapColumn||this.noNewLineWrapping?this.finalize(p.joinLines([n,c]," ")):(u>this.options.wrapColumn&&(r=this.rightPrinter.format("multiline",t+1)),r=r.indentFirstLine(M(t+1)),this.finalize(p.appendLines([n,r])))}},We=class extends v{constructor(e,t,n){super(e,t,n),this.node=e,this.parent=t,this.options=n,this.type="TemplateLiteralPrinter",this.parts=[];let r=e.expressions.map(s=>C(s,e,this.options));this.parts.push("`"),e.quasis.forEach((s,u)=>{this.parts.push(s.value.raw),u<r.length&&(this.parts.push("${"),this.parts.push(r[u]),this.parts.push("}"))}),this.parts.push("`")}format(e="singleLine",t=0){return this.finalize(p.joinLines(this.parts.map(n=>typeof n=="string"?n:n.format(e,t))))}};function Wi(i){let e={...i.leadingComments?.slice(0,1)[0]?.loc.start??i.loc.start},t={...i.trailingComments?.slice(-1)[0]?.loc.end??i.loc.end};return{start:e,end:t}}function Hi(i){return i.trailingComments?.slice(-1)[0]?.type===a.LineComment}var L=class{constructor(e,t,n){this.node=e,this.parent=t,this.options=n,this.indentStatementFirstLine=!0,this.externalOffset=0,this.options=Ye(this.options)}createStatementPrinter(e){switch(e.type){case a.Program:return new _(e,this.node,this.options);case a.ImportDeclaration:return new Je(e,this.node,this.options);case a.ExpressionStatement:return new Ke(e,this.node,this.options);case a.FunctionDeclaration:return new le(e,this.node,this.options);case a.ExportNamedDeclaration:return Te(e)?new ce(e,this.node,this.options):new le(e,this.node,this.options);case a.BlockStatement:return new _(e,this.node,this.options);case a.ReturnStatement:return new Xe(e,this.node,this.options);case a.VariableDeclaration:return new ce(e,this.node,this.options);case a.IfStatement:return new qe(e,this.node,this.options);case a.ForStatement:case a.ForInStatement:case a.ForOfStatement:case a.WhileStatement:return new Ge(e,this.node,this.options);case a.EmptyStatement:case a.BreakStatement:case a.ContinueStatement:return new He(e,this.node,this.options);default:throw new Error(`unknown type: ${JSON.stringify(e)}`)}}getFormattedBody(e,t=0){if(this.cachedBody&&this.cachedBody.level===t)return this.cachedBody.body;let n=e.format(t);return this.cachedBody={body:n,level:t},n}getStatementIndentation(e=0){return this.indentStatementFirstLine?M(e,this.options):""}getStatementIndentationLength(e=0){return this.indentStatementFirstLine?e*this.options.indentWidth:0}getIndentation(e=0){return M(e,this.options)}addComments(e,t=0){let n=this.getStatementIndentation(t);if(!this.node.leadingComments?.length&&!this.node.trailingComments?.length)return e.indentFirstLine(n);let r=(this.node.leadingComments??[]).reduce((u,c)=>{let l=this.formatComment(c);return{formattedLines:p.aggregateLines(u.formattedLines,u.location,l,c.loc,n),location:c.loc}},{formattedLines:new p}),s=p.aggregateLines(r.formattedLines,r.location,e,this.node.loc,n);return(this.node.trailingComments?.reduce((u,c)=>{let l=this.formatComment(c);return{formattedLines:p.aggregateLines(u.formattedLines,u.location,l,c.loc,n),location:c.loc}},{formattedLines:s,location:this.node.loc})??{formattedLines:s}).formattedLines}formatInnerComments(e=0){if(!S(this.node)||!Array.isArray(this.node.innerComments)||!this.node.innerComments.length)return new p;let t=this.getIndentation(e);return this.node.innerComments.reduce((n,r)=>{let s=this.formatComment(r);return{formattedLines:p.aggregateLines(n.formattedLines,n.location,s,r.loc,t),location:r.loc}},{formattedLines:new p}).formattedLines}formatComment(e){return e.type===a.BlockComment?p.fromString(e.value).surroundWith("/*","*/"):p.fromString(e.value.trimEnd()).surroundWith("//")}canFitSingleLine(e,t=0,n=0){return this.externalOffset+n+this.getStatementIndentationLength(t)+e.lastLineLength<=this.options.wrapColumn}},_=class extends L{constructor(e,t,n){super(e,t,n),this.node=e,this.printers=[],this.printers=e.body.map(r=>this.createStatementPrinter(r))}format(e=0){if(this.printers.length===0)return this.formatEmptyBlock(e);let t=[],n=S(this.node);n&&t.push("{");let r=n?e+1:e,s;return this.printers.forEach(u=>{if(Di(u.node))return;let c=Wi(u.node);s&&c.start.line-s.end.line>1&&t.push(""),s=c,t.push(u.format(r))}),n&&t.push(`${this.getIndentation(e)}}`),this.addComments(p.appendLines(t),e)}formatEmptyBlock(e=0){if(!S(this.node))return this.addComments(p.fromString(""),e);let t=this.formatInnerComments(e+1),n="{",r=`${this.getIndentation(e)}}`;return t.isEmpty?Se(this.parent)?this.addComments(p.appendLines([n,r]),e):this.addComments(p.fromString("{}"),e):this.addComments(p.appendLines([n,t,r]),e)}},He=class extends L{constructor(e,t,n){switch(super(e,t,n),this.node=e,this.keyword="",this.node.type){case a.ContinueStatement:this.keyword="continue;";break;case a.BreakStatement:this.keyword="break;";break;default:this.keyword=";"}}format(e=0){return this.addComments(p.fromString(this.keyword),e)}},ce=class extends L{constructor(e,t,n){if(super(e,t,n),this.node=e,Te(e))this.printer=new K(e,t,n);else if(Te(e.declaration))this.printer=new K(e.declaration,t,n),this.printer.prefix="export ";else throw new Error(`invalid type: ${JSON.stringify(e)}`)}format(e=0,t="optimized"){if(t==="singleLine"||t==="optimized"){let n=this.printer.format("singleLine",e).suffixWith(";");if(t==="singleLine"||this.canFitSingleLine(n,e))return this.addComments(n,e)}return this.addComments(this.printer.format("multiline",e).suffixWith(";"),e)}},le=class extends L{constructor(e,t,n){if(super(e,t,n),this.node=e,Zt(e))this.header=U(e,t,n),this.body=new _(e.body,e,n);else if(Zt(e.declaration))this.header=U(e.declaration,t,n),this.header.prefix="export ",this.body=new _(e.declaration.body,e,n);else throw new Error(`invalid type: ${JSON.stringify(e)}`)}format(e=0,t="optimized"){this.body.indentStatementFirstLine=!1;let n=this.getFormattedBody(this.body,e);if(t==="singleLine"||t==="optimized"){let s=this.header.format("singleLine",e);if(t==="singleLine"||this.canFitSingleLine(s,e,n.firstLineLength+1))return this.addComments(p.joinLines([s,n]," "),e)}let r=this.header.format("multiline",e);return this.addComments(p.joinLines([r,n]," "),e)}},qe=class extends L{constructor(e,t,n){super(e,t,n),this.node=e,this.header=U(e,t,n),this.consequent=this.createStatementPrinter(e.consequent),this.consequent.indentStatementFirstLine=!1,e.alternate&&(this.alternate=this.createStatementPrinter(e.alternate),this.alternate.indentStatementFirstLine=!1)}format(e=0,t="optimized"){let n=!1,r;if(t==="singleLine"||t==="optimized"){let l=this.header.format("singleLine",e),D=S(this.node.consequent)?2:0;(t==="singleLine"||this.canFitSingleLine(l,e,D))&&(r=l)}r||(n=!0,r=this.header.format("multiline",e));let s;if(S(this.node.consequent)){let l=this.consequent.format(e,"optimized");s=p.joinLines([r," ",l])}else if(n||Se(this.node.consequent)){this.consequent.indentStatementFirstLine=!0;let l=this.consequent.format(e+1,"singleLine");this.canFitSingleLine(l,e+1)||(l=this.consequent.format(e+1,"multiline")),s=p.appendLines([r,l])}else{this.consequent.indentStatementFirstLine=!1;let l=this.consequent.format(e,"singleLine");this.canFitSingleLine(l,0,r.lastLineLength+1)?s=p.joinLines([r," ",l]):(this.consequent.indentStatementFirstLine=!0,l=this.consequent.format(e+1,"optimized"),s=p.appendLines([r,l]))}if(!this.alternate)return this.addComments(s,e);let u=Hi(this.node.consequent)||!S(this.node.consequent),c;if(this.alternate.externalOffset=0,S(this.node.alternate)||Se(this.node.alternate))this.alternate.indentStatementFirstLine=!1,this.alternate.externalOffset=u?5:s.lastLineLength+6,c=this.alternate.format(e,"optimized"),c=p.joinLines(["else ",c]);else{let l=u?4:s.lastLineLength+4;this.alternate.indentStatementFirstLine=!1,c=this.alternate.format(e,"singleLine"),this.canFitSingleLine(c,e,l+1)?c=p.joinLines(["else ",c]):(this.alternate.indentStatementFirstLine=!0,c=this.alternate.format(e+1,"optimized"),c=p.appendLines(["else",c]))}return u?s=p.appendLines([s,c.indentFirstLine(this.getIndentation(e))]):s=p.joinLines([s,c]," "),this.addComments(s,e)}},Ge=class extends L{constructor(e,t,n){super(e,t,n),this.node=e,this.header=U(e,t,n),this.body=this.createStatementPrinter(e.body)}format(e=0,t="optimized"){this.body.indentStatementFirstLine=!1;let n=this.getFormattedBody(this.body,e);if(t==="singleLine"||t==="optimized"){let s=this.header.format("singleLine",e);if(t==="singleLine"||this.canFitSingleLine(s,e,n.firstLineLength+1))return this.addComments(p.joinLines([s,n]," "),e)}let r=this.header.format("multiline",e);return this.addComments(p.joinLines([r,n]," "),e)}},Ke=class extends L{constructor(e,t,n){super(e,t,n),this.node=e,this.expression=C(e.expression,e,n)}format(e=0,t="optimized"){if(t==="singleLine"||t==="optimized"){let n=this.expression.format("singleLine",e).suffixWith(";");if(t==="singleLine"||this.canFitSingleLine(n,e))return this.addComments(n,e)}return this.addComments(this.expression.format("multiline",e).suffixWith(";"),e)}},Xe=class extends L{constructor(e,t,n){super(e,t,n),this.node=e,this.argument=C(e.argument,e,n)}format(e=0,t="optimized"){if(t==="singleLine"||t==="optimized"){let u=this.argument.format("singleLine",e).surroundWith("return ",";");if(t==="singleLine"||this.canFitSingleLine(u,e))return this.addComments(u,e)}if(!Ne(this.node.argument)&&!Pe(this.node.argument)){let u=this.argument.format("multiline",e).surroundWith("return ",";");return this.addComments(u,e)}let n=this.getIndentation(e+1),r=this.argument.format("multiline",e+1).indentFirstLine(n),s=this.getIndentation(e);return this.addComments(p.appendLines(["return (",r,`${s});`]),e)}},Je=class extends L{constructor(e,t,n){super(e,t,n),this.node=e,this.libraryNamePrinter=C(e.specifiers[0].local,e,n),this.librarySourcePrinter=C(e.source,e,n)}format(e=0){return this.addComments(p.joinLines(["import"," ",this.libraryNamePrinter.format("singleLine",e)," from ",this.librarySourcePrinter.format("singleLine")]).suffixWith(";"),e)}};function un(i,e){if(!i)return"";let t=Ye(e),n=ze.fromString(i,t),r=n.toString(),s=Pi(r,{tolerant:!0,comments:!0}),u=Ni(s,n);return s.loc.start=u.start,s.loc.end=u.end,new _(s,null,t).format().toString()}var qi=Object.values(g),Gi=Object.values(q);var an=Gi.map(i=>({label:i,kind:b.Constant})),on=qi.map(i=>({label:i,kind:b.Keyword})),cn=[{label:"exportfunction",kind:b.Snippet,detail:"Export Function Statement",insertText:`export function \${1:functionName} ($2) {
21
+ `){return this.lines.join(e)}};function Ze(i,e){return i*(e.indentWidth??2)}function M(i=0,e){let{indentWidth:t=2}=Ye(e);return new Array(i*t+1).join(" ")}function ne(i){return i.replace(/['"]/gu,e=>e==='"'?"'":'"')}function Vi(i,e){switch(i.type){case a.UnaryExpression:return(ti(e)||Ii(e))&&e.object===i;case a.BinaryExpression:case a.LogicalExpression:switch(e.type){case a.UnaryExpression:return!0;case a.MemberExpression:case a.SafeMemberExpression:return e.object===i;case a.BinaryExpression:case a.LogicalExpression:return re[e.operator]>re[i.operator];default:return!1}case a.Literal:return ti(e)&&typeof i.value=="number"&&e.object===i;case a.AssignmentExpression:switch(e.type){case a.UnaryExpression:case a.BinaryExpression:case a.LogicalExpression:case a.ReturnStatement:return!0;case a.MemberExpression:case a.SafeMemberExpression:return e.object===i;default:return!1}case a.MemberAccessChainExpression:switch(e.type){case a.MemberExpression:case a.SafeMemberExpression:return e.object===i;default:return!1}default:return!1}}function C(i,e,t){switch(i?.type){case a.BinaryExpression:case a.LogicalExpression:return $i(i,e,t);case a.AssignmentExpression:return new X(i,e,t);case a.MemberExpression:case a.SafeMemberExpression:return new $e(i,e,t);case a.Identifier:return new G(i,e,t);case a.CallExpression:return new Ve(i,e,t);case a.ObjectExpression:return U(i,e,t);case a.ArrayExpression:return U(i,e,t);case a.Literal:return new G(i,e,t);case a.UpdateExpression:case a.UnaryExpression:case a.MemberAccessChainExpression:return new oe(i,e,t);case a.TemplateLiteral:return new We(i,e,t);case a.VariableDeclaration:return new K(i,e,t);default:throw new Error(`unknown type: ${JSON.stringify(i)}`)}}function U(i,e,t){let n=new R(i,e,t);switch(i.type){case a.ArrayExpression:return n.setupCollection(i.elements.map(r=>C(r,i,t)),"SquareBrackets"),n;case a.ObjectExpression:return n.setupCollection(i.properties.map(r=>new Re(r,i,t)),"CurlyBrackets"),n;case a.VariableDeclaration:return n.prefix="var ",n.setupCollection(i.declarations.map(r=>gi(r,i,t)),"None"),n;case a.FunctionDeclaration:return n.prefix=`function ${i.id.name}`,n.setupCollection(i.params.map(r=>C(r,i,t)),"Parentheses"),n;case a.ForStatement:return n.prefix="for ",n.setupCollection([C(i.init,i,t),C(i.test,i,t),C(i.update,i,t)],"Parentheses",";"),n;case a.ForInStatement:case a.ForOfStatement:return n.prefix="for ",n.setupCollection([new X(i,e,t)],"Parentheses",""),n;case a.IfStatement:return n.prefix="if ",n.setupCollection([C(i.test,i,t)],"Parentheses",""),n;case a.WhileStatement:return n.prefix="while ",n.setupCollection([C(i.test,i,t)],"Parentheses",""),n;default:return n}}function gi(i,e,t){return i.init?new X(i,e,t):new G(i.id,e,t)}function $i(i,e,t){let n=[...ae(i.left,i.operator),...ae(i.right,i.operator)].map(s=>C(s,i,t)),r=new R(i,e,t);return r.setupCollection(n,"None",` ${i.operator}`),r}function ae(i,e){return i.type!==a.BinaryExpression&&i.type!==a.LogicalExpression?[i]:i.operator!==e?[i]:[...ae(i.left,e),...ae(i.right,e)]}var v=class{constructor(e,t,n){this.node=e,this.parent=t,this.options=n,this.prefix="",this.suffix="",this.groupingParentheses=!1,this.groupingParentheses=Vi(e,t)}get openingParenthesis(){return this.groupingParentheses?"(":""}get closingParenthesis(){return this.groupingParentheses?")":""}get leadingString(){return[this.prefix,this.openingParenthesis].join("")}get trailingString(){return[this.closingParenthesis,this.suffix].join("")}finalize(e){return typeof e=="string"&&(e=p.fromString(e)),e.surroundWith(this.leadingString,this.trailingString)}},R=class extends v{constructor(e,t,n){super(e,t,n),this.node=e,this.parent=t,this.options=n,this.type="CollectionPrinter",this.bracketsType="None",this.separator=",",this.printers=[]}setupCollection(e=[],t="None",n){return this.bracketsType=t,this.separator=n??this.separator,this.printers=e,this}getOpeningBracket(e=!1,t="singleLine"){if(this.bracketsType==="None")return"";if(this.bracketsType==="CurlyBrackets")return`{${e||t==="multiline"?"":" "}`;switch(this.bracketsType){case"Parentheses":return"(";case"SquareBrackets":return"[";default:return""}}getClosingBracket(e=!1,t="singleLine"){if(this.bracketsType==="None")return"";if(this.bracketsType==="CurlyBrackets")return`${e||t==="multiline"?"":" "}}`;switch(this.bracketsType){case"Parentheses":return")";case"SquareBrackets":return"]";default:return""}}getLinesLevel(e=0){return this.bracketsType!=="None"||wi(this.parent)||mi(this.parent)||(Ne(this.node)||Pe(this.node))&&(Ne(this.parent)||Pe(this.parent))?e+1:e}finalize(e,t="singleLine",n=0){if(this.bracketsType==="None")return super.finalize(e);let r=this.getOpeningBracket(e.isEmpty,t),s=this.getClosingBracket(e.isEmpty,t);if(t==="singleLine")return super.finalize(e.surroundWith(r,s));let u=M(n,this.options);return super.finalize(p.appendLines([r,e,u+s]))}singleLineFormat(e=0){let t=this.printers.length-1;return p.joinLines(this.printers.map((n,r)=>n.format("singleLine",e).suffixWith(r<t?this.separator:""))," ")}optimizedPrinterFormat(e,t,n=0){let r=this.getLinesLevel(n),s=M(r,this.options),u=this.bracketsType==="None"&&t===0?"":s,c=t<this.printers.length-1?this.separator:"",l=e.format("singleLine",r).suffixWith(c);return l.maxLineLength+s.length<=this.options.wrapColumn?l.indentFirstLine(u):e.format("multiline",r).suffixWith(c).indentFirstLine(u)}multilineFormat(e=0){return p.appendLines(this.printers.map((t,n)=>this.optimizedPrinterFormat(t,n,e)))}format(e="singleLine",t=0){if(this.printers.length===0){let r=this.getOpeningBracket(!0,e),s=this.getClosingBracket(!0,e);return super.finalize(p.fromString(r+s))}if(e==="singleLine"){let r=this.singleLineFormat(t);return this.finalize(r,e,t)}let n=this.multilineFormat(t);return this.finalize(n,e,t)}},Ri=/^[a-zA-Z_$][a-zA-Z_$0-9]*$/u,G=class extends v{constructor(e,t,n){super(e,t,n),this.node=e,this.parent=t,this.options=n,this.type="StringPrinter"}format(){if(Qe(this.node))return this.finalize(this.node.name);if(typeof this.node.value!="string")return this.finalize(this.node.raw);if(Si(this.parent)&&this.parent.key===this.node&&fi(this.node)&&typeof this.node.value=="string"&&Ri.test(this.node.value))return this.finalize(this.node.value);switch(this.options.quote){case"auto":{let e=JSON.stringify(this.node.value),t=ne(JSON.stringify(ne(this.node.value)));return this.finalize(e.length>t.length?t:e)}case"single":return this.finalize(ne(JSON.stringify(ne(this.node.value))));default:return this.finalize(JSON.stringify(this.node.value))}}},oe=class extends v{constructor(e,t,n){super(e,t,n),this.node=e,this.parent=t,this.options=n,this.type="SingleExpressionPrinter";let r=vi(e),s=Li(e);if(r||s){this.prefix=r?e.operator:"",this.suffix=s&&!e.prefix?e.operator:"",this.printer=C(e.argument,e,this.options);return}if(ki(e)){this.printer=C(e.expression,e,this.options);return}this.printer=C(e,t,this.options)}format(e="singleLine",t=0){return this.finalize(this.printer.format(e,t))}},K=class extends v{constructor(e,t,n){super(e,t,n),this.node=e,this.parent=t,this.options=n,this.type="VariableDeclaratorsPrinter",e.declarations.length===1?(this.printer=gi(e.declarations[0],e,this.options),this.printer.prefix="var "):this.printer=U(e,t,this.options)}format(e="singleLine",t=0){return this.finalize(this.printer.format(e,t))}},Ve=class extends v{constructor(e,t,n){super(e,t,n),this.node=e,this.parent=t,this.options=n,this.type="CallExpressionPrinter",this.argumentsPrinter=new R(e,t,n),this.argumentsPrinter.setupCollection(e.arguments.map(r=>C(r,e,n)),"Parentheses"),Qe(e.callee)?this.argumentsPrinter.prefix=e.callee.name:this.calleePrinter=C(e.callee,t,n)}format(e="singleLine",t=0){if(!this.calleePrinter)return this.finalize(this.argumentsPrinter.format(e,t));let n=this.calleePrinter.format("singleLine",t),r=this.argumentsPrinter.format("singleLine",t);if(e==="singleLine")return this.finalize(p.joinLines([n,r]));let s=Ze(t,this.options)+this.leadingString.length+n.firstLineLength;return s+1<this.options.wrapColumn?(r=this.argumentsPrinter.format("multiline",t),this.finalize(p.joinLines([n,r]))):(n=this.calleePrinter.format("multiline",t),s=n.lastLineLength,s+r.maxLineLength>this.options.wrapColumn&&(r=this.argumentsPrinter.format("multiline",t+1)),this.finalize(p.joinLines([n,r])))}},$e=class extends v{constructor(e,t,n){if(super(e,t,n),this.node=e,this.parent=t,this.options=n,this.type="MemberExpressionPrinter",this.objectPrinter=C(e.object,e,this.options),e.computed){let r=new R(e.property,e,this.options);r.setupCollection([C(e.property,e,this.options)],"SquareBrackets"),r.prefix=e.type==="SafeMemberExpression"?N:"",this.propertyPrinter=r}else{let r=new oe(e.property,e,this.options);r.prefix=e.type==="SafeMemberExpression"?N:".",this.propertyPrinter=r}}format(e="singleLine",t=0){let n=this.objectPrinter.format("singleLine",t),r=this.propertyPrinter.format("singleLine",t);if(e==="singleLine")return this.finalize(p.joinLines([n,r]));let s=Ze(t,this.options)+this.leadingString.length+n.firstLineLength;s>this.options.wrapColumn&&(n=this.objectPrinter.format("multiline",t),s=n.lastLineLength);let u=r.firstLineLength+this.trailingString.length;if(s+u<this.options.wrapColumn)return this.finalize(p.joinLines([n,r]));if(this.node.computed)return this.finalize(p.joinLines([n,this.propertyPrinter.format("multiline",t)]));let c=t+1,l=M(c,this.options);return r=this.propertyPrinter.format("singleLine",t),u=l.length+r.lastLineLength+this.trailingString.length,u>this.options.wrapColumn&&(r=this.propertyPrinter.format("multiline",c)),this.finalize(p.appendLines([n,r.indentFirstLine(l)]))}},Re=class extends v{constructor(e,t,n){super(e,t,n),this.node=e,this.parent=t,this.options=n,this.type="PropertyPrinter",this.key=C(e.key,e,this.options),e.shorthand||(this.key.suffix=":",this.value=C(e.value,e,this.options))}format(e="singleLine",t=0){if(this.node.shorthand||!this.value)return this.finalize(this.key.format(e,t));let n=this.key.format("singleLine",t);if(e==="singleLine"){let u=this.value.format("singleLine",t);return this.finalize(p.joinLines([n,u]," "))}if(se(this.node.value)||se(this.node.value)){let u=this.value.format("multiline",t);return this.finalize(p.joinLines([n,u]," "))}let r=M(t+1,this.options),s=this.value.format("singleLine",t+1).indentFirstLine(r);return s.maxLineLength+this.trailingString.length+1<=this.options.wrapColumn?this.finalize(p.appendLines([n,s])):(s=this.value.format("multiline",t+1).indentFirstLine(r),this.finalize(p.appendLines([n,s])))}},X=class extends v{constructor(e,t,n){switch(super(e,t,n),this.node=e,this.parent=t,this.options=n,this.type="OperationPrinter",this.operator="",this.noNewLineWrapping=!1,e.type){case a.AssignmentExpression:this.leftPrinter=C(e.left,e,this.options),this.operator=` ${e.operator}`,this.rightPrinter=C(e.right,e,this.options),this.noNewLineWrapping=(Qe(e.left)||fi(e.left))&&(se(e.right)||ei(e.right));return;case a.VariableDeclarator:this.leftPrinter=C(e.id,e,this.options),e.init&&(this.operator=" =",this.rightPrinter=C(e.init,e,this.options)),this.noNewLineWrapping=se(e.init)||ei(e.init);return;case a.ForInStatement:case a.ForOfStatement:this.leftPrinter=C(e.left,e,this.options),this.operator=e.type==="ForInStatement"?" in":" of",this.rightPrinter=C(e.right,e,this.options);return;case a.BinaryExpression:case a.LogicalExpression:this.leftPrinter=C(e.left,e,this.options),this.operator=` ${e.operator}`,this.rightPrinter=C(e.right,e,this.options);return}}format(e="singleLine",t=0){if(!this.rightPrinter)return this.finalize(this.leftPrinter.format(e,t));let n=this.leftPrinter.format("singleLine",t).suffixWith(this.operator),r=this.rightPrinter.format("singleLine",t);if(e==="singleLine")return this.finalize(p.joinLines([n,r]," "));let s=Ze(t,this.options)+this.leadingString.length+n.maxLineLength+1;s>this.options.wrapColumn&&(n=this.leftPrinter.format("multiline",t).suffixWith(this.operator),s=n.lastLineLength+1);let u=r.firstLineLength+this.trailingString.length+1;if(s+u<this.options.wrapColumn)return this.finalize(p.joinLines([n,r]," "));let c=this.rightPrinter.format("multiline",t);return c.firstLineLength+this.trailingString.length+1+s<this.options.wrapColumn||this.noNewLineWrapping?this.finalize(p.joinLines([n,c]," ")):(u>this.options.wrapColumn&&(r=this.rightPrinter.format("multiline",t+1)),r=r.indentFirstLine(M(t+1)),this.finalize(p.appendLines([n,r])))}},We=class extends v{constructor(e,t,n){super(e,t,n),this.node=e,this.parent=t,this.options=n,this.type="TemplateLiteralPrinter",this.parts=[];let r=e.expressions.map(s=>C(s,e,this.options));this.parts.push("`"),e.quasis.forEach((s,u)=>{this.parts.push(s.value.raw),u<r.length&&(this.parts.push("${"),this.parts.push(r[u]),this.parts.push("}"))}),this.parts.push("`")}format(e="singleLine",t=0){return this.finalize(p.joinLines(this.parts.map(n=>typeof n=="string"?n:n.format(e,t))))}};function Wi(i){let e={...i.leadingComments?.slice(0,1)[0]?.loc.start??i.loc.start},t={...i.trailingComments?.slice(-1)[0]?.loc.end??i.loc.end};return{start:e,end:t}}function Hi(i){return i.trailingComments?.slice(-1)[0]?.type===a.LineComment}var L=class{constructor(e,t,n){this.node=e,this.parent=t,this.options=n,this.indentStatementFirstLine=!0,this.externalOffset=0,this.options=Ye(this.options)}createStatementPrinter(e){switch(e.type){case a.Program:return new _(e,this.node,this.options);case a.ImportDeclaration:return new Je(e,this.node,this.options);case a.ExpressionStatement:return new Ke(e,this.node,this.options);case a.FunctionDeclaration:return new le(e,this.node,this.options);case a.ExportNamedDeclaration:return Te(e)?new ce(e,this.node,this.options):new le(e,this.node,this.options);case a.BlockStatement:return new _(e,this.node,this.options);case a.ReturnStatement:return new Xe(e,this.node,this.options);case a.VariableDeclaration:return new ce(e,this.node,this.options);case a.IfStatement:return new qe(e,this.node,this.options);case a.ForStatement:case a.ForInStatement:case a.ForOfStatement:case a.WhileStatement:return new Ge(e,this.node,this.options);case a.EmptyStatement:case a.BreakStatement:case a.ContinueStatement:return new He(e,this.node,this.options);default:throw new Error(`unknown type: ${JSON.stringify(e)}`)}}getFormattedBody(e,t=0){if(this.cachedBody?.level===t)return this.cachedBody.body;let n=e.format(t);return this.cachedBody={body:n,level:t},n}getStatementIndentation(e=0){return this.indentStatementFirstLine?M(e,this.options):""}getStatementIndentationLength(e=0){return this.indentStatementFirstLine?e*this.options.indentWidth:0}getIndentation(e=0){return M(e,this.options)}addComments(e,t=0){let n=this.getStatementIndentation(t);if(!this.node.leadingComments?.length&&!this.node.trailingComments?.length)return e.indentFirstLine(n);let r=(this.node.leadingComments??[]).reduce((u,c)=>{let l=this.formatComment(c);return{formattedLines:p.aggregateLines(u.formattedLines,u.location,l,c.loc,n),location:c.loc}},{formattedLines:new p}),s=p.aggregateLines(r.formattedLines,r.location,e,this.node.loc,n);return(this.node.trailingComments?.reduce((u,c)=>{let l=this.formatComment(c);return{formattedLines:p.aggregateLines(u.formattedLines,u.location,l,c.loc,n),location:c.loc}},{formattedLines:s,location:this.node.loc})??{formattedLines:s}).formattedLines}formatInnerComments(e=0){if(!S(this.node)||!Array.isArray(this.node.innerComments)||!this.node.innerComments.length)return new p;let t=this.getIndentation(e);return this.node.innerComments.reduce((n,r)=>{let s=this.formatComment(r);return{formattedLines:p.aggregateLines(n.formattedLines,n.location,s,r.loc,t),location:r.loc}},{formattedLines:new p}).formattedLines}formatComment(e){return e.type===a.BlockComment?p.fromString(e.value).surroundWith("/*","*/"):p.fromString(e.value.trimEnd()).surroundWith("//")}canFitSingleLine(e,t=0,n=0){return this.externalOffset+n+this.getStatementIndentationLength(t)+e.lastLineLength<=this.options.wrapColumn}},_=class extends L{constructor(e,t,n){super(e,t,n),this.node=e,this.printers=[],this.printers=e.body.map(r=>this.createStatementPrinter(r))}format(e=0){if(this.printers.length===0)return this.formatEmptyBlock(e);let t=[],n=S(this.node);n&&t.push("{");let r=n?e+1:e,s;return this.printers.forEach(u=>{if(Di(u.node))return;let c=Wi(u.node);s&&c.start.line-s.end.line>1&&t.push(""),s=c,t.push(u.format(r))}),n&&t.push(`${this.getIndentation(e)}}`),this.addComments(p.appendLines(t),e)}formatEmptyBlock(e=0){if(!S(this.node))return this.addComments(p.fromString(""),e);let t=this.formatInnerComments(e+1),n="{",r=`${this.getIndentation(e)}}`;return t.isEmpty?Se(this.parent)?this.addComments(p.appendLines([n,r]),e):this.addComments(p.fromString("{}"),e):this.addComments(p.appendLines([n,t,r]),e)}},He=class extends L{constructor(e,t,n){switch(super(e,t,n),this.node=e,this.keyword="",this.node.type){case a.ContinueStatement:this.keyword="continue;";break;case a.BreakStatement:this.keyword="break;";break;default:this.keyword=";"}}format(e=0){return this.addComments(p.fromString(this.keyword),e)}},ce=class extends L{constructor(e,t,n){if(super(e,t,n),this.node=e,Te(e))this.printer=new K(e,t,n);else if(Te(e.declaration))this.printer=new K(e.declaration,t,n),this.printer.prefix="export ";else throw new Error(`invalid type: ${JSON.stringify(e)}`)}format(e=0,t="optimized"){if(t==="singleLine"||t==="optimized"){let n=this.printer.format("singleLine",e).suffixWith(";");if(t==="singleLine"||this.canFitSingleLine(n,e))return this.addComments(n,e)}return this.addComments(this.printer.format("multiline",e).suffixWith(";"),e)}},le=class extends L{constructor(e,t,n){if(super(e,t,n),this.node=e,Zt(e))this.header=U(e,t,n),this.body=new _(e.body,e,n);else if(Zt(e.declaration))this.header=U(e.declaration,t,n),this.header.prefix="export ",this.body=new _(e.declaration.body,e,n);else throw new Error(`invalid type: ${JSON.stringify(e)}`)}format(e=0,t="optimized"){this.body.indentStatementFirstLine=!1;let n=this.getFormattedBody(this.body,e);if(t==="singleLine"||t==="optimized"){let s=this.header.format("singleLine",e);if(t==="singleLine"||this.canFitSingleLine(s,e,n.firstLineLength+1))return this.addComments(p.joinLines([s,n]," "),e)}let r=this.header.format("multiline",e);return this.addComments(p.joinLines([r,n]," "),e)}},qe=class extends L{constructor(e,t,n){super(e,t,n),this.node=e,this.header=U(e,t,n),this.consequent=this.createStatementPrinter(e.consequent),this.consequent.indentStatementFirstLine=!1,e.alternate&&(this.alternate=this.createStatementPrinter(e.alternate),this.alternate.indentStatementFirstLine=!1)}format(e=0,t="optimized"){let n=!1,r;if(t==="singleLine"||t==="optimized"){let l=this.header.format("singleLine",e),D=S(this.node.consequent)?2:0;(t==="singleLine"||this.canFitSingleLine(l,e,D))&&(r=l)}r||(n=!0,r=this.header.format("multiline",e));let s;if(S(this.node.consequent)){let l=this.consequent.format(e,"optimized");s=p.joinLines([r," ",l])}else if(n||Se(this.node.consequent)){this.consequent.indentStatementFirstLine=!0;let l=this.consequent.format(e+1,"singleLine");this.canFitSingleLine(l,e+1)||(l=this.consequent.format(e+1,"multiline")),s=p.appendLines([r,l])}else{this.consequent.indentStatementFirstLine=!1;let l=this.consequent.format(e,"singleLine");this.canFitSingleLine(l,0,r.lastLineLength+1)?s=p.joinLines([r," ",l]):(this.consequent.indentStatementFirstLine=!0,l=this.consequent.format(e+1,"optimized"),s=p.appendLines([r,l]))}if(!this.alternate)return this.addComments(s,e);let u=Hi(this.node.consequent)||!S(this.node.consequent),c;if(this.alternate.externalOffset=0,S(this.node.alternate)||Se(this.node.alternate))this.alternate.indentStatementFirstLine=!1,this.alternate.externalOffset=u?5:s.lastLineLength+6,c=this.alternate.format(e,"optimized"),c=p.joinLines(["else ",c]);else{let l=u?4:s.lastLineLength+4;this.alternate.indentStatementFirstLine=!1,c=this.alternate.format(e,"singleLine"),this.canFitSingleLine(c,e,l+1)?c=p.joinLines(["else ",c]):(this.alternate.indentStatementFirstLine=!0,c=this.alternate.format(e+1,"optimized"),c=p.appendLines(["else",c]))}return u?s=p.appendLines([s,c.indentFirstLine(this.getIndentation(e))]):s=p.joinLines([s,c]," "),this.addComments(s,e)}},Ge=class extends L{constructor(e,t,n){super(e,t,n),this.node=e,this.header=U(e,t,n),this.body=this.createStatementPrinter(e.body)}format(e=0,t="optimized"){this.body.indentStatementFirstLine=!1;let n=this.getFormattedBody(this.body,e);if(t==="singleLine"||t==="optimized"){let s=this.header.format("singleLine",e);if(t==="singleLine"||this.canFitSingleLine(s,e,n.firstLineLength+1))return this.addComments(p.joinLines([s,n]," "),e)}let r=this.header.format("multiline",e);return this.addComments(p.joinLines([r,n]," "),e)}},Ke=class extends L{constructor(e,t,n){super(e,t,n),this.node=e,this.expression=C(e.expression,e,n)}format(e=0,t="optimized"){if(t==="singleLine"||t==="optimized"){let n=this.expression.format("singleLine",e).suffixWith(";");if(t==="singleLine"||this.canFitSingleLine(n,e))return this.addComments(n,e)}return this.addComments(this.expression.format("multiline",e).suffixWith(";"),e)}},Xe=class extends L{constructor(e,t,n){super(e,t,n),this.node=e,this.argument=C(e.argument,e,n)}format(e=0,t="optimized"){if(t==="singleLine"||t==="optimized"){let u=this.argument.format("singleLine",e).surroundWith("return ",";");if(t==="singleLine"||this.canFitSingleLine(u,e))return this.addComments(u,e)}if(!Ne(this.node.argument)&&!Pe(this.node.argument)){let u=this.argument.format("multiline",e).surroundWith("return ",";");return this.addComments(u,e)}let n=this.getIndentation(e+1),r=this.argument.format("multiline",e+1).indentFirstLine(n),s=this.getIndentation(e);return this.addComments(p.appendLines(["return (",r,`${s});`]),e)}},Je=class extends L{constructor(e,t,n){super(e,t,n),this.node=e,this.libraryNamePrinter=C(e.specifiers[0].local,e,n),this.librarySourcePrinter=C(e.source,e,n)}format(e=0){return this.addComments(p.joinLines(["import"," ",this.libraryNamePrinter.format("singleLine",e)," from ",this.librarySourcePrinter.format("singleLine")]).suffixWith(";"),e)}};function un(i,e){if(!i)return"";let t=Ye(e),n=ze.fromString(i,t),r=n.toString(),s=Pi(r,{tolerant:!0,comments:!0}),u=Ni(s,n);return s.loc.start=u.start,s.loc.end=u.end,new _(s,null,t).format().toString()}var qi=Object.values(g),Gi=Object.values(q);var an=Gi.map(i=>({label:i,kind:b.Constant})),on=qi.map(i=>({label:i,kind:b.Keyword})),cn=[{label:"exportfunction",kind:b.Snippet,detail:"Export Function Statement",insertText:`export function \${1:functionName} ($2) {
22
22
  $0
23
23
  }`,insertTextMode:w.adjustIndentation,insertTextFormat:B.Snippet},{label:"exportvar",kind:b.Snippet,detail:"Export Variable Statement",insertText:"export var ${0:variableName}\n",insertTextMode:w.adjustIndentation,insertTextFormat:B.Snippet},{label:"for",kind:b.Snippet,detail:"For Loop Statement",insertText:"for (var ${1:i} = 0; ${1:i} < ${2:array.length}; ${1:i}++) {\n $0\n}",insertTextMode:w.adjustIndentation,insertTextFormat:B.Snippet},{label:"forin",kind:b.Snippet,detail:"For-In Loop Statement",insertText:"for (var ${1:i} in ${2:arrayOrObject}) {\n $0\n}",insertTextMode:w.adjustIndentation,insertTextFormat:B.Snippet},{label:"forof",kind:b.Snippet,detail:"For-Of Loop Statement",insertText:"for (var ${1:i} of ${2:arrayOrObject}) {\n $0\n}",insertTextMode:w.adjustIndentation,insertTextFormat:B.Snippet},{label:"function",kind:b.Snippet,detail:"Function Statement",insertText:`function \${1:functionName} ($2) {
24
24
  $0
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
+ import{a as m,b as i,c as F,g as L}from"./HLDSPJ74.js";import{a as h}from"./ER2MKLVA.js";import{a as T}from"./MP6Z45SA.js";import{b as k}from"./Y3KOWWO5.js";import{Qk as S,Uk as _,Xk as p,al as l}from"./LLPQEURF.js";var V=["<=",">=","==","!=","+","-","*","/","%","++","--","<<",">>",">>>","&","|","^","!","~","&&","||","=","+=","-=","*=","**=","/=","%="],R={wordPattern:/(-?\d*\.\d\w*)|([^`~!#%\^&\*\(\)\-=\+\[\{\]\}\\\|;:'",\.<>\/\?\s]+)/gu,comments:{lineComment:"//",blockComment:["/*","*/"]},brackets:[["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"',notIn:["string"]},{open:"'",close:"'",notIn:["string","comment"]},{open:"`",close:"`",notIn:["string","comment"]}],autoCloseBefore:";:.,=}])` \n ",folding:{markers:{start:/^\s*\/\/\s*#?region\b/u,end:/^\s*\/\/\s*#?endregion\b/u}},indentationRules:{decreaseIndentPattern:/^((?!.*?\/\*).*\*\/)?\s*[\}\]\)].*$/u,increaseIndentPattern:/^((?!\/\/).)*(\{[^}"'`]*|\([^)"'`]*|\[[^\]"'`]*)$/u}},K={defaultToken:"invalid",tokenPostfix:".arcgis",ignoreCase:!0,keywords:L,operators:V,constants:["true","false","null"],symbols:/[=><!~?:&|+\-*\/\^%]+/u,escapes:/\\(?:[abfnrtv\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/u,digits:/\d+(_+\d+)*/u,octaldigits:/[0-7]+(_+[0-7]+)*/u,binarydigits:/[0-1]+(_+[0-1]+)*/u,hexdigits:/[[0-9a-fA-F]+(_+[0-9a-fA-F]+)*/u,regexpctl:/[(){}\[\]\$\^|\-*+?\.]/u,regexpesc:/\\(?:[bBdDfnrstvwWn0\\\/]|@regexpctl|c[A-Z]|x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4})/u,tokenizer:{root:[[/[{}]/u,"delimiter.bracket"],{include:"common"}],common:[[/import(?=\s)/u,{token:"keyword",next:"@import"}],[/for(?=\s)/u,{token:"keyword",next:"@forLoopInit"}],[/[a-z_$][\w$]*/u,{cases:{"@constants":"constant","@keywords":"keyword","@default":"identifier"}}],{include:"@whitespace"},[/\/(?=([^\\\/]|\\.)+\/([gimsuy]*)(\s*)(\.|;|,|\)|\]|\}|$))/u,{token:"regexp",bracket:"@open",next:"@regexp"}],[/[()\[\]]/u,"@brackets"],[/[<>](?!@symbols)/u,"@brackets"],[/@symbols/u,{cases:{"@operators":"delimiter","@default":""}}],[/(@digits)[eE]([\-+]?(@digits))?/u,"number"],[/(@digits)\.(@digits)([eE][\-+]?(@digits))?/u,"number"],[/0[xX](@hexdigits)/u,"number"],[/0[oO]?(@octaldigits)/u,"number"],[/0[bB](@binarydigits)/u,"number"],[/(@digits)/u,"number"],[/[;,.]/u,"delimiter"],[/"([^"\\]|\\.)*$/u,"string.invalid"],[/'([^'\\]|\\.)*$/u,"string.invalid"],[/"/u,"string","@string_double"],[/'/u,"string","@string_single"],[/`/u,"string","@string_backtick"]],import:[[/import(?=\s)/u,{token:"keyword"}],{include:"@whitespace"},[/[a-z_$][\w$]*/u,"identifier"],{include:"@whitespace"},[/from(?=\s)/u,{token:"keyword",next:"@popall"}]],forLoopInit:[{include:"@whitespace"},[/\(/u,{token:"@brackets",next:"@forLoopVar"}],[/.*/u,"","@pop"]],forLoopVar:[{include:"@whitespace"},[/var(?=\s)/u,"keyword","@forLoopVarName"],[/[a-z_$][\w$]*/u,"identifier","@forLoopCheckInOf"],[/\)/u,{token:"@brackets",next:"@popall"}]],forLoopVarName:[{include:"@whitespace"},[/[a-z_$][\w$]*/u,"identifier","@forLoopCheckInOf"],[/\)/u,{token:"@brackets",next:"@popall"}]],forLoopCheckInOf:[{include:"@whitespace"},[/in(?=\s)/u,"keyword","@popall"],[/of(?=\s)/u,"keyword","@popall"],[/[a-z_$][\w$]*/u,"identifier"],[/\)/u,{token:"@brackets",next:"@popall"}]],whitespace:[[/[ \t\r\n]+/u,""],[/\/\*/u,"comment","@comment"],[/\/\/.*$/u,"comment"]],comment:[[/[^\/*]+/u,"comment"],[/\*\//u,"comment","@pop"],[/[\/*]/u,"comment"]],regexp:[[/(\{)(\d+(?:,\d*)?)(\})/u,["regexp.escape.control","regexp.escape.control","regexp.escape.control"]],[/(\[)(\^?)(?=(?:[^\]\\\/]|\\.)+)/u,["regexp.escape.control",{token:"regexp.escape.control",next:"@regexrange"}]],[/(\()(\?:|\?=|\?!)/u,["regexp.escape.control","regexp.escape.control"]],[/[()]/u,"regexp.escape.control"],[/@regexpctl/u,"regexp.escape.control"],[/[^\\\/]/u,"regexp"],[/@regexpesc/u,"regexp.escape"],[/\\\./u,"regexp.invalid"],[/(\/)([gimsuy]*)/u,[{token:"regexp",bracket:"@close",next:"@pop"},"keyword.other"]]],regexrange:[[/-/u,"regexp.escape.control"],[/\^/u,"regexp.invalid"],[/@regexpesc/u,"regexp.escape"],[/[^\]]/u,"regexp"],[/\]/u,{token:"regexp.escape.control",next:"@pop",bracket:"@close"}]],string_double:[[/[^\\"]+/u,"string"],[/@escapes/u,"string.escape"],[/\\./u,"string.escape.invalid"],[/"/u,"string","@pop"]],string_single:[[/[^\\']+/u,"string"],[/@escapes/u,"string.escape"],[/\\./u,"string.escape.invalid"],[/'/u,"string","@pop"]],string_backtick:[[/\$\{/u,{token:"delimiter.bracket",next:"@bracketCounting"}],[/[^\\`$]+/u,"string"],[/@escapes/u,"string.escape"],[/\\./u,"string.escape.invalid"],[/`/u,"string","@pop"]],bracketCounting:[[/\{/u,"delimiter.bracket","@bracketCounting"],[/\}/u,"delimiter.bracket","@pop"],{include:"common"}]}},y=class{constructor(e,r,{defaults:o,diagnosticsService:u}){this._languageId=e,this._worker=r,this._disposables=[],this._modelListeners=new Map,this._diagnosticsService=u,this._defaults=o,h().then(a=>{let d=s=>{let n=s.getLanguageId();if(n!==this._languageId)return;let c=T(()=>{this._doValidate(s,n).catch($=>{throw $})}),P=s.onDidChangeContent(c),W=s.onDidChangeAttached(c);this._modelListeners.set(s.uri.toString(),[P,W]),this._doValidate(s,n).catch(k("DiagnosticsAdapter"))},g=s=>{let n=s.uri.toString();a.setModelMarkers(s,this._languageId,[]);let c=this._modelListeners.get(n);if(c){for(;c.length;)c.pop()?.dispose();this._modelListeners.delete(n)}};this._disposables.push(a.onDidCreateModel(d)),this._disposables.push(a.onWillDisposeModel(s=>{g(s)})),this._disposables.push(a.onDidChangeModelLanguage(s=>{g(s.model),d(s.model)})),this._disposables.push(o.onDidChange(()=>{a.getModels().forEach(s=>{s.getLanguageId()===this._languageId&&(g(s),d(s))})})),this._disposables.push(o.onModelContextDidChange(s=>{a.getModels().forEach(n=>{n.getLanguageId()===this._languageId&&n.uri.toString()===s&&this._doValidate(n,this._languageId).catch(k("DiagnosticsAdapter"))})})),this._disposables.push({dispose:()=>{this._modelListeners.forEach(s=>s.forEach(n=>n.dispose())),this._modelListeners.clear()}}),a.getModels().forEach(d)})}dispose(){this._disposables.forEach(e=>e.dispose()),this._disposables=[]}async _doValidate(e,r){if(e.isAttachedToEditor())try{let o=await h(),u=await this._worker(e.uri),a=this._defaults.getApiContextForModel(e.uri),d=await u.doValidation(e.uri.toString(),a),g=d.map(s=>z(e.uri,s));this._diagnosticsService.fireDiagnosticsChange(e.uri,d),o.setModelMarkers(e,r,g)}catch(o){k("DiagnosticsAdapter")(o)}}};function N(t){switch(t){case m.Error:return p.Error;case m.Warning:return p.Warning;case m.Information:return p.Info;case m.Hint:return p.Hint;default:return p.Info}}function z(t,e){return{severity:N(e.severity),startLineNumber:e.range.start.line+1,startColumn:e.range.start.character+1,endLineNumber:e.range.end.line+1,endColumn:e.range.end.character+1,message:e.message}}function H(t){return{character:t.column-1,line:t.lineNumber-1}}function f(t){return new _(t.start.line+1,t.start.character+1,t.end.line+1,t.end.character+1)}function O(t){return{range:f(t.range),text:t.newText}}function U(t){return typeof t.insert<"u"&&typeof t.replace<"u"}function B(t){let e=l.CompletionItemKind;switch(t){case i.Text:return e.Text;case i.Method:return e.Method;case i.Function:return e.Function;case i.Constructor:return e.Constructor;case i.Field:return e.Field;case i.Variable:return e.Variable;case i.Class:return e.Class;case i.Interface:return e.Interface;case i.Module:return e.Module;case i.Property:return e.Property;case i.Unit:return e.Unit;case i.Value:return e.Value;case i.Enum:return e.Enum;case i.Keyword:return e.Keyword;case i.Snippet:return e.Snippet;case i.Color:return e.Color;case i.File:return e.File;case i.Reference:return e.Reference;case i.Folder:return e.Folder;case i.EnumMember:return e.EnumMember;case i.Constant:return e.Constant;case i.Struct:return e.Struct;case i.Event:return e.Event;case i.Operator:return e.Operator;case i.TypeParameter:return e.TypeParameter;default:return e.Property}}var I=class{constructor(e,r){this._worker=e,this._defaults=r,this.triggerCharacters=[".","("]}async provideCompletionItems(e,r){let o=await this._worker(e.uri),u=this._defaults.getApiContextForModel(e.uri),a=await o.doComplete(e.uri.toString(),H(r),u),d=e.getWordUntilPosition(r),g=new _(r.lineNumber,d.startColumn,r.lineNumber,d.endColumn),s=a.items.map(n=>{let c={label:n.label,insertText:n.insertText||n.label,sortText:n.sortText,filterText:n.filterText,detail:n.detail,range:g,kind:B(n.kind)};return n.textEdit&&(U(n.textEdit)?c.range={insert:f(n.textEdit.insert),replace:f(n.textEdit.replace)}:c.range=f(n.textEdit.range),c.insertText=n.textEdit.newText),n.additionalTextEdits&&(c.additionalTextEdits=n.additionalTextEdits.map(O)),n.insertTextFormat===F.Snippet&&(c.insertTextRules=l.CompletionItemInsertTextRule.InsertAsSnippet),n.documentation&&(typeof n.documentation=="string"?c.documentation=n.documentation:c.documentation={supportThemeIcons:!1,value:n.documentation.value,supportHtml:!0}),c});return{incomplete:a.isIncomplete,suggestions:s}}},v=class{constructor(e,r){this._worker=e,this._defaults=r}async provideDocumentFormattingEdits(e){let r=await this._worker(e.uri),o=this._defaults.getApiContextForModel(e.uri.toString());return(await r.doFormat(e.uri.toString(),o)).map(u=>({range:f(u.range),text:u.newText}))}},b=Promise.withResolvers(),w=class{constructor(e){this._defaults=e,this._worker=null,this._client=null,this._configChangeListener=this._defaults.onDidChange(()=>this.stopWorker())}dispose(){this._configChangeListener.dispose(),this.stopWorker()}stopWorker(){this._worker&&(this._worker.dispose(),this._worker=null,b=Promise.withResolvers()),this._client=null}static async waitForWorker(){return await b.promise}async _getClientProxy(){let e=await h();if(!this._client){let{languageId:r}=this._defaults,o=window.MonacoEnvironment?.getWorker;if(!o)throw new Error("MonacoEnvironment.getWorker is not configured. Call setupMonacoEnvironment(...) before creating Arcade workers.");this._worker=e.createWebWorker({worker:o("ArcadeWorker",r),host:this._defaults.workerHost}),b.resolve(this._worker),this._client=this._worker.getProxy()}return await this._client}async getLanguageServiceWorker(...e){let r=await this._getClientProxy();return await this._worker?.withSyncedResources(e),r}},E,q="quickfix",Z="arcgis.arcade-editor.ask-ai",x=new Map,C;function te(t,e){let r=typeof t=="string"?t:t.uri.toString();if(!e){x.delete(r);return}x.set(r,e)}async function j(){return C||(C=(async()=>(await h()).addCommand({id:Z,run:(...t)=>{let[,e,r]=t;if(typeof e!="string")return;let o=typeof r=="string"?r:void 0;x.get(e)?.run(o)}}))()),await C}var A=class{async provideCodeActions(e,r,o,u){let a=x.get(e.uri.toString());return{actions:a?await a.provideCodeActions({model:e,range:r,context:o,token:u}):[],dispose:()=>{}}}};async function re(...t){return await w.waitForWorker(),await new Promise((e,r)=>{if(!E){r(new Error("Arcade not registered!"));return}e(E(...t))})}var M=class{constructor(){this._onDiagnosticsChange=new S}get onDiagnosticsChange(){return this._onDiagnosticsChange.event}fireDiagnosticsChange(e,r){this._onDiagnosticsChange.fire({uri:e,diagnostics:r})}},D=new M;function ne(){return D}function se(t){j();let e=new w(t),r=async(...o)=>await e.getLanguageServiceWorker(...o);E=r,l.setMonarchTokensProvider(t.languageId,K),l.setLanguageConfiguration(t.languageId,R),l.registerCompletionItemProvider(t.languageId,new I(r,t)),l.registerDocumentFormattingEditProvider(t.languageId,new v(r,t)),l.registerCodeActionProvider(t.languageId,new A,{providedCodeActionKinds:[q]}),new y(t.languageId,r,{defaults:t,diagnosticsService:D})}export{q as a,Z as b,te as c,re as d,ne as e,se as f};