@arcgis/coding-components 5.2.0-next.93 → 5.2.0-next.94
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.
- package/dist/cdn/{J4VBP7HA.js → 3KIKNRZV.js} +1 -1
- package/dist/cdn/{CQQVSACB.js → 3XGBQPFC.js} +1 -1
- package/dist/cdn/{ADG6PXX4.js → 5R3KBYY6.js} +1 -1
- package/dist/cdn/{CVQAVENI.js → 7OM23EVO.js} +1 -1
- package/dist/cdn/{4RQ6CTEX.js → AGZBL3MZ.js} +1 -1
- package/dist/cdn/{LY5JOQB7.js → AK3ZSUQ7.js} +1 -1
- package/dist/cdn/{VZ6DLSKR.js → CLPF64WZ.js} +1 -1
- package/dist/cdn/{O5LFPM4K.js → DFRZVVZZ.js} +1 -1
- package/dist/cdn/{5K6QWS7J.js → E5HJD45C.js} +1 -1
- package/dist/cdn/{CPX3K3UL.js → EUV7H33D.js} +1 -1
- package/dist/cdn/{6O5PGCTL.js → H2CMIQ2V.js} +1 -1
- package/dist/cdn/{JHACGQHF.js → HTMNRPYU.js} +1 -1
- package/dist/cdn/{VT2O42CL.js → ILDO72KX.js} +1 -1
- package/dist/cdn/{6UXWS2RY.js → J4OHMIVH.js} +1 -1
- package/dist/cdn/{WXA37GUM.js → J6FJWQ6O.js} +1 -1
- package/dist/cdn/LEFE3FVL.js +35 -0
- package/dist/cdn/{5A6ECP7V.js → P6Q7UVSV.js} +1 -1
- package/dist/cdn/{ZXHMUT2I.js → QAMR6MWW.js} +1 -1
- package/dist/cdn/{BBERXRDY.js → VLBBZP5D.js} +1 -1
- package/dist/cdn/{3AAE55DK.js → Z7HAJ23B.js} +1 -1
- package/dist/cdn/assets/code-editor/arcade.worker.js +3392 -3375
- package/dist/cdn/index.js +1 -1
- package/dist/docs/api.json +1 -1
- package/dist/docs/docs.json +1 -1
- package/dist/docs/web-types.json +1 -1
- package/package.json +6 -6
- package/dist/cdn/BZWB7A55.js +0 -35
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import b from"./
|
|
2
|
+
import b from"./EUV7H33D.js";import a from"./STN3LSQR.js";import{j as q}from"./BHSILWSL.js";import{M as P}from"./PM4JFKBG.js";export default $arcgis.t(([B,{substitute:E},{B:F},{a:T,d:C,e:N,f:b,g:g,h:$,i:x,j:L,n:_,o:D,p:A}])=>{function w(t,e,a){return t?.[e]??a}function h(t,e,a,n){return E(w(t,e,a),n)}function K(t,e){return w(t,e?"nullable":"notnull",e?"nullable":"not nullable")}function j(t,e){return w(t,e?"yes":"no",e?"yes":"no")}function v(t){for(let e of t){if(e instanceof _)return e;if(e.isCollection&&"variables"in e){let a=v(e.variables.filter(n=>n.type!=="group"));if(a)return a}}}function V(t,e){return`${t}:${e}`}function z(t){if(t){for(let e of t)if(e.type==="dataCatalogDatastore")return e.definition}}async function U(t){let e=new B({url:t.portal.url});return await e.load(),new T({itemId:t.id,serviceUrl:t.serviceUrl,portal:e})}async function k(t){return F(t)?await U(t):t}function H(t,e,a,n){let o=`**${t}**`;return e.type&&(o+=`
|
|
3
3
|
${e.type}`),a&&(o+=`
|
|
4
4
|
${h(n,"datastoreformat","Datastore: {datastoreName}",{datastoreName:a})}`),{value:o}}function W(t,e,a){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.2/LICENSE.txt */
|
|
2
|
-
import h from"./O5LFPM4K.js";import e from"./BBERXRDY.js";import d from"./CPX3K3UL.js";import{e as se}from"./J4VBP7HA.js";import c from"./STN3LSQR.js";import b from"./7Z6G332Z.js";import"./MZMKV7FA.js";import a from"./2WB7S5TQ.js";import{a as te}from"./RQZK3XV2.js";import{a as ee}from"./L7OEI4ZV.js";import"./BHSILWSL.js";import"./J4I4EROF.js";import{a as re,b as ce,c as E}from"./VZ6DLSKR.js";import"./BZWB7A55.js";import"./XEK22IDA.js";import{a as ne}from"./CMRUQ3BN.js";import"./UFF53OEH.js";import"./NHREAORV.js";import{F as L,G as M,H as Y,I as f,L as J,M as Z,h as W,j as l,l as I,n as T,t as Q,u as X}from"./PM4JFKBG.js";import{a as G,b as g}from"./BFPEJYVB.js";import{ml as ie,pl as F,ul as ae}from"./DSQ2DQQL.js";import"./H6RQVSYM.js";export default $arcgis.t(([_e,ge,{watch:O},S,{property:c,subclass:A},{a:oe,h:$,i:N},{b:U},,,v,{a:le,b:de}])=>{var xe=W`: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}.bottom-action-bar{display:flex;.bottom-action-bar__actions{flex:1 1 auto;min-inline-size:0}}`,ue="https://services6.arcgis.com/HXHga6CfMLMBOlBX/ArcGIS/rest/services/survey123_6e349a50b4504ca6b6107216d568db5f_form/FeatureServer/0",p=(t,e)=>{G(t,"Arcade Assistant",e)},pe=["orgAiAssistantsEnabled","betaAppsAllowed","serviceUrlAvailable","userHasUseAiAssistantsPrivilege"],Se=pe,he=(t,e)=>e.every(s=>t[s]===!0),Ae=t=>{let{aiAssistantsEnabled:e}=t;return e===void 0?(p("warn","`areAiAssistantsEnabled` is not defined in the organizations settings."),!1):e},Pe=async t=>(await ge.getCredential(t,{oAuthPopupConfirmation:!1})).token,fe=async t=>{try{return!!await ge.checkSignInStatus(t)}catch{return p("warn","User is not signed in."),!1}};async function ve({portalUrl:t}){t&&p("warn","The arcadeAssistant property is deprecated. Set esriConfig.portalUrl instead of arcadeAssistant.portalUrl.");let e=t||_e.portalUrl;if(!e)return p("warn","Arcade Assistant initialization failed. Reason: missing portal url."),{shouldRender:!1};let s=e.replace(/\/sharing\/rest(\/.*)?$/iu,"").replace(/\/$/u,"");if(!await fe(s))return{shouldRender:!1};let i=await Pe(e),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}`,r=await Promise.allSettled([fetch(a,{credentials:"include"}).then(y=>y.json()),fetch(o,{credentials:"include"}).then(y=>y.json()),fetch(n,{credentials:"include"}).then(y=>y.json())]),[h,u,R]=r,P=h.status==="fulfilled"?h.value:(p("warn",`Failed to fetch selfUrl. Reason: ${h.reason}.`),{}),K=u.status==="fulfilled"?u.value:(p("warn",`Failed to fetch settingsUrl. Reason: ${u.reason}.`),{}),me=R.status==="fulfilled"?R.value:(p("warn",`Failed to fetch signinSettingsUrl. Reason: ${R.reason}.`),{});if(P.isPortal&&!$e(P.enterpriseVersion))return{shouldRender:!1};let j=P.helpBase||"";if(!K)return p("warn","Settings response is not available."),{shouldRender:!1};let B={orgAiAssistantsEnabled:Ae(K),betaAppsAllowed:me.blockBetaApps!==!0,serviceUrlAvailable:!!P?.helperServices?.aiAssistantServices?.url,userHasUseAiAssistantsPrivilege:P?.user?.privileges?.includes("portal:user:useAIAssistants")===!0};B.betaAppsAllowed||p("warn","Arcade Assistant is blocked by the organization settings. To enable it, do not block beta apps in the organization settings."),B.userHasUseAiAssistantsPrivilege||p("warn","User does not have the required privileges to use AI Assistants.");let H=he(B,Se),V=he(B,pe),q=P?.helperServices?.aiAssistantServices?.url;return q?{shouldRender:!0,portalUrl:e,availableFeatures:{codeActions:H,prompting:V},serviceUrl:q,helpBase:j,feedbackServiceUrl:ue}:{shouldRender:!0,portalUrl:e,availableFeatures:{codeActions:H,prompting:V},helpBase:j,feedbackServiceUrl:ue}}function $e(t){let e=X(t),[s,i="0"]=e.split("."),a=Number.parseInt(s,10),o=Number.parseInt(i,10);return Number.isNaN(a)||Number.isNaN(o)?!1:a>12||a===12&&o>=2}var ye=Object.defineProperty,Ee=Object.getOwnPropertyDescriptor,x=(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&&ye(e,s,a),a},be=100,b=class extends S{constructor(t){super(t),this.collectionItems=[],this.errorMessage="",this.expanded=!1,this.requestId=0,this.status="idle",this.visibleChildCount=be}};x([c()],b.prototype,"collectionItems",2);x([c()],b.prototype,"errorMessage",2);x([c()],b.prototype,"expanded",2);x([c()],b.prototype,"requestId",2);x([c()],b.prototype,"schemaValue",2);x([c()],b.prototype,"status",2);x([c()],b.prototype,"visibleChildCount",2);b=x([A("ArcadeDebuggerLazyTreeNodeState")],b);var C=class extends S{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 b;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+be))}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 r=this.nodes.get(t);!r||this.generation!==a||r.requestId!==o||(s(r,n),r.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()}};C=x([A("ArcadeDebuggerLazyTreeState")],C);var De=Object.defineProperty,we=Object.getOwnPropertyDescriptor,d=(t,e,s,i)=>{for(var a=i>1?void 0:i?we(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&&De(e,s,a),a},_=class extends S{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}get executionTiming(){return this.result?.timing}addConsoleLog(t){this.consoleLogs=[...this.consoleLogs,t]}};d([c()],_.prototype,"phase",2);d([c()],_.prototype,"mode",2);d([c()],_.prototype,"sessionId",2);d([c()],_.prototype,"result",2);d([c()],_.prototype,"consoleLogs",2);d([c()],_.prototype,"hasExecuted",2);_=d([A("ArcadeDebuggerExecutionModel")],_);var D=class extends S{constructor(t){super(t),this.editorBreakpoints=[],this.executionBreakpoints=[]}setBreakpoints(t,e){t==="editor"?this.editorBreakpoints=Array.from(new Set(e)).sort((s,i)=>s-i):this.executionBreakpoints=Array.from(new Set(e)).sort((s,i)=>s-i)}toggleBreakpoint(t,e){let s=new Set(t==="editor"?this.editorBreakpoints:this.executionBreakpoints);s.has(e)?s.delete(e):s.add(e),this.setBreakpoints(t,s)}clearBreakpoints(t){t==="editor"?this.editorBreakpoints=[]:this.executionBreakpoints=[]}syncExecutionBreakpointsFromEditor(){this.executionBreakpoints=this.editorBreakpoints}};d([c()],D.prototype,"editorBreakpoints",2);d([c()],D.prototype,"executionBreakpoints",2);D=d([A("ArcadeDebuggerSessionModel")],D);var w=class extends S{constructor(t){super(t),this.openedPanel="output",this.showPanel=!1}};d([c()],w.prototype,"openedPanel",2);d([c()],w.prototype,"showPanel",2);w=d([A("ArcadeDebuggerUiModel")],w);var k=class extends S{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([c()],k.prototype,"pausedState",2);d([c()],k.prototype,"lastPausedState",2);k=d([A("ArcadeDebuggerPausedFrameModel")],k);var m=class extends S{constructor(t){super(t),this.execution=new _,this.lazyTreeState=new C,this.pausedFrame=new k,this.previewTabsState=new U,this.session=new D,this.ui=new w}get editorBreakpoints(){return this.session.editorBreakpoints}get debuggerBreakpoints(){return this.isPaused?this.session.executionBreakpoints.map(t=>({line:t})):this.session.editorBreakpoints.map(t=>({line:t}))}get executionBreakpoints(){return this.session.executionBreakpoints}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 executionTiming(){return this.execution.executionTiming}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(t){this.session.clearBreakpoints(t)}clearForMissingTestData(){this.stopDebug({hidePanel:!0}),this.execution.hasExecuted=!1,this.execution.result=void 0}closePanel(){this.ui.showPanel=!1}completeDebug(t,e){this.execution.mode="debug",this.execution.result={resultType:"debug",result:t,...e?{timing:e}:{}},this.execution.phase="completed",this.ui.openedPanel="output",this.pausedFrame.reset(),this.resetTransientDebuggerState()}completeRun(t,e={}){this.execution.mode="run",!e.useDebugRenderer&&$(t)?this.execution.result={resultType:"run",result:t}:e.useDebugRenderer&&!$(t)&&(this.execution.result={resultType:"debug",result:t,...e.timing?{timing:e.timing}:{}}),this.execution.phase="completed",this.pausedFrame.reset(),this.ui.openedPanel="output",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("execution"),this.clearBreakpoints("editor")}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.clearBreakpoints("execution"),this.clearBreakpoints("editor"),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("editor",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.session.syncExecutionBreakpointsFromEditor(),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("editor",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 C,this.previewTabsState=new U}};d([c()],m.prototype,"execution",2);d([c()],m.prototype,"lazyTreeState",2);d([c()],m.prototype,"pausedLine",2);d([c()],m.prototype,"pausedFrame",2);d([c()],m.prototype,"previewTabsState",2);d([c()],m.prototype,"session",2);d([c()],m.prototype,"ui",2);m=d([A("ArcadeDebuggerStore")],m);var ke={glyphMargin:!0,lineNumbersMinChars:1},z=class extends Y{constructor(){super(...arguments),this._codeEditorElt=L(),this._arcadeAssistantElt=L(),this._componentReadyDefer=Promise.withResolvers(),this._disposables=[],this._editorProfilePromise=Promise.resolve(void 0),this._debuggerState=new m,this.messages=te(),this._modelId=Q(),this._openArcadeHelp=()=>{window.open(oe,"Arcade Help")},this._decorations=void 0,this._monacoEditor=ee(ne),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.editorBreakpoints.map(i=>({range:new F(i,1,i,1),options:{isWholeLine:!0,glyphMarginClassName:"arcgis-code-editor__breakpoint-glyph",stickiness:this._monacoEditor.TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges}}));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.disableAssistant=!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,disableAssistant:5,arcadeAssistant:0,externalExecutor:0}}static{this.styles=[xe]}get _canExecute(){return!!(this.testData||this.externalExecutor)}get _usesBottomExecutionDrawer(){return this._canExecute&&(this.enableDebugger||!!this.externalExecutor)}get editorInstance(){return this._codeEditorElt.value?.editorInstance}get editorOptions(){return{...ke,...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 N(e.definition,s,this.testData,{mode:"run"});return $(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=Z("./assets");le(e),await this._updateDataModelDeps(),this.manager.onLifecycle(()=>(this.hasUpdated&&this._connectMonacoCustomizations().catch(g(this)),()=>{for(this._askAiBindingKey&&(E(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")||e.has("externalExecutor"))&&this._executionContextChanged(),e.has("enableDebugger")&&!this.enableDebugger&&this._debuggerState.disableDebugger(),e.has("snippets")&&v.updateApiContextForModel(this._modelId,{snippets:this.snippets}),(e.has("arcadeAssistant")||e.has("disableAssistant"))&&this._updateArcadeAssistantRemoteState()}async loaded(){await this._connectMonacoCustomizations(),this._componentReadyDefer.resolve()}_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(r=>{this._preparingArcade||(this._diagnostics=r.diagnostics,this.arcgisDiagnosticsChange.emit(r.diagnostics))})),this._canExecute&&!this._executeScriptAction&&this._addExecuteScriptAction(),this._syncAskAiAction();let s=O(()=>this._debuggerState.editorBreakpoints,()=>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(r=>this._onEditorMouseDown(r));o&&this._disposables.push(o);let n=this.editorInstance?.onDidChangeModelContent(r=>this._onEditorModelContentChange(r));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].includes(e.target.type)||e.target.element?.classList.contains("codicon-gutter-lightbulb"))return;let s=e.target.position?.lineNumber;s&&this._debuggerState.toggleBreakpoint(s)}_onEditorModelContentChange(e){if(!this.enableDebugger||!this._debuggerState.editorBreakpoints.length||e.isFlush)return;let s=se(this._debuggerState.editorBreakpoints,e.changes);s.length===this._debuggerState.editorBreakpoints.length&&s.every((i,a)=>i===this._debuggerState.editorBreakpoints[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",stickiness:this._monacoEditor.TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges}}]):this._debuggerPausedLineDecoration=void 0}_continueDebugSession(){this._debuggerState.continueDebug()}_abortExternalExecution(){this._externalExecutionAbortController?.abort(),this._externalExecutionAbortController=void 0}_stopDebugSession(){this._abortExternalExecution(),this._debuggerState.stopDebug({hidePanel:!1})}_resetDebugSession(){this._abortExternalExecution(),this._debuggerState.resetDebug(),this._executeScript("debug").catch(g(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:r}=i;if(!n||!r)throw new Error("Missing debug execution options");return await this.externalExecutor.execute({mode:"debug",script:s,console:o,signal:a.signal,breakpoints:n,onDebugPause:r})}return await this.externalExecutor.execute({mode:"run",script:s,console:o,signal:a.signal})}catch(n){return{type:"error",value:(n instanceof Error?n:new Error(String(n))).message??"Execution failed",error:n instanceof Error?n:new Error(String(n)),compilationTime:0,executionTime:0,timeStamp:new Date}}finally{this._externalExecutionAbortController===a&&(this._externalExecutionAbortController=void 0)}}_executionContextChanged(){!this._canExecute&&this._executeScriptAction&&(this._disposeSafely(this._executeScriptAction),this._executeScriptAction=void 0),this._canExecute&&!this._executeScriptAction&&this._addExecuteScriptAction(),!this.testData&&this.enableDebugger&&this._debuggerState.clearForMissingTestData(),this._debuggerState.openedPanel==="debug-console"&&!this.enableDebugger&&this._debuggerState.closePanel(),this._debuggerState.showPanel&&this._executeScript("run").catch(g(this))}async _updateEditorProfile(){this._preparingArcade=!0;try{await v.setProfileForModel(this._modelId,this.profile,{locale:this.messages._t9nLocale,snippets:this.snippets}),this._editorProfile=v.getEditorProfileForModel(this._modelId)}catch{this._editorProfile=void 0}finally{this._editorProfilePromise=Promise.resolve(this._editorProfile),this._preparingArcade=!1}}async _updateApiLibrary(){this._apiLibrary=await v.getApiLibraryForModel(this._modelId)}_setExecutionPanel(e){this._debuggerState.setPanel(e)}async _executeScript(e){let s=this.testData,i=this.externalExecutor;if(!this._codeEditorElt.value||!s&&!i)return;let a=e==="debug"?this._debuggerState.startDebug():this._debuggerState.startRun();setTimeout(()=>{(async()=>{let o=this._codeEditorElt.value?.value??this.script,n={mode:e,console:u=>this._debuggerState.addConsoleLog(u),breakpoints:e==="debug"?this._debuggerState.debuggerBreakpoints:void 0};e==="debug"&&(n.onDebugPause=this._handleDebugPause.bind(this,a));let r,h;if(i){let u=await this._executeWithExternalExecutor(e,o,n);"result"in u?(r=u.result,h=u.timing):r=u}else if(s){let u=await this._editorProfilePromise;if(!u){this._debuggerState.fail({type:"error",value:"Missing editor profile",error:null});return}r=await N(u.definition,o,s,n)}else return;if(a===this._debuggerState.sessionId){if(e==="debug"){if($(r)){this._debuggerState.fail(r);return}this._debuggerState.completeDebug(r,h);return}if($(r))this._debuggerState.completeRun(r);else if(i){if(!h){this._debuggerState.fail({type:"error",value:"Missing execution timing",error:null});return}this._debuggerState.completeRun(r,{useDebugRenderer:!0,timing:h})}else 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(g(this))}_insertAsText(e){this._insertText(e.detail)}_insertText(e){this._codeEditorElt.value?.insertText(e).catch(g(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:[ie.F5],contextMenuGroupId:"code",contextMenuOrder:1,run:()=>{this._canExecute&&this._executeScript("run").catch(g(this))}});e&&(this._executeScriptAction=e,this._disposables.push(e))}_getAskAiBindingKey(){return ae.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:re,diagnostics:e.markers,isPreferred:!1,isAI:!1,command:{id:ce,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&&(E(this._askAiBindingKey,void 0),this._askAiBindingKey=void 0);return}this._askAiBindingKey&&this._askAiBindingKey!==e&&E(this._askAiBindingKey,void 0),E(e,{provideCodeActions:({context:s})=>this._getAskAiCodeActions(s),run:s=>{this.openArcadeAssistant({prompt:s??this.messages.askarcadeassistantprompt??"Fix the errors in my script"}).catch(g(this))}}),this._askAiBindingKey=e}_disposeSafely(e){let s=this._disposables.indexOf(e);s!==-1&&this._disposables.splice(s,1),e.dispose()}async _updateArcadeAssistantRemoteState(){let e=this.arcadeAssistant;this.disableAssistant?this._arcadeAssistantRemoteState={shouldRender:!1}:this._arcadeAssistantRemoteState=await ve(e??{}),this._syncAskAiAction()}renderMainActionBar(){return this._usesBottomExecutionDrawer||!this._canExecute?null:l`<calcite-action-bar class="main-action-bar" layout=horizontal scale=s expanded expand-toggle-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(g(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=${v.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:r=this._toggleSidePanel}){return l`<calcite-action id=${e??I} .text=${s} .textEnabled=${this.sideActionBarExpanded} .icon=${i} .active=${a} @click=${r} 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,_arcadeAssistantRemoteState:s}=this;return l`<arcgis-language-api-panel slot=side-panel class=${f(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=${f(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,profilevariables:this.messages.profilevariables}}></arcgis-editor-variables>${this.suggestions?.length&&l`<arcgis-arcade-suggestions slot=side-panel class=${f(e==="suggestions"?"":"hidden")} .closed=${e!=="suggestions"} .suggestions=${this.suggestions} @arcgisInternalItemSelected=${this._insertAsText} @arcgisInternalClosePanel=${this._closeSidePanel} data-panel-name=none></arcgis-arcade-suggestions>`||""}${s?.shouldRender&&l`<arcgis-arcade-coding-assistant slot=side-panel class=${f(e==="arcade-assistant"?"":"hidden")} .closed=${e!=="arcade-assistant"} .insertText=${this._insertText.bind(this)} .closePanel=${this._closeSidePanel} .portalUrl=${s.portalUrl} .serviceUrl=${"serviceUrl"in s?s.serviceUrl:void 0} .helpBase=${s.helpBase} .promptingEnabled=${this._canPromptWithArcadeAssistant()} .feedbackServiceUrl=${s.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(i=>l`<calcite-flow slot=side-panel class=${f(e===i.id?"":"hidden")}>${i?.useFlows?i.renderer?.({closePanel:this._toggleSidePanel,insertText:this._insertText.bind(this),closed:e!==i.id,editorRef:this.el}):l`<calcite-flow-item .heading=${i.name} heading-level=2 closable .closed=${e!==i.id} @calciteFlowItemClose=${this._toggleSidePanel} .description=${i.description}>${i.renderer?.({closePanel:this._toggleSidePanel,insertText:this._insertText.bind(this),closed:e!==i.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} .executionTiming=${this._debuggerState.executionTiming} .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;if(!e)return null;let n=s==="debug-console"?"output":s;return this.enableDebugger&&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 .outputTitle=${this.messages.output} slot=results-panel .debuggerStore=${this._debuggerState} .result=${i}></arcgis-arcade-debugger-output>`:l`<arcgis-arcade-results slot=results-panel class="bottom-results" .openedResultPanel=${n} .loading=${s==="console"&&this._debuggerState.isPaused?!1:a} .result=${this._debuggerState.runResult} .executionTiming=${this._debuggerState.executionTiming} .consoleLogs=${this._debuggerState.consoleLogs} hide-header @arcgisInternalOpenedResultPanelChange=${this._onResultPanelChange}></arcgis-arcade-results>`}renderBottomActionBar(){if(!this._usesBottomExecutionDrawer)return null;let{showPanel:e,hasExecuted:s,openedPanel:i,isDebugging:a,isPaused:o,isExecuting:n}=this._debuggerState,r=this.messages.continue??"Continue",h=this.messages.reset??"Reset",u=this.messages.stop??"Stop";return l`<div slot=bottom-action-bar class=${`main-action-bar bottom-action-bar ${e?"":"is-collapsed"}`}><calcite-action-bar class="bottom-action-bar__actions" layout=horizontal scale=s expand-toggle-disabled expanded><calcite-action-group scale=s>${this.enableDebugger&&a?l`<calcite-action id=debugger-continue-action .text=${r} icon=forward scale=s .disabled=${!o} @click=${this._continueDebugSession}></calcite-action><calcite-tooltip reference-element=debugger-continue-action placement=top><span>${r}</span></calcite-tooltip><calcite-action id=debugger-reset-action .text=${h} icon=reset scale=s @click=${this._resetDebugSession}></calcite-action><calcite-tooltip reference-element=debugger-reset-action placement=top><span>${h}</span></calcite-tooltip><calcite-action id=debugger-stop-action .text=${u} icon=circle-stop scale=s @click=${this._stopDebugSession}></calcite-action><calcite-tooltip reference-element=debugger-stop-action placement=top><span>${u}</span></calcite-tooltip>`:l`<calcite-action .text=${this.messages.run??""} text-enabled icon=play scale=s .loading=${this._preparingArcade||n} @click=${()=>{this._executeScript("run").catch(g(this))}}></calcite-action>${this.enableDebugger&&l`<calcite-action .disabled=${this._debuggerState.editorBreakpoints.length===0} .text=${this.messages.runanddebug??"Run and Debug"} text-enabled icon=debug-script scale=s .loading=${this._preparingArcade||n} @click=${()=>{this._executeScript("debug").catch(g(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")} .disabled=${this.enableDebugger&&this._debuggerState.mode==="debug"}></calcite-action>${this.enableDebugger&&l`<calcite-action .active=${i==="debug-console"&&e} .text=${this.messages.debugconsole??"Debug Console"} text-enabled scale=s icon=debug-script .disabled=${this._debuggerState.mode!=="debug"} @click=${()=>this._setExecutionPanel("debug-console")}></calcite-action>`||""}</calcite-action-group>`:null}</calcite-action-bar>${e?l`<calcite-action .text=${this.messages.close??"Close"} scale=s icon=x icon-flip-rtl @click=${this._onExecutionPanelClose} slot=actions-end></calcite-action>`:null}</div>`}render(){return l`<arcgis-code-editor-shell>${this.renderMainActionBar()}${this.renderMainPanel()}${this.renderBottomActionBar()}${this.renderResultsPanel()}${this.renderSidePanel()}${this.renderSideActionBar()}</arcgis-code-editor-shell>`}};J("arcgis-arcade-editor",z);return z},"config","identity/IdentityManager","core/reactiveUtils","core/Accessor","core/accessorSupport/decorators",a,b,c,d,e,h)
|
|
2
|
+
import h from"./DFRZVVZZ.js";import e from"./VLBBZP5D.js";import d from"./EUV7H33D.js";import{e as se}from"./3KIKNRZV.js";import c from"./STN3LSQR.js";import b from"./7Z6G332Z.js";import"./MZMKV7FA.js";import a from"./2WB7S5TQ.js";import{a as te}from"./RQZK3XV2.js";import{a as ee}from"./L7OEI4ZV.js";import"./BHSILWSL.js";import"./J4I4EROF.js";import{a as re,b as ce,c as E}from"./CLPF64WZ.js";import"./LEFE3FVL.js";import"./XEK22IDA.js";import{a as ne}from"./CMRUQ3BN.js";import"./UFF53OEH.js";import"./NHREAORV.js";import{F as L,G as M,H as Y,I as f,L as J,M as Z,h as W,j as l,l as I,n as T,t as Q,u as X}from"./PM4JFKBG.js";import{a as G,b as g}from"./BFPEJYVB.js";import{ml as ie,pl as F,ul as ae}from"./DSQ2DQQL.js";import"./H6RQVSYM.js";export default $arcgis.t(([_e,ge,{watch:O},S,{property:c,subclass:A},{a:oe,h:$,i:N},{b:U},,,v,{a:le,b:de}])=>{var xe=W`: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}.bottom-action-bar{display:flex;.bottom-action-bar__actions{flex:1 1 auto;min-inline-size:0}}`,ue="https://services6.arcgis.com/HXHga6CfMLMBOlBX/ArcGIS/rest/services/survey123_6e349a50b4504ca6b6107216d568db5f_form/FeatureServer/0",p=(t,e)=>{G(t,"Arcade Assistant",e)},pe=["orgAiAssistantsEnabled","betaAppsAllowed","serviceUrlAvailable","userHasUseAiAssistantsPrivilege"],Se=pe,he=(t,e)=>e.every(s=>t[s]===!0),Ae=t=>{let{aiAssistantsEnabled:e}=t;return e===void 0?(p("warn","`areAiAssistantsEnabled` is not defined in the organizations settings."),!1):e},Pe=async t=>(await ge.getCredential(t,{oAuthPopupConfirmation:!1})).token,fe=async t=>{try{return!!await ge.checkSignInStatus(t)}catch{return p("warn","User is not signed in."),!1}};async function ve({portalUrl:t}){t&&p("warn","The arcadeAssistant property is deprecated. Set esriConfig.portalUrl instead of arcadeAssistant.portalUrl.");let e=t||_e.portalUrl;if(!e)return p("warn","Arcade Assistant initialization failed. Reason: missing portal url."),{shouldRender:!1};let s=e.replace(/\/sharing\/rest(\/.*)?$/iu,"").replace(/\/$/u,"");if(!await fe(s))return{shouldRender:!1};let i=await Pe(e),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}`,r=await Promise.allSettled([fetch(a,{credentials:"include"}).then(y=>y.json()),fetch(o,{credentials:"include"}).then(y=>y.json()),fetch(n,{credentials:"include"}).then(y=>y.json())]),[h,u,R]=r,P=h.status==="fulfilled"?h.value:(p("warn",`Failed to fetch selfUrl. Reason: ${h.reason}.`),{}),K=u.status==="fulfilled"?u.value:(p("warn",`Failed to fetch settingsUrl. Reason: ${u.reason}.`),{}),me=R.status==="fulfilled"?R.value:(p("warn",`Failed to fetch signinSettingsUrl. Reason: ${R.reason}.`),{});if(P.isPortal&&!$e(P.enterpriseVersion))return{shouldRender:!1};let j=P.helpBase||"";if(!K)return p("warn","Settings response is not available."),{shouldRender:!1};let B={orgAiAssistantsEnabled:Ae(K),betaAppsAllowed:me.blockBetaApps!==!0,serviceUrlAvailable:!!P?.helperServices?.aiAssistantServices?.url,userHasUseAiAssistantsPrivilege:P?.user?.privileges?.includes("portal:user:useAIAssistants")===!0};B.betaAppsAllowed||p("warn","Arcade Assistant is blocked by the organization settings. To enable it, do not block beta apps in the organization settings."),B.userHasUseAiAssistantsPrivilege||p("warn","User does not have the required privileges to use AI Assistants.");let H=he(B,Se),V=he(B,pe),q=P?.helperServices?.aiAssistantServices?.url;return q?{shouldRender:!0,portalUrl:e,availableFeatures:{codeActions:H,prompting:V},serviceUrl:q,helpBase:j,feedbackServiceUrl:ue}:{shouldRender:!0,portalUrl:e,availableFeatures:{codeActions:H,prompting:V},helpBase:j,feedbackServiceUrl:ue}}function $e(t){let e=X(t),[s,i="0"]=e.split("."),a=Number.parseInt(s,10),o=Number.parseInt(i,10);return Number.isNaN(a)||Number.isNaN(o)?!1:a>12||a===12&&o>=2}var ye=Object.defineProperty,Ee=Object.getOwnPropertyDescriptor,x=(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&&ye(e,s,a),a},be=100,b=class extends S{constructor(t){super(t),this.collectionItems=[],this.errorMessage="",this.expanded=!1,this.requestId=0,this.status="idle",this.visibleChildCount=be}};x([c()],b.prototype,"collectionItems",2);x([c()],b.prototype,"errorMessage",2);x([c()],b.prototype,"expanded",2);x([c()],b.prototype,"requestId",2);x([c()],b.prototype,"schemaValue",2);x([c()],b.prototype,"status",2);x([c()],b.prototype,"visibleChildCount",2);b=x([A("ArcadeDebuggerLazyTreeNodeState")],b);var C=class extends S{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 b;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+be))}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 r=this.nodes.get(t);!r||this.generation!==a||r.requestId!==o||(s(r,n),r.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()}};C=x([A("ArcadeDebuggerLazyTreeState")],C);var De=Object.defineProperty,we=Object.getOwnPropertyDescriptor,d=(t,e,s,i)=>{for(var a=i>1?void 0:i?we(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&&De(e,s,a),a},_=class extends S{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}get executionTiming(){return this.result?.timing}addConsoleLog(t){this.consoleLogs=[...this.consoleLogs,t]}};d([c()],_.prototype,"phase",2);d([c()],_.prototype,"mode",2);d([c()],_.prototype,"sessionId",2);d([c()],_.prototype,"result",2);d([c()],_.prototype,"consoleLogs",2);d([c()],_.prototype,"hasExecuted",2);_=d([A("ArcadeDebuggerExecutionModel")],_);var D=class extends S{constructor(t){super(t),this.editorBreakpoints=[],this.executionBreakpoints=[]}setBreakpoints(t,e){t==="editor"?this.editorBreakpoints=Array.from(new Set(e)).sort((s,i)=>s-i):this.executionBreakpoints=Array.from(new Set(e)).sort((s,i)=>s-i)}toggleBreakpoint(t,e){let s=new Set(t==="editor"?this.editorBreakpoints:this.executionBreakpoints);s.has(e)?s.delete(e):s.add(e),this.setBreakpoints(t,s)}clearBreakpoints(t){t==="editor"?this.editorBreakpoints=[]:this.executionBreakpoints=[]}syncExecutionBreakpointsFromEditor(){this.executionBreakpoints=this.editorBreakpoints}};d([c()],D.prototype,"editorBreakpoints",2);d([c()],D.prototype,"executionBreakpoints",2);D=d([A("ArcadeDebuggerSessionModel")],D);var w=class extends S{constructor(t){super(t),this.openedPanel="output",this.showPanel=!1}};d([c()],w.prototype,"openedPanel",2);d([c()],w.prototype,"showPanel",2);w=d([A("ArcadeDebuggerUiModel")],w);var k=class extends S{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([c()],k.prototype,"pausedState",2);d([c()],k.prototype,"lastPausedState",2);k=d([A("ArcadeDebuggerPausedFrameModel")],k);var m=class extends S{constructor(t){super(t),this.execution=new _,this.lazyTreeState=new C,this.pausedFrame=new k,this.previewTabsState=new U,this.session=new D,this.ui=new w}get editorBreakpoints(){return this.session.editorBreakpoints}get debuggerBreakpoints(){return this.isPaused?this.session.executionBreakpoints.map(t=>({line:t})):this.session.editorBreakpoints.map(t=>({line:t}))}get executionBreakpoints(){return this.session.executionBreakpoints}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 executionTiming(){return this.execution.executionTiming}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(t){this.session.clearBreakpoints(t)}clearForMissingTestData(){this.stopDebug({hidePanel:!0}),this.execution.hasExecuted=!1,this.execution.result=void 0}closePanel(){this.ui.showPanel=!1}completeDebug(t,e){this.execution.mode="debug",this.execution.result={resultType:"debug",result:t,...e?{timing:e}:{}},this.execution.phase="completed",this.ui.openedPanel="output",this.pausedFrame.reset(),this.resetTransientDebuggerState()}completeRun(t,e={}){this.execution.mode="run",!e.useDebugRenderer&&$(t)?this.execution.result={resultType:"run",result:t}:e.useDebugRenderer&&!$(t)&&(this.execution.result={resultType:"debug",result:t,...e.timing?{timing:e.timing}:{}}),this.execution.phase="completed",this.pausedFrame.reset(),this.ui.openedPanel="output",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("execution"),this.clearBreakpoints("editor")}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.clearBreakpoints("execution"),this.clearBreakpoints("editor"),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("editor",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.session.syncExecutionBreakpointsFromEditor(),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("editor",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 C,this.previewTabsState=new U}};d([c()],m.prototype,"execution",2);d([c()],m.prototype,"lazyTreeState",2);d([c()],m.prototype,"pausedLine",2);d([c()],m.prototype,"pausedFrame",2);d([c()],m.prototype,"previewTabsState",2);d([c()],m.prototype,"session",2);d([c()],m.prototype,"ui",2);m=d([A("ArcadeDebuggerStore")],m);var ke={glyphMargin:!0,lineNumbersMinChars:1},z=class extends Y{constructor(){super(...arguments),this._codeEditorElt=L(),this._arcadeAssistantElt=L(),this._componentReadyDefer=Promise.withResolvers(),this._disposables=[],this._editorProfilePromise=Promise.resolve(void 0),this._debuggerState=new m,this.messages=te(),this._modelId=Q(),this._openArcadeHelp=()=>{window.open(oe,"Arcade Help")},this._decorations=void 0,this._monacoEditor=ee(ne),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.editorBreakpoints.map(i=>({range:new F(i,1,i,1),options:{isWholeLine:!0,glyphMarginClassName:"arcgis-code-editor__breakpoint-glyph",stickiness:this._monacoEditor.TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges}}));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.disableAssistant=!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,disableAssistant:5,arcadeAssistant:0,externalExecutor:0}}static{this.styles=[xe]}get _canExecute(){return!!(this.testData||this.externalExecutor)}get _usesBottomExecutionDrawer(){return this._canExecute&&(this.enableDebugger||!!this.externalExecutor)}get editorInstance(){return this._codeEditorElt.value?.editorInstance}get editorOptions(){return{...ke,...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 N(e.definition,s,this.testData,{mode:"run"});return $(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=Z("./assets");le(e),await this._updateDataModelDeps(),this.manager.onLifecycle(()=>(this.hasUpdated&&this._connectMonacoCustomizations().catch(g(this)),()=>{for(this._askAiBindingKey&&(E(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")||e.has("externalExecutor"))&&this._executionContextChanged(),e.has("enableDebugger")&&!this.enableDebugger&&this._debuggerState.disableDebugger(),e.has("snippets")&&v.updateApiContextForModel(this._modelId,{snippets:this.snippets}),(e.has("arcadeAssistant")||e.has("disableAssistant"))&&this._updateArcadeAssistantRemoteState()}async loaded(){await this._connectMonacoCustomizations(),this._componentReadyDefer.resolve()}_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(r=>{this._preparingArcade||(this._diagnostics=r.diagnostics,this.arcgisDiagnosticsChange.emit(r.diagnostics))})),this._canExecute&&!this._executeScriptAction&&this._addExecuteScriptAction(),this._syncAskAiAction();let s=O(()=>this._debuggerState.editorBreakpoints,()=>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(r=>this._onEditorMouseDown(r));o&&this._disposables.push(o);let n=this.editorInstance?.onDidChangeModelContent(r=>this._onEditorModelContentChange(r));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].includes(e.target.type)||e.target.element?.classList.contains("codicon-gutter-lightbulb"))return;let s=e.target.position?.lineNumber;s&&this._debuggerState.toggleBreakpoint(s)}_onEditorModelContentChange(e){if(!this.enableDebugger||!this._debuggerState.editorBreakpoints.length||e.isFlush)return;let s=se(this._debuggerState.editorBreakpoints,e.changes);s.length===this._debuggerState.editorBreakpoints.length&&s.every((i,a)=>i===this._debuggerState.editorBreakpoints[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",stickiness:this._monacoEditor.TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges}}]):this._debuggerPausedLineDecoration=void 0}_continueDebugSession(){this._debuggerState.continueDebug()}_abortExternalExecution(){this._externalExecutionAbortController?.abort(),this._externalExecutionAbortController=void 0}_stopDebugSession(){this._abortExternalExecution(),this._debuggerState.stopDebug({hidePanel:!1})}_resetDebugSession(){this._abortExternalExecution(),this._debuggerState.resetDebug(),this._executeScript("debug").catch(g(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:r}=i;if(!n||!r)throw new Error("Missing debug execution options");return await this.externalExecutor.execute({mode:"debug",script:s,console:o,signal:a.signal,breakpoints:n,onDebugPause:r})}return await this.externalExecutor.execute({mode:"run",script:s,console:o,signal:a.signal})}catch(n){return{type:"error",value:(n instanceof Error?n:new Error(String(n))).message??"Execution failed",error:n instanceof Error?n:new Error(String(n)),compilationTime:0,executionTime:0,timeStamp:new Date}}finally{this._externalExecutionAbortController===a&&(this._externalExecutionAbortController=void 0)}}_executionContextChanged(){!this._canExecute&&this._executeScriptAction&&(this._disposeSafely(this._executeScriptAction),this._executeScriptAction=void 0),this._canExecute&&!this._executeScriptAction&&this._addExecuteScriptAction(),!this.testData&&this.enableDebugger&&this._debuggerState.clearForMissingTestData(),this._debuggerState.openedPanel==="debug-console"&&!this.enableDebugger&&this._debuggerState.closePanel(),this._debuggerState.showPanel&&this._executeScript("run").catch(g(this))}async _updateEditorProfile(){this._preparingArcade=!0;try{await v.setProfileForModel(this._modelId,this.profile,{locale:this.messages._t9nLocale,snippets:this.snippets}),this._editorProfile=v.getEditorProfileForModel(this._modelId)}catch{this._editorProfile=void 0}finally{this._editorProfilePromise=Promise.resolve(this._editorProfile),this._preparingArcade=!1}}async _updateApiLibrary(){this._apiLibrary=await v.getApiLibraryForModel(this._modelId)}_setExecutionPanel(e){this._debuggerState.setPanel(e)}async _executeScript(e){let s=this.testData,i=this.externalExecutor;if(!this._codeEditorElt.value||!s&&!i)return;let a=e==="debug"?this._debuggerState.startDebug():this._debuggerState.startRun();setTimeout(()=>{(async()=>{let o=this._codeEditorElt.value?.value??this.script,n={mode:e,console:u=>this._debuggerState.addConsoleLog(u),breakpoints:e==="debug"?this._debuggerState.debuggerBreakpoints:void 0};e==="debug"&&(n.onDebugPause=this._handleDebugPause.bind(this,a));let r,h;if(i){let u=await this._executeWithExternalExecutor(e,o,n);"result"in u?(r=u.result,h=u.timing):r=u}else if(s){let u=await this._editorProfilePromise;if(!u){this._debuggerState.fail({type:"error",value:"Missing editor profile",error:null});return}r=await N(u.definition,o,s,n)}else return;if(a===this._debuggerState.sessionId){if(e==="debug"){if($(r)){this._debuggerState.fail(r);return}this._debuggerState.completeDebug(r,h);return}if($(r))this._debuggerState.completeRun(r);else if(i){if(!h){this._debuggerState.fail({type:"error",value:"Missing execution timing",error:null});return}this._debuggerState.completeRun(r,{useDebugRenderer:!0,timing:h})}else 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(g(this))}_insertAsText(e){this._insertText(e.detail)}_insertText(e){this._codeEditorElt.value?.insertText(e).catch(g(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:[ie.F5],contextMenuGroupId:"code",contextMenuOrder:1,run:()=>{this._canExecute&&this._executeScript("run").catch(g(this))}});e&&(this._executeScriptAction=e,this._disposables.push(e))}_getAskAiBindingKey(){return ae.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:re,diagnostics:e.markers,isPreferred:!1,isAI:!1,command:{id:ce,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&&(E(this._askAiBindingKey,void 0),this._askAiBindingKey=void 0);return}this._askAiBindingKey&&this._askAiBindingKey!==e&&E(this._askAiBindingKey,void 0),E(e,{provideCodeActions:({context:s})=>this._getAskAiCodeActions(s),run:s=>{this.openArcadeAssistant({prompt:s??this.messages.askarcadeassistantprompt??"Fix the errors in my script"}).catch(g(this))}}),this._askAiBindingKey=e}_disposeSafely(e){let s=this._disposables.indexOf(e);s!==-1&&this._disposables.splice(s,1),e.dispose()}async _updateArcadeAssistantRemoteState(){let e=this.arcadeAssistant;this.disableAssistant?this._arcadeAssistantRemoteState={shouldRender:!1}:this._arcadeAssistantRemoteState=await ve(e??{}),this._syncAskAiAction()}renderMainActionBar(){return this._usesBottomExecutionDrawer||!this._canExecute?null:l`<calcite-action-bar class="main-action-bar" layout=horizontal scale=s expanded expand-toggle-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(g(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=${v.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:r=this._toggleSidePanel}){return l`<calcite-action id=${e??I} .text=${s} .textEnabled=${this.sideActionBarExpanded} .icon=${i} .active=${a} @click=${r} 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,_arcadeAssistantRemoteState:s}=this;return l`<arcgis-language-api-panel slot=side-panel class=${f(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=${f(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,profilevariables:this.messages.profilevariables}}></arcgis-editor-variables>${this.suggestions?.length&&l`<arcgis-arcade-suggestions slot=side-panel class=${f(e==="suggestions"?"":"hidden")} .closed=${e!=="suggestions"} .suggestions=${this.suggestions} @arcgisInternalItemSelected=${this._insertAsText} @arcgisInternalClosePanel=${this._closeSidePanel} data-panel-name=none></arcgis-arcade-suggestions>`||""}${s?.shouldRender&&l`<arcgis-arcade-coding-assistant slot=side-panel class=${f(e==="arcade-assistant"?"":"hidden")} .closed=${e!=="arcade-assistant"} .insertText=${this._insertText.bind(this)} .closePanel=${this._closeSidePanel} .portalUrl=${s.portalUrl} .serviceUrl=${"serviceUrl"in s?s.serviceUrl:void 0} .helpBase=${s.helpBase} .promptingEnabled=${this._canPromptWithArcadeAssistant()} .feedbackServiceUrl=${s.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(i=>l`<calcite-flow slot=side-panel class=${f(e===i.id?"":"hidden")}>${i?.useFlows?i.renderer?.({closePanel:this._toggleSidePanel,insertText:this._insertText.bind(this),closed:e!==i.id,editorRef:this.el}):l`<calcite-flow-item .heading=${i.name} heading-level=2 closable .closed=${e!==i.id} @calciteFlowItemClose=${this._toggleSidePanel} .description=${i.description}>${i.renderer?.({closePanel:this._toggleSidePanel,insertText:this._insertText.bind(this),closed:e!==i.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} .executionTiming=${this._debuggerState.executionTiming} .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;if(!e)return null;let n=s==="debug-console"?"output":s;return this.enableDebugger&&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 .outputTitle=${this.messages.output} slot=results-panel .debuggerStore=${this._debuggerState} .result=${i}></arcgis-arcade-debugger-output>`:l`<arcgis-arcade-results slot=results-panel class="bottom-results" .openedResultPanel=${n} .loading=${s==="console"&&this._debuggerState.isPaused?!1:a} .result=${this._debuggerState.runResult} .executionTiming=${this._debuggerState.executionTiming} .consoleLogs=${this._debuggerState.consoleLogs} hide-header @arcgisInternalOpenedResultPanelChange=${this._onResultPanelChange}></arcgis-arcade-results>`}renderBottomActionBar(){if(!this._usesBottomExecutionDrawer)return null;let{showPanel:e,hasExecuted:s,openedPanel:i,isDebugging:a,isPaused:o,isExecuting:n}=this._debuggerState,r=this.messages.continue??"Continue",h=this.messages.reset??"Reset",u=this.messages.stop??"Stop";return l`<div slot=bottom-action-bar class=${`main-action-bar bottom-action-bar ${e?"":"is-collapsed"}`}><calcite-action-bar class="bottom-action-bar__actions" layout=horizontal scale=s expand-toggle-disabled expanded><calcite-action-group scale=s>${this.enableDebugger&&a?l`<calcite-action id=debugger-continue-action .text=${r} icon=forward scale=s .disabled=${!o} @click=${this._continueDebugSession}></calcite-action><calcite-tooltip reference-element=debugger-continue-action placement=top><span>${r}</span></calcite-tooltip><calcite-action id=debugger-reset-action .text=${h} icon=reset scale=s @click=${this._resetDebugSession}></calcite-action><calcite-tooltip reference-element=debugger-reset-action placement=top><span>${h}</span></calcite-tooltip><calcite-action id=debugger-stop-action .text=${u} icon=circle-stop scale=s @click=${this._stopDebugSession}></calcite-action><calcite-tooltip reference-element=debugger-stop-action placement=top><span>${u}</span></calcite-tooltip>`:l`<calcite-action .text=${this.messages.run??""} text-enabled icon=play scale=s .loading=${this._preparingArcade||n} @click=${()=>{this._executeScript("run").catch(g(this))}}></calcite-action>${this.enableDebugger&&l`<calcite-action .disabled=${this._debuggerState.editorBreakpoints.length===0} .text=${this.messages.runanddebug??"Run and Debug"} text-enabled icon=debug-script scale=s .loading=${this._preparingArcade||n} @click=${()=>{this._executeScript("debug").catch(g(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")} .disabled=${this.enableDebugger&&this._debuggerState.mode==="debug"}></calcite-action>${this.enableDebugger&&l`<calcite-action .active=${i==="debug-console"&&e} .text=${this.messages.debugconsole??"Debug Console"} text-enabled scale=s icon=debug-script .disabled=${this._debuggerState.mode!=="debug"} @click=${()=>this._setExecutionPanel("debug-console")}></calcite-action>`||""}</calcite-action-group>`:null}</calcite-action-bar>${e?l`<calcite-action .text=${this.messages.close??"Close"} scale=s icon=x icon-flip-rtl @click=${this._onExecutionPanelClose} slot=actions-end></calcite-action>`:null}</div>`}render(){return l`<arcgis-code-editor-shell>${this.renderMainActionBar()}${this.renderMainPanel()}${this.renderBottomActionBar()}${this.renderResultsPanel()}${this.renderSidePanel()}${this.renderSideActionBar()}</arcgis-code-editor-shell>`}};J("arcgis-arcade-editor",z);return z},"config","identity/IdentityManager","core/reactiveUtils","core/Accessor","core/accessorSupport/decorators",a,b,c,d,e,h)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import a from"./
|
|
2
|
+
import a from"./P6Q7UVSV.js";import{a as I}from"./XEK22IDA.js";import{a as h}from"./CMRUQ3BN.js";import{b as l}from"./BFPEJYVB.js";import{ll as T,xl as u}from"./DSQ2DQQL.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)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import e from"./
|
|
2
|
+
import e from"./P6Q7UVSV.js";import{a as c}from"./5HKDO4SX.js";import b from"./DFRZVVZZ.js";import a from"./VLBBZP5D.js";import{a as t}from"./CMRUQ3BN.js";import{ul as d,xl as n}from"./DSQ2DQQL.js";export default $arcgis.t(([s,{c:m},{a:a,b:p}])=>{var k=["arcade","arcgis-sql-expression","sql-layer-sql-server","sql-layer-postgres","sql-layer-bigquery"],i=new Set,u=new Map;function l(e){let r=u.get(e);return r||(r=Promise.withResolvers(),u.set(e,r)),r}function f(e){l(e).resolve()}function T(e){return k.includes(e)?l(e).promise:Promise.resolve()}function h(e,r){return()=>{i.has(e)||i.add(e),r()}}async function U(e){i.has(e)||(await t()).createModel("",e,d.parse("")).dispose()}n.register({id:s.languageId,aliases:["Arcade","arcade"],extensions:[".arc"],mimetypes:["application/arcade"]});n.onLanguage(s.languageId,h(s.languageId,()=>{m().then(e=>{e.setupMode(s),f(s.languageId)}).catch(e=>{throw e})}));n.register({id:a.languageId,aliases:["EsiSqlExpression","sql-expression"],extensions:[".sql-expression"],mimetypes:["application/sql-expression"]});n.onLanguage(a.languageId,h(a.languageId,()=>{p().then(e=>{e.setupMode(a),f(a.languageId)}).catch(e=>{throw e})}));q();function q(){t().then(e=>{["light","dark"].forEach(r=>{let g=r==="light"?"vs":"vs-dark",o=c[`${r}-theme`];e.defineTheme(g,{base:g,inherit:!0,rules:[{token:"comment.arcgis",foreground:o.comment},{token:"constant.arcgis",foreground:o.constant},{token:"keyword.arcgis",foreground:o.keyword},{token:"identifier.arcgis",foreground:o.identifier},{token:"number.arcgis",foreground:o.number},{token:"string.arcgis",foreground:o.string},{token:"operator.arcgis",foreground:o.operator},{token:"predefined.arcgis",foreground:o.predefined},{token:"date.arcgis",foreground:o.date}],colors:{}})})})}return{a:f,b:T,c:h,d:U}},a,b,e)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{a as m,b as i,c as F,g as L}from"./BZWB7A55.js";import{a as T}from"./XEK22IDA.js";import{a as h}from"./CMRUQ3BN.js";import{b as k}from"./BFPEJYVB.js";import{ll as S,pl as _,sl as p,xl as l}from"./DSQ2DQQL.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};
|
|
2
|
+
import{a as m,b as i,c as F,g as L}from"./LEFE3FVL.js";import{a as T}from"./XEK22IDA.js";import{a as h}from"./CMRUQ3BN.js";import{b as k}from"./BFPEJYVB.js";import{ll as S,pl as _,sl as p,xl as l}from"./DSQ2DQQL.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};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{jl as i,xj as l}from"./DSQ2DQQL.js";export default $arcgis.t(([d])=>{function m(){return!!window.MonacoEnvironment?.getWorker}var c="",f=new Map,u=!1;async function p(t,r,e){if(e)return r?r():new Worker(t);let s=window.location.origin;if(new URL(t,window.location.href).origin!==s){let o=await d(t,{responseType:"text"});return new Worker(URL.createObjectURL(new Blob([o.data],{type:"text/javascript"})),{type:"module"})}return new Worker(t,{type:"module"})}function E(t){if(m())return;g(),c=t;let r=`${c}/code-editor`,e={arcade:`${r}/arcade.worker.js`,"arcgis-sql-expression":`${r}/sql-expr.worker.js`,"sql-layer-sql-server":`${r}/sql-layer.worker.js`,"sql-layer-postgres":`${r}/sql-layer.worker.js`,"sql-layer-bigquery":`${r}/sql-layer.worker.js`,html:`${r}/html.worker.js`,css:`${r}/css.worker.js`,typescript:`${r}/ts.worker.js`,json:`${r}/json.worker.js`,default:`${r}/editor.worker.js`},s={arcade:{url:e.arcade},"arcgis-sql-expression":{url:e["arcgis-sql-expression"]},"sql-layer-sql-server":{url:e["sql-layer-sql-server"]},"sql-layer-postgres":{url:e["sql-layer-postgres"]},"sql-layer-bigquery":{url:e["sql-layer-bigquery"]},html:{url:e.html},css:{url:e.css},typescript:{url:e.typescript},javascript:{url:e.typescript},json:{url:e.json},default:{url:e.default}};window.MonacoEnvironment={getWorker:async(o,a)=>{let n=f.get(a);if(n)return await p(n,void 0,u);let{url:y,localWorker:q}=s[a]||s.default;return await p(y,q,u)}}}var w=!1;function g(){w||(i.get(l),w=!0)}async function L(){return(await j()).getArcadeDiagnosticService()}async function j(){return await import("./
|
|
2
|
+
import{jl as i,xj as l}from"./DSQ2DQQL.js";export default $arcgis.t(([d])=>{function m(){return!!window.MonacoEnvironment?.getWorker}var c="",f=new Map,u=!1;async function p(t,r,e){if(e)return r?r():new Worker(t);let s=window.location.origin;if(new URL(t,window.location.href).origin!==s){let o=await d(t,{responseType:"text"});return new Worker(URL.createObjectURL(new Blob([o.data],{type:"text/javascript"})),{type:"module"})}return new Worker(t,{type:"module"})}function E(t){if(m())return;g(),c=t;let r=`${c}/code-editor`,e={arcade:`${r}/arcade.worker.js`,"arcgis-sql-expression":`${r}/sql-expr.worker.js`,"sql-layer-sql-server":`${r}/sql-layer.worker.js`,"sql-layer-postgres":`${r}/sql-layer.worker.js`,"sql-layer-bigquery":`${r}/sql-layer.worker.js`,html:`${r}/html.worker.js`,css:`${r}/css.worker.js`,typescript:`${r}/ts.worker.js`,json:`${r}/json.worker.js`,default:`${r}/editor.worker.js`},s={arcade:{url:e.arcade},"arcgis-sql-expression":{url:e["arcgis-sql-expression"]},"sql-layer-sql-server":{url:e["sql-layer-sql-server"]},"sql-layer-postgres":{url:e["sql-layer-postgres"]},"sql-layer-bigquery":{url:e["sql-layer-bigquery"]},html:{url:e.html},css:{url:e.css},typescript:{url:e.typescript},javascript:{url:e.typescript},json:{url:e.json},default:{url:e.default}};window.MonacoEnvironment={getWorker:async(o,a)=>{let n=f.get(a);if(n)return await p(n,void 0,u);let{url:y,localWorker:q}=s[a]||s.default;return await p(y,q,u)}}}var w=!1;function g(){w||(i.get(l),w=!0)}async function L(){return(await j()).getArcadeDiagnosticService()}async function j(){return await import("./QAMR6MWW.js")}return{a:E,b:L,c:j}},"request")
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{b as x}from"./43C5J4GE.js";import e from"./
|
|
2
|
+
import{b as x}from"./43C5J4GE.js";import e from"./5R3KBYY6.js";import c from"./EUV7H33D.js";import{c as v}from"./3KIKNRZV.js";import a from"./STN3LSQR.js";import"./MZMKV7FA.js";import{a as S}from"./RQZK3XV2.js";import"./L7OEI4ZV.js";import"./BHSILWSL.js";import"./J4I4EROF.js";import"./LEFE3FVL.js";import"./XEK22IDA.js";import"./CMRUQ3BN.js";import"./UFF53OEH.js";import"./NHREAORV.js";import{F as _,G as b,H as u,I as f,L as E,h as g,j as o,n as d,t as m}from"./PM4JFKBG.js";import{b as r}from"./BFPEJYVB.js";import"./DSQ2DQQL.js";import"./H6RQVSYM.js";export default $arcgis.t(([{E:n},{c:c},{a:$,b:y,c:I,d:P}])=>{var B=g`:host{height:100%}calcite-tooltip:not([calcite-hydrated])>*{display:none}`,h=class extends u{constructor(){super(...arguments),this._codeEditorElt=_(),this._disposables=[],this._modelId=m(),this.messages=S(),this._preparing=!1,this._resolvedLanguage=c,this.sideActionBarExpanded=!1,this.script="",this.hideSideBar=!1,this.openedSidePanel="none",this.arcgisDiagnosticsChange=d({bubbles:!1}),this.arcgisScriptChange=d({bubbles:!1})}static{this.properties={_editorProfile:16,_preparing:16,_resolvedLanguage:16,sideActionBarExpanded:16,profile:0,script:1,hideSideBar:5,messageOverrides:0,openedSidePanel:3,editorOptions:0,editorInstance:32}}static{this.styles=[B]}get editorInstance(){return this._codeEditorElt.value?.editorInstance}async setFocus(){await this._codeEditorElt.value?.setFocus()}async load(){await this._updateDataModelDeps().catch(r(this))}willUpdate(e){e.has("profile")&&this._updateDataModelDeps().catch(r(this))}async loaded(){let e=x();this._disposables.push(e.onDiagnosticsChange(t=>{t.uri.toString()===this._modelId&&!this._preparing&&this.arcgisDiagnosticsChange.emit(t.diagnostics)}))}disconnectedCallback(){for(super.disconnectedCallback();this._disposables.length;)this._disposables.pop()?.dispose();P().forEach(e=>e.disposeForModel(this._modelId))}async _updateDataModelDeps(){this._preparing=!0;try{let e=await $(this.profile);e!==this._resolvedLanguage&&(I(this._resolvedLanguage)?.disposeForModel(this._modelId),this._resolvedLanguage=e);let t=y(this._resolvedLanguage);await t.setProfileForModel(this._modelId,this.profile,{locale:this.messages._t9nLocale}),this._editorProfile=t.getEditorProfileForModel(this._modelId)}catch{this._editorProfile=void 0,this._resolvedLanguage=c}finally{this._preparing=!1}}_toggleSideActionBarExpanded(){this.sideActionBarExpanded=!this.sideActionBarExpanded}_toggleSidePanel(e){this.openedSidePanel=this.openedSidePanel===e?"none":e}_onCodeEditorValueChange(e){e.stopPropagation(),this.script=e.detail,this.arcgisScriptChange.emit(e.detail)}async _onItemSelected(e){e.stopPropagation();let t=this._getSelectedTableVariable(e.detail);if(!t){this._codeEditorElt.value?.insertText(e.detail).catch(r(this));return}await t.loadSource();let a,p=t.fieldInfos.filter(i=>i.type==="geometry"&&!a?(a=i.name,!0):i.type!=="geometry").map(i=>i.name).filter(Boolean),C=`select ${p.length?p.join(", "):"*"} from ${t.snippet}`,s=this._codeEditorElt.value?.editorInstance;v(s,C,"replace",""),s?.getAction("editor.action.formatDocument")?.run();let l=s?.getModel();if(l){let i=l.getLineCount(),L=l.getLineMaxColumn(i);s?.setPosition({lineNumber:i,column:L})}}_getTablesVariable(){return this._editorProfile?.variables.find(n)}_getSelectedTableVariable(e){let t=this._getTablesVariable();if(n(t))return t.tableVariables.find(a=>a.snippet===e)}render(){let e=this._getTablesVariable(),t=String(this.messages.placeholderexample??"Example: {sqlQueryExample}").replace("{sqlQueryExample}","select field1, field2 from db.dataset"),a=`${this.messages.placeholder??"Start filtering data using SQL query syntax"}
|
|
3
3
|
${t}`;return o`<arcgis-code-editor-shell><arcgis-code-editor slot=editor .language=${this._resolvedLanguage} .modelId=${this._modelId} .value=${this.script??""} @arcgisValueChange=${this._onCodeEditorValueChange} .editorOptions=${{placeholder:a,...this.editorOptions}} ${b(this._codeEditorElt)}></arcgis-code-editor>${!this.hideSideBar&&o`<arcgis-editor-variables slot=side-panel .variable=${e} .heading=${this.messages.tables??"Tables"} .messageOverrides=${{profileempty:this.messages.profileempty}} .closed=${this.openedSidePanel!=="variables"} class=${f(this.openedSidePanel==="variables"?"":"hidden")} .loading=${this._preparing} .modelId=${this._modelId} @arcgisInternalItemSelected=${this._onItemSelected} @arcgisInternalClosePanel=${()=>{this.openedSidePanel="none"}} data-panel-name=none></arcgis-editor-variables><calcite-action-bar slot=side-action-bar .expanded=${this.sideActionBarExpanded} position=end @calciteActionBarToggle=${this._toggleSideActionBarExpanded}><calcite-action id=tables-action .text=${this.messages.tables??"Tables"} icon=table .active=${this.openedSidePanel==="variables"} data-panel-name=variables @click=${()=>this._toggleSidePanel("variables")}></calcite-action>${!this.sideActionBarExpanded&&o`<calcite-tooltip reference-element=tables-action><span>${this.messages.tables??"Tables"}</span></calcite-tooltip>`||""}</calcite-action-bar>`||""}</arcgis-code-editor-shell>`}};E("arcgis-sql-layer-editor",h);return h},a,c,e)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{b as Se}from"./
|
|
2
|
+
import{b as Se}from"./3KIKNRZV.js";import a from"./STN3LSQR.js";import{a as k,b as Fe,c as W,d as w,e as D}from"./MZMKV7FA.js";import{k as N}from"./BHSILWSL.js";import{b as M,c as E,d as $,e as De}from"./LEFE3FVL.js";import{a as Ce}from"./CMRUQ3BN.js";import{M as oe,s as ae,v as A}from"./PM4JFKBG.js";import{a as h}from"./BFPEJYVB.js";import{ll as B,ul as H}from"./DSQ2DQQL.js";export default $arcgis.t(([Ve,Ae,Ne,K,{getDeclaredVoxelMembers:Oe,getDeclaredPixelMembers:qe},Ue,Re,{A:R,B:g,F:ge,H:G,I:we,a:O,b:ne,c:le,d:pe,e:ce,k:q,l:x,m:he,o:d,p:ue,q:de,r:P,s:U,t:b,u:fe,v:_e,w:me,y:ye,z:be}])=>{var S=s=>s!==void 0,m=s=>s!==null;function Ge(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:Ge(e.type),serverType:e.type,nullable:e.nullable}))}}function ve(s){return typeof s?.query=="object"&&s.query?s.query:{}}var j=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 Ue("portal:invalid-parameter",'The "tableName" parameter must be provided.');let i=await this.portal.request(z(this._datastoreUrl,"tableDescription"),{...this._createRequestOptions(t),query:{...ve(this._requestOptions),...ve(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 We={id:"ansi",keywords:[],functions:[],operators:[],specialChars:{likeWildcardAny:"%",likeWildcardOne:"_",identifierQuote:{start:'"',end:'"'},escapeKey:{start:null,end:null},escapeClause:{keyword:"ESCAPE",suffix:null}}},Ie=new Map,Be={ansi:async()=>await Promise.resolve(We),bigquery:async()=>(await import("./XG3S7JQW.js")).bigqueryDialect,postgres:async()=>(await import("./U2T7AGOO.js")).postgresDialect,sqlServer:async()=>(await import("./UZD32YRD.js")).sqlServerDialect,oracle:async()=>(await import("./TUQPDQ74.js")).oracleDialect};async function He(s){let e=Ie.get(s);if(e)return await e;let t=Be[s]();return Ie.set(s,t),await t}var ze=["WITH","SELECT","FROM","WHERE","GROUP","BY","HAVING","ORDER","OFFSET","FETCH","FIRST","NEXT","ROW","ROWS","ONLY","LIMIT","DISTINCT","AS","JOIN","LEFT","RIGHT","FULL","INNER","OUTER","CROSS","ON","USING","AND","OR","NOT","IN","IS","LIKE","ESCAPE","BETWEEN","NULL","TRUE","FALSE","DATE","TIMESTAMP","CASE","WHEN","THEN","ELSE","END","ASC","DESC"],Ke=["<=",">=","<>","!=","=","<",">","+","-","*","/","%","||"],je=(s,e={})=>{let t=new Set(e.baseKeywords??ze);for(let r of s.keywords)t.add(r.toUpperCase());let i=new Set(e.baseOperators??Ke);for(let r of s.operators)i.add(r);return{keywords:Array.from(t),functions:s.functions,operators:Array.from(i),specialChars:s.specialChars}},u={sqlServer:"sql-layer-sql-server",postgres:"sql-layer-postgres",bigquery:"sql-layer-bigquery",oracle:"sql-layer-oracle"},Te=u.postgres,Qe={[u.sqlServer]:"sqlServer",[u.postgres]:"postgres",[u.bigquery]:"bigquery",[u.oracle]:"oracle"};function Je(s){return Qe[s]}async function Xe(s){return je(await He(Je(s)))}var Ye=/^[A-Za-z_][A-Za-z0-9_$]*$/u;function Ze(s){return s==="esriDBMS_PostgreSQL"?Te:s==="esriDBMS_SQLServer"?u.sqlServer:s==="esriDBMS_BigQuery"?u.bigquery:s==="esriDBMS_Oracle"?u.oracle:Te}function At(s){return s.trim().toLowerCase()}function et(s){return s.specialChars.identifierQuote}function tt(s,e){let t=s.trim();return t?Ye.test(t)?e.keywords.includes(t.toUpperCase()):!0:!1}function $e(s,e){let t=s.trim();if(!t||!tt(t,e))return t;let i=et(e),r=t.replaceAll(i.end,`${i.end}${i.end}`);return`${i.start}${r}${i.end}`}function it(s,e){return s.split(".").map(t=>$e(t,e)).join(".")}function Nt(s){return s.split(".").at(-1)??s}function rt(s){return Xe(Ze(s))}async function st(s,e){let t=new K({url:`${s.url}/${e.relatedTableId}`});return await t.load(),t}function ie(s){return(e,t)=>{if(e.type==="oid")return-1;if(t.type==="oid")return 1;if(b(s)){if(e.name===s.subtypeField)return-1;if(t.name===s.subtypeField)return 1}if(P(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 xe(s,e){return s?.every(t=>t.domains?.[e.name]?.type==="inherited")??!1}var at=/^[a-z_$][a-z0-9_$]*$/giu;function re(s,e=!0){return s.match(at)?`${e?".":""}${s}`:`["${s}"]`}function Le(s,e){return s?`${s}${re(e)}`:e}function Pe(s){return _e(s)?s.portalItem:null}function ot(s,e){return e?s?.nullable??"nullable":s?.notnull??"not nullable"}function Ot(s,e,t){let{includeAliases:i=!1,supportGeometryFields:r=!1}=t??{},a=e,n=[],_=[];return w(s,{supportGeometry:r}).forEach(o=>{a&&(a+=`
|
|
3
3
|
|
|
4
4
|
`),a+=`**${o.name}** (${o.alias})
|
|
5
5
|
${o.type}`,o.description&&(a+=`
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{a as v}from"./JVCH3VYC.js";import{b,c as r,d as _}from"./O5VTBJWD.js";import{a as f}from"./
|
|
2
|
+
import{a as v}from"./JVCH3VYC.js";import{b,c as r,d as _}from"./O5VTBJWD.js";import{a as f}from"./3KIKNRZV.js";import{a as p}from"./RQZK3XV2.js";import"./L7OEI4ZV.js";import{e as h,f as m}from"./BHSILWSL.js";import"./J4I4EROF.js";import"./LEFE3FVL.js";import"./CMRUQ3BN.js";import"./UFF53OEH.js";import"./NHREAORV.js";import{G as c,H as d,L as u,h as g,j as s,l,n as a}from"./PM4JFKBG.js";import"./BFPEJYVB.js";import"./DSQ2DQQL.js";import"./H6RQVSYM.js";function S(o){return!Array.isArray(o)||!o.length?!1:Array.isArray(o[0].suggestions)}var $=g`: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}code{font-family:var(--calcite-code-family)}pre{direction:ltr;overflow-x:auto;background-color:var(--calcite-color-foreground-2);padding:var(--calcite-spacing-sm);code{font-size:var(--calcite-font-size--2)}}}calcite-list-item-group{background-color:var(--calcite-color-foreground-2)}calcite-flow{[slot=footer]{word-break:break-word}}}`,n=class extends d{constructor(){super(...arguments),this._beforeBack=async()=>{this._selectedSuggestion=void 0},this.messages=p(),this._colorizeStyle="",this._filterValue="",this.closed=!1,this.arcgisInternalClosePanel=a({bubbles:!1,composed:!1}),this.arcgisInternalItemSelected=a({bubbles:!1,composed:!1})}static{this.properties={_colorizeStyle:16,_filterValue:16,_selectedSuggestion:16,suggestions:0,closed:5}}static{this.styles=$}load(){this._colorizeStyle=r(),this._themeChangedListener=_(()=>this._colorizeStyle=r())}willUpdate(e){e.has("suggestions")&&this.suggestionsPropChanged()}disconnectedCallback(){super.disconnectedCallback(),this._flowObserver?.disconnect(),this._themeChangedListener?.dispose()}suggestionsPropChanged(){this._selectedSuggestion=void 0}flowFocusHandler(e){if(!e){this._flowObserver?.disconnect(),this._flowObserver=void 0;return}this._flowObserver||(this._flowObserver=new MutationObserver(()=>{m(e.querySelector("calcite-flow-item:last-child"),"calcite-input")}),this._flowObserver.observe(e,{attributes:!0,attributeFilter:["id"],childList:!0}))}_updateFilterValue(e){this._filterValue=e.currentTarget?.value??""}_emitItemSelected(e,t){let i=e;(!i.key||i.key==="Enter")&&(e.preventDefault(),this.arcgisInternalItemSelected.emit(t.code))}_showSuggestionDetail(e,t){e.stopPropagation(),this._selectedSuggestion=t}_emitClose(){this.arcgisInternalClosePanel.emit()}_colorizeCode(e){e!==void 0&&b(e,this._selectedSuggestion.code,"arcade")}renderSuggestionGroups(){return this.suggestions===void 0?null:S(this.suggestions)?this.suggestions.map(e=>s`<calcite-list-item-group .heading=${e.label}>${this.renderSuggestionListItems(e.suggestions)}</calcite-list-item-group>`):this.renderSuggestionListItems(this.suggestions)}renderSuggestionListItems(e){return e=f(e,"label",this._filterValue),e.length?e.map(t=>s`<calcite-list-item .label=${t.label} .description=${t.description} @calciteListItemSelect=${i=>this._emitItemSelected(i,t)} @keydown=${i=>this._emitItemSelected(i,t)} data-item=${t??l}><calcite-action slot=actions-end .text=${this.messages.expand??""} scale=s icon=chevron-right icon-flip-rtl @click=${i=>this._showSuggestionDetail(i,t)} data-item=${t??l}></calcite-action></calcite-list-item>`):s`<div class="notice-container">${this.messages.noitems}</div>`}renderSuggestionFlowItem(){let e=this._selectedSuggestion;return e?s`<calcite-flow-item heading-level=2 .heading=${this.messages.suggestions} closable @calciteFlowItemClose=${this._emitClose} .beforeBack=${this._beforeBack} selected><calcite-button width=half slot=footer appearance=outline kind=brand icon-start=code scale=s @click=${t=>this._emitItemSelected(t,e)} data-item=${e??l} ${c(h)}>${this.messages.insert}</calcite-button><calcite-block open .heading=${e.label} .description=${e.description}><div .innerHTML=${v(e.documentation)??""}></div><pre><code ${c(this._colorizeCode)}></code></pre></calcite-block></calcite-flow-item>`:null}render(){return this.closed?null:s`<style>${this._colorizeStyle}</style><calcite-flow ${c(this.flowFocusHandler)}><calcite-flow-item heading-level=2 .heading=${this.messages.suggestions} closable @calciteFlowItemClose=${this._emitClose} .selected=${!this._selectedSuggestion}><calcite-input .value=${this._filterValue} icon=magnifying-glass clearable @calciteInputInput=${this._updateFilterValue} class="sticky" scale=m></calcite-input><calcite-list .label=${this.messages.suggestions??"Suggestions"}>${this.renderSuggestionGroups()}</calcite-list></calcite-flow-item>${this.renderSuggestionFlowItem()}</calcite-flow>`}};u("arcgis-arcade-suggestions",n);export{n as ArcgisArcadeSuggestions};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import j from"./
|
|
2
|
+
import j from"./AGZBL3MZ.js";import i from"./P6Q7UVSV.js";import f from"./EUV7H33D.js";import"./3KIKNRZV.js";import b from"./STN3LSQR.js";import"./MZMKV7FA.js";import{a as _}from"./RQZK3XV2.js";import"./L7OEI4ZV.js";import"./BHSILWSL.js";import"./J4I4EROF.js";import"./LEFE3FVL.js";import"./XEK22IDA.js";import"./CMRUQ3BN.js";import"./UFF53OEH.js";import"./NHREAORV.js";import{F as l,G as h,H as p,I as r,L as g,h as c,j as e,n as o,t as d}from"./PM4JFKBG.js";import{b as a}from"./BFPEJYVB.js";import"./DSQ2DQQL.js";import"./H6RQVSYM.js";export default $arcgis.t(([,,{a:s},{b:m}])=>{var f=c`:host{height:100%}calcite-tooltip:not([calcite-hydrated])>*{display:none}`,n=class extends p{constructor(){super(...arguments),this._codeEditorElt=l(),this._disposables=[],this.messages=_(),this._modelId=d(),this._preparing=!1,this.sideActionBarExpanded=!1,this.script="",this.hideSideBar=!1,this.hideDescriptionsInFieldsPanel=!1,this.arcgisDiagnosticsChange=o({bubbles:!1}),this.arcgisScriptChange=o({bubbles:!1})}static{this.properties={_activeAction:16,_apiLibrary:16,_editorProfile:16,_preparing:16,sideActionBarExpanded:16,profile:0,script:1,hideSideBar:5,messageOverrides:0,hideDescriptionsInFieldsPanel:5}}static{this.styles=[f]}async setFocus(){await this._codeEditorElt.value?.setFocus()}async load(){await this._updateEditorProfile().catch(a(this))}willUpdate(i){(i.has("messages")||i.has("profile"))&&this._updateDataModelDeps()}async loaded(){let i=await m();this._disposables.push(i.onDiagnosticsChange(t=>!this._preparing&&this.arcgisDiagnosticsChange.emit(t.diagnostics)))}disconnectedCallback(){for(super.disconnectedCallback();this._disposables.length;)this._disposables.pop()?.dispose()}async _updateDataModelDeps(){await this._updateEditorProfile(),await this._updateApiLibrary()}async _updateEditorProfile(){this._preparing=!0;try{await s.setProfileForModel(this._modelId,this.profile,{locale:this.messages._t9nLocale}),this._editorProfile=s.getEditorProfileForModel(this._modelId)}catch{this._editorProfile=void 0}finally{this._preparing=!1}}_setActiveAction(i){if(this._activeAction===i){this._activeAction=void 0;return}this._activeAction=i}_handleActionClick(i){let t=i.target;this._setActiveAction(t.dataset.panelName)}_insertAsSnippet(i){this._codeEditorElt.value?.insertSnippet(i.detail).catch(a(this))}_insertAsText(i){this._codeEditorElt.value?.insertText(i.detail.replaceAll('"',"'")).catch(a(this))}async _updateApiLibrary(){this._apiLibrary=await s.getApiLibraryForModel(this._modelId)}_onCodeEditorValueChange(i){i.stopPropagation(),this.script=i.detail,this.arcgisScriptChange.emit(i.detail)}_getFeatureSetVariable(){let i,t=s.getEditorProfileForModel(this._modelId);return t?.variables?.length&&t?.variables?.[0]?.type!=="featureSet"?a(this)("Encountered unexpected editor profile"):i=t?.variables?.[0],i}_toggleSideActionBarExpanded(){this.sideActionBarExpanded=!this.sideActionBarExpanded}render(){let i=this._getFeatureSetVariable();return e`<arcgis-code-editor-shell><arcgis-code-editor slot=editor language=arcgis-sql-expression .modelId=${this._modelId} .value=${this.script??""} @arcgisValueChange=${this._onCodeEditorValueChange} ${h(this._codeEditorElt)}></arcgis-code-editor>${!this.hideSideBar&&i&&e`<arcgis-editor-variables slot=side-panel .variable=${i} .hideDescriptions=${this.hideDescriptionsInFieldsPanel} .closed=${this._activeAction!=="fields"} class=${r(this._activeAction==="fields"?"":"hidden")} .loading=${this._preparing} .modelId=${this._modelId} @arcgisInternalItemSelected=${this._insertAsText} @arcgisInternalClosePanel=${()=>this._setActiveAction(void 0)} data-panel-name=none .messageOverrides=${{profileempty:this.messages.profileempty}}></arcgis-editor-variables>`||""}${!this.hideSideBar&&e`<arcgis-language-api-panel slot=side-panel class=${r(this._activeAction==="functions"?"":"hidden")} .closed=${this._activeAction!=="functions"} @arcgisInternalItemSelected=${this._insertAsSnippet} @arcgisInternalClosePanel=${()=>this._setActiveAction(void 0)} .loading=${this._preparing} .apiLibrary=${this._apiLibrary} data-panel-name=none hide-documentation-actions .languageId=${s.languageId}></arcgis-language-api-panel>`||""}${!this.hideSideBar&&e`<calcite-action-bar slot=side-action-bar .expanded=${this.sideActionBarExpanded} position=end @calciteActionBarToggle=${this._toggleSideActionBarExpanded}>${i&&e`<calcite-action id=fields-action .text=${this.messages.fields??"Fields"} icon=profile-variables .active=${this._activeAction==="fields"} data-panel-name=fields @click=${this._handleActionClick}></calcite-action>`||""}${i&&!this.sideActionBarExpanded&&e`<calcite-tooltip reference-element=fields-action><span>${this.messages.fields??"Fields"}</span></calcite-tooltip>`||""}<calcite-action id=functions-action .text=${this.messages.functions??"Functions"} icon=function .active=${this._activeAction==="functions"} data-panel-name=functions @click=${this._handleActionClick}></calcite-action>${!this.sideActionBarExpanded&&e`<calcite-tooltip reference-element=functions-action><span>${this.messages.functions??"Functions"}</span></calcite-tooltip>`||""}</calcite-action-bar>`||""}</arcgis-code-editor-shell>`}};g("arcgis-sql-expression-editor",n);return n},b,f,i,j)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{a as n}from"./JVCH3VYC.js";import{a as g}from"./
|
|
2
|
+
import{a as n}from"./JVCH3VYC.js";import{a as g}from"./3KIKNRZV.js";import{a as f}from"./RQZK3XV2.js";import"./L7OEI4ZV.js";import{e as p,f as u}from"./BHSILWSL.js";import"./J4I4EROF.js";import"./LEFE3FVL.js";import{G as a,H as m,L as h,h as d,j as l,n as c,s as o}from"./PM4JFKBG.js";import"./BFPEJYVB.js";import"./H6RQVSYM.js";var b=d`: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)}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}}.container{block-size:100%;display:grid;grid-template-rows:auto 1fr;overflow:hidden}.scrollable{min-block-size:0;overflow:auto}}`,r=class extends m{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?l`<calcite-list-item-group .heading=${e.title}>${i.map(t=>l`<calcite-list-item .label=${o(t.completion.detail)} @calciteListItemSelect=${s=>this._emitItemSelected(s,t)} @keydown=${s=>this._emitItemSelected(s,t)}><calcite-action slot=actions-end .text=${this.messages.expand??""} icon=chevron-right icon-flip-rtl scale=s @click=${s=>this._selectItem(s,t)}></calcite-action></calcite-list-item>`)}</calcite-list-item-group>`:null}renderApiItemFlowItem(){let e=this._selectedApiItem;return e?l`<calcite-flow-item heading-level=2 .heading=${this.messages.constantsandfunctions} .beforeBack=${this._unselectItem} closable @calciteFlowItemClose=${this._emitClose} selected>${this.hideDocumentationActions?null:l`<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?l`<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 l`<calcite-flow ${a(this.flowFocusHandler)}><calcite-flow-item heading-level=2 .heading=${this.messages.constantsandfunctions} closable @calciteFlowItemClose=${this._emitClose} .selected=${!this._selectedApiItem}><div class="container"><calcite-input .value=${this._filterValue} icon=magnifying-glass clearable @calciteInputInput=${this._updateFilterValue} scale=m></calcite-input><div class="scrollable">${this.loading?l`<calcite-loader scale=s type=indeterminate .label=${this.messages.loading??"Loading"}></calcite-loader>`:l`<calcite-list .label=${this.messages.api??"API"}>${i?l`<div class="notice-container">${this.messages.noitems}</div>`:e}</calcite-list>`}</div></div></calcite-flow-item>${this.renderApiItemFlowItem()}</calcite-flow>`}};h("arcgis-language-api-panel",r);export{r as ArcgisLanguageApiPanel};
|